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

Updated from_path call to support pipeline configurations with no path using descriptors #492

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

burninghelix123
Copy link

@burninghelix123 burninghelix123 commented Jul 12, 2017

With the new zero config and descriptors setup, the python api can no longer check if a path is part of a particular pipeline configuration. This is because paths are currently being used to do the check, and when using a descriptor the pipeline configuration has no path set. This becomes extremely obvious in the error message that occurs stating that the path is "None":

# Error: TankError: file C:\...\pipelineconfig_factory.py line 247: You are trying to start Toolkit using the pipeline configuration located in 'C:\...\p180c71.basic.desktop\cfg'. The path 'R:\...\scene.ma' you are trying to load is not associated with that configuration. Instead, it is associated with the following pipeline configurations: 'None' (Pipeline config id 71, Project id 180).

This small suggested change switches the check to look at ID which we know is always unique rather than a path. This fixes the issues with using descriptors while also providing a likely safer way of verifying a path is part of a pipeline configuration. We already have the ID for associated pipeline configurations so we only have to add a small piece of code to get the ID for the current pipeline configuration.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.03%) to 57.041% when pulling dddfab3 on burninghelix123:master into 79469f2 on shotgunsoftware:master.

@burninghelix123
Copy link
Author

burninghelix123 commented Jul 12, 2017

I realize a test case for this problem might be useful:

  1. Create a pipeline configuration in Shotgun using a descriptor and make sure that the path field for windows/mac/linux is empty.
  2. Make sure that the desktop app still functions and that you can open Maya.
  3. Open/Create a file in that project so that you have a valid path.
  4. A. Open the script editor and in a python tab run:
import sgtk
sgtk.sgtk_from_path(pm.sceneName())
  1. B. Alternatively to see what is actually happening behind the hood, here's the commands that are run when using sgtk_from_path which is all under _from_path in pipelineconfig_factory.py:
import sgtk
path = os.path.abspath(pm.sceneName())
sg_data = sgtk.pipelineconfig_factory._get_pipeline_configs(True)
associated_sg_pipeline_configs = sgtk.pipelineconfig_factory._get_pipeline_configs_for_path(path, sg_data)
(all_pc_data, primary_pc_data) = sgtk.pipelineconfig_factory._get_pipeline_configuration_data(associated_sg_pipeline_configs)
config_context_path = sgtk.pipelineconfig_factory._get_configuration_context()
if config_context_path not in [x["path"] for x in all_pc_data]:
    raise sgtk.TankError("Path configuration does not match current confiugration")

As you can see in this, path will always be None, so the TankError will always be raised in both of these examples.

renaudll added a commit to SqueezeStudioAnimation/tk-core that referenced this pull request Aug 21, 2017
renaudll added a commit to SqueezeStudioAnimation/tk-framework-desktopstartup that referenced this pull request Sep 22, 2017
@jfboismenu
Copy link
Contributor

Hi @burninghelix123, we think this was fixed a while back. Could you update to that version of tk-core and confirm if you've haven't already?

@jfboismenu jfboismenu self-assigned this Apr 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants