From c32ea0c02bb6b975c9df4a51bd8d807104eaf49f Mon Sep 17 00:00:00 2001 From: loonghao Date: Tue, 14 May 2024 23:42:58 +0800 Subject: [PATCH] feat: Add new hook for fix no scene name Signed-off-by: loonghao --- maya_umbrella/hooks/fix_no_scene_name.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 maya_umbrella/hooks/fix_no_scene_name.py diff --git a/maya_umbrella/hooks/fix_no_scene_name.py b/maya_umbrella/hooks/fix_no_scene_name.py new file mode 100644 index 0000000..fe57c3f --- /dev/null +++ b/maya_umbrella/hooks/fix_no_scene_name.py @@ -0,0 +1,15 @@ +# Import built-in modules +import os + +# Import local modules +from maya_umbrella.maya_funs import cmds +from maya_umbrella.maya_funs import om + + +def hook(virus_cleaner): + if not cmds.file(query=1, sceneName=1): + scene_name = om.currentFile() + scene_name = scene_name.replace("\\", "/") + + if os.path.exists(scene_name): + cmds.file(rename=scene_name)