[Maya-Python] Re: Get point position using Uv map

2014-11-01 Thread Jan
I don't think there is an API function for that. You could write your own 
function to find the closest UV based on the mesh's UV list. 
However it might be a lot easier to just skip the results that are not within 
the coverage (ie. sorting out each result that is 0.0,0.0)

-- 
You received this message because you are subscribed to the Google Groups 
Python Programming for Autodesk Maya group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to python_inside_maya+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/d59cd4aa-2e49-45b8-a0d4-44729b5ea369%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Maya-Python] Re: using om.MVector.rotateBy

2014-11-01 Thread Pedro Bellini
Hi Sam, to answer your last question
if you want a different axis to rotate the vector around I probably would 
use MQuaternions, like

import maya.OpenMaya as om
from maya import cmds 
import math

cube = cmds.polyCube(w=10)[0]
dag = om.MDagPath()
sel = om.MSelectionList()
sel.add(cube)
sel.getDagPath(0,dag)

#
transformFn = om.MFnTransform(dag)
vec1 = om.MVector(0,1,0) # rotation in Y vec
angle = 30
radAngle = math.radians(angle)
quat = om.MQuaternion(radAngle, vec1)
transformFn.setRotation(quat)

vec2=om.MVector(1,1,0)
quat2=om.MQuaternion(radAngle, vec2)
transformFn.setRotation(quat2)
# totates 30 degress about the [1,1,0] vector

vec3 = vec2.rotateBy(quat)
print vec3.x, vec3.y, vec3.z
# vec 3 is the vec2 [1,1,0] rotated 30 degrees in vec1 [0,1,0] axis
# therefore vec3 y value should maitain unchanged while
# vec3 x value becomes cos(30)
# vec3 z value becomes -sin(30)

vec4 = vec1.rotateBy(quat2)
print vec4.x, vec4.y, vec4.z
# vec 4 is the vec1 [0,1,0] rotated 30 degrees in vec2 [1,1,0] axis

## note that if you try to rotate vec1 on quat, or vec2 on quat2 the 
resulting vector will be unchanged
## since you are rotating a vector 30 degrees on its own axis...
## like:
vec5 =vec1.rotateBy(quat)
print vec5.x, vec5.y, vec5.z
vec6 = vec2.rotateBy(quat2)
print vec6.x, vec6.y, vec6.z

# cheers

On Wednesday, October 29, 2014 6:20:39 AM UTC-7, sam williams wrote:

 hey Pedro, as you can only specify x,y and z axis. Is there a way of using 
 a specific vector to rotate around? so if instead of y being (0,1,0) 
 can (-0.12542495647, 0.971342830439, -0.201895235331) be used to represent 
 the y axis to use in the rotateBy method.

 thanks, 
 Sam


-- 
You received this message because you are subscribed to the Google Groups 
Python Programming for Autodesk Maya group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to python_inside_maya+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/b25024fd-e1a4-427a-9614-0451b4ce708f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Maya-Python] Re: Get point position using Uv map

2014-11-01 Thread illunara
Ah, okay. I will try to work it out somehow, anyway, thank for helping me, 
Jan :D

-- 
You received this message because you are subscribed to the Google Groups 
Python Programming for Autodesk Maya group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to python_inside_maya+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/3a379cc7-46db-4c03-bc63-1f3ec0d0a26a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.