[Bf-committers] [Bf-blender-cvs] SVN commit: /data/svn/bf-blender [38303] branches/soc-2011-pepper/source/ blender/editors/space_outliner: == The great Outliner code split up ==

Joshua Leung aligorith at gmail.com
Tue Jul 12 12:01:09 CEST 2011


Sure, go ahead. I never use CMake, so I've no idea what's breaking it.

On Tue, Jul 12, 2011 at 9:04 PM, Mitchell Stokes <mogurijin at gmail.com> wrote:
> This commit broke building with CMake. I have the fix if you want me
> to commit it.
>
> Cheers,
> Mitchell
>
> On Mon, Jul 11, 2011 at 3:59 AM, Joshua Leung <aligorith at gmail.com> wrote:
>> Revision: 38303
>>          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=38303
>> Author:   aligorith
>> Date:     2011-07-11 10:59:53 +0000 (Mon, 11 Jul 2011)
>> Log Message:
>> -----------
>> == The great Outliner code split up ==
>>
>> As per my proposal (http://lists.blender.org/pipermail/bf-
>> committers/2011-July/032553.html), I've split outliner.c into several
>> new files based on the purpose of the relevant code.
>>
>> * outliner_tree.c - building outliner structure
>> * outliner_draw.c - outliner drawing (including toggle buttons and
>> their handling)
>> * outliner_edit.c - all operators for toggling stuff, and/or hotkey
>> accessed operators. Also KeyingSet and Driver operators go here
>> * outliner_tools.c - all operators and callbacks used for handling RMB
>> click on items
>> * outliner_select.c - stuff for selecting rows, and handling the
>> active/selected toggling stuff
>>
>> In a few cases, the split hasn't been totally clear-cut due to cross-
>> dependencies and other spaghetti. However, in a few cases, I have
>> managed to remove the need for some of the prototypes that were needed
>> in the past by judicious reshuffling of functions, which also makes it
>> easier to actually find what you're looking for.
>>
>> Modified Paths:
>> --------------
>>    branches/soc-2011-pepper/source/blender/editors/space_outliner/outliner_intern.h
>>
>> Added Paths:
>> -----------
>>    branches/soc-2011-pepper/source/blender/editors/space_outliner/outliner_draw.c
>>    branches/soc-2011-pepper/source/blender/editors/space_outliner/outliner_edit.c
>>    branches/soc-2011-pepper/source/blender/editors/space_outliner/outliner_select.c
>>    branches/soc-2011-pepper/source/blender/editors/space_outliner/outliner_tools.c
>>    branches/soc-2011-pepper/source/blender/editors/space_outliner/outliner_tree.c
>>
>> Removed Paths:
>> -------------
>>    branches/soc-2011-pepper/source/blender/editors/space_outliner/outliner.c
>>
>> Deleted: branches/soc-2011-pepper/source/blender/editors/space_outliner/outliner.c
>> ===================================================================
>> --- branches/soc-2011-pepper/source/blender/editors/space_outliner/outliner.c   2011-07-11 09:47:13 UTC (rev 38302)
>> +++ branches/soc-2011-pepper/source/blender/editors/space_outliner/outliner.c   2011-07-11 10:59:53 UTC (rev 38303)
>> @@ -1,6148 +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 "RNA_enum_types.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");
>>
>> @@ Diff output truncated at 10240 characters. @@
>> _______________________________________________
>> Bf-blender-cvs mailing list
>> Bf-blender-cvs at blender.org
>> http://lists.blender.org/mailman/listinfo/bf-blender-cvs
>>
> _______________________________________________
> Bf-committers mailing list
> Bf-committers at blender.org
> http://lists.blender.org/mailman/listinfo/bf-committers
>


More information about the Bf-committers mailing list