Return collection from plugin to script environment

I need to return a collection from an SDK plugin, let's say a QList<DzNode*>.    This documentation appears to be exactly what I need :

How do I get a pointer to the QScriptEngine in use by the Daz app though?    If I just create my own it doesn't work, so I assume Daz has one that I need to use instead.   





  • rbtwhizrbtwhiz Posts: 1,826

    We do not provide access to the script engine itself. What you can do, however, is create a public slot on your class that returns a QVariantList. This will be seen by the script environment as an Array of objects of whatever type you put into it (assuming said type is registered).

    QVariantList MyClass::myPublicSlot()
    	DzNodeList nodeList; // typedef for QList<DzNode *>
    	QVariantList scriptArray;
    	DzNodeListIterator nodeIter( nodeList );
    	while( nodeIter.hasNext() )
    		scriptArray << QVariant::fromValue<QObject*>( );
    	return scriptArray;


  • shoei321shoei321 Posts: 112

    Thanks again Rob, that was what I needed.


Sign In or Register to comment.