Loading...
Searching...
No Matches
PcpDynamicFileFormatInterface Class Referenceabstract

Interface mixin that can be included by SdfFileFormat subclasses to enable dynamic file format argument generation for a file format plugin. More...

#include <dynamicFileFormatInterface.h>

Public Member Functions

virtual PCP_API ~PcpDynamicFileFormatInterface ()
 Empty virtual destructor to prevent build errors with some compilers.
 
virtual PCP_API void ComposeFieldsForFileFormatArguments (const std::string &assetPath, const PcpDynamicFileFormatContext &context, SdfFileFormat::FileFormatArguments *args, VtValue *dependencyContextData) const =0
 Derived classes must implement this function to compose prim metadata fields and/or attribute default values using the given context and use them to generate file format arguments for the layer at assetPath.
 
virtual PCP_API bool CanFieldChangeAffectFileFormatArguments (const TfToken &field, const VtValue &oldValue, const VtValue &newValue, const VtValue &dependencyContextData) const
 Return true if the change to scene description of the field named field can affect the dynamic file format arguments generated by ComposeFieldsForFileFormatArguments.
 
virtual PCP_API bool CanAttributeDefaultValueChangeAffectFileFormatArguments (const TfToken &attributeName, const VtValue &oldValue, const VtValue &newValue, const VtValue &dependencyContextData) const
 Return true if the change to scene description of the default field for the attribute named attributeName can affect the dynamic file format arguments generated by ComposeFieldsForFileFormatArguments.
 

Detailed Description

Interface mixin that can be included by SdfFileFormat subclasses to enable dynamic file format argument generation for a file format plugin.

When prim index composition encounters a payload to an asset of a file format that implements this interface, it will call ComposeFieldsForFileFormatArguments to generate arguments from the current composition context at which the payload is being added. The derived file format is on the hook for using the provided context to compute any prim field values it needs and generate the relevant file format arguments for its content.

Definition at line 47 of file dynamicFileFormatInterface.h.

Constructor & Destructor Documentation

◆ ~PcpDynamicFileFormatInterface()

virtual PCP_API ~PcpDynamicFileFormatInterface ( )
virtual

Empty virtual destructor to prevent build errors with some compilers.

Member Function Documentation

◆ CanAttributeDefaultValueChangeAffectFileFormatArguments()

virtual PCP_API bool CanAttributeDefaultValueChangeAffectFileFormatArguments ( const TfToken attributeName,
const VtValue oldValue,
const VtValue newValue,
const VtValue dependencyContextData 
) const
virtual

Return true if the change to scene description of the default field for the attribute named attributeName can affect the dynamic file format arguments generated by ComposeFieldsForFileFormatArguments.

This function will be called during change processing to determine whether a change to a attribute's default value affects the dynamic file format arguments of a payload that a prim index depends on.

The default implementation always returns true, indicating that any default value change for a passed in attribute will require file format arguments to be recomputed. Derived classes can override this function to be more discerning about which changes would truly cause a file format argument update, reducing the number of unnecessary recompositions of dynamic payloads using its file format.

oldValue and newValue contain the old and new values of the default value field. dependencyContextData is the arbitrary typed data that was generated by the call to ComposeFieldsForFileFormatArguments when the payload arc was computed.

◆ CanFieldChangeAffectFileFormatArguments()

virtual PCP_API bool CanFieldChangeAffectFileFormatArguments ( const TfToken field,
const VtValue oldValue,
const VtValue newValue,
const VtValue dependencyContextData 
) const
virtual

Return true if the change to scene description of the field named field can affect the dynamic file format arguments generated by ComposeFieldsForFileFormatArguments.

This function will be called during change processing to determine whether a change to a field affects the dynamic file format arguments of a payload that a prim index depends on.

The default implementation always returns true, indicating that any value change for a passed in field will require file format arguments to be recomputed. Derived classes can override this function to be more discerning about which changes would truly cause a file format argument update, reducing the number of unnecessary recompositions of dynamic payloads using its file format.

oldValue and newValue contain the old and new values of the field. dependencyContextData is the arbitrary typed data that was generated by the call to ComposeFieldsForFileFormatArguments when the payload arc was computed.

◆ ComposeFieldsForFileFormatArguments()

virtual PCP_API void ComposeFieldsForFileFormatArguments ( const std::string &  assetPath,
const PcpDynamicFileFormatContext context,
SdfFileFormat::FileFormatArguments args,
VtValue dependencyContextData 
) const
pure virtual

Derived classes must implement this function to compose prim metadata fields and/or attribute default values using the given context and use them to generate file format arguments for the layer at assetPath.

The context provides the methods for composing prim metadata field values and attribute default values at the current point in prim index composition which can be used to generate the relevant file format arguments. In the implementation, these arguments need to be added to the set of file format arguments provided by args.

Additionally, implementations can output dependencyContextData of any value type that will then be passed back in to calls to CanFieldChangeAffectFileFormatArguments and CanAttributeDefaultValueChangeAffectFileFormatArguments during change processing. This can be used to provide more that context that is specific to the file format when determining whether a field change really does affect the arguments generated by a particular call to this function.


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