diff options
Diffstat (limited to 'source/blender/makesrna')
53 files changed, 526 insertions, 293 deletions
diff --git a/source/blender/makesrna/RNA_access.h b/source/blender/makesrna/RNA_access.h index d18fe7629fd..b4b79059f93 100644 --- a/source/blender/makesrna/RNA_access.h +++ b/source/blender/makesrna/RNA_access.h @@ -1119,8 +1119,14 @@ void _RNA_warning(const char *format, ...) ATTR_PRINTF_FORMAT(1, 2); /* Equals test (skips pointers and collections) * is_strict false assumes uninitialized properties are equal */ -bool RNA_property_equals(struct PointerRNA *a, struct PointerRNA *b, struct PropertyRNA *prop, bool is_strict); -bool RNA_struct_equals(struct PointerRNA *a, struct PointerRNA *b, bool is_strict); +typedef enum eRNAEqualsMode { + RNA_EQ_STRICT, /* set/unset ignored */ + RNA_EQ_UNSET_MATCH_ANY, /* unset property matches anything */ + RNA_EQ_UNSET_MATCH_NONE /* unset property never matches set property */ +} eRNAEqualsMode; + +bool RNA_property_equals(struct PointerRNA *a, struct PointerRNA *b, struct PropertyRNA *prop, eRNAEqualsMode mode); +bool RNA_struct_equals(struct PointerRNA *a, struct PointerRNA *b, eRNAEqualsMode mode); #ifdef __cplusplus } diff --git a/source/blender/makesrna/RNA_define.h b/source/blender/makesrna/RNA_define.h index 924fc505fda..2b1a5bc71ff 100644 --- a/source/blender/makesrna/RNA_define.h +++ b/source/blender/makesrna/RNA_define.h @@ -42,8 +42,8 @@ extern "C" { BlenderRNA *RNA_create(void); void RNA_define_free(BlenderRNA *brna); void RNA_free(BlenderRNA *brna); -void RNA_define_verify_sdna(int verify); -void RNA_define_animate_sdna(int animate); +void RNA_define_verify_sdna(bool verify); +void RNA_define_animate_sdna(bool animate); void RNA_init(void); void RNA_exit(void); @@ -164,7 +164,7 @@ void RNA_def_property_update(PropertyRNA *prop, int noteflag, const char *update void RNA_def_property_editable_func(PropertyRNA *prop, const char *editable); void RNA_def_property_editable_array_func(PropertyRNA *prop, const char *editable); -void RNA_def_property_update_runtime(PropertyRNA *prop, void *func); +void RNA_def_property_update_runtime(PropertyRNA *prop, const void *func); void RNA_def_property_dynamic_array_funcs(PropertyRNA *prop, const char *getlength); void RNA_def_property_boolean_funcs(PropertyRNA *prop, const char *get, const char *set); @@ -225,6 +225,10 @@ const char *RNA_property_typename(PropertyType type); void RNA_identifier_sanitize(char *identifier, int property); +extern const int rna_matrix_dimsize_3x3[]; +extern const int rna_matrix_dimsize_4x4[]; +extern const int rna_matrix_dimsize_4x2[]; + /* max size for dynamic defined type descriptors, * this value is arbitrary */ #define RNA_DYN_DESCR_MAX 240 diff --git a/source/blender/makesrna/SConscript b/source/blender/makesrna/SConscript index dfe1ebb3385..5053c8082e9 100644 --- a/source/blender/makesrna/SConscript +++ b/source/blender/makesrna/SConscript @@ -66,6 +66,9 @@ if env['WITH_BF_BULLET']: defs.append('WITH_BULLET') incs += ' #/intern/rigidbody' +if env['WITH_BF_OIIO']: + defs.append('WITH_OPENIMAGEIO') + if env['WITH_BF_OPENEXR']: defs.append('WITH_OPENEXR') diff --git a/source/blender/makesrna/intern/CMakeLists.txt b/source/blender/makesrna/intern/CMakeLists.txt index eb0c4f7c422..bac335572f5 100644 --- a/source/blender/makesrna/intern/CMakeLists.txt +++ b/source/blender/makesrna/intern/CMakeLists.txt @@ -23,9 +23,6 @@ # # ***** END GPL LICENSE BLOCK ***** -# Generated code has some unused vars we can ignore. -remove_strict_flags() - if(CMAKE_COMPILER_IS_GNUCC) # add here so we fail early. set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror=implicit-function-declaration") @@ -124,7 +121,7 @@ set(APISRC ) string(REGEX REPLACE "rna_([a-zA-Z0-9_-]*).c" "${CMAKE_CURRENT_BINARY_DIR}/rna_\\1_gen.c" GENSRC "${DEFSRC}") -set_source_files_properties(GENSRC PROPERTIES GENERATED true) +set_source_files_properties(${GENSRC} PROPERTIES GENERATED TRUE) set(SRC_RNA_INC ../RNA_access.h @@ -140,6 +137,8 @@ set(SRC ${DEFSRC} ${APISRC} ../../../../intern/guardedalloc/intern/mallocn.c + ../../../../intern/guardedalloc/intern/mallocn_guarded_impl.c + ../../../../intern/guardedalloc/intern/mallocn_lockfree_impl.c ../../../../intern/guardedalloc/intern/mmap_win.c ) @@ -167,6 +166,10 @@ if(WITH_IMAGE_OPENEXR) add_definitions(-DWITH_OPENEXR) endif() +if(WITH_IMAGE_OPENIMAGEIO) + add_definitions(-DWITH_OPENIMAGEIO) +endif() + if(WITH_IMAGE_TIFF) add_definitions(-DWITH_TIFF) endif() @@ -252,11 +255,6 @@ if(WITH_BULLET) add_definitions(-DWITH_BULLET) endif() -# for mallocn.c -if (WITH_GUARDEDALLOC) - add_definitions(-DWITH_GUARDEDALLOC) -endif() - # Build makesrna executable blender_include_dirs( . diff --git a/source/blender/makesrna/intern/SConscript b/source/blender/makesrna/intern/SConscript index 10b6a8c8d10..fe6950e62dd 100644 --- a/source/blender/makesrna/intern/SConscript +++ b/source/blender/makesrna/intern/SConscript @@ -82,6 +82,9 @@ if env['WITH_BF_BULLET']: defs.append('WITH_BULLET') incs += ' #/intern/rigidbody' +if env['WITH_BF_OIIO']: + defs.append('WITH_OPENIMAGEIO') + if env['WITH_BF_OPENEXR']: defs.append('WITH_OPENEXR') @@ -150,8 +153,6 @@ if env['WITH_BF_INTERNATIONAL']: if not env['BF_DEBUG']: defs.append('NDEBUG') -defs.append('WITH_GUARDEDALLOC') - makesrna_tool.Append(CPPDEFINES=defs) makesrna_tool.Append (CPPPATH = Split(incs)) diff --git a/source/blender/makesrna/intern/makesrna.c b/source/blender/makesrna/intern/makesrna.c index 838f8a33f07..8a4022de104 100644 --- a/source/blender/makesrna/intern/makesrna.c +++ b/source/blender/makesrna/intern/makesrna.c @@ -82,7 +82,7 @@ static void rna_generate_static_parameter_prototypes(FILE *f, StructRNA *srna, F fprintf(f, param); \ } (void)0 -static int replace_if_different(char *tmpfile, const char *dep_files[]) +static int replace_if_different(const char *tmpfile, const char *dep_files[]) { /* return 0; *//* use for testing had edited rna */ @@ -2692,7 +2692,11 @@ static void rna_generate_static_parameter_prototypes(FILE *f, StructRNA *srna, F } + /* ensure func(void) if there are no args */ + if (first) fprintf(f, "void"); + fprintf(f, ")"); + if (close_prototype) fprintf(f, ";\n"); } @@ -2764,7 +2768,7 @@ static void rna_generate_struct_prototypes(FILE *f) static void rna_generate_property(FILE *f, StructRNA *srna, const char *nest, PropertyRNA *prop) { - char *strnest = "", *errnest = ""; + char *strnest = (char *)"", *errnest = (char *)""; int len, freenest = 0; if (nest != NULL) { @@ -3330,6 +3334,12 @@ static void rna_generate(BlenderRNA *brna, FILE *f, const char *filename, const fprintf(f, "#include \"%s\"\n", api_filename); fprintf(f, "\n"); + /* we want the included C files to have warnings enabled but for the generated code + * ignore unused-parameter warnings which are hard to prevent */ +#ifdef __GNUC__ + fprintf(f, "#pragma GCC diagnostic ignored \"-Wunused-parameter\"\n\n"); +#endif + fprintf(f, "/* Autogenerated Functions */\n\n"); for (ds = DefRNA.structs.first; ds; ds = ds->cont.next) { diff --git a/source/blender/makesrna/intern/rna_ID.c b/source/blender/makesrna/intern/rna_ID.c index 0bce3ac2907..075f852a032 100644 --- a/source/blender/makesrna/intern/rna_ID.c +++ b/source/blender/makesrna/intern/rna_ID.c @@ -58,7 +58,7 @@ EnumPropertyItem id_type_items[] = { {ID_KE, "KEY", ICON_SHAPEKEY_DATA, "Key", ""}, {ID_LA, "LAMP", ICON_LAMP_DATA, "Lamp", ""}, {ID_LI, "LIBRARY", ICON_LIBRARY_DATA_DIRECT, "Library", ""}, - {ID_LS, "LINESTYLE", ICON_PARTICLE_DATA, "FreestyleLineStyle", ""}, /* FIXME proper icon */ + {ID_LS, "LINESTYLE", ICON_BRUSH_DATA, "Line Style", ""}, /* FIXME proper icon */ {ID_LT, "LATTICE", ICON_LATTICE_DATA, "Lattice", ""}, {ID_MA, "MATERIAL", ICON_MATERIAL_DATA, "Material", ""}, {ID_MB, "META", ICON_META_DATA, "MetaBall", ""}, diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c index 918c67b4513..341ba02fd47 100644 --- a/source/blender/makesrna/intern/rna_access.c +++ b/source/blender/makesrna/intern/rna_access.c @@ -4419,10 +4419,12 @@ char *RNA_path_full_struct_py(struct PointerRNA *ptr) data_path = RNA_path_from_ID_to_struct(ptr); - ret = BLI_sprintfN("%s.%s", - id_path, data_path); + /* XXX data_path may be NULL (see #36788), do we want to get the 'bpy.data.foo["bar"].(null)' stuff? */ + ret = BLI_sprintfN("%s.%s", id_path, data_path); - MEM_freeN(data_path); + if (data_path) { + MEM_freeN(data_path); + } MEM_freeN(id_path); return ret; @@ -6316,14 +6318,20 @@ void _RNA_warning(const char *format, ...) #endif } -bool RNA_property_equals(PointerRNA *a, PointerRNA *b, PropertyRNA *prop, bool is_strict) +bool RNA_property_equals(PointerRNA *a, PointerRNA *b, PropertyRNA *prop, eRNAEqualsMode mode) { int len, fromlen; - /* if not strict, uninitialized properties are assumed to match */ - if (!is_strict) - if (!(RNA_property_is_set(a, prop) && RNA_property_is_set(b, prop))) + if (mode == RNA_EQ_UNSET_MATCH_ANY) { + /* uninitialized properties are assumed to match anything */ + if (!RNA_property_is_set(a, prop) || !RNA_property_is_set(b, prop)) return true; + } + else if (mode == RNA_EQ_UNSET_MATCH_NONE) { + /* unset properties never match set properties */ + if (RNA_property_is_set(a, prop) != RNA_property_is_set(b, prop)) + return false; + } /* get the length of the array to work with */ len = RNA_property_array_length(a, prop); @@ -6437,7 +6445,7 @@ bool RNA_property_equals(PointerRNA *a, PointerRNA *b, PropertyRNA *prop, bool i if (!STREQ(RNA_property_identifier(prop), "rna_type")) { PointerRNA propptr_a = RNA_property_pointer_get(a, prop); PointerRNA propptr_b = RNA_property_pointer_get(b, prop); - return RNA_struct_equals(&propptr_a, &propptr_b, is_strict); + return RNA_struct_equals(&propptr_a, &propptr_b, mode); } break; } @@ -6449,7 +6457,7 @@ bool RNA_property_equals(PointerRNA *a, PointerRNA *b, PropertyRNA *prop, bool i return true; } -bool RNA_struct_equals(PointerRNA *a, PointerRNA *b, bool is_strict) +bool RNA_struct_equals(PointerRNA *a, PointerRNA *b, eRNAEqualsMode mode) { CollectionPropertyIterator iter; // CollectionPropertyRNA *citerprop; /* UNUSED */ @@ -6470,7 +6478,7 @@ bool RNA_struct_equals(PointerRNA *a, PointerRNA *b, bool is_strict) for (; iter.valid; RNA_property_collection_next(&iter)) { PropertyRNA *prop = iter.ptr.data; - if (!RNA_property_equals(a, b, prop, is_strict)) { + if (!RNA_property_equals(a, b, prop, mode)) { equals = false; break; } diff --git a/source/blender/makesrna/intern/rna_action.c b/source/blender/makesrna/intern/rna_action.c index c008ac90e38..c5b7c88d8fc 100644 --- a/source/blender/makesrna/intern/rna_action.c +++ b/source/blender/makesrna/intern/rna_action.c @@ -191,7 +191,8 @@ static void rna_Action_active_pose_marker_index_set(PointerRNA *ptr, int value) act->active_marker = value + 1; } -static void rna_Action_active_pose_marker_index_range(PointerRNA *ptr, int *min, int *max, int *softmin, int *softmax) +static void rna_Action_active_pose_marker_index_range(PointerRNA *ptr, int *min, int *max, + int *UNUSED(softmin), int *UNUSED(softmax)) { bAction *act = (bAction *)ptr->data; diff --git a/source/blender/makesrna/intern/rna_animation.c b/source/blender/makesrna/intern/rna_animation.c index 7bdaca3c847..31fdd19f169 100644 --- a/source/blender/makesrna/intern/rna_animation.c +++ b/source/blender/makesrna/intern/rna_animation.c @@ -408,7 +408,8 @@ static void rna_KeyingSet_active_ksPath_index_set(PointerRNA *ptr, int value) ks->active_path = value + 1; } -static void rna_KeyingSet_active_ksPath_index_range(PointerRNA *ptr, int *min, int *max, int *softmin, int *softmax) +static void rna_KeyingSet_active_ksPath_index_range(PointerRNA *ptr, int *min, int *max, + int *UNUSED(softmin), int *UNUSED(softmax)) { KeyingSet *ks = (KeyingSet *)ptr->data; diff --git a/source/blender/makesrna/intern/rna_armature.c b/source/blender/makesrna/intern/rna_armature.c index b9cbbdb32f7..4b9f7ea32f6 100644 --- a/source/blender/makesrna/intern/rna_armature.c +++ b/source/blender/makesrna/intern/rna_armature.c @@ -471,9 +471,6 @@ static int rna_Armature_is_editmode_get(PointerRNA *ptr) #else -static int rna_matrix_dimsize_4x4[] = {4, 4}; -static int rna_matrix_dimsize_3x3[] = {3, 3}; - static void rna_def_bone_common(StructRNA *srna, int editbone) { PropertyRNA *prop; diff --git a/source/blender/makesrna/intern/rna_boid.c b/source/blender/makesrna/intern/rna_boid.c index 1dcc35c8fb3..6233649fb12 100644 --- a/source/blender/makesrna/intern/rna_boid.c +++ b/source/blender/makesrna/intern/rna_boid.c @@ -164,7 +164,8 @@ static PointerRNA rna_BoidState_active_boid_rule_get(PointerRNA *ptr) } return rna_pointer_inherit_refine(ptr, &RNA_BoidRule, NULL); } -static void rna_BoidState_active_boid_rule_index_range(PointerRNA *ptr, int *min, int *max, int *softmin, int *softmax) +static void rna_BoidState_active_boid_rule_index_range(PointerRNA *ptr, int *min, int *max, + int *UNUSED(softmin), int *UNUSED(softmax)) { BoidState *state = (BoidState *)ptr->data; *min = 0; @@ -230,7 +231,7 @@ static PointerRNA rna_BoidSettings_active_boid_state_get(PointerRNA *ptr) return rna_pointer_inherit_refine(ptr, &RNA_BoidState, NULL); } static void rna_BoidSettings_active_boid_state_index_range(PointerRNA *ptr, int *min, int *max, - int *softmin, int *softmax) + int *UNUSED(softmin), int *UNUSED(softmax)) { BoidSettings *boids = (BoidSettings *)ptr->data; *min = 0; diff --git a/source/blender/makesrna/intern/rna_color.c b/source/blender/makesrna/intern/rna_color.c index 2fba4e9ed7b..d848acd5971 100644 --- a/source/blender/makesrna/intern/rna_color.c +++ b/source/blender/makesrna/intern/rna_color.c @@ -110,7 +110,8 @@ static void rna_CurveMapping_white_level_set(PointerRNA *ptr, const float *value curvemapping_set_black_white(cumap, NULL, NULL); } -static void rna_CurveMapping_clipminx_range(PointerRNA *ptr, float *min, float *max, float *softmin, float *softmax) +static void rna_CurveMapping_clipminx_range(PointerRNA *ptr, float *min, float *max, + float *UNUSED(softmin), float *UNUSED(softmax)) { CurveMapping *cumap = (CurveMapping *)ptr->data; @@ -118,7 +119,8 @@ static void rna_CurveMapping_clipminx_range(PointerRNA *ptr, float *min, float * *max = cumap->clipr.xmax; } -static void rna_CurveMapping_clipminy_range(PointerRNA *ptr, float *min, float *max, float *softmin, float *softmax) +static void rna_CurveMapping_clipminy_range(PointerRNA *ptr, float *min, float *max, + float *UNUSED(softmin), float *UNUSED(softmax)) { CurveMapping *cumap = (CurveMapping *)ptr->data; @@ -126,7 +128,8 @@ static void rna_CurveMapping_clipminy_range(PointerRNA *ptr, float *min, float * *max = cumap->clipr.ymax; } -static void rna_CurveMapping_clipmaxx_range(PointerRNA *ptr, float *min, float *max, float *softmin, float *softmax) +static void rna_CurveMapping_clipmaxx_range(PointerRNA *ptr, float *min, float *max, + float *UNUSED(softmin), float *UNUSED(softmax)) { CurveMapping *cumap = (CurveMapping *)ptr->data; @@ -134,7 +137,8 @@ static void rna_CurveMapping_clipmaxx_range(PointerRNA *ptr, float *min, float * *max = 100.0f; } -static void rna_CurveMapping_clipmaxy_range(PointerRNA *ptr, float *min, float *max, float *softmin, float *softmax) +static void rna_CurveMapping_clipmaxy_range(PointerRNA *ptr, float *min, float *max, + float *UNUSED(softmin), float *UNUSED(softmax)) { CurveMapping *cumap = (CurveMapping *)ptr->data; @@ -407,8 +411,8 @@ static void rna_ColorManagedDisplaySettings_display_device_set(struct PointerRNA } } -static EnumPropertyItem *rna_ColorManagedDisplaySettings_display_device_itemf(bContext *UNUSED(C), PointerRNA *ptr, - PropertyRNA *UNUSED(prop), int *free) +static EnumPropertyItem *rna_ColorManagedDisplaySettings_display_device_itemf( + bContext *UNUSED(C), PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), int *free) { EnumPropertyItem *items = NULL; int totitem = 0; @@ -455,8 +459,8 @@ static void rna_ColorManagedViewSettings_view_transform_set(PointerRNA *ptr, int } } -static EnumPropertyItem *rna_ColorManagedViewSettings_view_transform_itemf(bContext *C, PointerRNA *ptr, - PropertyRNA *UNUSED(prop), int *free) +static EnumPropertyItem *rna_ColorManagedViewSettings_view_transform_itemf( + bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), int *free) { Scene *scene = CTX_data_scene(C); EnumPropertyItem *items = NULL; @@ -488,8 +492,8 @@ static void rna_ColorManagedViewSettings_look_set(PointerRNA *ptr, int value) } } -static EnumPropertyItem *rna_ColorManagedViewSettings_look_itemf(bContext *C, PointerRNA *ptr, - PropertyRNA *UNUSED(prop), int *free) +static EnumPropertyItem *rna_ColorManagedViewSettings_look_itemf( + bContext *UNUSED(C), PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), int *free) { EnumPropertyItem *items = NULL; int totitem = 0; @@ -534,8 +538,8 @@ static void rna_ColorManagedColorspaceSettings_colorspace_set(struct PointerRNA } } -static EnumPropertyItem *rna_ColorManagedColorspaceSettings_colorspace_itemf(bContext *UNUSED(C), PointerRNA *ptr, - PropertyRNA *UNUSED(prop), int *free) +static EnumPropertyItem *rna_ColorManagedColorspaceSettings_colorspace_itemf( + bContext *UNUSED(C), PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), int *free) { EnumPropertyItem *items = NULL; int totitem = 0; diff --git a/source/blender/makesrna/intern/rna_constraint.c b/source/blender/makesrna/intern/rna_constraint.c index 10349748713..0c7c2ea1e49 100644 --- a/source/blender/makesrna/intern/rna_constraint.c +++ b/source/blender/makesrna/intern/rna_constraint.c @@ -344,7 +344,8 @@ static EnumPropertyItem *rna_Constraint_target_space_itemf(bContext *UNUSED(C), return space_object_items; } -static void rna_ActionConstraint_minmax_range(PointerRNA *ptr, float *min, float *max, float *softmin, float *softmax) +static void rna_ActionConstraint_minmax_range(PointerRNA *ptr, float *min, float *max, + float *UNUSED(softmin), float *UNUSED(softmax)) { bConstraint *con = (bConstraint *)ptr->data; bActionConstraint *acon = (bActionConstraint *)con->data; @@ -504,7 +505,6 @@ static void rna_def_constrainttarget(BlenderRNA *brna) static void rna_def_constraint_childof(BlenderRNA *brna) { - static int rna_matrix_dimsize_4x4[] = {4, 4}; StructRNA *srna; PropertyRNA *prop; diff --git a/source/blender/makesrna/intern/rna_curve.c b/source/blender/makesrna/intern/rna_curve.c index cd3b30687b3..bd4b8dd76b1 100644 --- a/source/blender/makesrna/intern/rna_curve.c +++ b/source/blender/makesrna/intern/rna_curve.c @@ -243,14 +243,16 @@ static void rna_Curve_texspace_size_set(PointerRNA *ptr, const float *values) copy_v3_v3(cu->size, values); } -static void rna_Curve_material_index_range(PointerRNA *ptr, int *min, int *max, int *softmin, int *softmax) +static void rna_Curve_material_index_range(PointerRNA *ptr, int *min, int *max, + int *UNUSED(softmin), int *UNUSED(softmax)) { Curve *cu = (Curve *)ptr->id.data; *min = 0; *max = max_ii(0, cu->totcol - 1); } -static void rna_Curve_active_textbox_index_range(PointerRNA *ptr, int *min, int *max, int *softmin, int *softmax) +static void rna_Curve_active_textbox_index_range(PointerRNA *ptr, int *min, int *max, + int *UNUSED(softmin), int *UNUSED(softmax)) { Curve *cu = (Curve *)ptr->id.data; *min = 0; diff --git a/source/blender/makesrna/intern/rna_define.c b/source/blender/makesrna/intern/rna_define.c index d4b1130763b..fe9e9573957 100644 --- a/source/blender/makesrna/intern/rna_define.c +++ b/source/blender/makesrna/intern/rna_define.c @@ -574,13 +574,13 @@ void RNA_define_free(BlenderRNA *UNUSED(brna)) DefRNA.error = 0; } -void RNA_define_verify_sdna(int verify) +void RNA_define_verify_sdna(bool verify) { DefRNA.verify = verify; } #ifndef RNA_RUNTIME -void RNA_define_animate_sdna(int animate) +void RNA_define_animate_sdna(bool animate) { DefRNA.animate = animate; } @@ -1253,6 +1253,11 @@ void RNA_def_property_array(PropertyRNA *prop, int length) } } +/* common args for length */ +const int rna_matrix_dimsize_3x3[] = {3, 3}; +const int rna_matrix_dimsize_4x4[] = {4, 4}; +const int rna_matrix_dimsize_4x2[] = {4, 2}; + void RNA_def_property_multi_array(PropertyRNA *prop, int dimension, const int length[]) { StructRNA *srna = DefRNA.laststruct; @@ -2124,7 +2129,7 @@ void RNA_def_property_update(PropertyRNA *prop, int noteflag, const char *func) prop->update = (UpdateFunc)func; } -void RNA_def_property_update_runtime(PropertyRNA *prop, void *func) +void RNA_def_property_update_runtime(PropertyRNA *prop, const void *func) { prop->update = func; } diff --git a/source/blender/makesrna/intern/rna_dynamicpaint.c b/source/blender/makesrna/intern/rna_dynamicpaint.c index ffcd1f823b2..e13ec1f09a4 100644 --- a/source/blender/makesrna/intern/rna_dynamicpaint.c +++ b/source/blender/makesrna/intern/rna_dynamicpaint.c @@ -96,12 +96,12 @@ static char *rna_DynamicPaintSurface_path(PointerRNA *ptr) * Surfaces */ -static void rna_DynamicPaint_redoModifier(Main *bmain, Scene *scene, PointerRNA *ptr) +static void rna_DynamicPaint_redoModifier(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) { DAG_id_tag_update(ptr->id.data, OB_RECALC_DATA); } -static void rna_DynamicPaintSurfaces_updateFrames(Main *bmain, Scene *scene, PointerRNA *ptr) +static void rna_DynamicPaintSurfaces_updateFrames(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) { dynamicPaint_cacheUpdateFrames((DynamicPaintSurface *)ptr->data); } @@ -135,7 +135,7 @@ static void rna_DynamicPaintSurface_changePreview(Main *bmain, Scene *scene, Poi rna_DynamicPaint_redoModifier(bmain, scene, ptr); } -static void rna_DynamicPaintSurface_uniqueName(Main *bmain, Scene *scene, PointerRNA *ptr) +static void rna_DynamicPaintSurface_uniqueName(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) { dynamicPaintSurface_setUniqueName((DynamicPaintSurface *)ptr->data, ((DynamicPaintSurface *)ptr->data)->name); } @@ -197,7 +197,8 @@ static void rna_Surface_active_point_index_set(struct PointerRNA *ptr, int value return; } -static void rna_Surface_active_point_range(PointerRNA *ptr, int *min, int *max, int *softmin, int *softmax) +static void rna_Surface_active_point_range(PointerRNA *ptr, int *min, int *max, + int *UNUSED(softmin), int *UNUSED(softmax)) { DynamicPaintCanvasSettings *canvas = (DynamicPaintCanvasSettings *)ptr->data; @@ -244,8 +245,8 @@ static int rna_DynamicPaint_is_output_exists(DynamicPaintSurface *surface, Objec } -static EnumPropertyItem *rna_DynamicPaint_surface_type_itemf(bContext *C, PointerRNA *ptr, - PropertyRNA *UNUSED(prop), int *free) +static EnumPropertyItem *rna_DynamicPaint_surface_type_itemf( + bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *free) { DynamicPaintSurface *surface = (DynamicPaintSurface *)ptr->data; diff --git a/source/blender/makesrna/intern/rna_fcurve.c b/source/blender/makesrna/intern/rna_fcurve.c index 2ad8ded4656..4b50127d999 100644 --- a/source/blender/makesrna/intern/rna_fcurve.c +++ b/source/blender/makesrna/intern/rna_fcurve.c @@ -459,7 +459,8 @@ static void rna_FModifier_active_set(PointerRNA *ptr, int UNUSED(value)) fm->flag |= FMODIFIER_FLAG_ACTIVE; } -static void rna_FModifier_start_frame_range(PointerRNA *ptr, float *min, float *max, float *softmin, float *softmax) +static void rna_FModifier_start_frame_range(PointerRNA *ptr, float *min, float *max, + float *UNUSED(softmin), float *UNUSED(softmax)) { FModifier *fcm = (FModifier *)ptr->data; @@ -467,7 +468,8 @@ static void rna_FModifier_start_frame_range(PointerRNA *ptr, float *min, float * *max = (fcm->flag & FMODIFIER_FLAG_RANGERESTRICT) ? fcm->efra : MAXFRAMEF; } -static void rna_FModifier_end_frame_range(PointerRNA *ptr, float *min, float *max, float *softmin, float *softmax) +static void rna_FModifier_end_frame_range(PointerRNA *ptr, float *min, float *max, + float *UNUSED(softmin), float *UNUSED(softmax)) { FModifier *fcm = (FModifier *)ptr->data; @@ -475,7 +477,8 @@ static void rna_FModifier_end_frame_range(PointerRNA *ptr, float *min, float *ma *max = MAXFRAMEF; } -static void rna_FModifier_blending_range(PointerRNA *ptr, float *min, float *max, float *softmin, float *softmax) +static void rna_FModifier_blending_range(PointerRNA *ptr, float *min, float *max, + float *UNUSED(softmin), float *UNUSED(softmax)) { FModifier *fcm = (FModifier *)ptr->data; @@ -524,7 +527,8 @@ static void rna_FModifierGenerator_coefficients_set(PointerRNA *ptr, const float memcpy(gen->coefficients, values, gen->arraysize * sizeof(float)); } -static void rna_FModifierLimits_minx_range(PointerRNA *ptr, float *min, float *max, float *softmin, float *softmax) +static void rna_FModifierLimits_minx_range(PointerRNA *ptr, float *min, float *max, + float *UNUSED(softmin), float *UNUSED(softmax)) { FModifier *fcm = (FModifier *)ptr->data; FMod_Limits *data = fcm->data; @@ -533,7 +537,8 @@ static void rna_FModifierLimits_minx_range(PointerRNA *ptr, float *min, float *m *max = (data->flag & FCM_LIMIT_XMAX) ? data->rect.xmax : MAXFRAMEF; } -static void rna_FModifierLimits_maxx_range(PointerRNA *ptr, float *min, float *max, float *softmin, float *softmax) +static void rna_FModifierLimits_maxx_range(PointerRNA *ptr, float *min, float *max, + float *UNUSED(softmin), float *UNUSED(softmax)) { FModifier *fcm = (FModifier *)ptr->data; FMod_Limits *data = fcm->data; @@ -542,7 +547,8 @@ static void rna_FModifierLimits_maxx_range(PointerRNA *ptr, float *min, float *m *max = MAXFRAMEF; } -static void rna_FModifierLimits_miny_range(PointerRNA *ptr, float *min, float *max, float *softmin, float *softmax) +static void rna_FModifierLimits_miny_range(PointerRNA *ptr, float *min, float *max, + float *UNUSED(softmin), float *UNUSED(softmax)) { FModifier *fcm = (FModifier *)ptr->data; FMod_Limits *data = fcm->data; @@ -551,7 +557,8 @@ static void rna_FModifierLimits_miny_range(PointerRNA *ptr, float *min, float *m *max = (data->flag & FCM_LIMIT_YMAX) ? data->rect.ymax : FLT_MAX; } -static void rna_FModifierLimits_maxy_range(PointerRNA *ptr, float *min, float *max, float *softmin, float *softmax) +static void rna_FModifierLimits_maxy_range(PointerRNA *ptr, float *min, float *max, + float *UNUSED(softmin), float *UNUSED(softmax)) { FModifier *fcm = (FModifier *)ptr->data; FMod_Limits *data = fcm->data; @@ -562,7 +569,7 @@ static void rna_FModifierLimits_maxy_range(PointerRNA *ptr, float *min, float *m static void rna_FModifierStepped_start_frame_range(PointerRNA *ptr, float *min, float *max, - float *softmin, float *softmax) + float *UNUSED(softmin), float *UNUSED(softmax)) { FModifier *fcm = (FModifier *)ptr->data; FMod_Stepped *data = fcm->data; @@ -572,7 +579,7 @@ static void rna_FModifierStepped_start_frame_range(PointerRNA *ptr, float *min, } static void rna_FModifierStepped_end_frame_range(PointerRNA *ptr, float *min, float *max, - float *softmin, float *softmax) + float *UNUSED(softmin), float *UNUSED(softmax)) { FModifier *fcm = (FModifier *)ptr->data; FMod_Stepped *data = fcm->data; diff --git a/source/blender/makesrna/intern/rna_gpencil.c b/source/blender/makesrna/intern/rna_gpencil.c index 439bc51896f..6423763c49c 100644 --- a/source/blender/makesrna/intern/rna_gpencil.c +++ b/source/blender/makesrna/intern/rna_gpencil.c @@ -354,15 +354,15 @@ static void rna_def_gpencil_strokes_api(BlenderRNA *brna, PropertyRNA *cprop) RNA_def_property_srna(cprop, "GPencilStrokes"); srna = RNA_def_struct(brna, "GPencilStrokes", NULL); RNA_def_struct_sdna(srna, "bGPDframe"); - RNA_def_struct_ui_text(srna, "Grease Pencil Frames", "Collection of grease pencil frames"); + RNA_def_struct_ui_text(srna, "Grease Pencil Frames", "Collection of grease pencil stroke"); func = RNA_def_function(srna, "new", "rna_GPencil_stroke_new"); - RNA_def_function_ui_description(func, "Add a new grease pencil frame"); + RNA_def_function_ui_description(func, "Add a new grease pencil stroke"); parm = RNA_def_pointer(func, "stroke", "GPencilStroke", "", "The newly created stroke"); RNA_def_function_return(func, parm); func = RNA_def_function(srna, "remove", "rna_GPencil_stroke_remove"); - RNA_def_function_ui_description(func, "Remove a grease pencil frame"); + RNA_def_function_ui_description(func, "Remove a grease pencil stroke"); RNA_def_function_flag(func, FUNC_USE_REPORTS); parm = RNA_def_pointer(func, "stroke", "GPencilStroke", "Stroke", "The stroke to remove"); RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL | PROP_RNAPTR); @@ -390,7 +390,8 @@ static void rna_def_gpencil_frame(BlenderRNA *brna) /* Frame Number */ prop = RNA_def_property(srna, "frame_number", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "framenum"); - RNA_def_property_range(prop, MINFRAME, MAXFRAME); /* XXX note: this cannot occur on the same frame as another sketch */ + /* XXX note: this cannot occur on the same frame as another sketch */ + RNA_def_property_range(prop, MINAFRAME, MAXFRAME); RNA_def_property_ui_text(prop, "Frame Number", "The frame on which this sketch appears"); /* Flags */ @@ -421,7 +422,8 @@ static void rna_def_gpencil_frames_api(BlenderRNA *brna, PropertyRNA *cprop) func = RNA_def_function(srna, "new", "rna_GPencil_frame_new"); RNA_def_function_ui_description(func, "Add a new grease pencil frame"); RNA_def_function_flag(func, FUNC_USE_REPORTS); - parm = RNA_def_int(func, "frame_number", 1, MINFRAME, MAXFRAME, "Frame Number", "The frame on which this sketch appears", MINFRAME, MAXFRAME); + parm = RNA_def_int(func, "frame_number", 1, MINAFRAME, MAXFRAME, "Frame Number", + "The frame on which this sketch appears", MINAFRAME, MAXFRAME); RNA_def_property_flag(parm, PROP_REQUIRED); parm = RNA_def_pointer(func, "frame", "GPencilFrame", "", "The newly created frame"); RNA_def_function_return(func, parm); diff --git a/source/blender/makesrna/intern/rna_internal.h b/source/blender/makesrna/intern/rna_internal.h index f1e1569c87d..7950ed424ee 100644 --- a/source/blender/makesrna/intern/rna_internal.h +++ b/source/blender/makesrna/intern/rna_internal.h @@ -124,8 +124,9 @@ typedef struct BlenderDefRNA { extern BlenderDefRNA DefRNA; /* Define functions for all types */ - +#ifndef __RNA_ACCESS_H__ extern BlenderRNA BLENDER_RNA; +#endif void RNA_def_ID(struct BlenderRNA *brna); void RNA_def_action(struct BlenderRNA *brna); @@ -332,8 +333,10 @@ extern CollectionPropertyRNA rna_PropertyGroupItem_idp_array; extern FloatPropertyRNA rna_PropertyGroupItem_double; extern FloatPropertyRNA rna_PropertyGroupItem_double_array; +#ifndef __RNA_ACCESS_H__ extern StructRNA RNA_PropertyGroupItem; extern StructRNA RNA_PropertyGroup; +#endif struct IDProperty *rna_idproperty_check(struct PropertyRNA **prop, struct PointerRNA *ptr); @@ -421,4 +424,10 @@ int rna_IDMaterials_assign_int(struct PointerRNA *ptr, int key, const struct Poi void rna_RenderLayer_rect_set(PointerRNA *ptr, const float *values); void rna_RenderPass_rect_set(PointerRNA *ptr, const float *values); +#ifdef RNA_RUNTIME +# ifdef __GNUC__ +# pragma GCC diagnostic ignored "-Wredundant-decls" +# endif +#endif + #endif /* __RNA_INTERNAL_H__ */ diff --git a/source/blender/makesrna/intern/rna_key.c b/source/blender/makesrna/intern/rna_key.c index d5c9ec53b20..a20cb73b3aa 100644 --- a/source/blender/makesrna/intern/rna_key.c +++ b/source/blender/makesrna/intern/rna_key.c @@ -99,7 +99,8 @@ static void rna_ShapeKey_value_set(PointerRNA *ptr, float value) data->curval = value; } -static void rna_ShapeKey_value_range(PointerRNA *ptr, float *min, float *max, float *softmin, float *softmax) +static void rna_ShapeKey_value_range(PointerRNA *ptr, float *min, float *max, + float *UNUSED(softmin), float *UNUSED(softmax)) { KeyBlock *data = (KeyBlock *)ptr->data; @@ -110,7 +111,8 @@ static void rna_ShapeKey_value_range(PointerRNA *ptr, float *min, float *max, fl /* epsilon for how close one end of shapekey range can get to the other */ #define SHAPEKEY_SLIDER_TOL 0.001f -static void rna_ShapeKey_slider_min_range(PointerRNA *ptr, float *min, float *max, float *softmin, float *softmax) +static void rna_ShapeKey_slider_min_range(PointerRNA *ptr, float *min, float *max, + float *UNUSED(softmin), float *UNUSED(softmax)) { KeyBlock *data = (KeyBlock *)ptr->data; @@ -128,7 +130,8 @@ static void rna_ShapeKey_slider_min_set(PointerRNA *ptr, float value) data->slidermin = value; } -static void rna_ShapeKey_slider_max_range(PointerRNA *ptr, float *min, float *max, float *softmin, float *softmax) +static void rna_ShapeKey_slider_max_range(PointerRNA *ptr, float *min, float *max, + float *UNUSED(softmin), float *UNUSED(softmax)) { KeyBlock *data = (KeyBlock *)ptr->data; diff --git a/source/blender/makesrna/intern/rna_lamp.c b/source/blender/makesrna/intern/rna_lamp.c index f59f3db3652..63fc5dbdbbd 100644 --- a/source/blender/makesrna/intern/rna_lamp.c +++ b/source/blender/makesrna/intern/rna_lamp.c @@ -132,7 +132,7 @@ static StructRNA *rna_Lamp_refine(struct PointerRNA *ptr) } } -static void rna_Lamp_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *ptr) +static void rna_Lamp_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) { Lamp *la = ptr->id.data; diff --git a/source/blender/makesrna/intern/rna_linestyle.c b/source/blender/makesrna/intern/rna_linestyle.c index 660ef57dbfe..03319a9ccf8 100644 --- a/source/blender/makesrna/intern/rna_linestyle.c +++ b/source/blender/makesrna/intern/rna_linestyle.c @@ -254,7 +254,7 @@ static void rna_LineStyleGeometryModifier_name_set(PointerRNA *ptr, const char * #include "BLI_math.h" static void rna_def_modifier_type_common(StructRNA *srna, EnumPropertyItem *modifier_type_items, - char *set_name_func, int blend, int color) + const char *set_name_func, const bool blend, const bool color) { PropertyRNA *prop; diff --git a/source/blender/makesrna/intern/rna_main_api.c b/source/blender/makesrna/intern/rna_main_api.c index 8104fc169f6..dffe392e6f1 100644 --- a/source/blender/makesrna/intern/rna_main_api.c +++ b/source/blender/makesrna/intern/rna_main_api.c @@ -832,7 +832,7 @@ static Mask *rna_Main_mask_new(Main *bmain, const char *name) { Mask *mask; - mask = BKE_mask_new(bmain, "Mask"); + mask = BKE_mask_new(bmain, name); return mask; } diff --git a/source/blender/makesrna/intern/rna_material.c b/source/blender/makesrna/intern/rna_material.c index ed2dba907e8..e9f506b6f0b 100644 --- a/source/blender/makesrna/intern/rna_material.c +++ b/source/blender/makesrna/intern/rna_material.c @@ -93,7 +93,7 @@ EnumPropertyItem ramp_blend_items[] = { #include "ED_node.h" -static void rna_Material_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *ptr) +static void rna_Material_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) { Material *ma = ptr->id.data; @@ -101,7 +101,7 @@ static void rna_Material_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *p WM_main_add_notifier(NC_MATERIAL | ND_SHADING, ma); } -static void rna_Material_update_previews(Main *bmain, Scene *scene, PointerRNA *ptr) +static void rna_Material_update_previews(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) { Material *ma = ptr->id.data; @@ -111,7 +111,7 @@ static void rna_Material_update_previews(Main *bmain, Scene *scene, PointerRNA * WM_main_add_notifier(NC_MATERIAL | ND_SHADING_PREVIEW, ma); } -static void rna_Material_draw_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *ptr) +static void rna_Material_draw_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) { Material *ma = ptr->id.data; @@ -202,7 +202,8 @@ static void rna_Material_active_node_material_set(PointerRNA *ptr, PointerRNA va nodeSetActiveID(ma->nodetree, ID_MA, &ma_act->id); } -static void rna_MaterialStrand_start_size_range(PointerRNA *ptr, float *min, float *max, float *softmin, float *softmax) +static void rna_MaterialStrand_start_size_range(PointerRNA *ptr, float *min, float *max, + float *UNUSED(softmin), float *UNUSED(softmax)) { Material *ma = (Material *)ptr->id.data; @@ -216,7 +217,8 @@ static void rna_MaterialStrand_start_size_range(PointerRNA *ptr, float *min, flo } } -static void rna_MaterialStrand_end_size_range(PointerRNA *ptr, float *min, float *max, float *softmin, float *softmax) +static void rna_MaterialStrand_end_size_range(PointerRNA *ptr, float *min, float *max, + float *UNUSED(softmin), float *UNUSED(softmax)) { Material *ma = (Material *)ptr->id.data; diff --git a/source/blender/makesrna/intern/rna_mesh.c b/source/blender/makesrna/intern/rna_mesh.c index 1376eccb448..fe6f33abc8c 100644 --- a/source/blender/makesrna/intern/rna_mesh.c +++ b/source/blender/makesrna/intern/rna_mesh.c @@ -184,18 +184,22 @@ static void rna_MeshEdgeLayer_name_set(PointerRNA *ptr, const char *value) rna_cd_layer_name_set(rna_mesh_edata(ptr), (CustomDataLayer *)ptr->data, value); } #endif +#if 0 static void rna_MeshPolyLayer_name_set(PointerRNA *ptr, const char *value) { rna_cd_layer_name_set(rna_mesh_pdata(ptr), (CustomDataLayer *)ptr->data, value); } +#endif static void rna_MeshLoopLayer_name_set(PointerRNA *ptr, const char *value) { rna_cd_layer_name_set(rna_mesh_ldata(ptr), (CustomDataLayer *)ptr->data, value); } +#if 0 static void rna_MeshTessfaceLayer_name_set(PointerRNA *ptr, const char *value) { rna_cd_layer_name_set(rna_mesh_fdata(ptr), (CustomDataLayer *)ptr->data, value); } +#endif /* only for layers shared between types */ static void rna_MeshAnyLayer_name_set(PointerRNA *ptr, const char *value) { @@ -207,7 +211,7 @@ static void rna_MeshAnyLayer_name_set(PointerRNA *ptr, const char *value) /* -------------------------------------------------------------------- */ /* Update Callbacks */ -static void rna_Mesh_update_data(Main *bmain, Scene *scene, PointerRNA *ptr) +static void rna_Mesh_update_data(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) { ID *id = ptr->id.data; @@ -227,7 +231,7 @@ static void rna_Mesh_update_data_edit_color(Main *bmain, Scene *scene, PointerRN } } -static void rna_Mesh_update_select(Main *bmain, Scene *scene, PointerRNA *ptr) +static void rna_Mesh_update_select(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) { ID *id = ptr->id.data; /* cheating way for importers to avoid slow updates */ @@ -236,7 +240,7 @@ static void rna_Mesh_update_select(Main *bmain, Scene *scene, PointerRNA *ptr) } } -void rna_Mesh_update_draw(Main *bmain, Scene *scene, PointerRNA *ptr) +void rna_Mesh_update_draw(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) { ID *id = ptr->id.data; /* cheating way for importers to avoid slow updates */ @@ -646,7 +650,7 @@ static int rna_CustomDataLayer_active_get(PointerRNA *ptr, CustomData *data, int else return (n == CustomData_get_active_layer_index(data, type)); } -static int rna_CustomDataLayer_clone_get(PointerRNA *ptr, CustomData *data, int type, int render) +static int rna_CustomDataLayer_clone_get(PointerRNA *ptr, CustomData *data, int type) { int n = ((CustomDataLayer *)ptr->data) - data->layers; @@ -674,7 +678,7 @@ static void rna_CustomDataLayer_active_set(PointerRNA *ptr, CustomData *data, in BKE_mesh_update_customdata_pointers(me, true); } -static void rna_CustomDataLayer_clone_set(PointerRNA *ptr, CustomData *data, int value, int type, int render) +static void rna_CustomDataLayer_clone_set(PointerRNA *ptr, CustomData *data, int value, int type) { int n = ((CustomDataLayer *)ptr->data) - data->layers; @@ -684,6 +688,14 @@ static void rna_CustomDataLayer_clone_set(PointerRNA *ptr, CustomData *data, int CustomData_set_layer_clone_index(data, type, n); } +/* Generic UV rename! */ +static void rna_MeshUVLayer_name_set(PointerRNA *ptr, const char *name) +{ + char buf[MAX_CUSTOMDATA_LAYER_NAME]; + BLI_strncpy_utf8(buf, name, MAX_CUSTOMDATA_LAYER_NAME); + BKE_mesh_uv_cdlayer_rename(rna_mesh(ptr), ((CustomDataLayer *)ptr->data)->name, buf, true); +} + /* uv_layers */ DEFINE_CUSTOMDATA_LAYER_COLLECTION(uv_layer, ldata, CD_MLOOPUV) @@ -748,7 +760,7 @@ static int rna_MeshTextureFaceLayer_active_get(PointerRNA *ptr) static int rna_MeshTextureFaceLayer_clone_get(PointerRNA *ptr) { - return rna_CustomDataLayer_clone_get(ptr, rna_mesh_fdata(ptr), CD_MTFACE, 0); + return rna_CustomDataLayer_clone_get(ptr, rna_mesh_fdata(ptr), CD_MTFACE); } static void rna_MeshTextureFaceLayer_active_render_set(PointerRNA *ptr, int value) @@ -763,7 +775,7 @@ static void rna_MeshTextureFaceLayer_active_set(PointerRNA *ptr, int value) static void rna_MeshTextureFaceLayer_clone_set(PointerRNA *ptr, int value) { - rna_CustomDataLayer_clone_set(ptr, rna_mesh_fdata(ptr), value, CD_MTFACE, 0); + rna_CustomDataLayer_clone_set(ptr, rna_mesh_fdata(ptr), value, CD_MTFACE); } /* poly uv_textures */ @@ -799,7 +811,7 @@ static int rna_MeshTexturePolyLayer_active_get(PointerRNA *ptr) static int rna_MeshTexturePolyLayer_clone_get(PointerRNA *ptr) { - return rna_CustomDataLayer_clone_get(ptr, rna_mesh_pdata(ptr), CD_MTEXPOLY, 0); + return rna_CustomDataLayer_clone_get(ptr, rna_mesh_pdata(ptr), CD_MTEXPOLY); } static void rna_MeshTexturePolyLayer_active_render_set(PointerRNA *ptr, int value) @@ -814,7 +826,7 @@ static void rna_MeshTexturePolyLayer_active_set(PointerRNA *ptr, int value) static void rna_MeshTexturePolyLayer_clone_set(PointerRNA *ptr, int value) { - rna_CustomDataLayer_clone_set(ptr, rna_mesh_pdata(ptr), value, CD_MTEXPOLY, 0); + rna_CustomDataLayer_clone_set(ptr, rna_mesh_pdata(ptr), value, CD_MTEXPOLY); } /* vertex_color_layers */ @@ -906,7 +918,7 @@ static int rna_MeshFloatPropertyLayer_data_length(PointerRNA *ptr) return me->totpoly; } -static int rna_float_layer_check(CollectionPropertyIterator *iter, void *data) +static int rna_float_layer_check(CollectionPropertyIterator *UNUSED(iter), void *data) { CustomDataLayer *layer = (CustomDataLayer *)data; return (layer->type != CD_PROP_FLT); @@ -924,7 +936,7 @@ static int rna_Mesh_polygon_float_layers_length(PointerRNA *ptr) return CustomData_number_of_layers(rna_mesh_pdata(ptr), CD_PROP_FLT); } -static int rna_int_layer_check(CollectionPropertyIterator *iter, void *data) +static int rna_int_layer_check(CollectionPropertyIterator *UNUSED(iter), void *data) { CustomDataLayer *layer = (CustomDataLayer *)data; return (layer->type != CD_PROP_INT); @@ -955,7 +967,7 @@ static int rna_Mesh_polygon_int_layers_length(PointerRNA *ptr) return CustomData_number_of_layers(rna_mesh_pdata(ptr), CD_PROP_INT); } -static int rna_string_layer_check(CollectionPropertyIterator *iter, void *data) +static int rna_string_layer_check(CollectionPropertyIterator *UNUSED(iter), void *data) { CustomDataLayer *layer = (CustomDataLayer *)data; return (layer->type != CD_PROP_STR); @@ -997,7 +1009,7 @@ static char *rna_MeshSkinVertexLayer_path(PointerRNA *ptr) return BLI_sprintfN("skin_vertices[\"%s\"]", name_esc); } -static char *rna_VertCustomData_data_path(PointerRNA *ptr, char *collection, int type); +static char *rna_VertCustomData_data_path(PointerRNA *ptr, const char *collection, int type); static char *rna_MeshSkinVertex_path(PointerRNA *ptr) { return rna_VertCustomData_data_path(ptr, "skin_vertices", CD_MVERT_SKIN); @@ -1226,7 +1238,7 @@ static char *rna_MeshTexturePolyLayer_path(PointerRNA *ptr) return BLI_sprintfN("uv_textures[\"%s\"]", name_esc); } -static char *rna_VertCustomData_data_path(PointerRNA *ptr, char *collection, int type) +static char *rna_VertCustomData_data_path(PointerRNA *ptr, const char *collection, int type) { CustomDataLayer *cdl; Mesh *me = rna_mesh(ptr); @@ -1247,7 +1259,7 @@ static char *rna_VertCustomData_data_path(PointerRNA *ptr, char *collection, int return NULL; } -static char *rna_PolyCustomData_data_path(PointerRNA *ptr, char *collection, int type) +static char *rna_PolyCustomData_data_path(PointerRNA *ptr, const char *collection, int type) { CustomDataLayer *cdl; Mesh *me = rna_mesh(ptr); @@ -1268,7 +1280,7 @@ static char *rna_PolyCustomData_data_path(PointerRNA *ptr, char *collection, int return NULL; } -static char *rna_LoopCustomData_data_path(PointerRNA *ptr, char *collection, int type) +static char *rna_LoopCustomData_data_path(PointerRNA *ptr, const char *collection, int type) { CustomDataLayer *cdl; Mesh *me = rna_mesh(ptr); @@ -1289,7 +1301,7 @@ static char *rna_LoopCustomData_data_path(PointerRNA *ptr, char *collection, int return NULL; } -static char *rna_FaceCustomData_data_path(PointerRNA *ptr, char *collection, int type) +static char *rna_FaceCustomData_data_path(PointerRNA *ptr, const char *collection, int type) { CustomDataLayer *cdl; Mesh *me = rna_mesh(ptr); @@ -1475,7 +1487,7 @@ static PointerRNA rna_Mesh_tessface_vertex_color_new(struct Mesh *me, ReportList return ptr; } -static PointerRNA rna_Mesh_polygon_int_property_new(struct Mesh *me, struct bContext *C, const char *name) +static PointerRNA rna_Mesh_polygon_int_property_new(struct Mesh *me, const char *name) { PointerRNA ptr; CustomDataLayer *cdl = NULL; @@ -1490,7 +1502,7 @@ static PointerRNA rna_Mesh_polygon_int_property_new(struct Mesh *me, struct bCon return ptr; } -static PointerRNA rna_Mesh_polygon_float_property_new(struct Mesh *me, struct bContext *C, const char *name) +static PointerRNA rna_Mesh_polygon_float_property_new(struct Mesh *me, const char *name) { PointerRNA ptr; CustomDataLayer *cdl = NULL; @@ -1505,7 +1517,7 @@ static PointerRNA rna_Mesh_polygon_float_property_new(struct Mesh *me, struct bC return ptr; } -static PointerRNA rna_Mesh_polygon_string_property_new(struct Mesh *me, struct bContext *C, const char *name) +static PointerRNA rna_Mesh_polygon_string_property_new(struct Mesh *me, const char *name) { PointerRNA ptr; CustomDataLayer *cdl = NULL; @@ -1961,7 +1973,7 @@ static void rna_def_mloopuv(BlenderRNA *brna) prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE); RNA_def_struct_name_property(srna, prop); - RNA_def_property_string_funcs(prop, NULL, NULL, "rna_MeshLoopLayer_name_set"); + RNA_def_property_string_funcs(prop, NULL, NULL, "rna_MeshUVLayer_name_set"); RNA_def_property_ui_text(prop, "Name", "Name of UV map"); RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); @@ -1999,7 +2011,7 @@ static void rna_def_mtface(BlenderRNA *brna) prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE); RNA_def_struct_name_property(srna, prop); - RNA_def_property_string_funcs(prop, NULL, NULL, "rna_MeshTessfaceLayer_name_set"); + RNA_def_property_string_funcs(prop, NULL, NULL, "rna_MeshUVLayer_name_set"); RNA_def_property_ui_text(prop, "Name", "Name of UV map"); RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); @@ -2111,7 +2123,7 @@ static void rna_def_mtexpoly(BlenderRNA *brna) prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE); RNA_def_struct_name_property(srna, prop); - RNA_def_property_string_funcs(prop, NULL, NULL, "rna_MeshPolyLayer_name_set"); + RNA_def_property_string_funcs(prop, NULL, NULL, "rna_MeshUVLayer_name_set"); RNA_def_property_ui_text(prop, "Name", "Name of UV map"); RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); @@ -2677,7 +2689,6 @@ static void rna_def_polygon_int_layers(BlenderRNA *brna, PropertyRNA *cprop) RNA_def_struct_ui_text(srna, "Int Properties", "Collection of int properties"); func = RNA_def_function(srna, "new", "rna_Mesh_polygon_int_property_new"); - RNA_def_function_flag(func, FUNC_USE_CONTEXT); RNA_def_function_ui_description(func, "Add a integer property layer to Mesh"); RNA_def_string(func, "name", "Int Prop", 0, "", "Int property name"); parm = RNA_def_pointer(func, "layer", "MeshIntPropertyLayer", "", "The newly created layer"); @@ -2699,7 +2710,6 @@ static void rna_def_polygon_float_layers(BlenderRNA *brna, PropertyRNA *cprop) RNA_def_struct_ui_text(srna, "Float Properties", "Collection of float properties"); func = RNA_def_function(srna, "new", "rna_Mesh_polygon_float_property_new"); - RNA_def_function_flag(func, FUNC_USE_CONTEXT); RNA_def_function_ui_description(func, "Add a float property layer to Mesh"); RNA_def_string(func, "name", "Float Prop", 0, "", "Float property name"); parm = RNA_def_pointer(func, "layer", "MeshFloatPropertyLayer", "", "The newly created layer"); @@ -2721,7 +2731,6 @@ static void rna_def_polygon_string_layers(BlenderRNA *brna, PropertyRNA *cprop) RNA_def_struct_ui_text(srna, "String Properties", "Collection of string properties"); func = RNA_def_function(srna, "new", "rna_Mesh_polygon_string_property_new"); - RNA_def_function_flag(func, FUNC_USE_CONTEXT); RNA_def_function_ui_description(func, "Add a string property layer to Mesh"); RNA_def_string(func, "name", "String Prop", 0, "", "String property name"); parm = RNA_def_pointer(func, "layer", "MeshStringPropertyLayer", "", "The newly created layer"); diff --git a/source/blender/makesrna/intern/rna_mesh_api.c b/source/blender/makesrna/intern/rna_mesh_api.c index 4bf879f689f..a25f56f2259 100644 --- a/source/blender/makesrna/intern/rna_mesh_api.c +++ b/source/blender/makesrna/intern/rna_mesh_api.c @@ -48,7 +48,7 @@ #include "DNA_mesh_types.h" -static const char *rna_Mesh_unit_test_compare(struct Mesh *mesh, bContext *C, struct Mesh *mesh2) +static const char *rna_Mesh_unit_test_compare(struct Mesh *mesh, struct Mesh *mesh2) { const char *ret = BKE_mesh_cmp(mesh, mesh2, FLT_EPSILON * 60); @@ -130,7 +130,7 @@ void RNA_api_mesh(StructRNA *srna) parm = RNA_def_float(func, "split_angle", M_PI, 0.0f, M_PI, "", "Angle between polys' normals above which an edge is always sharp (180° to disable)", 0.0f, M_PI); - RNA_def_property_subtype(parm, PROP_UNIT_ROTATION); + RNA_def_property_subtype(parm, (PropertySubType)PROP_UNIT_ROTATION); func = RNA_def_function(srna, "free_normals_split", "rna_Mesh_free_normals_split"); RNA_def_function_ui_description(func, "Free split vertex normals"); @@ -155,7 +155,6 @@ void RNA_api_mesh(StructRNA *srna) func = RNA_def_function(srna, "unit_test_compare", "rna_Mesh_unit_test_compare"); RNA_def_pointer(func, "mesh", "Mesh", "", "Mesh to compare to"); - RNA_def_function_flag(func, FUNC_USE_CONTEXT); /* return value */ parm = RNA_def_string(func, "result", "nothing", 64, "Return value", "String description of result of comparison"); RNA_def_function_return(func, parm); diff --git a/source/blender/makesrna/intern/rna_mesh_utils.h b/source/blender/makesrna/intern/rna_mesh_utils.h index dfe36da033b..c0ea1a153ff 100644 --- a/source/blender/makesrna/intern/rna_mesh_utils.h +++ b/source/blender/makesrna/intern/rna_mesh_utils.h @@ -32,7 +32,8 @@ /* Define the accessors for a basic CustomDataLayer collection */ #define DEFINE_CUSTOMDATA_LAYER_COLLECTION(collection_name, customdata_type, layer_type) \ /* check */ \ - static int rna_##collection_name##_check(CollectionPropertyIterator *iter, void *data) \ + static int rna_##collection_name##_check( \ + CollectionPropertyIterator *UNUSED(iter), void *data) \ { \ CustomDataLayer *layer = (CustomDataLayer *)data; \ return (layer->type != layer_type); \ @@ -59,8 +60,9 @@ return data ? CustomData_number_of_layers(data, layer_type) : 0; \ } \ /* index range */ \ - static void rna_Mesh_##collection_name##_index_range(PointerRNA *ptr, int *min, int *max, \ - int *softmin, int *softmax) \ + static void rna_Mesh_##collection_name##_index_range( \ + PointerRNA *ptr, int *min, int *max, \ + int *UNUSED(softmin), int *UNUSED(softmax)) \ { \ CustomData *data = rna_mesh_##customdata_type(ptr); \ *min = 0; \ diff --git a/source/blender/makesrna/intern/rna_meta.c b/source/blender/makesrna/intern/rna_meta.c index f01b5af7aaa..6bf7c8926e8 100644 --- a/source/blender/makesrna/intern/rna_meta.c +++ b/source/blender/makesrna/intern/rna_meta.c @@ -321,12 +321,14 @@ static void rna_def_metaball(BlenderRNA *brna) prop = RNA_def_property(srna, "resolution", PROP_FLOAT, PROP_DISTANCE); RNA_def_property_float_sdna(prop, NULL, "wiresize"); RNA_def_property_range(prop, 0.005f, 10000.0f); + RNA_def_property_ui_range(prop, 0.05f, 1000.0f, 2.5f, 3); RNA_def_property_ui_text(prop, "Wire Size", "Polygonization resolution in the 3D viewport"); RNA_def_property_update(prop, 0, "rna_MetaBall_update_data"); prop = RNA_def_property(srna, "render_resolution", PROP_FLOAT, PROP_DISTANCE); RNA_def_property_float_sdna(prop, NULL, "rendersize"); RNA_def_property_range(prop, 0.005f, 10000.0f); + RNA_def_property_ui_range(prop, 0.025f, 1000.0f, 2.5f, 3); RNA_def_property_ui_text(prop, "Render Size", "Polygonization resolution in rendering"); RNA_def_property_update(prop, 0, "rna_MetaBall_update_data"); diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c index 7fc61c0acfd..34f138cd7c5 100644 --- a/source/blender/makesrna/intern/rna_modifier.c +++ b/source/blender/makesrna/intern/rna_modifier.c @@ -492,7 +492,8 @@ static void rna_MultiresModifier_type_set(PointerRNA *ptr, int value) mmd->simple = value; } -static void rna_MultiresModifier_level_range(PointerRNA *ptr, int *min, int *max, int *softmin, int *softmax) +static void rna_MultiresModifier_level_range(PointerRNA *ptr, int *min, int *max, + int *UNUSED(softmin), int *UNUSED(softmax)) { MultiresModifierData *mmd = (MultiresModifierData *)ptr->data; diff --git a/source/blender/makesrna/intern/rna_nla.c b/source/blender/makesrna/intern/rna_nla.c index d2dea03b29b..d905e6a014a 100644 --- a/source/blender/makesrna/intern/rna_nla.c +++ b/source/blender/makesrna/intern/rna_nla.c @@ -98,7 +98,7 @@ static char *rna_NlaStrip_path(PointerRNA *ptr) } /* no path */ - return ""; + return BLI_strdup(""); } static void rna_NlaStrip_transform_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c index 0e4f1f96733..bb8e8d87252 100644 --- a/source/blender/makesrna/intern/rna_nodetree.c +++ b/source/blender/makesrna/intern/rna_nodetree.c @@ -584,8 +584,9 @@ static void rna_NodeTree_unregister(Main *UNUSED(bmain), StructRNA *type) WM_main_add_notifier(NC_NODE | NA_EDITED, NULL); } -static StructRNA *rna_NodeTree_register(Main *bmain, ReportList *reports, void *data, const char *identifier, - StructValidateFunc validate, StructCallbackFunc call, StructFreeFunc free) +static StructRNA *rna_NodeTree_register( + Main *bmain, ReportList *reports, void *data, const char *identifier, + StructValidateFunc validate, StructCallbackFunc call, StructFreeFunc free) { bNodeTreeType *nt, dummynt; bNodeTree dummyntree; @@ -652,7 +653,7 @@ static bool rna_NodeTree_check(bNodeTree *ntree, ReportList *reports) return true; } -static void rna_NodeTree_update(Main *bmain, Scene *scene, PointerRNA *ptr) +static void rna_NodeTree_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr) { bNodeTree *ntree = (bNodeTree *)ptr->id.data; @@ -1376,8 +1377,8 @@ static bNodeType *rna_Node_register_base(Main *bmain, ReportList *reports, Struc nt->initfunc_api = (have_function[3]) ? rna_Node_init : NULL; nt->copyfunc_api = (have_function[4]) ? rna_Node_copy : NULL; nt->freefunc_api = (have_function[5]) ? rna_Node_free : NULL; - nt->uifunc = (have_function[6]) ? rna_Node_draw_buttons : NULL; - nt->uifuncbut = (have_function[7]) ? rna_Node_draw_buttons_ext : NULL; + nt->draw_buttons = (have_function[6]) ? rna_Node_draw_buttons : NULL; + nt->draw_buttons_ex = (have_function[7]) ? rna_Node_draw_buttons_ext : NULL; /* sanitize size values in case not all have been registered */ if (nt->maxwidth < nt->minwidth) @@ -1390,9 +1391,10 @@ static bNodeType *rna_Node_register_base(Main *bmain, ReportList *reports, Struc return nt; } -static StructRNA *rna_Node_register(Main *bmain, ReportList *reports, - void *data, const char *identifier, - StructValidateFunc validate, StructCallbackFunc call, StructFreeFunc free) +static StructRNA *rna_Node_register( + Main *bmain, ReportList *reports, + void *data, const char *identifier, + StructValidateFunc validate, StructCallbackFunc call, StructFreeFunc free) { bNodeType *nt = rna_Node_register_base(bmain, reports, &RNA_Node, data, identifier, validate, call, free); if (!nt) @@ -1406,9 +1408,10 @@ static StructRNA *rna_Node_register(Main *bmain, ReportList *reports, return nt->ext.srna; } -static StructRNA *rna_ShaderNode_register(Main *bmain, ReportList *reports, - void *data, const char *identifier, - StructValidateFunc validate, StructCallbackFunc call, StructFreeFunc free) +static StructRNA *rna_ShaderNode_register( + Main *bmain, ReportList *reports, + void *data, const char *identifier, + StructValidateFunc validate, StructCallbackFunc call, StructFreeFunc free) { bNodeType *nt = rna_Node_register_base(bmain, reports, &RNA_ShaderNode, data, identifier, validate, call, free); if (!nt) @@ -1422,9 +1425,10 @@ static StructRNA *rna_ShaderNode_register(Main *bmain, ReportList *reports, return nt->ext.srna; } -static StructRNA *rna_CompositorNode_register(Main *bmain, ReportList *reports, - void *data, const char *identifier, - StructValidateFunc validate, StructCallbackFunc call, StructFreeFunc free) +static StructRNA *rna_CompositorNode_register( + Main *bmain, ReportList *reports, + void *data, const char *identifier, + StructValidateFunc validate, StructCallbackFunc call, StructFreeFunc free) { bNodeType *nt = rna_Node_register_base(bmain, reports, &RNA_CompositorNode, data, identifier, validate, call, free); if (!nt) @@ -1438,9 +1442,10 @@ static StructRNA *rna_CompositorNode_register(Main *bmain, ReportList *reports, return nt->ext.srna; } -static StructRNA *rna_TextureNode_register(Main *bmain, ReportList *reports, - void *data, const char *identifier, - StructValidateFunc validate, StructCallbackFunc call, StructFreeFunc free) +static StructRNA *rna_TextureNode_register( + Main *bmain, ReportList *reports, + void *data, const char *identifier, + StructValidateFunc validate, StructCallbackFunc call, StructFreeFunc free) { bNodeType *nt = rna_Node_register_base(bmain, reports, &RNA_TextureNode, data, identifier, validate, call, free); if (!nt) @@ -1762,8 +1767,9 @@ static void rna_NodeSocket_unregister(Main *UNUSED(bmain), StructRNA *type) WM_main_add_notifier(NC_NODE | NA_EDITED, NULL); } -static StructRNA *rna_NodeSocket_register(Main *bmain, ReportList *reports, void *data, const char *identifier, - StructValidateFunc validate, StructCallbackFunc call, StructFreeFunc free) +static StructRNA *rna_NodeSocket_register( + Main *UNUSED(bmain), ReportList *reports, void *data, const char *identifier, + StructValidateFunc validate, StructCallbackFunc call, StructFreeFunc free) { bNodeSocketType *st, dummyst; bNodeSocket dummysock; @@ -1883,6 +1889,12 @@ static void rna_NodeSocket_update(Main *bmain, Scene *UNUSED(scene), PointerRNA ED_node_tag_update_nodetree(bmain, ntree); } +static int rna_NodeSocket_is_output_get(PointerRNA *ptr) +{ + bNodeSocket *sock = ptr->data; + return sock->in_out == SOCK_OUT; +} + static void rna_NodeSocket_link_limit_set(PointerRNA *ptr, int value) { bNodeSocket *sock = ptr->data; @@ -2033,8 +2045,9 @@ static void rna_NodeSocketInterface_unregister(Main *UNUSED(bmain), StructRNA *t WM_main_add_notifier(NC_NODE | NA_EDITED, NULL); } -static StructRNA *rna_NodeSocketInterface_register(Main *bmain, ReportList *reports, void *data, const char *identifier, - StructValidateFunc validate, StructCallbackFunc call, StructFreeFunc free) +static StructRNA *rna_NodeSocketInterface_register( + Main *UNUSED(bmain), ReportList *UNUSED(reports), void *data, const char *identifier, + StructValidateFunc validate, StructCallbackFunc call, StructFreeFunc free) { bNodeSocketType *st, dummyst; bNodeSocket dummysock; @@ -2329,30 +2342,31 @@ static void rna_NodeInternal_update(ID *id, bNode *node) static void rna_NodeInternal_draw_buttons(ID *id, bNode *node, struct bContext *C, struct uiLayout *layout) { - if (node->typeinfo->uifunc) { + if (node->typeinfo->draw_buttons) { PointerRNA ptr; RNA_pointer_create(id, &RNA_Node, node, &ptr); - node->typeinfo->uifunc(layout, C, &ptr); + node->typeinfo->draw_buttons(layout, C, &ptr); } } static void rna_NodeInternal_draw_buttons_ext(ID *id, bNode *node, struct bContext *C, struct uiLayout *layout) { - if (node->typeinfo->uifuncbut) { + if (node->typeinfo->draw_buttons_ex) { PointerRNA ptr; RNA_pointer_create(id, &RNA_Node, node, &ptr); - node->typeinfo->uifuncbut(layout, C, &ptr); + node->typeinfo->draw_buttons_ex(layout, C, &ptr); } - else if (node->typeinfo->uifunc) { + else if (node->typeinfo->draw_buttons) { PointerRNA ptr; RNA_pointer_create(id, &RNA_Node, node, &ptr); - node->typeinfo->uifunc(layout, C, &ptr); + node->typeinfo->draw_buttons(layout, C, &ptr); } } -static StructRNA *rna_NodeCustomGroup_register(Main *bmain, ReportList *reports, - void *data, const char *identifier, - StructValidateFunc validate, StructCallbackFunc call, StructFreeFunc free) +static StructRNA *rna_NodeCustomGroup_register( + Main *bmain, ReportList *reports, + void *data, const char *identifier, + StructValidateFunc validate, StructCallbackFunc call, StructFreeFunc free) { bNodeType *nt = rna_Node_register_base(bmain, reports, &RNA_NodeCustomGroup, data, identifier, validate, call, free); if (!nt) @@ -2839,6 +2853,15 @@ static void rna_ShaderNodeSubsurface_update(Main *bmain, Scene *scene, PointerRN rna_Node_update(bmain, scene, ptr); } +static void rna_CompositorNodeScale_update(Main *bmain, Scene *scene, PointerRNA *ptr) +{ + bNodeTree *ntree = (bNodeTree *)ptr->id.data; + bNode *node = (bNode *)ptr->data; + + nodeUpdate(ntree, node); + rna_Node_update(bmain, scene, ptr); +} + #else static EnumPropertyItem prop_image_layer_items[] = { @@ -3127,10 +3150,24 @@ static void def_sh_material(StructRNA *srna) static void def_sh_mapping(StructRNA *srna) { + static EnumPropertyItem prop_vect_type_items[] = { + {TEXMAP_TYPE_TEXTURE, "TEXTURE", 0, "Texture", "Transform a texture by inverse mapping the texture coordinate"}, + {TEXMAP_TYPE_POINT, "POINT", 0, "Point", "Transform a point"}, + {TEXMAP_TYPE_VECTOR, "VECTOR", 0, "Vector", "Transform a direction vector"}, + {TEXMAP_TYPE_NORMAL, "NORMAL", 0, "Normal", "Transform a normal vector with unit length"}, + {0, NULL, 0, NULL, NULL} + }; + PropertyRNA *prop; RNA_def_struct_sdna_from(srna, "TexMapping", "storage"); + prop = RNA_def_property(srna, "vector_type", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "type"); + RNA_def_property_enum_items(prop, prop_vect_type_items); + RNA_def_property_ui_text(prop, "Type", "Type of vector that the mapping transforms"); + RNA_def_property_update(prop, 0, "rna_Mapping_Node_update"); + prop = RNA_def_property(srna, "translation", PROP_FLOAT, PROP_TRANSLATION); RNA_def_property_float_sdna(prop, NULL, "loc"); RNA_def_property_ui_text(prop, "Location", ""); @@ -3236,7 +3273,7 @@ static void def_sh_tex_sky(StructRNA *srna) RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update"); prop = RNA_def_property(srna, "turbidity", PROP_FLOAT, PROP_NONE); - RNA_def_property_range(prop, 1.0f, 30.0f); + RNA_def_property_range(prop, 1.0f, 10.0f); RNA_def_property_ui_range(prop, 1.0f, 10.0f, 10, 3); RNA_def_property_ui_text(prop, "Turbidity", "Atmospheric turbidity"); RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update"); @@ -3514,9 +3551,9 @@ static void def_sh_tex_coord(StructRNA *srna) static void def_sh_vect_transform(StructRNA *srna) { static EnumPropertyItem prop_vect_type_items[] = { - {SHD_VECT_TRANSFORM_TYPE_VECTOR, "VECTOR", 0, "Vector", ""}, - {SHD_VECT_TRANSFORM_TYPE_POINT, "POINT", 0, "Point", ""}, - {SHD_VECT_TRANSFORM_TYPE_NORMAL, "NORMAL", 0, "Normal", ""}, + {SHD_VECT_TRANSFORM_TYPE_POINT, "POINT", 0, "Point", "Transform a point"}, + {SHD_VECT_TRANSFORM_TYPE_VECTOR, "VECTOR", 0, "Vector", "Transform a direction vector"}, + {SHD_VECT_TRANSFORM_TYPE_NORMAL, "NORMAL", 0, "Normal", "Transform a normal vector with unit length"}, {0, NULL, 0, NULL, NULL} }; @@ -3531,7 +3568,8 @@ static void def_sh_vect_transform(StructRNA *srna) RNA_def_struct_sdna_from(srna, "NodeShaderVectTransform", "storage"); - prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE); + prop = RNA_def_property(srna, "vector_type", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "type"); RNA_def_property_enum_items(prop, prop_vect_type_items); RNA_def_property_ui_text(prop, "Type", ""); RNA_def_property_update(prop, 0, "rna_Node_update"); @@ -3667,7 +3705,6 @@ static void def_sh_tangent(StructRNA *srna) static void def_sh_subsurface(StructRNA *srna) { static EnumPropertyItem prop_subsurface_falloff_items[] = { - {SHD_SUBSURFACE_COMPATIBLE, "COMPATIBLE", 0, "Compatible", "Subsurface scattering falloff compatible with previous versions"}, {SHD_SUBSURFACE_CUBIC, "CUBIC", 0, "Cubic", "Simple cubic falloff function"}, {SHD_SUBSURFACE_GAUSSIAN, "GAUSSIAN", 0, "Gaussian", "Normal distribution, multiple can be combined to fit more complex profiles"}, {0, NULL, 0, NULL, NULL} @@ -4337,7 +4374,7 @@ static void def_cmp_scale(StructRNA *srna) RNA_def_property_enum_sdna(prop, NULL, "custom1"); RNA_def_property_enum_items(prop, space_items); RNA_def_property_ui_text(prop, "Space", "Coordinate space to scale relative to"); - RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update"); + RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_CompositorNodeScale_update"); /* expose 2 flags as a enum of 3 items */ prop = RNA_def_property(srna, "frame_method", PROP_ENUM, PROP_NONE); @@ -6150,12 +6187,10 @@ static void rna_def_node_socket(BlenderRNA *brna) RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_ui_text(prop, "Identifier", "Unique identifier for mapping sockets"); - prop = RNA_def_property(srna, "in_out", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_sdna(prop, NULL, "in_out"); - RNA_def_property_enum_items(prop, node_socket_in_out_items); - RNA_def_property_enum_default(prop, SOCK_IN); + prop = RNA_def_property(srna, "is_output", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_funcs(prop, "rna_NodeSocket_is_output_get", NULL); RNA_def_property_clear_flag(prop, PROP_EDITABLE); - RNA_def_property_ui_text(prop, "Input or Output", "Input or Output type"); + RNA_def_property_ui_text(prop, "Is Output", "True if the socket is an output, otherwise input"); prop = RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", SOCK_HIDDEN); @@ -6277,12 +6312,10 @@ static void rna_def_node_socket_interface(BlenderRNA *brna) RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_ui_text(prop, "Identifier", "Unique identifier for mapping sockets"); - prop = RNA_def_property(srna, "in_out", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_sdna(prop, NULL, "in_out"); - RNA_def_property_enum_items(prop, node_socket_in_out_items); - RNA_def_property_enum_default(prop, SOCK_IN); + prop = RNA_def_property(srna, "is_output", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_funcs(prop, "rna_NodeSocket_is_output_get", NULL); RNA_def_property_clear_flag(prop, PROP_EDITABLE); - RNA_def_property_ui_text(prop, "Input or Output", "Input or Output type"); + RNA_def_property_ui_text(prop, "Is Output", "True if the socket is an output, otherwise input"); /* registration */ prop = RNA_def_property(srna, "bl_socket_idname", PROP_STRING, PROP_NONE); diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c index d4a78ce73d5..11a818c6a9c 100644 --- a/source/blender/makesrna/intern/rna_object.c +++ b/source/blender/makesrna/intern/rna_object.c @@ -557,7 +557,8 @@ static void rna_Object_active_vertex_group_index_set(PointerRNA *ptr, int value) ob->actdef = value + 1; } -static void rna_Object_active_vertex_group_index_range(PointerRNA *ptr, int *min, int *max, int *softmin, int *softmax) +static void rna_Object_active_vertex_group_index_range(PointerRNA *ptr, int *min, int *max, + int *UNUSED(softmin), int *UNUSED(softmax)) { Object *ob = (Object *)ptr->id.data; @@ -668,7 +669,8 @@ static void rna_Object_active_material_index_set(PointerRNA *ptr, int value) } } -static void rna_Object_active_material_index_range(PointerRNA *ptr, int *min, int *max, int *softmin, int *softmax) +static void rna_Object_active_material_index_range(PointerRNA *ptr, int *min, int *max, + int *UNUSED(softmin), int *UNUSED(softmax)) { Object *ob = (Object *)ptr->id.data; *min = 0; @@ -694,7 +696,7 @@ static void rna_Object_active_material_set(PointerRNA *ptr, PointerRNA value) } static void rna_Object_active_particle_system_index_range(PointerRNA *ptr, int *min, int *max, - int *softmin, int *softmax) + int *UNUSED(softmin), int *UNUSED(softmax)) { Object *ob = (Object *)ptr->id.data; *min = 0; @@ -907,6 +909,15 @@ static void rna_MaterialSlot_update(Main *bmain, Scene *scene, PointerRNA *ptr) WM_main_add_notifier(NC_MATERIAL | ND_SHADING_LINKS, NULL); } +static char *rna_MaterialSlot_path(PointerRNA *ptr) +{ + Object *ob = (Object *)ptr->id.data; + int index = (Material **)ptr->data - ob->mat; + + /* from armature... */ + return BLI_sprintfN("material_slots[%d]", index); +} + /* why does this have to be so complicated?, can't all this crap be * moved to in BGE conversion function? - Campbell * * @@ -1185,7 +1196,8 @@ static void rna_GameObjectSettings_col_mask_set(PointerRNA *ptr, const int *valu } -static void rna_Object_active_shape_key_index_range(PointerRNA *ptr, int *min, int *max, int *softmin, int *softmax) +static void rna_Object_active_shape_key_index_range(PointerRNA *ptr, int *min, int *max, + int *UNUSED(softmin), int *UNUSED(softmax)) { Object *ob = (Object *)ptr->id.data; Key *key = BKE_key_from_object(ob); @@ -1454,8 +1466,6 @@ static void rna_Object_lod_distance_update(Main *bmain, Scene *scene, PointerRNA } #else -static int rna_matrix_dimsize_4x4[] = {4, 4}; - static void rna_def_vertex_group(BlenderRNA *brna) { StructRNA *srna; @@ -1556,6 +1566,8 @@ static void rna_def_material_slot(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Name", "Material slot name"); RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_struct_name_property(srna, prop); + + RNA_def_struct_path_func(srna, "rna_MaterialSlot_path"); } static void rna_def_object_game_settings(BlenderRNA *brna) @@ -2811,11 +2823,14 @@ static void rna_def_object_base(BlenderRNA *brna) void RNA_def_object(BlenderRNA *brna) { rna_def_object(brna); + + RNA_define_animate_sdna(false); rna_def_object_game_settings(brna); rna_def_object_base(brna); rna_def_vertex_group(brna); rna_def_material_slot(brna); rna_def_dupli_object(brna); + RNA_define_animate_sdna(true); rna_def_object_lodlevel(brna); } diff --git a/source/blender/makesrna/intern/rna_object_api.c b/source/blender/makesrna/intern/rna_object_api.c index 25ca231e58d..0f71e26b687 100644 --- a/source/blender/makesrna/intern/rna_object_api.c +++ b/source/blender/makesrna/intern/rna_object_api.c @@ -430,8 +430,6 @@ 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"}, diff --git a/source/blender/makesrna/intern/rna_object_force.c b/source/blender/makesrna/intern/rna_object_force.c index 2fda576fcc2..33ae256c042 100644 --- a/source/blender/makesrna/intern/rna_object_force.c +++ b/source/blender/makesrna/intern/rna_object_force.c @@ -228,7 +228,8 @@ static void rna_Cache_list_begin(CollectionPropertyIterator *iter, PointerRNA *p rna_iterator_listbase_begin(iter, &lb, NULL); } -static void rna_Cache_active_point_cache_index_range(PointerRNA *ptr, int *min, int *max, int *softmin, int *softmax) +static void rna_Cache_active_point_cache_index_range(PointerRNA *ptr, int *min, int *max, + int *UNUSED(softmin), int *UNUSED(softmax)) { Object *ob = ptr->id.data; PointCache *cache = ptr->data; @@ -291,7 +292,8 @@ static void rna_Cache_active_point_cache_index_set(struct PointerRNA *ptr, int v BLI_freelistN(&pidlist); } -static void rna_PointCache_frame_step_range(PointerRNA *ptr, int *min, int *max, int *softmin, int *softmax) +static void rna_PointCache_frame_step_range(PointerRNA *ptr, int *min, int *max, + int *UNUSED(softmin), int *UNUSED(softmax)) { Object *ob = ptr->id.data; PointCache *cache = ptr->data; @@ -1538,8 +1540,6 @@ static void rna_def_softbody(BlenderRNA *brna) { StructRNA *srna; PropertyRNA *prop; - const int matrix_dimsize[] = {3, 3}; - static EnumPropertyItem collision_type_items[] = { {SBC_MODE_MANUAL, "MANUAL", 0, "Manual", "Manual adjust"}, @@ -1782,12 +1782,12 @@ static void rna_def_softbody(BlenderRNA *brna) /* matrix */ prop = RNA_def_property(srna, "rotation_estimate", PROP_FLOAT, PROP_MATRIX); RNA_def_property_float_sdna(prop, NULL, "lrot"); - RNA_def_property_multi_array(prop, 2, matrix_dimsize); + RNA_def_property_multi_array(prop, 2, rna_matrix_dimsize_3x3); RNA_def_property_ui_text(prop, "Rot Matrix", "Estimated rotation matrix"); prop = RNA_def_property(srna, "scale_estimate", PROP_FLOAT, PROP_MATRIX); RNA_def_property_float_sdna(prop, NULL, "lscale"); - RNA_def_property_multi_array(prop, 2, matrix_dimsize); + RNA_def_property_multi_array(prop, 2, rna_matrix_dimsize_3x3); RNA_def_property_ui_text(prop, "Scale Matrix", "Estimated scale matrix"); /***********************************************************************************/ diff --git a/source/blender/makesrna/intern/rna_particle.c b/source/blender/makesrna/intern/rna_particle.c index 7d30194277b..8dafe54e678 100644 --- a/source/blender/makesrna/intern/rna_particle.c +++ b/source/blender/makesrna/intern/rna_particle.c @@ -271,7 +271,8 @@ static void rna_ParticleHairKey_co_object(HairKey *hairkey, Object *object, Part } } -static void rna_Particle_uv_on_emitter(ParticleData *particle, ParticleSystemModifierData *modifier, float n_uv[2]) +static void rna_Particle_uv_on_emitter(ParticleData *particle, ReportList *reports, + ParticleSystemModifierData *modifier, float r_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);*/ @@ -279,28 +280,39 @@ static void rna_Particle_uv_on_emitter(ParticleData *particle, ParticleSystemMod int num = particle->num_dmcache; int from = modifier->psys->part->from; + if (!CustomData_has_layer(&modifier->dm->loopData, CD_MLOOPUV)) { + BKE_report(reports, RPT_ERROR, "Mesh has no UV data"); + return; + } + DM_ensure_tessface(modifier->dm); /* BMESH - UNTIL MODIFIER IS UPDATED FOR MPoly */ + 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 (r_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; + MFace *mface; + MTFace *mtface; + + mface = modifier->dm->getTessFaceData(modifier->dm, num, CD_MFACE); + mtface = (MTFace *)CustomData_get_layer_n(&modifier->dm->faceData, CD_MTFACE, 0); + + if (mface && mtface) { + mtface += num; + psys_interpolate_uvs(mtface, mface->v4, particle->fuv, r_uv); + return; + } } } + + r_uv[0] = 0.0f; + r_uv[1] = 0.0f; } -static void rna_ParticleSystem_co_hair(ParticleSystem *particlesystem, Object *object, ParticleSystemModifierData *modifier, +static void rna_ParticleSystem_co_hair(ParticleSystem *particlesystem, Object *object, int particle_no, int step, float n_co[3]) { ParticleSettings *part = 0; @@ -378,14 +390,22 @@ static void rna_ParticleSystem_co_hair(ParticleSystem *particlesystem, Object *o } -static void rna_ParticleSystem_uv_on_emitter(ParticleSystem *particlesystem, ParticleSystemModifierData *modifier, ParticleData *particle, int particle_no, int uv_no, - float n_uv[2]) +static void rna_ParticleSystem_uv_on_emitter(ParticleSystem *particlesystem, ReportList *reports, + ParticleSystemModifierData *modifier, ParticleData *particle, + int particle_no, int uv_no, + float r_uv[2]) { ParticleSettings *part = 0; int totpart; int totchild = 0; int num; + if (!CustomData_has_layer(&modifier->dm->loopData, CD_MLOOPUV)) { + BKE_report(reports, RPT_ERROR, "Mesh has no UV data"); + return; + } + DM_ensure_tessface(modifier->dm); /* BMESH - UNTIL MODIFIER IS UPDATED FOR MPoly */ + /* 1. check that everything is ok & updated */ if (particlesystem == NULL) return; @@ -419,17 +439,17 @@ static void rna_ParticleSystem_uv_on_emitter(ParticleSystem *particlesystem, Par if (particle->num < modifier->dm->getNumTessFaces(modifier->dm)) num = particle->num; - if (n_uv && ELEM(part->from, PART_FROM_FACE, PART_FROM_VOLUME)) { + if (r_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, uv_no); mtface += num; - psys_interpolate_uvs(mtface, mface->v4, particle->fuv, n_uv); + psys_interpolate_uvs(mtface, mface->v4, particle->fuv, r_uv); } else { - n_uv[0] = 0.0f; - n_uv[1] = 0.0f; + r_uv[0] = 0.0f; + r_uv[1] = 0.0f; } } } @@ -440,17 +460,17 @@ static void rna_ParticleSystem_uv_on_emitter(ParticleSystem *particlesystem, Par /* get uvco & mcol */ if (part->childtype == PART_CHILD_FACES) { - if (n_uv && ELEM(PART_FROM_FACE, PART_FROM_FACE, PART_FROM_VOLUME)) { + if (r_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, uv_no); mtface += cpa->num; - psys_interpolate_uvs(mtface, mface->v4, cpa->fuv, n_uv); + psys_interpolate_uvs(mtface, mface->v4, cpa->fuv, r_uv); } else { - n_uv[0] = 0.0f; - n_uv[1] = 0.0f; + r_uv[0] = 0.0f; + r_uv[1] = 0.0f; } } } @@ -462,17 +482,17 @@ static void rna_ParticleSystem_uv_on_emitter(ParticleSystem *particlesystem, Par if (parent->num < modifier->dm->getNumTessFaces(modifier->dm)) num = parent->num; - if (n_uv && ELEM(part->from, PART_FROM_FACE, PART_FROM_VOLUME)) { + if (r_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, uv_no); mtface += num; - psys_interpolate_uvs(mtface, mface->v4, parent->fuv, n_uv); + psys_interpolate_uvs(mtface, mface->v4, parent->fuv, r_uv); } else { - n_uv[0] = 0.0f; - n_uv[1] = 0.0f; + r_uv[0] = 0.0f; + r_uv[1] = 0.0f; } } } @@ -842,7 +862,8 @@ static float rna_PartSetting_linelentail_get(struct PointerRNA *ptr) ParticleSettings *settings = (ParticleSettings *)ptr->data; return settings->draw_line[0]; } -static void rna_PartSetting_pathstartend_range(PointerRNA *ptr, float *min, float *max, float *softmin, float *softmax) +static void rna_PartSetting_pathstartend_range(PointerRNA *ptr, float *min, float *max, + float *UNUSED(softmin), float *UNUSED(softmax)) { ParticleSettings *settings = (ParticleSettings *)ptr->data; @@ -899,7 +920,7 @@ static PointerRNA rna_ParticleSystem_active_particle_target_get(PointerRNA *ptr) return rna_pointer_inherit_refine(ptr, &RNA_ParticleTarget, NULL); } static void rna_ParticleSystem_active_particle_target_index_range(PointerRNA *ptr, int *min, int *max, - int *softmin, int *softmax) + int *UNUSED(softmin), int *UNUSED(softmax)) { ParticleSystem *psys = (ParticleSystem *)ptr->data; *min = 0; @@ -1021,7 +1042,8 @@ static PointerRNA rna_ParticleDupliWeight_active_get(PointerRNA *ptr) } return rna_pointer_inherit_refine(ptr, &RNA_ParticleTarget, NULL); } -static void rna_ParticleDupliWeight_active_index_range(PointerRNA *ptr, int *min, int *max, int *softmin, int *softmax) +static void rna_ParticleDupliWeight_active_index_range(PointerRNA *ptr, int *min, int *max, + int *UNUSED(softmin), int *UNUSED(softmax)) { ParticleSettings *part = (ParticleSettings *)ptr->id.data; *min = 0; @@ -1294,8 +1316,11 @@ static void rna_def_particle_hair_key(BlenderRNA *brna) RNA_def_function_ui_description(func, "Obtain hairkey location with particle and modifier data"); prop = RNA_def_pointer(func, "object", "Object", "", "Object"); + RNA_def_property_flag(prop, PROP_REQUIRED | PROP_NEVER_NULL); prop = RNA_def_pointer(func, "modifier", "ParticleSystemModifier", "", "Particle modifier"); + RNA_def_property_flag(prop, PROP_REQUIRED | PROP_NEVER_NULL); prop = RNA_def_pointer(func, "particle", "Particle", "", "hair particle"); + RNA_def_property_flag(prop, PROP_REQUIRED | PROP_NEVER_NULL); prop = RNA_def_float_vector(func, "co", 3, NULL, -FLT_MAX, FLT_MAX, "Co", "Exported hairkey location", -1e4, 1e4); @@ -1461,7 +1486,9 @@ static void rna_def_particle(BlenderRNA *brna) /* 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"); + RNA_def_function_flag(func, FUNC_USE_REPORTS); prop = RNA_def_pointer(func, "modifier", "ParticleSystemModifier", "", "Particle modifier"); + RNA_def_property_flag(prop, PROP_REQUIRED | PROP_NEVER_NULL); prop = RNA_def_property(func, "uv", PROP_FLOAT, PROP_COORDS); RNA_def_property_array(prop, 2); RNA_def_property_flag(prop, PROP_THICK_WRAP); @@ -3388,7 +3415,7 @@ static void rna_def_particle_system(BlenderRNA *brna) 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"); + RNA_def_property_flag(prop, PROP_REQUIRED | PROP_NEVER_NULL); 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); @@ -3400,8 +3427,11 @@ static void rna_def_particle_system(BlenderRNA *brna) /* 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"); + RNA_def_function_flag(func, FUNC_USE_REPORTS); prop = RNA_def_pointer(func, "modifier", "ParticleSystemModifier", "", "Particle modifier"); + RNA_def_property_flag(prop, PROP_REQUIRED | PROP_NEVER_NULL); prop = RNA_def_pointer(func, "particle", "Particle", "", "Particle"); + RNA_def_property_flag(prop, PROP_REQUIRED | PROP_NEVER_NULL); prop = RNA_def_int(func, "particle_no", 0, INT_MIN, INT_MAX, "Particle no", "", INT_MIN, INT_MAX); prop = RNA_def_int(func, "uv_no", 0, INT_MIN, INT_MAX, "UV no", "", INT_MIN, INT_MAX); prop = RNA_def_property(func, "uv", PROP_FLOAT, PROP_COORDS); @@ -3413,7 +3443,9 @@ static void rna_def_particle_system(BlenderRNA *brna) 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"); + RNA_def_property_flag(prop, PROP_REQUIRED | PROP_NEVER_NULL); prop = RNA_def_pointer(func, "particle", "Particle", "", "Particle"); + RNA_def_property_flag(prop, PROP_REQUIRED | PROP_NEVER_NULL); 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); diff --git a/source/blender/makesrna/intern/rna_pose.c b/source/blender/makesrna/intern/rna_pose.c index 35347d656df..9c4e7f034cb 100644 --- a/source/blender/makesrna/intern/rna_pose.c +++ b/source/blender/makesrna/intern/rna_pose.c @@ -382,7 +382,8 @@ static void rna_PoseChannel_bone_group_index_set(PointerRNA *ptr, int value) pchan->agrp_index = value + 1; } -static void rna_PoseChannel_bone_group_index_range(PointerRNA *ptr, int *min, int *max, int *softmin, int *softmax) +static void rna_PoseChannel_bone_group_index_range(PointerRNA *ptr, int *min, int *max, + int *UNUSED(softmin), int *UNUSED(softmax)) { Object *ob = (Object *)ptr->id.data; bPose *pose = (ob) ? ob->pose : NULL; @@ -415,7 +416,8 @@ static void rna_Pose_active_bone_group_index_set(PointerRNA *ptr, int value) pose->active_group = value + 1; } -static void rna_Pose_active_bone_group_index_range(PointerRNA *ptr, int *min, int *max, int *softmin, int *softmax) +static void rna_Pose_active_bone_group_index_range(PointerRNA *ptr, int *min, int *max, + int *UNUSED(softmin), int *UNUSED(softmax)) { bPose *pose = (bPose *)ptr->data; @@ -740,9 +742,7 @@ static void rna_def_pose_channel(BlenderRNA *brna) static float default_quat[4] = {1, 0, 0, 0}; /* default quaternion values */ static float default_axisAngle[4] = {0, 0, 1, 0}; /* default axis-angle rotation values */ static float default_scale[3] = {1, 1, 1}; /* default scale values */ - - const int matrix_dimsize[] = {4, 4}; - + StructRNA *srna; PropertyRNA *prop; @@ -839,13 +839,13 @@ static void rna_def_pose_channel(BlenderRNA *brna) /* transform matrices - should be read-only since these are set directly by AnimSys evaluation */ prop = RNA_def_property(srna, "matrix_channel", PROP_FLOAT, PROP_MATRIX); RNA_def_property_float_sdna(prop, NULL, "chan_mat"); - RNA_def_property_multi_array(prop, 2, matrix_dimsize); + RNA_def_property_multi_array(prop, 2, rna_matrix_dimsize_4x4); RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_ui_text(prop, "Channel Matrix", "4x4 matrix, before constraints"); /* writable because it touches loc/scale/rot directly */ prop = RNA_def_property(srna, "matrix_basis", PROP_FLOAT, PROP_MATRIX); - RNA_def_property_multi_array(prop, 2, matrix_dimsize); + RNA_def_property_multi_array(prop, 2, rna_matrix_dimsize_4x4); RNA_def_property_ui_text(prop, "Basis Matrix", "Alternative access to location/scale/rotation relative to the parent and own rest bone"); RNA_def_property_float_funcs(prop, "rna_PoseChannel_matrix_basis_get", "rna_PoseChannel_matrix_basis_set", NULL); @@ -855,7 +855,7 @@ static void rna_def_pose_channel(BlenderRNA *brna) /* final matrix */ prop = RNA_def_property(srna, "matrix", PROP_FLOAT, PROP_MATRIX); RNA_def_property_float_sdna(prop, NULL, "pose_mat"); - RNA_def_property_multi_array(prop, 2, matrix_dimsize); + RNA_def_property_multi_array(prop, 2, rna_matrix_dimsize_4x4); RNA_def_property_float_funcs(prop, NULL, "rna_PoseChannel_matrix_set", NULL); RNA_def_property_ui_text(prop, "Pose Matrix", "Final 4x4 matrix after constraints and drivers are applied (object space)"); diff --git a/source/blender/makesrna/intern/rna_render.c b/source/blender/makesrna/intern/rna_render.c index 5b809a51705..7ebbcf7b39b 100644 --- a/source/blender/makesrna/intern/rna_render.c +++ b/source/blender/makesrna/intern/rna_render.c @@ -66,14 +66,14 @@ static void engine_tag_update(RenderEngine *engine) static int engine_support_display_space_shader(RenderEngine *UNUSED(engine), Scene *scene) { - return IMB_colormanagement_support_glsl_draw(&scene->view_settings, true); + return IMB_colormanagement_support_glsl_draw(&scene->view_settings); } static void engine_bind_display_space_shader(RenderEngine *UNUSED(engine), Scene *scene) { IMB_colormanagement_setup_glsl_draw(&scene->view_settings, &scene->display_settings, - false, true); + false); } static void engine_unbind_display_space_shader(RenderEngine *UNUSED(engine)) diff --git a/source/blender/makesrna/intern/rna_rigidbody.c b/source/blender/makesrna/intern/rna_rigidbody.c index b1f704551e0..cc14e60f45a 100644 --- a/source/blender/makesrna/intern/rna_rigidbody.c +++ b/source/blender/makesrna/intern/rna_rigidbody.c @@ -96,14 +96,14 @@ EnumPropertyItem rigidbody_constraint_type_items[] = { /* ******************************** */ -static void rna_RigidBodyWorld_reset(Main *bmain, Scene *scene, PointerRNA *ptr) +static void rna_RigidBodyWorld_reset(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) { RigidBodyWorld *rbw = (RigidBodyWorld *)ptr->data; BKE_rigidbody_cache_reset(rbw); } -static char *rna_RigidBodyWorld_path(PointerRNA *ptr) +static char *rna_RigidBodyWorld_path(PointerRNA *UNUSED(ptr)) { return BLI_sprintfN("rigidbody_world"); } @@ -136,14 +136,14 @@ static void rna_RigidBodyWorld_split_impulse_set(PointerRNA *ptr, int value) /* ******************************** */ -static void rna_RigidBodyOb_reset(Main *bmain, Scene *scene, PointerRNA *ptr) +static void rna_RigidBodyOb_reset(Main *UNUSED(bmain), Scene *scene, PointerRNA *UNUSED(ptr)) { RigidBodyWorld *rbw = scene->rigidbody_world; BKE_rigidbody_cache_reset(rbw); } -static void rna_RigidBodyOb_shape_reset(Main *bmain, Scene *scene, PointerRNA *ptr) +static void rna_RigidBodyOb_shape_reset(Main *UNUSED(bmain), Scene *scene, PointerRNA *ptr) { RigidBodyWorld *rbw = scene->rigidbody_world; RigidBodyOb *rbo = (RigidBodyOb *)ptr->data; @@ -153,7 +153,7 @@ static void rna_RigidBodyOb_shape_reset(Main *bmain, Scene *scene, PointerRNA *p rbo->flag |= RBO_FLAG_NEEDS_RESHAPE; } -static char *rna_RigidBodyOb_path(PointerRNA *ptr) +static char *rna_RigidBodyOb_path(PointerRNA *UNUSED(ptr)) { /* NOTE: this hardcoded path should work as long as only Objects have this */ return BLI_sprintfN("rigid_body"); @@ -167,6 +167,14 @@ static void rna_RigidBodyOb_type_set(PointerRNA *ptr, int value) rbo->flag |= RBO_FLAG_NEEDS_VALIDATE; } +static void rna_RigidBodyOb_shape_set(PointerRNA *ptr, int value) +{ + RigidBodyOb *rbo = (RigidBodyOb *)ptr->data; + + rbo->shape = value; + rbo->flag |= RBO_FLAG_NEEDS_VALIDATE; +} + static void rna_RigidBodyOb_disabled_set(PointerRNA *ptr, int value) { RigidBodyOb *rbo = (RigidBodyOb *)ptr->data; @@ -335,7 +343,7 @@ static void rna_RigidBodyOb_angular_damping_set(PointerRNA *ptr, float value) #endif } -static char *rna_RigidBodyCon_path(PointerRNA *ptr) +static char *rna_RigidBodyCon_path(PointerRNA *UNUSED(ptr)) { /* NOTE: this hardcoded path should work as long as only Objects have this */ return BLI_sprintfN("rigid_body_constraint"); @@ -596,13 +604,17 @@ static void rna_RigidBodyCon_motor_ang_target_velocity_set(PointerRNA *ptr, floa } /* Sweep test */ -static void rna_RigidBodyWorld_convex_sweep_test(RigidBodyWorld *rbw, ReportList *reports, Object *object, float ray_start[3], float ray_end[3], float r_location[3], float r_hitpoint[3], float r_normal[3], int *r_hit) +static void rna_RigidBodyWorld_convex_sweep_test( + RigidBodyWorld *rbw, ReportList *reports, + Object *object, float ray_start[3], float ray_end[3], + float r_location[3], float r_hitpoint[3], float r_normal[3], int *r_hit) { #ifdef WITH_BULLET RigidBodyOb *rob = object->rigidbody_object; if (rbw->physics_world != NULL && rob->physics_object != NULL) { - RB_world_convex_sweep_test(rbw->physics_world, rob->physics_object, ray_start, ray_end, r_location, r_hitpoint, r_normal, r_hit); + RB_world_convex_sweep_test(rbw->physics_world, rob->physics_object, ray_start, ray_end, + r_location, r_hitpoint, r_normal, r_hit); if (*r_hit == -2) { BKE_report(reports, RPT_ERROR, "A non convex collision shape was passed to the function, use only convex collision shapes"); @@ -612,6 +624,9 @@ static void rna_RigidBodyWorld_convex_sweep_test(RigidBodyWorld *rbw, ReportList *r_hit = -1; BKE_report(reports, RPT_ERROR, "Rigidbody world was not properly initialized, need to step the simulation first"); } +#else + (void)rbw, (void)reports, (void)object, (void)ray_start, (void)ray_end; + (void)r_location, (void)r_hitpoint, (void)r_normal, (void)r_hit; #endif } @@ -764,6 +779,7 @@ static void rna_def_rigidbody_object(BlenderRNA *brna) prop = RNA_def_property(srna, "collision_shape", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "shape"); RNA_def_property_enum_items(prop, rigidbody_object_shape_items); + RNA_def_property_enum_funcs(prop, NULL, "rna_RigidBodyOb_shape_set", NULL); RNA_def_property_ui_text(prop, "Collision Shape", "Collision Shape of object in Rigid Body Simulations"); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_update(prop, NC_OBJECT | ND_POINTCACHE, "rna_RigidBodyOb_reset"); diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index e58bf2598f7..4d35acc84a0 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -219,6 +219,13 @@ EnumPropertyItem snap_uv_element_items[] = { # define R_IMF_ENUM_TIFF #endif +#ifdef WITH_OPENIMAGEIO +# define R_IMF_ENUM_PSD {R_IMF_IMTYPE_PSD, "PSD", ICON_FILE_IMAGE, "Photosp PSD", \ + "Output image in Photoshop PSD format"}, +#else +# define R_IMF_ENUM_PSD +#endif + #define IMAGE_TYPE_ITEMS_IMAGE_ONLY \ R_IMF_ENUM_BMP \ @@ -236,6 +243,7 @@ EnumPropertyItem snap_uv_element_items[] = { R_IMF_ENUM_EXR \ R_IMF_ENUM_HDR \ R_IMF_ENUM_TIFF \ + R_IMF_ENUM_PSD \ EnumPropertyItem image_only_type_items[] = { @@ -781,7 +789,7 @@ static void rna_ImageFormatSettings_file_format_set(PointerRNA *ptr, int value) } } -static EnumPropertyItem *rna_ImageFormatSettings_file_format_itemf(bContext *C, PointerRNA *ptr, +static EnumPropertyItem *rna_ImageFormatSettings_file_format_itemf(bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *UNUSED(free)) { ID *id = ptr->id.data; @@ -793,7 +801,7 @@ static EnumPropertyItem *rna_ImageFormatSettings_file_format_itemf(bContext *C, } } -static EnumPropertyItem *rna_ImageFormatSettings_color_mode_itemf(bContext *C, PointerRNA *ptr, +static EnumPropertyItem *rna_ImageFormatSettings_color_mode_itemf(bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *free) { ImageFormatData *imf = (ImageFormatData *)ptr->data; @@ -838,7 +846,7 @@ static EnumPropertyItem *rna_ImageFormatSettings_color_mode_itemf(bContext *C, P } } -static EnumPropertyItem *rna_ImageFormatSettings_color_depth_itemf(bContext *C, PointerRNA *ptr, +static EnumPropertyItem *rna_ImageFormatSettings_color_depth_itemf(bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *free) { ImageFormatData *imf = (ImageFormatData *)ptr->data; @@ -932,7 +940,7 @@ static void rna_RenderSettings_qtcodecsettings_codecType_set(PointerRNA *ptr, in settings->codecType = quicktime_videocodecType_from_rnatmpvalue(value); } -static EnumPropertyItem *rna_RenderSettings_qtcodecsettings_codecType_itemf(bContext *C, PointerRNA *ptr, +static EnumPropertyItem *rna_RenderSettings_qtcodecsettings_codecType_itemf(bContext *UNUSED(C), PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), int *free) { EnumPropertyItem *item = NULL; @@ -971,7 +979,7 @@ static void rna_RenderSettings_qtcodecsettings_audiocodecType_set(PointerRNA *pt settings->audiocodecType = quicktime_audiocodecType_from_rnatmpvalue(value); } -static EnumPropertyItem *rna_RenderSettings_qtcodecsettings_audiocodecType_itemf(bContext *C, PointerRNA *ptr, +static EnumPropertyItem *rna_RenderSettings_qtcodecsettings_audiocodecType_itemf(bContext *UNUSED(C), PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), int *free) { EnumPropertyItem *item = NULL; @@ -1032,7 +1040,8 @@ static void rna_RenderSettings_active_layer_index_set(PointerRNA *ptr, int value rd->actlay = value; } -static void rna_RenderSettings_active_layer_index_range(PointerRNA *ptr, int *min, int *max, int *softmin, int *softmax) +static void rna_RenderSettings_active_layer_index_range(PointerRNA *ptr, int *min, int *max, + int *UNUSED(softmin), int *UNUSED(softmax)) { RenderData *rd = (RenderData *)ptr->data; @@ -1313,7 +1322,7 @@ static void rna_Scene_simplify_update(Main *bmain, Scene *UNUSED(scene), Pointer rna_Scene_use_simplify_update(bmain, sce, ptr); } -static void rna_Scene_use_persistent_data_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr) +static void rna_Scene_use_persistent_data_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) { Scene *sce = ptr->id.data; @@ -1462,13 +1471,13 @@ static void rna_UnifiedPaintSettings_unprojected_radius_set(PointerRNA *ptr, flo ups->unprojected_radius = value; } -static void rna_UnifiedPaintSettings_radius_update(Main *bmain, Scene *scene, PointerRNA *ptr) +static void rna_UnifiedPaintSettings_radius_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *UNUSED(ptr)) { /* changing the unified size should invalidate */ BKE_paint_invalidate_overlay_all(); } -static char *rna_UnifiedPaintSettings_path(PointerRNA *ptr) +static char *rna_UnifiedPaintSettings_path(PointerRNA *UNUSED(ptr)) { return BLI_strdup("tool_settings.unified_paint_settings"); } @@ -1490,7 +1499,7 @@ static void rna_EditMesh_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *U } } -static char *rna_MeshStatVis_path(PointerRNA *ptr) +static char *rna_MeshStatVis_path(PointerRNA *UNUSED(ptr)) { return BLI_strdup("tool_settings.statvis"); } @@ -1524,7 +1533,7 @@ static void rna_SceneSequencer_update(Main *UNUSED(bmain), Scene *UNUSED(scene), BKE_sequencer_preprocessed_cache_cleanup(); } -static char *rna_ToolSettings_path(PointerRNA *ptr) +static char *rna_ToolSettings_path(PointerRNA *UNUSED(ptr)) { return BLI_strdup("tool_settings"); } @@ -1540,7 +1549,8 @@ static void rna_FreestyleLineSet_linestyle_set(PointerRNA *ptr, PointerRNA value { FreestyleLineSet *lineset = (FreestyleLineSet *)ptr->data; - lineset->linestyle->id.us--; + if (lineset->linestyle) + lineset->linestyle->id.us--; lineset->linestyle = (FreestyleLineStyle *)value.data; lineset->linestyle->id.us++; } @@ -1553,7 +1563,7 @@ static PointerRNA rna_FreestyleSettings_active_lineset_get(PointerRNA *ptr) } static void rna_FreestyleSettings_active_lineset_index_range(PointerRNA *ptr, int *min, int *max, - int *softmin, int *softmax) + int *UNUSED(softmin), int *UNUSED(softmax)) { FreestyleConfig *config = (FreestyleConfig *)ptr->data; @@ -1579,14 +1589,12 @@ static void rna_def_transform_orientation(BlenderRNA *brna) { StructRNA *srna; PropertyRNA *prop; - - const int matrix_dimsize[] = {3, 3}; srna = RNA_def_struct(brna, "TransformOrientation", NULL); prop = RNA_def_property(srna, "matrix", PROP_FLOAT, PROP_MATRIX); RNA_def_property_float_sdna(prop, NULL, "mat"); - RNA_def_property_multi_array(prop, 2, matrix_dimsize); + RNA_def_property_multi_array(prop, 2, rna_matrix_dimsize_3x3); RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE); @@ -2071,8 +2079,8 @@ static void rna_def_statvis(BlenderRNA *brna) {SCE_STATVIS_OVERHANG, "OVERHANG", 0, "Overhang", ""}, {SCE_STATVIS_THICKNESS, "THICKNESS", 0, "Thickness", ""}, {SCE_STATVIS_INTERSECT, "INTERSECT", 0, "Intersect", ""}, - {SCE_STATVIS_DISTORT, "DISTORT", 0, "Distort", ""}, - {SCE_STATVIS_SHARP, "SHARP", 0, "Sharp", ""}, + {SCE_STATVIS_DISTORT, "DISTORT", 0, "Distortion", ""}, + {SCE_STATVIS_SHARP, "SHARP", 0, "Sharp", ""}, {0, NULL, 0, NULL, NULL}}; srna = RNA_def_struct(brna, "MeshStatVis", NULL); @@ -4078,6 +4086,8 @@ static void rna_def_scene_render_data(BlenderRNA *brna) {RE_BAKE_NORMALS, "NORMALS", 0, "Normals", "Bake normals"}, {RE_BAKE_TEXTURE, "TEXTURE", 0, "Textures", "Bake textures"}, {RE_BAKE_DISPLACEMENT, "DISPLACEMENT", 0, "Displacement", "Bake displacement"}, + {RE_BAKE_DERIVATIVE, "DERIVATIVE", 0, "Derivative", "Bake derivative map"}, + {RE_BAKE_VERTEX_COLORS, "VERTEX_COLORS", 0, "Vertex Colors", "Bake vertex colors"}, {RE_BAKE_EMIT, "EMIT", 0, "Emission", "Bake Emit values (glow)"}, {RE_BAKE_ALPHA, "ALPHA", 0, "Alpha", "Bake Alpha values (transparency)"}, {RE_BAKE_MIRROR_INTENSITY, "MIRROR_INTENSITY", 0, "Mirror Intensity", "Bake Mirror values"}, @@ -4664,6 +4674,17 @@ static void rna_def_scene_render_data(BlenderRNA *brna) "Bake to vertex colors instead of to a UV-mapped image"); RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL); + prop = RNA_def_property(srna, "use_bake_user_scale", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "bake_flag", R_BAKE_USERSCALE); + RNA_def_property_ui_text(prop, "User scale", "Use a user scale for the derivative map"); + + prop = RNA_def_property(srna, "bake_user_scale", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "bake_user_scale"); + RNA_def_property_range(prop, 0.0, 1000.0); + RNA_def_property_ui_text(prop, "Scale", + "Instead of automatically normalizing to 0..1, " + "apply a user scale to the derivative map"); + /* stamp */ prop = RNA_def_property(srna, "use_stamp_time", PROP_BOOLEAN, PROP_NONE); diff --git a/source/blender/makesrna/intern/rna_scene_api.c b/source/blender/makesrna/intern/rna_scene_api.c index 375b31e0586..ae6c5e71e6e 100644 --- a/source/blender/makesrna/intern/rna_scene_api.c +++ b/source/blender/makesrna/intern/rna_scene_api.c @@ -142,12 +142,12 @@ static void rna_Scene_collada_export( int use_object_instantiation, int sort_by_name, int export_transformation_type, - int second_life) + int open_sim) { collada_export(scene, filepath, apply_modifiers, export_mesh_type, selected, include_children, include_armatures, include_shapekeys, deform_bones_only, active_uv_only, include_uv_textures, include_material_textures, - use_texture_copies, use_ngons, use_object_instantiation, sort_by_name, export_transformation_type, second_life); + use_texture_copies, use_ngons, use_object_instantiation, sort_by_name, export_transformation_type, open_sim); } #endif @@ -218,7 +218,7 @@ void RNA_api_scene(StructRNA *srna) parm = RNA_def_boolean(func, "use_ngons", 1, "Use NGons", "Keep NGons in Export"); parm = RNA_def_boolean(func, "use_object_instantiation", 1, "Use Object Instances", "Instantiate multiple Objects from same Data"); parm = RNA_def_boolean(func, "sort_by_name", 0, "Sort by Object name", "Sort exported data by Object name"); - parm = RNA_def_boolean(func, "second_life", 0, "Export for Second Life", "Compatibility mode for Second Life"); + parm = RNA_def_boolean(func, "open_sim", 0, "Export for SL/OpenSim", "Compatibility mode for SL, OpenSim and similar online worlds"); parm = RNA_def_int(func, "export_transformation_type", 0, INT_MIN, INT_MAX, "Transformation", "Transformation type for translation, scale and rotation", INT_MIN, INT_MAX); diff --git a/source/blender/makesrna/intern/rna_screen.c b/source/blender/makesrna/intern/rna_screen.c index f9171887bfb..b8269c428a1 100644 --- a/source/blender/makesrna/intern/rna_screen.c +++ b/source/blender/makesrna/intern/rna_screen.c @@ -94,7 +94,7 @@ static void rna_Screen_redraw_update(Main *UNUSED(bmain), Scene *UNUSED(scene), } -static int rna_Screen_is_animation_playing_get(PointerRNA *ptr) +static int rna_Screen_is_animation_playing_get(PointerRNA *UNUSED(ptr)) { return (ED_screen_animation_playing(G.main->wm.first) != NULL); } @@ -213,6 +213,7 @@ static void rna_def_area(BlenderRNA *brna) prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "spacetype"); RNA_def_property_enum_items(prop, space_type_items); + RNA_def_property_enum_default(prop, SPACE_VIEW3D); RNA_def_property_enum_funcs(prop, NULL, "rna_Area_type_set", "rna_Area_type_itemf"); RNA_def_property_ui_text(prop, "Editor Type", "Current editor type for this area"); RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); diff --git a/source/blender/makesrna/intern/rna_sculpt_paint.c b/source/blender/makesrna/intern/rna_sculpt_paint.c index 11b3f94a446..89714e49ebf 100644 --- a/source/blender/makesrna/intern/rna_sculpt_paint.c +++ b/source/blender/makesrna/intern/rna_sculpt_paint.c @@ -190,7 +190,7 @@ static int rna_ParticleEdit_hair_get(PointerRNA *ptr) return 0; } -static char *rna_ParticleEdit_path(PointerRNA *ptr) +static char *rna_ParticleEdit_path(PointerRNA *UNUSED(ptr)) { return BLI_strdup("tool_settings.particle_edit"); } @@ -247,7 +247,7 @@ static void rna_Sculpt_ShowDiffuseColor_update(Main *UNUSED(bmain), Scene *scene } } -static char *rna_Sculpt_path(PointerRNA *ptr) +static char *rna_Sculpt_path(PointerRNA *UNUSED(ptr)) { return BLI_strdup("tool_settings.sculpt"); } @@ -264,17 +264,17 @@ static char *rna_VertexPaint_path(PointerRNA *ptr) } } -static char *rna_ImagePaintSettings_path(PointerRNA *ptr) +static char *rna_ImagePaintSettings_path(PointerRNA *UNUSED(ptr)) { return BLI_strdup("tool_settings.image_paint"); } -static char *rna_UvSculpt_path(PointerRNA *ptr) +static char *rna_UvSculpt_path(PointerRNA *UNUSED(ptr)) { return BLI_strdup("tool_settings.uv_sculpt"); } -static char *rna_ParticleBrush_path(PointerRNA *ptr) +static char *rna_ParticleBrush_path(PointerRNA *UNUSED(ptr)) { return BLI_strdup("tool_settings.particle_edit.brush"); } diff --git a/source/blender/makesrna/intern/rna_sequencer.c b/source/blender/makesrna/intern/rna_sequencer.c index bc50be00ddd..342d94c7667 100644 --- a/source/blender/makesrna/intern/rna_sequencer.c +++ b/source/blender/makesrna/intern/rna_sequencer.c @@ -720,7 +720,7 @@ static Sequence *sequence_get_by_proxy(Editing *ed, StripProxy *proxy) return data.seq; } -static void rna_Sequence_tcindex_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr) +static void rna_Sequence_tcindex_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) { Scene *scene = (Scene *) ptr->id.data; Editing *ed = BKE_sequencer_editing_get(scene, FALSE); diff --git a/source/blender/makesrna/intern/rna_smoke.c b/source/blender/makesrna/intern/rna_smoke.c index 8b01a785f1e..ba90e3b1e4a 100644 --- a/source/blender/makesrna/intern/rna_smoke.c +++ b/source/blender/makesrna/intern/rna_smoke.c @@ -65,7 +65,7 @@ static void rna_Smoke_dependency_update(Main *bmain, Scene *scene, PointerRNA *p DAG_relations_tag_update(bmain); } -static void rna_Smoke_resetCache(Main *bmain, Scene *scene, PointerRNA *ptr) +static void rna_Smoke_resetCache(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) { SmokeDomainSettings *settings = (SmokeDomainSettings *)ptr->data; if (settings->smd && settings->smd->domain) diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index c2a8b25013e..41ea74ebb8c 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -406,23 +406,12 @@ static void rna_SpaceView3D_layer_update(Main *bmain, Scene *UNUSED(scene), Poin DAG_on_visible_update(bmain, FALSE); } -static void rna_SpaceView3D_viewport_shade_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) +static void rna_SpaceView3D_viewport_shade_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr) { View3D *v3d = (View3D *)(ptr->data); ScrArea *sa = rna_area_from_space(ptr); - if (v3d->drawtype != OB_RENDER) { - ARegion *ar; - - for (ar = sa->regionbase.first; ar; ar = ar->next) { - RegionView3D *rv3d = ar->regiondata; - - if (rv3d && rv3d->render_engine) { - RE_engine_free(rv3d->render_engine); - rv3d->render_engine = NULL; - } - } - } + ED_view3d_shade_update(bmain, v3d, sa); } static void rna_SpaceView3D_matcap_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) @@ -628,7 +617,7 @@ static PointerRNA rna_SpaceImageEditor_uvedit_get(PointerRNA *ptr) return rna_pointer_inherit_refine(ptr, &RNA_SpaceUVEditor, ptr->data); } -static void rna_SpaceImageEditor_mode_update(Main *bmain, Scene *scene, PointerRNA *ptr) +static void rna_SpaceImageEditor_mode_update(Main *bmain, Scene *scene, PointerRNA *UNUSED(ptr)) { ED_space_image_paint_update(bmain->wm.first, scene->toolsettings); } @@ -856,8 +845,8 @@ static void rna_SpaceProperties_context_set(PointerRNA *ptr, int value) sbuts->mainbuser = value; } -static EnumPropertyItem *rna_SpaceProperties_context_itemf(bContext *C, PointerRNA *ptr, - PropertyRNA *UNUSED(prop), int *free) +static EnumPropertyItem *rna_SpaceProperties_context_itemf(bContext *UNUSED(C), PointerRNA *ptr, + PropertyRNA *UNUSED(prop), int *free) { SpaceButs *sbuts = (SpaceButs *)(ptr->data); EnumPropertyItem *item = NULL; @@ -1003,7 +992,8 @@ static void rna_ConsoleLine_body_set(PointerRNA *ptr, const char *value) ci->cursor = len; } -static void rna_ConsoleLine_cursor_index_range(PointerRNA *ptr, int *min, int *max, int *softmin, int *softmax) +static void rna_ConsoleLine_cursor_index_range(PointerRNA *ptr, int *min, int *max, + int *UNUSED(softmin), int *UNUSED(softmax)) { ConsoleLine *ci = (ConsoleLine *)ptr->data; @@ -1346,6 +1336,12 @@ static void rna_def_space_mask_info(StructRNA *srna, int noteflag, const char *m { PropertyRNA *prop; + static EnumPropertyItem overlay_mode_items[] = { + {MASK_OVERLAY_ALPHACHANNEL, "ALPHACHANNEL", ICON_NONE, "Alpha Channel", "Show alpha channel of the mask"}, + {MASK_OVERLAY_COMBINED, "COMBINED", ICON_NONE, "Combined", "Combine space background image with the mask"}, + {0, NULL, 0, NULL, NULL} + }; + prop = RNA_def_property(srna, "mask", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "mask_info.mask"); RNA_def_property_flag(prop, PROP_EDITABLE); @@ -1364,6 +1360,17 @@ static void rna_def_space_mask_info(StructRNA *srna, int noteflag, const char *m RNA_def_property_boolean_sdna(prop, NULL, "mask_info.draw_flag", MASK_DRAWFLAG_SMOOTH); RNA_def_property_ui_text(prop, "Draw Smooth Splines", ""); RNA_def_property_update(prop, noteflag, NULL); + + prop = RNA_def_property(srna, "show_mask_overlay", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "mask_info.draw_flag", MASK_DRAWFLAG_OVERLAY); + RNA_def_property_ui_text(prop, "Show Mask Overlay", ""); + RNA_def_property_update(prop, noteflag, NULL); + + prop = RNA_def_property(srna, "mask_overlay_mode", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "mask_info.overlay_mode"); + RNA_def_property_enum_items(prop, overlay_mode_items); + RNA_def_property_ui_text(prop, "Overlay Mode", "Overlay mode of rasterized mask"); + RNA_def_property_update(prop, noteflag, NULL); } static void rna_def_space_image_uv(BlenderRNA *brna) @@ -1694,7 +1701,6 @@ static void rna_def_space_view3d(BlenderRNA *brna) { StructRNA *srna; PropertyRNA *prop; - const int matrix_dimsize[] = {4, 4}; static EnumPropertyItem pivot_items[] = { {V3D_CENTER, "BOUNDING_BOX_CENTER", ICON_ROTATE, "Bounding Box Center", @@ -2114,12 +2120,12 @@ static void rna_def_space_view3d(BlenderRNA *brna) prop = RNA_def_property(srna, "perspective_matrix", PROP_FLOAT, PROP_MATRIX); RNA_def_property_float_sdna(prop, NULL, "persmat"); RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* XXX: for now, it's too risky for users to do this */ - RNA_def_property_multi_array(prop, 2, matrix_dimsize); + RNA_def_property_multi_array(prop, 2, rna_matrix_dimsize_4x4); RNA_def_property_ui_text(prop, "Perspective Matrix", "Current perspective matrix of the 3D region"); prop = RNA_def_property(srna, "view_matrix", PROP_FLOAT, PROP_MATRIX); RNA_def_property_float_sdna(prop, NULL, "viewmat"); - RNA_def_property_multi_array(prop, 2, matrix_dimsize); + RNA_def_property_multi_array(prop, 2, rna_matrix_dimsize_4x4); RNA_def_property_float_funcs(prop, NULL, "rna_RegionView3D_view_matrix_set", NULL); RNA_def_property_ui_text(prop, "View Matrix", "Current view matrix of the 3D region"); RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); diff --git a/source/blender/makesrna/intern/rna_test.c b/source/blender/makesrna/intern/rna_test.c index e54e5f9bcad..cf0dc5e332d 100644 --- a/source/blender/makesrna/intern/rna_test.c +++ b/source/blender/makesrna/intern/rna_test.c @@ -185,7 +185,8 @@ void RNA_def_test(BlenderRNA *brna) RNA_def_property_flag(prop, PROP_DYNAMIC); RNA_def_property_dynamic_array_funcs(prop, "rna_Test_bdmarr_get_length", "rna_Test_bdmarr_set_length"); RNA_def_property_boolean_funcs(prop, "rna_Test_bdmarr_get", "rna_Test_bdmarr_set"); - +#else + (void)brna; #endif } diff --git a/source/blender/makesrna/intern/rna_texture.c b/source/blender/makesrna/intern/rna_texture.c index 2c68661f3bd..a26272b34ce 100644 --- a/source/blender/makesrna/intern/rna_texture.c +++ b/source/blender/makesrna/intern/rna_texture.c @@ -184,7 +184,7 @@ static void rna_Texture_mapping_update(Main *bmain, Scene *scene, PointerRNA *pt rna_Texture_update(bmain, scene, ptr); } -static void rna_Color_mapping_update(Main *bmain, Scene *scene, PointerRNA *ptr) +static void rna_Color_mapping_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *UNUSED(ptr)) { /* nothing to do */ } @@ -366,7 +366,7 @@ static int rna_TextureSlot_output_node_get(PointerRNA *ptr) } -static EnumPropertyItem *rna_TextureSlot_output_node_itemf(bContext *C, PointerRNA *ptr, +static EnumPropertyItem *rna_TextureSlot_output_node_itemf(bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *free) { MTex *mtex = ptr->data; @@ -478,7 +478,7 @@ static char *rna_VoxelData_path(PointerRNA *UNUSED(ptr)) return BLI_sprintfN("voxel_data"); } -static char *rna_OceanTex_path(PointerRNA *ptr) +static char *rna_OceanTex_path(PointerRNA *UNUSED(ptr)) { return BLI_sprintfN("ocean"); } @@ -495,6 +495,14 @@ static void rna_def_texmapping(BlenderRNA *brna) {0, NULL, 0, NULL, NULL} }; + static EnumPropertyItem prop_vect_type_items[] = { + {TEXMAP_TYPE_TEXTURE, "TEXTURE", 0, "Texture", "Transform a texture by inverse mapping the texture coordinate"}, + {TEXMAP_TYPE_POINT, "POINT", 0, "Point", "Transform a point"}, + {TEXMAP_TYPE_VECTOR, "VECTOR", 0, "Vector", "Transform a direction vector"}, + {TEXMAP_TYPE_NORMAL, "NORMAL", 0, "Normal", "Transform a normal vector with unit length"}, + {0, NULL, 0, NULL, NULL} + }; + static EnumPropertyItem prop_xyz_mapping_items[] = { {0, "NONE", 0, "None", ""}, {1, "X", 0, "X", ""}, @@ -509,6 +517,12 @@ static void rna_def_texmapping(BlenderRNA *brna) srna = RNA_def_struct(brna, "TexMapping", NULL); RNA_def_struct_ui_text(srna, "Texture Mapping", "Texture coordinate mapping settings"); + prop = RNA_def_property(srna, "vector_type", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "type"); + RNA_def_property_enum_items(prop, prop_vect_type_items); + RNA_def_property_ui_text(prop, "Type", "Type of vector that the mapping transforms"); + RNA_def_property_update(prop, 0, "rna_Texture_mapping_update"); + prop = RNA_def_property(srna, "translation", PROP_FLOAT, PROP_TRANSLATION); RNA_def_property_float_sdna(prop, NULL, "loc"); RNA_def_property_ui_text(prop, "Location", ""); diff --git a/source/blender/makesrna/intern/rna_tracking.c b/source/blender/makesrna/intern/rna_tracking.c index 0feaec85e38..97f5c24dc56 100644 --- a/source/blender/makesrna/intern/rna_tracking.c +++ b/source/blender/makesrna/intern/rna_tracking.c @@ -124,7 +124,8 @@ static void rna_tracking_active_object_index_set(PointerRNA *ptr, int value) BKE_tracking_dopesheet_tag_update(&clip->tracking); } -static void rna_tracking_active_object_index_range(PointerRNA *ptr, int *min, int *max, int *softmin, int *softmax) +static void rna_tracking_active_object_index_range(PointerRNA *ptr, int *min, int *max, + int *UNUSED(softmin), int *UNUSED(softmax)) { MovieClip *clip = (MovieClip *)ptr->id.data; @@ -362,7 +363,8 @@ static void rna_tracking_stabTracks_active_index_set(PointerRNA *ptr, int value) clip->tracking.stabilization.act_track = value; } -static void rna_tracking_stabTracks_active_index_range(PointerRNA *ptr, int *min, int *max, int *softmin, int *softmax) +static void rna_tracking_stabTracks_active_index_range(PointerRNA *ptr, int *min, int *max, + int *UNUSED(softmin), int *UNUSED(softmax)) { MovieClip *clip = (MovieClip *)ptr->id.data; @@ -525,7 +527,7 @@ static void rna_tracking_markerPattern_boundbox_get(PointerRNA *ptr, float *valu copy_v2_v2(values + 2, max); } -static void rna_trackingDopesheet_tagUpdate(Main *UNUSED(bmain), Scene *scene, PointerRNA *ptr) +static void rna_trackingDopesheet_tagUpdate(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) { MovieClip *clip = (MovieClip *)ptr->id.data; MovieTrackingDopesheet *dopesheet = &clip->tracking.dopesheet; @@ -709,9 +711,6 @@ static EnumPropertyItem pattern_match_items[] = { {0, NULL, 0, NULL, NULL} }; -static int rna_matrix_dimsize_4x4[] = {4, 4}; -static int rna_matrix_dimsize_4x2[] = {4, 2}; - static void rna_def_trackingSettings(BlenderRNA *brna) { StructRNA *srna; diff --git a/source/blender/makesrna/intern/rna_ui.c b/source/blender/makesrna/intern/rna_ui.c index 40bc0d3973e..39f305f7d47 100644 --- a/source/blender/makesrna/intern/rna_ui.c +++ b/source/blender/makesrna/intern/rna_ui.c @@ -166,7 +166,7 @@ static void panel_draw_header(const bContext *C, Panel *pnl) RNA_parameter_list_free(&list); } -static void rna_Panel_unregister(Main *bmain, StructRNA *type) +static void rna_Panel_unregister(Main *UNUSED(bmain), StructRNA *type) { ARegionType *art; PanelType *pt = RNA_struct_blender_type_get(type); @@ -268,7 +268,7 @@ static StructRNA *rna_Panel_refine(PointerRNA *ptr) } /* UIList */ -static unsigned int rna_UIList_filter_const_FILTER_ITEM_get(PointerRNA *ptr) +static unsigned int rna_UIList_filter_const_FILTER_ITEM_get(PointerRNA *UNUSED(ptr)) { return UILST_FLT_ITEM; } diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c index 3b609b69374..20e5083b1c4 100644 --- a/source/blender/makesrna/intern/rna_userdef.c +++ b/source/blender/makesrna/intern/rna_userdef.c @@ -505,6 +505,7 @@ static EnumPropertyItem *rna_userdef_audio_device_itemf(bContext *UNUSED(C), Poi return item; } #else + (void)free; return audio_device_items; #endif } diff --git a/source/blender/makesrna/intern/rna_wm.c b/source/blender/makesrna/intern/rna_wm.c index 71e3d86387b..c6366745c55 100644 --- a/source/blender/makesrna/intern/rna_wm.c +++ b/source/blender/makesrna/intern/rna_wm.c @@ -590,7 +590,7 @@ static void rna_Window_screen_set(PointerRNA *ptr, PointerRNA value) win->newscreen = value.data; } -int rna_Window_screen_assign_poll(PointerRNA *ptr, PointerRNA value) +int rna_Window_screen_assign_poll(PointerRNA *UNUSED(ptr), PointerRNA value) { bScreen *screen = (bScreen *)value.id.data; diff --git a/source/blender/makesrna/intern/rna_wm_api.c b/source/blender/makesrna/intern/rna_wm_api.c index 824fed98338..eb84bb61e1f 100644 --- a/source/blender/makesrna/intern/rna_wm_api.c +++ b/source/blender/makesrna/intern/rna_wm_api.c @@ -118,7 +118,7 @@ struct wmStaticProgress { } wm_progress_state = {0, 0, false}; -static void rna_progress_begin(struct wmWindowManager *wm, float min, float max) +static void rna_progress_begin(struct wmWindowManager *UNUSED(wm), float min, float max) { float range = max - min; if (range != 0) { @@ -262,6 +262,18 @@ static wmKeyMap *rna_keymap_find_modal(wmKeyConfig *UNUSED(keyconf), const char return ot->modalkeymap; } +static void rna_KeyMap_remove(wmKeyConfig *keyconfig, ReportList *reports, PointerRNA *keymap_ptr) +{ + wmKeyMap *keymap = keymap_ptr->data; + + if (WM_keymap_remove(keyconfig, keymap) == FALSE) { + BKE_reportf(reports, RPT_ERROR, "KeyConfig '%s' cannot be removed", keymap->idname); + return; + } + + RNA_POINTER_INVALIDATE(keymap_ptr); +} + static void rna_KeyConfig_remove(wmWindowManager *wm, ReportList *reports, PointerRNA *keyconf_ptr) { wmKeyConfig *keyconf = keyconf_ptr->data; @@ -671,6 +683,12 @@ void RNA_api_keymaps(StructRNA *srna) parm = RNA_def_pointer(func, "keymap", "KeyMap", "Key Map", "Added key map"); RNA_def_function_return(func, parm); + func = RNA_def_function(srna, "remove", "rna_KeyMap_remove"); /* remove_keymap */ + RNA_def_function_flag(func, FUNC_USE_REPORTS); + parm = RNA_def_pointer(func, "keymap", "KeyMap", "Key Map", "Removed key map"); + RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL | PROP_RNAPTR); + RNA_def_property_clear_flag(parm, PROP_THICK_WRAP); + func = RNA_def_function(srna, "find", "rna_keymap_find"); /* find_keymap */ parm = RNA_def_string(func, "name", "", 0, "Name", ""); RNA_def_property_flag(parm, PROP_REQUIRED); |