Unravel Engine C++ Reference
Loading...
Searching...
No Matches
inspector_particle_emitter.cpp
Go to the documentation of this file.
3#include "inspectors.h"
4
5namespace unravel
6{
8 entt::meta_any& var,
9 const meta_any_proxy& var_proxy,
10 const var_info& info,
11 const entt::meta_custom& custom) -> inspect_result
12{
13 inspect_result result;
14 auto& data = var.cast<particle_emitter_component&>();
15
16
17 // Current state display
18 const bool is_playing = data.is_playing();
19 const bool is_paused = data.is_paused();
20
21 // Status text
22 ImGui::Text("Status: ");
23 ImGui::SameLine();
24 if(!is_playing)
25 {
26 ImGui::TextColored(ImVec4(0.8f, 0.4f, 0.4f, 1.0f), "Stopped");
27 }
28 else if(is_paused)
29 {
30 ImGui::TextColored(ImVec4(0.8f, 0.8f, 0.4f, 1.0f), "Paused");
31 }
32 else
33 {
34 ImGui::TextColored(ImVec4(0.4f, 0.8f, 0.4f, 1.0f), "Playing");
35 }
36
37 ImGui::Spacing();
38
39 // Control buttons
40
41 // Play button
42 if(!is_playing || is_paused)
43 {
44 if(ImGui::Button("Play"))
45 {
46 data.play();
47 result.changed = true;
48 }
49
50 ImGui::SetItemTooltip("Start particle emission and simulation");
51 }
52 else
53 {
54 ImGui::BeginDisabled();
55 ImGui::Button("Play");
56 ImGui::EndDisabled();
57 }
58
59 ImGui::SameLine();
60
61 // Pause/Resume button
62 if(is_playing && !is_paused)
63 {
64 if(ImGui::Button("Pause"))
65 {
66 data.pause();
67 result.changed = true;
68 }
69 ImGui::SetItemTooltip("Pause particle simulation (particles remain visible)");
70 }
71 else if(is_playing && is_paused)
72 {
73 if(ImGui::Button("Resume"))
74 {
75 data.resume();
76 result.changed = true;
77 }
78 ImGui::SetItemTooltip("Resume particle simulation from paused state");
79 }
80 else
81 {
82 ImGui::BeginDisabled();
83 ImGui::Button("Pause");
84 ImGui::EndDisabled();
85 }
86
87 ImGui::SameLine();
88
89 // Stop button
90 if(is_playing)
91 {
92 if(ImGui::Button("Stop"))
93 {
94 data.stop();
95 result.changed = true;
96 }
97 ImGui::SetItemTooltip("Stop emission and clear all particles");
98
99 ImGui::SameLine();
100 if(ImGui::Button("Stop and Reset"))
101 {
102 data.stop_and_reset();
103 result.changed = true;
104 }
105 ImGui::SetItemTooltip("Stop emission and clear all particles");
106 }
107 else
108 {
109 ImGui::BeginDisabled();
110 ImGui::Button("Stop");
111 ImGui::SameLine();
112 ImGui::Button("Stop and Reset");
113 ImGui::EndDisabled();
114 }
115
116 result |= inspect_var_properties(ctx, var, var_proxy, info, custom);
117 return result;
118}
119} // namespace unravel
Component that wraps particle system emitter functionality.
auto inspect_var_properties(rtti::context &ctx, entt::meta_any &var, const meta_any_proxy &var_proxy, const var_info &info, const entt::meta_custom &custom) -> inspect_result
Inspects all properties of a complex object recursively.
Result of an inspection operation indicating what changes occurred.
Definition inspector.h:146
bool changed
Whether the value was modified during inspection.
Definition inspector.h:148
auto inspect(rtti::context &ctx, entt::meta_any &var, const meta_any_proxy &var_proxy, const var_info &info, const entt::meta_custom &custom) -> inspect_result override
Safe deferred property access proxy for arbitrary object properties.
Definition inspector.h:198
Metadata about a variable being inspected.
Definition inspector.h:133