Access data added by GvOperatorData::FillPortMenu



  • On 19/10/2017 at 06:05, xxxxxxxx wrote:

    Not sur how to explain that but for a given gvNode not all parameters are exposed.
    Then you can click on top corner and then choose to add this paramater (so you add a GvPort) to the GvNode.
    For exemple if we put a Bitmap node, in the input port choice we get "Bitmap, x and y" it's thoses value I would like to get. And of course if there is a way to get the DescID linked to them it would be nice !

    My question is how to list them, or at least get the conainter used for the GvOperatorData::FillPortMenu fonction?

    Thanks in advance ! :)



  • On 20/10/2017 at 09:06, xxxxxxxx wrote:

    The DescIDs you can get from the resource files. In your Cinema 4D install folder under resource/modules/expressiontag (in this case for most Xpresso/GraphView nodes) you find the gvbitmap.res for the parameter/port description and gvbitmap.h for the numerical IDs.

    For the rest of the question: Unfortunately GraphView in Python is a bit limited compared to C++. I'm not hundred percent sure, yet, but I don't think it's possible. We are lacking GvOperatorData class and its member function FillPortMenu() currently.

    In C++ you could do something like this (sorry for posting such in the Python sub-forum), where actually FillPortMenu() is delivering the container content:

    GvOperatorData* god = gvnode->GetOperatorData();
    BaseContainer bcPortsMenuIds;
    BaseContainer bcPortsMenuNames;
    god->FillPortsMenu(cn, bcPortsMenuNames, bcPortsMenuIds, ID_GV_VALUE_TYPE_NONE, GV_PORT_INPUT, 1000);
    


  • On 20/10/2017 at 10:07, xxxxxxxx wrote:

    Thanks I was afraid of that.

    Since the solution of ressource file only work when parameters are exposed within them and not when another plugin register node and not expose all parameters inside ressource file I made this tiny script to put inside a python node and connect the Output to the InputPort you want to know the descid.

    def main() :
        global Output1
        Output1 = 1
        
        ports = op.GetOutPort(0).GetDestination()
        if not ports: return
        
        for port in ports:
            print "{0} :: {1} - {2}".format(
            port.GetNode().GetName(),
            port.GetName(port.GetNode()),
            port.GetMainID()
            )
    

    So I can pre-build a table but is boring would have prefer a more dynamic way.

    Anyway thanks for your reply ! :)


Log in to reply