Adding a control to the root node in scenecomposer

I want to add my sky as an object in the editor, and the advice has been to make it a control. That way the editor recognizes its variables and they can be set in the properties window. Not exactly sure how to go about it in practice tho.



I have made a “SkyControl” class, that implements Control. The controller is used to create the actual geometry, materials, and set the shader parameters. Inside that object I store the sky geometry as a member variable.



In short:



User right clicks the scene node in the scene explorer and chooses controls on the menu, and there is the “SkyControl” object.



Once the skycontrol is clicked, a SkyControl object is created and attached to the scene node. The sky geometry is built, and automatically attached to the scene node as a child.



Does that make sense? Thankful for advice.

As you probably need some spatial/geometry to display the visuals how about a Geometry with the Control (which contains the code)?

1 Like

@normen

Yeah it’s a geometry that I store as a variable in the control.



There’s a crap load of parameters tho, so I put those in a struct-type class. The getters/setters are in the controller tho. If this causes problems I’ll just move them into the controller.



This I’m gonna do to practice before attempting the forester stuff.

Just try to make it work with a vanilla geometry that you add the control to. You could add these (geometry with the control) to the scene with a custom “add new…” option in the SceneExplorer (documented as well)?

1 Like