HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Sdf_ChildrenUtils< ChildPolicy > Class Template Reference

#include <childrenUtils.h>

Public Types

typedef ChildPolicy::KeyType KeyType
 
typedef ChildPolicy::FieldType FieldType
 

Static Public Member Functions

static bool CreateSpec (const SdfLayerHandle &layer, const SdfPath &childPath, SdfSpecType specType, bool inert=true)
 
static SDF_API bool CreateSpec (SdfLayer *layer, const SdfPath &childPath, SdfSpecType specType, bool inert=true)
 
Rename API
static SDF_API bool IsValidName (const FieldType &newName)
 Return whether newName is a valid name for a child. More...
 
static SDF_API bool IsValidName (const std::string &newName)
 Return whether newName is a valid name for a child. More...
 
static SdfAllowed CanRename (const SdfSpec &spec, const FieldType &newName)
 Return whether spec can be renamed to newName. More...
 
static SDF_API bool Rename (const SdfSpec &spec, const FieldType &newName)
 
Children List API
static SDF_API bool SetChildren (const SdfLayerHandle &layer, const SdfPath &path, const std::vector< typename ChildPolicy::ValueType > &values)
 
static SDF_API bool InsertChild (const SdfLayerHandle &layer, const SdfPath &path, const typename ChildPolicy::ValueType &value, int index)
 Insert value as a child of path at the specified index. More...
 
static SDF_API bool RemoveChild (const SdfLayerHandle &layer, const SdfPath &path, const typename ChildPolicy::KeyType &key)
 Remove the child identified by key. More...
 
Batch editing API
static SDF_API bool MoveChildForBatchNamespaceEdit (const SdfLayerHandle &layer, const SdfPath &path, const typename ChildPolicy::ValueType &value, const typename ChildPolicy::FieldType &newName, int index)
 
static SDF_API bool RemoveChildForBatchNamespaceEdit (const SdfLayerHandle &layer, const SdfPath &path, const typename ChildPolicy::KeyType &key)
 Remove the child identified by key. More...
 
static SDF_API bool CanMoveChildForBatchNamespaceEdit (const SdfLayerHandle &layer, const SdfPath &path, const typename ChildPolicy::ValueType &value, const typename ChildPolicy::FieldType &newName, int index, std::string *whyNot)
 
static SDF_API bool CanRemoveChildForBatchNamespaceEdit (const SdfLayerHandle &layer, const SdfPath &path, const typename ChildPolicy::FieldType &key, std::string *whyNot)
 

Detailed Description

template<class ChildPolicy>
class Sdf_ChildrenUtils< ChildPolicy >

Helper functions for creating and manipulating the children of a spec. A ChildPolicy must be provided that specifies which type of children to edit. (See childrenPolicies.h for details).

Definition at line 43 of file childrenUtils.h.

Member Typedef Documentation

template<class ChildPolicy >
typedef ChildPolicy::FieldType Sdf_ChildrenUtils< ChildPolicy >::FieldType

The type of the child identifier as it's stored in the layer's data. This is usually a TfToken.

Definition at line 52 of file childrenUtils.h.

template<class ChildPolicy >
typedef ChildPolicy::KeyType Sdf_ChildrenUtils< ChildPolicy >::KeyType

The type of the key that identifies a child. This is usually a std::string or an SdfPath.

Definition at line 48 of file childrenUtils.h.

Member Function Documentation

template<class ChildPolicy >
static SDF_API bool Sdf_ChildrenUtils< ChildPolicy >::CanMoveChildForBatchNamespaceEdit ( const SdfLayerHandle &  layer,
const SdfPath path,
const typename ChildPolicy::ValueType &  value,
const typename ChildPolicy::FieldType &  newName,
int  index,
std::string whyNot 
)
static

Returns true if value can be inserted as a child of path with the new name newName at the index index, otherwise returns false and sets whyNot.

template<class ChildPolicy >
static SDF_API bool Sdf_ChildrenUtils< ChildPolicy >::CanRemoveChildForBatchNamespaceEdit ( const SdfLayerHandle &  layer,
const SdfPath path,
const typename ChildPolicy::FieldType &  key,
std::string whyNot 
)
static

Returns true if the child of path identified by key can be removed, otherwise returns false and sets whyNot.

template<class ChildPolicy >
static SdfAllowed Sdf_ChildrenUtils< ChildPolicy >::CanRename ( const SdfSpec spec,
const FieldType newName 
)
static

Return whether spec can be renamed to newName.

template<class ChildPolicy >
static bool Sdf_ChildrenUtils< ChildPolicy >::CreateSpec ( const SdfLayerHandle &  layer,
const SdfPath childPath,
SdfSpecType  specType,
bool  inert = true 
)
inlinestatic

Create a new spec in layer at and add it to its parent's field named . Emit an error and return false if the new spec couldn't be created.

Definition at line 57 of file childrenUtils.h.

template<class ChildPolicy >
static SDF_API bool Sdf_ChildrenUtils< ChildPolicy >::CreateSpec ( SdfLayer layer,
const SdfPath childPath,
SdfSpecType  specType,
bool  inert = true 
)
static
template<class ChildPolicy >
static SDF_API bool Sdf_ChildrenUtils< ChildPolicy >::InsertChild ( const SdfLayerHandle &  layer,
const SdfPath path,
const typename ChildPolicy::ValueType &  value,
int  index 
)
static

Insert value as a child of path at the specified index.

template<class ChildPolicy >
static SDF_API bool Sdf_ChildrenUtils< ChildPolicy >::IsValidName ( const FieldType newName)
static

Return whether newName is a valid name for a child.

template<class ChildPolicy >
static SDF_API bool Sdf_ChildrenUtils< ChildPolicy >::IsValidName ( const std::string newName)
static

Return whether newName is a valid name for a child.

template<class ChildPolicy >
static SDF_API bool Sdf_ChildrenUtils< ChildPolicy >::MoveChildForBatchNamespaceEdit ( const SdfLayerHandle &  layer,
const SdfPath path,
const typename ChildPolicy::ValueType &  value,
const typename ChildPolicy::FieldType &  newName,
int  index 
)
static

Insert value as a child of path at the specified index with the new name newName.

template<class ChildPolicy >
static SDF_API bool Sdf_ChildrenUtils< ChildPolicy >::RemoveChild ( const SdfLayerHandle &  layer,
const SdfPath path,
const typename ChildPolicy::KeyType &  key 
)
static

Remove the child identified by key.

template<class ChildPolicy >
static SDF_API bool Sdf_ChildrenUtils< ChildPolicy >::RemoveChildForBatchNamespaceEdit ( const SdfLayerHandle &  layer,
const SdfPath path,
const typename ChildPolicy::KeyType &  key 
)
inlinestatic

Remove the child identified by key.

Definition at line 143 of file childrenUtils.h.

template<class ChildPolicy >
static SDF_API bool Sdf_ChildrenUtils< ChildPolicy >::Rename ( const SdfSpec spec,
const FieldType newName 
)
static

Rename spec to newName. If fixPrimListEdits is true, then also fix up the name children order. It's an error for fixPrimListEdits to be true if spec is not a PrimSpec.

template<class ChildPolicy >
static SDF_API bool Sdf_ChildrenUtils< ChildPolicy >::SetChildren ( const SdfLayerHandle &  layer,
const SdfPath path,
const std::vector< typename ChildPolicy::ValueType > &  values 
)
static

Replace the children of the spec at path with the specs in values. This will delete existing children that aren't in values and reparent children from other locations in the layer.


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