forked from qt-creator/qt-creator
QmlDesigner: Add camera alignment buttons
Add a button to 3D edit view that aligns the selected cameras to the view camera. Add another button that aligns the view camera to a selected camera. Task-number: QDS-4482 Change-Id: Ibe6ceaf498db10f45c8c351e3a108419d8d7a59b Reviewed-by: Samuel Ghinet <samuel.ghinet@qt.io> Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
This commit is contained in:
committed by
Miikka Heikkinen
parent
f6a26fb13e
commit
a03a50a262
@@ -30,6 +30,9 @@
|
||||
#include <viewmanager.h>
|
||||
#include <nodeinstanceview.h>
|
||||
#include <qmldesignerplugin.h>
|
||||
#include <nodemetainfo.h>
|
||||
|
||||
#include <utils/algorithm.h>
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
@@ -94,5 +97,21 @@ bool Edit3DAction::isEnabled(const SelectionContext &selectionContext) const
|
||||
return isVisible(selectionContext);
|
||||
}
|
||||
|
||||
Edit3DCameraAction::Edit3DCameraAction(const QByteArray &menuId, View3DActionCommand::Type type,
|
||||
const QString &description, const QKeySequence &key,
|
||||
bool checkable, bool checked, const QIcon &iconOff,
|
||||
const QIcon &iconOn,
|
||||
SelectionContextOperation selectionAction)
|
||||
: Edit3DAction(menuId, type, description, key, checkable, checked, iconOff, iconOn, selectionAction)
|
||||
{
|
||||
}
|
||||
|
||||
bool Edit3DCameraAction::isEnabled(const SelectionContext &selectionContext) const
|
||||
{
|
||||
return Utils::anyOf(selectionContext.selectedModelNodes(), [](const ModelNode &node) {
|
||||
return node.isValid() && node.metaInfo().isSubclassOf("QQuick3D.Camera");
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user