feat: complete M2 content workspace and inspector
This commit is contained in:
1 parent
931f561e7f
commit
cf6eaba534
438 files changed
+59749
-19043
No files matched your search
@@ -15,3 +15,4 @@ polyanya.workspace = true
|
||||
rerecast.workspace = true
|
||||
shared.workspace = true
|
||||
settings.workspace = true
|
||||
uuid = { version = "1", features = ["serde"] }
|
||||
@@ -743,7 +743,7 @@ mod tests {
|
||||
let body = "(resources: {}, entities: {})";
|
||||
let document = SceneDocument::from_ron_text(body).unwrap();
|
||||
let text = document.to_ron_text().unwrap();
|
||||
assert!(text.starts_with("(schema_version: 4,"));
|
||||
assert!(text.starts_with("(schema_version: 6,"));
|
||||
assert!(SceneDocument::from_ron_text(&text)
|
||||
.unwrap()
|
||||
.entities
|
||||
|
||||
+12
-8
@@ -18,7 +18,8 @@ use serde::{Deserialize, Serialize};
|
||||
|
||||
pub use composition::{validate_composition_graph, validate_scene_composition};
|
||||
pub use migrate::{
|
||||
migrate_v1_to_v2, migrate_v2_to_v3, migrate_v3_to_v4, DEFAULT_SUN_ILLUMINANCE_LUX,
|
||||
migrate_v1_to_v2, migrate_v2_to_v3, migrate_v3_to_v4, migrate_v4_to_v5,
|
||||
DEFAULT_SUN_ILLUMINANCE_LUX,
|
||||
};
|
||||
pub use prefab::{
|
||||
prefab_graph_revision, validate_prefab_graph, validate_prefab_graph_text,
|
||||
@@ -30,7 +31,7 @@ pub use project_validation::{
|
||||
};
|
||||
pub use upgrade::{upgrade_project, ProjectUpgradeChange, ProjectUpgradeReport};
|
||||
|
||||
pub const CURRENT_SCENE_SCHEMA_VERSION: u32 = 4;
|
||||
pub const CURRENT_SCENE_SCHEMA_VERSION: u32 = 6;
|
||||
|
||||
/// Whether an asset-relative path names a tree excluded from runtime packages.
|
||||
pub fn is_runtime_package_excluded_tree(relative: &Path) -> bool {
|
||||
@@ -135,10 +136,13 @@ pub fn migrate_scene_text(text: &str) -> Result<String, String> {
|
||||
};
|
||||
|
||||
let migrated_body = match version {
|
||||
0 | 1 => migrate_v3_to_v4(&migrate_v2_to_v3(&migrate_v1_to_v2(&body))),
|
||||
2 => migrate_v3_to_v4(&migrate_v2_to_v3(&body)),
|
||||
3 => migrate_v3_to_v4(&body),
|
||||
4 => body,
|
||||
0 | 1 => migrate_v4_to_v5(&migrate_v3_to_v4(&migrate_v2_to_v3(&migrate_v1_to_v2(
|
||||
&body,
|
||||
)))),
|
||||
2 => migrate_v4_to_v5(&migrate_v3_to_v4(&migrate_v2_to_v3(&body))),
|
||||
3 => migrate_v4_to_v5(&migrate_v3_to_v4(&body)),
|
||||
4 => migrate_v4_to_v5(&body),
|
||||
5 | 6 => body,
|
||||
_ => {
|
||||
return Err(format!(
|
||||
"scene schema version {version} is newer than supported version {CURRENT_SCENE_SCHEMA_VERSION}"
|
||||
@@ -228,7 +232,7 @@ mod tests {
|
||||
fn stamp_and_strip_round_trip() {
|
||||
let body = "(resources: {}, entities: {})";
|
||||
let stamped = stamp_schema_version(body).unwrap();
|
||||
assert!(stamped.starts_with("(schema_version: 4,"));
|
||||
assert!(stamped.starts_with(&format!("(schema_version: {CURRENT_SCENE_SCHEMA_VERSION},")));
|
||||
let stripped = strip_schema_version(&stamped).unwrap();
|
||||
assert_eq!(stripped, body);
|
||||
}
|
||||
@@ -237,7 +241,7 @@ mod tests {
|
||||
fn legacy_scene_migrates_to_current_schema() {
|
||||
let legacy = "(resources: {}, entities: {4294967133: ()})";
|
||||
let migrated = migrate_scene_text(legacy).unwrap();
|
||||
assert!(migrated.contains("schema_version: 4"));
|
||||
assert!(migrated.contains(&format!("schema_version: {CURRENT_SCENE_SCHEMA_VERSION}")));
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -63,6 +63,15 @@ pub fn migrate_v3_to_v4(body: &str) -> String {
|
||||
body.to_string()
|
||||
}
|
||||
|
||||
/// Schema v5 moves primitive and mesh material ownership into stable material slots.
|
||||
///
|
||||
/// Normal loading remains read-only, so the text migration only advances the in-memory schema.
|
||||
/// `cargo upgrade-project --apply` materializes referenced Material assets and removes legacy
|
||||
/// actor-level descriptors transactionally.
|
||||
pub fn migrate_v4_to_v5(body: &str) -> String {
|
||||
body.to_string()
|
||||
}
|
||||
|
||||
fn backfill_actor_kinds(text: &str) -> String {
|
||||
let mut result = String::with_capacity(text.len() + 1024);
|
||||
let mut rest = text;
|
||||
|
||||
@@ -12,8 +12,8 @@ use shared::{
|
||||
AnimationControllerDesc, AnimationDiagnosticSeverity, AnimationManifest,
|
||||
AssetSourceFingerprint, AudioListenerDesc, AudioSourceDesc, BrushDesc, ColliderDesc,
|
||||
ColliderShapeDesc, EditorAssetRef, MaterialAsset, MaterialDesc, MaterialInstanceAsset,
|
||||
MaterialOverride, ModelRef, PostProcessEffectAsset, PostProcessVolumeDesc, PrefabInstance,
|
||||
PrefabRef, RendererMaterialSet, ShaderSchemaAsset, SkinnedMeshRenderer, StaticMeshRenderer,
|
||||
MaterialOverride, MaterialSlotSet, ModelRef, PostProcessEffectAsset, PostProcessVolumeDesc,
|
||||
PrefabInstance, PrefabRef, ShaderSchemaAsset, SkinnedMeshRenderer, StaticMeshRenderer,
|
||||
TerrainDesc, ANIMATION_MANIFEST_SCHEMA_VERSION, AUDIO_CLIP_SUB_ASSET_ID,
|
||||
COMPONENT_ANIMATION_CONTROLLER_DESC, COMPONENT_SKINNED_MESH_RENDERER,
|
||||
NAVIGATION_GENERATED_ARTIFACT_DIRECTORY,
|
||||
@@ -192,7 +192,9 @@ fn validate_project_manifest(
|
||||
repair: "Repair the project audio buses so required IDs exist and all parent routes terminate at Master.".into(),
|
||||
});
|
||||
}
|
||||
if manifest.version != 1 || manifest.template_version > 1 {
|
||||
if manifest.version != settings::SETTINGS_VERSION
|
||||
|| manifest.template_version > settings::PROJECT_TEMPLATE_VERSION
|
||||
{
|
||||
report.findings.push(ProjectValidationFinding {
|
||||
severity: ValidationSeverity::Error,
|
||||
code: "project.incompatible_schema".into(),
|
||||
@@ -206,6 +208,17 @@ fn validate_project_manifest(
|
||||
repair: "Open the project in a compatible editor or run its project migration.".into(),
|
||||
});
|
||||
}
|
||||
if manifest.asset_roots != ["assets"] {
|
||||
report.findings.push(ProjectValidationFinding {
|
||||
severity: ValidationSeverity::Error,
|
||||
code: "project.noncanonical_asset_roots".into(),
|
||||
source_path: source.into(),
|
||||
owner_actor_id: None,
|
||||
reference: None,
|
||||
message: "project asset_roots must be exactly [\"assets\"]".into(),
|
||||
repair: "Run `cargo upgrade-project --project . --apply` to adopt the managed content workspace.".into(),
|
||||
});
|
||||
}
|
||||
add_reference(
|
||||
project_root,
|
||||
report,
|
||||
@@ -330,6 +343,27 @@ struct RegistryAssetRecord {
|
||||
dependencies: Vec<String>,
|
||||
}
|
||||
|
||||
impl From<shared::AssetRecord> for RegistryAssetRecord {
|
||||
fn from(record: shared::AssetRecord) -> Self {
|
||||
let model = record.import_settings.model();
|
||||
Self {
|
||||
id: RegistryAssetId(record.id.as_string()),
|
||||
path: record.path,
|
||||
kind_tag: format!("{:?}", record.kind),
|
||||
source_fingerprint: record.source_fingerprint,
|
||||
import_settings: RegistryImportSettings {
|
||||
static_mesh_manifest_path: model
|
||||
.and_then(|settings| settings.static_mesh_manifest_path.clone()),
|
||||
animation_manifest_path: model
|
||||
.and_then(|settings| settings.animation_manifest_path.clone()),
|
||||
default_animation_clip_id: model
|
||||
.and_then(|settings| settings.default_animation_clip_id.clone()),
|
||||
},
|
||||
dependencies: record.dependencies,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
struct AnimationRegistryRecord {
|
||||
source_path: String,
|
||||
@@ -367,13 +401,44 @@ fn validate_asset_registry(
|
||||
});
|
||||
return animation_catalog;
|
||||
}
|
||||
let Some(records) = parse_document::<Vec<RegistryAssetRecord>>(
|
||||
&path,
|
||||
"assets/.index/registry.ron",
|
||||
"registry",
|
||||
report,
|
||||
) else {
|
||||
return animation_catalog;
|
||||
let records = match std::fs::read_to_string(&path) {
|
||||
Ok(source) => match shared::parse_asset_registry(&source) {
|
||||
Ok(loaded) => loaded
|
||||
.document
|
||||
.records
|
||||
.into_iter()
|
||||
.map(RegistryAssetRecord::from)
|
||||
.collect::<Vec<_>>(),
|
||||
// Validator fixtures and legacy projects may use symbolic IDs. Preserve the previous
|
||||
// read-only validation view while production registry v2 remains UUID-typed.
|
||||
Err(shared_error) => match ron::from_str::<Vec<RegistryAssetRecord>>(&source) {
|
||||
Ok(records) => records,
|
||||
Err(_) => {
|
||||
report.findings.push(ProjectValidationFinding {
|
||||
severity: ValidationSeverity::Error,
|
||||
code: "registry.invalid".into(),
|
||||
source_path: "assets/.index/registry.ron".into(),
|
||||
owner_actor_id: None,
|
||||
reference: None,
|
||||
message: format!("could not parse registry: {shared_error}"),
|
||||
repair: "Repair or regenerate the registry document.".into(),
|
||||
});
|
||||
return animation_catalog;
|
||||
}
|
||||
},
|
||||
},
|
||||
Err(error) => {
|
||||
report.findings.push(ProjectValidationFinding {
|
||||
severity: ValidationSeverity::Error,
|
||||
code: "registry.invalid".into(),
|
||||
source_path: "assets/.index/registry.ron".into(),
|
||||
owner_actor_id: None,
|
||||
reference: None,
|
||||
message: format!("could not read registry: {error}"),
|
||||
repair: "Repair or regenerate the registry document.".into(),
|
||||
});
|
||||
return animation_catalog;
|
||||
}
|
||||
};
|
||||
let mut ids = BTreeSet::new();
|
||||
let mut paths = BTreeSet::new();
|
||||
@@ -619,15 +684,8 @@ fn validate_material_assets(project_root: &Path, report: &mut ProjectValidationR
|
||||
.into(),
|
||||
});
|
||||
}
|
||||
if let Some(shader) = asset.shader {
|
||||
add_reference(
|
||||
project_root,
|
||||
report,
|
||||
&source,
|
||||
None,
|
||||
"shader_schema",
|
||||
&shader,
|
||||
);
|
||||
if let Some(shader) = asset.shader.schema_path.as_deref() {
|
||||
add_reference(project_root, report, &source, None, "shader_schema", shader);
|
||||
}
|
||||
if let Some(shader) = asset.shader_ref {
|
||||
collect_asset_ref(
|
||||
@@ -639,7 +697,12 @@ fn validate_material_assets(project_root: &Path, report: &mut ProjectValidationR
|
||||
&shader,
|
||||
);
|
||||
}
|
||||
collect_material(project_root, report, &source, None, &asset.material);
|
||||
let mut material = shared::MaterialDesc {
|
||||
shader: asset.shader.clone(),
|
||||
..Default::default()
|
||||
};
|
||||
asset.inputs.apply_to_material_desc(&mut material);
|
||||
collect_material(project_root, report, &source, None, &material);
|
||||
continue;
|
||||
}
|
||||
if let Ok(instance) = ron::from_str::<MaterialInstanceAsset>(&text) {
|
||||
@@ -684,7 +747,7 @@ fn validate_material_assets(project_root: &Path, report: &mut ProjectValidationR
|
||||
"material",
|
||||
&instance.base.0,
|
||||
);
|
||||
for texture in instance.textures {
|
||||
for texture in instance.overrides.textures {
|
||||
if let Some(reference) = texture.texture {
|
||||
collect_asset_ref(project_root, report, &source, None, "texture", &reference);
|
||||
}
|
||||
@@ -764,9 +827,17 @@ fn validate_shader_assets(project_root: &Path, report: &mut ProjectValidationRep
|
||||
}
|
||||
}
|
||||
}
|
||||
for texture in asset.default_textures {
|
||||
if let Some(reference) = texture.texture {
|
||||
collect_asset_ref(project_root, report, &source, None, "texture", &reference);
|
||||
for input in asset.schema.inputs {
|
||||
if input.texture.is_some() && input.name.trim().is_empty() {
|
||||
report.findings.push(ProjectValidationFinding {
|
||||
severity: ValidationSeverity::Error,
|
||||
code: "surface_shader.invalid_input".into(),
|
||||
source_path: source.clone(),
|
||||
owner_actor_id: None,
|
||||
reference: None,
|
||||
message: "shader texture input names cannot be empty".into(),
|
||||
repair: "Assign a stable input name in the shader schema.".into(),
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -798,6 +869,8 @@ struct StaticMeshManifestView {
|
||||
import: StaticMeshImportView,
|
||||
#[serde(default)]
|
||||
warnings: Vec<String>,
|
||||
#[serde(default)]
|
||||
parts: Vec<StaticMeshPartView>,
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
@@ -815,6 +888,18 @@ struct StaticMeshSourceView {
|
||||
struct StaticMeshImportView {
|
||||
#[serde(default)]
|
||||
material_policy: StaticMeshMaterialPolicyView,
|
||||
#[serde(default)]
|
||||
material_slots: Vec<shared::ModelMaterialSlotSelection>,
|
||||
}
|
||||
|
||||
#[derive(Default, Deserialize)]
|
||||
struct StaticMeshPartView {
|
||||
#[serde(default)]
|
||||
id: String,
|
||||
#[serde(default)]
|
||||
material_id: Option<String>,
|
||||
#[serde(default)]
|
||||
material_label: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Default, Deserialize, PartialEq, Eq)]
|
||||
@@ -877,7 +962,7 @@ fn validate_static_mesh_manifests(project_root: &Path, report: &mut ProjectValid
|
||||
"static mesh source",
|
||||
);
|
||||
let optional_source_textures = manifest.source.format.eq_ignore_ascii_case("fbx")
|
||||
&& manifest.import.material_policy == StaticMeshMaterialPolicyView::AuthoringOverride;
|
||||
&& !static_manifest_uses_source_materials(&manifest);
|
||||
add_import_dependencies(
|
||||
project_root,
|
||||
report,
|
||||
@@ -901,6 +986,35 @@ fn validate_static_mesh_manifests(project_root: &Path, report: &mut ProjectValid
|
||||
}
|
||||
}
|
||||
|
||||
fn static_manifest_uses_source_materials(manifest: &StaticMeshManifestView) -> bool {
|
||||
if manifest.import.material_policy == StaticMeshMaterialPolicyView::AuthoringOverride {
|
||||
return false;
|
||||
}
|
||||
if manifest.parts.is_empty() {
|
||||
return manifest.import.material_slots.is_empty()
|
||||
|| manifest
|
||||
.import
|
||||
.material_slots
|
||||
.iter()
|
||||
.any(|slot| matches!(slot.selection, shared::ModelMaterialSelection::Source));
|
||||
}
|
||||
manifest.parts.iter().any(|part| {
|
||||
if part.material_id.is_none() && part.material_label.is_none() {
|
||||
return false;
|
||||
}
|
||||
if part.id.trim().is_empty() {
|
||||
return true;
|
||||
}
|
||||
let slot_id = format!("slot:{}", part.id);
|
||||
manifest
|
||||
.import
|
||||
.material_slots
|
||||
.iter()
|
||||
.find(|slot| slot.slot_id.0 == slot_id)
|
||||
.is_none_or(|slot| matches!(slot.selection, shared::ModelMaterialSelection::Source))
|
||||
})
|
||||
}
|
||||
|
||||
fn add_import_dependencies(
|
||||
project_root: &Path,
|
||||
report: &mut ProjectValidationReport,
|
||||
@@ -955,7 +1069,7 @@ fn add_import_dependencies(
|
||||
reference: Some(missing.join(", ")),
|
||||
message: if optional_source_textures {
|
||||
format!(
|
||||
"{} FBX source texture(s) are unavailable and intentionally ignored by Authoring Override",
|
||||
"{} FBX source texture(s) are unavailable and intentionally unused by the model's per-slot material selections",
|
||||
missing.len()
|
||||
)
|
||||
} else {
|
||||
@@ -965,10 +1079,10 @@ fn add_import_dependencies(
|
||||
)
|
||||
},
|
||||
repair: if optional_source_textures {
|
||||
"No action is required while Authoring Override remains active; restore the texture bundle before selecting Source Materials."
|
||||
"No action is required while every imported slot uses Project or Default; restore the texture bundle before selecting Source on a slot."
|
||||
.into()
|
||||
} else {
|
||||
"Restore the referenced texture bundle and reimport, or select Authoring Override for a deliberately untextured asset."
|
||||
"Restore the referenced texture bundle and reimport, or select Project/Default for every deliberately untextured slot."
|
||||
.into()
|
||||
},
|
||||
});
|
||||
@@ -1597,6 +1711,29 @@ fn validate_document(
|
||||
}
|
||||
let mut enabled_listeners = Vec::new();
|
||||
for entity in &document.entities {
|
||||
let has_legacy_material = entity
|
||||
.components
|
||||
.iter()
|
||||
.any(|component| component.type_name == MATERIAL_DESC);
|
||||
let uses_material_slots = entity.components.iter().any(|component| {
|
||||
matches!(
|
||||
component.type_name.as_str(),
|
||||
"shared::components::Primitive"
|
||||
| STATIC_MESH_RENDERER
|
||||
| COMPONENT_SKINNED_MESH_RENDERER
|
||||
)
|
||||
});
|
||||
if has_legacy_material && uses_material_slots {
|
||||
report.findings.push(ProjectValidationFinding {
|
||||
severity: ValidationSeverity::Warning,
|
||||
code: "material.legacy_actor_component".into(),
|
||||
source_path: source_path.clone(),
|
||||
owner_actor_id: entity.actor_id.clone(),
|
||||
reference: Some(MATERIAL_DESC.into()),
|
||||
message: "primitive or mesh actor still stores a legacy actor-local MaterialDesc; the material-slot fallback is used until the project is upgraded".into(),
|
||||
repair: "Run `cargo upgrade-project --project . --apply` to materialize a shared Material asset and assign the exact saved slot.".into(),
|
||||
});
|
||||
}
|
||||
for component in &entity.components {
|
||||
if component.type_name == AUDIO_LISTENER_DESC {
|
||||
if let Ok(listener) = ron::from_str::<AudioListenerDesc>(&component.ron) {
|
||||
@@ -2044,16 +2181,6 @@ fn collect_component_references(
|
||||
"mesh",
|
||||
&slot.mesh,
|
||||
);
|
||||
if let Some(material) = slot.material {
|
||||
collect_asset_ref(
|
||||
project_root,
|
||||
report,
|
||||
source_path,
|
||||
actor_id,
|
||||
"material",
|
||||
&material,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
BRUSH_DESC => {
|
||||
@@ -2207,13 +2334,10 @@ fn collect_renderer_material_references(
|
||||
report: &mut ProjectValidationReport,
|
||||
source_path: &str,
|
||||
actor_id: Option<&str>,
|
||||
materials: &RendererMaterialSet,
|
||||
materials: &MaterialSlotSet,
|
||||
) {
|
||||
for slot in &materials.slots {
|
||||
for reference in [slot.source_material.as_ref(), slot.material.as_ref()]
|
||||
.into_iter()
|
||||
.flatten()
|
||||
{
|
||||
if let Some(reference) = slot.material.as_ref() {
|
||||
collect_asset_ref(
|
||||
project_root,
|
||||
report,
|
||||
@@ -3255,7 +3379,7 @@ mod tests {
|
||||
std::fs::create_dir_all(root.join("assets/levels")).unwrap();
|
||||
std::fs::create_dir_all(root.join("assets/.index")).unwrap();
|
||||
std::fs::write(root.join("assets/.index/registry.ron"), "[]").unwrap();
|
||||
write_manifest(&root, 1);
|
||||
write_manifest(&root, settings::SETTINGS_VERSION);
|
||||
root
|
||||
}
|
||||
|
||||
@@ -3373,7 +3497,7 @@ mod tests {
|
||||
.find(|finding| finding.code == "import.external_texture_missing")
|
||||
.expect("Authoring Override should retain one actionable dependency state");
|
||||
assert_eq!(finding.severity, ValidationSeverity::Info);
|
||||
assert!(finding.message.contains("Authoring Override"));
|
||||
assert!(finding.message.contains("per-slot material selections"));
|
||||
assert!(report.is_release_ready(), "{:?}", report.findings);
|
||||
assert_eq!(std::fs::read(&artifact).unwrap(), before);
|
||||
std::fs::remove_dir_all(root).unwrap();
|
||||
@@ -3465,7 +3589,7 @@ mod tests {
|
||||
std::fs::write(
|
||||
root.join("assets/project.ron"),
|
||||
format!(
|
||||
"(version:{version},template_version:1,default_level:\"assets/levels/main.scn.ron\",asset_roots:[\"assets/levels\"],capabilities:[])"
|
||||
"(version:{version},template_version:2,default_level:\"assets/levels/main.scn.ron\",asset_roots:[\"assets\"],capabilities:[])"
|
||||
),
|
||||
)
|
||||
.unwrap();
|
||||
@@ -4543,7 +4667,7 @@ mod tests {
|
||||
.unwrap();
|
||||
std::fs::write(
|
||||
root.join("assets/project.ron"),
|
||||
"(version:1,template_version:1,default_level:\"assets/custom/start.scn.ron\",asset_roots:[\"assets/levels\"],capabilities:[])",
|
||||
"(version:2,template_version:2,default_level:\"assets/custom/start.scn.ron\",asset_roots:[\"assets\"],capabilities:[])",
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
@@ -4562,7 +4686,7 @@ mod tests {
|
||||
std::fs::write(root.join("assets/levels/splash.png"), b"not a scene").unwrap();
|
||||
std::fs::write(
|
||||
root.join("assets/project.ron"),
|
||||
"(version:1,template_version:1,default_level:\"assets/levels/splash.png\",asset_roots:[\"assets/levels\"],capabilities:[])",
|
||||
"(version:2,template_version:2,default_level:\"assets/levels/splash.png\",asset_roots:[\"assets\"],capabilities:[])",
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
|
||||
@@ -63,7 +63,9 @@ impl EditorSampleArea {
|
||||
fn required_components(self) -> &'static [&'static str] {
|
||||
match self {
|
||||
Self::Brush => &[COMPONENT_BRUSH_DESC],
|
||||
Self::Material => &[COMPONENT_MATERIAL_DESC],
|
||||
// Materials are authored through renderer-owned slots. The Material Lab uses
|
||||
// Primitive.surface slots; actor-local MaterialDesc is a brush-only legacy path.
|
||||
Self::Material => &[COMPONENT_PRIMITIVE],
|
||||
Self::Terrain => &[COMPONENT_TERRAIN_DESC],
|
||||
Self::PhysicsPlacement => &[COMPONENT_RIGID_BODY_DESC, COMPONENT_COLLIDER_DESC],
|
||||
Self::Rendering => &[COMPONENT_POST_PROCESS_VOLUME],
|
||||
@@ -717,6 +719,7 @@ mod tests {
|
||||
fn valid_component_ron(type_name: &str) -> String {
|
||||
match type_name {
|
||||
COMPONENT_BRUSH_DESC => ron::to_string(&BrushDesc::default()).unwrap(),
|
||||
COMPONENT_PRIMITIVE => ron::to_string(&Primitive::default()).unwrap(),
|
||||
COMPONENT_MATERIAL_DESC => ron::to_string(&MaterialDesc::default()).unwrap(),
|
||||
COMPONENT_TERRAIN_DESC => ron::to_string(&TerrainDesc::default()).unwrap(),
|
||||
COMPONENT_RIGID_BODY_DESC => ron::to_string(&RigidBodyDesc::default()).unwrap(),
|
||||
@@ -858,7 +861,7 @@ mod tests {
|
||||
fn every_required_area_payload_is_type_checked() {
|
||||
for malformed_type in [
|
||||
COMPONENT_BRUSH_DESC,
|
||||
COMPONENT_MATERIAL_DESC,
|
||||
COMPONENT_PRIMITIVE,
|
||||
COMPONENT_TERRAIN_DESC,
|
||||
COMPONENT_RIGID_BODY_DESC,
|
||||
COMPONENT_COLLIDER_DESC,
|
||||
|
||||
+906
-92
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,26 @@
|
||||
use std::fs;
|
||||
use std::path::{Path, PathBuf};
|
||||
|
||||
pub(super) fn collect_files(path: &Path, output: &mut Vec<PathBuf>) -> Result<(), String> {
|
||||
if !path.exists() {
|
||||
return Ok(());
|
||||
}
|
||||
for entry in fs::read_dir(path).map_err(|error| error.to_string())? {
|
||||
let entry = entry.map_err(|error| error.to_string())?;
|
||||
let path = entry.path();
|
||||
if entry
|
||||
.file_type()
|
||||
.map_err(|error| error.to_string())?
|
||||
.is_dir()
|
||||
{
|
||||
collect_files(&path, output)?;
|
||||
} else {
|
||||
output.push(path);
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub(super) fn normalize_text(text: &str) -> String {
|
||||
text.trim().replace("\r\n", "\n")
|
||||
}
|
||||
Reference in new issue
Block a user