Integrating latest 47acbe8
This commit is contained in:
@@ -18,6 +18,8 @@
|
||||
|
||||
#include "SequenceBatchRenderDialog.h"
|
||||
|
||||
#include <AzFramework/Windowing/WindowBus.h>
|
||||
|
||||
// Qt
|
||||
#include <QAction>
|
||||
#include <QFileDialog>
|
||||
@@ -628,8 +630,9 @@ void CSequenceBatchRenderDialog::OnFPSEditChange()
|
||||
CheckForEnableUpdateButton();
|
||||
}
|
||||
|
||||
void CSequenceBatchRenderDialog::OnFPSChange()
|
||||
void CSequenceBatchRenderDialog::OnFPSChange(int itemIndex)
|
||||
{
|
||||
m_customFPS = fps[itemIndex].fps;
|
||||
CheckForEnableUpdateButton();
|
||||
}
|
||||
|
||||
@@ -871,6 +874,8 @@ void CSequenceBatchRenderDialog::InitializeContext()
|
||||
|
||||
void CSequenceBatchRenderDialog::CaptureItemStart()
|
||||
{
|
||||
AZ::Render::FrameCaptureNotificationBus::Handler::BusConnect();
|
||||
|
||||
// Disable most of the UI in group chunks.
|
||||
// (Leave the start/cancel button and feedback elements).
|
||||
m_ui->BATCH_RENDER_LIST_GROUP_BOX->setEnabled(false);
|
||||
@@ -896,6 +901,8 @@ void CSequenceBatchRenderDialog::CaptureItemStart()
|
||||
// once the game mode kicks in with the specified range.
|
||||
nextSequence->SetFlags(m_renderContext.flagBU | IAnimSequence::eSeqFlags_PlayOnReset);
|
||||
|
||||
m_renderContext.captureOptions.timeStep = 1.0f / renderItem.fps;
|
||||
|
||||
Range newRange = renderItem.frameRange;
|
||||
newRange.start -= m_renderContext.captureOptions.timeStep;
|
||||
renderItem.pSequence->SetTimeRange(newRange);
|
||||
@@ -907,7 +914,6 @@ void CSequenceBatchRenderDialog::CaptureItemStart()
|
||||
}
|
||||
|
||||
// Set specific capture options for this item.
|
||||
m_renderContext.captureOptions.timeStep = 1.0f / renderItem.fps;
|
||||
m_renderContext.captureOptions.captureBufferIndex = renderItem.bufferIndex;
|
||||
m_renderContext.captureOptions.prefix = renderItem.prefix.toUtf8().data();
|
||||
switch (renderItem.formatIndex)
|
||||
@@ -955,6 +961,7 @@ void CSequenceBatchRenderDialog::CaptureItemStart()
|
||||
finalFolder += suffix;
|
||||
++i;
|
||||
}
|
||||
|
||||
m_renderContext.captureOptions.folder = finalFolder.toUtf8().data();
|
||||
|
||||
// Change the resolution.
|
||||
@@ -969,6 +976,14 @@ void CSequenceBatchRenderDialog::CaptureItemStart()
|
||||
m_renderContext.cvarCustomResHeightBU = pCVarCustomResHeight->GetIVal();
|
||||
pCVarCustomResWidth->Set(renderWidth);
|
||||
pCVarCustomResHeight->Set(renderHeight);
|
||||
|
||||
// awaiting ATOM-14859
|
||||
// AzFramework::NativeWindowHandle windowHandle = nullptr;
|
||||
// AzFramework::WindowSystemRequestBus::BroadcastResult(
|
||||
// windowHandle, &AzFramework::WindowSystemRequestBus::Events::GetDefaultWindowHandle);
|
||||
// AzFramework::WindowRequestBus::Event(
|
||||
// windowHandle, &AzFramework::WindowRequestBus::Events::ResizeClientArea,
|
||||
// AzFramework::WindowSize(renderWidth, renderHeight));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1187,6 +1202,11 @@ void CSequenceBatchRenderDialog::OnUpdateFinalize()
|
||||
m_ui->BATCH_RENDER_INPUT_GROUP_BOX->setEnabled(true);
|
||||
m_ui->BATCH_RENDER_OUTPUT_GROUP_BOX->setEnabled(true);
|
||||
|
||||
m_renderContext.frameNumber = 0;
|
||||
m_renderContext.capturingFrame = false;
|
||||
|
||||
AZ::Render::FrameCaptureNotificationBus::Handler::BusDisconnect();
|
||||
|
||||
// Check to see if there is more items to process
|
||||
bool done = m_renderContext.currentItemIndex == m_renderItems.size() - 1;
|
||||
if (done)
|
||||
@@ -1279,31 +1299,56 @@ void CSequenceBatchRenderDialog::OnKickIdle()
|
||||
|
||||
if (GetIEditor()->IsInGameMode())
|
||||
{
|
||||
bool capturing = m_renderContext.captureState == CaptureState::Capturing;
|
||||
|
||||
// The lags behind by one frame since we are capturing the back buffer, so dont bother enabling the capture
|
||||
// on the first frame.
|
||||
if (m_renderContext.framesSpentInCurrentPhase == 0)
|
||||
// note: the internal state may change by calling GetGameEngine()->Update() so
|
||||
// we must not cache this value
|
||||
const auto capturing = [this]
|
||||
{
|
||||
capturing = false;
|
||||
}
|
||||
return m_renderContext.captureState == CaptureState::Capturing
|
||||
// this lags behind by one frame since we are capturing the back buffer,
|
||||
// so don't bother enabling the capture on the first frame.
|
||||
&& m_renderContext.framesSpentInCurrentPhase != 0;
|
||||
};
|
||||
|
||||
if (capturing)
|
||||
// if we're currently trying to capture and aren't waiting for a frame
|
||||
// capture to complete, it's possible to start the next capture
|
||||
const auto canBeginFrameCapture = [capturing, this]
|
||||
{
|
||||
// Update the time so the frame number can be calculated in StartCapture()
|
||||
return capturing() && !m_renderContext.capturingFrame;
|
||||
};
|
||||
|
||||
if (canBeginFrameCapture())
|
||||
{
|
||||
// update the time so the frame number can be calculated in StartCapture()
|
||||
IAnimSequence* sequence = m_renderItems[m_renderContext.currentItemIndex].pSequence;
|
||||
m_renderContext.captureOptions.time = GetIEditor()->GetMovieSystem()->GetPlayingTime(sequence);
|
||||
|
||||
GetIEditor()->GetMovieSystem()->StartCapture(m_renderContext.captureOptions, m_renderContext.framesSpentInCurrentPhase);
|
||||
GetIEditor()->GetMovieSystem()->StartCapture(m_renderContext.captureOptions, ++m_renderContext.frameNumber);
|
||||
GetIEditor()->GetMovieSystem()->ControlCapture();
|
||||
}
|
||||
|
||||
GetIEditor()->GetGameEngine()->Update();
|
||||
|
||||
if (capturing)
|
||||
// if we're not capturing or we're not currently waiting for the current frame to finish
|
||||
// being captured, it's safe to move to the next step of the main update
|
||||
if (!capturing() || !m_renderContext.capturingFrame)
|
||||
{
|
||||
GetIEditor()->GetMovieSystem()->EndCapture();
|
||||
GetIEditor()->GetMovieSystem()->ControlCapture();
|
||||
GetIEditor()->GetGameEngine()->Update(); // step update (original frame capture)
|
||||
}
|
||||
|
||||
if (canBeginFrameCapture())
|
||||
{
|
||||
AZStd::string filePath;
|
||||
AZStd::string fileName = AZStd::string::format("Frame_%06d.dds", m_renderContext.frameNumber);
|
||||
AzFramework::StringFunc::Path::Join(
|
||||
m_renderContext.captureOptions.folder.c_str(), fileName.c_str(), filePath, /*caseInsensitive=*/true,
|
||||
/*normalize=*/false);
|
||||
|
||||
bool capturedScreenshot = false;
|
||||
AZ::Render::FrameCaptureRequestBus::BroadcastResult(
|
||||
capturedScreenshot, &AZ::Render::FrameCaptureRequestBus::Events::CaptureScreenshot, filePath);
|
||||
|
||||
if (capturedScreenshot)
|
||||
{
|
||||
m_renderContext.capturingFrame = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -1313,6 +1358,14 @@ void CSequenceBatchRenderDialog::OnKickIdle()
|
||||
}
|
||||
}
|
||||
|
||||
void CSequenceBatchRenderDialog::OnCaptureFinished(
|
||||
[[maybe_unused]] AZ::Render::FrameCaptureResult result, [[maybe_unused]] const AZStd::string& info)
|
||||
{
|
||||
m_renderContext.capturingFrame = false;
|
||||
GetIEditor()->GetMovieSystem()->EndCapture();
|
||||
GetIEditor()->GetMovieSystem()->ControlCapture();
|
||||
}
|
||||
|
||||
void CSequenceBatchRenderDialog::OnCancelRender()
|
||||
{
|
||||
if (m_renderContext.captureState == CaptureState::Capturing)
|
||||
|
||||
@@ -13,14 +13,10 @@
|
||||
|
||||
// Description : A dialog for batch-rendering sequences
|
||||
|
||||
|
||||
#ifndef CRYINCLUDE_EDITOR_TRACKVIEW_SEQUENCEBATCHRENDERDIALOG_H
|
||||
#define CRYINCLUDE_EDITOR_TRACKVIEW_SEQUENCEBATCHRENDERDIALOG_H
|
||||
#pragma once
|
||||
|
||||
#include <AzFramework/StringFunc/StringFunc.h>
|
||||
|
||||
class CMFCButton;
|
||||
#include <Atom/Feature/Utils/FrameCaptureBus.h>
|
||||
|
||||
#include <QDialog>
|
||||
#include <QTimer>
|
||||
@@ -37,6 +33,7 @@ namespace Ui
|
||||
class CSequenceBatchRenderDialog
|
||||
: public QDialog
|
||||
, public IMovieListener
|
||||
, private AZ::Render::FrameCaptureNotificationBus::Handler
|
||||
{
|
||||
public:
|
||||
CSequenceBatchRenderDialog(float fps, QWidget* pParent = nullptr);
|
||||
@@ -58,7 +55,7 @@ protected:
|
||||
void OnSequenceSelected();
|
||||
void OnRenderItemSelChange();
|
||||
void OnFPSEditChange();
|
||||
void OnFPSChange();
|
||||
void OnFPSChange(int itemIndex);
|
||||
void OnImageFormatChange();
|
||||
void OnResolutionSelected();
|
||||
void OnStartFrameChange();
|
||||
@@ -154,6 +151,10 @@ protected:
|
||||
IAnimSequence* endingSequence;
|
||||
// Current capture state.
|
||||
CaptureState captureState;
|
||||
// Is an individual frame currently being captured.
|
||||
bool capturingFrame;
|
||||
// Current frame being captured
|
||||
int frameNumber;
|
||||
|
||||
bool IsInRendering() const
|
||||
{ return currentItemIndex >= 0; }
|
||||
@@ -171,7 +172,9 @@ protected:
|
||||
, processingFFMPEG(false)
|
||||
, canceled(false)
|
||||
, endingSequence(nullptr)
|
||||
, captureState(CaptureState::Idle) {}
|
||||
, captureState(CaptureState::Idle)
|
||||
, capturingFrame(false)
|
||||
, frameNumber(0) {}
|
||||
};
|
||||
SRenderContext m_renderContext;
|
||||
|
||||
@@ -216,6 +219,8 @@ protected slots:
|
||||
bool GetResolutionFromCustomResText(const char* customResText, int& retCustomWidth, int& retCustomHeight) const;
|
||||
|
||||
private:
|
||||
// FrameCaptureNotificationBus overrides ...
|
||||
void OnCaptureFinished(AZ::Render::FrameCaptureResult result, const AZStd::string& info) override;
|
||||
|
||||
void CheckForEnableUpdateButton();
|
||||
void stashActiveViewportResolution();
|
||||
@@ -230,5 +235,3 @@ private:
|
||||
int32 CV_TrackViewRenderOutputCapturing;
|
||||
QScopedPointer<CPrefixValidator> m_prefixValidator;
|
||||
};
|
||||
|
||||
#endif // CRYINCLUDE_EDITOR_TRACKVIEW_SEQUENCEBATCHRENDERDIALOG_H
|
||||
|
||||
@@ -110,13 +110,11 @@ void CTrackViewKeyPropertiesDlg::CreateAllVars()
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CTrackViewKeyPropertiesDlg::PopulateVariables()
|
||||
{
|
||||
//SetVarBlock( m_pVarBlock,functor(*this,&CTrackViewKeyPropertiesDlg::OnVarChange) );
|
||||
|
||||
// Must first clear any selection in properties window.
|
||||
m_wndProps->RemoveAllItems();
|
||||
m_wndProps->AddVarBlock(m_pVarBlock);
|
||||
|
||||
m_wndProps->SetUpdateCallback(functor(*this, &CTrackViewKeyPropertiesDlg::OnVarChange));
|
||||
m_wndProps->SetUpdateCallback(AZStd::bind(&CTrackViewKeyPropertiesDlg::OnVarChange, this, AZStd::placeholders::_1));
|
||||
//m_wndProps->m_props.ExpandAll();
|
||||
|
||||
|
||||
@@ -180,7 +178,7 @@ void CTrackViewKeyPropertiesDlg::OnKeySelectionChanged(CTrackViewSequence* seque
|
||||
&& selectedKeys.GetKey(0).GetTrack() == m_pLastTrackSelected;
|
||||
|
||||
// Every Key in an Asset Blend track can have different min/max values on the float sliders
|
||||
// because it's based on the duration of the motion that is set. So don't try to
|
||||
// because it's based on the duration of the motion that is set. So don't try to
|
||||
// reuse the controls when the selection changes, otherwise the tooltips may be wrong.
|
||||
bool reuseControls = bSelectChangedInSameTrack && m_pLastTrackSelected && (m_pLastTrackSelected->GetValueType() != AnimValueType::AssetBlend);
|
||||
|
||||
@@ -370,13 +368,13 @@ void CTrackViewTrackPropsDlg::OnUpdateTime()
|
||||
|
||||
CTrackViewKeyHandle existingKey = track->GetKeyByTime(time);
|
||||
|
||||
// If there is an existing key at this time, remove it so the
|
||||
// If there is an existing key at this time, remove it so the
|
||||
// new key at this time is the only one here. Make sure it's actually a different
|
||||
// key, because time can "change" but then be quantized (or snapped) to the same time by track->GetKeyByTime(time).
|
||||
if (existingKey.IsValid() && (existingKey.GetIndex() != m_keyHandle.GetIndex()))
|
||||
{
|
||||
// Save the old time before we set the new time so we
|
||||
// can reselect the m_keyHandle after the Delete.
|
||||
// can reselect the m_keyHandle after the Delete.
|
||||
float currentTime = m_keyHandle.GetTime();
|
||||
|
||||
// There is a bug in QT where editingFinished will get fired a second time if we show a QMessageBox
|
||||
|
||||
@@ -43,7 +43,11 @@ class CTrackViewKeyUIControls
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
CTrackViewKeyUIControls() { m_pVarBlock = new CVarBlock; };
|
||||
CTrackViewKeyUIControls()
|
||||
{
|
||||
m_pVarBlock = new CVarBlock;
|
||||
m_onSetCallback = AZStd::bind(&CTrackViewKeyUIControls::OnInternalVariableChange, this, AZStd::placeholders::_1);
|
||||
};
|
||||
|
||||
void SetKeyPropertiesDlg(CTrackViewKeyPropertiesDlg* pDlg) { m_pKeyPropertiesDlg = pDlg; }
|
||||
|
||||
@@ -95,7 +99,7 @@ protected:
|
||||
var.SetName(varName);
|
||||
}
|
||||
var.SetDataType(dataType);
|
||||
var.AddOnSetCallback(functor(*this, &CTrackViewKeyUIControls::OnInternalVariableChange));
|
||||
var.AddOnSetCallback(&m_onSetCallback);
|
||||
varArray.AddVariable(&var);
|
||||
m_registeredVariables.push_back(&var);
|
||||
}
|
||||
@@ -107,7 +111,7 @@ protected:
|
||||
var.SetName(varName);
|
||||
}
|
||||
var.SetDataType(dataType);
|
||||
var.AddOnSetCallback(functor(*this, &CTrackViewKeyUIControls::OnInternalVariableChange));
|
||||
var.AddOnSetCallback(&m_onSetCallback);
|
||||
m_pVarBlock->AddVariable(&var);
|
||||
m_registeredVariables.push_back(&var);
|
||||
}
|
||||
@@ -117,6 +121,7 @@ protected:
|
||||
_smart_ptr<CVarBlock> m_pVarBlock;
|
||||
std::vector<_smart_ptr<IVariable> > m_registeredVariables;
|
||||
CTrackViewKeyPropertiesDlg* m_pKeyPropertiesDlg;
|
||||
IVariable::OnSetCallback m_onSetCallback;
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
Reference in New Issue
Block a user