It’s worth mentioning that the CurveTool solution is not always reliable, 
especially when dealing with something like an Alembic cache. I think it comes 
down to some kind of a timing issue between Nuke’s 3D system and its API, but 
if you try to snap to a moderately heavy deforming mesh, over time the 
positions returned by the vertex position sampling function will start to lag 
behind by one or more frames within your loop.

-Nathan



From: Erwan Leroy 
Sent: Saturday, August 09, 2014 5:04 AM
To: Nuke Python discussion 
Subject: Re: [Nuke-python] 3dposition won't update every frame when using 
aforloop.

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
_______________________________________________
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