Skip to content
Snippets Groups Projects
Select Git revision
  • 809b3771f95afcebd0db93d21ca36ecb05e9d524
  • master default protected
  • blender-v3.6-release
  • main
  • blender-v4.1-release
  • blender-v4.0-release
  • blender-v3.3-release
  • asset-shelf
  • blender-v3.5-release
  • brush-assets-project
  • blender-v2.93-release
  • blender-v3.4-release
  • xr-dev
  • bholodeck-v3.3
  • blender-v3.2-release
  • temp-xr-tracker
  • blender-v3.1-release
  • screenshots-manual
  • gltf_vtree
  • blender-v2.83-release
  • blender-v3.0-release
  • v3.6.18
  • v3.6.19
  • v3.6.20
  • v3.6.21
  • v3.6.22
  • v3.6.23
  • v4.1.1
  • v4.1.0
  • v3.6.10
  • v3.6.11
  • v3.6.12
  • v3.6.13
  • v3.6.14
  • v3.6.15
  • v3.6.16
  • v3.6.17
  • v3.6.9
  • v3.3.16
  • v3.6.8
  • v3.3.15
41 results

development_iskeyfree.py

Blame
  • asset_catalog.cc 35.53 KiB
    /* SPDX-License-Identifier: GPL-2.0-or-later */
    
    /** \file
     * \ingroup bke
     */
    
    #include <fstream>
    #include <set>
    
    #include "BKE_asset_catalog.hh"
    #include "BKE_asset_library.h"
    
    #include "BLI_fileops.hh"
    #include "BLI_path_util.h"
    
    /* For S_ISREG() and S_ISDIR() on Windows. */
    #ifdef WIN32
    #  include "BLI_winstuff.h"
    #endif
    
    #include "CLG_log.h"
    
    static CLG_LogRef LOG = {"bke.asset_service"};
    
    namespace blender::bke {
    
    const CatalogFilePath AssetCatalogService::DEFAULT_CATALOG_FILENAME = "blender_assets.cats.txt";
    
    const int AssetCatalogDefinitionFile::SUPPORTED_VERSION = 1;
    const std::string AssetCatalogDefinitionFile::VERSION_MARKER = "VERSION ";
    
    const std::string AssetCatalogDefinitionFile::HEADER =
        "# This is an Asset Catalog Definition file for Blender.\n"
        "#\n"
        "# Empty lines and lines starting with `#` will be ignored.\n"
        "# The first non-ignored line should be the version indicator.\n"
        "# Other lines are of the format \"UUID:catalog/path/for/assets:simple catalog name\"\n";
    
    AssetCatalogService::AssetCatalogService()
        : catalog_collection_(std::make_unique<AssetCatalogCollection>())
    {
    }
    
    AssetCatalogService::AssetCatalogService(const CatalogFilePath &asset_library_root)
        : catalog_collection_(std::make_unique<AssetCatalogCollection>()),
          asset_library_root_(asset_library_root)
    {
    }
    
    void AssetCatalogService::tag_has_unsaved_changes(AssetCatalog *edited_catalog)
    {
      if (edited_catalog) {
        edited_catalog->flags.has_unsaved_changes = true;
      }
      BLI_assert(catalog_collection_);
      catalog_collection_->has_unsaved_changes_ = true;
    }
    
    void AssetCatalogService::untag_has_unsaved_changes()
    {
      BLI_assert(catalog_collection_);
      catalog_collection_->has_unsaved_changes_ = false;
    
      /* TODO(Sybren): refactor; this is more like "post-write cleanup" than "remove a tag" code. */
    
      /* Forget about any deleted catalogs. */
      if (catalog_collection_->catalog_definition_file_) {
        for (CatalogID catalog_id : catalog_collection_->deleted_catalogs_.keys()) {
          catalog_collection_->catalog_definition_file_->forget(catalog_id);
        }