Post-modify a scene: enable/disable entities/components

hello!

As I can now create instances of stride scenes on the fly, I’d like to be able to

  • display a tree structure of the loaded scene - it might have a single entity, a group of entities, groups of groups of entities, etc.
  • enable/disable specific entities (groups, models, cameras, lights) within this scene/tree structure
  • addon: enable/disable and possibly edit components of these entities, eg disable a transform, switch a texture on a material, set transparency, etc.

UI Example from Blender:
image


@tonfilm already helped me quite a bit on some of this in the chat, but I’m still struggling:


Given this scene I have used the RecursiveTree node to get the IDs of all entities in my scene. I then use these IDs to check if they are part of the non-rendered entity group and move them to the rendered entity group if they’re enabled (and vice versa), by setting a new parent for the respective entity.

For the lowest level in my scene, this kind of works, I can enable only the box (nb: no need for the group)

The sphere and the light however, can only be enabled together, by activating their group:


I’m assuming this has to do with the level of hierarchy, as I’m not changing this for the box or the second group by changing their parent to the rendered group, but setting the parent of the sphere or the light to the rendered group would actually promote them up 1 level…?

The other problem here is that, as you can see in the entity list in the images, the RecursiveTree node doesn’t tell me the depth level an item is coming from, what I get is what seems to be an unordered spread. I think I can edit the node accordingly, but I thought maybe I should ask before it get’s too involved :)

I also don’t need to follow this route at all if there’s other ways to do this…this whole parent setting thing feels dirty, hehe…obviously I could add a pad to every enable pin in all scenes and create a UI for that, like in the linked thread above, but this feels very beta at this point :) also there’s other people potentially creating scenes for this setup and I really do not want to go through their patches adding it… been there too often :D

patch is here
EnableEntities.vl (58.1 KB)

thank you

Are you aware of the EnableAll node? (And note to us, the plain Enable node seems to be broken)

Regarding the broken Enable node, that will be fixed in upcoming builds (Fixes `Enable [Entity]` node by adding a pin to be able to infer the … · vvvv/VL.StandardLibs@5e36429 · GitHub)

I didn’t know the node, but since it will only let me enable all children at once it won’t be sufficient. The same node which allows me to feed a bool spread into it, one for each child, would do the trick. I still wouldn’t have a tree representation (for the UI) of my scene, but I can see how I could come up with that recursively using the GetChildren node…

Interestingly, with EnableAll I can disable a group but leave it’s children enabled. Are you suggesting to use this in conjunction with the patch I have, ie first disable the child group, then parent it’s children to the (other) root group? This could reduce adding an enabled pin for every entity to adding an enableAll to every (sub)group. Still not ideal, but definitely better :)

That enable nodes are utility/helper nodes. You could definitely come up with your own logic I guess. At its core it’s about the ActivableEntityComponent which most of the components derive from. All those can be enabled or disabled at runtime without the engine having to rebuild the graph which your other approach would lead to.

That sounds more like what I’m looking for. Already tried some things with ActivableComponent, but I’ll have a closer look, thank you.

cool, this works nicely. I now build up my own recursive tree of scene entities, then create a UI for them where I can enable/disable their activableComponents individually and also “pause” their transforms. Starting to feel like gamma slowly makes a real programmer out of me, lol…

thanks for the help!

sharing for others, feedback welcome
EnableEntities.vl (101.3 KB)

5 Likes

there is also this, which does exactly what you are trying to do:

There was also an experimental node in VL.Stride that created the editor. But I coundn’t find it anymore. @Elias @gregsn was it removed at some time?

1 Like

I had a quick look and updated it to work with the latest vvvv previews and .net8. You can fork the repo linked above and tweak the UI with Visual Studio to your liking. It works quite well with WPF hot-reload. After compiling, replace the StrideLiveEditor.dll and pdb.

VL.Stride.LiveEditor.zip (1.9 MB)

The advantage of this is that WPF is a retained mode UI, it doesn’t cost any GPU time and it doesn’t interfere with the main loop. The disadvantage is that you can’t render GPU things like textures in it and it looks like a Windows store app.

9 Likes

Indeed, exactly what I’m trying to do! I haven’t worked with WPF before and unfortunately I don’t think it’s an option for the project I’m working on, but looking at the code it’s no so different from what I have with Imgui except being much more reactive (and better structured). I’ll try if I can adapt this to my needs…thank you!