Skip to content

Instantly share code, notes, and snippets.

@Farfarer
Last active March 12, 2019 13:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Farfarer/b178c31231603916b621d71f610adad9 to your computer and use it in GitHub Desktop.
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.
#!/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