Renamed selectedInstances to g_selectedInstances
This commit is contained in:
@@ -10,7 +10,7 @@ bool Globals::showMouse = true;
|
|||||||
bool Globals::useMousePoint = false;
|
bool Globals::useMousePoint = false;
|
||||||
|
|
||||||
const std::string Globals::PlaceholderName = "Dynamica";
|
const std::string Globals::PlaceholderName = "Dynamica";
|
||||||
std::vector<Instance*> selectedInstances = std::vector<Instance*>();
|
std::vector<Instance*> g_selectedInstances = std::vector<Instance*>();
|
||||||
G3D::TextureRef Globals::surface;
|
G3D::TextureRef Globals::surface;
|
||||||
POINT Globals::mousepoint;
|
POINT Globals::mousepoint;
|
||||||
Globals::Globals(void){}
|
Globals::Globals(void){}
|
||||||
|
|||||||
@@ -20,4 +20,4 @@ public:
|
|||||||
static const std::string PlaceholderName;
|
static const std::string PlaceholderName;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern std::vector<Instance*> selectedInstances;
|
extern std::vector<Instance*> g_selectedInstances;
|
||||||
@@ -58,8 +58,8 @@ LRESULT CALLBACK PropProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
|||||||
void PropertyWindow::refreshExplorer()
|
void PropertyWindow::refreshExplorer()
|
||||||
{
|
{
|
||||||
SendMessage(_explorerComboBox,CB_RESETCONTENT,0,0);
|
SendMessage(_explorerComboBox,CB_RESETCONTENT,0,0);
|
||||||
for (unsigned int i=0;i<selectedInstances.size();i++) {
|
for (unsigned int i=0;i<g_selectedInstances.size();i++) {
|
||||||
SendMessage(_explorerComboBox,CB_ADDSTRING, 0,(LPARAM)selectedInstances[i]->name.c_str());
|
SendMessage(_explorerComboBox,CB_ADDSTRING, 0,(LPARAM)g_selectedInstances[i]->name.c_str());
|
||||||
SendMessage(_explorerComboBox,CB_SETCURSEL,0,(LPARAM)0);
|
SendMessage(_explorerComboBox,CB_SETCURSEL,0,(LPARAM)0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
56
main.cpp
56
main.cpp
@@ -222,8 +222,8 @@ void CameraButtonListener::onButton1MouseClick(BaseButtonInstance* button)
|
|||||||
{
|
{
|
||||||
AudioPlayer::playSound(cameraSound);
|
AudioPlayer::playSound(cameraSound);
|
||||||
CoordinateFrame frame = usableApp->cameraController.getCamera()->getCoordinateFrame();
|
CoordinateFrame frame = usableApp->cameraController.getCamera()->getCoordinateFrame();
|
||||||
if(button->name == "CenterCam" && selectedInstances.size() > 0)
|
if(button->name == "CenterCam" && g_selectedInstances.size() > 0)
|
||||||
usableApp->cameraController.centerCamera(selectedInstances.at(0));
|
usableApp->cameraController.centerCamera(g_selectedInstances.at(0));
|
||||||
else if(button->name == "ZoomIn")
|
else if(button->name == "ZoomIn")
|
||||||
usableApp->cameraController.Zoom(1);
|
usableApp->cameraController.Zoom(1);
|
||||||
else if(button->name == "ZoomOut")
|
else if(button->name == "ZoomOut")
|
||||||
@@ -245,25 +245,25 @@ public:
|
|||||||
|
|
||||||
void GUDButtonListener::onButton1MouseClick(BaseButtonInstance* button)
|
void GUDButtonListener::onButton1MouseClick(BaseButtonInstance* button)
|
||||||
{
|
{
|
||||||
if(selectedInstances.size() > 0)
|
if(g_selectedInstances.size() > 0)
|
||||||
{
|
{
|
||||||
AudioPlayer::playSound(dingSound);
|
AudioPlayer::playSound(dingSound);
|
||||||
if(button->name == "Duplicate")
|
if(button->name == "Duplicate")
|
||||||
{
|
{
|
||||||
std::vector<Instance*> newinst;
|
std::vector<Instance*> newinst;
|
||||||
for(size_t i = 0; i < selectedInstances.size(); i++)
|
for(size_t i = 0; i < g_selectedInstances.size(); i++)
|
||||||
{
|
{
|
||||||
PhysicalInstance* tempinst = (PhysicalInstance*) selectedInstances.at(i);
|
PhysicalInstance* tempinst = (PhysicalInstance*) g_selectedInstances.at(i);
|
||||||
Vector3 tempPos = tempinst->getPosition();
|
Vector3 tempPos = tempinst->getPosition();
|
||||||
Vector3 tempSize = tempinst->getSize();
|
Vector3 tempSize = tempinst->getSize();
|
||||||
|
|
||||||
PhysicalInstance* clonedInstance = (PhysicalInstance*) selectedInstances.at(i)->clone();
|
PhysicalInstance* clonedInstance = (PhysicalInstance*) g_selectedInstances.at(i)->clone();
|
||||||
|
|
||||||
newinst.push_back(tempinst);
|
newinst.push_back(tempinst);
|
||||||
/*tempinst->setPosition(Vector3(tempPos.x, tempPos.y + tempSize.y, tempPos.z));
|
/*tempinst->setPosition(Vector3(tempPos.x, tempPos.y + tempSize.y, tempPos.z));
|
||||||
usableApp->cameraController.centerCamera(selectedInstances.at(0));*/
|
usableApp->cameraController.centerCamera(g_selectedInstances.at(0));*/
|
||||||
}
|
}
|
||||||
selectedInstances = newinst;
|
g_selectedInstances = newinst;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -275,9 +275,9 @@ public:
|
|||||||
|
|
||||||
void RotateButtonListener::onButton1MouseClick(BaseButtonInstance* button)
|
void RotateButtonListener::onButton1MouseClick(BaseButtonInstance* button)
|
||||||
{
|
{
|
||||||
if(selectedInstances.size() > 0)
|
if(g_selectedInstances.size() > 0)
|
||||||
{
|
{
|
||||||
Instance* selectedInstance = selectedInstances.at(0);
|
Instance* selectedInstance = g_selectedInstances.at(0);
|
||||||
AudioPlayer::playSound(clickSound);
|
AudioPlayer::playSound(clickSound);
|
||||||
if(PhysicalInstance* part = dynamic_cast<PhysicalInstance*>(selectedInstance))
|
if(PhysicalInstance* part = dynamic_cast<PhysicalInstance*>(selectedInstance))
|
||||||
{
|
{
|
||||||
@@ -293,16 +293,16 @@ void RotateButtonListener::onButton1MouseClick(BaseButtonInstance* button)
|
|||||||
|
|
||||||
void deleteInstance()
|
void deleteInstance()
|
||||||
{
|
{
|
||||||
if(selectedInstances.size() > 0)
|
if(g_selectedInstances.size() > 0)
|
||||||
{
|
{
|
||||||
while(selectedInstances.size() > 0)
|
while(g_selectedInstances.size() > 0)
|
||||||
{
|
{
|
||||||
Instance* selectedInstance = selectedInstances.at(0);
|
Instance* selectedInstance = g_selectedInstances.at(0);
|
||||||
if(selectedInstance->getParent() != NULL)
|
if(selectedInstance->getParent() != NULL)
|
||||||
selectedInstance->getParent()->removeChild(selectedInstance);
|
selectedInstance->getParent()->removeChild(selectedInstance);
|
||||||
delete selectedInstance;
|
delete selectedInstance;
|
||||||
selectedInstance = NULL;
|
selectedInstance = NULL;
|
||||||
selectedInstances.erase(selectedInstances.begin());
|
g_selectedInstances.erase(g_selectedInstances.begin());
|
||||||
AudioPlayer::playSound(GetFileInPath("/content/sounds/pageturn.wav"));
|
AudioPlayer::playSound(GetFileInPath("/content/sounds/pageturn.wav"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -821,7 +821,7 @@ void Demo::onNetwork() {
|
|||||||
|
|
||||||
std::vector<Instance*> Demo::getSelection()
|
std::vector<Instance*> Demo::getSelection()
|
||||||
{
|
{
|
||||||
return selectedInstances;
|
return g_selectedInstances;
|
||||||
}
|
}
|
||||||
void Demo::onSimulation(RealTime rdt, SimTime sdt, SimTime idt) {
|
void Demo::onSimulation(RealTime rdt, SimTime sdt, SimTime idt) {
|
||||||
|
|
||||||
@@ -829,7 +829,7 @@ void Demo::onSimulation(RealTime rdt, SimTime sdt, SimTime idt) {
|
|||||||
if(obj != NULL)
|
if(obj != NULL)
|
||||||
{
|
{
|
||||||
ImageButtonInstance* button = (ImageButtonInstance*)obj;
|
ImageButtonInstance* button = (ImageButtonInstance*)obj;
|
||||||
if(selectedInstances.size() <= 0)
|
if(g_selectedInstances.size() <= 0)
|
||||||
button->disabled = true;
|
button->disabled = true;
|
||||||
else
|
else
|
||||||
button->disabled = false;
|
button->disabled = false;
|
||||||
@@ -899,8 +899,8 @@ void Demo::onUserInput(UserInput* ui) {
|
|||||||
if (GetHoldKeyState(VK_LBUTTON)) {
|
if (GetHoldKeyState(VK_LBUTTON)) {
|
||||||
if (dragging) {
|
if (dragging) {
|
||||||
PhysicalInstance* part = NULL;
|
PhysicalInstance* part = NULL;
|
||||||
if(selectedInstances.size() > 0)
|
if(g_selectedInstances.size() > 0)
|
||||||
part = (PhysicalInstance*) selectedInstances.at(0);
|
part = (PhysicalInstance*) g_selectedInstances.at(0);
|
||||||
Ray dragRay = cameraController.getCamera()->worldRay(dataModel->mousex, dataModel->mousey, renderDevice->getViewport());
|
Ray dragRay = cameraController.getCamera()->worldRay(dataModel->mousex, dataModel->mousey, renderDevice->getViewport());
|
||||||
std::vector<Instance*> instances = dataModel->getWorkspace()->getAllChildren();
|
std::vector<Instance*> instances = dataModel->getWorkspace()->getAllChildren();
|
||||||
for(size_t i = 0; i < instances.size(); i++)
|
for(size_t i = 0; i < instances.size(); i++)
|
||||||
@@ -1141,11 +1141,11 @@ void Demo::onGraphics(RenderDevice* rd) {
|
|||||||
dataModel->getWorkspace()->render(rd);
|
dataModel->getWorkspace()->render(rd);
|
||||||
rd->afterPrimitive();
|
rd->afterPrimitive();
|
||||||
|
|
||||||
if(selectedInstances.size() > 0)
|
if(g_selectedInstances.size() > 0)
|
||||||
{
|
{
|
||||||
for(size_t i = 0; i < selectedInstances.size(); i++)
|
for(size_t i = 0; i < g_selectedInstances.size(); i++)
|
||||||
{
|
{
|
||||||
PhysicalInstance* part = (PhysicalInstance*)selectedInstances.at(i);
|
PhysicalInstance* part = (PhysicalInstance*)g_selectedInstances.at(i);
|
||||||
Vector3 size = part->getSize();
|
Vector3 size = part->getSize();
|
||||||
Vector3 pos = part->getPosition();
|
Vector3 pos = part->getPosition();
|
||||||
drawOutline(Vector3(0+size.x/4, 0+size.y/4, 0+size.z/4) ,Vector3(0-size.x/4,0-size.y/4,0-size.z/4), rd, lighting, Vector3(size.x/2, size.y/2, size.z/2), Vector3(pos.x/2, pos.y/2, pos.z/2), part->getCFrameRenderBased());
|
drawOutline(Vector3(0+size.x/4, 0+size.y/4, 0+size.z/4) ,Vector3(0-size.x/4,0-size.y/4,0-size.z/4), rd, lighting, Vector3(size.x/2, size.y/2, size.z/2), Vector3(pos.x/2, pos.y/2, pos.z/2), part->getCFrameRenderBased());
|
||||||
@@ -1280,9 +1280,9 @@ void Demo::onMouseLeftPressed(HWND hwnd,int x,int y)
|
|||||||
{
|
{
|
||||||
nearest=time;
|
nearest=time;
|
||||||
bool found = false;
|
bool found = false;
|
||||||
for(size_t i = 0; i < selectedInstances.size(); i++)
|
for(size_t i = 0; i < g_selectedInstances.size(); i++)
|
||||||
{
|
{
|
||||||
if(selectedInstances.at(i) == test)
|
if(g_selectedInstances.at(i) == test)
|
||||||
{
|
{
|
||||||
found = true;
|
found = true;
|
||||||
ShowWindow(_propWindow->_hwndProp, SW_SHOW);
|
ShowWindow(_propWindow->_hwndProp, SW_SHOW);
|
||||||
@@ -1292,9 +1292,9 @@ void Demo::onMouseLeftPressed(HWND hwnd,int x,int y)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(!found)
|
if(!found)
|
||||||
{while(selectedInstances.size() > 0)
|
{while(g_selectedInstances.size() > 0)
|
||||||
selectedInstances.erase(selectedInstances.begin());
|
g_selectedInstances.erase(g_selectedInstances.begin());
|
||||||
selectedInstances.push_back(test);
|
g_selectedInstances.push_back(test);
|
||||||
}
|
}
|
||||||
_propWindow->SetProperties(test);
|
_propWindow->SetProperties(test);
|
||||||
//message = "Dragging = true.";
|
//message = "Dragging = true.";
|
||||||
@@ -1306,8 +1306,8 @@ void Demo::onMouseLeftPressed(HWND hwnd,int x,int y)
|
|||||||
}
|
}
|
||||||
if(!objFound)
|
if(!objFound)
|
||||||
{
|
{
|
||||||
while(selectedInstances.size() > 0)
|
while(g_selectedInstances.size() > 0)
|
||||||
selectedInstances.erase(selectedInstances.begin());
|
g_selectedInstances.erase(g_selectedInstances.begin());
|
||||||
_propWindow->ClearProperties();
|
_propWindow->ClearProperties();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user