Unravel Engine C++ Reference
Loading...
Searching...
No Matches
transform_actions.h
Go to the documentation of this file.
1#pragma once
2
3#include "editing_action.h"
4#include "composite_action.h"
5#include "entt/meta/meta.hpp"
6#include <engine/ecs/scene.h>
9#include <math/math.h>
10
11namespace unravel
12{
13
14// Individual transform component actions
15struct transform_move_action_t : crtp_meta_type<transform_move_action_t, editing_action_t>
16{
18 math::vec3 old_position;
19 math::vec3 new_position;
20
21 transform_move_action_t(entt::handle ent, const math::vec3& old_pos, const math::vec3& new_pos);
22
23 void do_action() override;
24 void undo_action() override;
25 auto is_mergeable(const editing_action_t& previous) const -> bool override;
26 void merge_with(const editing_action_t& previous) override;
27 auto is_valid() const -> bool override;
28 void draw_in_inspector(rtti::context& ctx) override;
29};
30
32{
34 math::vec3 old_position;
35 math::vec3 new_position;
36
37 transform_move_global_action_t(entt::handle ent, const math::vec3& old_pos, const math::vec3& new_pos);
38
39 void do_action() override;
40 void undo_action() override;
41 auto is_mergeable(const editing_action_t& previous) const -> bool override;
42 void merge_with(const editing_action_t& previous) override;
43 auto is_valid() const -> bool override;
44 void draw_in_inspector(rtti::context& ctx) override;
45};
46
48{
50 math::quat old_rotation;
51 math::quat new_rotation;
52
53 transform_rotate_action_t(entt::handle ent, const math::quat& old_rot, const math::quat& new_rot);
54
55 void do_action() override;
56 void undo_action() override;
57 auto is_mergeable(const editing_action_t& previous) const -> bool override;
58 void merge_with(const editing_action_t& previous) override;
59 auto is_valid() const -> bool override;
60 void draw_in_inspector(rtti::context& ctx) override;
61};
62
64{
66 math::vec3 old_scale;
67 math::vec3 new_scale;
68
69 transform_scale_action_t(entt::handle ent, const math::vec3& old_sc, const math::vec3& new_sc);
70
71 void do_action() override;
72 void undo_action() override;
73 auto is_mergeable(const editing_action_t& previous) const -> bool override;
74 void merge_with(const editing_action_t& previous) override;
75 auto is_valid() const -> bool override;
76 void draw_in_inspector(rtti::context& ctx) override;
77};
78
80{
82 math::vec3 old_skew;
83 math::vec3 new_skew;
84
85 transform_skew_action_t(entt::handle ent, const math::vec3& old_sk, const math::vec3& new_sk);
86
87 void do_action() override;
88 void undo_action() override;
89 auto is_mergeable(const editing_action_t& previous) const -> bool override;
90 void merge_with(const editing_action_t& previous) override;
91 auto is_valid() const -> bool override;
92 void draw_in_inspector(rtti::context& ctx) override;
93};
94
96{
98 entt::uhandle old_parent{};
99 entt::uhandle new_parent{};
100
101 transform_set_parent_action_t(entt::handle ent, entt::handle old_p, entt::handle new_p);
103
104 void do_action() override;
105 void undo_action() override;
106 auto is_mergeable(const editing_action_t& previous) const -> bool override;
107 void merge_with(const editing_action_t& previous) override;
108 auto is_valid() const -> bool override;
109 void draw_in_inspector(rtti::context& ctx) override;
110};
111
112} // namespace unravel
auto is_valid() const -> bool override
void draw_in_inspector(rtti::context &ctx) override
transform_move_action_t(entt::handle ent, const math::vec3 &old_pos, const math::vec3 &new_pos)
void merge_with(const editing_action_t &previous) override
auto is_mergeable(const editing_action_t &previous) const -> bool override