55 #if QT_VERSION >= 0x050000 66 return QString( tr(
"Sphere definition files ( *.sph )") );
70 return QString( tr(
"Sphere definition files ( *.sph )") );
78 int FileSPHPlugin::loadObject(QString _filename)
89 QFileInfo fi(_filename);
96 QSettings settings(_filename, QSettings::IniFormat);
97 settings.beginGroup(
"SPHERE");
99 if ( settings.contains(
"Name") ) {
101 QString name = settings.value(
"Name").toString();
110 if ( settings.contains(
"PositionX") ) {
113 position[0] = settings.value(
"PositionX").toDouble();
114 position[1] = settings.value(
"PositionY").toDouble();
115 position[2] = settings.value(
"PositionZ").toDouble();
120 if ( settings.contains(
"Size") ){
122 double size = settings.value(
"Size").toDouble();
127 if ( settings.contains(
"Slices") ){
129 int slices = settings.value(
"Slices").toDouble();
134 if ( settings.contains(
"Stacks") ){
136 int stacks = settings.value(
"Stacks").toDouble();
145 emit openedFile( sphereObject->
id() );
156 bool FileSPHPlugin::saveObject(
int _id, QString _filename)
167 QSettings settings(_filename, QSettings::IniFormat);
168 settings.beginGroup(
"SPHERE");
170 settings.setValue(
"Name",sphereObject->
name());
172 settings.setValue(
"PositionX", sphere->
get_primitive(0).position[0]);
173 settings.setValue(
"PositionY", sphere->
get_primitive(0).position[1]);
174 settings.setValue(
"PositionZ", sphere->
get_primitive(0).position[2]);
177 settings.setValue(
"Slices", sphere->
get_primitive(0).slices);
178 settings.setValue(
"Stacks", sphere->
get_primitive(0).stacks);
186 emit log(
LOGERR, tr(
"saveObject : cannot get object id %1 for save name %2").arg(_id).arg(_filename) );
193 #if QT_VERSION < 0x050000
SphereObject * sphereObject(int _objectId)
Get a SphereObject from id if possible.
QString filename() const
return the filename of the object
bool getObject(int _identifier, BSplineCurveObject *&_object)
void initializePlugin()
Initialize Plugin.
void setName(QString _name)
Set the name of the Object.
void setFromFileName(const QString &_filename)
SphereNode * sphereNode(BaseObjectData *_object)
Get a SphereNode from an object.
virtual void setName(QString _name)
path to the file from which the object is loaded ( defaults to "." )
QString name()
Return a name for the plugin.
Primitive & get_primitive(int _idx)
get a primitive
QString name() const
return the name of the object. The name defaults to NONAME if unset.
DataType supportedType()
Return your supported object type( e.g. DATA_TRIANGLE_MESH )
const UpdateType UPDATE_ALL(UpdateTypeSet(1))
Identifier for all updates.