diff --git a/release/scripts/startup/bl_ui/properties_object.py b/release/scripts/startup/bl_ui/properties_object.py index 1858e703faf1..1b04de2199f6 100644 --- a/release/scripts/startup/bl_ui/properties_object.py +++ b/release/scripts/startup/bl_ui/properties_object.py @@ -89,6 +89,7 @@ def draw(self, context): col = layout.column() col.prop(ob, "override_game_transform_priority", text="Override logic transform priority") + col.prop(ob, "override_game_depsgraph", text="Override Depsgraph") class OBJECT_PT_delta_transform(ObjectButtonsPanel, Panel): diff --git a/source/blender/makesdna/DNA_object_types.h b/source/blender/makesdna/DNA_object_types.h index f29c71267d4a..d7c8ed5ee56e 100644 --- a/source/blender/makesdna/DNA_object_types.h +++ b/source/blender/makesdna/DNA_object_types.h @@ -736,6 +736,7 @@ enum { /* runtime constraints disable */ OB_NO_CONSTRAINTS = 1 << 13, OB_TRANSFLAG_OVERRIDE_GAME_PRIORITY = 1 << 14, // UPBGE + OB_TRANSFLAG_OVERRIDE_DEPSGRAPH = 1 << 15, // UPBGE OB_DUPLI = OB_DUPLIVERTS | OB_DUPLICOLLECTION | OB_DUPLIFACES | OB_DUPLIPARTS, }; diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c index d8e7c6bfd4d8..b748a5d1f447 100644 --- a/source/blender/makesrna/intern/rna_object.c +++ b/source/blender/makesrna/intern/rna_object.c @@ -4382,6 +4382,11 @@ static void rna_def_object(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Override game transform priority", "Override logic transform with depsgraph autotransform"); + prop = RNA_def_property(srna, "override_game_depsgraph", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "transflag", OB_TRANSFLAG_OVERRIDE_DEPSGRAPH); + RNA_def_property_ui_text(prop, + "Ignore Depsgraph", + "Ignore all transformations and depsgraph updates for this object."); /* End of UPBGE */ /* Parent_inverse. */ diff --git a/source/gameengine/Ketsji/KX_GameObject.cpp b/source/gameengine/Ketsji/KX_GameObject.cpp index 6945143383fe..a56d97b4d40b 100644 --- a/source/gameengine/Ketsji/KX_GameObject.cpp +++ b/source/gameengine/Ketsji/KX_GameObject.cpp @@ -252,6 +252,14 @@ void KX_GameObject::ForceIgnoreParentTx() void KX_GameObject::TagForTransformUpdate(bool is_overlay_pass, bool is_last_render_pass) { + Object *ob_orig = GetBlenderObject(); + + bool skip_depsgraph = ob_orig->transflag & OB_TRANSFLAG_OVERRIDE_DEPSGRAPH; + if (skip_depsgraph){ + // Ignore all depsgraph updates and skip this object + return; + } + float object_to_world[4][4]; NodeGetWorldTransform().getValue(&object_to_world[0][0]); bool staticObject = true; @@ -279,8 +287,6 @@ void KX_GameObject::TagForTransformUpdate(bool is_overlay_pass, bool is_last_ren Main *bmain = CTX_data_main(C); Depsgraph *depsgraph = CTX_data_depsgraph_on_load(C); - Object *ob_orig = GetBlenderObject(); - bool skip_transform = ob_orig->transflag & OB_TRANSFLAG_OVERRIDE_GAME_PRIORITY; /* Don't tag non overlay collection objects in overlay collection render pass */ skip_transform = skip_transform || @@ -336,14 +342,20 @@ void KX_GameObject::TagForTransformUpdate(bool is_overlay_pass, bool is_last_ren void KX_GameObject::TagForTransformUpdateEvaluated() { + Object *ob_orig = GetBlenderObject(); + + bool skip_depsgraph = ob_orig->transflag & OB_TRANSFLAG_OVERRIDE_DEPSGRAPH; + if (skip_depsgraph){ + // Ignore all depsgraph updates and skip this object + return; + } + float object_to_world[4][4]; NodeGetWorldTransform().getValue(&object_to_world[0][0]); bContext *C = KX_GetActiveEngine()->GetContext(); Depsgraph *depsgraph = CTX_data_depsgraph_on_load(C); - Object *ob_orig = GetBlenderObject(); - bool skip_transform = ob_orig->transflag & OB_TRANSFLAG_OVERRIDE_GAME_PRIORITY; if (skip_transform) {