Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoshua Leung <aligorith@gmail.com>2011-11-16 04:13:38 +0400
committerJoshua Leung <aligorith@gmail.com>2011-11-16 04:13:38 +0400
commit9f46ca46a6fcdacf53d95a61147272352154204b (patch)
tree610cd480e9a3eb47335fc94af1bf27c9b51da308 /source/blender/editors/space_outliner
parent0792ab3652ce31377f9a994430cd62cd849d6684 (diff)
Partial Bugfix: [#29229] Outliner RMB commands unexpected results
This commit implements the Unlink and Make Single User capabilities for World datablocks in the Outliner
Diffstat (limited to 'source/blender/editors/space_outliner')
-rw-r--r--source/blender/editors/space_outliner/outliner_tools.c45
1 files changed, 43 insertions, 2 deletions
diff --git a/source/blender/editors/space_outliner/outliner_tools.c b/source/blender/editors/space_outliner/outliner_tools.c
index a4f67f91763..a7f7e36b182 100644
--- a/source/blender/editors/space_outliner/outliner_tools.c
+++ b/source/blender/editors/space_outliner/outliner_tools.c
@@ -236,6 +236,16 @@ static void unlink_group_cb(bContext *UNUSED(C), Scene *UNUSED(scene), TreeEleme
}
}
+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_action_cb(bContext *C, Scene *UNUSED(scene), TreeElement
}
}
+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 @@ static int outliner_id_operation_exec(bContext *C, wmOperator *op)
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 @@ static int outliner_id_operation_exec(bContext *C, wmOperator *op)
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 @@ static int outliner_id_operation_exec(bContext *C, wmOperator *op)
}
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: