[Maya-Python] Re: Issues unloading plugin despite custom nodes being removed

2020-06-09 Thread Cedric Bazillou
I think you might need as well toclear the undoStack and remove the custom 
data
you can procedurally discover what a plugin expose with *pluginIn*fo 

 ( *dependNode, data etc)*

-- 
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/87fe4056-99ae-4216-962b-b169858141cao%40googlegroups.com.


[Maya-Python] Re: Issues unloading plugin despite custom nodes being removed

2020-06-09 Thread Cedric Bazillou


On Monday, 8 June 2020 20:28:26 UTC-7, ger...@flyingbark.com.au wrote:
>
>
> Hello.  I posted this on the ngSkinTools forum but wanted to widen the net 
> a little as I'm not sure if its a Maya issue or a problem with the 3rd 
> party tool. 
>
> I get this:
> // Error: file: C:/Program 
> Files/Autodesk/Maya2017/scripts/others/pluginWin.mel line 1429: Plug-in, 
> "ngSkinTools", cannot be unloaded because it defines a MPxData derived type 
> that is still in use. // 
>
> I'm using Maya 2017 v5 and NG 1.7.9 in production and we are hitting a 
> problem where the 'requires' line for NG in the maya ascii file header 
> still exists ( *requires -dataType "ngSkinLayerDataStorage" "ngSkinTools" 
> "1.7.9" )* despite the custom nodes being removed from the scene.
>
> This is causing problems with files failing to open as NG is not currently 
> permitted as part of our studio environment (they are weary of 3rd Party 
> tools - but a few of us absolutely love NG's workflow and can't go back to 
> Maya's paleolithic solution)
>
> Currently I have written something that saves out the file as ma then line 
> by line removes the requires lines but it has to rewrite the entire file 
> and they can be big, then the file needs to be reopened. I need another 
> solution. Note that when the header is removed, the file reopens fine so to 
> my mind it appears to be possibly an issue of something in memory. Also 
> when the file has its custom nodes removed and is saved (with header 
> intact), opening the file again and unplugging the tool is successful - 
> again making me think its something stuck in the mayas memory for that 
> session..?
>
>
> Any advice appreciated.
>
> Gerard.
>

-- 
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/c1bd8b76-7b1e-4540-bc26-6fbfed735ab5o%40googlegroups.com.


[Maya-Python] Re: Distance Constraint

2019-05-24 Thread Cedric Bazillou
you should not read an output attribute that you write somewhere else in 
the same node( at least most of time, once you get more experience with 
attributeAffects internal attributes etc you can have some fun)
Are you not missing a second matrix attribute to do the distance clamping? 
( it will solve   self._mv_last_anchor , self._mv_point design issue) 

Le vendredi 24 mai 2019 00:23:25 UTC-7, Rémi Deletrain a écrit :
>
> Hi Michael,
>
> Normaly picture is a GIF. I think Google get just first frame au GIF...
>
> I try to store output value "outTranslate" for use it when i load my scene.
> I set "outTranslate" attribute to storable and in line 116 of my script I 
> get attribute value for initialize one variable. I not sure this solution 
> is really good beacause cause an error in first compute.
> # RuntimeError: maximum recursion depth exceeded in cmp // 
>
>
>

-- 
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/b5497ba2-8000-4e1e-b296-00d8eb6332e6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Maya-Python] Re: change attribute value in Node Compute Function

2019-03-25 Thread Cedric Bazillou
Hi,
normally you have to consider that your node is black box
it will take value from input attributes compute some data and write it on 
your output attributes
so you have to be careful not to write anything on your input attributes as 
it will do infinte loop  .

what are you trying to achieve?
some time to set default value you can use postConstructor 

 ()
or connectionMade 


Le dimanche 24 mars 2019 11:55:08 UTC-7, pety20...@gmail.com a écrit :
>
> hi, how can i, change value Of one attribute in my Node Compute Function?? 
>   
> if change value Of the attribute, compute function run again... 
> and, run again, run again, finally is crash! 
> because, i use attributeAffects fanction: 
> attributeAffects(inputAttributeIWantChangeIt, output); 
>
> i want, attributeAffects Disabled, temporarily!

-- 
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/da1699c4-2881-4f0a-b19e-65a1662a1953%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Maya-Python] MMeshIntersector: Getting world position / matrix of point in object space

2018-08-04 Thread Cedric Bazillou
tips wise maybe just put your code into a function so the garbage collector 
can clean up intermediate elements?

-- 
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/b17d5eb1-202e-43fc-8b00-cb87dc530148%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Maya-Python] plug-in "anti hacking" measures.

2018-08-04 Thread Cedric Bazillou
I know all too well what you are referring to:
i always though maya strongest point was its nodal nature and strong API ( 
so obviously all my rig were flatten into custom nodes:  at some point i 
even combine all  of them into a biped node and question the use of 
transform hierarchy to interact with it directly with an uber manipulator).

Protection wise its a lost cause ( every drm system by nature only prevent 
the majority of people from unregistered use of your product: but it wont 
stop motivated one), 
Its an hyper specialized field of its own, and like everything what are 
your priorities ?( producing content, extending your client base, providing 
support, custom solutions etc)

For me the most secured way to protect your plugin is for it to stay on 
computer/device not connected to the internet...

1 year is such a small amount of time  when you are a working professional 
and have limited free time + energy to devote to personal projects,you 
usually can only scratch the surface of one of the fields you mention above.
I value more the learning process than the result of my experiment : like 
used toys im not attached to my tools/plug-ins but to what they help me 
achieved.


if your selling a rig  as an asset maybe you can encode the data/mesh and 
do some check sum on volume / point count / name / hierarchy ?
Maybe some kind of combo with an encrypted alembic file feeding a reader 
node ( for the validation part ) which then output some mpxdata to your 
regular node.


-- 
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/46563ef5-1d30-4684-a0c2-e5dc84018663%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Maya-Python] plug-in "anti hacking" measures.

2018-08-04 Thread Cedric Bazillou
Im not even sure if its worth the effort:

lets be honest, rigging tool box or plugins are for the most part extremely 
elementary ( im not even sure how one can talk about intellectual property 
on something less than original, and for the most part inspired by 
community effort).
Personally i think the rig is the result produced from some tool, so its 
not that important: its the way you get to the result which is valuable.

Otherwise you can convert the rig to use factory nodes from maya:( much 
more difficult to decipher 12000 node network)
if you dont want to distribute plugins you can unpack the code logic into 
regular nodes (  python have some good abstract syntax tree / ast module 
and the same concept exists for c++).

-- 
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/54f797ef-764e-459a-9cd7-3fd9b66f953d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Maya-Python] MMeshIntersector: Getting world position / matrix of point in object space

2018-08-02 Thread Cedric Bazillou
Hi guys ,
normally by design the closest point value returned by the intersector is 
in object space
http://help.autodesk.com/view/MAYAUL/2017/ENU/?guid=__cpp_ref_closest_point_cmd_2closest_point_cmd_8cpp_example_html

in the function closestPointCmd::createDisplay( MPointOnMesh 
&
 
info, MMatrix 
&
 
matrix )
we go from local to worldspace by applying the mesh parent transform ( and 
its what is used as well for the matrix initialization.) is quite horrible 
that they labelled a local point as world point though..

i would as well stay as far as possible from the OpenMaya 2 layer if i can 
as you will soon see some hidden bugs and only 30 percent of the function 
are exposed ( dont concern yourself with pythonic argument as you will need 
to convert your code to c++ if your are serious about your work)

Le jeudi 2 août 2018 15:34:56 UTC-4, Luiz Amaral a écrit :
>
> OK I’m out of ideas now :/

-- 
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/7aed4d19-7f93-415d-8f83-50a98dad7f4c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Maya-Python] Re: [MPlug] error on get attribute

2018-06-29 Thread Cedric Bazillou
oh i know pretty much every part of the api related to animation / rigging.
Im just pointing out that in order to use the API in python you have to 
follow some strict procedure ( automatic binding with swig)

import maya.OpenMaya as OpenMaya
def getMObject(nodeName):
selList = OpenMaya.MSelectionList()
OpenMaya.MGlobal.getSelectionListByName(nodeName,  selList)
depNode = OpenMaya.MObject()
selList.getDependNode(0, depNode) 

return depNode


nodeFn = OpenMaya.MFnDependencyNode(getMObject('joint1'))
matrixPlug = nodeFn.findPlug('rotatePivot')

for childIndex in range(matrixPlug.numChildren()):
print matrixPlug.child(childIndex).asFloat()


Hence me getting a plug from dependency Mfn function set and not fiddling 
with the MSelectionList ( which conceptually is for dag/dependency and 
components).
Most of the time when working with python programmer, or other artist i 
have to point out that the api is exposed and use some python syntax but 
you must adopt maya philosophy ( so asking for more pythonic doesnt make 
sense  : at some point
you will write it in c++ and your python code will be a waste of time to 
translate back to pure API)

Le jeudi 28 juin 2018 17:05:19 UTC+1, Rémi Deletrain a écrit :
>
> I want to get a vector attribute like *translate*.
> Attribute *translate* and *rotatePivot* is a same type. But get 
> rotatePivot doesn't work and get translate works fine.
>
> from maya import OpenMaya
>
> def get_mplug(s_attr_node):
> m_sl = OpenMaya.MSelectionList ()
> m_sl.add (s_attr_node)
> mp = OpenMaya.MPlug ()
> m_sl.getPlug (0, mp)
> return mp
>
> try:
> mp_translate = get_mplug("joint1.translate")
> print mp_translate.child(0).name()
> print mp_translate.child(1).name()
> print mp_translate.child(2).name()
> except:
> print "Get translate doesn't works"
> else:
> print "Get translate works"
>
> try:
> mp_rotate_pivot = get_mplug("joint1.rotatePivot")
> print mp_rotate_pivot.child(0).name()
> print mp_rotate_pivot.child(1).name()
> print mp_rotate_pivot.child(2).name()
> except:
> print "Get rotatePivot doesn't works"
> else:
> print "Get rotatePivot works"
>
>
>

-- 
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/9510eb6d-579a-4cdd-9992-54bd53158ce3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Maya-Python] Re: [MPlug] error on get attribute

2018-06-23 Thread Cedric Bazillou
Depends on what your trying to achieve.
selection list first usage is for dag/dependency node and components.

Once you access them you can access their attributes easily 
So at first read what you point out doesn't look like an error.

Le vendredi 22 juin 2018 04:17:56 UTC-5, Rémi Deletrain a écrit :
>
> I everyone,
>
> I found an error on get attribute "rotatePivot" with api.
>
> It's possible to get this attribute with MFnDependencyNode like this
>
> m_sl = OpenMaya.MSelectionList()
> m_sl.add("null1")
>
> mo = OpenMaya.MObject()
> m_sl.getDependNode(0, mo)
>
> mfn = OpenMaya.MFnDependencyNode(mo)
> mp = mfn.findPlug("rotatePivot")
>
> But is not possible to get this attribute with MSelectionList
>
> m_sl = OpenMaya.MSelectionList()
> m_sl.add("null1.rotatePivot")
>
> mp = OpenMaya.MPlug()
> m_sl.getPlug(0, mp)
>
> But it's possible to get children like this
>
> m_sl = OpenMaya.MSelectionList()
> m_sl.add("null1.rotatePivotX")
>
> mp = OpenMaya.MPlug()
> m_sl.getPlug(0, mp)
>
> It's normal ?
>

-- 
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/2fcee142-c8c3-4870-894a-986eaff61c8d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Maya-Python] In the production pipeline, how to handle the problem that skinCluster deformations at large distances from origin?

2018-03-27 Thread Cedric Bazillou
personally my shot at it was more into evaluating the rig "In Place" at the 
origin and just parenting the deforming mesh to a root control. writing a 
batchMatrixNode is fun as well if you are concerned about performance( we 
even  have nowadays MPxSkinCluster class exposed to the API).
but this can be solve cheaply as well by your shot department if your scene 
is constrained to a the virtual room which slide to in order to  stuck the 
action to the origin. ( ala jamiroquai virtual insanity video clip).

Le lundi 26 mars 2018 15:15:35 UTC-5, Marcus Ottosson a écrit :
>
> Hi Yao,
>
> In my experience, you mostly just try to avoid this happening. You may not 
> have noticed, but this happens when things are too small as well!
>
> I'll assume by "production pipeline" you're referring to film, and in film 
> you typically work shot-by-shot. Before you even get to a shot in something 
> like Maya, you typically know what's going to happen and what's going to be 
> in it. With that information, it's typically trivial to figure out an 
> appropriate scale for things. At a higher level, the assets you create for 
> a film is typically created globally and span across many or all shots. In 
> that case, the same thing applies. You typically know up front, long before 
> getting to Maya, what a film consists of and what the average size of 
> things are.
>
> For example, if you're working on Bugs Life 2, then working in millimeters 
> is probably fine, even if there's the occasional human in some shots. But 
> if you're working on Pacific Rim 2, then millimeters can work against you. 
> Furthermore, if you know that in your film there's going to be lots of 
> locations but that all locations reside within the same "logical location" 
> - such as a single city - then you could try and replicate this single city 
> as one giant asset, and simply position the camera in various parts of it. 
> But see now you're in trouble, because you might run into the issue you've 
> been seeing. One solution is to either use this giant asset and move it, 
> such that the camera location is at the center of Maya. Another (and 
> perhaps more practical) is to chop the city up into individual parts, and 
> use the relevant part for the corresponding shot.
>
> Hope that helps. :)
> ​
>

-- 
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/67f799d1-f4a3-4427-9ea4-c68cfad80774%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Maya-Python] Re: Existential questions on attribute dirtying

2018-03-13 Thread Cedric Bazillou
Normally, should not concern yourself with that.
when you layout your node you have to define  the relationship between 
inputs  and output.

so if you check that your output plug needs to be refreshed one of the 
driver will trigger the computation and then your output will be written 
and mark dirty.
the other drivers wont have any effect at this point... ( from memory as i 
dont use maya that much at work anymore)


Le lundi 12 mars 2018 22:37:38 UTC-4, justin hidair a écrit :
>
>
>
> every now and then when changing , disconnecting , connecting an attribute 
> , MPxNode::setDependentsDirty() is called( easily observable)  , 
> if there's no connected output no compute is called() . However ,
>
>  1) What happens if a user change two different attributes at the same 
> time ? ( e.g. move two transforms dag nodes ) , 
> do Maya automatically order the thing and it seems to happen "at the same 
> time " or does it open a black hole ?
>
>  2) How would I change two *different*  attributes on a node with its 
> output connected , without calling compute() two times ?
>

-- 
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/8826736c-df89-4192-a18b-718203d2d08b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Maya-Python] Re: some Mel toughts

2017-08-19 Thread Cedric Bazillou
Like the other people said its a scripting language, and your variable are 
strongly typed ( so what is the point of whining :its normal to be confused 
when to start using something new...)
most of what you said for string manipulation has an equivalent in mel ( 
just need to learn how the docs are organized )

SO yeah its more difficult but you dont need OOp everywhere certainly not 
and at a scripting level ( automation and normal user executing code they 
drag from the script editor...).

A lot of people tend to be lure into aesthetics part of code when its the 
functionality and robustness which matters ( code maintenance and upgrade 
is another beast ).
When you will be a bit more c++ savy you can create your how nodes a 
command to do the actual work i you dont like mel syntax (for other people 
we work together at ilion btw )?

Le vendredi 18 août 2017 17:08:56 UTC-5, Rudi Hammad a écrit :
>
> Hello,
> I recently started a job in a studio that relies only on Mel, where python 
> is officially forbidden to use. I never used mel before. Since I am 
> familiar with C++ it was easy to learn, but still, I would like to share 
> some thought and try to explain 
> why I don´t like it. I only know 3 languages, python, c++ and mel now, so 
> maybe you can shed some light and tell me if my thoughts are wrong or if 
> you agree:
>
> 1-Why do you need to declare the data types in a high level scripting 
> languages? Aren´t data types declaration supposed to help manage memory to 
> optimize your programs? Since mel is high level, do you really need 
> declaring data types?
>  
> 2-the dollar sign before each variable. why? it feels that mel is not 
> smart enough to understand . It needs not only the declaration data type, 
> but also a $ to understand that you are creating a variable. 
>  
> 3-working with strings is excruciating in Mel. In python, since everything 
> is an object you can access all the string methods. .capitalize(), .split() 
> etc... To do simple .split in mel, you have to create a empty array first, 
> then use a proc like tokenize, give it the name to split, where to do the 
> split, and cast it in the empty array, and finally, retrieve the index you 
> need in that array in python you simply do somehting like myName = 
> l_myControl_CTR.split("_CTR")[0]...
>
> 4- quote marks to have a variable take a return. so string $myArray[] = 
> `ls -sl`;
>
> 5- no default values on arguments?! you can' t do something like proc 
> myFunc(string $myName="foo", int $default=1)
>
> (6. Also of course not having dictionaries , no external library, no OOP, 
> no access to the API are also big things to consider)
>
>
> My point is not to criticize anyone using Mel. This list is just to help 
> me understand a bit better how scripting languages compare to each other.
> When you work in a studio with a huge Mel legacy you have to get along 
> with it. And I do, I already developed many thing is mel. My only problem 
> is that I am not allowed to use python, but it is what it is.
>
> Anyway, to sum up, for the reasons I exposed above, I find Mel not smart, 
> long, ugly, very painful when it comes to strings, and very limited.
>
> So as I said, my point is not to criticize Mel, but try to understand it a 
> little better. Do you agree with anything I said, or am I just crazy
>
> Thanks,
> R
>

-- 
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/5c37a29e-ace2-470f-af93-5233240f7509%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Maya-Python] Re: AABB intersect

2017-05-22 Thread Cedric Bazillou
Good luck with the pymel roll back

Not too long ago it seems mandatory people have to bash mel  in order to 
promote pymel we now have a new generation of maya user which are mel 
illiterates:
they cant use the expression editor, parse ascii file using maya components 
or understand user setup or module files. ( what really amuse is to see 
that if you want to obfuscate your code nowadays you can write it in mel...)

Even on the developer side at Autodesk there seems to be questionable move
The latest version of maya (2017)is the worse for that:  adding callback to 
close node editor and polluting our plateform each time you open a new file 
(3 seconds clean up...)  ( why is arnold/pose editor loading pymel which 
will override all the loaded python plugins ?)

-- 
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/460171c2-84d5-4cb9-9439-3937fcc9676e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Maya-Python] Re: AABB intersect

2017-05-20 Thread Cedric Bazillou
Hi Alok,

i agree with your view as well, and intellectually understand the reasoning 
on the pipeline  level:
In your case getting the data in and out the DCC with reusable code base 
maximize your efficiency. 

What saddens me is some of this logic in action (on the tool side) in 
middle to big places.

Personally i come from an art background and had to build my own tools or 
devise my own techniques as it was clear what i wanted was too different to 
hope having it made by someone else.
As a rigger and character TD developing my tool is a  means to reach and 
produce better content ;those are byproduct of the process and can be 
trashed at any moment notice without regrets.

For this reason I never understood fabric engine advertising materials on 
sharing rigs across DCC...
Usually when you choose a commercial software you try to use it for its 
intrinsic qualities:
let say you will want to use :

   - 3dsmax for modeling/ texturing strengths
   - motionbuilder for performance/preview  and editing of biped creatures
   - maya for its animation capabilities ( which cover rigging robustness).

Does it make sense for example to write tools for motionbuilder in order 
for it to behave like maya or to swap to maya all together.
Or lets assume you are a video game developer and use 3dsmax, across the 
years your expertise with dotnet grows in parallel with your code base .
At some point you might want to switch to maya:
is it sane to think you can shove those tool in a new DCC with no effort?
Will it not be safer to use the c++ or python layer to interact with 
maya?(hell even the python 2.0 api layer is buggy and incomplete after all 
these years ( and dont get me started on pymel)).

Anyway thanks for your point of view!





-- 
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/424a2857-dd4c-4b65-a1d1-7db110c76d3d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Maya-Python] Re: AABB intersect

2017-05-19 Thread Cedric Bazillou

>
> Usually as a maya developper I tried to use what comes from the API...
>

http://help.autodesk.com/view/MAYAUL/2017/ENU/?guid=__cpp_ref_class_m_bounding_box_html

the MBoundingbox class provides 2 useful methods : contains and intersect ( 
one if for point, second is for a second bounding box)
So here the answer is trivial as a ray can produce a boundingbox and your 
problem solved in 3 lines... 

what a lot of python programmera forget is that you are doing work inside a 
dcc and thus you need to take the time to learn/ master this platform 
before coding thing yourself or try to fight it

-- 
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/a149eb2c-b060-4159-b464-1825a6b41573%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Maya-Python] Re: URGENT : Merge with API (C++ and / or Python)

2017-04-13 Thread Cedric Bazillou
Im not sure what is your problem?
Sure learning the API takes time ( it can be worse: try to look at 3dsmax 
SDK which is really low level, with parts missing or unexposed...)

Basically your answer would be append components:
rip from your mesh array :

   - points /
   -  face index / 
   - normals / or uv /
   
append them into one bigger array ( just be sure to add on the index array 
an offset / stride )
and later create with MFNMesh.create

Something pretty trivial to do, you just need more experience?

Le mardi 11 avril 2017 03:37:03 UTC-4, justin hidair a écrit :
>
> I'm going nut, I can no longer deal with the API, how the fuck Am I 
> suppose to merge things of an existing mesh already instanced in MFnMesh() 
> within a node, how!?
>
> recreating the mesh is too, too redundant... I tried ..
>
> adding polygons piece by piece with MFnMesh::addPolygon() ? I tried, and 
> the mergeTolerance thing didn't even worked , tears are flowing..
>

-- 
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/09df6a61-1330-4856-a36f-fcabe9ed0ebe%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Maya-Python] Creating Attributes that can be riven by textures

2016-10-30 Thread Cedric Bazillou
In maya bible: Complete maya programming 1 and 2 there is a sample project 
doing just that.
As joe point out you can start looking to MImage class ( readFromTextureNode 

  
/ readFromFile 

 )

the other 2 class you are after are 

   - MRenderUtil::sampleShadingNetwork () 
   - MDynamicsUtil::evalDynamics2dTexture()


otherwise you can also have a mix approach have and have maya arrayMapper 
sample your image for you and let you node displace you float array 
attribute. ( look at MPxParticleAttributeMapperNode if you are interested 
 on its mechanics ).

-- 
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/0ba9f9b5-30cb-41b0-9963-192dfb473a0a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Maya-Python] Re: When to use Logical Indicies over Physical Indicies

2016-10-27 Thread Cedric Bazillou
#So i did a quick test and i post a incorrect answer previously:

import maya.cmds
import maya.OpenMaya 

targetNode = maya.cmds.createNode('transform')
maya.cmds.addAttr(targetNode, ln='input', m=True, v=True)

for index in [12, 13, 16, 23]:
maya.cmds.setAttr('{0}.input[{1}]'.format(targetNode, index), index)

selList = maya.OpenMaya.MSelectionList()
maya.OpenMaya.MGlobal.getSelectionListByName(targetNode,  selList)
depNode = maya.OpenMaya.MObject()
selList.getDependNode(0, depNode) 

depUtils = maya.OpenMaya.MFnDependencyNode(depNode)
inputPlug = depUtils.findPlug('input')

print inputPlug.name()
indices = maya.OpenMaya.MIntArray()
inputPlug.getExistingArrayAttributeIndices(indices)
print indices
print inputPlug.numElements()

indexToRead = 0
print inputPlug.elementByPhysicalIndex(indexToRead).name()

#---
"""
*elementByPhysicalIndex(indexToRead) == indices[indexToRead]*

elementByPhysicalIndex refers to relative index in your array
elementByLogicalIndex will mostly point out to the connection *slot *of the 
attribute ( the element hosting the data )

what is dangerous if you use elementByLogicalIndex is that maya will create 
an input/output element at this connection index if its empty(its the 
standard behavior by the way).
in your datablock it migh be better to avoid using MPlug ( you can do 
everything cleanly with attribute).
"""

-- 
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/f143efee-cf80-4cb4-acd1-97ad44656d1f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Maya-Python] Re: When to use Logical Indicies over Physical Indicies

2016-10-27 Thread Cedric Bazillou
I dont have maya at work but from what you wrote i think you understood it 
the reverse way your physical index are 12, 13, 26.
Maya when it will process the datablock work on them in a sorted order so 
the logical index 0 will refer to physical index 12  (1 -> 13) and so on.

>
>>
>

-- 
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/978997fc-117a-47ad-b405-d63d65e04af0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Maya-Python] Re: When to use Logical Indicies over Physical Indicies

2016-10-26 Thread Cedric Bazillou
Its a really robust and flexible mechanism which makes perfect sense in a 
nodal application...
Array attribute ( vertical one like ouput[0], output[n] ) can potentially 
be sparse : it means no contiguous so inputGeometry[12], inputGeometry[13], 
inputGeometry[26] are perfectly valid
let say you have an iterator in your deformer what you are interested in is 
process element and not attached to physical index you need to extract to 
access these data.

How much experience do you have with maya ?


Le mercredi 26 octobre 2016 04:42:44 UTC-4, Dylan Smith a écrit :
>
> Hey Everyone,
> I was hoping someone could clear up something for me. When would we want 
> to use Logical indexes instead of Physical ones.
> I've been reading through some documentation and the MPlug Class Reference 
> explains what they are, but not when we should use one or the other.
> From my understanding of the Maya API, I can't think of a reason to ever 
> use Logical indexes . To me it just seems like an unnecessary source of 
> potential confusion and bugs. 
> If I'm using physical indexes then I know that the second plug will always 
> be index 1. But with logical indexes it could be anything. The physical 
> option seems like the more appealing,
> but if both options are in there then I assume there's a good reason for 
> it. What am I missing here? I've tried searching the documentation for an 
> answer but am yet to find anything.
>
> Thanks in advance for any help :)
> Dylan
>

-- 
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/27b3a353-3f66-4195-8975-0554c8c95d3a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Maya-Python] Re: API: Custom Spline IK (or Motion Path)

2012-11-16 Thread cedric bazillou
Hard , to tell much i have build my nodes differently:
The core concept was that the curve is a temporal system: there is a start 
and an end ( you will often see in SIGGRAPH paper the u parameter named as 
the variable *t* ).
I dont try to bundle all element in one node: some data can be store and 
update upstream.
so my node compute a matrix at a curve parameter value and the end object 
is used to extract a twist value.
This extraction is done by a separate node . it doesn't matter if you have 
7 full spin on the twist axis: your motion path node drive your joint  and 
even with 180/-180 degree range the orientation will be correct

Le lundi 12 novembre 2012 11:00:31 UTC+1, Roy Nieterau a écrit :

 Hey Guys,

 I'm looking into creating a custom Stretchy Spline IK setup that doesn't 
 pop (over  under extends in extreme situations). 
 But I seem to be unable to wrap my head around how to calculate 
 orientations on points on the curve. 
 Since the points on the curve don't have any orientation (well, they do 
 have tangents or something like that?) I have no clue on how to actually 
 start with this.

 My main references of tools in Maya would be the Motion Path and the 
 Spline IK (with Advanced Twist controlled by a start and end object). 
 If anybody has any starting points for this it would be greatly 
 appreciated!

 Thanks in advance.

 Regards,
 Roy


-- 
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings: 
http://groups.google.com/group/python_inside_maya/subscribe


[Maya-Python] Re: API: Custom Spline IK (or Motion Path)

2012-11-16 Thread cedric bazillou
I use the tangent and it is really robust: its the curve normal that can 
break with sharp turn. But my node drives helper/cross section joint and i 
have better result with tangent than point at the next point on the curve.
Perhaps try to use a nurbssurface ribbon and than once you are comfortable 
with that you can start massaging vector and matrix?

Le lundi 12 novembre 2012 11:00:31 UTC+1, Roy Nieterau a écrit :

 Hey Guys,

 I'm looking into creating a custom Stretchy Spline IK setup that doesn't 
 pop (over  under extends in extreme situations). 
 But I seem to be unable to wrap my head around how to calculate 
 orientations on points on the curve. 
 Since the points on the curve don't have any orientation (well, they do 
 have tangents or something like that?) I have no clue on how to actually 
 start with this.

 My main references of tools in Maya would be the Motion Path and the 
 Spline IK (with Advanced Twist controlled by a start and end object). 
 If anybody has any starting points for this it would be greatly 
 appreciated!

 Thanks in advance.

 Regards,
 Roy


-- 
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings: 
http://groups.google.com/group/python_inside_maya/subscribe


[Maya-Python] Re: API: Custom Spline IK (or Motion Path)

2012-11-14 Thread cedric bazillou
Hello Roy,

just a quick tip:
look at 
http://circecharacterworks.files.wordpress.com/2012/07/quatermainnode.pdf 
the most basic use of quaternion to build an aim target node...( this one 
use the X axis, and i also doesn't bother to support other rotation order  
).

To retrieve your up vector just use myUpvector * quatMatrix and the work is 
done( there a  lot of math in your code: the API provide  basic operation 
like dot/cross product: in my opinion its quicker to use what is already 
provided, )




Le lundi 12 novembre 2012 11:00:31 UTC+1, Roy Nieterau a écrit :

 Hey Guys,

 I'm looking into creating a custom Stretchy Spline IK setup that doesn't 
 pop (over  under extends in extreme situations). 
 But I seem to be unable to wrap my head around how to calculate 
 orientations on points on the curve. 
 Since the points on the curve don't have any orientation (well, they do 
 have tangents or something like that?) I have no clue on how to actually 
 start with this.

 My main references of tools in Maya would be the Motion Path and the 
 Spline IK (with Advanced Twist controlled by a start and end object). 
 If anybody has any starting points for this it would be greatly 
 appreciated!

 Thanks in advance.

 Regards,
 Roy


-- 
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings: 
http://groups.google.com/group/python_inside_maya/subscribe


[Maya-Python] Re: API: Custom Spline IK (or Motion Path)

2012-11-14 Thread cedric bazillou
Strange, it is python file that I rename into a pdf in order to post it on 
my blog( it can be found in the download section...)

the meat of this plugin is:

def compute(self,Plug,Data):
targetPosition_Hdle = Data.inputValue(self.targetPosition)
outputHandle = Data.outputValue(self.outRotate )

theTargetVector = targetPosition_Hdle.asVector().normal()
referenceVector = OpenMaya.MVector(1,0,0)

aimQuaternion = OpenMaya.MQuaternion()
aimQuaternion = referenceVector.rotateTo(theTargetVector)
eulerRotationValue = aimQuaternion.asEulerRotation()

outputHandle.set3Double( 
eulerRotationValue.x,eulerRotationValue.y,eulerRotationValue.z )

Data.setClean(Plug)
( the euler value is in radians and the output attribute is directly 3 
MAngle value in order to prevent maya to insert a unitconversion node( 
which is logical ))
This node expect the Driven object to be at position 0 0 0 under an offset 
group.


Le lundi 12 novembre 2012 11:00:31 UTC+1, Roy Nieterau a écrit :

 Hey Guys,

 I'm looking into creating a custom Stretchy Spline IK setup that doesn't 
 pop (over  under extends in extreme situations). 
 But I seem to be unable to wrap my head around how to calculate 
 orientations on points on the curve. 
 Since the points on the curve don't have any orientation (well, they do 
 have tangents or something like that?) I have no clue on how to actually 
 start with this.

 My main references of tools in Maya would be the Motion Path and the 
 Spline IK (with Advanced Twist controlled by a start and end object). 
 If anybody has any starting points for this it would be greatly 
 appreciated!

 Thanks in advance.

 Regards,
 Roy


-- 
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings: 
http://groups.google.com/group/python_inside_maya/subscribe
import math, sys
import maya.OpenMaya as OpenMaya
import maya.OpenMayaMPx as OpenMayaMPx

kPluginNodeName = quatermainNode
kPluginNodeId = OpenMaya.MTypeId(0xAAC0F773) 

class quatermainNode(OpenMayaMPx.MPxNode):
targetPosition  = OpenMaya.MObject()
rotate  = OpenMaya.MObject() 
 
def __init__(self):
OpenMayaMPx.MPxNode.__init__(self)
def compute(self,Plug,Data):
targetPosition_Hdle = Data.inputValue(self.targetPosition)
outputHandle = Data.outputValue(self.outRotate )

theTargetVector = targetPosition_Hdle.asVector().normal()
referenceVector = OpenMaya.MVector(1,0,0)

aimQuaternion = OpenMaya.MQuaternion()
aimQuaternion = referenceVector.rotateTo(theTargetVector)
eulerRotationValue = aimQuaternion.asEulerRotation()

outputHandle.set3Double( eulerRotationValue.x,eulerRotationValue.y,eulerRotationValue.z )

Data.setClean(Plug)
return OpenMaya.kUnknownParameter

def nodeCreator():
return OpenMayaMPx.asMPxPtr(quatermainNode())

def nodeInitializer():
nAttr = OpenMaya.MFnNumericAttribute()
mAttr = OpenMaya.MFnMatrixAttribute()
unitAttr = OpenMaya.MFnUnitAttribute()

quatermainNode.targetPosition = nAttr.create( targetPosition, trgPos, OpenMaya.MFnNumericData.k3Double )
nAttr.setStorable(0)
nAttr.setKeyable(1)
nAttr.setHidden(0)
quatermainNode.addAttribute( quatermainNode.targetPosition )

defaultAngle = OpenMaya.MAngle ( 0.0, OpenMaya.MAngle.kDegrees )
quatermainNode.outRotateX = unitAttr.create( outRotateX, orx, defaultAngle)
quatermainNode.outRotateY = unitAttr.create( outRotateY, ory, defaultAngle)
quatermainNode.outRotateZ = unitAttr.create( outRotateZ, orz, defaultAngle)
quatermainNode.outRotate = nAttr.create( outRotate, or, quatermainNode.outRotateX,quatermainNode.outRotateY,quatermainNode.outRotateZ)
nAttr.setStorable(1)
nAttr.setKeyable(0)
nAttr.setHidden(0)
quatermainNode.addAttribute( quatermainNode.outRotate )

quatermainNode.attributeAffects( quatermainNode.targetPosition, quatermainNode.outRotate )

return OpenMaya.MStatus.kSuccess	

	
	
def initializePlugin(mobject):
mplugin = OpenMayaMPx.MFnPlugin(mobject, Bazillou cedric2009, 1.0, Any)
try:
mplugin.registerNode( kPluginNodeName, kPluginNodeId, nodeCreator, nodeInitializer, OpenMayaMPx.MPxNode.kDependNode)
except:
sys.stderr.write( Failed to register node: %s % kPluginNodeName ); raise


def uninitializePlugin(mobject):
mplugin = OpenMayaMPx.MFnPlugin(mobject)
try:
mplugin.deregisterNode( kPluginNodeId )
except:
sys.stderr.write( Failed to deregister node: %s % kPluginNodeName ); raise







[Maya-Python] Re: undo/redo

2012-06-16 Thread cedric bazillou
Ok, just a quick example: there is an in depth one in the maya 
documentation: poly_modifier.py.

In a broad sense maya is a nodal application: there is 2 types of nodes* A 
transform node is a type of DAG node which handles transformations 
(translate, rotate, and scale), while a shape node is a type of DAG node 
which handles geometry* ( from API : /DAG_Hierarchy.htm ).

The flow of data travels between connected attributes . The refresh 
evaluation/propagation in this network is done in a lazy way through a push 
and pull of a dirty bit attribute.
When you want to support undo/redo you must understand how maya works: in 
mel or with the interface/UI you can create/Delete transform or 
dependencyNode, connect/disconnect attributes then get and set value. the 
API reflect these actions.

you want to modify a polygonal shape( a mesh ) so quite logically you must 
use a dependency Modifier -- MDGModifier.

code:
http://pastebin.ubuntu.com/1044863/

of course you can use whatever iterator you see fit but it is important to 
initialize it with the dataOwner newMeshObj.
in the end the MDGModifier will just write a new value from this meshdata 
into your target polygon

Le jeudi 14 juin 2012 00:08:38 UTC+2, Serena Xu a écrit :

 i have a simple script that moves vertices. I want to be undo and redo 
 the actions. Can i create a DAG node to save information on the state 
 of the vertices before the movement and then I can use MDGModifier to 
 undo? This is what I had in mind: 

 #move a few verts on a geo and make it undoable 
 import maya.OpenMaya as om 

 class undoRedoTest(): 
 def __init__(self): 
 self.__transPath = om.MDagPath() 
 self.__dagModify = om.MDagModifier() 
 self.__space = om.MSpace.kWorld 

 def doIt(self, *args): 
 om.MGlobal.selectByName('pPlane1') 
 sList = om.MSelectionList() 
 om.MGlobal.getActiveSelectionList(sList) 
 obj = om.MItSelectionList(sList, om.MFn.kGeometric) 

 self.__dagModify.createNode(#node that saves info for current 
 position of vertices 

 iter = om.MItMeshVertex(dagPath, components) 
 fnMesh = om.MFnMesh(self.__transPath) 
 doubleArray = om.MScriptUtil() 
 doubleArray.createFromList([2, 3, 1], 1) 

 while not iter.isDone(): 
 thisPt = iter.position() 
 inPoint = om.MPoint(thisPt.x, thisPt.y, thisPt.z) 
 outPoint = om.MPoint(0.0, 0.0, 0.0) 
 fnMesh.getClosestPoint(inPoint, outPoint, self.__space) 

 moveVec = om.MVector(doubleArray.asDoublePtr()) 
 iter.translateBy(moveVec, spc) 

 iter.next() 

 def redoIt(self): 
 self.__dagModify.doIt() 

 def undoIt(self): 
 self.__dagModify.undoIt()

-- 
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings: 
http://groups.google.com/group/python_inside_maya/subscribe


[Maya-Python] Re: array issue

2012-06-13 Thread cedric bazillou
Hello , just an idea: wouldn't it be easier to write a deformer?
@Justin on your code you already use the maya API, do you have to compute 
vector length/distance by hand? 
the MVector class has already a length method and you can also query the 
distance between 2 MPoint: PointA.distanceTo (PointB).

you can also store and update vectorArray/ pointArray attribute on regular 
node attribute: Just a personal preference, I just see lots of code 
floating around where a lot of thing present in maya is ditched just for 
the sake of playing with python( people are free to do that , if they are 
comfortable with something its better to stick with it )

Le mercredi 13 juin 2012 00:15:29 UTC+2, Serena Xu a écrit :

 oh that works! Thanks! 

 On Jun 12, 4:40 pm, Justin Israel justinisr...@gmail.com wrote: 
  Unfortunately the scripJob doesn't work if its not an interactive 
 process: 
  
  http://download.autodesk.com/global/docs/maya2012/en_us/CommandsPytho... 

  
   This triggering happens very frequently so for speed considerations no 
   events are forwarded during playback. This means that you cannot 
   use scriptJob -tc tcCallback; to alter animation behaviour. Use an 
   expression instead, or the rendering callbacks preRenderMel and 
   postRenderMel. 
  
  But what you could do to make this start working right away is use a 
  scriptNode instead. You can tell the scriptNode to update on frame 
 change: 
  
  n = cmds.scriptNode(name=vertexDeformer, sourceType=python, 
  scriptType=7, bs=v.check()) 
  
  This will work in a playblast 
  
  
  
  
  
  
  
  On Tue, Jun 12, 2012 at 12:21 PM, Serena Xu toomuchcof...@gmail.com 
 wrote: 
   Oh that did work as I expected. Thanks! 
   Could it be that with the mixed up names from my script before maya 
   didnt complain because the values did exist (even though they were 
   wrong values)? 
  
   How do make this script work as I scrub the timeline? 
   cmds.scriptJob(event=('timeChanged', v.check)) only runs it when i 
   click through the timeline. It doesnt show up when I playblast. 
  
   On Jun 12, 2:44 pm, Justin Israel justinisr...@gmail.com wrote: 
Hmm, well this is what I did... 
  
1. Using this version with the fixed attribute names: 
  
 https://gist.github.com/2918740/2e9054947f2c22696d472de968c81f03e4a0330b 
2. Create a plane 
3. New class instance, set defaults, start scriptJob: 
v = vertexInfo() 
v.saveDefaultPos() 
jobNum = cmds.scriptJob(event=('timeChanged', v.check)) 
4. go through time range and observe deformation, then go back to 
 frame 1 
(zero deform) 
5. delete plane, create new one with same name but clearly different 
 size 
and subdivs 
6. v.saveDefaultPos() 
7. step through timeline again, and deformation seems to work as 
 expected 
for me? 
  
On Tue, Jun 12, 2012 at 11:11 AM, Serena Xu toomuchcof...@gmail.com 

   wrote: 
 What i had intended to do was to move a cylinder over a plane and 
 leave an indentation as the cylinder goes over. I wanted the plane 
 to 
 be elastic so when the cylinder leaves the immediate region the 
 plane 
 returns to its initial state. so I have the saveDefaultPos() to 
 save 
 the vertex information and the check() to displace the vertices of 
 the plane when the cylinder moves close to it. The first time i 
 run it 
 the result will be as I expect but when I delete the old pPlane1 
 and 
 make a new one with the same name I run the  saveDefaultPos() to 
 save 
 the vertex info of the new plane. When i run check() now the 
 results 
 are not what I expect because the vertices move to the positions 
 of 
 the old pPlane1 instead of the second one I created. 
  
 I had thought of using a matrix to store info instead of so many 
 arrays but i ran into some syntax errors (still having trouble 
 with 
 the language) so I thought i'd do a small cheat for now. I'll go 
 fix 
 that now that you've helped me out so my code can be less 
 redundant. 
  
 On Jun 12, 1:35 pm, Justin Israel justinisr...@gmail.com wrote: 
  Hey Serena, 
  
  Make sure you use some form of external code view tool for this 
 much 
 code. 
  Small snippets are fine, but the messages can't handle the 
   formatting of 
  this size and it makes it hard for others to read it. The 
 wrapping 
   breaks 
  the lines, and indentations, etc. 
  
  I reformatted it into a gist for ya: 
  https://gist.github.com/2918740 
  (pastebin.com works too, but I like gist because of how you can 
   edit and 
  version it up, and see a diff) 
  
  It was crashing because of a naming error here (line 113): 
  dx = verX[ind] - thisPt.x  # self.verX 
  dy = verY[ind] - thisPt.y  # self.verY 
  dz = verZ[ind] - thisPt.z  # self.verZ 
  
  Could you maybe explain a little more specifically how to 
 reproduce 
   the 
  problem? This is a lot of code and its hard 

[Maya-Python] Re: deformer and mfnmesh

2012-06-13 Thread cedric bazillou
Hello marco, Instead of plug have you tried to use an outputHandle to read 
your mesh attribute? ( from your vimeo reel its obvious you already have a 
firm graps on the API), normally a dataHandle dont trigger a dirty bit 
propagation.
cedric
http://circecharacterworks.wordpress.com/

Le samedi 12 mai 2012 01:01:36 UTC+2, kungFu_Teddy a écrit :

 Hi Folks, 

 I have a little problem with a deformer that I'm writing.

 I would like to use a mfnmesh of my output_mesh

 so from OpenMayaMPx.cvar.MPxDeformerNode_outputGeom I get the plugs and 
 the mesh...

 it works. but in this way maya give me the cycle warning ( and it makes 
 sense ). It's not a real cycle but for maya it is. 

 any sudgestions? any other ways to do it? 

 thank you very much
 Teddy


-- 
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings: 
http://groups.google.com/group/python_inside_maya/subscribe


Re: [Maya-Python] Re: CGCircuit

2012-06-10 Thread cedric bazillou
Hello Chad, 
Your videos seems excellent, my only point would be that after diablo3 ( 
where blizzard put a gun on the head of legit users by forcing online 
gaming through their throat), im quite reluctant on online things. What 
will happen to your user license to watch your video when cgcircuit is out 
of operation? Have you thought of a compromise like 3dbuzz : encoding user 
information+watermark in order for your user to download their video 
several week after your release?

Le mercredi 6 juin 2012 02:35:38 UTC+2, Vladimir a écrit :

 Dear Chad, your course is the best one from any another in the whole world.

 Better than fxphd, 3dbuzz, cmivfx etc etc etc

 Thank you for your knowledge that you can share!

 Yours sincerely,

 Vladimir Yudin

 On 6 Jun 2012, at 01:23, Chad Vernon chadver...@gmail.com wrote:

 Thanks for the feedback!  I'm hoping to eventually create a sequel series 
 on more advanced topics.

 Thanks,
 Chad

 On Tue, Jun 5, 2012 at 11:43 AM, David Alvarez david...@gmail.com wrote:

 Yep, same happened too me but I finally subscribed and I can't be more 
 happier with the material Chad provided, great stuff in my opinion.


 2012/5/31 mattanimation mattanimat...@gmail.com

 The streaming kind of kept me at bay at first, and I completely
 understand the choice to keep it streaming, but it definitely is worth
 it, I'm only an hour in and have learned a butt load of cool stuff.

 On May 29, 8:33 am, Chad Vernon chadver...@gmail.com wrote:
  The videos are streaming only, so you will need to be connected to 
 watch
  them.
 
 
 
 
 
 
 
  On Tue, May 29, 2012 at 8:31 AM, Te Wilson ironjellypa...@gmail.com 
 wrote:
   Awesome.
   On May 29, 2012 6:22 AM, David Alvarez david...@gmail.com wrote:
 
   Looks really nice! I was wondering if you are allow to review the
   tutorials offline or you need a conection to have access to the 
 classes.
 
   David
 
   2012/5/28 Chad Vernon chadver...@gmail.com
 
   Hi folks,
 
   CGCircuit is a new site where industry folks can create and sell
   tutorial videos.  I've released a video series on the Maya API 
 available
   here.
 
  http://www.cgcircuit.com/lessondetailcomplete.php?val=592
 
   It's almost 7 hours of material that will give you a broad 
 spectrum of
   the API.  It focuses mostly on C++ but the API topics transfer to 
 Python.
Check it out if you're interested.
   I've also released an Applied 3d Math series which gives a 
 practical
   introduction to the math that TDs use in computer graphics.
 
  http://www.cgcircuit.com/lessondetailcomplete.php?val=599
 
   Thanks,
   Chad
 
   --
   view archives:http://groups.google.com/group/python_inside_maya
   change your subscription settings:
  http://groups.google.com/group/python_inside_maya/subscribe
 
   --
   *
   
 __
 
David Alvarez*
 
   *Character Animator - Character TD*
 
  http://halfstepforward.blogspot.com
 
   
 __
 
--
   view archives:http://groups.google.com/group/python_inside_maya
   change your subscription settings:
  http://groups.google.com/group/python_inside_maya/subscribe
 
--
   view archives:http://groups.google.com/group/python_inside_maya
   change your subscription settings:
  http://groups.google.com/group/python_inside_maya/subscribe

 --
 view archives: http://groups.google.com/group/python_inside_maya
 change your subscription settings: 
 http://groups.google.com/group/python_inside_maya/subscribe




 -- 
 *
 __

  David Alvarez*
  
 *Character Animator - Character TD*

 http://halfstepforward.blogspot.com

 __

  -- 
 view archives: http://groups.google.com/group/python_inside_maya
 change your subscription settings: 
 http://groups.google.com/group/python_inside_maya/subscribe


  -- 
 view archives: http://groups.google.com/group/python_inside_maya
 change your subscription settings: 
 http://groups.google.com/group/python_inside_maya/subscribe



-- 
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings: 
http://groups.google.com/group/python_inside_maya/subscribe


Re: [Maya-Python] MPxLocatorNode and compute troubleshooting (with example code)

2012-06-09 Thread cedric bazillou
If you have nothing connected the compute method is triggered by either a 
UI ( think attribute editor or any other connectControl/attributeControl  
element), when it is selected or visible: I rarely use setDependsDirty: my 
node use basic relationship and attributeAffects is enough for me. 

I have used pretty much all type of attribute as input and output in python 
and C++( not the generic one that accept different type of data yet ).
What works for me is is to let maya control the dirty bit propagation 
between connected attributes.

lets examine your node: 

MyNode.aOutput = tAttr.create('output', 'output', om.MFnData.kDoubleArray)

this is a typeAttribute:
you can write and read from it several MFNData like MFnMatrixData, 
MFnMeshData,MFnArrayAttrsData,  MFnComponentListData,  MFnDoubleArrayData( 
etc more info on the documentation can be found).

Depending on your data type you must use the appropriate MFnfunction:
here MFnDoubleArrayData ()

outHandle = dataBlock.outputValue(MyNode.aOutput)


to write your data, you set an MObject created from this MFNDoubleArrayData:

#MObject  create (const MDoubleArray in, MStatus *ReturnStatus=NULL) 
#--- C++ notation

Lets say you have create a MDoubleArray: and fill it
OuputList = OpenMaya.MDoubleArray()

#here expand and fill your value
outputDataFn = OpenMaya.MFNDoubleArrayData()
outputDataObj = outputDataFn.create(OuputList)

outHandle.setMObject(outputDataObj)outHandle.setClean()

Let me know if it still refuse to works,

Le samedi 9 juin 2012 23:37:46 UTC+2, Judah Baron a écrit :

 You may benefit from at least testing out the setDependentsDirty call. 
 Typed attributes are a bit more complex than standard base type attributes 
 and Maya may handle them differently - I have no direct experience using 
 them in compute. Unlike compute, setDependentsDirty is called every time an 
 attribute value changes, allowing you to dirty the plugs required for your 
 node to compute when needed. It's also good for dynamic multis and 
 compounds, allowing you to pinpoint your computation in a manner not 
 possible by using attributeAffects.

 -J

 On Saturday, June 9, 2012, WhileRomeBurns wrote:

 In the real plugin, I do declare Author Name, Plug Version, etc. The 
 point of my example was to remove all that code (which Maya allows- it gets 
 initialized to default values) to make it clear to myself, and others, what 
 the problem is. Hence I cut out the normal try/except error stuff as well- 
 cleaner examples are nice.


 *  then In your compute method there is no code to write some value on 
 your output and also no setClean call. *
 Doesn't matter matter if I set it clean- compute never gets called in my 
 example, so adding in setClean() or any other function call isn't relevant 
 as far as I can tell- it never gets dirtied.


 *  Your node must also be connected to another node.*
 Does it always? There are nodes that update on attribute change without 
 being connected. My first example does this. Change 'input' int attribute 
 and compute() gets called, and 'output' updates. The dirty/clean stuff 
 works a charm- I told Maya that attributeAffects(MyNode.aInput, MyNode.
 aOutput) and boom- input did indeed affect output as advertised! So 
 saying it must be connected is untrue for this case of kInt or KFloat, both 
 of which I've tested.

 Now if I do attributeAffects(MyNode.aInput, MyNode.aOutput) with aOutput 
 being an MFnTypedAttribute, compute() never gets called. attributeAffects() 
 does not work as described in the API docs (for this simple one node case) 
 and I want to know why. I assume there is a logical, maybe even 
 obvious, explanation; maybe it's an optimization on Maya's part because I 
 haven't actually created an array of data for the aOutput attr yet? 


 * Do you have any prior experience with the API?* 
 Mostly writing translators, compiling others' c++ nodes to work with my 
 version of maya/environment. Just got into python api stuff though.


 * Have you a basic understanding of the concept of hierarchy , 
 connections , attributes and plug ?( DAG versus dependency nodes )*
 I would say that I definitely have at least basic understanding, but I 
 came here for the people with the advanced understanding. :)


 Thanks again for your patience. I really want to resolve this simple 
 example before I start porting my code to Maya nodes.
 -shawn







 On Friday, June 8, 2012 4:29:55 PM UTC-4, cedric bazillou wrote:

 first In your plugin declaration with the kDoubleArray output I would 
 rather correct those lines( things can be done in a lot of different ways, 
 this is how i do it ):
 

 def initializePlugin(mobject):
 fnPlugin = omMPx.MFnPlugin(mobject)
 fnPlugin.registerNode(nodeType**, nodeId, nodeCreator, nodeInitializer)

 
 by
 
 kPluginNodeName = spaceSwitch #-- replace by your plugin name

 kPluginNodeId = OpenMaya.MTypeId(your_Custom_**ID_number here) 
 def initializePlugin(mobject):
 mplugin

Re: [Maya-Python] MPxLocatorNode and compute troubleshooting (with example code)

2012-06-08 Thread cedric bazillou
first In your plugin declaration with the kDoubleArray output I would 
rather correct those lines( things can be done in a lot of different ways, 
this is how i do it ):


def initializePlugin(mobject):
fnPlugin = omMPx.MFnPlugin(mobject)
fnPlugin.registerNode(nodeType, nodeId, nodeCreator, nodeInitializer)

by

kPluginNodeName = spaceSwitch #-- replace by your plugin name

kPluginNodeId = OpenMaya.MTypeId(your_Custom_ID_number here) 
def initializePlugin(mobject):
mplugin = OpenMayaMPx.MFnPlugin(mobject, AuthorName, VersionNum, Any)
mplugin.registerNode( kPluginNodeName, kPluginNodeId, nodeCreator, 
nodeInitializer, OpenMayaMPx.MPxNode.kDependNode)# -- As you can see I use the 
type of the node here a dependency node



then In your compute method there is no code to write some value on your 
output and also no setClean call.
Your node must also be connected to another node. just few question bellow,
Are your example the complete code for your nodes? 
Do you have an ascii maya file that can be used as an example?
Do you have any prior experience with the API? 
Have you a basic understanding of the concept of hierarchy , connections , 
attributes and plug ?( DAG versus dependency nodes )

Le vendredi 8 juin 2012 19:51:19 UTC+2, WhileRomeBurns a écrit :

 Thanks for the quick replies! So he basically tricks Maya into dirtying 
 his plug in the draw method? Nice. So in my example, I would query the 
 value of a third dummy attribute- something lighter weight than an array 
 like a float or int and use that to force the eval? Can do!


 *   how about writing a node to compute your pointList and plug it to 
 your locator that will only draw from  *
 Absolutely the way to go, but I thought I would save time and test the 
 idea in one node. But then nothing worked :)


 Additionally, I'm now fighting python just to call compute with *
 MFnTypedAttributes*. Two examples, slightly modified versions of 
 Farsheed's skeleton code. The first one has MFnNumericAttribute as the 
 output attribute and it calls the compute method as expected. The second 
 one is bunk though and I cannot figure out why. Hmm. Take a look:

 nodeNumeric.py:
 http://pastebin.ubuntu.com/1030758/ 
 Works a charm, compute gets called.

 nodeTyped.py
 http://pastebin.ubuntu.com/1030764/ 
 Compute never gets called. Silently fails? Only changed the attr type to 
 TypedAttr and kDoubleArray. Nada. Zilch. Zippo!

 Did I miss something obvious? Thanks.
 -shawn




-- 
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings: 
http://groups.google.com/group/python_inside_maya/subscribe


[Maya-Python] Re: MPxLocatorNode and compute troubleshooting (with example code)

2012-06-07 Thread cedric bazillou
Hello, 
(lets call you Nero... )

I think you can explain why your compute is not triggered: the dependency 
graph in maya is not informed that your output attribute needs to be 
update: you have nothing connected to it , right?
Nothing original but how about writing a node to compute your pointList and 
plug it to your locator that will only draw from a kPointArray/kVectorArray 
input attribute? I have play with this idea and it works: 
http://forums.cgsociety.org/showpost.php?p=7280472postcount=14.


Le mardi 5 juin 2012 18:35:15 UTC+2, WhileRomeBurns a écrit :

 So basically I've got a python node called *simpleLocator* with an 
 attribute called *pointCount *(type *kInt*) which is used to generate 
 some random points. These points can be passed out as an array with the 
 attribute *outPoints *(type *kDoubleArray *for this example). I've setup *
 attributeAffects*() so that outPoints depends on pointCount, so it should 
 update if the user edits the number of points. This node needs to draw the 
 points every frame with OpenGL as well, but only compute as needed. So far 
 so good. Here's my example code (also attached to this post), stripped to 
 the bare essentials and it almost works:

 http://hastebin.com/vixiyaruda.py


 When compute() is called though, plug never equals aOutPoints. Ever, ever.

 def compute( self, plug, data ):
 if plug == simpleLocator.aOutPoints:
 print( 'aOutPoints needs to be computed, but we never get 
 here...' )
 return om.MStatus.kSuccess
 else:
 return om.MStatus.kUnknownParameter


 What's normal practice here? Should I just query my 
 simpleLocator.aPointCount every time draw is called and only 
 call generatePoints() if the value of aPointCount has been changed? Should 
 I derive from a node other than MPxLocator and implement my own draw 
 method? Does MPxLocator behave different in C++? Any help, any insight 
 would be greatly appreciated. Thanks.

 -shawn
 PS- If you're curious, the real node is generating blue noise for 
 thousands of points and is fairly expensive to calculate.


-- 
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings: 
http://groups.google.com/group/python_inside_maya/subscribe


Re: [Maya-Python] MPxLocatorNode and compute troubleshooting (with example code)

2012-06-07 Thread cedric bazillou
You are right Judah, the other node is not mandatory: it was just a 
personal preference: separating data processing( noise point ) from drawing 
( the locator ).If you duplicate your locator you dont need to compute 
several time your point list( when you need the same point list of course 
). In my case it was easier to stick to the regular  maya workflow( data 
flows from one node to another )
I would also use a MVectorArray initialized with your self.pointCount 
value  but its just my way of doing things.

Le jeudi 7 juin 2012 23:11:44 UTC+2, Judah Baron a écrit :

 You don't need connect another node to pull the data from the plug and 
 trigger compute. It sounds like you are on the right track with the query 
 in draw. You can either use a real attribute, or create a dummy that is 
 used solely for the purpose of triggering compute. You then need to make 
 sure your attribute dependency is set up properly with attributeAffects, or 
 setDependentsDirty. Once you've done this, pulling the plug's value from 
 within draw will dirty the plug, triggering compute. You'll need to do this 
 early in draw, obviously - befor you draw anything, for the change to take 
 effect.

 There is a good sample here:

 http://code.google.com/p/mayaprogramming/source/browse/trunk/locator/GrassLocator.cpp?r=4

 Good luck,
 -Judah


 On Thursday, June 7, 2012, cedric bazillou wrote:

 Hello, 
 (lets call you Nero... )

 I think you can explain why your compute is not triggered: the dependency 
 graph in maya is not informed that your output attribute needs to be 
 update: you have nothing connected to it , right?
 Nothing original but how about writing a node to compute your pointList 
 and plug it to your locator that will only draw from a 
 kPointArray/kVectorArray input attribute? I have play with this idea and it 
 works: http://forums.cgsociety.org/showpost.php?p=7280472postcount=14.


 Le mardi 5 juin 2012 18:35:15 UTC+2, WhileRomeBurns a écrit :

 So basically I've got a python node called *simpleLocator* with an 
 attribute called *pointCount *(type *kInt*) which is used to generate 
 some random points. These points can be passed out as an array with the 
 attribute *outPoints *(type *kDoubleArray *for this example). I've 
 setup *attributeAffects*() so that outPoints depends on pointCount, so 
 it should update if the user edits the number of points. This node needs to 
 draw the points every frame with OpenGL as well, but only compute as 
 needed. So far so good. Here's my example code (also attached to this 
 post), stripped to the bare essentials and it almost works:

 http://hastebin.com/**vixiyaruda.py http://hastebin.com/vixiyaruda.py


 When compute() is called though, plug never equals aOutPoints. Ever, 
 ever.

 def compute( self, plug, data ):
 if plug == simpleLocator.aOutPoints:
 print( 'aOutPoints needs to be computed, but we never get 
 here...' )
 return om.MStatus.kSuccess
 else:
 return om.MStatus.kUnknownParameter


 What's normal practice here? Should I just query my 
 simpleLocator.aPointCount every time draw is called and only 
 call generatePoints() if the value of aPointCount has been changed? Should 
 I derive from a node other than MPxLocator and implement my own draw 
 method? Does MPxLocator behave different in C++? Any help, any insight 
 would be greatly appreciated. Thanks.

 -shawn
 PS- If you're curious, the real node is generating blue noise for 
 thousands of points and is fairly expensive to calculate.

  -- 
 view archives: http://groups.google.com/group/python_inside_maya
 change your subscription settings: 
 http://groups.google.com/group/python_inside_maya/subscribe



-- 
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings: 
http://groups.google.com/group/python_inside_maya/subscribe