diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2009-06-07 17:09:18 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2009-06-07 17:09:18 +0400 |
commit | 673a39dab1827def82c8b405df6d6704e140c6fe (patch) | |
tree | e9b386aa0dece4a442a825b0149aa2743ab64fcf /source/blender/makesrna/intern/rna_space.c | |
parent | 38e998e022411dd33a211a29650766bdca03bdc7 (diff) |
RNA:
* Accept None as NULL pointers through python function calls.
* Added type callback for pointers back, it's useful still in
some cases. Made Object.data editable using this, the pointer
type varying based on object type.
* Wrap pin ID pointer in buttons space.
* Added subclasses for text and surface curve ID blocks, to
organize data better and get proper icons.
* Added RNA_type_to_ID_code and ID_code_to_RNA_type functions.
* Update RNA_access.h with new RNA types.
Diffstat (limited to 'source/blender/makesrna/intern/rna_space.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_space.c | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index e9c6ce8156f..24091ac8b7d 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -24,6 +24,7 @@ #include <stdlib.h> +#include "RNA_access.h" #include "RNA_define.h" #include "RNA_types.h" @@ -134,6 +135,16 @@ void rna_SpaceTextEditor_text_set(PointerRNA *ptr, PointerRNA value) st->top= 0; } +StructRNA *rna_SpaceButtonsWindow_pin_id_typef(PointerRNA *ptr) +{ + SpaceButs *sbuts= (SpaceButs*)(ptr->data); + + if(sbuts->pinid) + return ID_code_to_RNA_type(GS(sbuts->pinid->name)); + + return &RNA_ID; +} + #else static void rna_def_space(BlenderRNA *brna) @@ -510,6 +521,13 @@ static void rna_def_space_buttons(BlenderRNA *brna) RNA_def_property_enum_sdna(prop, NULL, "align"); RNA_def_property_enum_items(prop, panel_alignment_items); RNA_def_property_ui_text(prop, "Panel Alignment", "Arrangement of the panels within the buttons window"); + + /* pinned data */ + prop= RNA_def_property(srna, "pin_id", PROP_POINTER, PROP_NONE); + RNA_def_property_pointer_sdna(prop, NULL, "pinid"); + RNA_def_property_struct_type(prop, "ID"); + RNA_def_property_pointer_funcs(prop, NULL, NULL, "rna_SpaceButtonsWindow_pin_id_typef"); + RNA_def_property_flag(prop, PROP_EDITABLE); } static void rna_def_space_image(BlenderRNA *brna) @@ -558,7 +576,7 @@ static void rna_def_space_image(BlenderRNA *brna) /* uv */ prop= RNA_def_property(srna, "uv_editor", PROP_POINTER, PROP_NEVER_NULL); RNA_def_property_struct_type(prop, "SpaceUVEditor"); - RNA_def_property_pointer_funcs(prop, "rna_SpaceImage_uvedit_get", NULL); + RNA_def_property_pointer_funcs(prop, "rna_SpaceImage_uvedit_get", NULL, NULL); RNA_def_property_ui_text(prop, "UV Editor", "UV editor settings."); /* paint */ @@ -603,7 +621,7 @@ static void rna_def_space_text(BlenderRNA *brna) prop= RNA_def_property(srna, "text", PROP_POINTER, PROP_NONE); RNA_def_property_flag(prop, PROP_EDITABLE); RNA_def_property_ui_text(prop, "Text", "Text displayed and edited in this space."); - RNA_def_property_pointer_funcs(prop, NULL, "rna_SpaceTextEditor_text_set"); + RNA_def_property_pointer_funcs(prop, NULL, "rna_SpaceTextEditor_text_set", NULL); RNA_def_property_update(prop, NC_TEXT|NA_EDITED, NULL); /* display */ |