Ogre Property Component - what's the point?

A place for users of OGRE to discuss ideas and experiences of utilitising OGRE in their games / demos / applications.
Post Reply
User avatar
Klaim
Old One
Posts: 2565
Joined: Sun Sep 11, 2005 1:04 am
Location: Paris, France
x 56
Contact:

Ogre Property Component - what's the point?

Post by Klaim »

Can someone explain to me what is the point of the Property component of Ogre?

I understand what it is technically after reading the main header, but I don't understand why it's in Ogre or in which case it becomes interesting.
I can't find any other documentation on this. Maybe in the forum but there is too much discussions about component systems that hide the related discussion to this ogre component.

Nodrev
Gremlin
Posts: 193
Joined: Fri Jan 25, 2008 6:55 pm
Location: Nantes / France
x 17

Re: Ogre Property Component - what's the point?

Post by Nodrev »

It's not used at all, but it's a nice peace of code :lol:
It emulates propety system of .net in c++. The funny thing is that I wanted such a system a couple of year ago, and I spent days to make a clean template generated system (I searched all over the net for a such library, but nothing was existing at this time...). And when I finished my own implementation, two or three month later, wasn't was my surprise to see a such lib implemented in Ogre, with quite the same techniques as I was using (my system is a little more powerful because it handle "Descriptors", a set of properties, and automatic serialization / unserialization).
The goal for me is to write something like:

Code: Select all

myInstance.myProperty = anyValue;
instead of

Code: Select all

myInstance.setSomething(anyValue);
And call some function binding in the "=" operator, using getter and setter function on the property. So for example if I write in my framework:

Code: Select all

myEntity.position = Vector3(10, 10, 10);
It will call the function "setPosition" automatically.
I think that this library was initially created for such thing, but it was never really used in Ogre itself. So in the actual state, I do not see the interest of using such system, but extending it as in my own property system, with serialization, it could be very useful.

<edit> another sample of a full c++ property system usage:

Code: Select all

	PongSettingsDescriptor settings; // a set of property in it

        // Unserialize all the properties of the descriptor from xml file
	Core::DataStreamPtr configFileStream;
	try
	{
		configFileStream = usulEngineRoot->resourceGroupManager->OpenResource("config.xml");
		settings = usulEngineRoot->serializerManager->Unserialize<PongSettingsDescriptor>(configFileStream, "xml");
		configFileStream->Close();
	}
	catch(Core::FileNotFoundException&){/*Do nothing if file is not found, we will use the default settings.*/}

       // Accessing a property
       if (settings.fullscreen)
           some c++ stuff;

      // setting property
      settings.fullscreen = !setting.fullscreen;
</edit>

User avatar
Klaim
Old One
Posts: 2565
Joined: Sun Sep 11, 2005 1:04 am
Location: Paris, France
x 56
Contact:

Re: Ogre Property Component - what's the point?

Post by Klaim »

Ok, so it don't look like it's used in Ogre anyway, so I'll disable it in my current setup. I don't need it.

User avatar
Kojack
OGRE Moderator
OGRE Moderator
Posts: 7153
Joined: Sun Jan 25, 2004 7:35 am
Location: Brisbane, Australia
x 523

Re: Ogre Property Component - what's the point?

Post by Kojack »

If you don't use boost with ogre (I usually can't be bothered) then cmake won't generate a project for the property component. Everything runs fine without it.

I don't know if any addons or wiki pages use it though.

User avatar
Klaim
Old One
Posts: 2565
Joined: Sun Sep 11, 2005 1:04 am
Location: Paris, France
x 56
Contact:

Re: Ogre Property Component - what's the point?

Post by Klaim »

I use boost but I deactivated the property component in CMake.

Post Reply