HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GU_PackedFolders.h
Go to the documentation of this file.
1 /*
2  * PROPRIETARY INFORMATION. This software is proprietary to
3  * Side Effects Software Inc., and is not to be reproduced,
4  * transmitted, or disclosed in any way without written permission.
5  *
6  * NAME: GU_PackedFolders.h (GU Library, C++)
7  *
8  * COMMENTS:
9  */
10 
11 #ifndef __GU_PackedFolders__
12 #define __GU_PackedFolders__
13 
14 #include "GU_API.h"
15 #include "GU_DetailHandle.h"
16 #include "GU_PrimPacked.h"
17 #include <UT/UT_ArrayStringMap.h>
18 #include <UT/UT_ArrayStringSet.h>
19 #include <UT/UT_PathPattern.h>
20 #include <UT/UT_StringHolder.h>
21 #include <UT/UT_StringMap.h>
22 #include <variant>
23 
24 class GU_PackedFolders;
25 
26 /// Read-Only Packed Folder Structure
28 {
29 public:
30  /// Class representing a file in the file map
31  class FileInfo
32  {
33  public:
34 
35  /// Path that this file represents
36  const UT_StringHolder &path() const { return myPath; };
37 
38  /// The parent can be in one of three states
39  /// @{
40  bool isParentEmpty() const
41  {
42  return std::holds_alternative<std::monostate>(myParentPrim);
43  }
44  bool isParentPrim() const
45  {
46  return std::holds_alternative<const GU_PrimPacked *>(myParentPrim);
47  }
48  bool isParentRange() const
49  {
50  return std::holds_alternative<GA_Range>(myParentPrim);
51  }
52  /// @}
53 
54  /// Obtain parent as a GU_PrimPacked*, throws if !isParentPrim()
55  /// @{
56  const GU_PrimPacked *parentPrim() const
57  {
58  UT_ASSERT(isParentPrim());
59  return std::get<const GU_PrimPacked *>(myParentPrim);
60  }
61  /// @}
62 
63  /// Get parent as a packed primitive, returns nullptr if not a prim
64  /// @{
66  {
67  if (!isParentPrim())
68  return nullptr;
69  return parentPrim();
70  }
71  /// @}
72 
73  /// Get parent as a GA_Range, throws if !isParentRange()
74  /// @{
75  const GA_Range &parentRange() const
76  {
77  UT_ASSERT(isParentRange());
78  return std::get<GA_Range>(myParentPrim);
79  }
80  /// @}
81 
82  /// Return true if parent is a packed primitive and has treatasfolder
83  /// intrinsic enabled
84  bool treatAsFolder() const;
85 
86  /// Return true if we're the root or treatAsFolder()
87  bool isFolder() const
88  {
89  return (myPath == "/" || treatAsFolder());
90  }
91 
92  /// Accessor to GU_DetailHandle of file contents
93  /// @{
94  const GU_ConstDetailHandle &primGdh() const { return myPrimGdh; }
95  /// @}
96 
97  /// Flag accessors
98  /// @{
99  bool isExisting() const { return myExisting; }
100  void setExisting(bool f) { myExisting = f; }
101 
102  bool isModified() const { return myModified; }
103  void setModified(bool f) { myModified = f; }
104 
105  bool isTouched() const { return myTouched; }
106  void setTouched(bool f) { myTouched = f; }
107 
108  bool isCleared() const { return myCleared; }
109  void setCleared(bool f) { myCleared = f; }
110 
111  bool isVisible() const { return myVisible; }
112  void setVisible(bool f) { myVisible = f; }
113  /// @}
114 
115  private:
116  friend class GU_PackedFoldersRO;
117 
118  UT_StringHolder myPath;
119 
120  // myParentPrim is initially monostate.
121  // When myParent is a GU_PrimPacked*/GA_Range, these are primitives
122  // inside its parent's FileInfo::myPrimGdh.
123  std::variant<std::monostate, const GU_PrimPacked *, GA_Range> myParentPrim;
124 
125  // Geometry contents of this file
126  GU_ConstDetailHandle myPrimGdh;
127 
128  bool myExisting = false;
129  bool myModified = false;
130  bool myTouched = false;
131  bool myCleared = false;
132  bool myVisible = true;
133  };
134 
135  /// Construct a folder structure with its own detail
137 
138  /// Construct and build the map over the given detail, holding references
139  /// to it
141  {
142  replaceDetail(d);
143  }
144 
145  /// Construct and build the map over the given detail, holding references
146  /// to it
148  {
150  }
151 
152  ~GU_PackedFoldersRO() = default;
153 
154  /// Copy geometry and hierarchy from another GU_PackedFoldersRO
155  /// @{
158  {
159  *this = src;
160  }
162  /// @}
163 
164  /// Rebuild file map over the given detail, holding references to it
165  void replaceDetail(const GU_DetailHandle &d);
166 
167  /// Check if file at given path is a folder; returns false if file does not
168  /// exist
169  bool isFolder(const UT_StringRef &path) const;
170 
171  /// Get file access for read; returns nullptr if file does not exist
172  /// Note: GU_PackedFolders::FileInfo* can become invalid when rebuildMap() is called.
174 
175  /// Fill array with the children of this file at path, if it exists
176  /// Note: GU_PackedFolders::FileInfo* can become invalid when rebuildMap() is called.
178  const UT_StringRef &path) const;
179 
180  /// Fill array with files which path the given apex syntax pattern; returns
181  /// false on bad pattern_str
182  /// @param sorted Sorts the output list by file path. If disabled, the list
183  /// is in an arbitrary order.
184  /// Note: GU_PackedFolders::FileInfo* can become invalid when rebuildMap() is called.
185  bool findFilesByPattern(
187  const UT_StringRef &pattern_str,
188  bool sorted,
189  UT_StringHolder &error) const;
190 
191  /// Verifies packed primitive implementation pointers. Only does something
192  /// on Windows debug builds.
193  bool verify() const;
194 
195  /// Returns a string representing the topology of the whole
197 
198  /// Returns a string representing the topology of the whole folder structure
199  /// but without actually building the GU_PackedFolders.
200  static UT_StringHolder getTopoFormat(const GU_ConstDetailHandle &root_h);
201 
202 private:
203  FileInfo &rootFileInfo();
204  const FileInfo &rootFileInfo() const;
205 
206  /// Rebuild the file map from myDetail if it was changed externally.
207  void rebuildMap(const GU_ConstDetailHandle &detail);
208 
209  static void rebuildMap( const GU_ConstDetailHandle &detail,
210  UT_ArrayStringMap<FileInfo> &file_map, bool create_details);
211 
212 private:
213  UT_ArrayStringMap<FileInfo> myFileMap;
214 
215  friend GU_PackedFolders;
216 };
217 
218 /// Packed Folder Structure
220 {
221 public:
222  /// Class representing a file in the file map
223  class FileInfo
224  {
225  public:
226 
227  /// Path that this file represents
228  const UT_StringHolder &path() const { return myPath; };
229 
230  /// The parent can be in one of three states
231  /// @{
232  bool isParentEmpty() const
233  {
234  return std::holds_alternative<std::monostate>(myParentPrim);
235  }
236  bool isParentPrim() const
237  {
238  return std::holds_alternative<GU_PrimPacked *>(myParentPrim);
239  }
240  bool isParentRange() const
241  {
242  return std::holds_alternative<GA_Range>(myParentPrim);
243  }
244  /// @}
245 
246  /// Obtain parent as a GU_PrimPacked*, throws if !isParentPrim()
247  /// @{
249  {
250  UT_ASSERT(isParentPrim());
251  return std::get<GU_PrimPacked *>(myParentPrim);
252  }
253  const GU_PrimPacked *parentPrim() const
254  {
255  UT_ASSERT(isParentPrim());
256  return std::get<GU_PrimPacked *>(myParentPrim);
257  }
258  /// @}
259 
260  /// Get parent as a packed primitive, returns nullptr if not a prim
261  /// @{
263  {
264  auto *pp_prim = std::get_if<GU_PrimPacked *>(&myParentPrim);
265  return pp_prim ? *pp_prim : nullptr;
266  }
268  {
269  auto *pp_prim = std::get_if<GU_PrimPacked *>(&myParentPrim);
270  return pp_prim ? *pp_prim : nullptr;
271  }
272  /// @}
273 
274  /// Get parent as a GA_Range, throws if !isParentRange()
275  /// @{
277  {
278  UT_ASSERT(isParentRange());
279  return std::get<GA_Range>(myParentPrim);
280  }
281  const GA_Range &parentRange() const
282  {
283  UT_ASSERT(isParentRange());
284  return std::get<GA_Range>(myParentPrim);
285  }
286  /// @}
287 
288  /// Return true if parent is a packed primitive and has treatasfolder
289  /// intrinsic enabled
290  bool treatAsFolder() const
291  {
292  const GU_PrimPacked *prim = getIfParentPrim();
293  return prim && GU_PackedFolders::treatAsFolder(prim);
294  }
295 
296  /// Return true if we're the root or treatAsFolder()
297  bool isFolder() const
298  {
299  return myPath == "/" || treatAsFolder();
300  }
301 
302  /// Safe accessors to GU_ConstDetailHandle/GU_DetailHandle of file contents
303  /// @{
305  {
306  return primGdh().castAwayConst();
307  }
308 
309 
311  {
312  if (myPrimGdh.isValid())
313  {
314  return myPrimGdh;
315  }
316 
317  GU_DetailHandle new_gdh;
318  new_gdh.allocateAndSet(new GU_Detail);
319  if (getIfParentPrim())
320  {
321  parentPrim()->unpack(*new_gdh.gdpNC());
322  }
323 
324  myPrimGdh = new_gdh;
325  return myPrimGdh;
326  }
327 
328  void setPrimGdh(const GU_ConstDetailHandle &prim_gdh) { myPrimGdh = prim_gdh; }
329  /// @}
330 
331  /// Flag accessors
332  /// @{
333  bool isExisting() const { return myExisting; }
334  void setExisting(bool f) { myExisting = f; }
335 
336  bool isModified() const { return myModified; }
337  void setModified(bool f) { myModified = f; }
338 
339  bool isTouched() const { return myTouched; }
340  void setTouched(bool f) { myTouched = f; }
341 
342  bool isCleared() const { return myCleared; }
343  void setCleared(bool f) { myCleared = f; }
344 
345  bool isVisible() const { return myVisible; }
346  void setVisible(bool f) { myVisible = f; }
347  /// @}
348 
349  private:
350  friend class GU_PackedFolders;
351 
352  UT_StringHolder myPath;
353 
354  // myParentPrim is initially monostate.
355  // When myParent is a GU_PrimPacked*/GA_Range, these are primitives
356  // inside its parent's FileInfo::myPrimGdh.
357  std::variant<std::monostate, GU_PrimPacked *, GA_Range> myParentPrim;
358 
359  // Geometry contents of this file
360  mutable GU_ConstDetailHandle myPrimGdh;
361 
362  bool myExisting = false;
363  bool myModified = false;
364  bool myTouched = false;
365  bool myCleared = false;
366  bool myVisible = true;
367  };
368 
369  /// Construct a folder structure with its own detail
371 
372  /// Construct and build the map over the given detail, holding references
373  /// to it
374  /// @mark_existing Sets the Existing flag on existing paths. This affects
375  /// the removeStale() behavior.
376  /// Use mark_existing=true if you want to keep existing details as is and
377  /// only modify the touched paths.
378  /// Use mark_existing=false if you want to delete existing details that
379  /// aren't touched
380  explicit GU_PackedFolders(GU_DetailHandle &d,
381  bool reuse_detail_ids=false,
382  bool mark_existing=true
383  );
384 
385  ~GU_PackedFolders() = default;
386 
387  /// Copy geometry and hierarchy from another GU_PackedFolders
388  /// @{
390  : GU_PackedFolders()
391  {
392  *this = src;
393  }
395  /// @}
396 
397  /// Get and set treatasfolder intrinsic on a packed prim
398  static bool treatAsFolder(const GU_PrimPacked *pack);
399  static void setTreatAsFolder(GU_PrimPacked *pack, bool b);
400 
401  /// Return whether the given primitive is in _3d_hidden_primitives
402  static bool isPrimVisible(const GA_Primitive *prim);
403 
404  /// Path and name processing functions
405  /// @{
408  static void splitFileName(const UT_StringRef &label, UT_WorkBuffer &name,
410  static void splitFilePath(const UT_StringRef &path, UT_Array<UT_StringHolder> &file_names);
411  /// @}
412 
413  /// Path name validation functions to avoid paths that conflict with the
414  /// pattern matching.
415  /// @{
416  static bool isValidPathName(const UT_StringRef &path);
418  /// @}
419 
420  /// Return packed prim if the detail is a single, packed object; return
421  /// null if not
422  static const GU_PrimPacked *getPackedFromDetail(const GU_Detail *gdp);
423 
424  /// Updates the packed geometry at the given path. If no geometry exists
425  /// at the given path, the geometry will not be added.
426  /// Returns whether the geometry was successfully updated.
427  static bool updatePackedGeometry(GU_DetailHandle packed_gdh,
429  const UT_StringRef &path);
430 
431  /// Returns whether the geometry contains a packed folder geometry with the
432  /// given path.
433  /// @{
434  static bool contains(GU_ConstDetailHandle gdh,
435  const UT_StringRef &path,
436  GA_OffsetArray *offsets=nullptr);
437  static bool contains(GU_ConstDetailHandle gdh,
438  const UT_Array<UT_StringHolder> &file_names,
439  GA_OffsetArray *offsets=nullptr);
440  /// @}
441 
442  /// Helper method to set the properties on an existing file
443  /// Note: GU_PackedFolders::FileInfo* can become invalid after calling
444  /// setFileProperties(). You'll have to call the find() methods again.
445  bool setFileProperties(const UT_StringRef &path, bool treat_as_folder, bool visible);
446 
447  /// Rebuild file map over the given detail, holding references to it
449 
450  /// Update the chain of packed primitives up the path to the root detail
451  void updatePath(const UT_StringRef &path_str);
452 
453  /// Build a path of folders if it does not exist already.
454  /// Returns true if successful; fails if a file in path_str exists and is
455  /// not a folder
456  bool buildPath(const UT_StringRef &path_str);
457 
458  /// Insert/replace a file at the given path, creating the path if it does
459  /// not exist. If pack is true, pack d before adding to the folder.
460  /// If is_folder is true, set the treatasfolder intrinsic on the inserted
461  /// file.
462  /// Returns true if successful; fails if it can't create the path to the
463  /// file
464  /// Note: GU_PackedFolders::FileInfo* can become invalid after call insert()
465  /// You'll have to call the find() methods again.
466  bool insert(
467  const UT_StringRef &path,
468  const GU_ConstDetailHandle &d,
469  bool pack = true,
470  bool is_folder = false,
471  bool is_visible = true);
472 
473  /// Remove a file or folder at the given path.
474  /// Returns true if successful; fails if the given path is the root "/" or
475  /// doesn't exist.
476  bool remove(const UT_StringRef &path_str);
477 
478  /// Merges the contents of 'src_folders' into this folder structure,
479  /// filtered by the specified file pattern.
480  /// Note: GU_PackedFolders::FileInfo* can become invalid after call insert()
481  /// You'll have to call the find() methods again.
482  void merge(
483  const GU_PackedFoldersRO &src_folders,
484  const UT_StringRef &pattern);
485 
486  /// Simple struct holding the args for the remove and insert operations.
487  struct EditInfo
488  {
489  bool myRemove = false; // true to remove, false to insert.
490  UT_StringHolder myPath; // The path to insert or remove
491 
492  // Extra args for Insert
493  GU_ConstDetailHandle myDetail; // Detail to insert.
494  bool myPack = true; // insert pack
495  bool myIsFolder = false; //insert is_folder
496  bool myIsVisible = true; // insert is_visibled
497 
498  bool myRet = false; // Return code for the operation.
499  };
500 
501  /// Accumulate edit operations in a block.
503  {
504  public:
505  /// Insert a detail at the given path.
506  void insert(
507  const UT_StringRef &path,
508  const GU_ConstDetailHandle &d,
509  bool pack = true,
510  bool is_folder = false,
511  bool is_visible = true)
512  {
513  EditInfo o;
514  o.myRemove = false;
515  o.myPath = path;
516  o.myDetail = d;
517  o.myPack = pack;
518  o.myIsFolder = is_folder;
519  o.myIsVisible = is_visible;
520  myOps.append(o);
521  }
522 
523  /// Remove a path
524  void remove(const UT_StringRef &path)
525  {
526  EditInfo o;
527  o.myRemove = true;
528  o.myPath = path;
529  myOps.append(o);
530  }
531 
532  /// Remove a FileInfo
533  void remove(const FileInfo *fi)
534  {
535  EditInfo o;
536  o.myRemove = true;
537  o.myPath = fi->path();
538  myOps.append(o);
539  }
540 
541  /// Move a FileInfo to a new path. Does an insert and remove.
542  void move(const FileInfo *fi, const UT_StringRef &new_path, bool pack)
543  {
544  EditInfo i;
545  i.myRemove = false;
546  i.myPath = new_path;
547  i.myDetail = fi->primGdh();
548  i.myPack = pack;
549  i.myIsFolder = fi->isFolder();
550  i.myIsVisible = fi->isVisible();
551  myOps.append(i);
552 
553  EditInfo r;
554  r.myRemove = true;
555  r.myPath = fi->path();
556  myOps.append(r);
557  }
558 
560  };
561  /// Perform multiple insert/remove/move operations in a single step.
562  /// Returns true if all the operations succeeded.
563  /// o.myOps[i].myRet has the return status of individual edit operations.
564  /// Note: GU_PackedFolders::FileInfo* can become invalid when rebuildMap()
565  /// is called and it is likely to happen after doing many operations.
566  /// You'll have to call the find() methods again.
567  bool edit(EditOperations &o);
568 
569 
570  /// Set flags to true on a given file and if desired, its children
571  void setFlags(
572  const UT_StringRef &path,
573  bool existing,
574  bool modified,
575  bool touched,
576  bool and_children = false);
577 
578  /// Clear flags to false on a given file and if desired, its children
579  void clearFlags(
580  const UT_StringRef &path,
581  bool existing,
582  bool modified,
583  bool touched,
584  bool and_children = false);
585 
586  /// Sets touch flag on a given file & its children if and_children is true
587  void touch(const UT_StringRef &path, bool and_children = false);
588 
589  /// Mark all folders in the path given as touched
590  void touchFolders(const UT_StringRef &path_str);
591 
592  /// Removes stale files which are flagged as untouched.
593  /// Files flagged existing if found by replaceDetail()/rebuildMap() are
594  /// protected. If backup is provided, files which are untouched, modified,
595  /// and existing will be replaced by the copy in backup. Files are marked
596  /// modified if created/replaced by insert().
597  void removeStale(const GU_PackedFolders *backup = nullptr);
598 
599  /// Check if file at given path is a folder; returns false if file does not
600  /// exist
601  bool isFolder(const UT_StringRef &path) const;
602 
603  /// Get file access for read; returns nullptr if file does not exist
604  /// Note: GU_PackedFolders::FileInfo* can become invalid when rebuildMap() is called.
605  /// It can happen when calling insert() or setFileProperties()
606  const GU_PackedFolders::FileInfo *findFile(const UT_StringRef &path) const;
607 
608  /// Fill array with the children of this file at path, if it exists
609  /// Note: GU_PackedFolders::FileInfo* can become invalid when rebuildMap() is called.
610  /// It can happen when calling insert() or setFileProperties()
611  void findChildren(UT_Array<const GU_PackedFolders::FileInfo *> &out,
612  const UT_StringRef &path) const;
613 
614  /// Fill array with files which path the given apex syntax pattern; returns
615  /// false on bad pattern_str
616  /// @param sorted Sorts the output list by file path. If disabled, the list
617  /// is in an arbitrary order.
618  /// Note: GU_PackedFolders::FileInfo* can become invalid when rebuildMap() is called.
619  /// It can happen when calling insert() or setFileProperties()
620  bool findFilesByPattern(
622  const UT_StringRef &pattern_str,
623  bool sorted,
624  UT_StringHolder &error) const;
625 
626  /// Verifies packed primitive implementation pointers. Only does something
627  /// on Windows debug builds.
628  bool verify() const;
629 
630  /// Returns a string representing the topology of the whole
631  UT_StringHolder getTopoFormat() const;
632 
633 private:
634  FileInfo &rootFileInfo();
635  const FileInfo &rootFileInfo() const;
636 
637  /// Rebuild the file map from myDetail if it was changed externally.
638  /// It will clear children of the given path before rebuilding.
639  /// If path does not exist in the map, it will fail silently.
640  /// If mark_existing, myExisting flag will be set on files.
641  ///
642  /// This can corrupt GU_PackedFolders::FileInfo* returned by
643  // findFile(), findChildren(), findFilesByPattern()
644  void rebuildMap(GU_DetailHandle *detail, const UT_StringRef &path,
645  bool mark_existing = true, bool reuse_detail_ids=false);
646 
647  /// internal insert call that accumulates the paths to rebuild.
648  bool insert(
649  const UT_StringRef &path,
650  const GU_ConstDetailHandle &d,
651  UT_StringArray &rebuild_paths,
652  bool pack = true,
653  bool is_folder = false,
654  bool is_visible = true);
655 
656 private:
657  UT_ArrayStringMap<FileInfo> myFileMap;
658 };
659 
661 bool
663 {
664  const GU_PrimPacked *prim = getIfParentPrim();
665  return prim && GU_PackedFolders::treatAsFolder(prim);
666 }
667 
668 namespace UT
669 {
670 template <typename T>
671 struct DefaultClearer;
672 
673 template <>
675 {
676  static void clear(GU_PackedFoldersRO::FileInfo &v) { v.setCleared(true); }
678  {
679  return v.isCleared();
680  }
682  {
683  new ((void *)p) GU_PackedFoldersRO::FileInfo();
684  }
685  static const bool clearNeedsDestruction = true;
686 };
687 
688 template <>
690 {
691  static void clear(GU_PackedFolders::FileInfo &v) { v.setCleared(true); }
693  {
694  return v.isCleared();
695  }
697  {
698  new ((void *)p) GU_PackedFolders::FileInfo();
699  }
700  static const bool clearNeedsDestruction = true;
701 };
702 } // namespace UT
703 
704 #endif
bool isFolder(const UT_StringRef &path) const
static bool treatAsFolder(const GU_PrimPacked *pack)
Get and set treatasfolder intrinsic on a packed prim.
static UT_StringHolder forceValidPathName(const UT_StringRef &path)
static bool isValidPathName(const UT_StringRef &path)
static void setTreatAsFolder(GU_PrimPacked *pack, bool b)
GLuint GLsizei const GLchar * label
Definition: glcorearb.h:2545
GU_PackedFoldersRO(const GU_PackedFoldersRO &src)
GU_ConstDetailHandle myDetail
const GU_ConstDetailHandle & primGdh() const
~GU_PackedFolders()=default
static void splitFilePath(const UT_StringRef &path, UT_Array< UT_StringHolder > &file_names)
const GLdouble * v
Definition: glcorearb.h:837
GU_DetailHandle castAwayConst() const
Accumulate edit operations in a block.
GLsizei const GLchar *const * path
Definition: glcorearb.h:3341
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].
Definition: simd.h:3556
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)
void setPrimGdh(const GU_ConstDetailHandle &prim_gdh)
static void clearConstruct(GU_PackedFoldersRO::FileInfo *p)
A range of elements in an index-map.
Definition: GA_Range.h:42
GLuint GLsizei const GLuint const GLintptr * offsets
Definition: glcorearb.h:2621
< returns > If no error
Definition: snippets.dox:2
static void splitFileName(const UT_StringRef &label, UT_WorkBuffer &name, UT_WorkBuffer &type)
void allocateAndSet(GU_Detail *gdp, bool own=true)
GLfloat f
Definition: glcorearb.h:1926
GLint GLint GLsizei GLint GLenum GLenum type
Definition: glcorearb.h:108
static bool updatePackedGeometry(GU_DetailHandle packed_gdh, GU_ConstDetailHandle gdh, const UT_StringRef &path)
GU_DetailHandle safePrimGdhNC()
#define SYS_FORCE_INLINE
Definition: SYS_Inline.h:45
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
Packed Folder Structure.
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.
#define GU_API
Definition: GU_API.h:14
GLuint const GLchar * name
Definition: glcorearb.h:786
GLushort pattern
Definition: glad.h:2583
GLboolean GLboolean GLboolean b
Definition: glcorearb.h:1222
GU_PackedFoldersRO(const GU_ConstDetailHandle &d)
bool isFolder() const
Return true if we're the root or treatAsFolder()
GU_Detail * gdpNC()
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)
const GU_PrimPacked * parentPrim() const
~GU_PackedFoldersRO()=default
#define UT_ASSERT(ZZ)
Definition: UT_Assert.h:165
bool isFolder() const
Return true if we're the root or treatAsFolder()
bool verify() const
OutGridT XformOp bool bool MergePolicy merge
GLboolean r
Definition: glcorearb.h:1222
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)
GLenum src
Definition: glcorearb.h:1793
static bool isClear(const GU_PackedFoldersRO::FileInfo &v)