Build production-ready editor authoring workflows
CI / Format, lint, test, build (push) Waiting to run
CI / Format, lint, test, build (push) Waiting to run
This commit is contained in:
1 parent
cc1fa6ea3b
commit
0553a85220
163 files changed
+34547
-1565
No files matched your search
@@ -7,9 +7,9 @@ use serde::Deserialize;
|
||||
use std::collections::{HashMap, HashSet};
|
||||
|
||||
use crate::{
|
||||
asset_server_path, inspector_component_active, ColliderDesc, ColliderShapeDesc, EditorAssetRef,
|
||||
InspectorOrder, LevelObject, MaterialDesc, MaterialOverride, StaticMeshRenderer,
|
||||
StaticMeshRendererEntry, COMPONENT_COLLIDER_DESC, COMPONENT_MATERIAL_DESC,
|
||||
asset_server_path, inspector_component_active, standard_material_asset_path, ColliderDesc,
|
||||
ColliderShapeDesc, EditorAssetRef, InspectorOrder, LevelObject, MaterialDesc, MaterialOverride,
|
||||
StaticMeshRenderer, StaticMeshRendererEntry, COMPONENT_COLLIDER_DESC, COMPONENT_MATERIAL_DESC,
|
||||
COMPONENT_STATIC_MESH_RENDERER,
|
||||
};
|
||||
|
||||
@@ -318,7 +318,7 @@ fn material_for_entry(
|
||||
if let Some(material_ref) = entry.material.as_ref() {
|
||||
if let Some(resolved_material) = artifact_cache.resolve_material(material_ref) {
|
||||
let source_path = asset_server_path(&resolved_material.source_path);
|
||||
return asset_server.load(labeled_asset_path(
|
||||
return asset_server.load(standard_material_asset_path(
|
||||
&source_path,
|
||||
&resolved_material.material_label,
|
||||
));
|
||||
@@ -331,7 +331,7 @@ fn material_for_entry(
|
||||
|
||||
if let Some(label) = resolved.material_label.as_deref() {
|
||||
let source_path = asset_server_path(&resolved.source_path);
|
||||
return asset_server.load(labeled_asset_path(&source_path, label));
|
||||
return asset_server.load(standard_material_asset_path(&source_path, label));
|
||||
}
|
||||
|
||||
materials.add(StandardMaterial::default())
|
||||
@@ -361,6 +361,18 @@ pub fn static_mesh_manifest_path(asset_id: &str) -> String {
|
||||
format!("{STATIC_MESH_ARTIFACT_DIR}/{asset_id}.static_mesh.ron")
|
||||
}
|
||||
|
||||
pub(super) fn static_mesh_source_path(asset_id: &str) -> Result<String, String> {
|
||||
let path = static_mesh_manifest_path(asset_id);
|
||||
let text = std::fs::read_to_string(&path)
|
||||
.map_err(|error| format!("could not read {path}: {error}"))?;
|
||||
let manifest: StaticMeshResolveManifest =
|
||||
ron::from_str(&text).map_err(|error| format!("could not parse {path}: {error}"))?;
|
||||
if manifest.source.path.trim().is_empty() {
|
||||
return Err(format!("static mesh manifest {path} has no source path"));
|
||||
}
|
||||
Ok(manifest.source.path)
|
||||
}
|
||||
|
||||
fn part_id_from_label(label: &str) -> String {
|
||||
format!("mesh:{}", stable_sub_asset_slug(label))
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user