Jump to content

[SOLVED] ComponentVariableArray


photo

Recommended Posts

Hi,

Let's say I have this in my .prop file:
 

<parameter name="blah" type="array" array_type="int" array_dim="0"/>

And this in my .H file:
 

PROP_ARRAY(Int, blah)

This does not work on the CPP side:
 

	for (int i = 0; i < blah.size(); ++i)
	{
		int someInt = blah[i];
	}

I can actually see the definitions inside <UnigineComponentSystem.h>.

What am I missing?

Thanks!

Link to comment
Quote

 This does not work on the CPP side:


Tell us in more detail what exactly does not work and how do you check?

everything looks right, it should work.

my code:

// in test.h
#include <UnigineComponentSystem.h>

class TEST: public Unigine::ComponentBase
{
public:
	COMPONENT_DEFINE(TEST, Unigine::ComponentBase);
	COMPONENT_INIT(init);
	
	PROP_ARRAY(Int, blah);
	
private:
	void init();
};


// in test.cpp
#include "test.h"

REGISTER_COMPONENT(TEST);

void TEST::init()
{
	Log::message("BEGIN\nsize of blah array on %s(%d) node is %d\n", node->getName(), node->getID(), blah.size());
	for (int i = 0; i < blah.size(); ++i)
	{
		int someInt = blah[i];
		Log::message("parameter %d = %d\n", i, someInt);
	}
	Log::message("END\n");
}

setting in editor

image.png

console output:

BEGIN
size of blah array on sun(824505625) node is 4
parameter 0 = 6
parameter 1 = 5
parameter 2 = 4
parameter 3 = 3
END

 

show a screenshot of how exactly you filled the array, and your console output
 

Link to comment
  • silent changed the title to [SOLVED] ComponentVariableArray
×
×
  • Create New...