mirror of
https://github.com/storytold/storyteller-bevy.git
synced 2026-10-22 08:06:01 +00:00
Studio Headless Mode (#36)
This PR adds the capaibility to run Stroyteller studio from the command line, rendering the result to images. This is the basic functionality, and there are somethings that I am saving for later when we make this a more fully fledged feature. Limitations: - Right now, you cannot do image output resolutions that aren't 2^n. This is a bug I plan on tackling later. If you have questions on how the command line works, use the --help argument. Let me know what you think! --------- Co-authored-by: Danny McGee <dannymcgee@gmail.com>
This commit is contained in:
@@ -24,6 +24,7 @@ pub struct BvhPlugin;
|
||||
impl Plugin for BvhPlugin {
|
||||
fn build(&self, app: &mut App) {
|
||||
app.init_asset::<Bvh>()
|
||||
.add_event::<BvhAnimCompleteEvent>()
|
||||
.register_asset_loader(BvhLoader)
|
||||
// FIXME: Need to add a state for this module (similar to scene
|
||||
// module's `SceneState`) to manage the order/frequency at
|
||||
@@ -106,6 +107,7 @@ fn compute_inverse_bindposes(
|
||||
pub fn animate_bvh(
|
||||
mut q_bvh_anims: Query<(&mut BvhAnim, &Children)>,
|
||||
mut q_bvh_joints: Query<JointQuery, Without<BvhAnim>>,
|
||||
mut bvh_event_writer: EventWriter<BvhAnimCompleteEvent>,
|
||||
r_bvh_assets: Res<Assets<Bvh>>,
|
||||
r_time: Res<Time>,
|
||||
) {
|
||||
@@ -122,6 +124,9 @@ pub fn animate_bvh(
|
||||
|
||||
if anim.timer.just_finished() {
|
||||
anim.frame = (anim.frame + 1) % bvh_len;
|
||||
if anim.frame == 0 {
|
||||
bvh_event_writer.send(BvhAnimCompleteEvent);
|
||||
}
|
||||
}
|
||||
|
||||
anim.timer.percent()
|
||||
@@ -204,6 +209,16 @@ fn lerp_frames<T: ReadOnlyWorldQuery>(
|
||||
}
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
// Bvh Anim Events
|
||||
//==============================================================================
|
||||
|
||||
// This may seem weird, but this is for the Headless mode to
|
||||
// know when to stop recording.
|
||||
|
||||
#[derive(Event)]
|
||||
pub struct BvhAnimCompleteEvent;
|
||||
|
||||
//==============================================================================
|
||||
// Bvh Anim Component
|
||||
//==============================================================================
|
||||
|
||||
Reference in New Issue
Block a user