(doc: &SceneDoc, node: &SceneNodeEntry, state: &EditorState)
| 1238 | ctx, |
| 1239 | &format!("{prefix}_{idx}_box"), |
| 1240 | values.get(idx).map(String::as_str).unwrap_or(""), |
| 1241 | ); |
| 1242 | } |
| 1243 | } |
| 1244 | |
| 1245 | pub fn toggle_inspector_section<API: ScriptAPI + ?Sized>( |
| 1246 | ctx: &mut ScriptContext<'_, API>, |
| 1247 | section: &str, |
| 1248 | ) { |
| 1249 | let _ = with_state_mut!(ctx.run, EditorState, ctx.id, |state| { |
| 1250 | if let Some(pos) = state |
| 1251 | .inspector_collapsed_sections |
| 1252 | .iter() |
| 1253 | .position(|item| item == section) |
| 1254 | { |
| 1255 | state.inspector_collapsed_sections.remove(pos); |
| 1256 | state.log = format!("inspector expand\n{section}"); |
| 1257 | } else { |
| 1258 | state.inspector_collapsed_sections.push(section.to_string()); |
| 1259 | state.log = format!("inspector collapse\n{section}"); |
| 1260 | } |
| 1261 | }); |
| 1262 | refresh_all(ctx); |
| 1263 | } |
| 1264 | |
| 1265 | pub fn inspector_section_collapsed(sections: &[String], section: &str) -> bool { |
| 1266 | sections.iter().any(|item| item == section) |
| 1267 | } |
| 1268 | |
| 1269 | #[derive(Clone, Copy, Debug, Default, PartialEq, Eq)] |
| 1270 | pub enum RowIndicator { |
| 1271 | #[default] |
| 1272 | None, |
| 1273 | Collapsed, |
| 1274 | Expanded, |
| 1275 | } |
| 1276 | |
| 1277 | pub fn inspector_disclosure(collapsed: bool) -> RowIndicator { |
| 1278 | if collapsed { |
| 1279 | RowIndicator::Collapsed |
| 1280 | } else { |
| 1281 | RowIndicator::Expanded |
| 1282 | } |
| 1283 | } |
| 1284 | |
| 1285 | fn take_inspector_layout_pass<API: ScriptAPI + ?Sized>(ctx: &mut ScriptContext<'_, API>) -> bool { |
| 1286 | with_state_mut!(ctx.run, EditorState, ctx.id, |state| { |
| 1287 | if state.inspector_layout_applied { |
| 1288 | false |
| 1289 | } else { |
| 1290 | state.inspector_layout_applied = true; |
| 1291 | true |
| 1292 | } |
| 1293 | }) |
| 1294 | .unwrap_or(false) |
| 1295 | } |
| 1296 | |
| 1297 | fn ensure_inspector_node_chain<API: ScriptAPI + ?Sized>( |
nothing calls this directly
no test coverage detected