|
|
|
@ -123,120 +123,155 @@ fn initialize_ui(mut commands: Commands) {
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
commands
|
|
|
|
commands
|
|
|
|
.spawn((NodeBundle {
|
|
|
|
.spawn(NodeBundle {
|
|
|
|
style: Style {
|
|
|
|
style: Style {
|
|
|
|
border: UiRect::all(Val::Px(1.0)),
|
|
|
|
border: UiRect::all(Val::Px(1.0)),
|
|
|
|
margin: UiRect::all(Val::Px(5.0)),
|
|
|
|
margin: UiRect::all(Val::Px(5.0)),
|
|
|
|
padding: UiRect::all(Val::Px(5.0)),
|
|
|
|
padding: UiRect::all(Val::Px(5.0)),
|
|
|
|
flex_direction: FlexDirection::Row,
|
|
|
|
flex_direction: FlexDirection::Column,
|
|
|
|
overflow: Overflow::clip(),
|
|
|
|
overflow: Overflow::clip(),
|
|
|
|
..default()
|
|
|
|
..default()
|
|
|
|
},
|
|
|
|
},
|
|
|
|
background_color: Color::WHITE.into(),
|
|
|
|
background_color: Color::WHITE.into(),
|
|
|
|
border_color: Color::BLACK.into(),
|
|
|
|
border_color: Color::BLACK.into(),
|
|
|
|
..default()
|
|
|
|
..default()
|
|
|
|
},))
|
|
|
|
})
|
|
|
|
.with_children(|parent| {
|
|
|
|
.with_children(|parent| {
|
|
|
|
// HACK: This is super janky but I think we need it like this for UI layout rules
|
|
|
|
let container = parent
|
|
|
|
let mut content_containers: Vec<(String, Entity)> = Vec::new();
|
|
|
|
.spawn((NodeBundle {
|
|
|
|
|
|
|
|
style: Style {
|
|
|
|
// Containers with asset content
|
|
|
|
border: UiRect::all(Val::Px(1.0)),
|
|
|
|
parent
|
|
|
|
margin: UiRect::all(Val::Px(5.0)),
|
|
|
|
.spawn((
|
|
|
|
padding: UiRect::all(Val::Px(5.0)),
|
|
|
|
NodeBundle {
|
|
|
|
flex_direction: FlexDirection::Row,
|
|
|
|
style: Style {
|
|
|
|
overflow: Overflow::clip(),
|
|
|
|
border: UiRect::all(Val::Px(1.0)),
|
|
|
|
|
|
|
|
margin: UiRect::all(Val::Px(5.0)),
|
|
|
|
|
|
|
|
padding: UiRect::all(Val::Px(5.0)),
|
|
|
|
|
|
|
|
flex_direction: FlexDirection::Column,
|
|
|
|
|
|
|
|
overflow: Overflow::clip(),
|
|
|
|
|
|
|
|
justify_content: JustifyContent::FlexStart,
|
|
|
|
|
|
|
|
..default()
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
background_color: Color::WHITE.into(),
|
|
|
|
|
|
|
|
border_color: Color::BLACK.into(),
|
|
|
|
|
|
|
|
..default()
|
|
|
|
..default()
|
|
|
|
},
|
|
|
|
},
|
|
|
|
ui::Sorting(2),
|
|
|
|
background_color: Color::WHITE.into(),
|
|
|
|
))
|
|
|
|
border_color: Color::BLACK.into(),
|
|
|
|
|
|
|
|
..default()
|
|
|
|
|
|
|
|
},))
|
|
|
|
.with_children(|parent| {
|
|
|
|
.with_children(|parent| {
|
|
|
|
content_containers.push(spawn_tab_container::<FontWidget>(
|
|
|
|
// HACK: This is super janky but I think we need it like this for UI layout rules
|
|
|
|
"Font",
|
|
|
|
let mut content_containers: Vec<(String, Entity)> = Vec::new();
|
|
|
|
parent,
|
|
|
|
|
|
|
|
&base_style,
|
|
|
|
// Containers with asset content
|
|
|
|
ui::Select::Single,
|
|
|
|
parent
|
|
|
|
));
|
|
|
|
.spawn((
|
|
|
|
content_containers.push(spawn_tab_container::<AudioWidget>(
|
|
|
|
NodeBundle {
|
|
|
|
"Audio",
|
|
|
|
style: Style {
|
|
|
|
parent,
|
|
|
|
border: UiRect::all(Val::Px(1.0)),
|
|
|
|
&base_style,
|
|
|
|
margin: UiRect::all(Val::Px(5.0)),
|
|
|
|
ui::Select::Multi,
|
|
|
|
padding: UiRect::all(Val::Px(5.0)),
|
|
|
|
));
|
|
|
|
flex_direction: FlexDirection::Column,
|
|
|
|
content_containers.push(spawn_tab_container::<GltfWidget>(
|
|
|
|
overflow: Overflow::clip(),
|
|
|
|
"Gltf",
|
|
|
|
justify_content: JustifyContent::FlexStart,
|
|
|
|
parent,
|
|
|
|
..default()
|
|
|
|
&base_style,
|
|
|
|
},
|
|
|
|
ui::Select::Single,
|
|
|
|
background_color: Color::WHITE.into(),
|
|
|
|
));
|
|
|
|
border_color: Color::BLACK.into(),
|
|
|
|
content_containers.push(spawn_tab_container::<SceneWidget>(
|
|
|
|
..default()
|
|
|
|
"Scene",
|
|
|
|
},
|
|
|
|
parent,
|
|
|
|
ui::Sorting(2),
|
|
|
|
&base_style,
|
|
|
|
))
|
|
|
|
ui::Select::Single,
|
|
|
|
.with_children(|parent| {
|
|
|
|
));
|
|
|
|
content_containers.push(spawn_tab_container::<FontWidget>(
|
|
|
|
content_containers.push(spawn_tab_container::<AnimationWidget>(
|
|
|
|
"Font",
|
|
|
|
"Animation",
|
|
|
|
parent,
|
|
|
|
parent,
|
|
|
|
&base_style,
|
|
|
|
&base_style,
|
|
|
|
ui::Select::Single,
|
|
|
|
ui::Select::Multi,
|
|
|
|
));
|
|
|
|
));
|
|
|
|
content_containers.push(spawn_tab_container::<AudioWidget>(
|
|
|
|
content_containers.push(spawn_tab_container::<CameraWidget>(
|
|
|
|
"Audio",
|
|
|
|
"Camera",
|
|
|
|
parent,
|
|
|
|
parent,
|
|
|
|
&base_style,
|
|
|
|
&base_style,
|
|
|
|
ui::Select::Multi,
|
|
|
|
ui::Select::Single,
|
|
|
|
));
|
|
|
|
));
|
|
|
|
content_containers.push(spawn_tab_container::<GltfWidget>(
|
|
|
|
});
|
|
|
|
"Gltf",
|
|
|
|
|
|
|
|
parent,
|
|
|
|
|
|
|
|
&base_style,
|
|
|
|
|
|
|
|
ui::Select::Single,
|
|
|
|
|
|
|
|
));
|
|
|
|
|
|
|
|
content_containers.push(spawn_tab_container::<SceneWidget>(
|
|
|
|
|
|
|
|
"Scene",
|
|
|
|
|
|
|
|
parent,
|
|
|
|
|
|
|
|
&base_style,
|
|
|
|
|
|
|
|
ui::Select::Single,
|
|
|
|
|
|
|
|
));
|
|
|
|
|
|
|
|
content_containers.push(spawn_tab_container::<AnimationWidget>(
|
|
|
|
|
|
|
|
"Animation",
|
|
|
|
|
|
|
|
parent,
|
|
|
|
|
|
|
|
&base_style,
|
|
|
|
|
|
|
|
ui::Select::Multi,
|
|
|
|
|
|
|
|
));
|
|
|
|
|
|
|
|
content_containers.push(spawn_tab_container::<CameraWidget>(
|
|
|
|
|
|
|
|
"Camera",
|
|
|
|
|
|
|
|
parent,
|
|
|
|
|
|
|
|
&base_style,
|
|
|
|
|
|
|
|
ui::Select::Single,
|
|
|
|
|
|
|
|
));
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
// Container for tabs that open/close containers
|
|
|
|
// Container for tabs that open/close containers
|
|
|
|
parent
|
|
|
|
parent
|
|
|
|
.spawn((
|
|
|
|
.spawn((
|
|
|
|
NodeBundle {
|
|
|
|
NodeBundle {
|
|
|
|
style: Style {
|
|
|
|
style: Style {
|
|
|
|
border: UiRect::all(Val::Px(1.0)),
|
|
|
|
border: UiRect::all(Val::Px(1.0)),
|
|
|
|
margin: UiRect::all(Val::Px(5.0)),
|
|
|
|
margin: UiRect::all(Val::Px(5.0)),
|
|
|
|
padding: UiRect::all(Val::Px(5.0)),
|
|
|
|
padding: UiRect::all(Val::Px(5.0)),
|
|
|
|
flex_direction: FlexDirection::Column,
|
|
|
|
flex_direction: FlexDirection::Column,
|
|
|
|
overflow: Overflow::clip(),
|
|
|
|
overflow: Overflow::clip(),
|
|
|
|
..default()
|
|
|
|
..default()
|
|
|
|
},
|
|
|
|
},
|
|
|
|
background_color: Color::WHITE.into(),
|
|
|
|
background_color: Color::WHITE.into(),
|
|
|
|
border_color: Color::BLACK.into(),
|
|
|
|
border_color: Color::BLACK.into(),
|
|
|
|
..default()
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
ui::Sorting(1),
|
|
|
|
|
|
|
|
ui::Select::Single,
|
|
|
|
|
|
|
|
))
|
|
|
|
|
|
|
|
.with_children(|parent| {
|
|
|
|
|
|
|
|
let b = ButtonBundle {
|
|
|
|
|
|
|
|
style: Style {
|
|
|
|
|
|
|
|
..base_style.clone()
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
background_color: Color::WHITE.into(),
|
|
|
|
|
|
|
|
border_color: Color::BLACK.into(),
|
|
|
|
|
|
|
|
..default()
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
content_containers.iter().for_each(|(name, target)| {
|
|
|
|
|
|
|
|
parent.spawn((
|
|
|
|
|
|
|
|
b.clone(),
|
|
|
|
|
|
|
|
ui::Title {
|
|
|
|
|
|
|
|
name: name.clone(),
|
|
|
|
|
|
|
|
..default()
|
|
|
|
..default()
|
|
|
|
},
|
|
|
|
},
|
|
|
|
ui::Collapse { target: *target },
|
|
|
|
ui::Sorting(1),
|
|
|
|
));
|
|
|
|
ui::Select::Single,
|
|
|
|
});
|
|
|
|
))
|
|
|
|
});
|
|
|
|
.with_children(|parent| {
|
|
|
|
|
|
|
|
let b = ButtonBundle {
|
|
|
|
|
|
|
|
style: Style {
|
|
|
|
|
|
|
|
..base_style.clone()
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
background_color: Color::WHITE.into(),
|
|
|
|
|
|
|
|
border_color: Color::BLACK.into(),
|
|
|
|
|
|
|
|
..default()
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
content_containers.iter().for_each(|(name, target)| {
|
|
|
|
|
|
|
|
parent.spawn((
|
|
|
|
|
|
|
|
b.clone(),
|
|
|
|
|
|
|
|
ui::Title { text: name.clone() },
|
|
|
|
|
|
|
|
ui::Collapse { target: *target },
|
|
|
|
|
|
|
|
ui::Active,
|
|
|
|
|
|
|
|
));
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
.id();
|
|
|
|
|
|
|
|
parent.spawn((
|
|
|
|
|
|
|
|
NodeBundle {
|
|
|
|
|
|
|
|
style: Style {
|
|
|
|
|
|
|
|
border: UiRect::all(Val::Px(1.0)),
|
|
|
|
|
|
|
|
margin: UiRect::all(Val::Px(5.0)),
|
|
|
|
|
|
|
|
padding: UiRect::all(Val::Px(5.0)),
|
|
|
|
|
|
|
|
flex_direction: FlexDirection::Row,
|
|
|
|
|
|
|
|
overflow: Overflow::clip(),
|
|
|
|
|
|
|
|
..default()
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
background_color: Color::ALICE_BLUE.into(),
|
|
|
|
|
|
|
|
border_color: Color::BLACK.into(),
|
|
|
|
|
|
|
|
..default()
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
ui::Title {
|
|
|
|
|
|
|
|
text: "Assets".into(),
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
ui::Minimize { target: container },
|
|
|
|
|
|
|
|
ui::Sorting(0),
|
|
|
|
|
|
|
|
));
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ -261,10 +296,7 @@ fn spawn_tab_container<T: Default + Component>(
|
|
|
|
z_index: ZIndex::Local(100),
|
|
|
|
z_index: ZIndex::Local(100),
|
|
|
|
..default()
|
|
|
|
..default()
|
|
|
|
},
|
|
|
|
},
|
|
|
|
ui::Title {
|
|
|
|
ui::Title { text: title.into() },
|
|
|
|
name: title.into(),
|
|
|
|
|
|
|
|
..default()
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
T::default(),
|
|
|
|
T::default(),
|
|
|
|
ui::Scroll,
|
|
|
|
ui::Scroll,
|
|
|
|
Interaction::default(),
|
|
|
|
Interaction::default(),
|
|
|
|
@ -436,7 +468,7 @@ mod assets {
|
|
|
|
border_color: Color::BLACK.into(),
|
|
|
|
border_color: Color::BLACK.into(),
|
|
|
|
..default()
|
|
|
|
..default()
|
|
|
|
},
|
|
|
|
},
|
|
|
|
ui::Title { name, ..default() },
|
|
|
|
ui::Title { text: name },
|
|
|
|
))
|
|
|
|
))
|
|
|
|
.set_parent(root.single())
|
|
|
|
.set_parent(root.single())
|
|
|
|
.id()
|
|
|
|
.id()
|
|
|
|
@ -461,7 +493,7 @@ mod assets {
|
|
|
|
border_color: Color::BLACK.into(),
|
|
|
|
border_color: Color::BLACK.into(),
|
|
|
|
..default()
|
|
|
|
..default()
|
|
|
|
},
|
|
|
|
},
|
|
|
|
ui::Title { name, ..default() },
|
|
|
|
ui::Title { text: name },
|
|
|
|
))
|
|
|
|
))
|
|
|
|
.set_parent(root.single())
|
|
|
|
.set_parent(root.single())
|
|
|
|
.id()
|
|
|
|
.id()
|
|
|
|
|