11 #ifndef __GU_PackedFolders__
12 #define __GU_PackedFolders__
42 return std::holds_alternative<std::monostate>(myParentPrim);
46 return std::holds_alternative<const GU_PrimPacked *>(myParentPrim);
50 return std::holds_alternative<GA_Range>(myParentPrim);
59 return std::get<const GU_PrimPacked *>(myParentPrim);
78 return std::get<GA_Range>(myParentPrim);
84 bool treatAsFolder()
const;
89 return (myPath ==
"/" || treatAsFolder());
123 std::variant<std::monostate, const GU_PrimPacked *, GA_Range> myParentPrim;
128 bool myExisting =
false;
129 bool myModified =
false;
130 bool myTouched =
false;
131 bool myCleared =
false;
132 bool myVisible =
true;
203 FileInfo &rootFileInfo();
204 const FileInfo &rootFileInfo()
const;
234 return std::holds_alternative<std::monostate>(myParentPrim);
238 return std::holds_alternative<GU_PrimPacked *>(myParentPrim);
242 return std::holds_alternative<GA_Range>(myParentPrim);
251 return std::get<GU_PrimPacked *>(myParentPrim);
256 return std::get<GU_PrimPacked *>(myParentPrim);
264 auto *pp_prim = std::get_if<GU_PrimPacked *>(&myParentPrim);
265 return pp_prim ? *pp_prim :
nullptr;
269 auto *pp_prim = std::get_if<GU_PrimPacked *>(&myParentPrim);
270 return pp_prim ? *pp_prim :
nullptr;
279 return std::get<GA_Range>(myParentPrim);
284 return std::get<GA_Range>(myParentPrim);
299 return myPath ==
"/" || treatAsFolder();
306 return primGdh().castAwayConst();
312 if (myPrimGdh.isValid())
319 if (getIfParentPrim())
321 parentPrim()->unpack(*new_gdh.
gdpNC());
357 std::variant<std::monostate, GU_PrimPacked *, GA_Range> myParentPrim;
362 bool myExisting =
false;
363 bool myModified =
false;
364 bool myTouched =
false;
365 bool myCleared =
false;
366 bool myVisible =
true;
381 bool reuse_detail_ids=
false,
382 bool mark_existing=
true
463 bool is_folder =
false,
464 bool is_visible =
true);
482 bool myRemove =
false;
488 bool myIsFolder =
false;
489 bool myIsVisible =
true;
503 bool is_folder =
false,
504 bool is_visible =
true)
569 bool and_children =
false);
577 bool and_children =
false);
613 bool findFilesByPattern(
628 const FileInfo &rootFileInfo()
const;
638 bool mark_existing =
true,
bool reuse_detail_ids=
false);
646 bool is_folder =
false,
647 bool is_visible =
true);
663 template <
typename T>
664 struct DefaultClearer;
678 static const bool clearNeedsDestruction =
true;
693 static const bool clearNeedsDestruction =
true;
bool isFolder(const UT_StringRef &path) const
static bool treatAsFolder(const GU_PrimPacked *pack)
Get and set treatasfolder intrinsic on a packed prim.
static void setTreatAsFolder(GU_PrimPacked *pack, bool b)
GLuint GLsizei const GLchar * label
GU_PackedFoldersRO(const GU_PackedFoldersRO &src)
GU_ConstDetailHandle myDetail
const GU_ConstDetailHandle & primGdh() const
bool treatAsFolder() const
~GU_PackedFolders()=default
static void splitFilePath(const UT_StringRef &path, UT_Array< UT_StringHolder > &file_names)
UT_Array< EditInfo > myOps
GU_DetailHandle castAwayConst() const
Accumulate edit operations in a block.
bool isParentEmpty() const
GLsizei const GLchar *const * path
GU_PrimPacked * getIfParentPrim()
Simple struct holding the args for the remove and insert operations.
const GU_PrimPacked * getIfParentPrim() const
void replaceDetail(const GU_DetailHandle &d)
Rebuild file map over the given detail, holding references to it.
const GA_Range & parentRange() const
GU_PackedFolders(const GU_PackedFolders &src)
static void clear(GU_PackedFolders::FileInfo &v)
Read-Only Packed Folder Structure.
void updatePath(const UT_StringRef &path_str)
Update the chain of packed primitives up the path to the root detail.
UT_StringHolder getTopoFormat() const
Returns a string representing the topology of the whole.
void move(const FileInfo *fi, const UT_StringRef &new_path, bool pack)
Move a FileInfo to a new path. Does an insert and remove.
bool buildPath(const UT_StringRef &path_str)
OIIO_FORCEINLINE vbool4 insert(const vbool4 &a, bool val)
Helper: substitute val for a[i].
bool isParentRange() const
static bool isPrimVisible(const GA_Primitive *prim)
Return whether the given primitive is in _3d_hidden_primitives.
Class representing a file in the file map.
const UT_StringHolder & path() const
Path that this file represents.
bool setFileProperties(const UT_StringRef &path, bool treat_as_folder, bool visible)
bool isParentPrim() const
void setPrimGdh(const GU_ConstDetailHandle &prim_gdh)
static void clearConstruct(GU_PackedFoldersRO::FileInfo *p)
A range of elements in an index-map.
GLuint GLsizei const GLuint const GLintptr * offsets
static void splitFileName(const UT_StringRef &label, UT_WorkBuffer &name, UT_WorkBuffer &type)
void allocateAndSet(GU_Detail *gdp, bool own=true)
GLint GLint GLsizei GLint GLenum GLenum type
bool isParentRange() const
static bool updatePackedGeometry(GU_DetailHandle packed_gdh, GU_ConstDetailHandle gdh, const UT_StringRef &path)
GU_DetailHandle safePrimGdhNC()
void insert(const UT_StringRef &path, const GU_ConstDetailHandle &d, bool pack=true, bool is_folder=false, bool is_visible=true)
Insert a detail at the given path.
static void clearConstruct(GU_PackedFolders::FileInfo *p)
GU_ConstDetailHandle primGdh() const
bool findFilesByPattern(UT_Array< const GU_PackedFoldersRO::FileInfo * > &out, const UT_StringRef &pattern_str, bool sorted, UT_StringHolder &error) const
const UT_StringHolder & path() const
Path that this file represents.
static void clear(GU_PackedFoldersRO::FileInfo &v)
void replaceDetail(GU_DetailHandle &d)
Rebuild file map over the given detail, holding references to it.
GLuint const GLchar * name
bool isParentPrim() const
GLboolean GLboolean GLboolean b
GU_PackedFoldersRO(const GU_ConstDetailHandle &d)
bool isFolder() const
Return true if we're the root or treatAsFolder()
static const GU_PrimPacked * getPackedFromDetail(const GU_Detail *gdp)
Class representing a file in the file map.
const GA_Range & parentRange() const
GU_PackedFoldersRO()
Construct a folder structure with its own detail.
const GU_PackedFoldersRO::FileInfo * findFile(const UT_StringRef &path) const
static void splitFirstDirectory(UT_WorkBuffer &path, UT_WorkBuffer &out)
GU_PrimPacked * parentPrim()
const GU_PrimPacked * parentPrim() const
LeafData & operator=(const LeafData &)=delete
void findChildren(UT_Array< const GU_PackedFoldersRO::FileInfo * > &out, const UT_StringRef &path) const
static void splitLastDirectory(UT_WorkBuffer &path, UT_WorkBuffer &out)
const GU_PrimPacked * getIfParentPrim() const
GU_PackedFoldersRO(const GU_DetailHandle &d)
bool treatAsFolder() const
const GU_PrimPacked * parentPrim() const
bool isParentEmpty() const
~GU_PackedFoldersRO()=default
bool isFolder() const
Return true if we're the root or treatAsFolder()
GU_PackedFolders()
Construct a folder structure with its own detail.
bool OIIO_UTIL_API contains(string_view a, string_view b)
Does 'a' contain the string 'b' within it?
static bool isClear(const GU_PackedFolders::FileInfo &v)
static bool isClear(const GU_PackedFoldersRO::FileInfo &v)