[Bf-taskforce25] RNA and 'Linked Values'

Brecht Van Lommel brecht at blender.org
Wed Nov 26 12:41:39 CET 2008


Hi Joshua,

On Thu, 2008-11-27 at 00:27 +1300, Joshua Leung wrote:
> While going through the RNA stuff tonight, I noticed that there's
> something which doesn't seem to be accounted for (or perhaps I
> overlooked it). I was trying to add start/end frame entries for Scene
> struct, but noticed that there wasn't any way to specify that the
> ranges of each should depend on the other. Perhaps this is more of
> UI-level stuff, but it seems that being able to specify this for some
> things (like in this scenario) is quite important, as it would mean
> less need for clamping of values on the part of data-users (i.e.
> operators). Or have I misunderstood some things about overall design
> of RNA?

If the property needs to do extra validation like this, you should write
your own rna_Scene_start/end_set functions. You can do that without too
much effort in this way:

* Let RNA autogenerate the functions without validation.
* Copy the functions from the autogenerated rna.c (for scons somewhere
in ../build, make in obj/..) into rna_scene.c in the #ifdef RNA_RUNTIME
section.
* Call RNA_def_property_int_funcs() with the function right names.

Brecht.



More information about the Bf-taskforce25 mailing list