Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
keithsw1111 committed Apr 16, 2023
2 parents 4579f43 + 09ba2c0 commit 7f4bc3f
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 20 deletions.
2 changes: 1 addition & 1 deletion controllers/espixelstick.xcontroller
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
<SupportsInputOnlyUpload/>
<SupportsAutoUpload/>
<MaxInputUniverses>12</MaxInputUniverses>
<MaxPixelPort>6</MaxPixelPort>
<MaxPixelPort>8</MaxPixelPort>
<MaxSerialPort>1</MaxSerialPort>
<MaxSerialPortChannels>512</MaxSerialPortChannels>
<MaxPixelPortChannels>3072</MaxPixelPortChannels>
Expand Down
12 changes: 10 additions & 2 deletions xLights/effects/ServoEffect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include "../models/DMX/DmxServo.h"
#include "../models/DMX/DmxServo3D.h"
#include "../models/DMX/Servo.h"
#include "../models/ModelGroup.h"

ServoEffect::ServoEffect(int id) : RenderableEffect(id, "Servo", servo_16, servo_24, servo_32, servo_48, servo_64)
{
Expand Down Expand Up @@ -262,21 +263,28 @@ void ServoEffect::SetPanelStatus(Model *cls) {
return;
}

Model* m = cls;
if (cls->GetDisplayAs() == "ModelGroup") {
m = dynamic_cast<ModelGroup*>(cls)->GetFirstModel();
if (m == nullptr)
m = cls;
}

p->Choice_Servo_TimingTrack->Clear();
for (const auto& it : wxSplit(GetTimingTracks(0, 3), '|'))
{
p->Choice_Servo_TimingTrack->Append(it);
}

int num_channels = cls->GetNumChannels();
int num_channels = m->GetNumChannels();

wxString choice_ctrl = "ID_CHOICE_Channel";
wxChoice* choice = (wxChoice*)(p->FindWindowByName(choice_ctrl));

if( choice != nullptr ) {
choice->Clear();
for(int i = 0; i <= num_channels; ++i) {
std::string name = cls->GetNodeName(i);
std::string name = m->GetNodeName(i);
if( name != "" && name[0] != '-' ) {
choice->Append(name);
}
Expand Down
64 changes: 47 additions & 17 deletions xLights/sequencer/EffectsGrid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ void EffectsGrid::rightClick(wxMouseEvent& event)
}

wxMenuItem* menu_duplicate = mnuLayer.Append(ID_GRID_MNU_DUPLICATE_EFFECT, "Duplicate");
if (mSelectedEffect == nullptr || (mSelectedEffect->GetEndTimeMS() - mSelectedEffect->GetStartTimeMS() <= mSequenceElements->GetFrameMS())) {
if (mSelectedEffect == nullptr ) {
menu_duplicate->Enable(false);
}

Expand Down Expand Up @@ -6768,23 +6768,53 @@ void EffectsGrid::DuplicateSelectedEffects()
DuplicateDialog dialog(mParent);

if (dialog.ShowModal() == wxID_OK) {
if (mSelectedEffect != nullptr) {
long start = mSelectedEffect->GetStartTimeMS();
long end = mSelectedEffect->GetEndTimeMS();
long length = end - start;
if (mSelectedEffect != nullptr) {
bool paste_by_cell = ((MainSequencer*)mParent)->PasteByCellActive();

auto el = mSelectedEffect->GetParentEffectLayer();
long newstart = end;
for (int i = 0; i < dialog.GetCount(); ++i) {
newstart += (dialog.GetGap() * length);
newstart = mTimeline->RoundToMultipleOfPeriod(newstart, mSequenceElements->GetFrequency());
long newEnd = mTimeline->RoundToMultipleOfPeriod(newstart + length, mSequenceElements->GetFrequency());
if (!el->HasEffectsInTimeRange(newstart, newEnd)) {
Effect* newef = el->AddEffect(0, xlights->GetEffectManager().GetEffectName(mSelectedEffect->GetEffectIndex()), mSelectedEffect->GetSettingsAsString(), mSelectedEffect->GetPaletteAsString(), newstart, newEnd, EFFECT_SELECTED, false);
mSequenceElements->get_undo_mgr().CaptureAddedEffect(el->GetParentElement()->GetName(), el->GetIndex(), newef->GetID());
}
newstart = newEnd;
}
EffectLayer* tel{nullptr};
if (paste_by_cell) {
tel = mSequenceElements->GetVisibleEffectLayer(mSequenceElements->GetSelectedTimingRow());
if (tel == nullptr) {
return;
}
long startCol = tel->GetEffectByTime(mSelectedEffect->GetStartTimeMS())->GetID() + 2;
if (mSelectedEffect->GetStartTimeMS() == 0) {//first timing mark in the zero column, and second timing mark has start column of 0 too
startCol--;
}
auto el = mSelectedEffect->GetParentEffectLayer();
mSelectedEffect->GetEffectIndex();
for (int i = 0; i < dialog.GetCount(); ++i) {
startCol += dialog.GetGap();
Effect* eff = tel->GetEffect(startCol);
if (nullptr != eff) {
long newstart = mTimeline->RoundToMultipleOfPeriod(eff->GetStartTimeMS(), mSequenceElements->GetFrequency());
long newEnd = mTimeline->RoundToMultipleOfPeriod(eff->GetEndTimeMS(), mSequenceElements->GetFrequency());
if (!el->HasEffectsInTimeRange(newstart, newEnd)) {
Effect* newef = el->AddEffect(0, xlights->GetEffectManager().GetEffectName(mSelectedEffect->GetEffectIndex()), mSelectedEffect->GetSettingsAsString(), mSelectedEffect->GetPaletteAsString(), newstart, newEnd, EFFECT_SELECTED, false);
mSequenceElements->get_undo_mgr().CaptureAddedEffect(el->GetParentElement()->GetName(), el->GetIndex(), newef->GetID());
}
}
startCol++;
}
}
else {
long start = mSelectedEffect->GetStartTimeMS();
long end = mSelectedEffect->GetEndTimeMS();
long length = end - start;

auto el = mSelectedEffect->GetParentEffectLayer();
long newstart = end;
for (int i = 0; i < dialog.GetCount(); ++i) {
newstart += (dialog.GetGap() * length);
newstart = mTimeline->RoundToMultipleOfPeriod(newstart, mSequenceElements->GetFrequency());
long newEnd = mTimeline->RoundToMultipleOfPeriod(newstart + length, mSequenceElements->GetFrequency());
if (!el->HasEffectsInTimeRange(newstart, newEnd)) {
Effect* newef = el->AddEffect(0, xlights->GetEffectManager().GetEffectName(mSelectedEffect->GetEffectIndex()), mSelectedEffect->GetSettingsAsString(), mSelectedEffect->GetPaletteAsString(), newstart, newEnd, EFFECT_SELECTED, false);
mSequenceElements->get_undo_mgr().CaptureAddedEffect(el->GetParentElement()->GetName(), el->GetIndex(), newef->GetID());
}
newstart = newEnd;
}
}
}
}
}

0 comments on commit 7f4bc3f

Please sign in to comment.