ScriptSpot

Forum topic · General Scripting

can you find modifier copy code erro ?

By dussla · 2012-08-30

Description

i made this code
but there is problem

if i selct many object , error message " unable to conver : undefined to type : modifier
what problem ?

S=#()
tst = #()
sel=selection as array

for z in sel do

(

for h in z.modifiers do

(if classof h == uvwmap then
(
append tst h

)

)

for o in geometry do

(

if o.name == z.name then

(

if tst.count != 0 then
(

tmp = copy z.modifiers[#UVW_Mapping]

deleteModifier z z.uvw_mapping

addmodifier o tmp

)

else
(
--tmp = copy z.modifiers[#UVW_Mapping]

)

)

)

Comments (4)

kimarotta · 2012-08-30

I'm trying to solve your other post ... below is part of your problem.
example...


modCp = #()
for z in selection do
(
	if z.modifiers != 0 then (
	for h = 1 to z.modifiers.count do 
	(if classof z.modifiers[h] == uvwmap do (insertItem (copy z.modifiers[h]) modCp h))
	)
)

there is 1 more problem

dussla · 2012-08-30

your code is very good
but i can't understand well still

i made code again
work is good
but there is problem . that is to be copy many uvwmaps in 1 object
i would like to be copy 1 times

in advance , thank you

S=#()
tst = #()
sel=selection as array

modCp = #()

for z in sel do

(

for o in geometry do

(

if z.name == o.name then

(

if z.modifiers != 0 then (
for h = 1 to z.modifiers.count do
(if classof z.modifiers[h] == uvwmap do

tmp = copy z.modifiers[#UVW_Mapping]
addmodifier o tmp
--deleteModifier o o.uvw_mapping

)

)

else
(

)

)

)

)

kimarotta · 2012-08-30

I do not understand...

work is good

dussla · 2012-08-31

at any way thank you