cmds.dgdirty(a=True)

On Tue, Jul 23, 2013 at 1:24 AM, Joe Weidenbach <[email protected]> wrote:

> Ok, figured it out :).  It looks like the wonderful Maya not updating
> itself bug struck again :).  I just had to force a scene update.  On that
> note, the best option I've found to achieve this that I've found is as
> follows:
>
> import maya.cmds as cmds
>
> cmds.setToolTo("**moveSuperContext")
>
> nodes = cmds.ls()
>
> for node in nodes:
>
> cmds.select(node, replace=True)
>
> cmds.select(clear=True)
>
> cmds.setToolTo("**selectSuperContext")
>
>
> Does anyone know a better way to approach this?
>
>
> On 7/22/2013 8:44 PM, Joe Weidenbach wrote:
>
>> Hello All,
>>
>> I'm trying to get a character loader functional, that will load separate
>> rigs (control rig and envelope rig) into the scene and connect them.  So
>> far, everything in my tool is working except the actual referencing.
>>  Somehow, when I do it through code, the IK chains and who knows what else
>> (I really haven't tested beyond the IK Chains--Spline IK works fine, just
>> not regular IK. I assume that if I can get this first part fixed, the rest
>> will work as well).
>>
>> The weird part is this.  If I load both files manually (through the file
>> menu->create reference) everything works flawlessly. My rigs come in and
>> everything connects up if I run that part of my script.  If, however, I do
>> it through code, no more IK on my control rig.  Through code, if I load
>> just one rig, everything works as well, and I can then manually load the
>> envelope rig, followed by connecting with code, which again works.  It
>> seems to be the moment that I tell the code to load both rigs that it
>> breaks.  Here's the relevant code:
>>
>>         charName = self.availableCharacters[cmds.**
>> optionMenu(self.UIElements["**charSelect"], query=True, select=True) -
>> 1]["characterName"]
>>         cRigPath = self.availableCRigs[cmds.**
>> optionMenu(self.UIElements["**crSelect"], query=True, select=True) -
>> 1]["rigPath"]
>>         eRigPath = self.availableERigs[cmds.**
>> optionMenu(self.UIElements["**erSelect"], query=True, select=True) -
>> 1]["rigPath"]
>>
>>         # Create the base node and namespace
>>         cmds.namespace(set=":")
>>         if not cmds.namespace(exists=":{0}".**format(charName)):
>>             cmds.namespace(add=charName)
>>         cmds.namespace(set=charName)
>>         masterNode = cmds.group(empty=True, name="Master")
>>
>>         # Reference in the control rig and place it under the master node
>>         cmds.file("{0}/{1}".format(**self.projectData.**characterPath,
>> cRigPath), loadReferenceDepth="all", reference=True,
>> namespace="{0}_CR".format(**charName))
>>         crNode = cmds.ls("{0}:{0}_CR:*".format(**charName),
>> assemblies=True)[0]
>>         crNode = cmds.parent(crNode, masterNode)[0]
>>         crNodeShortName = crNode.rpartition(":")[2]
>>         crScaleAllNode = "{0}|{1}:{1}_CR:scaleAllGRP".**format(crNode,
>> charName)
>>
>>         ## Reference in the envelope rig and place it under the master
>> node
>>         cmds.file("{0}/{1}".format(**self.projectData.**characterPath,
>> eRigPath), loadReferenceDepth="all", reference=True,
>> namespace="{0}_ER".format(**charName))
>>         erNode = cmds.ls("{0}:{0}_ER:*".format(**charName),
>> assemblies=True)[0]
>>         erNode = cmds.parent(erNode, masterNode)[0]
>>         erScaleAllNode = "{0}|{1}:{1}_ER:scaleAllGRP".**format(erNode,
>> charName)
>>
>> (keep in mind that I've got several external vars from another
>> class--setting the path directly should work fine)
>>
>> I even tried putting a 5 second sleep between loads, and no dice. The
>> behavior seems to hold when I use the MEL equivalent commands as well.  I'm
>> a bit stumped on this one.  I'm not sure if it's something in my rig or
>> not, but that possibility would seem to be eliminated by the fact that it
>> works as intended when I load it manually.  I guess I'm just wondering if
>> I'm missing something.
>>
>> Thanks in advance,
>>
>> Joe
>>
>
> --
> 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+**[email protected]<python_inside_maya%[email protected]>
> .
> To post to this group, send email to 
> python_inside_maya@**googlegroups.com<[email protected]>
> .
> For more options, visit 
> https://groups.google.com/**groups/opt_out<https://groups.google.com/groups/opt_out>
> .
>
>
>

-- 
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 [email protected].
To post to this group, send email to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to