Item::Clone

Discussion area about developing with Ogre2 branches (2.1, 2.2 and beyond)
Post Reply
Hilarius86
Gnoblar
Posts: 19
Joined: Thu Feb 14, 2019 11:27 am
x 3

Item::Clone

Post by Hilarius86 »

The implementation of Item::clone is deactivated (if 0) in OgreItem.cpp.
Is this intentional? It is still in the header.
I am migrating an application to ogre-next and had Entity clone calls I wanted to change to Item clone calls and that resulted in broken linking.

User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 4511
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 943
Contact:

Re: Item::Clone

Post by dark_sylinc »

Hi!

There is no clone() functionality because maintaining the cloning process by hand was error prone (i.e. a variable could be missing, gets out of date, etc)
Thus it was postponed until it could be automated but we simply forgot about it.

Ironically we did get an automated solution now though. In Other/clone_datablock there is a python script which parses OgreHlmsUnlitDatablock and OgreHlmsPbsDatablock to automatically generate a clone implementation for HlmsUnlitDatablock & HlmsPbsDatablock respectively.

It could be adapted to do the same for OgreItem.h / Item

Hilarius86
Gnoblar
Posts: 19
Joined: Thu Feb 14, 2019 11:27 am
x 3

Re: Item::Clone

Post by Hilarius86 »

I reactivated and used the implementation with a little twist and it seemed to work.
I guess I will take another look at the results and see if something is going wrong for my current use case. Thanks for the tip.

Nice to hear that a general solution may be around the corner anyway.

Last part in my comment was that we still have a method prototype in the OgreItem.h.
Was it intentionally left in the header (cause at that time you wanted to make a Item::clone happen soon) or just an oversight. I am trying to understand the reasoning, cause I was very surprised by it.

User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 4511
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 943
Contact:

Re: Item::Clone

Post by dark_sylinc »

Hilarius86 wrote:
Mon Jul 20, 2020 9:14 am
Was it intentionally left in the header (cause at that time you wanted to make a Item::clone happen soon) or just an oversight.
Just an oversight :)

Post Reply