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:
authorCampbell Barton <ideasman42@gmail.com>2020-10-10 10:19:55 +0300
committerCampbell Barton <ideasman42@gmail.com>2020-10-10 14:04:51 +0300
commit2abfcebb0eb7989e3d1e7d03f37ecf5c088210af (patch)
treee7a1ad5912b4661d4ece743f4f7fd86e6bf4d3c4 /source/blender/io/common/intern
parentc735aca42e9f5961fec7e5d5fc196b5bd6b85f56 (diff)
Cleanup: use C comments for descriptive text
Follow our code style guide by using C-comments for text descriptions.
Diffstat (limited to 'source/blender/io/common/intern')
-rw-r--r--source/blender/io/common/intern/abstract_hierarchy_iterator.cc71
-rw-r--r--source/blender/io/common/intern/abstract_hierarchy_iterator_test.cc34
-rw-r--r--source/blender/io/common/intern/object_identifier_test.cc4
3 files changed, 55 insertions, 54 deletions
diff --git a/source/blender/io/common/intern/abstract_hierarchy_iterator.cc b/source/blender/io/common/intern/abstract_hierarchy_iterator.cc
index 6e763c29631..6077fc89b91 100644
--- a/source/blender/io/common/intern/abstract_hierarchy_iterator.cc
+++ b/source/blender/io/common/intern/abstract_hierarchy_iterator.cc
@@ -57,7 +57,7 @@ bool HierarchyContext::operator<(const HierarchyContext &other) const
return object < other.object;
}
if (duplicator != nullptr && duplicator == other.duplicator) {
- // Only resort to string comparisons when both objects are created by the same duplicator.
+ /* Only resort to string comparisons when both objects are created by the same duplicator. */
return export_name < other.export_name;
}
@@ -291,16 +291,16 @@ void AbstractHierarchyIterator::export_graph_construct()
object,
DEG_ITER_OBJECT_FLAG_LINKED_DIRECTLY |
DEG_ITER_OBJECT_FLAG_LINKED_VIA_SET) {
- // Non-instanced objects always have their object-parent as export-parent.
+ /* Non-instanced objects always have their object-parent as export-parent. */
const bool weak_export = mark_as_weak_export(object);
visit_object(object, object->parent, weak_export);
if (weak_export) {
- // If a duplicator shouldn't be exported, its duplilist also shouldn't be.
+ /* If a duplicator shouldn't be exported, its duplilist also shouldn't be. */
continue;
}
- // Export the duplicated objects instanced by this object.
+ /* Export the duplicated objects instanced by this object. */
ListBase *lb = object_duplilist(depsgraph_, scene, object);
if (lb) {
DupliParentFinder dupli_parent_finder;
@@ -328,29 +328,29 @@ void AbstractHierarchyIterator::export_graph_construct()
void AbstractHierarchyIterator::connect_loose_objects()
{
- // Find those objects whose parent is not part of the export graph; these
- // objects would be skipped when traversing the graph as a hierarchy.
- // These objects will have to be re-attached to some parent object in order to
- // fit into the hierarchy.
+ /* Find those objects whose parent is not part of the export graph; these
+ * objects would be skipped when traversing the graph as a hierarchy.
+ * These objects will have to be re-attached to some parent object in order to
+ * fit into the hierarchy. */
ExportGraph loose_objects_graph = export_graph_;
for (const ExportGraph::value_type &map_iter : export_graph_) {
for (const HierarchyContext *child : map_iter.second) {
- // An object that is marked as a child of another object is not considered 'loose'.
+ /* An object that is marked as a child of another object is not considered 'loose'. */
ObjectIdentifier child_oid = ObjectIdentifier::for_hierarchy_context(child);
loose_objects_graph.erase(child_oid);
}
}
- // The root of the hierarchy is always found, so it's never considered 'loose'.
+ /* The root of the hierarchy is always found, so it's never considered 'loose'. */
loose_objects_graph.erase(ObjectIdentifier::for_graph_root());
- // Iterate over the loose objects and connect them to their export parent.
+ /* Iterate over the loose objects and connect them to their export parent. */
for (const ExportGraph::value_type &map_iter : loose_objects_graph) {
const ObjectIdentifier &graph_key = map_iter.first;
Object *object = graph_key.object;
while (true) {
- // Loose objects will all be real objects, as duplicated objects always have
- // their duplicator or other exported duplicated object as ancestor.
+ /* Loose objects will all be real objects, as duplicated objects always have
+ * their duplicator or other exported duplicated object as ancestor. */
ExportGraph::iterator found_parent_iter = export_graph_.find(
ObjectIdentifier::for_real_object(object->parent));
@@ -358,8 +358,8 @@ void AbstractHierarchyIterator::connect_loose_objects()
if (found_parent_iter != export_graph_.end()) {
break;
}
- // 'object->parent' will never be nullptr here, as the export graph contains the
- // root as nullptr and thus will cause a break above.
+ /* 'object->parent' will never be nullptr here, as the export graph contains the
+ * root as nullptr and thus will cause a break above. */
BLI_assert(object->parent != nullptr);
object = object->parent;
@@ -383,7 +383,7 @@ static bool remove_weak_subtrees(const HierarchyContext *context,
all_is_weak &= child_tree_is_weak;
if (child_tree_is_weak) {
- // This subtree is all weak, so we can remove it from the current object's children.
+ /* This subtree is all weak, so we can remove it from the current object's children. */
clean_graph[map_key].erase(child_context);
delete child_context;
}
@@ -391,7 +391,7 @@ static bool remove_weak_subtrees(const HierarchyContext *context,
}
if (all_is_weak) {
- // This node and all its children are weak, so it can be removed from the export graph.
+ /* This node and all its children are weak, so it can be removed from the export graph. */
clean_graph.erase(map_key);
}
@@ -400,7 +400,7 @@ static bool remove_weak_subtrees(const HierarchyContext *context,
void AbstractHierarchyIterator::export_graph_prune()
{
- // Take a copy of the map so that we can modify while recursing.
+ /* Take a copy of the map so that we can modify while recursing. */
ExportGraph unpruned_export_graph = export_graph_;
remove_weak_subtrees(HierarchyContext::root(), export_graph_, unpruned_export_graph);
}
@@ -435,14 +435,14 @@ void AbstractHierarchyIterator::visit_object(Object *object,
ExportGraph::key_type graph_index = determine_graph_index_object(context);
context_update_for_graph_index(context, graph_index);
- // Store this HierarchyContext as child of the export parent.
+ /* Store this HierarchyContext as child of the export parent. */
export_graph_[graph_index].insert(context);
- // Create an empty entry for this object to indicate it is part of the export. This will be used
- // by connect_loose_objects(). Having such an "indicator" will make it possible to do an O(log n)
- // check on whether an object is part of the export, rather than having to check all objects in
- // the map. Note that it's not possible to simply search for (object->parent, nullptr), as the
- // object's parent in Blender may not be the same as its export-parent.
+ /* Create an empty entry for this object to indicate it is part of the export. This will be used
+ * by connect_loose_objects(). Having such an "indicator" will make it possible to do an O(log n)
+ * check on whether an object is part of the export, rather than having to check all objects in
+ * the map. Note that it's not possible to simply search for (object->parent, nullptr), as the
+ * object's parent in Blender may not be the same as its export-parent. */
ExportGraph::key_type object_key = ObjectIdentifier::for_real_object(object);
if (export_graph_.find(object_key) == export_graph_.end()) {
export_graph_[object_key] = ExportChildren();
@@ -471,7 +471,7 @@ void AbstractHierarchyIterator::visit_dupli_object(DupliObject *dupli_object,
copy_m4_m4(context->matrix_world, dupli_object->mat);
- // Construct export name for the dupli-instance.
+ /* Construct export name for the dupli-instance. */
std::stringstream export_name_stream;
export_name_stream << get_object_name(context->object) << "-"
<< context->persistent_id.as_object_name_suffix();
@@ -500,7 +500,7 @@ AbstractHierarchyIterator::ExportGraph::key_type AbstractHierarchyIterator::
void AbstractHierarchyIterator::context_update_for_graph_index(
HierarchyContext *context, const ExportGraph::key_type &graph_index) const
{
- // Update the HierarchyContext so that it is consistent with the graph index.
+ /* Update the HierarchyContext so that it is consistent with the graph index. */
context->export_parent = graph_index.object;
if (context->export_parent != context->object->parent) {
/* The parent object in Blender is NOT used as the export parent. This means
@@ -550,7 +550,7 @@ void AbstractHierarchyIterator::determine_duplication_references(
const ExportPathMap::const_iterator &it = duplisource_export_path_.find(source_id);
if (it == duplisource_export_path_.end()) {
- // The original was not found, so mark this instance as "the original".
+ /* The original was not found, so mark this instance as "the original". */
context->mark_as_not_instanced();
duplisource_export_path_[source_id] = context->export_path;
}
@@ -563,7 +563,7 @@ void AbstractHierarchyIterator::determine_duplication_references(
const ExportPathMap::const_iterator &it = duplisource_export_path_.find(source_data_id);
if (it == duplisource_export_path_.end()) {
- // The original was not found, so mark this instance as "original".
+ /* The original was not found, so mark this instance as "original". */
std::string data_path = get_object_data_path(context);
context->mark_as_not_instanced();
duplisource_export_path_[source_id] = context->export_path;
@@ -588,19 +588,19 @@ void AbstractHierarchyIterator::make_writers(const HierarchyContext *parent_cont
}
for (HierarchyContext *context : graph_children(parent_context)) {
- // Update the context so that it is correct for this parent-child relation.
+ /* Update the context so that it is correct for this parent-child relation. */
copy_m4_m4(context->parent_matrix_inv_world, parent_matrix_inv_world);
if (parent_context != nullptr) {
context->higher_up_export_path = parent_context->export_path;
}
- // Get or create the transform writer.
+ /* Get or create the transform writer. */
EnsuredWriter transform_writer = ensure_writer(
context, &AbstractHierarchyIterator::create_transform_writer);
if (!transform_writer) {
- // Unable to export, so there is nothing to attach any children to; just abort this entire
- // branch of the export hierarchy.
+ /* Unable to export, so there is nothing to attach any children to; just abort this entire
+ * branch of the export hierarchy. */
return;
}
@@ -617,11 +617,12 @@ void AbstractHierarchyIterator::make_writers(const HierarchyContext *parent_cont
make_writer_object_data(context);
}
- // Recurse into this object's children.
+ /* Recurse into this object's children. */
make_writers(context);
}
- // TODO(Sybren): iterate over all unused writers and call unused_during_iteration() or something.
+ /* TODO(Sybren): iterate over all unused writers and call unused_during_iteration() or something.
+ */
}
HierarchyContext AbstractHierarchyIterator::context_for_object_data(
@@ -750,7 +751,7 @@ bool AbstractHierarchyIterator::mark_as_weak_export(const Object * /*object*/) c
}
bool AbstractHierarchyIterator::should_visit_dupli_object(const DupliObject *dupli_object) const
{
- // Removing dupli_object->no_draw hides things like custom bone shapes.
+ /* Removing dupli_object->no_draw hides things like custom bone shapes. */
return !dupli_object->no_draw;
}
diff --git a/source/blender/io/common/intern/abstract_hierarchy_iterator_test.cc b/source/blender/io/common/intern/abstract_hierarchy_iterator_test.cc
index 27196994a3c..6e4509afd30 100644
--- a/source/blender/io/common/intern/abstract_hierarchy_iterator_test.cc
+++ b/source/blender/io/common/intern/abstract_hierarchy_iterator_test.cc
@@ -145,7 +145,7 @@ TEST_F(AbstractHierarchyIteratorTest, ExportHierarchyTest)
iterator->iterate_and_write();
- // Mapping from object name to set of export paths.
+ /* Mapping from object name to set of export paths. */
used_writers expected_transforms = {
{"OBCamera", {"/Camera"}},
{"OBDupli1", {"/Dupli1"}},
@@ -196,12 +196,12 @@ TEST_F(AbstractHierarchyIteratorTest, ExportHierarchyTest)
EXPECT_EQ(expected_data, iterator->data_writers);
- // The scene has no hair or particle systems.
+ /* The scene has no hair or particle systems. */
EXPECT_EQ(0, iterator->hair_writers.size());
EXPECT_EQ(0, iterator->particle_writers.size());
- // On the second iteration, everything should be written as well.
- // This tests the default value of iterator->export_subset_.
+ /* On the second iteration, everything should be written as well.
+ * This tests the default value of iterator->export_subset_. */
iterator->transform_writers.clear();
iterator->data_writers.clear();
iterator->iterate_and_write();
@@ -211,8 +211,8 @@ TEST_F(AbstractHierarchyIteratorTest, ExportHierarchyTest)
TEST_F(AbstractHierarchyIteratorTest, ExportSubsetTest)
{
- // The scene has no hair or particle systems, and this is already covered by ExportHierarchyTest,
- // so not included here. Update this test when hair & particle systems are included.
+ /* The scene has no hair or particle systems, and this is already covered by ExportHierarchyTest,
+ * so not included here. Update this test when hair & particle systems are included. */
/* Load the test blend file. */
if (!blendfile_load("usd/usd_hierarchy_export_test.blend")) {
@@ -221,7 +221,7 @@ TEST_F(AbstractHierarchyIteratorTest, ExportSubsetTest)
depsgraph_create(DAG_EVAL_RENDER);
iterator_create();
- // Mapping from object name to set of export paths.
+ /* Mapping from object name to set of export paths. */
used_writers expected_transforms = {
{"OBCamera", {"/Camera"}},
{"OBDupli1", {"/Dupli1"}},
@@ -269,8 +269,8 @@ TEST_F(AbstractHierarchyIteratorTest, ExportSubsetTest)
{"OBParentOfDupli2", {"/ParentOfDupli2/Icosphere"}},
};
- // Even when only asking an export of transforms, on the first frame everything should be
- // exported.
+ /* Even when only asking an export of transforms, on the first frame everything should be
+ * exported. */
{
ExportSubset export_subset = {0};
export_subset.transforms = true;
@@ -281,20 +281,20 @@ TEST_F(AbstractHierarchyIteratorTest, ExportSubsetTest)
EXPECT_EQ(expected_transforms, iterator->transform_writers);
EXPECT_EQ(expected_data, iterator->data_writers);
- // Clear data to prepare for the next iteration.
+ /* Clear data to prepare for the next iteration. */
iterator->transform_writers.clear();
iterator->data_writers.clear();
- // Second iteration, should only write transforms now.
+ /* Second iteration, should only write transforms now. */
iterator->iterate_and_write();
EXPECT_EQ(expected_transforms, iterator->transform_writers);
EXPECT_EQ(0, iterator->data_writers.size());
- // Clear data to prepare for the next iteration.
+ /* Clear data to prepare for the next iteration. */
iterator->transform_writers.clear();
iterator->data_writers.clear();
- // Third iteration, should only write data now.
+ /* Third iteration, should only write data now. */
{
ExportSubset export_subset = {0};
export_subset.transforms = false;
@@ -305,11 +305,11 @@ TEST_F(AbstractHierarchyIteratorTest, ExportSubsetTest)
EXPECT_EQ(0, iterator->transform_writers.size());
EXPECT_EQ(expected_data, iterator->data_writers);
- // Clear data to prepare for the next iteration.
+ /* Clear data to prepare for the next iteration. */
iterator->transform_writers.clear();
iterator->data_writers.clear();
- // Fourth iteration, should export everything now.
+ /* Fourth iteration, should export everything now. */
{
ExportSubset export_subset = {0};
export_subset.transforms = true;
@@ -343,7 +343,7 @@ TEST_F(AbstractHierarchyIteratorInvisibleTest, ExportInvisibleTest)
iterator->iterate_and_write();
- // Mapping from object name to set of export paths.
+ /* Mapping from object name to set of export paths. */
used_writers expected_transforms = {{"OBInvisibleAnimatedCube", {"/InvisibleAnimatedCube"}},
{"OBInvisibleCube", {"/InvisibleCube"}},
{"OBVisibleCube", {"/VisibleCube"}}};
@@ -355,7 +355,7 @@ TEST_F(AbstractHierarchyIteratorInvisibleTest, ExportInvisibleTest)
EXPECT_EQ(expected_data, iterator->data_writers);
- // The scene has no hair or particle systems.
+ /* The scene has no hair or particle systems. */
EXPECT_EQ(0, iterator->hair_writers.size());
EXPECT_EQ(0, iterator->particle_writers.size());
}
diff --git a/source/blender/io/common/intern/object_identifier_test.cc b/source/blender/io/common/intern/object_identifier_test.cc
index 2b565876f22..30e1e43d076 100644
--- a/source/blender/io/common/intern/object_identifier_test.cc
+++ b/source/blender/io/common/intern/object_identifier_test.cc
@@ -175,7 +175,7 @@ TEST_F(ObjectIdentifierOrderTest, map_copy_and_update)
AbstractHierarchyIterator::ExportGraph graph_copy = graph;
EXPECT_EQ(5, graph_copy.size());
- // Updating a value in a copy should not update the original.
+ /* Updating a value in a copy should not update the original. */
HierarchyContext ctx1;
HierarchyContext ctx2;
ctx1.object = fake_pointer(1);
@@ -184,7 +184,7 @@ TEST_F(ObjectIdentifierOrderTest, map_copy_and_update)
graph_copy[id_root].insert(&ctx1);
EXPECT_EQ(0, graph[id_root].size());
- // Deleting a key in the copy should not update the original.
+ /* Deleting a key in the copy should not update the original. */
graph_copy.erase(id_dupli_c);
EXPECT_EQ(4, graph_copy.size());
EXPECT_EQ(5, graph.size());