Jump to content

Disable nodes demo


photo

Recommended Posts

Searching for a demo that show me how to hide a specific node at runtime, based on a simple pre-defined key input. So far didn't find anything similar.

Not sure is so easy a demo is not needed, but I'm trying to start stayng as simple as possible, let's say I press the key "a" and the specific node ID - hardcoded - will be setEnabled(0), recursivelly on all his subnodes if this is a dummy node.

Next step will be to click on a node and the click will hide it. A pre-defined key - let's say "e" - will re-enable all the nodes in the project recursivelly.

Also a question: assembling a project with some nodes already disabled in the editor, will mean they are not present at all in the released project? This to avoid the re-enable all command will show up unwanted nodes.

Not sure if script is the easiest way, was looking also at C# components system, starting almost from low coding skills (C development years ago and some others Python code modifying lately) is the same for me if the effort it's not too different.

Edited by davide445
Link to comment
On 11/30/2019 at 4:12 AM, davide445 said:

Also a question: assembling a project with some nodes already disabled in the editor, will mean they are not present at all in the released project? This to avoid the re-enable all command will show up unwanted nodes.

When you're assembling the project you just copy files. If you saved a world file with disabled nodes they will remain disabled.

On 11/30/2019 at 4:12 AM, davide445 said:

Not sure if script is the easiest way, was looking also at C# components system, starting almost from low coding skills (C development years ago and some others Python code modifying lately) is the same for me if the effort it's not too different.

We're upgrading our C# API. Since C# is considered to be more friendly than C++ to the new users, I suggest this C# Component System as a starting point.

To solve your task you can do the following:

  1. Create C# Project (C# .NET Core)
  2. Create 2 Components: NodeSwitcher and InteractiveObjects. Use RMB click from the Asset Browser to do this.
  3. NodeSwithcer will turn on and off nodes. Key bindings can be assigned via UnigineEditor.
  4. With InteractiveObjects you can assign key for enabling/disabling nodes hierarchy, number of interactive surface and mask.

Cubes in the attached project can be enabed/disabled on A/E keys. Spheres can be disabled by left click.

Please read C# requirements here: https://developer.unigine.com/en/docs/2.9/principles/component_system/component_system_cs/?rlang=cpp#requirements

Thanks.

 

csharp_sample.zip

  • Like 2

How to submit a good bug report
---
FTP server for test scenes and user uploads:

Link to comment
×
×
  • Create New...