--User changes

-Add a new dialog for editing QSS stylesheets. Allow for saving, reloading and setting styles as default.
  --Include a dark style with the installation called dark.qss.
  --Also add support for themes such as Fusion.
  --Resize some controls to better fit with the new style.
 -Add an option to specify the number of random embers generated on startup. 1 is the minimum and the default.

--Bug fixes
 -Properly enable/disable thread priority label in final render dialog in response to enable/disable of the OpenCL checkbox.
 -Remove all inline stylesheets.
 -Show xaos spinners with 6 decimal places.

--Code changes
 -Remove redundant comparisons to nullptr, use ! instead;
 -Give some controls valid names instead of the auto generated ones.
 -DoubleSpinBoxTableItemDelegate.h: Add virtual keyword to overridden functions.
This commit is contained in:
mfeemster
2015-10-26 21:31:35 -07:00
parent 9f524e1ad1
commit 04e72c27de
65 changed files with 7814 additions and 332 deletions

View File

@ -180,7 +180,7 @@ public:
SetProjFunc();
ClearEdit();
if (ember.m_Edits != nullptr)
if (ember.m_Edits)
m_Edits = xmlCopyDoc(ember.m_Edits, 1);
CopyVec(m_EmberMotionElements, ember.m_EmberMotionElements);
@ -858,7 +858,7 @@ public:
var->m_Weight = 0;
if (parVar != nullptr)
if (parVar)
parVar->Clear();
for (size_t k = 0; k < size; k++)//For each ember in the list.
@ -869,17 +869,17 @@ public:
{
Variation<T>* tempVar = tempXform->GetVariationById(var->VariationId());//See if the variation at this xform index exists in that ember at this xform index.
if (tempVar != nullptr)
if (tempVar)
{
//Interp weight.
var->m_Weight += tempVar->m_Weight * coefs[k];
//If it was a parametric variation, interp params.
if (parVar != nullptr)
if (parVar)
{
ParametricVariation<T>* tempParVar = dynamic_cast<ParametricVariation<T>*>(tempVar);
if (tempParVar != nullptr && (parVar->ParamCount() == tempParVar->ParamCount()))//This check will should always be true, but just check to be absolutely sure to avoid clobbering memory.
if (tempParVar && (parVar->ParamCount() == tempParVar->ParamCount()))//This check will should always be true, but just check to be absolutely sure to avoid clobbering memory.
{
auto params = parVar->Params();
auto tempParams = tempParVar->Params();
@ -1461,7 +1461,7 @@ public:
/// </summary>
void ClearEdit()
{
if (m_Edits != nullptr)
if (m_Edits)
xmlFreeDoc(m_Edits);
m_Edits = nullptr;

View File

@ -42,7 +42,7 @@
namespace EmberNs
{
#define EMBER_VERSION "0.9.9.1"
#define EMBER_VERSION "0.9.9.2"
#define EPS6 T(1e-6)
#define EPS std::numeric_limits<T>::epsilon()//Apoplugin.h uses -20, but it's more mathematically correct to do it this way.
#define ISAAC_SIZE 4

View File

@ -296,7 +296,7 @@ public:
}
}
if (doEdits && ember.m_Edits != nullptr)
if (doEdits && ember.m_Edits)
os << ToString(xmlDocGetRootElement(ember.m_Edits), 1, true, printEditDepth);
os << "</flame>\n";
@ -448,7 +448,7 @@ public:
os.str("");
//Check for errors.
if (commentDoc != nullptr)
if (commentDoc)
{
//Loop through the children of the new document and copy them into the rootNode.

View File

@ -544,7 +544,7 @@ public:
static void InterpParametricVar(vector<ParametricVariation<T>*>& first, ParametricVariation<T>* second, vector<T>& c)
{
//First, make sure the variation vector is the same size as the coefficient vector.
if (second != nullptr && first.size() == c.size())
if (second && first.size() == c.size())
{
second->Clear();
auto secondParams = second->Params();

View File

@ -49,7 +49,7 @@ public:
{
xmlDocPtr doc = xmlReadMemory(static_cast<const char*>(buf.data()), int(buf.size()), filename.c_str(), nullptr, XML_PARSE_NONET);
if (doc != nullptr)
if (doc)
{
auto rootNode = xmlDocGetRootElement(doc);
auto pfilename = shared_ptr<string>(new string(filename));

View File

@ -1410,8 +1410,8 @@ template <typename T, typename bucketT> size_t Renderer<T, bucketT>::FuseCount()
/// Non-virtual iterator wrappers.
/// </summary>
template <typename T, typename bucketT> const byte* Renderer<T, bucketT>::XformDistributions() const { return m_Iterator != nullptr ? m_Iterator->XformDistributions() : nullptr; }
template <typename T, typename bucketT> size_t Renderer<T, bucketT>::XformDistributionsSize() const { return m_Iterator != nullptr ? m_Iterator->XformDistributionsSize() : 0; }
template <typename T, typename bucketT> const byte* Renderer<T, bucketT>::XformDistributions() const { return m_Iterator ? m_Iterator->XformDistributions() : nullptr; }
template <typename T, typename bucketT> size_t Renderer<T, bucketT>::XformDistributionsSize() const { return m_Iterator ? m_Iterator->XformDistributionsSize() : 0; }
template <typename T, typename bucketT> Point<T>* Renderer<T, bucketT>::Samples(size_t threadIndex) const { return threadIndex < m_Samples.size() ? const_cast<Point<T>*>(m_Samples[threadIndex].data()) : nullptr; }
/// <summary>

View File

@ -50,7 +50,7 @@ public:
m_EndTime = Clock::now();
double ms = ElapsedTime();
if (str != nullptr)
if (str)
{
cout << string(str) << (fullString ? "" : " processing time: ") << Format(ms) << endl;
}

View File

@ -182,7 +182,7 @@ static bool ReadFile(const char* filename, string& buf, bool nullTerminate = tru
{
fopen_s(&f, filename, "rb");//Open in binary mode.
if (f != nullptr)
if (f)
{
struct _stat statBuf;
@ -225,7 +225,7 @@ static bool ReadFile(const char* filename, string& buf, bool nullTerminate = tru
b = false;
}
if (f != nullptr)
if (f)
fclose(f);
return b;
@ -279,7 +279,7 @@ static void ClearVec(vector<T*>& vec, bool arrayDelete = false)
{
for (size_t i = 0; i < vec.size(); i++)
{
if (vec[i] != nullptr)
if (vec[i])
{
if (arrayDelete)
delete [] vec[i];

View File

@ -1874,7 +1874,7 @@ protected:
#define VARCOPYDOUBLE(name) \
virtual void Copy(Variation<double>*& var) const override \
{ \
if (var != nullptr) \
if (var) \
delete var; \
\
var = new name<double>(*this); \
@ -1905,7 +1905,7 @@ protected:
\
virtual void Copy(Variation<float>*& var) const override \
{ \
if (var != nullptr) \
if (var) \
delete var; \
\
var = new name<float>(*this); \
@ -1932,7 +1932,7 @@ protected:
\
virtual void Copy(Variation<float>*& var) const override \
{ \
if (var != nullptr) \
if (var) \
delete var; \
\
var = new name<float>(*this); \
@ -2018,7 +2018,7 @@ protected:
\
virtual void Copy(Variation<float>*& var) const override \
{ \
if (var != nullptr) \
if (var) \
delete var; \
\
var = new name<float>(*this); \
@ -2049,7 +2049,7 @@ protected:
\
virtual void Copy(Variation<float>*& var) const override \
{ \
if (var != nullptr) \
if (var) \
delete var; \
\
var = new name<float>(*this); \

View File

@ -412,7 +412,7 @@ public:
/// <returns>A pointer to the variation if found, else nullptr.</returns>
const Variation<T>* GetVariation(eVariationId id) const
{
for (size_t i = 0; i < m_Variations.size() && m_Variations[i] != nullptr; i++)
for (size_t i = 0; i < m_Variations.size() && m_Variations[i]; i++)
if (id == m_Variations[i]->VariationId())
return m_Variations[i];
@ -435,7 +435,7 @@ public:
/// <returns>A pointer to the variation if found, else nullptr.</returns>
const Variation<T>* GetVariation(const string& name) const
{
for (size_t i = 0; i < m_Variations.size() && m_Variations[i] != nullptr; i++)
for (size_t i = 0; i < m_Variations.size() && m_Variations[i]; i++)
if (!_stricmp(name.c_str(), m_Variations[i]->Name().c_str()))
return m_Variations[i];
@ -466,7 +466,7 @@ public:
/// <returns>The parametric variation with a matching name, else nullptr.</returns>
const ParametricVariation<T>* GetParametricVariation(const string& name) const
{
for (size_t i = 0; i < m_ParametricVariations.size() && m_ParametricVariations[i] != nullptr; i++)
for (size_t i = 0; i < m_ParametricVariations.size() && m_ParametricVariations[i]; i++)
if (!_stricmp(name.c_str(), m_ParametricVariations[i]->Name().c_str()))
return m_ParametricVariations[i];
@ -480,7 +480,7 @@ public:
/// <returns>The index of the variation with the matching name, else -1</returns>
int GetVariationIndex(const string& name)
{
for (size_t i = 0; i < m_Variations.size() && m_Variations[i] != nullptr; i++)
for (size_t i = 0; i < m_Variations.size() && m_Variations[i]; i++)
if (!_stricmp(name.c_str(), m_Variations[i]->Name().c_str()))
return int(i);

View File

@ -370,7 +370,7 @@ public:
{
for (auto v : variations)
{
if (v != nullptr && v->VariationId() == id)
if (v && v->VariationId() == id)
{
var = v;
keepGoing = false;
@ -395,7 +395,7 @@ public:
{
for (auto v : variations)
{
if (v != nullptr && v->Name() == name)
if (v && v->Name() == name)
{
var = v;
keepGoing = false;
@ -447,7 +447,7 @@ public:
{
for (size_t i = 0; i < variations.size(); i++)
{
if (variations[i] != nullptr && variations[i]->VariationId() == id)
if (variations[i] && variations[i]->VariationId() == id)
{
delete variations[i];
variations.erase(variations.begin() + i);
@ -768,7 +768,7 @@ public:
//At this point, we've added if needed, or just applied the motion func to the weight.
//Now apply the motion func to the params if needed.
if (motParVar != nullptr)
if (motParVar)
{
auto parVar = dynamic_cast<ParametricVariation<T>*>(var);
auto params = parVar->Params();