Last active
March 12, 2019 13:10
-
-
Save Farfarer/b178c31231603916b621d71f610adad9 to your computer and use it in GitHub Desktop.
Wrapper command for vertMap.quantize so you can type in the number of divisions, rather than calculate them manually.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import lx | |
import lxu.command | |
class Quantize_Cmd(lxu.command.BasicCommand): | |
def __init__(self): | |
lxu.command.BasicCommand.__init__(self) | |
self.dyna_Add ('steps', lx.symbol.sTYPE_INTEGER) | |
def cmd_UserName(self): | |
return 'Quantise' | |
def basic_ButtonName(self): | |
return 'Quantise' | |
def cmd_Flags(self): | |
return lx.symbol.fCMD_QUIET | |
def basic_Enable(self, msg): | |
return True | |
def cmd_Interact(self): | |
pass | |
def arg_UIHints (self, index, hints): | |
if index == 0: | |
hints.Label ('Steps') | |
def basic_Execute(self, msg, flags): | |
steps = self.dyna_Int(0, 0) | |
steps = max (steps, 1) | |
lx.eval('vertMap.quantize %.32f' % (1.0/steps)) | |
lx.bless (Quantize_Cmd, 'ffr.quantize') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment