Revision: 17459
          
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=17459
Author:   blendix
Date:     2008-11-14 18:05:25 +0100 (Fri, 14 Nov 2008)

Log Message:
-----------

RNA
* 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.

Modified Paths:
--------------
    branches/blender2.5/blender/source/Makefile
    branches/blender2.5/blender/source/blender/editors/Makefile
    branches/blender2.5/blender/source/blender/editors/SConscript
    branches/blender2.5/blender/source/blender/editors/include/ED_area.h
    branches/blender2.5/blender/source/blender/editors/interface/interface.c
    branches/blender2.5/blender/source/blender/editors/screen/spacetypes.c
    branches/blender2.5/blender/source/blender/makesdna/DNA_space_types.h
    branches/blender2.5/blender/source/blender/makesrna/RNA_access.h
    branches/blender2.5/blender/source/blender/makesrna/RNA_types.h
    branches/blender2.5/blender/source/blender/makesrna/intern/rna_access.c
    branches/blender2.5/blender/source/blender/makesrna/intern/rna_define.c
    branches/blender2.5/blender/source/blender/makesrna/intern/rna_main.c
    branches/blender2.5/blender/source/blender/makesrna/intern/rna_mesh.c
    branches/blender2.5/blender/source/blender/makesrna/intern/rna_object.c
    branches/blender2.5/blender/source/blender/makesrna/intern/rna_rna.c

Added Paths:
-----------
    branches/blender2.5/blender/source/blender/editors/space_outliner/
    branches/blender2.5/blender/source/blender/editors/space_outliner/Makefile
    branches/blender2.5/blender/source/blender/editors/space_outliner/SConscript
    
branches/blender2.5/blender/source/blender/editors/space_outliner/outliner_intern.h
    
branches/blender2.5/blender/source/blender/editors/space_outliner/outliner_ops.c
    
branches/blender2.5/blender/source/blender/editors/space_outliner/space_outliner.c

Modified: branches/blender2.5/blender/source/Makefile
===================================================================
--- branches/blender2.5/blender/source/Makefile 2008-11-14 16:09:23 UTC (rev 
17458)
+++ branches/blender2.5/blender/source/Makefile 2008-11-14 17:05:25 UTC (rev 
17459)
@@ -234,6 +234,7 @@
 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

Modified: branches/blender2.5/blender/source/blender/editors/Makefile
===================================================================
--- branches/blender2.5/blender/source/blender/editors/Makefile 2008-11-14 
16:09:23 UTC (rev 17458)
+++ branches/blender2.5/blender/source/blender/editors/Makefile 2008-11-14 
17:05:25 UTC (rev 17459)
@@ -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

Modified: branches/blender2.5/blender/source/blender/editors/SConscript
===================================================================
--- branches/blender2.5/blender/source/blender/editors/SConscript       
2008-11-14 16:09:23 UTC (rev 17458)
+++ branches/blender2.5/blender/source/blender/editors/SConscript       
2008-11-14 17:05:25 UTC (rev 17459)
@@ -6,6 +6,7 @@
                        'interface/SConscript',
                        'mesh/SConscript',
                        'object/SConscript',
+                       'space_outliner/SConscript',
                        'space_time/SConscript',
                        'space_view3d/SConscript',
                        'transform/SConscript',

Modified: branches/blender2.5/blender/source/blender/editors/include/ED_area.h
===================================================================
--- branches/blender2.5/blender/source/blender/editors/include/ED_area.h        
2008-11-14 16:09:23 UTC (rev 17458)
+++ branches/blender2.5/blender/source/blender/editors/include/ED_area.h        
2008-11-14 17:05:25 UTC (rev 17459)
@@ -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);
 

Modified: 
branches/blender2.5/blender/source/blender/editors/interface/interface.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/interface/interface.c    
2008-11-14 16:09:23 UTC (rev 17458)
+++ branches/blender2.5/blender/source/blender/editors/interface/interface.c    
2008-11-14 17:05:25 UTC (rev 17459)
@@ -2232,64 +2232,73 @@
 {
        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)

Modified: branches/blender2.5/blender/source/blender/editors/screen/spacetypes.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/screen/spacetypes.c      
2008-11-14 16:09:23 UTC (rev 17458)
+++ branches/blender2.5/blender/source/blender/editors/screen/spacetypes.c      
2008-11-14 17:05:25 UTC (rev 17459)
@@ -50,6 +50,7 @@
        SpaceType *type;
 
        /* create space types */
+       ED_spacetype_outliner();
        ED_spacetype_time();
        ED_spacetype_view3d();
 //     ED_spacetype_ipo();

Added: 
branches/blender2.5/blender/source/blender/editors/space_outliner/Makefile
===================================================================
--- branches/blender2.5/blender/source/blender/editors/space_outliner/Makefile  
                        (rev 0)
+++ branches/blender2.5/blender/source/blender/editors/space_outliner/Makefile  
2008-11-14 17:05:25 UTC (rev 17459)
@@ -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 

Added: 
branches/blender2.5/blender/source/blender/editors/space_outliner/SConscript
===================================================================
--- 
branches/blender2.5/blender/source/blender/editors/space_outliner/SConscript    
                            (rev 0)
+++ 
branches/blender2.5/blender/source/blender/editors/space_outliner/SConscript    
    2008-11-14 17:05:25 UTC (rev 17459)
@@ -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] )

Added: 
branches/blender2.5/blender/source/blender/editors/space_outliner/outliner_intern.h
===================================================================
--- 
branches/blender2.5/blender/source/blender/editors/space_outliner/outliner_intern.h
                         (rev 0)
+++ 
branches/blender2.5/blender/source/blender/editors/space_outliner/outliner_intern.h
 2008-11-14 17:05:25 UTC (rev 17459)
@@ -0,0 +1,41 @@
+/**
+ * $Id:
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *

@@ Diff output truncated at 10240 characters. @@

_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to