Mirror set driven key


#21

Hi mate, the link isn’t working :slight_smile:


#22

Sorry about that, the link is still pending moderation approval. :slight_smile: I’ll let you know when it comes up, can’t paste any attachments at the moment.


#23

Link is fine now. Let me know if it works out.


#24

Hi mate, Im trying it out right now, only one thing, I dont think is working for my purpose, when I have 2 different drivers which are driving other two different objects … like the pic I posted in the first page… am i right ?

Cheers


#25

I don’t see how to use it (Maya 2011.5):

import copySDK
  reload (copySDK)
    select -cl  ;
    select -r pSphere1 ; #This is driven on x,y,z
     select -tgl pPyramid1 ;
    copySDK()
    # Error: 'module' object is not callable
    # Traceback (most recent call last):
    #   File "<maya console>", line 1, in <module>
    # TypeError: 'module' object is not callable 
   
   copySDK.__doc__ string 
   # Error: invalid syntax
    #   File "<maya console>", line 2
    #     copySDK.__doc__ string
    #                          ^
    # SyntaxError: invalid syntax 

#26

Ag. Again sorry about that. I was running it under the assumption that you ran it in the script editor.

If you import it, this should work:

copySDK.copySDK()

to view the doc tag, type:

copySDK.copySDK.__doc__

Let me know if you find any bugs. I found a few already with the advanced naming options and am writing revisions now.

Cheers.


#27

For different drivers, you should declare the search and replace variables:

copySDK.copySDK(search='originalDriver', replace='targetDriver')

Does it do it for you?


#28

I’ve got it running.
Say I have objA_R, objB_R, and objC_R driven by driver.smile (a slider). Can I use the script to copy/mirror all the SDKs to objA_L, objB_L, and objC_L? If so, what’s the procedure?

I see you also have a separate mirroring function. Once the SDK’s have been established, could you simply mirror the trans/rot/scale of the same objects?

If you look at my script (not as concisely written as yours), what it does is update or create keys on SDKs that have already been setup. Its useful for tweaking SDK driven rigs.
Thanks a lot.


#29

Right. Currently, it’s set to be driven-centric. Meaning you have to select the driven objects, objA_R, then toggle select objA_L. Then you run:

copySDK.copySDK()

Or not select anything and run:

copySDK.copySDK(source='objA_R', targets=['objA_L'])

This would mirror the sdk setup to objA_L, and would connect it to the original driver.attribute .

Then you do the same for objB_L and objB_R, and so on. By the way, the targets variable is a list because this will allow you to mirror the same SDK setup from objA_R to multiple objects. I’m assuming that objA_R, objB_R and objC_R all have unique keyframes, hence you need to do them separately in this case.

If you wanted the target object’s attributes to have negative behavior (have all the keys multiplied by negative 1), you’d have to specify the attributes using the mirror variable.

copySDK.copySDK(source='objA_R', targets=['objA_L'], mirror =['tx,'ty','tz'])

Furthermore, say you wanted to mirror the sdk setup to a different driver, that’s when you’d use the search and replace variable. Say you wanted to mirror the sdk setup from objA_R to objA_L, but use a differnt driver. Say the original was R_driver.smile, and you wanted to link the new one to L_driver.smile, you would use:

copySDK.copySDK(source='objA_R', targets=['objA_L'], search='R_', replace='L_')

This would link objA_L to the L_driver.smile. In the case of driven-centric SDK transfers, search and replace are used to search for a particular string in the original’s driver’s name, replace it with the replace string and find an object with a matching name.

But pretty soon, the script will be able to run in ‘driver’ mode. That is, you select the source driver first, and toggle select the destination driver. Right now it can’t do this yet but I’m currently writing it out:

copySDK.copySDK(source='R_driver', targets=['L_driver'], search='_R',  replace='_L', mode='driver')

This would theoretically search out for all the outgoing SDK connections from R_driver, look for the driven objects, find the target driven objects names based of the search/replace list, and then use the target object as the new driver. Hope I get it finished by Sunday…

If there are any suggestions please let me know. I’m trying to write it as a bunch of base scripts that can run through command line first to get a clear working method going (so that it can be run through other python modules or classes), and then build the interface later.


#30

Nope, i’ve got this error:

Error: AttributeError: line 1 of <maya console>: ‘function’ object has no attribute ‘copySDK’


#31

Hmmm. If you’re importing it as a module, you use this:

import copySDK
 copySDK.copySDK(search='originalDriverName', replace='targetDriverName')

If you’re opening the script in the script editor and running it from there, you use:


  copySDK(search='originalDriverName', replace='targetDriverName')

Of course, replace originalDriverName and targetDriverName with your actual objects’ names.


#32

Just updated my script to handle sdk transfer by selecting the driver objects instead of the driven (driven mode still exists though):

http://www.creativecrash.com/maya/downloads/scripts-plugins/character/c/copysdk-py

Cheers.


#33

Hi mate, sorry it took me so long to get back to you.
How this new script works ?


#34

First, select the source driver (the one where you’ll copy SDK’s from), and then select your target driver (the one you want to copy SDK’s to). Now assuming you’ve got your naming conventions for your object set up as something like this:

Left driver = L_faceCtrl

Right driver = R_faceCtrl

And assuming your transfering from one driver to another (and they have the same attrs), and that they have the same component parts (driven objects, with the same attrs), you can use:

import copySDK
copySDK.copySDK(search='L_', replace='R_', mode='driver')

Or if you source the script through the script editor:

copySDK(search='L_', replace='R_', mode='driver')

Now say you want to mirror some of the attributes on the driven objects, in your case the tx attribute, you’d have to find the attribute on the driver which is driving them and indicate that in the mirrorAttrs variable to that it gets a negative value.

copySDK(search='L_', replace='R_',  mirrorAttrs=['drivingAttr'], mode='driver')

Let me know if that works out.


#35

Wow, it works a treat !!! that is awesome mate, thank you so much for sharing this ! it is a time saver !!!

Thanks a lot !
Cheers


#36

No worries. Let me know if you find any bugs with it. It will take about a month to fully complete this thing (planning on adding an appropriate interface later, as well as diagnostic options).


#37

Is one the most powerful SDK manager script I ever used.
Well done !


#38

Checking out the latest version, I’ve run into some errors - not sure if they are yours or mine:

  1. Say I just want to mirror objects w/out SDKs. What’s the syntax?
select -r ball_upr_R ball_R ball_lwr_R ;
 copySDK.copySDK(search='_R',replace='_L',mirrorAttrs=['tx'])
 # Error: Flag 'ap' must be passed a boolean argument # Traceback (most recent call last):
  #   File "<maya console>", line 1, in 
  #   File "C:\Documents and Settings\Administrator\My Documents\maya\myScripts\copySDK.py", line 58, in copySDK
  #     curlist  = cmds.ls(sl=True, ap=True)
  # TypeError: Flag 'ap' must be passed a boolean argument # 
 
  1. Say I want to mirror some SDKs from one slider (driver) to another:
copySDK.copySDK(search='faceControls.rSmile', replace='faceControls.lSmile', mode='driver',mirrorAttrs =['tx']) # Error: Flag 'ap' must be passed a boolean argument
  # Traceback (most recent call last):
  #   File "<maya console>", line 1, in <module>
  #   File "C:\Documents and Settings\Administrator\My Documents\maya\myScripts\copySDK.py", line 58, in copySDK
  #     curlist  = cmds.ls(sl=True, ap=True)
  # TypeError: Flag 'ap' must be passed a boolean argument #

Thanks
Test file attached…


#39

Hmmm. Let me check into this tonight.


#40

Just wondering where the project is right now.