Blender V5.0
blender::io::usd::USDAbstractWriter Class Referenceabstract

#include <usd_writer_abstract.hh>

Inherits blender::io::AbstractHierarchyWriter.

Inherited by blender::io::usd::USDArmatureWriter, blender::io::usd::USDCameraWriter, blender::io::usd::USDCurvesWriter, blender::io::usd::USDGenericMeshWriter, blender::io::usd::USDHairWriter, blender::io::usd::USDLightWriter, blender::io::usd::USDPointInstancerWriter, blender::io::usd::USDPointsWriter, blender::io::usd::USDTransformWriter, and blender::io::usd::USDVolumeWriter.

Public Member Functions

 USDAbstractWriter (const USDExporterContext &usd_export_context)
void write (HierarchyContext &context) override
virtual bool is_supported (const HierarchyContext *context) const
const pxr::SdfPath & usd_path () const
ReportListreports () const
Public Member Functions inherited from blender::io::AbstractHierarchyWriter
virtual ~AbstractHierarchyWriter ()=default

Protected Member Functions

virtual void do_write (HierarchyContext &context)=0
std::string get_export_file_path () const
pxr::UsdTimeCode get_export_time_code () const
pxr::SdfPath get_material_library_path () const
pxr::SdfPath get_proto_material_root_path (const HierarchyContext &context) const
pxr::UsdShadeMaterial ensure_usd_material_created (const HierarchyContext &context, Material *material) const
pxr::UsdShadeMaterial ensure_usd_material (const HierarchyContext &context, Material *material) const
void write_id_properties (const pxr::UsdPrim &prim, const ID &id, pxr::UsdTimeCode=pxr::UsdTimeCode::Default()) const
void write_user_properties (const pxr::UsdPrim &prim, IDProperty *properties, pxr::UsdTimeCode=pxr::UsdTimeCode::Default()) const
void write_visibility (const HierarchyContext &context, const pxr::UsdTimeCode time, const pxr::UsdGeomImageable &usd_geometry)
virtual bool mark_as_instance (const HierarchyContext &context, const pxr::UsdPrim &prim)
void author_extent (const pxr::UsdGeomBoundable &boundable, const pxr::UsdTimeCode time)
void author_extent (const pxr::UsdGeomBoundable &boundable, const std::optional< Bounds< float3 > > &bounds, const pxr::UsdTimeCode time)
Protected Member Functions inherited from blender::io::AbstractHierarchyWriter
virtual bool check_is_animated (const HierarchyContext &context) const

Protected Attributes

const USDExporterContext usd_export_context_
pxr::UsdUtilsSparseValueWriter usd_value_writer_
bool frame_has_been_written_
bool is_animated_

Additional Inherited Members

Static Protected Member Functions inherited from blender::io::AbstractHierarchyWriter
static bool check_has_physics (const HierarchyContext &context)
static bool check_has_deforming_physics (const HierarchyContext &context)

Detailed Description

Definition at line 33 of file usd_writer_abstract.hh.

Constructor & Destructor Documentation

◆ USDAbstractWriter()

Member Function Documentation

◆ author_extent() [1/2]

void blender::io::usd::USDAbstractWriter::author_extent ( const pxr::UsdGeomBoundable & boundable,
const pxr::UsdTimeCode time )
protected

Compute the bounds for a boundable prim, and author the result as the extent attribute.

Although this method works for any boundable prim, it is preferred to use Blender's own cached bounds when possible.

This method does not author the extentsHint attribute, which is also important to provide. Whereas the extent attribute can only be authored on prims inheriting from UsdGeomBoundable, an extentsHint can be provided on any prim, including scopes. This extentsHint should be authored on every prim in a hierarchy being exported.

Note that this hint is only useful when importing or inspecting layers, and should not be taken into account when computing extents during export.

TODO: also provide method for authoring extentsHint on every prim in a hierarchy.

Definition at line 451 of file usd_writer_abstract.cc.

References blender::io::usd::set_attribute(), and usd_value_writer_.

Referenced by blender::io::usd::USDCurvesWriter::do_write(), blender::io::usd::USDHairWriter::do_write(), blender::io::usd::USDLightWriter::do_write(), blender::io::usd::USDPointsWriter::do_write(), and blender::io::usd::USDVolumeWriter::do_write().

◆ author_extent() [2/2]

void blender::io::usd::USDAbstractWriter::author_extent ( const pxr::UsdGeomBoundable & boundable,
const std::optional< Bounds< float3 > > & bounds,
const pxr::UsdTimeCode time )
protected

Author the extent attribute for a boundable prim given the Blender bounds.

Definition at line 469 of file usd_writer_abstract.cc.

References blender::io::usd::set_attribute(), and usd_value_writer_.

◆ do_write()

◆ ensure_usd_material()

pxr::UsdShadeMaterial blender::io::usd::USDAbstractWriter::ensure_usd_material ( const HierarchyContext & context,
Material * material ) const
protected

◆ ensure_usd_material_created()

pxr::UsdShadeMaterial blender::io::usd::USDAbstractWriter::ensure_usd_material_created ( const HierarchyContext & context,
Material * material ) const
protected

◆ get_export_file_path()

std::string blender::io::usd::USDAbstractWriter::get_export_file_path ( ) const
protected

Definition at line 155 of file usd_writer_abstract.cc.

References usd_export_context_.

◆ get_export_time_code()

◆ get_material_library_path()

pxr::SdfPath blender::io::usd::USDAbstractWriter::get_material_library_path ( ) const
protected

Definition at line 192 of file usd_writer_abstract.cc.

References usd_export_context_.

Referenced by ensure_usd_material_created().

◆ get_proto_material_root_path()

pxr::SdfPath blender::io::usd::USDAbstractWriter::get_proto_material_root_path ( const HierarchyContext & context) const
protected

Definition at line 205 of file usd_writer_abstract.cc.

References usd_export_context_.

Referenced by ensure_usd_material().

◆ is_supported()

bool blender::io::usd::USDAbstractWriter::is_supported ( const HierarchyContext * context) const
virtual

Returns true if the data to be written is actually supported. This would, for example, allow a hypothetical camera writer accept a perspective camera but reject an orthogonal one.

Returning false from a transform writer will prevent the object and all its descendants from being exported. Returning false from a data writer (object data, hair, or particles) will only prevent that data from being written (and thus cause the object to be exported as an Empty).

Reimplemented in blender::io::usd::USDCameraWriter, blender::io::usd::USDGenericMeshWriter, blender::io::usd::USDLightWriter, and blender::io::usd::USDMetaballWriter.

Definition at line 150 of file usd_writer_abstract.cc.

Referenced by blender::io::usd::USDHierarchyIterator::create_data_writer().

◆ mark_as_instance()

bool blender::io::usd::USDAbstractWriter::mark_as_instance ( const HierarchyContext & context,
const pxr::UsdPrim & prim )
protectedvirtual

Turn prim into an instance referencing context.original_export_path. Return true when the instancing was successful, false otherwise.

Reference the original data instead of writing a copy.

Definition at line 293 of file usd_writer_abstract.cc.

References BLI_assert, BLI_assert_msg, CLOG_ERROR, CLOG_WARN, LOG, and usd_export_context_.

Referenced by blender::io::usd::USDTransformWriter::do_write().

◆ reports()

ReportList * blender::io::usd::USDAbstractWriter::reports ( ) const
inline

Get the wmJobWorkerStatus-provided reports list pointer, to use with the BKE_report API.

Definition at line 60 of file usd_writer_abstract.hh.

References usd_export_context_.

Referenced by blender::io::usd::USDCurvesWriter::do_write(), blender::io::usd::USDPointInstancerWriter::do_write(), blender::io::usd::USDVolumeWriter::do_write(), and ensure_usd_material_created().

◆ usd_path()

◆ write()

void blender::io::usd::USDAbstractWriter::write ( HierarchyContext & context)
overridevirtual

◆ write_id_properties()

◆ write_user_properties()

void blender::io::usd::USDAbstractWriter::write_user_properties ( const pxr::UsdPrim & prim,
IDProperty * properties,
pxr::UsdTimeCode time = pxr::UsdTimeCode::Default() ) const
protected

◆ write_visibility()

void blender::io::usd::USDAbstractWriter::write_visibility ( const HierarchyContext & context,
const pxr::UsdTimeCode time,
const pxr::UsdGeomImageable & usd_geometry )
protected

Definition at line 279 of file usd_writer_abstract.cc.

References usd_export_context_, and usd_value_writer_.

Member Data Documentation

◆ frame_has_been_written_

bool blender::io::usd::USDAbstractWriter::frame_has_been_written_
protected

◆ is_animated_

bool blender::io::usd::USDAbstractWriter::is_animated_
protected

◆ usd_export_context_

const USDExporterContext blender::io::usd::USDAbstractWriter::usd_export_context_
protected

◆ usd_value_writer_


The documentation for this class was generated from the following files: