clipsAPI.h
Go to the documentation of this file.
1 //
2 // Copyright 2016 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 USD_GENERATED_CLIPSAPI_H
25 #define USD_GENERATED_CLIPSAPI_H
26 
28 
29 #include "pxr/pxr.h"
30 #include "pxr/usd/usd/api.h"
32 #include "pxr/usd/usd/prim.h"
33 #include "pxr/usd/usd/stage.h"
34 #include "pxr/usd/usd/tokens.h"
35 
36 #include "pxr/base/vt/value.h"
37 
38 #include "pxr/base/gf/vec3d.h"
39 #include "pxr/base/gf/vec3f.h"
40 #include "pxr/base/gf/matrix4d.h"
41 
42 #include "pxr/base/tf/token.h"
43 #include "pxr/base/tf/type.h"
44 
45 PXR_NAMESPACE_OPEN_SCOPE
46 
47 class SdfAssetPath;
48 
49 // -------------------------------------------------------------------------- //
50 // CLIPSAPI //
51 // -------------------------------------------------------------------------- //
52 
106 {
107 public:
112 
117  explicit UsdClipsAPI(const UsdPrim& prim=UsdPrim())
118  : UsdAPISchemaBase(prim)
119  {
120  }
121 
125  explicit UsdClipsAPI(const UsdSchemaBase& schemaObj)
126  : UsdAPISchemaBase(schemaObj)
127  {
128  }
129 
131  USD_API
132  virtual ~UsdClipsAPI();
133 
137  USD_API
138  static const TfTokenVector &
139  GetSchemaAttributeNames(bool includeInherited=true);
140 
150  USD_API
151  static UsdClipsAPI
152  Get(const UsdStagePtr &stage, const SdfPath &path);
153 
154 
155 protected:
159  USD_API
160  UsdSchemaKind _GetSchemaKind() const override;
161 
162 private:
163  // needs to invoke _GetStaticTfType.
164  friend class UsdSchemaRegistry;
165  USD_API
166  static const TfType &_GetStaticTfType();
167 
168  static bool _IsTypedSchema();
169 
170  // override SchemaBase virtuals.
171  USD_API
172  const TfType &_GetTfType() const override;
173 
174 public:
175  // ===================================================================== //
176  // Feel free to add custom code below this line, it will be preserved by
177  // the code generator.
178  //
179  // Just remember to:
180  // - Close the class declaration with };
181  // - Close the namespace with PXR_NAMESPACE_CLOSE_SCOPE
182  // - Close the include guard with #endif
183  // ===================================================================== //
184  // --(BEGIN CUSTOM CODE)--
185  //
186 
187  // --------------------------------------------------------------------- //
195  // --------------------------------------------------------------------- //
196 
206  USD_API
207  bool GetClips(VtDictionary* clips) const;
208 
211  USD_API
212  bool SetClips(const VtDictionary& clips);
213 
229  USD_API
230  bool GetClipSets(SdfStringListOp* clipSets) const;
231 
234  USD_API
235  bool SetClipSets(const SdfStringListOp& clipSets);
236 
245  USD_API
247  ComputeClipAssetPaths(const std::string& clipSet) const;
248 
251  USD_API
253 
257  USD_API
258  bool GetClipAssetPaths(VtArray<SdfAssetPath>* assetPaths,
259  const std::string& clipSet) const;
263  USD_API
264  bool GetClipAssetPaths(VtArray<SdfAssetPath>* assetPaths) const;
265 
268  USD_API
269  bool SetClipAssetPaths(const VtArray<SdfAssetPath>& assetPaths,
270  const std::string& clipSet);
274  USD_API
275  bool SetClipAssetPaths(const VtArray<SdfAssetPath>& assetPaths);
276 
286  USD_API
287  bool GetClipPrimPath(std::string* primPath,
288  const std::string& clipSet) const;
292  USD_API
293  bool GetClipPrimPath(std::string* primPath) const;
294 
297  USD_API
298  bool SetClipPrimPath(const std::string& primPath,
299  const std::string& clipSet);
303  USD_API
304  bool SetClipPrimPath(const std::string& primPath);
305 
311  USD_API
312  bool GetClipActive(VtVec2dArray* activeClips,
313  const std::string& clipSet) const;
317  USD_API
318  bool GetClipActive(VtVec2dArray* activeClips) const;
319 
322  USD_API
323  bool SetClipActive(const VtVec2dArray& activeClips,
324  const std::string& clipSet);
328  USD_API
329  bool SetClipActive(const VtVec2dArray& activeClips);
330 
341  USD_API
342  bool GetClipTimes(VtVec2dArray* clipTimes,
343  const std::string& clipSet) const;
347  USD_API
348  bool GetClipTimes(VtVec2dArray* clipTimes) const;
349 
352  USD_API
353  bool SetClipTimes(const VtVec2dArray& clipTimes,
354  const std::string& clipSet);
358  USD_API
359  bool SetClipTimes(const VtVec2dArray& clipTimes);
360 
372  USD_API
373  bool GetClipManifestAssetPath(SdfAssetPath* manifestAssetPath,
374  const std::string& clipSet) const;
378  USD_API
379  bool GetClipManifestAssetPath(SdfAssetPath* manifestAssetPath) const;
380 
383  USD_API
384  bool SetClipManifestAssetPath(const SdfAssetPath& manifestAssetPath,
385  const std::string& clipSet);
389  USD_API
390  bool SetClipManifestAssetPath(const SdfAssetPath& manifestAssetPath);
391 
405  USD_API
407  const std::string& clipSet,
408  bool writeBlocksForClipsWithMissingValues = false) const;
409 
413  USD_API
415  bool writeBlocksForClipsWithMissingValues = false) const;
416 
423  USD_API
424  static SdfLayerRefPtr
425  GenerateClipManifestFromLayers(const SdfLayerHandleVector& clipLayers,
426  const SdfPath& clipPrimPath);
427 
428  // Flag indicating whether values for a clip that does not contain authored
429  // time samples are interpolated from surrounding clips.
430  //
431  // If this flag is set, values for clips that do not have authored time
432  // samples for an attribute that is declared in the manifest without a
433  // fallback value will be interpolated from values in surrounding clips.
434  // This is disabled by default.
435  USD_API
436  bool GetInterpolateMissingClipValues(bool* interpolate,
437  const std::string& clipSet) const;
438 
441  USD_API
442  bool GetInterpolateMissingClipValues(bool* interpolate) const;
443 
446  USD_API
447  bool SetInterpolateMissingClipValues(bool interpolate,
448  const std::string& clipSet);
449 
452  USD_API
453  bool SetInterpolateMissingClipValues(bool interpolate);
454 
485  USD_API
486  bool GetClipTemplateAssetPath(std::string* clipTemplateAssetPath,
487  const std::string& clipSet) const;
491  USD_API
492  bool GetClipTemplateAssetPath(std::string* clipTemplateAssetPath) const;
493 
496  USD_API
497  bool SetClipTemplateAssetPath(const std::string& clipTemplateAssetPath,
498  const std::string& clipSet);
502  USD_API
503  bool SetClipTemplateAssetPath(const std::string& clipTemplateAssetPath);
504 
508  USD_API
509  bool GetClipTemplateStride(double* clipTemplateStride,
510  const std::string& clipSet) const;
514  USD_API
515  bool GetClipTemplateStride(double* clipTemplateStride) const;
516 
519  USD_API
520  bool SetClipTemplateActiveOffset(const double clipTemplateActiveOffset,
521  const std::string& clipSet);
522 
526  USD_API
527  bool SetClipTemplateActiveOffset(const double clipTemplateActiveOffset);
528 
531  USD_API
532  bool GetClipTemplateActiveOffset(double* clipTemplateActiveOffset,
533  const std::string& clipSet) const;
534 
538  USD_API
539  bool GetClipTemplateActiveOffset(double* clipTemplateActiveOffset) const;
540 
543  USD_API
544  bool SetClipTemplateStride(const double clipTemplateStride,
545  const std::string& clipSet);
549  USD_API
550  bool SetClipTemplateStride(const double clipTemplateStride);
551 
556  USD_API
557  bool GetClipTemplateStartTime(double* clipTemplateStartTime,
558  const std::string& clipSet) const;
562  USD_API
563  bool GetClipTemplateStartTime(double* clipTemplateStartTime) const;
564 
567  USD_API
568  bool SetClipTemplateStartTime(const double clipTemplateStartTime,
569  const std::string& clipSet);
573  USD_API
574  bool SetClipTemplateStartTime(const double clipTemplateStartTime);
575 
580  USD_API
581  bool GetClipTemplateEndTime(double* clipTemplateEndTime,
582  const std::string& clipSet) const;
586  USD_API
587  bool GetClipTemplateEndTime(double* clipTemplateEndTime) const;
588 
591  USD_API
592  bool SetClipTemplateEndTime(const double clipTemplateEndTime,
593  const std::string& clipSet);
597  USD_API
598  bool SetClipTemplateEndTime(const double clipTemplateEndTime);
599 
601 
602 };
603 
605 #define USDCLIPS_INFO_KEYS \
606  (active) \
607  (assetPaths) \
608  (interpolateMissingClipValues) \
609  (manifestAssetPath) \
610  (primPath) \
611  (templateAssetPath) \
612  (templateEndTime) \
613  (templateStartTime) \
614  (templateStride) \
615  (templateActiveOffset) \
616  (times) \
617 
618 TF_DECLARE_PUBLIC_TOKENS(UsdClipsAPIInfoKeys, USD_API, USDCLIPS_INFO_KEYS);
639 
641 #define USDCLIPS_SET_NAMES \
642  ((default_, "default")) \
643 
644 TF_DECLARE_PUBLIC_TOKENS(UsdClipsAPISetNames, USD_API, USDCLIPS_SET_NAMES);
653 
654 PXR_NAMESPACE_CLOSE_SCOPE
655 
656 #endif
USD_API bool SetClipTemplateStride(const double clipTemplateStride, const std::string &clipSet)
Set the template stride for the clip set named clipSet.
static USD_API SdfLayerRefPtr GenerateClipManifestFromLayers(const SdfLayerHandleVector &clipLayers, const SdfPath &clipPrimPath)
Create a clip manifest containing entries for all attributes in the given clipLayers that belong to t...
USD_API bool GetClipTemplateActiveOffset(double *clipTemplateActiveOffset, const std::string &clipSet) const
A double representing the offset value used by USD when determining the active period for each clip.
USD_API bool SetClipPrimPath(const std::string &primPath, const std::string &clipSet)
Set the clip prim path for the clip set named clipSet.
static USD_API UsdClipsAPI Get(const UsdStagePtr &stage, const SdfPath &path)
Return a UsdClipsAPI holding the prim adhering to this schema at path on stage.
USD_API bool GetClipTemplateEndTime(double *clipTemplateEndTime, const std::string &clipSet) const
A double which indicates the end of the range USD will use to to search for asset paths for the clip ...
USD_API UsdSchemaKind _GetSchemaKind() const override
Returns the kind of schema this class belongs to.
USD_API bool GetClipManifestAssetPath(SdfAssetPath *manifestAssetPath, const std::string &clipSet) const
Asset path for the clip manifest for the clip set named clipSet.
UsdClipsAPI is an API schema that provides an interface to a prim's clip metadata.
Definition: clipsAPI.h:105
USD_API SdfLayerRefPtr GenerateClipManifest(const std::string &clipSet, bool writeBlocksForClipsWithMissingValues=false) const
Create a clip manifest containing entries for all attributes in the value clips for clip set clipSet.
A map with string keys and VtValue values.
Definition: dictionary.h:63
USD_API VtArray< SdfAssetPath > ComputeClipAssetPaths() const
This is an overloaded member function, provided for convenience. It differs from the above function o...
The base class for all API schemas.
Non-applied API schema.
UsdSchemaKind
An enum representing which kind of schema a given schema class belongs to.
Definition: common.h:127
USD_API bool SetClipTemplateAssetPath(const std::string &clipTemplateAssetPath, const std::string &clipSet)
Set the clip template asset path for the clip set named clipSet.
USD_API bool GetClips(VtDictionary *clips) const
Dictionary that contains the definition of the clip sets on this prim.
USD_API bool SetClipTimes(const VtVec2dArray &clipTimes, const std::string &clipSet)
Set the clip times metadata for this prim.
UsdClipsAPI(const UsdPrim &prim=UsdPrim())
Construct a UsdClipsAPI on UsdPrim prim .
Definition: clipsAPI.h:117
USD_API bool GetClipTemplateStride(double *clipTemplateStride, const std::string &clipSet) const
A double representing the increment value USD will use when searching for asset paths for the clip se...
UsdClipsAPI(const UsdSchemaBase &schemaObj)
Construct a UsdClipsAPI on the prim held by schemaObj .
Definition: clipsAPI.h:125
USD_API bool GetClipTemplateStartTime(double *clipTemplateStartTime, const std::string &clipSet) const
A double which indicates the start of the range USD will use to search for asset paths for the clip s...
TF_DECLARE_PUBLIC_TOKENS(UsdClipsAPIInfoKeys, USD_API, USDCLIPS_INFO_KEYS)
UsdPrim is the sole persistent scenegraph object on a UsdStage, and is the embodiment of a "Prim" as ...
Definition: prim.h:134
USD_API bool SetInterpolateMissingClipValues(bool interpolate, const std::string &clipSet)
Set whether missing clip values are interpolated from surrounding clips.
std::vector< TfToken > TfTokenVector
Convenience types.
Definition: token.h:442
USD_API bool GetClipAssetPaths(VtArray< SdfAssetPath > *assetPaths, const std::string &clipSet) const
List of asset paths to the clips in the clip set named clipSet.
Represents an arbitrary dimensional rectangular container class.
Definition: array.h:228
A path value used to locate objects in layers or scenegraphs.
Definition: path.h:290
virtual USD_API ~UsdClipsAPI()
Destructor.
USD_API bool SetClipManifestAssetPath(const SdfAssetPath &manifestAssetPath, const std::string &clipSet)
Set the clip manifest asset path for this prim.
USD_API bool SetClipTemplateActiveOffset(const double clipTemplateActiveOffset, const std::string &clipSet)
Set the clip template offset for the clip set named clipSet.
USD_API bool SetClipAssetPaths(const VtArray< SdfAssetPath > &assetPaths, const std::string &clipSet)
Set the clip asset paths for the clip set named clipSet.
USD_API bool GetClipTemplateAssetPath(std::string *clipTemplateAssetPath, const std::string &clipSet) const
A template string representing a set of assets to be used as clips for the clip set named clipSet.
Contains an asset path and an optional resolved path.
Definition: assetPath.h:47
USD_API bool GetClipSets(SdfStringListOp *clipSets) const
ListOp that may be used to affect how opinions from clip sets are applied during value resolution.
USD_API bool SetClipActive(const VtVec2dArray &activeClips, const std::string &clipSet)
Set the active clip metadata for the clip set named clipSet.
USD_API bool GetClipActive(VtVec2dArray *activeClips, const std::string &clipSet) const
List of pairs (time, clip index) indicating the time on the stage at which the clip in the clip set n...
TfType represents a dynamic runtime type.
Definition: type.h:64
static const UsdSchemaKind schemaKind
Compile time constant representing what kind of schema this class is.
Definition: clipsAPI.h:111
Singleton registry that provides access to schema type information and the prim definitions for regis...
static USD_API const TfTokenVector & GetSchemaAttributeNames(bool includeInherited=true)
Return a vector of names of all pre-declared attributes for this schema class and all its ancestor cl...
USD_API bool GetClipTimes(VtVec2dArray *clipTimes, const std::string &clipSet) const
List of pairs (stage time, clip time) indicating the time in the active clip in the clip set named cl...
USD_API bool SetClips(const VtDictionary &clips)
Set the clips dictionary for this prim.
USD_API bool SetClipSets(const SdfStringListOp &clipSets)
Set the clip sets list op for this prim.
The base class for all schema types in Usd.
Definition: schemaBase.h:56
USD_API bool SetClipTemplateStartTime(const double clipTemplateStartTime, const std::string &clipSet)
Set the template start time for the clip set named clipSet.
TfToken class for efficient string referencing and hashing, plus conversions to and from stl string c...
USD_API bool SetClipTemplateEndTime(const double clipTemplateEndTime, const std::string &clipSet)
Set the template end time for the clipset named clipSet.
USD_API bool GetClipPrimPath(std::string *primPath, const std::string &clipSet) const
Path to the prim in the clips in the clip set named clipSet from which time samples will be read.