PDA

View Full Version : Average Scale of objects

 JokerMartini02-25-2012, 01:12 AMI know that scale on an objects transform is a "no no" in almost every case when it comes to rigging. Putting that I aside I want to find that average scale of a selection of objects. I just wanted to put this out there and see what others thought of it and to see if there was a more efficient or better way of finding the average scale. Are their any fool proof things I need to look out for when doing this? Such as things parented to a scaled object and negative scales if possible. avgScale = [0.0,0.0,0.0] for obj in selection do ( avgScale += obj.scale ) avgDiv = [selection.count,selection.count,selection.count] avgScale = avgScale/avgDiv box scale:avgScale
denisT
02-25-2012, 12:41 PM
I know that scale on an objects transform is a "no no" in almost every case when it comes to rigging. Putting that I aside I want to find that average scale of a selection of objects. I just wanted to put this out there and see what others thought of it and to see if there was a more efficient or better way of finding the average scale.
Are their any fool proof things I need to look out for when doing this? Such as things parented to a scaled object and negative scales if possible.

avgScale = [0.0,0.0,0.0]
for obj in selection do
(
avgScale += obj.scale
)
avgDiv = [selection.count,selection.count,selection.count]
avgScale = avgScale/avgDiv

box scale:avgScale

as I see you are averaging the absolute scale values. But I think you need the local scale.
to get the local scale you can ask:
# (<node>.transform*(inverse <node>.parent.transform)).scale -- if parent exists
or
# in coordsys parent <node>.scale -- you don't need to check parent
or
# <node>.<inode>.scaleinparent -- the way that I would use

JokerMartini
02-25-2012, 08:00 PM
# <node>.<inode>.scaleinparent -- the way that I would use

What is an inode?
Is that that parent node.

denisT
02-25-2012, 09:56 PM
# <node>.<inode>.scaleinparent -- the way that I would use

What is an inode?
Is that that parent node.
inode is a node's interface. see mxs help -> INode Interface

CGTalk Moderation
02-25-2012, 09:56 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.