Entity under Task found in context

Hi,

We have a folder representing the software name under the Task folder in our schema.
It used to be a simple folder, and now it’s a Software Entity.
For some reason, Maya sets the Context’s Entity to the Software, when Houdini and Nuke don’t. With Houdini and Nuke, the Context’s Entity is the Asset (or Shot).
The only difference seems to be that the maya folder, defined as a Software Entity in the schema, has its own folder and yml, when the other softwares are created via a generic folder using the software name.

The following error appears when saving a new scene:

// Error: Shotgun 1f5a04b23213444fbb414ee500050260: Could not refresh the engine; error: ‘Engine tk-maya cannot initialize - the pick environment hook was not able to return an environment to use, given the context model, Software Maya. Usually this is because the context contains insufficient information for an environment to be determined.’
Traceback (most recent call last):
File “/app/user/alefeve/package/tk_core/0.19.6-sps.1.0/studio/install/app_store/tk-maya/v0.10.1/engine.py”, line 208, in on_scene_event_callback
refresh_engine(engine_name, prev_context, menu_name)
File “/app/user/alefeve/package/tk_core/0.19.6-sps.1.0/studio/install/app_store/tk-maya/v0.10.1/engine.py”, line 199, in refresh_engine
current_engine.change_context(ctx)
File “/app/user/alefeve/package/tk_core/0.19.6-sps.1.0/studio/install/core/python/tank/platform/engine.py”, line 778, in change_context
engine_name=self.instance_name, tk=self.tank, context=new_context
File “/app/user/alefeve/package/tk_core/0.19.6-sps.1.0/studio/install/core/python/tank/platform/engine.py”, line 3382, in get_env_and_descriptor_for_engine
env_name = __pick_environment(engine_name, tk, context)
File “/app/user/alefeve/package/tk_core/0.19.6-sps.1.0/studio/install/core/python/tank/platform/engine.py”, line 3429, in __pick_environment
“for an environment to be determined.” % (engine_name, context)
TankEngineInitError: Engine tk-maya cannot initialize - the pick environment hook was not able to return an environment to use, given the context model, Software Maya. Usually this is because the context contains insufficient information for an environment to be determined. //
// Error: Message: Shotgun encountered a problem changing the Engine’s context.
Please contact support@shotgunsoftware.com

The other problem is that, in Maya, the files created before the use of the Software Entity still have a Context with the Entity set to the Asset, even when deleting their caches, when all new Entities have the Software as Context’s Entity.

Can anyone help on this?

1 Like

Hi @Alefeve

Thanks for reaching us. I have two questions.

  • Is it a new configure?
  • Does it happen to any asset? or just one asset in a project?

Thanks

Loney

1 Like

Hi Loney,

  • Yes, it’s DefCon2.

Actually, I’ve been able to find the source of the issue.
We have a field on Tasks to link Softwares. And in our schema, the software folder is created with the following rules:

type: "shotgun_entity"
name: "{engine:^tk-(.*)}"
entity_type: "Software"

filters:
- { "path": "task_sg_softwares_tasks", "relation": "is", "values": ["$Task"] }
- { "path": "engine", "relation": "is", "values": ["tk-maya"] }

# recurse down from parent folder
create_with_parent: true

With this config, when the Software is in the Task field, it’s used in the context, but when it’s not, the folder is still created, but the context uses the Entity (Shot/Asset) instead of the Software. I suppose there’s something wrong with the config because there are several Tasks with the same name any of them connected to the Software makes the condition True.
What do you think about it?

Is there a way to prevent sgtk from using this Entity in the context, and always use the Shot/Asset?

1 Like

Hi Alex – There’s no way to tell Toolkit which entity in the schema it should use for the entity in the context. I wonder if it would work for you to, rather than having a shotgun_entity folder, to actually have a shotgun_task folder and use the dot notation to bubble through from the task entity to its linked Software entity? Admittedly, I haven’t tested this, but it might work better?

1 Like

Hi Tannaz,

I suppose i would, but the problem is we have several Software Entities in the Task field. So I don’t think this would work. But I’ll give it a try!

2 Likes