diff options
author | Campbell Barton <ideasman42@gmail.com> | 2010-08-04 16:18:07 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2010-08-04 16:18:07 +0400 |
commit | 1f77f7b05af24d3117d76d8c2ec43dbee031ab6a (patch) | |
tree | c3262b326313bb4c1cdf0dc6894204e4eaf3bdd9 /source/blender/makesrna | |
parent | 2f8f86e4f6afe8ecdff5c57bdbcc1c0d9b18301e (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')
-rw-r--r-- | source/blender/makesrna/intern/rna_brush.c | 81 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_define.c | 92 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_sculpt_paint.c | 99 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_ui_api.c | 2 |
4 files changed, 72 insertions, 202 deletions
diff --git a/source/blender/makesrna/intern/rna_brush.c b/source/blender/makesrna/intern/rna_brush.c index 7a08e1403e3..3d1cb7c5c2f 100644 --- a/source/blender/makesrna/intern/rna_brush.c +++ b/source/blender/makesrna/intern/rna_brush.c @@ -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"); diff --git a/source/blender/makesrna/intern/rna_define.c b/source/blender/makesrna/intern/rna_define.c index d4640058c5c..d89d0ad5d29 100644 --- a/source/blender/makesrna/intern/rna_define.c +++ b/source/blender/makesrna/intern/rna_define.c @@ -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; } 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); diff --git a/source/blender/makesrna/intern/rna_ui_api.c b/source/blender/makesrna/intern/rna_ui_api.c index b2831c4b1d3..1c751433e31 100644 --- a/source/blender/makesrna/intern/rna_ui_api.c +++ b/source/blender/makesrna/intern/rna_ui_api.c @@ -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); |