0

Is rv can duplicate a node?

Is there any way to duplicate a node for new one?

I have a sequence images named "sequence_imageX", it consist of some node(RVSourceGroup,RVOverlay,RVPaint,etc.).I wanna duplicate a new one from it include associated node.

ps:named "sequence_imageX_new" also consist of RVSourceGroup,RVOverlay,RVOverlay,etc. just like clone.




dotrvrc.py

10 条评论

  • 0
    Avatar
    Jon Morley

    Hi Jonike,

    What kinds of properties are you interested in copying/preserving in the new source group?

    If you use commands.newNode("RVSourceGroup", <your_prefered_node_name>) you will get all of those associated nodes created as well. Even better I would suggest using commands.addSourceVerbose.

    Basically any call you use to create an RVSourceGroup will generate the entire collection of associated nodes you mentioned.

    Please let me know more about the properties you want to copy.

    Thanks,
    Jon 

  • 0
    Avatar
    jonike

    Hi Jon

    First, Thanks for your reply.

    I imported a sequence image in Rv then annotated it.

    I want to copy this sequence image node and it's annotation. then replace it's file path to " solid,width=1280,height=720,fps=24,start=1,end=134,red=0,green=0,blue=0,alpha=0.movieproc".

    My mean is that in Rv if a sequence image include a alpha chanel fill with whole area ,then export annotated frame image.the sequence image's alpha chanel will overlay annotation's alpha chanel .I wanna extract annotation include it's alpha chanel.

    In that case, i use " solid,width=1280,height=720,fps=24,start=1,end=134,red=0,green=0,blue=0,alpha=0.movieproc" to replace original seq image path, then export annotated frame image. it's perfect.

    So, In Rv python API, How to do it?

    I'm a new bird in Rv Api. Here is my little bit code:

    from rv.rvtypes import *
    from rv.commands import *
    from rv.extra_commands import *
    import rv.runtime
    import re

    def extractAnnotation(self, event):
        commands = """
    {
    let m = session_manager.theMode();
    if (m neq nil && m._active) then m.selectedNodes() else string[]();
    }
    """
        nodes = rv.runtime.eval(commands, ["session_manager", "commands"])
        result = re.findall(r'"(.*?)"',nodes)
        if result:
            for i in result:
                if nodeType(i) == "RVSourceGroup":
                    source_index = 0
                    sources = sourceMediaInfoList(i+"_source")
                    for j in range(len(sources)):
                        if sources[j]['file'].find("#") != -1:
                            source_index = j
                            break
                        else:
                            source_index = j


        maskNode = addSourceVerbose(["solid,width="+str(sources[source_index]['width'])+",height="+str(sources[source_index]['height'])+",fps="+str(sources[source_index]['fps'])+",start="+str(sources[source_index]['startFrame'])+",end="+str(sources[source_index]['endFrame'])+",red=0,green=0,blue=0,alpha=0.movieproc"],"nil")
        maskNodeGroup = maskNode.replace("_source","").strip()
        maskNodeGroupUiName=maskNodeGroup+".ui.name"
        setStringProperty(maskNodeGroupUiName,[str(getStringProperty((i+".ui.name"),0,2147483647)[0]) + "_annotation_mask"],False)


        newNode("RVSourceGroup",i) # Error: why? I watched you reply.


    ERROR: Exception thrown while calling commands.newNode -- exception: "in commands.newNode: can't build a node", program exception
    Traceback (most recent call last):
    File "C:\Users\home\AppData\Roaming\RV\Python\startup.py", line 64, in extractAnnotation
    newNode("RVSourceGroup",i)

  • 0
    Avatar
    jonike

    Another,Is Rv have a command line to execute a single command in console  just like Python IDLE?  Write a package to debug is so complex.

  • 0
    Avatar
    Jon Morley

    Hi Jonike,

    I have a couple suggestions and ideas before we get into copying nodes. Besides I think you might simply want to replace the media in your annotated sources temporarily during your export and then return them to their original values.

    OK, first of all what you have done is here very impressive, but I think I can help make it simpler. Have you seen the "Mu Commands API Browser..." under the help menu? It is a great place to look up commands for Mu (and Python though you have to translate the syntax).

    I have attached (linked below) a .rvrc.py file that takes a stab at doing what I think I would do to meet the task you have described. Using your .rvrc.py or .rvrc.mu files (which should be placed in your home directory) can be a great scratch area to do testing. It might be what you are looking for to avoid creating entire packages to test logic. You will need to rename the file to ".rvrc.py" and place it in your user home directory.

    The code I have written assumes that the annotations you are trying to capture are on your sources and not on the views like sequences, stacks, layouts, etc.

    Please take a look at the file and tell me if this is the kind of thing you are looking for.

    Thanks,
    Jon 

    dotrvrc.py file is attached at the top of this thread in the original post.

  • 0
    Avatar
    jonike

    Hi Jon,
    Awesome,your script is perfect but have a little problem.
    There is a WARNING dialog appearances at all times.
    First time to export is no any file write to disk but second time is successful.

    ==========================
    WARNING
    Another process is still running
    ==========================

    I am sorry for replying so late.
    Thank you. I appreciate your help.

    cheer,
    Jonike

  • 0
    Avatar
    jonike

    Sorry, It's my mistake.
    Multi-RVPainter node will appearances multi-export dialog box.
    But exportAnnotatedFrames() function must executed waiting for next one. It can not be executed in parallel mode. How to fix it.

    Thanks.

     

  • 0
    Avatar
    jonike

    I have change some code in your scripts. The source group and sequence is pretty well.
    But the stack is invalid.

     

  • 0
    Avatar
    jonike

    Here is output: two sourceGroups, a default sequence and a default stack.

    [u'sourceGroup000001_paint']
    {u'sourceGroup000001_source': u'D:/playblast/output.mov'}
    [u'sourceGroup000006_paint']
    {u'sourceGroup000006_source': u'D:/playblast/sc001/sc001.1-134#.tga'}
    [u'defaultSequence_p_sourceGroup000001', u'defaultSequence_p_sourceGroup000006']
    {u'sourceGroup000006_source': u'D:/playblast/sc001/sc001.1-134#.tga', u'sourceGroup000001_source': u'D:/playblast/output.mov'}
    [u'defaultStack_p_sourceGroup000006'] Why there is just return one node name in stack? 
    {u'sourceGroup000006_source': u'D:/playblast/sc001/sc001.1-134#.tga'} 

  • 0
    Avatar
    Jon Morley

    Hi Jonike,

    It sounds like you are making progress but still getting some errors. I am sorry I did not reply in the middle of your work here. Can you give me an update? What is the latest issue?

    Are you still trying to determine the source nodes in a stack? If so you can try using commands.nodeConnections on your stack. From the Help -> Mu Command API Browser...

    nodeConnections ((string[],string[]); 
                     string nodeName,
                     bool traverseGroups = false)

    The first list returned in the tuple is the inputs and the second is the outputs of the stack. In your case you will want to take a closer look at the inputs to get the source nodes.

    The reason you are only seeing one source for the stack in the code now is because the only the topmost source node of your stack is getting returned.

    Please let me know if this is what you were looking for.

    Thanks,
    Jon 

  • 0
    Avatar
    jonike

    Hi John!
    I can export stack and layout type,but no alpha chanel.
    Is stack and layout has own default RvFileSource must to replace ?
    Anyway, The script is working for me.
    Thanks !

    Cheer,
    Jonike

     

     

请先登录再写评论。