I'm using an Obj Instance node to scatter objects on a terrain.
I'm trying to:
1) Create a custom name for each instance.
2) Add “Extra Attributes” in maya that I can encode with useful meta data from Houdini for each instance.
I've tried adding point, vertex, and detail attributes in Houdini but never see any in Maya on transform or shape nodes.
Are either of these possible without using an nParticle solution?
Thanks.
-Len
Obj Instance not revealing attributes
3135 3 2- Len
- Member
- 132 posts
- Joined: 7月 2007
- Offline
- awong
- Member
- 818 posts
- Joined: 9月 2013
- Offline
- Len
- Member
- 132 posts
- Joined: 7月 2007
- Offline
Thanks for the answer (and example!), Andrew. That works, though it introduces a problem.
I am exploiting the obj Instance node's creation of full transforms for each copy since I'm taking that data, along with the additional meta data, to export into a custom game engine format.
So, I suppose I could encode the necessary transform data into the meta data with each copy? Or something like that?
Still learning Houdini so it's not obvious to me.
Thanks.
I am exploiting the obj Instance node's creation of full transforms for each copy since I'm taking that data, along with the additional meta data, to export into a custom game engine format.
So, I suppose I could encode the necessary transform data into the meta data with each copy? Or something like that?
Still learning Houdini so it's not obvious to me.
Thanks.
- awong
- Member
- 818 posts
- Joined: 9月 2013
- Offline
The instancer doesn't have the transform of each instance explicitly available. However, it's still possible to query the transform of the instances. Unfortunately, the “instancer” MEL command seems to be broken. However, it's still possible to use Python to access the Maya API. The simple script below will query the “instancer1” object, and print out all the instance paths and matrices.
from maya import OpenMaya as om
from maya import OpenMayaFX as omfx
sel = om.MSelectionList()
sel.add("instancer1")
dag = om.MDagPath()
sel.getDagPath(0, dag)
fn = omfx.MFnInstancer(dag)
count = fn.particleCount()
for i in xrange(count):
paths = om.MDagPathArray()
matrix = om.MMatrix()
fn.instancesForParticle(i, paths, matrix)
print i
print [paths[j].fullPathName() for j in xrange(paths.length())]
print [matrix(j/4, j%4) for j in xrange(16)]
Andrew / アンドリュー
-
- Quick Links