smpl_gloss_integration/
plugin.rs1#[cfg(feature = "with-gui")]
2use crate::systems::smpl_anim_scroll_gui;
3use crate::systems::smpl_auto_add_follow;
4use crate::systems::smpl_auto_add_scene;
5#[cfg(feature = "with-gui")]
6use crate::systems::smpl_betas_gui;
7#[cfg(feature = "with-gui")]
8use crate::systems::smpl_event_dropfile;
9#[cfg(feature = "with-gui")]
10use crate::systems::smpl_expression_gui;
11#[cfg(feature = "with-gui")]
12use crate::systems::smpl_hand_pose_gui;
13#[cfg(not(target_arch = "wasm32"))]
14use crate::systems::smpl_lazy_load_model;
15#[cfg(feature = "with-gui")]
16use crate::systems::smpl_params_gui;
17use crate::systems::{hide_floor_when_viewed_from_below, smpl_advance_anim};
18use crate::systems::{
19 smpl_apply_pose, smpl_betas_to_verts, smpl_compute_pose_correctives, smpl_expression_apply, smpl_expression_offsets, smpl_follow_anim,
20 smpl_make_dummy_pose, smpl_mask_pose, smpl_pose_remap, smpl_to_gloss_mesh,
21};
22use gloss_renderer::plugin_manager::{EventSystem, GuiSystem, LogicSystem, Plugin};
23#[derive(Clone)]
24pub struct SmplPlugin {
25 pub autorun: bool,
26}
27impl SmplPlugin {
28 pub fn new(autorun: bool) -> Self {
29 Self { autorun }
30 }
31}
32impl Plugin for SmplPlugin {
33 fn autorun(&self) -> bool {
34 self.autorun
35 }
36 #[allow(clippy::vec_init_then_push)]
37 fn event_systems(&self) -> Vec<EventSystem> {
38 let mut vec = Vec::new();
39 cfg_if::cfg_if! {
40 if #[cfg(feature = "with-gui")] { vec
41 .push(EventSystem::new(smpl_event_dropfile)
42 .with_name("smpl_event_dropfile")); } else {}
43 }
44 vec
45 }
46 fn logic_systems(&self) -> Vec<LogicSystem> {
47 let mut vec = Vec::new();
48 #[cfg(not(target_arch = "wasm32"))]
49 vec.push(LogicSystem::new(smpl_lazy_load_model).with_name("smpl_lazy_load_model"));
50 let mut rest = vec![
51 LogicSystem::new(smpl_auto_add_scene).with_name("smpl_auto_add_scene"),
52 LogicSystem::new(smpl_auto_add_follow).with_name("smpl_auto_add_follow"),
53 LogicSystem::new(smpl_advance_anim).with_name("smpl_advance_anim"),
54 LogicSystem::new(smpl_betas_to_verts).with_name("smpl_betas_to_verts"),
55 LogicSystem::new(smpl_expression_offsets).with_name("smpl_expression_offsets"),
56 LogicSystem::new(smpl_expression_apply).with_name("smpl_expression_apply"),
57 LogicSystem::new(smpl_make_dummy_pose).with_name("smpl_make_dummy_pose"),
58 LogicSystem::new(smpl_pose_remap).with_name("smpl_pose_remap"),
59 LogicSystem::new(smpl_mask_pose).with_name("smpl_mask_pose"),
60 LogicSystem::new(smpl_compute_pose_correctives).with_name("smpl_compute_pose_correctives"),
61 LogicSystem::new(smpl_apply_pose).with_name("smpl_apply_pose"),
62 LogicSystem::new(smpl_to_gloss_mesh).with_name("smpl_to_gloss_mesh"),
63 LogicSystem::new(smpl_follow_anim).with_name("smpl_follow_anim"),
64 LogicSystem::new(hide_floor_when_viewed_from_below).with_name("hide_floor_when_viewed_from_below"),
65 ];
66 vec.append(&mut rest);
67 vec
68 }
69 #[allow(clippy::vec_init_then_push)]
70 fn gui_systems(&self) -> Vec<GuiSystem> {
71 let mut vec = Vec::new();
72 cfg_if::cfg_if! {
73 if #[cfg(feature = "with-gui")] { vec.push(GuiSystem::new(smpl_params_gui));
74 vec.push(GuiSystem::new(smpl_betas_gui)); vec
75 .push(GuiSystem::new(smpl_expression_gui)); vec
76 .push(GuiSystem::new(smpl_anim_scroll_gui)); vec
77 .push(GuiSystem::new(smpl_hand_pose_gui)); } else {}
78 }
79 vec
80 }
81}