Reflection generator PrimalReflectGen #21
No assignees
Labels
No labels
area/build
area/content
area/editor
area/engine
area/graphics
area/platform
area/repo-wide
area/tests
area/tools
bug
optional
roadmap
size/L
size/M
size/S
No project
No milestone
Blocks
Depends on
#22 Game scripts and the game library ABI
UnflavoredMeson/Primal_Plus_Plus
#23 Render components
UnflavoredMeson/Primal_Plus_Plus
#42 Project, scene and prefab files as JSON
UnflavoredMeson/Primal_Plus_Plus
#43 Actor runtime: actors, parts, behaviors
UnflavoredMeson/Primal_Plus_Plus
#5 Unit tests with doctest
UnflavoredMeson/Primal_Plus_Plus
#11 The engine as one shared library
UnflavoredMeson/Primal_Plus_Plus
Reference
No Branch/Tag specified
Notifications
1 participant
Due date
No due date set.
Reference
UnflavoredMeson/Primal_Plus_Plus#21
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Why
The editor edits fields of components and classes it doesn't know at compile time, and files store them by name. In the fork, scripts were registered three different ways before this was settled. Deciding it now means game code is written one way.
Decided
PrimalReflectGen(ReflectionTool/) reads before compiling.PRIMAL_COMPONENT(),PRIMAL_GAME_SCRIPT(),PRIMAL_ACTOR(),PRIMAL_PART(),PRIMAL_BEHAVIOR(),PRIMAL_ENUM()before the type;PRIMAL_GENERATED_BODY()inside;PRIMAL_PROPERTY(.min = 0.f, .tooltip = "...")before a member. The header's last include is"X.generated.h".PRIMAL_PROPERTYfields..name = "..."); never by index. A duplicate name is an error in every build.bool,s32,u32,s64,u64,f32,v2-v4,m4x4,game_entity::Entity,PRIMAL_ENUM()enums,std::arrayof those; classes alsostd::vector/utl::vectorandstd::string. No C arrays. 64-bit integers are never held asdoubleanywhere.primal_reflect(<target> ...)(cmake/PrimalReflection.cmake), MSBuildEngine/Reflection.targets.Read first
Steps
Engine/EngineAPI/Reflection.h,Reflection/Reflection.cpp) with hand-written registrations, and tests for lookup by name, fields and duplicate names.X.generated.hwith the same registrations. Golden-file tests inUnitTests/for its output.ecs::find_component(name_hash)).Done when
Claude can help with
PRIMAL_PROPERTY).Learn