Hello everyone,
I have made a script that replaces the default 3ds max Mirror tool, and I need some help. I'm working with containers, so I want be able to mirror the parent container and all of its contents along a chosen axis. Now the problem is that I don't know how to make the whole selection mirror the exact distance from the objects to the parent container's pivot in the opposite direction (just like the default mirror tool does). You can see what I mean from the images below.
Any help would be greatly appreciated.
This is the code I've got so far:
macroScript waRp_Mirror
category:"waRp Tools"
buttonText:"waRp Mirror"
tooltip:"waRp Mirror"
icon:#("warp_tools_mirror",1)
(
rollout waRp_Mirror "waRp Mirror" width:144 height:202
(
groupBox gb_axis "Axis" pos:[8,11] width:127 height:45
radioButtons rb_axis "" pos:[22,28] width:97 height:16 labels:#("X", "Y", "Z") columns:3
groupBox gb_clone "Clone Selection" pos:[9,67] width:127 height:60
radioButtons rb_clone "" pos:[20,86] width:64 height:32 labels:#("Copy", "No Clone") columns:1
checkbox cb_collapse "Collapse All" pos:[11,136] width:80 height:20 checked: true
button btn_mirror "Mirror" pos:[41,163] width:61 height:25
on btn_mirror pressed do
(
--prvo removeTurbo pa collapsni go poly-to
macros.run "waRp Tools" "waRp_RemoveTurbo"
local selNodes = getCurrentSelection()
local newNodes
--- CLONE SELECTION ---
if rb_clone.state == 1 then
(
maxOps.clonenodes $ cloneType:#copy newNodes:&newNodes
select NewNodes
ConvertToPoly(selection)
)
else
ConvertToPoly(selection)
--- ---
--- XFORM MODIFIER ---
myXform= xform()
myxform.gizmo.scale=[-1,-1,-1]
if rb_axis.state == 1 then
myxform.gizmo.rotation += quat 1 0 0 0
else if rb_axis.state == 2 then
(
myxform.gizmo.rotation += quat 1 0 0 0
myxform.gizmo.rotation += quat 0 0 1 0
)
else
myxform.gizmo.rotation += quat 0 0 1 0
modpanel.addModToSelection(myXform)
--- ---
--- NORMAL MODIFIER ---
myNormal = Normalmodifier()
myNormal.flip=true
modPanel.addModToSelection(myNormal)
--- ---
-- collapse objects
if cb_collapse.checked then
ConvertToPoly(selection as array)
DestroyDialog waRp_Mirror
)
)
on execute do
(
if selection.count >= 1 then
createDialog waRp_Mirror
else
messagebox "Select at least one object!" title: "waRp Mirror"
)
)
barigazy · 2013-05-09