@@ -53,42 +53,42 @@ namespace OvEditor::Panels
5353 */
5454 void UnFocus ();
5555
56- /* *
57- * Unfocus the currently targeted actor without removing listeners attached to this actor
58- */
59- void SoftUnFocus ();
60-
6156 /* *
6257 * Returns the currently selected actor
6358 */
64- OvCore::ECS::Actor* GetTargetActor () const ;
65-
66- /* *
67- * Create the actor inspector for the given actor
68- */
69- void CreateActorInspector (OvCore::ECS::Actor& p_target);
70-
71- /* *
72- * Draw the given component in inspector
73- */
74- void DrawComponent (OvCore::ECS::Components::AComponent& p_component);
75-
76- /* *
77- * Draw the given behaviour in inspector
78- */
79- void DrawBehaviour (OvCore::ECS::Components::Behaviour& p_behaviour);
59+ OvTools::Utils::OptRef<OvCore::ECS::Actor> GetTargetActor () const ;
8060
8161 /* *
8262 * Refresh the inspector
8363 */
8464 void Refresh ();
8565
8666 private:
87- OvCore::ECS::Actor* m_targetActor = nullptr ;
88- OvUI::Widgets::Layout::Group* m_actorInfo;
89- OvUI::Widgets::Layout::Group* m_inspectorHeader;
90- OvUI::Widgets::Selection::ComboBox* m_componentSelectorWidget;
91- OvUI::Widgets::InputFields::InputText* m_scriptSelectorWidget;
67+ void _Populate ();
68+ void _PopulateActorInfo ();
69+ void _PopulateActorComponents ();
70+ void _PopulateActorBehaviours ();
71+ void _DrawAddComponentSection ();
72+ void _DrawAddScriptSection ();
73+ void _DrawComponent (OvCore::ECS::Components::AComponent& p_component);
74+ void _DrawBehaviour (OvCore::ECS::Components::Behaviour& p_behaviour);
75+ void _UpdateAddComponentButton ();
76+ void _UpdateAddScriptButton ();
77+
78+ private:
79+ OvTools::Utils::OptRef<OvCore::ECS::Actor> m_targetActor = std::nullopt ;
80+ OvUI::Widgets::Layout::Group* m_content;
81+
82+ OvTools::Utils::OptRef<OvUI::Widgets::Buttons::Button> m_addComponentButton;
83+ OvTools::Utils::OptRef<OvUI::Widgets::Buttons::Button> m_addScriptButton;
84+
85+ // We store this here so that re-creating the inspector doesn't
86+ // reset the selected component.
87+ int m_selectedComponent = 0 ;
88+
89+ // Same as the selected component above, we want to keep the value
90+ // of the selected script even if the inspector is re-created
91+ std::string m_selectedScript;
9292
9393 uint64_t m_componentAddedListener = 0 ;
9494 uint64_t m_componentRemovedListener = 0 ;
0 commit comments