MCPcopy Create free account
hub / github.com/PerroEngine/Perro / set_scene_tree_list

Function set_scene_tree_list

perro_editor/res/scripts/ui/editor_ui.rs:4546–4624  ·  view source on GitHub ↗
(
    ctx: &mut ScriptContext<'_, API>,
    view: &EditorView,
)

Source from the content-addressed store, hash-verified

4544) {
4545 if let Some(id) = find_named(ctx, name) {
4546 let _ = with_base_node_mut!(ctx.run, UiNode, id, |node| {
4547 node.layout.padding = padding;
4548 });
4549 }
4550}
4551
4552pub fn set_ui_node_h_align<API: ScriptAPI + ?Sized>(
4553 ctx: &mut ScriptContext<'_, API>,
4554 name: &str,
4555 align: UiHorizontalAlign,
4556) {
4557 if let Some(id) = find_named(ctx, name) {
4558 let _ = with_base_node_mut!(ctx.run, UiNode, id, |node| {
4559 node.layout.h_align = align;
4560 });
4561 }
4562}
4563
4564pub fn set_ui_node_z_index<API: ScriptAPI + ?Sized>(
4565 ctx: &mut ScriptContext<'_, API>,
4566 name: &str,
4567 z_index: i32,
4568) {
4569 if let Some(id) = find_named(ctx, name) {
4570 let _ = with_base_node_mut!(ctx.run, UiNode, id, |node| {
4571 node.layout.z_index = z_index;
4572 });
4573 }
4574}
4575
4576pub fn set_hlayout_spacing<API: ScriptAPI + ?Sized>(
4577 ctx: &mut ScriptContext<'_, API>,
4578 name: &str,
4579 spacing: f32,
4580) {
4581 if let Some(id) = find_named(ctx, name) {
4582 let _ = with_node_mut!(ctx.run, UiHLayout, id, |node| {
4583 node.inner.spacing = spacing;
4584 });
4585 }
4586}
4587
4588pub fn set_button_row_style<API: ScriptAPI + ?Sized>(
4589 ctx: &mut ScriptContext<'_, API>,
4590 name: &str,
4591 hover: &str,
4592 pressed: &str,
4593) {
4594 let Some(hover_color) = Color::from_hex(hover) else {
4595 return;
4596 };
4597 let Some(pressed_color) = Color::from_hex(pressed) else {
4598 return;
4599 };
4600 if let Some(id) = find_named(ctx, name) {
4601 let _ = with_node_mut!(ctx.run, UiButton, id, |node| {
4602 node.style.fill = hover_color;
4603 node.style.stroke = hover_color;

Callers 1

refresh_scene_pane_viewFunction · 0.85

Calls 10

find_namedFunction · 0.85
editor_tree_icon_textureFunction · 0.85
with_iconMethod · 0.80
with_valueMethod · 0.80
with_idMethod · 0.80
iterMethod · 0.45
getMethod · 0.45
lenMethod · 0.45
popMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected