You can pull them from globals(), but it may be easier/more flexible long-term
to change your script layout so each show’s Nuke environment is bootstrapped
from its own Python package (or, say, a singleton project class of some kind)
instead of just via an init.py. That way, you can define your show-level
variables in that package or class and always know where to find them.
-Nathan
From: Dan Walker
Sent: Thursday, April 12, 2012 10:49 AM
To: Nuke Python discussion ; Nuke user discussion
Subject: [Nuke-python] Nuke python scripts won't recognize init.py variables
Hey all,
Is there a way to have Nuke python scripts recognize init.py variables?
------------------------------------------------------------------------------------------------------------------------------------
SHOW_NUKE_CONFIG/init.py
show_resolution = ("1920 1080 1.0 ")
projectNameShortUpper = project_entity["short_name"].upper() ## NSN
------------------------------------------------------------------------------------------------------------------------------------
Nuke's menu.py ( SHOW_NUKE_CONFIG/versions/v001/menu.py ) picks up the
(SHOW_NUKE_CONFIG/init.py) variables but, show specific python scripts
won't?!?!?!?
------------------------------------------------------------------------------------------------------------------------------------
SHOW_NUKE_CONFIG/versions/v001/nuke_python/myPythonScript.py
import nuke
import os
import re
def showSettings():
show_format = nuke.addFormat[show_resolution + projectNameShortUpper]
nuke.root()['format'].setValue(show_format)
nuke.root()['fps'].setValue(frame_rate)
nuke.root()['proxy_type'].setValue(1)
nuke.root()['proxy_format'].setValue(show_format)
nuke.root()['proxy_scale'].setValue(1)
------------------------------------------------------------------------------------------------------------------------------------
Thanks,
Dan
--------------------------------------------------------------------------------
_______________________________________________
Nuke-python mailing list
[email protected], http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python
_______________________________________________
Nuke-python mailing list
[email protected], http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python