Page 1 of 1

how to handle ENTITY_EVENT_COMPONENT_PROPERTY_CHANGED event any code example ?

Posted: Sun Oct 07, 2018 8:15 am
by MoonBeam
Hi!
How to handle ENTITY_EVENT_COMPONENT_PROPERTY_CHANGED event any code exemple ?
the comments in code say's what
//! Called in the editor when a property of the selected entity changes. This is *not* sent when using IEntityPropertyGroup
//! nParam[0] = IEntityComponent pointer or nullptr
//! nParam[1] = Member id of the changed property, (@see IEntityComponent::GetClassDesc() FindMemberById(nParam[1]))

Re: how to handle ENTITY_EVENT_COMPONENT_PROPERTY_CHANGED event any code example ?

Posted: Sun Oct 07, 2018 11:20 am
by mknmknmknjk
search github cryengine source code

like this
https://github.com/CRYTEK/CRYENGINE/sea ... TY_CHANGED

Re: how to handle ENTITY_EVENT_COMPONENT_PROPERTY_CHANGED event any code example ?

Posted: Sun Oct 07, 2018 2:39 pm
by MoonBeam
thx,
but this examples only catching event, then call something (common for whole entity) and seems that all.
no, I want to get value that exactly was changed, should I get it from event structure or Entity::DescClass ?
exactly one value what was changed in editor.

Re: how to handle ENTITY_EVENT_COMPONENT_PROPERTY_CHANGED event any code example ?

Posted: Sun Oct 07, 2018 5:58 pm
by fury22uk
What I usually do in this case is...
I create struct, for example struct SMyComponentProperties
This structure gathers all properties of my component and is entirely exposed to the editor.
Then in my component I create two variables of this structure type.
SMyComponentProperties m_properties;
and
SMyComponentProperties m_prevProperties;

m_properties is exposed to the editor, and prevProperties is not.
Now in Initialize function I assign:
m_prevProperties = m_properties;

From now on whenever m_properties value changes, I am able to compare it to m_prevProperties and see what values have changed.

Re: how to handle ENTITY_EVENT_COMPONENT_PROPERTY_CHANGED event any code example ?

Posted: Mon Oct 08, 2018 10:59 am
by MoonBeam
thx fury22uk, you'r invented good solution )