Commit Graph

161 Commits

Author SHA1 Message Date
Danny McGee 2ad798ba2f Remove unused imports 2024-03-22 18:03:08 -04:00
Danny McGee d41fff9b04 Comment-out "Unknown component" block in inspector 2024-03-22 17:44:26 -04:00
Danny McGee 04d72a6650 Formatting, clippy 2024-03-22 17:40:25 -04:00
rewin 53f0a165e3 Fix picking for bundles and gltf entities (#103) 2024-03-22 17:35:38 -04:00
rewin 87ecf2d7e4 Save for material (#101) 2024-03-22 23:35:20 +03:00
Danny McGee dc6ab893a6 Add Scalar input field 2024-03-22 16:19:24 -04:00
Danny McGee 8dfc721686 Fix selection highlight for primitives 2024-03-21 22:34:44 -04:00
Danny McGee cde6b51bc7 Basic styling for material editor 2024-03-21 21:48:27 -04:00
Danny McGee 14011df082 Material roughness, metallic, specular editing 2024-03-21 21:36:14 -04:00
Danny McGee 0de4b744a7 Fix build error 2024-03-21 21:12:43 -04:00
Danny McGee d232eab3fd Material base_color editing support 2024-03-21 21:10:53 -04:00
Danny McGee 46d784c695 Proof-of-concept inspector mutations 2024-03-21 06:15:09 -04:00
Danny McGee 0c52ea6eec Fix hierarchy selection issues 2024-03-21 04:17:12 -04:00
Danny McGee 1f826b0d0f Sort unknown components to the bottom 2024-03-20 21:00:47 -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
Brandon Thomas cd19b3e593 Comment out dev-only file save dialog
The `window.showSaveFilePicker()` is used in development to save
`scn.ron` files. Since it's not defined in the source, it's breaking
Netlify production builds. I'm commenting this out for now so we can
unblock production builds, but feel free to restore this
code/functionality for local testing.
2024-03-22 01:32:54 -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
Danny McGee 701ba04765 Refactor Dialog abstraction (#90)
This PR overhauls the Dialog abstractions in `studio-ui` to be more
flexible for a wider variety of use cases, and adds a placeholder
"Import Asset" sub-dialog to the Media Library dialog.
2024-03-21 22:38:33 -04:00
Lee-Orr 67a12e42e2 Timeline Saving/Loading, Cameras, and Headless Playback (#98) 2024-03-21 20:35:25 -04:00
Lee-Orr 7f12634780 add url parameter for saving to the local file system &mock-save 2024-03-21 18:15:44 -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
Danny McGee 03f87b2544 "Add to Scene" menu and Media Library dialog (#78)
This PR adds a new "Add to Scene" dropdown menu for adding elements to
the current scene, and a new Media Library dialog for importing and/or
adding Storyteller Engine assets (characters, scenes, animations, etc.)
associated with the user's Storyteller.ai account.

The scope of this PR is limited to the UI &mdash; actual asset importing
behavior, and adding elements other than primitive shapes to the current
scene, will be implemented in follow-up PRs.

### Technical Details

In order to facilitate these changes, a new "overlay" abstraction has
been added to `@storyteller/studio-ui` (loosely modeled after
[`@angular/cdk/overlay`](https://material.angular.io/cdk/overlay/overview))
for managing DOM elements which should render in a self-contained
stacking context "above" the rest of the application.

Two new base UI components &mdash; `<sts-menu>` and `<sts-dialog>`
&mdash; have also been added to make use of this overlay system, but
it's worth noting that these new components have not yet been
exhaustively tested or thoroughly fleshed out, so they may require
significant changes in order to accommodate future use cases or address
unforeseen bugs.

### Testing

The Media Library makes some API calls which will run into CORS errors
in a normal browser. This can be bypassed by running Chrome with the
following command-line flags:
```
--disable-web-security --ignore-certificate-errors --user-data-dir=path/to/some/temporary/directory
```
Verify all of the following:

* The "Add to Scene" menu opens and closes as expected
* The primitive-shape menu items (Cube, Sphere, etc.) add the
  corresponding elements to the scene
* The "Media Library..." menu item correctly opens the Media Library
  dialog
* The Media Library's search bar and category filters work as expected
* A single asset can be selected by clicking on it
* Multiple assets can be selected by holding the "Ctrl" or "Cmd" key
* The selection can be cleared by clicking in an empty space in the
  results grid
* An "Add to Scene" button appears if (and only if) one or more assets
  are selected
* The Media Library dialog can be closed by:
  - Clicking the "X" in the upper right-hand corner
  - Pressing the "Esc" key
  - Clicking anywhere outside of the dialog boundaries

Additionally, ensure that the Media Library dialog handles all of the
following situations gracefully:
* User is not logged in to fakeyou.com
* User is logged in but does not have any engine-compatible assets
  uploaded (this can be tested by selecting any of the categories from the
  sidebar, since the database has not yet been migrated to use the new
  `media_file_class` field, so all of those categories should currently
  yield an empty list)
* User is logged in and there are engine-compatible assets to list (this
  can be tested by pressing the "Save" button in the main application
  toolbar to save the current scene to your account, and selecting the
  "Home" entry from the Media Library sidebar)
2024-03-15 13:30:06 -04: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
Brandon Thomas 7d5c490874 CORS - add allowed frame ancestors for development 2024-03-10 05:13:48 -04:00
Brandon Thomas 9837363783 cleanup removal of iframe origin checks 2024-03-09 13:26:08 -05:00
Brandon Thomas a958cc8283 remove origin checks - these might be the final CORS blockers 2024-03-09 13:10:08 -05:00
Brandon Thomas b36ee00d73 frame-ancestors 2024-03-09 04:14:32 -05:00
Brandon Thomas 241c5cc25c toml cors attempt 2 (#85) 2024-03-09 03:36:04 -05:00
Brandon Thomas 676b9f86a8 add netlify toml for CORS (#84) 2024-03-09 03:06:09 -05:00
Brandon Thomas 005b4fdba3 debug cors with logging (#83) 2024-03-09 02:45:48 -05:00
Brandon Thomas 26bbec58ec cargo target documentation 2024-03-09 02:34:55 -05:00
Danny McGee 9dfbcae134 Hotfix: Replace calls to crypto.randomUUID (#82)
`crypto.randomUUID` is only available in secure contexts (HTTPS), which
throws an error when trying to run in certain situations/browsers.
2024-03-08 19:56:19 -05:00
Brandon Thomas 33250e4627 fix CORS for certain hostnames (#81) 2024-03-08 18:34:33 -05:00
Danny McGee 30979fec96 Fix issues with framework decorators (#79)
This PR fixes issues with several of the decorator implementations in
`framework` and adds unit tests to specify and validate their
functionality.
2024-03-07 21:44:55 -05:00
Danny McGee fc022b1b3a Catch DOMException when accessing parent origin (#80) 2024-03-07 20:58:00 -05: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
Danny McGee 1ef112c232 Document URL params and app startup workflow (#77) 2024-03-06 21:38:11 -05:00
Danny McGee 183fab1d73 Low-hanging optimizations for CI pipelines (#75)
This PR attempts to avoid bankrupting the company by running 15 minutes
of unit tests on unchanged code or re-downloading
`@fortawesome/fontawesome-pro` 5 times for every PR commit.
2024-03-05 18:43:51 -05: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
Danny McGee 970f5b25bd Communication bridge to storyteller-frontend (#74)
This PR establishes a rudimentary communication protocol between
Storyteller Studio and the parent application (at fakeyou.com /
storyteller.ai) via the `Window.postMessage` API. An example of how this
protocol can be used from the parent application is here:
https://github.com/storytold/storyteller-frontend/commit/d36e2a9e5c162233d7bd194fdbaa26199bbf6f7a
2024-03-05 18:04:41 -05:00
rewin add1e79fea Logic for inspector field muts (#73)
Allow to send change events from typescript to bevy

Example (test)
```rust
CHANGE_FROM_UI.write_message(UpdateField {
    component: "bevy_transform::components::transform::Transform".to_string(),
    reflect_path: ".translation.x".to_string(),
    value: 0.to_string(),
});
```

Function for typescript
```rust
#[wasm_bindgen(js_name = changeValue)]
pub fn change_value(msg: String) {
    let Ok(msg) = serde_json::from_str::<UpdateField>(&msg) else {
        error!("Failed to parse message: {}", msg);
        return;
    };
    CHANGE_FROM_UI.write_message(msg);
}

```
2024-03-05 22:28:46 +03:00
Danny McGee c9904a5293 Inspector frontend UI (#68)
This PR begins fleshing out the front-end UI for inspecting the selected
entity's components.

### Implemented
* Support for the `Name` component
* Placeholder/WIP support for the `Transform` component

### To-do
* Support for sending changes made in the inspector back to Bevy
* A slider/field combo widget for numeric values (can be adapted from
  [this StackBlitz](https://stackblitz.com/edit/angular-wfikuy?file=src%2Ffloat-input%2Ffloat-input.component.ts))
* Quat -> Euler angles conversion ([example math here](https://github.com/dannymcgee/3DGameMath/blob/5cb7a8ff9310565329e57751cd8b9c33e9bd4cb7/libs/Math/include/math/quat.inl.hpp#L56-L78),
  or use a 3rd-party math library)

### Known issues
* Selecting entities from the hierarchy doesn't always update the
  components list. I suspect this is the same issue as #39
2024-03-04 15:13:03 -05:00
Danny McGee 9875ea7cca Progress bar for scene loading (#71) 2024-03-04 14:39:48 -05:00
rewin 3a27f3b881 Blocking buttons (#69)
![image](https://github.com/storytold/storyteller-bevy/assets/10954133/6c963b6c-6551-4379-854e-9f3f57cb173d)

---------

Co-authored-by: Danny McGee <dannymcgee@gmail.com>
2024-03-04 21:33:44 +03:00
Danny McGee 1f2bd9a6ae Fix pipeline fails (#70)
* Removes some unused imports causing linter to fail
* Removes a redundant `InitAsset` variant that was accidentally included
  in #57
2024-03-01 20:30:05 -05:00