Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Add Ignore Depsgraph option #1794

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions release/scripts/startup/bl_ui/properties_object.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
1 change: 1 addition & 0 deletions source/blender/makesdna/DNA_object_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
Expand Down
5 changes: 5 additions & 0 deletions source/blender/makesrna/intern/rna_object.c
Original file line number Diff line number Diff line change
Expand Up @@ -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. */
Expand Down
20 changes: 16 additions & 4 deletions source/gameengine/Ketsji/KX_GameObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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 ||
Expand Down Expand Up @@ -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) {
Expand Down