Page MenuHome

Custom Properties: Allow strings to have a default value
ClosedPublic

Authored by Demeter Dzadik (Mets) on Jun 24 2020, 1:01 PM.

Details

Summary

This patch lets String custom properties have a default value, just like floats and ints and arrays.

Use case example: A character outfit swapping system where objects store in custom properties what outfit or outfits they belong to. The user can change that to move the object to another outfit temporarily, but may later want to revert it to its original value.

Code is mostly copy paste from resetting float properties, so I hope it's the correct way.

Diff Detail

Event Timeline

Demeter Dzadik (Mets) requested review of this revision.Jun 24 2020, 1:01 PM
Demeter Dzadik (Mets) created this revision.
Steff Kempink (mswf) added inline comments.
source/blender/makesrna/intern/rna_access.c
3533

You left debug prints here
(Thanks for adding this, I ran into this with my scripts too)

Whoops, thanks!

  • Removed debug prints :)
Brecht Van Lommel (brecht) added inline comments.
source/blender/makesrna/intern/rna_access.c
3476

Wrong indent, run "make format" to fix it.

3526

This function needs to be updated as well, otherwise the length will not match the returned string.

This revision is now accepted and ready to land.Jun 25 2020, 5:32 PM
Brecht Van Lommel (brecht) requested changes to this revision.Jun 25 2020, 5:32 PM
This revision now requires changes to proceed.Jun 25 2020, 5:32 PM
  • Fixed not allocating right amount of memory. I think. Thanks Brecht!

I have no idea what I'm doing

Demeter Dzadik (Mets) marked 3 inline comments as done.Jun 29 2020, 8:11 PM
This revision is now accepted and ready to land.Jun 30 2020, 3:09 PM