Notifications
Clear all

[Closed] selection[1].modifier link to Pick button?

Hi everyone,

Just a quick question:
I have following line in my script –

local uv = selection[1].modifiers[ #unwrap_uvw ];

Want to change (link) selection[1] to pick button object.

So when the line is

local uv = $Box001.modifiers[ #unwrap_uvw ];

it works

But as soon I change it to

objname = obj.name (that is when button picked obj)
$(objname).modifiers[ #unwrap_uvw ];

it comes back with error giving the box name and it’s coordinate.

Can anybody advice how to write it correctly?

3 Replies

So if obj is the object you’re looking for, why not use that directly?

obj.modifiers[#unwrap_uvw]

Thanks for reply
So I have 2 pick buttons in this script, how do I define which object?

If I got it right, I need to use folowing

obj1mod = obj.modifiers[#unwrap_uvw] 

Under pick button picked?

Got it working thanks –

on btnpick picked obj  do
global uv = obj.modifiers[ #unwrap_uvw ];


local verts = (uv.NumberVertices());

Another question:

if (classof (modPanel.getCurrentObject()) == Unwrap_UVW) then (

Again I need to make it to check the modifier of picked object (from previous code),
Also I’ve noticed if there is another modifier on top of UV, the code doesn’t work, how to make it search for UV?