PDA

View Full Version : Commands working in listener but not script


stuh505
10-08-2005, 07:28 PM
addModifier obj (unwrap_uvw())
obj.unwrap_uvw.selectBySG 1
obj.unwrap_uvw.planarMap
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

marktsang
10-08-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

mark

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

prettyPixel
10-08-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...)

http://forums.cgsociety.org/showthread.php?t=219363

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

$.function

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

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

/Andreas

prettyPixel
10-09-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.

obj=selection[1]
select obj
max modify mode
addModifier obj (unwrap_uvw())
objUnwrap=obj.modifiers[1].unwrap
objUnwrap.edit()
objUnwrap2=obj.modifiers[1].unwrap2
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...

stuh505
10-09-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-09-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.