Unravel Engine C++ Reference
Loading...
Searching...
No Matches
seq_inspector.h
Go to the documentation of this file.
1#pragma once
2#include "seq_action.h"
3#include "seq_common.h"
4#include "seq_private.h"
5#include <hpp/source_location.hpp>
6
7namespace seq
8{
9namespace inspector
10{
11
12template<typename T>
13inline void update_begin_value(seq_action& action, const T& begin)
14{
15#ifdef SEQ_INSPECTOR_ENABLE
16 if(action.info)
17 {
18 action.info->begin_value = to_str(begin);
19 }
20#endif
21}
22
23template<typename T>
24inline void update_action_status(seq_action& action, const T& current)
25{
26#ifdef SEQ_INSPECTOR_ENABLE
27 if(action.info)
28 {
29 action.info->current_value = to_str(current);
30 action.info->elapsed = seq_private::get_elapsed(action);
31 action.info->progress = float(action.info->elapsed.count()) / float(action.info->duration.count());
32 action.info->speed_multiplier = seq_private::get_speed_multiplier(action);
33 action.info->stop_when_finished = seq_private::is_stop_when_finished_requested(action);
34 }
35#endif
36}
37
38template<typename Object, typename T>
39inline void add_info(seq_action& action,
40 const std::string& updater_type,
41 const Object& object,
42 const T& end_value,
43 const ease_t& ease_func)
44{
45#ifdef SEQ_INSPECTOR_ENABLE
46 action.info = std::make_shared<seq_inspect_info>();
47 action.info->id = action.get_id();
48 action.info->duration = seq_private::get_duration(action);
49 action.info->updater_type = updater_type;
50 action.info->modified_type = type_to_str(object);
51 action.info->end_value = to_str(end_value);
52 action.info->ease_func = ease_func;
53#endif
54}
55
57void update_action_state(seq_action& action, state_t state);
58
59void add_sequence_info(seq_action& action, const std::vector<seq_action>& actions);
60void add_together_info(seq_action& action, const std::vector<seq_action>& actions);
61void add_delay_info(seq_action& action);
62void add_repeat_info(seq_action& repeat_action, const seq_action& action, size_t times = 0);
63void add_location(seq_action& action, const hpp::source_location& location);
64
65} // end of namespace inspector
66} // namespace seq
Provides utilities for inspecting and converting sequence-related types to strings.
void update_begin_value(seq_action &action, const T &begin)
void add_info(seq_action &action, const std::string &updater_type, const Object &object, const T &end_value, const ease_t &ease_func)
void add_repeat_info(seq_action &repeat_action, const seq_action &action, size_t times)
void add_together_info(seq_action &action, const std::vector< seq_action > &actions)
auto to_str(const T &t) -> std::string
Converts a value to a string using ADL (Argument-Dependent Lookup).
Definition seq_common.h:280
void update_action_state(seq_action &action, state_t state)
void add_location(seq_action &action, const hpp::source_location &location)
void add_sequence_info(seq_action &action, const std::vector< seq_action > &actions)
auto type_to_str(const T &t) -> std::string
Gets the type of a value as a string using ADL.
Definition seq_common.h:311
void update_action_status(seq_action &action)
void add_delay_info(seq_action &action)
Provides a sequence-based action management system for controlling and scheduling actions.
state_t
Represents the state of a sequence action.
Definition seq_common.h:81
std::function< float(float)> ease_t
Represents an easing function for interpolation.
Definition seq_common.h:61
Represents an action within the sequence management system. Contains lifecycle events and management ...
Definition seq_action.h:18
auto get_id() const -> seq_id_t
Gets the unique ID of the action.
seq_inspect_info::ptr info
Gets a pointer to the action's inspection information.
Definition seq_action.h:75
static auto get_duration(const seq_action &self) -> duration_t
Gets the total duration of a given action.
static auto get_speed_multiplier(const seq_action &action) -> float
Gets the speed multiplier of a given action.
static auto is_stop_when_finished_requested(const seq_action &action) -> bool
Checks if the action is requested to stop when finished.
static auto get_elapsed(const seq_action &self) -> duration_t
Gets the elapsed time of a given action.