diff --git a/PropertyWindow.cpp b/PropertyWindow.cpp index 0bd5591..df9f211 100644 --- a/PropertyWindow.cpp +++ b/PropertyWindow.cpp @@ -75,7 +75,7 @@ bool PropertyWindow::onCreate(int x, int y, int sx, int sy, HMODULE hThisInstanc _propGrid = New_PropertyGrid(_hwndProp,IDC_PROPERTYGRID); - PROPGRIDITEM pItem; + /*PROPGRIDITEM pItem; PropGrid_ItemInit(pItem); pItem.lpszCatalog="Test"; @@ -109,8 +109,8 @@ bool PropertyWindow::onCreate(int x, int y, int sx, int sy, HMODULE hThisInstanc PropGrid_Enable(_propGrid,true); ShowWindow(_propGrid,SW_SHOW); - PropGrid_AddItem(_propGrid,&pItem); - PropGrid_AddItem(_propGrid,&pItem2); +// PropGrid_AddItem(_propGrid,&pItem); +// PropGrid_AddItem(_propGrid,&pItem2); PropGrid_SetItemHeight(_propGrid,20); PropGrid_ShowToolTips(_propGrid,TRUE); PropGrid_ShowPropertyDescriptions(_propGrid,TRUE); @@ -154,4 +154,9 @@ void PropertyWindow::SetProperties(Instance * instance) PropGrid_ExpandAllCatalogs(_propGrid); SetWindowLongPtr(_propGrid,GWL_USERDATA,(LONG)this); _redraw(); +} + +void PropertyWindow::ClearProperties() +{ + PropGrid_ResetContent(_propGrid); } \ No newline at end of file diff --git a/PropertyWindow.h b/PropertyWindow.h index cc99db2..22f93f8 100644 --- a/PropertyWindow.h +++ b/PropertyWindow.h @@ -5,6 +5,7 @@ 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 SetProperties(Instance *); + void ClearProperties(); void onResize(); HWND _hwndProp; diff --git a/main.cpp b/main.cpp index 694ab5e..d3d9e41 100644 --- a/main.cpp +++ b/main.cpp @@ -1262,13 +1262,16 @@ void Demo::onMouseLeftPressed(HWND hwnd,int x,int y) float nearest=std::numeric_limits::infinity(); Vector3 camPos = cameraController.getCamera()->getCoordinateFrame().translation; std::vector instances = dataModel->getWorkspace()->getAllChildren(); - for(size_t i = 0; i < instances.size(); i++) + bool objFound = false; + for(size_t i = 0; i < instances.size(); i++) { if(PhysicalInstance* test = dynamic_cast(instances.at(i))) { float time = testRay.intersectionTime(test->getBox()); + if (time != inf()) { + objFound = true; if (nearest>time) { nearest=time; @@ -1295,7 +1298,13 @@ void Demo::onMouseLeftPressed(HWND hwnd,int x,int y) //dragging = true; } } - } + } + } + if(!objFound) + { + while(selectedInstances.size() > 0) + selectedInstances.erase(selectedInstances.begin()); + _propWindow->ClearProperties(); } } }