(
ctx: &mut ScriptContext<'_, API>,
name: &str,
align: UiTextAlign,
)
| 3970 | } |
| 3971 | |
| 3972 | pub fn find_vec2_value(data: &SceneNodeData, field: &str) -> Option<Vector2> { |
| 3973 | for (name, value) in data.fields.iter() { |
| 3974 | if name.as_ref() == field { |
| 3975 | return match value { |
| 3976 | SceneValue::Vec2 { x, y } => Some(Vector2::new(*x, *y)), |
| 3977 | SceneValue::Vec3 { x, y, .. } => Some(Vector2::new(*x, *y)), |
| 3978 | _ => None, |
| 3979 | }; |
| 3980 | } |
| 3981 | } |
| 3982 | data.base_ref() |
| 3983 | .and_then(|base| find_vec2_value(base, field)) |
| 3984 | } |
| 3985 |
no test coverage detected