View Full Version : Commands working in listener but not script

10 October 2005, 07:28 PM
addModifier obj (unwrap_uvw())
obj.unwrap_uvw.selectBySG 1
obj.unwrap_uvw.setProjectionType 3
obj.unwrap_uvw.pack 0 0.02 true false false
convertToMesh obj

A short segment of code to apply planar mapping and pack the UV's. No bugs when I run it from the script, but the UV's aren't packed.

If I then select the object and do

$.unwrap_uvw.pack 0 0.02 true false false

then the UV's pack..?

By the way if there is a way to map the UV coords like this without using modifiers let me know, thanks

EDIT: figured it out...for some reason the uvw commands only work if the object is selected

10 October 2005, 07:46 PM
The following methods require that the Unwrap UVW modifier be the displayed modifier in the Modify panel, and that the Modify panel is active.

setCommandPanelTaskMode #modify


10 October 2005, 07:48 PM
hm, just tried that as per your suggestion but it didn't work for me. selecting the object did work.

10 October 2005, 09:40 PM
Indeed, there are several strange problems with the 'Unwrap UVW' modifier.
To use it is not always obvious.
In some cases it is necessary to open the interface. Otherwise operations do not take effect.

I explain in this text the things to do to use it. (at least those which I know...)

10 October 2005, 09:01 AM
But in the code you write:


That you have $ means that the object has to be selected since otherwise $ is undefined.
Instead write something like

But I get the feeling that you already know this...


10 October 2005, 10:37 AM
I see in your script that the interface is not open. The function 'selectBySG' does not have any effect if the user interface is closed.

select obj
max modify mode
addModifier obj (unwrap_uvw())
objUnwrap2.setTVSubObjectMode 3
objUnwrap2.setTVElementMode false
objUnwrap2.selectBySG 1 -- the interface must be open
objUnwrap2.pack 0 0.002 true true true
objUnwrap2.selectFaces #{}
convertToMesh obj

To open the interface is REALLY VERY SLOW.
I never found solution with this problem...

If somebody knows a method to avoid that it will be the welcome :)
EDIT: or to confirm that it is not possible...

10 October 2005, 03:53 PM
To open the interface is REALLY VERY SLOW.
I never found solution with this problem...

If you have a progress bar it won't open the interface, I think it will still work but I haven't tested it. I did test it with some other things and it made a tremendous speed increase.

CGTalk Moderation
10 October 2005, 03:53 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.