Re: [Maya-Python] New items are not added into QMenu

2019-01-15 Thread Justin Israel
On Wed, Jan 16, 2019, 2:17 PM likage  wrote:

> Thanks for the information, Justin.
> After re-arranging the `self.separator` I managed to get the newly created
> items to be slotted into the specified position of mine.
>
> While this seems to be working, as I tried to implement in the same
> makings into my actual tool, I keep getting `RuntimeError: Internal C++
> object (PySide2.QtWidgets.QAction) already deleted.`, seemingly the
> `self.separator` got killed off in the midst of it.
> The code structure in my actual tool is almost the same as the one that I
> have posted in this thread, with the exception that I have 'watered' down
> the code in this thread in hopes of keeping it short and simple.
>
> Even so, wondering if you may any advice to this? Read online for this
> issue is to make it into a variable in which I did, but still it did not
> work.
> However, if I do the following:
> def mousePressEvent(self):
>self.separator =  self.qmenu.addSeparator()
> ...
>
> items can still be created and added into the menu, but this time round,
> each will be created with both the item and the separator altogether
>

I'm not sure which part of your code that C++ error corresponds with, but
it means that it was parented to a QObject that was deleted but you are
still accessing the python object. If you are able to reproduce it in your
public code and know which part it corresponds with, that would be easier
to investigate.

> --
> 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/c2eedb45-b913-4430-a6f8-e39a5a2d3a78%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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/CAPGFgA2s2UtietB7tat-G4Kg4N6w8CwbCJE-Ls0Zco6kpCoFzw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


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

2019-01-15 Thread 徐一雄
Hi Tenghao,
Thank you for your reply.
I still can't get the proper *_jiggleMap* list.
In my code above, I can get the proper jiggleMap for each 
geometry(jiggleMap for current geoIndex) and I don't know how to store 
these jiggleMaps properly for further computing.
The deform() method seems to go to the current geoIndex and I don't how to 
store information of each geometry properly.
In C++ , it can use  a map to get it.
But how to make it in Python?
Can you help me ?
Thank you very much and looking forward to your reply.

Yixiong Xu
2019.01.16



在 2019年1月15日星期二 UTC+8上午10:50:08,Tenghao Wang写道:
>
> Hey Yixiong,
>
> _jiggleMap is a user defined list. We need to save the jiggleMap weights 
> for each *input geometry*.
> hJiggleMap.inputValue().asFloat() only returns the weight for the current 
> vertex ID on the current input geometry.
> jiggleMapArray stores all the weight for the current input geometry but 
> _jiggleMap will store all the jiggleMapArray for all the input geometry. 
> So I get the jiggleMapArray by using _jiggleMap[geoIndex].
>
> If you do not save this data, you will definitely see this issue: "When I 
> move one mesh, the other mesh or some components of the other mesh will 
> perform jiggle effect" Because your weights actually messed up.
>
> On Sun, Jan 13, 2019 at 8:02 PM 徐一雄 > 
> wrote:
>
>> Hi Tenghao,
>> Thank you for your reply.
>> I mainly use python for programming.
>> I have changed my code.
>> As you said, I can get the world matrix by code:
>> *worldMatrix = 
>> mPreGeomretyHandle.child(jiggleDeformerNode.worldMatrix).asMatrix()*
>>
>> For getting the jiggle map and other custom paintable map.
>> Why do you use following code?
>>
>> *jiggleMap = _jiggleMap[geoIndex] *
>>
>> I don't find any variable named *_jiggleMap*.
>> Is it the maya inside type variable?
>> Can you explain it? Or is there any explaination in maya document?
>>
>> In my opinion, I used to get jiggleMap by:
>> *hJiggleMap = mPreGeomretyHandle.child(jiggleDeformerNode.jiggleMap)*
>>
>> *jiggleMapArray = []*
>> *for i in range(geoIterator.count()):*
>> *  jump2Element(hJiggleMap, i)*
>> *  jiggleMapArray.append(hJiggleMap.inputValue().asFloat())*
>>
>> Looking forward to your reply.
>> Yixiong Xu
>> 2019.01.14
>>
>> 在 2019年1月13日星期日 UTC+8下午4:20:21,Tenghao Wang写道:
>>>
>>> Hey Yixiong,
>>>
>>> "When I move one mesh, the other mesh or some components of the other 
>>> mesh will perform jiggle effect. That is not what I want."
>>> I looked at your code a little bit, it looks like you commented this 
>>> part: # MFnCompoundAttr.addChild(JiggleDeformerNode.worldMatrix)
>>> You should understand "perGeometry" is an array compound attribute and 
>>> stored information for each input mesh, so you need to have worldmatrix for 
>>> each input geometry.
>>>
>>> # access compound array attibute:
>>> mGeometryHandle = dataBlock.inputArrayValue(perGeo)
>>> # access to each geometry handle, looks like you already implemented 
>>> "jump2Element" to access to each element in the compound array attribute.
>>> jump2Element(mGeometryHandle, geoIndex)
>>> mPerGeometryHandle = mGeometryHandle.inputValue()
>>> worldMatrix = mPreGeomretyHandle.child(jiggleDeformerNode.worldMatrix)
>>>
>>> # access to all the paintable maps
>>> jiggleMap = _jiggleMap[geoIndex] 
>>>
>>> if you are using Python: _jiggleMap is a list and each element is the 
>>> jiggleMap list for each input mesh.
>>> if you are using C++: _jiggleMap is map: std::map>> MFloatArray> _jiggleMap
>>>
>>> So basically,  the in the deform(self, dataBlock, geoIterator, 
>>> local2WorldMatrix, geoIndex) function, you have to implement your jiggle 
>>> algorithm for each input geometry by using "geoIndex".
>>> Let me know if you have more questions.
>>>
>>> Tenghao Wang
>>> Sr. Technical Artist
>>> Visual Concepts
>>>
>>> On Sat, Jan 12, 2019 at 2:05 AM 徐一雄  wrote:
>>>
 Hello Angelo,
 Thank you for your reply.
 I have some weird effect when I use my custom jiggle deformer on two 
 different meshes by only one deform node.
 First, my custom deform node has some paintable attributes and all of 
 them are the child of one MFnCompoundAttribute().
 When I move one mesh, the other mesh or some components of the other 
 mesh will perform jiggle effect. That is not what I want.
 I think the problem is due to reading(storing) the float array 
 attribute by different meshes.
 So, my question is how to get paintable attributes (mainly 
 MFloatArray()) of a MFnCompoundAttribute()?

 Thank you very much.
 Yixiong Xu

 在 2017年11月25日星期六 UTC+8上午5:07:03,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 = 

Re: [Maya-Python] New items are not added into QMenu

2019-01-15 Thread likage
Thanks for the information, Justin.
After re-arranging the `self.separator` I managed to get the newly created 
items to be slotted into the specified position of mine.

While this seems to be working, as I tried to implement in the same makings 
into my actual tool, I keep getting `RuntimeError: Internal C++ object 
(PySide2.QtWidgets.QAction) already deleted.`, seemingly the 
`self.separator` got killed off in the midst of it.
The code structure in my actual tool is almost the same as the one that I 
have posted in this thread, with the exception that I have 'watered' down 
the code in this thread in hopes of keeping it short and simple.

Even so, wondering if you may any advice to this? Read online for this 
issue is to make it into a variable in which I did, but still it did not 
work. 
However, if I do the following:
def mousePressEvent(self):
   self.separator =  self.qmenu.addSeparator()
...

items can still be created and added into the menu, but this time round, 
each will be created with both the item and the separator altogether

-- 
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/c2eedb45-b913-4430-a6f8-e39a5a2d3a78%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Maya-Python] Re: connectAttr with set groups

2019-01-15 Thread Francesco
Didn't think of using the plusMinusAverage node but it works! I connected 
the rotation of the Master FK controller to input3D[0] and rotation of the 
FK controllers (not the set groups) to input3D[1] of the 
plusMinusAverage node. I also had to connect the rotation of the FK Master 
controller to the rotation of each set group to make the controllers follow 
correctly.

Thank you for the advice!

On Tuesday, January 15, 2019 at 6:01:57 AM UTC-8, Neil Roche wrote:
>
> The simplest way would be to use a plusMinusAverage node and connect the 
> rotation of the control and the rotation of the set group to the input3D[0] 
> and input3D[1] plugs respectivley, set the operation to sum and then 
> connect the output3D to your joint rotation so both objects will drive the 
> joint.
>
> On Friday, 11 January 2019 02:26:34 UTC, Francesco wrote:
>>
>> Hi everybody!
>>
>> I had a question regarding the python connectAttr command in Maya. 
>>
>> I have created FK controllers that I connected the rotation of to the 
>> rotation of a joint chain through the connectAttr command. The FK 
>> controllers are in a hierarchy where there is a group and a set group above 
>> each controller (something like tail_01_GRP --> tail_01_setGRP --> 
>> tail_01_CNTL --> tail_02_GRP --> etc...). What I'm trying to do is create a 
>> master controller and connect its rotation to the rotation of the setGRPs 
>> through the connectAttr command, so that when I rotate it it rotates all 
>> the controllers keeping the rotation to zero. 
>>
>> The problem is that rotating the setGRPs doesn't rotate the joints 
>> (guessing because the actual controller doesn't have any rotation). How 
>> would I fix that? I know it could be done with orient constraints but I'm 
>> trying to avoid using too many constraints.
>>
>> Thanks!
>>
>> -Francesco
>>
>

-- 
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/9c722148-ab28-4834-899a-ddb304f40b97%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Maya-Python] New items are not added into QMenu

2019-01-15 Thread Justin Israel
On Wed, Jan 16, 2019 at 9:38 AM likage  wrote:

> Hi, thanks for getting back to me. It seems that the newly added items are
> added to the end (bottom) of the QMenu instead of in-between the 'Add new
> item' and the 'Default Item'..
>

The documentation for insertAction(before, action) says it will insert the
new action *before* the given one, so I would have expected it to put them
before the separator. But it also says it will end up appending it if
"before" is not a valid action for the menu.


>
> Also as mentioned in my first post, is it possible to create different
> QMenus for different tabs?
> Eg. I create 'item01' for TabA and I created 2 new items - 'item01a' and
> 'item01b' for TabB...  And based on which tabs that I perform a right-mouse
> click on, it will show the update menu
>

This should be possible with the available functionality of a QTabBar. I
imagine the following aspects would come into play:

   - A dictionary of tab to QMenu and creating a new one if needed
   - Maybe implementing tabInserted and tabRemoved methods if you want to
   directly track the tabs and create/remove menus at this stage
   - Checking tabAt(point) in your content menu handler to look up the
   correct QMenu to exec



>
> --
> 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/8b47ffc7-6ff5-4171-bf3d-c21e944219eb%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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/CAPGFgA1QVgHPdjLzzVoYfCAVdEDEGV0XJ5nraLpN1NJbrL_1Yw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Maya-Python] New items are not added into QMenu

2019-01-15 Thread likage
Hi, thanks for getting back to me. It seems that the newly added items are 
added to the end (bottom) of the QMenu instead of in-between the 'Add new 
item' and the 'Default Item'..

Also as mentioned in my first post, is it possible to create different 
QMenus for different tabs?
Eg. I create 'item01' for TabA and I created 2 new items - 'item01a' and 
'item01b' for TabB...  And based on which tabs that I perform a right-mouse 
click on, it will show the update menu

-- 
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/8b47ffc7-6ff5-4171-bf3d-c21e944219eb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Maya-Python] Re: connectAttr with set groups

2019-01-15 Thread Neil Roche
The simplest way would be to use a plusMinusAverage node and connect the 
rotation of the control and the rotation of the set group to the input3D[0] 
and input3D[1] plugs respectivley, set the operation to sum and then 
connect the output3D to your joint rotation so both objects will drive the 
joint.

On Friday, 11 January 2019 02:26:34 UTC, Francesco wrote:
>
> Hi everybody!
>
> I had a question regarding the python connectAttr command in Maya. 
>
> I have created FK controllers that I connected the rotation of to the 
> rotation of a joint chain through the connectAttr command. The FK 
> controllers are in a hierarchy where there is a group and a set group above 
> each controller (something like tail_01_GRP --> tail_01_setGRP --> 
> tail_01_CNTL --> tail_02_GRP --> etc...). What I'm trying to do is create a 
> master controller and connect its rotation to the rotation of the setGRPs 
> through the connectAttr command, so that when I rotate it it rotates all 
> the controllers keeping the rotation to zero. 
>
> The problem is that rotating the setGRPs doesn't rotate the joints 
> (guessing because the actual controller doesn't have any rotation). How 
> would I fix that? I know it could be done with orient constraints but I'm 
> trying to avoid using too many constraints.
>
> Thanks!
>
> -Francesco
>

-- 
*MILK ** VISUAL EFFECTS**
*

Threeways House,





40-44 Clipstone Street London, W1W 5DW

Tel: *+44 (0)20 3697 8448*

* *


This message is intended solely for the addressee and may contain 
confidential and/or legally privileged information. Any use, disclosure or 
reproduction without the sender’s explicit consent is unauthorized and may 
be unlawful. If you have received this message in error, please notify Milk 
VFX immediately and permanently delete it. Any views or opinions expressed 
in this message are solely those of the author and do not necessarily 
represent those of Milk VFX. 

By engaging in professional correspondence 
with Milk VFX, we may store your contact information for future reference. 
This is in line with Milk’s Privacy policy which can be found here. 

 
Milk Visual Effects is a registered limited company: 0844 1256. The 
registered company address is Threeways House, 40-44 Clipstone Street, 
London, W1W 5DW.

-- 
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/718de4dd-ac5f-4d11-a1d9-c77257bcb0d2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Maya-Python] query current layer in batch render process

2019-01-15 Thread Juan Cristóbal Quesada
Thanks Josh, but that doesnt work either, its querying the RenderSetup
Widget Configuration.
What im asking is to be notified of the render layer name when it is
actually being rendered in batch process, therefore, independent from the
main thread and GUI.
This is kind of a very specific geeky question.
Im having a bad time looking for answers as there apparently isnt a proper
documentation about the mel scripts options in the render options tabs.

Just to explain a little bit more: the reason why it must be done via a
preRenderLayerMel script in the render options tabs is because those are
callbacks called by the rendering process at the moment of effectively
proceeding the render (be it the layer, in pre/post, each frame in pre/post
or the whole rendering process). I dont want to query the RenderSetup or
the Legacy Render Layer system is this is the Configuration you have just
set up BEFORE  starting to render

The render layer name (among other layer parameters) must be able to be
queried from the render options tabs pre/post RenderLayer Mel since this is
a script that is called when starting/finishing to process each render
layer! It just must be available somehow.

Either there is a huge lack of documentation about the render options, or
it is explained in a very hidden spot. Im guessing the first one!

El lun., 14 ene. 2019 a las 20:47, Josh Carey ()
escribió:

> this may or may not operate the same as the globals query, but worth a
> shot in your case.
>
> import maya.app.renderSetup.model.renderSetup as renderSetup
> rs = renderSetup.instance()
> layer =  rs.getVisibleRenderLayer()
> # you can do all sorts of stuff/queries on the layer now...
> layer.name()  # name of the layer
>
> On Mon, Jan 14, 2019 at 2:41 AM Juan Cristóbal Quesada <
> juan.cristobal...@gmail.com> wrote:
>
>> Hi,
>>
>> Im trying to  retrieve the current layer being rendered in a batch
>> render process within an interactive maya session.
>>
>> currently im trying to do it like this:
>>
>> string $current_render_layer = `editRenderLayerGlobals -q
>> -currentRenderLayer`;
>>
>> And im setting this code as a mel script in the render options tab, as
>> "pre" script for preRenderLayerMel.
>>
>> When i launch the batch render im getting among other things the frame
>> number being rendered but i keep getting
>>
>> the same render layer name when rendering two different ones.
>>
>> Im guessing this code is not actually querying the batch render process,
>> but the Maya GUI tab.
>>
>> So my question is: how can i retrieve the current render layer that is
>> being rendered? Maybe there is another Maya API command that im not
>> aware of, or maybe in the render options scripts there are already some
>> global variables built in and the render layer would be one of those...
>>
>> Thanks
>>
>> --
>> 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/1f4ed9b7-151b-f4cf-9a55-2eeade4eb98e%40gmail.com
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
> --
> Josh Carey
>
>
> --
> 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/CAA_9eyoprin_qHDFSk62xTey6GDMf%2BGfEy8BJKwyvHyXh8Z7cA%40mail.gmail.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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/CANOg8wWypYt5yGCJ-dyiRx5euZPuTiGS1x1%3DA75j%3DBJ35b56pw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.