[SOLVED] Help using DzTSharedPointer

cridgitcridgit Posts: 987

I'm trying to generate a list of assets in a product using the SDK. I can do it no problems using DAZ Script, but am getting stuck using the SDK because there is no (= zip, zero, nada) documentation on DzTSharedPointer. I can't figure out how to dereference this class or cast to/from a regular pointer.

DzTopLevelAssetContainer *pContainer = dzApp->getAssetMgr()->getProducts();
DzAbstractAssetContainerList subcontainers;
pContainer->getChildContainers(subcontainers); // ignore result
foreach (DzAbstractAssetContainerPtr pChild, subcontainers)
{
	DzAssetList assets;
	pChild->getAssets(assets); // ignore result
	foreach(DzAssetPtr pAsset, assets)
		QMessageBox::warning(0, "Info", pAsset->getAssetName(), QMessageBox::Ok);
}

The code above crashes with an error at line 431 in QList.h ...

while(from != to) --to, delete reinterpret_cast<T*>(to->v);

Both DzAbstractAssetContainerList and DzAssetList are not documented. From the header files they are of type QList<...> with subclasses of DzTSharedPointer (which is also not documented). I don't want to use a list with an undocumented pointer wrapper class, I want to use a simple good old C pointer. Any suggestions how I can get an array of pointers or at least cast the DzAssetPtr to a DzAsset*

Thanks

 

Post edited by cridgit on

Comments

  • cridgitcridgit Posts: 987

    I've found a workaround using a for loop. The code below works fine without having to use those list pointers.

    int childrenCount = pContainer->getNumChildContainers();
    for (int i = 0; i < childrenCount; i++)
    	bla bla;
    

    Incidentally there appears to be a bug in the DzAbstractAssetContainer::getSubcontainers() code, because even if you just call subcontainers without doing anything with the list, DAZ Studio crashes on QList destruction. From the debug info it looks like it is trying to cast a DzAbstractAssetContainer to a DzAbstractAssetContainerPtr. I suspect the method creates a QList<DzAbstractAssetContainer> rather than a QList<DzAbstractAssetContainerPtr>.

     

Sign In or Register to comment.