I am trying to add an update function to an rna property in the rna_scene.c file. All the other update functions are at the start of the file following a “#ifdef RNA_RUNTIME” preprocessor statement. The actual rna property definition is after the “#else” statement. So one of the two is being compiled. How do I compile the update functions so my new update function is declared and recognized by my property definition?
I really dont understand how this works at all, I just want to add a new update function but now when I compile it says the update function is not declared, while the compiler doesnt complain about all the other update functions which are in the same code block?
Are you trying to add custom property with associated get/set/update functions or are extending a built in? I took a look at the code, but are unable to determine what problems you have with your changes. If I remember correctly though preprocesor #else is tied in with #if not #ifdef. #ifdef you are mentioning is closed on the :988 or there abouts with #endif if I understood the rna_scene.c correctly.
I checked again and Im pretty sure I am right. The two #endifs at :988 close the #ifdefs from :920 and :959. The #else seems to be connected to the #ifdef RNA_RUNTIME.
I am trying to extend two builtins with an update function, which serves the purpose off sending a second notifier, since RNA_def_property_update only supports defining one.
It would help if you posted a patch since makesrna is sometimes a bit tricky to get right.
grep’d this (random example):
(54 ) static void rna_Armature_update_data(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
(504 ) RNA_def_property_update(prop, 0, "rna_Armature_update_data");
Looks like it takes a string of the function name!
And here’s another interesting thing, …update_runtime()
(1440 ) static void gp_convert_set_end_frame(struct Main *UNUSED(main), struct Scene *UNUSED(scene), struct PointerRNA *ptr)
(1654 ) RNA_def_property_update_runtime(prop, gp_convert_set_end_frame);
this seems to take an actual function
CoDEmanX :
Many thanks, indeed I didnt notice the string… :spin:
My knowledge extends a bit!