I model most of my products in May 2016 and import them as FBX in Max 2020. In Maya I have all my products in different groups but when I import them into Max the groups have been replace by helpers. Normally I would unlink these helpers one by one and grouping al the different objects into the correct groups. But with lots and lots of groups to import in Max this quickly adds up to a lot off time.
Ideally I would create a simple script that turns all the helpers back into groups with the correct name. So far I haven't been able to do this correctly.
I have found this script that does the opposite: It turns groups into helpers.
delete (for h in helpers where isGroupHead h collect ( setGroupOpen h true h.children.parent = in h.parent Point name:h.name transform:h.transform h ) )
Reversing this script hasn't worked for me yet.
But I've tried it and came up with this little script that almost does what I want:
selection.parent = undefined
group (GetCurrentSelection()) name:"parent.name"
for i in selection where superclassOf i == Helper do delete i
This delete's the helper and creates a group from the selected objects. But what it doesn't do is give the group the correct name.
Is there anyone who could help me figure this one out? Would be greatly appreciated.
for obj in helpers where obj.children.count > 0 do
(
obj.pivot = obj.children.center
setGroupHead obj on
for child in obj.children do setGroupMember child on
)
Thanks, this works great.
Really need to better understand Maxscript as I couldn't figure this out in an entire afternoon.
the question is, should the head's pivot be only in the center of the direct children, or in the center of its entire hierarchy?
At first glance it worked perfectly but now there is one thing that doesn't work correctly for me.
I would like to have the pivot centred to the bottom of the entire group. I want to add this to the script but haven't figured that out yet. So in the mean time I use a seperate script to do this for me but for some reason it messes the group up. Instead of moving the pivot to the bottom, all individual objects get centred to the grid on the y axis. I don't have a clue why this happens. It also happens when I use the transform toolbox to adjust the pivot.
With the script in my original post the group that gets created behaves as it should: the pivot of the entire group moves to the bottom centre.
Do you guys have any Idea why this happens and how I can fix it?
This script:
selection.parent = undefined
group (GetCurrentSelection()) name:"parent.name"
for i in selection where superclassOf i == Helper do delete i
If I use this script I can centre the Pivot easily on the created group. The only problem with this script is the naming of the group. It should take the name of the helper but I can't figure out how to do that.
Delete 2nd (pivot) line from @Swordslayer script. If you don't want to change pivot pos. from Maya and FBX.
Check which selection center you're using (when checking results) in Max
Well that is not really the problem. The problem is when I've created the groups using @Swordslayer script I want to centre the pivot to the bottom of the group. When I do this all individual objects inside group get positioned to 0 on the z axis. See the first two screenprints.
When I use my own script nothing happens with the individual objects inside the group and the pivot of the group moves to the bottom of the group. See the 3th and 4th images.
The only problem I have with my own script is that I can't get it to name the group after the helper. In my script it names every group to this: parent.name
I hope this makes sense.
@Primabad wrote:When I use my own script nothing happens with the individual objects inside the group and the pivot of the group moves to the bottom of the group.
No, it doesn't.
Your script is grouping selection - including helper (and placing pivot at the sel. center)
Lather on it's deleting helper.
If the group pivot is placed at or close to the bottom of the group, that's coincidence.
For altering pivot (of the Group or any obj.) in Max look at help files -Hierarchy Panel - Affect Pivot Only...
Yes my script groups the selection including the helper and afterwards deletes the helper. The script doesn't do anything with the pivot, it just uses the same pivot position as the helper. This behaviour is exactly as I want.
So at this stage nothing has happened with the pivot position. So now I use edit > transform toolbox to align the pivot along each axis. On a normal group the pivot of the entire group is set correctly to where I want it. This has nothing to do with the Hierarchy Panel.
When I do the same thing after using the script from Swordslayer each object within the group gets affected as shown in my printscreens.
Maybe I am missing something but isn't this strange. How can the behaviour of a group differ so much. Shouldn't groups behave exactly the same nomather how they are created?
Can't find what you're looking for? Ask the community or share your knowledge.