|
Tell us what you think of the site.
|
Autodesk Media & Entertainment User Community
|
Autodesk® 3ds Max®
|
|
Autodesk® Maya®
|
|
Autodesk® Softimage®
|
|
Autodesk® MotionBuilder®
|
|
Autodesk® Mudbox™
|
|
Autodesk® ImageModeler™
|
|
Autodesk® Sketchbook® Pro
|
|
Autodesk® Smoke on Mac®
|
| Setting an object's reference coordsystem to parent?
|
|
|
Alright, first off:
Im completely new to maxscript, so I’ll probably need a dumb question or two to understand how all this works :P
I’m trying to write a script that parents the selection to a given node, and tells each object in the selection to use its parent’s (so the given node’s) coordsystem.
What I’ve got so far is this:
Dummy name:"controllerZeroHelp" pos:[0.0,0.0,0.0] isSelected:off
for obj in $ do
(
$.parent = $controllerZeroHelp
)
works out fine so far, as you might have alreay guessed - the problem is, I don’t understand MaxScript well enough to know how to “edit” the object in the selection. I’ve tried the maxscript documentation, but being used to have every command simply listed alphabetically (MELCmd ref, for example) this whole search thing needs getting used to - also im not quite sure where to look to begin with.
I’d do seomthing like “set coordsys parent” but am not sure how to write that in mxs.
thx for your help :)
AutoWalk script out on CreativeCrash!
http://www.creativecrash.com/may...gins/animation/c/autowalk
Jeeves Simple Biped Rig:
http://www.creativecrash.com/maya/downloads/character-rigs/c/jeeves
Dload, test & share! Feedback very much appreciated!
|
|
|
|
|
dum = Dummy name:"controllerZeroHelp" pos:[0.0,0.0,0.0] isSelected:off
for obj in selection do
obj.parent = dum
--or, because parent is a mapped property
selection.parent = dum --no loop needed
Author: Steve_Curley
|
| Replied: 26 January 2012 07:04 AM
|
|
|
|
|
Uhm. Okay. :D
So that will use the parent’s coordinate system as a ref then?
AutoWalk script out on CreativeCrash!
http://www.creativecrash.com/may...gins/animation/c/autowalk
Jeeves Simple Biped Rig:
http://www.creativecrash.com/maya/downloads/character-rigs/c/jeeves
Dload, test & share! Feedback very much appreciated!
|
|
|
|
No, sorry - I misread the question (based on the code you provided).
“Parent” is a property (which is what mislead me) - when you Select and Link 2 objects, one becomes the Parent of the other. The other is, effectively, using the parent as its reference coordinate system, so it’s not entirely wrong.
AIUI there’s no such thing - no “coordinatesystem” property to set. The coordinate systems are (primarily) for interactive use (in the viewports), internally they are stored differently (except as noted above).
Look at the “in coordsys” scope for a simple way, but to get to the underlying details you need to understand the internal transform matrix (which I don’t).
Create 2 boxes (not at the origin) and try the following.
in coordsys $Box001
(
$Box002.pos = [0,0,0]
)
)
Box002 will move to Box001, but only when the script runs, not permanently, though you can do interesting things when using the coordsys within a script controller.
Max 4.2 through 2013.
XP-64 (SP2)
NVidia 9800GTX-512 (Driver 266.58).
Core 2 Quad Q6600 2.4GHz, 8Gb Ram, DX9.0c.
|
|
|
|
|
Ah okay. Very well then. Thx! :D
Author: J.D.
|
| Replied: 26 January 2012 09:29 PM
|
|
|
|
|
Okay so apparently what I wanted to do, doesn’t work this way ;D
I’ll try explaining what I would do without scripts, maybe that will make it easier for you to think of something, because I am utterly clueless:
I need to link a Biped to a dummy helper called “controllerZeroHelp” - sometimes I will have more than one bone hierarchy, each needs to be linked to a seperate dummy helper called “controllerZeroHelp” in this case;
Also, each dummy helper needs to be aligned to the world, and the biped needs to use the coordsystem of the dummy helper.
Even without the ref coords working, It would still be a big help to at least get the linking done.
From what I have observed (and read here), however, linking objects and parenting seems to be not the same thing.
The script is intended to be run as a pre-export script for the CryEngine 3 Batch Exporter.
Sorry if my questions are tedious to answer - like I said, Im pretty new to 3dsMax scripting, and have worked only limitedly with package. So thanks for your patience :)
AutoWalk script out on CreativeCrash!
http://www.creativecrash.com/may...gins/animation/c/autowalk
Jeeves Simple Biped Rig:
http://www.creativecrash.com/maya/downloads/character-rigs/c/jeeves
Dload, test & share! Feedback very much appreciated!
|
|
|
I need to link a Biped to a dummy helper called “controllerZeroHelp”
That is a “Select and Link” - you’re creating a hierarchy of objects (ignoring for a moment the fact that a Biped is itself a hierarchy). Setting the Parent property of the Biped is exactly the same as using Select and Link.
sometimes I will have more than one bone hierarchy, each needs to be linked to a seperate dummy helper called “controllerZeroHelp”
Can’t be done. You can’t have 2 objects with the same name. They would have to be “controllerOneHelp”, “controllerTwoHelp” etc, or more logically “controllerHelp01”, “controllerHelp02” and so on. Even better (if the Bipeds have their original names) “Biped01Controller”, “Biped02Controller”. The reason being that you can derive the name for the controller Dummy from the name of the Biped to which it will be linked. Don’t forget these are just names, not actual controllers (which is a whole different discussion).
Also, each dummy helper needs to be aligned to the world, and the biped needs to use the coordsystem of the dummy helper.
Objects are always created relative to the world unless you use a User Grid, or you tick the Autogrid option on the create panel. In other words, if you do nothing about it they WILL be aligned to the world. Once 2 objects are linked, the Child automatically uses the Parent for its coordinates, i.e. wherever you move the Dummy, the Biped will follow.
From what I have observed (and read here), however, linking objects and parenting seems to be not the same thing.
Can be confusing, but they’re really the same thing. Select and Link creates a Child/Parent relationship between the 2 objects.
Assume that you have one or more Bipeds selected. I think you’re trying to get the Dummy aligned to each Biped? Change the construction of the Dummy name if necesary.
for obj in selection do
(
dum = Dummy name:(obj.name+"Controller") pos:(biped.GetTransform obj #pos)
obj.parent = dum
)
Max 4.2 through 2013.
XP-64 (SP2)
NVidia 9800GTX-512 (Driver 266.58).
Core 2 Quad Q6600 2.4GHz, 8Gb Ram, DX9.0c.
|
|
|
|
Actually no , the dummy is supposed to act as a “master” ctrl, positioned at 0,0,0.
You say you can’t have the same name twice, but I am positive that I actually have done this - at least the display name is the same, but that’s really all that matters to me.
Once 2 objects are linked, the Child automatically uses the Parent for its coordinates
I’ll give it a shot, but there seems to be something about that isn’t working; but im not sure yet what exactly. It’s practically the pivot rotation Im worrying about. When I do it manually,only linking the biped to the helper, after the export into the engine, the rig still points wherever it pleases. I always had to select the biped root and tell it to use the parent coord sys as a reference.
Can be confusing, but they’re really the same thing. Select and Link creates a Child/Parent relationship between the 2 objects.
Okay, that just seems really weird. I tried obj.parent out, but it parented each bone of the biped under the helper (destroying my biped). then again, I probably messed up the selection somewhere.
Alright, so besides being a little confused on whether or not I can create multiple helpers with the same name (displayed) I think you made most of it pretty clear :D Thank you for that! :)
AutoWalk script out on CreativeCrash!
http://www.creativecrash.com/may...gins/animation/c/autowalk
Jeeves Simple Biped Rig:
http://www.creativecrash.com/maya/downloads/character-rigs/c/jeeves
Dload, test & share! Feedback very much appreciated!
|
|
|
|
Just replace the “pos” bit with pos:[0,0,0].
You can’t have 2 objects with the same name - at least, you can’t create 2 objects with the same name. I’ve seen Imported objects manage to do it, but it confuses Max and definitly confuses users. It’s not supposed to be possible, and if you do, then which “Bip001” is $Bip001?
As for what happens outside Max I can’t comment. That’s likely an export or an import issue rather than how you link them in Max.
You must select the Biped object itself “Bip001” not any of its component parts. Biped is a “system” not a simple object or object hierarchy - you can see that by looking up Biped in the Maxscript help - it has its own set of unique function and properties.
Max 4.2 through 2013.
XP-64 (SP2)
NVidia 9800GTX-512 (Driver 266.58).
Core 2 Quad Q6600 2.4GHz, 8Gb Ram, DX9.0c.
|
|
|
|
|
Alright, thx!
The whole naming thing just got obsolete, anyways - I was corrected on that, it doesn’t matter what name it has. So nvm, BUT thanks for clearing that up, that will save me a headache at some point in the future :D
Author: J.D.
|
| Replied: 27 January 2012 02:26 AM
|
|
|
|
|
Okay, again with the reference oord system.
Something is DEFINITELY going on when I select “parent” in the ref coord system - meaning it cannot be, by default, use the parent’s coord system as a reference.
If I dont select it before the export, the mesh is rotated to its side and the mesh faces dow nthe x axis - if I select “parent” from the dropdown menu, it’s straightened out, standing upright facing down the Y axis.
So obviously SOME kind of command, function wutevers is being executed when I select that damn menu item - I NEED that friggin function >_<
My life basically depends on it :P :D
I know I seem a bit stubborn, but there must be something going - it cant be al black magic and voodoo :<
AutoWalk script out on CreativeCrash!
http://www.creativecrash.com/may...gins/animation/c/autowalk
Jeeves Simple Biped Rig:
http://www.creativecrash.com/maya/downloads/character-rigs/c/jeeves
Dload, test & share! Feedback very much appreciated!
|
|
|
|
You can set the coordinate system (the one in the dropdown list on the main toolbar) with
toolMode.coordsys <mode> <node>
if that helps. Beyond that i’m at a loss too.
Max 4.2 through 2013.
XP-64 (SP2)
NVidia 9800GTX-512 (Driver 266.58).
Core 2 Quad Q6600 2.4GHz, 8Gb Ram, DX9.0c.
|
|
|
|
|
so, i put in toolMode.coordsys #parent obj
and it gives me this?
-- Argument count error: toolMode.coordsys wanted 1, got 2
what do you mean by <node> ?
Author: J.D.
|
| Replied: 31 January 2012 01:11 AM
|
|
|
|
|
Arrgh :(
I had to re-read the help entry several times before seeing what’s wrong…
It’s either a mode or a node, not both.
Max 4.2 through 2013.
XP-64 (SP2)
NVidia 9800GTX-512 (Driver 266.58).
Core 2 Quad Q6600 2.4GHz, 8Gb Ram, DX9.0c.
|
|
|
|
|
Ah okay. So basically, I’d do
toolMode.coordsys #parent
toolMode.coordsys obj
to first set the tool to #parent mode and then I basically execute the tool on the object ? I’ll give it a shot, I hope this is it :/
Author: J.D.
|
| Replied: 31 January 2012 03:19 AM
|
|
|
|
|