Commit d446fc9e authored by Jan Möbius's avatar Jan Möbius

Get rid of constant ids in MeshObject. (Hopefully this works!)

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@8346 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 561f5e15
...@@ -302,7 +302,7 @@ bool getAllMeshes( std::vector<int>& _identifiers ) { ...@@ -302,7 +302,7 @@ bool getAllMeshes( std::vector<int>& _identifiers ) {
_identifiers.clear(); _identifiers.clear();
// find changed manipulator // find changed manipulator
for ( PluginFunctions::ObjectIterator o_it(PluginFunctions::ALL_OBJECTS,DATA_TRIANGLE_MESH) ; for ( PluginFunctions::ObjectIterator o_it(PluginFunctions::ALL_OBJECTS,typeId("TriangleMesh")) ;
o_it != PluginFunctions::objectsEnd(); ++o_it) { o_it != PluginFunctions::objectsEnd(); ++o_it) {
_identifiers.push_back( o_it->id() ); _identifiers.push_back( o_it->id() );
} }
...@@ -894,7 +894,7 @@ void get_all_objects( std::vector < BaseObjectData*>& _objects ) { ...@@ -894,7 +894,7 @@ void get_all_objects( std::vector < BaseObjectData*>& _objects ) {
_objects.clear(); _objects.clear();
// find changed manipulator // find changed manipulator
for ( PluginFunctions::ObjectIterator o_it(PluginFunctions::ALL_OBJECTS,DATA_TRIANGLE_MESH) ; for ( PluginFunctions::ObjectIterator o_it(PluginFunctions::ALL_OBJECTS,DATA_ALL) ;
o_it != PluginFunctions::objectsEnd(); ++o_it) { o_it != PluginFunctions::objectsEnd(); ++o_it) {
_objects.push_back( *o_it ); _objects.push_back( *o_it );
} }
......
...@@ -650,7 +650,7 @@ void Core::openIniFile( QString _filename, ...@@ -650,7 +650,7 @@ void Core::openIniFile( QString _filename,
} }
int tmpType; int tmpType;
DataType type = DATA_TRIANGLE_MESH; DataType type = typeId("TriangleMesh");
// First check for old datatype style (Only numbers .. therefore not consistent for runtime added types) // First check for old datatype style (Only numbers .. therefore not consistent for runtime added types)
if ( ini.get_entry( tmpType, sectionName , "type" )) { if ( ini.get_entry( tmpType, sectionName , "type" )) {
......
...@@ -172,7 +172,6 @@ void BaseObject::persistentId( int _id ) { ...@@ -172,7 +172,6 @@ void BaseObject::persistentId( int _id ) {
void BaseObject::cleanup() { void BaseObject::cleanup() {
persistentId_ = -1; persistentId_ = -1;
objectType_ = DATA_UNKNOWN;
flags_.clear(); flags_.clear();
......
...@@ -83,14 +83,6 @@ ...@@ -83,14 +83,6 @@
/// Items used for Grouping /// Items used for Grouping
#define DATA_GROUP 1 #define DATA_GROUP 1
/// Triangle Mesh objects
#define DATA_TRIANGLE_MESH typeId("TriangleMesh")
#define DATA_TRIANGLE_MESH_CONST_ID 2
/// Poly Mesh Objects
#define DATA_POLY_MESH typeId("PolyMesh")
#define DATA_POLY_MESH_CONST_ID 4
/// Identifier for all available objects /// Identifier for all available objects
const unsigned int DATA_ALL = UINT_MAX; const unsigned int DATA_ALL = UINT_MAX;
......
...@@ -67,7 +67,7 @@ ...@@ -67,7 +67,7 @@
/** This field defines the start id for custom datatypes. It starts high to avoid conflicts with previously /** This field defines the start id for custom datatypes. It starts high to avoid conflicts with previously
* hardcoded versions. * hardcoded versions.
*/ */
static int nextTypeId_ = 8; static int nextTypeId_ = 2;
/** This map maps an dataType id to an typeName /** This map maps an dataType id to an typeName
*/ */
...@@ -126,29 +126,16 @@ void initializeTypes() { ...@@ -126,29 +126,16 @@ void initializeTypes() {
typeToTypeInfo[DATA_GROUP] = types.size(); typeToTypeInfo[DATA_GROUP] = types.size();
types.push_back( TypeInfo(DATA_GROUP ,"Group" ,"group.png", QCoreApplication::translate("Types","Group")) ); types.push_back( TypeInfo(DATA_GROUP ,"Group" ,"group.png", QCoreApplication::translate("Types","Group")) );
stringToTypeInfo["TriangleMesh"] = types.size();
typeToTypeInfo[DATA_TRIANGLE_MESH_CONST_ID] = types.size();
types.push_back( TypeInfo(DATA_TRIANGLE_MESH_CONST_ID ,"TriangleMesh" ,"TriangleType.png", QCoreApplication::translate("Types","Triangle Mesh")) );
stringToTypeInfo["PolyMesh"] = types.size();
typeToTypeInfo[DATA_POLY_MESH_CONST_ID] = types.size();
types.push_back( TypeInfo(DATA_POLY_MESH_CONST_ID ,"PolyMesh" ,"PolyType.png", QCoreApplication::translate("Types","Poly Mesh")) );
stringToTypeInfo["All"] = types.size(); stringToTypeInfo["All"] = types.size();
typeToTypeInfo[DATA_ALL] = types.size(); typeToTypeInfo[DATA_ALL] = types.size();
types.push_back( TypeInfo(DATA_ALL ,"All" ,"Unknown.png", QCoreApplication::translate("Types","All")) ); types.push_back( TypeInfo(DATA_ALL ,"All" ,"Unknown.png", QCoreApplication::translate("Types","All")) );
typeToString[DATA_UNKNOWN] = "Unknown"; typeToString[DATA_UNKNOWN] = "Unknown";
typeToString[DATA_GROUP] = "Group"; typeToString[DATA_GROUP] = "Group";
typeToString[DATA_TRIANGLE_MESH_CONST_ID] = "TriangleMesh";
typeToString[DATA_POLY_MESH_CONST_ID] = "PolyMesh";
typeToString[DATA_ALL] = "All"; typeToString[DATA_ALL] = "All";
// Preload the static icons // Preload the static icons
setTypeIcon(DATA_GROUP,"group.png"); setTypeIcon(DATA_GROUP,"group.png");
setTypeIcon(DATA_TRIANGLE_MESH_CONST_ID,"TriangleType.png");
setTypeIcon(DATA_POLY_MESH_CONST_ID,"PolyType.png");
} }
/// Adds a datatype and returns the id for the new type /// Adds a datatype and returns the id for the new type
......
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