Importing Xgen Archives programatically?

Importing Xgen Archives programatically?

Anonymous
Not applicable
600 Views
2 Replies
Message 1 of 3

Importing Xgen Archives programatically?

Anonymous
Not applicable

Hi there,
I'm trying to import archives programatically (custom browser) and trying to sift through the python modules. Was able to do this fine with the importing of descriptions. However am running into errors when working with archives.

from xgenm.ui.widgets import xgArchiveFilesUI as xga

xgaW = xga.ArchiveFilesUI(attr='percent') # No idea what to put for attr param but its required
xgaW.addArchives(['//path/to/xarcFile.xarc'])


Error message:

# Error: XGen:  XGen description not found. [collection26,description22]  # 
# Error: XGen:  Could not findFileInXgDataPath [collection26, description22]  # 


I could manually parse the text data myself and insert data...but would rather not! 😕

Any help on how i could go about this? I dont mind having the dialog about matching material file pop out still (saw this happens further down the addArchives() method

Cheers
Jono

0 Likes
601 Views
2 Replies
Replies (2)
Message 2 of 3

Anonymous
Not applicable

ok i did not realise but it seems xgenm.setAttr() can access tonnes more attributes than I first thought.

If anyone else is interested,

xg.setAttr( 'files', data, 'collection26', 'description80', 'ArchivePrimitive')

where data holds the string from inside the .xarc file

"file" is the attribute in the .xgen file that is getting updated with the archives here. I would assume that if you are appending you may need to add on to
getAttr('files'....

Haven't tested the material is importing yet  though.

0 Likes
Message 3 of 3

Anonymous
Not applicable

And for the material...
K....bit of a gross hack...
But i found if you pop out an archive file dialog import archive and then close it the hypershade will then have the material avaialable and the previously imported archive via the other method will connect up to that material.

from xgenm.ui.widgets import xgArchiveFilesUI as xga
xgaW = xga.ArchiveFilesUI(attr='Description')

xgaW.show()

xgaW.addArchives(['C:/tmp/Stone_Textured.xarc'])

xgaW.close()


if anyone has any idea how to do this more elegantly....i will glady update my code! 😄

0 Likes