diff options
Diffstat (limited to 'editor.cpp')
-rw-r--r-- | editor.cpp | 16 |
1 files changed, 13 insertions, 3 deletions
@@ -1,7 +1,9 @@ #include "debugdraw.hpp" #include "editor.hpp" #include "model.hpp" +#include "scene.hpp" #include "ui.hpp" +#include "world.hpp" static struct { UI* ui; @@ -12,6 +14,7 @@ static struct { UI::Slider* metalness_input; UI::Slider* roughness_input; UI::Slider* ao_input; + Entity_Id selected; Model_Instance* selected_inst; int selected_mesh; } editor; @@ -126,10 +129,17 @@ void deinit_editor() { } -void editor_on_select(Model_Instance* instance, int mesh) { +void editor_on_select(World& w, Entity_Id e, int m) { if (!editor.ui->hovered) { - editor.selected_inst = instance; - editor.selected_mesh = mesh; + editor.selected = e; + if (e && w.has<C_Model>(e)) { + auto& cm = w.get<C_Model>(e); + editor.selected_inst = cm.i; + editor.selected_mesh = m; + } else { + editor.selected_inst = 0; + editor.selected_mesh = -1; + } if (editor.mat_win) { setup_mat_edit(); } |