Home Website Youtube GitHub

How do you create an SDK using scripts

Hi i was wondering how i would be able to create a SDK with script so that i can use it as a post script step.
I would use the RBF manager but currently it still is not working with regards to blendshapes and only work with control to control, so being able to just have the SDK in one of the post custom steps would be very helpful

Hi @IDntKnw,

Where specifically are you stuck on this? How to make a post script in general? Or the Python syntax for driven keys?

The syntax is simple:

pm.setDrivenKeyframe(yourControl.drivenAttribute, currentDriver=drivingControl.drivingAttr, driverValue=0.0, value=0.0)
pm.setDrivenKeyframe(yourControl.drivenAttribute, currentDriver=drivingControl.drivingAttr, driverValue=1.0, value=20.0)

Another made-up but slightly more realistic example:

import pymel.core as pm

# Say you want to add a driven key to your face blendshapes:
smileBlend = pm.PyNode('face_blendshapes').Smile_Left
frownBlend = pm.PyNode('face_blendshapes').Frown_Left

# The driver in this example is a "smile" attribute I added on the corner control:
# And that attribute goes from -10 to +10
smileDriver = pm.PyNode('lips_L_corner_ctl').smile

# When the attribute goes to +10, drive the smile to 1.0:
pm.setDrivenKeyframe(smileBlend, cd=smileDriver, dv=0.0, v=0.0)
pm.setDrivenKeyframe(smileBlend, cd=smileDriver, dv=10.0, v=1.0)

# When the attribute goes to -10, drive the frown instead of the smile:
pm.setDrivenKeyframe(frownBlend , cd=smileDriver, dv=0.0, v=0.0)
pm.setDrivenKeyframe(frownBlend , cd=smileDriver, dv=-10.0, v=1.0)
4 Likes

Hi thanks for the response

My issue was with the Python syntax which you seemingly have covered here, im assuming that this would create and 'animCurve" node the same way that an SDK would

Does the order in which you put in the blend shape, driving control and values matter

Is there a proper way for creating the post script steps as i have just been making a python file with all my info in it and haveing ‘from maya import cmds’ at the top and it seems to have been working just fine

Thanks

What is the “issue”? That’s what a driven key is. It’s an animation curve. If that is a problem for some reason, I recommend using a remapValue node instead.

Yes. If you create the script through the guide interface, it automatically adds some boilerplate mGear code, which gives you more access to the stepDict class.

But it is not required. The way you’re doing it is fine for simple scripts.

1 Like

thank you very much for all the help that should be everything that i can think of