Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#4292 Add preference to disable submodel dup node check #4293

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 15 additions & 0 deletions xLights/preferences/CheckSequenceSettingsPanel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ const long CheckSequenceSettingsPanel::ID_CHECKBOX3 = wxNewId();
const long CheckSequenceSettingsPanel::ID_CHECKBOX4 = wxNewId();
const long CheckSequenceSettingsPanel::ID_CHECKBOX5 = wxNewId();
const long CheckSequenceSettingsPanel::ID_CHECKBOX6 = wxNewId();
const long CheckSequenceSettingsPanel::ID_CHECKBOX8 = wxNewId();
const long CheckSequenceSettingsPanel::ID_CHECKBOX7 = wxNewId();
//*)

Expand Down Expand Up @@ -71,6 +72,10 @@ CheckSequenceSettingsPanel::CheckSequenceSettingsPanel(wxWindow* parent, xLights
CheckBox_CustomSizeCheck->SetValue(false);
CheckBox_CustomSizeCheck->SetHelpText(_("Large custom models with largely empty cells generate significant rendering overhead. You may want to consider shrinking the custom model dimensions if this can done without too significantly adversely affecting appearance."));
GridBagSizer1->Add(CheckBox_CustomSizeCheck, wxGBPosition(6, 0), wxDefaultSpan, wxALL|wxEXPAND, 5);
CheckBox_DupNodeSub = new wxCheckBox(this, ID_CHECKBOX8, _("Disable checks for duplicate nodes in submodels."), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_CHECKBOX8"));
CheckBox_DupNodeSub->SetValue(false);
CheckBox_DupNodeSub->SetHelpText(_("Duplicate nodes in submodels can be a result of planned overlap of common pixels"));
GridBagSizer1->Add(CheckBox_DupNodeSub, wxGBPosition(8, 0), wxDefaultSpan, wxALL, 5);
CheckBox_DisableSketch = new wxCheckBox(this, ID_CHECKBOX7, _("Disable sketch image file checking."), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_CHECKBOX7"));
CheckBox_DisableSketch->SetValue(false);
CheckBox_DisableSketch->SetHelpText(_("Sketch effect image files are not essential to rendering."));
Expand All @@ -92,6 +97,7 @@ CheckSequenceSettingsPanel::CheckSequenceSettingsPanel(wxWindow* parent, xLights
CheckBox_NonContigChOnPort->SetToolTip(CheckBox_NonContigChOnPort->GetHelpText());
CheckBox_PreviewGroup->SetToolTip(CheckBox_PreviewGroup->GetHelpText());
CheckBox_DupNodeMG->SetToolTip(CheckBox_DupNodeMG->GetHelpText());
CheckBox_DupNodeMG->SetToolTip(CheckBox_DupNodeSub->GetHelpText());
CheckBox_TransTime->SetToolTip(CheckBox_TransTime->GetHelpText());
CheckBox_CustomSizeCheck->SetToolTip(CheckBox_CustomSizeCheck->GetHelpText());
CheckBox_DisableSketch->SetToolTip(CheckBox_DisableSketch->GetHelpText());
Expand All @@ -108,6 +114,7 @@ bool CheckSequenceSettingsPanel::TransferDataToWindow() {
CheckBox_NonContigChOnPort->SetValue(xLightsFrame::IsCheckSequenceOptionDisabled("NonContigChOnPort"));
CheckBox_PreviewGroup->SetValue(xLightsFrame::IsCheckSequenceOptionDisabled("PreviewGroup"));
CheckBox_DupNodeMG->SetValue(xLightsFrame::IsCheckSequenceOptionDisabled("DupNodeMG"));
CheckBox_DupNodeSub->SetValue(xLightsFrame::IsCheckSequenceOptionDisabled("DupNodeSub"));
CheckBox_TransTime->SetValue(xLightsFrame::IsCheckSequenceOptionDisabled("TransTime"));
CheckBox_CustomSizeCheck->SetValue(xLightsFrame::IsCheckSequenceOptionDisabled("CustomSizeCheck"));
CheckBox_DisableSketch->SetValue(xLightsFrame::IsCheckSequenceOptionDisabled("SketchImage"));
Expand All @@ -118,6 +125,7 @@ bool CheckSequenceSettingsPanel::TransferDataFromWindow() {
xLightsFrame::SetCheckSequenceOptionDisable("NonContigChOnPort", CheckBox_NonContigChOnPort->IsChecked());
xLightsFrame::SetCheckSequenceOptionDisable("PreviewGroup", CheckBox_PreviewGroup->IsChecked());
xLightsFrame::SetCheckSequenceOptionDisable("DupNodeMG", CheckBox_DupNodeMG->IsChecked());
xLightsFrame::SetCheckSequenceOptionDisable("DupNodeSub", CheckBox_DupNodeSub->IsChecked());
xLightsFrame::SetCheckSequenceOptionDisable("TransTime", CheckBox_TransTime->IsChecked());
xLightsFrame::SetCheckSequenceOptionDisable("CustomSizeCheck", CheckBox_CustomSizeCheck->IsChecked());
xLightsFrame::SetCheckSequenceOptionDisable("SketchImage", CheckBox_DisableSketch->IsChecked());
Expand Down Expand Up @@ -172,3 +180,10 @@ void CheckSequenceSettingsPanel::OnCheckBox_DisableSketchClick(wxCommandEvent& e
TransferDataFromWindow();
}
}

void CheckSequenceSettingsPanel::OnCheckBox_DupNodeSubClick(wxCommandEvent& event)
{
if (wxPreferencesEditor::ShouldApplyChangesImmediately()) {
TransferDataFromWindow();
}
}
3 changes: 3 additions & 0 deletions xLights/preferences/CheckSequenceSettingsPanel.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ class CheckSequenceSettingsPanel: public wxPanel
wxCheckBox* CheckBox_CustomSizeCheck;
wxCheckBox* CheckBox_DisableSketch;
wxCheckBox* CheckBox_DupNodeMG;
wxCheckBox* CheckBox_DupNodeSub;
wxCheckBox* CheckBox_DupUniv;
wxCheckBox* CheckBox_NonContigChOnPort;
wxCheckBox* CheckBox_PreviewGroup;
Expand All @@ -49,6 +50,7 @@ class CheckSequenceSettingsPanel: public wxPanel
static const long ID_CHECKBOX4;
static const long ID_CHECKBOX5;
static const long ID_CHECKBOX6;
static const long ID_CHECKBOX8;
static const long ID_CHECKBOX7;
//*)

Expand All @@ -63,6 +65,7 @@ class CheckSequenceSettingsPanel: public wxPanel
void OnCheckBox_TransTimeClick(wxCommandEvent& event);
void OnCheckBox_CustomSizeCheckClick(wxCommandEvent& event);
void OnCheckBox_DisableSketchClick(wxCommandEvent& event);
void OnCheckBox_DupNodeSubClick(wxCommandEvent& event);
//*)

DECLARE_EVENT_TABLE()
Expand Down
11 changes: 11 additions & 0 deletions xLights/wxsmith/CheckSequenceSettingsPanel.wxs
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,17 @@
<border>5</border>
<option>1</option>
</object>
<object class="sizeritem">
<object class="wxCheckBox" name="ID_CHECKBOX8" variable="CheckBox_DupNodeSub" member="yes">
<label>Disable checks for duplicate nodes in submodels.</label>
<help>Duplicate nodes in submodels can be a result of planned overlap of common pixels</help>
</object>
<col>0</col>
<row>8</row>
<flag>wxALL</flag>
<border>5</border>
<option>1</option>
</object>
<object class="sizeritem">
<object class="wxCheckBox" name="ID_CHECKBOX7" variable="CheckBox_DisableSketch" member="yes">
<label>Disable sketch image file checking.</label>
Expand Down
29 changes: 17 additions & 12 deletions xLights/xLightsMain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5915,23 +5915,28 @@ std::string xLightsFrame::CheckSequence(bool displayInEditor, bool writeToFile)
warncountsave = warncount;

// Check for submodels with duplicate nodes
LogAndWrite(f, "");
LogAndWrite(f, "SubModels with duplicate nodes");
if (!IsCheckSequenceOptionDisabled("DupNodeSub")) {
LogAndWrite(f, "");
LogAndWrite(f, "SubModels with duplicate nodes");

for (const auto& it : AllModels) {
if (it.second->GetDisplayAs() != "ModelGroup") {
for (int i = 0; i < it.second->GetNumSubModels(); ++i) {
SubModel* sm = dynamic_cast<SubModel*>(it.second->GetSubModel(i));
if (sm != nullptr) {
std::string dups = sm->GetDuplicateNodes();
if (dups != "") {
wxString msg = wxString::Format(" WARN: SubModel '%s' contains duplicate nodes: %s. This may not render as expected.", (const char*)sm->GetFullName().c_str(), (const char*)dups.c_str());
LogAndWrite(f, msg.ToStdString());
warncount++;
for (const auto& it : AllModels) {
if (it.second->GetDisplayAs() != "ModelGroup") {
for (int i = 0; i < it.second->GetNumSubModels(); ++i) {
SubModel* sm = dynamic_cast<SubModel*>(it.second->GetSubModel(i));
if (sm != nullptr) {
std::string dups = sm->GetDuplicateNodes();
if (dups != "") {
wxString msg = wxString::Format(" WARN: SubModel '%s' contains duplicate nodes: %s. This may not render as expected.", (const char*)sm->GetFullName().c_str(), (const char*)dups.c_str());
LogAndWrite(f, msg.ToStdString());
warncount++;
}
}
}
}
}
} else {
LogAndWrite(f, "");
LogAndWrite(f, "SubModels with duplicate nodes - CHECK DISABLED");
}

if (errcount + warncount == errcountsave + warncountsave) {
Expand Down