mirror of
https://bitbucket.org/mfeemster/fractorium.git
synced 2025-01-21 05:00:06 -05:00
--Bug fixes
-Add missing Mac build files. -Convert PaletteList into a Singleton<T>.
This commit is contained in:
parent
00189531fc
commit
29c084a058
@ -1,6 +1,9 @@
|
||||
TEMPLATE = app
|
||||
CONFIG += console
|
||||
CONFIG -= app_bundle
|
||||
|
||||
# Uncomment this if you only want to build a binary instead of an app bundle.
|
||||
#macx:CONFIG -= app_bundle
|
||||
|
||||
CONFIG -= qt
|
||||
|
||||
TARGET = emberanimate
|
||||
|
@ -1,6 +1,9 @@
|
||||
TEMPLATE = app
|
||||
CONFIG += console
|
||||
CONFIG -= app_bundle
|
||||
|
||||
# Uncomment this if you only want to build a binary instead of an app bundle.
|
||||
#macx:CONFIG -= app_bundle
|
||||
|
||||
CONFIG -= qt
|
||||
|
||||
TARGET = embergenome
|
||||
|
@ -1,6 +1,9 @@
|
||||
TEMPLATE = app
|
||||
CONFIG += console
|
||||
CONFIG -= app_bundle
|
||||
|
||||
# Uncomment this if you only want to build a binary instead of an app bundle.
|
||||
#macx:CONFIG -= app_bundle
|
||||
|
||||
CONFIG -= qt
|
||||
|
||||
TARGET = emberrender
|
||||
|
@ -45,9 +45,8 @@ CONFIG(debug, debug|release) {
|
||||
INCLUDEPATH += $$PRJ_SRC_DIR
|
||||
INCLUDEPATH += $$PRJ_SRC_DIR/PaletteEditor
|
||||
|
||||
# TODO: Figure out how to build the app bundle correctly.
|
||||
# This will build a binary instead of an app bundle.
|
||||
macx:CONFIG -= app_bundle
|
||||
# Uncomment this if you only want to build a binary instead of an app bundle.
|
||||
#macx:CONFIG -= app_bundle
|
||||
|
||||
target.path = $$BIN_INSTALL_DIR
|
||||
#message(TARGET INSTALL: $$target.path)
|
||||
|
@ -56,8 +56,6 @@ uint Timing::m_ProcessorCount;
|
||||
template class Post##varName##Variation<T>;
|
||||
|
||||
#define EXPORT_SINGLE_TYPE_EMBER(T) \
|
||||
template<> const char* PaletteList<T>::m_DefaultFilename = "flam3-palettes.xml"; \
|
||||
template<> map<string, vector<Palette<T>>> PaletteList<T>::s_Palettes = map<string, vector<Palette<T>>>(); \
|
||||
template<> bool XmlToEmber<T>::m_Init = false; \
|
||||
template<> vector<string> XmlToEmber<T>::m_FlattenNames = vector<string>(); \
|
||||
template<> unordered_map<string, string> XmlToEmber<T>::m_BadParamNames = unordered_map<string, string>(); \
|
||||
|
@ -9,7 +9,6 @@ namespace EmberNs
|
||||
template <typename T>
|
||||
PaletteList<T>::PaletteList()
|
||||
{
|
||||
//Add(string(m_DefaultFilename));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -20,14 +20,11 @@ namespace EmberNs
|
||||
/// Template argument should always be float (which makes the templating of this class pointless).
|
||||
/// </summary>
|
||||
template <typename T>
|
||||
class EMBER_API PaletteList : public EmberReport
|
||||
class EMBER_API PaletteList : public EmberReport, public Singleton<PaletteList<T>>
|
||||
{
|
||||
public:
|
||||
static const char* m_DefaultFilename;
|
||||
const char* m_DefaultFilename = "flam3-palettes.xml";
|
||||
|
||||
PaletteList();
|
||||
PaletteList(const PaletteList<T>& paletteList) = delete;
|
||||
~PaletteList();
|
||||
bool AddPaletteFile(const string& filename, const vector<Palette<T>>& palettes);
|
||||
bool AddEmptyPaletteFile(const string& filename);
|
||||
bool AddPaletteToFile(const string& filename, const Palette<T>& palette);
|
||||
@ -52,11 +49,12 @@ public:
|
||||
bool IsModifiable(const string& filename);
|
||||
const map<string, vector<Palette<T>>>& Palettes() const;
|
||||
|
||||
SINGLETON_DERIVED_DECL(PaletteList<T>);
|
||||
private:
|
||||
PaletteList();
|
||||
bool Save(const string& filename);
|
||||
void ParsePalettes(xmlNode* node, const shared_ptr<string>& filename, vector<Palette<T>>& palettes);
|
||||
bool ParsePalettes(const string& buf, const shared_ptr<string>& filename, vector<Palette<T>>& palettes);
|
||||
|
||||
static map<string, vector<Palette<T>>> s_Palettes;//The map of filenames to vectors that store the palettes.
|
||||
map<string, vector<Palette<T>>> s_Palettes;//The map of filenames to vectors that store the palettes.
|
||||
};
|
||||
}
|
||||
|
@ -62,10 +62,11 @@ public:
|
||||
/// <param name="palettePath">The full path and filename of the palette file</param>
|
||||
/// <param name="renderer">A pre-constructed renderer to use. The caller should not delete this.</param>
|
||||
SheepTools(const string& palettePath, Renderer<T, bucketT>* renderer)
|
||||
: m_VariationList(VariationList<T>::Instance())
|
||||
: m_VariationList(VariationList<T>::Instance()),
|
||||
m_PaletteList(PaletteList<float>::Instance())
|
||||
{
|
||||
Timing t;
|
||||
m_PaletteList.Add(palettePath);
|
||||
m_PaletteList->Add(palettePath);
|
||||
m_Renderer = unique_ptr<Renderer<T, bucketT>>(renderer);
|
||||
m_Rand = QTIsaac<ISAAC_SIZE, ISAAC_INT>(ISAAC_INT(t.Tic()), ISAAC_INT(t.Tic() * 2), ISAAC_INT(t.Tic() * 3));
|
||||
}
|
||||
@ -90,8 +91,8 @@ public:
|
||||
ember.AddXform(xform2);
|
||||
ember.AddXform(xform3);
|
||||
|
||||
if (m_PaletteList.Size())
|
||||
ember.m_Palette = *m_PaletteList.GetRandomPalette();
|
||||
if (m_PaletteList->Size())
|
||||
ember.m_Palette = *m_PaletteList->GetRandomPalette();
|
||||
|
||||
return ember;
|
||||
}
|
||||
@ -365,8 +366,8 @@ public:
|
||||
}
|
||||
else//Randomize palette only.
|
||||
{
|
||||
if (m_PaletteList.Size())
|
||||
ember.m_Palette = *m_PaletteList.GetRandomPalette();
|
||||
if (m_PaletteList->Size())
|
||||
ember.m_Palette = *m_PaletteList->GetRandomPalette();
|
||||
|
||||
//If the palette retrieval fails, skip the mutation.
|
||||
if (ember.m_Palette.m_Index >= 0)
|
||||
@ -607,8 +608,8 @@ public:
|
||||
};
|
||||
ember.Clear();
|
||||
|
||||
if (m_PaletteList.Size())
|
||||
ember.m_Palette = *m_PaletteList.GetRandomPalette();
|
||||
if (m_PaletteList->Size())
|
||||
ember.m_Palette = *m_PaletteList->GetRandomPalette();
|
||||
|
||||
ember.m_Time = 0;
|
||||
ember.m_Interp = eInterp::EMBER_INTERP_LINEAR;
|
||||
@ -883,9 +884,9 @@ public:
|
||||
{
|
||||
if (changePalette)
|
||||
{
|
||||
if (m_PaletteList.Size())
|
||||
if (m_PaletteList->Size())
|
||||
{
|
||||
ember.m_Palette = *m_PaletteList.GetRandomPalette();
|
||||
ember.m_Palette = *m_PaletteList->GetRandomPalette();
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1365,7 +1366,7 @@ private:
|
||||
unique_ptr<XaosIterator<T>> m_XaosIterator = make_unique<XaosIterator<T>>();
|
||||
unique_ptr<Renderer<T, bucketT>> m_Renderer;
|
||||
QTIsaac<ISAAC_SIZE, ISAAC_INT> m_Rand;
|
||||
PaletteList<float> m_PaletteList;
|
||||
shared_ptr<PaletteList<float>> m_PaletteList;
|
||||
shared_ptr<VariationList<T>> m_VariationList;
|
||||
};
|
||||
}
|
||||
|
@ -37,7 +37,8 @@ Locale::~Locale()
|
||||
/// </summary>
|
||||
template <typename T>
|
||||
XmlToEmber<T>::XmlToEmber()
|
||||
: m_VariationList(VariationList<T>::Instance())
|
||||
: m_VariationList(VariationList<T>::Instance()),
|
||||
m_PaletteList(PaletteList<float>::Instance())
|
||||
{
|
||||
Timing t;
|
||||
|
||||
@ -388,7 +389,7 @@ bool XmlToEmber<T>::Parse(const char* filename, C<Ember<T>, Alloc>& embers, bool
|
||||
string buf;
|
||||
|
||||
//Ensure palette list is setup first.
|
||||
if (!m_PaletteList.Size())
|
||||
if (!m_PaletteList->Size())
|
||||
{
|
||||
AddToReport(string(loc) + " : Palette list must be initialized before parsing embers.");
|
||||
return false;
|
||||
@ -468,7 +469,7 @@ void XmlToEmber<T>::ScanForEmberNodes(xmlNode* curNode, char* parentFile, C<Embe
|
||||
|
||||
if (currentEmber.PaletteIndex() != -1)
|
||||
{
|
||||
if (auto pal = m_PaletteList.GetPaletteByFilename(PaletteList<T>::m_DefaultFilename, currentEmber.PaletteIndex()))
|
||||
if (auto pal = m_PaletteList->GetPaletteByFilename(m_PaletteList->m_DefaultFilename, currentEmber.PaletteIndex()))
|
||||
currentEmber.m_Palette = *pal;
|
||||
else
|
||||
AddToReport(string(loc) + " : Error assigning palette with index " + std::to_string(currentEmber.PaletteIndex()));
|
||||
|
@ -71,6 +71,6 @@ private:
|
||||
static unordered_map<string, string> m_BadParamNames;
|
||||
static vector<pair<pair<string, string>, vector<string>>> m_BadVariationNames;
|
||||
shared_ptr<VariationList<T>> m_VariationList;//The variation list used to make copies of variations to populate the embers with.
|
||||
PaletteList<T> m_PaletteList;
|
||||
shared_ptr<PaletteList<float>> m_PaletteList;
|
||||
};
|
||||
}
|
||||
|
@ -137,7 +137,7 @@ bool EmberAnimate(EmberOptions& opt)
|
||||
renderers.push_back(std::move(tempRenderer));
|
||||
}
|
||||
|
||||
if (!InitPaletteList<T>(opt.PalettePath()))//For any modern flames, the palette isn't used. This is for legacy purposes and should be removed.
|
||||
if (!InitPaletteList<float>(opt.PalettePath()))//For any modern flames, the palette isn't used. This is for legacy purposes and should be removed.
|
||||
return false;
|
||||
|
||||
cout << "Parsing ember file " << opt.Input() << "\n";
|
||||
@ -456,6 +456,7 @@ int _tmain(int argc, _TCHAR* argv[])
|
||||
|
||||
if (!opt.Populate(argc, argv, eOptionUse::OPT_USE_ANIMATE))
|
||||
{
|
||||
auto palf = PaletteList<float>::Instance();
|
||||
#ifdef DO_DOUBLE
|
||||
|
||||
if (!opt.Sp())
|
||||
|
@ -122,7 +122,7 @@ static bool ParseEmberFile(XmlToEmber<T>& parser, const string& filename, vector
|
||||
template <typename T>
|
||||
static bool InitPaletteList(const string& filename)
|
||||
{
|
||||
PaletteList<T> paletteList;//Even though this is local, the members are static so they will remain.
|
||||
auto paletteList = PaletteList<float>::Instance();
|
||||
static vector<string> paths =
|
||||
{
|
||||
"./"
|
||||
@ -138,15 +138,15 @@ static bool InitPaletteList(const string& filename)
|
||||
for (auto& p : paths)
|
||||
{
|
||||
if (!added)
|
||||
added |= paletteList.Add(p + "/" + filename);
|
||||
added |= paletteList->Add(p + "/" + filename);
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
||||
if (!added || !paletteList.Size())
|
||||
if (!added || !paletteList->Size())
|
||||
{
|
||||
cout << "Error parsing palette file " << filename << ". Reason: \n"
|
||||
<< paletteList.ErrorReportString() << "\nReturning without executing.\n";
|
||||
<< paletteList->ErrorReportString() << "\nReturning without executing.\n";
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -203,7 +203,7 @@ bool EmberGenome(EmberOptions& opt)
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!InitPaletteList<T>(opt.PalettePath()))
|
||||
if (!InitPaletteList<float>(opt.PalettePath()))
|
||||
return false;
|
||||
|
||||
if (!opt.EmberCL())
|
||||
@ -562,7 +562,7 @@ bool EmberGenome(EmberOptions& opt)
|
||||
cout << emberToXml.ToString(result1, opt.Extras(), opt.PrintEditDepth(), !opt.NoEdits(), opt.HexPalette());
|
||||
}
|
||||
|
||||
tools.Spin(embers[0], pTemplate, result2, frame , blend , opt.CwLoops());
|
||||
tools.Spin(embers[0], pTemplate, result2, frame, blend, opt.CwLoops());
|
||||
tools.Spin(embers[0], pTemplate, result3, frame + 1, blend + spread, opt.CwLoops());
|
||||
cout << emberToXml.ToString(result2, opt.Extras(), opt.PrintEditDepth(), !opt.NoEdits(), opt.HexPalette());
|
||||
cout << emberToXml.ToString(result3, opt.Extras(), opt.PrintEditDepth(), !opt.NoEdits(), opt.HexPalette());
|
||||
@ -581,7 +581,7 @@ bool EmberGenome(EmberOptions& opt)
|
||||
cout << emberToXml.ToString(result1, opt.Extras(), opt.PrintEditDepth(), !opt.NoEdits(), opt.HexPalette());
|
||||
}
|
||||
|
||||
tools.SpinInter(embers.data(), pTemplate, result2, frame , false, blend , opt.InterpLoops(), opt.CwInterpLoops());
|
||||
tools.SpinInter(embers.data(), pTemplate, result2, frame, false, blend, opt.InterpLoops(), opt.CwInterpLoops());
|
||||
tools.SpinInter(embers.data(), pTemplate, result3, frame + 1, false, blend + spread, opt.InterpLoops(), opt.CwInterpLoops());
|
||||
cout << emberToXml.ToString(result2, opt.Extras(), opt.PrintEditDepth(), !opt.NoEdits(), opt.HexPalette());
|
||||
cout << emberToXml.ToString(result3, opt.Extras(), opt.PrintEditDepth(), !opt.NoEdits(), opt.HexPalette());
|
||||
@ -862,6 +862,7 @@ int _tmain(int argc, _TCHAR* argv[])
|
||||
|
||||
if (!opt.Populate(argc, argv, eOptionUse::OPT_USE_GENOME))
|
||||
{
|
||||
auto palf = PaletteList<float>::Instance();
|
||||
#ifdef DO_DOUBLE
|
||||
|
||||
if (!opt.Sp())
|
||||
|
@ -63,7 +63,7 @@ bool EmberRender(EmberOptions& opt)
|
||||
if (opt.EmberCL() && renderer->RendererType() != eRendererType::OPENCL_RENDERER)//OpenCL init failed, so fall back to CPU.
|
||||
opt.EmberCL(false);
|
||||
|
||||
if (!InitPaletteList<T>(opt.PalettePath()))//For any modern flames, the palette isn't used. This is for legacy purposes and should be removed.
|
||||
if (!InitPaletteList<float>(opt.PalettePath()))//For any modern flames, the palette isn't used. This is for legacy purposes and should be removed.
|
||||
return false;
|
||||
|
||||
if (!ParseEmberFile(parser, opt.Input(), embers))
|
||||
@ -349,6 +349,7 @@ int _tmain(int argc, _TCHAR* argv[])
|
||||
|
||||
if (!opt.Populate(argc, argv, eOptionUse::OPT_USE_RENDER))
|
||||
{
|
||||
auto palf = PaletteList<float>::Instance();
|
||||
#ifdef DO_DOUBLE
|
||||
|
||||
if (!opt.Sp())
|
||||
|
@ -88,9 +88,9 @@ void MakeTestAllVarsRegPrePost(vector<Ember<T>>& embers)
|
||||
uint index = 0;
|
||||
ostringstream ss;
|
||||
auto varList = VariationList<T>::Instance();
|
||||
PaletteList<T> paletteList;
|
||||
auto paletteList = PaletteList<float>::Instance();
|
||||
QTIsaac<ISAAC_SIZE, ISAAC_INT> rand;
|
||||
paletteList.Add("flam3-palettes.xml");
|
||||
paletteList->Add("flam3-palettes.xml");
|
||||
Timing t;
|
||||
Ember<T> emberNoVars;
|
||||
emberNoVars.m_FinalRasW = 640;
|
||||
@ -113,7 +113,7 @@ void MakeTestAllVarsRegPrePost(vector<Ember<T>>& embers)
|
||||
ss << "NoVars";
|
||||
emberNoVars.m_Name = ss.str();
|
||||
ss.str("");
|
||||
emberNoVars.m_Palette = *paletteList.GetPaletteByFilename(paletteList.m_DefaultFilename, 0);
|
||||
emberNoVars.m_Palette = *paletteList->GetPaletteByFilename(paletteList->m_DefaultFilename, 0);
|
||||
embers.push_back(emberNoVars);
|
||||
|
||||
while (index < varList->RegSize())
|
||||
@ -176,7 +176,7 @@ void MakeTestAllVarsRegPrePost(vector<Ember<T>>& embers)
|
||||
ss << index << "_" << regVar->Name();
|
||||
ember1.m_Name = ss.str();
|
||||
ss.str("");
|
||||
ember1.m_Palette = *paletteList.GetRandomPalette();
|
||||
ember1.m_Palette = *paletteList->GetRandomPalette();
|
||||
index++;
|
||||
embers.push_back(ember1);
|
||||
}
|
||||
@ -1078,10 +1078,10 @@ void PrintAllVars()
|
||||
void TestXformsInOutPoints()
|
||||
{
|
||||
uint index = 0;
|
||||
auto varList(VariationList<float>::Instance());
|
||||
PaletteList<float> paletteList;
|
||||
auto varList = VariationList<float>::Instance();
|
||||
auto paletteList = PaletteList<float>::Instance();
|
||||
QTIsaac<ISAAC_SIZE, ISAAC_INT> rand;
|
||||
paletteList.Add("flam3-palettes.xml");
|
||||
paletteList->Add("flam3-palettes.xml");
|
||||
|
||||
while (index < varList->RegSize())
|
||||
{
|
||||
@ -1975,8 +1975,8 @@ int _tmain(int argc, _TCHAR* argv[])
|
||||
|
||||
TestThreadedKernel();
|
||||
|
||||
PaletteList<float> palf;
|
||||
Palette<float>* pal = palf.GetRandomPalette();
|
||||
auto palf = PaletteList<float>::Instance();
|
||||
Palette<float>* pal = palf->GetRandomPalette();
|
||||
|
||||
cout << pal->Size() << endl;
|
||||
|
||||
|
@ -397,12 +397,14 @@ static void AddPaletteToTable(QTableWidget* paletteTable, Palette<float>* palett
|
||||
/// Called upon initialization, palette combo index change, and controller type change.
|
||||
/// </summary>
|
||||
/// <param name="s">The name of the palette file without the path</param>
|
||||
/// <param name="paletteTable">The table to populate</param>
|
||||
/// <param name="paletteList">The global PaletteList shared_ptr to retrieve the specified palette file from to populate the table with</param>
|
||||
/// <returns>True if successful, else false.</returns>
|
||||
static bool FillPaletteTable(const string& s, QTableWidget* paletteTable, PaletteList<float>& paletteList)
|
||||
static bool FillPaletteTable(const string& s, QTableWidget* paletteTable, shared_ptr<PaletteList<float>> paletteList)
|
||||
{
|
||||
if (!s.empty())//This occasionally seems to get called with an empty string for reasons unknown.
|
||||
{
|
||||
if (auto palettes = paletteList.GetPaletteListByFilename(s))
|
||||
if (auto palettes = paletteList->GetPaletteListByFilename(s))
|
||||
{
|
||||
paletteTable->clear();
|
||||
paletteTable->blockSignals(true);
|
||||
|
@ -9,6 +9,7 @@
|
||||
/// </summary>
|
||||
/// <param name="fractorium">Pointer to the main window.</param>
|
||||
FractoriumEmberControllerBase::FractoriumEmberControllerBase(Fractorium* fractorium)
|
||||
: m_PaletteList(PaletteList<float>::Instance())
|
||||
{
|
||||
Timing t;
|
||||
m_Fractorium = fractorium;
|
||||
@ -46,7 +47,7 @@ FractoriumEmberController<T>::FractoriumEmberController(Fractorium* fractorium)
|
||||
m_GLController = make_unique<GLEmberController<T>>(fractorium, fractorium->ui.GLDisplay, this);
|
||||
m_LibraryPreviewRenderer = make_unique<TreePreviewRenderer<T>>(this, m_Fractorium->ui.LibraryTree, m_EmberFile);
|
||||
m_SequencePreviewRenderer = make_unique<TreePreviewRenderer<T>>(this, m_Fractorium->ui.SequenceTree, m_SequenceFile);
|
||||
m_PaletteList.Clear();
|
||||
m_PaletteList->Clear();
|
||||
m_Fractorium->ui.PaletteFilenameCombo->clear();
|
||||
//Initial combo change event to fill the palette table will be called automatically later.
|
||||
//Look hard for a palette.
|
||||
@ -57,7 +58,7 @@ FractoriumEmberController<T>::FractoriumEmberController(Fractorium* fractorium)
|
||||
|
||||
if (b)
|
||||
{
|
||||
m_SheepTools = make_unique<SheepTools<T, float>>(m_PaletteList.Name(0), new EmberNs::Renderer<T, float>());
|
||||
m_SheepTools = make_unique<SheepTools<T, float>>(m_PaletteList->Name(0), new EmberNs::Renderer<T, float>());
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -71,8 +72,8 @@ FractoriumEmberController<T>::FractoriumEmberController(Fractorium* fractorium)
|
||||
throw ex;
|
||||
}
|
||||
|
||||
if (m_PaletteList.Size() >= 1)//Only add the user palette if the folder already had a palette, which means we'll be using this folder.
|
||||
if (m_PaletteList.AddEmptyPaletteFile((GetDefaultUserPath() + "/user-palettes.xml").toStdString()))
|
||||
if (m_PaletteList->Size() >= 1)//Only add the user palette if the folder already had a palette, which means we'll be using this folder.
|
||||
if (m_PaletteList->AddEmptyPaletteFile((GetDefaultUserPath() + "/user-palettes.xml").toStdString()))
|
||||
m_Fractorium->ui.PaletteFilenameCombo->addItem("user-palettes.xml");
|
||||
|
||||
BackgroundChanged(QColor(0, 0, 0));//Default to black.
|
||||
@ -327,23 +328,13 @@ void FractoriumEmberController<T>::SetEmberPrivate(const Ember<U>& ember, bool v
|
||||
}
|
||||
|
||||
static EmberToXml<T> writer;//Save parameters of last full render just in case there is a crash.
|
||||
#ifdef _WIN32
|
||||
string filename = "last.flame";
|
||||
#elif defined(__APPLE__)
|
||||
QDir dir(QDir::applicationDirPath());
|
||||
auto path = GetDefaultUserPath();
|
||||
QDir dir(path);
|
||||
|
||||
if (!dir.exists())
|
||||
dir.mkpath(".");
|
||||
|
||||
string filename = QDir::applicationDirPath().toStdString() + "/last.flame";
|
||||
#else
|
||||
QDir dir(QDir::homePath() + "/.config/fractorium");
|
||||
|
||||
if (!dir.exists())
|
||||
dir.mkpath(".");
|
||||
|
||||
string filename = QDir::homePath().toStdString() + "/.config/fractorium/last.flame";
|
||||
#endif
|
||||
string filename = path.toStdString() + "/last.flame";
|
||||
writer.Save(filename.c_str(), m_Ember, 0, true, true, false, true, true);
|
||||
m_GLController->ResetMouseState();
|
||||
FillXforms();//Must do this first because the palette setup in FillParamTablesAndPalette() uses the xforms combo.
|
||||
|
@ -294,9 +294,9 @@ protected:
|
||||
QTIsaac<ISAAC_SIZE, ISAAC_INT> m_Rand;
|
||||
Fractorium* m_Fractorium;
|
||||
Palette<float> m_TempPalette;
|
||||
PaletteList<float> m_PaletteList;
|
||||
std::unique_ptr<QTimer> m_RenderTimer;
|
||||
std::unique_ptr<QTimer> m_RenderRestartTimer;
|
||||
shared_ptr<PaletteList<float>> m_PaletteList;
|
||||
shared_ptr<OpenCLInfo> m_Info = OpenCLInfo::Instance();
|
||||
};
|
||||
|
||||
|
@ -98,7 +98,7 @@ void FractoriumEmberController<T>::NewEmptyFlameInCurrentFile()
|
||||
xform.m_Weight = T(0.25);
|
||||
xform.m_ColorX = m_Rand.Frand01<T>();
|
||||
ember.AddXform(xform);
|
||||
ember.m_Palette = *m_PaletteList.GetRandomPalette();
|
||||
ember.m_Palette = *m_PaletteList->GetRandomPalette();
|
||||
ember.m_Name = EmberFile<T>::DefaultEmberName(m_EmberFile.Size() + 1).toStdString();
|
||||
ember.m_Index = m_EmberFile.Size();
|
||||
m_EmberFile.m_Embers.push_back(ember);//Will invalidate the pointers contained in the EmberTreeWidgetItems, UpdateLibraryTree() will resync.
|
||||
|
@ -66,7 +66,7 @@ size_t FractoriumEmberController<T>::InitPaletteList(const QString& s)
|
||||
|
||||
try
|
||||
{
|
||||
if (QFile::exists(path) && m_PaletteList.Add(path.toStdString()))
|
||||
if (QFile::exists(path) && m_PaletteList->Add(path.toStdString()))
|
||||
m_Fractorium->ui.PaletteFilenameCombo->addItem(qfilename);
|
||||
}
|
||||
catch (const std::exception& e)
|
||||
@ -79,7 +79,7 @@ size_t FractoriumEmberController<T>::InitPaletteList(const QString& s)
|
||||
}
|
||||
}
|
||||
|
||||
return m_PaletteList.Size();
|
||||
return m_PaletteList->Size();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -103,10 +103,10 @@ bool FractoriumEmberController<T>::FillPaletteTable(const string& s)
|
||||
}
|
||||
else
|
||||
{
|
||||
vector<string> errors = m_PaletteList.ErrorReport();
|
||||
vector<string> errors = m_PaletteList->ErrorReport();
|
||||
m_Fractorium->ErrorReportToQTextEdit(errors, m_Fractorium->ui.InfoFileOpeningTextEdit);
|
||||
m_Fractorium->ShowCritical("Palette Read Error", "Could not load palette file, all images will be black. See info tab for details.");
|
||||
m_PaletteList.ClearErrorReport();
|
||||
m_PaletteList->ClearErrorReport();
|
||||
}
|
||||
}
|
||||
|
||||
@ -122,7 +122,7 @@ void Fractorium::OnPaletteFilenameComboChanged(const QString& text)
|
||||
{
|
||||
auto s = text.toStdString();
|
||||
m_Controller->FillPaletteTable(s);
|
||||
auto fullname = m_Controller->m_PaletteList.GetFullPathFromFilename(s);
|
||||
auto fullname = m_Controller->m_PaletteList->GetFullPathFromFilename(s);
|
||||
ui.PaletteFilenameCombo->setToolTip(QString::fromStdString(fullname));
|
||||
ui.PaletteListTable->sortItems(0, m_PaletteSortMode == 0 ? Qt::AscendingOrder : Qt::DescendingOrder);
|
||||
}
|
||||
@ -222,7 +222,7 @@ void FractoriumEmberController<T>::SetBasePaletteAndAdjust(const Palette<float>&
|
||||
template <typename T>
|
||||
void FractoriumEmberController<T>::PaletteCellClicked(int row, int col)
|
||||
{
|
||||
if (auto palette = m_PaletteList.GetPaletteByFilename(m_CurrentPaletteFilePath, row))
|
||||
if (auto palette = m_PaletteList->GetPaletteByFilename(m_CurrentPaletteFilePath, row))
|
||||
SetBasePaletteAndAdjust(*palette);
|
||||
}
|
||||
|
||||
@ -332,14 +332,14 @@ void FractoriumEmberController<T>::PaletteEditorButtonClicked()
|
||||
}
|
||||
|
||||
//If the palette was modifiable, and any palette was changed at least once
|
||||
if (m_Fractorium->m_PaletteFileChanged && m_PaletteList.IsModifiable(m_CurrentPaletteFilePath))
|
||||
if (m_Fractorium->m_PaletteFileChanged && m_PaletteList->IsModifiable(m_CurrentPaletteFilePath))
|
||||
{
|
||||
if (!::FillPaletteTable(m_CurrentPaletteFilePath, m_Fractorium->ui.PaletteListTable, m_PaletteList))
|
||||
{
|
||||
vector<string> errors = m_PaletteList.ErrorReport();
|
||||
vector<string> errors = m_PaletteList->ErrorReport();
|
||||
m_Fractorium->ErrorReportToQTextEdit(errors, m_Fractorium->ui.InfoFileOpeningTextEdit);
|
||||
m_Fractorium->ShowCritical("Palette Read Error", "Could not re-load modified palette file, all images will be black. See info tab for details.");
|
||||
m_PaletteList.ClearErrorReport();
|
||||
m_PaletteList->ClearErrorReport();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -362,7 +362,7 @@ void Fractorium::OnPaletteEditorButtonClicked(bool checked)
|
||||
{
|
||||
if (!m_PaletteEditor)
|
||||
{
|
||||
m_PaletteEditor = new PaletteEditor(m_Controller->m_PaletteList, this);
|
||||
m_PaletteEditor = new PaletteEditor(this);
|
||||
connect(m_PaletteEditor, SIGNAL(PaletteChanged()), this, SLOT(OnPaletteEditorColorChanged()), Qt::QueuedConnection);
|
||||
connect(m_PaletteEditor, SIGNAL(PaletteFileChanged()), this, SLOT(OnPaletteEditorFileChanged()), Qt::QueuedConnection);
|
||||
}
|
||||
|
@ -22,6 +22,7 @@ int main(int argc, char* argv[])
|
||||
#endif
|
||||
auto vf = VarFuncs<float>::Instance();//Create instances that will stay alive until the program exits.
|
||||
auto vlf = VariationList<float>::Instance();
|
||||
auto palf = PaletteList<float>::Instance();
|
||||
auto settings = FractoriumSettings::Instance();
|
||||
#ifdef DO_DOUBLE
|
||||
auto vd = VarFuncs<float>::Instance();
|
||||
|
@ -10,10 +10,10 @@
|
||||
/// </summary>
|
||||
/// <param name="paletteList">A reference to an existing palette list, gotten from the main window.</param>
|
||||
/// <param name="p">The parent widget</param>
|
||||
PaletteEditor::PaletteEditor(PaletteList<float>& paletteList, QWidget* p) :
|
||||
PaletteEditor::PaletteEditor(QWidget* p) :
|
||||
QDialog(p),
|
||||
ui(make_unique<Ui::PaletteEditor>()),
|
||||
m_PaletteList(paletteList)
|
||||
m_PaletteList(PaletteList<float>::Instance())
|
||||
{
|
||||
ui->setupUi(this);
|
||||
m_ColorPicker = new ColorPickerWidget(this);
|
||||
@ -51,11 +51,11 @@ PaletteEditor::PaletteEditor(PaletteList<float>& paletteList, QWidget* p) :
|
||||
layout->setSpacing(0);
|
||||
layout->addWidget(m_GradientColorView);
|
||||
ui->ColorViewGroupBox->setLayout(layout);
|
||||
auto& pals = m_PaletteList.Palettes();
|
||||
auto& pals = m_PaletteList->Palettes();
|
||||
|
||||
for (auto& pal : pals)
|
||||
{
|
||||
if (m_PaletteList.IsModifiable(pal.first))//Only add user created palettes.
|
||||
if (m_PaletteList->IsModifiable(pal.first))//Only add user created palettes.
|
||||
{
|
||||
QFileInfo info(QString::fromStdString(pal.first));
|
||||
ui->PaletteFilenameCombo->addItem(info.fileName());
|
||||
@ -265,7 +265,7 @@ void PaletteEditor::OnPaletteFilenameComboChanged(const QString& text)
|
||||
auto paletteTable = ui->PaletteListTable;
|
||||
m_CurrentPaletteFilePath = text.toStdString();
|
||||
::FillPaletteTable(text.toStdString(), paletteTable, m_PaletteList);
|
||||
auto fullname = m_PaletteList.GetFullPathFromFilename(m_CurrentPaletteFilePath);
|
||||
auto fullname = m_PaletteList->GetFullPathFromFilename(m_CurrentPaletteFilePath);
|
||||
ui->PaletteFilenameCombo->setToolTip(QString::fromStdString(fullname));
|
||||
OnPaletteCellClicked(0, 1);
|
||||
}
|
||||
@ -281,7 +281,7 @@ void PaletteEditor::OnPaletteCellClicked(int row, int col)
|
||||
{
|
||||
if (col == 1)
|
||||
{
|
||||
if (auto palette = m_PaletteList.GetPaletteByFilename(m_CurrentPaletteFilePath, row))
|
||||
if (auto palette = m_PaletteList->GetPaletteByFilename(m_CurrentPaletteFilePath, row))
|
||||
{
|
||||
SetPalette(*palette);
|
||||
m_PaletteIndex = row;
|
||||
@ -299,7 +299,7 @@ void PaletteEditor::OnPaletteCellChanged(int row, int col)
|
||||
{
|
||||
if (col == 0)
|
||||
{
|
||||
if (auto palette = m_PaletteList.GetPaletteByFilename(m_CurrentPaletteFilePath, row))
|
||||
if (auto palette = m_PaletteList->GetPaletteByFilename(m_CurrentPaletteFilePath, row))
|
||||
{
|
||||
palette->m_Name = ui->PaletteListTable->item(row, col)->text().toStdString();
|
||||
emit PaletteFileChanged();
|
||||
@ -316,7 +316,7 @@ void PaletteEditor::OnNewPaletteFileButtonClicked()
|
||||
{
|
||||
auto filename = EmberFile<float>::UniqueFilename(GetDefaultUserPath() + "/user-palettes.xml");
|
||||
|
||||
if (m_PaletteList.AddEmptyPaletteFile(filename.toStdString()))
|
||||
if (m_PaletteList->AddEmptyPaletteFile(filename.toStdString()))
|
||||
{
|
||||
QFileInfo info(filename);
|
||||
ui->PaletteFilenameCombo->addItem(info.fileName());
|
||||
@ -331,17 +331,17 @@ void PaletteEditor::OnNewPaletteFileButtonClicked()
|
||||
/// </summary>
|
||||
void PaletteEditor::OnCopyPaletteFileButtonClicked()
|
||||
{
|
||||
auto& paletteFiles = m_PaletteList.Palettes();
|
||||
auto& paletteFiles = m_PaletteList->Palettes();
|
||||
auto qscurr = QString::fromStdString(m_CurrentPaletteFilePath);
|
||||
auto qfilename = EmberFile<float>::UniqueFilename(GetDefaultUserPath() + "/" + qscurr);
|
||||
auto filename = qfilename.toStdString();
|
||||
|
||||
if (m_PaletteList.GetPaletteListByFullPath(filename) == nullptr)//Ensure the new filename does not exist in the map.
|
||||
if (m_PaletteList->GetPaletteListByFullPath(filename) == nullptr)//Ensure the new filename does not exist in the map.
|
||||
{
|
||||
//Get the list of palettes for the current filename, this will be added as a copy below.
|
||||
if (auto currentPaletteFile = m_PaletteList.GetPaletteListByFilename(m_CurrentPaletteFilePath))//Ensure the list of palettes was properly retrieved.
|
||||
if (auto currentPaletteFile = m_PaletteList->GetPaletteListByFilename(m_CurrentPaletteFilePath))//Ensure the list of palettes was properly retrieved.
|
||||
{
|
||||
if (m_PaletteList.AddPaletteFile(filename, *currentPaletteFile))//Add the current vector of palettes to an entry with the new filename.
|
||||
if (m_PaletteList->AddPaletteFile(filename, *currentPaletteFile))//Add the current vector of palettes to an entry with the new filename.
|
||||
{
|
||||
QFileInfo info(qfilename);
|
||||
ui->PaletteFilenameCombo->addItem(info.fileName());
|
||||
@ -364,7 +364,7 @@ void PaletteEditor::OnCopyPaletteFileButtonClicked()
|
||||
void PaletteEditor::OnAppendPaletteButtonClicked()
|
||||
{
|
||||
auto& pal = m_GradientColorView->GetPalette(256);
|
||||
m_PaletteList.AddPaletteToFile(m_CurrentPaletteFilePath, pal);
|
||||
m_PaletteList->AddPaletteToFile(m_CurrentPaletteFilePath, pal);
|
||||
::FillPaletteTable(m_CurrentPaletteFilePath, ui->PaletteListTable, m_PaletteList);
|
||||
m_PaletteIndex = ui->PaletteListTable->rowCount() - 1;
|
||||
emit PaletteFileChanged();
|
||||
@ -377,7 +377,7 @@ void PaletteEditor::OnAppendPaletteButtonClicked()
|
||||
void PaletteEditor::OnOverwritePaletteButtonClicked()
|
||||
{
|
||||
auto& pal = m_GradientColorView->GetPalette(256);
|
||||
m_PaletteList.Replace(m_CurrentPaletteFilePath, pal, m_PaletteIndex);
|
||||
m_PaletteList->Replace(m_CurrentPaletteFilePath, pal, m_PaletteIndex);
|
||||
::FillPaletteTable(m_CurrentPaletteFilePath, ui->PaletteListTable, m_PaletteList);
|
||||
emit PaletteFileChanged();
|
||||
}
|
||||
@ -393,7 +393,7 @@ void PaletteEditor::OnDeletePaletteButtonClicked()
|
||||
|
||||
if (table->rowCount() > 1)
|
||||
{
|
||||
m_PaletteList.Delete(m_CurrentPaletteFilePath, m_PaletteIndex);
|
||||
m_PaletteList->Delete(m_CurrentPaletteFilePath, m_PaletteIndex);
|
||||
::FillPaletteTable(m_CurrentPaletteFilePath, table, m_PaletteList);
|
||||
emit PaletteFileChanged();
|
||||
OnPaletteCellClicked(0, table->rowCount() - 1);
|
||||
|
@ -26,7 +26,7 @@ class PaletteEditor : public QDialog
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit PaletteEditor(PaletteList<float>& paletteList, QWidget* p = nullptr);
|
||||
explicit PaletteEditor(QWidget* p = nullptr);
|
||||
|
||||
public:
|
||||
bool Sync();
|
||||
@ -73,6 +73,6 @@ private:
|
||||
ColorPickerWidget* m_ColorPicker = nullptr;
|
||||
GradientColorsView* m_GradientColorView = nullptr;
|
||||
QFileDialog* m_FileDialog = nullptr;
|
||||
PaletteList<float>& m_PaletteList;
|
||||
shared_ptr<PaletteList<float>> m_PaletteList;
|
||||
std::unique_ptr<Ui::PaletteEditor> ui;
|
||||
};
|
||||
|
24
archive/Info.plist
Normal file
24
archive/Info.plist
Normal file
@ -0,0 +1,24 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>NSPrincipalClass</key>
|
||||
<string>NSApplication</string>
|
||||
<key>CFBundleIconFile</key>
|
||||
<string>Fractorium.icns</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>Fractorium</string>
|
||||
<key>CFBundleGetInfoString</key>
|
||||
<string>Created by Qt/QMake</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>fractorium</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.yourcompany.fractorium</string>
|
||||
<key>NOTE</key>
|
||||
<string>This file was generated by Qt/QMake.</string>
|
||||
</dict>
|
||||
</plist>
|
55
archive/build.sh
Normal file
55
archive/build.sh
Normal file
@ -0,0 +1,55 @@
|
||||
#!/bin/bash
|
||||
|
||||
OSX_BUILD_PATH=$PWD
|
||||
FRACTORIUM_RELEASE_ROOT=$PWD/../Bin/release
|
||||
QT_MACDEPLOY=/Users/mastriani/Qt/5.4/clang_64/bin/macdeployqt
|
||||
|
||||
|
||||
cd $FRACTORIUM_RELEASE_ROOT
|
||||
|
||||
EMBERANIMATE_FINAL_ROOT=$PWD/emberanimate.app/Contents/MacOS
|
||||
EMBERGENOME_FINAL_ROOT=$PWD/embergenome.app/Contents/MacOS
|
||||
EMBERRENDER_FINAL_ROOT=$PWD/emberrender.app/Contents/MacOS
|
||||
FRACTORIUM_FINAL_ROOT=$PWD/fractorium.app/Contents/MacOS
|
||||
|
||||
install_name_tool -id $PWD/libember.dylib libember.dylib
|
||||
install_name_tool -id $PWD/libembercl.dylib libembercl.dylib
|
||||
install_name_tool -change libember.dylib $PWD/libember.dylib libembercl.dylib
|
||||
|
||||
install_name_tool -change libember.dylib $PWD/libember.dylib $EMBERANIMATE_FINAL_ROOT/emberanimate
|
||||
install_name_tool -change libembercl.dylib $PWD/libembercl.dylib $EMBERANIMATE_FINAL_ROOT/emberanimate
|
||||
|
||||
install_name_tool -change libember.dylib $PWD/libember.dylib $EMBERGENOME_FINAL_ROOT/embergenome
|
||||
install_name_tool -change libembercl.dylib $PWD/libembercl.dylib $EMBERGENOME_FINAL_ROOT/embergenome
|
||||
|
||||
install_name_tool -change libember.dylib $PWD/libember.dylib $EMBERRENDER_FINAL_ROOT/emberrender
|
||||
install_name_tool -change libembercl.dylib $PWD/libembercl.dylib $EMBERRENDER_FINAL_ROOT/emberrender
|
||||
|
||||
install_name_tool -change libember.dylib $PWD/libember.dylib $FRACTORIUM_FINAL_ROOT/fractorium
|
||||
install_name_tool -change libembercl.dylib $PWD/libembercl.dylib $FRACTORIUM_FINAL_ROOT/fractorium
|
||||
|
||||
$QT_MACDEPLOY emberanimate.app
|
||||
$QT_MACDEPLOY embergenome.app
|
||||
$QT_MACDEPLOY emberrender.app
|
||||
$QT_MACDEPLOY fractorium.app
|
||||
|
||||
cp ./emberanimate.app/Contents/MacOS/emberanimate $FRACTORIUM_FINAL_ROOT
|
||||
cp ./embergenome.app/Contents/MacOS/embergenome $FRACTORIUM_FINAL_ROOT
|
||||
cp ./emberrender.app/Contents/MacOS/emberrender $FRACTORIUM_FINAL_ROOT
|
||||
|
||||
cd $OSX_BUILD_PATH
|
||||
|
||||
#python macdeployqtfix.py $FRACTORIUM_FINAL_ROOT/fractorium /Users/mastriani/Qt/5.4/
|
||||
|
||||
cd ../Data
|
||||
|
||||
cp dark.qss $FRACTORIUM_FINAL_ROOT
|
||||
cp flam3-palettes.xml $FRACTORIUM_FINAL_ROOT
|
||||
cp Info.plist $FRACTORIUM_FINAL_ROOT/../
|
||||
#cp fractoriumcaller $FRACTORIUM_FINAL_ROOT
|
||||
|
||||
cd $FRACTORIUM_RELEASE_ROOT
|
||||
|
||||
mv fractorium.app Fractorium.app
|
||||
|
||||
hdiutil create -format UDBZ -quiet -srcfolder Fractorium.app Fractorium.dmg
|
Loading…
Reference in New Issue
Block a user