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
P
Plugin-MeshConvert
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
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenFlipper-Free
Plugin-MeshConvert
Commits
c8fd7495
Commit
c8fd7495
authored
Jan 08, 2017
by
Martin Schultz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added Mesh Conversion plugin
parents
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
268 additions
and
0 deletions
+268
-0
CMakeLists.txt
CMakeLists.txt
+3
-0
MeshConvert.cc
MeshConvert.cc
+150
-0
MeshConvert.hh
MeshConvert.hh
+115
-0
No files found.
CMakeLists.txt
0 → 100644
View file @
c8fd7495
include
(
plugin
)
openflipper_plugin
()
MeshConvert.cc
0 → 100644
View file @
c8fd7495
/*===========================================================================*\
* *
* OpenFlipper *
* Copyright (c) 2001-2015, RWTH-Aachen University *
* Department of Computer Graphics and Multimedia *
* All rights reserved. *
* www.openflipper.org *
* *
*---------------------------------------------------------------------------*
* This file is part of OpenFlipper. *
*---------------------------------------------------------------------------*
* *
* Redistribution and use in source and binary forms, with or without *
* modification, are permitted provided that the following conditions *
* are met: *
* *
* 1. Redistributions of source code must retain the above copyright notice, *
* this list of conditions and the following disclaimer. *
* *
* 2. Redistributions in binary form must reproduce the above copyright *
* notice, this list of conditions and the following disclaimer in the *
* documentation and/or other materials provided with the distribution. *
* *
* 3. Neither the name of the copyright holder nor the names of its *
* contributors may be used to endorse or promote products derived from *
* this software without specific prior written permission. *
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS *
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED *
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A *
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER *
* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, *
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, *
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR *
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING *
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS *
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
* *
\*===========================================================================*/
/*===========================================================================*\
* *
* $Revision$ *
* $LastChangedBy$ *
* $Date$ *
* *
\*===========================================================================*/
#include "MeshConvert.hh"
#include <OpenFlipper/common/GlobalOptions.hh>
#include <OpenFlipper/BasePlugin/PluginFunctions.hh>
#include <ObjectTypes/PolyMesh/PolyMesh.hh>
#include <ObjectTypes/TriangleMesh/TriangleMesh.hh>
#include <ObjectTypes/PolyMesh/PluginFunctionsPolyMesh.hh>
#include <OpenFlipper/libs_required/OpenMesh/src/OpenMesh/Core/Mesh/Casts.hh>
void
MeshConvertPlugin
::
initializePlugin
()
{
}
void
MeshConvertPlugin
::
pluginsInitialized
()
{
// Create your toolbar
toolbar
=
new
QToolBar
(
tr
(
"Example Toolbar"
));
grp
=
new
QActionGroup
(
toolbar
);
// Create an action for the toolbar
bidirectionalConversion
=
new
QAction
(
tr
(
"&Convert Meshes"
),
grp
);
polyConversion
=
new
QAction
(
tr
(
"&Convert to PolyMesh"
),
grp
);
triConversion
=
new
QAction
(
tr
(
"&Convert to TriMesh"
),
grp
);
// Create an icon which is shown for the action
bidirectionalConversion
->
setIcon
(
QIcon
(
OpenFlipper
::
Options
::
iconDirStr
()
+
OpenFlipper
::
Options
::
dirSeparator
()
+
"Mesh-Convert.png"
));
polyConversion
->
setIcon
(
QIcon
(
OpenFlipper
::
Options
::
iconDirStr
()
+
OpenFlipper
::
Options
::
dirSeparator
()
+
"Mesh-Convert-Poly.png"
));
triConversion
->
setIcon
(
QIcon
(
OpenFlipper
::
Options
::
iconDirStr
()
+
OpenFlipper
::
Options
::
dirSeparator
()
+
"Mesh-Convert-Tri.png"
));
// Add the action to the toolbar
toolbar
->
addAction
(
bidirectionalConversion
);
toolbar
->
addAction
(
polyConversion
);
toolbar
->
addAction
(
triConversion
);
connect
(
grp
,
SIGNAL
(
triggered
(
QAction
*
)
),
this
,
SLOT
(
convert
(
QAction
*
))
);
// Integrate the new toolbar into OpenFlipper
emit
addToolbar
(
toolbar
);
}
MeshConvertPlugin
::
MeshConvertPlugin
()
{
}
MeshConvertPlugin
::~
MeshConvertPlugin
()
{
}
void
MeshConvertPlugin
::
convert
(
QAction
*
_action
)
{
std
::
vector
<
int
>
_ids
;
if
(
!
PluginFunctions
::
getTargetIdentifiers
(
_ids
))
return
;
BaseObject
*
obj
;
PolyMesh
*
p
;
TriMesh
*
t
;
for
(
std
::
vector
<
int
>::
iterator
id
=
_ids
.
begin
();
id
!=
_ids
.
end
();
++
id
)
{
if
((
_action
==
bidirectionalConversion
||
_action
==
polyConversion
)
&&
PluginFunctions
::
getMesh
(
*
id
,
t
))
{
PolyMesh
converted
=
static_cast
<
PolyMesh
>
(
*
t
);
int
newID
=
-
1
;
emit
addEmptyObject
(
DATA_POLY_MESH
,
newID
);
if
(
PluginFunctions
::
getMesh
(
newID
,
p
))
{
*
p
=
converted
;
emit
updatedObject
(
newID
);
}
}
if
((
_action
==
bidirectionalConversion
||
_action
==
triConversion
)
&&
PluginFunctions
::
getMesh
(
*
id
,
p
))
{
TriMesh
converted
=
static_cast
<
TriMesh
>
(
*
p
);
int
newID
=
-
1
;
emit
addEmptyObject
(
DATA_TRIANGLE_MESH
,
newID
);
if
(
PluginFunctions
::
getMesh
(
newID
,
t
))
{
*
t
=
converted
;
emit
updatedObject
(
newID
);
}
}
}
}
#if QT_VERSION < 0x050000
Q_EXPORT_PLUGIN2
(
meshconvertplugin
,
MeshConvertPlugin
);
#endif
MeshConvert.hh
0 → 100644
View file @
c8fd7495
/*===========================================================================*\
* *
* OpenFlipper *
* Copyright (c) 2001-2015, RWTH-Aachen University *
* Department of Computer Graphics and Multimedia *
* All rights reserved. *
* www.openflipper.org *
* *
*---------------------------------------------------------------------------*
* This file is part of OpenFlipper. *
*---------------------------------------------------------------------------*
* *
* Redistribution and use in source and binary forms, with or without *
* modification, are permitted provided that the following conditions *
* are met: *
* *
* 1. Redistributions of source code must retain the above copyright notice, *
* this list of conditions and the following disclaimer. *
* *
* 2. Redistributions in binary form must reproduce the above copyright *
* notice, this list of conditions and the following disclaimer in the *
* documentation and/or other materials provided with the distribution. *
* *
* 3. Neither the name of the copyright holder nor the names of its *
* contributors may be used to endorse or promote products derived from *
* this software without specific prior written permission. *
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS *
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED *
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A *
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER *
* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, *
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, *
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR *
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING *
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS *
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
* *
\*===========================================================================*/
/*===========================================================================*\
* *
* $Revision$ *
* $LastChangedBy$ *
* $Date$ *
* *
\*===========================================================================*/
#pragma once
#include <OpenFlipper/BasePlugin/BaseInterface.hh>
#include <OpenFlipper/BasePlugin/LoggingInterface.hh>
#include <OpenFlipper/BasePlugin/ToolbarInterface.hh>
#include <OpenFlipper/BasePlugin/LoadSaveInterface.hh>
//class QAction;
class
MeshConvertPlugin
:
public
QObject
,
BaseInterface
,
LoggingInterface
,
LoadSaveInterface
,
ToolbarInterface
{
Q_OBJECT
Q_INTERFACES
(
BaseInterface
)
Q_INTERFACES
(
LoggingInterface
)
Q_INTERFACES
(
ToolbarInterface
)
Q_INTERFACES
(
LoadSaveInterface
)
#if QT_VERSION >= 0x050000
Q_PLUGIN_METADATA
(
IID
"org.OpenFlipper.Plugins.Plugin-MeshConvert"
)
#endif
signals:
// LoggingInterface
void
log
(
Logtype
_type
,
QString
_message
);
void
log
(
QString
_message
);
//ToolbarInterface
void
addToolbar
(
QToolBar
*
_toolbar
);
void
getToolBar
(
QString
_name
,
QToolBar
*&
_toolbar
);
// LoadSaveInterface
void
addEmptyObject
(
DataType
_type
,
int
&
_id
);
// BaseInterface
void
updatedObject
(
int
_objectId
);
public:
MeshConvertPlugin
();
~
MeshConvertPlugin
();
// BaseInterface
QString
name
()
{
return
(
QString
(
"MeshConvert"
));
}
QString
description
()
{
return
(
QString
(
"Plugin used to convert PolyMesh to TriMesh and vice versa"
));
}
private
slots
:
/// BaseInterface
void
initializePlugin
();
void
pluginsInitialized
();
private:
QToolBar
*
toolbar
;
QActionGroup
*
grp
;
QAction
*
bidirectionalConversion
;
QAction
*
polyConversion
;
QAction
*
triConversion
;
public
slots
:
void
convert
(
QAction
*
);
QString
version
()
{
return
QString
(
"1.0"
);
};
};
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