If you’re coming from Maya to 3dsmax, or you’re learning Maya and getting confused as to why in Maya there are Transform and Shape node and in 3dmax it doesn’t look like there are… here’s a bit of a explanation, as both of them work the same way….
3dsmax has each object as one node in the scene… there is a baseObject property for each node which is where the class of the node is assigned as an object, this is effectively your shape node. When you create an scene-object, you tell 3dsmax what class of object you want to create by clicking on a ‘Plane’, or ‘Teapot’ for example. 3dsmax creates a ‘node’ object in the scene and then creates an instance of this class and assigns this object to the baseObject property of the scene-object.
Looking at the command panel in 3dsmax, the modify panel is effectively the shape node, the controller, hierachy and display tabs are all for the ‘transform node’ properties.
You can change what an object actually is in 3dsmax by assigning a new maxObject to baseObject property. Create a Box in your scene and then run this line of code…
$.baseObject = (createInstance Teapot())
Ok so what is this baseObject property? When you use the commonly used*…
You are actually doing….
*Thanks to Paul Neale for pointing out that classof $ returns the class of the object given any modifiers changing say from a spline to geometry using say the sweep modifier.
When maxscripting, a max node inherits all the properties of the baseObject MaxObject.
$Sphere001.radius = 50
Where as properties such as:
are on all objects in 3dsmax regardless of their class
Properties of the maxObject, such as in an example of a sphere….
are unique to the class that is associated with the node as specified by its baseObject Class.
You can use the baseObject property to access these properties as well..
When you use getClassInstances it returns an array of all the instances of the class but not actual objects, so you have an array of all the maxObjects that are in the ‘baseObject’ properties slots for all the objects in the scene. To get from this baseObject to the actual node you can use the reference system to get the dependent nodes, as one maxObject may be shared between multiple objects. When objects are instanced in 3dsmax each node is unique but the baseObject property is shared between the instanced nodes.
Create three VRayLights in your scene (or any other kind of object)
>>> myObjs = getClassInstances (VRayLight)
(VRayLight, VRayLight, VRayLight)
See how it list 3 VRayLight types but it’s not pointing to VRayLight001 for example. This means using;
myObjs.invisible = true
works… but if you were to try this… you’d get…
— Unknown property: “position” in VRayLight
That’s because we’ve got an array of maxObjects not scene objects so we are querying the baseObject rather than the Object itself in the scene. We can get the Object my using refs.dependentNodes.
#($VRayLight:VRayLight001 @ [21.382523,52.673576,0.000000])
Take VRayLight001 in your scene and clone it 4 times as an instance, re-run the following code….
>>>myObjs = getClassInstances(VRayLight)
#(VRayLight, VRayLight, VRayLight)
See how we still get only 3 maxObjects returned?
–returns 5 objects now.
#($VRayLight:VRayLight007 @ [252.584503,52.673576,0.000000], $VRayLight:VRayLight006 @ [164.925598,52.673576,0.000000], $VRayLight:VRayLight005 @ [77.266678,52.673576,0.000000], $VRayLight:VRayLight004 @ [-10.392235,52.673576,0.000000], $VRayLight:VRayLight001 @ [-98.051147,52.673576,0.000000])
Other places you can spot this Transform-Shape/BaseObject system in max is in the trackview when you look at an object (say Sphere001) you’ll see the Transform controller as subAnims and the “Object” (which should really be called ‘baseObject’).
In Maya these two are separate nodes… the Transform and the Shape Node.
Transform node = maxObject node
Shape Node = baseObject
In the outline you can expose the shape nodes and you can see the shapes as nodes, If you instance a node in Maya you’ll see that the transform nodes are unique but the shape nodes are the same.
In Maya Cmds there isn’t property inheritance like in max…. if you select the Transform node, the only attributes you can access are those on the Transform node. You have to get the shape node…. which isn’t as simple as just getting the value of a property of the transformNode….
selected_items = cmds.ls(selection=True)
shapes = cmds.listRelatives(selected_items, shapes=True)
Using PyMel we can do this far more conveniently as everything is objects.
selectedTransform = pymel.core.general.selected()