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
Plugin-Datacontrol
Commits
ec82e26a
Commit
ec82e26a
authored
Oct 30, 2020
by
Jan Möbius
Browse files
Use ranges for Object Iteration to simplify code
parent
1a6970ce
Changes
3
Show whitespace changes
Inline
Side-by-side
DataControlPlugin.cc
View file @
ec82e26a
...
@@ -863,7 +863,7 @@ void DataControlPlugin::propagateDownwards(BaseObject* _obj, int _column ){
...
@@ -863,7 +863,7 @@ void DataControlPlugin::propagateDownwards(BaseObject* _obj, int _column ){
*/
*/
void
DataControlPlugin
::
slotBoundingBoxChange
(
)
void
DataControlPlugin
::
slotBoundingBoxChange
(
)
{
{
for
(
PluginFunctions
::
ObjectIterator
o_it
;
o_it
!=
PluginFunctions
::
objects
End
();
++
o_it
)
{
for
(
auto
*
o_it
:
PluginFunctions
::
objects
())
{
updateBoundingBox
(
o_it
);
updateBoundingBox
(
o_it
);
}
}
...
...
DataControlPluginScripting.cc
View file @
ec82e26a
...
@@ -454,8 +454,7 @@ void DataControlPlugin::setAllTarget() {
...
@@ -454,8 +454,7 @@ void DataControlPlugin::setAllTarget() {
if
(
action
!=
0
&&
action
->
data
().
isValid
()
)
if
(
action
!=
0
&&
action
->
data
().
isValid
()
)
type
=
(
DataType
)
action
->
data
().
toUInt
();
type
=
(
DataType
)
action
->
data
().
toUInt
();
for
(
PluginFunctions
::
ObjectIterator
o_it
(
PluginFunctions
::
ALL_OBJECTS
,
type
)
;
for
(
auto
*
o_it
:
PluginFunctions
::
objects
(
PluginFunctions
::
ALL_OBJECTS
,
type
)
)
{
o_it
!=
PluginFunctions
::
objectsEnd
();
++
o_it
){
o_it
->
target
(
true
);
o_it
->
target
(
true
);
}
}
}
}
...
@@ -476,8 +475,7 @@ void DataControlPlugin::setAllSource() {
...
@@ -476,8 +475,7 @@ void DataControlPlugin::setAllSource() {
if
(
action
!=
0
&&
action
->
data
().
isValid
()
)
if
(
action
!=
0
&&
action
->
data
().
isValid
()
)
type
=
(
DataType
)
action
->
data
().
toUInt
();
type
=
(
DataType
)
action
->
data
().
toUInt
();
for
(
PluginFunctions
::
ObjectIterator
o_it
(
PluginFunctions
::
ALL_OBJECTS
,
type
)
;
for
(
auto
*
o_it
:
PluginFunctions
::
objects
(
PluginFunctions
::
ALL_OBJECTS
,
type
)
)
{
o_it
!=
PluginFunctions
::
objectsEnd
();
++
o_it
){
o_it
->
source
(
true
);
o_it
->
source
(
true
);
}
}
}
}
...
@@ -498,8 +496,7 @@ void DataControlPlugin::clearAllTarget() {
...
@@ -498,8 +496,7 @@ void DataControlPlugin::clearAllTarget() {
if
(
action
!=
0
&&
action
->
data
().
isValid
()
)
if
(
action
!=
0
&&
action
->
data
().
isValid
()
)
type
=
(
DataType
)
action
->
data
().
toUInt
();
type
=
(
DataType
)
action
->
data
().
toUInt
();
for
(
PluginFunctions
::
ObjectIterator
o_it
(
PluginFunctions
::
ALL_OBJECTS
,
type
)
;
for
(
auto
*
o_it
:
PluginFunctions
::
objects
(
PluginFunctions
::
ALL_OBJECTS
,
type
)
)
{
o_it
!=
PluginFunctions
::
objectsEnd
();
++
o_it
){
o_it
->
target
(
false
);
o_it
->
target
(
false
);
}
}
}
}
...
@@ -520,8 +517,7 @@ void DataControlPlugin::clearAllSource() {
...
@@ -520,8 +517,7 @@ void DataControlPlugin::clearAllSource() {
if
(
action
!=
0
&&
action
->
data
().
isValid
()
)
if
(
action
!=
0
&&
action
->
data
().
isValid
()
)
type
=
(
DataType
)
action
->
data
().
toUInt
();
type
=
(
DataType
)
action
->
data
().
toUInt
();
for
(
PluginFunctions
::
ObjectIterator
o_it
(
PluginFunctions
::
ALL_OBJECTS
,
type
)
;
for
(
auto
*
o_it
:
PluginFunctions
::
objects
(
PluginFunctions
::
ALL_OBJECTS
,
type
)
)
{
o_it
!=
PluginFunctions
::
objectsEnd
();
++
o_it
){
o_it
->
source
(
false
);
o_it
->
source
(
false
);
}
}
}
}
...
@@ -545,8 +541,7 @@ void DataControlPlugin::hideAll() {
...
@@ -545,8 +541,7 @@ void DataControlPlugin::hideAll() {
if
(
action
!=
0
&&
action
->
data
().
isValid
()
)
if
(
action
!=
0
&&
action
->
data
().
isValid
()
)
type
=
(
DataType
)
action
->
data
().
toUInt
();
type
=
(
DataType
)
action
->
data
().
toUInt
();
for
(
PluginFunctions
::
ObjectIterator
o_it
(
PluginFunctions
::
ALL_OBJECTS
,
type
)
;
for
(
auto
*
o_it
:
PluginFunctions
::
objects
(
PluginFunctions
::
ALL_OBJECTS
,
type
)
)
{
o_it
!=
PluginFunctions
::
objectsEnd
();
++
o_it
){
o_it
->
hide
();
o_it
->
hide
();
}
}
...
@@ -571,7 +566,7 @@ void DataControlPlugin::showAll() {
...
@@ -571,7 +566,7 @@ void DataControlPlugin::showAll() {
if
(
action
!=
0
&&
action
->
data
().
isValid
()
)
if
(
action
!=
0
&&
action
->
data
().
isValid
()
)
type
=
(
DataType
)
action
->
data
().
toUInt
();
type
=
(
DataType
)
action
->
data
().
toUInt
();
for
(
PluginFunctions
::
O
bject
Iterator
o_it
(
PluginFunctions
::
ALL_OBJECTS
,
type
)
;
o_it
!=
PluginFunctions
::
objectsEnd
();
++
o_it
)
{
for
(
auto
*
o_it
:
PluginFunctions
::
o
bject
s
(
PluginFunctions
::
ALL_OBJECTS
,
type
)
)
{
o_it
->
show
();
o_it
->
show
();
}
}
...
@@ -586,8 +581,9 @@ IdList DataControlPlugin::getTargetObjects(DataType _type) {
...
@@ -586,8 +581,9 @@ IdList DataControlPlugin::getTargetObjects(DataType _type) {
IdList
list
;
IdList
list
;
for
(
PluginFunctions
::
O
bject
Iterator
o_it
(
PluginFunctions
::
TARGET_OBJECTS
,
_type
)
;
o_it
!=
PluginFunctions
::
objectsEnd
();
++
o_it
)
for
(
auto
*
o_it
:
PluginFunctions
::
o
bject
s
(
PluginFunctions
::
TARGET_OBJECTS
,
_type
)
)
{
list
.
push_back
(
o_it
->
id
()
);
list
.
push_back
(
o_it
->
id
()
);
}
return
list
;
return
list
;
}
}
...
@@ -601,8 +597,9 @@ IdList DataControlPlugin::getSourceObjects(DataType _type) {
...
@@ -601,8 +597,9 @@ IdList DataControlPlugin::getSourceObjects(DataType _type) {
IdList
list
;
IdList
list
;
for
(
PluginFunctions
::
O
bject
Iterator
o_it
(
PluginFunctions
::
SOURCE_OBJECTS
,
_type
)
;
o_it
!=
PluginFunctions
::
objectsEnd
();
++
o_it
)
for
(
auto
*
o_it
:
PluginFunctions
::
o
bject
s
(
PluginFunctions
::
SOURCE_OBJECTS
,
_type
)
)
{
list
.
push_back
(
o_it
->
id
()
);
list
.
push_back
(
o_it
->
id
()
);
}
return
list
;
return
list
;
}
}
...
@@ -614,8 +611,9 @@ IdList DataControlPlugin::getSourceObjects(DataType _type) {
...
@@ -614,8 +611,9 @@ IdList DataControlPlugin::getSourceObjects(DataType _type) {
*/
*/
void
DataControlPlugin
::
printObjectInfoToLog
()
{
void
DataControlPlugin
::
printObjectInfoToLog
()
{
for
(
PluginFunctions
::
O
bject
Iterator
o_it
(
PluginFunctions
::
ALL_OBJECTS
)
;
o_it
!=
PluginFunctions
::
objectsEnd
();
++
o_it
)
for
(
auto
*
o_it
:
PluginFunctions
::
o
bject
s
(
PluginFunctions
::
ALL_OBJECTS
)
)
{
emit
log
(
LOGINFO
,
tr
(
"Object
\"
%1
\"
with ID %2 of type %3 "
).
arg
(
o_it
->
name
()).
arg
(
o_it
->
id
()).
arg
(
o_it
->
dataType
().
name
()));
emit
log
(
LOGINFO
,
tr
(
"Object
\"
%1
\"
with ID %2 of type %3 "
).
arg
(
o_it
->
name
()).
arg
(
o_it
->
id
()).
arg
(
o_it
->
dataType
().
name
()));
}
}
}
//******************************************************************************
//******************************************************************************
...
@@ -628,7 +626,7 @@ void DataControlPlugin::printObjectInfoToLog() {
...
@@ -628,7 +626,7 @@ void DataControlPlugin::printObjectInfoToLog() {
*/
*/
unsigned
int
DataControlPlugin
::
groupCount
()
const
{
unsigned
int
DataControlPlugin
::
groupCount
()
const
{
unsigned
int
count
=
0
;
unsigned
int
count
=
0
;
for
(
PluginFunctions
::
BaseObjectIterator
o_it
(
PluginFunctions
::
ALL_OBJECTS
,
DATA_GROUP
)
;
o_it
!=
PluginFunctions
::
objectsEnd
();
++
o_it
)
for
(
auto
*
o_it
:
PluginFunctions
::
objects
(
PluginFunctions
::
ALL_OBJECTS
,
DATA_GROUP
)
)
++
count
;
++
count
;
return
count
;
return
count
;
...
...
Popup.cc
View file @
ec82e26a
...
@@ -321,8 +321,7 @@ void DataControlPlugin::slotHeaderCustomContextMenuRequested ( const QPoint & _p
...
@@ -321,8 +321,7 @@ void DataControlPlugin::slotHeaderCustomContextMenuRequested ( const QPoint & _p
//get all used types
//get all used types
QVector
<
DataType
>
types
;
QVector
<
DataType
>
types
;
for
(
PluginFunctions
::
ObjectIterator
o_it
(
PluginFunctions
::
ALL_OBJECTS
)
;
for
(
auto
*
o_it
:
PluginFunctions
::
objects
(
PluginFunctions
::
ALL_OBJECTS
)
)
o_it
!=
PluginFunctions
::
objectsEnd
();
++
o_it
)
if
(
!
types
.
contains
(
o_it
->
dataType
()
)
)
if
(
!
types
.
contains
(
o_it
->
dataType
()
)
)
types
.
push_back
(
o_it
->
dataType
()
);
types
.
push_back
(
o_it
->
dataType
()
);
...
@@ -478,8 +477,7 @@ void DataControlPlugin::slotCopyMaterialToTargeted() {
...
@@ -478,8 +477,7 @@ void DataControlPlugin::slotCopyMaterialToTargeted() {
BaseObjectData
*
itemData
=
dynamic_cast
<
BaseObjectData
*
>
(
item
);
BaseObjectData
*
itemData
=
dynamic_cast
<
BaseObjectData
*
>
(
item
);
const
ACG
::
SceneGraph
::
Material
&
sourceMaterial
=
itemData
->
materialNode
()
->
material
();
const
ACG
::
SceneGraph
::
Material
&
sourceMaterial
=
itemData
->
materialNode
()
->
material
();
for
(
PluginFunctions
::
ObjectIterator
o_it
(
PluginFunctions
::
TARGET_OBJECTS
);
for
(
auto
*
o_it
:
PluginFunctions
::
objects
(
PluginFunctions
::
TARGET_OBJECTS
)
)
{
o_it
!=
PluginFunctions
::
objectsEnd
();
++
o_it
)
{
MaterialNode
*
const
materialNode
=
o_it
->
materialNode
();
MaterialNode
*
const
materialNode
=
o_it
->
materialNode
();
if
(
materialNode
)
{
if
(
materialNode
)
{
...
...
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