#pragma once #include #include #include namespace UsdLayerManager { /// Symbolic icon names used throughout the UI. enum class Icon { // Visibility Eye, EyeSlash, // Reference state Link, LinkSlash, // Prim types Globe, // PseudoRoot / World Cube, // Mesh / Subdiv Camera, Lightbulb, // Light FolderOpen, // Scope ObjectGroup, // Xform Swatchbook, // Material Code, // Shader LayerGroup, // Model CircleDot, // Generic prim // Viewport manipulator tools ToolSelect, // cursor / arrow-pointer ToolMove, // four-directional arrows ToolRotate, // circular arrows ToolScale, // expand/compress arrows // Viewport display toggles WorldSpace, // globe / world coordinate space LocalSpace, // coordinate axes / local object space Grid, // ground grid toggle Antialias, // anti-aliasing toggle // Viewport layout modes LayoutSingle, // single viewport LayoutHSplit, // two panels side-by-side LayoutVSplit, // two panels top/bottom LayoutQuad, // four panels 2×2 // Timeline transport SkipBack, // go to first frame (|◀) StepBack, // previous frame (◀◀) Play, // play (▶) Pause, // pause (⏸) StepForward, // next frame (▶▶) SkipEnd, // go to last frame (▶|) }; /// Loads SVG files from disk, rasterizes them with NanoSVG, uploads them as /// OpenGL textures, and hands out ImTextureID handles for use with /// ImGui::Image() / ImGui::ImageButton(). /// /// Lifecycle: Initialize() after OpenGL is ready, Shutdown() before context /// is destroyed. One global instance is owned by Application. class IconManager { public: IconManager(); ~IconManager(); /// Load and rasterize all icons from the given directory. /// @param iconDir Path to the directory containing the .svg files. /// @param sizePixels Rasterisation size in pixels (both axes). bool Initialize(const std::string& iconDir, int sizePixels = 16); /// Release all GPU textures. void Shutdown(); /// Return the ImTextureID for the given icon. /// Returns a 1×1 transparent fallback texture when the icon is missing. ImTextureID Get(Icon icon) const; /// Pixel size the icons were rasterised at. int SizePixels() const { return m_sizePixels; } ImVec2 SizeVec() const { return ImVec2(static_cast(m_sizePixels), static_cast(m_sizePixels)); } private: bool LoadSVG(Icon icon, const std::string& path); void CreateFallback(); int m_sizePixels = 16; ImTextureID m_fallback = ImTextureID_Invalid; std::unordered_map m_textures; // key = (int)Icon }; } // namespace UsdLayerManager