--User changes

Allow for detaching of top level tabs in the dock widget so workspaces can be customized.
 Save workspace between runs.
 Only correct variation names/params during parsing when the source of the Xml file is not from Ember/Fractorium.
This commit is contained in:
mfeemster 2015-06-17 20:05:53 -07:00
parent 5bd593b42f
commit 5f3e70c6a8
14 changed files with 5502 additions and 5582 deletions

View File

@ -1217,6 +1217,8 @@ EmberStats Renderer<T, bucketT>::Iterate(size_t iterCount, size_t temporalSample
#endif
#ifdef WIN32
SetThreadPriority(GetCurrentThread(), m_Priority);
#else
pthread_setschedprio(pthread_self(), (int)m_Priority);
#endif
//Timing t;
IterParams<T> params;

View File

@ -239,7 +239,7 @@ public:
m_BadVariationNames.push_back(make_pair(make_pair(string("post_dcztransl"), string("post_dc_ztransl")), badParams));
badParams.clear();
m_BadVariationNames.push_back(make_pair(make_pair(string("pre_blur"), string("pre_gaussian_blur")), badParams));
m_BadVariationNames.push_back(make_pair(make_pair(string("pre_blur"), string("pre_gaussian_blur")), badParams));//No other special params for these.
m_BadVariationNames.push_back(make_pair(make_pair(string("pre_spin_z"), string("pre_rotate_z")), badParams));
m_BadVariationNames.push_back(make_pair(make_pair(string("post_spin_z"), string("post_rotate_z")), badParams));
@ -546,6 +546,7 @@ private:
bool ParseEmberElement(xmlNode* emberNode, Ember<T>& currentEmber)
{
bool ret = true;
bool fromEmber = false;
uint newLinear = 0;
char* attStr;
const char* loc = __FUNCTION__;
@ -639,6 +640,11 @@ private:
currentEmber.m_Name = string(attStr);
std::replace(currentEmber.m_Name.begin(), currentEmber.m_Name.end(), ' ', '_');
}
else if (!Compare(curAtt->name, "version"))
{
if (ToLower(string(attStr)).find_first_of("ember") != string::npos)
fromEmber = true;
}
else if (!Compare(curAtt->name, "size"))
{
if (sscanf_s(attStr, "%lu %lu", &currentEmber.m_FinalRasW, &currentEmber.m_FinalRasH) != 2)
@ -931,7 +937,7 @@ private:
{
Xform<T> finalXform;
if (!ParseXform(childNode, finalXform, false))
if (!ParseXform(childNode, finalXform, false, fromEmber))
{
m_ErrorReport.push_back(string(loc) + " : Error parsing final xform");
}
@ -951,7 +957,7 @@ private:
{
Xform<T> xform;
if (!ParseXform(childNode, xform, false))
if (!ParseXform(childNode, xform, false, fromEmber))
{
m_ErrorReport.push_back(string(loc) + " : Error parsing xform");
}
@ -977,7 +983,7 @@ private:
{
Xform<T> xform(false);//Will only have valid values in fields parsed for motion, all others will be EMPTYFIELD.
if (!ParseXform(motionNode, xform, true))
if (!ParseXform(motionNode, xform, true, fromEmber))
m_ErrorReport.push_back(string(loc) + " : Error parsing motion xform");
else
theXform->m_Motion.push_back(xform);
@ -1011,7 +1017,7 @@ private:
/// <param name="xform">The newly constructed xform based on what was parsed</param>
/// <param name="motion">True if this xform is a motion within a parent xform, else false</param>
/// <returns>True if there were no errors, else false.</returns>
bool ParseXform(xmlNode* childNode, Xform<T>& xform, bool motion)
bool ParseXform(xmlNode* childNode, Xform<T>& xform, bool motion, bool fromEmber)
{
bool success = true;
char* attStr;
@ -1145,7 +1151,8 @@ private:
}
else
{
string s = GetCorrectedVariationName(m_BadVariationNames, curAtt);
//Only correct names if it came from an outside source. Names originating from this library are always considered correct.
string s = fromEmber ? string(CCX(curAtt->name)) : GetCorrectedVariationName(m_BadVariationNames, curAtt);
if (Variation<T>* var = m_VariationList.GetVariation(s))
{
@ -1164,7 +1171,7 @@ private:
}
//Handle var1.
for (curAtt = attPtr; curAtt; curAtt = curAtt->next)
for (curAtt = attPtr; curAtt; curAtt = curAtt->next)//Legacy fields, most likely not used.
{
bool var1 = false;
@ -1195,7 +1202,7 @@ private:
}
//Handle var.
for (curAtt = attPtr; curAtt; curAtt = curAtt->next)
for (curAtt = attPtr; curAtt; curAtt = curAtt->next)//Legacy fields, most likely not used.
{
bool var = false;
@ -1226,7 +1233,8 @@ private:
{
for (curAtt = attPtr; curAtt; curAtt = curAtt->next)
{
string s = GetCorrectedParamName(m_BadParamNames, CCX(curAtt->name));
//Only correct names if it came from an outside source. Names originating from this library are always considered correct.
string s = fromEmber ? string(CCX(curAtt->name)) : GetCorrectedParamName(m_BadParamNames, CCX(curAtt->name));
const char* name = s.c_str();
if (parVar->ContainsParam(name))

View File

@ -258,7 +258,7 @@ bool EmberAnimate(EmberOptions& opt)
renderer->Transparency(opt.Transparency());
renderer->NumChannels(channels);
renderer->BytesPerChannel(opt.BitsPerChannel() / 8);
renderer->Priority((eThreadPriority)Clamp<uint>((uint)eThreadPriority::LOWEST, (uint)eThreadPriority::HIGHEST, opt.Priority()));
renderer->Priority((eThreadPriority)Clamp<int>((int)eThreadPriority::LOWEST, (int)eThreadPriority::HIGHEST, opt.Priority()));
renderer->Callback(opt.DoProgress() ? progress.get() : nullptr);
std::function<void(uint)> saveFunc = [&](uint threadVecIndex)

View File

@ -326,9 +326,16 @@ public:
INITBOOLOPTION(DumpKernel, Eob(OPT_USE_RENDER, OPT_DUMP_KERNEL, _T("--dump_kernel"), false, SO_NONE, "\t--dump_kernel Print the iteration kernel string when using OpenCL (ignored for CPU) [default: false].\n"));
//Int.
INITINTOPTION(Symmetry, Eoi(OPT_USE_GENOME, OPT_SYMMETRY, _T("--symmetry"), 0, SO_REQ_SEP, "\t--symmetry=<val> Set symmetry of result [default: 0].\n"));
INITINTOPTION(SheepGen, Eoi(OPT_USE_GENOME, OPT_SHEEP_GEN, _T("--sheep_gen"), -1, SO_REQ_SEP, "\t--sheep_gen=<val> Sheep generation of this flame [default: -1].\n"));
INITINTOPTION(SheepId, Eoi(OPT_USE_GENOME, OPT_SHEEP_ID, _T("--sheep_id"), -1, SO_REQ_SEP, "\t--sheep_id=<val> Sheep ID of this flame [default: -1].\n"));
INITINTOPTION(Symmetry, Eoi(OPT_USE_GENOME, OPT_SYMMETRY, _T("--symmetry"), 0, SO_REQ_SEP, "\t--symmetry=<val> Set symmetry of result [default: 0].\n"));
INITINTOPTION(SheepGen, Eoi(OPT_USE_GENOME, OPT_SHEEP_GEN, _T("--sheep_gen"), -1, SO_REQ_SEP, "\t--sheep_gen=<val> Sheep generation of this flame [default: -1].\n"));
INITINTOPTION(SheepId, Eoi(OPT_USE_GENOME, OPT_SHEEP_ID, _T("--sheep_id"), -1, SO_REQ_SEP, "\t--sheep_id=<val> Sheep ID of this flame [default: -1].\n"));
#ifdef _WIN32
INITINTOPTION(Priority, Eoi(OPT_RENDER_ANIM, OPT_PRIORITY, _T("--priority"), eThreadPriority::NORMAL, SO_REQ_SEP, "\t--priority=<val> The priority of the CPU rendering threads from -2 - 2. This does not apply to OpenCL rendering.\n"));
#else
INITINTOPTION(Priority, Eoi(OPT_RENDER_ANIM, OPT_PRIORITY, _T("--priority"), eThreadPriority::NORMAL, SO_REQ_SEP, "\t--priority=<val> The priority of the CPU rendering threads, 1, 25, 50, 75, 99. This does not apply to OpenCL rendering.\n"));
#endif
//Uint.
INITUINTOPTION(Platform, Eou(OPT_USE_ALL, OPT_OPENCL_PLATFORM, _T("--platform"), 0, SO_REQ_SEP, "\t--platform The OpenCL platform index to use [default: 0].\n"));
INITUINTOPTION(Device, Eou(OPT_USE_ALL, OPT_OPENCL_DEVICE, _T("--device"), 0, SO_REQ_SEP, "\t--device The OpenCL device index within the specified platform to use [default: 0].\n"));
INITUINTOPTION(Seed, Eou(OPT_USE_ALL, OPT_SEED, _T("--seed"), 0, SO_REQ_SEP, "\t--seed=<val> Integer seed to use for the random number generator [default: random].\n"));
@ -354,7 +361,6 @@ public:
INITUINTOPTION(Repeat, Eou(OPT_USE_GENOME, OPT_REPEAT, _T("--repeat"), 1, SO_REQ_SEP, "\t--repeat=<val> Number of new flames to create. Ignored if sequence, inter or rotate were specified [default: 1].\n"));
INITUINTOPTION(Tries, Eou(OPT_USE_GENOME, OPT_TRIES, _T("--tries"), 10, SO_REQ_SEP, "\t--tries=<val> Number times to try creating a flame that meets the specified constraints. Ignored if sequence, inter or rotate were specified [default: 10].\n"));
INITUINTOPTION(MaxXforms, Eou(OPT_USE_GENOME, OPT_MAX_XFORMS, _T("--maxxforms"), UINT_MAX, SO_REQ_SEP, "\t--maxxforms=<val> The maximum number of xforms allowed in the final output.\n"));
INITUINTOPTION(Priority, Eou(OPT_RENDER_ANIM, OPT_PRIORITY, _T("--priority"), eThreadPriority::NORMAL, SO_REQ_SEP, "\t--priority=<val> The priority of the CPU rendering threads from -2 - 2. This does not apply to OpenCL rendering.\n"));
//Double.
INITDOUBLEOPTION(SizeScale, Eod(OPT_RENDER_ANIM, OPT_SS, _T("--ss"), 1, SO_REQ_SEP, "\t--ss=<val> Size scale. All dimensions are scaled by this amount [default: 1.0].\n"));
@ -463,6 +469,7 @@ public:
PARSEINTOPTION(OPT_SYMMETRY, Symmetry);//Int args
PARSEINTOPTION(OPT_SHEEP_GEN, SheepGen);
PARSEINTOPTION(OPT_SHEEP_ID, SheepId);
PARSEINTOPTION(OPT_PRIORITY, Priority);
PARSEUINTOPTION(OPT_OPENCL_PLATFORM, Platform);//uint args.
PARSEUINTOPTION(OPT_OPENCL_DEVICE, Device);
PARSEUINTOPTION(OPT_SEED, Seed);
@ -484,7 +491,6 @@ public:
PARSEUINTOPTION(OPT_REPEAT, Repeat);
PARSEUINTOPTION(OPT_TRIES, Tries);
PARSEUINTOPTION(OPT_MAX_XFORMS, MaxXforms);
PARSEUINTOPTION(OPT_PRIORITY, Priority);
PARSEDOUBLEOPTION(OPT_SS, SizeScale);//Float args.
PARSEDOUBLEOPTION(OPT_QS, QualityScale);
@ -679,6 +685,7 @@ public:
EmberOptionEntry<int> Symmetry;//Value int.
EmberOptionEntry<int> SheepGen;
EmberOptionEntry<int> SheepId;
EmberOptionEntry<int> Priority;
EmberOptionEntry<uint> Platform;//Value uint.
EmberOptionEntry<uint> Device;
EmberOptionEntry<uint> Seed;
@ -700,7 +707,6 @@ public:
EmberOptionEntry<uint> Repeat;
EmberOptionEntry<uint> Tries;
EmberOptionEntry<uint> MaxXforms;
EmberOptionEntry<uint> Priority;
EmberOptionEntry<double> SizeScale;//Value double.
EmberOptionEntry<double> QualityScale;

View File

@ -154,7 +154,7 @@ bool EmberRender(EmberOptions& opt)
renderer->Transparency(opt.Transparency());
renderer->NumChannels(channels);
renderer->BytesPerChannel(opt.BitsPerChannel() / 8);
renderer->Priority((eThreadPriority)Clamp<uint>((uint)eThreadPriority::LOWEST, (uint)eThreadPriority::HIGHEST, opt.Priority()));
renderer->Priority((eThreadPriority)Clamp<int>((int)eThreadPriority::LOWEST, (int)eThreadPriority::HIGHEST, opt.Priority()));
renderer->Callback(opt.DoProgress() ? progress.get() : nullptr);
for (i = 0; i < embers.size(); i++)

View File

@ -118,7 +118,18 @@ FractoriumFinalRenderDialog::FractoriumFinalRenderDialog(FractoriumSettings* set
ui.FinalRenderDoSequenceCheckBox->setChecked( m_Settings->FinalDoSequence());
ui.FinalRenderKeepAspectCheckBox->setChecked( m_Settings->FinalKeepAspect());
ui.FinalRenderThreadCountSpin->setValue( m_Settings->FinalThreadCount());
#ifdef _WIN32
ui.FinalRenderThreadPriorityComboBox->setCurrentIndex(m_Settings->FinalThreadPriority() + 2);
#else
auto tpc = ui.FinalRenderThreadPriorityComboBox->count() - 1;
if (m_Settings->FinalThreadPriority() == THREAD_PRIORITY_LOWEST)
ui.FinalRenderThreadPriorityComboBox->setCurrentIndex(0);
else if (m_Settings->FinalThreadPriority() == THREAD_PRIORITY_HIGHEST)
ui.FinalRenderThreadPriorityComboBox->setCurrentIndex(tpc);
else
ui.FinalRenderThreadPriorityComboBox->setCurrentIndex(Clamp<int>(0, tpc, m_Settings->FinalThreadPriority() / 25));
#endif
m_QualitySpin->setValue(m_Settings->FinalQuality());
m_TemporalSamplesSpin->setValue(m_Settings->FinalTemporalSamples());
@ -206,7 +217,19 @@ uint FractoriumFinalRenderDialog::Current() { return ui.FinalRenderCurrentSpin->
uint FractoriumFinalRenderDialog::PlatformIndex() { return ui.FinalRenderPlatformCombo->currentIndex(); }
uint FractoriumFinalRenderDialog::DeviceIndex() { return ui.FinalRenderDeviceCombo->currentIndex(); }
uint FractoriumFinalRenderDialog::ThreadCount() { return ui.FinalRenderThreadCountSpin->value(); }
uint FractoriumFinalRenderDialog::ThreadPriority() { return ui.FinalRenderThreadPriorityComboBox->currentIndex() - 2; }
#ifdef _WIN32
int FractoriumFinalRenderDialog::ThreadPriority() { return ui.FinalRenderThreadPriorityComboBox->currentIndex() - 2; }
#else
int FractoriumFinalRenderDialog::ThreadPriority()
{
if (ui.FinalRenderThreadPriorityComboBox->currentIndex() == 0)
return THREAD_PRIORITY_LOWEST;
else if (ui.FinalRenderThreadPriorityComboBox->currentIndex() == (ui.FinalRenderThreadPriorityComboBox->count() - 1))
return THREAD_PRIORITY_HIGHEST;
else
return ui.FinalRenderThreadPriorityComboBox->currentIndex() * 25;
}
#endif
double FractoriumFinalRenderDialog::WidthScale() { return m_WidthScaleSpin->value(); }
double FractoriumFinalRenderDialog::HeightScale() { return m_HeightScaleSpin->value(); }
double FractoriumFinalRenderDialog::Quality() { return m_QualitySpin->value(); }

View File

@ -68,7 +68,7 @@ public:
uint PlatformIndex();
uint DeviceIndex();
uint ThreadCount();
uint ThreadPriority();
int ThreadPriority();
double WidthScale();
double HeightScale();
double Quality();

View File

@ -174,7 +174,7 @@ FinalRenderEmberController<T>::FinalRenderEmberController(FractoriumFinalRenderD
m_Renderer->Transparency(m_GuiState.m_Transparency);
m_Renderer->m_ProgressParameter = reinterpret_cast<void*>(&currentStripForProgress);
if (path.endsWith(".png", Qt::CaseInsensitive) || m_Renderer->RendererType() == OPENCL_RENDERER)//This is creating the wrong thing.//TODO
if (path.endsWith(".png", Qt::CaseInsensitive) || m_Renderer->RendererType() == OPENCL_RENDERER)
m_Renderer->NumChannels(4);
else
m_Renderer->NumChannels(3);

View File

@ -38,7 +38,7 @@ struct FinalRenderGuiState
uint m_PlatformIndex;
uint m_DeviceIndex;
uint m_ThreadCount;
uint m_ThreadPriority;
int m_ThreadPriority;
double m_WidthScale;
double m_HeightScale;
double m_Quality;

View File

@ -23,7 +23,16 @@ Fractorium::Fractorium(QWidget* p)
qRegisterMetaType<QVector<int>>("QVector<int>");//For previews.
qRegisterMetaType<vector<byte>>("vector<byte>");
qRegisterMetaType<EmberTreeWidgetItemBase*>("EmberTreeWidgetItemBase*");
setDockOptions(DockOption::AllowNestedDocks | DockOption::AllowTabbedDocks);
setTabPosition(Qt::AllDockWidgetAreas, QTabWidget::TabPosition::North);
setTabShape(QTabWidget::TabShape::Triangular);
tabifyDockWidget(ui.LibraryDockWidget, ui.FlameDockWidget);
tabifyDockWidget(ui.FlameDockWidget, ui.XformsDockWidget);
tabifyDockWidget(ui.XformsDockWidget, ui.XaosDockWidget);
tabifyDockWidget(ui.XaosDockWidget, ui.PaletteDockWidget);
tabifyDockWidget(ui.PaletteDockWidget, ui.InfoDockWidget);
m_FontSize = 9;
m_VarSortMode = 1;//Sort by weight by default.
m_PaletteSortMode = 0;//Sort by palette ascending by default.
@ -128,14 +137,14 @@ Fractorium::Fractorium(QWidget* p)
//Setup pointer in the GL window to point back to here.
ui.GLDisplay->SetMainWindow(this);
restoreState(m_Settings->value("windowState").toByteArray());
showMaximized();//This won't fully set things up and show them until after this constructor exits.
connect(ui.DockWidget, SIGNAL(dockLocationChanged(Qt::DockWidgetArea)), this, SLOT(dockLocationChanged(Qt::DockWidgetArea)));
connect(ui.DockWidget, SIGNAL(topLevelChanged(bool)), this, SLOT(OnDockTopLevelChanged(bool)));
connect(ui.LibraryDockWidget, SIGNAL(dockLocationChanged(Qt::DockWidgetArea)), this, SLOT(dockLocationChanged(Qt::DockWidgetArea)));
connect(ui.LibraryDockWidget, SIGNAL(topLevelChanged(bool)), this, SLOT(OnDockTopLevelChanged(bool)));
//Always ensure the library tab is selected, which will show preview renders.
ui.ParamsTabWidget->setCurrentIndex(0);
//ui.ParamsTabWidget->setCurrentIndex(0);
ui.XformsTabWidget->setCurrentIndex(2);//Make variations tab the currently selected one under the Xforms tab.
//Setting certain values will completely throw off the GUI, doing everything
@ -159,6 +168,7 @@ Fractorium::Fractorium(QWidget* p)
SetCoordinateStatus(0, 0, 0, 0);
SetTabOrders();
//At this point, everything has been setup except the renderer. Shortly after
//this constructor exits, GLWidget::InitGL() will create the initial flock and start the rendering timer
//which executes whenever the program is idle. Upon starting the timer, the renderer
@ -172,6 +182,7 @@ Fractorium::Fractorium(QWidget* p)
/// </summary>
Fractorium::~Fractorium()
{
m_Settings->setValue("windowState", saveState());
m_Settings->sync();
}
@ -718,6 +729,8 @@ void Fractorium::SetTabOrders()
w = SetTabOrder(this, w, m_PaletteBlurSpin);
w = SetTabOrder(this, w, m_PaletteBrightnessSpin);
w = SetTabOrder(this, w, m_PaletteFrequencySpin);
w = SetTabOrder(this, w, ui.PaletteFilterLineEdit);
w = SetTabOrder(this, w, ui.PaletteFilterClearButton);
w = SetTabOrder(this, w, ui.PaletteListTable);
w = SetTabOrder(this, ui.InfoBoundsGroupBox, ui.InfoBoundsFrame);//Info.

File diff suppressed because it is too large Load Diff

View File

@ -44,7 +44,7 @@ void FractoriumSettings::EnsureDefaults()
if (FinalThreadCount() == 0 || FinalThreadCount() > Timing::ProcessorCount())
FinalThreadCount(Timing::ProcessorCount());
FinalThreadPriority(Clamp<uint>((uint)eThreadPriority::LOWEST, (uint)eThreadPriority::HIGHEST, FinalThreadPriority()));
FinalThreadPriority(Clamp<int>((int)eThreadPriority::LOWEST, (int)eThreadPriority::HIGHEST, FinalThreadPriority()));
if (CpuSubBatch() < 1)
CpuSubBatch(1);
@ -186,8 +186,8 @@ void FractoriumSettings::FinalDeviceIndex(uint i) { setValue(FINALDEVICEINDE
uint FractoriumSettings::FinalThreadCount() { return value(FINALTHREADCOUNT).toUInt(); }
void FractoriumSettings::FinalThreadCount(uint i) { setValue(FINALTHREADCOUNT, i); }
uint FractoriumSettings::FinalThreadPriority() { return value(FINALTHREADPRIORITY).toUInt(); }
void FractoriumSettings::FinalThreadPriority(uint i) { setValue(FINALTHREADPRIORITY, i); }
uint FractoriumSettings::FinalThreadPriority() { return value(FINALTHREADPRIORITY).toInt(); }
void FractoriumSettings::FinalThreadPriority(int i) { setValue(FINALTHREADPRIORITY, i); }
uint FractoriumSettings::FinalQuality() { return value(FINALQUALITY).toUInt(); }
void FractoriumSettings::FinalQuality(uint i) { setValue(FINALQUALITY, i); }

View File

@ -153,7 +153,7 @@ public:
void FinalThreadCount(uint b);
uint FinalThreadPriority();
void FinalThreadPriority(uint b);
void FinalThreadPriority(int b);
uint FinalQuality();
void FinalQuality(uint i);

View File

@ -150,8 +150,8 @@ void Fractorium::InitXformsAffineUI()
//Further, the size of the dock widget won't be properly adjusted until the xforms tab is shown.
//So show it here and it will be switched back in Fractorium's constructor.
ui.ParamsTabWidget->setCurrentIndex(2);
ui.DockWidget->update();
//ui.ParamsTabWidget->setCurrentIndex(2);
//ui.DockWidget->update();
#endif
//Placing pointers to the spin boxes in arrays makes them easier to access in various places.