shotgunsoftware/tk-multi-breakdown2

Maya scene operations - Flag must be passed a boolean argument

EfthymisB opened this issue · 5 comments

Hello,

Ever since I rebased to v0.2.5, I'm getting the following error when running maya_scene_operations hook (it doesn't happen in Houdini).

// SG tk-maya: Toolkit platform was restarted. // 
// Error: SG tk-multi-breakdown2: File Model: Failed to find the latest published file for id 9: Flag 'long' must be passed a boolean argument // 
// Error: SG tk-multi-breakdown2: Traceback (most recent call last):
  File "/home/efthymios-b/pipe_config_dev/install/app_store/tk-framework-shotgunutils/v5.8.4/python/task_manager/worker_thread.py", line 82, in run
    result = task_to_process.run()
  File "/home/efthymios-b/pipe_config_dev/install/app_store/tk-framework-shotgunutils/v5.8.4/python/task_manager/background_task.py", line 139, in run
    return self._cbl(*self._args, **self._kwargs)
  File "/home/efthymios-b/pipe_config_dev/install/core/python/tank/log.py", line 514, in wrapper
    response = func(*args, **kwargs)
  File "/home/efthymios-b/git_repos/tk-multi-breakdown2/python/tk_multi_breakdown2/api/manager.py", line 40, in scan_scene
    "hook_scene_operations", "scan_scene"
  File "/home/efthymios-b/pipe_config_dev/install/core/python/tank/platform/bundle.py", line 628, in execute_hook_method
    resolved_hook_paths, self, method_name, base_class=base_class, **kwargs
  File "/home/efthymios-b/pipe_config_dev/install/core/python/tank/hook.py", line 631, in execute_hook_method
    ret_val = hook_method(**kwargs)
  File "/home/efthymios-b/pipe_config_dev/config/hooks/tk-multi-breakdown2/tk-maya_scene_operations.py", line 100, in scan_scene
    self._scan_textures()
  File "/home/efthymios-b/pipe_config_dev/config/hooks/tk-multi-breakdown2/tk-maya_scene_operations.py", line 123, in _scan_textures
    self._scan_node(self.TEXTURE.TYPE, self.TEXTURE.ATTR)
  File "/home/efthymios-b/pipe_config_dev/config/hooks/tk-multi-breakdown2/tk-maya_scene_operations.py", line 152, in _scan_node
    for node in cmds.ls(type=node_type, long=True):
TypeError: Flag 'long' must be passed a boolean argument
 // 

I saw that you had a similar issue with the query flag on cmds.file.
I did a test where I completely removed the long arg but I got the same error, this time on another command that again, expects a boolean argument.
Do you know what could cause this?

Linux Centos 7
Maya 2020.4

Thanks,
Efthymios

Hi @EfthymisB -- yes we also ran into it seems a similar issue with the query param. We believe the underlying issue is related to running Maya commands using the Toolkit background task manager, instead of executing in the main thread. We are looking into a solution for this.

Hey,
I've found a solution for now. Seems like when executing scan_scene in the main thread, I'm not getting any errors. Is this ok or it might cause issues elsewhere?

scene_objects = self._bundle.execute_in_main_thread(
                                self._bundle.execute_hook_method, "houk_scene_operations", "scan_scene"
                           )        

@EfthymisB can you provide a more complete code sample here, which file and where are you adding this change? It also seems that you might have a typo in the hook name houk_scene_operation

Hey,
That's on the scan_scene method of the BreakdownManager, I've linked the exact line on my previous comment, sorry if it wasn't clear (link). You also have a (related?) TODO comment there.

(indeed that's a type, should be hook_scene_operations)

Can we get a fix for this?