[ruby request\question]nesting visibility toggle
-
Is it possible to create ruby that would show (toggle in additive mode with one shortcut key) the rest of the model by 'nesting level'?
Let's say I'm editing the deepest component (the smallest matreshka doll) within the component within the component etc.
Now I'd like to (klicking the same shortcut) see the rest of dolls one by one in 'add mode'. Is it doable? -
Well there is always the option to make different scenes and updating the hidden geometry with the scene manager accordingly to what you want to accomplish.
If you still want to assign a single key to toggle the visibility of nested groups then you might want to study “knightgame.rb” by Scott Lininger. In his scrip he says the following;
“# Change the visibility of the Hero components based on the current frame.”
for subentity in entity.definition.entities
if subentity.definition.name == params['frame'] subentity.hidden = false else subentity.hidden = true end end
^^^
I have no experience in scripting since I only started to learn some ruby a few days ago so I can’t be of much help but maybe someone else could make some sense on the code above.Good luck!
-
@rv1974 said:
Now I'd like to (klicking the same shortcut) see the rest of dolls one by one in 'add mode'.
What is "add mode" ??
When you are in edit mode, is "Hide rest of model" ON ??
-
@dan rathbun said:
@rv1974 said:
Now I'd like to (klicking the same shortcut) see the rest of dolls one by one in 'add mode'.
What is "add mode" ??
When you are in edit mode, is "Hide rest of model" ON ??
- Yes, the rest of model is hidden.
- 'add' mode' (maybe not so successful term?) is unveiling the rest of the model by it's hierarchy layers.
Example: You're editing the component 'flea' that is nested in the component 'hair' nested in comp 'tail' nested in comp 'dog' nested in comp 'doghouse'. The rest of the model is constantly hidden.
Now You'd hit desired shortcut key (for example F12 )to show the 'hair' component . As result you see the editing flea and the 'hair' comp. Now you'd hit once again the same F12: the component tail is shown in addition
to the 'hair' component. Yet another F12 hit: now you see the next hierarchy layer (the dog) in addition to the hair and the tail. the 3rd F12 hit: the the hair+tale+dog+doghouse component is unveiled. the 4th F12 would start the loop from the beginning: the rest of the model is completely hidden (the only thing you see is a lonely handsome flea)
Hope the flea helps..
-
Interesting idea. I find it extremely difficult to edit a component with the rest of the model hidden because I am almost always using other parts of the model for inferencing. I can see where this could be a useful tool, though. How about F11 reversing the steps?
-
So... to put it another way... when your 'editing-context' is not the model, you want to be able to hide everything in the context's below the current edit-context.
I think we need four tools - 1. hide all, 2. hide none, 3. un-hide stepping down, 4. hide stepping up.Let's take the 'flea in tail in dog in model' schema.
You edit the flea'
- hides 'everything' except the active-flea.
- un-hides 'everything' previously hidden by 1 [i.e. the entire model becomes visible again].
- assuming 'everything' is hidden, the container of the active-flea [i.e. tail] also becomes visible, but nothing else in the hierarchy can be seen; if tool 3. is repeated then the container of the 'tail' [the 'dog'] becomes visible, right back down the hierarchy to the entire model being made visible.
- assuming 'everything' is currently visible, the 'base' container [i.e. the model] is now hidden, but everything else in the hierarchy can be seen; if tool 4. is repeated then each container is hidden up the hierarchy until only the 'flea' is visible.
This sounds quite simple...
However, in practice it requires convoluted 'housekeeping'.
Forst off hidden geometry needs to be forced 'off' during the processing.
To hide everything except the flea means you must hide the contents of the tail-instance except-for-the-flea, then you must hide the contents of the dog-instance except for the tail-instance [hiding the tail would also hide the flea !] then you must hide the contents of the model except for the dog-instance. Each 'stepping-visibilies' then needs to keep track of what was hidden/unhidden - also remembering that already hidden objects need to be conserved in the processing.
This all needs 'remembering' robustly so that on an exit of the edit the status quo is restored as it was !
I'm sure it's possible: just very complex to trap and make robust.Perhaps a v9 enhancement ?
-
.. and I see the global edit mode "Hide Rest of Model" interfering with such a feature.
The current rendering options setting for this would need saving, adjustment, and restoration, when done.
-
Giving that the solution towards hiding everything except the flea interferes with “Hide Rest of Model”, could the solution possibly be to find a way in temporarily copy & “pasting in place” the “flea” outside of the current group you’re going to hide automatically with a script?
That way the process of hiding the group without the wanted subgroup will be faked. But I bet that will take the fun out in figuring out how to not fake the process.
-
Unfortunatly, copy-pasting means freezing.
Something flawless is needed (by TIG and Dan if I got it right it should be a part of program itself) -
The "Hide Rest of Model" issue is not a show-stopper, it's just a step that needs to be dealt with.
Keep in mind when your not in edit mode, things are simple. The challenge comes when in edit mode, because we can exit an editing context with the API, but not enter (or change,) an editing context via the API.
Advertisement