Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
OpenFlipper-Free
OpenFlipper-Free
Commits
bba78ffc
Commit
bba78ffc
authored
Feb 11, 2016
by
Martin Schultz
Browse files
Fixed ASK dialog for OFF File Plugin
* also removed outcommented code fragment from obj loader
parent
85b8163f
Pipeline
#879
passed with stage
Changes
3
Pipelines
1
Show whitespace changes
Inline
Side-by-side
PluginCollection-FilePlugins/Plugin-FileOBJ/FileOBJ.cc
View file @
bba78ffc
...
@@ -1749,7 +1749,6 @@ void FileOBJPlugin::checkTypes(QByteArray& _bufferedFile, QString _filename, OBJ
...
@@ -1749,7 +1749,6 @@ void FileOBJPlugin::checkTypes(QByteArray& _bufferedFile, QString _filename, OBJ
break
;
break
;
case
TYPEASK
:
//ask
case
TYPEASK
:
//ask
//LoadType t;
QMetaObject
::
invokeMethod
(
this
,
"handleTrimeshDialog"
,
Qt
::
BlockingQueuedConnection
);
QMetaObject
::
invokeMethod
(
this
,
"handleTrimeshDialog"
,
Qt
::
BlockingQueuedConnection
);
if
(
trimeshOptions
==
OBJImporter
::
TRIMESH
)
if
(
trimeshOptions
==
OBJImporter
::
TRIMESH
)
_importer
.
forceMeshType
(
OBJImporter
::
TRIMESH
);
_importer
.
forceMeshType
(
OBJImporter
::
TRIMESH
);
...
...
PluginCollection-FilePlugins/Plugin-FileOFF/FileOFF.cc
View file @
bba78ffc
...
@@ -532,19 +532,11 @@ bool FileOFFPlugin::readOFFFile(QString _filename, OFFImporter& _importer) {
...
@@ -532,19 +532,11 @@ bool FileOFFPlugin::readOFFFile(QString _filename, OFFImporter& _importer) {
case
TYPEASK
:
case
TYPEASK
:
if
(
!
OpenFlipper
::
Options
::
nogui
()
)
{
if
(
!
OpenFlipper
::
Options
::
nogui
()
)
{
// Create message box
// Create message box
QMessageBox
msgBox
;
QMetaObject
::
invokeMethod
(
this
,
"handleTrimeshDialog"
,
Qt
::
BlockingQueuedConnection
);
QPushButton
*
detectButton
=
msgBox
.
addButton
(
tr
(
"Auto-Detect"
),
QMessageBox
::
ActionRole
);
QPushButton
*
triButton
=
msgBox
.
addButton
(
tr
(
"Open as triangle mesh"
),
QMessageBox
::
ActionRole
);
QPushButton
*
polyButton
=
msgBox
.
addButton
(
tr
(
"Open as poly mesh"
),
QMessageBox
::
ActionRole
);
msgBox
.
setWindowTitle
(
tr
(
"Mesh types in file"
)
);
if
(
trimeshOptions
==
OFFImporter
::
TRIMESH
)
msgBox
.
setText
(
tr
(
"You are about to open a file containing one or more mesh types.
\n\n
Which mesh type should be used?"
)
);
msgBox
.
setDefaultButton
(
detectButton
);
msgBox
.
exec
();
if
(
msgBox
.
clickedButton
()
==
triButton
)
type
=
DATA_TRIANGLE_MESH
;
type
=
DATA_TRIANGLE_MESH
;
else
if
(
msgBox
.
clickedButton
()
==
polyButton
)
else
if
(
trimeshOptions
==
OFFImporter
::
POLYMESH
)
type
=
DATA_POLY_MESH
;
type
=
DATA_POLY_MESH
;
else
else
type
=
_importer
.
isTriangleMesh
()
?
DATA_TRIANGLE_MESH
:
DATA_POLY_MESH
;
type
=
_importer
.
isTriangleMesh
()
?
DATA_TRIANGLE_MESH
:
DATA_POLY_MESH
;
...
@@ -574,6 +566,24 @@ bool FileOFFPlugin::readOFFFile(QString _filename, OFFImporter& _importer) {
...
@@ -574,6 +566,24 @@ bool FileOFFPlugin::readOFFFile(QString _filename, OFFImporter& _importer) {
return
_importer
.
isBinary
()
?
parseBinary
(
ifile
,
_importer
,
type
,
_filename
)
:
parseASCII
(
ifile
,
_importer
,
type
,
_filename
);
return
_importer
.
isBinary
()
?
parseBinary
(
ifile
,
_importer
,
type
,
_filename
)
:
parseASCII
(
ifile
,
_importer
,
type
,
_filename
);
}
}
void
FileOFFPlugin
::
handleTrimeshDialog
()
{
QMessageBox
msgBox
;
QPushButton
*
detectButton
=
msgBox
.
addButton
(
tr
(
"Auto-Detect"
),
QMessageBox
::
ActionRole
);
QPushButton
*
triButton
=
msgBox
.
addButton
(
tr
(
"Open as triangle mesh"
),
QMessageBox
::
ActionRole
);
QPushButton
*
polyButton
=
msgBox
.
addButton
(
tr
(
"Open as poly mesh"
),
QMessageBox
::
ActionRole
);
msgBox
.
setWindowTitle
(
tr
(
"Mesh types in file"
)
);
msgBox
.
setText
(
tr
(
"You are about to open a file containing one or more mesh types.
\n\n
Which mesh type should be used?"
)
);
msgBox
.
setDefaultButton
(
detectButton
);
msgBox
.
exec
();
if
(
msgBox
.
clickedButton
()
==
triButton
)
trimeshOptions
=
OFFImporter
::
TRIMESH
;
else
if
(
msgBox
.
clickedButton
()
==
polyButton
)
trimeshOptions
=
OFFImporter
::
POLYMESH
;
}
//-----------------------------------------------------------------------------------------------------
//-----------------------------------------------------------------------------------------------------
bool
FileOFFPlugin
::
parseASCII
(
std
::
istream
&
_in
,
OFFImporter
&
_importer
,
DataType
_type
,
QString
&
_objectName
)
{
bool
FileOFFPlugin
::
parseASCII
(
std
::
istream
&
_in
,
OFFImporter
&
_importer
,
DataType
_type
,
QString
&
_objectName
)
{
...
...
PluginCollection-FilePlugins/Plugin-FileOFF/FileOFF.hh
View file @
bba78ffc
...
@@ -107,6 +107,8 @@ class FileOFFPlugin : public QObject, BaseInterface, FileInterface, LoadSaveInte
...
@@ -107,6 +107,8 @@ class FileOFFPlugin : public QObject, BaseInterface, FileInterface, LoadSaveInte
void
initializePlugin
();
void
initializePlugin
();
/// Displays a dialog to ask how to load the mesh (triangle, polymesh , autodetect)
void
handleTrimeshDialog
();
/// Slot called when user wants to save the given Load options as default
/// Slot called when user wants to save the given Load options as default
void
slotLoadDefault
();
void
slotLoadDefault
();
...
@@ -267,6 +269,7 @@ class FileOFFPlugin : public QObject, BaseInterface, FileInterface, LoadSaveInte
...
@@ -267,6 +269,7 @@ class FileOFFPlugin : public QObject, BaseInterface, FileInterface, LoadSaveInte
bool
forceTriangleMesh_
;
bool
forceTriangleMesh_
;
bool
forcePolyMesh_
;
bool
forcePolyMesh_
;
bool
readColorComp_
;
bool
readColorComp_
;
OFFImporter
::
ObjectOptionsE
trimeshOptions
;
};
};
#if defined(INCLUDE_TEMPLATES) && !defined(FILEOFFPLUGIN_C)
#if defined(INCLUDE_TEMPLATES) && !defined(FILEOFFPLUGIN_C)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment