Re: [Maya-Python] Re: Remove reference edits via Python?

2014-10-31 Thread Fredrik Averpil
Hi Luke, this is very useful.

I save out all the edits to an editMB file before cleaning it. And when I
save out that file as well as when I re-apply it later down the road, Maya
crashes sporadically. Currently, I’m not unloading the reference when
performing the edits export and the edits import. Perhaps that could be why
it’s crashing on me? (it’s not always crashing)

Your pymel examples looks really clean. I managed to do it without pymel,
but it’s a bit more cumbersome. I wonder if pymel is a more stable way of
dealing with this?

Here’s what I did to remove all edits (on a loaded reference):

# Remove all edits
ref = 'myrefRN'
nodes = cmds.referenceQuery( ref, editNodes=True )
attr_types = cmds.referenceQuery( ref, editAttrs=True )
for node in nodes:
for attr_type in attr_types:
for edit_command in ['addAttr', 'connectAttr',
'deleteAttr', 'disconnectAttr', 'parent', 'setAttr', 'lock',
'unlock']:
cmds.referenceEdit( node+'.'+attr_type,
failedEdits=True, successfulEdits=True, removeEdits=True,
editCommand=edit_command)

// Fredrik



On Thu, Oct 30, 2014 at 11:14 PM, Luke Harris luk...@gmail.com wrote:

I was doing this recently with pymel. Maya says that you can now remove ref
 edits while the reference is loaded, but I've noticed this isn't always the
 case, so I still unload it first for safety

 for ref in pm.listReferences():
 ref.unload()
 for edit in ref.getReferenceEdits():
 # this way you can selectively remove edits
 pm.ReferenceEdit(edit, fileReference=ref).remove(force=True)
 ref.load()

 But if you want to remove ALL edits it might be faster to do a clean(),
 which removes failed edits. If the ref is unloaded then all edits are
 failed :)
 for ref in pm.listReferences():
 ref.unload()
 ref.clean()
 ref.load()




 On Thursday, October 30, 2014 11:51:12 AM UTC, Fredrik Averpil wrote:

 And if it makes it easier to somehow solve this ... I'm looking to remove
 *all* reference edits.


 ​


  --
 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/2ee0b079-d794-4d84-956e-d465ae245e22%40googlegroups.com
 https://groups.google.com/d/msgid/python_inside_maya/2ee0b079-d794-4d84-956e-d465ae245e22%40googlegroups.com?utm_medium=emailutm_source=footer
 .
 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/CAD%3DwhWPi2QNvFbVDzp-P2v0dim5F-Ewd7Yf0ZK9Y%2Bt5Z4J6P5w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Maya-Python] Re: Remove reference edits via Python?

2014-10-31 Thread Fredrik Averpil
Whoops … I meant to write that Maya crashes when I export the editMB
(sometimes) and later down the road it also crashes (sometimes) when I save
down the edits into the actual scene (“Save reference edits”).

By the way, this is how I save down the reference edits on a loaded
reference:

filepath = '..'
cmds.file(filepath, saveReference=True, force=True)

​

-- 
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/CAD%3DwhWNj_9tCTkjnmpHvU9CYO4b5iEY-cvA4zK%2BSZDq-51D2jg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Maya-Python] Re: Remove reference edits via Python?

2014-10-31 Thread Marcus Ottosson
Crashing reference updates is surprisingly common I think. One stable way
I've gone about it in the past is to update the .ma file. The results are
the same, except Maya won't have to keep the old and new reference in
memory while switching; which has been, in my experience, the cause of the
majority of crashes.

On 31 October 2014 07:39, Fredrik Averpil fredrik.aver...@gmail.com wrote:

 Whoops … I meant to write that Maya crashes when I export the editMB
 (sometimes) and later down the road it also crashes (sometimes) when I save
 down the edits into the actual scene (“Save reference edits”).

 By the way, this is how I save down the reference edits on a loaded
 reference:

 filepath = '..'
 cmds.file(filepath, saveReference=True, force=True)

 ​

 --
 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/CAD%3DwhWNj_9tCTkjnmpHvU9CYO4b5iEY-cvA4zK%2BSZDq-51D2jg%40mail.gmail.com
 https://groups.google.com/d/msgid/python_inside_maya/CAD%3DwhWNj_9tCTkjnmpHvU9CYO4b5iEY-cvA4zK%2BSZDq-51D2jg%40mail.gmail.com?utm_medium=emailutm_source=footer
 .

 For more options, visit https://groups.google.com/d/optout.




-- 
*Marcus Ottosson*
konstrukt...@gmail.com

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


Re: [Maya-Python] me podrian indicar como aprender lenguaje python y aplicarlo en maya entenderlo

2014-10-31 Thread Ricardo Viana
Sugiro que aprendas el ingles primero.
Despues aprendes Python en la web. Es gratuito en muchos sítios. Como
learntocode thehardway (Google it).

On Wednesday, October 29, 2014, Juan Carlos Chavez hernandez 
cerebrodigita...@gmail.com wrote:

 hla perdone pero  necesito  aprender comprender y aplicar python en maya,
 de esto  depende mi trabajo  para sacar adelante a mi  familia. no tego la
 plata para pagar un curso  y no  se ingles  necesito  ayuda en español por
 favor  agradesco su ayuda

  --
 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
 javascript:_e(%7B%7D,'cvml','python_inside_maya%2bunsubscr...@googlegroups.com');
 .
 To view this discussion on the web visit
 https://groups.google.com/d/msgid/python_inside_maya/5f88d317-95f0-4b8e-ae75-5afcbc61f88e%40googlegroups.com
 https://groups.google.com/d/msgid/python_inside_maya/5f88d317-95f0-4b8e-ae75-5afcbc61f88e%40googlegroups.com?utm_medium=emailutm_source=footer
 .
 For more options, visit https://groups.google.com/d/optout.



-- 
Ricardo Viana

-- 
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/CAK%2Bp0%3DbzWFc5vPy8StHHrNZUfHAC7sx4W7sqG6iXo%2Bh78UTS7Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Maya-Python] Re: Remove reference edits via Python?

2014-10-31 Thread Fredrik Averpil
One stable way I've gone about it in the past is to update the .ma file.

How do you mean, exactly?
Do you mean launching a separate process such as maya -batch -command [mel
code] -file hello.ma or do you mean reading in the .ma contents and
modifying it with Python?
​

-- 
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/CAD%3DwhWP4t8znzmfXR9c-c2O-%3DmqreigKuKsbW%3DHG8K3%3DH8xcPQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Maya-Python] Re: Remove reference edits via Python?

2014-10-31 Thread Marcus Ottosson
You can either modify the .ma in a text-editor, as it is text, or through
Python via something like regular expressions. Each reference will be
clearly prefixed by it's unique command in the header of the file, along
with its absolute path.

On 31 October 2014 08:15, Fredrik Averpil fredrik.aver...@gmail.com wrote:

 One stable way I've gone about it in the past is to update the .ma file.

 How do you mean, exactly?
 Do you mean launching a separate process such as maya -batch -command
 [mel code] -file hello.ma or do you mean reading in the .ma contents
 and modifying it with Python?
 ​

 --
 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/CAD%3DwhWP4t8znzmfXR9c-c2O-%3DmqreigKuKsbW%3DHG8K3%3DH8xcPQ%40mail.gmail.com
 https://groups.google.com/d/msgid/python_inside_maya/CAD%3DwhWP4t8znzmfXR9c-c2O-%3DmqreigKuKsbW%3DHG8K3%3DH8xcPQ%40mail.gmail.com?utm_medium=emailutm_source=footer
 .

 For more options, visit https://groups.google.com/d/optout.




-- 
*Marcus Ottosson*
konstrukt...@gmail.com

-- 
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/CAFRtmOChbuv2ti4%3DPHD35xnUG%3DXgon7WUjybGV%3D9rjOg6a%2BRvA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Maya-Python] Re: Remove reference edits via Python?

2014-10-31 Thread Eduardo Grana
Hello Fredrik,
Regarding the remove all edits,
have you tryed the referenceEdit command with the flag
*removeEdits?*probably is safer, but you have to unload the reference first.
Cheers!
Eduardo

On Fri, Oct 31, 2014 at 5:27 AM, Marcus Ottosson konstrukt...@gmail.com
wrote:

 You can either modify the .ma in a text-editor, as it is text, or through
 Python via something like regular expressions. Each reference will be
 clearly prefixed by it's unique command in the header of the file, along
 with its absolute path.

 On 31 October 2014 08:15, Fredrik Averpil fredrik.aver...@gmail.com
 wrote:

 One stable way I've gone about it in the past is to update the .ma file.

 How do you mean, exactly?
 Do you mean launching a separate process such as maya -batch -command
 [mel code] -file hello.ma or do you mean reading in the .ma contents
 and modifying it with Python?
 ​

 --
 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/CAD%3DwhWP4t8znzmfXR9c-c2O-%3DmqreigKuKsbW%3DHG8K3%3DH8xcPQ%40mail.gmail.com
 https://groups.google.com/d/msgid/python_inside_maya/CAD%3DwhWP4t8znzmfXR9c-c2O-%3DmqreigKuKsbW%3DHG8K3%3DH8xcPQ%40mail.gmail.com?utm_medium=emailutm_source=footer
 .

 For more options, visit https://groups.google.com/d/optout.




 --
 *Marcus Ottosson*
 konstrukt...@gmail.com

 --
 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/CAFRtmOChbuv2ti4%3DPHD35xnUG%3DXgon7WUjybGV%3D9rjOg6a%2BRvA%40mail.gmail.com
 https://groups.google.com/d/msgid/python_inside_maya/CAFRtmOChbuv2ti4%3DPHD35xnUG%3DXgon7WUjybGV%3D9rjOg6a%2BRvA%40mail.gmail.com?utm_medium=emailutm_source=footer
 .

 For more options, visit https://groups.google.com/d/optout.




-- 
Eduardo Graña
www.eduardograna.com.ar

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


Re: [Maya-Python] related to Maya Array Attribute, having compound child.

2014-10-31 Thread Eduardo Grana
Hello Hyun,
I may be misunderstanding the question, but I'll give it a try if you don't
mind ;)
As far as I know, when you have attributes and they have the default value,
maya doesn't save them anywhere, and when you ask for them, the default
value is returned
( and sometimes only the values that are different from the default are
returned, and you have to fill the array yourself )
Could this be what's happening?
Cheers!
Eduardo

On Wed, Oct 29, 2014 at 8:20 PM, Hyun Seung Kim arti...@gmail.com wrote:

 In fact, I have a question to ask.

 Question: related to dynamic size on array attribute
 Currently, I use array attribute containing compound attributes within
 ( target Matrices ( array ) - target 1st ( compound child  as matrix type)
 and target weight 1st ( compound child as float type ) )
 When the plugin loaded and try to access the attribute but the size of
 array has not been increased.
 Since maya array attribute is sparse, I thought, it should be expanded
 with elementByPhysicalIndex.
 But Array does not seem to be increased.

 Anyone might have an idea there is a way Maya API to handle array compound
 attributes?

 Thanks in advance on any feedbacks!!


  --
 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/7fdba434-2182-44b4-92aa-0f9dfd9821ce%40googlegroups.com
 https://groups.google.com/d/msgid/python_inside_maya/7fdba434-2182-44b4-92aa-0f9dfd9821ce%40googlegroups.com?utm_medium=emailutm_source=footer
 .
 For more options, visit https://groups.google.com/d/optout.




-- 
Eduardo Graña
www.eduardograna.com.ar

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


[Maya-Python] MObject unique ID's

2014-10-31 Thread Mark Jackson
Hi all,

I'm revisiting the Red9_Meta caching setup and am looking at the
possibility of using the MObjectHandles hashID as a key in the MetaCache
that I build up, currently I store the key as the dag path which is
obviously not optimal. The cache saves any object being instantiated twice
by the factory class and speeds things up considerably.

However, reading through the docs it seems that the hashID isn't actually
unique, from the api docs:

*The returned hash code is not unique: several internal Maya objects may
return the same code. However different MObjectHandles whose MObjects refer
to the same internal Maya object will return the same hash code.*

Can anybody shed any light on this, am I barking up the wrong tree here?

cheers

Mark

-
Mark Jackson
CEO / Technical Director
red9consultancy.com

-- 
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/CAGQH2FFG-jF%3DO6qtyPxwWp5jno%3DCk%3D5cJie9uaro7RpoC7p_SA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Maya-Python] me podrian indicar como aprender lenguaje python y aplicarlo en maya entenderlo

2014-10-31 Thread Eduardo Grana
Hola Juan Carlos,

Te paso unos links...
(I'm sending you some links)

Aqui documentacion de python en español
(Here you have spanish documentation for python)
http://pyspanishdoc.sourceforge.net/

Y aqui, un tutorial en español, o en castellano, como decimos los
argentinos ;)
(And here you have a tutorial in spanish, or castellano, as we, the
argentines, call it)
http://docs.python.org.ar/tutorial/2/contenido.html

Aqui hay un link a un libro muy interesante
(Here you have a link to a very interesting book)
http://es.diveintopython.net/toc.html

Saludos!
Eduardo


On Fri, Oct 31, 2014 at 5:02 AM, Ricardo Viana cgolhei...@gmail.com wrote:

 Sugiro que aprendas el ingles primero.
 Despues aprendes Python en la web. Es gratuito en muchos sítios. Como
 learntocode thehardway (Google it).


 On Wednesday, October 29, 2014, Juan Carlos Chavez hernandez 
 cerebrodigita...@gmail.com wrote:

 hla perdone pero  necesito  aprender comprender y aplicar python en maya,
 de esto  depende mi trabajo  para sacar adelante a mi  familia. no tego la
 plata para pagar un curso  y no  se ingles  necesito  ayuda en español por
 favor  agradesco su ayuda

  --
 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/5f88d317-95f0-4b8e-ae75-5afcbc61f88e%40googlegroups.com
 https://groups.google.com/d/msgid/python_inside_maya/5f88d317-95f0-4b8e-ae75-5afcbc61f88e%40googlegroups.com?utm_medium=emailutm_source=footer
 .
 For more options, visit https://groups.google.com/d/optout.



 --
 Ricardo Viana

 --
 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/CAK%2Bp0%3DbzWFc5vPy8StHHrNZUfHAC7sx4W7sqG6iXo%2Bh78UTS7Q%40mail.gmail.com
 https://groups.google.com/d/msgid/python_inside_maya/CAK%2Bp0%3DbzWFc5vPy8StHHrNZUfHAC7sx4W7sqG6iXo%2Bh78UTS7Q%40mail.gmail.com?utm_medium=emailutm_source=footer
 .

 For more options, visit https://groups.google.com/d/optout.




-- 
Eduardo Graña
www.eduardograna.com.ar

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


Re: [Maya-Python] MObject unique ID's

2014-10-31 Thread Justin Israel
Sounds like what you want to do is cache on the hash code combined with a
type identifier, since seems a hash code may not be unique across different
types.

On Sat, 1 Nov 2014 12:07 AM Mark Jackson mark...@gmail.com wrote:

 Hi all,

 I'm revisiting the Red9_Meta caching setup and am looking at the
 possibility of using the MObjectHandles hashID as a key in the MetaCache
 that I build up, currently I store the key as the dag path which is
 obviously not optimal. The cache saves any object being instantiated twice
 by the factory class and speeds things up considerably.

 However, reading through the docs it seems that the hashID isn't actually
 unique, from the api docs:

 *The returned hash code is not unique: several internal Maya objects may
 return the same code. However different MObjectHandles whose MObjects refer
 to the same internal Maya object will return the same hash code.*

 Can anybody shed any light on this, am I barking up the wrong tree here?

 cheers

 Mark

 -
 Mark Jackson
 CEO / Technical Director
 red9consultancy.com

 --
 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/CAGQH2FFG-jF%3DO6qtyPxwWp5jno%3DCk%3D5cJie9uaro7RpoC7p_SA%40mail.gmail.com
 https://groups.google.com/d/msgid/python_inside_maya/CAGQH2FFG-jF%3DO6qtyPxwWp5jno%3DCk%3D5cJie9uaro7RpoC7p_SA%40mail.gmail.com?utm_medium=emailutm_source=footer
 .
 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/CAPGFgA32wgr0QdR7bVe0Z2Uv4yF0TfXhez9gnr_pdVS0NtxVzQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Maya-Python] MObject unique ID's

2014-10-31 Thread David Moulder
Hi Mark,

Hows things?

I think the MObjectHandle is returning the its MObject.__hash__() and as 2
MObjectHandles can point to the same MObject you'll get the same uuid.

-Dave

On Fri, Oct 31, 2014 at 11:07 AM, Mark Jackson mark...@gmail.com wrote:

 Hi all,

 I'm revisiting the Red9_Meta caching setup and am looking at the
 possibility of using the MObjectHandles hashID as a key in the MetaCache
 that I build up, currently I store the key as the dag path which is
 obviously not optimal. The cache saves any object being instantiated twice
 by the factory class and speeds things up considerably.

 However, reading through the docs it seems that the hashID isn't actually
 unique, from the api docs:

 *The returned hash code is not unique: several internal Maya objects may
 return the same code. However different MObjectHandles whose MObjects refer
 to the same internal Maya object will return the same hash code.*

 Can anybody shed any light on this, am I barking up the wrong tree here?

 cheers

 Mark

 -
 Mark Jackson
 CEO / Technical Director
 red9consultancy.com

 --
 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/CAGQH2FFG-jF%3DO6qtyPxwWp5jno%3DCk%3D5cJie9uaro7RpoC7p_SA%40mail.gmail.com
 https://groups.google.com/d/msgid/python_inside_maya/CAGQH2FFG-jF%3DO6qtyPxwWp5jno%3DCk%3D5cJie9uaro7RpoC7p_SA%40mail.gmail.com?utm_medium=emailutm_source=footer
 .
 For more options, visit https://groups.google.com/d/optout.




-- 
*David Moulder*
Technical Animator / Artist
squis...@gmail.com
*Professional Profile http://uk.linkedin.com/pub/david-moulder/1/b12/b5a*

Mobile: +44 (0)7814033242
See who we know in common
http://www.linkedin.com/e/wwk/5748982/?hs=falsetok=3tztwkse1silw1Want a
signature like this?
http://www.linkedin.com/e/sig/5748982/?hs=falsetok=3pwLU9-mBsilw1

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


Re: [Maya-Python] MObject unique ID's

2014-10-31 Thread Mark Jackson
yeah, that's pretty much what I thought, just checking before I ditch the
idea, if I'm going to be checking the hashID against the node Type in-order
to extract a matching key from the dict then I may as well just revert to
the system I had. Not that big a hit to re-instantiate the node if
somebodies renamed it, the cache just updates itself.

As for things, yeah, bloody busy at the moment, Red9 is getting a lot of
interest and we're already booked solid till well into December doing
facial systems for a TV commercial, that and talking to a lot of games and
pre-viz companies about pipelines. How about yourself Dave, been a long
time!

Mark

On 31 October 2014 11:51, David Moulder da...@thirstydevil.co.uk wrote:

 Hi Mark,

 Hows things?

 I think the MObjectHandle is returning the its MObject.__hash__() and as 2
 MObjectHandles can point to the same MObject you'll get the same uuid.

 -Dave

 On Fri, Oct 31, 2014 at 11:07 AM, Mark Jackson mark...@gmail.com wrote:

 Hi all,

 I'm revisiting the Red9_Meta caching setup and am looking at the
 possibility of using the MObjectHandles hashID as a key in the MetaCache
 that I build up, currently I store the key as the dag path which is
 obviously not optimal. The cache saves any object being instantiated twice
 by the factory class and speeds things up considerably.

 However, reading through the docs it seems that the hashID isn't actually
 unique, from the api docs:

 *The returned hash code is not unique: several internal Maya objects may
 return the same code. However different MObjectHandles whose MObjects refer
 to the same internal Maya object will return the same hash code.*

 Can anybody shed any light on this, am I barking up the wrong tree here?

 cheers

 Mark

 -
 Mark Jackson
 CEO / Technical Director
 red9consultancy.com

 --
 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/CAGQH2FFG-jF%3DO6qtyPxwWp5jno%3DCk%3D5cJie9uaro7RpoC7p_SA%40mail.gmail.com
 https://groups.google.com/d/msgid/python_inside_maya/CAGQH2FFG-jF%3DO6qtyPxwWp5jno%3DCk%3D5cJie9uaro7RpoC7p_SA%40mail.gmail.com?utm_medium=emailutm_source=footer
 .
 For more options, visit https://groups.google.com/d/optout.




 --
 *David Moulder*
 Technical Animator / Artist
 squis...@gmail.com
 *Professional Profile http://uk.linkedin.com/pub/david-moulder/1/b12/b5a*

 Mobile: +44 (0)7814033242
 See who we know in common
 http://www.linkedin.com/e/wwk/5748982/?hs=falsetok=3tztwkse1silw1Want
 a signature like this?
 http://www.linkedin.com/e/sig/5748982/?hs=falsetok=3pwLU9-mBsilw1

 --
 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/CABD4PkQGSCXYRRrjdy0od49cSPqiF99TrhxehgnSUz8GBum8eA%40mail.gmail.com
 https://groups.google.com/d/msgid/python_inside_maya/CABD4PkQGSCXYRRrjdy0od49cSPqiF99TrhxehgnSUz8GBum8eA%40mail.gmail.com?utm_medium=emailutm_source=footer
 .

 For more options, visit https://groups.google.com/d/optout.




-- 
-
Mark Jackson
CEO / Technical Director
red9consultancy.com

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


Re: [Maya-Python] Re: Remove reference edits via Python?

2014-10-31 Thread Fredrik Averpil
Yes, however, that just simply does not work at all.

Try this;

for ref in cmds.ls(references=True):
cmds.referenceEdit( ref, removeEdits=True)

Here in my scene, nothing happens. No reference edits was removed.



On Fri, Oct 31, 2014 at 11:56 AM, Eduardo Grana eduardo.gr...@gmail.com
wrote:

have you tryed the referenceEdit command with the flag *removeEdits?*

​

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


Re: [Maya-Python] Re: Remove reference edits via Python?

2014-10-31 Thread Eduardo Grana
Hey Fredrik,
Your right, it doesn't do anything! hahaha

try this:


import maya.cmds as cmds

for ref in cmds.ls(references=True):
cmds.file(unloadReference=ref)
cmds.file (cr=ref) # *cleanReference*

thats how the reference editor does it...
(C:/Program Files/Autodesk/Maya2013/scripts/others/referenceEditorPanel.mel)

Cheers!
Eduardo

On Fri, Oct 31, 2014 at 12:58 PM, Fredrik Averpil fredrik.aver...@gmail.com
 wrote:

 Yes, however, that just simply does not work at all.

 Try this;

 for ref in cmds.ls(references=True):
 cmds.referenceEdit( ref, removeEdits=True)

 Here in my scene, nothing happens. No reference edits was removed.



 On Fri, Oct 31, 2014 at 11:56 AM, Eduardo Grana eduardo.gr...@gmail.com
 wrote:

 have you tryed the referenceEdit command with the flag *removeEdits?*

 ​

 --
 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/CAD%3DwhWP3ow98GjVjpcArMwg7SbL6ZAuH0AoJhOzG76%2BQoZ6omg%40mail.gmail.com
 https://groups.google.com/d/msgid/python_inside_maya/CAD%3DwhWP3ow98GjVjpcArMwg7SbL6ZAuH0AoJhOzG76%2BQoZ6omg%40mail.gmail.com?utm_medium=emailutm_source=footer
 .

 For more options, visit https://groups.google.com/d/optout.




-- 
Eduardo Graña
www.eduardograna.com.ar

-- 
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/CACt6GrnMiidVGDFORwvR%3D%3DbMaByMQw-8zOSJUV-HT1Rc5DELpg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Maya-Python] Re: Remove reference edits via Python?

2014-10-31 Thread Fredrik Averpil
Aaahhh... yes, that did work. Thank you!



On Fri, Oct 31, 2014 at 5:13 PM, Eduardo Grana eduardo.gr...@gmail.com
wrote:

 import maya.cmds as cmds

 for ref in cmds.ls(references=True):
 cmds.file(unloadReference=ref)
 cmds.file (cr=ref) # *cleanReference*


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


[Maya-Python] Possible Maya bug: Loading editMB into Maya via cmds.file()

2014-10-31 Thread Fredrik Averpil
I think I found a bug in Maya. After having fiddled around with reference
edits in a script, something broke and it is impossible to load an “editMB”
file back into Maya using Python or MEL. See the example script below. Step
4 won't work.

However, if you re-open the scene after having run this code and then run
the code for step 4 … it works, and the reference edits are loaded back in
successfully. So it seems a re-open of the scene is needed for step 4 to
work properly when chaining these commands in a script.

And if you right-click the reference and choose “Assign offline file” and
assign a file that way, it just works without re-opening the scene. My
problem is I have to automate this using a script.

Anyone understand what’s going on?

for ref in cmds.ls(references=True):
print 'Working on ' + ref

# Step 1. Export edits
print 'Exporting edits to C:/...'
cmds.exportEdits(
'C:/'+ref.replace(':','')+'.editMB',
type='editMB',  # default
onReferenceNode=ref,# default
includeNetwork=True,# default
includeAnimation=True,  # default
includeShaders=True,# default
includeSetAttrs=True,   # default

includeSetDrivenKeys=True,
includeConstraints=True,
includeDeformers=True,

force=True
)

# Step 2. Remove all edits
print 'Removing all edits...'
cmds.file(unloadReference=ref)
cmds.file (cr=ref) # cleanReference
cmds.file(loadReference=ref)


# Step 3. Save down new edits into maya reference files
print 'Saving down new edits into reference...'
filepath = cmds.referenceQuery( ref, filename=True )
cmds.file(filepath, saveReference=True, force=True)


# Step 4. Apply the original reference edits back onto the reference files
print 'Apply reference edits from file in C:/...editMB back into
reference...'
cmds.file( 'C:/'+ref.replace(':','')+'.editMB', applyTo=ref,
i=True, namespace=ref.replace(':',''), type='editMB')

// Fredrik
​

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


Re: [Maya-Python][ANN] Pyblish 1.0 Alpha

2014-10-31 Thread Marcus Ottosson
Hi all,

Frontend is live http://event.pyblish.com!

Interact with it using it’s RESTful API
https://github.com/pyblish/pyblish-event#api

   - GitHub Repo https://github.com/pyblish/pyblish-event
   - More Details
   https://github.com/abstractfactory/pyblish/issues/99#issuecomment-61304407

Early, of course, but do let us know what you think of it!

   - http://event.pyblish.com/

Best,
Marcus
​

-- 
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/CAFRtmOC%3DYCYNjeWrB%3DZ5So7N%2B12_iNRhvnWJsf1NNo7VMpENVg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[Maya-Python] Get point position using Uv map

2014-10-31 Thread Jan
The following script gets you the world position from a random uv-coordinate of 
the selected object.
I affraid I don't know what you mean with symmetry line.


import maya.OpenMaya as om
import maya.cmds as cmds
import random

def GetDagPath(nodeName):
sel = om.MSelectionList()
om.MGlobal.getSelectionListByName(nodeName, sel)

dp = om.MDagPath()

sel.getDagPath(0,dp)
return dp


def UvCoordToWorld(U, V, mesh):

mfnMesh = om.MFnMesh(GetDagPath(mesh))
numFaces = mfnMesh.numPolygons()

WSpoint = om.MPoint(0.0,0.0,0.0)

util2 = om.MScriptUtil()   
util2.createFromList ((U, V),2)   
float2ParamUV = util2.asFloat2Ptr()

for i in range(numFaces):
try:
mfnMesh.getPointAtUV(i,WSpoint, float2ParamUV, om.MSpace.kWorld) 
break; #point is in poly
except:
continue #point not found!

return WSpoint

f = UvCoordToWorld (random.random(), random.random(), 
cmds.ls(sl=True,type='shape'))
print [f[0], f[1], f[2]]

-- 
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/76460376-4fc1-4266-a3ed-420e2e0ab816%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.