Merge pull request #7439 from aws-lumberyard-dev/TerrainMaterialsFix
LYN-8403 Prevent the same Surface Tag from getting reused
This commit is contained in:
+10
@@ -154,6 +154,16 @@ namespace AzToolsFramework
|
||||
(void)debugName;
|
||||
}
|
||||
|
||||
// provides an option to specify reading parent element attributes.
|
||||
// This allows parent elements to override attributes of their children if needed.
|
||||
virtual void ConsumeParentAttribute(WidgetType* widget, AZ::u32 attrib, PropertyAttributeReader* attrValue, const char* debugName)
|
||||
{
|
||||
(void)widget;
|
||||
(void)attrib;
|
||||
(void)attrValue;
|
||||
(void)debugName;
|
||||
}
|
||||
|
||||
// override GetFirstInTabOrder, GetLastInTabOrder in your base class to define which widget gets focus first when pressing tab,
|
||||
// and also what widget is last.
|
||||
// for example, if your widget is a compound widget and contains, say, 5 buttons
|
||||
|
||||
+35
-10
@@ -40,7 +40,14 @@ namespace AzToolsFramework
|
||||
}
|
||||
|
||||
void* classInstance = parent->FirstInstance(); // pointer to the owner class so we can read member variables and functions
|
||||
auto consumeAttributes = [&](const auto& attributes, const char* name)
|
||||
|
||||
void* parentClassInstance = nullptr;
|
||||
if (InstanceDataNode* parentInstanceDataNode = parent->GetParent())
|
||||
{
|
||||
parentClassInstance = parentInstanceDataNode->FirstInstance();
|
||||
}
|
||||
|
||||
auto consumeAttributes = [this, classInstance, wid](const auto& attributes, const char* name)
|
||||
{
|
||||
for (size_t i = 0; i < attributes.size(); ++i)
|
||||
{
|
||||
@@ -50,25 +57,43 @@ namespace AzToolsFramework
|
||||
}
|
||||
};
|
||||
|
||||
auto consumeParentAttributes = [this, parentClassInstance, wid](const auto& attributes, const char* name)
|
||||
{
|
||||
if (parentClassInstance)
|
||||
{
|
||||
for (size_t i = 0; i < attributes.size(); ++i)
|
||||
{
|
||||
const auto& attrPair = attributes[i];
|
||||
PropertyAttributeReader reader(parentClassInstance, &*attrPair.second);
|
||||
ConsumeParentAttribute(wid, attrPair.first, &reader, name);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const AZ::SerializeContext::ClassElement* element = dataNode->GetElementMetadata();
|
||||
if (element)
|
||||
{
|
||||
consumeAttributes(element->m_attributes, element->m_name);
|
||||
const AZ::Edit::ElementData* elementEdit = dataNode->GetElementEditMetadata();
|
||||
if (elementEdit)
|
||||
|
||||
if (const AZ::Edit::ElementData* elementEdit = dataNode->GetElementEditMetadata();
|
||||
elementEdit != nullptr)
|
||||
{
|
||||
consumeAttributes(elementEdit->m_attributes, elementEdit->m_name);
|
||||
}
|
||||
}
|
||||
|
||||
if (dataNode->GetClassMetadata())
|
||||
{
|
||||
const AZ::Edit::ClassData* classEditData = dataNode->GetClassMetadata()->m_editData;
|
||||
if (classEditData)
|
||||
const AZ::SerializeContext::ClassElement* parentElement = parent != dataNode ?
|
||||
dataNode->GetElementMetadata() :
|
||||
nullptr;
|
||||
|
||||
if (parentElement != nullptr)
|
||||
{
|
||||
for (auto it = classEditData->m_elements.begin(); it != classEditData->m_elements.end(); ++it)
|
||||
// Reuse the current instance element name for the debug name
|
||||
consumeParentAttributes(parentElement->m_attributes, element->m_name);
|
||||
|
||||
if (const AZ::Edit::ElementData* elementEdit = parent->GetElementEditMetadata();
|
||||
elementEdit != nullptr)
|
||||
{
|
||||
consumeAttributes(it->m_attributes, it->m_name);
|
||||
consumeParentAttributes(elementEdit->m_attributes, elementEdit->m_name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+6
@@ -66,6 +66,12 @@ namespace AzToolsFramework
|
||||
class GenericEnumPropertyComboBoxHandler
|
||||
: public GenericComboBoxHandler<ValueType>
|
||||
{
|
||||
virtual void ConsumeParentAttribute(GenericComboBoxCtrlBase* GUI, AZ::u32 attrib, PropertyAttributeReader* attrValue, const char* debugName) override
|
||||
{
|
||||
// Simply re-route to ConsumeAttribute since no special logic is needed.
|
||||
ConsumeAttribute(GUI, attrib, attrValue, debugName);
|
||||
}
|
||||
|
||||
virtual void ConsumeAttribute(GenericComboBoxCtrlBase* GUI, AZ::u32 attrib, PropertyAttributeReader* attrValue, const char* debugName) override
|
||||
{
|
||||
(void)debugName;
|
||||
|
||||
Reference in New Issue
Block a user