Skip to content

Commit 974bbaa

Browse files
committed
Merged work (#786, #824)
2 parents fc399ec + 160933d commit 974bbaa

File tree

5 files changed

+29
-3
lines changed

5 files changed

+29
-3
lines changed

PARMmenu.xml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,11 +139,22 @@ except:
139139
<expression>len(kwargs['parms'])>0 and type(kwargs['parms'][0].parmTemplate()) is hou.FloatParmTemplate</expression>
140140
</context>
141141
<scriptCode><![CDATA[
142-
import qlibutils;
142+
import qlibutils; reload(qlibutils);
143143
qlibutils.add_parm_value_multiplier(kwargs)
144144
]]></scriptCode>
145145
</scriptItem>
146146

147+
<scriptItem id="ql_add_parm_value_multiplier_exp">
148+
<label>Add Value/Multiplier + Exponent</label>
149+
<context>
150+
<expression>len(kwargs['parms'])>0 and type(kwargs['parms'][0].parmTemplate()) is hou.FloatParmTemplate</expression>
151+
</context>
152+
<scriptCode><![CDATA[
153+
import qlibutils; reload(qlibutils);
154+
qlibutils.add_parm_value_multiplier(kwargs, add_exponent=True)
155+
]]></scriptCode>
156+
</scriptItem>
157+
147158
<scriptItem id="ql_set_rampbasis_label">
148159
<label>Set Ramp to...</label>
149160
<context>

otls/base/apply_xform_ql_SOP.otl

10 Bytes
Binary file not shown.

otls/future/peak_ql_SOP.otl

13.1 KB
Binary file not shown.
1.34 KB
Binary file not shown.

scripts/python/qlibutils.py

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ def toggle_abs_rel_path(kwargs):
279279
pass
280280

281281

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

301+
expr = "ch('%s') * ch('%s')" % (pvn, pmn, )
302+
300303
if not n.parm(pvn) and not n.parm(pmn):
301304
# value
302305
t.setName(pvn)
@@ -310,10 +313,22 @@ def add_parm_value_multiplier(kwargs):
310313
t.setMaxValue(2.0)
311314
t.setDefaultValue( (1.0, ) )
312315
g.insertAfter(pvn, t)
316+
317+
if add_exponent and not n.parm(pxn):
318+
# exp
319+
t.setName(pxn)
320+
t.setLabel('%s (exp)' % pl)
321+
t.setMinValue(0.001)
322+
t.setMaxValue(4.0)
323+
t.setDefaultValue( (2.0, ) )
324+
g.insertAfter(pmn, t)
325+
326+
expr = "ch('%s') * pow(ch('%s'), ch('%s'))" % (pvn, pmn, pxn, )
327+
313328
# add parms
314329
n.setParmTemplateGroup(g)
315330

316-
p.setExpression("ch('%s') * ch('%s')" % (pvn, pmn, ) )
331+
p.setExpression(expr)
317332
else:
318333
hou.ui.setStatusMessage("Value/multiplier params already exist for %s" % p.path(),
319334
severity=hou.severityType.Warning)

0 commit comments

Comments
 (0)