pyblish / pyblish-starter

A basic asset creation pipeline - batteries included. http://pyblish.com/pyblish-starter
MIT License
17 stars 9 forks source link

Static default root #6

Open mottosso opened 8 years ago

mottosso commented 8 years ago

Description

The root directory governs (1) where assets are published and (2) where assets are loaded from.

By default, the root directory is set to the current project directory, but doesn't update when the user changes the project.

This causes assets to be published into and loaded from the wrong location.

BigRoy commented 8 years ago

This could be resolved by using a load and save callback that automatically identifies whether the new location is still within the old project. If it is not it can update the "set project" to the new one.

Or are you looking for different solutions?

mottosso commented 8 years ago

It could, and I was doing exactly that, until I realised that it doesn't work since the root directory isn't necessarily the Maya project directory. That's just a default, and a pretty inflexible one at that. It's meant to be set to wherever you host assets.

For completeness, here's how I was doing that.

from maya import cmds
from pyblish_starter import api

def on_setproject():
    api.register_root(...)

cmds.scriptJob(event=["workspaceChanged", on_setproject])
cmds.workspace("C:/my/project", openWorkspace=True)
BigRoy commented 8 years ago

Ah, but that is on workspace changed. That would still require the artist to actually update manually by "setting project"? Why not do it on scene save/load (whenever the current path changes) and you identify automatically what is actually the project root?

Either way, you'd need to have a means of identifying what is the project. You could maybe tag it using cquery?

mottosso commented 8 years ago

Wait, I think you're misunderstanding.

Starter has the notion of a "root". The root directory could be anywhere, and isn't related to Maya. The command register_root enables the user to specify this directory, and it just so happens that by calling pyblish_starter.install() passing pyblish_starter.maya it sets this for you as the currently active project directory.

This isn't really the place to discuss it, this is more me documenting limitations for others to read about and to inspire how and why one would build it differently. Starter was never meant to be the most optimal implementation of a pipeline, but the simplest, and the things you suggest are good and practical solutions, but also takes away from how easily the implementation is explained.