Skip to content

Commit

Permalink
Merged work (#786, #824)
Browse files Browse the repository at this point in the history
  • Loading branch information
johnnyquest committed Feb 14, 2019
2 parents fc399ec + 160933d commit 974bbaa
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 3 deletions.
13 changes: 12 additions & 1 deletion PARMmenu.xml
Original file line number Diff line number Diff line change
Expand Up @@ -139,11 +139,22 @@ except:
<expression>len(kwargs['parms'])>0 and type(kwargs['parms'][0].parmTemplate()) is hou.FloatParmTemplate</expression>
</context>
<scriptCode><![CDATA[
import qlibutils;
import qlibutils; reload(qlibutils);
qlibutils.add_parm_value_multiplier(kwargs)
]]></scriptCode>
</scriptItem>

<scriptItem id="ql_add_parm_value_multiplier_exp">
<label>Add Value/Multiplier + Exponent</label>
<context>
<expression>len(kwargs['parms'])>0 and type(kwargs['parms'][0].parmTemplate()) is hou.FloatParmTemplate</expression>
</context>
<scriptCode><![CDATA[
import qlibutils; reload(qlibutils);
qlibutils.add_parm_value_multiplier(kwargs, add_exponent=True)
]]></scriptCode>
</scriptItem>

<scriptItem id="ql_set_rampbasis_label">
<label>Set Ramp to...</label>
<context>
Expand Down
Binary file modified otls/base/apply_xform_ql_SOP.otl
Binary file not shown.
Binary file modified otls/future/peak_ql_SOP.otl
Binary file not shown.
Binary file modified otls/future/volume_retime_ql_SOP.otl
Binary file not shown.
19 changes: 17 additions & 2 deletions scripts/python/qlibutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ def toggle_abs_rel_path(kwargs):
pass


def add_parm_value_multiplier(kwargs):
def add_parm_value_multiplier(kwargs, add_exponent=False):
"""Adds a value/multipler parameter pair to the specified parameter.
(Called from PARMmenu.xml)
"""
Expand All @@ -295,8 +295,11 @@ def add_parm_value_multiplier(kwargs):
pl = t.label()
pvn = '%s_value' % pn
pmn = '%s_mult' % pn
pxn = '%s_exp' % pn
t = hou.FloatParmTemplate(name=p.name(), label="...", num_components=1)

expr = "ch('%s') * ch('%s')" % (pvn, pmn, )

if not n.parm(pvn) and not n.parm(pmn):
# value
t.setName(pvn)
Expand All @@ -310,10 +313,22 @@ def add_parm_value_multiplier(kwargs):
t.setMaxValue(2.0)
t.setDefaultValue( (1.0, ) )
g.insertAfter(pvn, t)

if add_exponent and not n.parm(pxn):
# exp
t.setName(pxn)
t.setLabel('%s (exp)' % pl)
t.setMinValue(0.001)
t.setMaxValue(4.0)
t.setDefaultValue( (2.0, ) )
g.insertAfter(pmn, t)

expr = "ch('%s') * pow(ch('%s'), ch('%s'))" % (pvn, pmn, pxn, )

# add parms
n.setParmTemplateGroup(g)

p.setExpression("ch('%s') * ch('%s')" % (pvn, pmn, ) )
p.setExpression(expr)
else:
hou.ui.setStatusMessage("Value/multiplier params already exist for %s" % p.path(),
severity=hou.severityType.Warning)
Expand Down

0 comments on commit 974bbaa

Please sign in to comment.