fix merge problem

This commit is contained in:
rewin
2024-01-26 22:08:37 +03:00
parent be93b20400
commit 9a648b892a
7 changed files with 51 additions and 23 deletions
Generated
+10 -10
View File
@@ -177,9 +177,9 @@ dependencies = [
[[package]]
name = "anyhow"
version = "1.0.75"
version = "1.0.79"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a4668cab20f66d8d020e1fbc0ebe47217433c1b6c8f2040faf858554e394ace6"
checksum = "080e9890a082662b09c1ad45f567faeeb47f22b5fb23895fbe1e651e718e25ca"
[[package]]
name = "approx"
@@ -2936,9 +2936,9 @@ dependencies = [
[[package]]
name = "libz-sys"
version = "1.1.14"
version = "1.1.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "295c17e837573c8c821dbaeb3cceb3d745ad082f7572191409e69cbc1b3fd050"
checksum = "037731f5d3aaa87a5675e895b63ddff1a87624bc29f77004ea829809654e48f6"
dependencies = [
"cc",
"libc",
@@ -3466,9 +3466,9 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf"
[[package]]
name = "openssl-sys"
version = "0.9.98"
version = "0.9.99"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c1665caf8ab2dc9aef43d1c0023bd904633a6a05cb30b0ad59bec2ae986e57a7"
checksum = "22e1bf214306098e4832460f797824c05d25aacdf896f64a985fb0fd992454ae"
dependencies = [
"cc",
"libc",
@@ -3580,18 +3580,18 @@ dependencies = [
[[package]]
name = "pin-project"
version = "1.1.3"
version = "1.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fda4ed1c6c173e3fc7a83629421152e01d7b1f9b7f65fb301e490e8cfc656422"
checksum = "0302c4a0442c456bd56f841aee5c3bfd17967563f6fadc9ceb9f9c23cf3807e0"
dependencies = [
"pin-project-internal",
]
[[package]]
name = "pin-project-internal"
version = "1.1.3"
version = "1.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405"
checksum = "266c042b60c9c76b8d53061e52b2e0d1116abc57cefc8c5cd671619a56ac3690"
dependencies = [
"proc-macro2",
"quote",
+1
View File
@@ -2,4 +2,5 @@
"space_editor_ui::settings::NewWindowSettings": "{\"space_editor_ui::settings::NewWindowSettings\":(new_tab:SameNode)}",
"space_editor_core::hotkeys::HotkeySet<space_editor_ui::tools::gizmo::GizmoHotkey>": "{\"space_editor_core::hotkeys::HotkeySet<space_editor_ui::tools::gizmo::GizmoHotkey>\":(bindings:{Rotate:[R],Translate:[G],Scale:[S],Multiple:[ShiftLeft],Clone:[AltLeft],Delete:[X]},name:\"GizmoHotkey\")}",
"space_persistence::PersistenceSettings": "{\"space_persistence::PersistenceSettings\":(load_on_startup:true,save_on_close:true)}",
"space_undo::ChangeChainSettings": "{\"space_undo::ChangeChainSettings\":(max_change_chain_size:200)}",
}
+2
View File
@@ -17,6 +17,7 @@ bevy-inspector-egui = "0.22.0"
bevy_mod_raycast = "0.16.0"
bevy_rapier3d = "0.23.0"
bevy_mod_outline = "0.6.0"
bevy_web_asset = "0.7.0"
bitflags = "2.4.0"
console_error_panic_hook = { version = "0.1.7", optional = true }
js-sys = { version = "0.3.65", optional = true }
@@ -34,6 +35,7 @@ web-sys = { version = "0.3.65", optional = true, features = [
"Window",
] }
space_editor = {git = "https://github.com/rewin123/space_editor", rev = "ce83f86dc902787ab16213f3209276a784654df6"}
anyhow.workspace = true
[features]
wasm = [
+3
View File
@@ -179,6 +179,9 @@ fn process_focus_inputs(
// Zero out any existing camera velocity or interpolation
**velocity = Vec3::ZERO;
info!("Setting focus to {:?}", target);
if q_interp_vel.get(ent).is_ok() {
cmd.entity(ent).remove::<InterpVelocity>();
}
+9 -7
View File
@@ -3,9 +3,11 @@
use bevy::{app::PluginGroupBuilder, prelude::*};
use bevy_mod_picking::DefaultPickingPlugins;
use bevy_web_asset::WebAssetPlugin;
#[cfg(feature = "wasm")]
use wasm_bindgen::prelude::*;
mod bvh;
mod camera_controller;
mod debug;
mod design_system;
@@ -17,10 +19,10 @@ mod persistance;
mod scene;
mod skybox;
mod ui;
mod viewport;
pub mod viewport;
mod world_grid;
use crate::{
pub use crate::{
camera_controller::CameraControllerPlugin,
debug::DebugPlugin,
input::StudioInputPlugin,
@@ -188,7 +190,7 @@ pub fn start_editor(
// TODO: These `start_` functiions should be refactored to better support the
// needs of the "reaodnly viewer" vs "full studio editor" use cases. See
// notes in `studio-web/src/lib/viewer.element.ts` for more info.
#[cfg_attr(feature = "wasm", wasm_bindgen(js_name = start))]
pub fn start_internal(
object_id: &str,
skybox_id: &str,
@@ -196,7 +198,7 @@ pub fn start_internal(
canvas_alt: &str,
viewport_size: ViewportSize,
studio_mode: StudioMode,
) {
) -> App {
#[cfg(feature = "wasm")]
console_error_panic_hook::set_once();
@@ -210,6 +212,7 @@ pub fn start_internal(
app.add_plugins((
#[cfg(feature = "wasm")]
viewport::wasm::ViewportPlugin,
WebAssetPlugin,
DefaultPlugins.set(WindowPlugin {
primary_window: Some(Window {
resolution: viewport_size.into(),
@@ -222,8 +225,7 @@ pub fn start_internal(
CommonPlugins,
));
if studio_mode == StudioMode::Editor {
info!("Starting in editor mode");
if matches!(studio_mode, StudioMode::Editor) {
app.add_plugins((DefaultPickingPlugins, EditorPlugins));
// Only for registering components for undo
@@ -242,5 +244,5 @@ pub fn start_internal(
#[cfg(feature = "wasm")]
wasm::initialize();
app.run();
app
}
+1 -1
View File
@@ -4,7 +4,7 @@ use studio::{StudioMode, ViewportSize};
fn main() {
// Edit the arguments here to change the default startup scene or skybox
let mut app = studio::start_internal(
"Mannequin.gltf",
"bookcase.gltf",
"gum_trees_4k",
"", // ignored for non-WASM
"Storyteller Studio",
+25 -5
View File
@@ -6,7 +6,7 @@ use bevy::{
tonemapping::Tonemapping,
},
gltf::Gltf,
math::vec2,
math::{vec2, Affine3A},
pbr::ShadowFilteringMethod,
prelude::*,
render::{mesh::skinning::SkinnedMesh, primitives::Aabb, view::NoFrustumCulling},
@@ -86,6 +86,7 @@ fn minimal_scene_setup(mut cmd: Commands) {
cmd.spawn(DirectionalLightBundle {
directional_light: DirectionalLight {
shadows_enabled: false,
illuminance: 20000.0,
..default()
},
transform: Transform::default().looking_at(Vec3::NEG_ONE, Vec3::Y),
@@ -176,6 +177,7 @@ pub struct SceneData {
#[derive(Component)]
pub struct SkeletalJoint(pub Color);
#[derive(Component)]
pub struct SceneRoot;
#[derive(Resource, Deref, DerefMut)]
pub struct TestBvh(pub Handle<Bvh>); // TODO
@@ -248,7 +250,7 @@ fn init_scene_loading(
cmd.spawn((
SpatialBundle::default(),
space_editor::prelude::GltfPrefab {
path: format!("gltf/{}.gltf", id.0),
path: format!("gltf/{}", id.0),
scene: "Scene0".to_string(),
},
PrefabMarker,
@@ -270,6 +272,9 @@ fn tick_scene_spawning(
}
}
#[derive(Component)]
pub struct NoMeshElement;
fn tag_scene_elements(
mut cmd: Commands,
// A "glTF mesh" is actually a container for one or more "glTF primitives",
@@ -280,18 +285,33 @@ fn tag_scene_elements(
// leafy parts of a plant. Here we only want to tag the elements that a user
// might want to individually address when arranging or animating a scene.
q_named_non_primitives: Query<
Entity,
(Entity,
&Children),
(
With<SceneAutoChild>,
With<Name>,
Without<Handle<Mesh>>,
Without<SceneElement>,
Without<NoMeshElement>
),
>,
q_skinned_meshes: Query<(Entity, &SkinnedMesh), Without<SkeletalJoint>>,
mut q_xforms: ParamSet<(TransformHelper, Query<&Transform>)>,
mesh_entities: Query<Entity, With<Handle<Mesh>>>,
) {
for loaded_part in q_named_non_primitives.iter() {
cmd.entity(loaded_part).insert(SceneElement);
for (e, children) in q_named_non_primitives.iter() {
let mut has_mesh = false;
for child in children {
if mesh_entities.contains(*child) {
has_mesh = true;
break;
}
}
if has_mesh {
cmd.entity(e).insert(SceneElement);
} else {
cmd.entity(e).insert(NoMeshElement);
}
}
for (ent, skinned_mesh) in q_skinned_meshes.iter()