[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [39290] trunk/blender/source/blender/ editors/space_outliner/outliner.c: unlocking outliner.c and removing...

Campbell Barton ideasman42 at gmail.com
Thu Aug 11 07:43:20 CEST 2011


Revision: 39290
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=39290
Author:   campbellbarton
Date:     2011-08-11 05:43:20 +0000 (Thu, 11 Aug 2011)
Log Message:
-----------
unlocking outliner.c and removing... (merging refactor from pepper but looks like this will take a few steps)

Removed Paths:
-------------
    trunk/blender/source/blender/editors/space_outliner/outliner.c

Deleted: trunk/blender/source/blender/editors/space_outliner/outliner.c
===================================================================
--- trunk/blender/source/blender/editors/space_outliner/outliner.c	2011-08-11 05:41:47 UTC (rev 39289)
+++ trunk/blender/source/blender/editors/space_outliner/outliner.c	2011-08-11 05:43:20 UTC (rev 39290)
@@ -1,5792 +0,0 @@
-/*
- * $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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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 *****
- */
-
-/** \file blender/editors/space_outliner/outliner.c
- *  \ingroup spoutliner
- */
-
-
-#include <math.h>
-#include <string.h>
-#include <stdlib.h>
-#include <stddef.h>
-
-#include "MEM_guardedalloc.h"
-
-#include "DNA_anim_types.h"
-#include "DNA_armature_types.h"
-#include "DNA_constraint_types.h"
-#include "DNA_camera_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_particle_types.h"
-#include "DNA_scene_types.h"
-#include "DNA_world_types.h"
-#include "DNA_sequence_types.h"
-#include "DNA_object_types.h"
-
-#include "BLI_blenlib.h"
-#include "BLI_utildefines.h"
-#include "BLI_math_base.h"
-
-#if defined WIN32 && !defined _LIBC
-# include "BLI_fnmatch.h" /* use fnmatch included in blenlib */
-#else
-#  ifndef _GNU_SOURCE
-#    define _GNU_SOURCE
-#  endif
-# include <fnmatch.h>
-#endif
-
-
-#include "BKE_animsys.h"
-#include "BKE_context.h"
-#include "BKE_deform.h"
-#include "BKE_depsgraph.h"
-#include "BKE_fcurve.h"
-#include "BKE_global.h"
-#include "BKE_group.h"
-#include "BKE_library.h"
-#include "BKE_main.h"
-#include "BKE_modifier.h"
-#include "BKE_report.h"
-#include "BKE_scene.h"
-#include "BKE_sequencer.h"
-
-#include "ED_armature.h"
-#include "ED_object.h"
-#include "ED_screen.h"
-#include "ED_util.h"
-
-#include "WM_api.h"
-#include "WM_types.h"
-
-#include "BIF_gl.h"
-#include "BIF_glutil.h"
-
-#include "UI_interface.h"
-#include "UI_interface_icons.h"
-#include "UI_resources.h"
-#include "UI_view2d.h"
-
-#include "RNA_access.h"
-#include "RNA_define.h"
-
-#include "ED_keyframing.h"
-
-#include "outliner_intern.h"
-
-
-#define OL_Y_OFFSET	2
-
-#define OL_TOG_RESTRICT_VIEWX	(UI_UNIT_X*3)
-#define OL_TOG_RESTRICT_SELECTX	(UI_UNIT_X*2)
-#define OL_TOG_RESTRICT_RENDERX	UI_UNIT_X
-
-#define OL_TOGW OL_TOG_RESTRICT_VIEWX
-
-#define OL_RNA_COLX			(UI_UNIT_X*15)
-#define OL_RNA_COL_SIZEX	(UI_UNIT_X*7.5)
-#define OL_RNA_COL_SPACEX	(UI_UNIT_X*2.5)
-
-#define TS_CHUNK	128
-
-#define TREESTORE(a) ((a)?soops->treestore->data+(a)->store_index:NULL)
-
-/* ************* XXX **************** */
-
-static void error(const char *UNUSED(arg), ...) {}
-
-/* ********************************** */
-
-
-/* ******************** PROTOTYPES ***************** */
-static void outliner_draw_tree_element(bContext *C, uiBlock *block, Scene *scene, ARegion *ar, SpaceOops *soops, TreeElement *te, int startx, int *starty);
-static void outliner_do_object_operation(bContext *C, Scene *scene, SpaceOops *soops, ListBase *lb, 
-										 void (*operation_cb)(bContext *C, Scene *scene, TreeElement *, TreeStoreElem *, TreeStoreElem *));
-
-static int group_select_flag(Group *gr);
-
-/* ******************** 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, and always for
-		 * RNA datablocks view in order to save memory */
-		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) {
-		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);
-
-		if(te->flag & TE_FREE_NAME) MEM_freeN((void *)te->name);
-		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) += UI_UNIT_Y;
-		te= te->next;
-	}
-}
-
-#if 0  // XXX this is currently disabled until te->xend is set correctly
-static void outliner_width(SpaceOops *soops, ListBase *lb, int *w)
-{
-	TreeElement *te= lb->first;
-	while(te) {
-//		TreeStoreElem *tselem= TREESTORE(te);
-		
-		// XXX fixme... te->xend is not set yet
-		if(tselem->flag & TSE_CLOSED) {
-			if (te->xend > *w)
-				*w = te->xend;
-		}
-		outliner_width(soops, &te->subtree, w);
-		te= te->next;
-	}
-}
-#endif
-
-static void outliner_rna_width(SpaceOops *soops, ListBase *lb, int *w, int startx)
-{
-	TreeElement *te= lb->first;
-	while(te) {
-		TreeStoreElem *tselem= TREESTORE(te);
-			// XXX fixme... (currently, we're using a fixed length of 100)!
-		/*if(te->xend) {
-			if(te->xend > *w)
-				*w = te->xend;
-		}*/
-		if(startx+100 > *w)
-			*w = startx+100;
-
-		if((tselem->flag & TSE_CLOSED)==0)
-			outliner_rna_width(soops, &te->subtree, w, startx+UI_UNIT_X);
-		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;
-	const 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) {
-		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;
-	if(te==NULL) return;
-	tselem= TREESTORE(te);
-	
-	/* sorting rules; only object lists or deformgroups */
-	if( (tselem->type==TSE_DEFGROUP) || (tselem->type==0 && te->idcode==ID_OB)) {
-		
-		/* count first */
-		for(te= lb->first; te; te= te->next) totelem++;
-		
-		if(totelem>1) {
-			struct treesort *tear= MEM_mallocN(totelem*sizeof(struct treesort), "tree sort array");
-			struct treesort *tp=tear;
-			int skip= 0;
-			

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list