Moved selection to be a service

This commit is contained in:
Vulpovile
2022-10-03 19:30:24 -07:00
parent b2db375ecf
commit f46e24d8f1
18 changed files with 177 additions and 140 deletions

View File

@@ -32,7 +32,6 @@ class Application { // : public GApp {
PartInstance* makePart();
void drawButtons(RenderDevice* rd);
void drawOutline(Vector3 from, Vector3 to, RenderDevice* rd, LightingParameters lighting, Vector3 size, Vector3 pos, CoordinateFrame c);
std::vector<Instance*> getSelection();
void deleteInstance();
void run();
void QuitApp();

View File

@@ -2,6 +2,7 @@
#include "WorkspaceInstance.h"
#include "LevelInstance.h"
#include "PartInstance.h"
#include "SelectionService.h"
#include "rapidxml/rapidxml.hpp"
#include "GuiRootInstance.h"
#include "XplicitNgine/XplicitNgine.h"
@@ -30,12 +31,7 @@ public:
bool showMessage;
G3D::GFontRef font;
GuiRootInstance* getGuiRoot();
//float mousex;
//float mousey;
//Vector2 getMousePos();
//void setMousePos(int x,int y);
//void setMousePos(Vector2 pos);
//bool mouseButton1Down;
SelectionService* getSelectionService();
PartInstance* makePart();
void clearLevel();
void toggleRun();
@@ -56,6 +52,7 @@ private:
WorkspaceInstance* workspace;
LevelInstance * level;
GuiRootInstance* guiRoot;
SelectionService* selectionService;
bool running;
XplicitNgine * xplicitNgine;
};

View File

@@ -0,0 +1,21 @@
#pragma once
#include "Instance.h"
#include "PropertyWindow.h"
class SelectionService : public Instance
{
public:
SelectionService(void);
~SelectionService(void);
SelectionService(const SelectionService &oinst);
std::vector<Instance *> getSelection();
void clearSelection();
bool isSelected(Instance * instance);
void addSelected(Instance * instance);
void removeSelected(Instance * instance);
void addSelected(const std::vector<Instance *> &instances);
void setPropertyWindow(PropertyWindow * propertyWindow);
private:
std::vector<Instance *> selection;
PropertyWindow * propertyWindow;
};

View File

@@ -25,7 +25,6 @@ public:
};
extern std::vector<Instance*> postRenderStack;
extern std::vector<Instance*> g_selectedInstances;
extern bool running;
extern DataModelInstance* g_dataModel;
extern XplicitNgine* g_xplicitNgine;

View File

@@ -1,14 +1,15 @@
#pragma once
#include "DataModelV2/Instance.h"
#include <set>
class PropertyWindow {
public:
PropertyWindow(int x, int y, int sx, int sy, HMODULE hThisInstance);
bool onCreate(int x, int y, int sx, int sy, HMODULE hThisInstance);
void UpdateSelected(Instance *);
void UpdateSelected(std::vector<Instance *> selection);
void ClearProperties();
void onResize();
void refreshExplorer(Instance* selectedInstance);
void refreshExplorer(std::vector<Instance *> selection);
HWND _hwndProp;
private:
HWND _propGrid;