Commit f3006722 authored by Max Lyon's avatar Max Lyon

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:
/// Adds a new property to the mesh.
void addProperty(QString propName, QString friendlyTypeName, PropertyInfo::ENTITY_FILTER filter);
void initializeSupportedPropertyTypes();
private:
MeshT* mesh_;
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;
const PropertyInfo* mCombineProperty1;
const PropertyInfo* mCombineProperty2;
......@@ -178,6 +166,19 @@ private:
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)
......
......@@ -59,7 +59,16 @@ OMPropertyModel<MeshT>::OMPropertyModel(MeshT* mesh, int objectID, QObject *pare
objectID_(objectID),
mCombineProperty1(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();
bCombine.setText(tr("Combine"));
......@@ -85,6 +94,8 @@ OMPropertyModel<MeshT>::OMPropertyModel(MeshT* mesh, int objectID, QObject *pare
lastPickMode = PluginFunctions::pickMode();
lastActionMode = PluginFunctions::actionMode();
initializeSupportedPropertyTypes();
}
......@@ -682,53 +693,33 @@ void OMPropertyModel<MeshT>:: addProperty(QString propName, QString friendlyType
}
template <typename MeshT>
const TypeInfoWrapper OMPropertyModel<MeshT>::proptype_bool =
TypeInfoWrapper(typeid(OpenMesh::PropertyT<bool>), "bool");
template <typename MeshT>
const TypeInfoWrapper OMPropertyModel<MeshT>::proptype_int =
TypeInfoWrapper(typeid(OpenMesh::PropertyT<int>), "int");
template <typename MeshT>
const TypeInfoWrapper OMPropertyModel<MeshT>::proptype_uint =
TypeInfoWrapper(typeid(OpenMesh::PropertyT<unsigned int>), "unsigned int");
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");
template<typename MeshT>
void OMPropertyModel<MeshT>::initializeSupportedPropertyTypes()
{
supportedPropertyTypes.insert(proptype_bool);
supportedPropertyTypes.insert(proptype_int);
supportedPropertyTypes.insert(proptype_uint);
supportedPropertyTypes.insert(proptype_double);
supportedPropertyTypes.insert(proptype_Vec3d);
supportedPropertyTypes.insert(proptype_Vec3f);
#ifdef ENABLE_SKELETON_SUPPORT
template <typename MeshT>
const TypeInfoWrapper OMPropertyModel<MeshT>::proptype_SkinWeights =
TypeInfoWrapper(typeid(OpenMesh::PropertyT<BaseSkin::SkinWeights>), "SkinWeights");
supportedPropertyTypes.insert(proptype_SkinWeights);
#endif
template <typename MeshT>
const TypeInfoWrapper OMPropertyModel<MeshT>::propertyTypes[] = { OMPropertyModel<MeshT>::proptype_bool,
OMPropertyModel<MeshT>::proptype_int,
OMPropertyModel<MeshT>::proptype_uint,
OMPropertyModel<MeshT>::proptype_double,
OMPropertyModel<MeshT>::proptype_Vec3d,
OMPropertyModel<MeshT>::proptype_Vec3f,
#ifdef ENABLE_SKELETON_SUPPORT
OMPropertyModel<MeshT>::proptype_SkinWeights,
#endif
};
//#ifdef ENABLE_SKELETON_SUPPORT
// //template <typename MeshT>
// //const typename OMPropertyModel<MeshT>::TypeInfoWrapperSet OMPropertyModel<MeshT>::supportedPropertyTypes =
// // (OpenFlipper::Options::nogui() ? typename OMPropertyModel<MeshT>::TypeInfoWrapperSet() : typename OMPropertyModel<MeshT>::TypeInfoWrapperSet(propertyTypes, propertyTypes + 7));
// supportedPropertyTypes = typename OMPropertyModel<MeshT>::TypeInfoWrapperSet();
//#else
// //const typename OMPropertyModel<MeshT>::TypeInfoWrapperSet OMPropertyModel<MeshT>::supportedPropertyTypes =
// // (OpenFlipper::Options::nogui() ? typename OMPropertyModel<MeshT>::TypeInfoWrapperSet() : typename OMPropertyModel<MeshT>::TypeInfoWrapperSet(propertyTypes, propertyTypes + 6));
// supportedPropertyTypes = typename OMPropertyModel<MeshT>::TypeInfoWrapperSet();
//#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:
/// Adds a new property to the mesh.
void addProperty(QString propName, QString friendlyTypeName, PropertyInfo::ENTITY_FILTER filter);
void initializeSupportedPropertyTypes();
MeshT* mesh_;
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;
const PropertyInfo* mCombineProperty1;
const PropertyInfo* mCombineProperty2;
......@@ -205,62 +185,28 @@ private:
std::string lastPickMode;
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) \
template <typename MeshT> \
const TypeInfoWrapper OVMPropertyModel<MeshT>::proptype_##primitive##_bool = \
TypeInfoWrapper(typeid(OpenVolumeMesh::primitive##PropertyT<bool>), "bool"); \
template <typename MeshT> \
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*/));
#undef DECLARE_PROPTYPES
typedef std::set<TypeInfoWrapper> TypeInfoWrapperSet;
TypeInfoWrapperSet supportedPropertyTypes;
};
#if defined(INCLUDE_TEMPLATES) && !defined(OVM_PROPERTY_MODEL_CC)
......
......@@ -38,13 +38,28 @@
#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>
OVMPropertyModel<MeshT>::OVMPropertyModel(MeshT* mesh, int objectID, QObject *parent)
: OVMPropertyModelSubclass(parent),
mesh_(mesh),
objectID_(objectID),
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();
bCombine.setText(tr("Combine"));
......@@ -67,8 +82,12 @@ OVMPropertyModel<MeshT>::OVMPropertyModel(MeshT* mesh, int objectID, QObject *pa
mPickWidget.hide();
QString iconPath = OpenFlipper::Options::iconDirStr() + OpenFlipper::Options::dirSeparator();
mPickWidget.pickButton->setIcon( QIcon(iconPath + "color-picker.png") );
initializeSupportedPropertyTypes();
}
#undef INITIALIZE_PROPTYPES
template <typename MeshT>
void OVMPropertyModel<MeshT>::updateWidget(const QModelIndexList& selectedIndices)
{
......@@ -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 */
......@@ -76,38 +76,40 @@ propertyModel_(0)
void PropertyVisPlugin::initializePlugin()
{
if ( OpenFlipper::Options::gui() ) {
tool_ = new PropertyVisToolbar();
if ( OpenFlipper::Options::gui() ) {
tool_ = new PropertyVisToolbar();
QSize size(300,300);
tool_->resize(size);
QSize size(300,300);
tool_->resize(size);
// connect toolbox elements
connect(tool_->meshNames, SIGNAL( currentIndexChanged(int) ), this, SLOT( slotMeshChanged(int) ) );
tool_->meshNames->setModel(&objectListItemModel_);
connect(tool_->visualizeButton, SIGNAL( clicked() ), this, SLOT( slotVisualize() ) );
connect(tool_->clearButton, SIGNAL( clicked() ), this, SLOT( slotAllCleared() ) );
emit addHiddenPickMode( PROP_VIS );
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() ) );
QIcon* toolIcon = new QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"PropertyVisIcon.png");
connect(tool_, SIGNAL( widgetShown() ), this, SLOT( updateGUI() ) );
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 );
}
emit addToolbox( tr("Property Visualization") , tool_, toolIcon );
}
}
//-----------------------------------------------------------------------------
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()
void PropertyVisPlugin::slotObjectUpdated( int _identifier, const UpdateType& _type )
{
if( OpenFlipper::Options::gui() && tool_->isVisible() )
updateGUI();
if( OpenFlipper::Options::gui() )
if ( tool_->isVisible() )
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