50 #include <QPushButton> 62 #include <OpenFlipper/BasePlugin/TextureInterface.hh> 68 #ifdef ENABLE_BSPLINECURVE_SUPPORT 72 #ifdef ENABLE_BSPLINESURFACE_SUPPORT 76 #include "OBJImporter.hh" 77 #include "Material.hh" 103 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 );
205 template<
class MeshT >
209 template<
class MeshT >
210 bool writeMaterial(QString _filename, MeshT& _mesh,
int _objId );
212 template<
class MeshT >
213 bool writeMesh(std::ostream& _out, QString _filename, MeshT& _mesh,
int _objId);
215 #ifdef ENABLE_BSPLINECURVE_SUPPORT 216 bool writeCurve(std::ostream& _out, QString _filename,
BSplineCurve* _curve );
219 #ifdef ENABLE_BSPLINESURFACE_SUPPORT 220 bool writeSurface(std::ostream& _out, QString _filename,
BSplineSurface* _surface );
227 QWidget* loadOptions_;
228 QWidget* saveOptions_;
230 QCheckBox* saveBinary_;
231 QCheckBox* saveVertexColor_;
232 QCheckBox* saveFaceColor_;
233 QCheckBox* saveFaceColorOverride_;
234 QCheckBox* saveAlpha_;
235 QCheckBox* saveNormals_;
236 QCheckBox* saveTexCoords_;
237 QCheckBox* saveTextures_;
238 QCheckBox* saveCopyTextures_;
239 QCheckBox* saveCreateTexFolder_;
240 QLabel* savePrecisionLabel_;
241 QSpinBox* savePrecision_;
242 QPushButton* saveDefaultButton_;
245 QComboBox* triMeshHandling_;
246 QCheckBox* loadVertexColor_;
247 QCheckBox* loadFaceColor_;
248 QCheckBox* loadAlpha_;
249 QCheckBox* loadNormals_;
250 QCheckBox* loadTexCoords_;
251 QCheckBox* loadTextures_;
252 QPushButton* loadDefaultButton_;
254 bool forceTriangleMesh_;
257 QString textureIndexPropertyName_;
258 bool textureIndexPropFetched_;
259 std::map<int,QString> texIndexFileMap_;
260 OBJImporter::ObjectOptionsE trimeshOptions_;
264 #if defined(INCLUDE_TEMPLATES) && !defined(FILEOBJPLUGIN_C) 265 #define FILEOBJPLUGIN_TEMPLATES 266 #include "FileOBJT_impl.hh" Handle for a face entity.
void slotLoadDefault()
Slot called when user wants to save the given Load options as default.
Interface class for exporting functions to python.
void slotSaveDefault()
Slot called when user wants to save the given Save options as default.
void initializePlugin()
Initialize Plugin.
void checkTypes(QByteArray &_bufferedFile, QString _filename, OBJImporter &_importer, QStringList &_includes)
Reader functions.
QWidget * loadOptionsWidget(QString)
QString name()
Return a name for the plugin.
Logtype
Log types for Message Window.
Interface for all Plugins which do logging to the logging window of the framework.
MaterialList materials_
List that contains the material properties.
QWidget * saveOptionsWidget(QString)
applicationStatus
Enum for the statusBar Status Icon.
FileOBJPlugin()
Constructor.
Interface to call functions across plugins.
DataType supportedType()
Return your supported object type( e.g. DATA_TRIANGLE_MESH )
DrawMode NONE
not a valid draw mode
Control OpenFlippers status bar.
QString description()
Return a description of what the plugin is doing.
int loadObject(QString _filename)
Loads Object and converts it to a triangle mesh if possible.
bool writeMaterial(QString _filename, MeshT &_mesh, int _objId)
writer functions
Interface for all Plugins which provide scriptable Functions.
void backupTextureCoordinates(MeshT &_mesh)
creates a backup of the original per vertex/face texture coordinates
unsigned int materialErrors_
number of defect materials encountered during writing
Provide texture support for a plugin.
void convertToOBJName(QString &_name)
Convert non-valid filenames (e.g. of groups that end with .jpg) to valid .objs.
Interface class from which all plugins have to be created.
Interface class for file handling.
Interface for all plugins which want to Load or Save files and create Objects.