diff options
Diffstat (limited to 'source/blender/makesrna/intern/rna_modifier.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_modifier.c | 54 |
1 files changed, 48 insertions, 6 deletions
diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c index 26bb83fe6e8..2a125625681 100644 --- a/source/blender/makesrna/intern/rna_modifier.c +++ b/source/blender/makesrna/intern/rna_modifier.c @@ -755,6 +755,47 @@ static void rna_HookModifier_object_set(PointerRNA *ptr, BKE_object_modifier_hook_reset(owner, hmd); } +static bool rna_HookModifier_object_override_apply(Main *UNUSED(bmain), + PointerRNA *ptr_dst, + PointerRNA *ptr_src, + PointerRNA *ptr_storage, + PropertyRNA *prop_dst, + PropertyRNA *prop_src, + PropertyRNA *UNUSED(prop_storage), + const int len_dst, + const int len_src, + const int len_storage, + PointerRNA *UNUSED(ptr_item_dst), + PointerRNA *UNUSED(ptr_item_src), + PointerRNA *UNUSED(ptr_item_storage), + IDOverrideLibraryPropertyOperation *opop) +{ + BLI_assert(len_dst == len_src && (!ptr_storage || len_dst == len_storage) && len_dst == 0); + BLI_assert(opop->operation == IDOVERRIDE_LIBRARY_OP_REPLACE && + "Unsupported RNA override operation on Hook modifier target objet pointer"); + UNUSED_VARS_NDEBUG(ptr_storage, len_dst, len_src, len_storage, opop); + + /* We need a special handling here because setting hook target resets invert parent matrix, + * which is evil in our case. */ + HookModifierData *hmd = ptr_dst->data; + Object *owner = (Object *)ptr_dst->owner_id; + Object *target_dst = RNA_property_pointer_get(ptr_dst, prop_dst).data; + Object *target_src = RNA_property_pointer_get(ptr_src, prop_src).data; + + BLI_assert(target_dst == hmd->object); + + if (target_src == target_dst) { + return false; + } + + hmd->object = target_src; + if (target_src == NULL) { + /* The only case where we do want default behavior (with matrix reset). */ + BKE_object_modifier_hook_reset(owner, hmd); + } + return true; +} + static void rna_HookModifier_subtarget_set(PointerRNA *ptr, const char *value) { Object *owner = (Object *)ptr->owner_id; @@ -874,7 +915,7 @@ static void rna_MultiresModifier_type_set(PointerRNA *ptr, int value) Object *ob = (Object *)ptr->owner_id; MultiresModifierData *mmd = (MultiresModifierData *)ptr->data; - multires_force_update(ob); + multires_force_sculpt_rebuild(ob); mmd->simple = value; } @@ -1346,7 +1387,7 @@ static void rna_CorrectiveSmoothModifier_update(Main *bmain, Scene *scene, Point { CorrectiveSmoothModifierData *csmd = (CorrectiveSmoothModifierData *)ptr->data; - MEM_SAFE_FREE(csmd->delta_cache); + MEM_SAFE_FREE(csmd->delta_cache.deltas); rna_Modifier_update(bmain, scene, ptr); } @@ -2021,7 +2062,7 @@ static void rna_def_modifier_decimate(BlenderRNA *brna) prop = RNA_def_property(srna, "use_dissolve_boundaries", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_DECIM_FLAG_ALL_BOUNDARY_VERTS); RNA_def_property_ui_text( - prop, "All Boundaries", "Dissolve all vertices inbetween face boundaries (planar only)"); + prop, "All Boundaries", "Dissolve all vertices in between face boundaries (planar only)"); RNA_def_property_update(prop, 0, "rna_Modifier_update"); prop = RNA_def_property(srna, "delimit", PROP_ENUM, PROP_NONE); @@ -2289,6 +2330,7 @@ static void rna_def_modifier_hook(BlenderRNA *brna) prop, "Object", "Parent Object for hook, also recalculates and clears offset"); RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK); RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); + RNA_def_property_override_funcs(prop, NULL, NULL, "rna_HookModifier_object_override_apply"); RNA_def_property_pointer_funcs(prop, NULL, "rna_HookModifier_object_set", NULL, NULL); RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update"); @@ -3040,7 +3082,7 @@ static void rna_def_modifier_cast(BlenderRNA *brna) prop = RNA_def_property(srna, "use_transform", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_CAST_USE_OB_TRANSFORM); RNA_def_property_ui_text( - prop, "Use transform", "Use object transform to control projection shape"); + prop, "Use Transform", "Use object transform to control projection shape"); RNA_def_property_update(prop, 0, "rna_Modifier_update"); prop = RNA_def_property(srna, "factor", PROP_FLOAT, PROP_FACTOR); @@ -5862,7 +5904,7 @@ static void rna_def_modifier_surfacedeform(BlenderRNA *brna) prop = RNA_def_property(srna, "falloff", PROP_FLOAT, PROP_NONE); RNA_def_property_range(prop, 2.0f, 16.0f); RNA_def_property_ui_text( - prop, "Interpolation falloff", "Controls how much nearby polygons influence deformation"); + prop, "Interpolation Falloff", "Controls how much nearby polygons influence deformation"); RNA_def_property_update(prop, 0, "rna_Modifier_update"); prop = RNA_def_property(srna, "is_bound", PROP_BOOLEAN, PROP_NONE); @@ -6013,7 +6055,7 @@ void RNA_def_modifier(BlenderRNA *brna) RNA_def_property_boolean_sdna(prop, NULL, "mode", eModifierMode_ApplyOnSpline); RNA_def_property_ui_text( prop, - "Apply on spline", + "Apply on Spline", "Apply this and all preceding deformation modifiers on splines' points rather than " "on filled curve/surface"); RNA_def_property_ui_icon(prop, ICON_SURFACE_DATA, 0); |