Set parent to id(Int) of element you want to parent it to.(edit Combo, Slider and Radio and set parent to id of shape)
Set children to array of ids(Int) of the kids.(edit shape and add ids of Combo, Slider and Radio).
Haxe script:
You can create a scene script and the edit canvas in notifyOnInit func.
//! this psuedocode, haven't tried if this actually work, but it should !
import armory.trait.internal.CanvasScript;
class CanvasTrait extends iron.Trait {
var canvas:CanvasScript;
public function new() {
super();
notifyOnInit(function() {
canvas = Scene.active.getTrait(CanvasScript);
// This
canvas.getElement("Shape").children = [id_of_combo, id_of_slider, id_of_radio];
// Or this
canvas.getElement("combo").parent = id_of_shape;
canvas.getElement("slider").parent = id_of_shape;
canvas.getElement("radio").parent = id_of_shape;
});
}
}
(I don’t know if you only have to set children or parent, might have to set both, as I haven’t tried)
I needed to add this sentence, but I was able to build a parent-child relationship.
This is useful when switch canvases, because when hide the parent, all the children are also hidden.
Digging in code of Armory2D, I found out parenting is already there.
here how to do it(need 2 separate mouse button, can’t do it on magic mouse and macbook trackpad):
select the element you want it to be parent (eg: combo / slider / radio)
right click-hold on parent (eg: Shape).
left click on parent(eg: Shape).
tada! combo/slider/radio is now parent to shape!
to unparent:
select parented element.
right click-hold on parented element.
left click parent element.
tada! element unparented
will push fix for proper parenting keyboard-mouse combination, so that you don’t have to use 2 mouse button and flex on apple