From 4fc369564a59aeb36ce7fcfd2c6ada43a2f80777 Mon Sep 17 00:00:00 2001 From: Nathan Letwory Date: Sat, 29 Nov 2008 13:57:19 +0000 Subject: [PATCH] * more work on screen --- source/blender/makesdna/DNA_scene_types.h | 1 - source/blender/makesdna/DNA_screen_types.h | 6 +- source/blender/makesrna/RNA_access.h | 5 + source/blender/makesrna/intern/rna_screen.c | 118 +++++++++++++++++++- 4 files changed, 125 insertions(+), 5 deletions(-) diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h index 6563f56ed4d..5397d890789 100644 --- a/source/blender/makesdna/DNA_scene_types.h +++ b/source/blender/makesdna/DNA_scene_types.h @@ -37,7 +37,6 @@ extern "C" { #include "DNA_listBase.h" #include "DNA_scriptlink_types.h" #include "DNA_ID.h" -#include "DNA_scriptlink_types.h" struct Radio; struct Object; diff --git a/source/blender/makesdna/DNA_screen_types.h b/source/blender/makesdna/DNA_screen_types.h index 39cf6454c2c..c49a70ee9cf 100644 --- a/source/blender/makesdna/DNA_screen_types.h +++ b/source/blender/makesdna/DNA_screen_types.h @@ -30,13 +30,13 @@ #include "DNA_listBase.h" #include "DNA_vec_types.h" -#include "DNA_ID.h" #include "DNA_scriptlink_types.h" +#include "DNA_ID.h" -struct Scene; struct SpaceType; struct SpaceLink; struct ARegionType; +struct Scene; typedef struct bScreen { ID id; @@ -81,7 +81,7 @@ typedef struct ScrEdge { * @deprecated compiling while delivering a proper dna.c. Do not use * @deprecated it in any case. */ -typedef unsigned short dna_ushort_fix; +/*typedef unsigned short dna_ushort_fix;*/ #endif diff --git a/source/blender/makesrna/RNA_access.h b/source/blender/makesrna/RNA_access.h index 76a3e58d453..8e01dc9d3c4 100644 --- a/source/blender/makesrna/RNA_access.h +++ b/source/blender/makesrna/RNA_access.h @@ -73,6 +73,11 @@ extern StructRNA RNA_Material; extern StructRNA RNA_NodeTree; extern StructRNA RNA_Node; extern StructRNA RNA_Screen; +extern StructRNA RNA_ScrVert; +extern StructRNA RNA_ScrEdge; +extern StructRNA RNA_ScrArea; +extern StructRNA RNA_Panel; +extern StructRNA RNA_Region; extern StructRNA RNA_Operator; extern StructRNA RNA_WindowManager; extern StructRNA RNA_Sensor; diff --git a/source/blender/makesrna/intern/rna_screen.c b/source/blender/makesrna/intern/rna_screen.c index 043c98d9166..b599a607670 100644 --- a/source/blender/makesrna/intern/rna_screen.c +++ b/source/blender/makesrna/intern/rna_screen.c @@ -34,15 +34,131 @@ #ifdef RNA_RUNTIME + +static void *rna_Screen_scene_get(PointerRNA *ptr) +{ + bScreen *sc= (bScreen*)ptr->data; + return sc->scene; +} + +static void rna_Screen_verts_begin(CollectionPropertyIterator *iter, PointerRNA *ptr) +{ + bScreen *scr= (bScreen*)ptr->data; + rna_iterator_listbase_begin(iter, &scr->vertbase, NULL); +} + +static void rna_Screen_edges_begin(CollectionPropertyIterator *iter, PointerRNA *ptr) +{ + bScreen *scr= (bScreen*)ptr->data; + rna_iterator_listbase_begin(iter, &scr->edgebase, NULL); +} + +static void rna_Screen_areas_begin(CollectionPropertyIterator *iter, PointerRNA *ptr) +{ + bScreen *scr= (bScreen*)ptr->data; + rna_iterator_listbase_begin(iter, &scr->areabase, NULL); +} + #else -void RNA_def_screen(BlenderRNA *brna) +static void RNA_def_vectypes(BlenderRNA *brna) +{ + StructRNA *srna; + + srna= RNA_def_struct(brna, "vec2s", NULL, "vec2s"); + RNA_def_struct_sdna(srna, "vec2s"); +} + +static void RNA_def_scrvert(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + + srna= RNA_def_struct(brna, "ScrVert", NULL, "Screen Vertex"); + RNA_def_struct_sdna(srna, "ScrVert"); + + prop= RNA_def_property(srna, "Location", PROP_INT, PROP_VECTOR); + RNA_def_property_int_sdna(prop, NULL, "vec.x"); + RNA_def_property_array(prop, 2); + RNA_def_property_ui_text(prop, "Location", "Screen Vert Location"); + /* + prop= RNA_def_property(srna, "y", PROP_INT, PROP_NONE); + RNA_def_property_int_sdna(prop, NULL, "vec.y"); + RNA_def_property_array(prop, 2); + RNA_def_property_ui_text(prop, "Y Location", "Screen Vert Y-Location");*/ +} + +static void RNA_def_scredge(BlenderRNA *brna) +{ + StructRNA *srna; + + srna= RNA_def_struct(brna, "ScrEdge", NULL, "Screen Edge"); + RNA_def_struct_sdna(srna, "ScrEdge"); +} + +static void RNA_def_scrarea(BlenderRNA *brna) +{ + StructRNA *srna; + + srna= RNA_def_struct(brna, "ScrArea", NULL, "Area"); + RNA_def_struct_sdna(srna, "ScrArea"); +} + +static void RNA_def_panel(BlenderRNA *brna) +{ + StructRNA *srna; + + srna= RNA_def_struct(brna, "Panel", NULL, "Panel"); + RNA_def_struct_sdna(srna, "Panel"); +} + +static void RNA_def_region(BlenderRNA *brna) +{ + StructRNA *srna; + + srna= RNA_def_struct(brna, "Region", NULL, "Area Region"); + RNA_def_struct_sdna(srna, "ARegion"); +} + +static void RNA_def_bscreen(BlenderRNA *brna) { StructRNA *srna; PropertyRNA *prop; srna= RNA_def_struct(brna, "Screen", "ID", "Screen"); RNA_def_struct_sdna(srna, "bScreen"); + + prop= RNA_def_property(srna, "scene", PROP_POINTER, PROP_NONE); + RNA_def_property_flag(prop, PROP_NOT_EDITABLE); + RNA_def_property_struct_type(prop, "Scene"); + RNA_def_property_pointer_funcs(prop, "rna_Screen_scene_get", NULL, NULL); + RNA_def_property_ui_text(prop, "Scene", "Active scene."); + + prop= RNA_def_property(srna, "vertbase", PROP_COLLECTION, PROP_NONE); + RNA_def_property_struct_type(prop, "ScrVert"); + RNA_def_property_collection_funcs(prop, "rna_Screen_verts_begin", "rna_iterator_listbase_next", "rna_iterator_listbase_end", "rna_iterator_listbase_get", 0, 0, 0, 0); + RNA_def_property_ui_text(prop, "Verts", "All Screen Verts"); + + prop= RNA_def_property(srna, "edgebase", PROP_COLLECTION, PROP_NONE); + RNA_def_property_struct_type(prop, "ScrEdge"); + RNA_def_property_collection_funcs(prop, "rna_Screen_edges_begin", "rna_iterator_listbase_next", "rna_iterator_listbase_end", "rna_iterator_listbase_get", 0, 0, 0, 0); + RNA_def_property_ui_text(prop, "Edges", "All Screen Edges"); + + prop= RNA_def_property(srna, "areabase", PROP_COLLECTION, PROP_NONE); + RNA_def_property_struct_type(prop, "ScrArea"); + RNA_def_property_collection_funcs(prop, "rna_Screen_areas_begin", "rna_iterator_listbase_next", "rna_iterator_listbase_end", "rna_iterator_listbase_get", 0, 0, 0, 0); + RNA_def_property_ui_text(prop, "Areas", "All Screen Areas"); +} + +void RNA_def_screen(BlenderRNA *brna) +{ + RNA_def_bscreen(brna); + RNA_def_vectypes(brna); + RNA_def_scrvert(brna); + RNA_def_scredge(brna); + RNA_def_scrarea(brna); + RNA_def_panel(brna); + RNA_def_region(brna); } #endif