promote and link a ramp with python

   4799   5   2
User Avatar
Member
624 posts
Joined: Aug. 2008
Offline
I can create a new parameter with hou.Ramp((lin, lin), (0, 1), (2.5, 4.5))
and put it on the template in an a node.
but is there a way that I can link it?
User Avatar
Member
8081 posts
Joined: July 2005
Offline
Unfortunately, the only way to do it through scripting is via the opmultiparm hscript command. Use that and run it on a promoted ramp parameter (via the Operator Type Properties) to get an idea of the syntax that's needed.
User Avatar
Member
624 posts
Joined: Aug. 2008
Offline
I found a way to link then in an odd way, if the name of the node changes, this stop working since its a script.

in the callback script of the promoted ramp
ramp.set(promoted_ramp.evalAsRamp())
that way when the user move a key in the ramp runs the code and set the new parameters every time.
User Avatar
Member
1 posts
Joined: Aug. 2012
Offline
Hey guys sorry to revive this topic. I'm running into the same issue and i've tried what you were saying Edward and think I got the syntax right but its not working. It seems I'm missing something

as an example I have a geo1 node in /obj with two nulls, null1 and null2. I added a float ramp on each of them with the same name called parm

and then I try to run this in the textport :
opmultiparm /obj/geo1/null1 'parm#pos' '../null2/parm#pos' 'parm#value' '../null2/parm#value' 'parm#interp' '../null2/parm#interp'

this yields nothing like nothing happened. However if I run

opmultiparm /obj/geo1/null1

if outputs :

opmultiparm null1 'parm#pos' '../null2/parm#pos' 'parm#value' '../null2/parm#value' 'parm#interp' '../null2/parm#interp'

I also tried creating a subnetwork with a null and a ramp and then promoting it from the subnetwork and its connected it works

I then run

opmultiparm /obj/geo1/subnet1/null1

It will output :

opmultiparm null1 'parm#pos' '../parm#pos' 'parm#value' '../parm#value' 'parm#interp' '../parm#interp'

So then I tell myself ok then lets create another subnetwork with a null that has a ramp parameter called parm. Create a ramp parameter on the subnetwork also called parm and run the same thing as what it outputed just previously:

so I run

opmultiparm /obj/geo1/subnet2/null1 'parm#pos' '../parm#pos' 'parm#value' '../parm#value' 'parm#interp' '../parm#interp'

Nothing happens. I move and add stuff on the ramp on the subnet but the null ramp just ignores it

I check its connected by using


opmultiparm /obj/geo1/subnet2/null1

and it outputs


opmultiparm null1 'parm#pos' '../parm#pos' 'parm#value' '../parm#value' 'parm#interp' '../parm#interp'

same as with the subnet which I manually promoted the ramp.

Is there another step I am missing to get this to work ? I feel I've tried everything you mentioned here and in other threads on odforce or anything I could find

Thanks for the help
User Avatar
Member
192 posts
Joined: April 2015
Offline
pelos
ramp.set(promoted_ramp.evalAsRamp())

Hi there. Could you give me a small hip file example of that method?
User Avatar
Member
192 posts
Joined: April 2015
Offline
Check out this hip file guys. That works really well.
You only have to fickle a bit with the 'ramp copier' for it to work.

Is there a way to have this 'constantly' being evaluated?

I don't want to set any callback script on the ramp that is being copied. Only on the ramp_copier hda.
I see there is a hou.ui.addEventLoopCallback(), but that seems more like a global function, rather than something that lives in the HDA, inside that parameter.

(also: I want to do this via a script and this "ramp_path_parameter", and not with opmultiparm)
-
Edited by OdFotan - Nov. 15, 2021 20:49:52

Attachments:
Screenshot 2021-11-16 at 02.42.07.png (732.1 KB)
ramp_copier.hiplc (94.5 KB)

  • Quick Links