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
a68995aa
Commit
a68995aa
authored
Oct 24, 2016
by
Jan Möbius
Browse files
Changed function parameters for picking from using unsigned int to size_t. Breaking Change!
parent
21806e70
Changes
35
Hide whitespace changes
Inline
Side-by-side
ObjectTypes/Plane/QtPlaneSelect.cc
View file @
a68995aa
...
...
@@ -127,7 +127,7 @@ void QtPlaneSelect::slotMouseEvent(QMouseEvent* event)
return
;
unsigned
in
t
node_idx
,
target_idx
;
size_
t
node_idx
,
target_idx
;
if
(
PluginFunctions
::
scenegraphPick
(
ACG
::
SceneGraph
::
PICK_FACE
,
event
->
pos
(),
...
...
ObjectTypes/PolyLine/PolyLineBezierSplineData.hh
View file @
a68995aa
...
...
@@ -69,7 +69,7 @@ public:
std
::
vector
<
InterpolatePoint
>
points_
;
std
::
vector
<
ACG
::
Vec3d
>
handles_
;
/// Index of the corresponding mesh
unsigned
in
t
meshIndex_
;
size_
t
meshIndex_
;
public:
...
...
ObjectTypes/PolyLine/PolyLineCircleData.hh
View file @
a68995aa
...
...
@@ -64,7 +64,7 @@ public:
ACG
::
Vec3d
circleSideAxis_
;
double
circleMainRadius_
;
double
circleSideRadius_
;
unsigned
int
circleMeshIndex_
;
size_t
circleMeshIndex_
;
public:
PolyLineCircleData
(
ACG
::
Vec3d
center
,
ACG
::
Vec3d
normal
,
ACG
::
Vec3d
mainAxis
,
ACG
::
Vec3d
sideAxis
,
double
mainR
,
double
sideR
,
unsigned
int
mesh
);
...
...
OpenFlipper/BasePlugin/PluginFunctions.cc
View file @
a68995aa
...
...
@@ -260,7 +260,7 @@ void setSceneGraphRootNodeGlobal( SeparatorNode* _root_node ) {
PluginFunctions
::
sceneGraphRootNodeGlobal_
=
_root_node
;
}
bool
getPickedObject
(
const
unsigned
in
t
_node_idx
,
BaseObjectData
*&
_object
)
{
bool
getPickedObject
(
const
size_
t
_node_idx
,
BaseObjectData
*&
_object
)
{
for
(
ObjectIterator
o_it
(
PluginFunctions
::
ALL_OBJECTS
)
;
o_it
!=
PluginFunctions
::
objectsEnd
();
++
o_it
)
{
if
(
o_it
->
picked
(
_node_idx
)
)
{
_object
=
*
o_it
;
...
...
@@ -479,13 +479,13 @@ void viewingRay(int _x, int _y,
}
// Pick returning node index
bool
scenegraphPick
(
ACG
::
SceneGraph
::
PickTarget
_pickTarget
,
const
QPoint
&
_mousePos
,
unsigned
in
t
&
_nodeIdx
,
unsigned
in
t
&
_targetIdx
,
ACG
::
Vec3d
*
_hitPointPtr
=
0
)
{
bool
scenegraphPick
(
ACG
::
SceneGraph
::
PickTarget
_pickTarget
,
const
QPoint
&
_mousePos
,
size_
t
&
_nodeIdx
,
size_
t
&
_targetIdx
,
ACG
::
Vec3d
*
_hitPointPtr
=
0
)
{
return
examiner_widgets_
[
activeExaminer_
]
->
pick
(
_pickTarget
,
_mousePos
,
_nodeIdx
,
_targetIdx
,
_hitPointPtr
);
}
// Pick returning node index
bool
scenegraphPick
(
const
unsigned
int
_examiner
,
ACG
::
SceneGraph
::
PickTarget
_pickTarget
,
const
QPoint
&
_mousePos
,
unsigned
in
t
&
_nodeIdx
,
unsigned
in
t
&
_targetIdx
,
ACG
::
Vec3d
*
_hitPointPtr
=
0
)
{
bool
scenegraphPick
(
const
unsigned
int
_examiner
,
ACG
::
SceneGraph
::
PickTarget
_pickTarget
,
const
QPoint
&
_mousePos
,
size_
t
&
_nodeIdx
,
size_
t
&
_targetIdx
,
ACG
::
Vec3d
*
_hitPointPtr
=
0
)
{
if
(
_examiner
>=
examiner_widgets_
.
size
()
)
{
std
::
cerr
<<
"Wrong examiner id"
<<
std
::
endl
;
...
...
@@ -500,13 +500,13 @@ bool scenegraphPick( const unsigned int _examiner ,
ACG
::
SceneGraph
::
PickTarget
_pickTarget
,
const
QPoint
&
_mousePos
,
BaseObjectData
*&
_object
,
unsigned
int
&
_targetIdx
,
size_t
&
_targetIdx
,
const
bool
_refine
,
ACG
::
Vec3d
*
_hitPointPtr
)
{
unsigned
in
t
nodeIdx
=
0
;
size_
t
nodeIdx
=
0
;
bool
ok
=
scenegraphPick
(
_examiner
,
_pickTarget
,
_mousePos
,
nodeIdx
,
_targetIdx
,
_hitPointPtr
);
bool
ok
=
scenegraphPick
(
_examiner
,
_pickTarget
,
_mousePos
,
nodeIdx
,
_targetIdx
,
_hitPointPtr
);
// If successfully picked and object is found
if
(
ok
&&
PluginFunctions
::
getPickedObject
(
nodeIdx
,
_object
)
)
{
...
...
@@ -535,7 +535,7 @@ bool scenegraphPick( const unsigned int _examiner ,
bool
scenegraphPick
(
ACG
::
SceneGraph
::
PickTarget
_pickTarget
,
const
QPoint
&
_mousePos
,
BaseObjectData
*&
_object
,
unsigned
int
&
_targetIdx
,
size_t
&
_targetIdx
,
const
bool
_refine
,
ACG
::
Vec3d
*
_hitPointPtr
)
{
...
...
@@ -548,7 +548,7 @@ bool scenegraphPick( ACG::SceneGraph::PickTarget _pickTarget,
bool
scenegraphRegionPick
(
ACG
::
SceneGraph
::
PickTarget
_pickTarget
,
const
QRegion
&
_region
,
QList
<
QPair
<
unsigned
int
,
unsigned
int
>
>&
_list
,
QList
<
QPair
<
size_t
,
size_t
>
>&
_list
,
QVector
<
float
>*
_depths
,
QVector
<
ACG
::
Vec3d
>*
_points
)
{
...
...
@@ -558,7 +558,7 @@ bool scenegraphRegionPick( ACG::SceneGraph::PickTarget _pickTarge
bool
scenegraphRegionPick
(
const
unsigned
int
_examiner
,
ACG
::
SceneGraph
::
PickTarget
_pickTarget
,
const
QRegion
&
_region
,
QList
<
QPair
<
unsigned
int
,
unsigned
int
>
>&
_list
,
QList
<
QPair
<
size_t
,
size_t
>
>&
_list
,
QVector
<
float
>*
_depths
,
QVector
<
ACG
::
Vec3d
>*
_points
)
{
...
...
OpenFlipper/BasePlugin/PluginFunctions.hh
View file @
a68995aa
...
...
@@ -93,7 +93,7 @@ namespace PluginFunctions {
* @return true if mesh was found, false if picked object is not a mesh or not found
*/
DLLEXPORT
bool
getPickedObject
(
const
unsigned
in
t
_node_idx
,
BaseObjectData
*&
_object
);
bool
getPickedObject
(
const
size_
t
_node_idx
,
BaseObjectData
*&
_object
);
/** @} */
...
...
@@ -250,14 +250,14 @@ void setSceneCenter(const ACG::Vec3d& _center, int _viewer );
* set by the last mouse event from the core
*/
DLLEXPORT
bool
scenegraphPick
(
ACG
::
SceneGraph
::
PickTarget
_pickTarget
,
const
QPoint
&
_mousePos
,
unsigned
in
t
&
_nodeIdx
,
unsigned
in
t
&
_targetIdx
,
ACG
::
Vec3d
*
_hitPointPtr
);
bool
scenegraphPick
(
ACG
::
SceneGraph
::
PickTarget
_pickTarget
,
const
QPoint
&
_mousePos
,
size_
t
&
_nodeIdx
,
size_
t
&
_targetIdx
,
ACG
::
Vec3d
*
_hitPointPtr
);
/** \brief Execute picking operation on scenegraph
*
* This picking function will pick in the specified examiner context
*/
DLLEXPORT
bool
scenegraphPick
(
const
unsigned
int
_examiner
,
ACG
::
SceneGraph
::
PickTarget
_pickTarget
,
const
QPoint
&
_mousePos
,
unsigned
in
t
&
_nodeIdx
,
unsigned
in
t
&
_targetIdx
,
ACG
::
Vec3d
*
_hitPointPtr
);
bool
scenegraphPick
(
const
unsigned
int
_examiner
,
ACG
::
SceneGraph
::
PickTarget
_pickTarget
,
const
QPoint
&
_mousePos
,
size_
t
&
_nodeIdx
,
size_
t
&
_targetIdx
,
ACG
::
Vec3d
*
_hitPointPtr
);
/** \brief Execute picking operation on scenegraph and return object
*
...
...
@@ -266,7 +266,7 @@ bool scenegraphPick( const unsigned int _examiner ,ACG::SceneGraph::PickTarget _
* the picked object will be called in order to achieve higher picking accuracy
*/
DLLEXPORT
bool
scenegraphPick
(
const
unsigned
int
_examiner
,
ACG
::
SceneGraph
::
PickTarget
_pickTarget
,
const
QPoint
&
_mousePos
,
BaseObjectData
*&
_object
,
unsigned
in
t
&
_targetIdx
,
const
bool
_refine
,
ACG
::
Vec3d
*
_hitPointPtr
);
bool
scenegraphPick
(
const
unsigned
int
_examiner
,
ACG
::
SceneGraph
::
PickTarget
_pickTarget
,
const
QPoint
&
_mousePos
,
BaseObjectData
*&
_object
,
size_
t
&
_targetIdx
,
const
bool
_refine
,
ACG
::
Vec3d
*
_hitPointPtr
);
/** \brief Execute picking operation on scenegraph and return object
*
...
...
@@ -275,7 +275,7 @@ bool scenegraphPick( const unsigned int _examiner ,ACG::SceneGraph::PickTarget _
* the picked object will be called in order to achieve higher picking accuracy
*/
DLLEXPORT
bool
scenegraphPick
(
ACG
::
SceneGraph
::
PickTarget
_pickTarget
,
const
QPoint
&
_mousePos
,
BaseObjectData
*&
_object
,
unsigned
in
t
&
_targetIdx
,
const
bool
_refine
,
ACG
::
Vec3d
*
_hitPointPtr
);
bool
scenegraphPick
(
ACG
::
SceneGraph
::
PickTarget
_pickTarget
,
const
QPoint
&
_mousePos
,
BaseObjectData
*&
_object
,
size_
t
&
_targetIdx
,
const
bool
_refine
,
ACG
::
Vec3d
*
_hitPointPtr
);
/** Execute picking operation on scenegraph
...
...
@@ -285,7 +285,7 @@ bool scenegraphPick( ACG::SceneGraph::PickTarget _pickTarget, const QPoint &_mou
DLLEXPORT
bool
scenegraphRegionPick
(
ACG
::
SceneGraph
::
PickTarget
_pickTarget
,
const
QRegion
&
_region
,
QList
<
QPair
<
unsigned
int
,
unsigned
int
>
>&
_list
,
QList
<
QPair
<
size_t
,
size_t
>
>&
_list
,
QVector
<
float
>*
_depths
=
0
,
QVector
<
ACG
::
Vec3d
>*
_points
=
0
);
...
...
@@ -296,7 +296,7 @@ DLLEXPORT
bool
scenegraphRegionPick
(
const
unsigned
int
_examiner
,
ACG
::
SceneGraph
::
PickTarget
_pickTarget
,
const
QRegion
&
_region
,
QList
<
QPair
<
unsigned
int
,
unsigned
int
>
>&
_list
,
QList
<
QPair
<
size_t
,
size_t
>
>&
_list
,
QVector
<
float
>*
_depths
=
0
,
QVector
<
ACG
::
Vec3d
>*
_points
=
0
);
...
...
OpenFlipper/Core/Core.cc
View file @
a68995aa
...
...
@@ -743,7 +743,7 @@ Core::slotMouseEventIdentify( QMouseEvent* _event )
PluginFunctions
::
setActiveExaminer
(
examinerId
);
// Do picking
unsigned
in
t
node_idx
,
target_idx
;
size_
t
node_idx
,
target_idx
;
ACG
::
Vec3d
hit_point
;
if
(
PluginFunctions
::
scenegraphPick
(
ACG
::
SceneGraph
::
PICK_ANYTHING
,
_event
->
pos
(),
node_idx
,
target_idx
,
&
hit_point
))
{
...
...
OpenFlipper/Documentation/DeveloperHelpSources/changelog.docu
View file @
a68995aa
...
...
@@ -2,6 +2,8 @@
- <b>OpenFlipper 4.0 ( ?/?/? )</b>
- <b>Breaking changes</b>
- Picking functions use size_t instead of unsigned int now (Required to get rid of a lot of warnings during compilation)
- <b>Build System</b>
- Enable C++-11 by default
- Drop support for Qt 4
...
...
OpenFlipper/publicWidgets/objectSelectionWidget/objectPickDialog.cc
View file @
a68995aa
...
...
@@ -183,7 +183,7 @@ void ObjectPickDialog::activated(const QModelIndex & _index)
void
ObjectPickDialog
::
slotMouseEventClick
(
QMouseEvent
*
_event
,
bool
/*_double*/
)
{
unsigned
in
t
nodeIdx
,
targetIdx
;
size_
t
nodeIdx
,
targetIdx
;
if
(
viewer_
->
viewer
()
->
pick
(
ACG
::
SceneGraph
::
PICK_ANYTHING
,
_event
->
pos
(),
nodeIdx
,
targetIdx
))
...
...
OpenFlipper/widgets/coreWidget/ContextMenu.cc
View file @
a68995aa
...
...
@@ -679,7 +679,7 @@ void CoreWidget::updatePopupMenu(const QPoint& _point) {
}
context
=
BACKGROUNDCONTEXT
;
// Do picking in the gl area to find an object
unsigned
int
node_idx
,
target_idx
;
size_t
node_idx
,
target_idx
;
ACG
::
Vec3d
hit_point
;
BaseObjectData
*
object
=
0
;
ACG
::
SceneGraph
::
BaseNode
*
node
=
0
;
...
...
OpenFlipper/widgets/coreWidget/dragAndDrop.cc
View file @
a68995aa
...
...
@@ -100,7 +100,7 @@ void CoreWidget::startDrag ( QMouseEvent* _event )
int
objectId
=
-
1
;
// Do picking in the gl area to find an object
unsigned
int
node_idx
,
target_idx
;
size_t
node_idx
,
target_idx
;
ACG
::
Vec3d
hit_point
;
BaseObjectData
*
object
;
if
(
PluginFunctions
::
scenegraphPick
(
ACG
::
SceneGraph
::
PICK_ANYTHING
,
...
...
OpenFlipper/widgets/glWidget/QtBaseViewer.cc
View file @
a68995aa
...
...
@@ -2431,8 +2431,8 @@ void glViewer::updateCursorPosition (QPointF _scenePos)
ACG
::
Vec3d
tmp
;
unsigned
in
t
nodeIdx
=
0
;
unsigned
in
t
targetIdx
=
0
;
size_
t
nodeIdx
=
0
;
size_
t
targetIdx
=
0
;
// ignore cursor if we are outside of our window
...
...
OpenFlipper/widgets/glWidget/QtBaseViewer.hh
View file @
a68995aa
...
...
@@ -794,10 +794,10 @@ private:
* @return Successful?
*/
bool
pick
(
ACG
::
SceneGraph
::
PickTarget
_pickTarget
,
const
QPoint
&
_mousePos
,
unsigned
int
&
_nodeIdx
,
unsigned
int
&
_targetIdx
,
ACG
::
Vec3d
*
_hitPointPtr
=
0
);
const
QPoint
&
_mousePos
,
size_t
&
_nodeIdx
,
size_t
&
_targetIdx
,
ACG
::
Vec3d
*
_hitPointPtr
=
0
);
/** \brief Perform picking action n a whole region.
*
...
...
@@ -814,7 +814,7 @@ private:
*/
bool
pick_region
(
ACG
::
SceneGraph
::
PickTarget
_pickTarget
,
const
QRegion
&
_region
,
QList
<
QPair
<
unsigned
int
,
unsigned
int
>
>&
_list
,
QList
<
QPair
<
size_t
,
size_t
>
>&
_list
,
QVector
<
float
>*
_depths
=
0
,
QVector
<
ACG
::
Vec3d
>*
_points
=
0
);
...
...
@@ -836,15 +836,15 @@ private:
/// pick using colors
int
pickColor
(
ACG
::
SceneGraph
::
PickTarget
_pickTarget
,
const
QPoint
&
_mousePos
,
unsigned
in
t
&
_nodeIdx
,
unsigned
in
t
&
_targetIdx
,
size_
t
&
_nodeIdx
,
size_
t
&
_targetIdx
,
ACG
::
Vec3d
*
_hitPointPtr
=
0
);
/// pick from cache
int
pickFromCache
(
ACG
::
SceneGraph
::
PickTarget
_pickTarget
,
const
QPoint
&
_mousePos
,
unsigned
in
t
&
_nodeIdx
,
unsigned
in
t
&
_targetIdx
,
size_
t
&
_nodeIdx
,
size_
t
&
_targetIdx
,
ACG
::
Vec3d
*
_hitPointPtr
=
0
);
private:
...
...
OpenFlipper/widgets/glWidget/QtBaseViewerFlyAnimation.cc
View file @
a68995aa
...
...
@@ -72,7 +72,7 @@ void glViewer::flyTo(const QPoint& _pos, bool _moveBack)
{
makeCurrent
();
unsigned
in
t
nodeIdx
,
targetIdx
;
size_
t
nodeIdx
,
targetIdx
;
ACG
::
Vec3d
hitPoint
;
if
(
pick
(
ACG
::
SceneGraph
::
PICK_ANYTHING
,
_pos
,
nodeIdx
,
targetIdx
,
&
hitPoint
))
...
...
OpenFlipper/widgets/glWidget/QtBaseViewerPicking.cc
View file @
a68995aa
...
...
@@ -76,8 +76,8 @@
bool
glViewer
::
pick
(
ACG
::
SceneGraph
::
PickTarget
_pickTarget
,
const
QPoint
&
_mousePos
,
unsigned
int
&
_nodeIdx
,
unsigned
int
&
_targetIdx
,
size_t
&
_nodeIdx
,
size_t
&
_targetIdx
,
ACG
::
Vec3d
*
_hitPointPtr
)
{
if
(
sceneGraphRoot_
)
...
...
@@ -106,8 +106,8 @@ bool glViewer::pick( ACG::SceneGraph::PickTarget _pickTarget,
int
glViewer
::
pickColor
(
ACG
::
SceneGraph
::
PickTarget
_pickTarget
,
const
QPoint
&
_mousePos
,
unsigned
int
&
_nodeIdx
,
unsigned
int
&
_targetIdx
,
size_t
&
_nodeIdx
,
size_t
&
_targetIdx
,
ACG
::
Vec3d
*
_hitPointPtr
)
{
GLint
w
=
glWidth
(),
...
...
@@ -306,8 +306,8 @@ int glViewer::pickColor( ACG::SceneGraph::PickTarget _pickTarget,
int
glViewer
::
pickFromCache
(
ACG
::
SceneGraph
::
PickTarget
_pickTarget
,
const
QPoint
&
_mousePos
,
unsigned
int
&
_nodeIdx
,
unsigned
int
&
_targetIdx
,
size_t
&
_nodeIdx
,
size_t
&
_targetIdx
,
ACG
::
Vec3d
*
_hitPointPtr
)
{
// do we need an update?
...
...
@@ -416,7 +416,7 @@ int glViewer::pickFromCache( ACG::SceneGraph::PickTarget _pickTarget,
bool
glViewer
::
pick_region
(
ACG
::
SceneGraph
::
PickTarget
_pickTarget
,
const
QRegion
&
_region
,
QList
<
QPair
<
unsigned
int
,
unsigned
int
>
>&
_list
,
QList
<
QPair
<
size_t
,
size_t
>
>&
_list
,
QVector
<
float
>*
_depths
,
QVector
<
ACG
::
Vec3d
>*
_points
)
{
...
...
@@ -565,7 +565,7 @@ bool glViewer::pick_region( ACG::SceneGraph::PickTarget _pickTarg
if
(
rv
.
size
()
<
2
)
continue
;
QPair
<
unsigned
int
,
unsigned
in
t
>
curr
(
rv
[
1
],
rv
[
0
]);
QPair
<
size_t
,
size_
t
>
curr
(
rv
[
1
],
rv
[
0
]);
// added a new (targetidx/nodeidx) pair
if
(
!
_list
.
contains
(
curr
))
...
...
Plugin-Components/ComponentsPlugin.cc
View file @
a68995aa
...
...
@@ -166,7 +166,7 @@ void ComponentsPlugin::splitComponents(QMouseEvent * _event)
{
if
(
_event
->
type
()
==
QEvent
::
MouseButtonPress
)
{
unsigned
int
node_idx
,
target_idx
;
size_t
node_idx
,
target_idx
;
ACG
::
Vec3d
*
sourcePoint3D
=
0
;
if
(
PluginFunctions
::
scenegraphPick
(
ACG
::
SceneGraph
::
PICK_FACE
,
...
...
@@ -193,7 +193,7 @@ void ComponentsPlugin::biggestComponent(QMouseEvent* _event)
{
if
(
_event
->
type
()
==
QEvent
::
MouseButtonPress
)
{
unsigned
int
node_idx
,
target_idx
;
size_t
node_idx
,
target_idx
;
ACG
::
Vec3d
*
sourcePoint3D
=
0
;
if
(
PluginFunctions
::
scenegraphPick
(
ACG
::
SceneGraph
::
PICK_FACE
,
...
...
Plugin-InfoMeshObject/MeshObjectInfoPlugin.cc
View file @
a68995aa
...
...
@@ -697,7 +697,7 @@ InfoMeshObjectPlugin::
ACG
::
SceneGraph
::
PickTarget
target
=
ACG
::
SceneGraph
::
PICK_FACE
;
unsigned
int
node_idx
,
target_idx
;
size_t
node_idx
,
target_idx
;
ACG
::
Vec3d
hit_point
;
if
(
info_
->
isHidden
())
...
...
Plugin-InfoSkeleton/SkeletonObjectInfoPlugin.cc
View file @
a68995aa
...
...
@@ -211,7 +211,7 @@ void InfoSkeletonObjectPlugin::slotInformationRequested(const QPoint _clickedPoi
ACG
::
SceneGraph
::
PickTarget
target
=
ACG
::
SceneGraph
::
PICK_ANYTHING
;
unsigned
int
node_idx
,
target_idx
;
size_t
node_idx
,
target_idx
;
ACG
::
Vec3d
hit_point
;
if
(
PluginFunctions
::
scenegraphPick
(
target
,
_clickedPoint
,
node_idx
,
target_idx
,
&
hit_point
))
{
...
...
Plugin-MaterialPicker/MaterialPicker.cc
View file @
a68995aa
...
...
@@ -269,7 +269,7 @@ void MaterialPicker::slotMouseEvent(QMouseEvent* _event) {
return
;
if
(
_event
->
type
()
==
QEvent
::
MouseButtonPress
)
{
unsigned
int
node_idx
,
target_idx
;
size_t
node_idx
,
target_idx
;
OpenMesh
::
Vec3d
hitPoint
;
// Get picked object's identifier by picking in scenegraph
...
...
Plugin-Move/MovePlugin.cc
View file @
a68995aa
...
...
@@ -863,7 +863,7 @@ void MovePlugin::ManipulatorPositionChanged(QtTranslationManipulatorNode* _node
* @param _snap Snap manipulator to nearest geometry primitive?
*/
void
MovePlugin
::
placeManip
(
QMouseEvent
*
_event
,
bool
_snap
)
{
unsigned
in
t
node_idx
,
target_idx
;
size_
t
node_idx
,
target_idx
;
OpenMesh
::
Vec3d
hitPoint
;
BaseObjectData
*
object
;
...
...
Plugin-PolyLine/PolyLinePlugin.cc
View file @
a68995aa
...
...
@@ -960,22 +960,23 @@ PolyLinePlugin::
me_insert
(
QMouseEvent
*
_event
)
{
if
(
_event
->
type
()
==
QEvent
::
MouseMove
)
{
if
(
create_point_ref_
)
{
// Pick position
unsigned
in
t
node_idx
,
target_idx
;
ACG
::
Vec3d
hit_point
;
if
(
PluginFunctions
::
scenegraphPick
(
ACG
::
SceneGraph
::
PICK_FACE
,
_event
->
pos
(),
node_idx
,
target_idx
,
&
hit_point
))
{
*
create_point_ref_
=
(
PolyLine
::
Point
)
hit_point
;
// update
emit
updatedObject
(
cur_insert_id_
,
UPDATE_GEOMETRY
);
}
// Pick position
size_
t
node_idx
,
target_idx
;
ACG
::
Vec3d
hit_point
;
if
(
PluginFunctions
::
scenegraphPick
(
ACG
::
SceneGraph
::
PICK_FACE
,
_event
->
pos
(),
node_idx
,
target_idx
,
&
hit_point
))
{
*
create_point_ref_
=
(
PolyLine
::
Point
)
hit_point
;
// update
emit
updatedObject
(
cur_insert_id_
,
UPDATE_GEOMETRY
);
}
}
return
;
}
// Pick position
unsigned
in
t
node_idx
,
target_idx
;
size_
t
node_idx
,
target_idx
;
ACG
::
Vec3d
hit_point
;
if
(
PluginFunctions
::
scenegraphPick
(
ACG
::
SceneGraph
::
PICK_FACE
,
_event
->
pos
(),
node_idx
,
target_idx
,
&
hit_point
))
{
...
...
@@ -1363,7 +1364,7 @@ me_delete( QMouseEvent* _event )
// MousePress ?
if
(
_event
->
type
()
==
QEvent
::
MouseButtonPress
)
{
unsigned
in
t
node_idx
,
target_idx
;
size_
t
node_idx
,
target_idx
;
ACG
::
Vec3d
hit_point
;
// pick
if
(
PluginFunctions
::
scenegraphPick
(
ACG
::
SceneGraph
::
PICK_ANYTHING
,
_event
->
pos
(),
node_idx
,
target_idx
,
&
hit_point
))
{
...
...
@@ -1386,19 +1387,19 @@ me_delete( QMouseEvent* _event )
namespace
{
bool
me_GetMeshHit
(
QMouseEvent
*
_event
,
ACG
::
SceneGraph
::
GlutPrimitiveNode
*
moveCircle_SelNode_
,
ACG
::
Vec3d
&
_hit_point
,
unsigned
in
t
&
_node_idx
,
unsigned
in
t
&
_targetIdx
)
bool
me_GetMeshHit
(
QMouseEvent
*
_event
,
ACG
::
SceneGraph
::
GlutPrimitiveNode
*
moveCircle_SelNode_
,
ACG
::
Vec3d
&
_hit_point
,
size_
t
&
_node_idx
,
size_
t
&
_targetIdx
)
{
unsigned
in
t
ndx
;
if
(
moveCircle_SelNode_
)
moveCircle_SelNode_
->
enablePicking
(
false
);
bool
hasHit
=
PluginFunctions
::
scenegraphPick
(
ACG
::
SceneGraph
::
PICK_FACE
,
_event
->
pos
(),
ndx
,
_targetIdx
,
&
_hit_point
);
if
(
moveCircle_SelNode_
)
moveCircle_SelNode_
->
enablePicking
(
true
);
BaseObjectData
*
obj
;
//if there is no current mesh use the newly found
if
(
hasHit
&&
PluginFunctions
::
getPickedObject
(
ndx
,
obj
)
&&
_node_idx
==
std
::
numeric_limits
<
unsigned
int
>::
max
())
_node_idx
=
obj
->
id
();
return
hasHit
;
size_
t
ndx
;
if
(
moveCircle_SelNode_
)
moveCircle_SelNode_
->
enablePicking
(
false
);
bool
hasHit
=
PluginFunctions
::
scenegraphPick
(
ACG
::
SceneGraph
::
PICK_FACE
,
_event
->
pos
(),
ndx
,
_targetIdx
,
&
_hit_point
);
if
(
moveCircle_SelNode_
)
moveCircle_SelNode_
->
enablePicking
(
true
);
BaseObjectData
*
obj
;
//if there is no current mesh use the newly found
if
(
hasHit
&&
PluginFunctions
::
getPickedObject
(
ndx
,
obj
)
&&
_node_idx
==
std
::
numeric_limits
<
unsigned
int
>::
max
())
_node_idx
=
obj
->
id
();
return
hasHit
;
}
void
me_UpdateCircleData
(
ACG
::
Vec3d
_hit_point
,
ACG
::
Vec3d
_onPlane
,
ACG
::
Vec3d
_nor
,
ACG
::
SceneGraph
::
GlutPrimitiveNode
*
_moveCircle_SelNode_
,
PolyLineCircleData
*
_lineData
,
bool
_isShift
)
...
...
@@ -1447,7 +1448,7 @@ me_move( QMouseEvent* _event )
// MousePress ? -> get reference point
if
(
_event
->
type
()
==
QEvent
::
MouseButtonPress
)
{
unsigned
in
t
node_idx
,
target_idx
;
size_
t
node_idx
,
target_idx
;
ACG
::
Vec3d
hit_point
;
// this is for picking the handles on a circle or spline
if
(
PluginFunctions
::
scenegraphPick
(
ACG
::
SceneGraph
::
PICK_ANYTHING
,
_event
->
pos
(),
node_idx
,
target_idx
,
&
hit_point
))
{
...
...
@@ -1497,7 +1498,7 @@ me_move( QMouseEvent* _event )
return
;
PolyLineCircleData
*
lineData
=
dynamic_cast
<
PolyLineCircleData
*>
(
lineObject
->
objectData
(
CIRCLE_DATA
));
ACG
::
Vec3d
hit_point
;
unsigned
in
t
target_idx
;
size_
t
target_idx
;
bool
hasHit
=
me_GetMeshHit
(
_event
,
moveCircle_SelNode_
,
hit_point
,
lineData
->
circleMeshIndex_
,
target_idx
);
if
(
lineData
->
circleMeshIndex_
==
std
::
numeric_limits
<
unsigned
int
>::
max
())
return
;
if
(
!
moveCircle_IsLocked
&&
hasHit
)
{
...
...
@@ -1546,7 +1547,7 @@ me_move( QMouseEvent* _event )
return
;
PolyLineBezierSplineData
*
lineData
=
dynamic_cast
<
PolyLineBezierSplineData
*>
(
lineObject
->
objectData
(
BEZSPLINE_DATA
));
ACG
::
Vec3d
hit_point
;
unsigned
in
t
target_idx
;
size_
t
target_idx
;
bool
hasHit
=
me_GetMeshHit
(
_event
,
moveBezSpline_SelNode_
,
hit_point
,
lineData
->
meshIndex_
,
target_idx
);
if
(
lineData
->
meshIndex_
==
std
::
numeric_limits
<
unsigned
int
>::
max
())
return
;
...
...
@@ -1607,8 +1608,8 @@ me_move( QMouseEvent* _event )
updatePolyBezierSpline
(
lineObject
,
tool_
->
sb_SplineSegNum
->
value
());
}
else
if
(
move_point_ref_
!=
0
)
{
ACG
::
Vec3d
hit_point
;
unsigned
in
t
node_idx
,
target_idx
;
ACG
::
Vec3d
hit_point
;
size_
t
node_idx
,
target_idx
;
if
(
PluginFunctions
::
scenegraphPick
(
ACG
::
SceneGraph
::
PICK_FACE
,
_event
->
pos
(),
node_idx
,
target_idx
,
&
hit_point
))
{
(
*
move_point_ref_
)
=
(
PolyLine
::
Point
)
hit_point
;
// update
...
...
@@ -1650,7 +1651,7 @@ me_split( QMouseEvent* _event )
// release old references
move_point_ref_
=
0
;
unsigned
in
t
node_idx
,
target_idx
;
size_
t
node_idx
,
target_idx
;
ACG
::
Vec3d
hit_point
;
// pick
if
(
PluginFunctions
::
scenegraphPick
(
ACG
::
SceneGraph
::
PICK_VERTEX
,
_event
->
pos
(),
node_idx
,
target_idx
,
&
hit_point
))
{
...
...
@@ -1722,7 +1723,7 @@ me_split( QMouseEvent* _event )
if
(
_event
->
type
()
==
QEvent
::
MouseMove
)
if
(
move_point_ref_
!=
0
)
{
unsigned
in
t
node_idx
,
target_idx
;
size_
t
node_idx
,
target_idx
;
ACG
::
Vec3d
hit_point
;
// pick
if
(
PluginFunctions
::
scenegraphPick
(
ACG
::
SceneGraph
::
PICK_FACE
,
_event
->
pos
(),
node_idx
,
target_idx
,
&
hit_point
))
{
...
...
@@ -1759,7 +1760,7 @@ me_merge( QMouseEvent* _event )
move_point_ref_
=
0
;
cur_merge_id_
=
-
1
;
unsigned
in
t
node_idx
,
target_idx
;
size_
t
node_idx
,
target_idx
;
ACG
::
Vec3d
hit_point
;
// pick
if
(
PluginFunctions
::
scenegraphPick
(
ACG
::
SceneGraph
::
PICK_VERTEX
,
_event
->
pos
(),
node_idx
,
target_idx
,
&
hit_point
))
{
...
...
@@ -1796,7 +1797,7 @@ me_merge( QMouseEvent* _event )
// Move ? -> move reference point
if
(
_event
->
type
()
==
QEvent
::
MouseMove
&&
cur_merge_id_
!=
-
1
)
if
(
move_point_ref_
!=
0
)
{
unsigned
in
t
node_idx
,
target_idx
;
size_
t
node_idx
,
target_idx
;
ACG
::
Vec3d
hit_point
;
// pick
if
(
PluginFunctions
::
scenegraphPick
(
ACG
::
SceneGraph
::
PICK_FACE
,
_event
->
pos
(),
node_idx
,
target_idx
,
&
hit_point
))
{
...
...
@@ -1828,7 +1829,7 @@ me_merge( QMouseEvent* _event )
move_point_ref_
=
0
;
}
unsigned
in
t
node_idx
,
target_idx
;
size_
t
node_idx
,
target_idx
;
ACG
::
Vec3d
hit_point
;
// pick
...
...
@@ -1978,7 +1979,7 @@ me_smart_move( QMouseEvent* _event )
// MousePress ? -> select vertex and start timer
if
(
_event
->
type
()
==
QEvent
::
MouseButtonPress
)
{
unsigned
in
t
node_idx
,
target_idx
;
size_
t
node_idx
,
target_idx
;
ACG
::
Vec3d
hit_point
;
// pick
...
...
@@ -2156,7 +2157,7 @@ pick_triangle_mesh( QPoint mPos,
_fh
=
TriMesh
::
FaceHandle
(
-
1
);
_vh
=
TriMesh
::
VertexHandle
(
-
1
);
unsigned
in
t
target_idx
=
0
,
node_idx
=
0
;
size_
t
target_idx
=
0
,
node_idx
=
0
;
ACG
::
Vec3d
hit_point
;
...
...
@@ -2225,7 +2226,7 @@ me_copyPasteMouse(QMouseEvent* _event)
copyPaste_ObjectId_
=
copyPaste_ActionType_
-
1
;
}
//determine the world pos
unsigned
in
t
target_idx
=
0
,
node_idx
=
0
;
size_
t
target_idx
=
0
,
node_idx
=
0
;
ACG
::
Vec3d
hit_point
;
if
(
PluginFunctions
::
scenegraphPick
(
ACG
::
SceneGraph
::
PICK_ANYTHING
,
_event
->
pos
(),
node_idx
,
target_idx
,
&
hit_point
)
)
{
if
(
copyPaste_ActionType_
==
1
)
{
//duplicate
...
...
@@ -2296,7 +2297,7 @@ slot_duplicate()
if
(
copyPaste_ObjectId_
==
-
1
||
!
PluginFunctions
::
getObject
(
copyPaste_ObjectId_
,
obj
))
return
;
//set mode for mouse move event
unsigned
in
t
target_idx
=
0
,
node_idx
=
0
;
size_
t
target_idx
=
0
,
node_idx
=
0
;
ACG
::
Vec3d
hit_point
;
//determine the world coordinate of the mouse
QPoint
mPos
=
copyPaste_LastMouse
;
...
...
Prev
1
2
Next
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