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

Function scene_value_edit_text

perro_editor/res/scripts/ui/editor_ui.rs:2359–2408  ·  view source on GitHub ↗
(value: &SceneValue)

Source from the content-addressed store, hash-verified

2357fn apply_inspector_value_row_text_layout<API: ScriptAPI + ?Sized>(
2358 ctx: &mut ScriptContext<'_, API>,
2359 idx: usize,
2360 row: &InspectorValueRow,
2361 changed: bool,
2362) {
2363 let (name_ratio, name_text_ratio) = if row.source == "section" {
2364 if row.depth == 0 {
2365 (0.96, 0.38)
2366 } else {
2367 (0.96, 0.36)
2368 }
2369 } else if row.kind == "EmptyArrayAdd" || row.kind == "EmptyObject" {
2370 (0.62, 0.62)
2371 } else if row.kind == "BitMask" {
2372 (0.13, 0.13)
2373 } else if row.kind.starts_with("Matrix(") {
2374 (0.23, 0.23)
2375 } else if row.kind == "Quat" || !row.components.is_empty() || row.kind == "Color" {
2376 (0.27, 0.32)
2377 } else {
2378 (0.42, 0.31)
2379 };
2380 let name_label = format!("inspector_var_{idx}_name");
2381 set_label_text_ratio(ctx, &name_label, name_text_ratio);
2382 set_label_size_ratio(ctx, &name_label, (name_ratio, 1.0));
2383 if row.kind == "Quat" {
2384 set_ui_node_size(
2385 ctx,
2386 &format!("inspector_var_{idx}_components"),
2387 (0.68, 1.0),
2388 );
2389 set_ui_node_size(
2390 ctx,
2391 &format!("inspector_var_{idx}_quat_mode"),
2392 (0.30, 0.32),
2393 );
2394 }
2395 if row.source == "section" {
2396 // Categories stay centered like Godot; nested section headers hug
2397 // the left edge next to their disclosure marker.
2398 let marker = row.value.trim();
2399 let text = if marker.is_empty() {
2400 row.name.clone()
2401 } else {
2402 format!("{marker} {}", row.name)
2403 };
2404 set_label(ctx, &name_label, &text);
2405 set_label_h_align(
2406 ctx,
2407 &name_label,
2408 if row.depth == 0 {
2409 UiTextAlign::Center
2410 } else {
2411 UiTextAlign::Start

Callers 5

push_value_rowsFunction · 0.85
matrix_cell_textsFunction · 0.85
scene_value_enum_textFunction · 0.85
scene_value_summaryFunction · 0.85

Calls 5

inspector_node_ref_labelFunction · 0.85
format_compact_f32Function · 0.85
joinMethod · 0.80
as_refMethod · 0.45
iterMethod · 0.45

Tested by 5

push_value_rowsFunction · 0.68
matrix_cell_textsFunction · 0.68
scene_value_enum_textFunction · 0.68
scene_value_summaryFunction · 0.68