Commit Graph

121 Commits

Author SHA1 Message Date
rewin 50eb45fa2f fix headless 2024-04-03 22:05:49 +03:00
rewin cbd17cdca6 meta errors fix 2024-04-03 21:40:47 +03:00
rewin 6500031f6b fix headless failure 2024-04-02 22:14:53 +03:00
Lee-Orr ec4809a509 Local assets (#114)
To use it, add "&mock-api" to the URL.
2024-04-02 14:04:53 -04:00
rewin 1d3c309c20 fix native build 2024-04-02 20:26:31 +03:00
rewin 8fd780288d fmt 2024-04-02 20:23:58 +03:00
rewin 75fdb39dc2 clear debug 2024-04-02 20:23:49 +03:00
rewin 20ce43e705 fix overflow canvas 2024-04-02 20:20:16 +03:00
rewin 84be5fc08e fix native 2024-04-01 23:27:38 +03:00
rewin 97ebf4c224 auto undo 2024-04-01 22:43:56 +03:00
rewin 27b59f33c8 fix input freezing 2024-04-01 22:05:47 +03:00
rewin cd5028f93f fmt 2024-03-29 20:31:41 +03:00
rewin a7c8717646 fmt 2024-03-29 20:31:32 +03:00
rewin e6969c8006 Merge branch 'main' into update-version 2024-03-29 20:07:42 +03:00
rewin 0036e3b0f4 fix viewport 2024-03-28 23:10:02 +03:00
rewin 461ef06a4b fix loading 2024-03-28 22:48:28 +03:00
rewin e4ec7f7a62 fmt 2024-03-28 21:44:02 +03:00
Danny McGee 1163192d24 Media Library: Importing and spawning assets (#109)
This PR updates the Media Library feature to implement asset imports
from the local file system, and spawning assets from the library into
the scene. Additionally, some placeholder functionality has been
scaffolded for adding animations onto existing characters in the scene.

### Additional Changes
* Dialogs can be set to `nonBlocking` to allow interaction with
  background elements (note: this is fraught for accessibility and likely
  temporary, to facilitate testing while the UI/UX redesign is in
  progress)
* Dialogs can be moved around the screen by dragging their title-bars
* The `scene` module has been moved into a folder with a separate
  `wasm.rs` file for its submodule. (`scene/mod.rs` remains one of our
  largest single Rust files and could probably stand to be partitioned
  further.)

### To-Do
* Support for adding animations is not yet fully implemented, though
  some prerequisite functionality has been scaffolded. Namely, the "Add to
  Scene" button will be disabled if:
  - There is a mix of animations and non-animations selected in the Media
    Library
  - There is more than one animation selected in the Media Library
  - There is one animation selected in the Media Library, but no
    animatable character selected in the scene
* Adding full Storyteller-format scenes to the existing scene is not a
  use case that has been tested, and may not be a use case we wish to
  support in the long-term, as some of the data stored in Storyteller
  scenes are intended to be "singleton" resources that may conflict with
  existing data in the scene.
  
  **Attempting to spawn a Storyteller scene through the Media Library has
  not been explicitly blocked for now, but may cause unexpected
  behavior.** This needs additional UX consideration and grooming.
2024-03-27 19:20:33 -04:00
Brandon Thomas b905a0f635 Install plugin for ShortMaterial in headless mode (#105)
Not for review. This is just to get an artifact to run in production.
There's probably a better way to organize this

**NB:** We don't need to keep compatibility with the `type_path`. I'm
only doing this to stay compatible with files being written in
production currently. I assume this might change.
2024-03-27 16:41:21 -04:00
rewin 6c6570a6d3 fixs 2024-03-27 23:23:26 +03:00
rewin bb9bd4e9f4 Merge branch 'main' into update-version 2024-03-27 22:56:50 +03:00
Lee-Orr 7cea820d78 Auto keyframe/scrubbing/snapping (#107)
Co-authored-by: Danny McGee <dannymcgee@gmail.com>
2024-03-27 15:22:14 -04:00
Lee-Orr 9b2f1636c3 Move release profile to opt-level 3 (#110)
Co-authored-by: rewin <rewin1996@gmail.com>
2024-03-27 22:19:59 +03:00
rewin d63709c578 . 2024-03-27 20:27:27 +03:00
Danny McGee 21a6cb42fe Fix some issues causing input jank (#106)
This PR fixes two issues that can cause a degraded user experience under
certain conditions:

### Focus-stealing

When focus lands on the `document.body`, it's typically bad for
accessibility and a sign of improper input handling. This generally
occurs when the currently-focused element is removed from the DOM. In
our particular case, it also prevents the Bevy application from
correctly handling keyboard events.

Previously, the problem of `document.body` focus had been fixed by
checking the `document.activeElement` every frame, and redirecting focus
to the Bevy canvas whenever it landed on the `document.body`. However,
when running in an iframe embedded on https://fakeyou.com, our
application will report `document.body` as the `document.activeElement`
whenever the parent application has focus, effectively stealing focus
from the parent application and making it impossible for the user to,
e.g., interact with text fields in the parent app.

This PR removes that focus-stealing behavior. Instead, we should
properly implement the ARIA specifications for any elements that may
disappear from the DOM so that user focus is managed in a precise and
predictable way. That will be addressed in follow-up PRs.

### "Stuck" input states

In certain circumstances, the browser window hosting our application may
lose focus while certain keys/buttons are held down which are bound to
long-running actions in the Bevy application, like camera manipulation.
When that occurs, Bevy is unable to detect when the bound keys/buttons
are released, causing the input state to become "stuck" reading those
keys/buttons as being pressed.

As a workaround, this PR introduces a listener for "blur" events on the
`window`, which dispatches synthetic "keyup"/"pointerup" events to the
Bevy canvas for all affected keyboard keys and mouse buttons.
2024-03-26 19:36:47 -04:00
rewin f581bcd49a Its compilimg 2024-03-26 21:16:22 +03:00
Danny McGee daabc4d562 Fix rotation inspector (#104)
This PR updates the Transform > Rotation section of the Entity Inspector
to display Euler angles in degrees instead of the vector component of
the input quaternion.

Additionally, this updates the `studio/ui/inspector` module to add a
special-case function for updating the selected entity's rotation from
the inspector in a way that's consistent with the behavior of the
rotation gizmo.

### Known Issues

The values displayed for the angles in the inspector are not always
intuitive, especially while actively manipulating them. To some extent
this is just the nature of Euler angles (e.g., Unreal Engine exhibits
similar issues), but I suspect there's room for improvement of our
implementation (e.g., Unreal's rotation display is typically _more_ sane
than ours).

Regardless, fixing this requires a firmer grasp of the math than I
possess, so a fix for this issue is not currently planned.
2024-03-26 14:07:09 -04:00
Lee-Orr f28b7602fb Fix for animation desyncronization bug
Issue turned out to be that in some circumstances, the `group_by` iterator will create multiple groups for a single key - and sometimes those groups can be empty. This lead to situations where an animation track will end up empty until enough changed to re-shuffle things in the query iterator.
The fix is switching to `into_group_map_by` - which will put all grouped items into a hashmap instead, ensuring no duplicate keys.
2024-03-25 16:14:57 -04:00
Danny McGee 0d4072c806 Inspector editing (#96)
This PR adds Material component inspection to the frontend Entity
Inspector, and adds functional editing capabilities for the Transform
and Material inspectors.

### Changes
* Added a `ScalarFieldElement` for numeric form fields, with a hybrid
slider/text-input UX inspired by Blender, Unreal Engine, etc.
* Added `MaterialInspectorElement` for inspecting the Bevy
`StandardMaterial` component
* Wired up the `TransformInspectorElement` and
`MaterialInspectorElement` to apply changes made in the UI to the Bevy
scene
* Refactored the `studio/ui/inspector` module to output `Result::Err`s
to the dev console
* Refactored the `studio/interaction/selection` module to use only the
`Selection` resource, removing the redundant `Selected` component which
added some unnecessary complexity. This fixes #39
* Fixed primitive shapes not receiving a selection outline when selected

### To-Do

These tasks will be addressed in a forthcoming PR:

* The **Transform** > **Rotation** section in the inspector is still not
displaying sensible values. Currently it's just displaying the raw
quaternion `xyz` vector rather than displaying the orientation in
human-readable terms (e.g., as Euler angles).
* We're currently ignoring the Primitive Shape component, which would
allow the user to configure some additional geometric properties of the
shape or replace it with a different one.

---------

Co-authored-by: rewin <rewin1996@gmail.com>
2024-03-22 18:53:28 -04:00
Lee-Orr c890665e16 - avoid updating seek time from UI if source of seek time is studio, … (#102)
…to avoid re-processing timeline info

- move generating animation to first thing in a frame, and notifying
about timeline changes to last, to ensure that it happens before the
time updates
- re-generate the animation tweens whenever you start playing or
manually seek a new time in the timeline to prevent inconsistencies
2024-03-22 17:09:58 -04:00
Lee-Orr 11dc7c7945 add a minimum length of 3 seconds to animations in headless mode (#100) 2024-03-22 13:12:40 -04:00
Danny McGee 97a4aa5716 Auto-play animations in imported scenes (#91)
This PR adds a system to find animation clips in imported glTF scenes
and auto-play them on their associated entities.

The new system runs only in "Viewer" mode, for the purposes of
previewing a scene import on its Storyteller.ai Media File page. In
"Editor" mode, we will eventually expose animation clips to the user
through some other mechanism (TDB -- needs design work, grooming,
etc.).
2024-03-21 22:40:04 -04:00
Lee-Orr 67a12e42e2 Timeline Saving/Loading, Cameras, and Headless Playback (#98) 2024-03-21 20:35:25 -04:00
Lee-Orr 10759af963 save and load keyframe data (#97) 2024-03-21 15:20:50 -04:00
Brandon Thomas 116079fc48 simplify conditional compilation and fix bug 2024-03-21 00:06:11 -04:00
Brandon Thomas ba97339b1b conditional compilation of async compat (#95)
Problems with the previous code:

- `async-compat` is necessary for headless mode (cli server rendering)
to load remote scenes from the API without blowing up. Without it, the
code complains about the lack of a Tokio runtime.

- Unfortunately, `async-compat` doesn't work with WASM and the entire
web build is broken by its presence.

This change introduces conditional compilation so `async-compat` is only
leveraged in headless mode.
2024-03-20 22:36:28 -04:00
Lee-Orr 89487e5889 Headless remote assets issues (#94)
Co-authored-by: Danny McGee <dannymcgee@gmail.com>
2024-03-20 21:45:09 -04:00
Lee-Orr 0eff115eb5 Animation Timeline Initial (#88)
This PR adds an initial animation timeline.

---------

Co-authored-by: Brandon Thomas <echelon@gmail.com>
Co-authored-by: Danny McGee <dannymcgee@gmail.com>
2024-03-20 20:53:24 -04:00
rewin 2c6affce55 Fixing skybox problems 2024-03-19 21:49:22 +03:00
rewin 4c532fd32c Fix bugs 2024-03-18 21:58:48 +03:00
rewin d9175ca8d8 Its compile 2024-03-15 22:39:16 +03:00
rewin 96e15921ae fmt 2024-03-15 21:45:14 +03:00
rewin d8c837fa1b All stuff beside lerp and screenshot 2024-03-15 21:37:48 +03:00
rewin 98f1398b9f Some more bugs fixed 2024-03-15 20:04:38 +03:00
Brooks Palin 17b0e14dc8 fixed some issues, included a quick hack
The first three-ish frames of rendering are gray. We fixed this by not recording the first 3 frames and then adding 3 frames to the render.
2024-03-14 21:02:57 -06:00
Brooks Palin b9abf1d82f Composite Mode Camera Motions (#86)
This PR adds the camera motions to the composite mode. There are
currently 4 camera motion modes: `Orbit`, `Static`, `Pan`, `Zoom`. They
are accessed by using the `--camera-motion [motion]` argument. For
example, if I want to render a scene with an orbiting motion, I would do
the following:

`studio-headless scene --camera-motion orbit scene.ron `

Some things to note:
- The argument `--orbit` no longer is there. It has been deprecated!
- Currently the speed is hard coded. This can be set as a command arg
later.
- This only works with scenes, as this is intended for the `sample-room`
scene. May not work great for other scenes

Let me know if there is anything that I can fix!
2024-03-14 21:57:20 -04:00
rewin dbf512bb0c first step to 0.13 2024-03-14 23:15:30 +03:00
rewin 75dcd9b8d9 Set correct library versions 2024-03-14 20:48:57 +03:00
rewin 550a92eec1 Inspect for StandartMaterial (#76)
Allow to render StandartMaterial color and change in uniform way as
another components


![image](https://github.com/storytold/storyteller-bevy/assets/10954133/bf2fc91a-642e-40b6-99d3-a18c06dc156a)



![image](https://github.com/storytold/storyteller-bevy/assets/10954133/8534b82d-ed55-4714-8888-257db50c5e0f)
2024-03-07 21:03:42 +03:00
Brooks Palin 9aaf15287a Scaling Gizmo (#72)
This PR adds the Scaling Gizmo to the StoryTeller Engine.

Features
- Objects can now be scaled by Axis or Plane

Limitations
- Currently there is no implementation for combining the scale gizmo
with any of the other gizmo. This should be amended with further PRs.

Let me know if there is anything that I missed!

---------

Co-authored-by: Danny McGee <dannymcgee@gmail.com>
2024-03-05 16:16:01 -07:00