-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathkmfx_multikeyAssign.py
32 lines (22 loc) · 986 Bytes
/
kmfx_multikeyAssign.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import fx
from fx import *
from tools.objectIterator import getObjects
class KMFXmultikeyAssign(Action):
"""assign multiple actions to the same key shortcut depending on the active node context
example:
fx.bind('Num+1', callMethod(fx.actions["KMFXmultikeyAssign"].execute,
**{"PaintNode":["KMFXchangepaintOpacity", {"mode": "decrease"}],
"RotoNode":["KMFXnudgeShapes", {"mode": "BL"}]
}))
the keys of the assignment dict should be: fx.activeNode().type i.e. PaintNode, RotoNode, etc
the lists are [nameoftheaction (str), arguments (dict)]
"""
def __init__(self,):
Action.__init__(self, "KMFX|MultiKeyAssign helper")
def available(self):
pass
def execute(self, **kwargs):
node = activeNode()
if node.type in kwargs.keys():
fx.actions[kwargs[node.type][0]].execute(**kwargs[node.type][1])
addAction(KMFXmultikeyAssign())