[Maya-Python] MMeshIntersector in Python API 2.0

2017-11-06 Thread Angelo
Has anyone had any success using MMeshIntersector in python api 2.0? import maya.api.OpenMaya as om import pymel.core as pm obj = pm.polyCube(ch=0)[0] path = om.MGlobal.getSelectionListByName(obj.name()).getDagPath(0) matrix = path.inclusiveMatrix() node = path.node() intersector = om.MMeshInter

[Maya-Python] Deform function not called when editing deformer membership in Maya 2018

2017-11-09 Thread Angelo
I noticed the deform function doesn't call when you edit the deformer membership of a custom deformer in Maya 2018 but it does in 2016. Is there something new that has to be done? you can test it with Chad Vernon's python implementation of the blendNode ( http://www.chadvernon.com/blog/resources/

[Maya-Python] Re: MMeshIntersector in Python API 2.0

2017-11-10 Thread Angelo
So I'm convinced this is a Maya bug. I was able to partially create it. I figured out you have to get the path to the shape node instead of the transform. Maya is usually able to handle this but it doesn't for MMeshIntersector for some reason. What still doesn't work is the second parameter for

[Maya-Python] Re: Array Attribute on maya python api deformer node

2017-11-24 Thread Angelo
def inititialize(self) self.aBindData = cAttr.create('bindData', 'bindData') cAttr.setArray(True) def deform(self, data, itGeo, matrix, index): bindArrayData = data.inputArrayValue(self.aBindData) size = bindArrayData.elementCount() for i in range(size): bindData =

[Maya-Python] Re: rotate vector

2019-03-22 Thread Angelo
If your vectors are vectors that make up a rotation matrix, you can use quaternions to rotate all the vectors. for example: rot_matrix = (x_vec, y_vec, z_vec, om.MPoint.kOrigin) # you want to rotate x_vec to x_vec_target and apply that too the other vectors to rotate the matrix offset_quat = x_

Re: [Maya-Python] How can I correctly read a matrix attribute?

2017-11-23 Thread Angelo Sta. Catalina
you're getting the matrix successfully when you call "print mat" If you compare your input matrix and the values printed from "print mat", they should be identical. As far as the other stuff goes, I'm not exactly sure what you're trying to accomplish. if you're trying to return the input matrix as

Re: [Maya-Python] How can I correctly read a matrix attribute?

2017-11-23 Thread Angelo Sta. Catalina
Oh. I see a problem. In your initialize method, you shouldn't use om.MFnTypedAttribute to create a matrix attribute. Use om.MFnMatrixAttribute. mAttr = om.MFnMatrixAttribute() Node.aMatrix = mAttr.create('matrix', 'mat') Try doing that. On Thu, Nov 23, 2017 at 7:01 PM, Giulio Martella < giuliom

Re: [Maya-Python] How can I correctly read a matrix attribute?

2017-11-23 Thread Angelo Sta. Catalina
Also, to multiply a point, you can simply just cast an MPoint and multply that directly into your MMatrix variable: mat. Maya supports MPoint to MMatrix multiplication. om.MPoint() * om.MMatrix() will work. On Thu, Nov 23, 2017 at 7:19 PM, Angelo Sta. Catalina < angelostacatal...@gmail.

Re: [Maya-Python] Python custom node optimisation

2017-11-24 Thread Angelo Sta. Catalina
Maya made the change to remove MStatus from the python api so that users handle exceptions through using native python methods. I forget which version they made this change but you can read about it here (Under Exceptions vs MStatus topic). http://help.autodesk.com/view/MAYAUL/2018/ENU/?guid=__file

Re: [Maya-Python] [PyMEL] Sparse Component List handling

2017-11-24 Thread Angelo Sta. Catalina
I'm not sure if this will help but I use the flatten flag in the mel command ls. pm.ls(sl=1, fl=1) This will return a list of selected components flattened. I believe sets also has a flatten flag that you can use to flatten components. On Fri, Nov 24, 2017 at 11:44 AM, Paul Molodowitch wrote:

Re: [Maya-Python] custom node array attribute not saved properly

2017-12-06 Thread Angelo Sta. Catalina
The default behavior for an MPxNode is to only save when the value differs from the default value or if there is an incoming connection. You can read more about it in the MPxNode doc's. You can change the behavior by overwriting the method: om.MPxNode.shouldSave() On Wed, Dec 6, 2017 at 1:11 PM, c

Re: [Maya-Python] MItDependencyNodes missing Maya 2016 API 2.0?

2017-12-09 Thread Angelo Sta. Catalina
That class exists in maya.api.OpenMaya version 2018.1 On Sat, Dec 9, 2017 at 4:35 PM, David Lantos wrote: > Hi Everyone! > > > I found MItDependencyNodes > > class > in the maya document

Re: [Maya-Python] Re: query a maya nurbs curve for its basis / interpolation style

2018-03-04 Thread Angelo Sta. Catalina
NURBS stands for non-uniform-rational-b-spline. Its very similar both in appearance and implementation. There's a really good book out there called "The Nurbs Book" which goes in depth into nurbs curve and surface creation/manipulation. I has C style snippets which you can reference to to write you

Re: [Maya-Python] Getting rotations beyond -180 to 180 degree range from matrix

2018-03-19 Thread Angelo Sta. Catalina
This subject can get quite complicated. How exactly are you interpolating rotations with matrices in Maya? From a matrix, you have to extract the rotation matrix, then either convert it to euler rotations or quaternions before doing any kind of interpolation. Just calculate the rotations using the

Re: [Maya-Python] Mel to Python

2018-05-09 Thread Angelo Sta. Catalina
import maya.cmds as cmds cmds.dgdirty(a=True) On Wed, May 9, 2018, 12:57 PM Ravi Chandran wrote: > anyone help me this small mel script to python please > > > dgdirty -a > > -- > You received this message because you are subscribed to the Google Groups > "Python Programming for Autodesk Maya" gr

Re: [Maya-Python] VertexConstraint

2018-05-21 Thread Angelo Sta. Catalina
You cant attach anything to a vertex without loosing GPU parallel functionality. Maya sends calculation data to display the geometry to the GPU. GPU then sends it to your monitor. When you attach anything to a piece of geo, it has to be calculated in the CPU. When this happens, Maya automatically d

Re: [Maya-Python] VertexConstraint

2018-05-21 Thread Angelo Sta. Catalina
With GPU, even hidden meshes are evaluated. On Mon, May 21, 2018, 8:12 AM Daniele Dolci wrote: > Hi, >> >> > This is why I created a low res driver and I have hidden it from the > viewport. if both the low res driver and the controls are hidden, only the > high res mesh will be evaluated. > > >

Re: [Maya-Python] rewrite maya follicle node

2018-11-19 Thread Angelo Sta. Catalina
> > Why not just use MFnMesh.getPoint? Build an orthonormal coordinate using > connected points. -- 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 em

Re: [Maya-Python] rewrite maya follicle node

2018-11-20 Thread Angelo Sta. Catalina
> > How about rotation , any idea ? > > Normal can get from interpolation of 3 points normal . > Tangent should base on UV , have no idea yet . > > 在 2018年11月19日星期一 UTC+8下午10:30:17,Angelo写道: >> >> Why not just use MFnMesh.getPoint? Build an orthonormal coordinate using >

Re: [Maya-Python] rewrite maya follicle node

2018-11-24 Thread Angelo Sta. Catalina
much slower > than maya follicle . > > So I did what @Angelo mentioned method to have another plugin with 3 > points orthonormal coordinate . The inputs is 5 , index of A,B,C point and > UV , so sad even this simple pure math function can't run faster than maya > follicle , >

Re: [Maya-Python] Re: [NurbsCurve] Alogrithm create curve from joints

2018-11-28 Thread Angelo Sta. Catalina
I've written quite a few bits of code to calculate a nurbs curve without using Maya's built in commands - In plugins, primarily because Maya's MFnNurbsCurve isn't multi thread safe. Its not a simple algorithm since you have to calculate for continuity. If speed really is an issue, I would look into

Re: [Maya-Python] Unable to get correct attribute values from MFnAnimCurve

2020-02-10 Thread Angelo Sta. Catalina
you're getting values in radians. You can convert it back to degrees using the math module math.degrees(x) On Mon, Feb 10, 2020 at 5:33 PM yann19 wrote: > I had a locator, where the following attributes are keyed at Frame 2: > >- rotateX : 10 >- rotateY : 20 >- rotateZ : 30 > > > I