This topic came up a few times on the mailing list already. Heres an a part from the discussion I created February this year (vertexSelection updates in a loop):
On 27/02/14 06:47, Ben DIckson wrote: > fr = nuke.FrameRange(1, 100, 1) > ct = nuke.nodes.CurveTool() > ct['label'].setValue("Temp curvetool to update frames") > for frame in fr: > nuke.execute(ct, frame, frame) > # ...vertexSelection stuff... > nuke.delete(ct) # Clean up hacky CurveTool > >Theoretically this should be the same as doing nuke.frame(2) >nuke.frame(3) etc, but.. as Frank described, it's not. > >It seems like nuke.frame(framenum) should trigger the update always.. >but I guess there might be cases where this wouldn't be desired..? > >Alternatively nuke.frame(framenum, refresh=True) or something, or just a generic nuke.refresh() type method that could be called might be a good compromise On 27/02/14 06:47, Frank Rueter wrote: > Many of us have been fighting this for years. > One of the quick& (very) dirty workarounds is to create a dummy node > that can be executed (i.e. CurveTool), execute it to force Nuke to > re-evaluate the stream, then delete it. Do this for every > iteration/frame and you should get the correct values if I remember > correctly. > I don't think the dummy node has to be connected to the nodes you are > working with but haven't done this in a while myself. > > Afterwards don't forget to log a bug report to get this resolved > finally. Maybe we could ask for a flag to set that forces Nuke to > re-evaluate during a python loop, then set another flag to turn off > that behaviour again if it means staying more efficient. > > Cheers, > frank I cant agree more, please submit a bug report! Von: nuke-python-boun...@support.thefoundry.co.uk [mailto:nuke-python-boun...@support.thefoundry.co.uk] Im Auftrag von Johannes Hezer Gesendet: Samstag, 9. August 2014 14:09 An: nuke-python@support.thefoundry.co.uk Betreff: Re: [Nuke-python] 3dposition won't update every frame when using a forloop. http://www.nukepedia.com/python/3d/animatedsnap3d/ This is probably what you are after. Cheers Johannes Am 8/9/14 14:04 PM, schrieb Erwan Leroy: There is a built in function that does pretty much that, when you click "match position" and select the animated one. I'm pretty sure I saw the code for that in the reference, you might want to look at it. On 9 Aug 2014 12:41, "Justin Fpc" <j.grosde...@gmail.com> wrote: Hi ! I found a workaround a while ago to update the viewer to the next frame. You want to use a curveTool node. In your python script before the loop create your node then execute it for frame "i" in your loop. I don't have access to my scripts but you can refere to the Nuke python api. Don't forget to delete your CurveTool node at the end of your script. Cheers, Justin 2014-08-09 12:21 GMT+01:00 Wouter Gilsing <shufflec...@hotmail.com>: Hi there, I'm kinda stuck with a script, and though I think its probably an easy fix, I haven't found the solution yet. A very simplified version of what I want: - grab the 3d position of a selected vertex, - print this value - move to the next frame and repeat. The script I came up with : import nukescripts.snap3d for i in range (0,100): nuke.frame(i) vertex = nukescripts.snap3d.getSelection() for v in vertex: vertexXpos = v.position[0] print vertexXpos The problem is that, when executed in a loop, the vertexposition is identical for every frame (it always uses the values of the first frame). If I remove the forloop and just execute the script manually on every frame it works as it should. My guess would be that I have to force the 3dviewer to refresh on every frame so it updates the vertexpostion. Am I right, and if yes how can I achieve this. Thanks! _______________________________________________ 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 _______________________________________________ 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 _______________________________________________ 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 ____ ESET 10211 (20140806) ____ The message was checked by ESET Mail Security. -- STUDIO RAKETE GmbH Johannes Hezer, Compositing TD & Stereoscopic SV Schomburgstr. 120 D - 22767 Hamburg j.he...@studiorakete.de Tel:+49 (0)40 - 380 375 69 - 0 Fax:+49 (0)40 - 380 375 69 - 99 ------------------------------------------------------ Pflichtangaben laut Handelsgesetzbuch und GmbH-Gesetz: STUDIO RAKETE GmbH Schomburgstr. 120 D - 22767 Hamburg www.studiorakete.de / i...@studiorakete.de Geschaeftsfuehrer: Jana Bohl Die Gesellschaft ist eingetragen im Handelregister des Amtsgerichts Hamburg unter der Nummer HR B 95660 USt.-ID Nr.: DE 245787817 ____ ESET 10211 (20140806) ____ The message was checked by ESET Mail Security.
_______________________________________________ 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