Delay the creation of the `prim_map` data structure until the last possible moment. This is more efficient in the majority of cases where no Import hooks have been defined. Additionally, it removes the need for locking in the `read_object_data` code path once we implement concurrent loading. Pull Request: https://projects.blender.org/blender/blender/pulls/132360
51 lines
2.0 KiB
C++
51 lines
2.0 KiB
C++
/* SPDX-FileCopyrightText: 2023 Blender Authors
|
|
*
|
|
* SPDX-License-Identifier: GPL-2.0-or-later */
|
|
#pragma once
|
|
|
|
#include <pxr/usd/usd/common.h>
|
|
#include <pxr/usd/usdShade/material.h>
|
|
|
|
struct Depsgraph;
|
|
struct Material;
|
|
struct ReportList;
|
|
|
|
namespace blender::io::usd {
|
|
|
|
struct USDExportParams;
|
|
struct USDImportParams;
|
|
class USDStageReader;
|
|
|
|
/** Ensure classes and type converters necessary for invoking import and export hooks
|
|
* are registered. */
|
|
void register_hook_converters();
|
|
|
|
/** Call the 'on_export' chaser function defined in the registered #USDHook classes. */
|
|
void call_export_hooks(pxr::UsdStageRefPtr stage, Depsgraph *depsgraph, ReportList *reports);
|
|
|
|
/** Call the 'on_material_export' hook functions defined in the registered #USDHook classes. */
|
|
void call_material_export_hooks(pxr::UsdStageRefPtr stage,
|
|
Material *material,
|
|
const pxr::UsdShadeMaterial &usd_material,
|
|
const USDExportParams &export_params,
|
|
ReportList *reports);
|
|
|
|
/** Call the 'on_import' chaser function defined in the registered USDHook classes. */
|
|
void call_import_hooks(USDStageReader *archive, ReportList *reports);
|
|
|
|
/** Returns true if there is a registered #USDHook class that can convert the given material. */
|
|
bool have_material_import_hook(pxr::UsdStageRefPtr stage,
|
|
const pxr::UsdShadeMaterial &usd_material,
|
|
const USDImportParams &import_params,
|
|
ReportList *reports);
|
|
|
|
/** Call the 'on_material_import' hook functions defined in the registered #USDHook classes.
|
|
* Returns true if any of the hooks were successful, false otherwise. */
|
|
bool call_material_import_hooks(pxr::UsdStageRefPtr stage,
|
|
Material *material,
|
|
const pxr::UsdShadeMaterial &usd_material,
|
|
const USDImportParams &import_params,
|
|
ReportList *reports);
|
|
|
|
} // namespace blender::io::usd
|