Unravel Engine C++ Reference
Loading...
Searching...
No Matches
scene_panel.h
Go to the documentation of this file.
1#pragma once
2#include "../entity_panel.h"
4#include <math/math.h>
5
8
9namespace unravel
10{
12
13{
14public:
15 scene_panel(imgui_panels* parent, const char* name);
16
17 void init(rtti::context& ctx);
18
19 auto get_window_name() const -> const char* override;
20 void deinit(rtti::context& ctx);
21
25 auto get_window_flags() const -> ImGuiWindowFlags override;
26
27 auto get_camera() -> entt::handle;
28 auto get_center() -> entt::handle;
29
31 void reset_camera(rtti::context& ctx);
32
33 auto get_auto_save_prefab() const -> bool;
34
35 void on_project_opened();
36
37 // Drag selection methods
38 auto is_drag_selection_active() const -> bool { return is_drag_selecting_; }
39 auto get_drag_selection_rect() const -> ImRect { return ImRect(drag_start_pos_, drag_current_pos_); }
40 auto get_drag_selection_bounds() const -> std::pair<ImVec2, ImVec2>
41 {
42 return {
43 ImVec2(std::min(drag_start_pos_.x, drag_current_pos_.x), std::min(drag_start_pos_.y, drag_current_pos_.y)),
44 ImVec2(std::max(drag_start_pos_.x, drag_current_pos_.x), std::max(drag_start_pos_.y, drag_current_pos_.y))
45 };
46 }
47
48private:
49 void draw_scene(rtti::context& ctx, delta_t dt);
50
51 void draw_ui(rtti::context& ctx) override;
52 void draw_menubar(rtti::context& ctx);
53 void draw_selected_camera(rtti::context& ctx, entt::handle editor_camera, const ImVec2& size);
54 auto begin_panel(const char* name, ImGuiWindowFlags flags) -> bool override;
55
56 // Menu bar drawing functions
57 void draw_prefab_mode_header(rtti::context& ctx);
58 void draw_transform_tools(editing_manager& em);
59 void draw_gizmo_pivot_mode_menu(bool& gizmo_at_center);
60 void draw_coordinate_system_menu(editing_manager& em);
61 void draw_grid_settings_menu(editing_manager& em);
62 void draw_gizmos_settings_menu(editing_manager& em);
63 void draw_visualization_menu();
64 void draw_snapping_menu(editing_manager& em);
65 void draw_inverse_kinematics_menu(editing_manager& em);
66 void draw_camera_settings_menu(rtti::context& ctx);
67
68
69 // Drag selection helper functions
70 void handle_drag_selection(rtti::context& ctx, const camera& camera, editing_manager& em);
71 void draw_drag_selection_rect(const ImVec2& start_pos, const ImVec2& current_pos);
72
73 // UI interaction functions
74 void handle_viewport_interaction(rtti::context& ctx, const camera& camera, editing_manager& em);
75 void handle_keyboard_shortcuts(editing_manager& em);
76 void setup_camera_viewport(camera_component& camera_comp, const ImVec2& size, const ImVec2& pos);
77 void draw_scene_viewport(rtti::context& ctx, const ImVec2& size, const ImVec2& pos);
78
79 // Handle prefab mode changes
80 void handle_prefab_mode_changes(rtti::context& ctx);
81
82 bool is_dragging_{};
83 int visualize_passes_{-1};
84 int current_resolution_index_{0};
85 scene panel_scene_{"scene_panel"};
86
87 bool gizmo_at_center_{true};
88
89 float acceleration_{};
90 math::vec3 move_dir_{};
91
92 dd_2d_raii dd_2d_{};
93 gizmos_renderer gizmos_{};
94
95 // Track prefab mode state
96 bool was_prefab_mode_{false};
97
98 // Auto-save prefabs when exiting prefab mode
99 bool auto_save_prefab_{true};
100
101 // Drag selection state
102 bool is_drag_selecting_{false};
103 ImVec2 drag_start_pos_{};
104 ImVec2 drag_current_pos_{};
105 bool was_using_gizmo_{false};
106
107 std::string fullscreen_name_{};
108
109 viewport_stats_overlay::state stats_overlay_state_{};
110
111 int m_skip_frames_{0};
112};
113} // namespace unravel
Class that contains core camera data, used for rendering and other purposes.
Class representing a camera. Contains functionality for manipulating and updating a camera....
Definition camera.h:62
void on_frame_render(rtti::context &ctx, delta_t dt)
void on_frame_update(rtti::context &ctx, delta_t dt)
void init(rtti::context &ctx)
auto get_auto_save_prefab() const -> bool
auto is_drag_selection_active() const -> bool
Definition scene_panel.h:38
auto get_drag_selection_bounds() const -> std::pair< ImVec2, ImVec2 >
Definition scene_panel.h:40
auto get_window_flags() const -> ImGuiWindowFlags override
auto get_drag_selection_rect() const -> ImRect
Definition scene_panel.h:39
scene_panel(imgui_panels *parent, const char *name)
void on_frame_before_render(rtti::context &ctx, delta_t dt)
auto get_center() -> entt::handle
void reset_camera(rtti::context &ctx)
Recreate the Scene panel editor camera at the default pose (UI "Reset Camera").
auto get_window_name() const -> const char *override
void deinit(rtti::context &ctx)
auto get_camera() -> entt::handle
std::chrono::duration< float > delta_t
std::string name
Definition hub.cpp:33
const aiScene * scene
Hash specialization for batch_key to enable use in std::unordered_map.