Support custom textures installed as /textures/all/*.png
authorPerttu Ahola <celeron55@gmail.com>
Sat, 7 Apr 2012 07:43:06 +0000 (10:43 +0300)
committerPerttu Ahola <celeron55@gmail.com>
Sat, 7 Apr 2012 07:43:06 +0000 (10:43 +0300)
CMakeLists.txt
src/tile.cpp
textures/all/textures_here.txt [new file with mode: 0644]

index 29882500c18b80d94f653666c48c26f99be4827b..027a710b6c76c58cf1e65defbdb9e1c1d510f380 100644 (file)
@@ -104,6 +104,7 @@ if(BUILD_CLIENT)
 endif()
 if(RUN_IN_PLACE)
        install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/mods/minetest/mods_here.txt" DESTINATION "${SHAREDIR}/mods/minetest")
+       install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/textures/all/textures_here.txt" DESTINATION "${SHAREDIR}/textures/all")
 endif()
 
 install(FILES "README.txt" DESTINATION "${DOCDIR}")
index 25f8a000bd72b1886a218e329948a510e5b55ce3..73c286fb3e3488cccc66ba22aae5aa9e758112bf 100644 (file)
@@ -131,6 +131,18 @@ std::string getTexturePath(const std::string &filename)
                fullpath = getImagePath(testpath);
        }
        
+       /*
+               Check from $user/textures/all
+       */
+       if(fullpath == "")
+       {
+               std::string texture_path = porting::path_user + DIR_DELIM
+                               + "textures" + DIR_DELIM + "all";
+               std::string testpath = texture_path + DIR_DELIM + filename;
+               // Check all filename extensions. Returns "" if not found.
+               fullpath = getImagePath(testpath);
+       }
+
        /*
                Check from default data directory
        */
diff --git a/textures/all/textures_here.txt b/textures/all/textures_here.txt
new file mode 100644 (file)
index 0000000..3794085
--- /dev/null
@@ -0,0 +1 @@
+If you haven't modified the texture_path setting, you can copy textures of your texture packs into here. Folders are currently not supported.