50 #ifndef FILEOBJPLUGIN_HH
51 #define FILEOBJPLUGIN_HH
64 #include <OpenFlipper/BasePlugin/TextureInterface.hh>
69 #ifdef ENABLE_BSPLINECURVE_SUPPORT
73 #ifdef ENABLE_BSPLINESURFACE_SUPPORT
77 #include "OBJImporter.hh"
78 #include "Material.hh"
101 #if QT_VERSION >= 0x050000
102 Q_PLUGIN_METADATA(IID
"org.OpenFlipper.Plugins.Plugin-FileOBJ")
105 void openedFile(
int _id );
106 void addEmptyObject(
DataType _type,
int& _id);
107 void load(QString _filename,
DataType _type,
int& _id);
108 void save(
int _id , QString _filename );
109 void log(
Logtype _type, QString _message);
110 void log(QString _message);
112 void updatedObject(
int _identifier,
const UpdateType& _type);
114 void deleteObject(
int _id );
117 void showStatusMessage(QString _message,
int _timeout = 0);
121 void pluginExists( QString _pluginName ,
bool& _exists );
124 void setTextureMode(QString _textureName, QString _mode,
int _id );
125 void switchTexture( QString _textureName,
int _id );
126 void addMultiTexture( QString _textureGroup, QString _name, QString _filename,
int _id,
int& _textureId);
127 void textureFilename(
int , QString , QString& );
128 void textureIndex(QString _name,
int _id,
int& _index);
129 void getCurrentTexture(
int , QString& );
130 void textureName (
int,
int, QString &);
131 void getSubTextures (
int, QString, QStringList &);
132 void textureIndexPropertyName(
int, QString&);
136 void fileOpened(
int ){};
148 void slotHandleCheckBoxes(
bool _checked);
150 void handleTrimeshDialog();
158 QString
name() {
return (QString(
"FileOBJ")); };
159 QString
description( ) {
return (QString(tr(
"Load/Save OBJ-Files"))); };
177 bool saveObject(
int _id, QString _filename);
179 QString version() {
return QString(
"1.0"); };
184 void checkTypes(QByteArray& _bufferedFile, QString _filename,
OBJImporter& _importer, QStringList& _includes);
186 bool readMaterial(QString _filename,
OBJImporter& _importer);
187 void readOBJFile(QByteArray& _bufferedFile, QString _filename,
OBJImporter& _importer);
188 void createAllGroupObjects(
OBJImporter& _importer);
190 template <
class MeshT>
192 void addTextures(
OBJImporter& _importer,
int _objectID );
202 template<
class MeshT >
206 template<
class MeshT >
207 bool writeMaterial(QString _filename, MeshT& _mesh,
int _objId );
209 template<
class MeshT >
210 bool writeMesh(std::ostream& _out, QString _filename, MeshT& _mesh,
int _objId);
212 #ifdef ENABLE_BSPLINECURVE_SUPPORT
213 bool writeCurve(std::ostream& _out, QString _filename,
BSplineCurve* _curve );
216 #ifdef ENABLE_BSPLINESURFACE_SUPPORT
217 bool writeSurface(std::ostream& _out, QString _filename,
BSplineSurface* _surface );
224 QWidget* loadOptions_;
225 QWidget* saveOptions_;
227 QCheckBox* saveBinary_;
228 QCheckBox* saveVertexColor_;
229 QCheckBox* saveFaceColor_;
230 QCheckBox* saveAlpha_;
231 QCheckBox* saveNormals_;
232 QCheckBox* saveTexCoords_;
233 QCheckBox* saveTextures_;
234 QCheckBox* saveCopyTextures_;
235 QCheckBox* saveCreateTexFolder_;
236 QLabel* savePrecisionLabel_;
237 QSpinBox* savePrecision_;
238 QPushButton* saveDefaultButton_;
241 QComboBox* triMeshHandling_;
242 QCheckBox* loadVertexColor_;
243 QCheckBox* loadFaceColor_;
244 QCheckBox* loadAlpha_;
245 QCheckBox* loadNormals_;
246 QCheckBox* loadTexCoords_;
247 QCheckBox* loadTextures_;
248 QPushButton* loadDefaultButton_;
250 bool forceTriangleMesh_;
253 QString textureIndexPropertyName_;
254 bool textureIndexPropFetched_;
255 std::map<int,QString> texIndexFileMap_;
256 OBJImporter::ObjectOptionsE trimeshOptions_;
260 #if defined(INCLUDE_TEMPLATES) && !defined(FILEOBJPLUGIN_C)
261 #define FILEOBJPLUGIN_TEMPLATES
262 #include "FileOBJT.cc"
266 #endif //FILEOBJPLUGIN_HH
void slotSaveDefault()
Slot called when user wants to save the given Save options as default.
QWidget * loadOptionsWidget(QString)
Interface class from which all plugins have to be created.
Logtype
Log types for Message Window.
bool writeMaterial(QString _filename, MeshT &_mesh, int _objId)
writer functions
FileOBJPlugin()
Constructor.
applicationStatus
Enum for the statusBar Status Icon.
QString description()
Return a description of what the plugin is doing.
Interface for all Plugins which do logging to the logging window of the framework.
QString name()
Return a name for the plugin.
Interface class for file handling.
Interface to call functions across plugins.
void convertToOBJName(QString &_name)
Convert non-valid filenames (e.g. of groups that end with .jpg) to valid .objs.
void slotLoadDefault()
Slot called when user wants to save the given Load options as default.
Interface for all Plugins which provide scriptable Functions.
void initializePlugin()
Initialize Plugin.
void checkTypes(QByteArray &_bufferedFile, QString _filename, OBJImporter &_importer, QStringList &_includes)
Reader functions.
void backupTextureCoordinates(MeshT &_mesh)
creates a backup of the original per vertex/face texture coordinates
Interface for all plugins which want to Load or Save files and create Objects.
Handle for a face entity.
int loadObject(QString _filename)
Loads Object and converts it to a triangle mesh if possible.
Control OpenFlippers status bar.
Provide texture support for a plugin.
DataType supportedType()
Return your supported object type( e.g. DATA_TRIANGLE_MESH )
DrawMode NONE
not a valid draw mode
MaterialList materials_
List that contains the material properties.
QWidget * saveOptionsWidget(QString)