if then problem

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

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
dussla's picture

there is some problem

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

if i use it , uvmmap modfidifer accumulate continuly

Garp's picture

That's weird.

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.

kimarotta's picture

try thismax modify modeobj

try this

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

kimarotta.com.br
3d Artist  

dussla's picture

i can,'t use movdifiers.count

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's picture

ok... try this other ... not

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()

kimarotta.com.br
3d Artist  

dussla's picture

thank you really

good work , thank you for your effort

always thank you

Garp's picture

Or...

if $.modifiers[#edit_poly] == undefined do
    addModifier $ (edit_poly())
kimarotta's picture

very good, simple and useful,

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

kimarotta.com.br
3d Artist  

MKlejnowski's picture

In this case it is used to

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).

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.