Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
OpenFlipper-Free
Plugin-FileOFF
Commits
cb367312
Commit
cb367312
authored
Feb 11, 2016
by
Martin Schultz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed ASK dialog for OFF File Plugin
* also removed outcommented code fragment from obj loader
parent
620fd69f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
11 deletions
+24
-11
FileOFF.cc
FileOFF.cc
+21
-11
FileOFF.hh
FileOFF.hh
+3
-0
No files found.
FileOFF.cc
View file @
cb367312
...
@@ -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
)
{
...
...
FileOFF.hh
View file @
cb367312
...
@@ -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
Markdown
is supported
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