HDK
|
Packed Folder Structure. More...
#include <GU_PackedFolders.h>
Classes | |
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) | |
~GU_PackedFolders ()=default | |
bool | setFileProperties (const UT_StringRef &path, bool treat_as_folder, bool visible) |
Helper method to set the properties on an existing file. More... | |
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 | 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 |
Get file access for read; returns nullptr if file does not exist. More... | |
void | 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. More... | |
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) |
Static Public Member Functions | |
static bool | treatAsFolder (const GU_PrimPacked *pack) |
Get and set treatasfolder intrinsic on a packed prim. More... | |
static void | setTreatAsFolder (GU_PrimPacked *pack, bool b) |
static bool | isPrimVisible (const GA_Primitive *prim) |
Return whether the given primitive is in _3d_hidden_primitives. More... | |
static const GU_PrimPacked * | getPackedFromDetail (const GU_Detail *gdp) |
static void | splitFirstDirectory (UT_WorkBuffer &path, UT_WorkBuffer &out) |
static void | splitLastDirectory (UT_WorkBuffer &path, UT_WorkBuffer &out) |
static void | splitFileName (const UT_StringRef &label, UT_WorkBuffer &name, UT_WorkBuffer &type) |
Packed Folder Structure.
Definition at line 207 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
|
default |
|
inline |
Copy geometry and hierarchy from another GU_PackedFolders
Definition at line 364 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.
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.
const GU_PackedFolders::FileInfo* GU_PackedFolders::findFile | ( | const UT_StringRef & | path | ) | const |
Get file access for read; returns nullptr if file does not exist.
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. |
|
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
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.
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.
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
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.
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.