Commit a4b5790c by Kai Westerkamp

delete

parent c4814ea9
...@@ -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(){
......
...@@ -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();
} }
......
...@@ -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);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment