many small fixes, RU lang
This commit is contained in:
@@ -109,8 +109,9 @@ QList<QAction *> SceneTree::actionsAdd() {
|
||||
QList<QAction *> SceneTree::actionsSelection() {
|
||||
QList<QAction *> ret;
|
||||
ret << ui->actionFocus << newSeparator() << ui->actionGroup << ui->actionClone << newSeparator() << ui->actionSelect_parent
|
||||
<< ui->actionSelect_by_mesh << ui->actionSelect_by_material << newSeparator() << ui->actionTransfer_transform_to_children
|
||||
<< newSeparator() << ui->actionActive_camera << ui->actionDefault_camera << newSeparator() << ui->actionRemove;
|
||||
<< ui->actionSelect_by_mesh << ui->actionSelect_by_material << newSeparator() << ui->actionMove_to_parent
|
||||
<< ui->actionTransfer_transform_to_children << newSeparator() << ui->actionActive_camera << ui->actionDefault_camera
|
||||
<< newSeparator() << ui->actionRemove;
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -194,6 +195,19 @@ ObjectBase * SceneTree::itemObject(QTreeWidgetItem * item) const {
|
||||
}
|
||||
|
||||
|
||||
ObjectBase * SceneTree::insertTarget() const {
|
||||
auto sil = ui->treeObjects->selectedItems();
|
||||
QSet<ObjectBase *> parents;
|
||||
for (auto * i: sil) {
|
||||
auto * p = itemObject(i);
|
||||
if (p) p = p->parent();
|
||||
if (p) parents << p;
|
||||
}
|
||||
if (parents.size() != 1) return nullptr;
|
||||
return parents.values()[0];
|
||||
}
|
||||
|
||||
|
||||
int SceneTree::itemType(QTreeWidgetItem * item) const {
|
||||
if (!item) return otNode;
|
||||
return item->data(cName, irType).toInt();
|
||||
@@ -291,6 +305,7 @@ void SceneTree::checkActions() {
|
||||
ui->actionClone->setEnabled(has_1);
|
||||
ui->actionGroup->setEnabled(has_m);
|
||||
ui->actionTransfer_transform_to_children->setEnabled(has_1);
|
||||
ui->actionMove_to_parent->setEnabled(has_1);
|
||||
ui->actionSelect_parent->setEnabled(has_1);
|
||||
ui->actionSelect_by_mesh->setEnabled(has_mesh);
|
||||
ui->actionSelect_by_material->setEnabled(has_mesh);
|
||||
@@ -378,7 +393,8 @@ void SceneTree::on_treeObjects_itemMoved(QTreeWidgetItem * item, QTreeWidgetItem
|
||||
void SceneTree::on_actionAdd_node_triggered() {
|
||||
if (!view) return;
|
||||
ObjectBase * no = new ObjectBase();
|
||||
view->scene()->addObject(no);
|
||||
no->setName("node");
|
||||
view->scene()->addObject(no, insertTarget());
|
||||
view->scene()->selectObject(no);
|
||||
}
|
||||
|
||||
@@ -386,7 +402,8 @@ void SceneTree::on_actionAdd_node_triggered() {
|
||||
void SceneTree::on_actionAdd_light_triggered() {
|
||||
if (!view) return;
|
||||
ObjectBase * no = new Light();
|
||||
view->scene()->addObject(no);
|
||||
no->setName("light");
|
||||
view->scene()->addObject(no, insertTarget());
|
||||
view->scene()->selectObject(no);
|
||||
}
|
||||
|
||||
@@ -394,7 +411,8 @@ void SceneTree::on_actionAdd_light_triggered() {
|
||||
void SceneTree::on_actionAdd_camera_triggered() {
|
||||
if (!view) return;
|
||||
ObjectBase * no = new Camera();
|
||||
view->scene()->addObject(no);
|
||||
no->setName("camera");
|
||||
view->scene()->addObject(no, insertTarget());
|
||||
view->scene()->selectObject(no);
|
||||
}
|
||||
|
||||
@@ -434,6 +452,20 @@ void SceneTree::on_actionTransfer_transform_to_children_triggered() {
|
||||
}
|
||||
|
||||
|
||||
void SceneTree::on_actionMove_to_parent_triggered() {
|
||||
if (!view) return;
|
||||
ObjectBaseList sol = view->scene()->selectedObjects(true);
|
||||
foreach(ObjectBase * o, sol) {
|
||||
auto * old_p = o->parent();
|
||||
if (!old_p) continue;
|
||||
auto * new_p = old_p->parent();
|
||||
if (!new_p) continue;
|
||||
old_p->removeChild(o);
|
||||
new_p->addChild(o);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void SceneTree::on_actionActive_camera_triggered() {
|
||||
if (!view) return;
|
||||
ObjectBase * o = view->scene()->selectedObject();
|
||||
|
||||
Reference in New Issue
Block a user