[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [18016] branches/blender2.5/blender/source /blender: 2.5

Ton Roosendaal ton at blender.org
Mon Dec 22 20:31:23 CET 2008


Revision: 18016
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=18016
Author:   ton
Date:     2008-12-22 20:31:23 +0100 (Mon, 22 Dec 2008)

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

Our precious outliner is back! :)
Currently no operations are active there, nor notifiers to refresh
other windows. Be patient!

You can switch to RNA with the 'view' menu. 
Later we'll sort out how much of both get integrated in 1 system, or
have both options, or make designated 'data view' for rna? ALso the
old Oops... bring back?

Modified Paths:
--------------
    branches/blender2.5/blender/source/blender/editors/interface/interface_draw.c
    branches/blender2.5/blender/source/blender/editors/space_outliner/outliner_header.c
    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
    branches/blender2.5/blender/source/blender/makesdna/DNA_space_types.h
    branches/blender2.5/blender/source/blender/windowmanager/WM_types.h

Added Paths:
-----------
    branches/blender2.5/blender/source/blender/editors/space_outliner/outliner.c

Modified: branches/blender2.5/blender/source/blender/editors/interface/interface_draw.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/interface/interface_draw.c	2008-12-22 16:56:14 UTC (rev 18015)
+++ branches/blender2.5/blender/source/blender/editors/interface/interface_draw.c	2008-12-22 19:31:23 UTC (rev 18016)
@@ -384,6 +384,32 @@
 	glDisable( GL_BLEND );
 }
 
+/* (old, used in outliner) plain antialiased filled box */
+void uiRoundBox(float minx, float miny, float maxx, float maxy, float rad)
+{
+	float color[4];
+	
+	if(roundboxtype & UI_RB_ALPHA) {
+		glGetFloatv(GL_CURRENT_COLOR, color);
+		color[3]= 0.5;
+		glColor4fv(color);
+		glEnable( GL_BLEND );
+	}
+	
+	/* solid part */
+	gl_round_box(GL_POLYGON, minx, miny, maxx, maxy, rad);
+	
+	/* set antialias line */
+	if (UI_GetThemeValue(TH_BUT_DRAWTYPE) != TH_MINIMAL) {
+		glEnable( GL_LINE_SMOOTH );
+		glEnable( GL_BLEND );
+	}
+	
+	gl_round_box(GL_LINE_LOOP, minx, miny, maxx, maxy, rad);
+	
+	glDisable( GL_BLEND );
+	glDisable( GL_LINE_SMOOTH );
+}
 
 void uiTriangleFakeAA(float x1, float y1, float x2, float y2, float x3, float y3)
 {

Copied: branches/blender2.5/blender/source/blender/editors/space_outliner/outliner.c (from rev 18013, trunk/blender/source/blender/src/outliner.c)
===================================================================
--- branches/blender2.5/blender/source/blender/editors/space_outliner/outliner.c	                        (rev 0)
+++ branches/blender2.5/blender/source/blender/editors/space_outliner/outliner.c	2008-12-22 19:31:23 UTC (rev 18016)
@@ -0,0 +1,3837 @@
+/**
+ * $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) 2004 Blender Foundation.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#include <string.h>
+#include <stdlib.h>
+#include <stddef.h>
+
+#include "MEM_guardedalloc.h"
+
+#include "DNA_action_types.h"
+#include "DNA_armature_types.h"
+#include "DNA_constraint_types.h"
+#include "DNA_curve_types.h"
+#include "DNA_camera_types.h"
+#include "DNA_image_types.h"
+#include "DNA_ipo_types.h"
+#include "DNA_group_types.h"
+#include "DNA_key_types.h"
+#include "DNA_lamp_types.h"
+#include "DNA_material_types.h"
+#include "DNA_mesh_types.h"
+#include "DNA_meta_types.h"
+#include "DNA_modifier_types.h"
+#include "DNA_nla_types.h"
+#include "DNA_object_types.h"
+#include "DNA_oops_types.h"
+#include "DNA_particle_types.h"
+#include "DNA_scene_types.h"
+#include "DNA_screen_types.h"
+#include "DNA_space_types.h"
+#include "DNA_texture_types.h"
+#include "DNA_text_types.h"
+#include "DNA_world_types.h"
+#include "DNA_sequence_types.h"
+
+#include "BLI_blenlib.h"
+
+#include "IMB_imbuf_types.h"
+
+#include "BKE_constraint.h"
+#include "BKE_context.h"
+#include "BKE_deform.h"
+#include "BKE_depsgraph.h"
+#include "BKE_global.h"
+#include "BKE_group.h"
+#include "BKE_library.h"
+#include "BKE_main.h"
+#include "BKE_material.h"
+#include "BKE_modifier.h"
+#include "BKE_object.h"
+#include "BKE_screen.h"
+#include "BKE_scene.h"
+#include "BKE_utildefines.h"
+
+#include "ED_screen.h"
+#include "ED_util.h"
+#include "ED_types.h"
+
+#include "WM_api.h"
+#include "WM_types.h"
+
+#include "BIF_gl.h"
+#include "BIF_glutil.h"
+#include "BIF_editarmature.h"
+
+#include "UI_interface.h"
+#include "UI_interface_icons.h"
+#include "UI_resources.h"
+#include "UI_view2d.h"
+#include "UI_text.h"
+
+#include "outliner_intern.h"
+
+#ifdef INTERNATIONAL
+#include "FTF_Api.h"
+#endif
+
+#include "PIL_time.h" 
+
+
+#define OL_H	19
+#define OL_X	18
+
+#define OL_TOG_RESTRICT_VIEWX	54
+#define OL_TOG_RESTRICT_SELECTX	36
+#define OL_TOG_RESTRICT_RENDERX	18
+
+#define OL_TOGW				OL_TOG_RESTRICT_VIEWX
+
+#define TS_CHUNK	128
+
+#define TREESTORE(a) ((a)?soops->treestore->data+(a)->store_index:NULL)
+
+/* ************* XXX **************** */
+
+static void allqueue() {}
+static void BIF_undo_push() {}
+static void BIF_preview_changed() {}
+static void set_scene() {}
+static void error() {}
+static int pupmenu() {return 0;}
+
+/* ********************************** */
+
+
+/* ******************** PROTOTYPES ***************** */
+static void outliner_draw_tree_element(Scene *scene, ARegion *ar, SpaceOops *soops, TreeElement *te, int startx, int *starty);
+static void outliner_do_object_operation(Scene *scene, SpaceOops *soops, ListBase *lb, 
+										 void (*operation_cb)(TreeElement *, TreeStoreElem *, TreeStoreElem *));
+
+
+/* ******************** PERSISTANT DATA ***************** */
+
+static void outliner_storage_cleanup(SpaceOops *soops)
+{
+	TreeStore *ts= soops->treestore;
+	
+	if(ts) {
+		TreeStoreElem *tselem;
+		int a, unused= 0;
+		
+		/* each element used once, for ID blocks with more users to have each a treestore */
+		for(a=0, tselem= ts->data; a<ts->usedelem; a++, tselem++) tselem->used= 0;
+
+		/* cleanup only after reading file or undo step */
+		if(soops->storeflag & SO_TREESTORE_CLEANUP) {
+			
+			for(a=0, tselem= ts->data; a<ts->usedelem; a++, tselem++) {
+				if(tselem->id==NULL) unused++;
+			}
+
+			if(unused) {
+				if(ts->usedelem == unused) {
+					MEM_freeN(ts->data);
+					ts->data= NULL;
+					ts->usedelem= ts->totelem= 0;
+				}
+				else {
+					TreeStoreElem *tsnewar, *tsnew;
+					
+					tsnew=tsnewar= MEM_mallocN((ts->usedelem-unused)*sizeof(TreeStoreElem), "new tselem");
+					for(a=0, tselem= ts->data; a<ts->usedelem; a++, tselem++) {
+						if(tselem->id) {
+							*tsnew= *tselem;
+							tsnew++;
+						}
+					}
+					MEM_freeN(ts->data);
+					ts->data= tsnewar;
+					ts->usedelem-= unused;
+					ts->totelem= ts->usedelem;
+				}
+			}
+		}
+	}
+}
+
+static void check_persistant(SpaceOops *soops, TreeElement *te, ID *id, short type, short nr)
+{
+	TreeStore *ts;
+	TreeStoreElem *tselem;
+	int a;
+	
+	/* case 1; no TreeStore */
+	if(soops->treestore==NULL) {
+		ts= soops->treestore= MEM_callocN(sizeof(TreeStore), "treestore");
+	}
+	ts= soops->treestore;
+	
+	/* check if 'te' is in treestore */
+	tselem= ts->data;
+	for(a=0; a<ts->usedelem; a++, tselem++) {
+		if(tselem->id==id && tselem->used==0) {
+			if((type==0 && tselem->type==0) ||(tselem->type==type && tselem->nr==nr)) {
+				te->store_index= a;
+				tselem->used= 1;
+				return;
+			}
+		}
+	}
+	
+	/* add 1 element to treestore */
+	if(ts->usedelem==ts->totelem) {
+		TreeStoreElem *tsnew;
+		
+		tsnew= MEM_mallocN((ts->totelem+TS_CHUNK)*sizeof(TreeStoreElem), "treestore data");
+		if(ts->data) {
+			memcpy(tsnew, ts->data, ts->totelem*sizeof(TreeStoreElem));
+			MEM_freeN(ts->data);
+		}
+		ts->data= tsnew;
+		ts->totelem+= TS_CHUNK;
+	}
+	
+	tselem= ts->data+ts->usedelem;
+	
+	tselem->type= type;
+	if(type) tselem->nr= nr; // we're picky! :)
+	else tselem->nr= 0;
+	tselem->id= id;
+	tselem->used = 0;
+	tselem->flag= TSE_CLOSED;
+	te->store_index= ts->usedelem;
+	
+	ts->usedelem++;
+}
+
+/* ******************** TREE MANAGEMENT ****************** */
+
+void outliner_free_tree(ListBase *lb)
+{
+	
+	while(lb->first) {
+		TreeElement *te= lb->first;
+		
+		outliner_free_tree(&te->subtree);
+		BLI_remlink(lb, te);
+		MEM_freeN(te);
+	}
+}
+
+static void outliner_height(SpaceOops *soops, ListBase *lb, int *h)
+{
+	TreeElement *te= lb->first;
+	while(te) {
+		TreeStoreElem *tselem= TREESTORE(te);
+		if((tselem->flag & TSE_CLOSED)==0) 
+			outliner_height(soops, &te->subtree, h);
+		(*h)++;
+		te= te->next;
+	}
+}
+
+static void outliner_width(SpaceOops *soops, ListBase *lb, int *w)
+{
+	TreeElement *te= lb->first;
+	while(te) {
+		TreeStoreElem *tselem= TREESTORE(te);
+		if(tselem->flag & TSE_CLOSED) {
+			if (te->xend > *w)
+				*w = te->xend;
+		}
+		outliner_width(soops, &te->subtree, w);
+		te= te->next;
+	}
+}
+
+static TreeElement *outliner_find_tree_element(ListBase *lb, int store_index)
+{
+	TreeElement *te= lb->first, *tes;
+	while(te) {
+		if(te->store_index==store_index) return te;
+		tes= outliner_find_tree_element(&te->subtree, store_index);
+		if(tes) return tes;
+		te= te->next;
+	}
+	return NULL;
+}
+
+
+
+static ID *outliner_search_back(SpaceOops *soops, TreeElement *te, short idcode)
+{
+	TreeStoreElem *tselem;
+	te= te->parent;
+	
+	while(te) {
+		tselem= TREESTORE(te);
+		if(tselem->type==0 && te->idcode==idcode) return tselem->id;
+		te= te->parent;
+	}
+	return NULL;
+}
+
+struct treesort {
+	TreeElement *te;
+	ID *id;
+	char *name;
+	short idcode;
+};
+
+static int treesort_alpha(const void *v1, const void *v2)
+{
+	const struct treesort *x1= v1, *x2= v2;
+	int comp;
+	
+	/* first put objects last (hierarchy) */
+	comp= (x1->idcode==ID_OB);
+	if(x2->idcode==ID_OB) comp+=2;
+	
+	if(comp==1) return 1;
+	else if(comp==2) return -1;
+	else if(comp==3) {
+		int comp= strcmp(x1->name, x2->name);
+		
+		if( comp>0 ) return 1;
+		else if( comp<0) return -1;
+		return 0;
+	}
+	return 0;
+}
+
+/* this is nice option for later? doesnt look too useful... */
+#if 0
+static int treesort_obtype_alpha(const void *v1, const void *v2)
+{
+	const struct treesort *x1= v1, *x2= v2;
+	
+	/* first put objects last (hierarchy) */
+	if(x1->idcode==ID_OB && x2->idcode!=ID_OB) return 1;
+	else if(x2->idcode==ID_OB && x1->idcode!=ID_OB) return -1;
+	else {
+		/* 2nd we check ob type */
+		if(x1->idcode==ID_OB && x2->idcode==ID_OB) {
+			if( ((Object *)x1->id)->type > ((Object *)x2->id)->type) return 1;
+			else if( ((Object *)x1->id)->type > ((Object *)x2->id)->type) return -1;
+			else return 0;
+		}
+		else {
+			int comp= strcmp(x1->name, x2->name);
+			
+			if( comp>0 ) return 1;
+			else if( comp<0) return -1;
+			return 0;
+		}
+	}
+}
+#endif
+
+/* sort happens on each subtree individual */
+static void outliner_sort(SpaceOops *soops, ListBase *lb)
+{
+	TreeElement *te;
+	TreeStoreElem *tselem;
+	int totelem=0;
+	
+	te= lb->last;

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list