mirror of
https://bitbucket.org/mfeemster/fractorium.git
synced 2025-07-01 13:56:06 -04:00
05/31/2017
--User changes -Add support for adjusting xform color indices in the palette editor. Fixed palettes can now be displayed there, but they will have no color arrows as they are not editable. -Add support for independent dimension scaling in the EmberRender and EmberAnimate programs to bring them in line with the final render dialog Fractorium. --Bug fixes -File paths with a space in them did not work in the command line programs. -Any Xml file in the search paths would erroneously be treated as a palette file. --Code changes -Change some for loops to while loops when iterating through xforms. -Allow FractoriumEmberController<T>::UpdateXform() to be able to apply the action to an xform at a specific index. -Remove old code blocks build files that were never used. -Make GetPath() return empty string if no path is present in the passed in file path. -GetTotalXform() was always counting the final xform, even if it was unused.
This commit is contained in:
@ -316,17 +316,17 @@ public:
|
||||
{
|
||||
if (i < XformCount())
|
||||
return const_cast<Xform<T>*>(&m_Xforms[i]);
|
||||
else if (i == XformCount() || forceFinal)
|
||||
else if (forceFinal || (i == XformCount() && UseFinalXform()))
|
||||
return const_cast<Xform<T>*>(&m_FinalXform);
|
||||
else
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Search the xforms, excluding final, to find which one's address matches the address of the specified xform.
|
||||
/// </summary>
|
||||
/// <param name="xform">A pointer to the xform to find</param>
|
||||
/// <returns>The index of the matched xform if found, else -1.</returns>
|
||||
/// <summary>
|
||||
/// Search the xforms, excluding final, to find which one's address matches the address of the specified xform.
|
||||
/// </summary>
|
||||
/// <param name="xform">A pointer to the xform to find</param>
|
||||
/// <returns>The index of the matched xform if found, else -1.</returns>
|
||||
intmax_t GetXformIndex(Xform<T>* xform) const
|
||||
{
|
||||
intmax_t index = -1;
|
||||
@ -388,8 +388,10 @@ public:
|
||||
/// </summary>
|
||||
void DeleteMotionElements()
|
||||
{
|
||||
for (size_t i = 0; i < TotalXformCount(); i++)
|
||||
GetTotalXform(i)->DeleteMotionElements();
|
||||
size_t i = 0;
|
||||
|
||||
while (auto xform = GetTotalXform(i++))
|
||||
xform->DeleteMotionElements();
|
||||
|
||||
m_EmberMotionElements.clear();
|
||||
}
|
||||
@ -399,9 +401,10 @@ public:
|
||||
/// </summary>
|
||||
void CacheXforms()
|
||||
{
|
||||
for (size_t i = 0; i < TotalXformCount(); i++)
|
||||
size_t i = 0;
|
||||
|
||||
while (auto xform = GetTotalXform(i++))
|
||||
{
|
||||
auto xform = GetTotalXform(i);
|
||||
xform->CacheColorVals();
|
||||
xform->SetPrecalcFlags();
|
||||
}
|
||||
@ -594,12 +597,10 @@ public:
|
||||
bool Flatten(vector<string>& names)
|
||||
{
|
||||
bool flattened = false;
|
||||
size_t i = 0;
|
||||
|
||||
for (auto& xform : m_Xforms)
|
||||
flattened |= xform.Flatten(names);
|
||||
|
||||
if (UseFinalXform())
|
||||
flattened |= m_FinalXform.Flatten(names);
|
||||
while (auto xform = GetTotalXform(i++))
|
||||
flattened |= xform->Flatten(names);
|
||||
|
||||
return flattened;
|
||||
}
|
||||
@ -743,12 +744,8 @@ public:
|
||||
for (size_t i = 0; i < totalXformCount; i++)//For each xform to populate.
|
||||
{
|
||||
for (size_t j = 0; j < size; j++)//For each ember in the list.
|
||||
{
|
||||
if (i < embers[j].TotalXformCount())//Xform in this position in this ember.
|
||||
{
|
||||
xformVec.push_back(embers[j].GetTotalXform(i));//Temporary list to pass to MergeXforms().
|
||||
}
|
||||
}
|
||||
|
||||
if (i < maxXformCount)//Working with standard xforms?
|
||||
AddXform(Interpolater<T>::MergeXforms(xformVec, true));//Merge, set weights to zero, and add to the xform list.
|
||||
|
@ -211,10 +211,14 @@ bool PaletteList<T>::Add(const string& filename, bool force)
|
||||
if (doc)
|
||||
{
|
||||
auto rootNode = xmlDocGetRootElement(doc);
|
||||
palettes.first->second.clear();
|
||||
palettes.first->second.reserve(buf.size() / 2048);//Roughly what it takes per palette.
|
||||
ParsePalettes(rootNode, pfilename, palettes.first->second);
|
||||
xmlFreeDoc(doc);
|
||||
|
||||
if (!Compare(rootNode->name, "palettes"))
|
||||
{
|
||||
palettes.first->second.clear();
|
||||
palettes.first->second.reserve(buf.size() / 2048);//Roughly the size in bytes it takes to store the xml text of palette.
|
||||
ParsePalettes(rootNode, pfilename, palettes.first->second);
|
||||
xmlFreeDoc(doc);
|
||||
}
|
||||
|
||||
if (palettes.first->second.empty())
|
||||
{
|
||||
|
@ -108,28 +108,30 @@ public:
|
||||
string TruncateVariations(Ember<T>& ember, size_t maxVars)
|
||||
{
|
||||
intmax_t smallest;
|
||||
size_t i, j, numVars;
|
||||
size_t i = 0, j, numVars;
|
||||
T sv = 0;
|
||||
ostringstream os;
|
||||
|
||||
//First clear out any xforms that are not the final, and have a density of less than 0.001.
|
||||
for (i = 0; i < ember.XformCount(); i++)
|
||||
{
|
||||
auto xform = ember.GetXform(i);
|
||||
|
||||
while (auto xform = ember.GetXform(i))
|
||||
{
|
||||
if (xform->m_Weight < T(0.001))
|
||||
{
|
||||
os << "trunc_density " << i;
|
||||
ember.DeleteXform(i);
|
||||
i = 0;//Size will have changed, so start over.
|
||||
continue;
|
||||
}
|
||||
|
||||
i++;
|
||||
}
|
||||
|
||||
//Now consider all xforms, including final.
|
||||
for (i = 0; i < ember.TotalXformCount(); i++)
|
||||
{
|
||||
auto xform = ember.GetTotalXform(i);
|
||||
i = 0;
|
||||
|
||||
while (auto xform = ember.GetTotalXform(i))
|
||||
{
|
||||
do
|
||||
{
|
||||
Variation<T>* var = nullptr;
|
||||
@ -164,6 +166,8 @@ public:
|
||||
}
|
||||
}
|
||||
while (numVars > maxVars);
|
||||
|
||||
i++;
|
||||
}
|
||||
|
||||
return os.str();
|
||||
|
@ -86,7 +86,7 @@ public:
|
||||
/// Days, hours and minutes are only included if 1 or more of them has elapsed. Seconds are always
|
||||
/// included as a decimal value with the precision the user specified in the constructor.
|
||||
/// </summary>
|
||||
/// <param name="ms">The ms</param>
|
||||
/// <param name="ms">The time in milliseconds to format</param>
|
||||
/// <returns>The formatted string</returns>
|
||||
string Format(double ms) const
|
||||
{
|
||||
|
@ -924,6 +924,8 @@ static vector<std::string> Split(const string& str, const string& del, bool remo
|
||||
|
||||
/// <summary>
|
||||
/// Return a copy of a file path string with the file portion removed.
|
||||
/// If no path is present, such as having only a filename present, then
|
||||
/// empty string is returned.
|
||||
/// </summary>
|
||||
/// <param name="filename">The string to retrieve the path from</param>
|
||||
/// <returns>The path portion of the string</returns>
|
||||
@ -931,10 +933,10 @@ static string GetPath(const string& filename)
|
||||
{
|
||||
const size_t lastSlash = filename.find_last_of("\\/");
|
||||
|
||||
if (std::string::npos != lastSlash)
|
||||
if (lastSlash != std::string::npos)
|
||||
return filename.substr(0, lastSlash + 1);
|
||||
else
|
||||
return filename;
|
||||
return "";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
Reference in New Issue
Block a user