Hi,
I’m using blender to process geometry for an upcoming project. I’d like to be able to store contextual data to drive some procedural effects in my geometry. My current idea is to use USD since the custom attributes are immediately attached to the importselectSOP.
It’s going mostly well. The only issue that I’m having is that the attribute name formatting has the string ‘primvars:’ appended to the attribute Id. So for example, an Attribute ‘Foo’ will be imported as ‘primvars:Foo’. The semicolon is kind of a paper cut when working in GLSL. I don’t know if it’s being added by blender on export or TD on import.
My current approach for getting rid of it is to use the callbacks on the USD importer to procedurally generate attributeSOPs to handle and convert these. Ie:
def onImport(comp, allOps, newOps):
for c in allOps:
if c.OPType == 'importselectSOP':
# make list of primvar attribs
primvars = []
for p in c.pointAttribs:
if p.name[:9] == 'primvars:':
primvars.append(p.name)
# add an attributeSOP
a = c.parent().create(attributeSOP)
# populate attribute conversion pars
for v in range(len(primvars)):
a.par['pt'+str(v)+'from'] = primvars[v]
a.par['pt'+str(v)+'to'] = primvars[v].split(':')[1]
# connect the importselectSOP to the attributeSOP
c.outputConnectors[0].connect(a)
# update render and display flags
c.render = c.display = False
a.render = a.display = True
return
This is generally just fine, but since I’m looking into USD I wanted to check in to see if anyone knew of a smarter way to handle this.
Thank you for any advice