Commit f3006722 authored by Max Lyon's avatar Max Lyon
Browse files

Fixed mac crashes



git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@15826 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 4e497eb9
...@@ -146,26 +146,14 @@ private: ...@@ -146,26 +146,14 @@ private:
/// Adds a new property to the mesh. /// Adds a new property to the mesh.
void addProperty(QString propName, QString friendlyTypeName, PropertyInfo::ENTITY_FILTER filter); void addProperty(QString propName, QString friendlyTypeName, PropertyInfo::ENTITY_FILTER filter);
void initializeSupportedPropertyTypes();
private: private:
MeshT* mesh_; MeshT* mesh_;
int objectID_; int objectID_;
static const TypeInfoWrapper proptype_bool;
static const TypeInfoWrapper proptype_int;
static const TypeInfoWrapper proptype_uint;
static const TypeInfoWrapper proptype_double;
static const TypeInfoWrapper proptype_Vec3d;
static const TypeInfoWrapper proptype_Vec3f;
#ifdef ENABLE_SKELETON_SUPPORT
static const TypeInfoWrapper proptype_SkinWeights;
#endif
typedef std::set<TypeInfoWrapper> TypeInfoWrapperSet;
static const TypeInfoWrapper propertyTypes[];
static const TypeInfoWrapperSet supportedPropertyTypes;
QPushButton bCombine; QPushButton bCombine;
const PropertyInfo* mCombineProperty1; const PropertyInfo* mCombineProperty1;
const PropertyInfo* mCombineProperty2; const PropertyInfo* mCombineProperty2;
...@@ -178,6 +166,19 @@ private: ...@@ -178,6 +166,19 @@ private:
Viewer::ActionMode lastActionMode; Viewer::ActionMode lastActionMode;
TypeInfoWrapper proptype_bool;
TypeInfoWrapper proptype_int;
TypeInfoWrapper proptype_uint;
TypeInfoWrapper proptype_double;
TypeInfoWrapper proptype_Vec3d;
TypeInfoWrapper proptype_Vec3f;
#ifdef ENABLE_SKELETON_SUPPORT
TypeInfoWrapper proptype_SkinWeights;
#endif
typedef std::set<TypeInfoWrapper> TypeInfoWrapperSet;
TypeInfoWrapperSet supportedPropertyTypes;
}; };
#if defined(INCLUDE_TEMPLATES) && !defined(OM_PROPERTY_MODEL_CC) #if defined(INCLUDE_TEMPLATES) && !defined(OM_PROPERTY_MODEL_CC)
......
...@@ -59,7 +59,16 @@ OMPropertyModel<MeshT>::OMPropertyModel(MeshT* mesh, int objectID, QObject *pare ...@@ -59,7 +59,16 @@ OMPropertyModel<MeshT>::OMPropertyModel(MeshT* mesh, int objectID, QObject *pare
objectID_(objectID), objectID_(objectID),
mCombineProperty1(0), mCombineProperty1(0),
mCombineProperty2(0), mCombineProperty2(0),
pickModeActive(false) pickModeActive(false),
proptype_bool(TypeInfoWrapper(typeid(OpenMesh::PropertyT<bool>), "bool")),
proptype_int(TypeInfoWrapper(typeid(OpenMesh::PropertyT<int>), "int")),
proptype_uint(TypeInfoWrapper(typeid(OpenMesh::PropertyT<unsigned int>), "unsigned int")),
proptype_double(TypeInfoWrapper(typeid(OpenMesh::PropertyT<double>), "double")),
proptype_Vec3d(TypeInfoWrapper(typeid(OpenMesh::PropertyT<ACG::Vec3d>), "Vec3d")),
proptype_Vec3f(TypeInfoWrapper(typeid(OpenMesh::PropertyT<ACG::Vec3f>), "Vec3f"))
#ifdef ENABLE_SKELETON_SUPPORT
,proptype_SkinWeights(TypeInfoWrapper(typeid(OpenMesh::PropertyT<BaseSkin::SkinWeights>), "SkinWeights"))
#endif
{ {
gatherProperties(); gatherProperties();
bCombine.setText(tr("Combine")); bCombine.setText(tr("Combine"));
...@@ -85,6 +94,8 @@ OMPropertyModel<MeshT>::OMPropertyModel(MeshT* mesh, int objectID, QObject *pare ...@@ -85,6 +94,8 @@ OMPropertyModel<MeshT>::OMPropertyModel(MeshT* mesh, int objectID, QObject *pare
lastPickMode = PluginFunctions::pickMode(); lastPickMode = PluginFunctions::pickMode();
lastActionMode = PluginFunctions::actionMode(); lastActionMode = PluginFunctions::actionMode();
initializeSupportedPropertyTypes();
} }
...@@ -682,53 +693,33 @@ void OMPropertyModel<MeshT>:: addProperty(QString propName, QString friendlyType ...@@ -682,53 +693,33 @@ void OMPropertyModel<MeshT>:: addProperty(QString propName, QString friendlyType
} }
template <typename MeshT> template<typename MeshT>
const TypeInfoWrapper OMPropertyModel<MeshT>::proptype_bool = void OMPropertyModel<MeshT>::initializeSupportedPropertyTypes()
TypeInfoWrapper(typeid(OpenMesh::PropertyT<bool>), "bool"); {
template <typename MeshT>
const TypeInfoWrapper OMPropertyModel<MeshT>::proptype_int = supportedPropertyTypes.insert(proptype_bool);
TypeInfoWrapper(typeid(OpenMesh::PropertyT<int>), "int"); supportedPropertyTypes.insert(proptype_int);
supportedPropertyTypes.insert(proptype_uint);
template <typename MeshT> supportedPropertyTypes.insert(proptype_double);
const TypeInfoWrapper OMPropertyModel<MeshT>::proptype_uint = supportedPropertyTypes.insert(proptype_Vec3d);
TypeInfoWrapper(typeid(OpenMesh::PropertyT<unsigned int>), "unsigned int"); supportedPropertyTypes.insert(proptype_Vec3f);
template <typename MeshT>
const TypeInfoWrapper OMPropertyModel<MeshT>::proptype_double =
TypeInfoWrapper(typeid(OpenMesh::PropertyT<double>), "double");
template <typename MeshT>
const TypeInfoWrapper OMPropertyModel<MeshT>::proptype_Vec3d =
TypeInfoWrapper(typeid(OpenMesh::PropertyT<ACG::Vec3d>), "Vec3d");
template <typename MeshT>
const TypeInfoWrapper OMPropertyModel<MeshT>::proptype_Vec3f =
TypeInfoWrapper(typeid(OpenMesh::PropertyT<ACG::Vec3f>), "Vec3f");
#ifdef ENABLE_SKELETON_SUPPORT #ifdef ENABLE_SKELETON_SUPPORT
template <typename MeshT> supportedPropertyTypes.insert(proptype_SkinWeights);
const TypeInfoWrapper OMPropertyModel<MeshT>::proptype_SkinWeights =
TypeInfoWrapper(typeid(OpenMesh::PropertyT<BaseSkin::SkinWeights>), "SkinWeights");
#endif #endif
template <typename MeshT> //#ifdef ENABLE_SKELETON_SUPPORT
const TypeInfoWrapper OMPropertyModel<MeshT>::propertyTypes[] = { OMPropertyModel<MeshT>::proptype_bool, // //template <typename MeshT>
OMPropertyModel<MeshT>::proptype_int, // //const typename OMPropertyModel<MeshT>::TypeInfoWrapperSet OMPropertyModel<MeshT>::supportedPropertyTypes =
OMPropertyModel<MeshT>::proptype_uint, // // (OpenFlipper::Options::nogui() ? typename OMPropertyModel<MeshT>::TypeInfoWrapperSet() : typename OMPropertyModel<MeshT>::TypeInfoWrapperSet(propertyTypes, propertyTypes + 7));
OMPropertyModel<MeshT>::proptype_double, // supportedPropertyTypes = typename OMPropertyModel<MeshT>::TypeInfoWrapperSet();
OMPropertyModel<MeshT>::proptype_Vec3d, //#else
OMPropertyModel<MeshT>::proptype_Vec3f, // //const typename OMPropertyModel<MeshT>::TypeInfoWrapperSet OMPropertyModel<MeshT>::supportedPropertyTypes =
#ifdef ENABLE_SKELETON_SUPPORT // // (OpenFlipper::Options::nogui() ? typename OMPropertyModel<MeshT>::TypeInfoWrapperSet() : typename OMPropertyModel<MeshT>::TypeInfoWrapperSet(propertyTypes, propertyTypes + 6));
OMPropertyModel<MeshT>::proptype_SkinWeights, // supportedPropertyTypes = typename OMPropertyModel<MeshT>::TypeInfoWrapperSet();
#endif //#endif
};
}
#ifdef ENABLE_SKELETON_SUPPORT
template <typename MeshT>
const typename OMPropertyModel<MeshT>::TypeInfoWrapperSet OMPropertyModel<MeshT>::supportedPropertyTypes(propertyTypes, propertyTypes + 7);
#else
template <typename MeshT>
const typename OMPropertyModel<MeshT>::TypeInfoWrapperSet OMPropertyModel<MeshT>::supportedPropertyTypes(propertyTypes, propertyTypes + 6);
#endif
...@@ -167,32 +167,12 @@ private: ...@@ -167,32 +167,12 @@ private:
/// Adds a new property to the mesh. /// Adds a new property to the mesh.
void addProperty(QString propName, QString friendlyTypeName, PropertyInfo::ENTITY_FILTER filter); void addProperty(QString propName, QString friendlyTypeName, PropertyInfo::ENTITY_FILTER filter);
void initializeSupportedPropertyTypes();
MeshT* mesh_; MeshT* mesh_;
int objectID_; int objectID_;
#define DECLARE_PROPTYPES(primitive) \
static const TypeInfoWrapper proptype_##primitive##_bool; \
static const TypeInfoWrapper proptype_##primitive##_int; \
static const TypeInfoWrapper proptype_##primitive##_uint; \
static const TypeInfoWrapper proptype_##primitive##_double; \
static const TypeInfoWrapper proptype_##primitive##_Vec3d; \
static const TypeInfoWrapper proptype_##primitive##_Vec3f;
DECLARE_PROPTYPES(Cell)
DECLARE_PROPTYPES(Face)
DECLARE_PROPTYPES(HalfFace)
DECLARE_PROPTYPES(Edge)
DECLARE_PROPTYPES(HalfEdge)
DECLARE_PROPTYPES(Vertex)
#undef DECLARE_PROPTYPES
typedef std::set<TypeInfoWrapper> TypeInfoWrapperSet;
static const TypeInfoWrapper propertyTypes[];
static const TypeInfoWrapperSet supportedPropertyTypes;
QPushButton bCombine; QPushButton bCombine;
const PropertyInfo* mCombineProperty1; const PropertyInfo* mCombineProperty1;
const PropertyInfo* mCombineProperty2; const PropertyInfo* mCombineProperty2;
...@@ -205,62 +185,28 @@ private: ...@@ -205,62 +185,28 @@ private:
std::string lastPickMode; std::string lastPickMode;
Viewer::ActionMode lastActionMode; Viewer::ActionMode lastActionMode;
}; #define DECLARE_PROPTYPES(primitive) \
TypeInfoWrapper proptype_##primitive##_bool; \
TypeInfoWrapper proptype_##primitive##_int; \
TypeInfoWrapper proptype_##primitive##_uint; \
TypeInfoWrapper proptype_##primitive##_double; \
TypeInfoWrapper proptype_##primitive##_Vec3d; \
TypeInfoWrapper proptype_##primitive##_Vec3f;
DECLARE_PROPTYPES(Cell)
DECLARE_PROPTYPES(Face)
DECLARE_PROPTYPES(HalfFace)
DECLARE_PROPTYPES(Edge)
DECLARE_PROPTYPES(HalfEdge)
DECLARE_PROPTYPES(Vertex)
#define INITIALIZE_PROPTYPES(primitive) \ #undef DECLARE_PROPTYPES
template <typename MeshT> \
const TypeInfoWrapper OVMPropertyModel<MeshT>::proptype_##primitive##_bool = \
TypeInfoWrapper(typeid(OpenVolumeMesh::primitive##PropertyT<bool>), "bool"); \ typedef std::set<TypeInfoWrapper> TypeInfoWrapperSet;
template <typename MeshT> \ TypeInfoWrapperSet supportedPropertyTypes;
const TypeInfoWrapper OVMPropertyModel<MeshT>::proptype_##primitive##_int = \
TypeInfoWrapper(typeid(OpenVolumeMesh::primitive##PropertyT<int>), "int"); \ };
template <typename MeshT> \
const TypeInfoWrapper OVMPropertyModel<MeshT>::proptype_##primitive##_uint = \
TypeInfoWrapper(typeid(OpenVolumeMesh::primitive##PropertyT<unsigned int>), "unsigned int"); \
template <typename MeshT> \
const TypeInfoWrapper OVMPropertyModel<MeshT>::proptype_##primitive##_double = \
TypeInfoWrapper(typeid(OpenVolumeMesh::primitive##PropertyT<double>), "double"); \
template <typename MeshT> \
const TypeInfoWrapper OVMPropertyModel<MeshT>::proptype_##primitive##_Vec3d = \
TypeInfoWrapper(typeid(OpenVolumeMesh::primitive##PropertyT<ACG::Vec3d>), "Vec3d"); \
template <typename MeshT> \
const TypeInfoWrapper OVMPropertyModel<MeshT>::proptype_##primitive##_Vec3f = \
TypeInfoWrapper(typeid(OpenVolumeMesh::primitive##PropertyT<ACG::Vec3f>), "Vec3f");
INITIALIZE_PROPTYPES(Cell)
INITIALIZE_PROPTYPES(Face)
INITIALIZE_PROPTYPES(HalfFace)
INITIALIZE_PROPTYPES(Edge)
INITIALIZE_PROPTYPES(HalfEdge)
INITIALIZE_PROPTYPES(Vertex)
#undef INITIALIZE_PROPTYPES
#define LIST_PROPTYPES(primitive) \
OVMPropertyModel<MeshT>::proptype_##primitive##_bool, \
OVMPropertyModel<MeshT>::proptype_##primitive##_int, \
OVMPropertyModel<MeshT>::proptype_##primitive##_uint, \
OVMPropertyModel<MeshT>::proptype_##primitive##_double, \
OVMPropertyModel<MeshT>::proptype_##primitive##_Vec3d, \
OVMPropertyModel<MeshT>::proptype_##primitive##_Vec3f
template <typename MeshT>
const TypeInfoWrapper OVMPropertyModel<MeshT>::propertyTypes[] = { LIST_PROPTYPES(Cell),
LIST_PROPTYPES(Face),
LIST_PROPTYPES(HalfFace),
LIST_PROPTYPES(Edge),
LIST_PROPTYPES(HalfEdge),
LIST_PROPTYPES(Vertex)
};
#undef LIST_PROPTYPES
template <typename MeshT>
const typename OVMPropertyModel<MeshT>::TypeInfoWrapperSet OVMPropertyModel<MeshT>::supportedPropertyTypes(propertyTypes, propertyTypes + (6/*num of primitves*/ * 6/*num of types per primitive*/));
#if defined(INCLUDE_TEMPLATES) && !defined(OVM_PROPERTY_MODEL_CC) #if defined(INCLUDE_TEMPLATES) && !defined(OVM_PROPERTY_MODEL_CC)
......
...@@ -38,13 +38,28 @@ ...@@ -38,13 +38,28 @@
#include "OVMPropertyModel.hh" #include "OVMPropertyModel.hh"
#define INITIALIZE_PROPTYPES(primitive) \
proptype_##primitive##_bool(TypeInfoWrapper(typeid(OpenVolumeMesh::primitive##PropertyT<bool>), "bool")), \
proptype_##primitive##_int(TypeInfoWrapper(typeid(OpenVolumeMesh::primitive##PropertyT<int>), "int")), \
proptype_##primitive##_uint(TypeInfoWrapper(typeid(OpenVolumeMesh::primitive##PropertyT<unsigned int>), "unsigned int")), \
proptype_##primitive##_double(TypeInfoWrapper(typeid(OpenVolumeMesh::primitive##PropertyT<double>), "double")), \
proptype_##primitive##_Vec3d(TypeInfoWrapper(typeid(OpenVolumeMesh::primitive##PropertyT<ACG::Vec3d>), "Vec3d")), \
proptype_##primitive##_Vec3f(TypeInfoWrapper(typeid(OpenVolumeMesh::primitive##PropertyT<ACG::Vec3f>), "Vec3f"))
template <typename MeshT> template <typename MeshT>
OVMPropertyModel<MeshT>::OVMPropertyModel(MeshT* mesh, int objectID, QObject *parent) OVMPropertyModel<MeshT>::OVMPropertyModel(MeshT* mesh, int objectID, QObject *parent)
: OVMPropertyModelSubclass(parent), : OVMPropertyModelSubclass(parent),
mesh_(mesh), mesh_(mesh),
objectID_(objectID), objectID_(objectID),
mCombineProperty1(0), mCombineProperty1(0),
mCombineProperty2(0) mCombineProperty2(0),
INITIALIZE_PROPTYPES(Cell),
INITIALIZE_PROPTYPES(Face),
INITIALIZE_PROPTYPES(HalfFace),
INITIALIZE_PROPTYPES(Edge),
INITIALIZE_PROPTYPES(HalfEdge),
INITIALIZE_PROPTYPES(Vertex)
{ {
gatherProperties(); gatherProperties();
bCombine.setText(tr("Combine")); bCombine.setText(tr("Combine"));
...@@ -67,8 +82,12 @@ OVMPropertyModel<MeshT>::OVMPropertyModel(MeshT* mesh, int objectID, QObject *pa ...@@ -67,8 +82,12 @@ OVMPropertyModel<MeshT>::OVMPropertyModel(MeshT* mesh, int objectID, QObject *pa
mPickWidget.hide(); mPickWidget.hide();
QString iconPath = OpenFlipper::Options::iconDirStr() + OpenFlipper::Options::dirSeparator(); QString iconPath = OpenFlipper::Options::iconDirStr() + OpenFlipper::Options::dirSeparator();
mPickWidget.pickButton->setIcon( QIcon(iconPath + "color-picker.png") ); mPickWidget.pickButton->setIcon( QIcon(iconPath + "color-picker.png") );
initializeSupportedPropertyTypes();
} }
#undef INITIALIZE_PROPTYPES
template <typename MeshT> template <typename MeshT>
void OVMPropertyModel<MeshT>::updateWidget(const QModelIndexList& selectedIndices) void OVMPropertyModel<MeshT>::updateWidget(const QModelIndexList& selectedIndices)
{ {
...@@ -815,6 +834,31 @@ void OVMPropertyModel<MeshT>::addProperty(QString propName, QString friendlyType ...@@ -815,6 +834,31 @@ void OVMPropertyModel<MeshT>::addProperty(QString propName, QString friendlyType
} }
} }
}
template <typename MeshT>
void OVMPropertyModel<MeshT>::initializeSupportedPropertyTypes()
{
#define INSERT_PROPTYPES(primitive) \
supportedPropertyTypes.insert(proptype_##primitive##_bool); \
supportedPropertyTypes.insert(proptype_##primitive##_int); \
supportedPropertyTypes.insert(proptype_##primitive##_uint); \
supportedPropertyTypes.insert(proptype_##primitive##_double); \
supportedPropertyTypes.insert(proptype_##primitive##_Vec3d); \
supportedPropertyTypes.insert(proptype_##primitive##_Vec3f); \
INSERT_PROPTYPES(Cell)
INSERT_PROPTYPES(Face)
INSERT_PROPTYPES(HalfFace)
INSERT_PROPTYPES(Edge)
INSERT_PROPTYPES(HalfEdge)
INSERT_PROPTYPES(Vertex)
#undef INITIALIZE_PROPTYPES
} }
#endif /* ENABLE_OPENVOLUMEMESH_SUPPORT */ #endif /* ENABLE_OPENVOLUMEMESH_SUPPORT */
...@@ -76,38 +76,40 @@ propertyModel_(0) ...@@ -76,38 +76,40 @@ propertyModel_(0)
void PropertyVisPlugin::initializePlugin() void PropertyVisPlugin::initializePlugin()
{ {
if ( OpenFlipper::Options::gui() ) { if ( OpenFlipper::Options::gui() ) {
tool_ = new PropertyVisToolbar(); tool_ = new PropertyVisToolbar();
QSize size(300,300); QSize size(300,300);
tool_->resize(size); tool_->resize(size);
// connect toolbox elements tool_->meshNames->setModel(&objectListItemModel_);
connect(tool_->meshNames, SIGNAL( currentIndexChanged(int) ), this, SLOT( slotMeshChanged(int) ) );
connect(tool_->visualizeButton, SIGNAL( clicked() ), this, SLOT( slotVisualize() ) ); emit addHiddenPickMode( PROP_VIS );
connect(tool_->clearButton, SIGNAL( clicked() ), this, SLOT( slotAllCleared() ) );
connect(tool_->refresh_property_names_tb, SIGNAL( clicked() ), this, SLOT( slotMeshChanged() ) ); QIcon* toolIcon = new QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"PropertyVisIcon.png");
connect(tool_->duplicate_property_tb, SIGNAL( clicked() ), this, SLOT( slotDuplicateProperty() ) );
connect(tool_->remove_property_tb, SIGNAL( clicked() ), this, SLOT( slotRemoveProperty() ) );
connect(tool_, SIGNAL( widgetShown() ), this, SLOT( updateGUI() ) ); emit addToolbox( tr("Property Visualization") , tool_, toolIcon );
}
tool_->meshNames->setModel(&objectListItemModel_);
emit addHiddenPickMode( PROP_VIS );
QIcon* toolIcon = new QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"PropertyVisIcon.png");
emit addToolbox( tr("Property Visualization") , tool_, toolIcon );
}
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void PropertyVisPlugin::pluginsInitialized() void PropertyVisPlugin::pluginsInitialized()
{ {
if ( OpenFlipper::Options::gui() ) {
// connect toolbox elements
connect(tool_->meshNames, SIGNAL( currentIndexChanged(int) ), this, SLOT( slotMeshChanged(int) ) );
connect(tool_->visualizeButton, SIGNAL( clicked() ), this, SLOT( slotVisualize() ) );
connect(tool_->clearButton, SIGNAL( clicked() ), this, SLOT( slotAllCleared() ) );
connect(tool_->refresh_property_names_tb, SIGNAL( clicked() ), this, SLOT( slotMeshChanged() ) );
connect(tool_->duplicate_property_tb, SIGNAL( clicked() ), this, SLOT( slotDuplicateProperty() ) );
connect(tool_->remove_property_tb, SIGNAL( clicked() ), this, SLOT( slotRemoveProperty() ) );
connect(tool_, SIGNAL( widgetShown() ), this, SLOT( updateGUI() ) );
}
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
...@@ -131,8 +133,9 @@ void PropertyVisPlugin::slotAllCleared() ...@@ -131,8 +133,9 @@ void PropertyVisPlugin::slotAllCleared()
void PropertyVisPlugin::slotObjectUpdated( int _identifier, const UpdateType& _type ) void PropertyVisPlugin::slotObjectUpdated( int _identifier, const UpdateType& _type )
{ {
if( OpenFlipper::Options::gui() && tool_->isVisible() ) if( OpenFlipper::Options::gui() )
updateGUI(); if ( tool_->isVisible() )
updateGUI();
} }
void PropertyVisPlugin::updateGUI() void PropertyVisPlugin::updateGUI()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment