[Bf-committers] RNA Defaults

Campbell Barton ideasman42 at gmail.com
Mon Oct 15 12:59:03 CEST 2012


The min/max are RNA-only (since limits are not known about in our
internal C code), so I see no need to split those out into defines
too.
Only the defaults would be in a different file, IMHO having them
external isn't that bad - using an IDE (probably well configured emacs
or vim also) - you can jump to the define value easily enough.

IMHO its better then having defaults copied about where they will
certainly get out of sync.

On Mon, Oct 15, 2012 at 3:05 PM, Harley Acheson
<harley.acheson at gmail.com> wrote:
> Campbell,
>
> You are right in that it would keep all the defaults together, but it does
> separate
> each from the RNA definitions themselves.  It's kind've nice seeing the UI
> range,
> the min and max, and defaults all together.
>
> So at the moment it is like this:
>
> /* was 'file_quality' */
> prop = RNA_def_property(srna, "quality", PROP_INT, PROP_PERCENTAGE);
> RNA_def_property_int_sdna(prop, NULL, "quality");
> RNA_def_property_range(prop, 0, 100); /* 0 is needed for compression. */
> RNA_def_property_int_default(prop, 90);
> RNA_def_property_ui_text(prop, "Quality", "Quality for image formats that
> support lossy compression");
> RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
>
> So your suggestion is we define a scene_quality_default, but then
> should we also define a scene_quality_min and scene_quality_max?
>
> Harley
>
>
>
> On Sun, Oct 14, 2012 at 7:42 PM, Campbell Barton <ideasman42 at gmail.com>
> wrote:
>>
>> IMHO to resolve this we should have some define, DNA_defaults.h (or
>> split by type DNA_defaults_scene.h, etc)
>> that has all defaults which can be shared by RNA and the BKE
>> initializer functions.
>>
>> this is tedious, not-fun stuff, headers would look something like...
>>
>> #define DNA_DEF_SCENE_SAMPLES  8  /* scene->r.osa */
>> #define DNA_DEF_SCENE_FPS  24  /* scene->r.frs_sec */
>> ...
>>
>> So that functions like BKE_scene_add() would have few hard coded values.
>>
>> On Sat, Oct 13, 2012 at 3:13 AM, Harley Acheson
>> <harley.acheson at gmail.com> wrote:
>> > Hello,
>> >
>> > Long-standing "To Do" item #23538 mentions how most RNA properties are
>> > missing
>> > defaults. So we right-click on them, select "Reset to Default Value" and
>> > they revert
>> > to minimums instead
>> >
>> > Patch #32854 adds 120 defaults to rna_scene.c, which are properties
>> > shown on
>> > the scene and render tabs.  Strangely I was not able to make the render
>> > resolution
>> > dimensions revert to a normal default (still changes to 4x4), but
>> > everything else works
>> > well...
>> >
>> > Harley
>> > _______________________________________________
>> > Bf-committers mailing list
>> > Bf-committers at blender.org
>> > http://lists.blender.org/mailman/listinfo/bf-committers
>>
>>
>>
>> --
>> - Campbell
>
>



-- 
- Campbell


More information about the Bf-committers mailing list