mirror of
https://github.com/KillzXGaming/Switch-Toolbox
synced 2024-11-26 22:40:27 +00:00
Add batch editing panes if multiple are selected.
This commit is contained in:
parent
50191e4679
commit
6bc40a94a7
7 changed files with 100 additions and 0 deletions
|
@ -92,6 +92,14 @@ namespace LayoutBXLYT
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public BxlytMaterial TryGetActiveMaterial()
|
||||||
|
{
|
||||||
|
if (this is IPicturePane)
|
||||||
|
return ((IPicturePane)this).Material;
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
[DisplayName("Translate"), CategoryAttribute("Pane")]
|
[DisplayName("Translate"), CategoryAttribute("Pane")]
|
||||||
public Vector3F Translate { get; set; }
|
public Vector3F Translate { get; set; }
|
||||||
|
|
||||||
|
@ -2015,6 +2023,8 @@ namespace LayoutBXLYT
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public virtual void AddTexture(string texture)
|
public virtual void AddTexture(string texture)
|
||||||
{
|
{
|
||||||
int index = ParentLayout.AddTexture(texture);
|
int index = ParentLayout.AddTexture(texture);
|
||||||
|
|
|
@ -193,6 +193,11 @@ namespace LayoutBXLYT
|
||||||
if (!Loaded) return;
|
if (!Loaded) return;
|
||||||
ActivePane.Alpha = (byte)alphaUD.Value;
|
ActivePane.Alpha = (byte)alphaUD.Value;
|
||||||
|
|
||||||
|
//Apply to all selected panes
|
||||||
|
foreach (BasePane pane in parentEditor.SelectedPanes)
|
||||||
|
pane.Alpha = (byte)alphaUD.Value;
|
||||||
|
|
||||||
|
|
||||||
parentEditor.PropertyChanged?.Invoke(sender, e);
|
parentEditor.PropertyChanged?.Invoke(sender, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -241,6 +246,12 @@ namespace LayoutBXLYT
|
||||||
ActivePane.originY = OriginY.Center;
|
ActivePane.originY = OriginY.Center;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Apply to all selected panes
|
||||||
|
foreach (BasePane pane in parentEditor.SelectedPanes) {
|
||||||
|
pane.originX = ActivePane.originX;
|
||||||
|
pane.originY = ActivePane.originY;
|
||||||
|
}
|
||||||
|
|
||||||
SetOrientation();
|
SetOrientation();
|
||||||
|
|
||||||
IsRadioOrientationEdited = false;
|
IsRadioOrientationEdited = false;
|
||||||
|
@ -300,6 +311,15 @@ namespace LayoutBXLYT
|
||||||
ActivePane.ParentOriginY = OriginY.Center;
|
ActivePane.ParentOriginY = OriginY.Center;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Apply to all selected panes
|
||||||
|
foreach (BasePane pane in parentEditor.SelectedPanes) {
|
||||||
|
if (!pane.IsRoot && !pane.ParentIsRoot)
|
||||||
|
{
|
||||||
|
pane.ParentOriginX = ActivePane.ParentOriginX;
|
||||||
|
pane.ParentOriginY = ActivePane.ParentOriginY;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
SetParentOrientation();
|
SetParentOrientation();
|
||||||
|
|
||||||
IsRadioOrientationEdited = false;
|
IsRadioOrientationEdited = false;
|
||||||
|
|
|
@ -68,6 +68,17 @@ namespace LayoutBXLYT
|
||||||
ActivePane.ColorBottomLeft.Color = vertexColorBox1.BottomLeftColor;
|
ActivePane.ColorBottomLeft.Color = vertexColorBox1.BottomLeftColor;
|
||||||
ActivePane.ColorBottomRight.Color = vertexColorBox1.BottomRightColor;
|
ActivePane.ColorBottomRight.Color = vertexColorBox1.BottomRightColor;
|
||||||
|
|
||||||
|
//Apply to all selected panes
|
||||||
|
foreach (BasePane pane in parentEditor.SelectedPanes)
|
||||||
|
{
|
||||||
|
if (pane is IPicturePane) {
|
||||||
|
((IPicturePane)pane).ColorTopLeft.Color = vertexColorBox1.TopLeftColor;
|
||||||
|
((IPicturePane)pane).ColorTopRight.Color = vertexColorBox1.TopRightColor;
|
||||||
|
((IPicturePane)pane).ColorBottomLeft.Color = vertexColorBox1.BottomLeftColor;
|
||||||
|
((IPicturePane)pane).ColorBottomRight.Color = vertexColorBox1.BottomRightColor;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
parentEditor.PropertyChanged?.Invoke(sender, e);
|
parentEditor.PropertyChanged?.Invoke(sender, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -55,6 +55,15 @@ namespace LayoutBXLYT
|
||||||
{
|
{
|
||||||
whiteColorPB.Color = colorDlg.NewColor;
|
whiteColorPB.Color = colorDlg.NewColor;
|
||||||
ActiveMaterial.WhiteColor.Color = colorDlg.NewColor;
|
ActiveMaterial.WhiteColor.Color = colorDlg.NewColor;
|
||||||
|
|
||||||
|
//Apply to all selected panes
|
||||||
|
foreach (BasePane pane in ParentEditor.SelectedPanes)
|
||||||
|
{
|
||||||
|
var mat = pane.TryGetActiveMaterial();
|
||||||
|
if (mat != null)
|
||||||
|
mat.WhiteColor.Color = colorDlg.NewColor;
|
||||||
|
}
|
||||||
|
|
||||||
ParentEditor.PropertyChanged?.Invoke(sender, e);
|
ParentEditor.PropertyChanged?.Invoke(sender, e);
|
||||||
};
|
};
|
||||||
colorDlg.Show();
|
colorDlg.Show();
|
||||||
|
@ -78,6 +87,15 @@ namespace LayoutBXLYT
|
||||||
{
|
{
|
||||||
blackColorBP.Color = colorDlg.NewColor;
|
blackColorBP.Color = colorDlg.NewColor;
|
||||||
ActiveMaterial.BlackColor.Color = colorDlg.NewColor;
|
ActiveMaterial.BlackColor.Color = colorDlg.NewColor;
|
||||||
|
|
||||||
|
//Apply to all selected panes
|
||||||
|
foreach (BasePane pane in ParentEditor.SelectedPanes)
|
||||||
|
{
|
||||||
|
var mat = pane.TryGetActiveMaterial();
|
||||||
|
if (mat != null)
|
||||||
|
mat.BlackColor.Color = colorDlg.NewColor;
|
||||||
|
}
|
||||||
|
|
||||||
ParentEditor.PropertyChanged?.Invoke(sender, e);
|
ParentEditor.PropertyChanged?.Invoke(sender, e);
|
||||||
};
|
};
|
||||||
colorDlg.Show();
|
colorDlg.Show();
|
||||||
|
|
|
@ -288,6 +288,14 @@ namespace LayoutBXLYT
|
||||||
string newTexture = selector.GetSelectedTexture();
|
string newTexture = selector.GetSelectedTexture();
|
||||||
ActiveMaterial.AddTexture(newTexture);
|
ActiveMaterial.AddTexture(newTexture);
|
||||||
|
|
||||||
|
//Apply to all selected panes
|
||||||
|
foreach (BasePane pane in ParentEditor.SelectedPanes)
|
||||||
|
{
|
||||||
|
var mat = pane.TryGetActiveMaterial();
|
||||||
|
if (mat != null && mat != ActiveMaterial && mat.TextureMaps?.Length != 3)
|
||||||
|
mat.AddTexture(newTexture);
|
||||||
|
}
|
||||||
|
|
||||||
ReloadTexture();
|
ReloadTexture();
|
||||||
ParentEditor.PropertyChanged?.Invoke(sender, e);
|
ParentEditor.PropertyChanged?.Invoke(sender, e);
|
||||||
}
|
}
|
||||||
|
@ -313,6 +321,19 @@ namespace LayoutBXLYT
|
||||||
texMap.Name = newTexture;
|
texMap.Name = newTexture;
|
||||||
ReloadTexture();
|
ReloadTexture();
|
||||||
ParentEditor.PropertyChanged?.Invoke(sender, e);
|
ParentEditor.PropertyChanged?.Invoke(sender, e);
|
||||||
|
|
||||||
|
//Apply to all selected panes
|
||||||
|
foreach (BasePane pane in ParentEditor.SelectedPanes)
|
||||||
|
{
|
||||||
|
var mat = pane.TryGetActiveMaterial();
|
||||||
|
if (mat != null && mat != ActiveMaterial)
|
||||||
|
{
|
||||||
|
if (mat.TextureMaps?.Length > SelectedIndex)
|
||||||
|
mat.TextureMaps[SelectedIndex] = texMap;
|
||||||
|
else
|
||||||
|
mat.AddTexture(newTexture);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -320,8 +341,18 @@ namespace LayoutBXLYT
|
||||||
private void removebtn_Click(object sender, EventArgs e)
|
private void removebtn_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (ActiveMaterial.TextureMaps.Length > SelectedIndex && SelectedIndex >= 0)
|
if (ActiveMaterial.TextureMaps.Length > SelectedIndex && SelectedIndex >= 0)
|
||||||
|
{
|
||||||
ActiveMaterial.TextureMaps = ActiveMaterial.TextureMaps.RemoveAt(SelectedIndex);
|
ActiveMaterial.TextureMaps = ActiveMaterial.TextureMaps.RemoveAt(SelectedIndex);
|
||||||
|
|
||||||
|
//Apply to all selected panes
|
||||||
|
foreach (BasePane pane in ParentEditor.SelectedPanes)
|
||||||
|
{
|
||||||
|
var mat = pane.TryGetActiveMaterial();
|
||||||
|
if (mat != null && mat != ActiveMaterial && mat.TextureMaps?.Length > SelectedIndex)
|
||||||
|
mat.TextureMaps = mat.TextureMaps.RemoveAt(SelectedIndex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (ActiveMaterial.TextureMaps.Length == 0)
|
if (ActiveMaterial.TextureMaps.Length == 0)
|
||||||
{
|
{
|
||||||
SelectedIndex = -1;
|
SelectedIndex = -1;
|
||||||
|
|
|
@ -28,6 +28,11 @@ namespace LayoutBXLYT
|
||||||
return ParentEditor.GetTextures();
|
return ParentEditor.GetTextures();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<BasePane> SelectedPanes
|
||||||
|
{
|
||||||
|
get { return ParentEditor.SelectedPanes; }
|
||||||
|
}
|
||||||
|
|
||||||
public void Reset()
|
public void Reset()
|
||||||
{
|
{
|
||||||
stToolStrip1.Items.Clear();
|
stToolStrip1.Items.Clear();
|
||||||
|
|
|
@ -35,6 +35,11 @@ namespace LayoutBXLYT
|
||||||
public List<BxlanHeader> AnimationFiles = new List<BxlanHeader>();
|
public List<BxlanHeader> AnimationFiles = new List<BxlanHeader>();
|
||||||
public List<BxlanHeader> SelectedAnimations = new List<BxlanHeader>();
|
public List<BxlanHeader> SelectedAnimations = new List<BxlanHeader>();
|
||||||
|
|
||||||
|
public List<BasePane> SelectedPanes
|
||||||
|
{
|
||||||
|
get { return ActiveViewport?.SelectedPanes; }
|
||||||
|
}
|
||||||
|
|
||||||
private BxlytHeader ActiveLayout;
|
private BxlytHeader ActiveLayout;
|
||||||
private BxlanHeader ActiveAnimation;
|
private BxlanHeader ActiveAnimation;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue