0

Get annotations in Python?

Hi, I'm running a python script inside of RV and am trying to keep track of all the annotations and manually export them to a pre-defined folder.   I'm attempting the following:

1.  Catch signal for newly created annotation and track it

2.  Display annotation info (id, frame #, et cetera)

3.  Export annotations (let user select which annotations to export if possible)

I see the rv.extra_commands.findAnnotatedFrames() but it just gives me back a list of frames that have been annotated.

Apparently the annotations are kept inside the "RVPaint" node but when I run rv.commands.nodesOfType("RVPaint") it just brings back the names of those nodes.  

I guess I'm just having trouble accessing the attributes and functions on all of the nodes.  Is it possible to load a node object into memory in python and access its attributes/methods?  

And even then I'm unsure the best way to export the annotation.  RV seems to be running the "rvio_hw" command on the *.rv file to export the annotated frames.  Can I just use a system call to mimic that?   The help menu says that rvui has a function called "exportAnnotatedFrames()" but that function doesn't seem to be in the code anywhere including the rvui.py file.

Sorry there's a lot going on here.  Thanks

4 条评论

  • 0
    Avatar
    Collin Parrish

    Okay I figured everything out.  Please disregard. 

  • 0
    Avatar
    Jon Morley

    Hi Collin,

    Are you sure? There were a lot of questions there I want to make sure you have the information you need. The "exportAnnotatedFrames" method in rvui.mu is not the solution for all cases as it interactively asks for a place to save the files. Many times those who are programmatically scripting an export choose to use some of the lower level functions that one uses. Please let me know if I can help any further.

    Thanks,
    Jon

  • 0
    Avatar
    Collin Parrish

    I never figured out how to get the signal for added annotations so basically I just check at certain times to see if any annotations have been added or removed.

    I ended up using a command line function to render out the annotations using rvio_hw.  Seems to work well.

    Thanks for following up!

  • 0
    Avatar
    Jon Morley

    Ok, great!

    If you want to look for new annotations coming in then you will want to look for the event "graph-state-change" and looks at the event.contents() to see which property was changed. If you see any properties changing on RVPaint nodes that you know to be annotation related then you are set!

    Glad it is working for you.

    Thanks,
    Jon

请先登录再写评论。