[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [39291] trunk/blender/source/blender/ editors/space_outliner: merge outliner refactor so we dont have to keep outliner.c locked in trunk .
Campbell Barton
ideasman42 at gmail.com
Thu Aug 11 07:46:18 CEST 2011
Revision: 39291
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=39291
Author: campbellbarton
Date: 2011-08-11 05:46:18 +0000 (Thu, 11 Aug 2011)
Log Message:
-----------
merge outliner refactor so we dont have to keep outliner.c locked in trunk.
this wont build because of changes spesific to pepper, fix coming next.
svn merge source/blender/editors/space_outliner -r36830:38987 https://svn.blender.org/svnroot/bf-blender/branches/soc-2011-pepper/source/blender/editors/space_outliner
Revision Links:
--------------
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=36830
Modified Paths:
--------------
trunk/blender/source/blender/editors/space_outliner/CMakeLists.txt
trunk/blender/source/blender/editors/space_outliner/outliner_intern.h
trunk/blender/source/blender/editors/space_outliner/outliner_ops.c
trunk/blender/source/blender/editors/space_outliner/space_outliner.c
Added Paths:
-----------
trunk/blender/source/blender/editors/space_outliner/outliner_draw.c
trunk/blender/source/blender/editors/space_outliner/outliner_edit.c
trunk/blender/source/blender/editors/space_outliner/outliner_select.c
trunk/blender/source/blender/editors/space_outliner/outliner_tools.c
trunk/blender/source/blender/editors/space_outliner/outliner_tree.c
Property Changed:
----------------
trunk/blender/source/blender/editors/space_outliner/
Property changes on: trunk/blender/source/blender/editors/space_outliner
___________________________________________________________________
Added: svn:mergeinfo
+ /branches/soc-2011-pepper/source/blender/editors/space_outliner:36831-38987
Modified: trunk/blender/source/blender/editors/space_outliner/CMakeLists.txt
===================================================================
--- trunk/blender/source/blender/editors/space_outliner/CMakeLists.txt 2011-08-11 05:43:20 UTC (rev 39290)
+++ trunk/blender/source/blender/editors/space_outliner/CMakeLists.txt 2011-08-11 05:46:18 UTC (rev 39291)
@@ -37,8 +37,12 @@
)
set(SRC
- outliner.c
+ outliner_draw.c
+ outliner_edit.c
outliner_ops.c
+ outliner_select.c
+ outliner_tools.c
+ outliner_tree.c
space_outliner.c
outliner_intern.h
Copied: trunk/blender/source/blender/editors/space_outliner/outliner_draw.c (from rev 38987, branches/soc-2011-pepper/source/blender/editors/space_outliner/outliner_draw.c)
===================================================================
--- trunk/blender/source/blender/editors/space_outliner/outliner_draw.c (rev 0)
+++ trunk/blender/source/blender/editors/space_outliner/outliner_draw.c 2011-08-11 05:46:18 UTC (rev 39291)
@@ -0,0 +1,1647 @@
+/*
+ * ***** 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): Joshua Leung
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/editors/space_outliner/outliner_draw.c
+ * \ingroup spoutliner
+ */
+
+#include <string.h>
+#include <stdlib.h>
+
+#include "MEM_guardedalloc.h"
+
+#include "DNA_anim_types.h"
+#include "DNA_armature_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 "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 "outliner_intern.h"
+
+/* ****************************************************** */
+/* Tree Size Functions */
+
+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 void restrictbutton_view_cb(bContext *C, void *poin, void *poin2)
+{
+ Scene *scene = (Scene *)poin;
+ Object *ob = (Object *)poin2;
+
+ if(!common_restrict_check(C, ob)) return;
+
+ /* deselect objects that are invisible */
+ if (ob->restrictflag & OB_RESTRICT_VIEW) {
+ /* Ouch! There is no backwards pointer from Object to Base,
+ * so have to do loop to find it. */
+ ED_base_object_select(object_in_scene(ob, scene), BA_DESELECT);
+ }
+ WM_event_add_notifier(C, NC_SCENE|ND_OB_SELECT, scene);
+
+}
+
+static void restrictbutton_sel_cb(bContext *C, void *poin, void *poin2)
+{
+ Scene *scene = (Scene *)poin;
+ Object *ob = (Object *)poin2;
+
+ if(!common_restrict_check(C, ob)) return;
+
+ /* if select restriction has just been turned on */
+ if (ob->restrictflag & OB_RESTRICT_SELECT) {
+ /* Ouch! There is no backwards pointer from Object to Base,
+ * so have to do loop to find it. */
+ ED_base_object_select(object_in_scene(ob, scene), BA_DESELECT);
+ }
+ WM_event_add_notifier(C, NC_SCENE|ND_OB_SELECT, scene);
+
+}
+
+static void restrictbutton_rend_cb(bContext *C, void *poin, void *UNUSED(poin2))
+{
+ WM_event_add_notifier(C, NC_SCENE|ND_OB_RENDER, poin);
+}
+
+static void restrictbutton_r_lay_cb(bContext *C, void *poin, void *UNUSED(poin2))
+{
+ WM_event_add_notifier(C, NC_SCENE|ND_RENDER_OPTIONS, poin);
+}
+
+static void restrictbutton_modifier_cb(bContext *C, void *UNUSED(poin), void *poin2)
+{
+ Object *ob = (Object *)poin2;
+
+ DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
+
+ WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob);
+}
+
+static void restrictbutton_bone_cb(bContext *C, void *UNUSED(poin), void *poin2)
+{
+ Bone *bone= (Bone *)poin2;
+ if(bone && (bone->flag & BONE_HIDDEN_P))
+ bone->flag &= ~(BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL);
+ WM_event_add_notifier(C, NC_OBJECT|ND_POSE, NULL);
+}
+
+static void restrictbutton_ebone_cb(bContext *C, void *UNUSED(poin), void *poin2)
+{
+ EditBone *ebone= (EditBone *)poin2;
+ if(ebone && (ebone->flag & BONE_HIDDEN_A))
+ ebone->flag &= ~(BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL);
+
+ WM_event_add_notifier(C, NC_OBJECT|ND_POSE, NULL);
+}
+
+static int group_restrict_flag(Group *gr, int flag)
+{
+ GroupObject *gob;
+
+ for(gob= gr->gobject.first; gob; gob= gob->next) {
+ if((gob->ob->restrictflag & flag) == 0)
+ return 0;
+ }
+
+ return 1;
+}
+
+static int group_select_flag(Group *gr)
+{
+ GroupObject *gob;
+
+ for(gob= gr->gobject.first; gob; gob= gob->next)
+ if((gob->ob->flag & SELECT))
+ return 1;
+
+ return 0;
+}
+
+static void restrictbutton_gr_restrict_flag(void *poin, void *poin2, int flag)
+{
+ Scene *scene = (Scene *)poin;
+ GroupObject *gob;
+ Group *gr = (Group *)poin2;
+
+ if(group_restrict_flag(gr, flag)) {
+ for(gob= gr->gobject.first; gob; gob= gob->next) {
+ gob->ob->restrictflag &= ~flag;
+
+ if(flag==OB_RESTRICT_VIEW)
+ if(gob->ob->flag & SELECT)
+ ED_base_object_select(object_in_scene(gob->ob, scene), BA_DESELECT);
+ }
+ }
+ else {
+ for(gob= gr->gobject.first; gob; gob= gob->next) {
+ /* not in editmode */
+ if(scene->obedit!=gob->ob) {
+ gob->ob->restrictflag |= flag;
+
+ if(flag==OB_RESTRICT_VIEW)
+ if((gob->ob->flag & SELECT) == 0)
+ ED_base_object_select(object_in_scene(gob->ob, scene), BA_SELECT);
+ }
+ }
+ }
+}
+
+static void restrictbutton_gr_restrict_view(bContext *C, void *poin, void *poin2)
+{
+ restrictbutton_gr_restrict_flag(poin, poin2, OB_RESTRICT_VIEW);
+ WM_event_add_notifier(C, NC_GROUP, NULL);
+}
+static void restrictbutton_gr_restrict_select(bContext *C, void *poin, void *poin2)
+{
+ restrictbutton_gr_restrict_flag(poin, poin2, OB_RESTRICT_SELECT);
+ WM_event_add_notifier(C, NC_GROUP, NULL);
+}
+static void restrictbutton_gr_restrict_render(bContext *C, void *poin, void *poin2)
+{
+ restrictbutton_gr_restrict_flag(poin, poin2, OB_RESTRICT_RENDER);
+ WM_event_add_notifier(C, NC_GROUP, NULL);
+}
+
+
+static void namebutton_cb(bContext *C, void *tsep, char *oldname)
+{
+ SpaceOops *soops= CTX_wm_space_outliner(C);
+ Scene *scene= CTX_data_scene(C);
+ Object *obedit= CTX_data_edit_object(C);
+ TreeStore *ts= soops->treestore;
+ TreeStoreElem *tselem= tsep;
+
+ if(ts && tselem) {
+ TreeElement *te= outliner_find_tse(soops, tselem);
+
+ if(tselem->type==0) {
+ test_idbutton(tselem->id->name+2); // library.c, unique name and alpha sort
+
+ switch(GS(tselem->id->name)) {
+ case ID_MA:
+ WM_event_add_notifier(C, NC_MATERIAL, NULL); break;
+ case ID_TE:
+ WM_event_add_notifier(C, NC_TEXTURE, NULL); break;
+ case ID_IM:
+ WM_event_add_notifier(C, NC_IMAGE, NULL); break;
+ case ID_SCE:
+ WM_event_add_notifier(C, NC_SCENE, NULL); break;
+ default:
+ WM_event_add_notifier(C, NC_ID|NA_RENAME, NULL); break;
+ }
+ /* Check the library target exists */
+ if (te->idcode == ID_LI) {
+ char expanded[FILE_MAXDIR + FILE_MAXFILE];
+ BLI_strncpy(expanded, ((Library *)tselem->id)->name, FILE_MAXDIR + FILE_MAXFILE);
+ BLI_path_abs(expanded, G.main->name);
+ if (!BLI_exists(expanded)) {
+ BKE_report(CTX_wm_reports(C), RPT_ERROR, "This path does not exist, correct this before saving");
+ }
+ }
+ }
+ else {
+ switch(tselem->type) {
+ case TSE_DEFGROUP:
+ defgroup_unique_name(te->directdata, (Object *)tselem->id); // id = object
+ break;
+ case TSE_NLA_ACTION:
+ test_idbutton(tselem->id->name+2);
+ break;
+ case TSE_EBONE:
+ {
+ bArmature *arm= (bArmature *)tselem->id;
+ if(arm->edbo) {
+ EditBone *ebone= te->directdata;
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list