diff options
author | Dan Eicher <dan@eu.phorio.us> | 2012-05-29 22:12:13 +0400 |
---|---|---|
committer | Dan Eicher <dan@eu.phorio.us> | 2012-05-29 22:12:13 +0400 |
commit | 52aad984b6634f009ebc9fecf33bca786036a834 (patch) | |
tree | 0ffa9681ee3b268620578dde2710bc507d399681 /source/blender/editors/space_outliner/space_outliner.c | |
parent | 2aa3b5a24eaaeaeef671eb8f778d6fdaf21ea28d (diff) |
Outliner Drag & Drop fixes
OUTLINER_OT_parent_drop
* use scene of child instead of active scene
* poll to check if parent and child are in same scene
OUTLINER_OT_parent_clear
* get scene from child instead of only working on active scene
* poll to check if no parent
OUTLINER_OT_scene_drop && OBJECT_OT_make_links_scene
* memory leak on error
* would only link some objects on error
Diffstat (limited to 'source/blender/editors/space_outliner/space_outliner.c')
-rw-r--r-- | source/blender/editors/space_outliner/space_outliner.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/source/blender/editors/space_outliner/space_outliner.c b/source/blender/editors/space_outliner/space_outliner.c index f3f6e3cf49f..4d45be561c6 100644 --- a/source/blender/editors/space_outliner/space_outliner.c +++ b/source/blender/editors/space_outliner/space_outliner.c @@ -41,6 +41,7 @@ #include "BKE_context.h" #include "BKE_screen.h" +#include "BKE_scene.h" #include "ED_space_api.h" #include "ED_screen.h" @@ -52,6 +53,9 @@ #include "RNA_access.h" +#include "DNA_scene_types.h" +#include "DNA_object_types.h" + #include "UI_resources.h" #include "UI_view2d.h" @@ -91,7 +95,13 @@ static int outliner_parent_drop_poll(bContext *C, wmDrag *drag, wmEvent *event) for (te = soops->tree.first; te; te = te->next) { TreeElement *te_valid; te_valid = outliner_dropzone_parent(C, event, te, fmval); - if (te_valid) return 1; + if (te_valid) { + /* check that parent/child are both in the same scene */ + Scene *scene = (Scene *)outliner_search_back(soops, te_valid, ID_SCE); + if (BKE_scene_base_find(scene, (Object *)id)) { + return 1; + } + } } } } @@ -117,7 +127,9 @@ static int outliner_parent_clear_poll(bContext *C, wmDrag *drag, wmEvent *event) if (drag->type == WM_DRAG_ID) { ID *id = (ID *)drag->poin; if (GS(id->name) == ID_OB) { - //TODO: Check if no parent? + if (((Object *)id)->parent == NULL) { + return 0; + } /* Ensure location under cursor is valid dropzone */ for (te = soops->tree.first; te; te = te->next) { if (outliner_dropzone_parent_clear(C, event, te, fmval)) return 1; |