| 1 |
Generate Pascal code to correctly instantiate and publish instances of: |
| 2 |
|
| 3 |
TCastleColorRGBPersistent |
| 4 |
TCastleColorPersistent |
| 5 |
TCastleVector3Persistent |
| 6 |
TCastleVector4Persistent |
| 7 |
|
| 8 |
Thanks to these classes, vectors and colors: |
| 9 |
|
| 10 |
- Can be saved/loaded using our serialization system in CastleComponentSerialize, |
| 11 |
|
| 12 |
- Can be saved/loaded using standard Lazarus/Delphi serialization (lfm, dfm) |
| 13 |
(Not yet working, a published TPersistent is not saved automatically in LFM. |
| 14 |
In the future, possibly we will upgrade them to TComponent, |
| 15 |
or we will save a JSON serialization of TCastleControl.Controls in LFM, |
| 16 |
or we will figure out a way to serialize a bare TPersistent in LFM.) |
| 17 |
|
| 18 |
- Can be edited in Castle Game Engine Editor, |
| 19 |
|
| 20 |
- Can be edited in Lazarus/Delphi Object Inspector (when used in TCastleControl). |
| 21 |
|
| 22 |
Instantiating these classes is something we need to do often across the engine. |
| 23 |
And it involves a lot of boilerplace code. |
| 24 |
So it was more efficient to write a tool to generate this code. |
| 25 |
|
| 26 |
Example output is inside: |
| 27 |
|
| 28 |
../../../src/ui/opengl/auto_generated_persistent_vectors |
| 29 |
|
| 30 |
Input of this program is inside |
| 31 |
|
| 32 |
persistent_vectors_input.txt |
| 33 |
persistent_vectors_template.inc |
| 34 |
|
| 35 |
Compile and run it like |
| 36 |
|
| 37 |
castle-engine compile |
| 38 |
./generate-persistent-vectors # or castle-engine run |