ScriptSpot

Forum topic · Scripts Wanted

if then problem

By dussla · 2012-07-26

Description

i made a box and i would like to apply edit poly automaticly

if $.modifier == undefined then

(

apply edit poly
)

else

(

pass edit poly
)

is that right ?

Comments (9)

there is some problem

dussla · 2012-07-30

if $.modifiers[#uvwmap] == undefined do
addModifier $ (uvwmap())

if i use it , uvmmap modfidifer accumulate continuly

That's weird.

Garp · 2012-07-31

I copy/pasted your code and tried in max 2012. It worked fine.
So I tried it in old max 9 and sure enough it didn't recognize #uvwmap.
It does work with #uvw_mapping instead.
It looks like they change a few names between versions. Well done, Autodesk.

try thismax modify modeobj

kimarotta · 2012-07-26

try this


max modify mode
---
obj = $
tst = obj.modifiers.count
ep = edit_poly()
if tst == 0 then (addModifier obj ep)

i can,'t use movdifiers.count

dussla · 2012-07-26

i have to apply 2-3 modfier in obj
so i can't use modifers.count
ex)

so i have to use

$.modifier[uvwmap] == undefined
(

modpanel.addmodtoselection(uvwmap()) ui:on

)

$.modifier[editpoly] == undefined
(

modpanel.addmodtoselection(eidtpoly()) ui:on

kimarotta · 2012-07-26

ok... try this other ... not believe to be the right way ... but I think it works, would be to use the correct "modPanel.validModifier (< modifier > | < modifier_class >)." but I could not make it work, look for in help...


fn eptst =
(
ep = Edit_Poly()
o = $
tst = #()
for m in o.modifiers do (if classof m == Edit_poly then (append tst m))
if tst.count == 0 then (addmodifier o (ep))
)
eptst()

thank you really

dussla · 2012-07-27

good work , thank you for your effort

always thank you

Or...

Garp · 2012-07-27

if $.modifiers[#edit_poly] == undefined do
    addModifier $ (edit_poly())

kimarotta · 2012-07-27

very good, simple and useful, I like... What it means "#" before of edit_poly ?

MKlejnowski · 2012-08-05

In this case it is used to pick a modifier based on its name. So if you have a modifier with a named "Edit Poly" then you will pick it by the name #Edit_Poly (replacing all spaces with underscore).