Merge branch 'main' of https://github.com/aws-lumberyard/o3de into ly-as-sdk/LYN-2948-phistere
This commit is contained in:
@@ -1,290 +0,0 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
// Original file Copyright Crytek GMBH or its affiliates, used under license.
|
||||
|
||||
#include "EditorDefs.h"
|
||||
|
||||
#include "AlembicCompileDialog.h"
|
||||
|
||||
// Qt
|
||||
#include <QPushButton>
|
||||
|
||||
// AzCore
|
||||
#include <AzCore/Utils/Utils.h>
|
||||
|
||||
#include <Pak/CryPakUtils.h>
|
||||
|
||||
// Editor
|
||||
#include "Util/PathUtil.h"
|
||||
#include "Util/EditorUtils.h"
|
||||
|
||||
|
||||
AZ_PUSH_DISABLE_DLL_EXPORT_MEMBER_WARNING
|
||||
#include <Alembic/ui_AlembicCompileDialog.h>
|
||||
AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING
|
||||
|
||||
CAlembicCompileDialog::CAlembicCompileDialog(const XmlNodeRef config)
|
||||
: m_ui(new Ui::AlembicCompileDialog)
|
||||
{
|
||||
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
|
||||
m_ui->setupUi(this);
|
||||
m_config = LoadConfig("", config);
|
||||
|
||||
OnInitDialog();
|
||||
|
||||
connect(m_ui->m_yUpRadio, &QRadioButton::clicked, this, &CAlembicCompileDialog::OnRadioYUp);
|
||||
connect(m_ui->m_zUpRadio, &QRadioButton::clicked, this, &CAlembicCompileDialog::OnRadioZUp);
|
||||
connect(m_ui->m_playbackFromMemoryCheckBox, &QCheckBox::clicked, this, &CAlembicCompileDialog::OnPlaybackFromMemory);
|
||||
connect(m_ui->m_blockCompressionFormatCombo, &QComboBox::currentTextChanged, this, &CAlembicCompileDialog::OnBlockCompressionSelected);
|
||||
connect(m_ui->m_meshPredictionCheckBox, &QCheckBox::clicked, this, &CAlembicCompileDialog::OnMeshPredictionCheckBox);
|
||||
connect(m_ui->m_useBFramesCheckBox, &QCheckBox::clicked, this, &CAlembicCompileDialog::OnUseBFramesCheckBox);
|
||||
connect(m_ui->m_indexFrameDistanceEdit, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), this, &CAlembicCompileDialog::OnIndexFrameDistanceChanged);
|
||||
connect(m_ui->m_positionPrecisionEdit, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), this, &CAlembicCompileDialog::OnPositionPrecisionChanged);
|
||||
connect(m_ui->m_uvMaxEdit, static_cast<void (QDoubleSpinBox::*)(double)>(&QDoubleSpinBox::valueChanged), this, &CAlembicCompileDialog::OnUVmaxChanged);
|
||||
connect(m_ui->m_presetComboBox, &QComboBox::currentTextChanged, this, &CAlembicCompileDialog::OnPresetSelected);
|
||||
}
|
||||
|
||||
CAlembicCompileDialog::~CAlembicCompileDialog()
|
||||
{
|
||||
}
|
||||
|
||||
void CAlembicCompileDialog::OnInitDialog()
|
||||
{
|
||||
// custom 'Ok' and 'Cancel' text for this dialog
|
||||
m_ui->buttonBox->button(QDialogButtonBox::Ok)->setText("Recompile .cax File");
|
||||
m_ui->buttonBox->button(QDialogButtonBox::Cancel)->setText("Use Existing .cax File");
|
||||
|
||||
m_ui->m_blockCompressionFormatCombo->addItem(QStringLiteral("store"));
|
||||
m_ui->m_blockCompressionFormatCombo->addItem(QStringLiteral("deflate"));
|
||||
m_ui->m_blockCompressionFormatCombo->addItem(QStringLiteral("lz4hc"));
|
||||
m_ui->m_blockCompressionFormatCombo->addItem(QStringLiteral("zstd"));
|
||||
AZStd::vector<AZStd::string> presetFiles;
|
||||
const char* const filePattern = "*.cbc";
|
||||
|
||||
SDirectoryEnumeratorHelper dirHelper;
|
||||
|
||||
auto engineAssetSourceRoot = AZ::IO::FixedMaxPath(AZ::Utils::GetEnginePath()) / "Assets";
|
||||
dirHelper.ScanDirectoryRecursive(gEnv->pCryPak, engineAssetSourceRoot.c_str(), "Editor/Presets/GeomCache", filePattern, presetFiles);
|
||||
|
||||
for (auto iter = presetFiles.begin(); iter != presetFiles.end(); ++iter)
|
||||
{
|
||||
const auto& file = *iter;
|
||||
const AZ::IO::FixedMaxPath filePath = engineAssetSourceRoot / file;
|
||||
m_presets.push_back(LoadConfig(Path::GetFileName(file.c_str()), XmlHelpers::LoadXmlFromFile(filePath.c_str())));
|
||||
m_ui->m_presetComboBox->addItem(m_presets.back().m_name);
|
||||
}
|
||||
|
||||
m_ui->m_presetComboBox->addItem(tr("(Custom)"));
|
||||
|
||||
SetFromConfig(m_config);
|
||||
UpdatePresetSelection();
|
||||
UpdateEnabledStates();
|
||||
}
|
||||
|
||||
void CAlembicCompileDialog::SetFromConfig(const SConfig& config)
|
||||
{
|
||||
if (QString::compare(config.m_blockCompressionFormat, QLatin1String("deflate"), Qt::CaseInsensitive) == 0)
|
||||
{
|
||||
m_ui->m_blockCompressionFormatCombo->setCurrentIndex(1);
|
||||
}
|
||||
else if (QString::compare(config.m_blockCompressionFormat, QLatin1String("lz4hc"), Qt::CaseInsensitive) == 0)
|
||||
{
|
||||
m_ui->m_blockCompressionFormatCombo->setCurrentIndex(2);
|
||||
}
|
||||
else if (QString::compare(config.m_blockCompressionFormat, QLatin1String("zstd"), Qt::CaseInsensitive) == 0)
|
||||
{
|
||||
m_ui->m_blockCompressionFormatCombo->setCurrentIndex(3);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_ui->m_blockCompressionFormatCombo->setCurrentIndex(0);
|
||||
}
|
||||
|
||||
if (QString::compare(config.m_upAxis, QLatin1String("Y"), Qt::CaseInsensitive) == 0)
|
||||
{
|
||||
m_ui->m_yUpRadio->setChecked(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_ui->m_zUpRadio->setChecked(true);
|
||||
}
|
||||
|
||||
m_ui->m_playbackFromMemoryCheckBox->setChecked(config.m_playbackFromMemory == QStringLiteral("1"));
|
||||
m_ui->m_meshPredictionCheckBox->setChecked(config.m_meshPrediction == QStringLiteral("1"));
|
||||
m_ui->m_useBFramesCheckBox->setChecked(config.m_useBFrames == QStringLiteral("1"));
|
||||
|
||||
m_ui->m_indexFrameDistanceEdit->setValue(config.m_indexFrameDistance);
|
||||
m_ui->m_positionPrecisionEdit->setValue(aznumeric_cast<int>(config.m_positionPrecision));
|
||||
m_ui->m_uvMaxEdit->setValue(config.m_uvMax);
|
||||
}
|
||||
|
||||
void CAlembicCompileDialog::UpdateEnabledStates()
|
||||
{
|
||||
m_ui->m_meshPredictionCheckBox->setEnabled(false);
|
||||
m_ui->m_useBFramesCheckBox->setEnabled(false);
|
||||
m_ui->m_indexFrameDistanceEdit->setEnabled(false);
|
||||
|
||||
if (QString::compare(m_config.m_blockCompressionFormat, QLatin1String("store"), Qt::CaseInsensitive) != 0)
|
||||
{
|
||||
m_ui->m_meshPredictionCheckBox->setEnabled(true);
|
||||
m_ui->m_useBFramesCheckBox->setEnabled(true);
|
||||
|
||||
m_ui->m_indexFrameDistanceEdit->setEnabled(m_config.m_useBFrames == QStringLiteral("1"));
|
||||
}
|
||||
}
|
||||
|
||||
void CAlembicCompileDialog::UpdatePresetSelection()
|
||||
{
|
||||
for (uint i = 0; i < m_presets.size(); ++i)
|
||||
{
|
||||
if (m_presets[i] == m_config)
|
||||
{
|
||||
m_ui->m_presetComboBox->setCurrentIndex(i);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
m_ui->m_presetComboBox->setCurrentIndex(m_presets.size());
|
||||
}
|
||||
|
||||
QString CAlembicCompileDialog::GetUpAxis() const
|
||||
{
|
||||
return m_config.m_upAxis;
|
||||
}
|
||||
|
||||
QString CAlembicCompileDialog::GetPlaybackFromMemory() const
|
||||
{
|
||||
return m_config.m_playbackFromMemory;
|
||||
}
|
||||
|
||||
QString CAlembicCompileDialog::GetBlockCompressionFormat() const
|
||||
{
|
||||
return m_config.m_blockCompressionFormat;
|
||||
}
|
||||
|
||||
QString CAlembicCompileDialog::GetMeshPrediction() const
|
||||
{
|
||||
return m_config.m_meshPrediction;
|
||||
}
|
||||
|
||||
QString CAlembicCompileDialog::GetUseBFrames() const
|
||||
{
|
||||
return m_config.m_useBFrames;
|
||||
}
|
||||
|
||||
uint CAlembicCompileDialog::GetIndexFrameDistance() const
|
||||
{
|
||||
return m_config.m_indexFrameDistance;
|
||||
}
|
||||
|
||||
double CAlembicCompileDialog::GetPositionPrecision() const
|
||||
{
|
||||
return m_config.m_positionPrecision;
|
||||
}
|
||||
|
||||
float CAlembicCompileDialog::GetUVmax() const
|
||||
{
|
||||
return m_config.m_uvMax;
|
||||
}
|
||||
|
||||
|
||||
void CAlembicCompileDialog::OnRadioYUp()
|
||||
{
|
||||
m_config.m_upAxis = "Y";
|
||||
UpdatePresetSelection();
|
||||
}
|
||||
|
||||
void CAlembicCompileDialog::OnRadioZUp()
|
||||
{
|
||||
m_config.m_upAxis = "Z";
|
||||
UpdatePresetSelection();
|
||||
}
|
||||
|
||||
void CAlembicCompileDialog::OnPlaybackFromMemory()
|
||||
{
|
||||
m_config.m_playbackFromMemory = m_ui->m_playbackFromMemoryCheckBox->isChecked() ? QStringLiteral("1") : QStringLiteral("0");
|
||||
UpdatePresetSelection();
|
||||
}
|
||||
|
||||
void CAlembicCompileDialog::OnBlockCompressionSelected()
|
||||
{
|
||||
m_config.m_blockCompressionFormat = m_ui->m_blockCompressionFormatCombo->currentText();
|
||||
UpdatePresetSelection();
|
||||
UpdateEnabledStates();
|
||||
}
|
||||
|
||||
void CAlembicCompileDialog::OnMeshPredictionCheckBox()
|
||||
{
|
||||
m_config.m_meshPrediction = m_ui->m_meshPredictionCheckBox->isChecked() ? QStringLiteral("1") : QStringLiteral("0");
|
||||
UpdatePresetSelection();
|
||||
}
|
||||
|
||||
void CAlembicCompileDialog::OnUseBFramesCheckBox()
|
||||
{
|
||||
m_config.m_useBFrames = m_ui->m_useBFramesCheckBox->isChecked() ? QStringLiteral("1") : QStringLiteral("0");
|
||||
UpdatePresetSelection();
|
||||
UpdateEnabledStates();
|
||||
}
|
||||
|
||||
void CAlembicCompileDialog::OnIndexFrameDistanceChanged()
|
||||
{
|
||||
m_config.m_indexFrameDistance = m_ui->m_indexFrameDistanceEdit->value();
|
||||
UpdatePresetSelection();
|
||||
}
|
||||
|
||||
void CAlembicCompileDialog::OnPositionPrecisionChanged()
|
||||
{
|
||||
m_config.m_positionPrecision = m_ui->m_positionPrecisionEdit->value();
|
||||
UpdatePresetSelection();
|
||||
}
|
||||
|
||||
void CAlembicCompileDialog::OnUVmaxChanged()
|
||||
{
|
||||
m_config.m_uvMax = aznumeric_cast<float>(m_ui->m_uvMaxEdit->value());
|
||||
UpdatePresetSelection();
|
||||
}
|
||||
|
||||
void CAlembicCompileDialog::OnPresetSelected()
|
||||
{
|
||||
uint presetIndex = m_ui->m_presetComboBox->currentIndex();
|
||||
if (presetIndex < m_presets.size())
|
||||
{
|
||||
m_config = m_presets[presetIndex];
|
||||
SetFromConfig(m_config);
|
||||
}
|
||||
|
||||
m_ui->m_presetComboBox->setCurrentIndex(presetIndex);
|
||||
UpdateEnabledStates();
|
||||
}
|
||||
|
||||
CAlembicCompileDialog::SConfig CAlembicCompileDialog::LoadConfig(const QString& fileName, XmlNodeRef xml) const
|
||||
{
|
||||
SConfig config;
|
||||
config.m_name = fileName;
|
||||
|
||||
if (xml)
|
||||
{
|
||||
config.m_name = xml->getAttr("Name");
|
||||
config.m_blockCompressionFormat = xml->getAttr("BlockCompressionFormat");
|
||||
config.m_upAxis = xml->getAttr("UpAxis");
|
||||
config.m_playbackFromMemory = xml->getAttr("PlaybackFromMemory");
|
||||
config.m_meshPrediction = xml->getAttr("MeshPrediction");
|
||||
config.m_useBFrames = xml->getAttr("UseBFrames");
|
||||
xml->getAttr("IndexFrameDistance", config.m_indexFrameDistance);
|
||||
xml->getAttr("PositionPrecision", config.m_positionPrecision);
|
||||
xml->getAttr("UVmax", config.m_uvMax);
|
||||
}
|
||||
|
||||
return config;
|
||||
}
|
||||
|
||||
#include <Alembic/moc_AlembicCompileDialog.cpp>
|
||||
@@ -1,107 +0,0 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
// Original file Copyright Crytek GMBH or its affiliates, used under license.
|
||||
|
||||
#ifndef CRYINCLUDE_EDITOR_ALEMBIC_ALEMBICCOMPILEDIALOG_H
|
||||
#define CRYINCLUDE_EDITOR_ALEMBIC_ALEMBICCOMPILEDIALOG_H
|
||||
#pragma once
|
||||
|
||||
#if !defined(Q_MOC_RUN)
|
||||
#include <QDialog>
|
||||
|
||||
#include <IXml.h>
|
||||
|
||||
#endif
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class AlembicCompileDialog;
|
||||
}
|
||||
|
||||
class CAlembicCompileDialog
|
||||
: public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
CAlembicCompileDialog(const XmlNodeRef config);
|
||||
~CAlembicCompileDialog();
|
||||
|
||||
void OnInitDialog();
|
||||
|
||||
QString GetUpAxis() const;
|
||||
QString GetPlaybackFromMemory() const;
|
||||
QString GetBlockCompressionFormat() const;
|
||||
QString GetMeshPrediction() const;
|
||||
QString GetUseBFrames() const;
|
||||
uint GetIndexFrameDistance() const;
|
||||
double GetPositionPrecision() const;
|
||||
float GetUVmax() const;
|
||||
|
||||
|
||||
private:
|
||||
struct SConfig
|
||||
{
|
||||
SConfig()
|
||||
: m_upAxis("Y")
|
||||
, m_playbackFromMemory("0")
|
||||
, m_blockCompressionFormat("deflate")
|
||||
, m_meshPrediction("1")
|
||||
, m_useBFrames("1")
|
||||
, m_indexFrameDistance(10)
|
||||
, m_positionPrecision(1.0)
|
||||
, m_uvMax(1.0f) {}
|
||||
|
||||
bool operator ==(const SConfig& other) const
|
||||
{
|
||||
return m_blockCompressionFormat == other.m_blockCompressionFormat
|
||||
&& m_upAxis == other.m_upAxis
|
||||
&& m_playbackFromMemory == other.m_playbackFromMemory
|
||||
&& m_meshPrediction == other.m_meshPrediction
|
||||
&& m_useBFrames == other.m_useBFrames
|
||||
&& m_indexFrameDistance == other.m_indexFrameDistance
|
||||
&& m_positionPrecision == other.m_positionPrecision
|
||||
&& m_uvMax == other.m_uvMax;
|
||||
}
|
||||
|
||||
QString m_name;
|
||||
QString m_blockCompressionFormat;
|
||||
QString m_upAxis;
|
||||
QString m_playbackFromMemory;
|
||||
QString m_meshPrediction;
|
||||
QString m_useBFrames;
|
||||
uint m_indexFrameDistance;
|
||||
double m_positionPrecision;
|
||||
float m_uvMax;
|
||||
};
|
||||
|
||||
void SetFromConfig(const SConfig& config);
|
||||
void UpdateEnabledStates();
|
||||
void UpdatePresetSelection();
|
||||
SConfig LoadConfig(const QString& fileName, XmlNodeRef xml) const;
|
||||
|
||||
void OnRadioYUp();
|
||||
void OnRadioZUp();
|
||||
void OnPlaybackFromMemory();
|
||||
void OnBlockCompressionSelected();
|
||||
void OnMeshPredictionCheckBox();
|
||||
void OnUseBFramesCheckBox();
|
||||
void OnIndexFrameDistanceChanged();
|
||||
void OnPositionPrecisionChanged();
|
||||
void OnUVmaxChanged();
|
||||
void OnPresetSelected();
|
||||
|
||||
SConfig m_config;
|
||||
std::vector<SConfig> m_presets;
|
||||
|
||||
QScopedPointer<Ui::AlembicCompileDialog> m_ui;
|
||||
};
|
||||
#endif // CRYINCLUDE_EDITOR_ALEMBIC_ALEMBICCOMPILEDIALOG_H
|
||||
@@ -1,192 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>AlembicCompileDialog</class>
|
||||
<widget class="QDialog" name="AlembicCompileDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>432</width>
|
||||
<height>252</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Compile Alembic File</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
<string>Preset</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QComboBox" name="m_presetComboBox"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1" rowspan="3">
|
||||
<widget class="QGroupBox" name="groupBox_4">
|
||||
<property name="title">
|
||||
<string>Compression Settings</string>
|
||||
</property>
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Block Compression:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QComboBox" name="m_blockCompressionFormatCombo"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Precision (mm):</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QSpinBox" name="m_positionPrecisionEdit">
|
||||
<property name="buttonSymbols">
|
||||
<enum>QAbstractSpinBox::NoButtons</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>UV Max:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="m_meshPredictionCheckBox">
|
||||
<property name="text">
|
||||
<string>Use Mesh Prediction</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="m_useBFramesCheckBox">
|
||||
<property name="text">
|
||||
<string>Use Bi-Directional Prediction</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0" colspan="2">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>Index Frame Distance:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="m_indexFrameDistanceEdit">
|
||||
<property name="buttonSymbols">
|
||||
<enum>QAbstractSpinBox::NoButtons</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QDoubleSpinBox" name="m_uvMaxEdit">
|
||||
<property name="buttonSymbols">
|
||||
<enum>QAbstractSpinBox::NoButtons</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QGroupBox" name="groupBox_2">
|
||||
<property name="title">
|
||||
<string>Compilation Settings</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QRadioButton" name="m_yUpRadio">
|
||||
<property name="text">
|
||||
<string>Y-axis up</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="m_zUpRadio">
|
||||
<property name="text">
|
||||
<string>Z-axis up</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QGroupBox" name="groupBox_3">
|
||||
<property name="title">
|
||||
<string>Runtime Settings</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QCheckBox" name="m_playbackFromMemoryCheckBox">
|
||||
<property name="text">
|
||||
<string>Playback from Memory</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0" colspan="2">
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>AlembicCompileDialog</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>248</x>
|
||||
<y>254</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>157</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>AlembicCompileDialog</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>316</x>
|
||||
<y>260</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>286</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
||||
@@ -1,158 +0,0 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
// Original file Copyright Crytek GMBH or its affiliates, used under license.
|
||||
|
||||
#include "EditorDefs.h"
|
||||
|
||||
#include "AlembicCompiler.h"
|
||||
|
||||
// Editor
|
||||
#include "AlembicCompileDialog.h"
|
||||
#include "Util/EditorUtils.h"
|
||||
#include "Util/FileUtil.h"
|
||||
#include "Util/PathUtil.h"
|
||||
|
||||
// AzCore
|
||||
#include <AzCore/std/string/wildcard.h>
|
||||
|
||||
// AzToolsFramework
|
||||
#include <AzToolsFramework/AssetBrowser/AssetBrowserEntry.h>
|
||||
|
||||
|
||||
|
||||
namespace Internal
|
||||
{
|
||||
// Attempt to add the file to source control if it is available
|
||||
bool TryAddFileToSourceControl(const QString& filename)
|
||||
{
|
||||
if (!CFileUtil::CheckoutFile(filename.toUtf8().data(), nullptr))
|
||||
{
|
||||
CryWarning(VALIDATOR_MODULE_EDITOR, VALIDATOR_ERROR, "Failed to add file %s to the source control provider", filename.toUtf8().constData());
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
} // namespace Internal
|
||||
|
||||
CAlembicCompiler::CAlembicCompiler()
|
||||
{
|
||||
AzToolsFramework::AssetBrowser::AssetBrowserInteractionNotificationBus::Handler::BusConnect();
|
||||
}
|
||||
|
||||
CAlembicCompiler::~CAlembicCompiler()
|
||||
{
|
||||
AzToolsFramework::AssetBrowser::AssetBrowserInteractionNotificationBus::Handler::BusDisconnect();
|
||||
}
|
||||
|
||||
bool CAlembicCompiler::CompileAlembic(const QString& fullPath)
|
||||
{
|
||||
bool compileConfigFileSaved = false;
|
||||
const QString configPath = Path::ReplaceExtension(fullPath, "cbc");
|
||||
XmlNodeRef config = XmlHelpers::LoadXmlFromFile(configPath.toUtf8().data());
|
||||
|
||||
CAlembicCompileDialog dialog(config);
|
||||
|
||||
if (dialog.exec() == QDialog::Accepted)
|
||||
{
|
||||
bool configChanged = false;
|
||||
const QString upAxis = dialog.GetUpAxis();
|
||||
const QString playbackFromMemory = dialog.GetPlaybackFromMemory();
|
||||
const QString blockCompressionFormat = dialog.GetBlockCompressionFormat();
|
||||
const QString meshPrediction = dialog.GetMeshPrediction();
|
||||
const QString useBFrames = dialog.GetUseBFrames();
|
||||
const uint indexFrameDistance = dialog.GetIndexFrameDistance();
|
||||
const double positionPrecision = dialog.GetPositionPrecision();
|
||||
const float uvMax = dialog.GetUVmax();
|
||||
|
||||
if (!config)
|
||||
{
|
||||
CryLog("Build configuration file not found, writing new one");
|
||||
config = XmlHelpers::CreateXmlNode("CacheBuildConfiguration");
|
||||
configChanged = true;
|
||||
}
|
||||
|
||||
if (strcmp(config->getAttr("UpAxis"), upAxis.toUtf8().data()) != 0)
|
||||
{
|
||||
config->setAttr("UpAxis", upAxis.toUtf8().data());
|
||||
configChanged = true;
|
||||
}
|
||||
if (strcmp(config->getAttr("MeshPrediction"), meshPrediction.toUtf8().data()) != 0)
|
||||
{
|
||||
config->setAttr("MeshPrediction", meshPrediction.toUtf8().data());
|
||||
configChanged = true;
|
||||
}
|
||||
if (strcmp(config->getAttr("UseBFrames"), useBFrames.toUtf8().data()) != 0)
|
||||
{
|
||||
config->setAttr("UseBFrames", useBFrames.toUtf8().data());
|
||||
configChanged = true;
|
||||
}
|
||||
if (atoi(config->getAttr("IndexFrameDistance")) != indexFrameDistance)
|
||||
{
|
||||
config->setAttr("IndexFrameDistance", indexFrameDistance);
|
||||
configChanged = true;
|
||||
}
|
||||
if (strcmp(config->getAttr("BlockCompressionFormat"), blockCompressionFormat.toUtf8().data()) != 0)
|
||||
{
|
||||
config->setAttr("BlockCompressionFormat", blockCompressionFormat.toUtf8().data());
|
||||
configChanged = true;
|
||||
}
|
||||
if (strcmp(config->getAttr("PlaybackFromMemory"), playbackFromMemory.toUtf8().data()) != 0)
|
||||
{
|
||||
config->setAttr("PlaybackFromMemory", playbackFromMemory.toUtf8().data());
|
||||
configChanged = true;
|
||||
}
|
||||
if (atof(config->getAttr("PositionPrecision")) != positionPrecision)
|
||||
{
|
||||
config->setAttr("PositionPrecision", positionPrecision);
|
||||
configChanged = true;
|
||||
}
|
||||
if (atof(config->getAttr("UVmax")) != uvMax)
|
||||
{
|
||||
config->setAttr("UVmax", uvMax);
|
||||
configChanged = true;
|
||||
}
|
||||
|
||||
if (configChanged)
|
||||
{
|
||||
compileConfigFileSaved = XmlHelpers::SaveXmlNode(GetIEditor()->GetFileUtil(), config, configPath.toUtf8().data());
|
||||
if (compileConfigFileSaved)
|
||||
{
|
||||
// If we just created the file above, or the cbc file was not previously managed, attempt to add it to perforce now.
|
||||
// Note that XmlHelpers::SaveXmlNode will prompt the user to checkout or overwrite the file
|
||||
Internal::TryAddFileToSourceControl(configPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return compileConfigFileSaved;
|
||||
}
|
||||
|
||||
void CAlembicCompiler::AddSourceFileOpeners(const char* fullSourceFileName, [[maybe_unused]] const AZ::Uuid& sourceUUID, AzToolsFramework::AssetBrowser::SourceFileOpenerList& openers)
|
||||
{
|
||||
using namespace AzToolsFramework;
|
||||
using namespace AzToolsFramework::AssetBrowser;
|
||||
|
||||
if (AZStd::wildcard_match("*.abc", fullSourceFileName))
|
||||
{
|
||||
auto alembicCallback = [this]([[maybe_unused]] const char* fullSourceFileNameInCall, const AZ::Uuid& sourceUUIDInCall)
|
||||
{
|
||||
const SourceAssetBrowserEntry* fullDetails = SourceAssetBrowserEntry::GetSourceByUuid(sourceUUIDInCall);
|
||||
if (fullDetails)
|
||||
{
|
||||
CompileAlembic(fullDetails->GetRelativePath().c_str());
|
||||
}
|
||||
};
|
||||
|
||||
openers.push_back({ "O3DE_AlembicCompiler", "Open In Alembic Compiler...", QIcon(), alembicCallback });
|
||||
}
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
// Original file Copyright Crytek GMBH or its affiliates, used under license.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AzToolsFramework/AssetBrowser/AssetBrowserBus.h>
|
||||
|
||||
class CAlembicCompiler
|
||||
: public AzToolsFramework::AssetBrowser::AssetBrowserInteractionNotificationBus::Handler
|
||||
{
|
||||
public:
|
||||
CAlembicCompiler();
|
||||
~CAlembicCompiler();
|
||||
|
||||
bool CompileAlembic(const QString& fullPath);
|
||||
|
||||
protected:
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
/// AzToolsFramework::AssetBrowser::AssetBrowserInteractionNotificationBus::Handler
|
||||
void AddSourceFileOpeners(const char* fullSourceFileName, const AZ::Uuid& sourceUUID, AzToolsFramework::AssetBrowser::SourceFileOpenerList& openers) override;
|
||||
};
|
||||
@@ -58,13 +58,11 @@
|
||||
#include "LevelFileDialog.h"
|
||||
#include "StatObjBus.h"
|
||||
|
||||
// LmbrCentral
|
||||
#include <ModernViewportCameraController.h>
|
||||
#include <Atom/RPI.Public/ViewportContext.h>
|
||||
#include <Atom/RPI.Public/ViewportContextBus.h>
|
||||
#include <LmbrCentral/Rendering/EditorLightComponentBus.h> // for LmbrCentral::EditorLightComponentRequestBus
|
||||
|
||||
|
||||
// LmbrCentral
|
||||
#include <LmbrCentral/Rendering/EditorLightComponentBus.h> // for LmbrCentral::EditorLightComponentRequestBus
|
||||
|
||||
//#define PROFILE_LOADING_WITH_VTUNE
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
#include <AzCore/Settings/SettingsRegistry.h>
|
||||
#include <AzCore/std/string/string_view.h>
|
||||
|
||||
namespace Editor
|
||||
namespace SandboxEditor
|
||||
{
|
||||
constexpr AZStd::string_view GridSnappingSetting = "/Amazon/Preferences/Editor/GridSnapping";
|
||||
constexpr AZStd::string_view GridSizeSetting = "/Amazon/Preferences/Editor/GridSize";
|
||||
@@ -113,4 +113,4 @@ namespace Editor
|
||||
registry->Set(ShowGridSetting, showing);
|
||||
}
|
||||
}
|
||||
} // namespace Editor
|
||||
} // namespace SandboxEditor
|
||||
|
||||
@@ -12,27 +12,31 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <EditorCoreAPI.h>
|
||||
#include <SandboxAPI.h>
|
||||
|
||||
namespace Editor
|
||||
namespace SandboxEditor
|
||||
{
|
||||
EDITOR_CORE_API bool GridSnappingEnabled();
|
||||
SANDBOX_API bool GridSnappingEnabled();
|
||||
|
||||
EDITOR_CORE_API float GridSnappingSize();
|
||||
SANDBOX_API float GridSnappingSize();
|
||||
|
||||
EDITOR_CORE_API bool AngleSnappingEnabled();
|
||||
SANDBOX_API bool AngleSnappingEnabled();
|
||||
|
||||
EDITOR_CORE_API float AngleSnappingSize();
|
||||
SANDBOX_API float AngleSnappingSize();
|
||||
|
||||
EDITOR_CORE_API bool ShowingGrid();
|
||||
SANDBOX_API bool ShowingGrid();
|
||||
|
||||
EDITOR_CORE_API void SetGridSnapping(bool enabled);
|
||||
SANDBOX_API void SetGridSnapping(bool enabled);
|
||||
|
||||
EDITOR_CORE_API void SetGridSnappingSize(float size);
|
||||
SANDBOX_API void SetGridSnappingSize(float size);
|
||||
|
||||
EDITOR_CORE_API void SetAngleSnapping(bool enabled);
|
||||
SANDBOX_API void SetAngleSnapping(bool enabled);
|
||||
|
||||
EDITOR_CORE_API void SetAngleSnappingSize(float size);
|
||||
SANDBOX_API void SetAngleSnappingSize(float size);
|
||||
|
||||
EDITOR_CORE_API void SetShowingGrid(bool showing);
|
||||
} // namespace Editor
|
||||
SANDBOX_API void SetShowingGrid(bool showing);
|
||||
|
||||
//! Return if the new editor camera system is enabled or not.
|
||||
//! @note This is implemented in EditorViewportWidget.cpp
|
||||
SANDBOX_API bool UsingNewCameraSystem();
|
||||
} // namespace SandboxEditor
|
||||
|
||||
@@ -49,9 +49,11 @@
|
||||
#include <AzToolsFramework/API/ComponentEntityObjectBus.h>
|
||||
#include <AzToolsFramework/Manipulators/ManipulatorManager.h>
|
||||
#include <AzToolsFramework/ViewportSelection/EditorInteractionSystemViewportSelectionRequestBus.h>
|
||||
#include <AzToolsFramework/ViewportSelection/EditorTransformComponentSelectionRequestBus.h>
|
||||
|
||||
// AtomToolsFramework
|
||||
#include <AtomToolsFramework/Viewport/RenderViewportWidget.h>
|
||||
#include <AtomToolsFramework/Viewport/ModularViewportCameraController.h>
|
||||
|
||||
// CryCommon
|
||||
#include <CryCommon/HMDBus.h>
|
||||
@@ -74,7 +76,6 @@
|
||||
#include "EditorPreferencesPageGeneral.h"
|
||||
#include "ViewportManipulatorController.h"
|
||||
#include "LegacyViewportCameraController.h"
|
||||
#include "ModernViewportCameraController.h"
|
||||
#include "EditorViewportSettings.h"
|
||||
|
||||
#include "ViewPane.h"
|
||||
@@ -102,8 +103,16 @@
|
||||
#include <IStatObj.h>
|
||||
|
||||
AZ_CVAR(
|
||||
bool, ed_visibility_logTiming, false, nullptr, AZ::ConsoleFunctorFlags::Null,
|
||||
"Output the timing of the new IVisibilitySystem query");
|
||||
bool, ed_visibility_logTiming, false, nullptr, AZ::ConsoleFunctorFlags::Null, "Output the timing of the new IVisibilitySystem query");
|
||||
AZ_CVAR(bool, ed_useNewCameraSystem, false, nullptr, AZ::ConsoleFunctorFlags::Null, "Use the new Editor camera system");
|
||||
|
||||
namespace SandboxEditor
|
||||
{
|
||||
bool UsingNewCameraSystem()
|
||||
{
|
||||
return ed_useNewCameraSystem;
|
||||
}
|
||||
} // namespace SandboxEditor
|
||||
|
||||
EditorViewportWidget* EditorViewportWidget::m_pPrimaryViewport = nullptr;
|
||||
|
||||
@@ -114,7 +123,7 @@ namespace AzFramework
|
||||
extern InputChannelId CameraOrbitLookButton;
|
||||
extern InputChannelId CameraOrbitDollyButton;
|
||||
extern InputChannelId CameraOrbitPanButton;
|
||||
}
|
||||
} // namespace AzFramework
|
||||
|
||||
#if AZ_TRAIT_OS_PLATFORM_APPLE
|
||||
void StopFixedCursorMode();
|
||||
@@ -124,10 +133,6 @@ void StartFixedCursorMode(QObject *viewport);
|
||||
#define RENDER_MESH_TEST_DISTANCE (0.2f)
|
||||
#define CURSOR_FONT_HEIGHT 8.0f
|
||||
|
||||
AZ_CVAR(
|
||||
bool, ed_useNewCameraSystem, false, nullptr, AZ::ConsoleFunctorFlags::Null,
|
||||
"Use the new Editor camera system (the Atom-native Editor viewport (experimental) must also be enabled)");
|
||||
|
||||
//! Viewport settings for the EditorViewportWidget
|
||||
struct EditorViewportSettings : public AzToolsFramework::ViewportInteraction::ViewportSettings
|
||||
{
|
||||
@@ -1215,7 +1220,7 @@ void EditorViewportWidget::SetViewportId(int id)
|
||||
{
|
||||
AzFramework::ReloadCameraKeyBindings();
|
||||
|
||||
auto controller = AZStd::make_shared<SandboxEditor::ModernViewportCameraController>();
|
||||
auto controller = AZStd::make_shared<AtomToolsFramework::ModularViewportCameraController>();
|
||||
controller->SetCameraListBuilderCallback([](AzFramework::Cameras& cameras)
|
||||
{
|
||||
auto firstPersonRotateCamera = AZStd::make_shared<AzFramework::RotateCameraInput>(AzFramework::CameraFreeLookButton);
|
||||
@@ -1225,6 +1230,20 @@ void EditorViewportWidget::SetViewportId(int id)
|
||||
auto firstPersonWheelCamera = AZStd::make_shared<AzFramework::ScrollTranslationCameraInput>();
|
||||
|
||||
auto orbitCamera = AZStd::make_shared<AzFramework::OrbitCameraInput>();
|
||||
orbitCamera->SetLookAtFn([]() -> AZStd::optional<AZ::Vector3> {
|
||||
AZStd::optional<AZ::Transform> manipulatorTransform;
|
||||
AzToolsFramework::EditorTransformComponentSelectionRequestBus::EventResult(
|
||||
manipulatorTransform, AzToolsFramework::GetEntityContextId(),
|
||||
&AzToolsFramework::EditorTransformComponentSelectionRequestBus::Events::GetManipulatorTransform);
|
||||
|
||||
if (manipulatorTransform)
|
||||
{
|
||||
return manipulatorTransform->GetTranslation();
|
||||
}
|
||||
|
||||
return {};
|
||||
});
|
||||
|
||||
auto orbitRotateCamera = AZStd::make_shared<AzFramework::RotateCameraInput>(AzFramework::CameraOrbitLookButton);
|
||||
auto orbitTranslateCamera = AZStd::make_shared<AzFramework::TranslateCameraInput>(AzFramework::OrbitTranslation);
|
||||
auto orbitDollyWheelCamera = AZStd::make_shared<AzFramework::OrbitDollyScrollCameraInput>();
|
||||
@@ -2876,27 +2895,27 @@ void EditorViewportWidget::SetAsActiveViewport()
|
||||
|
||||
bool EditorViewportSettings::GridSnappingEnabled() const
|
||||
{
|
||||
return Editor::GridSnappingEnabled();
|
||||
return SandboxEditor::GridSnappingEnabled();
|
||||
}
|
||||
|
||||
float EditorViewportSettings::GridSize() const
|
||||
{
|
||||
return Editor::GridSnappingSize();
|
||||
return SandboxEditor::GridSnappingSize();
|
||||
}
|
||||
|
||||
bool EditorViewportSettings::ShowGrid() const
|
||||
{
|
||||
return Editor::ShowingGrid();
|
||||
return SandboxEditor::ShowingGrid();
|
||||
}
|
||||
|
||||
bool EditorViewportSettings::AngleSnappingEnabled() const
|
||||
{
|
||||
return Editor::AngleSnappingEnabled();
|
||||
return SandboxEditor::AngleSnappingEnabled();
|
||||
}
|
||||
|
||||
float EditorViewportSettings::AngleStep() const
|
||||
{
|
||||
return Editor::AngleSnappingSize();
|
||||
return SandboxEditor::AngleSnappingSize();
|
||||
}
|
||||
|
||||
#include <moc_EditorViewportWidget.cpp>
|
||||
|
||||
@@ -34,6 +34,7 @@ CGotoPositionDlg::CGotoPositionDlg(QWidget* pParent /*=NULL*/)
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
|
||||
setFixedSize(size());
|
||||
OnInitDialog();
|
||||
|
||||
auto doubleValueChanged = static_cast<void(QDoubleSpinBox::*)(double)>(&QDoubleSpinBox::valueChanged);
|
||||
@@ -98,6 +99,9 @@ void CGotoPositionDlg::OnInitDialog()
|
||||
m_ui->m_dymSegX->setVisible(false);
|
||||
m_ui->m_dymSegY->setVisible(false);
|
||||
|
||||
// Ensure the goto button is highlighted correctly.
|
||||
m_ui->pushButton->setDefault(true);
|
||||
|
||||
OnUpdateNumbers();
|
||||
}
|
||||
|
||||
|
||||
@@ -6,189 +6,210 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>358</width>
|
||||
<height>198</height>
|
||||
<width>290</width>
|
||||
<height>180</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Go to Position</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout" columnstretch="0,1,0,0,1,0,0,1">
|
||||
<item row="6" column="0" colspan="2">
|
||||
<widget class="QPushButton" name="pushButton">
|
||||
<property name="text">
|
||||
<string>Go To</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="3" colspan="2">
|
||||
<widget class="QPushButton" name="pushButton_2">
|
||||
<property name="text">
|
||||
<string>Cancel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="6" colspan="2">
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="3" column="2">
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>22</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<widget class="QDoubleSpinBox" name="m_dymZ"/>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QDoubleSpinBox" name="m_dymY"/>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QDoubleSpinBox" name="m_dymX"/>
|
||||
</item>
|
||||
<item row="4" column="4">
|
||||
<widget class="QDoubleSpinBox" name="m_dymAngleY"/>
|
||||
</item>
|
||||
<item row="3" column="4">
|
||||
<widget class="QDoubleSpinBox" name="m_dymAngleX"/>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="label_8">
|
||||
<property name="text">
|
||||
<string>Z:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="3">
|
||||
<widget class="QLabel" name="label_7">
|
||||
<property name="text">
|
||||
<string>Y:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" colspan="8">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Enter position here:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>X:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="8">
|
||||
<widget class="QLineEdit" name="m_posEdit">
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="2">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Position:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="3">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>X:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="6">
|
||||
<widget class="QLabel" name="m_labelSegX">
|
||||
<property name="text">
|
||||
<string>X:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="4">
|
||||
<widget class="QDoubleSpinBox" name="m_dymAngleZ"/>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="text">
|
||||
<string>Y:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="6">
|
||||
<widget class="QLabel" name="m_labelSegY">
|
||||
<property name="text">
|
||||
<string>Y:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="3">
|
||||
<widget class="QLabel" name="label_9">
|
||||
<property name="text">
|
||||
<string>Z:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="5">
|
||||
<spacer name="horizontalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>22</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="2" column="3" colspan="2">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Angles:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="6" colspan="2">
|
||||
<widget class="QLabel" name="m_labelSeg">
|
||||
<property name="text">
|
||||
<string>Segments:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="7">
|
||||
<widget class="QSpinBox" name="m_dymSegX"/>
|
||||
</item>
|
||||
<item row="4" column="7">
|
||||
<widget class="QSpinBox" name="m_dymSegY"/>
|
||||
</item>
|
||||
</layout>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout" columnstretch="0,1,0,0,1,0,0,1">
|
||||
<item row="5" column="6" colspan="2">
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="3" column="2">
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>22</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<widget class="QDoubleSpinBox" name="m_dymZ"/>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QDoubleSpinBox" name="m_dymY"/>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QDoubleSpinBox" name="m_dymX"/>
|
||||
</item>
|
||||
<item row="4" column="4">
|
||||
<widget class="QDoubleSpinBox" name="m_dymAngleY"/>
|
||||
</item>
|
||||
<item row="3" column="4">
|
||||
<widget class="QDoubleSpinBox" name="m_dymAngleX"/>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="label_8">
|
||||
<property name="text">
|
||||
<string>Z:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="3">
|
||||
<widget class="QLabel" name="label_7">
|
||||
<property name="text">
|
||||
<string>Y:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" colspan="8">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Enter position here:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>X:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="8">
|
||||
<widget class="QLineEdit" name="m_posEdit">
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="2">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Position:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="3">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>X:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="6">
|
||||
<widget class="QLabel" name="m_labelSegX">
|
||||
<property name="text">
|
||||
<string>X:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="4">
|
||||
<widget class="QDoubleSpinBox" name="m_dymAngleZ"/>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="text">
|
||||
<string>Y:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="6">
|
||||
<widget class="QLabel" name="m_labelSegY">
|
||||
<property name="text">
|
||||
<string>Y:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="3">
|
||||
<widget class="QLabel" name="label_9">
|
||||
<property name="text">
|
||||
<string>Z:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="5">
|
||||
<spacer name="horizontalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>22</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="2" column="3" colspan="2">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Angles:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="6" colspan="2">
|
||||
<widget class="QLabel" name="m_labelSeg">
|
||||
<property name="text">
|
||||
<string>Segments:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="7">
|
||||
<widget class="QSpinBox" name="m_dymSegX"/>
|
||||
</item>
|
||||
<item row="4" column="7">
|
||||
<widget class="QSpinBox" name="m_dymSegY"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="buttonLayout">
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_1">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton">
|
||||
<property name="text">
|
||||
<string>Go To</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_2">
|
||||
<property name="text">
|
||||
<string>Cancel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<tabstops>
|
||||
<tabstop>m_posEdit</tabstop>
|
||||
|
||||
@@ -57,7 +57,6 @@ AZ_POP_DISABLE_WARNING
|
||||
#include "GameEngine.h"
|
||||
#include "ToolBox.h"
|
||||
#include "MainWindow.h"
|
||||
#include "Alembic/AlembicCompiler.h"
|
||||
#include "UIEnumsDatabase.h"
|
||||
#include "RenderHelpers/AxisHelper.h"
|
||||
#include "Settings.h"
|
||||
@@ -185,7 +184,6 @@ CEditorImpl::CEditorImpl()
|
||||
m_pIconManager = new CIconManager;
|
||||
m_pUndoManager = new CUndoManager;
|
||||
m_pToolBoxManager = new CToolBoxManager;
|
||||
m_pAlembicCompiler = new CAlembicCompiler();
|
||||
m_pSequenceManager = new CTrackViewSequenceManager;
|
||||
m_pAnimationContext = new CAnimationContext;
|
||||
|
||||
@@ -303,7 +301,6 @@ CEditorImpl::~CEditorImpl()
|
||||
m_bExiting = true; // Can't save level after this point (while Crash)
|
||||
SAFE_RELEASE(m_pSourceControl);
|
||||
|
||||
SAFE_DELETE(m_pAlembicCompiler)
|
||||
SAFE_DELETE(m_pIconManager)
|
||||
SAFE_DELETE(m_pViewManager)
|
||||
SAFE_DELETE(m_pObjectManager) // relies on prefab manager
|
||||
|
||||
@@ -48,7 +48,6 @@ class CEditorFileMonitor;
|
||||
class AzAssetWindow;
|
||||
class AzAssetBrowserRequestHandler;
|
||||
class AssetEditorRequestsHandler;
|
||||
class CAlembicCompiler;
|
||||
struct IEditorFileMonitor;
|
||||
class CVegetationMap;
|
||||
|
||||
@@ -356,7 +355,6 @@ protected:
|
||||
CAnimationContext* m_pAnimationContext;
|
||||
CTrackViewSequenceManager* m_pSequenceManager;
|
||||
CToolBoxManager* m_pToolBoxManager;
|
||||
CAlembicCompiler* m_pAlembicCompiler;
|
||||
CMusicManager* m_pMusicManager;
|
||||
CErrorReport* m_pErrorReport;
|
||||
//! Contains the error reports for the last loaded level.
|
||||
|
||||
@@ -33,8 +33,6 @@ AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING
|
||||
|
||||
#include <AzQtComponents/Components/Style.h>
|
||||
|
||||
#include "CryPhysicsDeprecation.h"
|
||||
|
||||
void BeautifyEulerAngles(Vec3& v)
|
||||
{
|
||||
if (v.x + v.y + v.z >= 360.0f)
|
||||
@@ -334,7 +332,6 @@ void CInfoBar::OnBnClickedPhysics()
|
||||
|
||||
void CInfoBar::OnBnClickedSingleStepPhys()
|
||||
{
|
||||
CRY_PHYSICS_REPLACEMENT_ASSERT();
|
||||
}
|
||||
|
||||
void CInfoBar::OnBnClickedDoStepPhys()
|
||||
|
||||
@@ -874,9 +874,9 @@ void MainWindow::InitActions()
|
||||
.SetCheckable(true)
|
||||
.RegisterUpdateCallback([](QAction* action) {
|
||||
Q_ASSERT(action->isCheckable());
|
||||
action->setChecked(Editor::GridSnappingEnabled());
|
||||
action->setChecked(SandboxEditor::GridSnappingEnabled());
|
||||
})
|
||||
.Connect(&QAction::triggered, []() { Editor::SetGridSnapping(!Editor::GridSnappingEnabled()); });
|
||||
.Connect(&QAction::triggered, []() { SandboxEditor::SetGridSnapping(!SandboxEditor::GridSnappingEnabled()); });
|
||||
|
||||
am->AddAction(ID_SNAPANGLE, tr("Snap angle"))
|
||||
.SetIcon(Style::icon("Angle"))
|
||||
@@ -885,9 +885,9 @@ void MainWindow::InitActions()
|
||||
.SetCheckable(true)
|
||||
.RegisterUpdateCallback([](QAction* action) {
|
||||
Q_ASSERT(action->isCheckable());
|
||||
action->setChecked(Editor::AngleSnappingEnabled());
|
||||
action->setChecked(SandboxEditor::AngleSnappingEnabled());
|
||||
})
|
||||
.Connect(&QAction::triggered, []() { Editor::SetAngleSnapping(!Editor::AngleSnappingEnabled()); });
|
||||
.Connect(&QAction::triggered, []() { SandboxEditor::SetAngleSnapping(!SandboxEditor::AngleSnappingEnabled()); });
|
||||
|
||||
// Display actions
|
||||
am->AddAction(ID_WIREFRAME, tr("&Wireframe"))
|
||||
@@ -1275,12 +1275,12 @@ QWidget* MainWindow::CreateSnapToGridWidget()
|
||||
{
|
||||
SnapToWidget::SetValueCallback setCallback = [](double snapStep)
|
||||
{
|
||||
Editor::SetGridSnappingSize(snapStep);
|
||||
SandboxEditor::SetGridSnappingSize(snapStep);
|
||||
};
|
||||
|
||||
SnapToWidget::GetValueCallback getCallback = []()
|
||||
{
|
||||
return Editor::GridSnappingSize();
|
||||
return SandboxEditor::GridSnappingSize();
|
||||
};
|
||||
|
||||
return new SnapToWidget(m_actionManager->GetAction(ID_SNAP_TO_GRID), setCallback, getCallback);
|
||||
@@ -1290,12 +1290,12 @@ QWidget* MainWindow::CreateSnapToAngleWidget()
|
||||
{
|
||||
SnapToWidget::SetValueCallback setCallback = [](double snapAngle)
|
||||
{
|
||||
Editor::SetAngleSnappingSize(snapAngle);
|
||||
SandboxEditor::SetAngleSnappingSize(snapAngle);
|
||||
};
|
||||
|
||||
SnapToWidget::GetValueCallback getCallback = []()
|
||||
{
|
||||
return Editor::AngleSnappingSize();
|
||||
return SandboxEditor::AngleSnappingSize();
|
||||
};
|
||||
|
||||
return new SnapToWidget(m_actionManager->GetAction(ID_SNAPANGLE), setCallback, getCallback);
|
||||
|
||||
@@ -1,180 +0,0 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "ModernViewportCameraController.h"
|
||||
|
||||
#include <Atom/RPI.Public/ViewportContext.h>
|
||||
#include <Atom/RPI.Public/ViewportContextBus.h>
|
||||
#include <AzCore/Console/IConsole.h>
|
||||
#include <AzCore/Interface/Interface.h>
|
||||
#include <AzFramework/Input/Devices/Keyboard/InputDeviceKeyboard.h>
|
||||
#include <AzFramework/Input/Devices/Mouse/InputDeviceMouse.h>
|
||||
#include <AzFramework/Viewport/ScreenGeometry.h>
|
||||
#include <AzFramework/Viewport/ViewportScreen.h>
|
||||
#include <AzFramework/Windowing/WindowBus.h>
|
||||
#include <AzToolsFramework/Viewport/ViewportMessages.h>
|
||||
|
||||
namespace SandboxEditor
|
||||
{
|
||||
static void DrawPreviewAxis(AzFramework::DebugDisplayRequests& display, const AZ::Transform& transform, const float axisLength)
|
||||
{
|
||||
display.SetColor(AZ::Colors::Red);
|
||||
display.DrawLine(transform.GetTranslation(), transform.GetTranslation() + transform.GetBasisX().GetNormalizedSafe() * axisLength);
|
||||
display.SetColor(AZ::Colors::Green);
|
||||
display.DrawLine(transform.GetTranslation(), transform.GetTranslation() + transform.GetBasisY().GetNormalizedSafe() * axisLength);
|
||||
display.SetColor(AZ::Colors::Blue);
|
||||
display.DrawLine(transform.GetTranslation(), transform.GetTranslation() + transform.GetBasisZ().GetNormalizedSafe() * axisLength);
|
||||
}
|
||||
|
||||
static AZ::RPI::ViewportContextPtr RetrieveViewportContext(const AzFramework::ViewportId viewportId)
|
||||
{
|
||||
auto viewportContextManager = AZ::Interface<AZ::RPI::ViewportContextRequestsInterface>::Get();
|
||||
if (!viewportContextManager)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
auto viewportContext = viewportContextManager->GetViewportContextById(viewportId);
|
||||
if (!viewportContext)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return viewportContext;
|
||||
}
|
||||
|
||||
void ModernViewportCameraController::SetCameraListBuilderCallback(const CameraListBuilder& builder)
|
||||
{
|
||||
m_cameraListBuilder = builder;
|
||||
}
|
||||
|
||||
void ModernViewportCameraController::SetupCameras(AzFramework::Cameras& cameras)
|
||||
{
|
||||
if (m_cameraListBuilder)
|
||||
{
|
||||
m_cameraListBuilder(cameras);
|
||||
}
|
||||
}
|
||||
|
||||
ModernViewportCameraControllerInstance::ModernViewportCameraControllerInstance(
|
||||
const AzFramework::ViewportId viewportId, ModernViewportCameraController* controller)
|
||||
: MultiViewportControllerInstanceInterface<ModernViewportCameraController>(viewportId, controller)
|
||||
{
|
||||
controller->SetupCameras(m_cameraSystem.m_cameras);
|
||||
|
||||
if (auto viewportContext = RetrieveViewportContext(GetViewportId()))
|
||||
{
|
||||
auto handleCameraChange = [this, viewportContext](const AZ::Matrix4x4&) {
|
||||
if (!m_updatingTransform)
|
||||
{
|
||||
UpdateCameraFromTransform(m_targetCamera, viewportContext->GetCameraTransform());
|
||||
m_camera = m_targetCamera;
|
||||
}
|
||||
};
|
||||
|
||||
m_cameraViewMatrixChangeHandler = AZ::RPI::ViewportContext::MatrixChangedEvent::Handler(handleCameraChange);
|
||||
|
||||
viewportContext->ConnectViewMatrixChangedHandler(m_cameraViewMatrixChangeHandler);
|
||||
}
|
||||
|
||||
AzFramework::ViewportDebugDisplayEventBus::Handler::BusConnect(AzToolsFramework::GetEntityContextId());
|
||||
}
|
||||
|
||||
ModernViewportCameraControllerInstance::~ModernViewportCameraControllerInstance()
|
||||
{
|
||||
AzFramework::ViewportDebugDisplayEventBus::Handler::BusDisconnect();
|
||||
}
|
||||
|
||||
bool ModernViewportCameraControllerInstance::HandleInputChannelEvent(const AzFramework::ViewportControllerInputEvent& event)
|
||||
{
|
||||
AzFramework::WindowSize windowSize;
|
||||
AzFramework::WindowRequestBus::EventResult(
|
||||
windowSize, event.m_windowHandle, &AzFramework::WindowRequestBus::Events::GetClientAreaSize);
|
||||
|
||||
if (m_cameraMode == CameraMode::Control)
|
||||
{
|
||||
if (AzFramework::InputDeviceKeyboard::IsKeyboardDevice(event.m_inputChannel.GetInputDevice().GetInputDeviceId()))
|
||||
{
|
||||
if (event.m_inputChannel.GetInputChannelId() == AzFramework::InputDeviceKeyboard::Key::AlphanumericR)
|
||||
{
|
||||
m_transformEnd = m_camera.Transform();
|
||||
|
||||
return true;
|
||||
}
|
||||
else if (event.m_inputChannel.GetInputChannelId() == AzFramework::InputDeviceKeyboard::Key::AlphanumericP)
|
||||
{
|
||||
m_animationT = 0.0f;
|
||||
m_cameraMode = CameraMode::Animation;
|
||||
m_transformStart = m_camera.Transform();
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return m_cameraSystem.HandleEvents(AzFramework::BuildInputEvent(event.m_inputChannel, windowSize));
|
||||
}
|
||||
|
||||
void ModernViewportCameraControllerInstance::UpdateViewport(const AzFramework::ViewportControllerUpdateEvent& event)
|
||||
{
|
||||
if (auto viewportContext = RetrieveViewportContext(GetViewportId()))
|
||||
{
|
||||
m_updatingTransform = true;
|
||||
|
||||
if (m_cameraMode == CameraMode::Control)
|
||||
{
|
||||
m_targetCamera = m_cameraSystem.StepCamera(m_targetCamera, event.m_deltaTime.count());
|
||||
m_camera = AzFramework::SmoothCamera(m_camera, m_targetCamera, event.m_deltaTime.count());
|
||||
|
||||
viewportContext->SetCameraTransform(m_camera.Transform());
|
||||
}
|
||||
else if (m_cameraMode == CameraMode::Animation)
|
||||
{
|
||||
const auto smootherStepFn = [](const float t) { return t * t * t * (t * (t * 6.0f - 15.0f) + 10.0f); };
|
||||
const float transitionT = smootherStepFn(m_animationT);
|
||||
|
||||
const AZ::Transform current = AZ::Transform::CreateFromQuaternionAndTranslation(
|
||||
m_transformStart.GetRotation().Slerp(m_transformEnd.GetRotation(), transitionT),
|
||||
m_transformStart.GetTranslation().Lerp(m_transformEnd.GetTranslation(), transitionT));
|
||||
|
||||
const AZ::Vector3 eulerAngles = AzFramework::EulerAngles(AZ::Matrix3x3::CreateFromTransform(current));
|
||||
m_camera.m_pitch = eulerAngles.GetX();
|
||||
m_camera.m_yaw = eulerAngles.GetZ();
|
||||
m_camera.m_lookAt = current.GetTranslation();
|
||||
m_targetCamera = m_camera;
|
||||
|
||||
if (m_animationT >= 1.0f)
|
||||
{
|
||||
m_cameraMode = CameraMode::Control;
|
||||
}
|
||||
|
||||
m_animationT = AZ::GetClamp(m_animationT + event.m_deltaTime.count(), 0.0f, 1.0f);
|
||||
|
||||
viewportContext->SetCameraTransform(current);
|
||||
}
|
||||
|
||||
m_updatingTransform = false;
|
||||
}
|
||||
}
|
||||
|
||||
void ModernViewportCameraControllerInstance::DisplayViewport(
|
||||
[[maybe_unused]] const AzFramework::ViewportInfo& viewportInfo, AzFramework::DebugDisplayRequests& debugDisplay)
|
||||
{
|
||||
if (const float alpha = AZStd::min(-m_camera.m_lookDist / 5.0f, 1.0f); alpha > AZ::Constants::FloatEpsilon)
|
||||
{
|
||||
debugDisplay.SetColor(1.0f, 1.0f, 1.0f, alpha);
|
||||
debugDisplay.DrawWireSphere(m_camera.m_lookAt, 0.5f);
|
||||
}
|
||||
|
||||
DrawPreviewAxis(debugDisplay, m_transformEnd, 2.0f);
|
||||
}
|
||||
} // namespace SandboxEditor
|
||||
@@ -1,71 +0,0 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <Atom/RPI.Public/ViewportContext.h>
|
||||
#include <AzFramework/Entity/EntityDebugDisplayBus.h>
|
||||
#include <AzFramework/Viewport/CameraInput.h>
|
||||
#include <AzFramework/Viewport/MultiViewportController.h>
|
||||
|
||||
namespace SandboxEditor
|
||||
{
|
||||
class ModernViewportCameraControllerInstance;
|
||||
class ModernViewportCameraController : public AzFramework::MultiViewportController<ModernViewportCameraControllerInstance>
|
||||
{
|
||||
public:
|
||||
using CameraListBuilder = AZStd::function<void(AzFramework::Cameras&)>;
|
||||
|
||||
//! Sets the camera list builder callback used to populate new ModernViewportCameraControllerInstances
|
||||
void SetCameraListBuilderCallback(const CameraListBuilder& builder);
|
||||
//! Sets up a camera list based on this controller's CameraListBuilderCallback
|
||||
void SetupCameras(AzFramework::Cameras& cameras);
|
||||
|
||||
private:
|
||||
CameraListBuilder m_cameraListBuilder;
|
||||
};
|
||||
|
||||
class ModernViewportCameraControllerInstance final
|
||||
: public AzFramework::MultiViewportControllerInstanceInterface<ModernViewportCameraController>,
|
||||
private AzFramework::ViewportDebugDisplayEventBus::Handler
|
||||
{
|
||||
public:
|
||||
explicit ModernViewportCameraControllerInstance(AzFramework::ViewportId viewportId, ModernViewportCameraController* controller);
|
||||
~ModernViewportCameraControllerInstance() override;
|
||||
|
||||
// MultiViewportControllerInstanceInterface overrides ...
|
||||
bool HandleInputChannelEvent(const AzFramework::ViewportControllerInputEvent& event) override;
|
||||
void UpdateViewport(const AzFramework::ViewportControllerUpdateEvent& event) override;
|
||||
|
||||
// AzFramework::ViewportDebugDisplayEventBus overrides ...
|
||||
void DisplayViewport(const AzFramework::ViewportInfo& viewportInfo, AzFramework::DebugDisplayRequests& debugDisplay) override;
|
||||
|
||||
private:
|
||||
enum class CameraMode
|
||||
{
|
||||
Control,
|
||||
Animation
|
||||
};
|
||||
|
||||
AzFramework::Camera m_camera;
|
||||
AzFramework::Camera m_targetCamera;
|
||||
AzFramework::CameraSystem m_cameraSystem;
|
||||
|
||||
AZ::Transform m_transformStart = AZ::Transform::CreateIdentity();
|
||||
AZ::Transform m_transformEnd = AZ::Transform::CreateIdentity();
|
||||
float m_animationT = 0.0f;
|
||||
CameraMode m_cameraMode = CameraMode::Control;
|
||||
bool m_updatingTransform = false;
|
||||
|
||||
AZ::RPI::ViewportContext::MatrixChangedEvent::Handler m_cameraViewMatrixChangeHandler;
|
||||
};
|
||||
} // namespace SandboxEditor
|
||||
@@ -482,28 +482,6 @@ void CSelectionGroup::StartScaling()
|
||||
}
|
||||
|
||||
|
||||
void CSelectionGroup::FinishScaling(const Vec3& scale, [[maybe_unused]] int referenceCoordSys)
|
||||
{
|
||||
if (fabs(scale.x - scale.y) < 0.001f &&
|
||||
fabs(scale.y - scale.z) < 0.001f &&
|
||||
fabs(scale.z - scale.x) < 0.001f)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i = 0; i < GetFilteredCount(); ++i)
|
||||
{
|
||||
CBaseObject* obj = GetFilteredObject(i);
|
||||
Vec3 OriginalScale;
|
||||
if (obj->GetUntransformedScale(OriginalScale))
|
||||
{
|
||||
obj->TransformScale(scale);
|
||||
obj->SetScale(OriginalScale);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CSelectionGroup::Align()
|
||||
{
|
||||
|
||||
@@ -103,7 +103,6 @@ public:
|
||||
void StartScaling();
|
||||
void Scale(const Vec3& scale, int referenceCoordSys);
|
||||
void SetScale(const Vec3& scale, int referenceCoordSys);
|
||||
void FinishScaling(const Vec3& scale, int referenceCoordSys);
|
||||
//! Align objects in selection to surface normal
|
||||
void Align();
|
||||
//! Very special method to move contents of a voxel.
|
||||
|
||||
@@ -38,6 +38,11 @@ AzToolsFramework--ComponentPaletteWidget > QTreeView
|
||||
background-color: #222222;
|
||||
}
|
||||
|
||||
AzToolsFramework--PropertyRowWidget[canBeReordered="true"] QLabel#Name
|
||||
{
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
/* Style for visualizing property values overridden from their prefab values */
|
||||
AzToolsFramework--PropertyRowWidget[IsOverridden=true] #Name QLabel,
|
||||
AzToolsFramework--ComponentEditorHeader #Title[IsOverridden="true"]
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
// Original file Copyright Crytek GMBH or its affiliates, used under license.
|
||||
|
||||
#include "EditorDefs.h"
|
||||
|
||||
#if defined(USE_GEOM_CACHES)
|
||||
#include "TrackViewGeomCacheAnimationTrack.h"
|
||||
|
||||
CTrackViewKeyHandle CTrackViewGeomCacheAnimationTrack::CreateKey(const float time)
|
||||
{
|
||||
return CTrackViewTrack::CreateKey(time);
|
||||
}
|
||||
#endif
|
||||
@@ -1,37 +0,0 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
// Original file Copyright Crytek GMBH or its affiliates, used under license.
|
||||
|
||||
#ifndef CRYINCLUDE_EDITOR_TRACKVIEW_TRACKVIEWGEOMCACHEANIMATIONTRACK_H
|
||||
#define CRYINCLUDE_EDITOR_TRACKVIEW_TRACKVIEWGEOMCACHEANIMATIONTRACK_H
|
||||
#pragma once
|
||||
|
||||
|
||||
#if defined(USE_GEOM_CACHES)
|
||||
#include "IMovieSystem.h"
|
||||
#include "TrackViewTrack.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// This class represents a time range track of a geom cache node in TrackView
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
class CTrackViewGeomCacheAnimationTrack
|
||||
: public CTrackViewTrack
|
||||
{
|
||||
public:
|
||||
CTrackViewGeomCacheAnimationTrack(IAnimTrack* pTrack, CTrackViewAnimNode* pTrackAnimNode,
|
||||
CTrackViewNode* pParentNode, bool bIsSubTrack = false, unsigned int subTrackIndex = 0)
|
||||
: CTrackViewTrack(pTrack, pTrackAnimNode, pParentNode, bIsSubTrack, subTrackIndex) {}
|
||||
|
||||
virtual CTrackViewKeyHandle CreateKey(const float time);
|
||||
};
|
||||
#endif
|
||||
#endif // CRYINCLUDE_EDITOR_TRACKVIEW_TRACKVIEWGEOMCACHEANIMATIONTRACK_H
|
||||
@@ -21,7 +21,6 @@
|
||||
|
||||
// Editor
|
||||
#include "TrackViewEventNode.h"
|
||||
#include "TrackViewGeomCacheAnimationTrack.h"
|
||||
|
||||
|
||||
CTrackViewAnimNode* CTrackViewAnimNodeFactory::BuildAnimNode(IAnimSequence* pSequence, IAnimNode* pAnimNode, CTrackViewNode* pParentNode)
|
||||
@@ -43,12 +42,5 @@ CTrackViewAnimNode* CTrackViewAnimNodeFactory::BuildAnimNode(IAnimSequence* pSeq
|
||||
CTrackViewTrack* CTrackViewTrackFactory::BuildTrack(IAnimTrack* pTrack, CTrackViewAnimNode* pTrackAnimNode,
|
||||
CTrackViewNode* pParentNode, bool bIsSubTrack, unsigned int subTrackIndex)
|
||||
{
|
||||
#if defined(USE_GEOM_CACHES)
|
||||
if (pTrack->GetParameterType() == AnimParamType::TimeRanges && pTrackAnimNode->GetType() == AnimNodeType::GeomCache)
|
||||
{
|
||||
return new CTrackViewGeomCacheAnimationTrack(pTrack, pTrackAnimNode, pParentNode, bIsSubTrack, subTrackIndex);
|
||||
}
|
||||
#endif
|
||||
|
||||
return new CTrackViewTrack(pTrack, pTrackAnimNode, pParentNode, bIsSubTrack, subTrackIndex);
|
||||
}
|
||||
|
||||
@@ -22,8 +22,6 @@ set(FILES
|
||||
Include/IEditorMaterial.h
|
||||
Include/IEditorMaterialManager.h
|
||||
Include/IImageUtil.h
|
||||
EditorViewportSettings.cpp
|
||||
EditorViewportSettings.h
|
||||
Controls/ReflectedPropertyControl/ReflectedPropertyCtrl.qrc
|
||||
Controls/ReflectedPropertyControl/ReflectedPropertyCtrl.cpp
|
||||
Controls/ReflectedPropertyControl/ReflectedPropertyCtrl.h
|
||||
|
||||
@@ -307,11 +307,6 @@ set(FILES
|
||||
Util/AffineParts.cpp
|
||||
Objects/BaseObject.cpp
|
||||
Objects/BaseObject.h
|
||||
Alembic/AlembicCompileDialog.cpp
|
||||
Alembic/AlembicCompileDialog.h
|
||||
Alembic/AlembicCompileDialog.ui
|
||||
Alembic/AlembicCompiler.h
|
||||
Alembic/AlembicCompiler.cpp
|
||||
Animation/AnimationBipedBoneNames.cpp
|
||||
Animation/AnimationBipedBoneNames.h
|
||||
AnimationContext.cpp
|
||||
@@ -714,14 +709,12 @@ set(FILES
|
||||
TrackView/TrackViewNode.cpp
|
||||
TrackView/TrackViewSequence.cpp
|
||||
TrackView/TrackViewNodeFactories.cpp
|
||||
TrackView/TrackViewGeomCacheAnimationTrack.cpp
|
||||
TrackView/TrackViewEventNode.cpp
|
||||
TrackView/TrackViewAnimNode.h
|
||||
TrackView/TrackViewTrack.h
|
||||
TrackView/TrackViewNode.h
|
||||
TrackView/TrackViewSequence.h
|
||||
TrackView/TrackViewNodeFactories.h
|
||||
TrackView/TrackViewGeomCacheAnimationTrack.h
|
||||
TrackView/TrackViewEventNode.h
|
||||
ConfigGroup.cpp
|
||||
ConfigGroup.h
|
||||
@@ -824,12 +817,12 @@ set(FILES
|
||||
LayoutWnd.h
|
||||
EditorViewportWidget.cpp
|
||||
EditorViewportWidget.h
|
||||
EditorViewportSettings.cpp
|
||||
EditorViewportSettings.h
|
||||
ViewportManipulatorController.cpp
|
||||
ViewportManipulatorController.h
|
||||
LegacyViewportCameraController.cpp
|
||||
LegacyViewportCameraController.h
|
||||
ModernViewportCameraController.cpp
|
||||
ModernViewportCameraController.h
|
||||
RenderViewport.cpp
|
||||
RenderViewport.h
|
||||
TopRendererWnd.cpp
|
||||
|
||||
Reference in New Issue
Block a user