PDA

View Full Version : UV Script Question


Chingis
01-12-2007, 05:07 PM
How do I make the following work on whatever UV samples are currently selected?

ScaleUVW "cylinder.sample
", "cylinder.polymsh.cls.Texture_Coordinates_AUTO.Texture_Projection", 2, 1, 1, siRelative, siUVW, 0


I'm trying to make a script that can scale the selected UVs up and down in either the U or V direction.

Thanks,

CS

Mic_Ma
01-15-2007, 04:45 AM
This works on any selection of your cylinder:

ScaleUVW selection(0), "cylinder.polymsh.cls.Texture_Coordinates_AUTO.Text ure_Projection", 2, 1, 1, siRelative, siUVW, 0

Chingis
01-16-2007, 02:37 PM
Do you know how to get it to work on whatever is selected (no matter what combination of object/uv selection I have. I want it to be a universal script so having it constrained to an object of a specific name is not very useful. Sorry, I'm a programming idiot. I really did read through the SDK trying to find the answer though.

Thanks

Strang
01-16-2007, 09:42 PM
if your using xsi 6 there is a new tool that may help with this. Tools > Transform UVs

look up what's new section under texturing. explains it all there

good luck

steven

misterdi
01-17-2007, 02:34 AM
Do you know how to get it to work on whatever is selected (no matter what combination of object/uv selection I have. I want it to be a universal script so having it constrained to an object of a specific name is not very useful. Sorry, I'm a programming idiot. I really did read through the SDK trying to find the answer though.

Thanks

You need to find out the clusters first before you could make it as variables.

Here is a sample of code in JScript

var oSel = selection(0);

// find its Geometry
var oGeom = oSel.ActivePrimitive.Geometry;

// find clusters under the geometry
var oCluster = oGeom.Clusters;

// Enumerate each cluster, look for type = sample
for (var i = 0; i<oCluster.Count; i++)
{
if(oCluster(i).type == "sample")
{
logmessage(oCluster(i) + " is texture projection Cluster");
}
}

Chingis
01-19-2007, 09:08 PM
Ok, what I really want to do is this...

If I'm in a viewport I want the script to scale the UVs based on the poly selection and if I'm in the Texture Editor it will scale them based on the UV Sample selection. If anything but polys or samples are selected nothing would happen.

So I need to get the selection of the currently active view right? Or if no components were selected in a 3d view than it would look for a selection in the Texture Editor if it was open. I'm not sure how to do that. Does it have to do with Application.Selection?

Maybe I should just shut up and stop trying to be an artist that can program eh?

Any help is appreciated though.

CS

CGTalk Moderation
01-19-2007, 09:08 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.