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:
authorCampbell Barton <ideasman42@gmail.com>2010-08-04 16:18:07 +0400
committerCampbell Barton <ideasman42@gmail.com>2010-08-04 16:18:07 +0400
commit1f77f7b05af24d3117d76d8c2ec43dbee031ab6a (patch)
treec3262b326313bb4c1cdf0dc6894204e4eaf3bdd9 /source/blender/makesrna/intern/rna_sculpt_paint.c
parent2f8f86e4f6afe8ecdff5c57bdbcc1c0d9b18301e (diff)
Brush/Paint internal changes
- 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.
Diffstat (limited to 'source/blender/makesrna/intern/rna_sculpt_paint.c')
-rw-r--r--source/blender/makesrna/intern/rna_sculpt_paint.c99
1 files changed, 8 insertions, 91 deletions
diff --git a/source/blender/makesrna/intern/rna_sculpt_paint.c b/source/blender/makesrna/intern/rna_sculpt_paint.c
index 5056d5e3ec7..435c90eb623 100644
--- a/source/blender/makesrna/intern/rna_sculpt_paint.c
+++ b/source/blender/makesrna/intern/rna_sculpt_paint.c
@@ -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);