HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
dynamicFileFormatInterface.h
Go to the documentation of this file.
1 //
2 // Copyright 2019 Pixar
3 //
4 // Licensed under the Apache License, Version 2.0 (the "Apache License")
5 // with the following modification; you may not use this file except in
6 // compliance with the Apache License and the following modification to it:
7 // Section 6. Trademarks. is deleted and replaced with:
8 //
9 // 6. Trademarks. This License does not grant permission to use the trade
10 // names, trademarks, service marks, or product names of the Licensor
11 // and its affiliates, except as required to comply with Section 4(c) of
12 // the License and to reproduce the content of the NOTICE file.
13 //
14 // You may obtain a copy of the Apache License at
15 //
16 // http://www.apache.org/licenses/LICENSE-2.0
17 //
18 // Unless required by applicable law or agreed to in writing, software
19 // distributed under the Apache License with the above modification is
20 // distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
21 // KIND, either express or implied. See the Apache License for the specific
22 // language governing permissions and limitations under the Apache License.
23 //
24 #ifndef PXR_USD_PCP_DYNAMIC_FILE_FORMAT_INTERFACE_H
25 #define PXR_USD_PCP_DYNAMIC_FILE_FORMAT_INTERFACE_H
26 
27 #include "pxr/pxr.h"
28 #include "pxr/usd/pcp/api.h"
29 #include "pxr/usd/sdf/fileFormat.h"
30 
32 
34 class VtValue;
35 
36 /// \class PcpDynamicFileFormatInterface
37 ///
38 /// Interface mixin that can be included by SdfFileFormat subclasses to enable
39 /// dynamic file format argument generation for a file format plugin.
40 /// When prim index composition encounters a payload to an asset of a file
41 /// format that implements this interface, it will call
42 /// ComposeFieldsForFileFormatArguments to generate arguments from the current
43 /// composition context at which the payload is being added. The derived file
44 /// format is on the hook for using the provided context to compute any prim
45 /// field values it needs and generate the relevant file format arguments for
46 /// its content.
48 {
49 public:
50  /// Empty virtual destructor to prevent build errors with some compilers.
51  PCP_API
53 
54  /// Derived classes must implement this function to compose prim fields
55  /// using the given \p context and use them to generate file format
56  /// arguments for the layer at \p assetPath. The context provides methods
57  /// to compose field values at the current point in prim index composition
58  /// which can be used to generate the relevant file format arguments. These
59  /// arguments need to be added to the set of file format arguments provided
60  /// by \p args.
61  ///
62  /// Additionally, implementations can output \p dependencyContextData of
63  /// any value type that will then be passed back in to calls to
64  /// CanFieldChangeAffectFileFormatArguments during change processing.
65  /// This can be used to provide more that context that is specific to the
66  /// file format when determining whether a field change really does affect
67  /// the arguments generated by a particular call to this function.
68  PCP_API
70  const std::string& assetPath,
73  VtValue *dependencyContextData) const = 0;
74 
75  /// Derived classes must implement this function to return true if the
76  /// change to scene description of the field named \p field can affect the
77  /// dynamic file format arguments generated by
78  /// ComposeFieldsForFileFormatArguments. This function will be called during
79  /// change processing to determine whether a change to a field affects
80  /// the dynamic file format arguments of a payload that a prim index depends
81  /// on.
82  ///
83  /// \p oldValue and \p newValue contain the old and new values of the field.
84  /// \p dependencyContextData is the arbitrary typed data that was generated
85  /// by the call to ComposeFieldsForFileFormatArguments when the payload arc
86  /// was computed.
87  PCP_API
89  const TfToken& field,
90  const VtValue& oldValue,
91  const VtValue& newValue,
92  const VtValue &dependencyContextData) const = 0;
93 };
94 
96 
97 #endif // PXR_USD_PCP_DYNAMIC_FILE_FORMAT_INTERFACE_H
virtual PCP_API void ComposeFieldsForFileFormatArguments(const std::string &assetPath, const PcpDynamicFileFormatContext &context, SdfFileFormat::FileFormatArguments *args, VtValue *dependencyContextData) const =0
const Args & args
Definition: printf.h:628
Definition: token.h:87
virtual PCP_API bool CanFieldChangeAffectFileFormatArguments(const TfToken &field, const VtValue &oldValue, const VtValue &newValue, const VtValue &dependencyContextData) const =0
GLsizei const GLchar *const * string
Definition: glew.h:1844
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1346
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:91
virtual PCP_API ~PcpDynamicFileFormatInterface()
Empty virtual destructor to prevent build errors with some compilers.
std::map< std::string, std::string > FileFormatArguments
Definition: fileFormat.h:113
Definition: value.h:174
#define PCP_API
Definition: api.h:40