[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [41899] trunk/blender/source/blender/ editors/space_outliner/outliner_tools.c: Partial Bugfix: [#29229] Outliner RMB commands unexpected results
Joshua Leung
aligorith at gmail.com
Wed Nov 16 01:13:40 CET 2011
Revision: 41899
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=41899
Author: aligorith
Date: 2011-11-16 00:13:38 +0000 (Wed, 16 Nov 2011)
Log Message:
-----------
Partial Bugfix: [#29229] Outliner RMB commands unexpected results
This commit implements the Unlink and Make Single User capabilities for World
datablocks in the Outliner
Modified Paths:
--------------
trunk/blender/source/blender/editors/space_outliner/outliner_tools.c
Modified: trunk/blender/source/blender/editors/space_outliner/outliner_tools.c
===================================================================
--- trunk/blender/source/blender/editors/space_outliner/outliner_tools.c 2011-11-15 23:03:35 UTC (rev 41898)
+++ trunk/blender/source/blender/editors/space_outliner/outliner_tools.c 2011-11-16 00:13:38 UTC (rev 41899)
@@ -236,6 +236,16 @@
}
}
+static void unlink_world_cb(bContext *UNUSED(C), Scene *UNUSED(scene), TreeElement *UNUSED(te), TreeStoreElem *tsep, TreeStoreElem *tselem)
+{
+ Scene *parscene = (Scene *)tsep->id;
+ World *wo = (World *)tselem->id;
+
+ /* need to use parent scene not just scene, otherwise may end up getting wrong one */
+ id_us_min(&wo->id);
+ parscene->world = NULL;
+}
+
static void outliner_do_libdata_operation(bContext *C, Scene *scene, SpaceOops *soops, ListBase *lb,
void (*operation_cb)(bContext *C, Scene *scene, TreeElement *, TreeStoreElem *, TreeStoreElem *))
{
@@ -350,6 +360,23 @@
}
}
+static void singleuser_world_cb(bContext *C, Scene *UNUSED(scene), TreeElement *UNUSED(te), TreeStoreElem *tsep, TreeStoreElem *tselem)
+{
+ ID *id = tselem->id;
+
+ /* need to use parent scene not just scene, otherwise may end up getting wrong one */
+ if (id) {
+ Scene *parscene = (Scene *)tsep->id;
+ PointerRNA ptr = {{NULL}};
+ PropertyRNA *prop;
+
+ RNA_id_pointer_create(&parscene->id, &ptr);
+ prop = RNA_struct_find_property(&ptr, "world");
+
+ id_single_user(C, id, &ptr, prop);
+ }
+}
+
static void group_linkobs2scene_cb(bContext *UNUSED(C), Scene *scene, TreeElement *UNUSED(te), TreeStoreElem *UNUSED(tsep), TreeStoreElem *tselem)
{
Group *group= (Group *)tselem->id;
@@ -746,6 +773,12 @@
WM_event_add_notifier(C, NC_OBJECT|ND_OB_SHADING, NULL);
ED_undo_push(C, "Unlink texture");
break;
+ case ID_WO:
+ outliner_do_libdata_operation(C, scene, soops, &soops->tree, unlink_world_cb);
+
+ WM_event_add_notifier(C, NC_SCENE|ND_WORLD, NULL);
+ ED_undo_push(C, "Unlink world");
+ break;
default:
BKE_report(op->reports, RPT_WARNING, "Not Yet");
break;
@@ -772,6 +805,13 @@
ED_undo_push(C, "Single-User Action");
break;
+ case ID_WO:
+ outliner_do_libdata_operation(C, scene, soops, &soops->tree, singleuser_world_cb);
+
+ WM_event_add_notifier(C, NC_SCENE|ND_WORLD, NULL);
+ ED_undo_push(C, "Single-User World");
+ break;
+
default:
BKE_report(op->reports, RPT_WARNING, "Not Yet");
break;
@@ -799,12 +839,13 @@
}
break;
case OUTLINER_IDOP_RENAME:
+ {
/* rename */
outliner_do_libdata_operation(C, scene, soops, &soops->tree, item_rename_cb);
-
+
WM_event_add_notifier(C, NC_ID|NA_EDITED, NULL);
ED_undo_push(C, "Rename");
-
+ }
break;
default:
More information about the Bf-blender-cvs
mailing list