Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionLast revisionBoth sides next revision | ||
0.8.3:prefabs [2022/04/08 10:51] – admin | 0.8.3:prefabs [2022/04/08 11:33] – [Prefabs] admin | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== Prefabs ====== | ====== Prefabs ====== | ||
+ | |||
+ | Prefabs are containers with a number of components and presets. | ||
+ | They are comparable to *.fmx files in regular Delphi applications. | ||
Prefabs are very helpful on storing and reusing sceneries in projects. | Prefabs are very helpful on storing and reusing sceneries in projects. | ||
- | You can store complex component hierarchies | + | You can store complex component hierarchies like in a default FMX formular file (*.fmx). |
- | We use the read/write mechanisms for prefabs. | + | We use the read/write mechanisms for prefabs |
So it is also possible to store complete models with textures and animations. | So it is also possible to store complete models with textures and animations. | ||
To unify the structure within a prefab, all components are grouped within a parent TGorillaGroup component inside the prefab file. | To unify the structure within a prefab, all components are grouped within a parent TGorillaGroup component inside the prefab file. | ||
Therefore you need to create a corresponding TGorillaGroup component to load data into. | Therefore you need to create a corresponding TGorillaGroup component to load data into. | ||
+ | |||
+ | ===== TGorillaPrefabSystem ===== | ||
+ | |||
+ | Is a simple management component to prepare prefab loading. | ||
+ | You can setup prefabs with their corresponding file location and load them on running the application. | ||
+ | |||
+ | <file pascal> | ||
+ | var LList : TObjectList< | ||
+ | | ||
+ | LList := TObjectList< | ||
+ | try | ||
+ | GorillaPrefabSystem1.LoadAllPrefabs(LList); | ||
+ | finally | ||
+ | FreeAndNil(LList); | ||
+ | end; | ||
+ | </ | ||
+ | |||
+ | ===== Runtime Usage ===== | ||
When projects getting very large, prefabs need to be loaded at runtime. Take a look at the following function on how to do it. | When projects getting very large, prefabs need to be loaded at runtime. Take a look at the following function on how to do it. | ||
Line 48: | Line 69: | ||
end; | end; | ||
</ | </ | ||
+ | |||
+ | ===== Assets Store (Beta) ===== | ||
+ | |||
+ | During development process prefabs became very handy and useful. | ||
+ | Like in other 3D DevTools (Unity, Unreal, ...) it is common to share those over a platform. | ||
+ | |||
+ | We present **[[https:// | ||
+ | |||
+ | {{: | ||
+ | |||
+ | In our assets store you can download prefabs and integrate them in your application. | ||
+ | When download the prefab you will receive a *.prefab or a *.prefabz file. | ||
+ | Both types can be integrated in the TGorillaPrefabSystem. Have a look at the code snippets above. | ||
+ | |||
+ | **WARNING**: | ||
+ | |||
+ | **WARNING: | ||
+ | |||
+ | ===== Embedded AssetsStore (Beta) ===== | ||
+ | |||
+ | Since 0.8.3.2265 we integrated the assets store also directly in the Delphi IDE. | ||
+ | |||
+ | - Drop a TGorillaPrefabSystem component onto your form. | ||
+ | - Right-Click on the component in the object inspector | ||
+ | - Click " | ||
+ | - Browse through the assets and click to directly embed them in your form | ||
+ | |||
+ | {{: | ||
+ | |||
+ | **WARNING**: | ||
+ | |||
+ | **WARNING: Some prefabs are very large in size or produce large output due to textures or animations. | ||
+ | This can exceed your memory in IDE very fast!** | ||
+ | |||
+ | **WARNING: | ||
+ | |||
+ | Next step: [[android|Android]] |