Cleanup: IO: Various cleanups for the AbstractHierarchyIterator
Various non-functional cleanups for the AbstractHierarchyIterator. - Use const in more places - Remove unused headers Pull Request: https://projects.blender.org/blender/blender/pulls/140508
This commit is contained in:
committed by
Jesse Yurkovich
parent
29de34fdab
commit
9cc09611da
@@ -299,7 +299,7 @@ class AbstractHierarchyIterator {
|
||||
void export_graph_clear();
|
||||
|
||||
void visit_object(Object *object, Object *export_parent, bool weak_export);
|
||||
void visit_dupli_object(DupliObject *dupli_object,
|
||||
void visit_dupli_object(const DupliObject *dupli_object,
|
||||
Object *duplicator,
|
||||
const DupliParentFinder &dupli_parent_finder);
|
||||
|
||||
@@ -320,7 +320,7 @@ class AbstractHierarchyIterator {
|
||||
HierarchyContext context_for_object_data(const HierarchyContext *object_context) const;
|
||||
|
||||
/* Convenience wrappers around get_id_name(). */
|
||||
std::string get_object_name(const Object *object);
|
||||
std::string get_object_name(const Object *object) const;
|
||||
std::string get_object_name(const Object *object, const Object *parent);
|
||||
std::string get_object_data_name(const Object *object) const;
|
||||
|
||||
@@ -330,7 +330,7 @@ class AbstractHierarchyIterator {
|
||||
*
|
||||
* The create_func function should be one of the create_XXXX_writer(context) functions declared
|
||||
* below. */
|
||||
EnsuredWriter ensure_writer(HierarchyContext *context, create_writer_func create_func);
|
||||
EnsuredWriter ensure_writer(const HierarchyContext *context, create_writer_func create_func);
|
||||
|
||||
protected:
|
||||
/* Construct a valid path for the export file format. This class concatenates by using '/' as a
|
||||
|
||||
@@ -10,15 +10,13 @@
|
||||
|
||||
#include "BKE_anim_data.hh"
|
||||
#include "BKE_duplilist.hh"
|
||||
#include "BKE_geometry_set.hh"
|
||||
#include "BKE_geometry_set_instances.hh"
|
||||
#include "BKE_key.hh"
|
||||
#include "BKE_modifier.hh"
|
||||
#include "BKE_node_legacy_types.hh"
|
||||
#include "BKE_object.hh"
|
||||
#include "BKE_particle.h"
|
||||
|
||||
#include "BLI_assert.h"
|
||||
#include "BLI_listbase.h"
|
||||
#include "BLI_math_matrix.h"
|
||||
#include "BLI_set.hh"
|
||||
#include "BLI_string_utils.hh"
|
||||
@@ -26,7 +24,6 @@
|
||||
#include "DNA_ID.h"
|
||||
#include "DNA_layer_types.h"
|
||||
#include "DNA_modifier_types.h"
|
||||
#include "DNA_node_types.h"
|
||||
#include "DNA_object_types.h"
|
||||
#include "DNA_particle_types.h"
|
||||
#include "DNA_rigidbody_types.h"
|
||||
@@ -322,7 +319,7 @@ void AbstractHierarchyIterator::export_graph_construct()
|
||||
if (!duplilist.is_empty()) {
|
||||
DupliParentFinder dupli_parent_finder;
|
||||
|
||||
for (DupliObject &dupli_object : duplilist) {
|
||||
for (const DupliObject &dupli_object : duplilist) {
|
||||
PersistentID persistent_id(&dupli_object);
|
||||
if (!should_visit_dupli_object(&dupli_object)) {
|
||||
continue;
|
||||
@@ -330,7 +327,7 @@ void AbstractHierarchyIterator::export_graph_construct()
|
||||
dupli_parent_finder.insert(&dupli_object);
|
||||
}
|
||||
|
||||
for (DupliObject &dupli_object : duplilist) {
|
||||
for (const DupliObject &dupli_object : duplilist) {
|
||||
if (!should_visit_dupli_object(&dupli_object)) {
|
||||
continue;
|
||||
}
|
||||
@@ -469,7 +466,7 @@ ObjectIdentifier AbstractHierarchyIterator::determine_graph_index_object(
|
||||
return ObjectIdentifier::for_real_object(context->export_parent);
|
||||
}
|
||||
|
||||
void AbstractHierarchyIterator::visit_dupli_object(DupliObject *dupli_object,
|
||||
void AbstractHierarchyIterator::visit_dupli_object(const DupliObject *dupli_object,
|
||||
Object *duplicator,
|
||||
const DupliParentFinder &dupli_parent_finder)
|
||||
{
|
||||
@@ -648,12 +645,15 @@ void AbstractHierarchyIterator::make_writers(const HierarchyContext *parent_cont
|
||||
return;
|
||||
}
|
||||
|
||||
bool has_point_instance_ancestor = false;
|
||||
if (parent_context &&
|
||||
(parent_context->is_point_instance || parent_context->has_point_instance_ancestor))
|
||||
{
|
||||
has_point_instance_ancestor = true;
|
||||
}
|
||||
|
||||
for (HierarchyContext *context : *children) {
|
||||
if (parent_context) {
|
||||
if (parent_context->is_point_instance || parent_context->has_point_instance_ancestor) {
|
||||
context->has_point_instance_ancestor = true;
|
||||
}
|
||||
}
|
||||
context->has_point_instance_ancestor = has_point_instance_ancestor;
|
||||
|
||||
/* 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);
|
||||
@@ -787,7 +787,7 @@ void AbstractHierarchyIterator::make_writers_particle_systems(
|
||||
}
|
||||
}
|
||||
|
||||
std::string AbstractHierarchyIterator::get_object_name(const Object *object)
|
||||
std::string AbstractHierarchyIterator::get_object_name(const Object *object) const
|
||||
{
|
||||
return get_id_name(&object->id);
|
||||
}
|
||||
@@ -800,7 +800,7 @@ std::string AbstractHierarchyIterator::get_object_name(const Object *object, con
|
||||
|
||||
std::string AbstractHierarchyIterator::get_object_data_name(const Object *object) const
|
||||
{
|
||||
ID *object_data = static_cast<ID *>(object->data);
|
||||
const ID *object_data = static_cast<ID *>(object->data);
|
||||
return get_id_name(object_data);
|
||||
}
|
||||
|
||||
@@ -811,7 +811,7 @@ AbstractHierarchyWriter *AbstractHierarchyIterator::get_writer(
|
||||
}
|
||||
|
||||
EnsuredWriter AbstractHierarchyIterator::ensure_writer(
|
||||
HierarchyContext *context, AbstractHierarchyIterator::create_writer_func create_func)
|
||||
const HierarchyContext *context, AbstractHierarchyIterator::create_writer_func create_func)
|
||||
{
|
||||
AbstractHierarchyWriter *writer = get_writer(context->export_path);
|
||||
if (writer != nullptr) {
|
||||
|
||||
Reference in New Issue
Block a user