Integrating latest 47acbe8

This commit is contained in:
alexpete
2021-03-25 13:57:57 -07:00
parent 448c549698
commit 75dc720198
10312 changed files with 2711566 additions and 671451 deletions
@@ -1,12 +1,12 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates, or
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates, or
* a third party where indicated.
*
* 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,
* 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.
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
@@ -169,7 +169,7 @@ void LensFlarePropertyWidget::SetValue(const QString &value)
}
QString LensFlarePropertyWidget::GetValue() const
{
{
return m_valueEdit->text();
}
@@ -223,7 +223,7 @@ bool LensFlareHandler::ReadValuesIntoGUI(size_t index, LensFlarePropertyWidget*
QWidget* FloatCurveHandler::CreateGUI(QWidget *pParent)
{
CSplineCtrl *cSpline = new CSplineCtrl(pParent);
cSpline->SetUpdateCallback(functor(*this, &FloatCurveHandler::OnSplineChange));
cSpline->SetUpdateCallback(AZStd::bind(&FloatCurveHandler::OnSplineChange, this, AZStd::placeholders::_1));
cSpline->SetTimeRange(0, 1);
cSpline->SetValueRange(0, 1);
cSpline->SetGrid(12, 12);
@@ -35,7 +35,7 @@ void ReflectedPropertiesPanel::DeleteVars()
}
//////////////////////////////////////////////////////////////////////////
void ReflectedPropertiesPanel::SetVarBlock(class CVarBlock* vb, const ReflectedPropertyControl::UpdateVarCallback& updCallback, const char* category)
void ReflectedPropertiesPanel::SetVarBlock(class CVarBlock* vb, ReflectedPropertyControl::UpdateVarCallback* updCallback, const char* category)
{
assert(vb);
@@ -45,7 +45,7 @@ void ReflectedPropertiesPanel::SetVarBlock(class CVarBlock* vb, const ReflectedP
m_varBlock = vb;
AddVarBlock(m_varBlock, category);
SetUpdateCallback(functor(*this, &ReflectedPropertiesPanel::OnPropertyChanged));
SetUpdateCallback(AZStd::bind(&ReflectedPropertiesPanel::OnPropertyChanged, this, AZStd::placeholders::_1));
// When new object set all previous callbacks freed.
m_updateCallbacks.clear();
@@ -56,7 +56,7 @@ void ReflectedPropertiesPanel::SetVarBlock(class CVarBlock* vb, const ReflectedP
}
//////////////////////////////////////////////////////////////////////////
void ReflectedPropertiesPanel::AddVars(CVarBlock* vb, const ReflectedPropertyControl::UpdateVarCallback& updCallback, const char* category)
void ReflectedPropertiesPanel::AddVars(CVarBlock* vb, ReflectedPropertyControl::UpdateVarCallback* updCallback, const char* category)
{
assert(vb);
@@ -73,7 +73,7 @@ void ReflectedPropertiesPanel::AddVars(CVarBlock* vb, const ReflectedPropertyCon
if (bNewBlock)
{
SetUpdateCallback(functor(*this, &ReflectedPropertiesPanel::OnPropertyChanged));
SetUpdateCallback(AZStd::bind(&ReflectedPropertiesPanel::OnPropertyChanged, this, AZStd::placeholders::_1));
// When new object set all previous callbacks freed.
m_updateCallbacks.clear();
@@ -87,10 +87,10 @@ void ReflectedPropertiesPanel::AddVars(CVarBlock* vb, const ReflectedPropertyCon
void ReflectedPropertiesPanel::OnPropertyChanged(IVariable* pVar)
{
std::list<ReflectedPropertyControl::UpdateVarCallback>::iterator iter;
std::list<ReflectedPropertyControl::UpdateVarCallback*>::iterator iter;
for (iter = m_updateCallbacks.begin(); iter != m_updateCallbacks.end(); ++iter)
{
(*iter)(pVar);
(*iter)->operator()(pVar);
}
}
@@ -31,9 +31,9 @@ public:
ReflectedPropertiesPanel(QWidget* pParent = nullptr); // standard constructor
void DeleteVars();
void AddVars(class CVarBlock* vb, const ReflectedPropertyControl::UpdateVarCallback& func = nullptr, const char* category = nullptr);
void AddVars(class CVarBlock* vb, ReflectedPropertyControl::UpdateVarCallback* func = nullptr, const char* category = nullptr);
void SetVarBlock(class CVarBlock* vb, const ReflectedPropertyControl::UpdateVarCallback& func = nullptr, const char* category = nullptr);
void SetVarBlock(class CVarBlock* vb, ReflectedPropertyControl::UpdateVarCallback* func = nullptr, const char* category = nullptr);
protected:
void OnPropertyChanged(IVariable* pVar);
@@ -42,7 +42,7 @@ protected:
AZ_PUSH_DISABLE_DLL_EXPORT_MEMBER_WARNING
TSmartPtr<CVarBlock> m_varBlock;
std::list<ReflectedPropertyControl::UpdateVarCallback> m_updateCallbacks;
std::list<ReflectedPropertyControl::UpdateVarCallback*> m_updateCallbacks;
AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING
};
@@ -1,12 +1,12 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates, or
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates, or
* a third party where indicated.
*
* 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,
* 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.
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
@@ -15,7 +15,7 @@
#include "ReflectedPropertyCtrl.h"
// Qt
#include <QScopedValueRollback>
#include <QScopedValueRollback>
#include <QHBoxLayout>
#include <QVBoxLayout>
#include <QLabel>
@@ -27,7 +27,7 @@
#include <AzToolsFramework/UI/PropertyEditor/ComponentEditorHeader.hxx>
#include <AzToolsFramework/UI/PropertyEditor/ReflectedPropertyEditor.hxx>
#include <AzToolsFramework/UI/PropertyEditor/PropertyRowWidget.hxx>
#include <AzToolsFramework/UI/SearchWidget/SearchCriteriaWidget.hxx>
#include <AzToolsFramework/UI/SearchWidget/SearchCriteriaWidget.hxx>
#include <AzToolsFramework/Editor/EditorSettingsAPIBus.h>
// Editor
@@ -98,7 +98,7 @@ QSize ReflectedPropertyControl::sizeHint() const
ReflectedPropertyItem* ReflectedPropertyControl::AddVarBlock(CVarBlock *varBlock, const char *szCategory /*= nullptr*/)
{
AZ_Assert(m_initialized, "ReflectedPropertyControl not initialized. Setup must be called first.");
if (!varBlock)
return nullptr;
@@ -112,7 +112,7 @@ ReflectedPropertyItem* ReflectedPropertyControl::AddVarBlock(CVarBlock *varBlock
m_editor->AddInstance(m_rootContainer.get());
}
AZStd::vector<IVariable*> variables(varBlock->GetNumVariables());
//Copy variables into vector
@@ -171,7 +171,7 @@ ReflectedPropertyItem* ReflectedPropertyControl::AddVarBlock(CVarBlock *varBlock
}
//////////////////////////////////////////////////////////////////////////
static void AddVariable(CVariableBase& varArray, CVariableBase& var, const char* varName, const char* humanVarName, const char* description, IVariable::OnSetCallback func, void* pUserData, char dataType = IVariable::DT_SIMPLE)
static void AddVariable(CVariableBase& varArray, CVariableBase& var, const char* varName, const char* humanVarName, const char* description, IVariable::OnSetCallback* func, void* pUserData, char dataType = IVariable::DT_SIMPLE)
{
if (varName)
{
@@ -200,7 +200,7 @@ void ReflectedPropertyControl::CreateItems(XmlNodeRef node)
CreateItems(node, out, nullptr);
}
void ReflectedPropertyControl::CreateItems(XmlNodeRef node, CVarBlockPtr& outBlockPtr, IVariable::OnSetCallback func, bool splitCamelCaseIntoWords)
void ReflectedPropertyControl::CreateItems(XmlNodeRef node, CVarBlockPtr& outBlockPtr, IVariable::OnSetCallback* func, bool splitCamelCaseIntoWords)
{
SelectItem(0);
@@ -456,7 +456,7 @@ int ReflectedPropertyControl::GetContentHeight() const
}
void ReflectedPropertyControl::AddCustomPopupMenuPopup(const QString& text, const Functor1<int>& handler, const QStringList& items)
void ReflectedPropertyControl::AddCustomPopupMenuPopup(const QString& text, const AZStd::function<void(int)>& handler, const QStringList& items)
{
m_customPopupMenuPopups.push_back(SCustomPopupMenu(text, handler, items));
}
@@ -709,7 +709,7 @@ void ReflectedPropertyControl::OnItemChange(ReflectedPropertyItem *item, bool de
}
if (m_updateObjectFunc != 0 && m_bEnableCallback)
{
// KDAB: This callback has same signature as DoUpdateCallback. I think the only reason there are 2 is because some
// KDAB: This callback has same signature as DoUpdateCallback. I think the only reason there are 2 is because some
// EntityObject registers callback and some derived objects want to register their own callback. the normal UpdateCallback
// can only be registered for item at a time so the original authors added a 2nd callback function, so we ported it this way.
// This can probably get cleaned up to only on callback function with multiple receivers.
@@ -949,7 +949,7 @@ void ReflectedPropertyControl::EnableUpdateCallback(bool bEnable)
void ReflectedPropertyControl::SetGrayed([[maybe_unused]] bool grayed)
{
//KDAB_PROPERTYCTRL_PORT_TODO
//control should be grayed out but not disabled?
//control should be grayed out but not disabled?
}
void ReflectedPropertyControl::SetReadOnly(bool readonly)
@@ -46,7 +46,7 @@ AZ_POP_DISABLE_DLL_EXPORT_BASECLASS_WARNING
Q_OBJECT
public:
//! For alternative undo.
typedef Functor1<IVariable*> UndoCallback;
typedef AZStd::function<void(IVariable*)> UndoCallback;
explicit ReflectedPropertyControl(QWidget* parent = nullptr, Qt::WindowFlags windowFlags = Qt::WindowFlags());
@@ -55,7 +55,7 @@ public:
ReflectedPropertyItem* AddVarBlock(CVarBlock* varBlock, const char* szCategory = nullptr);
void CreateItems(XmlNodeRef node);
void CreateItems(XmlNodeRef node, CVarBlockPtr& varBlock, IVariable::OnSetCallback func, bool splitCamelCaseIntoWords = false);
void CreateItems(XmlNodeRef node, CVarBlockPtr& varBlock, IVariable::OnSetCallback* func, bool splitCamelCaseIntoWords = false);
// Replace category item contents with the specified var block.
virtual void ReplaceVarBlock(IVariable* categoryItem, CVarBlock* varBlock);
@@ -68,11 +68,11 @@ public:
bool FindVariable(IVariable* categoryItem) const;
//! When item change, this callback fired variable that changed.
typedef Functor1<IVariable*> UpdateVarCallback;
typedef AZStd::function<void(IVariable*)> UpdateVarCallback;
//! When item change, update object.
typedef Functor1<IVariable*> UpdateObjectCallback;
typedef AZStd::function<void(IVariable*)> UpdateObjectCallback;
//! When selection changes, this callback fired variable that changed.
typedef Functor1<IVariable*> SelChangeCallback;
typedef AZStd::function<void(IVariable*)> SelChangeCallback;
/** Set update callback to be used for this property window.
*/
@@ -166,19 +166,19 @@ public:
struct SCustomPopupItem
{
typedef Functor0 Callback;
typedef AZStd::function<void()> Callback;
QString m_text;
Callback m_callback;
SCustomPopupItem(const QString& text, const Functor0& callback)
SCustomPopupItem(const QString& text, const Callback& callback)
: m_text(text)
, m_callback(callback) {}
};
struct SCustomPopupMenu
{
typedef Functor1<int> Callback;
typedef AZStd::function<void(int)> Callback;
QString m_text;
Callback m_callback;
@@ -190,7 +190,7 @@ public:
, m_subMenuText(subMenuText) {}
};
void AddCustomPopupMenuPopup(const QString& text, const Functor1<int>& handler, const QStringList& items);
void AddCustomPopupMenuPopup(const QString& text, const AZStd::function<void(int)>& handler, const QStringList& items);
void RemoveCustomPopupMenuPopup(const QString& text);
void AddCustomPopupMenuItem(const QString& text, const SCustomPopupItem::Callback handler);
@@ -1,12 +1,12 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates, or
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates, or
* a third party where indicated.
*
* 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,
* 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.
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
@@ -28,10 +28,10 @@ const float ReflectedPropertyItem::s_DefaultNumStepIncrements = 500.0f;
//A ReflectedVarAdapter for holding IVariableContainers
//The extra ReflectedVarAdapter is the extra case of a container (has children) but also has a value itself.
//An example is an IVariable array whose type is forced to IVariable::DT_TEXTURE. The base Ivariable has a texture,
//The extra ReflectedVarAdapter is the extra case of a container (has children) but also has a value itself.
//An example is an IVariable array whose type is forced to IVariable::DT_TEXTURE. The base Ivariable has a texture,
//but it also has children that are parameters of the texture. The ReflectedPropertyEditor does not support this case
//so we work around by adding the base property to the list of children and showing the value of the base property
//so we work around by adding the base property to the list of children and showing the value of the base property
//in the container value space instead of "X Elements"
static ColorF StringToColor(const QString &value)
@@ -92,7 +92,7 @@ public:
UpdateCommon(m_item->GetVariable(), varBlock);
}
void SyncReflectedVarToIVar(IVariable *pVariable) override
void SyncReflectedVarToIVar(IVariable *pVariable) override
{
if (m_extraVariableAdapter)
{
@@ -102,7 +102,7 @@ public:
}
};
void SyncIVarToReflectedVar(IVariable *pVariable) override
void SyncIVarToReflectedVar(IVariable *pVariable) override
{
if (m_extraVariableAdapter)
{
@@ -175,6 +175,9 @@ ReflectedPropertyItem::ReflectedPropertyItem(ReflectedPropertyControl *control,
m_modified = false;
if (parent)
parent->AddChild(this);
m_onSetCallback = AZStd::bind(&ReflectedPropertyItem::OnVariableChange, this, AZStd::placeholders::_1);
m_onSetEnumCallback = AZStd::bind(&ReflectedPropertyItem::OnVariableEnumChange, this, AZStd::placeholders::_1);
}
ReflectedPropertyItem::~ReflectedPropertyItem()
@@ -193,7 +196,7 @@ void ReflectedPropertyItem::SetVariable(IVariable *var)
if (var == m_pVariable)
{
// Early exit optimization if setting the same var as the current var.
// A common use case, in Track View for example, is to re-use the save var for a property when switching to a new
// A common use case, in Track View for example, is to re-use the save var for a property when switching to a new
// instance of the same variable. The visible display of the value is often handled by invalidating the property,
// but the non-visible attributes, i.e. the range values, are usually set using this method. Thus we reset the ranges
// explicitly here when the Ivariable var is the same
@@ -210,8 +213,8 @@ void ReflectedPropertyItem::SetVariable(IVariable *var)
m_pVariable = pInputVar;
assert(m_pVariable != NULL);
m_pVariable->AddOnSetCallback(functor(*this, &ReflectedPropertyItem::OnVariableChange));
m_pVariable->AddOnSetEnumCallback(functor(*this, &ReflectedPropertyItem::OnVariableEnumChange));
m_pVariable->AddOnSetCallback(&m_onSetCallback);
m_pVariable->AddOnSetEnumCallback(&m_onSetEnumCallback);
// Fetch base parameter description
Prop::Description desc(m_pVariable);
@@ -230,14 +233,14 @@ void ReflectedPropertyItem::SetVariable(IVariable *var)
break;
case ePropertyFloat:
case ePropertyAngle:
//if the Description has a valid global enumDB lookup, edit as an enum, otherwise use normal float editor
//if the Description has a valid global enumDB lookup, edit as an enum, otherwise use normal float editor
if (desc.m_pEnumDBItem)
m_reflectedVarAdapter = new ReflectedVarDBEnumAdapter;
else
m_reflectedVarAdapter = new ReflectedVarFloatAdapter;
break;
case ePropertyInt:
//if the Description has a valid global enumDB lookup, edit as an enum, otherwise use normal int editor
//if the Description has a valid global enumDB lookup, edit as an enum, otherwise use normal int editor
if (desc.m_pEnumDBItem)
m_reflectedVarAdapter = new ReflectedVarDBEnumAdapter;
else
@@ -247,7 +250,7 @@ void ReflectedPropertyItem::SetVariable(IVariable *var)
m_reflectedVarAdapter = new ReflectedVarBoolAdapter;
break;
case ePropertyString:
//if the Description has a valid global enumDB lookup, edit as an enum, otherwise use normal string editor
//if the Description has a valid global enumDB lookup, edit as an enum, otherwise use normal string editor
if (desc.m_pEnumDBItem)
m_reflectedVarAdapter = new ReflectedVarDBEnumAdapter;
else
@@ -301,7 +304,7 @@ void ReflectedPropertyItem::SetVariable(IVariable *var)
default:
break;
}
const bool hasChildren = (m_pVariable->GetNumVariables() > 0 || desc.m_type == ePropertyTable || m_pVariable->GetType() == IVariable::ARRAY);
//const bool isNotContainerType = (m_pVariable->GetType() != IVariable::ARRAY && desc.m_type != ePropertyTable && desc.m_type != ePropertyInvalid);
if (hasChildren )
@@ -309,7 +312,7 @@ void ReflectedPropertyItem::SetVariable(IVariable *var)
m_reflectedVarContainerAdapter = new ReflectedVarContainerAdapter(this, m_propertyCtrl, m_reflectedVarAdapter);
m_reflectedVarAdapter = m_reflectedVarContainerAdapter;
}
if (m_reflectedVarAdapter)
{
m_reflectedVarAdapter->SetVariable(m_pVariable);
@@ -474,8 +477,8 @@ void ReflectedPropertyItem::ReleaseVariable()
if (m_pVariable)
{
// Unwire all from variable.
m_pVariable->RemoveOnSetCallback(functor(*this, &ReflectedPropertyItem::OnVariableChange));
m_pVariable->RemoveOnSetEnumCallback(functor(*this, &ReflectedPropertyItem::OnVariableEnumChange));
m_pVariable->RemoveOnSetCallback(&m_onSetCallback);
m_pVariable->RemoveOnSetEnumCallback(&m_onSetEnumCallback);
}
m_pVariable = 0;
delete m_reflectedVarAdapter;
@@ -619,7 +622,7 @@ void ReflectedPropertyItem::SetValue(const QString& sValue, bool bRecordUndo, bo
{
m_pVariable->SetForceModified(true);
}
switch (m_type)
{
case ePropertyColor:
@@ -162,6 +162,11 @@ AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING
QString m_strNoScriptDefault;
QString m_strScriptDefault;
AZ_PUSH_DISABLE_DLL_EXPORT_MEMBER_WARNING
IVariable::OnSetCallback m_onSetCallback;
IVariable::OnSetEnumCallback m_onSetEnumCallback;
AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING
};
typedef _smart_ptr<ReflectedPropertyItem> ReflectedPropertyItemPtr;