Notifications
Clear all

[Closed] problem in max script

hi. i write a script for double turbo smooth but when i aply it on editable poly error apears !
can somebody help me
here is code:
(
function hasTurboSmooth theNode=
(
result = false
local modifiresCount = theNode.modifires.count
if modifiresCount > 0 do
(
for n in 1 to modifiersCount while not result do
(
if classof theNode.modifiers[n] == turbosmooth do result = true
)
)

                                                result
                                )
                                
                                local allSelectedGeo = for curNode in $selection as array where superclassof curNode == Geometryclass and not hasTurboSmooth curNode collect curNode
                                addmodifier allSelectedGeo (TurboSmooth iteration:2 sepBySmGroups:true)
                                addmodifier allSelectedGeo (TurboSmooth iteration:1)

)

tnx

3 Replies

(
            function hasTurboSmooth theNode =
            (
                result = false
                local modifiresCount = theNode.modifiers.count
                if modifiresCount > 0 do
                (
                                for n in 1 to modifiersCount while not result do
                                (
                                                if classof theNode.modifiers[n] == turbosmooth do result = true
                                )
                )
                
                result
            )
            
            local allSelectedGeo = for curNode in (selection as array) where superclassof curNode == Geometryclass and not hasTurboSmooth curNode collect curNode
            addmodifier allSelectedGeo (TurboSmooth iteration:2 sepBySmGroups:true)
            addmodifier allSelectedGeo (TurboSmooth iteration:1)
)

thank you for your help ser


fn hasModifierClass node class: =
(
   local has = off
   for m in node.modifiers while not (has = iskindof m class) do ()
   has
)
/*
hasModifierClass <node> class:TurboSmooth
*/