>>-Is there a way to have Nuke use the entire subdirectory for the pluginAddPath? E.G., only need '/WORK
>>/Nuke/IN_PRODUCTION/' and not the other two?

No, you have to explicitly add the directories. There are scripts hovering around that are triggered via the menu.py that recurse through the sub tree and run nuke.pluginAddPath on each one, so you can totally roll your own logic here.

I personally prefer setting the path to the main repository via an environment variable on each machine, then using nuke.pluginAddPath in a init.py within that main repo to load sub directories. But that's just me.

>>-Under /scripts/ I have several .py files, do I need to explicitly "from myscript1 import *" for every file in that folder, or is
>>there a way to bring in all files under that dir?
It depends on how you want to organise yourcode. There are several ways to manage your files via name spaces. Have a read about packages here:
https://docs.python.org/2/tutorial/modules.html


>>-Do I need to explicitly import appropriate modules for each script in .py file itself? E.G. myscript1.py calls nuke.XYZ(), if I >>don't put "import nuke" in that file it throws an error, but "import nuke" is called ahead of myscript1.py in the menu.py file... you have to import the module into the name space you are trying to access it from. When the menu.py does "import nuke", that module is imported to a different name space than your code is run from (i.e. scripts.myscripts1)



On 18/11/14 9:45 am, Matthew Doll wrote:
Hiya folks, I'm certain this has been answered but I cannot find it in the archives...

I am trying to append my plugin path to a generic dumping ground like so:

nuke.pluginAddPath('/WORK/Nuke/IN_PRODUCTION/')
nuke.pluginAddPath('/WORK/Nuke/IN_PRODUCTION/nodes/')
nuke.pluginAddPath('/WORK/Nuke/IN_PRODUCTION/scripts/')

Under '/WORK/Nuke/IN_PRODUCTION/' I have a menu.py where I want to import all the nodes under /nodes/ and scripts under /scripts/

My question is threefold:

-Is there a way to have Nuke use the entire subdirectory for the pluginAddPath? E.G., only need '/WORK/Nuke/IN_PRODUCTION/' and not the other two?

-Under /scripts/ I have several .py files, do I need to explicitly "from myscript1 import *" for every file in that folder, or is there a way to bring in all files under that dir?

-Do I need to explicitly import appropriate modules for each script in .py file itself? E.G. myscript1.py calls nuke.XYZ(), if I don't put "import nuke" in that file it throws an error, but "import nuke" is called ahead of myscript1.py in the menu.py file...


Thanks,
Matt


_______________________________________________
Nuke-python mailing list
Nuke-python@support.thefoundry.co.uk, http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python

--
ohufxLogo 50x50 <http://www.ohufx.com> *vfx compositing <http://ohufx.com/index.php/vfx-compositing> | *workflow customisation and consulting <http://ohufx.com/index.php/vfx-customising>* *

_______________________________________________
Nuke-python mailing list
Nuke-python@support.thefoundry.co.uk, http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python

Reply via email to