Outliner/layer: fix users trying to drop a collection into itself (recursion hell)
This commit is contained in:
@@ -580,6 +580,11 @@ bool BKE_layer_collection_move_into(const Scene *scene, LayerCollection *lc_dst,
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* We can't nest the collection into itself */
|
||||||
|
if (lc_src->scene_collection == lc_dst->scene_collection) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/* Collection is already where we wanted it to be */
|
/* Collection is already where we wanted it to be */
|
||||||
if (lc_dst->layer_collections.last == lc_src) {
|
if (lc_dst->layer_collections.last == lc_src) {
|
||||||
return false;
|
return false;
|
||||||
|
@@ -135,6 +135,7 @@ RENDER_LAYER_TEST(move_into_layer_collection_f)
|
|||||||
RENDER_LAYER_TEST(move_into_layer_collection_g)
|
RENDER_LAYER_TEST(move_into_layer_collection_g)
|
||||||
RENDER_LAYER_TEST(move_into_layer_collection_h)
|
RENDER_LAYER_TEST(move_into_layer_collection_h)
|
||||||
RENDER_LAYER_TEST(move_into_layer_collection_i)
|
RENDER_LAYER_TEST(move_into_layer_collection_i)
|
||||||
|
RENDER_LAYER_TEST(move_into_layer_collection_j)
|
||||||
RENDER_LAYER_TEST(layer_linking)
|
RENDER_LAYER_TEST(layer_linking)
|
||||||
RENDER_LAYER_TEST(layer_syncinc)
|
RENDER_LAYER_TEST(layer_syncinc)
|
||||||
RENDER_LAYER_TEST(scene_copy)
|
RENDER_LAYER_TEST(scene_copy)
|
||||||
|
@@ -0,0 +1,49 @@
|
|||||||
|
# ./blender.bin --background -noaudio --python tests/python/render_layer/test_link.py -- --testdir="/data/lib/tests/"
|
||||||
|
|
||||||
|
# ############################################################
|
||||||
|
# Importing - Same For All Render Layer Tests
|
||||||
|
# ############################################################
|
||||||
|
|
||||||
|
import unittest
|
||||||
|
|
||||||
|
import os, sys
|
||||||
|
sys.path.append(os.path.dirname(__file__))
|
||||||
|
|
||||||
|
from render_layer_common import *
|
||||||
|
|
||||||
|
|
||||||
|
# ############################################################
|
||||||
|
# Testing
|
||||||
|
# ############################################################
|
||||||
|
|
||||||
|
class UnitTesting(MoveLayerCollectionTesting):
|
||||||
|
def get_reference_scene_tree_map(self):
|
||||||
|
# original tree, no changes
|
||||||
|
return self.get_initial_scene_tree_map()
|
||||||
|
|
||||||
|
def get_reference_layers_tree_map(self):
|
||||||
|
# original tree, no changes
|
||||||
|
return self.get_initial_layers_tree_map()
|
||||||
|
|
||||||
|
def test_layer_collection_into(self):
|
||||||
|
"""
|
||||||
|
Test outliner operations
|
||||||
|
Prevent collection from being dragged into itself
|
||||||
|
"""
|
||||||
|
self.setup_tree()
|
||||||
|
self.assertFalse(self.move_into("Layer 2.dog", "Layer 2.3.dog"))
|
||||||
|
self.compare_tree_maps()
|
||||||
|
|
||||||
|
|
||||||
|
# ############################################################
|
||||||
|
# Main - Same For All Render Layer Tests
|
||||||
|
# ############################################################
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
import sys
|
||||||
|
|
||||||
|
extra_arguments = sys.argv[sys.argv.index("--") + 1:] if "--" in sys.argv else []
|
||||||
|
sys.argv = [__file__] + (sys.argv[sys.argv.index("--") + 2:] if "--" in sys.argv else [])
|
||||||
|
|
||||||
|
UnitTesting._extra_arguments = extra_arguments
|
||||||
|
unittest.main()
|
Reference in New Issue
Block a user