Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
GraPa
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kai Westerkamp
GraPa
Commits
a4b5790c
Commit
a4b5790c
authored
Nov 23, 2015
by
Kai Westerkamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
delete
parent
c4814ea9
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
15 deletions
+20
-15
mainwindow.cpp
A2/mainwindow.cpp
+3
-1
scene.cpp
A2/scene.cpp
+12
-7
sceneobject.cpp
A2/sceneobject.cpp
+5
-7
No files found.
A2/mainwindow.cpp
View file @
a4b5790c
...
...
@@ -240,7 +240,9 @@ void MainWindow::initDoc()
void
MainWindow
::
updateStatusBar
()
{
statusBar
->
showMessage
(
scene
->
getActive
()
->
getName
());
QString
text
=
scene
->
getActive
()
->
getName
();
statusBar
->
showMessage
(
text
);
qDebug
()
<<
"updateStatusBar()"
<<
text
;
}
void
MainWindow
::
showSingle
(){
...
...
A2/scene.cpp
View file @
a4b5790c
...
...
@@ -45,14 +45,12 @@ void Scene::addSceneObjectTaActive(SceneObject *obj){
if
(
active
->
isNode
()){
// qDebug()<<"Active is Node "<<active->getName();
parent
=
static_cast
<
SceneNode
*>
(
active
);
parentIndex
=
activeIndex
;
}
else
{
parent
=
static_cast
<
SceneNode
*>
(
active
->
getParent
());
parentIndex
=
activeIndex
.
parent
();
// qDebug()<<"Active is Primitve "<<active->getName()<<"Parent"<<parent->getName();
}
beginInsertRows
(
parentIndex
,
parent
->
childCount
(),
parent
->
childCount
());
...
...
@@ -118,17 +116,24 @@ void Scene::addNode()
void
Scene
::
deletActive
()
{
QModelIndex
parentIndex
=
activeIndex
.
parent
();
SceneNode
*
parent
=
static_cast
<
SceneNode
*>
(
active
->
getParent
());
int
number
=
active
->
childNumber
();
beginRemoveColumns
(
parentIndex
,
number
,
number
);
parent
->
remove
(
number
);
endRemoveColumns
();
int
pos
=
active
->
childNumber
();
qDebug
()
<<
"Delet Active in Scene"
<<
parentIndex
<<
parent
->
childCount
()
<<
pos
;
foreach
(
SceneObject
*
t
,
parent
->
getChildren
())
{
qDebug
()
<<
t
->
getName
()
<<
t
->
childNumber
();
}
beginRemoveRows
(
parentIndex
,
pos
,
pos
);
parent
->
remove
(
pos
);
endRemoveRows
();
active
=
parent
;
activeIndex
=
parentIndex
;
qDebug
()
<<
"Delet Active in Scene"
<<
active
<<
activeIndex
<<
active
->
getName
();
emit
activChanged
();
}
...
...
A2/sceneobject.cpp
View file @
a4b5790c
...
...
@@ -28,11 +28,10 @@ int SceneObject::childCount() const
int
SceneObject
::
childNumber
()
const
{
if
(
parent
&&
parent
->
isNode
()
){
if
(
parent
){
SceneNode
*
node
=
static_cast
<
SceneNode
*>
(
parent
);
node
->
getChildren
().
indexOf
(
const_cast
<
SceneObject
*>
(
this
));
return
node
->
getChildren
().
indexOf
(
const_cast
<
SceneObject
*>
(
this
));
}
return
0
;
}
...
...
@@ -43,7 +42,6 @@ int SceneObject::columnCount() const
QVariant
SceneObject
::
data
(
int
column
)
const
{
//qDebug()<<"Data "<<column<<"="<<name;
if
(
column
==
0
)
return
name
;
return
itemData
.
value
(
column
);
...
...
@@ -51,10 +49,12 @@ QVariant SceneObject::data(int column) const
bool
SceneObject
::
setData
(
int
column
,
const
QVariant
&
value
)
{
qDebug
()
<<
"Set Data called"
;
if
(
column
<
0
||
column
>=
itemData
.
size
())
return
false
;
itemData
[
column
]
=
value
;
if
(
column
==
0
)
setName
(
value
.
toString
());
else
itemData
[
column
]
=
value
;
return
true
;
}
...
...
@@ -67,7 +67,6 @@ int SceneObject::getID(){return id;}
QString
SceneObject
::
getName
(){
return
name
;}
QQuaternion
SceneObject
::
getGlobalRotation
(){
qDebug
()
<<
this
->
getName
()
<<
" "
<<
parent
;
if
(
parent
==
NULL
)
return
QQuaternion
();
else
...
...
@@ -78,7 +77,6 @@ QQuaternion SceneObject::getGlobalRotation(){
void
SceneObject
::
move
(
QVector3D
dir
)
{
QQuaternion
rot
=
parent
->
getGlobalRotation
();
qDebug
()
<<
rot
;
translation
+=
rot
.
conjugate
().
rotatedVector
(
dir
);
}
...
...
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