void MainWindow::updateObjectsRecursive(QTreeWidgetItem *item, Joint* parent){
    for(int i = 0 ; i < parent->howManyChilds() ; i++ ) {
        Joint *child = parent->childAt(i);
        QTreeWidgetItem *childitem = new QTreeWidgetItem(item,QStringList(QString(child->label().c_str())));
        updateObjectsRecursive(childitem, child);
        item_to_object_[childitem] = child;
        object_to_item_[child]  = childitem;
    }
    //    if(parent->ChildObject()!=NULL){
    //       new QTreeWidgetItem(item,QStringList(QString(parent->ChildObject()->label().c_str())));
    //    }
}
void MainWindow::updateObjects(){
    ui->treeWidget->clear();
    item_to_object_.clear();
    for( unsigned int i = 0 ; i < SceneContainer::howManyObjects() ; i++ ) {
        Joint* object =  SceneContainer::objectAt(i);
        QTreeWidgetItem *item = new QTreeWidgetItem(QStringList(QString(object->label().c_str())));
        updateObjectsRecursive(item, object);
        ui->treeWidget->addTopLevelItem(item);
        item_to_object_[item] = object;
        object_to_item_[object]  = item;
    }
    ui->treeWidget->expandAll();

    connect(ui->treeWidget, SIGNAL(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)), this, SLOT(updateCurrentSelected(QTreeWidgetItem*,QTreeWidgetItem*)));
    //ui->timebar->setKeyFrames((Object3D*)SceneContainer::ObjectAt(0));
    ui->timebar->update();
}