Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2009-06-30 23:10:14 +0400
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2009-06-30 23:10:14 +0400
commit80ee09bb9a03a58019b2054d7e0d280658858656 (patch)
treed7b00ff876776a19163b73aa7fe0c534ec986b92
parent538da84de0b0944d646d9b589e5b29e93bbd20bb (diff)
RNA
* Add Image.dirty boolean. * Added Window struct, with editable Window.screen. * Make Screen.scene editable.
-rw-r--r--source/blender/makesdna/DNA_screen_types.h1
-rw-r--r--source/blender/makesdna/DNA_windowmanager_types.h3
-rw-r--r--source/blender/makesrna/intern/rna_access.c1
-rw-r--r--source/blender/makesrna/intern/rna_context.c8
-rw-r--r--source/blender/makesrna/intern/rna_image.c19
-rw-r--r--source/blender/makesrna/intern/rna_screen.c28
-rw-r--r--source/blender/makesrna/intern/rna_wm.c46
7 files changed, 101 insertions, 5 deletions
diff --git a/source/blender/makesdna/DNA_screen_types.h b/source/blender/makesdna/DNA_screen_types.h
index 4891f44e1cd..7bc94195204 100644
--- a/source/blender/makesdna/DNA_screen_types.h
+++ b/source/blender/makesdna/DNA_screen_types.h
@@ -53,6 +53,7 @@ typedef struct bScreen {
ListBase regionbase; /* screen level regions (menus), runtime only */
struct Scene *scene;
+ struct Scene *newscene; /* temporary when switching */
short full; /* fade out? */
short winid; /* winid from WM, starts with 1 */
diff --git a/source/blender/makesdna/DNA_windowmanager_types.h b/source/blender/makesdna/DNA_windowmanager_types.h
index e02d2984771..b63fb35c193 100644
--- a/source/blender/makesdna/DNA_windowmanager_types.h
+++ b/source/blender/makesdna/DNA_windowmanager_types.h
@@ -88,7 +88,8 @@ typedef struct wmWindow {
int winid, pad; /* winid also in screens, is for retrieving this window after read */
- struct bScreen *screen; /* active screen */
+ struct bScreen *screen; /* active screen */
+ struct bScreen *newscreen; /* temporary when switching */
char screenname[32]; /* MAX_ID_NAME for matching window with active screen after file read */
short posx, posy, sizex, sizey; /* window coords */
diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c
index 36adc9a7c10..9ebb778707c 100644
--- a/source/blender/makesrna/intern/rna_access.c
+++ b/source/blender/makesrna/intern/rna_access.c
@@ -1588,6 +1588,7 @@ int RNA_raw_type_sizeof(RawPropertyType type)
case PROP_RAW_INT: return sizeof(int);
case PROP_RAW_FLOAT: return sizeof(float);
case PROP_RAW_DOUBLE: return sizeof(double);
+ default: return 0;
}
}
diff --git a/source/blender/makesrna/intern/rna_context.c b/source/blender/makesrna/intern/rna_context.c
index 07a50235733..378498c8e0a 100644
--- a/source/blender/makesrna/intern/rna_context.c
+++ b/source/blender/makesrna/intern/rna_context.c
@@ -40,11 +40,11 @@ static PointerRNA rna_Context_manager_get(PointerRNA *ptr)
return rna_pointer_inherit_refine(ptr, &RNA_WindowManager, CTX_wm_manager(C));
}
-/*static PointerRNA rna_Context_window_get(PointerRNA *ptr)
+static PointerRNA rna_Context_window_get(PointerRNA *ptr)
{
bContext *C= (bContext*)ptr->data;
return rna_pointer_inherit_refine(ptr, &RNA_Window, CTX_wm_window(C));
-}*/
+}
static PointerRNA rna_Context_screen_get(PointerRNA *ptr)
{
@@ -113,10 +113,10 @@ void RNA_def_context(BlenderRNA *brna)
RNA_def_property_struct_type(prop, "WindowManager");
RNA_def_property_pointer_funcs(prop, "rna_Context_manager_get", NULL, NULL);
- /* prop= RNA_def_property(srna, "window", PROP_POINTER, PROP_NONE);
+ prop= RNA_def_property(srna, "window", PROP_POINTER, PROP_NONE);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_struct_type(prop, "Window");
- RNA_def_property_pointer_funcs(prop, "rna_Context_window_get", NULL, NULL); */
+ RNA_def_property_pointer_funcs(prop, "rna_Context_window_get", NULL, NULL);
prop= RNA_def_property(srna, "screen", PROP_POINTER, PROP_NONE);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
diff --git a/source/blender/makesrna/intern/rna_image.c b/source/blender/makesrna/intern/rna_image.c
index 4a6fdf5a734..c74e46c17da 100644
--- a/source/blender/makesrna/intern/rna_image.c
+++ b/source/blender/makesrna/intern/rna_image.c
@@ -39,6 +39,8 @@
#ifdef RNA_RUNTIME
+#include "IMB_imbuf_types.h"
+
static void rna_Image_animated_update(bContext *C, PointerRNA *ptr)
{
Image *ima= (Image*)ptr->data;
@@ -52,6 +54,18 @@ static void rna_Image_animated_update(bContext *C, PointerRNA *ptr)
}
}
+static int rna_Image_dirty_get(PointerRNA *ptr)
+{
+ Image *ima= (Image*)ptr->data;
+ ImBuf *ibuf;
+
+ for(ibuf=ima->ibufs.first; ibuf; ibuf=ibuf->next)
+ if(ibuf->userflags & IB_BITMAPDIRTY)
+ return 1;
+
+ return 0;
+}
+
#else
static void rna_def_imageuser(BlenderRNA *brna)
@@ -174,6 +188,11 @@ static void rna_def_image(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Premultiply", "Convert RGB from key alpha to premultiplied alpha.");
RNA_def_property_update(prop, NC_IMAGE|ND_DISPLAY, NULL);
+ prop= RNA_def_property(srna, "dirty", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_funcs(prop, "rna_Image_dirty_get", NULL);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Dirty", "Image has changed and is not saved.");
+
/* generated image (image_generated_change_cb) */
prop= RNA_def_property(srna, "generated_type", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "gen_type");
diff --git a/source/blender/makesrna/intern/rna_screen.c b/source/blender/makesrna/intern/rna_screen.c
index b7279757455..a4ba6ec172b 100644
--- a/source/blender/makesrna/intern/rna_screen.c
+++ b/source/blender/makesrna/intern/rna_screen.c
@@ -42,6 +42,31 @@ EnumPropertyItem region_type_items[] = {
#ifdef RNA_RUNTIME
+#include "WM_api.h"
+#include "WM_types.h"
+
+static void rna_Screen_scene_set(PointerRNA *ptr, PointerRNA value)
+{
+ bScreen *sc= (bScreen*)ptr->data;
+
+ if(value.data == NULL)
+ return;
+
+ /* exception: can't set screens inside of area/region handers */
+ sc->newscene= value.data;
+}
+
+static void rna_Screen_scene_update(bContext *C, PointerRNA *ptr)
+{
+ bScreen *sc= (bScreen*)ptr->data;
+
+ /* exception: can't set screens inside of area/region handers */
+ if(sc->newscene) {
+ WM_event_add_notifier(C, NC_SCENE|ND_SCENEBROWSE, sc->newscene);
+ sc->newscene= NULL;
+ }
+}
+
#else
static void rna_def_scrarea(BlenderRNA *brna)
@@ -94,6 +119,9 @@ static void rna_def_bscreen(BlenderRNA *brna)
prop= RNA_def_property(srna, "scene", PROP_POINTER, PROP_NEVER_NULL);
RNA_def_property_ui_text(prop, "Scene", "Active scene to be edited in the screen.");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_pointer_funcs(prop, NULL, "rna_Screen_scene_set", NULL);
+ RNA_def_property_update(prop, 0, "rna_Screen_scene_update");
prop= RNA_def_property(srna, "areas", PROP_COLLECTION, PROP_NONE);
RNA_def_property_collection_sdna(prop, NULL, "areabase", NULL);
diff --git a/source/blender/makesrna/intern/rna_wm.c b/source/blender/makesrna/intern/rna_wm.c
index 1bfc3b6f8f6..f8ab3a86744 100644
--- a/source/blender/makesrna/intern/rna_wm.c
+++ b/source/blender/makesrna/intern/rna_wm.c
@@ -147,6 +147,8 @@ EnumPropertyItem event_type_items[] = {
#ifdef RNA_RUNTIME
+#include "WM_api.h"
+
#include "BKE_idprop.h"
static wmOperator *rna_OperatorProperties_find_operator(PointerRNA *ptr)
@@ -215,6 +217,28 @@ static int rna_Event_ascii_length(PointerRNA *ptr)
return (event->ascii)? 1 : 0;
}
+static void rna_Window_screen_set(PointerRNA *ptr, PointerRNA value)
+{
+ wmWindow *win= (wmWindow*)ptr->data;
+
+ if(value.data == NULL)
+ return;
+
+ /* exception: can't set screens inside of area/region handers */
+ win->newscreen= value.data;
+}
+
+static void rna_Window_screen_update(bContext *C, PointerRNA *ptr)
+{
+ wmWindow *win= (wmWindow*)ptr->data;
+
+ /* exception: can't set screens inside of area/region handers */
+ if(win->newscreen) {
+ WM_event_add_notifier(C, NC_SCREEN|ND_SCREENBROWSE, win->newscreen);
+ win->newscreen= NULL;
+ }
+}
+
#else
static void rna_def_operator(BlenderRNA *brna)
@@ -349,6 +373,23 @@ static void rna_def_event(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "OS Key", "True when the shift key is held.");
}
+static void rna_def_window(BlenderRNA *brna)
+{
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna= RNA_def_struct(brna, "Window", NULL);
+ RNA_def_struct_ui_text(srna, "Window", "Open window.");
+ RNA_def_struct_sdna(srna, "wmWindow");
+
+ prop= RNA_def_property(srna, "screen", PROP_POINTER, PROP_NEVER_NULL);
+ RNA_def_property_struct_type(prop, "Screen");
+ RNA_def_property_ui_text(prop, "Screen", "Active screen showing in the window.");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_pointer_funcs(prop, NULL, "rna_Window_screen_set", NULL);
+ RNA_def_property_update(prop, 0, "rna_Window_screen_update");
+}
+
static void rna_def_windowmanager(BlenderRNA *brna)
{
StructRNA *srna;
@@ -362,6 +403,10 @@ static void rna_def_windowmanager(BlenderRNA *brna)
RNA_def_property_struct_type(prop, "Operator");
RNA_def_property_ui_text(prop, "Operators", "Operator registry.");
+ prop= RNA_def_property(srna, "windows", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_struct_type(prop, "Window");
+ RNA_def_property_ui_text(prop, "Windows", "Open windows.");
+
RNA_api_wm(srna);
}
@@ -371,6 +416,7 @@ void RNA_def_wm(BlenderRNA *brna)
rna_def_operator_utils(brna);
rna_def_operator_filelist_element(brna);
rna_def_event(brna);
+ rna_def_window(brna);
rna_def_windowmanager(brna);
}