Basic undefined error?

Basic undefined error?

Anonymous
Not applicable
851 Views
2 Replies
Message 1 of 3

Basic undefined error?

Anonymous
Not applicable

Hi I am getting an error on a script.....Unkown property : "utile" in undefined

Is this due to declaring variables?

 

I am stuck-?

 

 

All I want to do is assign a certain tiling value  to multiple objects...

 

I have 

 

rollout UVW "settings"
(
spinner uuvspin "U Tile:" fieldwidth: 56 range:[-1e7,1e7,1] type:#float align:#right
button tileBTN "Change Tile Size" width:100 height:24 align:#center

fn ResizeUVW =
(
for x in selection do
(
x.modifiers[#UVW_Mapping].utile = uuvspin.value
)
)

on tileBTN pressed do
(
ResizeUVW()
)

)

0 Likes
852 Views
2 Replies
Replies (2)
Message 2 of 3

Swordslayer
Advisor
Advisor

Unless it's a one-off thing, at least a basic level of error-checking is always needed. If the modifier name is different from UVW Mapping, you won't get it this way (and will get undefined instead of the modifier instance), same if there's no mapping modifier in the first place.

 

try destroyDialog UVW_dialog catch()
rollout UVW_dialog "settings"
(
	spinner uuvspin "U Tile:" fieldwidth: 56 range:[-1e7,1e7,1] type:#float align:#right
	button tileBTN "Change Tile Size" width:100 height:24 align:#center

	mapped fn ResizeUVW obj value =
		for m in obj.modifiers
			where isKindOf m UVWMap do
				m.utile = value

	on tileBTN pressed do
		ResizeUVW selection uuvspin.value
)
createDialog UVW_dialog

 

0 Likes
Message 3 of 3

Anonymous
Not applicable

Genius....

 

of course!

works a treat

 

thanks

 

0 Likes