diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2020-03-03 14:35:51 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2020-03-13 16:14:56 +0300 |
commit | bc0a0cdf171037cba4076c796e9adb2769382561 (patch) | |
tree | 518cf488b585fa0440989e756db10d5c3cd3f6a1 /source/blender/editors/object | |
parent | b0a1af4eb10f6c771a49401e9d0c4c56f6f6d008 (diff) |
Multires: Fix Subdivide, Reshape and Apply Base
This change fixes artifacts produced by these operations.
On a technical aspect this is done by porting all of the operations
to the new subdivision surface implementation which ensures that
tangent space used to evaluate modifier and those operations is
exactly the same (before modifier will use new code and the operations
will still use an old one).
The next step is to get sculpting on a non-top level to work, and
that actually requires fixes in the undo system.
Diffstat (limited to 'source/blender/editors/object')
-rw-r--r-- | source/blender/editors/object/object_modifier.c | 31 | ||||
-rw-r--r-- | source/blender/editors/object/object_relations.c | 2 |
2 files changed, 16 insertions, 17 deletions
diff --git a/source/blender/editors/object/object_modifier.c b/source/blender/editors/object/object_modifier.c index bac40b35102..31c4f96693c 100644 --- a/source/blender/editors/object/object_modifier.c +++ b/source/blender/editors/object/object_modifier.c @@ -686,7 +686,7 @@ static int modifier_apply_obdata( } if (mmd && mmd->totlvl && mti->type == eModifierTypeType_OnlyDeform) { - if (!multiresModifier_reshapeFromDeformModifier(depsgraph, mmd, ob, md_eval)) { + if (!multiresModifier_reshapeFromDeformModifier(depsgraph, ob, mmd, md_eval)) { BKE_report(reports, RPT_ERROR, "Multires modifier returned error, skipping apply"); return 0; } @@ -1375,26 +1375,25 @@ void OBJECT_OT_multires_higher_levels_delete(wmOperatorType *ot) static int multires_subdivide_exec(bContext *C, wmOperator *op) { - Scene *scene = CTX_data_scene(C); - Object *ob = ED_object_active_context(C); + Object *object = ED_object_active_context(C); MultiresModifierData *mmd = (MultiresModifierData *)edit_modifier_property_get( - op, ob, eModifierType_Multires); + op, object, eModifierType_Multires); if (!mmd) { return OPERATOR_CANCELLED; } - multiresModifier_subdivide(mmd, scene, ob, 0, mmd->simple); + multiresModifier_subdivide(object, mmd); ED_object_iter_other( - CTX_data_main(C), ob, true, ED_object_multires_update_totlevels_cb, &mmd->totlvl); + CTX_data_main(C), object, true, ED_object_multires_update_totlevels_cb, &mmd->totlvl); - DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY); - WM_event_add_notifier(C, NC_OBJECT | ND_MODIFIER, ob); + DEG_id_tag_update(&object->id, ID_RECALC_GEOMETRY); + WM_event_add_notifier(C, NC_OBJECT | ND_MODIFIER, object); - if (ob->mode & OB_MODE_SCULPT) { + if (object->mode & OB_MODE_SCULPT) { /* ensure that grid paint mask layer is created */ - BKE_sculpt_mask_layers_ensure(ob, mmd); + BKE_sculpt_mask_layers_ensure(object, mmd); } return OPERATOR_FINISHED; @@ -1614,19 +1613,19 @@ void OBJECT_OT_multires_external_pack(wmOperatorType *ot) /********************* multires apply base ***********************/ static int multires_base_apply_exec(bContext *C, wmOperator *op) { - Scene *scene = CTX_data_scene(C); - Object *ob = ED_object_active_context(C); + Depsgraph *depsgraph = CTX_data_depsgraph_pointer(C); + Object *object = ED_object_active_context(C); MultiresModifierData *mmd = (MultiresModifierData *)edit_modifier_property_get( - op, ob, eModifierType_Multires); + op, object, eModifierType_Multires); if (!mmd) { return OPERATOR_CANCELLED; } - multiresModifier_base_apply(mmd, scene, ob); + multiresModifier_base_apply(depsgraph, object, mmd); - DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY); - WM_event_add_notifier(C, NC_OBJECT | ND_MODIFIER, ob); + DEG_id_tag_update(&object->id, ID_RECALC_GEOMETRY); + WM_event_add_notifier(C, NC_OBJECT | ND_MODIFIER, object); return OPERATOR_FINISHED; } diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c index c7bba43758f..29bf9e88853 100644 --- a/source/blender/editors/object/object_relations.c +++ b/source/blender/editors/object/object_relations.c @@ -1586,7 +1586,7 @@ static int make_links_data_exec(bContext *C, wmOperator *op) DEG_id_tag_update(&ob_dst->id, ID_RECALC_COPY_ON_WRITE); break; case MAKE_LINKS_MODIFIERS: - BKE_object_link_modifiers(scene, ob_dst, ob_src); + BKE_object_link_modifiers(ob_dst, ob_src); DEG_id_tag_update(&ob_dst->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY | ID_RECALC_ANIMATION); break; |