Cleanup: Alembic: Remove some unused utility APIs
These have long been unused and they will not be used in the future either. Pull Request: https://projects.blender.org/blender/blender/pulls/146863
This commit is contained in:
committed by
Jesse Yurkovich
parent
ea43fa08e1
commit
fd3da2004c
@@ -20,30 +20,12 @@
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include "DNA_object_types.h"
|
||||
|
||||
#include "BLI_time.h"
|
||||
|
||||
using Alembic::Abc::IV3fArrayProperty;
|
||||
using Alembic::Abc::PropertyHeader;
|
||||
using Alembic::Abc::V3fArraySamplePtr;
|
||||
|
||||
namespace blender::io::alembic {
|
||||
|
||||
std::string get_id_name(const Object *const ob)
|
||||
{
|
||||
if (!ob) {
|
||||
return "";
|
||||
}
|
||||
|
||||
return get_id_name(&ob->id);
|
||||
}
|
||||
|
||||
std::string get_id_name(const ID *const id)
|
||||
{
|
||||
return get_valid_abc_name(id->name + 2);
|
||||
}
|
||||
|
||||
std::string get_valid_abc_name(const char *name)
|
||||
{
|
||||
std::string name_string(name);
|
||||
@@ -53,24 +35,6 @@ std::string get_valid_abc_name(const char *name)
|
||||
return name_string;
|
||||
}
|
||||
|
||||
std::string get_object_dag_path_name(const Object *const ob, Object *dupli_parent)
|
||||
{
|
||||
std::string name = get_id_name(ob);
|
||||
|
||||
Object *p = ob->parent;
|
||||
|
||||
while (p) {
|
||||
name = get_id_name(p) + "/" + name;
|
||||
p = p->parent;
|
||||
}
|
||||
|
||||
if (dupli_parent && (ob != dupli_parent)) {
|
||||
name = get_id_name(dupli_parent) + "/" + name;
|
||||
}
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
Imath::M44d convert_matrix_datatype(const float mat[4][4])
|
||||
{
|
||||
Imath::M44d m;
|
||||
@@ -239,39 +203,4 @@ AbcObjectReader *create_reader(const Alembic::AbcGeom::IObject &object, ImportSe
|
||||
return reader;
|
||||
}
|
||||
|
||||
/* ********************** */
|
||||
|
||||
ScopeTimer::ScopeTimer(const char *message) : m_message(message), m_start(BLI_time_now_seconds())
|
||||
{
|
||||
}
|
||||
|
||||
ScopeTimer::~ScopeTimer()
|
||||
{
|
||||
fprintf(stderr, "%s: %fs\n", m_message, BLI_time_now_seconds() - m_start);
|
||||
}
|
||||
|
||||
/* ********************** */
|
||||
|
||||
std::string SimpleLogger::str() const
|
||||
{
|
||||
return m_stream.str();
|
||||
}
|
||||
|
||||
void SimpleLogger::clear()
|
||||
{
|
||||
m_stream.clear();
|
||||
m_stream.str("");
|
||||
}
|
||||
|
||||
std::ostringstream &SimpleLogger::stream()
|
||||
{
|
||||
return m_stream;
|
||||
}
|
||||
|
||||
std::ostream &operator<<(std::ostream &os, const SimpleLogger &logger)
|
||||
{
|
||||
os << logger.str();
|
||||
return os;
|
||||
}
|
||||
|
||||
} // namespace blender::io::alembic
|
||||
|
||||
@@ -33,19 +33,7 @@ namespace blender::io::alembic {
|
||||
class AbcObjectReader;
|
||||
struct ImportSettings;
|
||||
|
||||
std::string get_id_name(const ID *const id);
|
||||
std::string get_id_name(const Object *const ob);
|
||||
std::string get_valid_abc_name(const char *name);
|
||||
/**
|
||||
* \brief get_object_dag_path_name returns the name under which the object
|
||||
* will be exported in the Alembic file. It is of the form
|
||||
* "[../grandparent/]parent/object" if dupli_parent is NULL, or
|
||||
* "dupli_parent/[../grandparent/]parent/object" otherwise.
|
||||
* \param ob:
|
||||
* \param dupli_parent:
|
||||
* \return
|
||||
*/
|
||||
std::string get_object_dag_path_name(const Object *const ob, Object *dupli_parent);
|
||||
|
||||
/* Convert from float to Alembic matrix representations. Does NOT convert from Z-up to Y-up. */
|
||||
Imath::M44d convert_matrix_datatype(const float mat[4][4]);
|
||||
@@ -123,62 +111,4 @@ std::optional<SampleInterpolationSettings> get_sample_interpolation_settings(
|
||||
|
||||
AbcObjectReader *create_reader(const Alembic::AbcGeom::IObject &object, ImportSettings &settings);
|
||||
|
||||
/* *************************** */
|
||||
|
||||
#undef ABC_DEBUG_TIME
|
||||
|
||||
class ScopeTimer {
|
||||
const char *m_message;
|
||||
double m_start;
|
||||
|
||||
public:
|
||||
ScopeTimer(const char *message);
|
||||
~ScopeTimer();
|
||||
};
|
||||
|
||||
#ifdef ABC_DEBUG_TIME
|
||||
# define SCOPE_TIMER(message) ScopeTimer prof(message)
|
||||
#else
|
||||
# define SCOPE_TIMER(message)
|
||||
#endif
|
||||
|
||||
/* *************************** */
|
||||
|
||||
/**
|
||||
* Utility class whose purpose is to more easily log related information. An
|
||||
* instance of the SimpleLogger can be created in any context, and will hold a
|
||||
* copy of all the strings passed to its output stream.
|
||||
*
|
||||
* Different instances of the class may be accessed from different threads,
|
||||
* although accessing the same instance from different threads will lead to race
|
||||
* conditions.
|
||||
*/
|
||||
class SimpleLogger {
|
||||
std::ostringstream m_stream;
|
||||
|
||||
public:
|
||||
/**
|
||||
* Return a copy of the string contained in the SimpleLogger's stream.
|
||||
*/
|
||||
std::string str() const;
|
||||
|
||||
/**
|
||||
* Remove the bits set on the SimpleLogger's stream and clear its string.
|
||||
*/
|
||||
void clear();
|
||||
|
||||
/**
|
||||
* Return a reference to the SimpleLogger's stream, in order to e.g. push
|
||||
* content into it.
|
||||
*/
|
||||
std::ostringstream &stream();
|
||||
};
|
||||
|
||||
#define ABC_LOG(logger) logger.stream()
|
||||
|
||||
/**
|
||||
* Pass the content of the logger's stream to the specified std::ostream.
|
||||
*/
|
||||
std::ostream &operator<<(std::ostream &os, const SimpleLogger &logger);
|
||||
|
||||
} // namespace blender::io::alembic
|
||||
|
||||
@@ -489,7 +489,6 @@ static void sort_readers(blender::MutableSpan<AbcObjectReader *> readers)
|
||||
static void import_file(ImportJobData *data, const char *filepath, float progress_factor)
|
||||
{
|
||||
blender::timeit::TimePoint start_time = blender::timeit::Clock::now();
|
||||
SCOPE_TIMER("Alembic import, objects reading and creation");
|
||||
|
||||
ArchiveReader *archive = ArchiveReader::get(data->bmain, {filepath});
|
||||
|
||||
@@ -646,8 +645,6 @@ static void import_startjob(void *user_data, wmJobWorkerStatus *worker_status)
|
||||
|
||||
static void import_endjob(void *user_data)
|
||||
{
|
||||
SCOPE_TIMER("Alembic import, cleanup");
|
||||
|
||||
ImportJobData *data = static_cast<ImportJobData *>(user_data);
|
||||
|
||||
/* Delete objects on cancellation. */
|
||||
|
||||
Reference in New Issue
Block a user