67 lines
1.6 KiB
C++
67 lines
1.6 KiB
C++
#pragma once
|
|
|
|
#include "ModuleManager.h"
|
|
|
|
#include <array>
|
|
|
|
class UnityExplorerModule final : public BaseModule {
|
|
public:
|
|
UnityExplorerModule();
|
|
|
|
void RegisterTab() override;
|
|
void Render() override;
|
|
void Update() override;
|
|
|
|
private:
|
|
struct SceneEntry {
|
|
std::string name;
|
|
};
|
|
|
|
struct ObjectEntry {
|
|
std::string display_name;
|
|
void* unity_object = nullptr;
|
|
};
|
|
|
|
struct ComponentEntry {
|
|
std::string type_name;
|
|
void* component = nullptr;
|
|
};
|
|
|
|
struct InspectorState {
|
|
bool active = false;
|
|
bool has_transform = false;
|
|
void* transform = nullptr;
|
|
Vec3 position{};
|
|
Vec3 local_position{};
|
|
Vec3 scale{1.0f, 1.0f, 1.0f};
|
|
Vec3 rotation_xyz{};
|
|
float rotation_w = 1.0f;
|
|
std::string class_namespace;
|
|
std::string class_name;
|
|
std::vector<ComponentEntry> components;
|
|
};
|
|
|
|
void RefreshScenes();
|
|
void RefreshObjectsForScene();
|
|
void InspectObject(int object_index);
|
|
void RefreshInspectorState();
|
|
bool LoadTransformState(void* unity_object);
|
|
void LoadComponentList(void* unity_object);
|
|
|
|
bool active_window_ = true;
|
|
bool auto_refresh_ = false;
|
|
float refresh_interval_ = 3.0f;
|
|
double last_refresh_time_ = 0.0;
|
|
int selected_scene_ = 0;
|
|
int selected_object_ = -1;
|
|
|
|
bool inspector_active_ = false;
|
|
void* inspected_obj_ptr_ = nullptr;
|
|
std::string inspected_obj_name_;
|
|
InspectorState inspector_;
|
|
|
|
std::array<char, 128> search_filter_{};
|
|
std::vector<SceneEntry> scenes_;
|
|
std::vector<ObjectEntry> objects_;
|
|
};
|