Brush/Paint internal changes
authorCampbell Barton <ideasman42@gmail.com>
Wed, 4 Aug 2010 12:18:07 +0000 (12:18 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Wed, 4 Aug 2010 12:18:07 +0000 (12:18 +0000)
- remove brush array for each Paint struct, just use a single brush pointer.
- removed rna function based template filtering.
- filter brushes using a flag on the brush and the pointer poll function.
- set the brushes using a new operator WM_OT_context_set_id().

TODO
- remake startup.blend, currently brush groupings are lost.
- rewrite WM_OT_context_set_id() to use rna introspection.

24 files changed:
release/scripts/op/wm.py
release/scripts/ui/space_view3d_toolbar.py
source/blender/blenkernel/BKE_brush.h
source/blender/blenkernel/BKE_paint.h
source/blender/blenkernel/intern/brush.c
source/blender/blenkernel/intern/paint.c
source/blender/blenloader/intern/readfile.c
source/blender/blenloader/intern/writefile.c
source/blender/editors/gpencil/gpencil_buttons.c
source/blender/editors/include/UI_interface.h
source/blender/editors/interface/interface_templates.c
source/blender/editors/sculpt_paint/paint_ops.c
source/blender/editors/sculpt_paint/sculpt.c
source/blender/editors/space_image/Makefile
source/blender/editors/space_image/image_buttons.c
source/blender/editors/space_logic/logic_window.c
source/blender/editors/space_nla/nla_buttons.c
source/blender/editors/space_node/drawnode.c
source/blender/makesdna/DNA_brush_types.h
source/blender/makesdna/DNA_scene_types.h
source/blender/makesrna/intern/rna_brush.c
source/blender/makesrna/intern/rna_define.c
source/blender/makesrna/intern/rna_sculpt_paint.c
source/blender/makesrna/intern/rna_ui_api.c

index 3b34225b7dafaea1ddfc7fcc004104177606e470..4f2ec5056ab67426d90e67e1efa2229191946a8c 100644 (file)
@@ -325,6 +325,39 @@ class WM_OT_context_cycle_enum(bpy.types.Operator):
         exec("context.%s=advance_enum" % self.properties.data_path)
         return {'FINISHED'}
 
+
+class WM_OT_context_set_id(bpy.types.Operator):
+    '''Toggle a context value.'''
+    bl_idname = "wm.context_set_id"
+    bl_label = "Set Library ID"
+    bl_options = {'UNDO'}
+
+    data_path = rna_path_prop
+    value = StringProperty(name="Value",
+            description="Assign value", maxlen=1024, default="")
+
+    def execute(self, context):
+        value = self.properties.value
+        print(value)
+
+        # TODO! highly lazy, must rewrite
+        for lib in dir(bpy.data):
+            try:
+                id_value = getattr(bpy.data, lib)[value] # bpy.data.brushes["Smooth"]
+            except:
+                id_value = None
+            
+            if id_value:
+                try:
+                    print("attempts", id_value)
+                    exec("context.%s=id_value" % self.properties.data_path)
+                    break # success
+                except:
+                    pass
+
+        return {'FINISHED'}
+
+
 doc_id = StringProperty(name="Doc ID",
         description="", maxlen=1024, default="", options={'HIDDEN'})
 
index 34132069017a7f1f5b10b284b73b24e3a10aa85d..625eae89dbe186ecde8997dd23e10659a862b0b0 100644 (file)
@@ -504,26 +504,7 @@ class VIEW3D_PT_tools_brush(PaintPanel, bpy.types.Panel):
 
         if not context.particle_edit_object:
             col = layout.split().column()
-
-            if context.sculpt_object and context.tool_settings.sculpt:
-                col.template_ID_preview(settings, "brush", new="brush.add", filter="is_sculpt_brush", rows=3, cols=8)
-            elif context.texture_paint_object and context.tool_settings.image_paint:
-                col.template_ID_preview(settings, "brush", new="brush.add", filter="is_imapaint_brush", rows=3, cols=8)
-            elif context.vertex_paint_object and context.tool_settings.vertex_paint:
-                col.template_ID_preview(settings, "brush", new="brush.add", filter="is_vpaint_brush", rows=3, cols=8)
-            elif context.weight_paint_object and context.tool_settings.weight_paint:
-                col.template_ID_preview(settings, "brush", new="brush.add", filter="is_wpaint_brush", rows=3, cols=8)
-            else:
-                row = col.row()
-
-                if context.sculpt_object and brush:
-                    defaultbrushes = 8
-                elif context.texture_paint_object and brush:
-                    defaultbrushes = 4
-                else:
-                    defaultbrushes = 7
-
-                row.template_list(settings, "brushes", settings, "active_brush_index", rows=2, maxrows=defaultbrushes)
+            col.template_ID_preview(settings, "brush", new="brush.add", rows=3, cols=8)
 
         # Particle Mode #
 
@@ -865,6 +846,12 @@ class VIEW3D_PT_tools_brush_tool(PaintPanel, bpy.types.Panel):
         elif context.vertex_paint_object or context.weight_paint_object:
             col.prop(brush, "vertexpaint_tool", expand=False, text="")
 
+        row = layout.row(align=True)
+        row.prop(brush, "use_paint_sculpt", text="", icon='SCULPTMODE_HLT')
+        row.prop(brush, "use_paint_vertex", text="", icon='VPAINT_HLT')
+        row.prop(brush, "use_paint_weight", text="", icon='WPAINT_HLT')
+        row.prop(brush, "use_paint_texture", text="", icon='TPAINT_HLT')
+
 
 class VIEW3D_PT_tools_brush_stroke(PaintPanel, bpy.types.Panel):
     bl_label = "Stroke"
@@ -1191,7 +1178,8 @@ class VIEW3D_PT_tools_projectpaint(View3DPanel, bpy.types.Panel):
     bl_label = "Project Paint"
 
     def poll(self, context):
-        return context.tool_settings.image_paint.brush.imagepaint_tool != 'SMEAR'
+        brush = context.tool_settings.image_paint.brush
+        return (brush and brush.imagepaint_tool != 'SMEAR')
 
     def draw_header(self, context):
         ipaint = context.tool_settings.image_paint
index 3afcfddfea38f380395f1bf1d179e38b2bca1a49..0e406a16d0ce242cf3834d15620771ea03413811 100644 (file)
@@ -50,10 +50,7 @@ void brush_reset_sculpt(struct Brush *brush);
 struct ImBuf *get_brush_icon(struct Brush *brush);
 
 /* brush library operations used by different paint panels */
-int brush_set_nr(struct Brush **current_brush, int nr, const char *name);
 int brush_delete(struct Brush **current_brush);
-void brush_check_exists(struct Brush **brush, const char *name);
-void brush_toggled_fake_user(struct Brush *brush);
 int brush_texture_set_nr(struct Brush *brush, int nr);
 int brush_texture_delete(struct Brush *brush);
 int brush_clone_image_set_nr(struct Brush *brush, int nr);
index 95293f16d9d6487bbe3482f3efe8d8edfec6b102..20742033a2e9945bc69920f96575d0ad6e37ed47 100644 (file)
@@ -47,21 +47,17 @@ extern const char PAINT_CURSOR_TEXTURE_PAINT[3];
 
 void paint_init(struct Paint *p, const char col[3]);
 void free_paint(struct Paint *p);
-void copy_paint(struct Paint *orig, struct Paint *new);
+void copy_paint(struct Paint *src, struct Paint *tar);
 
 struct Paint *paint_get_active(struct Scene *sce);
 struct Brush *paint_brush(struct Paint *paint);
 void paint_brush_set(struct Paint *paint, struct Brush *br);
-void paint_brush_slot_add(struct Paint *p);
-void paint_brush_slot_remove(struct Paint *p);
 
 /* testing face select mode
  * Texture paint could be removed since selected faces are not used
  * 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 {
index b9d7ea177d4fee2637743a08902f6de4867617d8..905515914b437452b935166b6a009a61eea27499 100644 (file)
@@ -35,6 +35,7 @@
 #include "DNA_brush_types.h"
 #include "DNA_color_types.h"
 #include "DNA_scene_types.h"
+#include "DNA_object_types.h"
 #include "DNA_windowmanager_types.h"
 
 #include "WM_types.h"
@@ -67,6 +68,8 @@ static void brush_set_defaults(Brush *brush)
        brush->blend = 0;
        brush->flag = 0;
 
+       brush->ob_mode = (OB_MODE_SCULPT|OB_MODE_VERTEX_PAINT|OB_MODE_WEIGHT_PAINT|OB_MODE_TEXTURE_PAINT);
+
        /* BRUSH SCULPT TOOL SETTINGS */
        brush->size= 35; /* radius of the brush in pixels */
        brush->alpha= 0.5f; /* brush strength/intensity probably variable should be renamed? */
@@ -120,6 +123,9 @@ Brush *add_brush(const char *name)
 
        brush= alloc_libblock(&G.main->brush, ID_BR, name);
 
+       /* enable fake user by default */
+       brush->id.flag |= LIB_FAKEUSER;
+
        brush_set_defaults(brush);
 
        brush->sculpt_tool = SCULPT_TOOL_DRAW; /* sculpting defaults to the draw tool for new brushes */
@@ -127,10 +133,6 @@ Brush *add_brush(const char *name)
         /* the default alpha falloff curve */
        brush_curve_preset(brush, CURVE_PRESET_SMOOTH);
 
-       /* enable fake user by default */
-       brush->id.flag |= LIB_FAKEUSER;
-       brush_toggled_fake_user(brush);
-
        return brush;
 }
 
@@ -151,7 +153,7 @@ Brush *copy_brush(Brush *brush)
        /* enable fake user by default */
        if (!(brushn->id.flag & LIB_FAKEUSER)) {
                brushn->id.flag |= LIB_FAKEUSER;
-               brush_toggled_fake_user(brushn);
+               brushn->id.us++;
        }
        
        return brushn;
@@ -205,7 +207,7 @@ void make_local_brush(Brush *brush)
                /* enable fake user by default */
                if (!(brush->id.flag & LIB_FAKEUSER)) {
                        brush->id.flag |= LIB_FAKEUSER;
-                       brush_toggled_fake_user(brush);
+                       brush->id.us++;
                }
        }
        else if(local && lib) {
@@ -393,54 +395,6 @@ void brush_reset_sculpt(Brush *br)
 }
 
 /* Library Operations */
-
-int brush_set_nr(Brush **current_brush, int nr, const char *name)
-{
-       ID *idtest, *id;
-       
-       id= (ID*)(*current_brush);
-       idtest= (ID*)BLI_findlink(&G.main->brush, nr-1);
-       
-       if(idtest==0) { /* new brush */
-               if(id) idtest= (ID *)copy_brush((Brush *)id);
-               else idtest= (ID *)add_brush(name);
-               idtest->us--;
-       }
-       if(idtest!=id) {
-               brush_delete(current_brush);
-               *current_brush= (Brush *)idtest;
-               id_us_plus(idtest);
-
-               return 1;
-       }
-
-       return 0;
-}
-
-int brush_delete(Brush **current_brush)
-{
-       if (*current_brush) {
-               (*current_brush)->id.us--;
-               *current_brush= NULL;
-
-               return 1;
-       }
-
-       return 0;
-}
-
-void brush_toggled_fake_user(Brush *brush)
-{
-       ID *id= (ID*)brush;
-       if(id) {
-               if(id->flag & LIB_FAKEUSER) {
-                       id_us_plus(id);
-               } else {
-                       id->us--;
-               }
-       }
-}
-
 void brush_curve_preset(Brush *b, /*CurveMappingPreset*/int preset)
 {
        CurveMap *cm = NULL;
@@ -524,12 +478,6 @@ int brush_clone_image_delete(Brush *brush)
        return 0;
 }
 
-void brush_check_exists(Brush **brush, const char *name)
-{
-       if(*brush==NULL)
-               brush_set_nr(brush, 1, name);
-}
-
 /* Brush Sampling */
 void brush_sample_tex(Brush *brush, float *xy, float *rgba)
 {
index b58e6c459ff910397cf12f336a52ea2affaf172f..3343df6b8a7da1777211fd01ead6e9d3e4a0bb2d 100644 (file)
@@ -71,91 +71,13 @@ Paint *paint_get_active(Scene *sce)
 
 Brush *paint_brush(Paint *p)
 {
-       return p && p->brushes ? p->brushes[p->active_brush_index] : NULL;
+       return p ? p->brush : NULL;
 }
 
 void paint_brush_set(Paint *p, Brush *br)
 {
-       if(p && !br) {
-               /* Setting to NULL removes the current slot */
-               paint_brush_slot_remove(p);
-       }
-       else if(p) {
-               int found = 0;
-       
-               if(p->brushes) {
-                       int i;
-                       
-                       /* See if there's already a slot with the brush */
-                       for(i = 0; i < p->brush_count; ++i) {
-                               if(p->brushes[i] == br) {
-                                       p->active_brush_index = i;
-                                       found = 1;
-                                       break;
-                               }
-                       }
-                       
-               }
-               
-               if(!found) {
-                       paint_brush_slot_add(p);
-                       id_us_plus(&br->id);
-               }
-               
-               /* Make sure the current slot is the new brush */
-               p->brushes[p->active_brush_index] = br;
-       }
-}
-
-static void paint_brush_slots_alloc(Paint *p, const int count)
-{
-       p->brush_count = count;
-       if(count == 0)
-               p->brushes = NULL;
-       else
-               p->brushes = MEM_callocN(sizeof(Brush*) * count, "Brush slots");
-}
-
-void paint_brush_slot_add(Paint *p)
-{
-       if(p) {
-               Brush **orig = p->brushes;
-               int orig_count = p->brushes ? p->brush_count : 0;
-
-               /* Increase size of brush slot array */
-               paint_brush_slots_alloc(p, orig_count + 1);
-               if(orig) {
-                       memcpy(p->brushes, orig, sizeof(Brush*) * orig_count);
-                       MEM_freeN(orig);
-               }
-
-               p->active_brush_index = orig_count;
-       }
-}
-
-void paint_brush_slot_remove(Paint *p)
-{
-       if(p && p->brushes) {
-               Brush **orig = p->brushes;
-               int src, dst;
-               
-               /* Decrease size of brush slot array */
-               paint_brush_slots_alloc(p, p->brush_count - 1);
-               if(p->brushes) {
-                       for(src = 0, dst = 0; dst < p->brush_count; ++src) {
-                               if(src != p->active_brush_index) {
-                                       p->brushes[dst] = orig[src];
-                                       ++dst;
-                               }
-                       }
-               }
-               MEM_freeN(orig);
-
-               if(p->active_brush_index >= p->brush_count)
-                       p->active_brush_index = p->brush_count - 1;
-               if(p->active_brush_index < 0)
-                       p->active_brush_index = 0;
-       }
+       if(p)
+               p->brush= br;
 }
 
 int paint_facesel_test(Object *ob)
@@ -169,7 +91,8 @@ void paint_init(Paint *p, const char col[3])
 
        /* If there's no brush, create one */
        brush = paint_brush(p);
-       brush_check_exists(&brush, "Brush");
+       if(brush == NULL)
+               brush= add_brush("Brush");
        paint_brush_set(p, brush);
 
        memcpy(p->paint_cursor_col, col, 3);
@@ -180,28 +103,10 @@ void paint_init(Paint *p, const char col[3])
 
 void free_paint(Paint *paint)
 {
-       if(paint->brushes)
-               MEM_freeN(paint->brushes);
+       /* nothing */
 }
 
-void copy_paint(Paint *orig, Paint *new)
+void copy_paint(Paint *src, Paint *tar)
 {
-       if(orig->brushes) {
-               int i;
-               new->brushes = MEM_dupallocN(orig->brushes);
-               for(i = 0; i < orig->brush_count; ++i)
-                       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;
+       tar->brush= src->brush;
 }
index 9a81974349cf8685e839c725d2320a3514aea772..88ddca3328c321bd37ee4d2ab4a38eeac38de923 100644 (file)
@@ -4123,10 +4123,8 @@ static void composite_patch(bNodeTree *ntree, Scene *scene)
 
 static void link_paint(FileData *fd, Scene *sce, Paint *p)
 {
-       if(p && p->brushes) {
-               int i;
-               for(i = 0; i < p->brush_count; ++i)
-                       p->brushes[i]= newlibadr_us(fd, sce->id.lib, p->brushes[i]);
+       if(p && p->brush) {
+               p->brush= newlibadr_us(fd, sce->id.lib, p->brush);
        }
 }
 
@@ -4242,13 +4240,8 @@ static void link_recurs_seq(FileData *fd, ListBase *lb)
 static void direct_link_paint(FileData *fd, Paint **paint)
 {
        Paint *p;
-
+/* TODO. is this needed */
        p= (*paint)= newdataadr(fd, (*paint));
-       if(p) {
-               p->paint_cursor= NULL;
-               p->brushes= newdataadr(fd, p->brushes);
-               test_pointer_array(fd, (void**)&p->brushes);
-       }
 }
 
 static void direct_link_scene(FileData *fd, Scene *sce)
@@ -4284,9 +4277,6 @@ static void direct_link_scene(FileData *fd, Scene *sce)
                direct_link_paint(fd, (Paint**)&sce->toolsettings->vpaint);
                direct_link_paint(fd, (Paint**)&sce->toolsettings->wpaint);
 
-               sce->toolsettings->imapaint.paint.brushes= newdataadr(fd, sce->toolsettings->imapaint.paint.brushes);
-               test_pointer_array(fd, (void**)&sce->toolsettings->imapaint.paint.brushes);
-
                sce->toolsettings->imapaint.paintcursor= NULL;
                sce->toolsettings->particle.paintcursor= NULL;
        }
@@ -11117,6 +11107,12 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 
        /* put compatibility code here until next subversion bump */
        {
+               Brush *br;
+               for(br= main->brush.first; br; br= br->id.next) {
+                       if(br->ob_mode==0)
+                               br->ob_mode= (OB_MODE_SCULPT|OB_MODE_WEIGHT_PAINT|OB_MODE_TEXTURE_PAINT|OB_MODE_VERTEX_PAINT);
+               }
+               
        }
 
        /* WATCH IT!!!: pointers from libdata have not been converted yet here! */
index eab6a4c2b5559791d52800ef2c84e5756ce62493..dbe869450a5bc510a36d33b35d0a272bad99a29c 100644 (file)
@@ -1770,11 +1770,6 @@ static void write_lamps(WriteData *wd, ListBase *idbase)
        }
 }
 
-static void write_paint(WriteData *wd, Paint *p)
-{
-       if(p && p->brushes)
-               writedata(wd, DATA, p->brush_count * sizeof(Brush*), p->brushes);
-}
 
 static void write_scenes(WriteData *wd, ListBase *scebase)
 {
@@ -1809,18 +1804,15 @@ static void write_scenes(WriteData *wd, ListBase *scebase)
                writestruct(wd, DATA, "ToolSettings", 1, tos);
                if(tos->vpaint) {
                        writestruct(wd, DATA, "VPaint", 1, tos->vpaint);
-                       write_paint(wd, &tos->vpaint->paint);
                }
                if(tos->wpaint) {
                        writestruct(wd, DATA, "VPaint", 1, tos->wpaint);
-                       write_paint(wd, &tos->wpaint->paint);
                }
                if(tos->sculpt) {
                        writestruct(wd, DATA, "Sculpt", 1, tos->sculpt);
-                       write_paint(wd, &tos->sculpt->paint);
                }
 
-               write_paint(wd, &tos->imapaint.paint);
+               // write_paint(wd, &tos->imapaint.paint);
 
                ed= sce->ed;
                if(ed) {
index c1ac863b36255b429989cda51c5952c163fd5b2a..c051678b86b303f85114d8e9b53731bcdb14be3b 100644 (file)
@@ -243,7 +243,7 @@ static void draw_gpencil_panel (bContext *C, uiLayout *layout, bGPdata *gpd, Poi
        col= uiLayoutColumn(layout, 0);
                /* current Grease Pencil block */
                // TODO: show some info about who owns this?
-               uiTemplateID(col, C, ctx_ptr, "grease_pencil", "GPENCIL_OT_data_add", NULL, "GPENCIL_OT_data_unlink", NULL); 
+               uiTemplateID(col, C, ctx_ptr, "grease_pencil", "GPENCIL_OT_data_add", NULL, "GPENCIL_OT_data_unlink"); 
                
                /* add new layer button - can be used even when no data, since it can add a new block too */
                uiItemO(col, NULL, 0, "GPENCIL_OT_layer_add");
index 4b6b396483df7c1d9a10c7b613b8b74bb067c88a..93e91d025997e9638cc8ac13a51d0a3be7ef3b5a 100644 (file)
@@ -669,11 +669,11 @@ uiBlock *uiLayoutAbsoluteBlock(uiLayout *layout);
 void uiTemplateHeader(uiLayout *layout, struct bContext *C, int menus);
 void uiTemplateDopeSheetFilter(uiLayout *layout, struct bContext *C, struct PointerRNA *ptr);
 void uiTemplateID(uiLayout *layout, struct bContext *C, struct PointerRNA *ptr, char *propname,
-       char *newop, char *openop, char *unlinkop, char *filterop);
+       char *newop, char *openop, char *unlinkop);
 void uiTemplateIDBrowse(uiLayout *layout, struct bContext *C, struct PointerRNA *ptr, char *propname,
-                                 char *newop, char *openop, char *unlinkop, char *filterop);
+                                 char *newop, char *openop, char *unlinkop);
 void uiTemplateIDPreview(uiLayout *layout, struct bContext *C, struct PointerRNA *ptr, char *propname,
-       char *newop, char *openop, char *unlinkop, char *filterop, int rows, int cols);
+       char *newop, char *openop, char *unlinkop, int rows, int cols);
 void uiTemplateAnyID(uiLayout *layout, struct bContext *C, struct PointerRNA *ptr, char *propname, 
        char *proptypename, char *text);
 void uiTemplatePathBuilder(uiLayout *layout, struct bContext *C, struct PointerRNA *ptr, char *propname, 
index ec57c813e203a47589a76d1158c6488747c9df06..e2c033bd68d5435e93642925842c57e0d4a4d9a5 100644 (file)
@@ -142,8 +142,6 @@ typedef struct TemplateID {
 
        ListBase *idlb;
        int prv_rows, prv_cols;
-
-       char filterop[64];
 } TemplateID;
 
 /* Search browse menu, assign  */
@@ -173,9 +171,6 @@ static void id_search_cb(const bContext *C, void *arg_template, char *str, uiSea
        /* ID listbase */
        for(id= lb->first; id; id= id->next) {
                if(!((flag & PROP_ID_SELF_CHECK) && id == id_from)) {
-                       int filter_yes;
-
-                       filter_yes= 0;
 
                        /* use filter */
                        if(RNA_property_type(template->prop)==PROP_POINTER) {
@@ -185,43 +180,8 @@ static void id_search_cb(const bContext *C, void *arg_template, char *str, uiSea
                                        continue;
                        }
 
-                       if (template->filterop[0] != 0) {
-                               /* XXX, remove this, use pointer filtering */
-                               PointerRNA ptr;
-                               ReportList reports;
-                               FunctionRNA *func;
-                               ParameterList parms;
-
-                               RNA_id_pointer_create(id, &ptr);
-
-                               BKE_reports_init(&reports, RPT_PRINT);
-
-                               func= RNA_struct_find_function(&ptr, template->filterop);
-
-                               if (func) {
-                                       RNA_parameter_list_create(&parms, &ptr, func);
-
-                                       RNA_parameter_set_lookup(&parms, "context", &C);
-
-                                       if (RNA_function_call((bContext *)C, &reports, &ptr, func, &parms) == 0) {
-                                               int* ret;
-                                               RNA_parameter_get_lookup(&parms, "ret", (void **)&ret);
-
-                                               if (!(*ret)) {
-                                                       RNA_parameter_list_free(&parms);
-                                                       continue;
-                                               }
-                                               else {
-                                                       filter_yes= 1;
-                                               }
-                                       }
-
-                                       RNA_parameter_list_free(&parms);
-                               }
-                       }
-
                        /* hide dot-datablocks, but only if filter does not force it visible */
-                       if(!filter_yes && U.uiflag & USER_HIDE_DOT)
+                       if(U.uiflag & USER_HIDE_DOT)
                                if ((id->name[2]=='.') && (str[0] != '.'))
                                        continue;
 
@@ -392,7 +352,7 @@ static void template_id_cb(bContext *C, void *arg_litem, void *arg_event)
        }
 }
 
-static void template_ID(bContext *C, uiLayout *layout, TemplateID *template, StructRNA *type, int flag, char *newop, char *openop, char *unlinkop, char *filterop)
+static void template_ID(bContext *C, uiLayout *layout, TemplateID *template, StructRNA *type, int flag, char *newop, char *openop, char *unlinkop)
 {
        uiBut *but;
        uiBlock *block;
@@ -536,7 +496,7 @@ static void template_ID(bContext *C, uiLayout *layout, TemplateID *template, Str
        uiBlockEndAlign(block);
 }
 
-static void ui_template_id(uiLayout *layout, bContext *C, PointerRNA *ptr, char *propname, char *newop, char *openop, char *unlinkop, char* filterop, int flag, int prv_rows, int prv_cols)
+static void ui_template_id(uiLayout *layout, bContext *C, PointerRNA *ptr, char *propname, char *newop, char *openop, char *unlinkop, int flag, int prv_rows, int prv_cols)
 {
        TemplateID *template;
        PropertyRNA *prop;
@@ -555,11 +515,6 @@ static void ui_template_id(uiLayout *layout, bContext *C, PointerRNA *ptr, char
        template->prv_rows = prv_rows;
        template->prv_cols = prv_cols;
 
-       if (filterop) 
-               BLI_strncpy(template->filterop, filterop, sizeof(template->filterop));
-       else
-               template->filterop[0] = 0;
-
        if(newop)
                flag |= UI_ID_ADD_NEW;
        if(openop)
@@ -573,25 +528,25 @@ static void ui_template_id(uiLayout *layout, bContext *C, PointerRNA *ptr, char
         */
        if(template->idlb) {
                uiLayoutRow(layout, 1);
-               template_ID(C, layout, template, type, flag, newop, openop, unlinkop, filterop);
+               template_ID(C, layout, template, type, flag, newop, openop, unlinkop);
        }
 
        MEM_freeN(template);
 }
 
-void uiTemplateID(uiLayout *layout, bContext *C, PointerRNA *ptr, char *propname, char *newop, char *openop, char *unlinkop, char *filterop)
+void uiTemplateID(uiLayout *layout, bContext *C, PointerRNA *ptr, char *propname, char *newop, char *openop, char *unlinkop)
 {
-       ui_template_id(layout, C, ptr, propname, newop, openop, unlinkop, filterop, UI_ID_BROWSE|UI_ID_RENAME|UI_ID_DELETE, 0, 0);
+       ui_template_id(layout, C, ptr, propname, newop, openop, unlinkop, UI_ID_BROWSE|UI_ID_RENAME|UI_ID_DELETE, 0, 0);
 }
 
-void uiTemplateIDBrowse(uiLayout *layout, bContext *C, PointerRNA *ptr, char *propname, char *newop, char *openop, char *unlinkop, char *filterop)
+void uiTemplateIDBrowse(uiLayout *layout, bContext *C, PointerRNA *ptr, char *propname, char *newop, char *openop, char *unlinkop)
 {
-       ui_template_id(layout, C, ptr, propname, newop, openop, unlinkop, filterop, UI_ID_BROWSE|UI_ID_RENAME, 0, 0);
+       ui_template_id(layout, C, ptr, propname, newop, openop, unlinkop, UI_ID_BROWSE|UI_ID_RENAME, 0, 0);
 }
 
-void uiTemplateIDPreview(uiLayout *layout, bContext *C, PointerRNA *ptr, char *propname, char *newop, char *openop, char *unlinkop, char *filterop, int rows, int cols)
+void uiTemplateIDPreview(uiLayout *layout, bContext *C, PointerRNA *ptr, char *propname, char *newop, char *openop, char *unlinkop, int rows, int cols)
 {
-       ui_template_id(layout, C, ptr, propname, newop, openop, unlinkop, filterop, UI_ID_BROWSE|UI_ID_RENAME|UI_ID_DELETE|UI_ID_PREVIEWS, rows, cols);
+       ui_template_id(layout, C, ptr, propname, newop, openop, unlinkop, UI_ID_BROWSE|UI_ID_RENAME|UI_ID_DELETE|UI_ID_PREVIEWS, rows, cols);
 }
 
 /************************ ID Chooser Template ***************************/
index 8c786483d9fee6cf1fbb26dbd5bb3e336fe01ea5..b5cadb9c484fc783a4c5cf540f223d970431d987 100644 (file)
@@ -350,40 +350,40 @@ void ED_keymap_paint(wmKeyConfig *keyconf)
        RNA_string_set(kmi->ptr, "data_path", "tool_settings.sculpt.brush.use_airbrush");
 
        /* brush switching */
-       kmi = WM_keymap_add_item(keymap, "WM_OT_context_set_enum", DKEY, KM_PRESS, 0, 0);
-       RNA_string_set(kmi->ptr, "data_path", "tool_settings.sculpt.active_brush_name");
+       kmi = WM_keymap_add_item(keymap, "WM_OT_context_set_id", DKEY, KM_PRESS, 0, 0);
+       RNA_string_set(kmi->ptr, "data_path", "tool_settings.sculpt.brush");
        RNA_string_set(kmi->ptr, "value", "SculptDraw");
        
-       kmi = WM_keymap_add_item(keymap, "WM_OT_context_set_enum", SKEY, KM_PRESS, 0, 0);
-       RNA_string_set(kmi->ptr, "data_path", "tool_settings.sculpt.active_brush_name");
+       kmi = WM_keymap_add_item(keymap, "WM_OT_context_set_id", SKEY, KM_PRESS, 0, 0);
+       RNA_string_set(kmi->ptr, "data_path", "tool_settings.sculpt.brush");
        RNA_string_set(kmi->ptr, "value", "Smooth");
        
-       kmi = WM_keymap_add_item(keymap, "WM_OT_context_set_enum", PKEY, KM_PRESS, 0, 0);
-       RNA_string_set(kmi->ptr, "data_path", "tool_settings.sculpt.active_brush_name");
+       kmi = WM_keymap_add_item(keymap, "WM_OT_context_set_id", PKEY, KM_PRESS, 0, 0);
+       RNA_string_set(kmi->ptr, "data_path", "tool_settings.sculpt.brush");
        RNA_string_set(kmi->ptr, "value", "Pinch/Magnify");
        
-       kmi = WM_keymap_add_item(keymap, "WM_OT_context_set_enum", GKEY, KM_PRESS, 0, 0);
-       RNA_string_set(kmi->ptr, "data_path", "tool_settings.sculpt.active_brush_name");
+       kmi = WM_keymap_add_item(keymap, "WM_OT_context_set_id", GKEY, KM_PRESS, 0, 0);
+       RNA_string_set(kmi->ptr, "data_path", "tool_settings.sculpt.brush");
        RNA_string_set(kmi->ptr, "value", "Grab");
        
-       kmi = WM_keymap_add_item(keymap, "WM_OT_context_set_enum", LKEY, KM_PRESS, 0, 0);
-       RNA_string_set(kmi->ptr, "data_path", "tool_settings.sculpt.active_brush_name");
+       kmi = WM_keymap_add_item(keymap, "WM_OT_context_set_id", LKEY, KM_PRESS, 0, 0);
+       RNA_string_set(kmi->ptr, "data_path", "tool_settings.sculpt.brush");
        RNA_string_set(kmi->ptr, "value", "Layer");
 
-       kmi = WM_keymap_add_item(keymap, "WM_OT_context_set_enum", CKEY, KM_PRESS, KM_SHIFT, 0);
-       RNA_string_set(kmi->ptr, "data_path", "tool_settings.sculpt.active_brush_name");
+       kmi = WM_keymap_add_item(keymap, "WM_OT_context_set_id", CKEY, KM_PRESS, KM_SHIFT, 0);
+       RNA_string_set(kmi->ptr, "data_path", "tool_settings.sculpt.brush");
        RNA_string_set(kmi->ptr, "value", "Crease");
 
-       kmi = WM_keymap_add_item(keymap, "WM_OT_context_set_enum", CKEY, KM_PRESS, 0, 0);
-       RNA_string_set(kmi->ptr, "data_path", "tool_settings.sculpt.active_brush_name");
+       kmi = WM_keymap_add_item(keymap, "WM_OT_context_set_id", CKEY, KM_PRESS, 0, 0);
+       RNA_string_set(kmi->ptr, "data_path", "tool_settings.sculpt.brush");
        RNA_string_set(kmi->ptr, "value", "Clay");
        
-       kmi = WM_keymap_add_item(keymap, "WM_OT_context_set_enum", IKEY, KM_PRESS, 0, 0);
-       RNA_string_set(kmi->ptr, "data_path", "tool_settings.sculpt.active_brush_name");
+       kmi = WM_keymap_add_item(keymap, "WM_OT_context_set_id", IKEY, KM_PRESS, 0, 0);
+       RNA_string_set(kmi->ptr, "data_path", "tool_settings.sculpt.brush");
        RNA_string_set(kmi->ptr, "value", "Inflate/Deflate");
        
-       kmi = WM_keymap_add_item(keymap, "WM_OT_context_set_enum", TKEY, KM_PRESS, KM_SHIFT, 0); // was just T in 2.4x
-       RNA_string_set(kmi->ptr, "data_path", "tool_settings.sculpt.active_brush_name");
+       kmi = WM_keymap_add_item(keymap, "WM_OT_context_set_id", TKEY, KM_PRESS, KM_SHIFT, 0); // was just T in 2.4x
+       RNA_string_set(kmi->ptr, "data_path", "tool_settings.sculpt.brush");
        RNA_string_set(kmi->ptr, "value", "Flatten/Contrast");
 
        /* Vertex Paint mode */
index a1e1d387e4a8dea7300fcea8b4f054a60fe4daa0..e7ea298e58c84e444fed853e9ed8bac4227216df 100644 (file)
@@ -2860,18 +2860,13 @@ static void sculpt_update_cache_invariants(bContext* C, Sculpt *sd, SculptSessio
        if (ss->cache->alt_smooth) {
                Paint *p= &sd->paint;
                Brush *br;
-               int i;
                
                BLI_strncpy(cache->saved_active_brush_name, brush->id.name+2, sizeof(cache->saved_active_brush_name));
 
-               for(i = 0; i < p->brush_count; ++i) {
-                       br = p->brushes[i];
-               
-                       if (strcmp(br->id.name+2, "Smooth")==0) {
-                               paint_brush_set(p, br);
-                               brush = br;
-                               break;
-                       }
+               br= (Brush *)find_id("BR", "Smooth");
+               if(br) {
+                       paint_brush_set(p, br);
+                       brush = br;
                }
        }
 
@@ -3414,16 +3409,9 @@ static void sculpt_stroke_done(bContext *C, struct PaintStroke *unused)
                /* Alt-Smooth */
                if (ss->cache->alt_smooth) {
                        Paint *p= &sd->paint;
-                       Brush *br;
-                       int i;
-
-                       for(i = 0; i < p->brush_count; ++i) {
-                               br = p->brushes[i];
-
-                               if (strcmp(br->id.name+2, ss->cache->saved_active_brush_name)==0) {
-                                       paint_brush_set(p, br);
-                                       break;
-                               }
+                       Brush *br= (Brush *)find_id("BR", ss->cache->saved_active_brush_name);
+                       if(br) {
+                               paint_brush_set(p, br);
                        }
                }
 
index 7267d1abb93704a50fcb92be6e14fc678318679c..1838b9ce73da2228b9ee8e1bff23f81d11848155 100644 (file)
@@ -66,11 +66,11 @@ ifeq ($(WITH_LCMS), true)
     CPPFLAGS += -I$(BF_LCMS_INC)
 endif
 
-ifeq ($(WHITH_CINEON), true)
+ifeq ($(WITH_CINEON), true)
     CPPFLAGS += -DWITH_CINEON
 endif
 
-ifeq ($(WHITH_HDR), true)
+ifeq ($(WITH_HDR), true)
     CPPFLAGS += -DWITH_HDR
 endif
 
index f58326239ae0f39d1e657b446a02fb31548b646d..357aa9dacdf19a91c736108c50e5b00794e37191 100644 (file)
@@ -792,7 +792,7 @@ void uiTemplateImage(uiLayout *layout, bContext *C, PointerRNA *ptr, char *propn
        uiLayoutSetContextPointer(layout, "edit_image", &imaptr);
 
        if(!compact)
-               uiTemplateID(layout, C, ptr, propname, "IMAGE_OT_new", "IMAGE_OT_open", NULL, NULL);
+               uiTemplateID(layout, C, ptr, propname, "IMAGE_OT_new", "IMAGE_OT_open", NULL);
 
        // XXX missing: reload, pack
 
index cdfac81b0fc41c2ce02a702029c65fbeec3ad206..1387631870d4f7278631f8d1ce56884c66369cbc 100644 (file)
@@ -4275,7 +4275,7 @@ static void draw_actuator_sound(uiLayout *layout, PointerRNA *ptr, bContext *C)
 {
        uiLayout *row, *col;
 
-       uiTemplateID(layout, C, ptr, "sound", NULL, "SOUND_OT_open", NULL, NULL);
+       uiTemplateID(layout, C, ptr, "sound", NULL, "SOUND_OT_open", NULL);
        if (!RNA_pointer_get(ptr, "sound").data)
        {
                uiItemL(layout, "Select a sound from the list or load a new one", 0);
index 494e42ea2c8199617edd2366173717f41e9d0927..ef46f8a274de1eacb3fa882584a9210e3fb8c047 100644 (file)
@@ -237,7 +237,7 @@ static void nla_panel_animdata (const bContext *C, Panel *pa)
        /* Active Action Properties ------------------------------------- */
        /* action */
        row= uiLayoutRow(layout, 1);
-               uiTemplateID(row, (bContext *)C, &adt_ptr, "action", "ACTION_OT_new", NULL, NULL /*"ACTION_OT_unlink"*/, NULL); // XXX: need to make these operators
+               uiTemplateID(row, (bContext *)C, &adt_ptr, "action", "ACTION_OT_new", NULL, NULL /*"ACTION_OT_unlink"*/); // XXX: need to make these operators
        
        /* extrapolation */
        row= uiLayoutRow(layout, 1);
index ad21f9659af31a1cb8016601f3690f9f551cb5f4..171f56c63fbcaed54792adc895ef879a55196f3a 100644 (file)
@@ -81,7 +81,7 @@
 
 void node_buts_group(uiLayout *layout, bContext *C, PointerRNA *ptr)
 {
-       uiTemplateIDBrowse(layout, C, ptr, "nodetree", NULL, NULL, "", NULL);
+       uiTemplateIDBrowse(layout, C, ptr, "nodetree", NULL, NULL, "");
 }
 
 static void node_buts_value(uiLayout *layout, bContext *C, PointerRNA *ptr)
@@ -309,7 +309,7 @@ static void node_shader_buts_material(uiLayout *layout, bContext *C, PointerRNA
        bNode *node= ptr->data;
        uiLayout *col;
        
-       uiTemplateID(layout, C, ptr, "material", "MATERIAL_OT_new", NULL, NULL, NULL);
+       uiTemplateID(layout, C, ptr, "material", "MATERIAL_OT_new", NULL, NULL);
        
        if(!node->id) return;
        
@@ -471,7 +471,7 @@ static void node_composit_buts_image(uiLayout *layout, bContext *C, PointerRNA *
        PointerRNA imaptr;
        PropertyRNA *prop;
        
-       uiTemplateID(layout, C, ptr, "image", NULL, "IMAGE_OT_open", NULL, NULL);
+       uiTemplateID(layout, C, ptr, "image", NULL, "IMAGE_OT_open", NULL);
        
        if(!node->id) return;
        
@@ -508,7 +508,7 @@ static void node_composit_buts_renderlayers(uiLayout *layout, bContext *C, Point
        const char *layer_name;
        char scene_name[19];
        
-       uiTemplateID(layout, C, ptr, "scene", NULL, NULL, NULL, NULL);
+       uiTemplateID(layout, C, ptr, "scene", NULL, NULL, NULL);
        
        if(!node->id) return;
 
@@ -1211,7 +1211,7 @@ static void node_texture_buts_proc(uiLayout *layout, bContext *C, PointerRNA *pt
 
 static void node_texture_buts_image(uiLayout *layout, bContext *C, PointerRNA *ptr)
 {
-       uiTemplateID(layout, C, ptr, "image", NULL, "IMAGE_OT_open", NULL, NULL);
+       uiTemplateID(layout, C, ptr, "image", NULL, "IMAGE_OT_open", NULL);
 }
 
 static void node_texture_buts_output(uiLayout *layout, bContext *C, PointerRNA *ptr)
index 814fa25a39042975e86ed3859f9da36c1cff1c17..1492319fe225f11d78f5823465c6c6d12d97d0ac 100644 (file)
@@ -60,7 +60,8 @@ typedef struct Brush {
 
        float normal_weight;
 
-       short blend, pad;               /* blend mode */
+       short blend;            /* blend mode */
+       short ob_mode;          /* & with ob->mode to see if the brush is compatible, use for display only. */
        int size;                       /* brush diameter */
        int flag;                       /* general purpose flag */      
        float jitter;                   /* jitter the position of the brush */
@@ -94,9 +95,6 @@ typedef struct Brush {
 
        float add_col[3];
        float sub_col[3];
-       
-       int use_flag; /* set the different object modes this brush should be shown in */
-       int pad4;
 } Brush;
 
 /* Brush.flag */
index c348979255ec02bd36ff254ad4c715c17453ad8c..bc9ae0abd99d91787ad8e8e0137d5936b209ab30 100644 (file)
@@ -507,9 +507,7 @@ typedef struct TimeMarker {
 } TimeMarker;
 
 typedef struct Paint {
-       /* Array of brushes selected for use in this paint mode */
-       struct Brush **brushes;
-       int active_brush_index, brush_count;
+       struct Brush *brush;
        
        /* WM Paint cursor */
        void *paint_cursor;
index 7a08e1403e3a976fdabcb9ad778f10f5c9e11208..3d1cb7c5c2f87df43a058f8185d166c19bd8f819 100644 (file)
@@ -31,6 +31,7 @@
 #include "DNA_brush_types.h"
 #include "DNA_texture_types.h"
 #include "DNA_scene_types.h"
+#include "DNA_object_types.h"
 
 #include "BLI_math.h"
 
@@ -140,37 +141,6 @@ static void rna_Brush_imagepaint_tool_update(Main *bmain, Scene *scene, PointerR
        rna_Brush_update(bmain, scene, ptr);
 }
 
-static int rna_Brush_is_sculpt_brush(Brush *br, bContext *C)
-{
-       Sculpt *sd = CTX_data_tool_settings(C)->sculpt;
-       return paint_has_brush(&sd->paint, br);
-}
-
-static int rna_Brush_is_vpaint_brush(Brush *br, bContext *C)
-{
-       VPaint *vp = CTX_data_tool_settings(C)->vpaint;
-       return paint_has_brush(&vp->paint, br);
-}
-
-static int rna_Brush_is_wpaint_brush(Brush *br, bContext *C)
-{
-       VPaint *vp = CTX_data_tool_settings(C)->wpaint;
-       return paint_has_brush(&vp->paint, br);
-}
-
-static int rna_Brush_is_imapaint_brush(Brush *me, bContext *C)
-{
-       ImagePaintSettings *data = &(CTX_data_tool_settings(C)->imapaint);
-       int i;
-
-       for (i= 0; i < data->paint.brush_count; i++) {
-               if (strcmp(me->id.name+2, data->paint.brushes[i]->id.name+2) == 0) 
-                       return 1;
-       }
-
-       return 0;
-}
-
 static void rna_Brush_icon_update(Main *bmain, Scene *scene, PointerRNA *ptr)
 {
        Brush *br= (Brush*)ptr->data;
@@ -395,42 +365,10 @@ static void rna_def_brush(BlenderRNA *brna)
                {SCULPT_DISP_DIR_Z, "Z", 0, "Z Plane", ""},
                {0, NULL, 0, NULL, NULL}};
 
-       FunctionRNA *func;
-       PropertyRNA *parm;
-
        srna= RNA_def_struct(brna, "Brush", "ID");
        RNA_def_struct_ui_text(srna, "Brush", "Brush datablock for storing brush settings for painting and sculpting");
        RNA_def_struct_ui_icon(srna, ICON_BRUSH_DATA);
 
-       /* functions */
-       func= RNA_def_function(srna, "is_sculpt_brush", "rna_Brush_is_sculpt_brush");
-       RNA_def_function_ui_description(func, "Returns true if Brush can be used for sculpting");
-       parm= RNA_def_pointer(func, "context", "Context", "", "");
-       RNA_def_property_flag(parm, PROP_REQUIRED);
-       parm= RNA_def_boolean(func, "ret", 0, "", "");
-       RNA_def_function_return(func, parm);
-
-       func= RNA_def_function(srna, "is_vpaint_brush", "rna_Brush_is_vpaint_brush");
-       RNA_def_function_ui_description(func, "Returns true if Brush can be used for vertex painting");
-       parm= RNA_def_pointer(func, "context", "Context", "", "");
-       RNA_def_property_flag(parm, PROP_REQUIRED);
-       parm= RNA_def_boolean(func, "ret", 0, "", "");
-       RNA_def_function_return(func, parm);
-
-       func= RNA_def_function(srna, "is_wpaint_brush", "rna_Brush_is_wpaint_brush");
-       RNA_def_function_ui_description(func, "Returns true if Brush can be used for weight painting");
-       parm= RNA_def_pointer(func, "context", "Context", "", "");
-       RNA_def_property_flag(parm, PROP_REQUIRED);
-       parm= RNA_def_boolean(func, "ret", 0, "", "");
-       RNA_def_function_return(func, parm);
-
-       func= RNA_def_function(srna, "is_imapaint_brush", "rna_Brush_is_imapaint_brush");
-       RNA_def_function_ui_description(func, "Returns true if Brush can be used for image painting");
-       parm= RNA_def_pointer(func, "context", "Context", "", "");
-       RNA_def_property_flag(parm, PROP_REQUIRED);
-       parm= RNA_def_boolean(func, "ret", 0, "", "");
-       RNA_def_function_return(func, parm);
-
        /* enums */
        prop= RNA_def_property(srna, "blend", PROP_ENUM, PROP_NONE);
        RNA_def_property_enum_items(prop, prop_blend_items);
@@ -734,6 +672,23 @@ static void rna_def_brush(BlenderRNA *brna)
        RNA_def_property_ui_text(prop, "Curve", "Editable falloff curve");
        RNA_def_property_update(prop, 0, "rna_Brush_update");
 
+       /* paint mode flags */
+       prop= RNA_def_property(srna, "use_paint_sculpt", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_sdna(prop, NULL, "ob_mode", OB_MODE_SCULPT);
+       RNA_def_property_ui_text(prop, "Use Sculpt", "Use this brush in sculpt mode");
+
+       prop= RNA_def_property(srna, "use_paint_vertex", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_sdna(prop, NULL, "ob_mode", OB_MODE_VERTEX_PAINT);
+       RNA_def_property_ui_text(prop, "Use Vertex", "Use this brush in vertex paint mode");
+
+       prop= RNA_def_property(srna, "use_paint_weight", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_sdna(prop, NULL, "ob_mode", OB_MODE_WEIGHT_PAINT);
+       RNA_def_property_ui_text(prop, "Use Weight", "Use this brush in weight paint mode");    
+
+       prop= RNA_def_property(srna, "use_paint_texture", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_sdna(prop, NULL, "ob_mode", OB_MODE_TEXTURE_PAINT);
+       RNA_def_property_ui_text(prop, "Use Texture", "Use this brush in texture paint mode");  
+
        /* texture */
        prop= RNA_def_property(srna, "texture_slot", PROP_POINTER, PROP_NONE);
        RNA_def_property_struct_type(prop, "BrushTextureSlot");
index d4640058c5c4edbb3d03c9be3fc66dcf41b58c57..d89d0ad5d294873d03dce211a6bb7ea1871a09ea 100644 (file)
@@ -737,7 +737,7 @@ void RNA_def_struct_sdna_from(StructRNA *srna, const char *structname, const cha
 void RNA_def_struct_name_property(struct StructRNA *srna, struct PropertyRNA *prop)
 {
        if(prop->type != PROP_STRING) {
-               fprintf(stderr, "RNA_def_struct_name_property: %s.%s, must be a string property.\n", srna->identifier, prop->identifier);
+               fprintf(stderr, "RNA_def_struct_name_property: \"%s.%s\", must be a string property.\n", srna->identifier, prop->identifier);
                DefRNA.error= 1;
        }
        else
@@ -847,7 +847,7 @@ PropertyRNA *RNA_def_property(StructOrFunctionRNA *cont_, const char *identifier
                char error[512];
                
                if (rna_validate_identifier(identifier, error, 1) == 0) {
-                       fprintf(stderr, "RNA_def_property: property identifier \"%s\" - %s\n", identifier, error);
+                       fprintf(stderr, "RNA_def_property: property identifier \"%s.%s\" - %s\n", srna->identifier, identifier, error);
                        DefRNA.error= 1;
                }
                
@@ -855,7 +855,7 @@ PropertyRNA *RNA_def_property(StructOrFunctionRNA *cont_, const char *identifier
 
                /* XXX - toto, detect supertype collisions */
                if(rna_findlink(&dcont->properties, identifier)) {
-                       fprintf(stderr, "RNA_def_property: duplicate identifier \"%s\"\n", identifier);
+                       fprintf(stderr, "RNA_def_property: duplicate identifier \"%s.%s\"\n", srna->identifier, identifier);
                        DefRNA.error= 1;
                }
 
@@ -913,7 +913,7 @@ PropertyRNA *RNA_def_property(StructOrFunctionRNA *cont_, const char *identifier
                case PROP_COLLECTION:
                        break;
                default:
-                       fprintf(stderr, "RNA_def_property: %s.%s, invalid property type.\n", srna->identifier, identifier);
+                       fprintf(stderr, "RNA_def_property: \"%s.%s\", invalid property type.\n", srna->identifier, identifier);
                        DefRNA.error= 1;
                        return NULL;
        }
@@ -1009,13 +1009,13 @@ void RNA_def_property_array(PropertyRNA *prop, int length)
        StructRNA *srna= DefRNA.laststruct;
 
        if(length<0) {
-               fprintf(stderr, "RNA_def_property_array: %s.%s, array length must be zero of greater.\n", srna->identifier, prop->identifier);
+               fprintf(stderr, "RNA_def_property_array: \"%s.%s\", array length must be zero of greater.\n", srna->identifier, prop->identifier);
                DefRNA.error= 1;
                return;
        }
 
        if(length>RNA_MAX_ARRAY_LENGTH) {
-               fprintf(stderr, "RNA_def_property_array: %s.%s, array length must be smaller than %d.\n", srna->identifier, prop->identifier, RNA_MAX_ARRAY_LENGTH);
+               fprintf(stderr, "RNA_def_property_array: \"%s.%s\", array length must be smaller than %d.\n", srna->identifier, prop->identifier, RNA_MAX_ARRAY_LENGTH);
                DefRNA.error= 1;
                return;
        }
@@ -1029,7 +1029,7 @@ void RNA_def_property_array(PropertyRNA *prop, int length)
                        prop->arraydimension= 1;
                        break;
                default:
-                       fprintf(stderr, "RNA_def_property_array: %s.%s, only boolean/int/float can be array.\n", srna->identifier, prop->identifier);
+                       fprintf(stderr, "RNA_def_property_array: \"%s.%s\", only boolean/int/float can be array.\n", srna->identifier, prop->identifier);
                        DefRNA.error= 1;
                        break;
        }
@@ -1041,7 +1041,7 @@ void RNA_def_property_multi_array(PropertyRNA *prop, int dimension, int length[]
        int i;
        
        if (dimension < 1 || dimension > RNA_MAX_ARRAY_DIMENSION) {
-               fprintf(stderr, "RNA_def_property_multi_array: %s.%s, array dimension must be between 1 and %d.\n", srna->identifier, prop->identifier, RNA_MAX_ARRAY_DIMENSION);
+               fprintf(stderr, "RNA_def_property_multi_array: \"%s.%s\", array dimension must be between 1 and %d.\n", srna->identifier, prop->identifier, RNA_MAX_ARRAY_DIMENSION);
                DefRNA.error= 1;
                return;
        }
@@ -1052,7 +1052,7 @@ void RNA_def_property_multi_array(PropertyRNA *prop, int dimension, int length[]
                case PROP_FLOAT:
                        break;
                default:
-                       fprintf(stderr, "RNA_def_property_multi_array: %s.%s, only boolean/int/float can be array.\n", srna->identifier, prop->identifier);
+                       fprintf(stderr, "RNA_def_property_multi_array: \"%s.%s\", only boolean/int/float can be array.\n", srna->identifier, prop->identifier);
                        DefRNA.error= 1;
                        break;
        }
@@ -1107,7 +1107,7 @@ void RNA_def_property_ui_range(PropertyRNA *prop, double min, double max, double
                        break;
                }
                default:
-                       fprintf(stderr, "RNA_def_property_ui_range: %s.%s, invalid type for ui range.\n", srna->identifier, prop->identifier);
+                       fprintf(stderr, "RNA_def_property_ui_range: \"%s.%s\", invalid type for ui range.\n", srna->identifier, prop->identifier);
                        DefRNA.error= 1;
                        break;
        }
@@ -1135,7 +1135,7 @@ void RNA_def_property_range(PropertyRNA *prop, double min, double max)
                        break;
                }
                default:
-                       fprintf(stderr, "RNA_def_property_range: %s.%s, invalid type for range.\n", srna->identifier, prop->identifier);
+                       fprintf(stderr, "RNA_def_property_range: \"%s.%s\", invalid type for range.\n", srna->identifier, prop->identifier);
                        DefRNA.error= 1;
                        break;
        }
@@ -1146,7 +1146,7 @@ void RNA_def_property_struct_type(PropertyRNA *prop, const char *type)
        StructRNA *srna= DefRNA.laststruct;
 
        if(!DefRNA.preprocess) {
-               fprintf(stderr, "RNA_def_property_struct_type %s.%s: only during preprocessing.\n", srna->identifier, prop->identifier);
+               fprintf(stderr, "RNA_def_property_struct_type \"%s.%s\": only during preprocessing.\n", srna->identifier, prop->identifier);
                return;
        }
 
@@ -1162,7 +1162,7 @@ void RNA_def_property_struct_type(PropertyRNA *prop, const char *type)
                        break;
                }
                default:
-                       fprintf(stderr, "RNA_def_property_struct_type: %s.%s, invalid type for struct type.\n", srna->identifier, prop->identifier);
+                       fprintf(stderr, "RNA_def_property_struct_type: \"%s.%s\", invalid type for struct type.\n", srna->identifier, prop->identifier);
                        DefRNA.error= 1;
                        break;
        }
@@ -1193,7 +1193,7 @@ void RNA_def_property_struct_runtime(PropertyRNA *prop, StructRNA *type)
                        break;
                }
                default:
-                       fprintf(stderr, "RNA_def_property_struct_runtime: %s.%s, invalid type for struct type.\n", srna->identifier, prop->identifier);
+                       fprintf(stderr, "RNA_def_property_struct_runtime: \"%s.%s\", invalid type for struct type.\n", srna->identifier, prop->identifier);
                        DefRNA.error= 1;
                        break;
        }
@@ -1228,7 +1228,7 @@ void RNA_def_property_enum_items(PropertyRNA *prop, const EnumPropertyItem *item
                        break;
                }
                default:
-                       fprintf(stderr, "RNA_def_property_enum_items: %s.%s, invalid type for struct type.\n", srna->identifier, prop->identifier);
+                       fprintf(stderr, "RNA_def_property_enum_items: \"%s.%s\", invalid type for struct type.\n", srna->identifier, prop->identifier);
                        DefRNA.error= 1;
                        break;
        }
@@ -1245,7 +1245,7 @@ void RNA_def_property_string_maxlength(PropertyRNA *prop, int maxlength)
                        break;
                }
                default:
-                       fprintf(stderr, "RNA_def_property_string_maxlength: %s.%s, type is not string.\n", srna->identifier, prop->identifier);
+                       fprintf(stderr, "RNA_def_property_string_maxlength: \"%s.%s\", type is not string.\n", srna->identifier, prop->identifier);
                        DefRNA.error= 1;
                        break;
        }
@@ -1262,7 +1262,7 @@ void RNA_def_property_boolean_default(PropertyRNA *prop, int value)
                        break;
                }
                default:
-                       fprintf(stderr, "RNA_def_property_boolean_default: %s.%s, type is not boolean.\n", srna->identifier, prop->identifier);
+                       fprintf(stderr, "RNA_def_property_boolean_default: \"%s.%s\", type is not boolean.\n", srna->identifier, prop->identifier);
                        DefRNA.error= 1;
                        break;
        }
@@ -1279,7 +1279,7 @@ void RNA_def_property_boolean_array_default(PropertyRNA *prop, const int *array)
                        break;
                }
                default:
-                       fprintf(stderr, "RNA_def_property_boolean_default: %s.%s, type is not boolean.\n", srna->identifier, prop->identifier);
+                       fprintf(stderr, "RNA_def_property_boolean_default: \"%s.%s\", type is not boolean.\n", srna->identifier, prop->identifier);
                        DefRNA.error= 1;
                        break;
        }
@@ -1296,7 +1296,7 @@ void RNA_def_property_int_default(PropertyRNA *prop, int value)
                        break;
                }
                default:
-                       fprintf(stderr, "RNA_def_property_int_default: %s.%s, type is not int.\n", srna->identifier, prop->identifier);
+                       fprintf(stderr, "RNA_def_property_int_default: \"%s.%s\", type is not int.\n", srna->identifier, prop->identifier);
                        DefRNA.error= 1;
                        break;
        }
@@ -1313,7 +1313,7 @@ void RNA_def_property_int_array_default(PropertyRNA *prop, const int *array)
                        break;
                }
                default:
-                       fprintf(stderr, "RNA_def_property_int_default: %s.%s, type is not int.\n", srna->identifier, prop->identifier);
+                       fprintf(stderr, "RNA_def_property_int_default: \"%s.%s\", type is not int.\n", srna->identifier, prop->identifier);
                        DefRNA.error= 1;
                        break;
        }
@@ -1330,7 +1330,7 @@ void RNA_def_property_float_default(PropertyRNA *prop, float value)
                        break;
                }
                default:
-                       fprintf(stderr, "RNA_def_property_float_default: %s.%s, type is not float.\n", srna->identifier, prop->identifier);
+                       fprintf(stderr, "RNA_def_property_float_default: \"%s.%s\", type is not float.\n", srna->identifier, prop->identifier);
                        DefRNA.error= 1;
                        break;
        }
@@ -1347,7 +1347,7 @@ void RNA_def_property_float_array_default(PropertyRNA *prop, const float *array)
                        break;
                }
                default:
-                       fprintf(stderr, "RNA_def_property_float_default: %s.%s, type is not float.\n", srna->identifier, prop->identifier);
+                       fprintf(stderr, "RNA_def_property_float_default: \"%s.%s\", type is not float.\n", srna->identifier, prop->identifier);
                        DefRNA.error= 1;
                        break;
        }
@@ -1364,7 +1364,7 @@ void RNA_def_property_string_default(PropertyRNA *prop, const char *value)
                        break;
                }
                default:
-                       fprintf(stderr, "RNA_def_property_string_default: %s.%s, type is not string.\n", srna->identifier, prop->identifier);
+                       fprintf(stderr, "RNA_def_property_string_default: \"%s.%s\", type is not string.\n", srna->identifier, prop->identifier);
                        DefRNA.error= 1;
                        break;
        }
@@ -1390,7 +1390,7 @@ void RNA_def_property_enum_default(PropertyRNA *prop, int value)
                                        eprop->defaultvalue= eprop->item[0].value;
                                }
                                else {
-                                       fprintf(stderr, "RNA_def_property_enum_default: %s.%s, default is not in items.\n", srna->identifier, prop->identifier);
+                                       fprintf(stderr, "RNA_def_property_enum_default: \"%s.%s\", default is not in items.\n", srna->identifier, prop->identifier);
                                        DefRNA.error= 1;
                                }
                        }
@@ -1398,7 +1398,7 @@ void RNA_def_property_enum_default(PropertyRNA *prop, int value)
                        break;
                }
                default:
-                       fprintf(stderr, "RNA_def_property_enum_default: %s.%s, type is not enum.\n", srna->identifier, prop->identifier);
+                       fprintf(stderr, "RNA_def_property_enum_default: \"%s.%s\", type is not enum.\n", srna->identifier, prop->identifier);
                        DefRNA.error= 1;
                        break;
        }
@@ -1437,7 +1437,7 @@ static PropertyDefRNA *rna_def_property_sdna(PropertyRNA *prop, const char *stru
                        return dp;
                }
                else {
-                       fprintf(stderr, "rna_def_property_sdna: %s.%s not found.\n", structname, propname);
+                       fprintf(stderr, "rna_def_property_sdna: \"%s.%s\" not found.\n", structname, propname);
                        DefRNA.error= 1;
                        return NULL;
                }
@@ -1475,7 +1475,7 @@ void RNA_def_property_boolean_sdna(PropertyRNA *prop, const char *structname, co
        }
 
        if(prop->type != PROP_BOOLEAN) {
-               fprintf(stderr, "RNA_def_property_boolean_sdna: %s.%s, type is not boolean.\n", srna->identifier, prop->identifier);
+               fprintf(stderr, "RNA_def_property_boolean_sdna: \"%s.%s\", type is not boolean.\n", srna->identifier, prop->identifier);
                DefRNA.error= 1;
                return;
        }
@@ -1508,7 +1508,7 @@ void RNA_def_property_int_sdna(PropertyRNA *prop, const char *structname, const
        }
 
        if(prop->type != PROP_INT) {
-               fprintf(stderr, "RNA_def_property_int_sdna: %s.%s, type is not int.\n", srna->identifier, prop->identifier);
+               fprintf(stderr, "RNA_def_property_int_sdna: \"%s.%s\", type is not int.\n", srna->identifier, prop->identifier);
                DefRNA.error= 1;
                return;
        }
@@ -1546,7 +1546,7 @@ void RNA_def_property_float_sdna(PropertyRNA *prop, const char *structname, cons
        }
 
        if(prop->type != PROP_FLOAT) {
-               fprintf(stderr, "RNA_def_property_float_sdna: %s.%s, type is not float.\n", srna->identifier, prop->identifier);
+               fprintf(stderr, "RNA_def_property_float_sdna: \"%s.%s\", type is not float.\n", srna->identifier, prop->identifier);
                DefRNA.error= 1;
                return;
        }
@@ -1565,7 +1565,7 @@ void RNA_def_property_enum_sdna(PropertyRNA *prop, const char *structname, const
        }
 
        if(prop->type != PROP_ENUM) {
-               fprintf(stderr, "RNA_def_property_enum_sdna: %s.%s, type is not enum.\n", srna->identifier, prop->identifier);
+               fprintf(stderr, "RNA_def_property_enum_sdna: \"%s.%s\", type is not enum.\n", srna->identifier, prop->identifier);
                DefRNA.error= 1;
                return;
        }
@@ -1576,7 +1576,7 @@ void RNA_def_property_enum_sdna(PropertyRNA *prop, const char *structname, const
                        prop->totarraylength= 0;
 
                        if(!DefRNA.silent) {
-                               fprintf(stderr, "RNA_def_property_enum_sdna: %s.%s, array not supported for enum type.\n", structname, propname);
+                               fprintf(stderr, "RNA_def_property_enum_sdna: \"%s.%s\", array not supported for enum type.\n", structname, propname);
                                DefRNA.error= 1;
                        }
                }
@@ -1607,7 +1607,7 @@ void RNA_def_property_string_sdna(PropertyRNA *prop, const char *structname, con
        }
 
        if(prop->type != PROP_STRING) {
-               fprintf(stderr, "RNA_def_property_string_sdna: %s.%s, type is not string.\n", srna->identifier, prop->identifier);
+               fprintf(stderr, "RNA_def_property_string_sdna: \"%s.%s\", type is not string.\n", srna->identifier, prop->identifier);
                DefRNA.error= 1;
                return;
        }
@@ -1632,7 +1632,7 @@ void RNA_def_property_pointer_sdna(PropertyRNA *prop, const char *structname, co
        }
 
        if(prop->type != PROP_POINTER) {
-               fprintf(stderr, "RNA_def_property_pointer_sdna: %s.%s, type is not pointer.\n", srna->identifier, prop->identifier);
+               fprintf(stderr, "RNA_def_property_pointer_sdna: \"%s.%s\", type is not pointer.\n", srna->identifier, prop->identifier);
                DefRNA.error= 1;
                return;
        }
@@ -1643,7 +1643,7 @@ void RNA_def_property_pointer_sdna(PropertyRNA *prop, const char *structname, co
                        prop->totarraylength= 0;
 
                        if(!DefRNA.silent) {
-                               fprintf(stderr, "RNA_def_property_pointer_sdna: %s.%s, array not supported for pointer type.\n", structname, propname);
+                               fprintf(stderr, "RNA_def_property_pointer_sdna: \"%s.%s\", array not supported for pointer type.\n", structname, propname);
                                DefRNA.error= 1;
                        }
                }
@@ -1662,7 +1662,7 @@ void RNA_def_property_collection_sdna(PropertyRNA *prop, const char *structname,
        }
 
        if(prop->type != PROP_COLLECTION) {
-               fprintf(stderr, "RNA_def_property_collection_sdna: %s.%s, type is not collection.\n", srna->identifier, prop->identifier);
+               fprintf(stderr, "RNA_def_property_collection_sdna: \"%s.%s\", type is not collection.\n", srna->identifier, prop->identifier);
                DefRNA.error= 1;
                return;
        }
@@ -1673,7 +1673,7 @@ void RNA_def_property_collection_sdna(PropertyRNA *prop, const char *structname,
                        prop->totarraylength= 0;
 
                        if(!DefRNA.silent) {
-                               fprintf(stderr, "RNA_def_property_collection_sdna: %s.%s, array of collections not supported.\n", structname, propname);
+                               fprintf(stderr, "RNA_def_property_collection_sdna: \"%s.%s\", array of collections not supported.\n", structname, propname);
                                DefRNA.error= 1;
                        }
                }
@@ -1714,7 +1714,7 @@ void RNA_def_property_collection_sdna(PropertyRNA *prop, const char *structname,
                }
                else {
                        if(!DefRNA.silent) {
-                               fprintf(stderr, "RNA_def_property_collection_sdna: %s.%s not found.\n", structname, lengthpropname);
+                               fprintf(stderr, "RNA_def_property_collection_sdna: \"%s.%s\" not found.\n", structname, lengthpropname);
                                DefRNA.error= 1;
                        }
                }
@@ -1794,7 +1794,7 @@ void RNA_def_property_boolean_funcs(PropertyRNA *prop, const char *get, const ch
                        break;
                }
                default:
-                       fprintf(stderr, "RNA_def_property_boolean_funcs: %s.%s, type is not boolean.\n", srna->identifier, prop->identifier);
+                       fprintf(stderr, "RNA_def_property_boolean_funcs: \"%s.%s\", type is not boolean.\n", srna->identifier, prop->identifier);
                        DefRNA.error= 1;
                        break;
        }
@@ -1825,7 +1825,7 @@ void RNA_def_property_int_funcs(PropertyRNA *prop, const char *get, const char *
                        break;
                }
                default:
-                       fprintf(stderr, "RNA_def_property_int_funcs: %s.%s, type is not int.\n", srna->identifier, prop->identifier);
+                       fprintf(stderr, "RNA_def_property_int_funcs: \"%s.%s\", type is not int.\n", srna->identifier, prop->identifier);
                        DefRNA.error= 1;
                        break;
        }
@@ -1856,7 +1856,7 @@ void RNA_def_property_float_funcs(PropertyRNA *prop, const char *get, const char
                        break;
                }
                default:
-                       fprintf(stderr, "RNA_def_property_float_funcs: %s.%s, type is not float.\n", srna->identifier, prop->identifier);
+                       fprintf(stderr, "RNA_def_property_float_funcs: \"%s.%s\", type is not float.\n", srna->identifier, prop->identifier);
                        DefRNA.error= 1;
                        break;
        }
@@ -1881,7 +1881,7 @@ void RNA_def_property_enum_funcs(PropertyRNA *prop, const char *get, const char
                        break;
                }
                default:
-                       fprintf(stderr, "RNA_def_property_enum_funcs: %s.%s, type is not enum.\n", srna->identifier, prop->identifier);
+                       fprintf(stderr, "RNA_def_property_enum_funcs: \"%s.%s\", type is not enum.\n", srna->identifier, prop->identifier);
                        DefRNA.error= 1;
                        break;
        }
@@ -1906,7 +1906,7 @@ void RNA_def_property_string_funcs(PropertyRNA *prop, const char *get, const cha
                        break;
                }
                default:
-                       fprintf(stderr, "RNA_def_property_string_funcs: %s.%s, type is not string.\n", srna->identifier, prop->identifier);
+                       fprintf(stderr, "RNA_def_property_string_funcs: \"%s.%s\", type is not string.\n", srna->identifier, prop->identifier);
                        DefRNA.error= 1;
                        break;
        }
@@ -1932,7 +1932,7 @@ void RNA_def_property_pointer_funcs(PropertyRNA *prop, const char *get, const ch
                        break;
                }
                default:
-                       fprintf(stderr, "RNA_def_property_pointer_funcs: %s.%s, type is not pointer.\n", srna->identifier, prop->identifier);
+                       fprintf(stderr, "RNA_def_property_pointer_funcs: \"%s.%s\", type is not pointer.\n", srna->identifier, prop->identifier);
                        DefRNA.error= 1;
                        break;
        }
@@ -1961,7 +1961,7 @@ void RNA_def_property_collection_funcs(PropertyRNA *prop, const char *begin, con
                        break;
                }
                default:
-                       fprintf(stderr, "RNA_def_property_collection_funcs: %s.%s, type is not collection.\n", srna->identifier, prop->identifier);
+                       fprintf(stderr, "RNA_def_property_collection_funcs: \"%s.%s\", type is not collection.\n", srna->identifier, prop->identifier);
                        DefRNA.error= 1;
                        break;
        }
@@ -2423,11 +2423,11 @@ FunctionRNA *RNA_def_function_runtime(StructRNA *srna, const char *identifier, C
 void RNA_def_function_return(FunctionRNA *func, PropertyRNA *ret)
 {
        if (ret->flag & PROP_DYNAMIC) {
-               fprintf(stderr, "RNA_def_function_return: %s.%s, dynamic values are not allowed as strict returns, use RNA_def_function_output instead.\n", func->identifier, ret->identifier);
+               fprintf(stderr, "RNA_def_function_return: \"%s.%s\", dynamic values are not allowed as strict returns, use RNA_def_function_output instead.\n", func->identifier, ret->identifier);
                return;
        }
        else if (ret->arraydimension) {
-               fprintf(stderr, "RNA_def_function_return: %s.%s, arrays are not allowed as strict returns, use RNA_def_function_output instead.\n", func->identifier, ret->identifier);
+               fprintf(stderr, "RNA_def_function_return: \"%s.%s\", arrays are not allowed as strict returns, use RNA_def_function_output instead.\n", func->identifier, ret->identifier);
                return;
        }
 
index 5056d5e3ec7ef470a42b2ed3ffd12d57d26c9179..435c90eb623d0168feae5627857a22c84662ed81 100644 (file)
@@ -89,29 +89,6 @@ static PointerRNA rna_ParticleBrush_curve_get(PointerRNA *ptr)
        return rna_pointer_inherit_refine(ptr, &RNA_CurveMapping, NULL);
 }
 
-static void rna_Paint_brushes_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
-{
-       Paint *p= (Paint*)ptr->data;
-       rna_iterator_array_begin(iter, (void*)p->brushes, sizeof(Brush*), p->brush_count, 0, NULL);
-}
-
-static int rna_Paint_brushes_length(PointerRNA *ptr)
-{
-       Paint *p= (Paint*)ptr->data;
-
-       return p->brush_count;
-}
-
-static PointerRNA rna_Paint_active_brush_get(PointerRNA *ptr)
-{
-       return rna_pointer_inherit_refine(ptr, &RNA_Brush, paint_brush(ptr->data));
-}
-
-static void rna_Paint_active_brush_set(PointerRNA *ptr, PointerRNA value)
-{
-       paint_brush_set(ptr->data, value.data);
-}
-
 static void rna_ParticleEdit_redo(Main *bmain, Scene *scene, PointerRNA *ptr)
 {
        Object *ob= (scene->basact)? scene->basact->object: NULL;
@@ -179,52 +156,13 @@ static int rna_ParticleEdit_hair_get(PointerRNA *ptr)
        return 0;
 }
 
-static void rna_Paint_active_brush_index_set(PointerRNA *ptr, int value)
-{
-       Paint *p= ptr->data;
-       CLAMP(value, 0, p->brush_count-1);
-       p->active_brush_index= value;
-}
-
-static void rna_Paint_active_brush_index_range(PointerRNA *ptr, int *min, int *max)
-{
-       Paint *p= ptr->data;
-       *min= 0;
-       *max= MAX2(p->brush_count-1, 0);
-}
-
-static void rna_Paint_active_brush_name_get(PointerRNA *ptr, char *value)
-{
-       Paint *p= ptr->data;
-       Brush *br = paint_brush(p);
-       
-       BLI_strncpy(value, br->id.name+2, sizeof(br->id.name)-2);
-}
-
-
-static int rna_Paint_active_brush_name_length(PointerRNA *ptr)
-{
-       Paint *p= ptr->data;
-       Brush *br = paint_brush(p);
-       return strlen(br->id.name+2);
-}
-
-static void rna_Paint_active_brush_name_set(PointerRNA *ptr, const char *value)
+static int rna_Brush_mode_poll(PointerRNA *ptr, PointerRNA value)
 {
-       Paint *p= ptr->data;
-       Brush *br;
-       int i;
-       
-       for(i = 0; i < p->brush_count; ++i) {
-               br = p->brushes[i];
-
-               if (strcmp(br->id.name+2, value)==0) {
-                       paint_brush_set(p, br);
-                       return;
-               }
-       }
+       Scene *scene= (Scene *)ptr->id.data;
+       Object *ob = OBACT;
+       Brush *brush= value.id.data;
+       return ob->mode & brush->ob_mode;
 }
-
 #else
 
 static void rna_def_paint(BlenderRNA *brna)
@@ -235,32 +173,11 @@ static void rna_def_paint(BlenderRNA *brna)
        srna= RNA_def_struct(brna, "Paint", NULL);
        RNA_def_struct_ui_text(srna, "Paint", "");
 
-       prop= RNA_def_property(srna, "brushes", PROP_COLLECTION, PROP_NONE);
-       RNA_def_property_struct_type(prop, "Brush");
-       RNA_def_property_collection_funcs(prop, "rna_Paint_brushes_begin",
-                                         "rna_iterator_array_next",
-                                         "rna_iterator_array_end",
-                                         "rna_iterator_array_dereference_get", 
-                                         "rna_Paint_brushes_length", 0, 0);
-       RNA_def_property_ui_text(prop, "Brushes", "Brushes selected for this paint mode");
-
-       prop= RNA_def_property(srna, "active_brush_index", PROP_INT, PROP_NONE);
-       RNA_def_property_int_funcs(prop, NULL, "rna_Paint_active_brush_index_set", "rna_Paint_active_brush_index_range");
-       RNA_def_property_range(prop, 0, INT_MAX);
-       RNA_def_property_update(prop, NC_BRUSH|NA_EDITED, NULL);
-       
-       prop= RNA_def_property(srna, "active_brush_name", PROP_STRING, PROP_NONE);
-       RNA_def_property_string_funcs(prop, "rna_Paint_active_brush_name_get", "rna_Paint_active_brush_name_length", "rna_Paint_active_brush_name_set");
-       RNA_def_property_string_maxlength(prop, sizeof(((ID*)NULL)->name)-2);
-       RNA_def_property_ui_text(prop, "Active Brush Name", "");
-       RNA_def_property_update(prop, NC_BRUSH|NA_EDITED, NULL);
-
-       /* Fake property to get active brush directly, rather than integer index */
+       /* Global Settings */
        prop= RNA_def_property(srna, "brush", PROP_POINTER, PROP_NONE);
-       RNA_def_property_struct_type(prop, "Brush");
-       RNA_def_property_pointer_funcs(prop, "rna_Paint_active_brush_get", "rna_Paint_active_brush_set", NULL, NULL);
        RNA_def_property_flag(prop, PROP_EDITABLE);
-       RNA_def_property_ui_text(prop, "Brush", "Active paint brush");
+       RNA_def_property_pointer_funcs(prop, NULL, NULL, NULL, "rna_Brush_mode_poll");
+       RNA_def_property_ui_text(prop, "Brush", "Active Brush");
        RNA_def_property_update(prop, NC_BRUSH|NA_EDITED, NULL);
 
        prop= RNA_def_property(srna, "show_brush", PROP_BOOLEAN, PROP_NONE);
index b2831c4b1d3bbfc07c70ee7aac3d08d9b14d8dfc..1c751433e31f24d1e841826ab613cb388f1f3d72 100644 (file)
@@ -274,7 +274,6 @@ void RNA_api_ui_layout(StructRNA *srna)
        RNA_def_string(func, "new", "", 0, "", "Operator identifier to create a new ID block.");
        RNA_def_string(func, "open", "", 0, "", "Operator identifier to open a file for creating a new ID block.");
        RNA_def_string(func, "unlink", "", 0, "", "Operator identifier to unlink the ID block.");
-       RNA_def_string(func, "filter", "", 0, "", "Function identifier to filter the ID block.");       
        
        func= RNA_def_function(srna, "template_ID_preview", "uiTemplateIDPreview");
        RNA_def_function_flag(func, FUNC_USE_CONTEXT);
@@ -282,7 +281,6 @@ void RNA_api_ui_layout(StructRNA *srna)
        RNA_def_string(func, "new", "", 0, "", "Operator identifier to create a new ID block.");
        RNA_def_string(func, "open", "", 0, "", "Operator identifier to open a file for creating a new ID block.");
        RNA_def_string(func, "unlink", "", 0, "", "Operator identifier to unlink the ID block.");
-       RNA_def_string(func, "filter", "", 0, "", "Function identifier to filter the ID block.");
        RNA_def_int(func, "rows", 0, 0, INT_MAX, "Number of thumbnail preview rows to display", "", 0, INT_MAX);
        RNA_def_int(func, "cols", 0, 0, INT_MAX, "Number of thumbnail preview columns to display", "", 0, INT_MAX);