RNA
authorBrecht Van Lommel <brechtvanlommel@pandora.be>
Fri, 14 Nov 2008 17:05:25 +0000 (17:05 +0000)
committerBrecht Van Lommel <brechtvanlommel@pandora.be>
Fri, 14 Nov 2008 17:05:25 +0000 (17:05 +0000)
* Added RNA list viewer. This is currently drawn in the outliner
  window, the UI is limited but it is just intended to test RNA
  at the moment.
* Added UI names for currently wrapped properties.
* Made iterating collections a bit more convenient.

20 files changed:
source/Makefile
source/blender/editors/Makefile
source/blender/editors/SConscript
source/blender/editors/include/ED_area.h
source/blender/editors/interface/interface.c
source/blender/editors/screen/spacetypes.c
source/blender/editors/space_outliner/Makefile [new file with mode: 0644]
source/blender/editors/space_outliner/SConscript [new file with mode: 0644]
source/blender/editors/space_outliner/outliner_intern.h [new file with mode: 0644]
source/blender/editors/space_outliner/outliner_ops.c [new file with mode: 0644]
source/blender/editors/space_outliner/space_outliner.c [new file with mode: 0644]
source/blender/makesdna/DNA_space_types.h
source/blender/makesrna/RNA_access.h
source/blender/makesrna/RNA_types.h
source/blender/makesrna/intern/rna_access.c
source/blender/makesrna/intern/rna_define.c
source/blender/makesrna/intern/rna_main.c
source/blender/makesrna/intern/rna_mesh.c
source/blender/makesrna/intern/rna_object.c
source/blender/makesrna/intern/rna_rna.c

index b0182ff131d352ed2cb5234ddfc85d6ecb7dc326..cb4694c8e905115f1e5d424e2246f92e47dde1ed 100644 (file)
@@ -234,6 +234,7 @@ PULIB = $(NAN_MOTO)/lib/libmoto.a
 PULIB += $(NAN_ELBEEM)/lib/$(DEBUG_DIR)libelbeem.a
 PULIB += $(OCGDIR)/blender/readblenfile/$(DEBUG_DIR)libreadblenfile.a
 PULIB += $(OCGDIR)/blender/ed_screen/libed_screen.a
+PULIB += $(OCGDIR)/blender/ed_outliner/libed_outliner.a
 PULIB += $(OCGDIR)/blender/ed_time/libed_time.a
 PULIB += $(OCGDIR)/blender/ed_view3d/libed_view3d.a
 PULIB += $(OCGDIR)/blender/ed_interface/libed_interface.a
index 3ea82ebe3b41b7365ee1444b4db46e66d5abf958..b051abb913474aa7c3063d6e764701aaa6e7c815 100644 (file)
@@ -29,6 +29,6 @@
 # Bounces make to subdirectories.
 
 SOURCEDIR = source/blender/editors
-DIRS = datafiles screen space_time space_view3d interface
+DIRS = datafiles screen space_outliner space_time space_view3d interface
 
 include nan_subdirs.mk
index 113cc7a2d7b9f25844e4343bace4e334ec128eac..eec294616630ac8c8e3a8a252fc146dfbd51794a 100644 (file)
@@ -6,6 +6,7 @@ SConscript(['datafiles/SConscript',
                        'interface/SConscript',
                        'mesh/SConscript',
                        'object/SConscript',
+                       'space_outliner/SConscript',
                        'space_time/SConscript',
                        'space_view3d/SConscript',
                        'transform/SConscript',
index 6666907c63da740350d37dfa810c02a2f59f9c29..63c6cd7e13f0d2f4bb5a8dab7389ef362f0a5bbe 100644 (file)
@@ -32,6 +32,7 @@
 /* the pluginnable API for export to editors */
 
 /* calls for registering default spaces */
+void ED_spacetype_outliner(void);
 void ED_spacetype_time(void);
 void ED_spacetype_view3d(void);
 
index 7fa9615f64cbaa0cf5de6a8b8dadc306bcd98d63..4fbc1147d1141cf36a3e82bf34bd3fa0ba088297 100644 (file)
@@ -2232,64 +2232,73 @@ uiBut *uiDefRNABut(uiBlock *block, int retval, PointerRNA *ptr, PropertyRNA *pro
 {
        uiBut *but;
 
-       switch(prop->type) {
+       switch(RNA_property_type(prop, ptr)) {
                case PROP_BOOLEAN: {
-                       int value;
+                       int value, length;
 
-                       if(prop->arraylength)
+                       length= RNA_property_array_length(prop, ptr);
+
+                       if(length)
                                value= RNA_property_boolean_get_array(prop, ptr, index);
                        else
                                value= RNA_property_boolean_get(prop, ptr);
 
-                       but= ui_def_but(block, TOG, 0, (value)? "True": "False", x1, y1, x2, y2, NULL, 0, 0, 0, 0, (char*)prop->description);
+                       but= ui_def_but(block, TOG, 0, (value)? "True": "False", x1, y1, x2, y2, NULL, 0, 0, 0, 0, (char*)RNA_property_ui_description(prop, ptr));
                        break;
                }
                case PROP_INT: {
-                       IntPropertyRNA *iprop= (IntPropertyRNA*)prop;
-                       but= ui_def_but(block, NUM, 0, "", x1, y1, x2, y2, NULL, iprop->softmin, iprop->softmax, iprop->step, 0, (char*)prop->description);
+                       int softmin, softmax, step;
+
+                       RNA_property_int_ui_range(prop, ptr, &softmin, &softmax, &step);
+                       but= ui_def_but(block, NUM, 0, "", x1, y1, x2, y2, NULL, softmin, softmax, step, 0, (char*)RNA_property_ui_description(prop, ptr));
                        break;
                }
                case PROP_FLOAT: {
-                       FloatPropertyRNA *fprop= (FloatPropertyRNA*)prop;
-                       but= ui_def_but(block, NUM, 0, "", x1, y1, x2, y2, NULL, fprop->softmin, fprop->softmax, fprop->step, fprop->precision, (char*)prop->description);
+                       float softmin, softmax, step, precision;
+
+                       RNA_property_float_ui_range(prop, ptr, &softmin, &softmax, &step, &precision);
+                       but= ui_def_but(block, NUM, 0, "", x1, y1, x2, y2, NULL, softmin, softmax, step, precision, (char*)RNA_property_ui_description(prop, ptr));
                        break;
                }
                case PROP_ENUM: {
-                       EnumPropertyRNA *eprop= (EnumPropertyRNA*)prop;
+                       const PropertyEnumItem *item;
                        DynStr *dynstr;
                        char *menu;
-                       int i;
+                       int i, totitem;
+
+                       RNA_property_enum_items(prop, ptr, &item, &totitem);
 
                        dynstr= BLI_dynstr_new();
-                       BLI_dynstr_appendf(dynstr, "%s%%t", prop->name);
-                       for(i=0; i<eprop->totitem; i++)
-                               BLI_dynstr_appendf(dynstr, "|%s %%x%d", eprop->item[i].name, eprop->item[i].value);
+                       BLI_dynstr_appendf(dynstr, "%s%%t", RNA_property_ui_name(prop, ptr));
+                       for(i=0; i<totitem; i++)
+                               BLI_dynstr_appendf(dynstr, "|%s %%x%d", item[i].name, item[i].value);
                        menu= BLI_dynstr_get_cstring(dynstr);
                        BLI_dynstr_free(dynstr);
 
-                       but= ui_def_but(block, MENU, 0, menu, x1, y1, x2, y2, NULL, 0, 0, 0, 0, (char*)prop->description);
+                       but= ui_def_but(block, MENU, 0, menu, x1, y1, x2, y2, NULL, 0, 0, 0, 0, (char*)RNA_property_ui_description(prop, ptr));
                        MEM_freeN(menu);
                        break;
                }
                case PROP_STRING: {
-                       StringPropertyRNA *sprop= (StringPropertyRNA*)prop;
-                       but= ui_def_but(block, TEX, 0, "", x1, y1, x2, y2, NULL, 0, sprop->maxlength, 0, 0, (char*)prop->description);
+                       but= ui_def_but(block, TEX, 0, "", x1, y1, x2, y2, NULL, 0, RNA_property_string_maxlength(prop, ptr), 0, 0, (char*)RNA_property_ui_description(prop, ptr));
                        break;
                }
                case PROP_POINTER: {
                        PointerRNA pptr;
+                       PropertyRNA *nameprop;
                        char name[256]= "", *nameptr= name;
 
                        RNA_property_pointer_get(prop, ptr, &pptr);
 
                        if(pptr.data) {
-                               if(pptr.type && pptr.type->nameproperty)
-                                       nameptr= RNA_property_string_get_alloc(pptr.type->nameproperty, &pptr, name, sizeof(name));
+                               nameprop= RNA_struct_name_property(&pptr);
+                               if(pptr.type && nameprop)
+                                       nameptr= RNA_property_string_get_alloc(nameprop, &pptr, name, sizeof(name));
                                else
-                                       strcpy(nameptr, "unknown");
+                                       strcpy(nameptr, "->");
                        }
 
-                       but= ui_def_but(block, BUT, 0, nameptr, x1, y1, x2, y2, NULL, 0, 0, 0, 0, (char*)prop->description);
+                       but= ui_def_but(block, BUT, 0, nameptr, x1, y1, x2, y2, NULL, 0, 0, 0, 0, (char*)RNA_property_ui_description(prop, ptr));
                        but->flag |= UI_TEXT_LEFT;
 
                        if(nameptr != name)
index 64c8c920c6439460ccc0653124d0fae3ab070be7..91e773b36e1274c122977e79b7810afa3ff0d5d5 100644 (file)
@@ -50,6 +50,7 @@ void ED_spacetypes_init(void)
        SpaceType *type;
 
        /* create space types */
+       ED_spacetype_outliner();
        ED_spacetype_time();
        ED_spacetype_view3d();
 //     ED_spacetype_ipo();
diff --git a/source/blender/editors/space_outliner/Makefile b/source/blender/editors/space_outliner/Makefile
new file mode 100644 (file)
index 0000000..19d40a4
--- /dev/null
@@ -0,0 +1,54 @@
+#
+# $Id: Makefile 14 2002-10-13 15:57:19Z hans $
+#
+# ***** BEGIN GPL LICENSE BLOCK *****
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version. 
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+#
+# The Original Code is Copyright (C) 2007 Blender Foundation
+# All rights reserved.
+#
+# The Original Code is: all of this file.
+#
+# Contributor(s): none yet.
+#
+# ***** END GPL LICENSE BLOCK *****
+#
+# Makes module object directory and bounces make to subdirectories.
+
+LIBNAME = ed_outliner
+DIR = $(OCGDIR)/blender/$(LIBNAME)
+
+include nan_compile.mk
+
+CFLAGS += $(LEVEL_1_C_WARNINGS)
+
+CPPFLAGS += -I$(NAN_GLEW)/include
+CPPFLAGS += -I$(OPENGL_HEADERS)
+
+# not very neat....
+CPPFLAGS += -I../../windowmanager
+CPPFLAGS += -I../../blenloader
+CPPFLAGS += -I../../blenkernel
+CPPFLAGS += -I../../blenlib
+CPPFLAGS += -I../../makesdna
+CPPFLAGS += -I../../makesrna
+CPPFLAGS += -I../../imbuf
+CPPFLAGS += -I../../python
+CPPFLAGS += -I$(NAN_GUARDEDALLOC)/include
+
+# own include 
+
+CPPFLAGS += -I../include 
diff --git a/source/blender/editors/space_outliner/SConscript b/source/blender/editors/space_outliner/SConscript
new file mode 100644 (file)
index 0000000..f5d6ddc
--- /dev/null
@@ -0,0 +1,10 @@
+#!/usr/bin/python
+Import ('env')
+
+sources = env.Glob('*.c')
+
+incs = '../include ../../blenlib ../../blenkernel ../../makesdna ../../imbuf'
+incs += ' ../../windowmanager #/intern/guardedalloc ../../makesrna'
+incs += ' #/extern/glew/include'
+
+env.BlenderLib ( 'bf_editors_space_outliner', sources, Split(incs), [], libtype=['core', 'intern'], priority=[35, 40] )
diff --git a/source/blender/editors/space_outliner/outliner_intern.h b/source/blender/editors/space_outliner/outliner_intern.h
new file mode 100644 (file)
index 0000000..70aec25
--- /dev/null
@@ -0,0 +1,41 @@
+/**
+ * $Id:
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version. 
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2008 Blender Foundation.
+ * All rights reserved.
+ *
+ * 
+ * Contributor(s): Blender Foundation
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#ifndef ED_OUTLINER_INTERN_H
+#define ED_OUTLINER_INTERN_H
+
+/* internal exports only */
+
+struct wmWindowManager;
+
+/* outliner_ops.c */
+void outliner_operatortypes(void);
+void outliner_keymap(struct wmWindowManager *wm);
+
+#endif /* ED_OUTLINER_INTERN_H */
+
diff --git a/source/blender/editors/space_outliner/outliner_ops.c b/source/blender/editors/space_outliner/outliner_ops.c
new file mode 100644 (file)
index 0000000..c512b49
--- /dev/null
@@ -0,0 +1,42 @@
+/**
+ * $Id:
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version. 
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2008 Blender Foundation.
+ * All rights reserved.
+ *
+ * 
+ * Contributor(s): Blender Foundation
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#include <stdlib.h>
+
+#include "DNA_windowmanager_types.h"
+
+/* ************************** registration **********************************/
+
+void outliner_operatortypes(void)
+{
+}
+
+void outliner_keymap(wmWindowManager *wm)
+{
+}
+
diff --git a/source/blender/editors/space_outliner/space_outliner.c b/source/blender/editors/space_outliner/space_outliner.c
new file mode 100644 (file)
index 0000000..4ab7ae4
--- /dev/null
@@ -0,0 +1,535 @@
+/**
+ * $Id$
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version. 
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2008 Blender Foundation.
+ * All rights reserved.
+ *
+ * 
+ * Contributor(s): Blender Foundation
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#include <string.h>
+#include <stdio.h>
+
+#include "DNA_color_types.h"
+#include "DNA_object_types.h"
+#include "DNA_space_types.h"
+#include "DNA_scene_types.h"
+#include "DNA_screen_types.h"
+#include "DNA_space_types.h"
+#include "DNA_texture_types.h"
+#include "DNA_vec_types.h"
+#include "DNA_windowmanager_types.h"
+
+#include "MEM_guardedalloc.h"
+
+#include "BLI_blenlib.h"
+#include "BLI_arithb.h"
+#include "BLI_rand.h"
+
+#include "BKE_colortools.h"
+#include "BKE_global.h"
+#include "BKE_screen.h"
+#include "BKE_texture.h"
+#include "BKE_utildefines.h"
+
+#include "ED_area.h"
+
+#include "WM_api.h"
+#include "WM_types.h"
+
+#include "BIF_gl.h"
+#include "BIF_glutil.h"
+
+#include "UI_interface.h"
+#include "UI_text.h"
+#include "UI_resources.h"
+#include "UI_view2d.h"
+
+#include "RNA_access.h"
+#include "RNA_types.h"
+
+#include "outliner_intern.h"
+
+#define SET_INT_IN_POINTER(i) ((void*)(intptr_t)(i))
+#define GET_INT_FROM_POINTER(i) ((int)(intptr_t)(i))
+
+#define ROW_HEIGHT             19
+#define COLUMN_WIDTH   150
+
+typedef void (*uiTableCellFunc)(void *userdata, int row, int col, struct rcti *rct, struct uiBlock *block);
+
+typedef struct uiTable {
+       rcti rct;
+       int rows, cols;
+
+       uiTableCellFunc cellfunc;
+       void *userdata;
+} uiTable;
+
+uiTable *UI_table_create(int rows, int cols, rcti *rct, uiTableCellFunc cellfunc, void *userdata)
+{
+       uiTable *table;
+
+       table= MEM_callocN(sizeof(uiTable), "uiTable");
+       table->rct= *rct;
+       table->cellfunc= cellfunc;
+       table->rows= rows;
+       table->cols= cols;
+       table->userdata= userdata;
+
+       return table;
+}
+
+void UI_table_free(uiTable *table)
+{
+       MEM_freeN(table);
+}
+
+void UI_table_draw(wmWindow *window, ARegion *region, uiTable *table)
+{
+       uiBlock *block;
+       rcti *rct, cellrct;
+       int y, row, col;
+
+       rct= &table->rct;
+
+       block= uiBeginBlock(window, region, "table outliner", UI_EMBOSST, UI_HELV);
+
+       for(y=rct->ymax, row=0; y>rct->ymin; y-=ROW_HEIGHT, row++) {
+               if(row%2 == 0) {
+                       UI_ThemeColorShade(TH_BACK, 6);
+                       glRecti(rct->xmin, y-ROW_HEIGHT, rct->xmax, y);
+               }
+
+               if(row >= table->rows)
+                       continue;
+
+               for(col=0; col<table->cols; col++) {
+                       cellrct.xmin= rct->xmin+COLUMN_WIDTH*col + 1;
+                       cellrct.xmax= rct->xmin+COLUMN_WIDTH*(col+1);
+                       cellrct.ymin= y-ROW_HEIGHT;
+                       cellrct.ymax= y;
+
+                       table->cellfunc(table->userdata, row, col, &cellrct, block);
+               }
+       }
+
+       UI_ThemeColorShadeAlpha(TH_BACK, -15, -200);
+
+       for(col=0; col<table->cols; col++)
+               fdrawline(rct->xmin+COLUMN_WIDTH*(col+1), rct->ymin, rct->xmin+COLUMN_WIDTH*(col+1), rct->ymax);
+
+       uiEndBlock(block);
+       uiDrawBlock(block);
+}
+
+
+/* ************************ main outliner area region *********************** */
+
+typedef struct CellRNA {
+       SpaceOops *space;
+       StructRNA *srna;
+       PropertyRNA *prop;
+       PointerRNA ptr;
+       int lastrow, index;
+
+       CollectionPropertyIterator iter;
+       PropertyRNA *iterprop;
+} CellRNA;
+
+static void rna_back_cb(void *arg_buts, void *arg_unused)
+{
+       SpaceOops *soutliner= arg_buts;
+       char *newpath;
+
+       newpath= RNA_path_back(soutliner->rnapath);
+       if(soutliner->rnapath)
+               MEM_freeN(soutliner->rnapath);
+       soutliner->rnapath= newpath;
+}
+
+static void rna_pointer_cb(void *arg_buts, void *arg_prop, void *arg_index)
+{
+       SpaceOops *soutliner= arg_buts;
+       PropertyRNA *prop= arg_prop;
+       char *newpath;
+       int index= GET_INT_FROM_POINTER(arg_index);;
+
+       newpath= RNA_path_append(soutliner->rnapath, prop, index, NULL);
+       if(soutliner->rnapath)
+               MEM_freeN(soutliner->rnapath);
+       soutliner->rnapath= newpath;
+}
+
+static void rna_label(CellRNA *cell, rcti *rct, uiBlock *block)
+{
+       PropertySubType subtype;
+       PropertyType type;
+       PropertyRNA *prop;
+       char *vectoritem[4]= {"x", "y", "z", "w"};
+       char *coloritem[4]= {"r", "g", "b", "a"};
+       char item[32];
+       int arraylength;
+
+       prop= cell->prop;
+       type= RNA_property_type(prop, &cell->ptr);
+       subtype= RNA_property_subtype(prop, &cell->ptr);
+       arraylength= RNA_property_array_length(prop, &cell->ptr);
+
+       if(cell->index == -1) {
+               uiDefBut(block, LABEL, 0, (char*)RNA_property_ui_name(prop, &cell->ptr), rct->xmin, rct->ymin, rct->xmax-rct->xmin, rct->ymax-rct->ymin, 0, 0, 0, 0, 0, (char*)RNA_property_ui_description(prop, &cell->ptr));
+       }
+       else if (type != PROP_COLLECTION) {
+               if(arraylength <= 4 && (subtype == PROP_VECTOR || subtype == PROP_ROTATION))
+                       sprintf(item, "    %s", vectoritem[cell->index]);
+               else if(arraylength <= 4 && subtype == PROP_COLOR)
+                       sprintf(item, "    %s", coloritem[cell->index]);
+               else
+                       sprintf(item, "    %d", cell->index+1);
+
+               uiDefBut(block, LABEL, 0, item, rct->xmin, rct->ymin, rct->xmax-rct->xmin, rct->ymax-rct->ymin, 0, 0, 0, 0, 0, "");
+       }
+}
+
+static void rna_collection_but(CellRNA *cell, rcti *rct, uiBlock *block)
+{
+       uiBut *but;
+       PointerRNA lookup;
+       PropertyRNA *nameprop;
+       char name[256]= "", *nameptr= name;
+
+       RNA_property_collection_lookup_int(cell->prop, &cell->ptr, cell->index, &lookup);
+
+       if(lookup.data) {
+               nameprop= RNA_struct_name_property(&lookup);
+
+               if(nameprop)
+                       nameptr= RNA_property_string_get_alloc(nameprop, &lookup, name, sizeof(name));
+               else
+                       sprintf(nameptr, "%d", cell->index+1);
+       }
+
+       but= uiDefBut(block, BUT, 0, nameptr, rct->xmin, rct->ymin, rct->xmax-rct->xmin, rct->ymax-rct->ymin, 0, 0, 0, 0, 0, "");
+       uiButSetFlag(but, UI_TEXT_LEFT);
+
+       if(nameptr != name)
+               MEM_freeN(nameptr);
+
+       uiButSetFunc3(but, rna_pointer_cb, cell->space, cell->prop, SET_INT_IN_POINTER(cell->index));
+}
+
+static void rna_but(CellRNA *cell, rcti *rct, uiBlock *block)
+{
+       uiBut *but;
+       PropertyRNA *prop;
+       PropertyType type;
+       int arraylength, index;
+
+       prop= cell->prop;
+       type= RNA_property_type(prop, &cell->ptr);
+       arraylength= RNA_property_array_length(prop, &cell->ptr);
+
+       if(type == PROP_COLLECTION) {
+               /* item in a collection */
+               if(cell->index >= 0)
+                       rna_collection_but(cell, rct, block);
+       }
+       else {
+               /* other cases */
+               index= (arraylength)? cell->index: 0;
+
+               if(index >= 0) {
+                       but= uiDefRNABut(block, 0, &cell->ptr, prop, index, rct->xmin, rct->ymin, rct->xmax-rct->xmin, rct->ymax-rct->ymin);
+
+                       if(type == PROP_POINTER)
+                               uiButSetFunc3(but, rna_pointer_cb, cell->space, prop, SET_INT_IN_POINTER(0));
+               }
+       }
+}
+
+static void rna_path_but(CellRNA *cell, rcti *rct, uiBlock *block)
+{
+       uiBut *but;
+
+       but= uiDefBut(block, BUT, 0, (cell->space->rnapath)? "..": ".", rct->xmin, rct->ymin, rct->xmax-rct->xmin, rct->ymax-rct->ymin, 0, 0, 0, 0, 0, "");
+       uiButSetFlag(but, UI_TEXT_LEFT);
+       uiButSetFunc(but, rna_back_cb, cell->space, NULL);
+}
+
+static void rna_table_cell_func(void *userdata, int row, int col, rcti *rct, uiBlock *block)
+{
+       CellRNA *cell= userdata;
+       PropertyRNA *prop;
+       PropertyType type;
+       int length;
+
+       /* path button */
+       if(row == 0) {
+               if(col == 0)
+                       rna_path_but(cell, rct, block);
+
+               return;
+       }
+
+       /* set next property for new row */
+       if(row != cell->lastrow) {
+               if(cell->prop) {
+                       cell->index++;
+
+                       type= RNA_property_type(cell->prop, &cell->ptr);
+                       if(type == PROP_COLLECTION)
+                               length= RNA_property_collection_length(cell->prop, &cell->ptr);
+                       else
+                               length= RNA_property_array_length(cell->prop, &cell->ptr);
+
+                       /* verify if we need to go to the next property */
+                       if(type == PROP_COLLECTION && cell->index < length);
+                       else if(length && cell->index < length);
+                       else {
+                               RNA_property_collection_next(cell->iterprop, &cell->iter);
+                               cell->prop= cell->iter.ptr.data;
+                               cell->index= -1;
+                       }
+               }
+               else {
+                       /* initialize */
+                       cell->prop= cell->iter.ptr.data;
+                       cell->index= -1;
+               }
+
+               cell->lastrow= row;
+       }
+
+       prop= cell->prop;
+
+       /* make button */
+       if(col == 0)
+               rna_label(cell, rct, block);
+       else if(col == 1)
+               rna_but(cell, rct, block);
+}
+
+static void outliner_main_area_draw(const bContext *C, ARegion *ar)
+{
+       uiTable *table;
+       rcti rct;
+       CellRNA cell;
+       PropertyRNA *prop;
+       PointerRNA newptr;
+       float col[3];
+       int rows, cols, width, height;
+       SpaceOops *soutliner= C->area->spacedata.first;
+
+       /* clear */
+       UI_GetThemeColor3fv(TH_BACK, col);
+       glClearColor(col[0], col[1], col[2], 0.0);
+       glClear(GL_COLOR_BUFFER_BIT);
+
+       width= ar->winrct.xmax - ar->winrct.xmin;
+       height= ar->winrct.ymax - ar->winrct.ymin;
+       
+       /* create table */
+       rct.xmin= 0;
+       rct.ymin= 0;
+       rct.xmax= width;
+       rct.ymax= height;
+
+       cell.space= soutliner;
+       cell.lastrow= -1;
+       RNA_pointer_main_get(G.main, &cell.ptr);
+       cell.prop= NULL;
+
+       /* solve RNA path or reset if fails */
+       if(soutliner->rnapath) {
+               if(!RNA_path_resolve(&cell.ptr, soutliner->rnapath, &newptr, &prop)) {
+                       newptr.data= NULL;
+                       printf("RNA outliner: failed resolving path. (%s)\n", soutliner->rnapath);
+               }
+
+               if(newptr.data && newptr.type) {
+                       cell.ptr= newptr;
+               }
+               else {
+                       MEM_freeN(soutliner->rnapath);
+                       soutliner->rnapath= NULL;
+               }
+       }
+
+       /* compute number of rows and columns */
+       rows= 1;
+       cols= 2;
+
+       cell.iterprop= RNA_struct_iterator_property(&cell.ptr);
+       RNA_property_collection_begin(cell.iterprop, &cell.iter, &cell.ptr);
+
+       for(; cell.iter.valid; RNA_property_collection_next(cell.iterprop, &cell.iter)) {
+               prop= cell.iter.ptr.data;
+
+               rows += 1 + RNA_property_array_length(prop, &cell.ptr);
+               if(RNA_property_type(prop, &cell.ptr) == PROP_COLLECTION)
+                       rows += RNA_property_collection_length(prop, &cell.ptr);
+       }
+
+       RNA_property_collection_end(cell.iterprop, &cell.iter);
+
+       /* create and draw table */
+       table= UI_table_create(rows, 2, &rct, rna_table_cell_func, &cell);
+
+       RNA_property_collection_begin(cell.iterprop, &cell.iter, &cell.ptr);
+       UI_table_draw(C->window, ar, table);
+       RNA_property_collection_end(cell.iterprop, &cell.iter);
+
+       UI_table_free(table);
+}
+
+static void outliner_main_area_free(ARegion *ar)
+{
+       uiFreeBlocks(&ar->uiblocks);
+}
+
+/* ************************ header outliner area region *********************** */
+
+static void outliner_header_area_draw(const bContext *C, ARegion *ar)
+{
+       SpaceOops *soutliner= C->area->spacedata.first;
+       float col[3];
+       int width, height;
+       rctf bbox;
+       char *path;
+
+       path= (soutliner->rnapath)? soutliner->rnapath: "Main";
+
+       /* clear */
+       UI_GetThemeColor3fv(TH_BACK, col);
+       glClearColor(MAX2(col[0]-0.3f, 0.0f), MAX2(col[1]-0.3f, 0.0f), MAX2(col[2]-0.3f, 0.0f), 0.0);
+       glClear(GL_COLOR_BUFFER_BIT);
+
+       width= ar->winrct.xmax - ar->winrct.xmin;
+       height= ar->winrct.ymax - ar->winrct.ymin;
+
+       /* header text */
+       UI_GetBoundingBox(UI_HELV, path, 0, &bbox);
+
+       glColor3f(1.0f, 1.0f, 1.0f);
+       UI_SetScale(1.0);
+       UI_RasterPos(0.5f*(width - (bbox.xmax - bbox.xmin)), 0.5f*(height - (bbox.ymax - bbox.ymin)));
+       UI_DrawString(UI_HELV, path, 0);
+}
+
+static void outliner_header_area_free(ARegion *ar)
+{
+       uiFreeBlocks(&ar->uiblocks);
+}
+
+/* ******************** default callbacks for outliner space ***************** */
+
+static SpaceLink *outliner_new(void)
+{
+       SpaceOops *soutliner;
+
+       soutliner= MEM_callocN(sizeof(SpaceOops), "initoutliner");
+
+       return (SpaceLink*)soutliner;
+}
+
+/* not spacelink itself */
+static void outliner_free(SpaceLink *sl)
+{
+       SpaceOops *soutliner= (SpaceOops*)sl;
+
+       if(soutliner->rnapath) {
+               MEM_freeN(soutliner->rnapath);
+               soutliner->rnapath= NULL;
+       }
+}
+
+/* spacetype; init callback */
+static void outliner_init(wmWindowManager *wm, ScrArea *sa)
+{
+       ARegion *ar;
+       
+       /* link area to SpaceXXX struct */
+
+       /* add handlers to area */
+       /* define how many regions, the order and types */
+       
+       /* add types to regions */
+       for(ar= sa->regionbase.first; ar; ar= ar->next) {
+               if(ar->regiontype == RGN_TYPE_WINDOW) {
+                       static ARegionType mainart={NULL, NULL, NULL, NULL, NULL};
+
+                       mainart.draw= outliner_main_area_draw;
+                       mainart.free= outliner_main_area_free;
+
+                       ar->type= &mainart;
+
+                       WM_event_add_keymap_handler(&ar->handlers, &wm->uikeymap);
+               }
+               else if(ar->regiontype == RGN_TYPE_HEADER) {
+                       static ARegionType headerart={NULL, NULL, NULL, NULL, NULL};
+
+                       headerart.draw= outliner_header_area_draw;
+                       headerart.free= outliner_header_area_free;
+
+                       ar->type= &headerart;
+
+                       WM_event_add_keymap_handler(&ar->handlers, &wm->uikeymap);
+               }
+               else {
+                       static ARegionType headerart={NULL, NULL, NULL, NULL, NULL};
+                       ar->type= &headerart;
+               }
+       }
+}
+
+/* spacetype; context changed */
+static void outliner_refresh(bContext *C, ScrArea *sa)
+{
+       
+}
+
+static SpaceLink *outliner_duplicate(SpaceLink *sl)
+{
+       SpaceOops *soutliner= (SpaceOops *)sl;
+       SpaceOops *soutlinern= MEM_dupallocN(soutliner);
+       
+       return (SpaceLink *)soutlinern;
+}
+
+/* only called once, from screen/spacetypes.c */
+void ED_spacetype_outliner(void)
+{
+       static SpaceType st;
+       
+       st.spaceid= SPACE_OOPS;
+       
+       st.new= outliner_new;
+       st.free= outliner_free;
+       st.init= outliner_init;
+       st.refresh= outliner_refresh;
+       st.duplicate= outliner_duplicate;
+       st.operatortypes= outliner_operatortypes;
+       st.keymap= outliner_keymap;
+       
+       BKE_spacetype_register(&st);
+}
+
index dc713362d83a759662c15f33987ed7d1827672f9..d1eff908c865732022c235368d16344c8785425a 100644 (file)
@@ -207,6 +207,9 @@ typedef struct SpaceOops {
        
        short type, outlinevis, storeflag;
        short deps_flags;
+
+       /* RNA */
+       char *rnapath;
        
 } SpaceOops;
 
index cee371b91ab9ff7cfe36e06bd0cde5a1a79c032a..4e21e93d47359e1f1b6cb6bb6fb514be7b1f4681 100644 (file)
@@ -108,8 +108,6 @@ StructRNA *RNA_property_pointer_type(PropertyRNA *prop, PointerRNA *ptr);
 void RNA_property_collection_begin(PropertyRNA *prop, CollectionPropertyIterator *iter, PointerRNA *ptr);
 void RNA_property_collection_next(PropertyRNA *prop, CollectionPropertyIterator *iter);
 void RNA_property_collection_end(PropertyRNA *prop, CollectionPropertyIterator *iter);
-void RNA_property_collection_get(PropertyRNA *prop, CollectionPropertyIterator *iter, PointerRNA *r_ptr);
-StructRNA *RNA_property_collection_type(PropertyRNA *prop, CollectionPropertyIterator *iter);
 int RNA_property_collection_length(PropertyRNA *prop, PointerRNA *ptr);
 int RNA_property_collection_lookup_int(PropertyRNA *prop, PointerRNA *ptr, int key, PointerRNA *r_ptr);
 int RNA_property_collection_lookup_string(PropertyRNA *prop, PointerRNA *ptr, const char *key, PointerRNA *r_ptr);
index 846e516a41f2622b38044bedb3f190518241f551..41151e58fec2e91a63c49cb51de86237a934dd5e 100644 (file)
@@ -140,9 +140,11 @@ typedef enum PropertyFlag {
 } PropertyFlag;
 
 typedef struct CollectionPropertyIterator {
-       PointerRNA pointer;
+       PointerRNA parent;
        void *internal;
+
        int valid;
+       PointerRNA ptr;
 } CollectionPropertyIterator;
 
 typedef struct PropertyEnumItem {
index 9304618f596586e8a1f81d40b70a65358b3a418c..afb83e97d33939a236633f970ff8564010250713 100644 (file)
@@ -355,51 +355,61 @@ StructRNA *RNA_property_pointer_type(PropertyRNA *prop, PointerRNA *ptr)
        return pprop->structtype;
 }
 
-void RNA_property_collection_begin(PropertyRNA *prop, CollectionPropertyIterator *iter, PointerRNA *ptr)
+static StructRNA *rna_property_collection_type(PropertyRNA *prop, CollectionPropertyIterator *iter)
 {
        CollectionPropertyRNA *cprop= (CollectionPropertyRNA*)prop;
 
-       iter->pointer= *ptr;
-       cprop->begin(iter, ptr);
+       if(cprop->type)
+               return cprop->type(iter);
+       
+       return cprop->structtype;
 }
 
-void RNA_property_collection_next(PropertyRNA *prop, CollectionPropertyIterator *iter)
+static void rna_property_collection_get(PropertyRNA *prop, CollectionPropertyIterator *iter, PointerRNA *r_ptr)
 {
        CollectionPropertyRNA *cprop= (CollectionPropertyRNA*)prop;
 
-       cprop->next(iter);
+       r_ptr->data= cprop->get(iter);
+
+       if(r_ptr->data) {
+               r_ptr->type= rna_property_collection_type(prop, iter);
+               rna_pointer_inherit_id(&iter->parent, r_ptr);
+       }
+       else
+               memset(r_ptr, 0, sizeof(*r_ptr));
 }
 
-void RNA_property_collection_end(PropertyRNA *prop, CollectionPropertyIterator *iter)
+void RNA_property_collection_begin(PropertyRNA *prop, CollectionPropertyIterator *iter, PointerRNA *ptr)
 {
        CollectionPropertyRNA *cprop= (CollectionPropertyRNA*)prop;
 
-       if(cprop->end)
-               cprop->end(iter);
+       iter->parent= *ptr;
+       cprop->begin(iter, ptr);
+
+       if(iter->valid)
+               rna_property_collection_get(prop, iter, &iter->ptr);
+       else
+               memset(&iter->ptr, 0, sizeof(iter->ptr));
 }
 
-void RNA_property_collection_get(PropertyRNA *prop, CollectionPropertyIterator *iter, PointerRNA *r_ptr)
+void RNA_property_collection_next(PropertyRNA *prop, CollectionPropertyIterator *iter)
 {
        CollectionPropertyRNA *cprop= (CollectionPropertyRNA*)prop;
 
-       r_ptr->data= cprop->get(iter);
+       cprop->next(iter);
 
-       if(r_ptr->data) {
-               r_ptr->type= RNA_property_collection_type(prop, iter);
-               rna_pointer_inherit_id(&iter->pointer, r_ptr);
-       }
+       if(iter->valid)
+               rna_property_collection_get(prop, iter, &iter->ptr);
        else
-               memset(r_ptr, 0, sizeof(*r_ptr));
+               memset(&iter->ptr, 0, sizeof(iter->ptr));
 }
 
-StructRNA *RNA_property_collection_type(PropertyRNA *prop, CollectionPropertyIterator *iter)
+void RNA_property_collection_end(PropertyRNA *prop, CollectionPropertyIterator *iter)
 {
        CollectionPropertyRNA *cprop= (CollectionPropertyRNA*)prop;
 
-       if(cprop->type)
-               return cprop->type(iter);
-       
-       return cprop->structtype;
+       if(cprop->end)
+               cprop->end(iter);
 }
 
 int RNA_property_collection_length(PropertyRNA *prop, PointerRNA *ptr)
@@ -451,7 +461,7 @@ int RNA_property_collection_lookup_int(PropertyRNA *prop, PointerRNA *ptr, int k
                RNA_property_collection_begin(prop, &iter, ptr);
                for(i=0; iter.valid; RNA_property_collection_next(prop, &iter), i++) {
                        if(i == key) {
-                               RNA_property_collection_get(prop, &iter, r_ptr);
+                               *r_ptr= iter.ptr;
                                break;
                        }
                }
@@ -488,18 +498,15 @@ int RNA_property_collection_lookup_string(PropertyRNA *prop, PointerRNA *ptr, co
                /* no callback defined, compare with name properties if they exist */
                CollectionPropertyIterator iter;
                PropertyRNA *nameprop;
-               PointerRNA iterptr;
                char name[256], *nameptr;
                int length, alloc, found= 0;
 
                RNA_property_collection_begin(prop, &iter, ptr);
                for(; iter.valid; RNA_property_collection_next(prop, &iter)) {
-                       RNA_property_collection_get(prop, &iter, &iterptr);
-
-                       if(iterptr.data && iterptr.type->nameproperty) {
-                               nameprop= iterptr.type->nameproperty;
+                       if(iter.ptr.data && iter.ptr.type->nameproperty) {
+                               nameprop= iter.ptr.type->nameproperty;
 
-                               length= RNA_property_string_length(nameprop, &iterptr);
+                               length= RNA_property_string_length(nameprop, &iter.ptr);
 
                                if(sizeof(name)-1 < length) {
                                        nameptr= name;
@@ -510,10 +517,10 @@ int RNA_property_collection_lookup_string(PropertyRNA *prop, PointerRNA *ptr, co
                                        alloc= 1;
                                }
 
-                               RNA_property_string_get(nameprop, &iterptr, nameptr);
+                               RNA_property_string_get(nameprop, &iter.ptr, nameptr);
 
                                if(strcmp(nameptr, key) == 0) {
-                                       *r_ptr= iterptr;
+                                       *r_ptr= iter.ptr;
                                        found= 1;
                                }
 
@@ -670,14 +677,8 @@ int RNA_path_resolve(PointerRNA *ptr, const char *path, PointerRNA *r_ptr, Prope
                prop= NULL;
 
                for(; iter.valid; RNA_property_collection_next(iterprop, &iter)) {
-                       PointerRNA cptr;
-                       PropertyRNA *cprop;
-
-                       RNA_property_collection_get(iterprop, &iter, &cptr);
-                       cprop= cptr.data;
-
-                       if(strcmp(token, cprop->cname) == 0) {
-                               prop= cprop;
+                       if(strcmp(token, RNA_property_cname(iter.ptr.data, &iter.ptr)) == 0) {
+                               prop= iter.ptr.data;
                                break;
                        }
                }
index 003773381c9cdee89329345047e3756fe287f945..8e16c422409225489ba5a187b786c8ed2caacaff 100644 (file)
@@ -272,6 +272,7 @@ PropertyRNA *RNA_def_property(StructRNA *srna, const char *cname, int type, int
 
                        iprop->softmin= (subtype == PROP_UNSIGNED)? 0: -10000; /* rather arbitrary .. */
                        iprop->softmax= 10000;
+                       iprop->step= 1;
                        break;
                }
                case PROP_FLOAT: {
@@ -284,6 +285,8 @@ PropertyRNA *RNA_def_property(StructRNA *srna, const char *cname, int type, int
 
                        fprop->softmin= (subtype == PROP_UNSIGNED)? 0.0f: -10000.0f; /* rather arbitrary .. */
                        fprop->softmax= 10000.0f;
+                       fprop->step= 10;
+                       fprop->precision= 3;
                        break;
                }
                case PROP_STRING: {
@@ -372,7 +375,9 @@ PropertyRNA *RNA_def_property(StructRNA *srna, const char *cname, int type, int
 
 void RNA_def_property_flag(PropertyRNA *prop, int flag)
 {
+#if 0
        StructDefRNA *ds= DefRNA.structs.last;
+#endif
 
        prop->flag |= flag;
 
index 2e95d8af74bc60b92a04167359c732a8a613a8e6..8f771eb4ea4918542bb6d9fbf530b1bedece4e5b 100644 (file)
@@ -206,36 +206,36 @@ void RNA_def_main(BlenderRNA *brna)
 {
        StructRNA *srna;
        PropertyRNA *prop;
-       const char *lists[][4]= {
-               {"scenes", "Scene", "rna_Main_scene_begin"},
-               {"objects", "Object", "rna_Main_object_begin"},
-               {"meshes", "Mesh", "rna_Main_mesh_begin"}, 
-               {NULL, NULL, NULL},
-               {"libraries", "Library", "rna_Main_library_begin"},
-               {"curves", "Curve", "rna_Main_curve_begin"}, 
-               {"metaballs", "MBall", "rna_Main_mball_begin"}, 
-               {"materials", "Material", "rna_Main_mat_begin"},
-               {"textures", "Texture", "rna_Main_tex_begin"},
-               {"images", "Image", "rna_Main_image_begin"},
-               {"lattices", "Lattice", "rna_Main_latt_begin"},
-               {"lamps", "Lamp", "rna_Main_lamp_begin"},
-               {"cameras", "Camera", "rna_Main_camera_begin"},
-               {"ipos", "Ipo", "rna_Main_ipo_begin"},
-               {"keys", "Key", "rna_Main_key_begin"},
-               {"worlds", "World", "rna_Main_world_begin"},
-               {"screens", "Screen", "rna_Main_screen_begin"},
-               {"scripts", "Script", "rna_Main_script_begin"},
-               {"vfonts", "VFont", "rna_Main_vfont_begin"},
-               {"texts", "Text", "rna_Main_text_begin"},
-               {"sounds", "Sound", "rna_Main_sound_begin"},
-               {"groups", "Group", "rna_Main_group_begin"},
-               {"armatures", "Armature", "rna_Main_armature_begin"},
-               {"actions", "Action", "rna_Main_action_begin"},
-               {"nodegroups", "NodeGroup", "rna_Main_nodetree_begin"},
-               {"brushes", "Brush", "rna_Main_brush_begin"},
-               {"particles", "Particle", "rna_Main_particle_begin"},
-               {"windowmanagers", "wmWindowManager", "rna_Main_wm_begin"},
-               {NULL, NULL, NULL}};
+       const char *lists[][5]= {
+               {"scenes", "Scene", "rna_Main_scene_begin", "Scenes", "Scene datablocks."},
+               {"objects", "Object", "rna_Main_object_begin", "Objects", "Object datablocks."},
+               {"meshes", "Mesh", "rna_Main_mesh_begin", "Meshes", "Mesh datablocks."}, 
+               {NULL, NULL, NULL, NULL, NULL},
+               {"libraries", "Library", "rna_Main_library_begin", "Libraries", "Library datablocks."},
+               {"curves", "Curve", "rna_Main_curve_begin", "Curves", "Curve datablocks."}, 
+               {"metaballs", "MBall", "rna_Main_mball_begin", "Metaballs", "Metaball datablocks."}, 
+               {"materials", "Material", "rna_Main_mat_begin", "Materials", "Material datablocks."},
+               {"textures", "Texture", "rna_Main_tex_begin", "Textures", "Texture datablocks."},
+               {"images", "Image", "rna_Main_image_begin", "Images", "Image datablocks."},
+               {"lattices", "Lattice", "rna_Main_latt_begin", "Lattices", "Lattice datablocks."},
+               {"lamps", "Lamp", "rna_Main_lamp_begin", "Lamps", "Lamp datablocks."},
+               {"cameras", "Camera", "rna_Main_camera_begin", "Cameras", "Camera datablocks."},
+               {"ipos", "Ipo", "rna_Main_ipo_begin", "Ipos", "Ipo datablocks."},
+               {"keys", "Key", "rna_Main_key_begin", "Keys", "Key datablocks."},
+               {"worlds", "World", "rna_Main_world_begin", "Worlds", "World datablocks."},
+               {"screens", "Screen", "rna_Main_screen_begin", "Screens", "Screen datablocks."},
+               {"scripts", "Script", "rna_Main_script_begin", "Scripts", "Script datablocks."},
+               {"vfonts", "VFont", "rna_Main_vfont_begin", "VFonts", "VFont datablocks."},
+               {"texts", "Text", "rna_Main_text_begin", "Texts", "Text datablocks."},
+               {"sounds", "Sound", "rna_Main_sound_begin", "Sounds", "Sound datablocks."},
+               {"groups", "Group", "rna_Main_group_begin", "Groups", "Group datablocks."},
+               {"armatures", "Armature", "rna_Main_armature_begin", "Armatures", "Armature datablocks."},
+               {"actions", "Action", "rna_Main_action_begin", "Actions", "Action datablocks."},
+               {"nodegroups", "NodeGroup", "rna_Main_nodetree_begin", "Node Groups", "Node group datablocks."},
+               {"brushes", "Brush", "rna_Main_brush_begin", "Brushes", "Brush datablocks."},
+               {"particles", "Particle", "rna_Main_particle_begin", "Particles", "Particle datablocks."},
+               {"windowmanagers", "wmWindowManager", "rna_Main_wm_begin", "Window Managers", "Window manager datablocks."},
+               {NULL, NULL, NULL, NULL, NULL}};
        int i;
        
        srna= RNA_def_struct(brna, "Main", "Main");
@@ -245,6 +245,7 @@ void RNA_def_main(BlenderRNA *brna)
                prop= RNA_def_property(srna, lists[i][0], PROP_COLLECTION, PROP_NONE);
                RNA_def_property_struct_type(prop, lists[i][1]);
                RNA_def_property_collection_funcs(prop, lists[i][2], "rna_iterator_listbase_next", 0, "rna_iterator_listbase_get", 0, 0, 0, 0);
+               RNA_def_property_ui_text(prop, lists[i][3], lists[i][4]);
        }
 }
 
index 38bd523cfc72ec3a11db109ea9222061ac422f9a..6a4125e62574b448e02ae1ed86d8950c1c2c5fa2 100644 (file)
@@ -49,11 +49,13 @@ void RNA_def_mesh(BlenderRNA *brna)
        prop= RNA_def_property(srna, "verts", PROP_COLLECTION, PROP_NONE);
        RNA_def_property_collection_sdna(prop, NULL, "mvert", "totvert");
        RNA_def_property_struct_type(prop, "MVert");
+       RNA_def_property_ui_text(prop, "Vertices", "Vertices of the mesh.");
 
        /* vertex */
        srna= RNA_def_struct(brna, "MVert", "Mesh Vertex");
 
-       prop= RNA_def_property(srna, "co", PROP_FLOAT, PROP_NONE);
+       prop= RNA_def_property(srna, "co", PROP_FLOAT, PROP_VECTOR);
+       RNA_def_property_ui_text(prop, "Location", "Location of the vertex.");
 }
 
 #endif
index d79bd2a3f48b742e465930881ce4d9b5d545bbdd..fc6efc242fb87cc88562cfbe9365d0e54b5c35b6 100644 (file)
@@ -34,6 +34,7 @@
 
 #ifdef RNA_RUNTIME
 
+#if 0
 static StructRNA *rna_Object_data_type(PointerRNA *ptr)
 {
        Object *ob= (Object*)ptr->data;
@@ -65,6 +66,7 @@ static StructRNA *rna_Object_data_type(PointerRNA *ptr)
                        return NULL;
        }
 }
+#endif
 
 #else
 
@@ -77,14 +79,17 @@ void RNA_def_object(BlenderRNA *brna)
 
        RNA_def_ID(srna);
 
-       prop= RNA_def_property(srna, "data", PROP_POINTER, PROP_NONE);
+       /*prop= RNA_def_property(srna, "data", PROP_POINTER, PROP_NONE);
        RNA_def_property_pointer_funcs(prop, NULL, "rna_Object_data_type", NULL);
+       RNA_def_property_ui_text(prop, "Data", "Object data."); */
 
        prop= RNA_def_property(srna, "parent", PROP_POINTER, PROP_NONE);
        RNA_def_property_struct_type(prop, "Object");
+       RNA_def_property_ui_text(prop, "Parent", "Parent Object");
 
        prop= RNA_def_property(srna, "track", PROP_POINTER, PROP_NONE);
        RNA_def_property_struct_type(prop, "Object");
+       RNA_def_property_ui_text(prop, "Track", "Object being tracked to define the rotation (Old Track).");
 }
 
 #endif
index dc3d2486126a427f50c40da73e62479da53cc045..02746681d4ae08f5c2d939c75ae71dadba633038 100644 (file)
@@ -57,19 +57,19 @@ static void *rna_StructRNA_name_property_get(PointerRNA *ptr)
        return ((StructRNA*)ptr->data)->nameproperty;
 }
 
-static void *rna_StructRNA_iterator_property_get(PointerRNA *ptr)
+static void rna_StructRNA_properties_next(CollectionPropertyIterator *iter)
 {
-       return ((StructRNA*)ptr->data)->iteratorproperty;
+       do {
+               rna_iterator_listbase_next(iter);
+       } while(iter->valid && (((PropertyRNA*)iter->internal)->flag & PROP_BUILTIN));
 }
 
 static void rna_StructRNA_properties_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
 {
        rna_iterator_listbase_begin(iter, &((StructRNA*)ptr->data)->properties);
-}
 
-static void rna_StructRNA_properties_next(CollectionPropertyIterator *iter)
-{
-       rna_iterator_listbase_next(iter);
+       if(iter->valid && (((PropertyRNA*)iter->internal)->flag & PROP_BUILTIN))
+               rna_StructRNA_properties_next(iter);
 }
 
 static void *rna_StructRNA_properties_get(CollectionPropertyIterator *iter)
@@ -180,6 +180,11 @@ static int rna_PropertyRNA_array_length_get(PointerRNA *ptr)
        return ((PropertyRNA*)ptr->data)->arraylength;
 }
 
+static int rna_PropertyRNA_max_length_get(PointerRNA *ptr)
+{
+       return ((StringPropertyRNA*)ptr->data)->maxlength;
+}
+
 #else
 
 static void rna_def_property(StructRNA *srna)
@@ -204,32 +209,33 @@ static void rna_def_property(StructRNA *srna)
                {PROP_ROTATION, "ROTATION", "Rotation"},
                {0, NULL, NULL}};
 
-       prop= RNA_def_property(srna, "cname", PROP_STRING, PROP_NONE);
-       RNA_def_property_flag(prop, PROP_NOT_EDITABLE);
-       RNA_def_property_string_funcs(prop, "rna_PropertyRNA_cname_get", "rna_PropertyRNA_cname_length", NULL);
-
        prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
        RNA_def_property_flag(prop, PROP_NOT_EDITABLE);
        RNA_def_property_string_funcs(prop, "rna_PropertyRNA_name_get", "rna_PropertyRNA_name_length", NULL);
+       RNA_def_property_ui_text(prop, "Name", "Human readable name.");
        RNA_def_struct_name_property(srna, prop);
 
+       prop= RNA_def_property(srna, "cname", PROP_STRING, PROP_NONE);
+       RNA_def_property_flag(prop, PROP_NOT_EDITABLE);
+       RNA_def_property_string_funcs(prop, "rna_PropertyRNA_cname_get", "rna_PropertyRNA_cname_length", NULL);
+       RNA_def_property_ui_text(prop, "Identifier", "Unique name used in the code and scripting.");
+
        prop= RNA_def_property(srna, "description", PROP_STRING, PROP_NONE);
        RNA_def_property_flag(prop, PROP_NOT_EDITABLE);
        RNA_def_property_string_funcs(prop, "rna_PropertyRNA_description_get", "rna_PropertyRNA_description_length", NULL);
+       RNA_def_property_ui_text(prop, "Description", "Description of the property for tooltips.");
 
        prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
        RNA_def_property_flag(prop, PROP_NOT_EDITABLE);
        RNA_def_property_enum_items(prop, type_items);
        RNA_def_property_enum_funcs(prop, "rna_PropertyRNA_type_get", NULL);
+       RNA_def_property_ui_text(prop, "Type", "Data type of the property.");
 
        prop= RNA_def_property(srna, "subtype", PROP_ENUM, PROP_NONE);
        RNA_def_property_flag(prop, PROP_NOT_EDITABLE);
        RNA_def_property_enum_items(prop, subtype_items);
        RNA_def_property_enum_funcs(prop, "rna_PropertyRNA_subtype_get", NULL);
-
-       prop= RNA_def_property(srna, "array_length", PROP_INT, PROP_NONE);
-       RNA_def_property_flag(prop, PROP_NOT_EDITABLE);
-       RNA_def_property_int_funcs(prop, "rna_PropertyRNA_array_length_get", NULL);
+       RNA_def_property_ui_text(prop, "Sub Type", "Sub type indicating the interpretation of the property.");
 }
 
 void RNA_def_rna(BlenderRNA *brna)
@@ -240,45 +246,64 @@ void RNA_def_rna(BlenderRNA *brna)
        /* StructRNA */
        srna= RNA_def_struct(brna, "StructRNA", "Struct RNA");
 
-       prop= RNA_def_property(srna, "cname", PROP_STRING, PROP_NONE);
-       RNA_def_property_flag(prop, PROP_NOT_EDITABLE);
-       RNA_def_property_string_funcs(prop, "rna_StructRNA_cname_get", "rna_StructRNA_cname_length", NULL);
-
        prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
        RNA_def_property_flag(prop, PROP_NOT_EDITABLE);
        RNA_def_property_string_funcs(prop, "rna_StructRNA_name_get", "rna_StructRNA_name_length", NULL);
+       RNA_def_property_ui_text(prop, "Name", "Human readable name.");
        RNA_def_struct_name_property(srna, prop);
 
+       prop= RNA_def_property(srna, "cname", PROP_STRING, PROP_NONE);
+       RNA_def_property_flag(prop, PROP_NOT_EDITABLE);
+       RNA_def_property_string_funcs(prop, "rna_StructRNA_cname_get", "rna_StructRNA_cname_length", NULL);
+       RNA_def_property_ui_text(prop, "Identifier", "Unique name used in the code and scripting.");
+
        prop= RNA_def_property(srna, "name_property", PROP_POINTER, PROP_NONE);
        RNA_def_property_flag(prop, PROP_NOT_EDITABLE);
        RNA_def_property_struct_type(prop, "StringPropertyRNA");
        RNA_def_property_pointer_funcs(prop, "rna_StructRNA_name_property_get", NULL, NULL);
-
-       prop= RNA_def_property(srna, "iterator_property", PROP_POINTER, PROP_NONE);
-       RNA_def_property_flag(prop, PROP_NOT_EDITABLE);
-       RNA_def_property_struct_type(prop, "CollectionPropertyRNA");
-       RNA_def_property_pointer_funcs(prop, "rna_StructRNA_iterator_property_get", NULL, NULL);
+       RNA_def_property_ui_text(prop, "Name Property", "Property that gives the name of the struct.");
 
        prop= RNA_def_property(srna, "properties", PROP_COLLECTION, PROP_NONE);
        RNA_def_property_flag(prop, PROP_NOT_EDITABLE);
        RNA_def_property_collection_funcs(prop, "rna_StructRNA_properties_begin", "rna_StructRNA_properties_next", 0, "rna_StructRNA_properties_get", "rna_StructRNA_properties_type", 0, 0, 0);
+       RNA_def_property_ui_text(prop, "Properties", "Properties in the struct.");
 
        /* BooleanPropertyRNA */
        srna= RNA_def_struct(brna, "BooleanPropertyRNA", "Boolean Property");
        rna_def_property(srna);
 
+       prop= RNA_def_property(srna, "array_length", PROP_INT, PROP_NONE);
+       RNA_def_property_flag(prop, PROP_NOT_EDITABLE);
+       RNA_def_property_int_funcs(prop, "rna_PropertyRNA_array_length_get", NULL);
+       RNA_def_property_ui_text(prop, "Array Length", "Maximum length of the array, 0 means unlimited.");
+
        /* IntPropertyRNA */
        srna= RNA_def_struct(brna, "IntPropertyRNA", "Int Property");
        rna_def_property(srna);
 
+       prop= RNA_def_property(srna, "array_length", PROP_INT, PROP_NONE);
+       RNA_def_property_flag(prop, PROP_NOT_EDITABLE);
+       RNA_def_property_int_funcs(prop, "rna_PropertyRNA_array_length_get", NULL);
+       RNA_def_property_ui_text(prop, "Array Length", "Maximum length of the array, 0 means unlimited.");
+
        /* FloatPropertyRNA */
        srna= RNA_def_struct(brna, "FloatPropertyRNA", "Float Property");
        rna_def_property(srna);
 
+       prop= RNA_def_property(srna, "array_length", PROP_INT, PROP_NONE);
+       RNA_def_property_flag(prop, PROP_NOT_EDITABLE);
+       RNA_def_property_int_funcs(prop, "rna_PropertyRNA_array_length_get", NULL);
+       RNA_def_property_ui_text(prop, "Array Length", "Maximum length of the array, 0 means unlimited.");
+
        /* StringPropertyRNA */
        srna= RNA_def_struct(brna, "StringPropertyRNA", "String Property");
        rna_def_property(srna);
 
+       prop= RNA_def_property(srna, "max_length", PROP_INT, PROP_NONE);
+       RNA_def_property_flag(prop, PROP_NOT_EDITABLE);
+       RNA_def_property_int_funcs(prop, "rna_PropertyRNA_max_length_get", NULL);
+       RNA_def_property_ui_text(prop, "Maximum Length", "Maximum length of the string, 0 means unlimited.");
+
        /* EnumPropertyRNA */
        srna= RNA_def_struct(brna, "EnumPropertyRNA", "Enum Property");
        rna_def_property(srna);
@@ -299,11 +324,13 @@ void rna_def_builtin_properties(StructRNA *srna)
        prop= RNA_def_property(srna, "rna_properties", PROP_COLLECTION, PROP_NONE);
        RNA_def_property_flag(prop, PROP_NOT_EDITABLE|PROP_BUILTIN);
        RNA_def_property_collection_funcs(prop, "rna_builtin_properties_begin", "rna_builtin_properties_next", 0, "rna_builtin_properties_get", "rna_builtin_properties_type", 0, 0, 0);
+       RNA_def_property_ui_text(prop, "Properties", "RNA property collection.");
 
        prop= RNA_def_property(srna, "rna_type", PROP_POINTER, PROP_NONE);
-       RNA_def_property_flag(prop, PROP_NOT_EDITABLE|PROP_BUILTIN);
+       RNA_def_property_flag(prop, PROP_NOT_EDITABLE);
        RNA_def_property_struct_type(prop, "StructRNA");
        RNA_def_property_pointer_funcs(prop, "rna_builtin_type_get", NULL, NULL);
+       RNA_def_property_ui_text(prop, "Type", "RNA type definition.");
 }
 
 #endif