Commit: e910ac7c3d2d5adc514ce3d78b15ef08b75c57a5
Author: Martin Felke
Date:   Wed Apr 10 00:42:48 2019 +0200
Branches: sculpt-mode-features
https://developer.blender.org/rBe910ac7c3d2d5adc514ce3d78b15ef08b75c57a5

disabling an operand now skips unnecessary calculations

useful when transforming the disabled operand for example

===================================================================

M       intern/openvdb/intern/openvdb_level_set.cc
M       source/blender/editors/object/object_modifier.c
M       source/blender/makesrna/intern/rna_modifier.c
M       source/blender/modifiers/intern/MOD_remesh.c

===================================================================

diff --git a/intern/openvdb/intern/openvdb_level_set.cc 
b/intern/openvdb/intern/openvdb_level_set.cc
index 280b008f369..c95cbceb10f 100644
--- a/intern/openvdb/intern/openvdb_level_set.cc
+++ b/intern/openvdb/intern/openvdb_level_set.cc
@@ -119,8 +119,8 @@ void 
OpenVDBLevelSet::OpenVDB_level_set_filter(OpenVDBLevelSet_FilterType filter
 }
 openvdb::FloatGrid::Ptr 
OpenVDBLevelSet::OpenVDB_CSG_operation(openvdb::FloatGrid::Ptr gridA, 
openvdb::FloatGrid::Ptr gridB, OpenVDBLevelSet_CSGOperation operation)
 {
-       openvdb::FloatGrid::Ptr gridA_copy = gridA->deepCopy();
-       openvdb::FloatGrid::Ptr gridB_copy = gridB->deepCopy();
+       openvdb::FloatGrid::Ptr gridA_copy = gridA;//->deepCopy();
+       openvdb::FloatGrid::Ptr gridB_copy = gridB;//->deepCopy();
 
        switch (operation) {
                case OPENVDB_LEVELSET_CSG_UNION:
diff --git a/source/blender/editors/object/object_modifier.c 
b/source/blender/editors/object/object_modifier.c
index 5babeed6b9b..b40df6158b7 100644
--- a/source/blender/editors/object/object_modifier.c
+++ b/source/blender/editors/object/object_modifier.c
@@ -2413,6 +2413,7 @@ static bool remesh_csg_poll(bContext *C)
 static int remesh_csg_add_exec(bContext *C, wmOperator *op)
 {
        Object *ob = ED_object_active_context(C);
+       Main *bmain = CTX_data_main(C);
        RemeshModifierData *rmd = (RemeshModifierData 
*)edit_modifier_property_get(op, ob, eModifierType_Remesh);
 
        if (rmd == NULL) {
@@ -2425,6 +2426,11 @@ static int remesh_csg_add_exec(bContext *C, wmOperator 
*op)
        vcob->flag |= MOD_REMESH_CSG_SYNC_VOXEL_SIZE;
        BLI_addtail(&rmd->csg_operands, vcob);
 
+       if (BLI_listbase_is_single(&rmd->csg_operands)) {
+               /*trigger update to detach modifier transform relation from 
modifier */
+               DEG_relations_tag_update(bmain);
+       }
+
        DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY | 
ID_RECALC_COPY_ON_WRITE);
        WM_event_add_notifier(C, NC_OBJECT | ND_MODIFIER, ob);
 
@@ -2459,6 +2465,7 @@ void REMESH_OT_csg_add(wmOperatorType *ot)
 static int remesh_csg_remove_exec(bContext *C, wmOperator *op)
 {
        Object *ob = ED_object_active_context(C);
+       Main *bmain = CTX_data_main(C);
        RemeshModifierData *rmd = (RemeshModifierData 
*)edit_modifier_property_get(op, ob, eModifierType_Remesh);
        int index = RNA_int_get(op->ptr, "index");
 
@@ -2471,6 +2478,11 @@ static int remesh_csg_remove_exec(bContext *C, 
wmOperator *op)
                BLI_remlink(&rmd->csg_operands, vcob);
        }
 
+       if (BLI_listbase_is_empty(&rmd->csg_operands)) {
+               /*trigger update to detach modifier transform relation from 
modifier */
+               DEG_relations_tag_update(bmain);
+       }
+
        DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY | 
ID_RECALC_COPY_ON_WRITE);
        WM_event_add_notifier(C, NC_OBJECT | ND_MODIFIER, ob);
 
diff --git a/source/blender/makesrna/intern/rna_modifier.c 
b/source/blender/makesrna/intern/rna_modifier.c
index 8477485681a..6084d1499fb 100644
--- a/source/blender/makesrna/intern/rna_modifier.c
+++ b/source/blender/makesrna/intern/rna_modifier.c
@@ -4285,11 +4285,11 @@ static void rna_def_modifier_remesh(BlenderRNA *brna)
        prop = RNA_def_property(srna, "enabled", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "flag", 
MOD_REMESH_CSG_OBJECT_ENABLED);
        RNA_def_property_ui_text(prop, "Enabled", "Consider this object as part 
of the csg operations");
-       RNA_def_property_update(prop, 0, "rna_Modifier_update");
+       RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
 
        prop = RNA_def_property(srna, "sync_voxel_size", PROP_BOOLEAN, 
PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "flag", 
MOD_REMESH_CSG_SYNC_VOXEL_SIZE);
-       RNA_def_property_ui_text(prop, "Sync Voxel Size", "Consider this object 
as part of the csg operations");
+       RNA_def_property_ui_text(prop, "Sync Voxel Size", "Keep voxel size in 
sync");
        RNA_def_property_update(prop, 0, "rna_Modifier_update");
 }
 
diff --git a/source/blender/modifiers/intern/MOD_remesh.c 
b/source/blender/modifiers/intern/MOD_remesh.c
index 5d6d7296147..7259745a509 100644
--- a/source/blender/modifiers/intern/MOD_remesh.c
+++ b/source/blender/modifiers/intern/MOD_remesh.c
@@ -385,13 +385,16 @@ static void updateDepsgraph(ModifierData *md, const 
ModifierUpdateDepsgraphConte
 
        for (vcob = rmd->csg_operands.first; vcob; vcob = vcob->next)
        {
-               if (vcob->object != NULL) {
+               if (vcob->object && (vcob->flag & 
MOD_REMESH_CSG_OBJECT_ENABLED)) {
                        DEG_add_object_relation(ctx->node, vcob->object, 
DEG_OB_COMP_TRANSFORM, "Remesh Modifier");
                        DEG_add_object_relation(ctx->node, vcob->object, 
DEG_OB_COMP_GEOMETRY, "Remesh Modifier");
                }
        }
-       /* We need own transformation as well. */
-       DEG_add_modifier_to_transform_relation(ctx->node, "Remesh Modifier");
+
+       if (rmd->csg_operands.first) {
+               /* We need own transformation as well in case we have operands 
*/
+               DEG_add_modifier_to_transform_relation(ctx->node, "Remesh 
Modifier");
+       }
 }
 
 static void copyData(const ModifierData *md_src, ModifierData *md_dst, const 
int flag)

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to