diff --git a/CMakeModules/SimoxConfig.cmake.in b/CMakeModules/SimoxConfig.cmake.in index 8d87a6768ea958beca1445b9e6101cf3869f1ec4..9d552b818e4b2f8e29a6940a9549a6ee768b0467 100644 --- a/CMakeModules/SimoxConfig.cmake.in +++ b/CMakeModules/SimoxConfig.cmake.in @@ -1,4 +1,4 @@ -## Copyright (c) 2014, Karlsruhe Institute of Technology (Nikolaus Vahrenkamp) +## Copyright (c) 2014, Nikolaus Vahrenkamp (Karlsruhe Institute of Technology) # - Config file for the Simox package diff --git a/CMakeModules/SimoxConfigVersion.cmake.in b/CMakeModules/SimoxConfigVersion.cmake.in index b790027341e70fc8160223d0c22450b2fb94f638..5ad53154260b88e104e064aec174818fbc6afcbe 100644 --- a/CMakeModules/SimoxConfigVersion.cmake.in +++ b/CMakeModules/SimoxConfigVersion.cmake.in @@ -1,4 +1,4 @@ -## Copyright (c) 2012, Karlsruhe Institute of Technology +## Copyright (c) 2014, Nikolaus Vahrenkamp (Karlsruhe Institute of Technology) set(PACKAGE_VERSION "@Simox_VERSION@") diff --git a/VirtualRobot/Nodes/RobotNode.cpp b/VirtualRobot/Nodes/RobotNode.cpp index 38a8437de9914840e7b19632278f476e3b14859a..651b664548d557aa5dd9f2af3dce71bf5b0740ba 100644 --- a/VirtualRobot/Nodes/RobotNode.cpp +++ b/VirtualRobot/Nodes/RobotNode.cpp @@ -695,7 +695,7 @@ std::string RobotNode::toXML( const std::string &modelPath /*= "models"*/, bool std::string visuFile = getFilenameReplacementVisuModel(); ss << visualizationModel->toXML(modelPath,visuFile,2); } - if (collisionModel) + if (collisionModel && collisionModel->getTriMeshModel() && collisionModel->getTriMeshModel()->faces.size()>0) { std::string colFile = getFilenameReplacementColModel(); ss << collisionModel->toXML(modelPath,colFile,2); diff --git a/VirtualRobot/SceneObject.cpp b/VirtualRobot/SceneObject.cpp index d342daca9241cd2cb5f0d0745ad11a71fde07ac2..6adf8d50f48ffd492d27ab9246a2a00543b75827 100644 --- a/VirtualRobot/SceneObject.cpp +++ b/VirtualRobot/SceneObject.cpp @@ -885,7 +885,7 @@ std::vector<std::string> SceneObject::getIgnoredCollisionModels() bool SceneObject::saveModelFiles( const std::string &modelPath, bool replaceFilenames ) { bool res = true; - if (visualizationModel) + if (visualizationModel && visualizationModel->getTriMeshModel() && visualizationModel->getTriMeshModel()->faces.size()>0) { std::string newFilename; if (replaceFilenames) @@ -900,7 +900,7 @@ bool SceneObject::saveModelFiles( const std::string &modelPath, bool replaceFile } res = res & visualizationModel->saveModel(modelPath,newFilename); } - if (collisionModel) + if (collisionModel && collisionModel->getTriMeshModel() && collisionModel->getTriMeshModel()->faces.size()>0) { // check if we need to replace the filename (also in case the trimesh model is stored!) std::string newFilename; diff --git a/VirtualRobot/examples/ColladaViewer/RobotViewer.ui b/VirtualRobot/examples/ColladaViewer/RobotViewer.ui index 747a3f4a7b0d6f8b2746bedb5014d5fd9e1f32a1..254fd480f787d9b3c4ea1519389fe00ecf3f1ab3 100644 --- a/VirtualRobot/examples/ColladaViewer/RobotViewer.ui +++ b/VirtualRobot/examples/ColladaViewer/RobotViewer.ui @@ -55,7 +55,7 @@ <x>0</x> <y>360</y> <width>201</width> - <height>311</height> + <height>251</height> </rect> </property> <property name="title"> @@ -176,7 +176,7 @@ </rect> </property> <property name="text"> - <string>Select Robot File</string> + <string>Select Collada File</string> </property> </widget> <widget class="QGroupBox" name="groupBox_3"> @@ -392,6 +392,19 @@ </property> </widget> </widget> + <widget class="QPushButton" name="pushButtonSave"> + <property name="geometry"> + <rect> + <x>40</x> + <y>630</y> + <width>111</width> + <height>31</height> + </rect> + </property> + <property name="text"> + <string>Save XML</string> + </property> + </widget> </widget> </item> </layout> diff --git a/VirtualRobot/examples/ColladaViewer/showRobotWindow.cpp b/VirtualRobot/examples/ColladaViewer/showRobotWindow.cpp index a9d33ddff1215ce5730d92838043fb824edd31d8..e0d418af985f3bd077e96896664458cc4f13da8c 100644 --- a/VirtualRobot/examples/ColladaViewer/showRobotWindow.cpp +++ b/VirtualRobot/examples/ColladaViewer/showRobotWindow.cpp @@ -105,6 +105,7 @@ void showRobotWindow::setupUI() connect(UI.pushButtonReset, SIGNAL(clicked()), this, SLOT(resetSceneryAll())); connect(UI.pushButtonLoad, SIGNAL(clicked()), this, SLOT(selectRobot())); + connect(UI.pushButtonSave, SIGNAL(clicked()), this, SLOT(saveRobot())); /*connect(UI.pushButtonClose, SIGNAL(clicked()), this, SLOT(closeHand())); connect(UI.pushButtonOpen, SIGNAL(clicked()), this, SLOT(openHand())); @@ -504,9 +505,29 @@ void showRobotWindow::loadRobot() robotStructure(); displayPhysics(); viewer->viewAll(); +} -#if 0 - std::string outFile("robot.xml"); +void showRobotWindow::robotStructure() +{ + if (!robot) + return; + + structureEnabled = UI.checkBoxStructure->checkState() == Qt::Checked; + robot->showStructure(structureEnabled); + // rebuild visualization + rebuildVisualization(); +} + +void showRobotWindow::saveRobot() +{ + + QString fileName = QFileDialog::getSaveFileName(this, tr("Save File"), + "", + tr("Simox XML (*.xml)")); + if (fileName.isEmpty()) + return; + std::string outFile = fileName.toLocal8Bit().constData(); + //std::string outFile("robot.xml"); //store robot to file boost::filesystem::path relOutFile(outFile); boost::filesystem::path outFilename = relOutFile.filename(); @@ -540,18 +561,6 @@ void showRobotWindow::loadRobot() cout << e.what(); return; } -#endif -} - -void showRobotWindow::robotStructure() -{ - if (!robot) - return; - - structureEnabled = UI.checkBoxStructure->checkState() == Qt::Checked; - robot->showStructure(structureEnabled); - // rebuild visualization - rebuildVisualization(); } void showRobotWindow::robotCoordSystems() diff --git a/VirtualRobot/examples/ColladaViewer/showRobotWindow.h b/VirtualRobot/examples/ColladaViewer/showRobotWindow.h index 89b2b63b5f1beec069ffc0471b62753b56512a94..ab4bfdc162dbbf76e0dba2cf3170a38800b6a087 100644 --- a/VirtualRobot/examples/ColladaViewer/showRobotWindow.h +++ b/VirtualRobot/examples/ColladaViewer/showRobotWindow.h @@ -61,6 +61,7 @@ public slots: //void closeHand(); //void openHand(); //void selectEEF(int nr); + void saveRobot(); void selectRobot(); void displayPhysics();