Daz SDK vs Daz Script method availability

Are the SDK and the scripting language divergent on the class functions they expose? I've found functions in the SDK that are clearly labelled as less efficient and only there for scripting use, but I recently came across a class function that's missing from the SDK header but is documented as available in Daz Script.

Class function in question is DZERCLink DzERCLink::duplicate(DzNumericProperty): http://docs.daz3d.com/doku.php/public/software/dazstudio/4/referenceguide/scripting/api_reference/object_index/erclink_dz#a_1aaae65b8fc56adb5b1d67c95edb1e5402

I'd really like to explore that class function in the SDK but it's missing from the DzERCLink header sad

 

Comments

  • OmnifluxOmniflux Posts: 377

    There is some divergence, but they remain very similar. The main issue is that the SDK was frozen with DS 4.5. You can access C++ methods added after the freeze, but they are not documented and no header files are available. You can call them by using QMetaObject::invokeMethod.

     

    For a simple example of using invokeMethod, look at this commit where I call dzApp->getAppDataInstancePath() which was added after the SDK was frozen, but fallback to the value of dzApp->getAppDataPath() if the method is not available.

     

    You can check which methods exist by doing something like this

    DzBase* simulationMgr;
    if (QMetaObject::invokeMethod(dzApp, "getSimulationMgr", Qt::DirectConnection, QGenericReturnArgument("DzSimulationMgr*", &simulationMgr)))
    {
        const QMetaObject* metaObject = simulationMgr->metaObject();
        for (int i = metaObject->methodOffset(); i < metaObject->methodCount(); ++i)
            dzApp->debug(QString("%1 -> %2").arg(metaObject->method(i).signature()).arg(metaObject->method(i).typeName()));
    }
    
  • Omniflux said:

    There is some divergence, but they remain very similar. The main issue is that the SDK was frozen with DS 4.5. You can access C++ methods added after the freeze, but they are not documented and no header files are available. You can call them by using QMetaObject::invokeMethod.

     

    For a simple example of using invokeMethod, look at this commit where I call dzApp->getAppDataInstancePath() which was added after the SDK was frozen, but fallback to the value of dzApp->getAppDataPath() if the method is not available.

     

    You can check which methods exist by doing something like this

    DzBase* simulationMgr;
    if (QMetaObject::invokeMethod(dzApp, "getSimulationMgr", Qt::DirectConnection, QGenericReturnArgument("DzSimulationMgr*", &simulationMgr)))
    {
        const QMetaObject* metaObject = simulationMgr->metaObject();
        for (int i = metaObject->methodOffset(); i < metaObject->methodCount(); ++i)
            dzApp->debug(QString("%1 -> %2").arg(metaObject->method(i).signature()).arg(metaObject->method(i).typeName()));
    }
    

    Excellent - thank you so much for sharing this! Excited to try it out this evening laugh

  • Richard HaseltineRichard Haseltine Posts: 100,804

    Omniflux said:

    There is some divergence, but they remain very similar. The main issue is that the SDK was frozen with DS 4.5. You can access C++ methods added after the freeze, but they are not documented and no header files are available.

    Some are in the scripting  docs, though you would still have to work out the types of the variables to an extent.

    You can call them by using QMetaObject::invokeMethod.

     

    For a simple example of using invokeMethod, look at this commit where I call dzApp->getAppDataInstancePath() which was added after the SDK was frozen, but fallback to the value of dzApp->getAppDataPath() if the method is not available.

     

    You can check which methods exist by doing something like this

    DzBase* simulationMgr;
    if (QMetaObject::invokeMethod(dzApp, "getSimulationMgr", Qt::DirectConnection, QGenericReturnArgument("DzSimulationMgr*", &simulationMgr)))
    {
        const QMetaObject* metaObject = simulationMgr->metaObject();
        for (int i = metaObject->methodOffset(); i < metaObject->methodCount(); ++i)
            dzApp->debug(QString("%1 -> %2").arg(metaObject->method(i).signature()).arg(metaObject->method(i).typeName()));
    }
    

    You can see some examples of this in https://github.com/daz3d/StudioFbxImporter

Sign In or Register to comment.