50 #include <QPushButton> 62 #include <OpenFlipper/BasePlugin/TextureInterface.hh> 67 #ifdef ENABLE_BSPLINECURVE_SUPPORT 71 #ifdef ENABLE_BSPLINESURFACE_SUPPORT 75 #include "OBJImporter.hh" 76 #include "Material.hh" 99 Q_PLUGIN_METADATA(IID
"org.OpenFlipper.Plugins.Plugin-FileOBJ")
101 void openedFile(
int _id );
102 void addEmptyObject(
DataType _type,
int& _id);
103 void load(QString _filename,
DataType _type,
int& _id);
104 void save(
int _id , QString _filename );
105 void log(
Logtype _type, QString _message);
106 void log(QString _message);
108 void updatedObject(
int _identifier,
const UpdateType& _type);
110 void deleteObject(
int _id );
113 void showStatusMessage(QString _message,
int _timeout = 0);
117 void pluginExists( QString _pluginName ,
bool& _exists );
120 void setTextureMode(QString _textureName, QString _mode,
int _id );
121 void switchTexture( QString _textureName,
int _id );
122 void addMultiTexture( QString _textureGroup, QString _name, QString _filename,
int _id,
int& _textureId);
123 void textureFilename(
int , QString , QString& );
124 void textureIndex(QString _name,
int _id,
int& _index);
125 void getCurrentTexture(
int , QString& );
126 void textureName (
int,
int, QString &);
127 void getSubTextures (
int, QString, QStringList &);
128 void textureIndexPropertyName(
int, QString&);
132 void fileOpened(
int ){};
144 void slotHandleCheckBoxes(
bool _checked);
146 void handleTrimeshDialog();
154 QString
name() {
return (QString(
"FileOBJ")); };
155 QString
description( ) {
return (QString(tr(
"Load/Save OBJ-Files"))); };
173 bool saveObject(
int _id, QString _filename);
175 QString version() {
return QString(
"1.0"); };
180 void checkTypes(QByteArray& _bufferedFile, QString _filename,
OBJImporter& _importer, QStringList& _includes);
182 bool readMaterial(QString _filename,
OBJImporter& _importer);
183 void readOBJFile(QByteArray& _bufferedFile, QString _filename,
OBJImporter& _importer);
184 void createAllGroupObjects(
OBJImporter& _importer);
186 template <
class MeshT>
188 void addTextures(
OBJImporter& _importer,
int _objectID );
198 template<
class MeshT >
202 template<
class MeshT >
203 bool writeMaterial(QString _filename, MeshT& _mesh,
int _objId );
205 template<
class MeshT >
206 bool writeMesh(std::ostream& _out, QString _filename, MeshT& _mesh,
int _objId);
208 #ifdef ENABLE_BSPLINECURVE_SUPPORT 209 bool writeCurve(std::ostream& _out, QString _filename,
BSplineCurve* _curve );
212 #ifdef ENABLE_BSPLINESURFACE_SUPPORT 213 bool writeSurface(std::ostream& _out, QString _filename,
BSplineSurface* _surface );
220 QWidget* loadOptions_;
221 QWidget* saveOptions_;
223 QCheckBox* saveBinary_;
224 QCheckBox* saveVertexColor_;
225 QCheckBox* saveFaceColor_;
226 QCheckBox* saveAlpha_;
227 QCheckBox* saveNormals_;
228 QCheckBox* saveTexCoords_;
229 QCheckBox* saveTextures_;
230 QCheckBox* saveCopyTextures_;
231 QCheckBox* saveCreateTexFolder_;
232 QLabel* savePrecisionLabel_;
233 QSpinBox* savePrecision_;
234 QPushButton* saveDefaultButton_;
237 QComboBox* triMeshHandling_;
238 QCheckBox* loadVertexColor_;
239 QCheckBox* loadFaceColor_;
240 QCheckBox* loadAlpha_;
241 QCheckBox* loadNormals_;
242 QCheckBox* loadTexCoords_;
243 QCheckBox* loadTextures_;
244 QPushButton* loadDefaultButton_;
246 bool forceTriangleMesh_;
249 QString textureIndexPropertyName_;
250 bool textureIndexPropFetched_;
251 std::map<int,QString> texIndexFileMap_;
252 OBJImporter::ObjectOptionsE trimeshOptions_;
256 #if defined(INCLUDE_TEMPLATES) && !defined(FILEOBJPLUGIN_C) 257 #define FILEOBJPLUGIN_TEMPLATES 258 #include "FileOBJT_impl.hh" QString name()
Return a name for the plugin.
FileOBJPlugin()
Constructor.
Interface to call functions across plugins.
void slotLoadDefault()
Slot called when user wants to save the given Load options as default.
DataType supportedType()
Return your supported object type( e.g. DATA_TRIANGLE_MESH )
Logtype
Log types for Message Window.
Interface for all plugins which want to Load or Save files and create Objects.
Control OpenFlippers status bar.
Interface for all Plugins which provide scriptable Functions.
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
Provide texture support for a plugin.
void slotSaveDefault()
Slot called when user wants to save the given Save options as default.
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 do logging to the logging window of the framework.
applicationStatus
Enum for the statusBar Status Icon.
DrawMode NONE
not a valid draw mode
Handle for a face entity.
Interface class from which all plugins have to be created.
void convertToOBJName(QString &_name)
Convert non-valid filenames (e.g. of groups that end with .jpg) to valid .objs.
Interface class for file handling.
MaterialList materials_
List that contains the material properties.
QString description()
Return a description of what the plugin is doing.
void initializePlugin()
Initialize Plugin.
QWidget * saveOptionsWidget(QString)
QWidget * loadOptionsWidget(QString)