Skip to content

Commit

Permalink
added script load options on preferences
Browse files Browse the repository at this point in the history
  • Loading branch information
magnoborgo committed Sep 28, 2021
1 parent 4257e1a commit 2d7b586
Show file tree
Hide file tree
Showing 16 changed files with 58 additions and 32 deletions.
16 changes: 9 additions & 7 deletions kmfx_alphaOverlayColor.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,23 @@
from PySide2.QtCore import *
from PySide2.QtWidgets import QLabel
import sys
# import shiboken2
from fx import *

fx.prefs.add("KMFX.Alpha Overlay Color UI", True)
fx.prefs.add("KMFX_Load.Alpha Overlay Color UI", True)


class KMFXalphaOverlayColor(Action):
"""allows to change the alpha overlay color with UI item and shortcuts"""

def __init__(self,):
Action.__init__(self, "KMFX|Alpha Overlay Color")
if fx.prefs["KMFX.Alpha Overlay Color UI"]:
self.AObtn = self.get_widgets()
AOcolor = self.fxcolor_to_qcolor(fx.prefs["viewer.alphaColor"])
self.AObtn.setStyleSheet(
"background-color: {}".format(AOcolor.name()))
if fx.prefs["KMFX_Load.Alpha Overlay Color UI"] is True:
Action.__init__(self, "KMFX|Alpha Overlay Color")
if fx.prefs["KMFX.Alpha Overlay Color UI"]:
self.AObtn = self.get_widgets()
AOcolor = self.fxcolor_to_qcolor(fx.prefs["viewer.alphaColor"])
self.AObtn.setStyleSheet(
"background-color: {}".format(AOcolor.name()))

def available(self):
pass
Expand Down
4 changes: 3 additions & 1 deletion kmfx_changepaintOpacity.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import fx
from fx import *
fx.prefs.add("KMFX_Load.Change Paint Opacity", True)


class KMFXchangepaintOpacity(Action):

"""shortcuts to increase/decrease opacity when using paint node"""

def __init__(self):
Action.__init__(self, "KMFX|Change Paint Opacity")
if fx.prefs["KMFX_Load.Change Paint Opacity"] is True:
Action.__init__(self, "KMFX|Change Paint Opacity")

def available(self):
node = fx.activeNode()
Expand Down
6 changes: 4 additions & 2 deletions kmfx_cloneShapeinPlace.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
from fx import *
from tools.objectIterator import getObjects
from tools.objectIterator import ObjectFinder
fx.prefs.add("KMFX_Load.Clone Shapes in Place", True)


def remove_keys(shape,propertiesList):
for prop in propertiesList:
Expand All @@ -13,14 +15,14 @@ def remove_keys(shape,propertiesList):
editor.deleteKey(t)
editor.execute()
propertie.constant = True



class KMFXcloneShapeinPlace(Action):
"""Copy shapes to an Active Layer on a given frame,removing all keyframes."""

def __init__(self):
Action.__init__(self, "KMFX|Clone Shapes in Place")
if fx.prefs["KMFX_Load.Clone Shapes in Place"] is True:
Action.__init__(self, "KMFX|Clone Shapes in Place")

def available(self):
shapes = getObjects(selection(), types=[Shape])
Expand Down
4 changes: 3 additions & 1 deletion kmfx_cloneinteractivemodeToggle.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import fx
from fx import *
clonemode = None
fx.prefs.add("KMFX_Load.Clone Interactive Toggle", True)


class KMFXcloneinteractivemodeToggle(Action):
"""shortcut to enable interactive mode if onion skin is active"""

def __init__(self,):
Action.__init__(self, "KMFX|Clone Interactive Toggle On/Off")
if fx.prefs["KMFX_Load.Clone Interactive Toggle"] is True:
Action.__init__(self, "KMFX|Clone Interactive Toggle On/Off")

def available(self):
assert fx.viewer.toolName == "Clone", "Clone tool only"
Expand Down
9 changes: 5 additions & 4 deletions kmfx_copyShapeKeyframe.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
import fx
from fx import *
from tools.objectIterator import getObjects
fx.prefs.add("KMFX_Load.Shape Keyframe Copy", True)


class KMFXcopyShapeKeyframe(Action):
"""copy paste path keyframes"""

def __init__(self):
Action.__init__(self, "KMFX|Shape Keyframe Copy")
self.savedkeys = {}
self.from_action_menu = "copy"

if fx.prefs["KMFX_Load.Shape Keyframe Copy"] is True:
Action.__init__(self, "KMFX|Shape Keyframe Copy")
self.savedkeys = {}
self.from_action_menu = "copy"

def available(self):
shapes = getObjects(selection(), types=[Shape])
Expand Down
4 changes: 3 additions & 1 deletion kmfx_cyclePaintPresets.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@
from fx import *

fx.prefs.add("KMFX.Paint Presets maximum cycle", 4, min=2, max=10)
fx.prefs.add("KMFX_Load.Cycle Paint Presets", True)


class KMFXcyclePaintPresets(Action):
"""You can cycle your paint presets with a keybind"""

def __init__(self,):
Action.__init__(self, "KMFX|Cycle Paint Presets")
if fx.prefs["KMFX_Load.Cycle Paint Presets"] is True:
Action.__init__(self, "KMFX|Cycle Paint Presets")

def available(self):
node = fx.activeNode()
Expand Down
4 changes: 3 additions & 1 deletion kmfx_cycleRGB.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@
from fx import *
cycleRGB = None
previousRGB = None
fx.prefs.add("KMFX_Load.Cycle RGB channels", True)


class KMFXcycleRGBchannels(Action):
"""Overrides shortcuts to cycle rgb modes using a single key shortcut"""

def __init__(self,):
Action.__init__(self, "KMFX|Cycle RGB channels")
if fx.prefs["KMFX_Load.Cycle RGB channels"] is True:
Action.__init__(self, "KMFX|Cycle RGB channels")

def available(self):
pass
Expand Down
4 changes: 3 additions & 1 deletion kmfx_hard_alpha.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import fx
from fx import *
fx.prefs.add("KMFX_Load.Paint Hard Alpha setup", True)


class KMFX_hard_Alpha(Action):
"""creates a combo of nodes to setup a hard alpha"""

def __init__(self,):
Action.__init__(self, "KMFX|Paint Hard Alpha setup")
if fx.prefs["KMFX_Load.Paint Hard Alpha setup"] is True:
Action.__init__(self, "KMFX|Paint Hard Alpha setup")

def available(self):
assert fx.selection() != [], "Select some nodes"
Expand Down
4 changes: 3 additions & 1 deletion kmfx_keyframeVisibility.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import fx
from fx import *
from tools.objectIterator import getObjects
fx.prefs.add("KMFX_Load.Keyframe Visibility", True)


class KMFXkeyframeVisibility(Action):
"""Creates keyframes without clicking on the visibility icon"""

def __init__(self):
Action.__init__(self, "KMFX|Keyframe Visibility")
if fx.prefs["KMFX_Load.Keyframe Visibility"] is True:
Action.__init__(self, "KMFX|Keyframe Visibility")

def available(self):
shapes = getObjects(selection(), types=[Shape])
Expand Down
4 changes: 3 additions & 1 deletion kmfx_nudgeShapes.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import fx
from fx import *
from tools.objectIterator import getObjects
fx.prefs.add("KMFX_Load.Nudge Shape Shortcuts", True)


class KMFXnudgeShapes(Action):
"""move shapes with keyboard shortcuts """

def __init__(self,):
Action.__init__(self, "KMFX|Nudge Shape Shortcuts")
if fx.prefs["KMFX_Load.Nudge Shape Shortcuts"] is True:
Action.__init__(self, "KMFX|Nudge Shape Shortcuts")

def available(self):
shapes = getObjects(selection(), types=[Shape])
Expand Down
5 changes: 3 additions & 2 deletions kmfx_paintpresets.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import glob
import os
from fx import *

fx.prefs.add("KMFX_Load.Paint Presets", True)
fx.prefs.add("KMFX.Paint Presets Path", "")
fx.prefs.add("KMFX.Paint Presets Save Warning", True)

Expand Down Expand Up @@ -89,7 +89,8 @@ class KMFXpaintPresets(Action):
"""this will save/load the actual state of the paint node to/from disk"""

def __init__(self,):
Action.__init__(self, "KMFX|Paint Presets")
if fx.prefs["KMFX_Load.Paint Presets"] is True:
Action.__init__(self, "KMFX|Paint Presets")

def available(self):
pass # verification on execution
Expand Down
6 changes: 4 additions & 2 deletions kmfx_pasteShapeKeyframe.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import fx
from fx import *
from tools.objectIterator import getObjects
fx.prefs.add("KMFX_Load.Shape Keyframe Paste", True)


class KMFXpasteShapeKeyframe(Action):
"""paste path keyframes, this is just a wrapper so we have this on the Actions menu"""

def __init__(self):
Action.__init__(self, "KMFX|Shape Keyframe Paste")

if fx.prefs["KMFX_Load.Shape Keyframe Paste"] is True:
Action.__init__(self, "KMFX|Shape Keyframe Paste")

def available(self):
shapes = getObjects(selection(), types=[Shape])
Expand Down
7 changes: 3 additions & 4 deletions kmfx_resetcloneoverride.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
import fx
from fx import *


fx.prefs.add("KMFX.Reset Clone also resets opacity", True)

fx.prefs.add("KMFX_Load.Clone Reset transforms and frame", True)

class KMFXresetCloneOverride(Action):
"""replicates the behavior the clone tool
"reset button",resets clone frame as well"""

def __init__(self,):
Action.__init__(self, "KMFX|Clone Reset transforms and frame")
if fx.prefs["KMFX_Load.Clone Reset transforms and frame"] is True:
Action.__init__(self, "KMFX|Clone Reset transforms and frame")

def available(self):
assert fx.viewer.toolName == "Clone", "Clone tool only"
Expand Down
5 changes: 3 additions & 2 deletions kmfx_reshapeOverride.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import fx
from fx import *
reshapeOverridestore = True

fx.prefs.add("KMFX_Load.Reshape Tool Override", True)

class KMFXreshapeOverride(Action):
"""Overrides the reshape tool binding to avoid the magnet reshape tool"""

def __init__(self,):
Action.__init__(self, "KMFX|Reshape Tool Override")
if fx.prefs["KMFX_Load.Reshape Tool Override"] is True:
Action.__init__(self, "KMFX|Reshape Tool Override")

def available(self):
pass
Expand Down
4 changes: 3 additions & 1 deletion kmfx_selectallpoints.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import fx
from fx import *
from tools.objectIterator import getObjects
fx.prefs.add("KMFX_Load.Select All Points rebind", True)


class KMFXselectAllPointRebind(Action):
"""shortcut to Selects all points when in reshape mode """

def __init__(self,):
Action.__init__(self, "KMFX|Select All Points rebind")
if fx.prefs["KMFX_Load.Select All Points rebind"] is True:
Action.__init__(self, "KMFX|Select All Points rebind")

def available(self):
pass
Expand Down
4 changes: 3 additions & 1 deletion kmfx_timeOffset.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import fx
from fx import *
from tools.objectIterator import getObjects
fx.prefs.add("KMFX_Load.Node Time Offset", True)


class KMFXtimeOffset(Action):
"""Offsets keyframes on selected nodes"""

def __init__(self,):
Action.__init__(self, "KMFX|Node Time Offset")
if fx.prefs["KMFX_Load.Node Time Offset"] is True:
Action.__init__(self, "KMFX|Node Time Offset")

def available(self):
assert fx.selection() != [], "Select some nodes"
Expand Down

0 comments on commit 2d7b586

Please sign in to comment.