Questions about struct padding in DNA_modifier_types

Hey there! :slight_smile:

Im a bit puzzled with struct padding for the various ModifierData structs in DNA_modifier_types.
When I add, i.e. a short to a struct and try to align the padding for it, everything breaks when I compile. Lots of errors.

This is what I read up: Structure Member Alignment, Padding and Data Packing - GeeksforGeeks

And this already raises questions, i.e. what are we aligning for, 4 or 8 bytes ?
It should be obvious when I fiddle around long enough and analyze all the other ModifierData structs, but I have so many more questions to this topic that I cant yet draw certain conclusions. If that makes sense.

How do I count byte size for structs inside the ModifierData structs?
They are already packed locally, so can I ignore them for counting?
Still matters where I put them, correct ?

My specific goal is to make the custom-curve influence falloff for the WeightVGProximityModifier available, for that I need to add the struct:
struct CurveMapping *cmap_curve;
in DNA_modifier_types.h => WeightVGProximityModifierData.

But where to put it and how to pad ?

original padding:
char _pad0[2];

Thanks in advance!

Check the build log, makesdna will inform you about any padding errors it found and how it thinks you should resolve it, however you should only address the very first one it reports, since any errors beyond that could just be a cascade of that very first padding error.

Thx for your help, that was a fantastic hint for a beginner like me. :slight_smile:

I must have messed something else up because it was throwing an exception from another struct that I never touched. Maybe I unknowingly switched up the order of some vars.

I just purged my progress and started over, all good now. I must have been clumsy.