Changeset 7aafc15 in OpenModelica
- Timestamp:
- 2023-03-27T11:28:24+02:00 (13 months ago)
- Parents:
- e757cda7
- git-author:
- anotheruserofgithub <96748782+anotheruserofgithub@…> (03/23/23 09:52:56)
- git-committer:
- anotheruserofgithub <96748782+anotheruserofgithub@…> (03/27/23 11:28:24)
- Location:
- OMEdit/OMEditLIB/Animation
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
OMEdit/OMEditLIB/Animation/AnimationUtil.h
re757cda7 r7aafc15 165 165 } 166 166 167 inline bool isDXFType(const std::string& type) 168 { 169 return type == "DXF"; 170 } 171 172 inline bool isSTLType(const std::string& type) 173 { 174 return type == "STL"; 175 } 176 177 inline bool isOBJType(const std::string& type) 178 { 179 return type == "OBJ"; 180 } 181 182 inline bool is3DSType(const std::string& type) 183 { 184 return type == "3DS"; 185 } 186 187 inline bool isCADType(const std::string& type) 188 { 189 return isDXFType(type) || isSTLType(type) || isOBJType(type) || is3DSType(type); 190 } 191 192 inline bool isSimpleCADType(const std::string& type) 193 { 194 return isDXFType(type) || isSTLType(type); 195 } 196 197 inline bool isAdvancedCADType(const std::string& type) 198 { 199 return isOBJType(type) || is3DSType(type); 200 } 201 167 202 inline const char* boolToString(bool b) 168 203 { -
OMEdit/OMEditLIB/Animation/ViewerWidget.cpp
r740a8c7 r7aafc15 404 404 if (mpSelectedVisualizer->isShape()) { 405 405 ShapeObject* shape = mpSelectedVisualizer->asShape(); 406 if ( shape->_type.compare("dxf") == 0 or shape->_type.compare("stl") == 0) {407 QString msg = tr("Texture feature is not applicable for %1 files.").arg(shape->_type.c ompare("dxf") == 0 ? "DXF" : "STL");406 if (isSimpleCADType(shape->_type)) { 407 QString msg = tr("Texture feature is not applicable for %1 files.").arg(shape->_type.c_str()); 408 408 MessagesWidget::instance()->addGUIMessage(MessageItem(MessageItem::Modelica, msg, 409 409 Helper::scriptingKind, Helper::notificationLevel)); … … 427 427 if (mpSelectedVisualizer->isShape()) { 428 428 ShapeObject* shape = mpSelectedVisualizer->asShape(); 429 if ( shape->_type.compare("dxf") == 0 or shape->_type.compare("stl") == 0) {430 QString msg = tr("Texture feature is not applicable for %1 files.").arg(shape->_type.c ompare("dxf") == 0 ? "DXF" : "STL");429 if (isSimpleCADType(shape->_type)) { 430 QString msg = tr("Texture feature is not applicable for %1 files.").arg(shape->_type.c_str()); 431 431 MessagesWidget::instance()->addGUIMessage(MessageItem(MessageItem::Modelica, msg, 432 432 Helper::scriptingKind, Helper::notificationLevel)); … … 455 455 if (mpSelectedVisualizer->isShape()) { 456 456 ShapeObject* shape = mpSelectedVisualizer->asShape(); 457 if ( shape->_type.compare("dxf") == 0 or shape->_type.compare("stl") == 0) {458 QString msg = tr("Texture feature is not applicable for %1 files.").arg(shape->_type.c ompare("dxf") == 0 ? "DXF" : "STL");457 if (isSimpleCADType(shape->_type)) { 458 QString msg = tr("Texture feature is not applicable for %1 files.").arg(shape->_type.c_str()); 459 459 MessagesWidget::instance()->addGUIMessage(MessageItem(MessageItem::Modelica, msg, 460 460 Helper::scriptingKind, Helper::notificationLevel)); -
OMEdit/OMEditLIB/Animation/ViewerWidget.h
r740a8c7 r7aafc15 48 48 49 49 #include "AbstractAnimationWindow.h" 50 #include "AnimationUtil.h" 50 51 #include "Util/Helper.h" 51 52 -
OMEdit/OMEditLIB/Animation/Visualization.cpp
re757cda7 r7aafc15 330 330 331 331 if (isDXFFile(shape._fileName)) { 332 shape._type = " dxf";332 shape._type = "DXF"; 333 333 } else if (isSTLFile(shape._fileName)) { 334 shape._type = " stl";334 shape._type = "STL"; 335 335 } else if (isOBJFile(shape._fileName)) { 336 shape._type = " obj";336 shape._type = "OBJ"; 337 337 } else if (is3DSFile(shape._fileName)) { 338 shape._type = "3 ds";338 shape._type = "3DS"; 339 339 } 340 340 } … … 796 796 // Store the radius of relevant shapes 797 797 for (ShapeObject& shape : relevantShapes) { 798 // Consider OpenSceneGraph shape drawables only 799 if (shape._type.compare("dxf") == 0 || shape._type.compare("stl") == 0 || 800 shape._type.compare("obj") == 0 || shape._type.compare("3ds") == 0) { 798 // Consider OSG shape drawables only 799 if (isCADType(shape._type)) { 801 800 continue; 802 801 } … … 1288 1287 transf->setName(shape._id); 1289 1288 1290 if ( shape._type.compare("obj") == 0 or shape._type.compare("3ds") == 0)1289 if (isAdvancedCADType(shape._type)) 1291 1290 { //advanced cad node 1292 1291 //std::cout<<"It's an advanced cad and the filename is "<<shape._fileName<<std::endl; … … 1299 1298 } 1300 1299 } 1301 else if ( shape._type.compare("stl") == 0)1300 else if (isSTLType(shape._type)) 1302 1301 { //stl node 1303 1302 //std::cout<<"It's a stl and the filename is "<<shape._fileName<<std::endl; … … 1312 1311 } 1313 1312 } 1314 else if ( shape._type.compare("dxf") == 0)1313 else if (isDXFType(shape._type)) 1315 1314 { //geode with dxf drawable 1316 1315 //std::cout<<"It's a dxf and the filename is "<<shape._fileName<<std::endl; … … 1430 1429 { 1431 1430 ShapeObject* shape = _visualizer->asShape(); 1432 if (shape->_type.compare("dxf") == 0 or shape->_type.compare("stl") == 0 or 1433 shape->_type.compare("obj") == 0 or shape->_type.compare("3ds") == 0) 1431 if (isCADType(shape->_type)) 1434 1432 { 1435 1433 //it's a cad file so we have to rescale the underlying geometry vertices … … 1568 1566 if (_visualizer->isShape()) { 1569 1567 ShapeObject* shape = _visualizer->asShape(); 1570 if (shape->_type.compare("dxf") == 0 or shape->_type.compare("stl") == 0 or 1571 shape->_type.compare("obj") == 0 or shape->_type.compare("3ds") == 0) { 1568 if (isCADType(shape->_type)) { 1572 1569 osg::ref_ptr<osg::Transform> transformNode = shape->getTransformNode(); 1573 1570 if (transformNode.valid() && transformNode->getNumChildren() > 0) { … … 1576 1573 stateSet = cad->getOrCreateStateSet(); 1577 1574 geometryColors = !shape->getVisualProperties()->getColor().custom(); 1578 is3DSShape = shape->_type.compare("3ds") == 0;1575 is3DSShape = is3DSType(shape->_type); 1579 1576 } 1580 1577 } … … 1891 1888 1892 1889 osg::Matrix3 T0; 1893 if ( type == "dxf" || type == "stl" || type == "obj" || type == "3ds")1890 if (isCADType(type)) 1894 1891 { 1895 1892 T0 = osg::Matrix3(dirs._lDir[0], dirs._lDir[1], dirs._lDir[2],
Note: See TracChangeset
for help on using the changeset viewer.