[Bf-blender-cvs] [f2e6935f0af] temp-group-collections: Outliner: Support drag & drop of GROUP_INTERNAL collections
Dalai Felinto
noreply at git.blender.org
Wed Nov 1 18:14:58 CET 2017
Commit: f2e6935f0af5f45068e1fe887846e3e6b01a51d1
Author: Dalai Felinto
Date: Mon Oct 30 21:45:28 2017 -0200
Branches: temp-group-collections
https://developer.blender.org/rBf2e6935f0af5f45068e1fe887846e3e6b01a51d1
Outliner: Support drag & drop of GROUP_INTERNAL collections
===================================================================
M source/blender/blenkernel/BKE_collection.h
M source/blender/blenkernel/BKE_layer.h
M source/blender/blenkernel/intern/collection.c
M source/blender/blenkernel/intern/layer.c
M source/blender/editors/space_outliner/outliner_intern.h
M source/blender/editors/space_outliner/outliner_ops.c
M source/blender/editors/space_outliner/outliner_tree.c
M source/blender/makesrna/intern/rna_layer.c
===================================================================
diff --git a/source/blender/blenkernel/BKE_collection.h b/source/blender/blenkernel/BKE_collection.h
index 418bab30082..78be290e14d 100644
--- a/source/blender/blenkernel/BKE_collection.h
+++ b/source/blender/blenkernel/BKE_collection.h
@@ -66,9 +66,9 @@ struct Group *BKE_collection_group_create(struct Main *bmain, struct Scene *scen
void BKE_collection_reinsert_after(const struct Scene *scene, struct SceneCollection *sc_reinsert, struct SceneCollection *sc_after);
void BKE_collection_reinsert_into(struct SceneCollection *sc_reinsert, struct SceneCollection *sc_into);
-bool BKE_collection_move_above(const struct Scene *scene, struct SceneCollection *sc_dst, struct SceneCollection *sc_src);
-bool BKE_collection_move_below(const struct Scene *scene, struct SceneCollection *sc_dst, struct SceneCollection *sc_src);
-bool BKE_collection_move_into(const struct Scene *scene, struct SceneCollection *sc_dst, struct SceneCollection *sc_src);
+bool BKE_collection_move_above(const struct ID *id, struct SceneCollection *sc_dst, struct SceneCollection *sc_src);
+bool BKE_collection_move_below(const struct ID *id, struct SceneCollection *sc_dst, struct SceneCollection *sc_src);
+bool BKE_collection_move_into(const struct ID *id, struct SceneCollection *sc_dst, struct SceneCollection *sc_src);
typedef void (*BKE_scene_objects_Cb)(struct Object *ob, void *data);
typedef void (*BKE_scene_collections_Cb)(struct SceneCollection *ob, void *data);
diff --git a/source/blender/blenkernel/BKE_layer.h b/source/blender/blenkernel/BKE_layer.h
index b4a14bcf71f..a9bb653f420 100644
--- a/source/blender/blenkernel/BKE_layer.h
+++ b/source/blender/blenkernel/BKE_layer.h
@@ -89,11 +89,11 @@ int BKE_layer_collection_count(struct SceneLayer *sl);
struct LayerCollection *BKE_layer_collection_from_index(struct SceneLayer *sl, const int index);
int BKE_layer_collection_findindex(struct SceneLayer *sl, const struct LayerCollection *lc);
-bool BKE_layer_collection_move_above(const struct Scene *scene, struct LayerCollection *lc_dst, struct LayerCollection *lc_src);
-bool BKE_layer_collection_move_below(const struct Scene *scene, struct LayerCollection *lc_dst, struct LayerCollection *lc_src);
-bool BKE_layer_collection_move_into(const struct Scene *scene, struct LayerCollection *lc_dst, struct LayerCollection *lc_src);
+bool BKE_layer_collection_move_above(const struct ID *id, struct LayerCollection *lc_dst, struct LayerCollection *lc_src);
+bool BKE_layer_collection_move_below(const struct ID *id, struct LayerCollection *lc_dst, struct LayerCollection *lc_src);
+bool BKE_layer_collection_move_into(const struct ID *id, struct LayerCollection *lc_dst, struct LayerCollection *lc_src);
-void BKE_layer_collection_resync(const struct Scene *scene, const struct SceneCollection *sc);
+void BKE_layer_collection_resync(const struct ID *id, const struct SceneCollection *sc);
struct LayerCollection *BKE_collection_link(struct SceneLayer *sl, struct SceneCollection *sc);
diff --git a/source/blender/blenkernel/intern/collection.c b/source/blender/blenkernel/intern/collection.c
index 3bdaa283997..d60791151fc 100644
--- a/source/blender/blenkernel/intern/collection.c
+++ b/source/blender/blenkernel/intern/collection.c
@@ -588,10 +588,10 @@ static bool is_collection_in_tree(const SceneCollection *sc_reference, SceneColl
return find_collection_parent(sc_reference, sc_parent) != NULL;
}
-bool BKE_collection_move_above(const Scene *scene, SceneCollection *sc_dst, SceneCollection *sc_src)
+bool BKE_collection_move_above(const ID *id, SceneCollection *sc_dst, SceneCollection *sc_src)
{
/* Find the SceneCollection the sc_src belongs to */
- SceneCollection *sc_master = BKE_collection_master(scene);
+ SceneCollection *sc_master = master_collection_from_id(id);
/* Master Layer can't be moved around*/
if (ELEM(sc_master, sc_src, sc_dst)) {
@@ -621,16 +621,16 @@ bool BKE_collection_move_above(const Scene *scene, SceneCollection *sc_dst, Scen
BLI_insertlinkbefore(&sc_dst_parent->scene_collections, sc_dst, sc_src);
/* Update the tree */
- BKE_layer_collection_resync(scene, sc_src_parent);
- BKE_layer_collection_resync(scene, sc_dst_parent);
+ BKE_layer_collection_resync(id, sc_src_parent);
+ BKE_layer_collection_resync(id, sc_dst_parent);
return true;
}
-bool BKE_collection_move_below(const Scene *scene, SceneCollection *sc_dst, SceneCollection *sc_src)
+bool BKE_collection_move_below(const ID *id, SceneCollection *sc_dst, SceneCollection *sc_src)
{
/* Find the SceneCollection the sc_src belongs to */
- SceneCollection *sc_master = BKE_collection_master(scene);
+ SceneCollection *sc_master = master_collection_from_id(id);
/* Master Layer can't be moved around*/
if (ELEM(sc_master, sc_src, sc_dst)) {
@@ -660,16 +660,16 @@ bool BKE_collection_move_below(const Scene *scene, SceneCollection *sc_dst, Scen
BLI_insertlinkafter(&sc_dst_parent->scene_collections, sc_dst, sc_src);
/* Update the tree */
- BKE_layer_collection_resync(scene, sc_src_parent);
- BKE_layer_collection_resync(scene, sc_dst_parent);
+ BKE_layer_collection_resync(id, sc_src_parent);
+ BKE_layer_collection_resync(id, sc_dst_parent);
return true;
}
-bool BKE_collection_move_into(const Scene *scene, SceneCollection *sc_dst, SceneCollection *sc_src)
+bool BKE_collection_move_into(const ID *id, SceneCollection *sc_dst, SceneCollection *sc_src)
{
/* Find the SceneCollection the sc_src belongs to */
- SceneCollection *sc_master = BKE_collection_master(scene);
+ SceneCollection *sc_master = master_collection_from_id(id);
if (sc_src == sc_master) {
return false;
}
@@ -695,8 +695,8 @@ bool BKE_collection_move_into(const Scene *scene, SceneCollection *sc_dst, Scene
BLI_addtail(&sc_dst->scene_collections, sc_src);
/* Update the tree */
- BKE_layer_collection_resync(scene, sc_src_parent);
- BKE_layer_collection_resync(scene, sc_dst);
+ BKE_layer_collection_resync(id, sc_src_parent);
+ BKE_layer_collection_resync(id, sc_dst);
return true;
}
diff --git a/source/blender/blenkernel/intern/layer.c b/source/blender/blenkernel/intern/layer.c
index eb7a4d63e1b..b1ff258c846 100644
--- a/source/blender/blenkernel/intern/layer.c
+++ b/source/blender/blenkernel/intern/layer.c
@@ -62,6 +62,7 @@ static void layer_collection_free(SceneLayer *sl, LayerCollection *lc);
static void layer_collection_objects_populate(SceneLayer *sl, LayerCollection *lc, ListBase *objects);
static LayerCollection *layer_collection_add(SceneLayer *sl, LayerCollection *parent, SceneCollection *sc);
static LayerCollection *find_layer_collection_by_scene_collection(LayerCollection *lc, const SceneCollection *sc);
+static SceneLayer *scene_layer_first_from_id(const ID *id);
static IDProperty *collection_engine_settings_create(struct EngineSettingsCB_Type *ces_type, const bool populate);
static IDProperty *collection_engine_get(IDProperty *root, const int type, const char *engine_name);
static void collection_engine_settings_init(IDProperty *root, const bool populate);
@@ -682,12 +683,12 @@ static void layer_collection_swap(
* Move \a lc_src into \a lc_dst. Both have to be stored in \a sl.
* If \a lc_src is directly linked to the SceneLayer it's unlinked
*/
-bool BKE_layer_collection_move_into(const Scene *scene, LayerCollection *lc_dst, LayerCollection *lc_src)
+bool BKE_layer_collection_move_into(const ID *id, LayerCollection *lc_dst, LayerCollection *lc_src)
{
- SceneLayer *sl = BKE_scene_layer_find_from_collection(&scene->id, lc_src);
+ SceneLayer *sl = BKE_scene_layer_find_from_collection(id, lc_src);
bool is_directly_linked = false;
- if ((!sl) || (sl != BKE_scene_layer_find_from_collection(&scene->id, lc_dst))) {
+ if ((!sl) || (sl != BKE_scene_layer_find_from_collection(id, lc_dst))) {
return false;
}
@@ -723,7 +724,7 @@ bool BKE_layer_collection_move_into(const Scene *scene, LayerCollection *lc_dst,
layer_collection_swap(sl, &sl->layer_collections, NULL, lc_temp, lc_src);
}
- if (!BKE_collection_move_into(scene, lc_dst->scene_collection, lc_src->scene_collection)) {
+ if (!BKE_collection_move_into(id, lc_dst->scene_collection, lc_src->scene_collection)) {
if (!is_directly_linked) {
/* Swap back and remove */
layer_collection_swap(sl, NULL, NULL, lc_temp, lc_src);
@@ -749,13 +750,13 @@ bool BKE_layer_collection_move_into(const Scene *scene, LayerCollection *lc_dst,
* Move \a lc_src above \a lc_dst. Both have to be stored in \a sl.
* If \a lc_src is directly linked to the SceneLayer it's unlinked
*/
-bool BKE_layer_collection_move_above(const Scene *scene, LayerCollection *lc_dst, LayerCollection *lc_src)
+bool BKE_layer_collection_move_above(const ID *id, LayerCollection *lc_dst, LayerCollection *lc_src)
{
- SceneLayer *sl = BKE_scene_layer_find_from_collection(&scene->id, lc_src);
+ SceneLayer *sl = BKE_scene_layer_find_from_collection(id, lc_src);
const bool is_directly_linked_src = BLI_findindex(&sl->layer_collections, lc_src) != -1;
const bool is_directly_linked_dst = BLI_findindex(&sl->layer_collections, lc_dst) != -1;
- if ((!sl) || (sl != BKE_scene_layer_find_from_collection(&scene->id, lc_dst))) {
+ if ((!sl) || (sl != BKE_scene_layer_find_from_collection(id, lc_dst))) {
return false;
}
@@ -798,7 +799,7 @@ bool BKE_layer_collection_move_above(const Scene *scene, LayerCollection *lc_dst
layer_collection_swap(sl, &sl->layer_collections, NULL, lc_temp, lc_src);
}
- if (!BKE_collection_move_above(scene, lc_dst->scene_collection, lc_src->scene_collection)) {
+ if (!BKE_collection_move_above(id, lc_dst->scene_collection, lc_src->scene_collection)) {
if (!is_directly_linked_src) {
/* Swap back and remove */
layer_collection_swap(sl, NULL, NULL, lc_temp, lc_src);
@@ -824,13 +825,13 @@ bool BKE_layer_collection_move_above(const Scene *scene, LayerCollection *lc_dst
* Move \a lc_src below \a lc_dst. Both have to be stored in \a sl.
* If \a lc_src is directly linked to the SceneLayer it's unlinked
*/
-bool BKE_layer_collection_move_below(const Scene *scene, LayerCollection *lc_dst, LayerCollection *lc_src)
+bool BKE_layer_collection_move_below(const ID *id, LayerCollection *lc_dst, LayerCollection *lc_src)
{
- Sc
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list