o3de / sig-testing

Documentation and materials for the Open 3D Engine Test Special Interest Group
9 stars 7 forks source link

RFC: EditorEntityComponentBehaviors Libraries #56

Open FuzzyCarter opened 1 year ago

FuzzyCarter commented 1 year ago

Summary:

A set of libraries that allow for Editor Entity Components to be interacted with through common user interactions that come packed with behavior validators (need to break validators out into their own RFC).

For a prototype please see Gem/PythonTests/EditorPythonTestTools/editor_python_test_tools/editor_component

What is the motivation for this suggestion?

Why is this important?

What are the use cases for this suggestion?

What should the outcome be if this suggestion is implemented?

Suggestion design description:

On-Build Auto-generation of the following:

What are the advantages of the suggestion?

What are the disadvantages of the suggestion?

How will this be work within the O3DE project?

Are there any alternatives to this suggestion?

Same implementation as above but not using auto-generation.

What is the strategy for adoption?

lmbr-pip commented 1 year ago

@FuzzyCarterAWS - These RFCs should be created in SIG/Testing (or other relevant SIG or TSC github) ie https://github.com/o3de/sig-testing/issues

You should work with a maintainer to migrate issue (need maintainer with permissions on SIG repository).

Kadino commented 1 year ago

Unclear ownership as this falls in the grey area between SIGs. @o3de/sig-testing can iterate on this to clarify.

hultonha commented 1 year ago

I'm not totally clear on what this is adding and/or solving. Could you maybe include some examples of before/after to help show how this improves consistency and makes things easier/clearer? Thanks!

smurly commented 1 year ago

currently accessing behavior context properties requires a property path string using a bus call that takes python type any for the value. I believe the intention of this is to create a hardened interface on the python side for setting, getting and validating function for each component property. in python the bus call to set a property looks something like editor.EditorComponentAPIBus(bus.Broadcast, "SetComponentProperty", self.id, component_property_path, value) which is available wrapped in editor_entity_utils.py as a method set_component_property_value the component itself also has a string name used for interacting with it via bus calls. component names and property paths represent a collection of static strings which are subject to change on the C++ side of behavior context which has on occasion resulted in automation breaks on the python side. Atom automation addressed this issue through the use of constants dictionaries in AutomatedTesting/Gem/PythonTests/Atom/atom_utils/atom_constants.py where each component has a dictionary collection including component name string and property path strings which can be used with editor_entity_utils.py calls to set/get property values like the following: mesh_component.set_component_property_value(AtomComponentProperties.mesh('Model Asset'), model.id)

this RFC proposes a way to encapsulate these property path and component name strings in python so that they are centralized with get/set/validate methods for each property as a component specific object. adding an instance of a component to an entity would be an initialize python component class providing the entity as an argument. setting a component property would be done by calling the set method on the component objects property

Generating python component classes could be helpful in writing automation against the components. autogenerating might break automation though since the python classes if changed by this generation might not be reflected in automation python code using it; autogenerating could introduce breaking changes. some sort of generation tooling to make the component classes could be used to initially populate the python classes.