Atom Tools: Document system exposes reflected object data

• This removes a direct dependency on dynamic property groups and data from the document system.
• Added support for names, descriptions, and nesting to dynamic property groups.
• Moved property related functions from base document classes into material editor document classes because dynamic property groups are an implementation detail of the material editor document to support material type flexible data format.
• Change material document to use a table of dynamic property groups instead of a map of properties.
• Added functions to traverse groups and properties.
• This keeps groups and properties organized consistently with the material type file as well as what’s expected in the UI.
• Document data can now be maps directly to the inspector reflective property editors instead of copying one property at a time out of the document and keeping those synchronized.

Signed-off-by: Guthrie Adams <guthadam@amazon.com>
This commit is contained in:
Guthrie Adams
2022-02-03 20:15:40 -06:00
parent 1e11df5d92
commit c9c172794e
19 changed files with 585 additions and 592 deletions
@@ -36,32 +36,10 @@ namespace AtomToolsFramework
return m_absolutePath;
}
const AZStd::any& AtomToolsDocument::GetPropertyValue([[maybe_unused]] const AZ::Name& propertyId) const
AZStd::vector<DocumentObjectInfo> AtomToolsDocument::GetObjectInfo() const
{
AZ_UNUSED(propertyId);
AZ_Error("AtomToolsDocument", false, "%s not implemented.", __FUNCTION__);
return m_invalidValue;
}
const AtomToolsFramework::DynamicProperty& AtomToolsDocument::GetProperty([[maybe_unused]] const AZ::Name& propertyId) const
{
AZ_UNUSED(propertyId);
AZ_Error("AtomToolsDocument", false, "%s not implemented.", __FUNCTION__);
return m_invalidProperty;
}
bool AtomToolsDocument::IsPropertyGroupVisible([[maybe_unused]] const AZ::Name& propertyGroupFullName) const
{
AZ_UNUSED(propertyGroupFullName);
AZ_Error("AtomToolsDocument", false, "%s not implemented.", __FUNCTION__);
return false;
}
void AtomToolsDocument::SetPropertyValue([[maybe_unused]] const AZ::Name& propertyId, [[maybe_unused]] const AZStd::any& value)
{
AZ_UNUSED(propertyId);
AZ_UNUSED(value);
AZ_Error("AtomToolsDocument", false, "%s not implemented.", __FUNCTION__);
AZ_Warning("AtomToolsDocument", false, "%s not implemented.", __FUNCTION__);
return AZStd::vector<DocumentObjectInfo>();
}
bool AtomToolsDocument::Open(AZStd::string_view loadPath)
@@ -256,13 +234,13 @@ namespace AtomToolsFramework
bool AtomToolsDocument::BeginEdit()
{
AZ_Error("AtomToolsDocument", false, "%s not implemented.", __FUNCTION__);
AZ_Warning("AtomToolsDocument", false, "%s not implemented.", __FUNCTION__);
return false;
}
bool AtomToolsDocument::EndEdit()
{
AZ_Error("AtomToolsDocument", false, "%s not implemented.", __FUNCTION__);
AZ_Warning("AtomToolsDocument", false, "%s not implemented.", __FUNCTION__);
return false;
}
@@ -77,8 +77,6 @@ namespace AtomToolsFramework
->Attribute(AZ::Script::Attributes::Category, "Editor")
->Attribute(AZ::Script::Attributes::Module, "atomtools")
->Event("GetAbsolutePath", &AtomToolsDocumentRequestBus::Events::GetAbsolutePath)
->Event("GetPropertyValue", &AtomToolsDocumentRequestBus::Events::GetPropertyValue)
->Event("SetPropertyValue", &AtomToolsDocumentRequestBus::Events::SetPropertyValue)
->Event("Open", &AtomToolsDocumentRequestBus::Events::Open)
->Event("Reopen", &AtomToolsDocumentRequestBus::Events::Reopen)
->Event("Close", &AtomToolsDocumentRequestBus::Events::Close)
@@ -195,14 +195,14 @@ namespace AtomToolsFramework
return !m_config.m_displayName.empty() ? m_config.m_displayName : m_config.m_name;
}
AZStd::string DynamicProperty::GetGroupName() const
AZStd::string DynamicProperty::GetGroupDisplayName() const
{
return m_config.m_groupName;
return m_config.m_groupDisplayName;
}
AZStd::string DynamicProperty::GetAssetPickerTitle() const
{
return GetGroupName().empty() ? GetDisplayName() : GetGroupName() + " " + GetDisplayName();
return GetGroupDisplayName().empty() ? GetDisplayName() : GetGroupDisplayName() + " " + GetDisplayName();
}
AZStd::string DynamicProperty::GetDescription() const
@@ -235,6 +235,10 @@ namespace AtomToolsFramework
AZ::u32 DynamicProperty::OnDataChanged() const
{
if (m_config.m_dataChangeCallback)
{
return m_config.m_dataChangeCallback(GetValue());
}
return AZ::Edit::PropertyRefreshLevels::AttributesAndValues;
}
@@ -17,7 +17,12 @@ namespace AtomToolsFramework
if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
{
serializeContext->Class<DynamicPropertyGroup>()
->Field("visible", &DynamicPropertyGroup::m_visible)
->Field("name", &DynamicPropertyGroup::m_name)
->Field("displayName", &DynamicPropertyGroup::m_displayName)
->Field("description", &DynamicPropertyGroup::m_description)
->Field("properties", &DynamicPropertyGroup::m_properties)
->Field("groups", &DynamicPropertyGroup::m_groups)
;
if (auto editContext = serializeContext->GetEditContext())
@@ -28,6 +33,9 @@ namespace AtomToolsFramework
->DataElement(AZ::Edit::UIHandlers::Default, &DynamicPropertyGroup::m_properties, "properties", "")
->Attribute(AZ::Edit::Attributes::Visibility, AZ::Edit::PropertyVisibility::ShowChildrenOnly) // hides the m_properties row
->Attribute(AZ::Edit::Attributes::ContainerCanBeModified, false) // probably not necessary since Visibility is children-only
->DataElement(AZ::Edit::UIHandlers::Default, &DynamicPropertyGroup::m_groups, "groups", "")
->Attribute(AZ::Edit::Attributes::Visibility, AZ::Edit::PropertyVisibility::ShowChildrenOnly) // hides the m_groups row
->Attribute(AZ::Edit::Attributes::ContainerCanBeModified, false) // probably not necessary since Visibility is children-only
;
}
}