HIK magic-ses

Situation

Say you have multiple Mocapped walks, and you need to apply it to characters of different sizes.

Here’s the twist: all these characters need to walk “in pace”, and they must all advance the same distance with the same amount of steps.

Potential Solution

Apply definitions to all your destination assets and Mocap. Before Locking the Mocap, however, scale the Mocap Takes to have the same gait that you’ll need the assets to have.

Then, on each Target Asset, Go to its HIK Properties, set the following:
Retarget Specific>Match Source to ON
Retarget Specific>Pull>Left Leg>Left Leg Pull to 1.0
Retarget Specific>Pull>Right Leg>Right Leg Pull to 1.0

And now, each Target Asset will reach the Mocap Foot’s location precisely!

Motion Trails from Camera View!

Here’s how it works:

To use Anchor Transform to isolate animation

  1. In your scene, create an animated camera.

  2. Select an object in your scene, either part of a character rig, or an object and set a key, even if the object is not animated. The object must have at least one keyframe on it, even if it is static, for the Anchor Transform trail to work.

  3. Go to Panels > Perspective > <your animated camera name> so you view the scene through the animated camera.

  4. Ctrl-click both the object and the current camera in the Outliner and go to Visualize >Create Editable Motion Trails > .

  5. Activate the Anchor Transform option and click Create Motion Trail.

    The Motion trail of the object from the camera's point-of-view appears when you play the animation.

Or use this Python Code:

from pymel import all as pm
# Select the Control first, then the Shotcam, then run this code
item,anchor = pm.selected()
motion_trail = pm.snapshot(item,
                            motionTrail=True, 
                            increment=1, 
                            startTime = pm.playbackOptions(q=1,min=1),
                            endTime = pm.playbackOptions(q=1,max=1),
                            anchorTransform = anchor)

Button = Function + Arguments

In Maya, here are 3 examples to run a Function within a UI (explanation annotated to help another Animator with UI function calls):

Call a formatted string

Calling a string directly is a quick way to run a simple command with a UI. Here’s what the string would look like:

run_command_string = 'print(cmds.radioCollection("{}", query=True, select=True));'.format(COLLECTION1) button1 = cmds.button(label='Print String Command', command=run_command_string)

Call a unique function

With a unique function, it can only run the given command.

def run_code(*args,**kwargs):
    '''
    For as long as you're using maya.cmds, ALWAYS use *args and **kwargs.
    This will catch any extra attributes coming in with the Function call.

    Notice that "COLLECTION1" is in CapsLock.
    This usually means that a Variable is Global to the Code's scope.
    '''
    print(cmds.radioCollection(COLLECTION1, query=True, select=True))

Call a function with additional arguments

def run_partial_code(collection_name,*args,**kwargs):
    '''
    Use *args and **kwargs. This will catch any extra attributes coming in with the Function call.
    Using functools.partial allows you to add multiple Variables.
    So if your command had a crapload of Variables, you can call them like so:
        partial(run_partial_command, collection_name, this_fancy_var, oh_look_ma, i_can_fly)
    And it'll be the same as running:
        run_partial_command(collection_name, this_fancy_var, oh_look_ma, i_can_fly)
    '''
    print(cmds.radioCollection(collection_name, query=True, select=True))

Full Sample Code

  from functools import partial

def run_code(collection,*args,**kwargs):
    '''
    For as long as you're using maya.cmds, ALWAYS use *args and **kwargs.
    This will catch any extra attributes coming in with the Function call.

    Notice that "COLLECTION1" is in CapsLock.
    This usually means that a Variable is Global to the Code's scope.
    '''
    print(cmds.radioCollection(COLLECTION1, query=True, select=True))

def run_partial_code(collection_name,*args,**kwargs):
    '''
    Use *args and **kwargs. This will catch any extra attributes coming in with the Function call.
    Using functools.partial allows you to add multiple Variables.
    So if your command had a crapload of Variables, you can call them like so:
        partial(run_partial_command, collection_name, this_fancy_var, oh_look_ma, i_can_fly)
    And it'll be the same as running:
        run_partial_command(collection_name, this_fancy_var, oh_look_ma, i_can_fly)
    '''
    print(cmds.radioCollection(collection_name, query=True, select=True))
    

cmds.window()
cmds.columnLayout( adjustableColumn=True, rowSpacing=10 )
cmds.frameLayout( label='Colors' )
cmds.columnLayout()
COLLECTION1 = cmds.radioCollection()
# rb1 = cmds.radioButton( label='Red' ) # This will label the new name radioButton, but not return
                                        # the appropriate name.
rb1 = cmds.radioButton( 'Red' ) # This will use "Red" to both Label the Radio Button AND call it "Red" in the background.
print(cmds.radioButton(rb1,q=1,label=1)) # Will print "Red"
print(cmds.radioButton(rb1,q=1,fullPathName=1))
# Will print something like "window12|columnLayout136|frameLayout118|columnLayout137|Red"

rb2 = cmds.radioButton( label='Blue' )
rb3 = cmds.radioButton( label='Green' )
cmds.setParent( '..' )
cmds.setParent( '..' )

cmds.radioCollection( COLLECTION1, edit=True, select=rb2 )

# Call the command as a String
run_command_string = 'print(cmds.radioCollection("{}", query=True, select=True));'.format(COLLECTION1)
button1 = cmds.button(label='Print String Command', command=run_command_string)

# Call the Function only, all Args have to be implemented in the function from the start
button2 = cmds.button(label='Print Function Command', command=run_code)

# Call the function along with Arguments, useful when using For loops to create a lot of buttons
# that use the same Function, but each button calls different Arguments.
button3 = cmds.button(label='Print Partial Command', command=partial(run_partial_code,COLLECTION1))

## Here, since you're calling the "collection", 
## you have to use the "radioCollection" command instead of the "radioButton",
## and you are querying the "select" flag to find out what is selected.
# getSelectRadioVal1 = cmds.radioCollection(COLLECTION1, query=True, select=True)


cmds.showWindow()