smpl_gloss_integration/
plugin.rs

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