(state: &EditorState)
| 2124 | true |
| 2125 | } |
| 2126 | |
| 2127 | pub fn inspector_value_fields_for_node( |
| 2128 | scene_fields: &[(SceneFieldName, SceneValue)], |
| 2129 | script_fields: &[(SceneFieldName, SceneValue)], |
| 2130 | ) -> Vec<(SceneFieldName, SceneValue)> { |
| 2131 | let mut out = Vec::new(); |
| 2132 | if !script_fields.is_empty() { |
| 2133 | out.push(( |
| 2134 | SceneFieldName::from_name("script_vars".to_string()), |
| 2135 | SceneValue::Object(Cow::Owned(script_fields.to_vec())), |
| 2136 | )); |
| 2137 | } |
| 2138 | out.extend_from_slice(scene_fields); |
| 2139 | out |
| 2140 | } |
| 2141 | |
| 2142 | fn inspector_var_button_label(row: &InspectorValueRow) -> String { |
| 2143 | let value = row.value.trim(); |
| 2144 | if row.kind.starts_with("Node") && matches!(value, "" | "null" | "none" | "-") { |
| 2145 | return node_ref_button_label(&row.kind); |
| 2146 | } |
| 2147 | if row.kind.starts_with("Asset(") && matches!(value, "" | "null" | "none" | "-") { |
| 2148 | let asset_ty = asset_ref_assign_label(&row.kind); |
| 2149 | return format!("Assign {asset_ty}"); |
| 2150 | } |
| 2151 | row.value.clone() |
| 2152 | } |
| 2153 | |
| 2154 | fn node_ref_button_label(kind: &str) -> String { |
| 2155 | format!("Assign {}", node_ref_assign_label(kind)) |
| 2156 | } |
| 2157 | |
| 2158 | fn node_ref_assign_label(kind: &str) -> String { |
| 2159 | let Some(refs) = node_ref_names_from_kind(kind) else { |
| 2160 | return "Node".to_string(); |
| 2161 | }; |
| 2162 | if refs.is_empty() { |
| 2163 | return "Node".to_string(); |
no test coverage detected