o3de / o3de

Open 3D Engine (O3DE) is an Apache 2.0-licensed multi-platform 3D engine that enables developers and content creators to build AAA games, cinema-quality 3D worlds, and high-fidelity simulations without any fees or commercial obligations.

Home Page:https://o3de.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Bug Report: Editor don't recognize SimpleState changes

Andre-LA opened this issue · comments

Describe the bug
On the "Simple State" component, the following changes aren't recognized by the editor as changes, that is, the prefab being edited (including the level prefab) isn't being marked as a modified one.

The unrecognized changes are:

  • Adding, removing or reordering states;
  • Adding, removing or reordering the Entities list on a state;
    • Note: Setting or unsetting an actual entity does mark the prefab as edited.

Steps to reproduce
Steps to reproduce the behavior:

  1. Add an entity;
  2. Add Simple State component on it;
  3. Save;
  4. Do one of the mentioned changes above;
  5. Check that the level prefab isn't marked as edited.

Expected behavior
Being able to save the prefab as a change it's done

Actual behavior
The prefab isn't marked as edited, thus cannot be saved.

Screenshots/Video
This video shows an prefab being edited, but the same goes to a level prefab.

simple-state-no-save.webm

Found in Branches and Commit IDs
point-release/23103 at e0f6a3a
development at c895a33

Desktop/Device

  • Device: PC
  • OS: Linux
  • Version: Fedora 39
  • CPU & GPU: AMD Ryzen 5 5600G
  • Memory: 16GB

Note that this is a much more general issue that is not limited to the SimpleState component, but to all components with a list/vector.

Started on this a little, the ctrl stuff is kind of hard to follow.

I believe the issue would be in the ReflectionAdapter logic for marking modified or added container elements as dirty in the DPE
That code is in the ReflectionAdapter

void OnRemoveElement(ReflectionAdapterReflectionImpl* impl, const AZ::Dom::Path& path)
{
const AZ::SerializeContext::ClassElement* containerClassElement =
m_container->GetElement(m_container->GetDefaultElementNameCrc());
auto elementInstance = m_container->GetElementByIndex(m_containerInstance, containerClassElement, m_elementIndex);
[[maybe_unused]] const bool elementRemoved = m_container->RemoveElement(m_containerInstance, elementInstance, impl->m_serializeContext);
AZ_Assert(elementRemoved, "could not remove element!");
auto containerNode = GetContainerNode(impl, path);
Nodes::PropertyEditor::ChangeNotify.InvokeOnDomNode(containerNode);
impl->m_adapter->NotifyResetDocument();
}
void OnMoveElement(ReflectionAdapterReflectionImpl* impl, const AZ::Dom::Path& path, bool moveForward)
{
m_container->SwapElements(m_containerInstance, m_elementIndex, (moveForward ? m_elementIndex + 1 : m_elementIndex - 1));
auto containerNode = GetContainerNode(impl, path);
Nodes::PropertyEditor::ChangeNotify.InvokeOnDomNode(containerNode);
impl->m_adapter->NotifyResetDocument();
}

@lemonade-dm so this is the callstack for how a proeprty notifies the dom that a value changed.

this call AZ::DocumentPropertyEditor::ReflectionAdapter is where the entity gets dirtied but its a little vague how this should notify when the dom is present I don't think I would want to flag it and then try to dirty it later?

I doesn't look that straightforward to fix.

(lldb) bt
* thread #1, name = 'Editor', stop reason = breakpoint 3.4
  * frame #0: 0x00007ffff169756f libEditorLib.so`AzToolsFramework::RpePropertyHandlerWrapper<AZStd::basic_string<char, AZStd::char_traits<char>, AZStd::allocator>>::OnValueChanged(this=0x0000555564256c50, changeType=InProgressEdit) at PropertyEditorAPI_In
nals.h:500:36
    frame #1: 0x00007ffff170b905 libEditorLib.so`decltype(*InvokeTraits::forward<AzToolsFramework::IndividualPropertyHandlerEditNotifications*&>(fp0).*fp(InvokeTraits::forward<AZ::DocumentPropertyEditor::Nodes::ValueChangeType>(fp1))) AZStd::Internal::INV
<void (AzToolsFramework::IndividualPropertyHandlerEditNotifications::*)(AZ::DocumentPropertyEditor::Nodes::ValueChangeType), AzToolsFramework::IndividualPropertyHandlerEditNotifications*&, AZ::DocumentPropertyEditor::Nodes::ValueChangeType, void>(f=0x0000
fffffb0e0, arg0=0x000055556242da18, args=0x00007fffffffb0dc) at invoke_traits.h:177:20
    frame #2: 0x00007ffff170b844 libEditorLib.so`AZStd::invoke_result<void (AzToolsFramework::IndividualPropertyHandlerEditNotifications::*)(AZ::DocumentPropertyEditor::Nodes::ValueChangeType), AzToolsFramework::IndividualPropertyHandlerEditNotifications*
AZ::DocumentPropertyEditor::Nodes::ValueChangeType>::type AZStd::invoke<void (AzToolsFramework::IndividualPropertyHandlerEditNotifications::*)(AZ::DocumentPropertyEditor::Nodes::ValueChangeType), AzToolsFramework::IndividualPropertyHandlerEditNotification
, AZ::DocumentPropertyEditor::Nodes::ValueChangeType>(f=0x00007fffffffb0e0, args=0x000055556242da18, args=0x00007fffffffb0dc) at invoke.h:54:16
    frame #3: 0x00007ffff170b1e2 libEditorLib.so`void AZ::EBusEventProcessingPolicy::Call<void (AzToolsFramework::IndividualPropertyHandlerEditNotifications::*)(AZ::DocumentPropertyEditor::Nodes::ValueChangeType), AzToolsFramework::IndividualPropertyHandl
ditNotifications*&, AZ::DocumentPropertyEditor::Nodes::ValueChangeType>(func=0x00007fffffffb0e0, iface=0x000055556242da18, args=0x00007fffffffb0dc) at Policies.h:437:13
    frame #4: 0x00007ffff16ff17a libEditorLib.so`void AZ::Internal::EBusContainer<AzToolsFramework::IndividualPropertyHandlerEditNotifications, AzToolsFramework::IndividualPropertyHandlerEditNotifications, (AZ::EBusAddressPolicy)1, (AZ::EBusHandlerPolicy)
:Dispatcher<AZ::EBus<AzToolsFramework::IndividualPropertyHandlerEditNotifications, AzToolsFramework::IndividualPropertyHandlerEditNotifications>>::Event<void (AzToolsFramework::IndividualPropertyHandlerEditNotifications::*)(AZ::DocumentPropertyEditor::Nod
:ValueChangeType), AZ::DocumentPropertyEditor::Nodes::ValueChangeType>(id=0x00007fffffffb110, func=0x00007fffffffb0e0, args=0x00007fffffffb0dc) at BusContainer.h:806:29
    frame #5: 0x00007ffff16fbd80 libEditorLib.so`AzToolsFramework::Components::PropertyManagerComponent::RequestWrite(this=0x0000555558860178, editorGUI=0x000055555c5db530) at PropertyManagerComponent.cpp:201:13
    frame #6: 0x00007ffff174a28e libEditorLib.so`decltype(*InvokeTraits::forward<AZ::Internal::HandlerNode<AzToolsFramework::PropertyEditorGUIMessages, AzToolsFramework::PropertyEditorGUIMessages, AZ::Internal::EBusContainer<AzToolsFramework::PropertyEdit
UIMessages, AzToolsFramework::PropertyEditorGUIMessages, (AZ::EBusAddressPolicy)0, (AZ::EBusHandlerPolicy)1>::HandlerHolder, false>&>(fp0).*fp(InvokeTraits::forward<AzToolsFramework::PropertyStringLineEditCtrl* const&>(fp1))) AZStd::Internal::INVOKE<void 
ToolsFramework::PropertyEditorGUIMessages::*&)(QWidget*), AZ::Internal::HandlerNode<AzToolsFramework::PropertyEditorGUIMessages, AzToolsFramework::PropertyEditorGUIMessages, AZ::Internal::EBusContainer<AzToolsFramework::PropertyEditorGUIMessages, AzToolsF
ework::PropertyEditorGUIMessages, (AZ::EBusAddressPolicy)0, (AZ::EBusHandlerPolicy)1>::HandlerHolder, false>&, AzToolsFramework::PropertyStringLineEditCtrl* const&, void>(f=0x00007fffffffb2f8, arg0=0x00005555588601a8, args=0x0000555564ae3dd0) at invoke_tr
s.h:177:20
    frame #7: 0x00007ffff174a1c4 libEditorLib.so`AZStd::invoke_result<void (AzToolsFramework::PropertyEditorGUIMessages::*&)(QWidget*), AZ::Internal::HandlerNode<AzToolsFramework::PropertyEditorGUIMessages, AzToolsFramework::PropertyEditorGUIMessages, AZ:
ternal::EBusContainer<AzToolsFramework::PropertyEditorGUIMessages, AzToolsFramework::PropertyEditorGUIMessages, (AZ::EBusAddressPolicy)0, (AZ::EBusHandlerPolicy)1>::HandlerHolder, false>&, AzToolsFramework::PropertyStringLineEditCtrl* const&>::type AZStd:
voke<void (AzToolsFramework::PropertyEditorGUIMessages::*&)(QWidget*), AZ::Internal::HandlerNode<AzToolsFramework::PropertyEditorGUIMessages, AzToolsFramework::PropertyEditorGUIMessages, AZ::Internal::EBusContainer<AzToolsFramework::PropertyEditorGUIMessa
, AzToolsFramework::PropertyEditorGUIMessages, (AZ::EBusAddressPolicy)0, (AZ::EBusHandlerPolicy)1>::HandlerHolder, false>&, AzToolsFramework::PropertyStringLineEditCtrl* const&>(f=0x00007fffffffb2f8, args=0x00005555588601a8, args=0x0000555564ae3dd0) at in
e.h:54:16
    frame #8: 0x00007ffff1749ec2 libEditorLib.so`void AZ::EBusEventProcessingPolicy::Call<void (AzToolsFramework::PropertyEditorGUIMessages::*&)(QWidget*), AZ::Internal::HandlerNode<AzToolsFramework::PropertyEditorGUIMessages, AzToolsFramework::PropertyEd
rGUIMessages, AZ::Internal::EBusContainer<AzToolsFramework::PropertyEditorGUIMessages, AzToolsFramework::PropertyEditorGUIMessages, (AZ::EBusAddressPolicy)0, (AZ::EBusHandlerPolicy)1>::HandlerHolder, false>&, AzToolsFramework::PropertyStringLineEditCtrl* 
st&>(func=0x00007fffffffb2f8, iface=0x00005555588601a8, args=0x0000555564ae3dd0) at Policies.h:437:13
    frame #9: 0x00007ffff1749cb5 libEditorLib.so`void AZ::Internal::EBusContainer<AzToolsFramework::PropertyEditorGUIMessages, AzToolsFramework::PropertyEditorGUIMessages, (AZ::EBusAddressPolicy)0, (AZ::EBusHandlerPolicy)1>::Dispatcher<AZ::EBus<AzToolsFra
ork::PropertyEditorGUIMessages, AzToolsFramework::PropertyEditorGUIMessages>>::Broadcast<void (AzToolsFramework::PropertyEditorGUIMessages::*)(QWidget*), AzToolsFramework::PropertyStringLineEditCtrl* const&>(func=0x00007fffffffb2f8, args=0x0000555564ae3dd
at BusContainer.h:1365:29
    frame #10: 0x00007ffff174789a libEditorLib.so`AzToolsFramework::StringPropertyLineEditHandler::CreateGUI(QWidget*)::$_0::operator()(this=0x0000555564ae3dd0) const at PropertyStringLineEditCtrl.cpp:110:17
    frame #11: 0x00007ffff1747826 libEditorLib.so`QtPrivate::FunctorCall<QtPrivate::IndexesList<>, QtPrivate::List<>, void, AzToolsFramework::StringPropertyLineEditHandler::CreateGUI(QWidget*)::$_0>::call(f=0x0000555564ae3dd0, arg=0x00007fffffffb460) at q
ectdefs_impl.h:146:13
    frame #12: 0x00007ffff17477de libEditorLib.so`void QtPrivate::Functor<AzToolsFramework::StringPropertyLineEditHandler::CreateGUI(QWidget*)::$_0, 0>::call<QtPrivate::List<>, void>(f=0x0000555564ae3dd0, (null)=0x0000555557a2ae20, arg=0x00007fffffffb460)
 qobjectdefs_impl.h:256:13
    frame #13: 0x00007ffff174772e libEditorLib.so`QtPrivate::QFunctorSlotObject<AzToolsFramework::StringPropertyLineEditHandler::CreateGUI(QWidget*)::$_0, 0, QtPrivate::List<>, void>::impl(which=1, this_=0x0000555564ae3dc0, r=0x0000555557a2ae20, a=0x00007
ffffb460, ret=0x0000000000000000) at qobjectdefs_impl.h:443:17
    frame #14: 0x00007ffff7b089ce libQt5Core.so.5`void doActivate<false>(QObject*, int, void**) [inlined] QtPrivate::QSlotObjectBase::call(a=0x00007fffffffb460, r=0x0000555557a2ae20, this=0x0000555564ae3dc0) at qobjectdefs_impl.h:398:57
    frame #15: 0x00007ffff7b089bc libQt5Core.so.5`void doActivate<false>(sender=0x000055555b8cfdc0, signal_index=11, argv=0x00007fffffffb460) at qobject.cpp:3886:21
    frame #16: 0x00007fffe40c6f4f libQt5Widgets.so.5`QLineEdit::qt_static_metacall(_o=0x000055555b8cfdc0, _c=<unavailable>, _id=<unavailable>, _a=<unavailable>) at moc_qlineedit.cpp:259:36
    frame #17: 0x00007ffff7b08a00 libQt5Core.so.5`void doActivate<false>(sender=0x000055555b6aa940, signal_index=11, argv=0x00007fffffffb5a0) at qobject.cpp:3898:33
    frame #18: 0x00007fffe40cd77d libQt5Widgets.so.5`QWidgetLineControl::processKeyEvent(this=0x000055555b6aa940, event=<unavailable>) at qwidgetlinecontrol.cpp:1686:33