setExecPortTypeSpec bug?

craouettecraouette Posts: 113
edited February 2016 in Integrations

Hello,

I have a problem with exec.setExecPortTypeSpec((unsigned int)portNum, portType);
If I set portType to "Boolean", "Vec2"... it is working perfectly.
If I do the same with "Integer", it is working if the port is an input port, not if it an Input port!!!

I am using FabricEngine-pablo-Windows-x86_64-20160211-101701

Is it a problem in my code or a bug?

Thanks,

Pierre

ps: and it is not raising any exception if the type is not existing... like "ddd"

Comments

  • HelgeHelge Moderator, Fabric Employee Posts: 314 Fabric Employee

    Hey Craouette,

    can you please post the full source code of what you are trying to accomplish? Also you are saying the same thing twice - so I am not sure where the issue is. :smile:

    "If I do the same with "Integer", it is working if the port is an input port, not if it an Input port!!!"

    Research Engineer @ Fabric Software

  • craouettecraouette Posts: 113

    the full source is a little tricky... but, if I create ports, I create them with the Scalar type by default.
    Then, the end user is able to type a new type for the existing Scalar port.
    The function called (when changing the name, the type or the mode) is:

    void spliceDFGGraphUpdatePort(spliceDFGGraph graph, int portNum,
                                  const char *portName, const char *portType,
                                  const char *portMode)
    {
      spliceDFGGraphDef *a3dGraph = (spliceDFGGraphDef *) graph;
    
      try
      {
        FabricCore::DFGExec exec = a3dGraph->binding.getExec();
        if(a3dGraph->currentGraphPath != NULL)
          exec = exec.getSubExec(a3dGraph->currentGraphPath);
    
        const char *orgName = exec.getExecPortName((unsigned int)portNum);
        const char *newName = exec.renameExecPort(orgName, portName);
        FabricCore::DFGPortType mode;
        if(portMode[0] == 'o')
          mode = FabricCore::DFGPortType_Out;
        else if(portMode[1] == 'o')
          mode = FabricCore::DFGPortType_IO;
        else
          mode = FabricCore::DFGPortType_In;
        exec.setExecPortType(newName, mode);
        exec.setExecPortTypeSpec((unsigned int)portNum, portType);
      }
      catch(FabricCore::Exception e)
      {
        spliceDFGAddToConsole(CONSOLE_LEVEL_ERROR, (char *)e.getDesc_cstr());
        a3dSpliceDfgUserFeedback(e.getDesc_cstr());
      }
    }
    

    If the function is called with "Integer" as a new type, it is working for an output port, but doing nothing for an input port.
    The port remains Scalar.
    It is working for any other types I tried (Boolean, String, Color, Vec2, Vec3), whatever the port mode...

    sorry for the mistake...

  • HelgeHelge Moderator, Fabric Employee Posts: 314 Fabric Employee

    That's pretty weird. I've looked at the unit test concerning this.

    Can you try two things please:

    1. Don't use "Integer", it's an alias for "SInt32", so try that
    2. Try to use setExecPortTypeSpec with the name as the first argument, not the index.

    If one of them fixes this will fix it in the core accordingly.

    Research Engineer @ Fabric Software

  • craouettecraouette Posts: 113

    I tried, none is working.
    Here is a video showing the problem (the port list is refreshed after user action, and it is using the name version of the function as suggested):
    https://vimeo.com/155387029

  • craouettecraouette Posts: 113

    any news on this problem? If I did something wrong, why is it working with other types?

  • craouettecraouette Posts: 113

    I have made this python script:

    import FabricEngine.Core
    client = FabricEngine.Core.createClient()
    host = client.DFG.host
    
    binding = host.createBindingToNewGraph()
    rootExec = binding.getExec()
    portOName = rootExec.addExecPort("out", client.DFG.PortTypes.Out)
    portIName = rootExec.addExecPort("in", client.DFG.PortTypes.In)
    print rootExec.getDesc()
    rootExec.setExecPortTypeSpec(portOName, "Scalar")
    rootExec.setExecPortTypeSpec(portIName, "Scalar")
    print rootExec.getDesc()
    rootExec.setExecPortTypeSpec(portOName, "Integer")
    rootExec.setExecPortTypeSpec(portIName, "Integer")
    print rootExec.getDesc()
    rootExec.setExecPortTypeSpec(portOName, "String")
    rootExec.setExecPortTypeSpec(portIName, "String")
    print rootExec.getDesc()
    

    the result for the last 3 prints are:

    {
    "objectType" : "Graph",
    "title" : "",
    "extDeps" : {},
    "connections" : {},
    "ports" : [
    {
    "objectType" : "Port",
    "nodePortType" : "In",
    "name" : "out",
    "execPortType" : "Out",
    "typeSpec" : "Scalar",
    "type" : "Scalar"
    },
    {
    "objectType" : "Port",
    "nodePortType" : "Out",
    "name" : "in",
    "execPortType" : "In",
    "typeSpec" : "Scalar",
    "type" : "Scalar"
    }
    ],
    "errors" : [],
    "nodes" : []
    }
    

    ok, everything normal.

    {
    "objectType" : "Graph",
    "title" : "",
    "extDeps" : {},
    "connections" : {},
    "ports" : [
    {
    "objectType" : "Port",
    "nodePortType" : "In",
    "name" : "out",
    "execPortType" : "Out",
    "typeSpec" : "Integer",
    "type" : "Integer"
    },
    {
    "objectType" : "Port",
    "nodePortType" : "Out",
    "name" : "in",
    "execPortType" : "In",
    "typeSpec" : "Integer",
    ** "type" : "Scalar"**
    }
    ],
    "errors" : [],
    "nodes" : []
    }

    and, as you can see, the type of the last input is still "Scalar"

    {
    "objectType" : "Graph",
    "title" : "",
    "extDeps" : {},
    "connections" : {},
    "ports" : [
    {
    "objectType" : "Port",
    "nodePortType" : "In",
    "name" : "out",
    "execPortType" : "Out",
    "typeSpec" : "String",
    "type" : "String"
    },
    {
    "objectType" : "Port",
    "nodePortType" : "Out",
    "name" : "in",
    "execPortType" : "In",
    "typeSpec" : "String",
    "type" : "String"
    }
    ],
    "errors" : [],
    "nodes" : []
    }

    and back to normal...

  • borjaborja Administrator, Fabric Employee Posts: 480 admin

    Hi @craouette

    I am taking a look at your issue!

    Borja Morales
    Technical Product Manager
    Fabric Software Inc.

  • craouettecraouette Posts: 113

    thanks @borja. I started, I have it with the CAPI..... but it can be reproduced with python, so it is easier to provide a test.

Sign In or Register to comment.