View Full Version : grops help please
nebille 10-07-2005, 12:00 PM Hi all
at the moment i am writing a script that collapses groups to editable meshes and want the mesh to be renamed as the original group name. However as far as i can see the groups dont have extension $.name therefore i cant save it in a variable and apply it to the mesh once it is collapsed. Can anyone think of a work around.
regards
Nebille
|
|
Hi all
at the moment i am writing a script that collapses groups to editable meshes and want the mesh to be renamed as the original group name. However as far as i can see the groups dont have extension $.name therefore i cant save it in a variable and apply it to the mesh once it is collapsed. Can anyone think of a work around.
regards
Nebille
Groups DO have a .name property.
Groups in Max are special case of hieararchy where the group is a Helper object and all grouped objects are linked (parented) to it. Just check for group head using the isGroupHead method and grab the name of the helper - that will be the name of the group...
Unless I am misunderstanding what you are doing...
nebille
10-07-2005, 02:56 PM
cheers bobo i will give it a go now
cheers bobo i will give it a go now
Here is a simple example:
theGroups = for o in helpers where isGroupHead o collect o --collect all groups in the scene
for g in theGroups do --for each group
(
theChildren = g.children --get its children
--filter out the geometry objects from the group's children
theGeometry = for o in theChildren where superclassof o == GeometryClass and classof o != TargetObject collect o
if theGeometry.count > 0 do --if there are any geometry objects
(
convertToMesh theGeometry[1] --convert the first one to a mesh
for c = 2 to theGeometry.count do --go through the rest, if any
attach theGeometry[1] theGeometry[c] --and attach them to the first mesh
theGeometry[1].name = g.name --set the name of the final mesh to the group's name
ungroup g --ungroup the group
)--end if
)--end g loop
nebille
10-07-2005, 03:53 PM
thanks bobo you are a true legend
CGTalk Moderation
10-07-2005, 03:53 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
vBulletin v3.0.5, Copyright ©2000-2013, Jelsoft Enterprises Ltd.