Files
test2/source/blender/io/wavefront_obj/IO_wavefront_obj.cc
Devashish Lal 4b884f737c Geometry Nodes: OBJ Import Node
Add a node similar to the STL import node (d1455c4138) that
imports OBJ files, including both meshes and curves. The output consists
of a geometry instance for each mesh/curve in the file.

There are a few improvements to address in the future: Currently the node
has no inputs besides the file path. Options may be exposed in the future.
Materials are also not imported yet, because creating material data-blocks
during evaluation may not be trivial.

This is part of a GSoC project:
https://devtalk.blender.org/t/gsoc-2024-geometry-nodes-file-import-nodes/34482

Pull Request: https://projects.blender.org/blender/blender/pulls/123967
2024-07-08 20:20:38 +02:00

48 lines
1.3 KiB
C++

/* SPDX-FileCopyrightText: 2023 Blender Authors
*
* SPDX-License-Identifier: GPL-2.0-or-later */
/** \file
* \ingroup obj
*/
#include <iostream>
#include "BLI_path_util.h"
#include "BLI_timeit.hh"
#include "IO_wavefront_obj.hh"
#include "obj_exporter.hh"
#include "obj_importer.hh"
using namespace blender::timeit;
static void report_duration(const char *job, const TimePoint &start_time, const char *path)
{
Nanoseconds duration = Clock::now() - start_time;
std::cout << "OBJ " << job << " of '" << BLI_path_basename(path) << "' took ";
print_duration(duration);
std::cout << '\n';
}
void OBJ_export(bContext *C, const OBJExportParams *export_params)
{
TimePoint start_time = Clock::now();
blender::io::obj::exporter_main(C, *export_params);
report_duration("export", start_time, export_params->filepath);
}
void OBJ_import(bContext *C, const OBJImportParams *import_params)
{
TimePoint start_time = Clock::now();
blender::io::obj::importer_main(C, *import_params);
report_duration("import", start_time, import_params->filepath);
}
void OBJ_import_geometries(const OBJImportParams *import_params,
blender::Vector<blender::bke::GeometrySet> &geometries)
{
blender::io::obj::importer_geometry(*import_params, geometries);
}