diff options
author | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2013-01-06 02:24:05 +0400 |
---|---|---|
committer | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2013-01-06 02:24:05 +0400 |
commit | feccbaabbd39c18b2f552964ebd8dfab4eeaed89 (patch) | |
tree | 0069f654883a7a02dd320649ce61bd7933748111 /source/blender/makesrna/intern | |
parent | a22096e8019c461128a0907e4026859996ec1b5c (diff) | |
parent | 37ba969c74840142682cf22f34610f3b65b86cf4 (diff) |
Merged changes in the trunk up to revision 53584.
Conflicts resolved:
release/scripts/startup/bl_ui/properties_render.py
source/blender/blenloader/intern/readfile.c
source/blender/editors/interface/interface_templates.c
source/blender/makesrna/RNA_enum_types.h
Also made additional code updates for:
r53355 UIList - Python-extendable list of UI items
r53460 Alpha premul pipeline cleanup
Diffstat (limited to 'source/blender/makesrna/intern')
35 files changed, 1286 insertions, 271 deletions
diff --git a/source/blender/makesrna/intern/makesrna.c b/source/blender/makesrna/intern/makesrna.c index 1b1e4f19cbb..a9cb6cdf77e 100644 --- a/source/blender/makesrna/intern/makesrna.c +++ b/source/blender/makesrna/intern/makesrna.c @@ -415,10 +415,10 @@ static const char *rna_type_type_name(PropertyRNA *prop) return "float"; case PROP_STRING: if (prop->flag & PROP_THICK_WRAP) { - return "char*"; + return "char *"; } else { - return "const char*"; + return "const char *"; } default: return NULL; @@ -870,16 +870,16 @@ static char *rna_def_property_set_func(FILE *f, StructRNA *srna, PropertyRNA *pr if (prop->flag & PROP_ID_REFCOUNT) { fprintf(f, "\n if (data->%s)\n", dp->dnaname); - fprintf(f, " id_us_min((ID*)data->%s);\n", dp->dnaname); + fprintf(f, " id_us_min((ID *)data->%s);\n", dp->dnaname); fprintf(f, " if (value.data)\n"); - fprintf(f, " id_us_plus((ID*)value.data);\n\n"); + fprintf(f, " id_us_plus((ID *)value.data);\n\n"); } else { PointerPropertyRNA *pprop = (PointerPropertyRNA *)dp->prop; StructRNA *type = rna_find_struct((const char *)pprop->type); if (type && (type->flag & STRUCT_ID)) { fprintf(f, " if (value.data)\n"); - fprintf(f, " id_lib_extern((ID*)value.data);\n\n"); + fprintf(f, " id_lib_extern((ID *)value.data);\n\n"); } } @@ -1084,7 +1084,7 @@ static char *rna_def_property_begin_func(FILE *f, StructRNA *srna, PropertyRNA * fprintf(f, "\n memset(iter, 0, sizeof(*iter));\n"); fprintf(f, " iter->parent= *ptr;\n"); - fprintf(f, " iter->prop= (PropertyRNA*)&rna_%s_%s;\n", srna->identifier, prop->identifier); + fprintf(f, " iter->prop= (PropertyRNA *)&rna_%s_%s;\n", srna->identifier, prop->identifier); if (dp->dnalengthname || dp->dnalengthfixed) { if (manualfunc) { @@ -1768,7 +1768,7 @@ static void rna_def_property_funcs_header_cpp(FILE *f, StructRNA *srna, Property const char *collection_funcs = "DefaultCollectionFunctions"; if (!(dp->prop->flag & (PROP_IDPROPERTY | PROP_BUILTIN)) && cprop->property.srna) - collection_funcs = (char*)cprop->property.srna; + collection_funcs = (char *)cprop->property.srna; if (cprop->item_type) fprintf(f, "\tCOLLECTION_PROPERTY(%s, %s, %s, %s, %s, %s, %s)", collection_funcs, (const char *)cprop->item_type, srna->identifier, @@ -2906,9 +2906,9 @@ static void rna_generate_property(FILE *f, StructRNA *srna, const char *nest, Pr rna_property_structname(prop->type), srna->identifier, strnest, prop->identifier); - if (prop->next) fprintf(f, "\t{(PropertyRNA*)&rna_%s%s_%s, ", srna->identifier, strnest, prop->next->identifier); + if (prop->next) fprintf(f, "\t{(PropertyRNA *)&rna_%s%s_%s, ", srna->identifier, strnest, prop->next->identifier); else fprintf(f, "\t{NULL, "); - if (prop->prev) fprintf(f, "(PropertyRNA*)&rna_%s%s_%s,\n", srna->identifier, strnest, prop->prev->identifier); + if (prop->prev) fprintf(f, "(PropertyRNA *)&rna_%s%s_%s,\n", srna->identifier, strnest, prop->prev->identifier); else fprintf(f, "NULL,\n"); fprintf(f, "\t%d, ", prop->magic); rna_print_c_string(f, prop->identifier); @@ -3080,12 +3080,12 @@ static void rna_generate_struct(BlenderRNA *UNUSED(brna), StructRNA *srna, FILE fprintf(f, "%s%s rna_%s_%s_func = {\n", "", "FunctionRNA", srna->identifier, func->identifier); if (func->cont.next) - fprintf(f, "\t{(FunctionRNA*)&rna_%s_%s_func, ", srna->identifier, + fprintf(f, "\t{(FunctionRNA *)&rna_%s_%s_func, ", srna->identifier, ((FunctionRNA *)func->cont.next)->identifier); else fprintf(f, "\t{NULL, "); if (func->cont.prev) - fprintf(f, "(FunctionRNA*)&rna_%s_%s_func,\n", srna->identifier, + fprintf(f, "(FunctionRNA *)&rna_%s_%s_func,\n", srna->identifier, ((FunctionRNA *)func->cont.prev)->identifier); else fprintf(f, "NULL,\n"); @@ -3093,11 +3093,11 @@ static void rna_generate_struct(BlenderRNA *UNUSED(brna), StructRNA *srna, FILE fprintf(f, "\tNULL,\n"); parm = func->cont.properties.first; - if (parm) fprintf(f, "\t{(PropertyRNA*)&rna_%s_%s_%s, ", srna->identifier, func->identifier, parm->identifier); + if (parm) fprintf(f, "\t{(PropertyRNA *)&rna_%s_%s_%s, ", srna->identifier, func->identifier, parm->identifier); else fprintf(f, "\t{NULL, "); parm = func->cont.properties.last; - if (parm) fprintf(f, "(PropertyRNA*)&rna_%s_%s_%s}},\n", srna->identifier, func->identifier, parm->identifier); + if (parm) fprintf(f, "(PropertyRNA *)&rna_%s_%s_%s}},\n", srna->identifier, func->identifier, parm->identifier); else fprintf(f, "NULL}},\n"); fprintf(f, "\t"); @@ -3110,7 +3110,7 @@ static void rna_generate_struct(BlenderRNA *UNUSED(brna), StructRNA *srna, FILE else fprintf(f, "\tNULL,\n"); if (func->c_ret) - fprintf(f, "\t(PropertyRNA*)&rna_%s_%s_%s\n", srna->identifier, func->identifier, func->c_ret->identifier); + fprintf(f, "\t(PropertyRNA *)&rna_%s_%s_%s\n", srna->identifier, func->identifier, func->c_ret->identifier); else fprintf(f, "\tNULL\n"); @@ -3128,11 +3128,11 @@ static void rna_generate_struct(BlenderRNA *UNUSED(brna), StructRNA *srna, FILE fprintf(f, "\tNULL,\n"); prop = srna->cont.properties.first; - if (prop) fprintf(f, "\t{(PropertyRNA*)&rna_%s_%s, ", srna->identifier, prop->identifier); + if (prop) fprintf(f, "\t{(PropertyRNA *)&rna_%s_%s, ", srna->identifier, prop->identifier); else fprintf(f, "\t{NULL, "); prop = srna->cont.properties.last; - if (prop) fprintf(f, "(PropertyRNA*)&rna_%s_%s}},\n", srna->identifier, prop->identifier); + if (prop) fprintf(f, "(PropertyRNA *)&rna_%s_%s}},\n", srna->identifier, prop->identifier); else fprintf(f, "NULL}},\n"); fprintf(f, "\t"); rna_print_c_string(f, srna->identifier); @@ -3151,7 +3151,7 @@ static void rna_generate_struct(BlenderRNA *UNUSED(brna), StructRNA *srna, FILE while (base->base && base->base->nameproperty == prop) base = base->base; - fprintf(f, "\t(PropertyRNA*)&rna_%s_%s, ", base->identifier, prop->identifier); + fprintf(f, "\t(PropertyRNA *)&rna_%s_%s, ", base->identifier, prop->identifier); } else fprintf(f, "\tNULL, "); @@ -3159,7 +3159,7 @@ static void rna_generate_struct(BlenderRNA *UNUSED(brna), StructRNA *srna, FILE base = srna; while (base->base && base->base->iteratorproperty == prop) base = base->base; - fprintf(f, "(PropertyRNA*)&rna_%s_rna_properties,\n", base->identifier); + fprintf(f, "(PropertyRNA *)&rna_%s_rna_properties,\n", base->identifier); if (srna->base) fprintf(f, "\t&RNA_%s,\n", srna->base->identifier); else fprintf(f, "\tNULL,\n"); @@ -3181,11 +3181,11 @@ static void rna_generate_struct(BlenderRNA *UNUSED(brna), StructRNA *srna, FILE } func = srna->functions.first; - if (func) fprintf(f, "\t{(FunctionRNA*)&rna_%s_%s_func, ", srna->identifier, func->identifier); + if (func) fprintf(f, "\t{(FunctionRNA *)&rna_%s_%s_func, ", srna->identifier, func->identifier); else fprintf(f, "\t{NULL, "); func = srna->functions.last; - if (func) fprintf(f, "(FunctionRNA*)&rna_%s_%s_func}\n", srna->identifier, func->identifier); + if (func) fprintf(f, "(FunctionRNA *)&rna_%s_%s_func}\n", srna->identifier, func->identifier); else fprintf(f, "NULL}\n"); fprintf(f, "};\n"); @@ -3578,7 +3578,7 @@ static const char *cpp_classes = "" " int length;\n" "\n" " DynamicArray() : data(NULL), length(0) {}\n" -" DynamicArray(int new_length) : data(NULL), length(new_length) { data = (float*)malloc(sizeof(T) * new_length); }\n" +" DynamicArray(int new_length) : data(NULL), length(new_length) { data = (float *)malloc(sizeof(T) * new_length); }\n" " DynamicArray(const DynamicArray<T>& other) { copy_from(other); }\n" " const DynamicArray<T>& operator=(const DynamicArray<T>& other) { copy_from(other); return *this; }\n" "\n" @@ -3589,7 +3589,7 @@ static const char *cpp_classes = "" "protected:\n" " void copy_from(const DynamicArray<T>& other) {\n" " if (data) free(data);\n" -" data = (float*)malloc(sizeof(T) * other.length);\n" +" data = (float *)malloc(sizeof(T) * other.length);\n" " memcpy(data, other.data, sizeof(T) * other.length);\n" " length = other.length;\n" " }\n" @@ -3620,7 +3620,7 @@ static const char *cpp_classes = "" "{ return iter.valid != other.iter.valid; }\n" "\n" " void begin(const Pointer &ptr)\n" -" { if (init) Tend(&iter); Tbegin(&iter, (PointerRNA*)&ptr.ptr); t = T(iter.ptr); init = true; }\n" +" { if (init) Tend(&iter); Tbegin(&iter, (PointerRNA *)&ptr.ptr); t = T(iter.ptr); init = true; }\n" "\n" "private:\n" " const CollectionIterator<T, Tbegin, Tnext, Tend>& operator=" @@ -3754,13 +3754,13 @@ static void rna_generate_header_cpp(BlenderRNA *UNUSED(brna), FILE *f) if (first_collection_func_struct == NULL) first_collection_func_struct = ds->srna->identifier; - if (!rna_is_collection_functions_struct(collection_func_structs, (char*)prop->srna)) { + if (!rna_is_collection_functions_struct(collection_func_structs, (char *)prop->srna)) { if (all_collection_func_structs >= max_collection_func_structs) { printf("Array size to store all collection structures names is too small\n"); exit(1); } - collection_func_structs[all_collection_func_structs++] = (char*)prop->srna; + collection_func_structs[all_collection_func_structs++] = (char *)prop->srna; } } } diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c index caa53a23d77..0048e1c60c2 100644 --- a/source/blender/makesrna/intern/rna_access.c +++ b/source/blender/makesrna/intern/rna_access.c @@ -4204,6 +4204,8 @@ char *RNA_path_full_struct_py(struct PointerRNA *ptr) ret = BLI_sprintfN("%s.%s", id_path, data_path); + MEM_freeN(data_path); + return ret; } @@ -4235,6 +4237,10 @@ char *RNA_path_full_property_py(PointerRNA *ptr, PropertyRNA *prop, int index) ret = BLI_sprintfN("%s.%s[%d]", id_path, data_path, index); } + MEM_freeN(id_path); + if (data_path) { + MEM_freeN(data_path); + } return ret; } @@ -4264,6 +4270,10 @@ char *RNA_path_struct_property_py(PointerRNA *ptr, PropertyRNA *prop, int index) data_path, index); } + if (data_path) { + MEM_freeN(data_path); + } + return ret; } diff --git a/source/blender/makesrna/intern/rna_animation.c b/source/blender/makesrna/intern/rna_animation.c index 7229dddf6d6..402d05a20b6 100644 --- a/source/blender/makesrna/intern/rna_animation.c +++ b/source/blender/makesrna/intern/rna_animation.c @@ -52,6 +52,20 @@ EnumPropertyItem keyingset_path_grouping_items[] = { {0, NULL, 0, NULL, NULL} }; +/* It would be cool to get rid of this 'INSERTKEY_' prefix in 'py strings' values, but it would break existing + * exported keyingset... :/ + */ +EnumPropertyItem keying_flag_items[] = { + {INSERTKEY_NEEDED, "INSERTKEY_NEEDED", 0, "Only Needed", + "Only insert keyframes where they're needed in the relevant F-Curves"}, + {INSERTKEY_MATRIX, "INSERTKEY_VISUAL", 0, "Visual Keying", + "Insert keyframes based on 'visual transforms'"}, + {INSERTKEY_XYZ2RGB, "INSERTKEY_XYZ_TO_RGB", 0, "XYZ=RGB Colors", + "Color for newly added transformation F-Curves (Location, Rotation, Scale) " + "and also Color is based on the transform axis"}, + {0, NULL, 0, NULL, NULL} +}; + #ifdef RNA_RUNTIME #include "BLI_math_base.h" @@ -518,17 +532,6 @@ static void rna_def_common_keying_flags(StructRNA *srna, short UNUSED(reg)) { PropertyRNA *prop; - static EnumPropertyItem keying_flag_items[] = { - {INSERTKEY_NEEDED, "INSERTKEY_NEEDED", 0, "Only Needed", - "Only insert keyframes where they're needed in the relevant F-Curves"}, - {INSERTKEY_MATRIX, "INSERTKEY_VISUAL", 0, "Visual Keying", - "Insert keyframes based on 'visual transforms'"}, - {INSERTKEY_XYZ2RGB, "INSERTKEY_XYZ_TO_RGB", 0, "XYZ=RGB Colors", - "Color for newly added transformation F-Curves (Location, Rotation, Scale) " - "and also Color is based on the transform axis"}, - {0, NULL, 0, NULL, NULL} - }; - prop = RNA_def_property(srna, "bl_options", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "keyingflag"); RNA_def_property_enum_items(prop, keying_flag_items); diff --git a/source/blender/makesrna/intern/rna_brush.c b/source/blender/makesrna/intern/rna_brush.c index 7bdebd620ee..3d5106b0cef 100644 --- a/source/blender/makesrna/intern/rna_brush.c +++ b/source/blender/makesrna/intern/rna_brush.c @@ -65,6 +65,7 @@ EnumPropertyItem brush_sculpt_tool_items[] = { {SCULPT_TOOL_PINCH, "PINCH", ICON_BRUSH_PINCH, "Pinch", ""}, {SCULPT_TOOL_ROTATE, "ROTATE", ICON_BRUSH_ROTATE, "Rotate", ""}, {SCULPT_TOOL_SCRAPE, "SCRAPE", ICON_BRUSH_SCRAPE, "Scrape", ""}, + {SCULPT_TOOL_SIMPLIFY, "SIMPLIFY", ICON_BRUSH_SUBTRACT /* icon TODO */, "Simplify", ""}, {SCULPT_TOOL_SMOOTH, "SMOOTH", ICON_BRUSH_SMOOTH, "Smooth", ""}, {SCULPT_TOOL_SNAKE_HOOK, "SNAKE_HOOK", ICON_BRUSH_SNAKE_HOOK, "Snake Hook", ""}, {SCULPT_TOOL_THUMB, "THUMB", ICON_BRUSH_THUMB, "Thumb", ""}, diff --git a/source/blender/makesrna/intern/rna_camera.c b/source/blender/makesrna/intern/rna_camera.c index b72bba0422a..0b1e1c215c4 100644 --- a/source/blender/makesrna/intern/rna_camera.c +++ b/source/blender/makesrna/intern/rna_camera.c @@ -112,8 +112,8 @@ void RNA_def_camera(BlenderRNA *brna) {0, NULL, 0, NULL, NULL} }; static EnumPropertyItem prop_lens_unit_items[] = { - {0, "MILLIMETERS", 0, "Millimeters", ""}, - {CAM_ANGLETOGGLE, "DEGREES", 0, "Degrees", ""}, + {0, "MILLIMETERS", 0, "Millimeters", "Specify the lens in millimeters"}, + {CAM_ANGLETOGGLE, "FOV", 0, "Field of View", "Specify the lens as the field of view's angle"}, {0, NULL, 0, NULL, NULL} }; static EnumPropertyItem sensor_fit_items[] = { @@ -154,23 +154,23 @@ void RNA_def_camera(BlenderRNA *brna) RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL); prop = RNA_def_property(srna, "angle_x", PROP_FLOAT, PROP_ANGLE); - RNA_def_property_range(prop, M_PI * (0.367 / 180.0), M_PI * (172.847 / 180.0)); + RNA_def_property_range(prop, DEG2RAD(0.367), DEG2RAD(172.847)); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); - RNA_def_property_ui_text(prop, "Horizontal FOV", "Camera lens horizontal field of view in degrees"); + RNA_def_property_ui_text(prop, "Horizontal FOV", "Camera lens horizontal field of view"); RNA_def_property_float_funcs(prop, "rna_Camera_angle_x_get", "rna_Camera_angle_x_set", NULL); RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Camera_update"); prop = RNA_def_property(srna, "angle_y", PROP_FLOAT, PROP_ANGLE); - RNA_def_property_range(prop, M_PI * (0.367 / 180.0), M_PI * (172.847 / 180.0)); + RNA_def_property_range(prop, DEG2RAD(0.367), DEG2RAD(172.847)); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); - RNA_def_property_ui_text(prop, "Vertical FOV", "Camera lens vertical field of view in degrees"); + RNA_def_property_ui_text(prop, "Vertical FOV", "Camera lens vertical field of view"); RNA_def_property_float_funcs(prop, "rna_Camera_angle_y_get", "rna_Camera_angle_y_set", NULL); RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Camera_update"); prop = RNA_def_property(srna, "angle", PROP_FLOAT, PROP_ANGLE); - RNA_def_property_range(prop, M_PI * (0.367 / 180.0), M_PI * (172.847 / 180.0)); + RNA_def_property_range(prop, DEG2RAD(0.367), DEG2RAD(172.847)); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); - RNA_def_property_ui_text(prop, "Field of View", "Camera lens field of view in degrees"); + RNA_def_property_ui_text(prop, "Field of View", "Camera lens field of view"); RNA_def_property_float_funcs(prop, "rna_Camera_angle_get", "rna_Camera_angle_set", NULL); RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Camera_update"); diff --git a/source/blender/makesrna/intern/rna_color.c b/source/blender/makesrna/intern/rna_color.c index 851ae69ed3f..36d5a575ab4 100644 --- a/source/blender/makesrna/intern/rna_color.c +++ b/source/blender/makesrna/intern/rna_color.c @@ -1011,15 +1011,26 @@ static void rna_def_colormanage(BlenderRNA *brna) RNA_def_property_update(prop, NC_WINDOW, "rna_ColorManagement_update"); /* ** Colorspace ** */ - srna = RNA_def_struct(brna, "ColorManagedColorspaceSettings", NULL); - RNA_def_struct_ui_text(srna, "ColorManagedColorspaceSettings", "Input color space settings"); + srna = RNA_def_struct(brna, "ColorManagedInputColorspaceSettings", NULL); + RNA_def_struct_ui_text(srna, "ColorManagedInputColorspaceSettings", "Input color space settings"); prop = RNA_def_property(srna, "name", PROP_ENUM, PROP_NONE); RNA_def_property_enum_items(prop, color_space_items); RNA_def_property_enum_funcs(prop, "rna_ColorManagedColorspaceSettings_colorspace_get", "rna_ColorManagedColorspaceSettings_colorspace_set", "rna_ColorManagedColorspaceSettings_colorspace_itemf"); - RNA_def_property_ui_text(prop, "Color Space", "Input color space name"); + RNA_def_property_ui_text(prop, "Input Color Space", "Color space of the image or movie on disk"); + RNA_def_property_update(prop, NC_WINDOW, "rna_ColorManagedColorspaceSettings_reload_update"); + + srna = RNA_def_struct(brna, "ColorManagedSequencerColorspaceSettings", NULL); + RNA_def_struct_ui_text(srna, "ColorManagedSequencerColorspaceSettings", "Input color space settings"); + + prop = RNA_def_property(srna, "name", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_items(prop, color_space_items); + RNA_def_property_enum_funcs(prop, "rna_ColorManagedColorspaceSettings_colorspace_get", + "rna_ColorManagedColorspaceSettings_colorspace_set", + "rna_ColorManagedColorspaceSettings_colorspace_itemf"); + RNA_def_property_ui_text(prop, "Color Space", "Color space that the sequencer operates in"); RNA_def_property_update(prop, NC_WINDOW, "rna_ColorManagedColorspaceSettings_reload_update"); } diff --git a/source/blender/makesrna/intern/rna_constraint.c b/source/blender/makesrna/intern/rna_constraint.c index 30a9bfd81f6..0c8fb3d6a36 100644 --- a/source/blender/makesrna/intern/rna_constraint.c +++ b/source/blender/makesrna/intern/rna_constraint.c @@ -214,7 +214,7 @@ static void rna_Constraint_name_set(PointerRNA *ptr, const char *value) /* if we have the list, check for unique name, otherwise give up */ if (list) - unique_constraint_name(con, list); + BKE_unique_constraint_name(con, list); } /* fix all the animation data which may link to this */ @@ -293,7 +293,7 @@ static EnumPropertyItem *rna_Constraint_target_space_itemf(bContext *UNUSED(C), PropertyRNA *UNUSED(prop), int *UNUSED(free)) { bConstraint *con = (bConstraint *)ptr->data; - bConstraintTypeInfo *cti = constraint_get_typeinfo(con); + bConstraintTypeInfo *cti = BKE_constraint_get_typeinfo(con); ListBase targets = {NULL, NULL}; bConstraintTarget *ct; @@ -1392,19 +1392,19 @@ static void rna_def_constraint_rigid_body_joint(BlenderRNA *brna) prop = RNA_def_property(srna, "axis_x", PROP_FLOAT, PROP_ANGLE); RNA_def_property_float_sdna(prop, NULL, "axX"); RNA_def_property_range(prop, -M_PI * 2, M_PI * 2); - RNA_def_property_ui_text(prop, "Axis X", "Rotate pivot on X axis in degrees"); + RNA_def_property_ui_text(prop, "Axis X", "Rotate pivot on X axis"); RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update"); prop = RNA_def_property(srna, "axis_y", PROP_FLOAT, PROP_ANGLE); RNA_def_property_float_sdna(prop, NULL, "axY"); RNA_def_property_range(prop, -M_PI * 2, M_PI * 2); - RNA_def_property_ui_text(prop, "Axis Y", "Rotate pivot on Y axis in degrees"); + RNA_def_property_ui_text(prop, "Axis Y", "Rotate pivot on Y axis"); RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update"); prop = RNA_def_property(srna, "axis_z", PROP_FLOAT, PROP_ANGLE); RNA_def_property_float_sdna(prop, NULL, "axZ"); RNA_def_property_range(prop, -M_PI * 2, M_PI * 2); - RNA_def_property_ui_text(prop, "Axis Z", "Rotate pivot on Z axis in degrees"); + RNA_def_property_ui_text(prop, "Axis Z", "Rotate pivot on Z axis"); RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update"); prop = RNA_def_property(srna, "use_linked_collision", PROP_BOOLEAN, PROP_NONE); @@ -1528,7 +1528,7 @@ static void rna_def_constraint_clamp_to(BlenderRNA *brna) prop = RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "tar"); RNA_def_property_pointer_funcs(prop, NULL, NULL, NULL, "rna_Curve_object_poll"); - RNA_def_property_ui_text(prop, "Target", "Target Object"); + RNA_def_property_ui_text(prop, "Target", "Target Object (Curves only)"); RNA_def_property_flag(prop, PROP_EDITABLE); RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update"); diff --git a/source/blender/makesrna/intern/rna_define.c b/source/blender/makesrna/intern/rna_define.c index bb1ecea6a24..727b1e44931 100644 --- a/source/blender/makesrna/intern/rna_define.c +++ b/source/blender/makesrna/intern/rna_define.c @@ -391,7 +391,9 @@ static int rna_validate_identifier(const char *identifier, char *error, int prop { int a = 0; - /* list from http://docs.python.org/py3k/reference/lexical_analysis.html#keywords */ + /* list is from... + * ", ".join(['"%s"' % kw for kw in __import__("keyword").kwlist if kw not in {"False", "None", "True"}]) + */ static const char *kwlist[] = { /* "False", "None", "True", */ "and", "as", "assert", "break", @@ -631,7 +633,7 @@ StructRNA *RNA_def_struct(BlenderRNA *brna, const char *identifier, const char * if (DefRNA.preprocess) { char error[512]; - if (rna_validate_identifier(identifier, error, 0) == 0) { + if (rna_validate_identifier(identifier, error, FALSE) == 0) { fprintf(stderr, "%s: struct identifier \"%s\" error - %s\n", __func__, identifier, error); DefRNA.error = 1; } @@ -909,7 +911,7 @@ PropertyRNA *RNA_def_property(StructOrFunctionRNA *cont_, const char *identifier if (DefRNA.preprocess) { char error[512]; - if (rna_validate_identifier(identifier, error, 1) == 0) { + if (rna_validate_identifier(identifier, error, TRUE) == 0) { fprintf(stderr, "%s: property identifier \"%s.%s\" - %s\n", __func__, CONTAINER_RNA_ID(cont), identifier, error); DefRNA.error = 1; @@ -926,6 +928,16 @@ PropertyRNA *RNA_def_property(StructOrFunctionRNA *cont_, const char *identifier dprop = MEM_callocN(sizeof(PropertyDefRNA), "PropertyDefRNA"); rna_addtail(&dcont->properties, dprop); } + else { +#ifdef DEBUG + char error[512]; + if (rna_validate_identifier(identifier, error, TRUE) == 0) { + fprintf(stderr, "%s: runtime property identifier \"%s.%s\" - %s\n", __func__, + CONTAINER_RNA_ID(cont), identifier, error); + DefRNA.error = 1; + } +#endif + } prop = MEM_callocN(rna_property_type_sizeof(type), "PropertyRNA"); @@ -2674,7 +2686,7 @@ static FunctionRNA *rna_def_function(StructRNA *srna, const char *identifier) if (DefRNA.preprocess) { char error[512]; - if (rna_validate_identifier(identifier, error, 0) == 0) { + if (rna_validate_identifier(identifier, error, FALSE) == 0) { fprintf(stderr, "%s: function identifier \"%s\" - %s\n", __func__, identifier, error); DefRNA.error = 1; } diff --git a/source/blender/makesrna/intern/rna_dynamicpaint.c b/source/blender/makesrna/intern/rna_dynamicpaint.c index 4f9f2009a14..99d2f6dbbda 100644 --- a/source/blender/makesrna/intern/rna_dynamicpaint.c +++ b/source/blender/makesrna/intern/rna_dynamicpaint.c @@ -32,6 +32,8 @@ #include "rna_internal.h" +#include "BLI_math_base.h" + #include "BKE_modifier.h" #include "BKE_dynamicpaint.h" @@ -219,6 +221,14 @@ static int rna_DynamicPaint_is_cache_user_get(PointerRNA *ptr) return (surface->format != MOD_DPAINT_SURFACE_F_IMAGESEQ) ? 1 : 0; } +/* is some 3D view preview available */ +static int rna_DynamicPaint_use_color_preview_get(PointerRNA *ptr) +{ + DynamicPaintSurface *surface = (DynamicPaintSurface *)ptr->data; + + return dynamicPaint_surfaceHasColorPreview(surface); +} + /* does output layer exist*/ static int rna_DynamicPaint_is_output_exists(DynamicPaintSurface *surface, Object *ob, int index) { @@ -239,6 +249,7 @@ static EnumPropertyItem *rna_DynamicPaint_surface_type_itemf(bContext *C, Pointe tmp.value = MOD_DPAINT_SURFACE_T_PAINT; tmp.identifier = "PAINT"; tmp.name = "Paint"; + tmp.icon = ICON_TPAINT_HLT; RNA_enum_item_add(&item, &totitem, &tmp); /* Displace */ @@ -248,6 +259,7 @@ static EnumPropertyItem *rna_DynamicPaint_surface_type_itemf(bContext *C, Pointe tmp.value = MOD_DPAINT_SURFACE_T_DISPLACE; tmp.identifier = "DISPLACE"; tmp.name = "Displace"; + tmp.icon = ICON_MOD_DISPLACE; RNA_enum_item_add(&item, &totitem, &tmp); } @@ -256,6 +268,7 @@ static EnumPropertyItem *rna_DynamicPaint_surface_type_itemf(bContext *C, Pointe tmp.value = MOD_DPAINT_SURFACE_T_WEIGHT; tmp.identifier = "WEIGHT"; tmp.name = "Weight"; + tmp.icon = ICON_MOD_VERTEX_WEIGHT; RNA_enum_item_add(&item, &totitem, &tmp); } @@ -264,6 +277,7 @@ static EnumPropertyItem *rna_DynamicPaint_surface_type_itemf(bContext *C, Pointe tmp.value = MOD_DPAINT_SURFACE_T_WAVE; tmp.identifier = "WAVE"; tmp.name = "Waves"; + tmp.icon = ICON_MOD_WAVE; RNA_enum_item_add(&item, &totitem, &tmp); } @@ -705,6 +719,14 @@ static void rna_def_canvas_surface(BlenderRNA *brna) RNA_def_property_boolean_funcs(prop, "rna_DynamicPaint_is_cache_user_get", NULL); RNA_def_property_ui_text(prop, "Use Cache", ""); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE | PROP_EDITABLE); + + /* whether this surface has preview data for 3D view */ + RNA_define_verify_sdna(FALSE); + prop = RNA_def_property(srna, "use_color_preview", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_funcs(prop, "rna_DynamicPaint_use_color_preview_get", NULL); + RNA_def_property_ui_text(prop, "Use Color Preview", "Whether this surface has some color preview for 3D view"); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE | PROP_EDITABLE); + RNA_define_verify_sdna(TRUE); } static void rna_def_dynamic_paint_canvas_settings(BlenderRNA *brna) diff --git a/source/blender/makesrna/intern/rna_image.c b/source/blender/makesrna/intern/rna_image.c index 9fedbee41ff..5d37f67fa93 100644 --- a/source/blender/makesrna/intern/rna_image.c +++ b/source/blender/makesrna/intern/rna_image.c @@ -116,15 +116,6 @@ static void rna_Image_fields_update(Main *UNUSED(bmain), Scene *UNUSED(scene), P BKE_image_release_ibuf(ima, ibuf, lock); } -static void rna_Image_free_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) -{ - Image *ima = ptr->id.data; - BKE_image_signal(ima, NULL, IMA_SIGNAL_FREE); - WM_main_add_notifier(NC_IMAGE | NA_EDITED, &ima->id); - DAG_id_tag_update(&ima->id, 0); -} - - static void rna_Image_reload_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) { Image *ima = ptr->id.data; @@ -139,6 +130,15 @@ static void rna_Image_generated_update(Main *UNUSED(bmain), Scene *UNUSED(scene) BKE_image_signal(ima, NULL, IMA_SIGNAL_FREE); } +static void rna_Image_colormanage_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) +{ + Image *ima = ptr->id.data; + BKE_image_signal(ima, NULL, IMA_SIGNAL_COLORMANAGE); + DAG_id_tag_update(&ima->id, 0); + WM_main_add_notifier(NC_IMAGE | ND_DISPLAY, &ima->id); + WM_main_add_notifier(NC_IMAGE | NA_EDITED, &ima->id); +} + static void rna_ImageUser_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *ptr) { ImageUser *iuser = ptr->data; @@ -463,6 +463,11 @@ static void rna_def_image(BlenderRNA *brna) {IMA_STD_FIELD, "ODD", 0, "Lower First", "Lower field first"}, {0, NULL, 0, NULL, NULL} }; + static const EnumPropertyItem alpha_mode_items[] = { + {IMA_ALPHA_STRAIGHT, "STRAIGHT", 0, "Straight", "Transparent RGB and alpha pixels are unmodified"}, + {IMA_ALPHA_PREMUL, "PREMUL", 0, "Premultiplied", "Transparent RGB pixels are multiplied by the alpha channel"}, + {0, NULL, 0, NULL, NULL} + }; srna = RNA_def_struct(brna, "Image", "ID"); RNA_def_struct_ui_text(srna, "Image", "Image datablock referencing an external or packed image"); @@ -512,23 +517,17 @@ static void rna_def_image(BlenderRNA *brna) RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_Image_fields_update"); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); - prop = RNA_def_property(srna, "use_premultiply", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", IMA_DO_PREMUL); - RNA_def_property_ui_text(prop, "Premultiply", "Convert RGB from key alpha to premultiplied alpha"); - RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_Image_free_update"); - - prop = RNA_def_property(srna, "use_color_unpremultiply", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", IMA_CM_PREDIVIDE); - RNA_def_property_ui_text(prop, "Color Unpremultiply", - "For premultiplied alpha images, do color space conversion on colors without alpha, " - "to avoid fringing for images with light backgrounds"); - RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_Image_free_update"); prop = RNA_def_property(srna, "view_as_render", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", IMA_VIEW_AS_RENDER); RNA_def_property_ui_text(prop, "View as Render", "Apply render part of display transformation when displaying this image on the screen"); RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, NULL); + prop = RNA_def_property(srna, "use_alpha", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", IMA_IGNORE_ALPHA); + RNA_def_property_ui_text(prop, "Use Alpha", "Use the alpha channel information from the image or make image fully opaque"); + RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_Image_colormanage_update"); + prop = RNA_def_property(srna, "is_dirty", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_funcs(prop, "rna_Image_dirty_get", NULL); RNA_def_property_clear_flag(prop, PROP_EDITABLE); @@ -674,9 +673,14 @@ static void rna_def_image(BlenderRNA *brna) prop = RNA_def_property(srna, "colorspace_settings", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "colorspace_settings"); - RNA_def_property_struct_type(prop, "ColorManagedColorspaceSettings"); + RNA_def_property_struct_type(prop, "ColorManagedInputColorspaceSettings"); RNA_def_property_ui_text(prop, "Color Space Settings", "Input color space settings"); + prop = RNA_def_property(srna, "alpha_mode", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_items(prop, alpha_mode_items); + RNA_def_property_ui_text(prop, "Alpha Mode", "Representation of alpha information in the RGBA pixels"); + RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_Image_colormanage_update"); + RNA_api_image(srna); } diff --git a/source/blender/makesrna/intern/rna_lamp.c b/source/blender/makesrna/intern/rna_lamp.c index af39500442d..660f6fc6ab7 100644 --- a/source/blender/makesrna/intern/rna_lamp.c +++ b/source/blender/makesrna/intern/rna_lamp.c @@ -54,7 +54,7 @@ static void rna_Lamp_buffer_size_set(PointerRNA *ptr, int value) { Lamp *la = (Lamp *)ptr->data; - CLAMP(value, 512, 10240); + CLAMP(value, 128, 10240); la->bufsize = value; la->bufsize &= (~15); /* round to multiple of 16 */ } @@ -540,7 +540,7 @@ static void rna_def_lamp_shadow(StructRNA *srna, int spot, int area) prop = RNA_def_property(srna, "shadow_buffer_size", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "bufsize"); - RNA_def_property_range(prop, 512, 10240); + RNA_def_property_range(prop, 128, 10240); RNA_def_property_ui_text(prop, "Shadow Buffer Size", "Resolution of the shadow buffer, higher values give crisper shadows " "but use more memory"); diff --git a/source/blender/makesrna/intern/rna_mesh.c b/source/blender/makesrna/intern/rna_mesh.c index eb1fd61d9a7..31e27ebc982 100644 --- a/source/blender/makesrna/intern/rna_mesh.c +++ b/source/blender/makesrna/intern/rna_mesh.c @@ -154,7 +154,6 @@ static void rna_Mesh_update_vertmask(Main *bmain, Scene *scene, PointerRNA *ptr) Mesh *me = ptr->data; if ((me->editflag & ME_EDIT_PAINT_VERT_SEL) && (me->editflag & ME_EDIT_PAINT_FACE_SEL)) { me->editflag &= ~ME_EDIT_PAINT_FACE_SEL; - BKE_mesh_flush_select_from_polys(me); } rna_Mesh_update_draw(bmain, scene, ptr); } @@ -164,7 +163,6 @@ static void rna_Mesh_update_facemask(Main *bmain, Scene *scene, PointerRNA *ptr) Mesh *me = ptr->data; if ((me->editflag & ME_EDIT_PAINT_VERT_SEL) && (me->editflag & ME_EDIT_PAINT_FACE_SEL)) { me->editflag &= ~ME_EDIT_PAINT_VERT_SEL; - BKE_mesh_flush_select_from_verts(me); } rna_Mesh_update_draw(bmain, scene, ptr); } @@ -2963,7 +2961,7 @@ static void rna_def_mesh(BlenderRNA *brna) prop = RNA_def_property(srna, "show_extra_face_angle", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "drawflag", ME_DRAWEXTRA_FACEANG); RNA_def_property_ui_text(prop, "Face Angles", - "Display the angles in the selected edges in degrees, " + "Display the angles in the selected edges, " "using global values when set in the transform panel"); RNA_def_property_update(prop, 0, "rna_Mesh_update_draw"); diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c index e1489d821a0..7a576c88677 100644 --- a/source/blender/makesrna/intern/rna_modifier.c +++ b/source/blender/makesrna/intern/rna_modifier.c @@ -748,13 +748,13 @@ static void rna_BevelModifier_angle_limit_set(PointerRNA *ptr, float value) static void rna_UVWarpModifier_vgroup_set(PointerRNA *ptr, const char *value) { - UVWarpModifierData *umd = (UVWarpModifierData*)ptr->data; + UVWarpModifierData *umd = (UVWarpModifierData *)ptr->data; rna_object_vgroup_name_set(ptr, value, umd->vgroup_name, sizeof(umd->vgroup_name)); } static void rna_UVWarpModifier_uvlayer_set(PointerRNA *ptr, const char *value) { - UVWarpModifierData *umd = (UVWarpModifierData*)ptr->data; + UVWarpModifierData *umd = (UVWarpModifierData *)ptr->data; rna_object_uvlayer_name_set(ptr, value, umd->uvlayer_name, sizeof(umd->uvlayer_name)); } @@ -3269,7 +3269,7 @@ static void rna_def_modifier_ocean(BlenderRNA *brna) prop = RNA_def_property(srna, "size", PROP_FLOAT, PROP_UNSIGNED); RNA_def_property_float_sdna(prop, NULL, "size"); - RNA_def_property_ui_text(prop, "Size", ""); + RNA_def_property_ui_text(prop, "Size", "Surface scale factor (does not affect the height of the waves)"); RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, 0); RNA_def_property_update(prop, 0, "rna_OceanModifier_topology_update"); @@ -3310,16 +3310,17 @@ static void rna_def_modifier_ocean(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Resolution", "Resolution of the generated surface"); RNA_def_property_update(prop, 0, "rna_OceanModifier_init_update"); - prop = RNA_def_property(srna, "spatial_size", PROP_INT, PROP_DISTANCE); + prop = RNA_def_property(srna, "spatial_size", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "spatial_size"); RNA_def_property_ui_range(prop, 1, 512, 2, 0); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); - RNA_def_property_ui_text(prop, "Spatial Size", "Physical size of the simulation domain (m)"); + RNA_def_property_ui_text(prop, "Spatial Size", + "Size of the simulation domain (in meters), and of the generated geometry (in BU)"); RNA_def_property_update(prop, 0, "rna_OceanModifier_init_update"); prop = RNA_def_property(srna, "wind_velocity", PROP_FLOAT, PROP_VELOCITY); RNA_def_property_float_sdna(prop, NULL, "wind_velocity"); - RNA_def_property_ui_text(prop, "Wind Velocity", "Wind speed (m/s)"); + RNA_def_property_ui_text(prop, "Wind Velocity", "Wind speed"); RNA_def_property_update(prop, 0, "rna_OceanModifier_init_update"); prop = RNA_def_property(srna, "damping", PROP_FLOAT, PROP_FACTOR); @@ -3332,42 +3333,43 @@ static void rna_def_modifier_ocean(BlenderRNA *brna) RNA_def_property_float_sdna(prop, NULL, "smallest_wave"); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_range(prop, 0.0, FLT_MAX); - RNA_def_property_ui_text(prop, "Smallest Wave", "Shortest allowed wavelength (m)"); + RNA_def_property_ui_text(prop, "Smallest Wave", "Shortest allowed wavelength"); RNA_def_property_update(prop, 0, "rna_OceanModifier_init_update"); prop = RNA_def_property(srna, "wave_alignment", PROP_FLOAT, PROP_UNSIGNED); RNA_def_property_float_sdna(prop, NULL, "wave_alignment"); RNA_def_property_range(prop, 0.0, 10.0); - RNA_def_property_ui_text(prop, "Wave Alignment", ""); + RNA_def_property_ui_text(prop, "Wave Alignment", "How much the waves are aligned to each other"); RNA_def_property_update(prop, 0, "rna_OceanModifier_init_update"); prop = RNA_def_property(srna, "wave_direction", PROP_FLOAT, PROP_ANGLE); RNA_def_property_float_sdna(prop, NULL, "wave_direction"); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); - RNA_def_property_ui_text(prop, "Wave Direction", ""); + RNA_def_property_ui_text(prop, "Wave Direction", "Main direction of the waves when they are (partially) aligned"); RNA_def_property_update(prop, 0, "rna_OceanModifier_init_update"); prop = RNA_def_property(srna, "wave_scale", PROP_FLOAT, PROP_UNSIGNED); RNA_def_property_float_sdna(prop, NULL, "wave_scale"); - RNA_def_property_ui_text(prop, "Wave Scale", ""); + RNA_def_property_ui_text(prop, "Wave Scale", "Scale of the displacement effect"); RNA_def_property_update(prop, 0, "rna_OceanModifier_sim_update"); - prop = RNA_def_property(srna, "depth", PROP_FLOAT, PROP_UNSIGNED); + prop = RNA_def_property(srna, "depth", PROP_FLOAT, PROP_DISTANCE); RNA_def_property_float_sdna(prop, NULL, "depth"); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); - RNA_def_property_ui_text(prop, "Depth", ""); + RNA_def_property_ui_text(prop, "Depth", "Depth of the solid ground below the water surface"); RNA_def_property_ui_range(prop, 0, 250, 1, 0); RNA_def_property_update(prop, 0, "rna_OceanModifier_init_update"); prop = RNA_def_property(srna, "foam_coverage", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "foam_coverage"); - RNA_def_property_ui_text(prop, "Foam Coverage", ""); + RNA_def_property_ui_text(prop, "Foam Coverage", "Amount of generated foam"); RNA_def_property_update(prop, 0, "rna_Modifier_update"); prop = RNA_def_property(srna, "bake_foam_fade", PROP_FLOAT, PROP_UNSIGNED); RNA_def_property_float_sdna(prop, NULL, "foam_fade"); - RNA_def_property_ui_text(prop, "Foam Fade", ""); - RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, 0); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); + RNA_def_property_ui_text(prop, "Foam Fade", "How much foam accumulates over time (baked ocean only)"); + RNA_def_property_ui_range(prop, 0.0, 10.0, 1, 0); RNA_def_property_update(prop, 0, NULL); prop = RNA_def_property(srna, "foam_layer_name", PROP_STRING, PROP_NONE); @@ -3377,33 +3379,34 @@ static void rna_def_modifier_ocean(BlenderRNA *brna) prop = RNA_def_property(srna, "choppiness", PROP_FLOAT, PROP_UNSIGNED); RNA_def_property_float_sdna(prop, NULL, "chop_amount"); - RNA_def_property_ui_text(prop, "Choppiness", ""); + RNA_def_property_ui_text(prop, "Choppiness", + "Choppiness of the wave's crest (adds some horizontal component to the displacement)"); RNA_def_property_ui_range(prop, 0.0, 4.0, 3, 0); RNA_def_property_float_funcs(prop, NULL, "rna_OceanModifier_ocean_chop_set", NULL); RNA_def_property_update(prop, 0, "rna_OceanModifier_sim_update"); prop = RNA_def_property(srna, "time", PROP_FLOAT, PROP_UNSIGNED); RNA_def_property_float_sdna(prop, NULL, "time"); - RNA_def_property_ui_text(prop, "Time", ""); + RNA_def_property_ui_text(prop, "Time", "Current time of the simulation"); RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, 0); RNA_def_property_update(prop, 0, "rna_OceanModifier_sim_update"); prop = RNA_def_property(srna, "random_seed", PROP_INT, PROP_UNSIGNED); RNA_def_property_int_sdna(prop, NULL, "seed"); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); - RNA_def_property_ui_text(prop, "Random Seed", ""); + RNA_def_property_ui_text(prop, "Random Seed", "Seed of the random generator"); RNA_def_property_update(prop, 0, "rna_OceanModifier_init_update"); prop = RNA_def_property(srna, "frame_start", PROP_INT, PROP_UNSIGNED); RNA_def_property_int_sdna(prop, NULL, "bakestart"); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); - RNA_def_property_ui_text(prop, "Bake Start", ""); + RNA_def_property_ui_text(prop, "Bake Start", "Start frame of the ocean baking"); RNA_def_property_update(prop, 0, "rna_OceanModifier_init_update"); prop = RNA_def_property(srna, "frame_end", PROP_INT, PROP_UNSIGNED); RNA_def_property_int_sdna(prop, NULL, "bakeend"); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); - RNA_def_property_ui_text(prop, "Bake End", ""); + RNA_def_property_ui_text(prop, "Bake End", "End frame of the ocean baking"); RNA_def_property_update(prop, 0, "rna_OceanModifier_init_update"); prop = RNA_def_property(srna, "is_cached", PROP_BOOLEAN, PROP_NONE); diff --git a/source/blender/makesrna/intern/rna_movieclip.c b/source/blender/makesrna/intern/rna_movieclip.c index 99effc990a8..3b018591455 100644 --- a/source/blender/makesrna/intern/rna_movieclip.c +++ b/source/blender/makesrna/intern/rna_movieclip.c @@ -308,7 +308,7 @@ static void rna_def_movieclip(BlenderRNA *brna) /* color management */ prop = RNA_def_property(srna, "colorspace_settings", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "colorspace_settings"); - RNA_def_property_struct_type(prop, "ColorManagedColorspaceSettings"); + RNA_def_property_struct_type(prop, "ColorManagedInputColorspaceSettings"); RNA_def_property_ui_text(prop, "Color Space Settings", "Input color space settings"); } diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c index 3e9f5f1b88f..18dfd8aa6f9 100644 --- a/source/blender/makesrna/intern/rna_nodetree.c +++ b/source/blender/makesrna/intern/rna_nodetree.c @@ -1101,7 +1101,7 @@ static void rna_ShaderNodeScript_mode_set(PointerRNA *ptr, int value) /* replace text datablock by filepath */ if (node->id) { - Text *text = (Text*)node->id; + Text *text = (Text *)node->id; if (value == NODE_SCRIPT_EXTERNAL && text->name) { BLI_strncpy(nss->filepath, text->name, sizeof(nss->filepath)); @@ -3217,8 +3217,8 @@ static void def_cmp_premul_key(StructRNA *srna) PropertyRNA *prop; static EnumPropertyItem type_items[] = { - {0, "KEY_TO_PREMUL", 0, "Key to Premul", ""}, - {1, "PREMUL_TO_KEY", 0, "Premul to Key", ""}, + {0, "STRAIGHT_TO_PREMUL", 0, "Straight to Premul", ""}, + {1, "PREMUL_TO_STRAIGHT", 0, "Premul to Straight", ""}, {0, NULL, 0, NULL, NULL} }; diff --git a/source/blender/makesrna/intern/rna_nodetree_types.h b/source/blender/makesrna/intern/rna_nodetree_types.h index de535156199..46f2306f284 100644 --- a/source/blender/makesrna/intern/rna_nodetree_types.h +++ b/source/blender/makesrna/intern/rna_nodetree_types.h @@ -84,6 +84,7 @@ DefNode( ShaderNode, SH_NODE_LIGHT_PATH, 0, "LI DefNode( ShaderNode, SH_NODE_LIGHT_FALLOFF, 0, "LIGHT_FALLOFF", LightFalloff, "Light Falloff", "" ) DefNode( ShaderNode, SH_NODE_OBJECT_INFO, 0, "OBJECT_INFO", ObjectInfo, "Object Info", "" ) DefNode( ShaderNode, SH_NODE_PARTICLE_INFO, 0, "PARTICLE_INFO", ParticleInfo, "Particle Info", "" ) +DefNode( ShaderNode, SH_NODE_HAIR_INFO, 0, "HAIR_INFO", HairInfo, "Hair Info", "" ) DefNode( ShaderNode, SH_NODE_BUMP, 0, "BUMP", Bump, "Bump", "" ) DefNode( ShaderNode, SH_NODE_NORMAL_MAP, def_sh_normal_map, "NORMAL_MAP", NormalMap, "Normal Map", "" ) DefNode( ShaderNode, SH_NODE_TANGENT, def_sh_tangent, "TANGENT", Tangent, "Tangent", "" ) diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c index b218cc6a944..80d74c3a9fe 100644 --- a/source/blender/makesrna/intern/rna_object.c +++ b/source/blender/makesrna/intern/rna_object.c @@ -48,6 +48,7 @@ #include "BLI_utildefines.h" +#include "BKE_paint.h" #include "BKE_tessmesh.h" #include "BKE_group.h" /* needed for object_in_group() */ @@ -1123,7 +1124,7 @@ static void rna_GameObjectSettings_used_state_get(PointerRNA *ptr, int *values) static void rna_GameObjectSettings_col_group_get(PointerRNA *ptr, int *values) { - Object *ob = (Object*)ptr->data; + Object *ob = (Object *)ptr->data; int i; for (i = 0; i < OB_MAX_COL_MASKS; i++) { @@ -1133,7 +1134,7 @@ static void rna_GameObjectSettings_col_group_get(PointerRNA *ptr, int *values) static void rna_GameObjectSettings_col_group_set(PointerRNA *ptr, const int *values) { - Object *ob = (Object*)ptr->data; + Object *ob = (Object *)ptr->data; int i, tot = 0; /* ensure we always have some group selected */ @@ -1152,7 +1153,7 @@ static void rna_GameObjectSettings_col_group_set(PointerRNA *ptr, const int *val static void rna_GameObjectSettings_col_mask_get(PointerRNA *ptr, int *values) { - Object *ob = (Object*)ptr->data; + Object *ob = (Object *)ptr->data; int i; for (i = 0; i < OB_MAX_COL_MASKS; i++) { @@ -1162,7 +1163,7 @@ static void rna_GameObjectSettings_col_mask_get(PointerRNA *ptr, int *values) static void rna_GameObjectSettings_col_mask_set(PointerRNA *ptr, const int *values) { - Object *ob = (Object*)ptr->data; + Object *ob = (Object *)ptr->data; int i, tot = 0; /* ensure we always have some mask selected */ @@ -1252,20 +1253,20 @@ static PointerRNA rna_Object_collision_get(PointerRNA *ptr) static PointerRNA rna_Object_active_constraint_get(PointerRNA *ptr) { Object *ob = (Object *)ptr->id.data; - bConstraint *con = constraints_get_active(&ob->constraints); + bConstraint *con = BKE_constraints_get_active(&ob->constraints); return rna_pointer_inherit_refine(ptr, &RNA_Constraint, con); } static void rna_Object_active_constraint_set(PointerRNA *ptr, PointerRNA value) { Object *ob = (Object *)ptr->id.data; - constraints_set_active(&ob->constraints, (bConstraint *)value.data); + BKE_constraints_set_active(&ob->constraints, (bConstraint *)value.data); } static bConstraint *rna_Object_constraints_new(Object *object, int type) { WM_main_add_notifier(NC_OBJECT | ND_CONSTRAINT | NA_ADDED, object); - return add_ob_constraint(object, NULL, type); + return BKE_add_ob_constraint(object, NULL, type); } static void rna_Object_constraints_remove(Object *object, ReportList *reports, PointerRNA *con_ptr) @@ -1276,7 +1277,7 @@ static void rna_Object_constraints_remove(Object *object, ReportList *reports, P return; } - remove_constraint(&object->constraints, con); + BKE_remove_constraint(&object->constraints, con); RNA_POINTER_INVALIDATE(con_ptr); ED_object_constraint_update(object); @@ -1286,7 +1287,7 @@ static void rna_Object_constraints_remove(Object *object, ReportList *reports, P static void rna_Object_constraints_clear(Object *object) { - free_constraints(&object->constraints); + BKE_free_constraints(&object->constraints); ED_object_constraint_update(object); ED_object_constraint_set_active(object, NULL); @@ -1436,6 +1437,12 @@ int rna_DupliObject_index_get(PointerRNA *ptr) return dob->persistent_id[0]; } +int rna_Object_use_dynamic_topology_sculpting_get(PointerRNA *ptr) +{ + SculptSession *ss = ((Object *)ptr->id.data)->sculpt; + return (ss && ss->bm); +} + #else static int rna_matrix_dimsize_4x4[] = {4, 4}; @@ -2629,6 +2636,12 @@ static void rna_def_object(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Active Shape Key Index", "Current shape key index"); RNA_def_property_update(prop, 0, "rna_Object_active_shape_update"); + /* sculpt */ + prop = RNA_def_property(srna, "use_dynamic_topology_sculpting", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_funcs(prop, "rna_Object_use_dynamic_topology_sculpting_get", NULL); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Dynamic Topology Sculpting", NULL); + RNA_api_object(srna); } diff --git a/source/blender/makesrna/intern/rna_object_api.c b/source/blender/makesrna/intern/rna_object_api.c index 87fc3be28a2..d7115256fe5 100644 --- a/source/blender/makesrna/intern/rna_object_api.c +++ b/source/blender/makesrna/intern/rna_object_api.c @@ -36,42 +36,79 @@ #include "RNA_define.h" -#include "DNA_object_types.h" +#include "DNA_constraint_types.h" #include "DNA_modifier_types.h" +#include "DNA_object_types.h" #include "rna_internal.h" /* own include */ +static EnumPropertyItem space_items[] = { + {CONSTRAINT_SPACE_WORLD, "WORLD", 0, "World Space", + "The most gobal space in Blender"}, + {CONSTRAINT_SPACE_POSE, "POSE", 0, "Pose Space", + "The pose space of a bone (its armature's object space)"}, + {CONSTRAINT_SPACE_PARLOCAL, "LOCAL_WITH_PARENT", 0, "Local With Parent", + "The local space of a bone's parent bone"}, + {CONSTRAINT_SPACE_LOCAL, "LOCAL", 0, "Local Space", + "The local space of an object/bone"}, + {0, NULL, 0, NULL, NULL} +}; + #ifdef RNA_RUNTIME + #include "BLI_math.h" -#include "BKE_main.h" -#include "BKE_global.h" -#include "BKE_context.h" -#include "BKE_report.h" -#include "BKE_object.h" -#include "BKE_mesh.h" -#include "BKE_DerivedMesh.h" +#include "BKE_anim.h" #include "BKE_bvhutils.h" - +#include "BKE_cdderivedmesh.h" +#include "BKE_constraint.h" +#include "BKE_context.h" #include "BKE_customdata.h" -#include "BKE_anim.h" #include "BKE_depsgraph.h" +#include "BKE_DerivedMesh.h" #include "BKE_displist.h" #include "BKE_font.h" +#include "BKE_global.h" +#include "BKE_main.h" +#include "BKE_mesh.h" #include "BKE_mball.h" #include "BKE_modifier.h" -#include "BKE_cdderivedmesh.h" +#include "BKE_object.h" +#include "BKE_report.h" +#include "DNA_curve_types.h" #include "DNA_mesh_types.h" -#include "DNA_scene_types.h" #include "DNA_meshdata_types.h" -#include "DNA_curve_types.h" -#include "DNA_modifier_types.h" -#include "DNA_constraint_types.h" +#include "DNA_scene_types.h" #include "DNA_view3d_types.h" #include "MEM_guardedalloc.h" +/* Convert a given matrix from a space to another (using the object and/or a bone as reference). */ +static void rna_Scene_mat_convert_space(Object *ob, ReportList *reports, bPoseChannel *pchan, + float *mat, float *mat_ret, int from, int to) +{ + copy_m4_m4((float (*)[4])mat_ret, (float (*)[4])mat); + + /* Error in case of invalid from/to values when pchan is NULL */ + if (pchan == NULL) { + if (ELEM(from, CONSTRAINT_SPACE_POSE, CONSTRAINT_SPACE_PARLOCAL)) { + const char *identifier = NULL; + RNA_enum_identifier(space_items, from, &identifier); + BKE_reportf(reports, RPT_ERROR, "'from_space' '%s' is invalid when no pose bone is given!", identifier); + return; + } + if (ELEM(to, CONSTRAINT_SPACE_POSE, CONSTRAINT_SPACE_PARLOCAL)) { + const char *identifier = NULL; + RNA_enum_identifier(space_items, to, &identifier); + BKE_reportf(reports, RPT_ERROR, "'to_space' '%s' is invalid when no pose bone is given!", identifier); + return; + } + } + + BKE_constraint_mat_convertspace(ob, pchan, (float (*)[4])mat_ret, from, to); +} + /* copied from Mesh_getFromObject and adapted to RNA interface */ /* settings: 0 - preview, 1 - render */ static Mesh *rna_Object_to_mesh(Object *ob, ReportList *reports, Scene *sce, int apply_modifiers, int settings) @@ -570,7 +607,7 @@ void rna_Object_dm_info(struct Object *ob, int type, char *result) } #endif /* NDEBUG */ -#else +#else /* RNA_RUNTIME */ void RNA_api_object(StructRNA *srna) { @@ -583,6 +620,8 @@ void RNA_api_object(StructRNA *srna) {0, NULL, 0, NULL, NULL} }; + static int rna_matrix_dimsize_4x4[] = {4, 4}; + #ifndef NDEBUG static EnumPropertyItem mesh_dm_info_items[] = { {0, "SOURCE", 0, "Source", "Source mesh"}, @@ -592,6 +631,25 @@ void RNA_api_object(StructRNA *srna) }; #endif + /* Matrix space conversion */ + func = RNA_def_function(srna, "convert_space", "rna_Scene_mat_convert_space"); + RNA_def_function_ui_description(func, "Convert (transform) the given matrix from one space to another"); + RNA_def_function_flag(func, FUNC_USE_REPORTS); + parm = RNA_def_pointer(func, "pose_bone", "PoseBone", "", + "Bone to use to define spaces (may be None, in which case only the two 'WORLD' and " + "'LOCAL' spaces are usable)"); + parm = RNA_def_property(func, "matrix", PROP_FLOAT, PROP_MATRIX); + RNA_def_property_multi_array(parm, 2, rna_matrix_dimsize_4x4); + RNA_def_property_ui_text(parm, "", "The matrix to transform"); + parm = RNA_def_property(func, "matrix_return", PROP_FLOAT, PROP_MATRIX); + RNA_def_property_multi_array(parm, 2, rna_matrix_dimsize_4x4); + RNA_def_property_ui_text(parm, "", "The transformed matrix"); + RNA_def_function_output(func, parm); + parm = RNA_def_enum(func, "from_space", space_items, CONSTRAINT_SPACE_WORLD, "", + "The space in which 'matrix' is currently"); + parm = RNA_def_enum(func, "to_space", space_items, CONSTRAINT_SPACE_WORLD, "", + "The space to which you want to transform 'matrix'"); + /* mesh */ func = RNA_def_function(srna, "to_mesh", "rna_Object_to_mesh"); RNA_def_function_ui_description(func, "Create a Mesh datablock with modifiers applied"); @@ -737,5 +795,4 @@ void RNA_api_object_base(StructRNA *srna) RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL); } -#endif - +#endif /* RNA_RUNTIME */ diff --git a/source/blender/makesrna/intern/rna_object_force.c b/source/blender/makesrna/intern/rna_object_force.c index 6d7187da7d9..0c2944b3966 100644 --- a/source/blender/makesrna/intern/rna_object_force.c +++ b/source/blender/makesrna/intern/rna_object_force.c @@ -763,7 +763,8 @@ static void rna_def_pointcache(BlenderRNA *brna) prop = RNA_def_property(srna, "frame_start", PROP_INT, PROP_TIME); RNA_def_property_int_sdna(prop, NULL, "startframe"); - RNA_def_property_range(prop, 1, MAXFRAME); + RNA_def_property_range(prop, -MAXFRAME, MAXFRAME); + RNA_def_property_ui_range(prop, -1000, MAXFRAME, 1, 1); RNA_def_property_ui_text(prop, "Start", "Frame on which the simulation starts"); prop = RNA_def_property(srna, "frame_end", PROP_INT, PROP_TIME); diff --git a/source/blender/makesrna/intern/rna_particle.c b/source/blender/makesrna/intern/rna_particle.c index 93f940b1aa3..be3cbfaece3 100644 --- a/source/blender/makesrna/intern/rna_particle.c +++ b/source/blender/makesrna/intern/rna_particle.c @@ -238,7 +238,329 @@ static void rna_ParticleHairKey_location_object_set(PointerRNA *ptr, const float } } -/* property update functions */ +static void rna_ParticleHairKey_co_object(HairKey *hairkey, Object *object, ParticleSystemModifierData *modifier, ParticleData *particle, + float n_co[3]) +{ + + DerivedMesh *hairdm = (modifier->psys->flag & PSYS_HAIR_DYNAMICS) ? modifier->psys->hair_out_dm : NULL; + if (particle) { + if (hairdm) { + MVert *mvert = CDDM_get_vert(hairdm, particle->hair_index + (hairkey - particle->hair)); + copy_v3_v3(n_co, mvert->co); + } + else { + float hairmat[4][4]; + psys_mat_hair_to_object(object, modifier->dm, modifier->psys->part->from, particle, hairmat); + copy_v3_v3(n_co, hairkey->co); + mul_m4_v3(hairmat, n_co); + } + } + else { + zero_v3(n_co); + } +} + +static void rna_Particle_uv_on_emitter(ParticleData *particle, ParticleSystemModifierData *modifier, float n_uv[2]) +{ + /*psys_particle_on_emitter(psmd, part->from, pa->num, pa->num_dmcache, pa->fuv, pa->foffset, co, nor, 0, 0, sd.orco, 0);*/ + + /* get uvco & mcol */ + int num = particle->num_dmcache; + int from = modifier->psys->part->from; + + if (num == DMCACHE_NOTFOUND) + if (particle->num < modifier->dm->getNumTessFaces(modifier->dm)) + num = particle->num; + + /* get uvco */ + if (n_uv && ELEM(from, PART_FROM_FACE, PART_FROM_VOLUME)) { + + if (num != DMCACHE_NOTFOUND) { + MFace *mface = modifier->dm->getTessFaceData(modifier->dm, num, CD_MFACE); + MTFace *mtface = (MTFace *)CustomData_get_layer_n(&modifier->dm->faceData, CD_MTFACE, 0); + mtface += num; + + psys_interpolate_uvs(mtface, mface->v4, particle->fuv, n_uv); + } + else { + n_uv[0] = 0.0f; + n_uv[1] = 0.0f; + } + } +} + +static void rna_ParticleSystem_co_hair(ParticleSystem *particlesystem, Object *object, ParticleSystemModifierData *modifier, int particle_no, int step, + float n_co[3]) +{ + ParticleSettings *part = 0; + ParticleData *pars = 0; + ParticleCacheKey *cache = 0; + int totchild = 0; + int path_nbr = 0; + int totpart; + int max_k = 0; + + if (particlesystem == NULL) + return; + + part = particlesystem->part; + pars = particlesystem->particles; + + if (part == NULL || pars == NULL || !psys_check_enabled(object, particlesystem)) + return; + + if (part->ren_as == PART_DRAW_OB || part->ren_as == PART_DRAW_GR || part->ren_as == PART_DRAW_NOT) + return; + + totchild = particlesystem->totchild * part->disp / 100; + + /* can happen for disconnected/global hair */ + if (part->type == PART_HAIR && !particlesystem->childcache) + totchild = 0; + + totpart = particlesystem->totpart; + + if (particle_no >= totpart + totchild) + return; + + if (part->ren_as == PART_DRAW_PATH && particlesystem->pathcache) + path_nbr = (int)pow(2.0, part->draw_step); + + if (particle_no < totpart) { + + if (path_nbr) { + cache = particlesystem->pathcache[particle_no]; + max_k = (int)cache->steps; + } + + } + else { + + if (path_nbr) { + cache = particlesystem->childcache[particle_no - totpart]; + + if (cache->steps < 0) + max_k = 0; + else + max_k = (int)cache->steps; + } + } + + /*strands key loop data stored in cache + step->co*/ + if (path_nbr) { + if (step >= 0 && step <= path_nbr) { + if (step <= max_k) + copy_v3_v3(n_co, (cache + step)->co); + } + } + +} + +static void rna_ParticleSystem_uv_on_emitter(ParticleSystem *particlesystem, ParticleSystemModifierData *modifier, ParticleData *particle, int particle_no, + float n_uv[2]) +{ + ParticleSettings *part = 0; + int totpart; + int totchild = 0; + int num; + + /* 1. check that everything is ok & updated */ + if (particlesystem == NULL) + return; + + part = particlesystem->part; + + totchild = particlesystem->totchild; + + /* can happen for disconnected/global hair */ + if (part->type == PART_HAIR && !particlesystem->childcache) + totchild = 0; + + totpart = particlesystem->totpart; + + if (particle_no >= totpart + totchild) + return; + +/* 3. start creating renderable things */ + /* setup per particle individual stuff */ + if (particle_no < totpart) { + + /* get uvco & mcol */ + num = particle->num_dmcache; + + if (num == DMCACHE_NOTFOUND) + if (particle->num < modifier->dm->getNumTessFaces(modifier->dm)) + num = particle->num; + + if (n_uv && ELEM(part->from, PART_FROM_FACE, PART_FROM_VOLUME)) { + if (num != DMCACHE_NOTFOUND) { + MFace *mface = modifier->dm->getTessFaceData(modifier->dm, num, CD_MFACE); + MTFace *mtface = (MTFace *)CustomData_get_layer_n(&modifier->dm->faceData, CD_MTFACE, 0); + mtface += num; + + psys_interpolate_uvs(mtface, mface->v4, particle->fuv, n_uv); + } + else { + n_uv[0] = 0.0f; + n_uv[1] = 0.0f; + } + } + } + else { + ChildParticle *cpa = particlesystem->child + particle_no - totpart; + + num = cpa->num; + + /* get uvco & mcol */ + if (part->childtype == PART_CHILD_FACES) { + if (n_uv && ELEM(PART_FROM_FACE, PART_FROM_FACE, PART_FROM_VOLUME)) { + if (cpa->num != DMCACHE_NOTFOUND) { + MFace *mface = modifier->dm->getTessFaceData(modifier->dm, cpa->num, CD_MFACE); + MTFace *mtface = (MTFace *)CustomData_get_layer_n(&modifier->dm->faceData, CD_MTFACE, 0); + mtface += cpa->num; + + psys_interpolate_uvs(mtface, mface->v4, cpa->fuv, n_uv); + } + else { + n_uv[0] = 0.0f; + n_uv[1] = 0.0f; + } + } + } + else { + ParticleData *parent = particlesystem->particles + cpa->parent; + num = parent->num_dmcache; + + if (num == DMCACHE_NOTFOUND) + if (parent->num < modifier->dm->getNumTessFaces(modifier->dm)) + num = parent->num; + + if (n_uv && ELEM(part->from, PART_FROM_FACE, PART_FROM_VOLUME)) { + if (num != DMCACHE_NOTFOUND) { + MFace *mface = modifier->dm->getTessFaceData(modifier->dm, num, CD_MFACE); + MTFace *mtface = (MTFace *)CustomData_get_layer_n(&modifier->dm->faceData, CD_MTFACE, 0); + mtface += num; + + psys_interpolate_uvs(mtface, mface->v4, parent->fuv, n_uv); + } + else { + n_uv[0] = 0.0f; + n_uv[1] = 0.0f; + } + } + } + } +} + +static void rna_ParticleSystem_mcol_on_emitter(ParticleSystem *particlesystem, ParticleSystemModifierData *modifier, ParticleData *particle, int particle_no, int vcol_no, + float n_mcol[3]) +{ + ParticleSettings *part = 0; + int totpart; + int totchild = 0; + int num; + MCol mcol = {255, 255, 255, 255}; + + /* 1. check that everything is ok & updated */ + if (particlesystem == NULL) + return; + + part = particlesystem->part; + + totchild = particlesystem->totchild; + + /* can happen for disconnected/global hair */ + if (part->type == PART_HAIR && !particlesystem->childcache) + totchild = 0; + + totpart = particlesystem->totpart; + + if (particle_no >= totpart + totchild) + return; + +/* 3. start creating renderable things */ + /* setup per particle individual stuff */ + if (particle_no < totpart) { + + /* get uvco & mcol */ + num = particle->num_dmcache; + + if (num == DMCACHE_NOTFOUND) + if (particle->num < modifier->dm->getNumTessFaces(modifier->dm)) + num = particle->num; + + if (n_mcol && ELEM(part->from, PART_FROM_FACE, PART_FROM_VOLUME)) { + if (num != DMCACHE_NOTFOUND) { + MFace *mface = modifier->dm->getTessFaceData(modifier->dm, num, CD_MFACE); + MCol *mc = (MCol*)CustomData_get_layer_n(&modifier->dm->faceData, CD_MCOL, vcol_no); + mc += num * 4; + + psys_interpolate_mcol(mc, mface->v4, particle->fuv, &mcol); + n_mcol[0] = (float)mcol.b / 255.0f; + n_mcol[1] = (float)mcol.g / 255.0f; + n_mcol[2] = (float)mcol.r / 255.0f; + } + else { + n_mcol[0] = 0.0f; + n_mcol[1] = 0.0f; + n_mcol[2] = 0.0f; + } + } + } + else { + ChildParticle *cpa = particlesystem->child + particle_no - totpart; + + num = cpa->num; + + /* get uvco & mcol */ + if (part->childtype == PART_CHILD_FACES) { + if (n_mcol && ELEM(PART_FROM_FACE, PART_FROM_FACE, PART_FROM_VOLUME)) { + if (cpa->num != DMCACHE_NOTFOUND) { + MFace *mface = modifier->dm->getTessFaceData(modifier->dm, cpa->num, CD_MFACE); + MCol *mc = (MCol*)CustomData_get_layer_n(&modifier->dm->faceData, CD_MCOL, 0); + mc += cpa->num * 4; + + psys_interpolate_mcol(mc, mface->v4, cpa->fuv, &mcol); + n_mcol[0] = (float)mcol.b / 255.0f; + n_mcol[1] = (float)mcol.g / 255.0f; + n_mcol[2] = (float)mcol.r / 255.0f; + } + else { + n_mcol[0] = 0.0f; + n_mcol[1] = 0.0f; + n_mcol[2] = 0.0f; + } + } + } + else { + ParticleData *parent = particlesystem->particles + cpa->parent; + num = parent->num_dmcache; + + if (num == DMCACHE_NOTFOUND) + if (parent->num < modifier->dm->getNumTessFaces(modifier->dm)) + num = parent->num; + + if (n_mcol && ELEM(part->from, PART_FROM_FACE, PART_FROM_VOLUME)) { + if (num != DMCACHE_NOTFOUND) { + MFace *mface = modifier->dm->getTessFaceData(modifier->dm, num, CD_MFACE); + MCol *mc = (MCol*)CustomData_get_layer_n(&modifier->dm->faceData, CD_MCOL, 0); + mc += num * 4; + + psys_interpolate_mcol(mc, mface->v4, parent->fuv, &mcol); + n_mcol[0] = (float)mcol.b / 255.0f; + n_mcol[1] = (float)mcol.g / 255.0f; + n_mcol[2] = (float)mcol.r / 255.0f; + } + else { + n_mcol[0] = 0.0f; + n_mcol[1] = 0.0f; + n_mcol[2] = 0.0f; + } + } + } + } +} + static void particle_recalc(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr, short flag) { if (ptr->type == &RNA_ParticleSystem) { @@ -905,6 +1227,7 @@ static void rna_def_particle_hair_key(BlenderRNA *brna) { StructRNA *srna; PropertyRNA *prop; + FunctionRNA *func; srna = RNA_def_struct(brna, "ParticleHairKey", NULL); RNA_def_struct_sdna(srna, "HairKey"); @@ -928,6 +1251,19 @@ static void rna_def_particle_hair_key(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Location", "Location of the hair key in its internal coordinate system, " "relative to the emitting face"); + + /* Aided co func */ + func = RNA_def_function(srna, "co_object", "rna_ParticleHairKey_co_object"); + RNA_def_function_ui_description(func, "Obtain hairkey location with particle and modifier data"); + + prop = RNA_def_pointer(func, "object", "Object", "", "Object"); + prop = RNA_def_pointer(func, "modifier", "ParticleSystemModifier", "", "Particle modifier"); + prop = RNA_def_pointer(func, "particle", "Particle", "", "hair particle"); + + prop = RNA_def_float_vector(func, "co", 3, NULL, -FLT_MAX, FLT_MAX, "Co", + "Exported hairkey location", -1e4, 1e4); + RNA_def_property_flag(prop, PROP_THICK_WRAP); + RNA_def_function_output(func, prop); } static void rna_def_particle_key(BlenderRNA *brna) @@ -979,6 +1315,7 @@ static void rna_def_particle(BlenderRNA *brna) { StructRNA *srna; PropertyRNA *prop; + FunctionRNA *func; static EnumPropertyItem alive_items[] = { /*{PARS_KILLED, "KILLED", 0, "Killed", ""}, */ @@ -1083,6 +1420,15 @@ static void rna_def_particle(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Alive State", ""); /* short rt2; */ + +/* UVs */ + func = RNA_def_function(srna, "uv_on_emitter", "rna_Particle_uv_on_emitter"); + RNA_def_function_ui_description(func, "Obtain uv for particle on derived mesh"); + prop = RNA_def_pointer(func, "modifier", "ParticleSystemModifier", "", "Particle modifier"); + prop = RNA_def_property(func, "uv", PROP_FLOAT, PROP_COORDS); + RNA_def_property_array(prop, 2); + RNA_def_property_flag(prop, PROP_THICK_WRAP); + RNA_def_function_output(func, prop); } static void rna_def_particle_dupliweight(BlenderRNA *brna) @@ -2696,6 +3042,7 @@ static void rna_def_particle_system(BlenderRNA *brna) { StructRNA *srna; PropertyRNA *prop; + FunctionRNA *func; srna = RNA_def_struct(brna, "ParticleSystem", NULL); RNA_def_struct_ui_text(srna, "Particle System", "Particle system in an object"); @@ -2793,7 +3140,6 @@ static void rna_def_particle_system(BlenderRNA *brna) "rna_ParticleSystem_active_particle_target_index_range"); RNA_def_property_ui_text(prop, "Active Particle Target Index", ""); - /* billboard */ prop = RNA_def_property(srna, "billboard_normal_uv", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "bb_uvname[0]"); @@ -2995,6 +3341,44 @@ static void rna_def_particle_system(BlenderRNA *brna) RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_struct_path_func(srna, "rna_ParticleSystem_path"); + + /* extract cached hair location data */ + func = RNA_def_function(srna, "co_hair", "rna_ParticleSystem_co_hair"); + RNA_def_function_ui_description(func, "Obtain cache hair data"); + + prop = RNA_def_pointer(func, "object", "Object", "", "Object"); + prop = RNA_def_pointer(func, "modifier", "ParticleSystemModifier", "", "Particle modifier"); + prop = RNA_def_int(func, "particle_no", 0, INT_MIN, INT_MAX, "Particle no", "", INT_MIN, INT_MAX); + prop = RNA_def_int(func, "step", 0, INT_MIN, INT_MAX, "step no", "", INT_MIN, INT_MAX); + + prop = RNA_def_float_vector(func, "co", 3, NULL, -FLT_MAX, FLT_MAX, "Co", + "Exported hairkey location", -1e4, 1e4); + RNA_def_property_flag(prop, PROP_THICK_WRAP); + RNA_def_function_output(func, prop); + + /* extract hair UVs */ + func = RNA_def_function(srna, "uv_on_emitter", "rna_ParticleSystem_uv_on_emitter"); + RNA_def_function_ui_description(func, "Obtain uv for all particles"); + prop = RNA_def_pointer(func, "modifier", "ParticleSystemModifier", "", "Particle modifier"); + prop = RNA_def_pointer(func, "particle", "Particle", "", "Particle"); + prop = RNA_def_int(func, "particle_no", 0, INT_MIN, INT_MAX, "Particle no", "", INT_MIN, INT_MAX); + prop = RNA_def_property(func, "uv", PROP_FLOAT, PROP_COORDS); + RNA_def_property_array(prop, 2); + RNA_def_property_flag(prop, PROP_THICK_WRAP); + RNA_def_function_output(func, prop); + + /* extract hair mcols */ + func = RNA_def_function(srna, "mcol_on_emitter", "rna_ParticleSystem_mcol_on_emitter"); + RNA_def_function_ui_description(func, "Obtain mcol for all particles"); + prop = RNA_def_pointer(func, "modifier", "ParticleSystemModifier", "", "Particle modifier"); + prop = RNA_def_pointer(func, "particle", "Particle", "", "Particle"); + prop = RNA_def_int(func, "particle_no", 0, INT_MIN, INT_MAX, "Particle no", "", INT_MIN, INT_MAX); + prop = RNA_def_int(func, "vcol_no", 0, INT_MIN, INT_MAX, "vcol no", "", INT_MIN, INT_MAX); + prop = RNA_def_property(func, "mcol", PROP_FLOAT, PROP_COLOR); + RNA_def_property_array(prop, 3); + RNA_def_property_flag(prop, PROP_THICK_WRAP); + RNA_def_function_output(func, prop); + } void RNA_def_particle(BlenderRNA *brna) diff --git a/source/blender/makesrna/intern/rna_pose.c b/source/blender/makesrna/intern/rna_pose.c index 28d1de2c601..23f61282b78 100644 --- a/source/blender/makesrna/intern/rna_pose.c +++ b/source/blender/makesrna/intern/rna_pose.c @@ -472,14 +472,14 @@ static void rna_pose_pgroup_name_set(PointerRNA *ptr, const char *value, char *r static PointerRNA rna_PoseChannel_active_constraint_get(PointerRNA *ptr) { bPoseChannel *pchan = (bPoseChannel *)ptr->data; - bConstraint *con = constraints_get_active(&pchan->constraints); + bConstraint *con = BKE_constraints_get_active(&pchan->constraints); return rna_pointer_inherit_refine(ptr, &RNA_Constraint, con); } static void rna_PoseChannel_active_constraint_set(PointerRNA *ptr, PointerRNA value) { bPoseChannel *pchan = (bPoseChannel *)ptr->data; - constraints_set_active(&pchan->constraints, (bConstraint *)value.data); + BKE_constraints_set_active(&pchan->constraints, (bConstraint *)value.data); } static bConstraint *rna_PoseChannel_constraints_new(bPoseChannel *pchan, int type) @@ -487,7 +487,7 @@ static bConstraint *rna_PoseChannel_constraints_new(bPoseChannel *pchan, int typ /*WM_main_add_notifier(NC_OBJECT|ND_CONSTRAINT|NA_ADDED, object); */ /* TODO, pass object also */ /* TODO, new pose bones don't have updated draw flags */ - return add_pose_constraint(NULL, pchan, NULL, type); + return BKE_add_pose_constraint(NULL, pchan, NULL, type); } static void rna_PoseChannel_constraints_remove(ID *id, bPoseChannel *pchan, ReportList *reports, PointerRNA *con_ptr) @@ -501,12 +501,12 @@ static void rna_PoseChannel_constraints_remove(ID *id, bPoseChannel *pchan, Repo return; } - remove_constraint(&pchan->constraints, con); + BKE_remove_constraint(&pchan->constraints, con); RNA_POINTER_INVALIDATE(con_ptr); ED_object_constraint_update(ob); - constraints_set_active(&pchan->constraints, NULL); /* XXX, is this really needed? - Campbell */ + BKE_constraints_set_active(&pchan->constraints, NULL); /* XXX, is this really needed? - Campbell */ WM_main_add_notifier(NC_OBJECT | ND_CONSTRAINT | NA_REMOVED, id); @@ -786,14 +786,14 @@ static void rna_def_pose_channel(BlenderRNA *brna) RNA_def_property_editable_array_func(prop, "rna_PoseChannel_location_editable"); RNA_def_property_ui_text(prop, "Location", ""); RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, RNA_TRANSLATION_PREC_DEFAULT); - RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_update"); + RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_IK_update"); prop = RNA_def_property(srna, "scale", PROP_FLOAT, PROP_XYZ); RNA_def_property_float_sdna(prop, NULL, "size"); RNA_def_property_editable_array_func(prop, "rna_PoseChannel_scale_editable"); RNA_def_property_float_array_default(prop, default_scale); RNA_def_property_ui_text(prop, "Scale", ""); - RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_update"); + RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_IK_update"); prop = RNA_def_property(srna, "rotation_quaternion", PROP_FLOAT, PROP_QUATERNION); RNA_def_property_float_sdna(prop, NULL, "quat"); diff --git a/source/blender/makesrna/intern/rna_render.c b/source/blender/makesrna/intern/rna_render.c index 46b22cd0963..93c5b45e642 100644 --- a/source/blender/makesrna/intern/rna_render.c +++ b/source/blender/makesrna/intern/rna_render.c @@ -137,7 +137,7 @@ static void engine_update_script_node(RenderEngine *engine, struct bNodeTree *nt FunctionRNA *func; RNA_pointer_create(NULL, engine->type->ext.srna, engine, &ptr); - RNA_pointer_create((ID*)ntree, &RNA_Node, node, &nodeptr); + RNA_pointer_create((ID *)ntree, &RNA_Node, node, &nodeptr); func = &rna_RenderEngine_update_script_node_func; RNA_parameter_list_create(&list, &ptr, func); @@ -406,6 +406,9 @@ static void rna_def_render_engine(BlenderRNA *brna) RNA_def_property_int_sdna(prop, NULL, "resolution_y"); RNA_def_property_clear_flag(prop, PROP_EDITABLE); + prop = RNA_def_property(srna, "use_highlight_tiles", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", RE_ENGINE_HIGHLIGHT_TILES); + /* registration */ prop = RNA_def_property(srna, "bl_idname", PROP_STRING, PROP_NONE); diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index 29d7391ccb4..8d99cecd9fa 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -119,7 +119,8 @@ EnumPropertyItem proportional_falloff_curve_only_items[] = { EnumPropertyItem proportional_editing_items[] = { {PROP_EDIT_OFF, "DISABLED", ICON_PROP_OFF, "Disable", "Proportional Editing disabled"}, {PROP_EDIT_ON, "ENABLED", ICON_PROP_ON, "Enable", "Proportional Editing enabled"}, - {PROP_EDIT_CONNECTED, "CONNECTED", ICON_PROP_CON, "Connected", "Proportional Editing using connected geometry only"}, + {PROP_EDIT_CONNECTED, "CONNECTED", ICON_PROP_CON, "Connected", + "Proportional Editing using connected geometry only"}, {0, NULL, 0, NULL, NULL} }; @@ -880,7 +881,7 @@ static int rna_SceneRender_file_ext_length(PointerRNA *ptr) RenderData *rd = (RenderData *)ptr->data; char ext[8]; ext[0] = '\0'; - BKE_add_image_extension(ext, rd->im_format.imtype); + BKE_add_image_extension(ext, &rd->im_format); return strlen(ext); } @@ -888,7 +889,7 @@ static void rna_SceneRender_file_ext_get(PointerRNA *ptr, char *str) { RenderData *rd = (RenderData *)ptr->data; str[0] = '\0'; - BKE_add_image_extension(str, rd->im_format.imtype); + BKE_add_image_extension(str, &rd->im_format); } #ifdef WITH_QUICKTIME @@ -1137,7 +1138,7 @@ static void rna_SceneRenderLayer_name_set(PointerRNA *ptr, const char *value) static char *rna_SceneRenderLayer_path(PointerRNA *ptr) { - SceneRenderLayer *srl = (SceneRenderLayer*)ptr->data; + SceneRenderLayer *srl = (SceneRenderLayer *)ptr->data; return BLI_sprintfN("render.layers[\"%s\"]", srl->name); } @@ -1368,7 +1369,8 @@ static void rna_TimeLine_remove(Scene *scene, ReportList *reports, PointerRNA *m { TimeMarker *marker = marker_ptr->data; if (BLI_remlink_safe(&scene->markers, marker) == FALSE) { - BKE_reportf(reports, RPT_ERROR, "Timeline marker '%s' not found in scene '%s'", marker->name, scene->id.name + 2); + BKE_reportf(reports, RPT_ERROR, "Timeline marker '%s' not found in scene '%s'", + marker->name, scene->id.name + 2); return; } @@ -2050,7 +2052,8 @@ void rna_def_render_layer_common(StructRNA *srna, int scene) if (scene) { prop = RNA_def_property(srna, "samples", PROP_INT, PROP_UNSIGNED); - RNA_def_property_ui_text(prop, "Samples", "Override number of render samples for this render layer, 0 will use the scene setting"); + RNA_def_property_ui_text(prop, "Samples", "Override number of render samples for this render layer, " + "0 will use the scene setting"); RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL); } @@ -2799,7 +2802,7 @@ static void rna_def_scene_game_recast_data(BlenderRNA *brna) prop = RNA_def_property(srna, "slope_max", PROP_FLOAT, PROP_ANGLE); RNA_def_property_float_sdna(prop, NULL, "agentmaxslope"); RNA_def_property_range(prop, 0, M_PI / 2); - RNA_def_property_ui_text(prop, "Max Slope", "Maximum walkable slope angle in degrees"); + RNA_def_property_ui_text(prop, "Max Slope", "Maximum walkable slope angle"); RNA_def_property_update(prop, NC_SCENE, NULL); @@ -2924,8 +2927,10 @@ static void rna_def_scene_game_data(BlenderRNA *brna) {RAS_STORE_AUTO, "AUTO", 0, "Auto Select", "Chooses the best supported mode"}, {RAS_STORE_IMMEDIATE, "IMMEDIATE", 0, "Immediate Mode", "Slowest performance, requires OpenGL (any version)"}, {RAS_STORE_VA, "VERTEX_ARRAY", 0, "Vertex Arrays", "Better performance, requires at least OpenGL 1.1"}, - /* VBOS are currently disabled since they cannot beat vertex array with display lists in performance. */ - /* {RAS_STORE_VBO, "VERTEX_BUFFER_OBJECT", 0, "Vertex Buffer Objects", "Best performance, requires at least OpenGL 1.4"}, */ +#if 0 /* XXX VBOS are currently disabled since they cannot beat vertex array with display lists in performance. */ + {RAS_STORE_VBO, "VERTEX_BUFFER_OBJECT", 0, "Vertex Buffer Objects", + "Best performance, requires at least OpenGL 1.4"}, +#endif {0, NULL, 0, NULL, NULL}}; srna = RNA_def_struct(brna, "SceneGameData", NULL); @@ -2960,13 +2965,13 @@ static void rna_def_scene_game_data(BlenderRNA *brna) RNA_def_property_enum_sdna(prop, NULL, "exitkey"); RNA_def_property_enum_items(prop, event_type_items); RNA_def_property_enum_funcs(prop, NULL, "rna_GameSettings_exit_key_set", NULL); - RNA_def_property_ui_text(prop, "Exit Key", "The key that exits the Game Engine"); + RNA_def_property_ui_text(prop, "Exit Key", "The key that exits the Game Engine"); RNA_def_property_update(prop, NC_SCENE, NULL); prop = RNA_def_property(srna, "raster_storage", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "raster_storage"); RNA_def_property_enum_items(prop, storage_items); - RNA_def_property_ui_text(prop, "Storage", "Sets the storage mode used by the rasterizer"); + RNA_def_property_ui_text(prop, "Storage", "Set the storage mode used by the rasterizer"); RNA_def_property_update(prop, NC_SCENE, NULL); /* Do we need it here ? (since we already have it in World */ @@ -3252,6 +3257,12 @@ static void rna_def_scene_game_data(BlenderRNA *brna) "Use extra textures like normal or specular maps for GLSL rendering"); RNA_def_property_update(prop, NC_SCENE | NA_EDITED, "rna_Scene_glsl_update"); + prop = RNA_def_property(srna, "use_material_caching", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", GAME_NO_MATERIAL_CACHING); + RNA_def_property_ui_text(prop, "Use Material Caching", + "Cache materials in the converter (this is faster, but can cause problems with older " + "Singletexture and Multitexture games"); + /* obstacle simulation */ prop = RNA_def_property(srna, "obstacle_simulation", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "obstacleSimulation"); @@ -3370,6 +3381,14 @@ static void rna_def_scene_image_format_data(BlenderRNA *brna) }; #endif +#ifdef WITH_OPENJPEG + static EnumPropertyItem jp2_codec_items[] = { + {R_IMF_JP2_CODEC_JP2, "JP2", 0, "JP2", ""}, + {R_IMF_JP2_CODEC_J2K, "J2K", 0, "J2K", ""}, + {0, NULL, 0, NULL, NULL} + }; +#endif + StructRNA *srna; PropertyRNA *prop; @@ -3457,6 +3476,12 @@ static void rna_def_scene_image_format_data(BlenderRNA *brna) RNA_def_property_boolean_sdna(prop, NULL, "jp2_flag", R_IMF_JP2_FLAG_CINE_48); RNA_def_property_ui_text(prop, "Cinema (48)", "Use Openjpeg Cinema Preset (48fps)"); RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL); + + prop = RNA_def_property(srna, "jpeg2k_codec", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "jp2_codec"); + RNA_def_property_enum_items(prop, jp2_codec_items); + RNA_def_property_ui_text(prop, "Codec", "Codec settings for Jpek2000"); + RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL); #endif /* Cineon and DPX */ @@ -3796,8 +3821,7 @@ static void rna_def_scene_render_data(BlenderRNA *brna) static EnumPropertyItem alpha_mode_items[] = { {R_ADDSKY, "SKY", 0, "Sky", "Transparent pixels are filled with sky color"}, - {R_ALPHAPREMUL, "PREMUL", 0, "Premultiplied", "Transparent RGB pixels are multiplied by the alpha channel"}, - {R_ALPHAKEY, "STRAIGHT", 0, "Straight Alpha", "Transparent RGB and alpha pixels are unmodified"}, + {R_ALPHAPREMUL, "TRANSPARENT", 0, "Transparent", "World background is transparent with premultiplied alpha"}, {0, NULL, 0, NULL, NULL} }; @@ -4174,10 +4198,9 @@ static void rna_def_scene_render_data(BlenderRNA *brna) RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_glsl_update"); - prop = RNA_def_property(srna, "motion_blur_shutter", PROP_FLOAT, PROP_NONE); + prop = RNA_def_property(srna, "motion_blur_shutter", PROP_FLOAT, PROP_UNSIGNED); RNA_def_property_float_sdna(prop, NULL, "blurfac"); - RNA_def_property_range(prop, 0.01f, 10.0f); - RNA_def_property_ui_range(prop, 0.01, 2.0f, 1, 0); + RNA_def_property_ui_range(prop, 0.01f, 2.0f, 1, 0); RNA_def_property_ui_text(prop, "Shutter", "Time taken in frames between shutter open and close"); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_glsl_update"); @@ -4248,13 +4271,6 @@ static void rna_def_scene_render_data(BlenderRNA *brna) "editor pipeline, if sequencer strips exist"); RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL); - prop = RNA_def_property(srna, "use_color_unpremultiply", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "color_mgt_flag", R_COLOR_MANAGEMENT_PREDIVIDE); - RNA_def_property_ui_text(prop, "Color Unpremultiply", - "For premultiplied alpha render output, do color space conversion on " - "colors without alpha, to avoid fringing on light backgrounds"); - RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL); - prop = RNA_def_property(srna, "use_file_extension", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "scemode", R_EXTENSION); RNA_def_property_ui_text(prop, "File Extensions", @@ -4407,6 +4423,12 @@ static void rna_def_scene_render_data(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Samples", "Number of samples used for ambient occlusion baking from multires"); RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL); + prop = RNA_def_property(srna, "use_bake_to_vertex_color", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "bake_flag", R_BAKE_VCOL); + RNA_def_property_ui_text(prop, "Bake to Vertex Color", + "Bake to vertex colors instead of to a UV-mapped image"); + RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL); + /* stamp */ prop = RNA_def_property(srna, "use_stamp_time", PROP_BOOLEAN, PROP_NONE); @@ -5169,7 +5191,7 @@ void RNA_def_scene(BlenderRNA *brna) prop = RNA_def_property(srna, "sequencer_colorspace_settings", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "sequencer_colorspace_settings"); - RNA_def_property_struct_type(prop, "ColorManagedColorspaceSettings"); + RNA_def_property_struct_type(prop, "ColorManagedSequencerColorspaceSettings"); RNA_def_property_ui_text(prop, "Sequencer Color Space Settings", "Settings of color space sequencer is working in"); /* Nestled Data */ diff --git a/source/blender/makesrna/intern/rna_scene_api.c b/source/blender/makesrna/intern/rna_scene_api.c index 012767b5845..9b5a858a581 100644 --- a/source/blender/makesrna/intern/rna_scene_api.c +++ b/source/blender/makesrna/intern/rna_scene_api.c @@ -84,7 +84,7 @@ static void rna_SceneRender_get_frame_path(RenderData *rd, int frame, char *name if (BKE_imtype_is_movie(rd->im_format.imtype)) BKE_movie_filepath_get(name, rd); else - BKE_makepicstring(name, rd->pic, G.main->name, (frame == INT_MIN) ? rd->cfra : frame, rd->im_format.imtype, + BKE_makepicstring(name, rd->pic, G.main->name, (frame == INT_MIN) ? rd->cfra : frame, &rd->im_format, rd->scemode & R_EXTENSION, TRUE); } diff --git a/source/blender/makesrna/intern/rna_sculpt_paint.c b/source/blender/makesrna/intern/rna_sculpt_paint.c index f717c83075a..17edf2944aa 100644 --- a/source/blender/makesrna/intern/rna_sculpt_paint.c +++ b/source/blender/makesrna/intern/rna_sculpt_paint.c @@ -40,6 +40,9 @@ #include "WM_api.h" #include "WM_types.h" +#include "BLI_utildefines.h" +#include "bmesh.h" + static EnumPropertyItem particle_edit_hair_brush_items[] = { {PE_BRUSH_NONE, "NONE", 0, "None", "Don't use any brush"}, {PE_BRUSH_COMB, "COMB", 0, "Comb", "Comb hairs"}, @@ -52,6 +55,18 @@ static EnumPropertyItem particle_edit_hair_brush_items[] = { {0, NULL, 0, NULL, NULL} }; +EnumPropertyItem symmetrize_direction_items[] = { + {BMO_SYMMETRIZE_NEGATIVE_X, "NEGATIVE_X", 0, "-X to +X", ""}, + {BMO_SYMMETRIZE_POSITIVE_X, "POSITIVE_X", 0, "+X to -X", ""}, + + {BMO_SYMMETRIZE_NEGATIVE_Y, "NEGATIVE_Y", 0, "-Y to +Y", ""}, + {BMO_SYMMETRIZE_POSITIVE_Y, "POSITIVE_Y", 0, "+Y to -Y", ""}, + + {BMO_SYMMETRIZE_NEGATIVE_Z, "NEGATIVE_Z", 0, "-Z to +Z", ""}, + {BMO_SYMMETRIZE_POSITIVE_Z, "POSITIVE_Z", 0, "+Z to -Z", ""}, + {0, NULL, 0, NULL, NULL}, +}; + #ifdef RNA_RUNTIME #include "MEM_guardedalloc.h" @@ -204,6 +219,11 @@ static void rna_Sculpt_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *UNU if (ob) { DAG_id_tag_update(&ob->id, OB_RECALC_DATA); WM_main_add_notifier(NC_OBJECT | ND_MODIFIER, ob); + + if (ob->sculpt) { + ob->sculpt->bm_smooth_shading = (scene->toolsettings->sculpt->flags & + SCULPT_DYNTOPO_SMOOTH_SHADING); + } } } @@ -319,6 +339,27 @@ static void rna_def_sculpt(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Show Diffuse Color", "Show diffuse color of object and overlay sculpt mask on top of it"); RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Sculpt_ShowDiffuseColor_update"); + + prop = RNA_def_property(srna, "detail_size", PROP_INT, PROP_DISTANCE); + RNA_def_property_ui_range(prop, 2, 100, 0, 0); + RNA_def_property_ui_text(prop, "Detail Size", "Maximum edge length for dynamic topology sculpting (in pixels)"); + + prop = RNA_def_property(srna, "use_smooth_shading", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flags", SCULPT_DYNTOPO_SMOOTH_SHADING); + RNA_def_property_ui_text(prop, "Smooth Shading", + "Show faces in dynamic-topology mode with smooth " + "shading rather than flat shaded"); + RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Sculpt_update"); + + prop = RNA_def_property(srna, "use_edge_collapse", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flags", SCULPT_DYNTOPO_COLLAPSE); + RNA_def_property_ui_text(prop, "Collapse Short Edges", + "In dynamic-topology mode, collapse short edges " + "in addition to subdividing long ones"); + + prop = RNA_def_property(srna, "symmetrize_direction", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_items(prop, symmetrize_direction_items); + RNA_def_property_ui_text(prop, "Direction", "Source and destination for symmetrize operator"); } diff --git a/source/blender/makesrna/intern/rna_sequencer.c b/source/blender/makesrna/intern/rna_sequencer.c index 18a9b9683f8..a41551fc8da 100644 --- a/source/blender/makesrna/intern/rna_sequencer.c +++ b/source/blender/makesrna/intern/rna_sequencer.c @@ -1401,26 +1401,26 @@ static void rna_def_sequence(BlenderRNA *brna) prop = RNA_def_property(srna, "frame_offset_start", PROP_INT, PROP_TIME); RNA_def_property_int_sdna(prop, NULL, "startofs"); - RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* overlap tests */ +// RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* overlap tests */ RNA_def_property_ui_text(prop, "Start Offset", ""); RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update"); prop = RNA_def_property(srna, "frame_offset_end", PROP_INT, PROP_TIME); RNA_def_property_int_sdna(prop, NULL, "endofs"); - RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* overlap tests */ +// RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* overlap tests */ RNA_def_property_ui_text(prop, "End Offset", ""); RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update"); prop = RNA_def_property(srna, "frame_still_start", PROP_INT, PROP_TIME); RNA_def_property_int_sdna(prop, NULL, "startstill"); - RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* overlap tests */ +// RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* overlap tests */ RNA_def_property_range(prop, 0, MAXFRAME); RNA_def_property_ui_text(prop, "Start Still", ""); RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update"); prop = RNA_def_property(srna, "frame_still_end", PROP_INT, PROP_TIME); RNA_def_property_int_sdna(prop, NULL, "endstill"); - RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* overlap tests */ +// RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* overlap tests */ RNA_def_property_range(prop, 0, MAXFRAME); RNA_def_property_ui_text(prop, "End Still", ""); RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update"); @@ -1541,14 +1541,20 @@ static void rna_def_filter_video(StructRNA *srna) { PropertyRNA *prop; + static const EnumPropertyItem alpha_mode_items[] = { + {SEQ_ALPHA_STRAIGHT, "STRAIGHT", 0, "Straight", "RGB channels in transparent pixels are unaffected by the alpha channel"}, + {SEQ_ALPHA_PREMUL, "PREMUL", 0, "Premultiplied", "RGB channels in transparent pixels are multiplied by the alpha channel"}, + {0, NULL, 0, NULL, NULL} + }; + prop = RNA_def_property(srna, "use_deinterlace", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_FILTERY); RNA_def_property_ui_text(prop, "De-Interlace", "For video movies to remove fields"); RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update_reopen_files"); - prop = RNA_def_property(srna, "use_premultiply", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_MAKE_PREMUL); - RNA_def_property_ui_text(prop, "Premultiply", "Convert RGB from key alpha to premultiplied alpha"); + prop = RNA_def_property(srna, "alpha_mode", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_items(prop, alpha_mode_items); + RNA_def_property_ui_text(prop, "Alpha Mode", "Representation of alpha information in the RGBA pixels"); RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update"); prop = RNA_def_property(srna, "use_flip_x", PROP_BOOLEAN, PROP_NONE); @@ -1694,7 +1700,7 @@ static void rna_def_color_management(StructRNA *srna) prop = RNA_def_property(srna, "colorspace_settings", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "strip->colorspace_settings"); - RNA_def_property_struct_type(prop, "ColorManagedColorspaceSettings"); + RNA_def_property_struct_type(prop, "ColorManagedInputColorspaceSettings"); RNA_def_property_ui_text(prop, "Color Space Settings", "Input color space settings"); } diff --git a/source/blender/makesrna/intern/rna_sequencer_api.c b/source/blender/makesrna/intern/rna_sequencer_api.c index 7602ec99c2b..69d35a3c2f0 100644 --- a/source/blender/makesrna/intern/rna_sequencer_api.c +++ b/source/blender/makesrna/intern/rna_sequencer_api.c @@ -37,6 +37,8 @@ #include "DNA_scene_types.h" #include "DNA_sequence_types.h" +#include "BLI_utildefines.h" + #ifdef RNA_RUNTIME //#include "DNA_anim_types.h" @@ -62,6 +64,16 @@ #include "WM_api.h" +static void rna_Sequence_update_rnafunc(ID *id, Sequence *self, int do_data) +{ + if (do_data) { + BKE_sequencer_update_changed_seq_and_deps((Scene *)id, self, true, true); + // new_tstripdata(self); // need 2.6x version of this. + } + BKE_sequence_calc((Scene *)id, self); + BKE_sequence_calc_disp((Scene *)id, self); +} + static void rna_Sequence_swap_internal(Sequence *seq_self, ReportList *reports, Sequence *seq_other) { const char *error_msg; @@ -389,7 +401,13 @@ void RNA_api_sequence_strip(StructRNA *srna) FunctionRNA *func; PropertyRNA *parm; - func = RNA_def_function(srna, "getStripElem", "BKE_sequencer_give_stripelem"); + func = RNA_def_function(srna, "update", "rna_Sequence_update_rnafunc"); + RNA_def_function_flag(func, FUNC_USE_SELF_ID); + RNA_def_function_ui_description(func, "Update the strip dimensions"); + parm = RNA_def_boolean(func, "data", false, "Frame", + "Update strip data"); + + func = RNA_def_function(srna, "strip_elem_from_frame", "BKE_sequencer_give_stripelem"); RNA_def_function_ui_description(func, "Return the strip element from a given frame or None"); parm = RNA_def_int(func, "frame", 0, -MAXFRAME, MAXFRAME, "Frame", "The frame to get the strip element from", -MAXFRAME, MAXFRAME); diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index 09209ddea4d..7fa3aae8ede 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -2375,11 +2375,11 @@ static void rna_def_space_dopesheet(BlenderRNA *brna) /* XXX: action-editor is currently for object-level only actions, so show that using object-icon hint */ static EnumPropertyItem mode_items[] = { - {SACTCONT_DOPESHEET, "DOPESHEET", ICON_OOPS, "DopeSheet", "DopeSheet Editor"}, - {SACTCONT_ACTION, "ACTION", ICON_OBJECT_DATA, "Action Editor", "Action Editor"}, - {SACTCONT_SHAPEKEY, "SHAPEKEY", ICON_SHAPEKEY_DATA, "ShapeKey Editor", "ShapeKey Editor"}, - {SACTCONT_GPENCIL, "GPENCIL", ICON_GREASEPENCIL, "Grease Pencil", "Grease Pencil"}, - {SACTCONT_MASK, "MASK", ICON_MOD_MASK, "Mask", "Mask Editor"}, + {SACTCONT_DOPESHEET, "DOPESHEET", ICON_OOPS, "DopeSheet", "Edit all keyframes in scene"}, + {SACTCONT_ACTION, "ACTION", ICON_OBJECT_DATA, "Action Editor", "Edit keyframes in active object's Object-level action"}, + {SACTCONT_SHAPEKEY, "SHAPEKEY", ICON_SHAPEKEY_DATA, "ShapeKey Editor", "Edit keyframes in active object's Shape Keys action"}, + {SACTCONT_GPENCIL, "GPENCIL", ICON_GREASEPENCIL, "Grease Pencil", "Edit timings for all Grease Pencil sketches in file"}, + {SACTCONT_MASK, "MASK", ICON_MOD_MASK, "Mask", "Edit timings for Mask Editor splines"}, {0, NULL, 0, NULL, NULL} }; @@ -2723,6 +2723,7 @@ static void rna_def_console_line(BlenderRNA *brna) "rna_ConsoleLine_body_set"); RNA_def_property_ui_text(prop, "Line", "Text in the line"); RNA_def_property_update(prop, NC_SPACE | ND_SPACE_CONSOLE, NULL); + RNA_def_property_translation_context(prop, BLF_I18NCONTEXT_ID_TEXT); prop = RNA_def_property(srna, "current_character", PROP_INT, PROP_NONE); /* copied from text editor */ RNA_def_property_int_sdna(prop, NULL, "cursor"); diff --git a/source/blender/makesrna/intern/rna_speaker.c b/source/blender/makesrna/intern/rna_speaker.c index 139582104ee..8a75aa2d227 100644 --- a/source/blender/makesrna/intern/rna_speaker.c +++ b/source/blender/makesrna/intern/rna_speaker.c @@ -62,6 +62,7 @@ static void rna_def_speaker(BlenderRNA *brna) RNA_def_property_boolean_sdna(prop, NULL, "flag", SPK_MUTED); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_ui_text(prop, "Mute", "Mute the speaker"); + RNA_def_property_translation_context(prop, BLF_I18NCONTEXT_ID_SOUND); /* RNA_def_property_update(prop, 0, "rna_Speaker_update"); */ #if 0 /* This shouldn't be changed actually, hiding it! */ diff --git a/source/blender/makesrna/intern/rna_text.c b/source/blender/makesrna/intern/rna_text.c index b1637ef4c8a..df6181af4b2 100644 --- a/source/blender/makesrna/intern/rna_text.c +++ b/source/blender/makesrna/intern/rna_text.c @@ -30,6 +30,8 @@ #include "MEM_guardedalloc.h" +#include "BLF_translation.h" + #include "BKE_text.h" #include "RNA_define.h" @@ -127,6 +129,7 @@ static void rna_def_text_line(BlenderRNA *brna) RNA_def_property_string_funcs(prop, "rna_TextLine_body_get", "rna_TextLine_body_length", "rna_TextLine_body_set"); RNA_def_property_ui_text(prop, "Line", "Text in the line"); RNA_def_property_update(prop, NC_TEXT | NA_EDITED, NULL); + RNA_def_property_translation_context(prop, BLF_I18NCONTEXT_ID_TEXT); } static void rna_def_text(BlenderRNA *brna) diff --git a/source/blender/makesrna/intern/rna_texture.c b/source/blender/makesrna/intern/rna_texture.c index e116e5df0de..2ab448c9188 100644 --- a/source/blender/makesrna/intern/rna_texture.c +++ b/source/blender/makesrna/intern/rna_texture.c @@ -1194,11 +1194,6 @@ static void rna_def_texture_image(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Flip Axis", "Flip the texture's X and Y axis"); RNA_def_property_update(prop, 0, "rna_Texture_update"); - prop = RNA_def_property(srna, "use_alpha", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "imaflag", TEX_USEALPHA); - RNA_def_property_ui_text(prop, "Use Alpha", "Use the alpha channel information in the image"); - RNA_def_property_update(prop, 0, "rna_Texture_update"); - prop = RNA_def_property(srna, "use_calculate_alpha", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "imaflag", TEX_CALCALPHA); RNA_def_property_ui_text(prop, "Calculate Alpha", "Calculate an alpha channel based on RGB values in the image"); diff --git a/source/blender/makesrna/intern/rna_tracking.c b/source/blender/makesrna/intern/rna_tracking.c index f5bcab3e530..7cc57947671 100644 --- a/source/blender/makesrna/intern/rna_tracking.c +++ b/source/blender/makesrna/intern/rna_tracking.c @@ -280,7 +280,7 @@ static void rna_tracking_flushUpdate(Main *UNUSED(bmain), Scene *scene, PointerR static void rna_trackingObject_tracks_begin(CollectionPropertyIterator *iter, PointerRNA *ptr) { - MovieTrackingObject *object = (MovieTrackingObject * )ptr->data; + MovieTrackingObject *object = (MovieTrackingObject *)ptr->data; if (object->flag & TRACKING_OBJECT_CAMERA) { MovieClip *clip = (MovieClip *)ptr->id.data; @@ -294,7 +294,7 @@ static void rna_trackingObject_tracks_begin(CollectionPropertyIterator *iter, Po static PointerRNA rna_trackingObject_reconstruction_get(PointerRNA *ptr) { - MovieTrackingObject *object = (MovieTrackingObject * )ptr->data; + MovieTrackingObject *object = (MovieTrackingObject *)ptr->data; if (object->flag & TRACKING_OBJECT_CAMERA) { MovieClip *clip = (MovieClip *)ptr->id.data; diff --git a/source/blender/makesrna/intern/rna_ui.c b/source/blender/makesrna/intern/rna_ui.c index de359fd6413..14789a437b7 100644 --- a/source/blender/makesrna/intern/rna_ui.c +++ b/source/blender/makesrna/intern/rna_ui.c @@ -55,6 +55,16 @@ EnumPropertyItem operator_context_items[] = { {0, NULL, 0, NULL, NULL} }; +EnumPropertyItem uilist_layout_type_items[] = { + {UILST_LAYOUT_DEFAULT, "DEFAULT", 0, "Default Layout", + "Use the default, multi-rows layout"}, + {UILST_LAYOUT_COMPACT, "COMPACT", 0, "Compact Layout", + "Use the compact, single-row layout"}, + {UILST_LAYOUT_GRID, "GRID", 0, "Grid Layout", + "Use the grid-based layout"}, + {0, NULL, 0, NULL, NULL} +}; + #ifdef RNA_RUNTIME #include <assert.h> @@ -252,6 +262,105 @@ static StructRNA *rna_Panel_refine(PointerRNA *ptr) return (hdr->type && hdr->type->ext.srna) ? hdr->type->ext.srna : &RNA_Panel; } +/* UIList */ +static void uilist_draw_item(uiList *ui_list, bContext *C, uiLayout *layout, PointerRNA *dataptr, PointerRNA *itemptr, + int icon, PointerRNA *active_dataptr, const char *active_propname, int index) +{ + extern FunctionRNA rna_UIList_draw_item_func; + + PointerRNA ul_ptr; + ParameterList list; + FunctionRNA *func; + + RNA_pointer_create(&CTX_wm_screen(C)->id, ui_list->type->ext.srna, ui_list, &ul_ptr); + func = &rna_UIList_draw_item_func; /* RNA_struct_find_function(&ul_ptr, "draw_item"); */ + + RNA_parameter_list_create(&list, &ul_ptr, func); + RNA_parameter_set_lookup(&list, "context", &C); + RNA_parameter_set_lookup(&list, "layout", &layout); + RNA_parameter_set_lookup(&list, "data", dataptr); + RNA_parameter_set_lookup(&list, "item", itemptr); + RNA_parameter_set_lookup(&list, "icon", &icon); + RNA_parameter_set_lookup(&list, "active_data", active_dataptr); + RNA_parameter_set_lookup(&list, "active_property", &active_propname); + RNA_parameter_set_lookup(&list, "index", &index); + ui_list->type->ext.call((bContext *)C, &ul_ptr, func, &list); + + RNA_parameter_list_free(&list); +} + +static void rna_UIList_unregister(Main *UNUSED(bmain), StructRNA *type) +{ + uiListType *ult = RNA_struct_blender_type_get(type); + + if (!ult) + return; + + RNA_struct_free_extension(type, &ult->ext); + + WM_uilisttype_freelink(ult); + + RNA_struct_free(&BLENDER_RNA, type); + + /* update while blender is running */ + WM_main_add_notifier(NC_SCREEN | NA_EDITED, NULL); +} + +static StructRNA *rna_UIList_register(Main *bmain, ReportList *reports, void *data, const char *identifier, + StructValidateFunc validate, StructCallbackFunc call, StructFreeFunc free) +{ + uiListType *ult, dummyult = {NULL}; + uiList dummyuilist = {NULL}; + PointerRNA dummyul_ptr; + int have_function[1]; + size_t over_alloc = 0; /* warning, if this becomes a bess, we better do another alloc */ + + /* setup dummy menu & menu type to store static properties in */ + dummyuilist.type = &dummyult; + RNA_pointer_create(NULL, &RNA_UIList, &dummyuilist, &dummyul_ptr); + + /* validate the python class */ + if (validate(&dummyul_ptr, data, have_function) != 0) + return NULL; + + if (strlen(identifier) >= sizeof(dummyult.idname)) { + BKE_reportf(reports, RPT_ERROR, "Registering uilist class: '%s' is too long, maximum length is %d", + identifier, (int)sizeof(dummyult.idname)); + return NULL; + } + + /* check if we have registered this uilist type before, and remove it */ + ult = WM_uilisttype_find(dummyult.idname, TRUE); + if (ult && ult->ext.srna) + rna_UIList_unregister(bmain, ult->ext.srna); + + /* create a new menu type */ + ult = MEM_callocN(sizeof(uiListType) + over_alloc, "python uilist"); + memcpy(ult, &dummyult, sizeof(dummyult)); + + ult->ext.srna = RNA_def_struct(&BLENDER_RNA, ult->idname, "UIList"); + ult->ext.data = data; + ult->ext.call = call; + ult->ext.free = free; + RNA_struct_blender_type_set(ult->ext.srna, ult); + RNA_def_struct_flag(ult->ext.srna, STRUCT_NO_IDPROPERTIES); + + ult->draw_item = (have_function[0]) ? uilist_draw_item : NULL; + + WM_uilisttype_add(ult); + + /* update while blender is running */ + WM_main_add_notifier(NC_SCREEN | NA_EDITED, NULL); + + return ult->ext.srna; +} + +static StructRNA *rna_UIList_refine(PointerRNA *ptr) +{ + uiList *ui_list = (uiList *)ptr->data; + return (ui_list->type && ui_list->type->ext.srna) ? ui_list->type->ext.srna : &RNA_UIList; +} + /* Header */ static void header_draw(const bContext *C, Header *hdr) @@ -495,6 +604,8 @@ static void rna_Menu_bl_description_set(PointerRNA *ptr, const char *value) else assert(!"setting the bl_description on a non-builtin menu"); } +/* UILayout */ + static int rna_UILayout_active_get(PointerRNA *ptr) { return uiLayoutGetActive(ptr->data); @@ -738,6 +849,58 @@ static void rna_def_panel(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Options", "Options for this panel type"); } +static void rna_def_uilist(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + PropertyRNA *parm; + FunctionRNA *func; + + srna = RNA_def_struct(brna, "UIList", NULL); + RNA_def_struct_ui_text(srna, "UIList", "UI list containing the elements of a collection"); + RNA_def_struct_sdna(srna, "uiList"); + RNA_def_struct_refine_func(srna, "rna_UIList_refine"); + RNA_def_struct_register_funcs(srna, "rna_UIList_register", "rna_UIList_unregister", NULL); + + /* draw */ + func = RNA_def_function(srna, "draw_item", NULL); + RNA_def_function_ui_description(func, "Draw an item in the list (NOTE: when you define your own draw_item " + "function, you may want to check given 'item' is of the right type...)"); + RNA_def_function_flag(func, FUNC_REGISTER); + parm = RNA_def_pointer(func, "context", "Context", "", ""); + RNA_def_property_flag(parm, PROP_REQUIRED); + parm = RNA_def_pointer(func, "layout", "UILayout", "", "Layout to draw the item"); + RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL); + parm = RNA_def_pointer(func, "data", "AnyType", "", "Data from which to take Collection property"); + RNA_def_property_flag(parm, PROP_REQUIRED | PROP_RNAPTR); + parm = RNA_def_pointer(func, "item", "AnyType", "", "Item of the collection property"); + RNA_def_property_flag(parm, PROP_REQUIRED | PROP_RNAPTR); + parm = RNA_def_int(func, "icon", 0, 0, INT_MAX, "", "Icon of the item in the collection", 0, INT_MAX); + RNA_def_property_flag(parm, PROP_REQUIRED); + parm = RNA_def_pointer(func, "active_data", "AnyType", "", + "Data from which to take property for the active element"); + RNA_def_property_flag(parm, PROP_REQUIRED | PROP_RNAPTR | PROP_NEVER_NULL); + parm = RNA_def_string(func, "active_property", "", 0, "", + "Identifier of property in active_data, for the active element"); + RNA_def_property_flag(parm, PROP_REQUIRED); + RNA_def_int(func, "index", 0, 0, INT_MAX, "", "Index of the item in the collection", 0, INT_MAX); + RNA_def_property_flag(parm, PROP_REQUIRED); + + prop = RNA_def_property(srna, "layout_type", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_items(prop, uilist_layout_type_items); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + + /* registration */ + prop = RNA_def_property(srna, "bl_idname", PROP_STRING, PROP_NONE); + RNA_def_property_string_sdna(prop, NULL, "type->idname"); + RNA_def_property_flag(prop, PROP_REGISTER | PROP_NEVER_CLAMP); + RNA_def_property_ui_text(prop, "ID Name", + "If this is set, the uilist gets a custom ID, otherwise it takes the " + "name of the class used to define the uilist (for example, if the " + "class name is \"OBJECT_UL_vgroups\", and bl_idname is not set by the " + "script, then bl_idname = \"OBJECT_UL_vgroups\")"); +} + static void rna_def_header(BlenderRNA *brna) { StructRNA *srna; @@ -852,6 +1015,7 @@ void RNA_def_ui(BlenderRNA *brna) { rna_def_ui_layout(brna); rna_def_panel(brna); + rna_def_uilist(brna); rna_def_header(brna); rna_def_menu(brna); } diff --git a/source/blender/makesrna/intern/rna_ui_api.c b/source/blender/makesrna/intern/rna_ui_api.c index 548539e3395..366d0dc1fd9 100644 --- a/source/blender/makesrna/intern/rna_ui_api.c +++ b/source/blender/makesrna/intern/rna_ui_api.c @@ -33,8 +33,12 @@ #include <stdio.h> #include "RNA_define.h" +#include "RNA_enum_types.h" + +#include "DNA_screen_types.h" #include "UI_resources.h" +#include "UI_interface_icons.h" #include "rna_internal.h" @@ -70,12 +74,117 @@ static PointerRNA rna_uiItemO(uiLayout *layout, const char *opname, const char * return uiItemFullO(layout, opname, name, icon, NULL, uiLayoutGetOperatorContext(layout), flag); } +static void rna_uiItemL(uiLayout *layout, const char *name, int icon, int icon_value) +{ + if (icon_value && !icon) { + icon = icon_value; + } + + uiItemL(layout, name, icon); +} + +static int rna_ui_get_rnaptr_icon(bContext *C, PointerRNA *ptr_icon) +{ + return UI_rnaptr_icon_get(C, ptr_icon, RNA_struct_ui_icon(ptr_icon->type), FALSE); +} + +static const char *rna_ui_get_enum_name(bContext *C, PointerRNA *ptr, const char *propname, const char *identifier) +{ + PropertyRNA *prop = NULL; + EnumPropertyItem *items = NULL, *item; + int free; + const char *name = ""; + + prop = RNA_struct_find_property(ptr, propname); + if (!prop || (RNA_property_type(prop) != PROP_ENUM)) { + RNA_warning("Property not found or not an enum: %s.%s", RNA_struct_identifier(ptr->type), propname); + return name; + } + + RNA_property_enum_items_gettexted(C, ptr, prop, &items, NULL, &free); + + if (items) { + for (item = items; item->identifier; item++) { + if (item->identifier[0] && strcmp(item->identifier, identifier) == 0) { + name = item->name; + break; + } + } + if (free) { + MEM_freeN(items); + } + } + + return name; +} + +static const char *rna_ui_get_enum_description(bContext *C, PointerRNA *ptr, const char *propname, + const char *identifier) +{ + PropertyRNA *prop = NULL; + EnumPropertyItem *items = NULL, *item; + int free; + const char *desc = ""; + + prop = RNA_struct_find_property(ptr, propname); + if (!prop || (RNA_property_type(prop) != PROP_ENUM)) { + RNA_warning("Property not found or not an enum: %s.%s", RNA_struct_identifier(ptr->type), propname); + return desc; + } + + RNA_property_enum_items_gettexted(C, ptr, prop, &items, NULL, &free); + + if (items) { + for (item = items; item->identifier; item++) { + if (item->identifier[0] && strcmp(item->identifier, identifier) == 0) { + desc = item->description; + break; + } + } + if (free) { + MEM_freeN(items); + } + } + + return desc; +} + +static int rna_ui_get_enum_icon(bContext *C, PointerRNA *ptr, const char *propname, const char *identifier) +{ + PropertyRNA *prop = NULL; + EnumPropertyItem *items = NULL, *item; + int free; + int icon = ICON_NONE; + + prop = RNA_struct_find_property(ptr, propname); + if (!prop || (RNA_property_type(prop) != PROP_ENUM)) { + RNA_warning("Property not found or not an enum: %s.%s", RNA_struct_identifier(ptr->type), propname); + return icon; + } + + RNA_property_enum_items(C, ptr, prop, &items, NULL, &free); + + if (items) { + for (item = items; item->identifier; item++) { + if (item->identifier[0] && strcmp(item->identifier, identifier) == 0) { + icon = item->icon; + break; + } + } + if (free) { + MEM_freeN(items); + } + } + + return icon; +} + #else #define DEF_ICON_BLANK_SKIP #define DEF_ICON(name) {ICON_##name, (#name), 0, (#name), ""}, #define DEF_VICO(name) {VICO_##name, (#name), 0, (#name), ""}, -static EnumPropertyItem icon_items[] = { +EnumPropertyItem icon_items[] = { #include "UI_icons.h" {0, NULL, 0, NULL, NULL} }; @@ -92,7 +201,6 @@ static void api_ui_item_common(FunctionRNA *func) prop = RNA_def_property(func, "icon", PROP_ENUM, PROP_NONE); RNA_def_property_enum_items(prop, icon_items); RNA_def_property_ui_text(prop, "Icon", "Override automatic icon of the item"); - } static void api_ui_item_op(FunctionRNA *func) @@ -130,13 +238,6 @@ void RNA_api_ui_layout(StructRNA *srna) {'h', "HUE", 0, "Hue", ""}, {0, NULL, 0, NULL, NULL} }; - - static EnumPropertyItem list_type_items[] = { - {0, "DEFAULT", 0, "None", ""}, - {'c', "COMPACT", 0, "Compact", ""}, - {'i', "ICONS", 0, "Icons", ""}, - {0, NULL, 0, NULL, NULL} - }; /* simple layout specifiers */ func = RNA_def_function(srna, "row", "uiLayoutRow"); @@ -175,6 +276,44 @@ void RNA_api_ui_layout(StructRNA *srna) RNA_def_float(func, "percentage", 0.0f, 0.0f, 1.0f, "Percentage", "Percentage of width to split at", 0.0f, 1.0f); RNA_def_boolean(func, "align", 0, "", "Align buttons to each other"); + /* Icon of a rna pointer */ + func = RNA_def_function(srna, "icon", "rna_ui_get_rnaptr_icon"); + parm = RNA_def_int(func, "icon_value", ICON_NONE, 0, INT_MAX, "", "Icon identifier", 0, INT_MAX); + RNA_def_function_return(func, parm); + RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_USE_CONTEXT); + parm = RNA_def_pointer(func, "data", "AnyType", "", "Data from which to take the icon"); + RNA_def_property_flag(parm, PROP_REQUIRED | PROP_RNAPTR | PROP_NEVER_NULL); + RNA_def_function_ui_description(func, "Return the custom icon for this data, " + "use it e.g. to get materials or texture icons"); + + /* UI name, description and icon of an enum item */ + func = RNA_def_function(srna, "enum_item_name", "rna_ui_get_enum_name"); + parm = RNA_def_string(func, "name", "", 0, "", "UI name of the enum item"); + RNA_def_function_return(func, parm); + RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_USE_CONTEXT); + api_ui_item_rna_common(func); + parm = RNA_def_string(func, "identifier", "", 0, "", "Identifier of the enum item"); + RNA_def_property_flag(parm, PROP_REQUIRED); + RNA_def_function_ui_description(func, "Return the UI name for this enum item"); + + func = RNA_def_function(srna, "enum_item_description", "rna_ui_get_enum_description"); + parm = RNA_def_string(func, "description", "", 0, "", "UI description of the enum item"); + RNA_def_function_return(func, parm); + RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_USE_CONTEXT); + api_ui_item_rna_common(func); + parm = RNA_def_string(func, "identifier", "", 0, "", "Identifier of the enum item"); + RNA_def_property_flag(parm, PROP_REQUIRED); + RNA_def_function_ui_description(func, "Return the UI description for this enum item"); + + func = RNA_def_function(srna, "enum_item_icon", "rna_ui_get_enum_icon"); + parm = RNA_def_int(func, "icon_value", ICON_NONE, 0, INT_MAX, "", "Icon identifier", 0, INT_MAX); + RNA_def_function_return(func, parm); + RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_USE_CONTEXT); + api_ui_item_rna_common(func); + parm = RNA_def_string(func, "identifier", "", 0, "", "Identifier of the enum item"); + RNA_def_property_flag(parm, PROP_REQUIRED); + RNA_def_function_ui_description(func, "Return the icon for this enum item"); + /* items */ func = RNA_def_function(srna, "prop", "rna_uiItemR"); RNA_def_function_ui_description(func, "Item. Exposes an RNA item and places it into the layout"); @@ -274,9 +413,13 @@ void RNA_api_ui_layout(StructRNA *srna) RNA_def_property_flag(parm, PROP_REQUIRED); #endif - func = RNA_def_function(srna, "label", "uiItemL"); - RNA_def_function_ui_description(func, "Item. Display text in the layout"); + func = RNA_def_function(srna, "label", "rna_uiItemL"); + RNA_def_function_ui_description(func, "Item. Display text and/or icon in the layout"); api_ui_item_common(func); + parm = RNA_def_property(func, "icon_value", PROP_INT, PROP_UNSIGNED); + RNA_def_property_ui_text(parm, "Icon Value", + "Override automatic icon of the item " + "(use it e.g. with custom material icons returned by icon()...)"); func = RNA_def_function(srna, "menu", "uiItemM"); RNA_def_function_flag(func, FUNC_USE_CONTEXT); @@ -439,26 +582,29 @@ void RNA_api_ui_layout(StructRNA *srna) RNA_def_boolean(func, "compact", 0, "", "Use more compact layout"); func = RNA_def_function(srna, "template_list", "uiTemplateList"); - RNA_def_function_ui_description(func, "Item. A list widget to display data, e.g. vertexgroups " - "(WARNING: only one per panel allowed!)."); + RNA_def_function_ui_description(func, "Item. A list widget to display data, e.g. vertexgroups."); RNA_def_function_flag(func, FUNC_USE_CONTEXT); - parm = RNA_def_pointer(func, "data", "AnyType", "", "Data from which to take property"); + parm = RNA_def_string(func, "listtype_name", "", 0, "", "Identifier of the list type to use"); + RNA_def_property_flag(parm, PROP_REQUIRED); + parm = RNA_def_string(func, "list_id", "", 0, "", + "Identifier of this list widget. " + "If this is set, the uilist gets a custom ID, otherwise it takes the " + "name of the class used to define the uilist (for example, if the " + "class name is \"OBJECT_UL_vgroups\", and list_id is not set by the " + "script, then bl_idname = \"OBJECT_UL_vgroups\")"); + parm = RNA_def_pointer(func, "dataptr", "AnyType", "", "Data from which to take the Collection property"); RNA_def_property_flag(parm, PROP_REQUIRED | PROP_RNAPTR); - parm = RNA_def_string(func, "property", "", 0, "", "Identifier of property in data"); + parm = RNA_def_string(func, "propname", "", 0, "", "Identifier of the Collection property in data"); RNA_def_property_flag(parm, PROP_REQUIRED); - parm = RNA_def_pointer(func, "active_data", "AnyType", "", - "Data from which to take property for the active element"); + parm = RNA_def_pointer(func, "active_dataptr", "AnyType", "", + "Data from which to take the integer property, index of the active item"); RNA_def_property_flag(parm, PROP_REQUIRED | PROP_RNAPTR | PROP_NEVER_NULL); - parm = RNA_def_string(func, "active_property", "", 0, "", - "Identifier of property in data, for the active element"); + parm = RNA_def_string(func, "active_propname", "", 0, "", + "Identifier of the integer property in active_data, index of the active item"); RNA_def_property_flag(parm, PROP_REQUIRED); - RNA_def_string(func, "prop_list", "", 0, "", - "Identifier of a string property in each data member, specifying which " - "of its properties should have a widget displayed in its row " - "(format: \"propname1:propname2:propname3:...\")"); RNA_def_int(func, "rows", 5, 0, INT_MAX, "", "Number of rows to display", 0, INT_MAX); RNA_def_int(func, "maxrows", 5, 0, INT_MAX, "", "Maximum number of rows to display", 0, INT_MAX); - RNA_def_enum(func, "type", list_type_items, 0, "Type", "Type of list to use"); + RNA_def_enum(func, "type", uilist_layout_type_items, UILST_LAYOUT_DEFAULT, "Type", "Type of layout to use"); func = RNA_def_function(srna, "template_running_jobs", "uiTemplateRunningJobs"); RNA_def_function_flag(func, FUNC_USE_CONTEXT); diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c index 06154a235aa..7474ff40e32 100644 --- a/source/blender/makesrna/intern/rna_userdef.c +++ b/source/blender/makesrna/intern/rna_userdef.c @@ -47,6 +47,7 @@ #include "BLF_translation.h" #include "BKE_sound.h" +#include "BKE_addon.h" #ifdef WITH_CYCLES static EnumPropertyItem compute_device_type_items[] = { @@ -67,6 +68,7 @@ static EnumPropertyItem compute_device_type_items[] = { #include "BKE_depsgraph.h" #include "BKE_global.h" #include "BKE_main.h" +#include "BKE_idprop.h" #include "GPU_draw.h" @@ -79,6 +81,8 @@ static EnumPropertyItem compute_device_type_items[] = { #include "CCL_api.h" +#include "BKE_addon.h" + static void rna_userdef_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *UNUSED(ptr)) { WM_main_add_notifier(NC_WINDOW, NULL); @@ -428,6 +432,103 @@ static EnumPropertyItem *rna_lang_enum_properties_itemf(bContext *UNUSED(C), Poi } #endif +static IDProperty *rna_AddonPref_idprops(PointerRNA *ptr, int create) +{ + if (create && !ptr->data) { + IDPropertyTemplate val = {0}; + ptr->data = IDP_New(IDP_GROUP, &val, "RNA_AddonPreferences group"); + } + + return ptr->data; +} + +static PointerRNA rna_Addon_preferences_get(PointerRNA *ptr) +{ + bAddon *addon = (bAddon *)ptr->data; + bAddonPrefType *apt = BKE_addon_pref_type_find(addon->module, TRUE); + if (apt) { + if (addon->prop == NULL) { + IDPropertyTemplate val = {0}; + addon->prop = IDP_New(IDP_GROUP, &val, addon->module); /* name is unimportant */ + } + return rna_pointer_inherit_refine(ptr, apt->ext.srna, addon->prop); + } + else { + return PointerRNA_NULL; + } +} + +static void rna_AddonPref_unregister(Main *UNUSED(bmain), StructRNA *type) +{ + bAddonPrefType *apt = RNA_struct_blender_type_get(type); + + if (!apt) + return; + + RNA_struct_free_extension(type, &apt->ext); + + BKE_addon_pref_type_remove(apt); + RNA_struct_free(&BLENDER_RNA, type); + + /* update while blender is running */ + WM_main_add_notifier(NC_SCREEN | NA_EDITED, NULL); +} + +static StructRNA *rna_AddonPref_register(Main *bmain, ReportList *reports, void *data, const char *identifier, + StructValidateFunc validate, StructCallbackFunc call, StructFreeFunc free) +{ + bAddonPrefType *apt, dummyapt = {{'\0'}}; + bAddon dummyaddon = {NULL}; + PointerRNA dummyhtr; + // int have_function[1]; + + /* setup dummy header & header type to store static properties in */ + RNA_pointer_create(NULL, &RNA_AddonPreferences, &dummyaddon, &dummyhtr); + + /* validate the python class */ + if (validate(&dummyhtr, data, NULL /* have_function */ ) != 0) + return NULL; + + BLI_strncpy(dummyapt.idname, dummyaddon.module, sizeof(dummyapt.idname)); + if (strlen(identifier) >= sizeof(dummyapt.idname)) { + BKE_reportf(reports, RPT_ERROR, "Registering addon-prefs class: '%s' is too long, maximum length is %d", + identifier, (int)sizeof(dummyapt.idname)); + return NULL; + } + + /* check if we have registered this header type before, and remove it */ + apt = BKE_addon_pref_type_find(dummyaddon.module, TRUE); + if (apt) { + if (apt->ext.srna) { + rna_AddonPref_unregister(bmain, apt->ext.srna); + } + } + + /* create a new header type */ + apt = MEM_mallocN(sizeof(bAddonPrefType), "addonpreftype"); + memcpy(apt, &dummyapt, sizeof(dummyapt)); + BKE_addon_pref_type_add(apt); + + apt->ext.srna = RNA_def_struct(&BLENDER_RNA, identifier, "AddonPreferences"); + apt->ext.data = data; + apt->ext.call = call; + apt->ext.free = free; + RNA_struct_blender_type_set(apt->ext.srna, apt); + +// apt->draw = (have_function[0]) ? header_draw : NULL; + + /* update while blender is running */ + WM_main_add_notifier(NC_SCREEN | NA_EDITED, NULL); + + return apt->ext.srna; +} + +/* placeholder, doesn't do anything useful yet */ +static StructRNA *rna_AddonPref_refine(PointerRNA *ptr) +{ + return (ptr->type) ? ptr->type : &RNA_AddonPreferences; +} + #else static void rna_def_userdef_theme_ui_font_style(BlenderRNA *brna) @@ -437,7 +538,7 @@ static void rna_def_userdef_theme_ui_font_style(BlenderRNA *brna) static EnumPropertyItem font_kerning_style[] = { {0, "UNFITTED", 0, "Unfitted", "Use scaled but un-grid-fitted kerning distances"}, - {1, "DEFAULT", 0, "Default", "Use scaled and grid-fitted kerning distances"}, + {1, "FITTED", 0, "Fitted", "Use scaled and grid-fitted kerning distances"}, {0, NULL, 0, NULL, NULL} }; @@ -1549,10 +1650,28 @@ static void rna_def_userdef_theme_space_text(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Syntax Built-in", ""); RNA_def_property_update(prop, 0, "rna_userdef_update"); + prop = RNA_def_property(srna, "syntax_symbols", PROP_FLOAT, PROP_COLOR_GAMMA); + RNA_def_property_float_sdna(prop, NULL, "syntaxs"); + RNA_def_property_array(prop, 3); + RNA_def_property_ui_text(prop, "Syntax Symbols", ""); + RNA_def_property_update(prop, 0, "rna_userdef_update"); + prop = RNA_def_property(srna, "syntax_special", PROP_FLOAT, PROP_COLOR_GAMMA); RNA_def_property_float_sdna(prop, NULL, "syntaxv"); RNA_def_property_array(prop, 3); - RNA_def_property_ui_text(prop, "Decorator", ""); + RNA_def_property_ui_text(prop, "Syntax Special", ""); + RNA_def_property_update(prop, 0, "rna_userdef_update"); + + prop = RNA_def_property(srna, "syntax_preprocessor", PROP_FLOAT, PROP_COLOR_GAMMA); + RNA_def_property_float_sdna(prop, NULL, "syntaxd"); + RNA_def_property_array(prop, 3); + RNA_def_property_ui_text(prop, "Syntax PreProcessor", ""); + RNA_def_property_update(prop, 0, "rna_userdef_update"); + + prop = RNA_def_property(srna, "syntax_reserved", PROP_FLOAT, PROP_COLOR_GAMMA); + RNA_def_property_float_sdna(prop, NULL, "syntaxr"); + RNA_def_property_array(prop, 3); + RNA_def_property_ui_text(prop, "Syntax Reserved", ""); RNA_def_property_update(prop, 0, "rna_userdef_update"); prop = RNA_def_property(srna, "syntax_comment", PROP_FLOAT, PROP_COLOR_GAMMA); @@ -2228,6 +2347,7 @@ static void rna_def_userdef_themes(BlenderRNA *brna) static EnumPropertyItem active_theme_area[] = { {0, "USER_INTERFACE", ICON_UI, "User Interface", ""}, + {19, "STYLE", ICON_FONTPREVIEW, "Text Style", ""}, {18, "BONE_COLOR_SETS", ICON_COLOR, "Bone Color Sets", ""}, {1, "VIEW_3D", ICON_VIEW3D, "3D View", ""}, {2, "TIMELINE", ICON_TIME, "Timeline", ""}, @@ -2394,6 +2514,32 @@ static void rna_def_userdef_addon(BlenderRNA *brna) prop = RNA_def_property(srna, "module", PROP_STRING, PROP_NONE); RNA_def_property_ui_text(prop, "Module", "Module name"); RNA_def_struct_name_property(srna, prop); + + /* Collection active property */ + prop = RNA_def_property(srna, "preferences", PROP_POINTER, PROP_NONE); + RNA_def_property_struct_type(prop, "AddonPreferences"); + RNA_def_property_pointer_funcs(prop, "rna_Addon_preferences_get", NULL, NULL, NULL); +} + +static void rna_def_userdef_addon_pref(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + + srna = RNA_def_struct(brna, "AddonPreferences", NULL); + RNA_def_struct_ui_text(srna, "Addon Preferences", ""); + RNA_def_struct_sdna(srna, "bAddon"); /* WARNING: only a bAddon during registration */ + + RNA_def_struct_refine_func(srna, "rna_AddonPref_refine"); + RNA_def_struct_register_funcs(srna, "rna_AddonPref_register", "rna_AddonPref_unregister", NULL); + RNA_def_struct_idprops_func(srna, "rna_AddonPref_idprops"); + + /* registration */ + RNA_define_verify_sdna(0); + prop = RNA_def_property(srna, "bl_idname", PROP_STRING, PROP_NONE); + RNA_def_property_string_sdna(prop, NULL, "module"); + RNA_def_property_flag(prop, PROP_REGISTER | PROP_NEVER_CLAMP); + RNA_define_verify_sdna(1); } @@ -3031,62 +3177,10 @@ static void rna_def_userdef_system(BlenderRNA *brna) {0, NULL, 0, NULL, NULL} }; -#if 0 - /* hardcoded here, could become dynamic somehow */ - /* locale according to http://www.roseindia.net/tutorials/I18N/locales-list.shtml */ - /* if you edit here, please also edit the source/blender/blenfont/intern/blf_lang.c 's locales */ - /* Note: As this list is in alphabetical order, and not defined order, - * here is the highest define currently in use: 35 (Esperanto). */ - static EnumPropertyItem language_items[] = { - { 0, "", 0, N_("Nearly Done"), ""}, - { 0, "DEFAULT", 0, "Default (Default)", ""}, - /* using the utf8 flipped form of Arabic (العربية) */ - {21, "ARABIC", 0, "Arabic (ﺔﻴﺑﺮﻌﻟﺍ)", "ar_EG"}, - {32, "BRAZILIANPORTUGUESE", 0, "Brazilian Portuguese (Português do Brasil)", "pt_BR"}, - { 1, "ENGLISH", 0, "English (English)", "en_US"}, - { 8, "FRENCH", 0, "French (Français)", "fr_FR"}, - { 4, "ITALIAN", 0, "Italian (Italiano)", "it_IT"}, - { 2, "JAPANESE", 0, "Japanese (日本語)", "ja_JP"}, - {12, "PORTUGUESE", 0, "Portuguese (Português)", "pt"}, - {15, "RUSSIAN", 0, "Russian (Русский)", "ru_RU"}, - {13, "SIMPLIFIED_CHINESE", 0, "Simplified Chinese (简体中文)", "zh_CN"}, - { 9, "SPANISH", 0, "Spanish (Español)", "es"}, - {14, "TRADITIONAL_CHINESE", 0, "Traditional Chinese (繁體中文)", "zh_TW"}, - {18, "UKRAINIAN", 0, "Ukrainian (Український)", "uk_UA"}, - { 0, "", 0, N_("In Progress"), ""}, -/* {22, "BULGARIAN", 0, "Bulgarian (Български)", "bg_BG"},*/ /* XXX Not active nor enough translated. */ -/* {10, "CATALAN", 0, "Catalan (Català)", "ca_AD"},*/ /* XXX Not active nor enough translated. */ - {16, "CROATIAN", 0, "Croatian (Hrvatski)", "hr_HR"}, - {11, "CZECH", 0, "Czech (Český)", "cs_CZ"}, - { 3, "DUTCH", 0, "Dutch (Nederlandse taal)", "nl_NL"}, - {35, "ESPERANTO", 0, "Esperanto (Esperanto)", "eo"}, - {34, "ESTONIAN", 0, "Estonian (Eestlane)", "et_EE"}, -/* { 6, "FINNISH", 0, "Finnish (Suomi)", "fi_FI"},*/ /* XXX Not active nor enough translated. */ - { 5, "GERMAN", 0, "German (Deutsch)", "de_DE"}, -/* {23, "GREEK", 0, "Greek (Ελληνικά)", "el_GR"},*/ /* XXX Not active nor enough translated. */ - /* using the utf8 flipped form of Hebrew (עִבְרִית)) */ - {33, "HEBREW", 0, "Hebrew (תירִבְעִ)", "he_IL"}, - {31, "HUNGARIAN", 0, "Hungarian (Magyar)", "hu_HU"}, - {27, "INDONESIAN", 0, "Indonesian (Bahasa indonesia)", "id_ID"}, - {29, "KYRGYZ", 0, "Kyrgyz (Кыргыз тили)", "ky_KG"}, -/* {24, "KOREAN", 0, "Korean (한국 언어)", "ko_KR"}, */ /* XXX Not active nor enough translated. */ -/* {25, "NEPALI", 0, "Nepali (नेपाली)", "ne_NP"},*/ /* XXX Not active nor enough translated. */ - /* using the utf8 flipped form of Persian (فارسی) */ - {26, "PERSIAN", 0, "Persian (ﯽﺳﺭﺎﻓ)", "fa_IR"}, -/* {19, "POLISH", 0, "Polish (Polski)", "pl_PL"},*/ /* XXX Not active nor enough translated. */ -/* {20, "ROMANIAN", 0, "Romanian (Român)", "ro_RO"}, */ /* XXX Not active nor enough translated. */ - {17, "SERBIAN", 0, "Serbian (Српски)", "sr_RS"}, - {28, "SERBIAN_LATIN", 0, "Serbian Latin (Srpski latinica)", "sr_RS@latin"}, - { 7, "SWEDISH", 0, "Swedish (Svenska)", "sv_SE"}, - {30, "TURKISH", 0, "Turkish (Türkçe)", "tr_TR"}, - { 0, NULL, 0, NULL, NULL} - }; -#else static EnumPropertyItem language_items[] = { - { 0, "DEFAULT", 0, "Default (Default)", ""}, - { 0, NULL, 0, NULL, NULL} + {0, "DEFAULT", 0, "Default (Default)", ""}, + {0, NULL, 0, NULL, NULL} }; -#endif #ifdef WITH_CYCLES static EnumPropertyItem compute_device_items[] = { @@ -3801,6 +3895,7 @@ void RNA_def_userdef(BlenderRNA *brna) rna_def_userdef_filepaths(brna); rna_def_userdef_system(brna); rna_def_userdef_addon(brna); + rna_def_userdef_addon_pref(brna); } |