Updating slider value after a dynamic modification

unhandled
(Ang Rose33) #1

Hi to everyone,
I have a setup where a ‘Slider’s Range’ is dynamically modified by the Metahopper SetSlider component.

The Slider seemingly changes its values since I can see the numbers on the Slider visibly changing (for example if the upper bound is decreased while the slider is at its max value, then the visible max value on the Slider is decreased); but, that very visible value is not propagated to the output of the Slider (until I manually touch the Slider).

Setting the V value works as expected though.
I have attached a sample recording of what happens

Is this as designed, or something that perhaps will be fixed? Or, does it exist any alternative Slider manipulator plugins, a Python component?

Thanks.

(Andrew Heumann) #2

I believe I have fixed this. I can’t upload to food4rhino right now but here is the fixed GHA:
MetaHopper.gha (251 KB)

(Ang Rose33) #3

hi andrew,
thanks for your work, but I have problems yet.
I leave you a screen, I hope you can solve it.

(Andrew Heumann) #4

I think if you update your rhino it should work?

(Ang Rose33) #5

Very very good, Andrew! Thank you! but but I noticed a general slowdown, you too?

(Andrew Heumann) #6

slowdown with what? like just that component, or in general?

(Ang Rose33) #7

a general slowdown of the entire model that does not occur with the previous version of Metahopper

(Andrew Heumann) #8

I can’t imagine why that would be. If you send me your file and I can reproduce the slowness I can certainly take a look

(Ang Rose33) #9

try but it’s very complex. I thank you and wait for your feedback34.model_pupils plan absorption.gh (364.7 KB)

(Andrew Heumann) #10

Your file is very large and hard to understand, but one thing I notice right away is that you’re using “Set Slider” in tandem with “Get Connected objects” - this is a bad idea as the definition will execute many times every time you try to change the slider. As a rule, don’t use “get connected” if you’re going to modify the state (expire the solution of) the object you’re referencing

Here is what happens, for example:
You change the slider range
this executes “set slider”
this changes all the sliders
this causes “get connected” to execute
this triggers “set slider” again

in extreme cases this can even cause an infinite loop, although in your case I think this is not happening due to the smart way sliders handle changes forced programmatically.

Instead, you should use a “get” component that does not rely on a wired connection, such as get object by nickname, get objects by selection, or get objects in group - these will not recompute when the object they reference expires.

1 Like
Value listener not live with Metahopper change
(Ang Rose33) #11

Hi Andrew, sorry for the delay in answering you,
could you better explain how the components you are talking about work?
Can you attach an example?