Commit a4b5790c by Kai Westerkamp

delete

parent c4814ea9
......@@ -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(){
......
......@@ -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();
}
......
......@@ -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);
}
......
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