Message 1 of 4
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
How can I add a mesh from the scene to the XGen collision modifier using Python or MEL?
Solved! Go to Solution.
How can I add a mesh from the scene to the XGen collision modifier using Python or MEL?
Solved! Go to Solution.
For anyone dealing with similar problem:
So far I've found a way to read collider attributes by looking at the python implementation of the XGen plugin.
Specifically, this functionality is handled inside the following file:
.../Autodesk/maya2018/plug-ins/xgen/scripts/xgenm/ui/ae/xgmModifierCollisionTemplate.py
Methods __getCollidersList and __getConnectedMesh can be used to list it's attributes, including connected mesh.
For example:
cl = __getCollidersList('collision.collider')
print(cl)
gives:
[(0L, 'collision.collider[0]', True, u'pCylinder1', False)]
assuming the name of collision modifier is 'collision' and object pCylinder1 has been added as collision mesh.
More to follow...
Adding new meshes can be achieved by reusing code from the following function (see previous post):
__OnCollidersButtonAddPressed
One important note is that all of that works when the hair or related object is created from XGen Interactive Editor->Create->Interactive Groom Splines..., then adding collision modifier.
Finally, it is also possible to add collision modifier to a hair groom created as a collection/description (first icon to the left in the XGen toolbar). However, it only works with preciously exported alembic objects that have to be selected via collision modifier attributes. Its behavior is different than the one described in previous posts. I find it less useful overall.