Page 1 of 1

Entity component array expose for editor

Posted: Thu Feb 22, 2018 3:09 pm
by fury22uk
Hi. I need some help. I need to create specific type of array in my component, that I will access in editor later. Now.. the issue about it is, that most of the arrays in Schematyc:: namespace don't work.
Okay, I managed to create array of strings or ints, for example:

Code: Select all

Schematyc::CArray<Schematyc::CSharedString> arrayOfStrings;
//then I simply add member in reflect type function:
desc.AddMember(&SPropertyClass::arrayOfStrings, 'arof', "Array", "StringArray", "", Schematyc::CArray<Schematyc::CSharedString>());
And it works just fine. I can access it in editor and add items to array. But what I actually need is specific type of array.
In the best case I need array where each element will contain Schematyc::GeomFileName and Schematyc::MaterialFileName. Is it possible at all?
What I would also be happy with would be array of geometry files only. This would be fine too.
I tried:

Code: Select all

Schematyc::CArray<Schematyc::GeomFileName>
just like before, but it won't compile. And yes, I double and triple checked if my syntax is correct, and if I do it as it should. So there is no typo.
I looked also into other arrays lilke Schematyc::CHybridArray and all of other array types, but norhing. They won't even compile.
Any ideas?

Re: Entity component array expose for editor

Posted: Fri Feb 23, 2018 12:23 am
by mknmknmknjk
i found a case in source code .

Code: Select all

typedef Schematyc::CArray<SSensorTagName> SensorTagNames; desc.AddMember(&CSchematycEntitySensorVolumeComponent::STags::attributeTags, 'atT', "Attribute", "Attribute", "Tags describing this volume.", SensorTagNames());

Re: Entity component array expose for editor

Posted: Fri Feb 23, 2018 4:10 am
by fury22uk
I guess this is some old gamesdk stuff, because I can't find it anywhere. This components does not seem to exist anymore, and I do not use GameSDK

Re: Entity component array expose for editor

Posted: Fri Feb 23, 2018 6:51 pm
by Cry-Flare
The code mentioned by mknmknmknjk is part of the SensorVolumeComponent. You can find this component at "CRYENGINE\Code\CryPlugins\CrySensorSystem\Module\SensorSystem.cpp".

Let us know if this helps.

Re: Entity component array expose for editor

Posted: Fri Feb 23, 2018 7:07 pm
by fury22uk
Yeah, I found reference to it somewhere online, but when I try to include it, it does not pop up, i mean it is not finding it. Can't even find cry plugin directory

Re: Entity component array expose for editor

Posted: Fri Feb 23, 2018 8:27 pm
by ivanhawkes
I managed to get Schematyc::CArray<Schematyc::CSharedString> working for me, but not really sure about any other types using a CArray. It should be possible to have any type exposed as long as it has a Serialize function - but I was so damn grateful the moment I got Schematyc::CArray<Schematyc::CSharedString> to work I wept quietly in a corner and moved onwards :D

Re: Entity component array expose for editor

Posted: Fri Feb 23, 2018 8:30 pm
by ivanhawkes
Oddly, this stuff is a lot easier to make work for DRS stuff (Dynamic Response System) so maybe you should go and have a look into that code base and see if there's any clues in there.

Re: Entity component array expose for editor

Posted: Fri Feb 23, 2018 9:51 pm
by Cry-Flare
To answer your last question this is an example of getting access to the sensorvolume plugins' interface:

Code: Select all

#include <../../CryPlugins/CrySensorSystem/Interface/ICrySensorSystemPlugin.h>
#include <../../CryPlugins/CrySensorSystem/Interface/ISensorSystem.h>
#include <../../CryPlugins/CrySensorSystem/Interface/ISensorMap.h>
#include <CryExtension/ICryPluginManager.h>

void someFunc()
{
if (auto pSensorPlugin = gEnv->pSystem->GetIPluginManager()->QueryPlugin<ICrySensorSystemPlugin>())
{
// Do stuff
}
}

Re: Entity component array expose for editor

Posted: Tue Feb 27, 2018 1:23 pm
by fury22uk
Just tested code mentioned by mknmknmknjk, but it won't compile. I included those plugins, and it finds the type, but there is a bunch of errors anyway. Well, I guess we need to have different solution for it.

Re: Entity component array expose for editor

Posted: Wed Feb 28, 2018 2:43 am
by mknmknmknjk
what error ? have you tried copy SensorVolumeComponent source code to your project and change class Name?
provide your code !