mirror of
https://github.com/aseprite/aseprite.git
synced 2025-04-15 11:42:30 +00:00
Get default palette from extensions
This commit is contained in:
parent
c4d0273e4e
commit
587b8b6dd7
@ -303,7 +303,7 @@ Extensions::~Extensions()
|
||||
std::string Extensions::themePath(const std::string& themeId)
|
||||
{
|
||||
for (auto ext : m_extensions) {
|
||||
if (!ext->isEnabled()) // Ignore disabled themes
|
||||
if (!ext->isEnabled()) // Ignore disabled extensions
|
||||
continue;
|
||||
|
||||
auto it = ext->themes().find(themeId);
|
||||
@ -313,6 +313,19 @@ std::string Extensions::themePath(const std::string& themeId)
|
||||
return std::string();
|
||||
}
|
||||
|
||||
std::string Extensions::palettePath(const std::string& palId)
|
||||
{
|
||||
for (auto ext : m_extensions) {
|
||||
if (!ext->isEnabled()) // Ignore disabled extensions
|
||||
continue;
|
||||
|
||||
auto it = ext->palettes().find(palId);
|
||||
if (it != ext->palettes().end())
|
||||
return it->second;
|
||||
}
|
||||
return std::string();
|
||||
}
|
||||
|
||||
ExtensionItems Extensions::palettes() const
|
||||
{
|
||||
ExtensionItems palettes;
|
||||
|
@ -79,6 +79,7 @@ namespace app {
|
||||
Extension* installCompressedExtension(const std::string& zipFn);
|
||||
|
||||
std::string themePath(const std::string& themeId);
|
||||
std::string palettePath(const std::string& palId);
|
||||
ExtensionItems palettes() const;
|
||||
|
||||
obs::signal<void(Extension*)> NewExtension;
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Aseprite
|
||||
// Copyright (C) 2001-2016 David Capello
|
||||
// Copyright (C) 2001-2017 David Capello
|
||||
//
|
||||
// This program is distributed under the terms of
|
||||
// the End-User License Agreement for Aseprite.
|
||||
@ -11,6 +11,7 @@
|
||||
#include "app/modules/palettes.h"
|
||||
|
||||
#include "app/app.h"
|
||||
#include "app/extensions.h"
|
||||
#include "app/file/palette_file.h"
|
||||
#include "app/resource_finder.h"
|
||||
#include "base/fs.h"
|
||||
@ -98,11 +99,11 @@ void load_default_palette()
|
||||
// If the default palette file doesn't exist, we copy db32.gpl
|
||||
// as the default one (default.ase).
|
||||
else {
|
||||
ResourceFinder rf;
|
||||
rf.includeDataDir("palettes/db32.gpl");
|
||||
if (rf.findFirst()) {
|
||||
pal.reset(load_palette(rf.filename().c_str()));
|
||||
}
|
||||
std::string path = App::instance()->extensions().palettePath("db32");
|
||||
if (path.empty())
|
||||
path = App::instance()->extensions().palettePath("vga-13h");
|
||||
if (!path.empty())
|
||||
pal.reset(load_palette(path.c_str()));
|
||||
}
|
||||
|
||||
// Save default.ase file
|
||||
|
Loading…
x
Reference in New Issue
Block a user