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
@@ -2,6 +2,7 @@
|
||||
|
||||
use bevy::prelude::*;
|
||||
|
||||
use super::{default_grid_emergency_handle, DefaultGridEmergencyMaterial};
|
||||
use crate::{
|
||||
authoring_component_active, AuthoringComponentStates, InspectorOrder, LevelObject, Primitive,
|
||||
PrimitiveShape, COMPONENT_PRIMITIVE,
|
||||
@@ -49,6 +50,8 @@ pub fn hydrate_primitives(
|
||||
),
|
||||
>,
|
||||
mut meshes: ResMut<Assets<Mesh>>,
|
||||
mut materials: ResMut<Assets<StandardMaterial>>,
|
||||
mut fallback: ResMut<DefaultGridEmergencyMaterial>,
|
||||
) {
|
||||
for (entity, primitive, states, legacy_order) in &primitives {
|
||||
if !authoring_component_active(states, legacy_order, COMPONENT_PRIMITIVE) {
|
||||
@@ -59,8 +62,17 @@ pub fn hydrate_primitives(
|
||||
continue;
|
||||
}
|
||||
let mesh = meshes.add(primitive_mesh(primitive));
|
||||
let material = default_grid_emergency_handle(&mut materials, &mut fallback);
|
||||
|
||||
commands.entity(entity).insert(Mesh3d(mesh));
|
||||
commands.entity(entity).insert((
|
||||
Mesh3d(mesh),
|
||||
MeshMaterial3d(material),
|
||||
crate::HydratedMaterialSlotBinding {
|
||||
owner: entity,
|
||||
slot_id: primitive.surface.id.clone(),
|
||||
selection: primitive.surface.hydrated_selection(),
|
||||
},
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user