Home Website Youtube GitHub

Disable automatic set keys in previous frame during space switching

Hey there! :slight_smile:
Guys, I’m wondering how can I switch off automatic adding keys in previous frame during space switching. This is really annoying. I’m an animator and I need the only keys I set in exacly frame I set it, even during space switching.
So, could you help me and point the direction how can I switch this feature Off.
Thanks!

1 Like

Hello, mate.
You need go to dagmenu.py and commite this strings:

> ```if autokey:
> 
>             for target_control in target_control_list:
> 
>                 cmds.setKeyframe("{}:{}".format(
> 
>                     namespace_value, target_control), "{}.{}"
> 
>                     .format(switch_control, switch_attr),
> 
>                     time=(cmds.currentTime(query=True) - 1.0))'''
> 
>         # triggers switch
> 
>         changeSpace(root,
> 
>                     switch_control,
> 
>                     switch_attr,
> 
>                     switch_idx,
> 
>                     target_control_list)
> 
>         '''if autokey:
> 
>             for target_control in target_control_list:
> 
>                 cmds.setKeyframe("{}:{}".format(
> 
>                     namespace_value, target_control), "{}.{}"
> 
>                     .format(switch_control, switch_attr),
> 
>                     time=(cmds.currentTime(query=True)))'''

This turn off automatic adding keys in previous frame. Cheers

3 Likes

Just to clarify, do you want to turn off autokey completely? Or just on the previous frame?

Right now, the tool doesn’t respect the autokey setting, and I think it is a good feature request that it should! If you have autokey turned off, it probably shouldn’t add a key at all.

But to just disable the previous key, @GoodSewed is right, but that code pasting has some weird formatting probably because of the forum auto-formatting, and shows backticks, instead of quotes.

  1. Open mgear/core/dagmenu.py
  2. Go to line 374 (assuming mGear 4.0.3. Otherwise search for “autokey =”)
  3. Comment out these lines, by adding 3 quotes around the code: ''' or """:
    if not root or not target_control_list:
        pm.displayInfo("Not root or target control list for space transfer")
        return

    autokey = cmds.listConnections("{}.{}".format(switch_control, switch_attr),
                                   type="animCurve")

    ''' <-- ADD THE QUOTES HERE AND BELOW
    if autokey:
        for target_control in target_control_list:
            cmds.setKeyframe("{}:{}".format(
                namespace_value, target_control), "{}.{}"
                .format(switch_control, switch_attr),
                time=(cmds.currentTime(query=True) - 1.0))
    ''' 

    # triggers switch
    changeSpace(root,
                switch_control,
                switch_attr,
                switch_idx,
                target_control_list)

    if autokey:
        for target_control in target_control_list:
            cmds.setKeyframe("{}:{}".format(
                namespace_value, target_control), "{}.{}"
                .format(switch_control, switch_attr),
                time=(cmds.currentTime(query=True)))

3 Likes

Oh, boy! Thanks a lot, man! You saved 1000hours of my work! ))

Tank you, Chris! )) That’s awesome news! Animators now in save! ))