MCPcopy Create free account
hub / github.com/BoomingTech/Piccolo / EditorUI

Method EditorUI

engine/source/editor/source/editor_ui.cpp:45–255  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

43 float columnWidth = 100.0f);
44
45 EditorUI::EditorUI()
46 {
47 const auto& asset_folder = g_runtime_global_context.m_config_manager->getAssetFolder();
48 m_editor_ui_creator["TreeNodePush"] = [this](const std::string& name, void* value_ptr) -> void {
49 static ImGuiTableFlags flags = ImGuiTableFlags_Resizable | ImGuiTableFlags_NoSavedSettings;
50 bool node_state = false;
51 g_node_depth++;
52 if (g_node_depth > 0)
53 {
54 if (g_editor_node_state_array[g_node_depth - 1].second)
55 {
56 node_state = ImGui::TreeNodeEx(name.c_str(), ImGuiTreeNodeFlags_SpanFullWidth);
57 }
58 else
59 {
60 g_editor_node_state_array.emplace_back(std::pair(name.c_str(), node_state));
61 return;
62 }
63 }
64 else
65 {
66 node_state = ImGui::TreeNodeEx(name.c_str(), ImGuiTreeNodeFlags_SpanFullWidth);
67 }
68 g_editor_node_state_array.emplace_back(std::pair(name.c_str(), node_state));
69 };
70 m_editor_ui_creator["TreeNodePop"] = [this](const std::string& name, void* value_ptr) -> void {
71 if (g_editor_node_state_array[g_node_depth].second)
72 {
73 ImGui::TreePop();
74 }
75 g_editor_node_state_array.pop_back();
76 g_node_depth--;
77 };
78 m_editor_ui_creator["Transform"] = [this](const std::string& name, void* value_ptr) -> void {
79 if (g_editor_node_state_array[g_node_depth].second)
80 {
81 Transform* trans_ptr = static_cast<Transform*>(value_ptr);
82
83 Vector3 degrees_val;
84
85 degrees_val.x = trans_ptr->m_rotation.getPitch(false).valueDegrees();
86 degrees_val.y = trans_ptr->m_rotation.getRoll(false).valueDegrees();
87 degrees_val.z = trans_ptr->m_rotation.getYaw(false).valueDegrees();
88
89 DrawVecControl("Position", trans_ptr->m_position);
90 DrawVecControl("Rotation", degrees_val);
91 DrawVecControl("Scale", trans_ptr->m_scale);
92
93 trans_ptr->m_rotation.w = Math::cos(Math::degreesToRadians(degrees_val.x / 2)) *
94 Math::cos(Math::degreesToRadians(degrees_val.y / 2)) *
95 Math::cos(Math::degreesToRadians(degrees_val.z / 2)) +
96 Math::sin(Math::degreesToRadians(degrees_val.x / 2)) *
97 Math::sin(Math::degreesToRadians(degrees_val.y / 2)) *
98 Math::sin(Math::degreesToRadians(degrees_val.z / 2));
99 trans_ptr->m_rotation.x = Math::sin(Math::degreesToRadians(degrees_val.x / 2)) *
100 Math::cos(Math::degreesToRadians(degrees_val.y / 2)) *
101 Math::cos(Math::degreesToRadians(degrees_val.z / 2)) -
102 Math::cos(Math::degreesToRadians(degrees_val.x / 2)) *

Callers

nothing calls this directly

Calls 13

DrawVecControlFunction · 0.85
TextClass · 0.85
DragFloat3Function · 0.85
DragFloat4Function · 0.85
getPitchMethod · 0.80
getRollMethod · 0.80
getYawMethod · 0.80
c_strMethod · 0.45
pop_backMethod · 0.45
valueDegreesMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected