
I wish you happy holidays!
Autodesk 3ds Max Tech Blog
Life is about learning, from your own experiences and from helpful people along the way. Everything from a 3d tip to larger topics such as composition and color theory, this is my area to give back to the graphics community.
While several lessons deal directly with 3ds Max, I've tried to keep discussions as software unspecific as possible, so you won't have to be a Max user to get something from these lessons.
for i in selection do (
c = snapshot i
c.transform = matrix3 1
d = dummy boxsize:(c.max - c.min)
delete c
d.transform = i.transform
d.pos = i.center
)
for i in selection do (
local c
with undo off ( c = snapshot i )
c.transform = matrix3 1
d = dummy boxsize:(c.max - c.min)
with undo off ( delete c )
d.transform = i.transform
d.pos = i.center
)
-- collect objects which has "height" property
objs = for o in objects where \
hasProperty o "height" collect o
-- collect Multimaterials from scene
MMats = for m in sceneMaterials where \
classOf m == Multimaterial collect m
-- filter array and collect integer values to a new array
oldArray = #("a", 12, "b", 3.5, 7)
newArray = for i in oldArray where \
classOf i == integer collect i
--> #(12, 7)
-- old and bad style coding (SLOW):
for o in Lights do
try(o.rgb = random black white)catch()
-- Optimized code:
for o in Lights where classOf o != TargetObject do
o.rgb = random black white
Basic script example
How to filter out shapes only in selection.
Collecting Photometric lights
Collect in array all photometric lights that are selected.
Remove specific type of object from scene
Delete all PF_Source in the scene.
Select objects with 0 vertices
How to exclude (delete or deselect) objects with 0 vertices (helpers objects).
-- collect 'em
g1 = $Bus_Controller_* as array
g2 = $Bus_Collider_* as array
g3 = $Bus_Graphic_* as array
-- LINK
for i=1 to g1.count do g2[i].parent = g3[i].parent = g1[i]