diff options
author | Monique Dewanchand <mdewanchand> | 2022-09-14 22:30:20 +0300 |
---|---|---|
committer | Monique <mdewanchand@atmind.nl> | 2022-09-14 22:30:56 +0300 |
commit | 23276bcc37acc54f1e1814abdf482a432523c3a6 (patch) | |
tree | 8677bacc96fb953fb27625a6ae563aa1ae5e1769 /source/blender/io/collada | |
parent | 1a4854898000661dd7cf57492a7a75cb60ea63ef (diff) |
Adding `const Scene*` parameter in many areas.
Related to {D15885} that requires scene parameter
to be added in many places. To speed up the review process
the adding of the scene parameter was added in a separate
patch.
Reviewed By: mont29
Maniphest Tasks: T73411
Differential Revision: https://developer.blender.org/D15930
Diffstat (limited to 'source/blender/io/collada')
-rw-r--r-- | source/blender/io/collada/BlenderContext.cpp | 21 | ||||
-rw-r--r-- | source/blender/io/collada/BlenderContext.h | 8 | ||||
-rw-r--r-- | source/blender/io/collada/DocumentImporter.cpp | 2 | ||||
-rw-r--r-- | source/blender/io/collada/ExportSettings.h | 7 | ||||
-rw-r--r-- | source/blender/io/collada/SceneExporter.cpp | 8 | ||||
-rw-r--r-- | source/blender/io/collada/collada.cpp | 3 |
6 files changed, 33 insertions, 16 deletions
diff --git a/source/blender/io/collada/BlenderContext.cpp b/source/blender/io/collada/BlenderContext.cpp index 5f54f38a0ab..e76eea24dca 100644 --- a/source/blender/io/collada/BlenderContext.cpp +++ b/source/blender/io/collada/BlenderContext.cpp @@ -11,19 +11,20 @@ #include "BKE_scene.h" -bool bc_is_base_node(LinkNode *export_set, Object *ob, ViewLayer *view_layer) +bool bc_is_base_node(LinkNode *export_set, Object *ob, const Scene *scene, ViewLayer *view_layer) { - Object *root = bc_get_highest_exported_ancestor_or_self(export_set, ob, view_layer); + Object *root = bc_get_highest_exported_ancestor_or_self(export_set, ob, scene, view_layer); return (root == ob); } Object *bc_get_highest_exported_ancestor_or_self(LinkNode *export_set, Object *ob, + const Scene *scene, ViewLayer *view_layer) { Object *ancestor = ob; while (ob->parent) { - if (bc_is_in_Export_set(export_set, ob->parent, view_layer)) { + if (bc_is_in_Export_set(export_set, ob->parent, scene, view_layer)) { ancestor = ob->parent; } ob = ob->parent; @@ -31,7 +32,10 @@ Object *bc_get_highest_exported_ancestor_or_self(LinkNode *export_set, return ancestor; } -void bc_get_children(std::vector<Object *> &child_set, Object *ob, ViewLayer *view_layer) +void bc_get_children(std::vector<Object *> &child_set, + Object *ob, + const Scene *scene, + ViewLayer *view_layer) { Base *base; for (base = (Base *)view_layer->object_bases.first; base; base = base->next) { @@ -51,7 +55,10 @@ void bc_get_children(std::vector<Object *> &child_set, Object *ob, ViewLayer *vi } } -bool bc_is_in_Export_set(LinkNode *export_set, Object *ob, ViewLayer *view_layer) +bool bc_is_in_Export_set(LinkNode *export_set, + Object *ob, + const Scene *scene, + ViewLayer *view_layer) { bool to_export = (BLI_linklist_index(export_set, ob) != -1); @@ -60,9 +67,9 @@ bool bc_is_in_Export_set(LinkNode *export_set, Object *ob, ViewLayer *view_layer * export list, but it contains children to export. */ std::vector<Object *> children; - bc_get_children(children, ob, view_layer); + bc_get_children(children, ob, scene, view_layer); for (Object *child : children) { - if (bc_is_in_Export_set(export_set, child, view_layer)) { + if (bc_is_in_Export_set(export_set, child, scene, view_layer)) { to_export = true; break; } diff --git a/source/blender/io/collada/BlenderContext.h b/source/blender/io/collada/BlenderContext.h index 6fdb043b3dc..8a782b74e52 100644 --- a/source/blender/io/collada/BlenderContext.h +++ b/source/blender/io/collada/BlenderContext.h @@ -22,8 +22,11 @@ extern "C" { static const BC_global_forward_axis BC_DEFAULT_FORWARD = BC_GLOBAL_FORWARD_Y; static const BC_global_up_axis BC_DEFAULT_UP = BC_GLOBAL_UP_Z; -bool bc_is_in_Export_set(LinkNode *export_set, Object *ob, ViewLayer *view_layer); -bool bc_is_base_node(LinkNode *export_set, Object *ob, ViewLayer *view_layer); +bool bc_is_in_Export_set(LinkNode *export_set, + Object *ob, + const Scene *scene, + ViewLayer *view_layer); +bool bc_is_base_node(LinkNode *export_set, Object *ob, const Scene *scene, ViewLayer *view_layer); /** * Returns the highest selected ancestor * returns NULL if no ancestor is selected @@ -32,6 +35,7 @@ bool bc_is_base_node(LinkNode *export_set, Object *ob, ViewLayer *view_layer); */ Object *bc_get_highest_exported_ancestor_or_self(LinkNode *export_set, Object *ob, + const Scene *scene, ViewLayer *view_layer); int bc_is_marked(Object *ob); void bc_remove_mark(Object *ob); diff --git a/source/blender/io/collada/DocumentImporter.cpp b/source/blender/io/collada/DocumentImporter.cpp index 7ac70864f82..00c69a5fb8a 100644 --- a/source/blender/io/collada/DocumentImporter.cpp +++ b/source/blender/io/collada/DocumentImporter.cpp @@ -120,7 +120,7 @@ bool DocumentImporter::import() loader.registerExtraDataCallbackHandler(ehandler); /* deselect all to select new objects */ - BKE_view_layer_base_deselect_all(view_layer); + BKE_view_layer_base_deselect_all(CTX_data_scene(mContext), view_layer); std::string mFilename = std::string(this->import_settings->filepath); const std::string encodedFilename = bc_url_encode(mFilename); diff --git a/source/blender/io/collada/ExportSettings.h b/source/blender/io/collada/ExportSettings.h index b3f192fdac6..e4c1b41fdde 100644 --- a/source/blender/io/collada/ExportSettings.h +++ b/source/blender/io/collada/ExportSettings.h @@ -81,7 +81,10 @@ typedef struct ExportSettings { #ifdef __cplusplus } -void bc_get_children(std::vector<Object *> &child_set, Object *ob, ViewLayer *view_layer); +void bc_get_children(std::vector<Object *> &child_set, + Object *ob, + const Scene *scene, + ViewLayer *view_layer); class BCExportSettings { @@ -271,7 +274,7 @@ class BCExportSettings { bool is_export_root(Object *ob) { - return bc_is_base_node(get_export_set(), ob, get_view_layer()); + return bc_is_base_node(get_export_set(), ob, get_scene(), get_view_layer()); } }; diff --git a/source/blender/io/collada/SceneExporter.cpp b/source/blender/io/collada/SceneExporter.cpp index 1b1da110573..b98ff27c89e 100644 --- a/source/blender/io/collada/SceneExporter.cpp +++ b/source/blender/io/collada/SceneExporter.cpp @@ -82,11 +82,13 @@ void SceneExporter::writeNodeList(std::vector<Object *> &child_objects, Object * void SceneExporter::writeNode(Object *ob) { + const Scene *scene = blender_context.get_scene(); ViewLayer *view_layer = blender_context.get_view_layer(); std::vector<Object *> child_objects; - bc_get_children(child_objects, ob, view_layer); - bool can_export = bc_is_in_Export_set(this->export_settings.get_export_set(), ob, view_layer); + bc_get_children(child_objects, ob, scene, view_layer); + bool can_export = bc_is_in_Export_set( + this->export_settings.get_export_set(), ob, scene, view_layer); /* Add associated armature first if available */ bool armature_exported = false; @@ -94,7 +96,7 @@ void SceneExporter::writeNode(Object *ob) if (ob_arm != nullptr) { armature_exported = bc_is_in_Export_set( - this->export_settings.get_export_set(), ob_arm, view_layer); + this->export_settings.get_export_set(), ob_arm, scene, view_layer); if (armature_exported && bc_is_marked(ob_arm)) { writeNode(ob_arm); bc_remove_mark(ob_arm); diff --git a/source/blender/io/collada/collada.cpp b/source/blender/io/collada/collada.cpp index 6bff2601fc3..c33363ef205 100644 --- a/source/blender/io/collada/collada.cpp +++ b/source/blender/io/collada/collada.cpp @@ -58,6 +58,7 @@ int collada_import(bContext *C, ImportSettings *import_settings) int collada_export(bContext *C, ExportSettings *export_settings) { BlenderContext blender_context(C); + const Scene *scene = blender_context.get_scene(); ViewLayer *view_layer = blender_context.get_view_layer(); int includeFilter = OB_REL_NONE; @@ -73,7 +74,7 @@ int collada_export(bContext *C, ExportSettings *export_settings) */ eObjectSet objectSet = (export_settings->selected) ? OB_SET_SELECTED : OB_SET_ALL; export_settings->export_set = BKE_object_relational_superset( - view_layer, objectSet, (eObRelationTypes)includeFilter); + scene, view_layer, objectSet, (eObRelationTypes)includeFilter); int export_count = BLI_linklist_count(export_settings->export_set); |