Skip to content

Commit

Permalink
Convert ABOUT_TO_SAVE to _about_to_save
Browse files Browse the repository at this point in the history
Value is not a public constant, but a private global
  • Loading branch information
BigRoy committed Apr 2, 2024
1 parent 878719e commit 57d2250
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 23 deletions.
18 changes: 9 additions & 9 deletions client/ayon_core/hosts/fusion/api/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
INVENTORY_PATH = os.path.join(PLUGINS_DIR, "inventory")

# Track whether the workfile tool is about to save
ABOUT_TO_SAVE = False
_about_to_save = False


class FusionLogHandler(logging.Handler):
Expand Down Expand Up @@ -176,15 +176,15 @@ def on_save(event):
validate_comp_prefs(comp)

# We are now starting the actual save directly
global ABOUT_TO_SAVE
ABOUT_TO_SAVE = False
global _about_to_save
_about_to_save = False


def on_task_changed():
global ABOUT_TO_SAVE
print(f"Task changed: {ABOUT_TO_SAVE}")
global _about_to_save
print(f"Task changed: {_about_to_save}")
# TODO: Only do this if not headless
if ABOUT_TO_SAVE:
if _about_to_save:
# Let's prompt the user to update the context settings or not
prompt_reset_context()

Expand Down Expand Up @@ -228,7 +228,7 @@ def before_workfile_save(event):
# have been shut down, and restarted - which will restart it to the
# environment Fusion started with; not necessarily where the artist
# is currently working.
# The `ABOUT_TO_SAVE` var is used to detect context changes when
# The `_about_to_save` var is used to detect context changes when
# saving into another asset. If we keep it False it will be ignored
# as context change. As such, before we change tasks we will only
# consider it the current filepath is within the currently known
Expand All @@ -239,8 +239,8 @@ def before_workfile_save(event):
filepath = comp.GetAttrs()["COMPS_FileName"]
workdir = os.environ.get("AYON_WORKDIR")
if Path(workdir) in Path(filepath).parents:
global ABOUT_TO_SAVE
ABOUT_TO_SAVE = True
global _about_to_save
_about_to_save = True


def ls():
Expand Down
14 changes: 7 additions & 7 deletions client/ayon_core/hosts/houdini/api/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
INVENTORY_PATH = os.path.join(PLUGINS_DIR, "inventory")

# Track whether the workfile tool is about to save
ABOUT_TO_SAVE = False
_about_to_save = False


class HoudiniHost(HostBase, IWorkfileHost, ILoadHost, IPublishHost):
Expand Down Expand Up @@ -292,8 +292,8 @@ def ls():


def before_workfile_save(event):
global ABOUT_TO_SAVE
ABOUT_TO_SAVE = True
global _about_to_save
_about_to_save = True


def before_save():
Expand All @@ -308,13 +308,13 @@ def on_save():
lib.update_houdini_vars_context_dialog()

# We are now starting the actual save directly
global ABOUT_TO_SAVE
ABOUT_TO_SAVE = False
global _about_to_save
_about_to_save = False


def on_task_changed():
global ABOUT_TO_SAVE
if not IS_HEADLESS and ABOUT_TO_SAVE:
global _about_to_save
if not IS_HEADLESS and _about_to_save:
# Let's prompt the user to update the context settings or not
lib.prompt_reset_context()

Expand Down
14 changes: 7 additions & 7 deletions client/ayon_core/hosts/maya/api/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
AVALON_CONTAINERS = ":AVALON_CONTAINERS"

# Track whether the workfile tool is about to save
ABOUT_TO_SAVE = False
_about_to_save = False


class MayaHost(HostBase, IWorkfileHost, ILoadHost, IPublishHost):
Expand Down Expand Up @@ -585,8 +585,8 @@ def on_save():
lib.set_id(node, new_id, overwrite=False)

# We are now starting the actual save directly
global ABOUT_TO_SAVE
ABOUT_TO_SAVE = False
global _about_to_save
_about_to_save = False


def on_open():
Expand Down Expand Up @@ -657,8 +657,8 @@ def on_task_changed():
lib.set_context_settings()
lib.update_content_on_context_change()

global ABOUT_TO_SAVE
if not lib.IS_HEADLESS and ABOUT_TO_SAVE:
global _about_to_save
if not lib.IS_HEADLESS and _about_to_save:
# Let's prompt the user to update the context settings or not
lib.prompt_reset_context()

Expand All @@ -676,8 +676,8 @@ def before_workfile_save(event):
if workdir_path:
create_workspace_mel(workdir_path, project_name)

global ABOUT_TO_SAVE
ABOUT_TO_SAVE = True
global _about_to_save
_about_to_save = True


def workfile_save_before_xgen(event):
Expand Down

0 comments on commit 57d2250

Please sign in to comment.