(state: &EditorState, kind: &str)
| 1877 | if selected_key.is_some() { |
| 1878 | attach_material_to_selected_node(ctx, &out_path); |
| 1879 | } else { |
| 1880 | refresh_all(ctx); |
| 1881 | } |
| 1882 | } |
| 1883 | Err(err) => set_log(ctx, &format!("glb mat write fail\n{out_path}\n{err}")), |
| 1884 | } |
| 1885 | } |
| 1886 | Err(err) => set_log(ctx, &format!("glb mat fail\n{glb_path}\n{err}")), |
| 1887 | } |
| 1888 | } |
| 1889 | |
| 1890 | pub fn active_gltf_asset_path(state: &EditorState) -> Option<String> { |
| 1891 | if is_gltf_path(&state.active_asset_path) { |
| 1892 | Some(state.active_asset_path.clone()) |
| 1893 | } else if is_gltf_path(&state.active_glb_path) { |
| 1894 | Some(state.active_glb_path.clone()) |
| 1895 | } else { |
| 1896 | None |
| 1897 | } |
| 1898 | } |
| 1899 | |
| 1900 | pub fn glb_asset_stem(path: &str) -> String { |
| 1901 | sanitize_file_stem( |
| 1902 | Path::new(&editor_files::rel_label(path)) |
| 1903 | .file_stem() |
| 1904 | .and_then(|value| value.to_str()) |
| 1905 | .unwrap_or("glb"), |
| 1906 | ) |
| 1907 | } |
| 1908 | |
| 1909 | pub fn unique_res_path(project_root: &str, dir: &str, stem: &str, ext: &str) -> String { |
| 1910 | let dir = dir.trim_matches('/'); |
| 1911 | for idx in 0..1000 { |
| 1912 | let suffix = if idx == 0 { |
| 1913 | String::new() |
| 1914 | } else { |
| 1915 | format!("_{idx}") |
| 1916 | }; |
| 1917 | let path = format!("res://{dir}/{stem}{suffix}.{ext}"); |
nothing calls this directly
no test coverage detected