Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
OpenFlipper-Staging
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
1
Merge Requests
1
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
OpenFlipper-Free
OpenFlipper-Staging
Commits
673612b5
Commit
673612b5
authored
Jun 01, 2018
by
Martin Schultz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added confirmation dialog when files with multiple materials are loaded
parent
78e57c54
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
42 additions
and
6 deletions
+42
-6
PluginCollection-FilePlugins/Plugin-Assimp/AssimpPlugin.cc
PluginCollection-FilePlugins/Plugin-Assimp/AssimpPlugin.cc
+34
-6
PluginCollection-FilePlugins/Plugin-Assimp/AssimpPlugin.hh
PluginCollection-FilePlugins/Plugin-Assimp/AssimpPlugin.hh
+8
-0
No files found.
PluginCollection-FilePlugins/Plugin-Assimp/AssimpPlugin.cc
View file @
673612b5
...
...
@@ -44,7 +44,6 @@
#include "AssimpPlugin.hh"
#include <ACG/QtWidgets/QtFlapBox.hh>
// Defines for the type handling drop down box
#define TYPEAUTODETECT 0
...
...
@@ -91,6 +90,8 @@ void AssimpPlugin::initializePlugin() {
" <br> "
;
emit
addAboutInfo
(
info
,
"File-Assimp Plugin"
);
connect
(
this
,
SIGNAL
(
showConfirmationDialog
(
const
QString
&
,
const
QString
&
)),
this
,
SLOT
(
slotShowConfirmationDialog
(
const
QString
&
,
const
QString
&
)),
Qt
::
BlockingQueuedConnection
);
}
int
AssimpPlugin
::
convertAiSceneToOpenMesh
(
const
aiScene
*
_scene
,
QString
_objectName
)
{
...
...
@@ -99,6 +100,15 @@ int AssimpPlugin::convertAiSceneToOpenMesh(const aiScene *_scene, QString _objec
if
(
_scene
->
mNumMeshes
==
0
)
emit
log
(
LOGWARN
,
tr
(
"aiScene contains no meshes"
));
if
(
_scene
->
mNumMaterials
>
1
)
{
if
(
!
emit
showConfirmationDialog
(
tr
(
"Multiple MAterials in file"
),
tr
(
"The File you are trying to load contains %1 materials. "
"Assimp creates a separate Mesh for each material, which may cause performance issues.
\n\n
"
"Do you want to continue loading the file?"
).
arg
(
_scene
->
mNumMaterials
)))
return
returnId
;
}
for
(
unsigned
int
i
=
0
;
i
<
_scene
->
mNumMeshes
;
++
i
)
{
int
objectId
=
-
1
;
...
...
@@ -479,10 +489,13 @@ QWidget *AssimpPlugin::loadOptionsWidget(QString) {
triMeshHandling_
->
addItem
(
tr
(
"Open as PolyMesh"
)
);
triMeshHandling_
->
addItem
(
tr
(
"Open as TriangleMesh"
)
);
loadFaceColor_
=
new
QCheckBox
(
"Load Face Colors"
);
loadNormals_
=
new
QCheckBox
(
"Load Normals"
);
loadTexCoords_
=
new
QCheckBox
(
"Load Texture Coordinates"
);
loadTextures_
=
new
QCheckBox
(
"Load Textures"
);
loadFaceColor_
=
new
QCheckBox
(
"Load Vertex Colors"
);
loadNormals_
=
new
QCheckBox
(
"Load Vertex Normals"
);
loadTexCoords_
=
new
QCheckBox
(
"Load Vertex Texture Coordinates"
);
loadTextures_
=
new
QCheckBox
(
"Load Textures"
);
//loading textures is not yet supported
loadTextures_
->
setDisabled
(
true
);
QList
<
QWidget
*>
generalOptions
=
{
triMeshHandling_
,
loadFaceColor_
,
loadNormals_
,
loadTexCoords_
,
loadTextures_
};
...
...
@@ -766,11 +779,26 @@ unsigned int AssimpPlugin::processSteps( const std::unordered_map<QCheckBox*, un
unsigned
int
result
=
0
;
for
(
auto
entry
:
_options
)
{
result
|=
entry
.
first
->
isChecked
()
?
entry
.
second
:
0
;
if
(
entry
.
first
!=
nullptr
)
result
|=
entry
.
first
->
isChecked
()
?
entry
.
second
:
0
;
}
return
result
;
}
bool
AssimpPlugin
::
slotShowConfirmationDialog
(
const
QString
&
_title
,
const
QString
&
_message
)
{
QMessageBox
msgBox
;
QPushButton
*
cancelButton
=
msgBox
.
addButton
(
tr
(
"Cancel"
),
QMessageBox
::
ActionRole
);
/*QPushButton *confirmButton =*/
msgBox
.
addButton
(
tr
(
"Continue"
),
QMessageBox
::
ActionRole
);
msgBox
.
setWindowTitle
(
_title
);
msgBox
.
setText
(
_message
);
msgBox
.
setDefaultButton
(
cancelButton
);
msgBox
.
exec
();
if
(
msgBox
.
clickedButton
()
==
cancelButton
)
return
false
;
return
true
;
}
#if QT_VERSION < 0x050000
Q_EXPORT_PLUGIN2
(
assimpplugin
,
AssimpPlugin
)
#endif
PluginCollection-FilePlugins/Plugin-Assimp/AssimpPlugin.hh
View file @
673612b5
...
...
@@ -137,6 +137,14 @@ private slots:
void
slotLoadDefault
();
void
slotSaveDefault
();
/// displays a message dialog with the given message,
/// and returns whether confirm or cancel was clicked
/// returns true if confirm was clicked
bool
slotShowConfirmationDialog
(
const
QString
&
_title
,
const
QString
&
_message
);
signals:
bool
showConfirmationDialog
(
const
QString
&
_title
,
const
QString
&
_message
);
private:
...
...
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