HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GU_PackedFolders Class Reference

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)
 
 ~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::FileInfofindFile (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, UT_StringHolder &error) const
 
bool verify () const
 
 GU_PackedFolders (const GU_PackedFolders &src)
 
GU_PackedFoldersoperator= (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_PrimPackedgetPackedFromDetail (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)
 

Detailed Description

Packed Folder Structure.

Definition at line 189 of file GU_PackedFolders.h.

Constructor & Destructor Documentation

GU_PackedFolders::GU_PackedFolders ( )

Construct a folder structure with its own detail.

GU_PackedFolders::GU_PackedFolders ( GU_DetailHandle d)
inlineexplicit

Construct and build the map over the given detail, holding references to it

Definition at line 339 of file GU_PackedFolders.h.

GU_PackedFolders::~GU_PackedFolders ( )
default
GU_PackedFolders::GU_PackedFolders ( const GU_PackedFolders src)
inline

Copy geometry and hierarchy from another GU_PackedFolders

Definition at line 348 of file GU_PackedFolders.h.

Member Function Documentation

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,
UT_StringHolder error 
) const

Fill array with files which path the given apex syntax pattern; returns false on bad pattern_str

static const GU_PrimPacked* GU_PackedFolders::getPackedFromDetail ( const GU_Detail gdp)
static

Return packed prim if the detail is a single, packed object; return null if not

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 bool GU_PackedFolders::isPrimVisible ( const GA_Primitive prim)
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 void GU_PackedFolders::setTreatAsFolder ( GU_PrimPacked pack,
bool  b 
)
static
static void GU_PackedFolders::splitFileName ( const UT_StringRef label,
UT_WorkBuffer name,
UT_WorkBuffer type 
)
static

Path and name processing functions

static void GU_PackedFolders::splitFirstDirectory ( UT_WorkBuffer path,
UT_WorkBuffer out 
)
static

Path and name processing functions

static void GU_PackedFolders::splitLastDirectory ( UT_WorkBuffer path,
UT_WorkBuffer out 
)
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 bool GU_PackedFolders::treatAsFolder ( const GU_PrimPacked pack)
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.


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