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
Hide 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()
...
@@ -240,7 +240,9 @@ void MainWindow::initDoc()
void
MainWindow
::
updateStatusBar
()
void
MainWindow
::
updateStatusBar
()
{
{
statusBar
->
showMessage
(
scene
->
getActive
()
->
getName
());
QString
text
=
scene
->
getActive
()
->
getName
();
statusBar
->
showMessage
(
text
);
qDebug
()
<<
"updateStatusBar()"
<<
text
;
}
}
void
MainWindow
::
showSingle
(){
void
MainWindow
::
showSingle
(){
...
...
A2/scene.cpp
View file @
a4b5790c
...
@@ -45,14 +45,12 @@ void Scene::addSceneObjectTaActive(SceneObject *obj){
...
@@ -45,14 +45,12 @@ void Scene::addSceneObjectTaActive(SceneObject *obj){
if
(
active
->
isNode
()){
if
(
active
->
isNode
()){
// qDebug()<<"Active is Node "<<active->getName();
parent
=
static_cast
<
SceneNode
*>
(
active
);
parent
=
static_cast
<
SceneNode
*>
(
active
);
parentIndex
=
activeIndex
;
parentIndex
=
activeIndex
;
}
else
{
}
else
{
parent
=
static_cast
<
SceneNode
*>
(
active
->
getParent
());
parent
=
static_cast
<
SceneNode
*>
(
active
->
getParent
());
parentIndex
=
activeIndex
.
parent
();
parentIndex
=
activeIndex
.
parent
();
// qDebug()<<"Active is Primitve "<<active->getName()<<"Parent"<<parent->getName();
}
}
beginInsertRows
(
parentIndex
,
parent
->
childCount
(),
parent
->
childCount
());
beginInsertRows
(
parentIndex
,
parent
->
childCount
(),
parent
->
childCount
());
...
@@ -118,17 +116,24 @@ void Scene::addNode()
...
@@ -118,17 +116,24 @@ void Scene::addNode()
void
Scene
::
deletActive
()
void
Scene
::
deletActive
()
{
{
QModelIndex
parentIndex
=
activeIndex
.
parent
();
QModelIndex
parentIndex
=
activeIndex
.
parent
();
SceneNode
*
parent
=
static_cast
<
SceneNode
*>
(
active
->
getParent
());
SceneNode
*
parent
=
static_cast
<
SceneNode
*>
(
active
->
getParent
());
int
number
=
active
->
childNumber
();
int
pos
=
active
->
childNumber
();
beginRemoveColumns
(
parentIndex
,
number
,
number
);
qDebug
()
<<
"Delet Active in Scene"
<<
parentIndex
<<
parent
->
childCount
()
<<
pos
;
parent
->
remove
(
number
);
foreach
(
SceneObject
*
t
,
parent
->
getChildren
())
{
endRemoveColumns
();
qDebug
()
<<
t
->
getName
()
<<
t
->
childNumber
();
}
beginRemoveRows
(
parentIndex
,
pos
,
pos
);
parent
->
remove
(
pos
);
endRemoveRows
();
active
=
parent
;
active
=
parent
;
activeIndex
=
parentIndex
;
activeIndex
=
parentIndex
;
qDebug
()
<<
"Delet Active in Scene"
<<
active
<<
activeIndex
<<
active
->
getName
();
emit
activChanged
();
emit
activChanged
();
}
}
...
...
A2/sceneobject.cpp
View file @
a4b5790c
...
@@ -28,11 +28,10 @@ int SceneObject::childCount() const
...
@@ -28,11 +28,10 @@ int SceneObject::childCount() const
int
SceneObject
::
childNumber
()
const
int
SceneObject
::
childNumber
()
const
{
{
if
(
parent
&&
parent
->
isNode
()
){
if
(
parent
){
SceneNode
*
node
=
static_cast
<
SceneNode
*>
(
parent
);
SceneNode
*
node
=
static_cast
<
SceneNode
*>
(
parent
);
node
->
getChildren
().
indexOf
(
const_cast
<
SceneObject
*>
(
this
));
return
node
->
getChildren
().
indexOf
(
const_cast
<
SceneObject
*>
(
this
));
}
}
return
0
;
return
0
;
}
}
...
@@ -43,7 +42,6 @@ int SceneObject::columnCount() const
...
@@ -43,7 +42,6 @@ int SceneObject::columnCount() const
QVariant
SceneObject
::
data
(
int
column
)
const
QVariant
SceneObject
::
data
(
int
column
)
const
{
{
//qDebug()<<"Data "<<column<<"="<<name;
if
(
column
==
0
)
return
name
;
if
(
column
==
0
)
return
name
;
return
itemData
.
value
(
column
);
return
itemData
.
value
(
column
);
...
@@ -51,10 +49,12 @@ QVariant SceneObject::data(int column) const
...
@@ -51,10 +49,12 @@ QVariant SceneObject::data(int column) const
bool
SceneObject
::
setData
(
int
column
,
const
QVariant
&
value
)
bool
SceneObject
::
setData
(
int
column
,
const
QVariant
&
value
)
{
{
qDebug
()
<<
"Set Data called"
;
if
(
column
<
0
||
column
>=
itemData
.
size
())
if
(
column
<
0
||
column
>=
itemData
.
size
())
return
false
;
return
false
;
itemData
[
column
]
=
value
;
if
(
column
==
0
)
setName
(
value
.
toString
());
else
itemData
[
column
]
=
value
;
return
true
;
return
true
;
}
}
...
@@ -67,7 +67,6 @@ int SceneObject::getID(){return id;}
...
@@ -67,7 +67,6 @@ int SceneObject::getID(){return id;}
QString
SceneObject
::
getName
(){
return
name
;}
QString
SceneObject
::
getName
(){
return
name
;}
QQuaternion
SceneObject
::
getGlobalRotation
(){
QQuaternion
SceneObject
::
getGlobalRotation
(){
qDebug
()
<<
this
->
getName
()
<<
" "
<<
parent
;
if
(
parent
==
NULL
)
if
(
parent
==
NULL
)
return
QQuaternion
();
return
QQuaternion
();
else
else
...
@@ -78,7 +77,6 @@ QQuaternion SceneObject::getGlobalRotation(){
...
@@ -78,7 +77,6 @@ QQuaternion SceneObject::getGlobalRotation(){
void
SceneObject
::
move
(
QVector3D
dir
)
void
SceneObject
::
move
(
QVector3D
dir
)
{
{
QQuaternion
rot
=
parent
->
getGlobalRotation
();
QQuaternion
rot
=
parent
->
getGlobalRotation
();
qDebug
()
<<
rot
;
translation
+=
rot
.
conjugate
().
rotatedVector
(
dir
);
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