QQ聊天

MaxScript镜像函数

看到有网友需要写的,其实镜像就是缩放改为负数

 

Fn MirrorObject argObjects argAxisName =
(
    local axisNames = #(#x,#y,#z)
    if FindItem axisNames argAxisName  == 0 do
    (
        throw "the second parameter error !!! -- valid values:#x,#y,#z"
    )
    
    local mirrorMatrix = matrix3 1
    if argAxisName == #x do mirrorMatrix.row1 *= -1
    if argAxisName == #y do mirrorMatrix.row2 *= -1
    if argAxisName == #z do mirrorMatrix.row3 *= -1

    local tempArray = #()
    maxOps.CloneNodes argObjects  expandHierarchy:true  newNodes:&tempArray
    for tempObject in tempArray where
    (
        tempObject.parent == undefined  or FindItem tempArray tempObject.parent  == 0
    )
    do 
    (
        tempObject.parent = undefined
        tempObject.transform *= mirrorMatrix
    )
    tempArray
)

MirrorObject selection #X

 

posted @ 2013-08-29 23:05  SITT  阅读(1222)  评论(1编辑  收藏  举报
QQ聊天