Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Wilkins <Jason.A.Wilkins@gmail.com>2010-07-20 06:18:10 +0400
committerJason Wilkins <Jason.A.Wilkins@gmail.com>2010-07-20 06:18:10 +0400
commit80e63236464a7e864c45e163dd059ffe61735926 (patch)
tree4fb120608572fd4a3126838be24253e68bf1e693 /source/blender/blenkernel/intern/brush.c
parent1033b60824c291089e568e1b20b8b1a734cb28e1 (diff)
* Images for brush icons are now reloaded when they are needed from an external file
* First, try to load the file from the given filename. This is either absolute or relative to the current .blend * If file is found using the given filename directly then look for the file in the datafiles/brushicons directory (local, user, or system). * Note: This commit does not update the .blend to reference the default icons * Note: This commit does not make sure that the build system copies the default icons to the 2.52/datafiles/brushicons directory
Diffstat (limited to 'source/blender/blenkernel/intern/brush.c')
-rw-r--r--source/blender/blenkernel/intern/brush.c33
1 files changed, 31 insertions, 2 deletions
diff --git a/source/blender/blenkernel/intern/brush.c b/source/blender/blenkernel/intern/brush.c
index c47f5a3ddba..cea9ba32160 100644
--- a/source/blender/blenkernel/intern/brush.c
+++ b/source/blender/blenkernel/intern/brush.c
@@ -132,8 +132,6 @@ Brush *copy_brush(Brush *brush)
if(brush->mtex.tex) id_us_plus((ID*)brush->mtex.tex);
- if(brush->image_icon) id_us_plus((ID*)brush->image_icon);
-
brushn->curve= curvemapping_copy(brush->curve);
/* enable fake user by default */
@@ -205,6 +203,37 @@ void make_local_brush(Brush *brush)
}
}
+/* image icon function */
+Image* get_brush_icon(Brush *brush)
+{
+
+ if (!(brush->image_icon) && brush->image_icon_path[0]) {
+ // first use the path directly to try and load the file
+ brush->image_icon= BKE_add_image_file(brush->image_icon_path, 1);
+
+ // otherwise lets try to find it in other directories
+ if (!(brush->image_icon)) {
+ char path[240];
+ char *folder;
+
+ folder= BLI_get_folder(BLENDER_DATAFILES, "brushicons");
+
+ path[0] = 0;
+
+ BLI_make_file_string(G.sce, path, folder, brush->image_icon_path);
+
+ if (path[0])
+ brush->image_icon= BKE_add_image_file(path, 1);
+ }
+
+ // remove user count so image isn't saved on exit
+ if (brush->image_icon)
+ id_us_min((ID*)(brush->image_icon));
+ }
+
+ return brush->image_icon;
+}
+
/* Library Operations */
int brush_set_nr(Brush **current_brush, int nr, const char *name)