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:
authorNicholas Bishop <nicholasbishop@gmail.com>2010-07-26 06:35:43 +0400
committerNicholas Bishop <nicholasbishop@gmail.com>2010-07-26 06:35:43 +0400
commit5b1231849cd2f87af24d13b6631199ba28e100e6 (patch)
tree4c49be4fd703942c5ad59617ac1764b6b5880fa8 /source/blender/blenkernel
parenta27de17349f7f341e07ff2521156a444b59ba3b9 (diff)
* Factored out some duplicated code from rna_brush into paint.c, added a new function that checks whether a brush is used by that paint struct
* Fixed an improperly initialized variable in BKE_previewing_free_id * Added an RNA access function to get the icon associated with a value
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r--source/blender/blenkernel/BKE_paint.h2
-rw-r--r--source/blender/blenkernel/intern/icons.c2
-rw-r--r--source/blender/blenkernel/intern/paint.c12
3 files changed, 15 insertions, 1 deletions
diff --git a/source/blender/blenkernel/BKE_paint.h b/source/blender/blenkernel/BKE_paint.h
index f9954b3d55d..95293f16d9d 100644
--- a/source/blender/blenkernel/BKE_paint.h
+++ b/source/blender/blenkernel/BKE_paint.h
@@ -60,6 +60,8 @@ void paint_brush_slot_remove(struct Paint *p);
* however hiding faces is useful */
int paint_facesel_test(struct Object *ob);
+int paint_has_brush(struct Paint *p, struct Brush *brush);
+
/* Session data (mode-specific) */
typedef struct SculptSession {
diff --git a/source/blender/blenkernel/intern/icons.c b/source/blender/blenkernel/intern/icons.c
index c1e00e091e8..78306705d6b 100644
--- a/source/blender/blenkernel/intern/icons.c
+++ b/source/blender/blenkernel/intern/icons.c
@@ -178,7 +178,7 @@ void BKE_previewimg_free_id(ID *id)
Image *img = (Image*)id;
BKE_previewimg_free(&img->preview);
} else if (GS(id->name) == ID_BR) {
- Brush *br = (Brush*)br;
+ Brush *br = (Brush*)id;
BKE_previewimg_free(&br->preview);
}
}
diff --git a/source/blender/blenkernel/intern/paint.c b/source/blender/blenkernel/intern/paint.c
index cf5deb95258..fcbe8d65d64 100644
--- a/source/blender/blenkernel/intern/paint.c
+++ b/source/blender/blenkernel/intern/paint.c
@@ -192,3 +192,15 @@ void copy_paint(Paint *orig, Paint *new)
id_us_plus((ID *)new->brushes[i]);
}
}
+
+int paint_has_brush(Paint *p, Brush *brush)
+{
+ int i;
+
+ for (i= 0; i < p->brush_count; i++) {
+ if (strcmp(brush->id.name+2, p->brushes[i]->id.name+2) == 0)
+ return 1;
+ }
+
+ return 0;
+}