View Full Version : Scripting Query:
dushyantk
January 10th, 2011, 08:07 AM
Hello everyone,
I was wondering if there's any way of executing a piece of code as soon I open a comp.
pingking
January 10th, 2011, 03:04 PM
yeah, this is possible
look here (http://vfxpedia.com/index.php?title=Eyeon:Script/General_Concepts/Script_Libraries_and_Event_Scripting)
dushyantk
January 10th, 2011, 10:34 PM
thanks, this works...
pingking
January 11th, 2011, 12:29 PM
no problem
another side with some more active fusion gurus is pigsfly.com (http://pigsfly.com/forums)
this side is now so nuke heavy and sometimes its hard to get help in the other sections
dushyantk
February 10th, 2011, 01:11 AM
hi pingking, one more trouble I'd like to share,
Is it possible to get some variables from one comp and apply to another while running the same script.
Basically, I want to take the file path from current comp's saver, open a new comp and put that path into a Loader.
bfloch
February 11th, 2011, 09:56 AM
hi pingking, one more trouble I'd like to share,
Is it possible to get some variables from one comp and apply to another while running the same script.
Basically, I want to take the file path from current comp's saver, open a new comp and put that path into a Loader.
Totally since you should have access to the fusion variable.
You can get the path from a comp and create a new comp with:
filepath = comp.Loader.Clip[comp.CurrentTime]
newcomp = fusion:NewComp(True)
newcomp.Loader({Clip = filepath})
newcomp.Unlock()
I'm not using much Lua recently so forgive if it doesn't work but maybe you get the idea.
Compare the reference:
NewComp (http://vfxpedia.com/index.php?title=Eyeon:Script/Reference/Applications/Fusion/Classes/Fusion/NewComp)
bfloch
February 11th, 2011, 10:17 AM
If you need access to open comps use GetCompList (http://vfxpedia.com/index.php?title=Eyeon:Script/Reference/Applications/Fusion/Classes/Fusion/GetCompList)
dushyantk
February 12th, 2011, 12:42 AM
Thanks, that was really helpful, though I'm not creating a new comp but opening existing one, GetCompList is something new for me.
Here's my actual situation, if I'am in comp1 and running the script to get saver path, thn opening existing slate comp (comp2), and tryin to put tht variable in MainLoader of comp2,
while doing this, the script looks for MainLoader before opening the new comp and gives error...
Actually MainLoader is a comp variable, which will becomes available only when comp2 two is active and then the script is called again :)
For the mean time I've solved it by writing and reading variables in a temp text file. Thanks for looking into it.
bfloch
February 12th, 2011, 09:31 AM
Please take a look of what other functions the fusion object has to offer:
LoadComp (http://vfxpedia.com/index.php?title=Eyeon:Script/Reference/Applications/Fusion/Classes/Fusion/LoadComp)
This way you can OPEN a comp.
filepath = comp.Loader.Clip[comp.CurrentTime]
newcomp = fusion:LoadComp("C:\PATHTOMY\comp.comp", True)
newcomp.Loader({Clip = filepath})
newcomp.Unlock()
dushyantk
February 12th, 2011, 04:17 PM
That's amazing, so many ways to do the same thing :) but there's always a way...'ll get back to you as soon as I test it.
bfloch
February 12th, 2011, 07:27 PM
Actually they all do something different. The question is what YOU want them to do?
For beginners it really is best to browse through vfxpedia to see what the API is capable of.
dushyantk
June 22nd, 2011, 05:42 AM
Hey Guys, got a new problem:confused:, this time Nuke ONE...wish you know what I mean...Wrong place to post it, but just to get attention ....
I am creating a panel this way: :niceone:
def panel_example():
sequenceList = ['A B C']
splitShotA = ['A A A']
splitShotB = ['B B B']
splitShotC = ['C C C']
p = nuke.Panel("Browser Panel")
p.addEnumerationPulldown("Select Sequence:", ''.join(sequenceList))
p.addEnumerationPulldown("Select Shot:", ' '.join(splitShotA))
p.addMultilineTextInput("Add Notes:", multilineTextInput)
p.addBooleanCheckBox("Save Local:", booleanCheckBox)
p.addButton("Cancel")
p.addButton("Create")
result = p.show()
enumVal = p.value("Select Sequence:")
if enumVal is not None:
print "Select Sequence: ", enumVal
boolVal = p.value("Save Local:")
if boolVal is not None:
print "Save Local:", boolVal
panel_example()
Here am calling a list in Pull Down "Select Sequence"
What I want to do now is when user selects B in Sequence List Shot List should be recreated and be populated with splitShotB list....
Any help 'd be greately appreciated...:radar: OR i'll pull my hairs off!!! :scorching::splat: