Add/remove component parameters depending on zoom level dynamically - Grasshopper2024-03-29T07:40:01Zhttps://www.grasshopper3d.com/forum/topics/add-remove-component-parameters-depending-on-zoom-level?commentId=2985220%3AComment%3A1108141&feed=yes&xn_auth=noNice, thanks.
I've modified…tag:www.grasshopper3d.com,2014-07-29:2985220:Comment:11081582014-07-29T21:59:10.629ZDaniel Gebreiterhttps://www.grasshopper3d.com/profile/DanielGebreiter
<p>Nice, thanks.</p>
<p></p>
<p>I've modified it such that it can deal with two open issues.</p>
<p>1. Inputs with sources are no longer removed when collapsing.</p>
<p>2. Inputs where a value had been set manually lost this value upon collapsing. This manually set value is now restored upon unfolding.</p>
<p></p>
<p>However, I've had to include a permanent list of parameters in the component, not sure if that's best practice. Wouldn't it be nicer to have a "Visible" flag with parameters where…</p>
<p>Nice, thanks.</p>
<p></p>
<p>I've modified it such that it can deal with two open issues.</p>
<p>1. Inputs with sources are no longer removed when collapsing.</p>
<p>2. Inputs where a value had been set manually lost this value upon collapsing. This manually set value is now restored upon unfolding.</p>
<p></p>
<p>However, I've had to include a permanent list of parameters in the component, not sure if that's best practice. Wouldn't it be nicer to have a "Visible" flag with parameters where they would simply be omitted from the list (if certain permitting conditions are met), rather than registering/unregistering them entirely?</p>
<p></p>
<p>There is also an issue with the order of inputs changing when some are collapsed and some aren't. This could be fixed with a bit of brain though.</p>
<p></p>
<p>Sending a message could be done with GH_RuntimeMessage for now, but I might look into providing a little arrow button like I had in my sketch when I have time.</p>
<p></p>
<p>Thanks a million, you have already brought me a whole lot further with this!</p>
<p></p> The attached code adds or rem…tag:www.grasshopper3d.com,2014-07-29:2985220:Comment:11081422014-07-29T20:25:23.125ZDavid Ruttenhttps://www.grasshopper3d.com/profile/DavidRutten
<p>The attached code adds or removes parameters from a component menu. </p>
<p>I didn't set a message yet, that should probably be done to signal to the user there is a menu option they should care about.</p>
<p></p>
<p>--</p>
<p>David Rutten</p>
<p>david@mcneel.com</p>
<p></p>
<p>The attached code adds or removes parameters from a component menu. </p>
<p>I didn't set a message yet, that should probably be done to signal to the user there is a menu option they should care about.</p>
<p></p>
<p>--</p>
<p>David Rutten</p>
<p>david@mcneel.com</p>
<p></p> lovely!tag:www.grasshopper3d.com,2014-07-29:2985220:Comment:11083222014-07-29T19:59:05.300ZLorenzo Grecohttps://www.grasshopper3d.com/profile/LorenzoGreco
<p>lovely!</p>
<p>lovely!</p> As a user I think multiple zo…tag:www.grasshopper3d.com,2014-07-29:2985220:Comment:11083192014-07-29T19:54:02.281ZAndrew Heumannhttps://www.grasshopper3d.com/profile/AndrewHeumann
<p>As a user I think multiple zoom levels would be extremely confusing. For complex options consider some of the other ways of dealing with this, some of which are a bit more "grasshopper-style":</p>
<p>1. have a regular component and an "expanded" or "advanced" component with this extended functionality</p>
<p>2. have some of the custom optional parameters entered in a settings component (like mesh brep + custom mesh settings)</p>
<p>3. Embed some of these options (if they do not need to be…</p>
<p>As a user I think multiple zoom levels would be extremely confusing. For complex options consider some of the other ways of dealing with this, some of which are a bit more "grasshopper-style":</p>
<p>1. have a regular component and an "expanded" or "advanced" component with this extended functionality</p>
<p>2. have some of the custom optional parameters entered in a settings component (like mesh brep + custom mesh settings)</p>
<p>3. Embed some of these options (if they do not need to be dynamic inputs) as component menu items (like "maintain paths" in the tree branch component)</p>
<p>4. (not 100% sure this last one is possible but it should be...) use a component menu as in 3. to show/hide advanced inputs. As you say the problem of hiding inputs with connections is a bit tricky but I think the most intuitive behavior is to leave the ones with connections always visible as you describe.</p>
<p></p> It would be fairly trivial to…tag:www.grasshopper3d.com,2014-07-29:2985220:Comment:11081412014-07-29T19:51:04.510ZDavid Ruttenhttps://www.grasshopper3d.com/profile/DavidRutten
<p>It would be fairly trivial to make the component 'unfold'. You'd still have to override the attributes, but I think most of the drawing and layout can be done by calling available methods.</p>
<p></p>
<p>Doing it through the menu allows you to get away without overriding attribute display, layout and mouse-handling. Perhaps that's a good place to start, then override the attributes later if you still want to.</p>
<p></p>
<p>I can upload an example of this probably later…</p>
<p>It would be fairly trivial to make the component 'unfold'. You'd still have to override the attributes, but I think most of the drawing and layout can be done by calling available methods.</p>
<p></p>
<p>Doing it through the menu allows you to get away without overriding attribute display, layout and mouse-handling. Perhaps that's a good place to start, then override the attributes later if you still want to.</p>
<p></p>
<p>I can upload an example of this probably later tonight.</p>
<p></p>
<p>--</p>
<p>David Rutten</p>
<p>david@mcneel.com</p> and voila a screenshot of the…tag:www.grasshopper3d.com,2014-07-29:2985220:Comment:11082192014-07-29T19:36:44.170ZDaniel Gebreiterhttps://www.grasshopper3d.com/profile/DanielGebreiter
<p>and voila a screenshot of the intended expansion functionality</p>
<p></p>
<p>Initially I thought zooming in would be nice to expose (or unhide) the optional parameters. But now I agree you might be right, an arrow button or similar would be nice to expose parameters which are often unused...</p>
<p></p>
<p>Of course this raises the questions as to what happens when input parameters are connected to something and the list is collapsed again - but maybe the ones with active connections are…</p>
<p>and voila a screenshot of the intended expansion functionality</p>
<p></p>
<p>Initially I thought zooming in would be nice to expose (or unhide) the optional parameters. But now I agree you might be right, an arrow button or similar would be nice to expose parameters which are often unused...</p>
<p></p>
<p>Of course this raises the questions as to what happens when input parameters are connected to something and the list is collapsed again - but maybe the ones with active connections are simply not collapsed back?</p>
<p></p>
<p>On the left the collapsed component, on the right the fully exposed version.</p>
<p></p> Hi David,
I've got a few com…tag:www.grasshopper3d.com,2014-07-29:2985220:Comment:11079012014-07-29T18:05:26.796ZDaniel Gebreiterhttps://www.grasshopper3d.com/profile/DanielGebreiter
<p>Hi David,</p>
<p></p>
<p>I've got a few components which just have too many inputs to look neat on the canvas.</p>
<p>Moreover, many of them are optional to the user and only required in special cases. </p>
<p>Consider a custom finite element line with </p>
<p></p>
<p>start point</p>
<p>end point</p>
<p>id</p>
<p>cross-section (optional)</p>
<p>local coordinate system (optional)</p>
<p>some property (optional)</p>
<p>some other property (optional) </p>
<p>additional settings…</p>
<p>Hi David,</p>
<p></p>
<p>I've got a few components which just have too many inputs to look neat on the canvas.</p>
<p>Moreover, many of them are optional to the user and only required in special cases. </p>
<p>Consider a custom finite element line with </p>
<p></p>
<p>start point</p>
<p>end point</p>
<p>id</p>
<p>cross-section (optional)</p>
<p>local coordinate system (optional)</p>
<p>some property (optional)</p>
<p>some other property (optional) </p>
<p>additional settings (optional)</p>
<p>etc </p>
<p></p>
<p>Now in 99% of the cases, users will only specify the first 4 parameters and leave the others blank. I'm not a huge fan of to many inputs so to clean up the canvas/components, I thought about exposing the optional parameters only upon zooming in on the component.</p>
<p>So far I've sometimes added a secondary component with more inputs to specify a list of additional settings (similar to the "settings" panel that exists/existed in Kangaroo), but this I find rather messy.</p>
<p></p>
<p>Alternatively I guess I could quite happily live with exposing the additional parameters at the click of a button. This I can do with the ZUI as it is written? I still need to get my head round what's what in this happy world of the canvas' third dimension...</p>
<p></p>
<p></p>
<p></p>
<p></p>
<p></p>
<p></p>
<p></p> Although you can override the…tag:www.grasshopper3d.com,2014-07-29:2985220:Comment:11079892014-07-29T16:43:02.505ZDavid Ruttenhttps://www.grasshopper3d.com/profile/DavidRutten
<p>Although you can override the display as much as you like, you probably shouldn't be <em>actually</em> adding or removing parameters based on the view.</p>
<p></p>
<p>It doesn't sound easy though, and it does sound confusing. Users won't be expecting this behaviour unless you tell them explicitly it can be done...</p>
<p></p>
<p>Can you provide a quick sketch of what you want to achieve exactly?</p>
<p></p>
<p>--</p>
<p>David Rutten</p>
<p>david@mcneel.com</p>
<p>Although you can override the display as much as you like, you probably shouldn't be <em>actually</em> adding or removing parameters based on the view.</p>
<p></p>
<p>It doesn't sound easy though, and it does sound confusing. Users won't be expecting this behaviour unless you tell them explicitly it can be done...</p>
<p></p>
<p>Can you provide a quick sketch of what you want to achieve exactly?</p>
<p></p>
<p>--</p>
<p>David Rutten</p>
<p>david@mcneel.com</p>