View Full Version : selection[1].modifier link to Pick button?

04 April 2012, 04:37 PM
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 = (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?

04 April 2012, 04:42 PM
So if obj is the object you're looking for, why not use that directly?

04 April 2012, 04:49 PM
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?

04 April 2012, 05:12 PM
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?

CGTalk Moderation
04 April 2012, 05:12 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.