This commit is contained in:
rewin
2024-03-27 23:23:26 +03:00
parent bb9bd4e9f4
commit 6c6570a6d3
11 changed files with 77 additions and 56 deletions
+2 -2
View File
@@ -34,7 +34,7 @@ impl Plugin for TimelinePlugin {
.register_type::<uuid::Uuid>()
.add_event::<TimelineInteractionEvent>()
.add_event::<KeyframeInteractionEvent>()
.add_state::<KeyingMode>();
.init_state::<KeyingMode>();
app.insert_resource(GlobalSeekTime {
time: 0.,
@@ -375,7 +375,7 @@ fn process_auto_key(
for entity in &changed {
info!("Setting Auto Key");
event.send(KeyframeInteractionEvent::RecordKeyframe { target: entity })
event.send(KeyframeInteractionEvent::RecordKeyframe { target: entity });
}
}
+3 -3
View File
@@ -50,8 +50,8 @@ impl Plugin for StudioInputPlugin {
/// Logs all `InputAction`s emitted, along with the input state at the time they
/// were fired, with `debug` verbosity.
fn log_input_actions(
ri_keyboard: Res<Input<KeyCode>>,
ri_mouse_buttons: Res<Input<MouseButton>>,
ri_keyboard: Res<ButtonInput<KeyCode>>,
ri_mouse_buttons: Res<ButtonInput<MouseButton>>,
mut er_input_actions: EventReader<InputAction>,
) {
if er_input_actions.is_empty() {
@@ -78,7 +78,7 @@ fn log_input_actions(
let mod_keys = [AltLeft, AltRight, ShiftLeft, ControlLeft, ControlRight]
.into_iter()
.collect::<HashSet<_>>();
let action_keys = [W, A, S, D, E, Q, Escape, Grave, Delete, F]
let action_keys = [KeyCode::KeyW, KeyCode::KeyA, KeyCode::KeyS, KeyCode::KeyD, KeyCode::KeyE, KeyCode::KeyQ, KeyCode::Escape, KeyCode::Quote, KeyCode::Delete, KeyCode::KeyF]
.into_iter()
.collect::<HashSet<_>>();
+7 -5
View File
@@ -38,22 +38,24 @@ pub(super) struct GizmoMats {
pub rotate_ss: Handle<GizmoMaterial>,
}
#[allow(deprecated)]
pub(super) fn init_resources(
mut cmd: Commands,
mut ra_meshes: ResMut<Assets<Mesh>>,
mut ra_mats: ResMut<Assets<GizmoMaterial>>,
) {
let translate_line = ra_meshes.add(Mesh::from(shape::Cylinder {
let translate_line = ra_meshes.add(Cylinder {
radius: 0.03,
height: 0.8,
resolution: 6,
segments: 1,
}));
half_height: 0.4,
});
let translate_arrow = ra_meshes.add(Mesh::from(geo::Cone {
radius: 0.115,
length: 0.4,
resolution: 12,
}));
let translate_plane = ra_meshes.add(Mesh::from(geo::Plane2Sided { size: 0.25 }));
let translate_ss = ra_meshes.add(
Mesh::try_from(shape::Icosphere {
+6 -6
View File
@@ -21,10 +21,10 @@ impl RemoteAssetReader {
let token = path
.ext_file_prefix()
.ok_or_else(|| {
AssetReaderError::Io(std::io::Error::new(
AssetReaderError::Io(Arc::new(std::io::Error::new(
ErrorKind::Other,
format!("Failed to parse token from '{path:?}'"),
))
)))
})?
.to_str()
.unwrap();
@@ -40,10 +40,10 @@ impl RemoteAssetReader {
.json::<GetMediaFileSuccessResponse>()
.await
.map_err(IntoError::<AssetReaderError>::into),
other => Err(AssetReaderError::Io(std::io::Error::new(
other => Err(AssetReaderError::Io(Arc::new(std::io::Error::new(
ErrorKind::Other,
format!("Status Code from endpoint: {other}"),
))),
)))),
}?;
let url = format!(
@@ -69,10 +69,10 @@ impl RemoteAssetReader {
.map_err(IntoError::<AssetReaderError>::into)?
.into_iter()
.collect::<Vec<_>>()),
other => Err(AssetReaderError::Io(std::io::Error::new(
other => Err(AssetReaderError::Io(Arc::new(std::io::Error::new(
ErrorKind::Other,
format!("Status Code from bucket URL: {other}"),
))),
)))),
}?;
let reader: Box<Reader> = Box::new(VecReader::new(bytes));
+2 -2
View File
@@ -12,7 +12,7 @@ use bevy::{
prelude::*,
render::{camera::RenderTarget, primitives::Aabb},
scene::InstanceId,
utils::{EntityHashSet, HashSet},
utils::HashSet,
};
#[cfg(feature = "wasm")]
use serde_repr::{Deserialize_repr, Serialize_repr};
@@ -461,7 +461,7 @@ fn tag_scene_elements(
fn autoplay_animations(
mut cmd: Commands,
mut l_done: Local<HashSet<String>>,
mut l_animating: Local<EntityHashSet<Entity>>,
mut l_animating: Local<HashSet<Entity>>,
ra_gltfs: Res<Assets<Gltf>>,
ra_anims: Res<Assets<AnimationClip>>,
q_prefabs: Query<(&GltfPrefab, &Handle<Gltf>)>,
+1 -1
View File
@@ -188,7 +188,7 @@ fn prepare_screen_capture_buffers(
let size = texture.size();
let format = texture.format();
let bytes_per_row =
(size.width / format.block_dimensions().0) * format.block_size(None).unwrap();
(size.width / format.block_dimensions().0) * format.block_copy_size(None).unwrap();
let padded_bytes_per_row =
RenderDevice::align_copy_bytes_per_row(bytes_per_row as usize) as u32;
+14 -16
View File
@@ -1,5 +1,3 @@
use core::fmt;
use bevy::{
asset::LoadState,
prelude::*,
@@ -118,21 +116,21 @@ fn spawn_skybox(
// cmd.remove_resource::<SkyboxAssets>();
}
struct SkyboxPaths {
cubemap: String,
env_diffuse: String,
env_specular: String,
}
// struct SkyboxPaths {
// cubemap: String,
// env_diffuse: String,
// env_specular: String,
// }
impl SkyboxPaths {
fn new(name: impl fmt::Display) -> Self {
Self {
cubemap: format!("skyboxes/{name}.hdr"),
env_diffuse: format!("skyboxes/{name}_diffuse.zstd.ktx2"),
env_specular: format!("skyboxes/{name}_specular.zstd.ktx2"),
}
}
}
// impl SkyboxPaths {
// fn new(name: impl fmt::Display) -> Self {
// Self {
// cubemap: format!("skyboxes/{name}.hdr"),
// env_diffuse: format!("skyboxes/{name}_diffuse.zstd.ktx2"),
// env_specular: format!("skyboxes/{name}_specular.zstd.ktx2"),
// }
// }
// }
#[cfg(feature = "wasm")]
mod wasm {
+4 -7
View File
@@ -11,12 +11,9 @@ use serde::{Deserialize, Serialize};
use serde_json::{self, json, Map as JsonMap, Value as JsonValue};
use space_editor::{
space_editor_ui::{
editor_tab::{EditorTab, EditorTabName},
EditorUiAppExt,
},
space_prefab::{
component::MeshPrimitivePrefab, editor_registry::EditorRegistryExt, save::SaveState,
editor_tab::{EditorTab, EditorTabName}, ui_plugin::EditorUiAppExt
},
space_prefab::{component::MeshPrimitive3dPrefab, editor_registry::EditorRegistryExt, save::SaveState},
};
use wasm_bindgen::prelude::*;
@@ -66,7 +63,7 @@ impl Plugin for InspectorPlugin {
app.register_inspect::<Transform>();
app.register_inspect::<Name>();
app.register_inspect::<MeshPrimitivePrefab>();
app.register_inspect::<MeshPrimitive3dPrefab>();
//register standart material
{
@@ -627,7 +624,7 @@ fn serialize_standart_materal(
ev_inspect.clear();
if let Some((target, handle)) = r_selection
if let Some((_, handle)) = r_selection
.as_ref()
.and_then(|selection| find_handle_in_self_or_children(***selection, &q_children, &q_m))
.and_then(|target| q_m.get(target).ok().map(|h| (target, h.clone())))
+2 -5
View File
@@ -37,10 +37,7 @@ fn spawn_world_grid(
mut ra_meshes: ResMut<Assets<Mesh>>,
mut ra_mat_proc_grid: ResMut<Assets<ProceduralGridMaterial>>,
) {
let plane = ra_meshes.add(Mesh::from(shape::Plane {
size: 200.0,
subdivisions: 0,
}));
let plane = ra_meshes.add(Plane3d::default());
let proc_grid = ra_mat_proc_grid.add(ProceduralGridMaterial {});
cmd.spawn((
@@ -53,7 +50,7 @@ fn spawn_world_grid(
MaterialMeshBundle {
mesh: plane.clone(),
material: proc_grid.clone(),
transform: Transform::IDENTITY,
transform: Transform::IDENTITY.with_scale(Vec3::splat(200.0)),
..default()
},
NotShadowCaster,