Help with lookdev template for maya

Hi,
new ayon user here.

I’m trying to setup a lookdev template for maya so it automatically imports the model and has a a look publish already setup. This is the template:

When creating a workfile from the template everything works, but on the publish step i get an error. Looking in the outliner it seems that the placeholder locator is still in the look set, which is why the error pops up.

Is there something I’m missing with the template setup? Is this the intended behavior?

Thank you

How interesting - so it seems that we’ve filtered locators by default from getting cbId attributes - which may be debatable about whether that was the right decision.

In this case however, I’d say the locator should not remain there after having build the template. I think this error may already be avoided if you have “Delete placeholders” or something enabled. I believe that’s in settings?

(Unless you absolutely need the placeholders to be maintained.)

Hi Roy, thank you for the quick reply.
I cannot find the Delete Placeholders option. Do you know where it’s located?

It should be in settings - but I can’t seem to find it myself.

It does exist in Nuke:

But not for Maya:

Could you create an issue to track this on ayon-maya?


A workaround for now may be to force generate an id in the workfile template itself. Select the placeholder locator and run this in Python in Maya:

"""Force generate new cbId values on selected nodes, even if they don't have any yet"""
from ayon_maya.api import lib
from maya import cmds


def force_generate_ids(nodes):
    """Generate new cbIds on selected nodes, even if they don't have any yet"""
    with lib.undo_chunk():
        for node, id in lib.generate_ids(nodes):
            print("Setting cbId on {node}: {id}".format(node=node, id=id))
            lib.set_id(node, id, overwrite=True)


nodes = cmds.ls(dag=True, sl=True, long=True)
nodes += cmds.ls(sl=True, long=True)  # also include non-dag nodes
force_generate_ids(nodes)

That way it would have the necessary attribute. But then you may get into the case that it doesn’t allow it to contain ids that are not relevant to the asset you’re publishing in that particular context. So I’m not sure that really solves it.

Thank you for your help, will create an issue later today.

For now, i found a workaround to delete the placeholders.

I create a placeholder that runs this script after build:

from maya import cmds
# Placeholders to delete
del_nodes = ["Context_model_folder"]

for node in del_nodes:
	cmds.delete(node)
	
# Delete script placeholder
cmds.delete(placeholder.scene_identifier)

Ah, look at that - I suppose the Script Placeholder happens to be useful!

You could even create the Script Placeholder as object set if I’m not mistaken. From which, in the script, you can trivial access its members… as such, you can then just make the placeholder to delete a member of the script placeholder object set instead of having to hardcode the name. :exploding_head:

Have fun!

from maya import cmds

placeholder_node = placeholder.scene_identifier
members = cmds.sets(placeholder_node, query=True)
if members:
    cmds.delete(members)       # Delete any members
cmds.delete(placeholder_node)  # Cleanup self
1 Like

Oh nice, thank you!
That’s a way more elegant solution