emrahgunduz
always eats his vegetables
Blog RSS Feed
  • twitter
  • friendfeed
  • linkedin
  • facebook
  • vimeo
  • flickr
  • lastfm
Auto Mirror Selected Using a Specific/Picked Object

Auto Mirror Selected Using a Specific/Picked Object

One of the missing parts of 3ds max is, you can’t find any APIs related to most of the functions. Mirroring is one of them. It has no functions that you can use from maxscript. Just “max mirror” which actually opens the mirror dialog toolbox.

Yet, there is another way for controlling max: dialog monitoring. If you are so tired of selecting objects that needs to be mirrored to a specific object, and selecting or picking that object, plus changing the axis to “use transform center”, this is the script for you.

Download Auto Mirror Script

macroScript AUTO_MIRROR category:"emrahgunduz.com" tooltip:"Auto mirror using MIRROROBJ" buttontext:"Auto Mirror" (   fn XMirror =   (     local Xhwnd=dialogMonitorOps.getWindowHandle()     local Xstring=UIAccessor.GetWindowText Xhwnd     --//--     if Xhwnd != undefined then       (       if Xstring != undefined and (findString Xstring "Mirror") != undefined then         (         UIAccessor.PressButtonByName Xhwnd "X"         UIAccessor.PressButtonByName Xhwnd "Instance"         UIAccessor.PressDefaultButton()         )       )     true   )   undo on (     MirrorOBJ = $MIRROROBJ     SelectedOBJ = $     toolMode.coordsys MirrorOBJ     toolMode.transformCenter()     dialogMonitorOps.registerNotification XMirror id:#findmirror     dialogMonitorOps.enabled=true     --//--     max mirror     --//--     dialogMonitorOps.unregisterNotification id:#findmirror     dialogMonitorOps.enabled=false     toolMode.coordsys #view     toolMode.selectionCenter()   ) )
This script assumes that you’ve an object named MIRROROBJ in the scene, which will be used as the base. The axis of this object will be our transform center. So keep in mind that and before using this script, add your mirror object and move it to anywhere you like.

Here are a few screenshots of how this script works:

  • Drag drop script to 3dsmax
  • Configure your user panel and add script to a quad menu
  • Rename your object as MIRROROBJ
  • Use quad menu option for mirroring
  • Mirroring accomplished
  • You can use any object, any angle, any location for mirroring

This post's short url is: http://emrg.me/4g

3dsmax : Name An Object From Material Name

This question came a few days ago via a comment. Is it possible to name an object by simply checking the material, and assign that name to the object? Answer is yes, and here is a script that will accomplish this easy task.

A selected object’s material name can be accessed with :
$.material.name

Assigning a name to an object goes like this :
$.name = “MyNewName”

And for a unique name you can use this one :
$.name = uniqueName “MyNewName”

If you’ve got more than one object selected, you can do something like this :

sel = selection as array count = 1 undo on   (     if sel.count > 0 then     (       while count <= sel.count do       (         select sel[count]         count += 1         $.name = uniqueName ($.material.name as String)       )     ) )
This will get the material name, and assign it to the object. Plus, it adds an auto incremented number at the end of each name. You can simply delete “uniqueName”, if you do not want this number. Objects can have same names, 3dsmax will not mind.

There is no error caching in this script. If you select an object that is not a member of the mesh class (like lights, cameras, helpers, etc), you might encounter errors.

This post's short url is: http://emrg.me/52

Calendar

May 2012
M T W T F S S
« Feb    
 123456
78910111213
14151617181920
21222324252627
28293031  
Web Analytics
Author: Emrah Gunduz