Skip to content
GitLab
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
Commits
0f09f6d0
Commit
0f09f6d0
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
75523dcc
Changes
11
Hide whitespace changes
Inline
Side-by-side
BasePlugin/PluginFunctions.cc
View file @
0f09f6d0
...
...
@@ -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
)
{
...
...
BasePlugin/PluginFunctions.hh
View file @
0f09f6d0
...
...
@@ -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
);
...
...
Core/Core.cc
View file @
0f09f6d0
...
...
@@ -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
))
{
...
...
Documentation/DeveloperHelpSources/changelog.docu
View file @
0f09f6d0
...
...
@@ -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
...
...
publicWidgets/objectSelectionWidget/objectPickDialog.cc
View file @
0f09f6d0
...
...
@@ -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
))
...
...
widgets/coreWidget/ContextMenu.cc
View file @
0f09f6d0
...
...
@@ -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
;
...
...
widgets/coreWidget/dragAndDrop.cc
View file @
0f09f6d0
...
...
@@ -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
,
...
...
widgets/glWidget/QtBaseViewer.cc
View file @
0f09f6d0
...
...
@@ -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
...
...
widgets/glWidget/QtBaseViewer.hh
View file @
0f09f6d0
...
...
@@ -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:
...
...
widgets/glWidget/QtBaseViewerFlyAnimation.cc
View file @
0f09f6d0
...
...
@@ -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
))
...
...
widgets/glWidget/QtBaseViewerPicking.cc
View file @
0f09f6d0
...
...
@@ -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
))
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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