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

Function push_value_rows

perro_editor/res/scripts/ui/editor_inspector_values.rs:3382–3515  ·  view source on GitHub ↗
(
    rows: &mut Vec<InspectorValueRow>,
    source: &str,
    name: &str,
    value: &SceneValue,
    path: &mut Vec<ValuePathStep>,
    depth: usize,
    ctx: &ValueRowContext<'_>,
)

Source from the content-addressed store, hash-verified

3380 match value {
3381 SceneValue::UVec2 { x, y } => Some((x, y)),
3382 SceneValue::IVec2 { x, y } => Some((u32::try_from(x).ok()?, u32::try_from(y).ok()?)),
3383 SceneValue::Vec2 { x, y } if x >= 0.0 && y >= 0.0 => Some((x as u32, y as u32)),
3384 _ => None,
3385 }
3386}
3387
3388fn scene_value_as_uvec3(value: SceneValue) -> Option<(u32, u32, u32)> {
3389 match value {
3390 SceneValue::UVec3 { x, y, z } => Some((x, y, z)),
3391 SceneValue::IVec3 { x, y, z } => Some((
3392 u32::try_from(x).ok()?,
3393 u32::try_from(y).ok()?,
3394 u32::try_from(z).ok()?,
3395 )),
3396 SceneValue::Vec3 { x, y, z } if x >= 0.0 && y >= 0.0 && z >= 0.0 => {
3397 Some((x as u32, y as u32, z as u32))
3398 }
3399 _ => None,
3400 }
3401}
3402
3403fn scene_value_as_uvec4(value: SceneValue) -> Option<(u32, u32, u32, u32)> {
3404 match value {
3405 SceneValue::UVec4 { x, y, z, w } => Some((x, y, z, w)),
3406 SceneValue::IVec4 { x, y, z, w } => Some((
3407 u32::try_from(x).ok()?,
3408 u32::try_from(y).ok()?,
3409 u32::try_from(z).ok()?,
3410 u32::try_from(w).ok()?,
3411 )),
3412 SceneValue::Vec4 { x, y, z, w } if x >= 0.0 && y >= 0.0 && z >= 0.0 && w >= 0.0 => {
3413 Some((x as u32, y as u32, z as u32, w as u32))
3414 }
3415 _ => None,
3416 }
3417}
3418
3419fn generic_inner(ty: &str, outer: &str) -> Option<String> {
3420 ty.strip_prefix(outer)?
3421 .strip_prefix('<')?
3422 .strip_suffix('>')
3423 .map(str::to_string)
3424}
3425
3426fn strip_line_comment(line: &str) -> &str {
3427 line.split("//").next().unwrap_or(line)
3428}
3429
3430fn brace_delta(line: &str) -> i32 {
3431 let opens = line.chars().filter(|ch| *ch == '{').count() as i32;
3432 let closes = line.chars().filter(|ch| *ch == '}').count() as i32;
3433 opens - closes
3434}
3435
3436fn push_value_rows(
3437 rows: &mut Vec<InspectorValueRow>,
3438 source: &str,
3439 name: &str,

Calls 15

value_path_keyFunction · 0.85
color_preview_for_valueFunction · 0.85
scene_value_kindFunction · 0.85
matrix_cell_textsFunction · 0.85
scene_value_enum_textFunction · 0.85
scene_value_summaryFunction · 0.85
scene_value_edit_textFunction · 0.85
empty_array_add_rowFunction · 0.85
push_enum_payload_rowsFunction · 0.85
empty_object_rowFunction · 0.85

Tested by

no test coverage detected