HDK
|
Packed Folder Structure. More...
#include <GU_PackedFolders.h>
Classes | |
struct | EditInfo |
Simple struct holding the args for the remove and insert operations. More... | |
class | EditOperations |
Accumulate edit operations in a block. More... | |
class | FileInfo |
Class representing a file in the file map. More... | |
Public Member Functions | |
GU_PackedFolders () | |
Construct a folder structure with its own detail. More... | |
GU_PackedFolders (GU_DetailHandle &d, bool reuse_detail_ids=false, bool mark_existing=true) | |
~GU_PackedFolders ()=default | |
bool | setFileProperties (const UT_StringRef &path, bool treat_as_folder, bool visible) |
void | replaceDetail (GU_DetailHandle &d) |
Rebuild file map over the given detail, holding references to it. More... | |
void | updatePath (const UT_StringRef &path_str) |
Update the chain of packed primitives up the path to the root detail. More... | |
bool | buildPath (const UT_StringRef &path_str) |
bool | insert (const UT_StringRef &path, const GU_ConstDetailHandle &d, bool pack=true, bool is_folder=false, bool is_visible=true) |
bool | remove (const UT_StringRef &path_str) |
void | merge (const GU_PackedFoldersRO &src_folders, const UT_StringRef &pattern) |
bool | edit (EditOperations &o) |
void | setFlags (const UT_StringRef &path, bool existing, bool modified, bool touched, bool and_children=false) |
Set flags to true on a given file and if desired, its children. More... | |
void | clearFlags (const UT_StringRef &path, bool existing, bool modified, bool touched, bool and_children=false) |
Clear flags to false on a given file and if desired, its children. More... | |
void | touch (const UT_StringRef &path, bool and_children=false) |
Sets touch flag on a given file & its children if and_children is true. More... | |
void | touchFolders (const UT_StringRef &path_str) |
Mark all folders in the path given as touched. More... | |
void | removeStale (const GU_PackedFolders *backup=nullptr) |
bool | isFolder (const UT_StringRef &path) const |
const GU_PackedFolders::FileInfo * | findFile (const UT_StringRef &path) const |
void | findChildren (UT_Array< const GU_PackedFolders::FileInfo * > &out, const UT_StringRef &path) const |
bool | findFilesByPattern (UT_Array< const GU_PackedFolders::FileInfo * > &out, const UT_StringRef &pattern_str, bool sorted, UT_StringHolder &error) const |
bool | verify () const |
UT_StringHolder | getTopoFormat () const |
Returns a string representing the topology of the whole. More... | |
GU_PackedFolders (const GU_PackedFolders &src) | |
GU_PackedFolders & | operator= (const GU_PackedFolders &src) |
Packed Folder Structure.
Definition at line 219 of file GU_PackedFolders.h.
GU_PackedFolders::GU_PackedFolders | ( | ) |
Construct a folder structure with its own detail.
|
explicit |
Construct and build the map over the given detail, holding references to it Sets the Existing flag on existing paths. This affects the removeStale() behavior. Use mark_existing=true if you want to keep existing details as is and only modify the touched paths. Use mark_existing=false if you want to delete existing details that aren't touched
|
default |
|
inline |
Copy geometry and hierarchy from another GU_PackedFolders
Definition at line 389 of file GU_PackedFolders.h.
bool GU_PackedFolders::buildPath | ( | const UT_StringRef & | path_str | ) |
Build a path of folders if it does not exist already. Returns true if successful; fails if a file in path_str exists and is not a folder
void GU_PackedFolders::clearFlags | ( | const UT_StringRef & | path, |
bool | existing, | ||
bool | modified, | ||
bool | touched, | ||
bool | and_children = false |
||
) |
Clear flags to false on a given file and if desired, its children.
|
static |
Returns whether the geometry contains a packed folder geometry with the given path.
|
static |
Returns whether the geometry contains a packed folder geometry with the given path.
bool GU_PackedFolders::edit | ( | EditOperations & | o | ) |
Perform multiple insert/remove/move operations in a single step. Returns true if all the operations succeeded. o.myOps[i].myRet has the return status of individual edit operations. Note: GU_PackedFolders::FileInfo* can become invalid when rebuildMap() is called and it is likely to happen after doing many operations. You'll have to call the find() methods again.
void GU_PackedFolders::findChildren | ( | UT_Array< const GU_PackedFolders::FileInfo * > & | out, |
const UT_StringRef & | path | ||
) | const |
Fill array with the children of this file at path, if it exists Note: GU_PackedFolders::FileInfo* can become invalid when rebuildMap() is called. It can happen when calling insert() or setFileProperties()
const GU_PackedFolders::FileInfo* GU_PackedFolders::findFile | ( | const UT_StringRef & | path | ) | const |
Get file access for read; returns nullptr if file does not exist Note: GU_PackedFolders::FileInfo* can become invalid when rebuildMap() is called. It can happen when calling insert() or setFileProperties()
bool GU_PackedFolders::findFilesByPattern | ( | UT_Array< const GU_PackedFolders::FileInfo * > & | out, |
const UT_StringRef & | pattern_str, | ||
bool | sorted, | ||
UT_StringHolder & | error | ||
) | const |
Fill array with files which path the given apex syntax pattern; returns false on bad pattern_str
sorted | Sorts the output list by file path. If disabled, the list is in an arbitrary order. Note: GU_PackedFolders::FileInfo* can become invalid when rebuildMap() is called. It can happen when calling insert() or setFileProperties() |
|
static |
Return packed prim if the detail is a single, packed object; return null if not
UT_StringHolder GU_PackedFolders::getTopoFormat | ( | ) | const |
Returns a string representing the topology of the whole.
bool GU_PackedFolders::insert | ( | const UT_StringRef & | path, |
const GU_ConstDetailHandle & | d, | ||
bool | pack = true , |
||
bool | is_folder = false , |
||
bool | is_visible = true |
||
) |
Insert/replace a file at the given path, creating the path if it does not exist. If pack is true, pack d before adding to the folder. If is_folder is true, set the treatasfolder intrinsic on the inserted file. Returns true if successful; fails if it can't create the path to the file Note: GU_PackedFolders::FileInfo* can become invalid after call insert() You'll have to call the find() methods again.
bool GU_PackedFolders::isFolder | ( | const UT_StringRef & | path | ) | const |
Check if file at given path is a folder; returns false if file does not exist
|
static |
Return whether the given primitive is in _3d_hidden_primitives.
void GU_PackedFolders::merge | ( | const GU_PackedFoldersRO & | src_folders, |
const UT_StringRef & | pattern | ||
) |
Merges the contents of 'src_folders' into this folder structure, filtered by the specified file pattern. Note: GU_PackedFolders::FileInfo* can become invalid after call insert() You'll have to call the find() methods again.
GU_PackedFolders& GU_PackedFolders::operator= | ( | const GU_PackedFolders & | src | ) |
Copy geometry and hierarchy from another GU_PackedFolders
bool GU_PackedFolders::remove | ( | const UT_StringRef & | path_str | ) |
Remove a file or folder at the given path. Returns true if successful; fails if the given path is the root "/" or doesn't exist.
void GU_PackedFolders::removeStale | ( | const GU_PackedFolders * | backup = nullptr | ) |
Removes stale files which are flagged as untouched. Files flagged existing if found by replaceDetail()/rebuildMap() are protected. If backup is provided, files which are untouched, modified, and existing will be replaced by the copy in backup. Files are marked modified if created/replaced by insert().
void GU_PackedFolders::replaceDetail | ( | GU_DetailHandle & | d | ) |
Rebuild file map over the given detail, holding references to it.
bool GU_PackedFolders::setFileProperties | ( | const UT_StringRef & | path, |
bool | treat_as_folder, | ||
bool | visible | ||
) |
Helper method to set the properties on an existing file Note: GU_PackedFolders::FileInfo* can become invalid after calling setFileProperties(). You'll have to call the find() methods again.
void GU_PackedFolders::setFlags | ( | const UT_StringRef & | path, |
bool | existing, | ||
bool | modified, | ||
bool | touched, | ||
bool | and_children = false |
||
) |
Set flags to true on a given file and if desired, its children.
|
static |
|
static |
Path and name processing functions
|
static |
Path and name processing functions
|
static |
Path and name processing functions
|
static |
Path and name processing functions
void GU_PackedFolders::touch | ( | const UT_StringRef & | path, |
bool | and_children = false |
||
) |
Sets touch flag on a given file & its children if and_children is true.
void GU_PackedFolders::touchFolders | ( | const UT_StringRef & | path_str | ) |
Mark all folders in the path given as touched.
|
static |
Get and set treatasfolder intrinsic on a packed prim.
|
static |
Updates the packed geometry at the given path. If no geometry exists at the given path, the geometry will not be added. Returns whether the geometry was successfully updated.
void GU_PackedFolders::updatePath | ( | const UT_StringRef & | path_str | ) |
Update the chain of packed primitives up the path to the root detail.
bool GU_PackedFolders::verify | ( | ) | const |
Verifies packed primitive implementation pointers. Only does something on Windows debug builds.