Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #39 from woeishi/develop

DeleteSlice with Pin.IsChanged & TextEX9Texture bugfix
  • Loading branch information...
commit 2ee013252f0f2b2c01904dbf7b51221e190fd3f3 2 parents 4f5ae06 + 6e19cc3
@joreg joreg authored
View
126 vvvv45/addonpack/src/nodes/plugins/Texture/TextEX9Texture/TextEX9TextureNode.cs
@@ -169,70 +169,80 @@ unsafe protected override void UpdateTexture(int Slice, Texture texture)
GraphicsUnit.Pixel);
string text = FTextInput[Slice];
+
int renderingMode = FTextRenderingModeInput[Slice].Index;
RectangleF layout = new RectangleF(0,0,0,0);
- switch (renderingMode)
- {
- case 0: text = text.Replace("\n"," ").Replace("\n",string.Empty); break;
- case 1: break;
- case 2: layout.Size= new SizeF(width,height);break;
- }
- if (FCharEncoding[Slice] == "UTF8")
- {
- byte[] utf8bytes = Encoding.Default.GetBytes(text);
- text = Encoding.UTF8.GetString(utf8bytes);
- }
-
StringFormat format = new StringFormat();
- format.LineAlignment = StringAlignment.Near;
- switch (FHorizontalAlignInput[Slice].Index)
- {
- case 0: format.Alignment = StringAlignment.Near;break;
- case 1:
- format.Alignment = StringAlignment.Center;
- layout.X = width/2;
- break;
- case 2:
- format.Alignment = StringAlignment.Far;
- layout.X = width;
- break;
- }
-
- switch (FVerticalAlignInput[Slice].Index)
- {
- case 0: format.LineAlignment = StringAlignment.Near;break;
- case 1:
- format.LineAlignment = StringAlignment.Center;
- layout.Y = height/2;
- break;
- case 2:
- format.LineAlignment = StringAlignment.Far;
- layout.Y = height;
- break;
- }
-
- SizeF size = g.MeasureString(text, objFont, layout.Size, format);
- FSizeOutput[Slice] = new Vector2D(width/size.Width,height/size.Height);
+ if (!string.IsNullOrEmpty(text))
+ {
+ switch (renderingMode)
+ {
+ case 0: text = text.Replace("\n"," ").Replace("\n",string.Empty); break;
+ case 1: break;
+ case 2: layout.Size= new SizeF(width,height);break;
+ }
+ if (FCharEncoding[Slice] == "UTF8")
+ {
+ byte[] utf8bytes = Encoding.Default.GetBytes(text);
+ text = Encoding.UTF8.GetString(utf8bytes);
+ }
+
+
+ format.LineAlignment = StringAlignment.Near;
+ switch (FHorizontalAlignInput[Slice].Index)
+ {
+ case 0: format.Alignment = StringAlignment.Near;break;
+ case 1:
+ format.Alignment = StringAlignment.Center;
+ layout.X = width/2;
+ break;
+ case 2:
+ format.Alignment = StringAlignment.Far;
+ layout.X = width;
+ break;
+ }
+
+ switch (FVerticalAlignInput[Slice].Index)
+ {
+ case 0: format.LineAlignment = StringAlignment.Near;break;
+ case 1:
+ format.LineAlignment = StringAlignment.Center;
+ layout.Y = height/2;
+ break;
+ case 2:
+ format.LineAlignment = StringAlignment.Far;
+ layout.Y = height;
+ break;
+ }
- float scx = 1; float scy = 1;
- switch (FNormalizeInput[Slice].Index)
- {
- case 0: break;
- case 1: scx = width/size.Width; break;
- case 2: scy = height/size.Height; break;
- case 3:
- scx = width/size.Width;
- scy = height/size.Height;
- break;
- }
- FScaleOutput[Slice]=new Vector2D(scx,scy);
+ SizeF size = g.MeasureString(text, objFont, layout.Size, format);
+ FSizeOutput[Slice] = new Vector2D(width/size.Width,height/size.Height);
+
+ float scx = 1; float scy = 1;
+ switch (FNormalizeInput[Slice].Index)
+ {
+ case 0: break;
+ case 1: scx = width/size.Width; break;
+ case 2: scy = height/size.Height; break;
+ case 3:
+ scx = width/size.Width;
+ scy = height/size.Height;
+ break;
+ }
+ FScaleOutput[Slice]=new Vector2D(scx,scy);
+
+ g.TranslateTransform(layout.X,layout.Y);
+ g.ScaleTransform(scx,scy);
+ g.TranslateTransform(-layout.X,-layout.Y);
+
+
+ if (renderingMode ==2)
+ layout.Location = new PointF(0,0);
- g.TranslateTransform(layout.X,layout.Y);
- g.ScaleTransform(scx,scy);
- g.TranslateTransform(-layout.X,-layout.Y);
+ }
+ else
+ FScaleOutput[Slice]=new Vector2D(0,0);
- if (renderingMode ==2)
- layout.Location = new PointF(0,0);
RGBAColor tmpBrush = FColorInput[Slice];
tmpBrush.A=0;
View
13 vvvv45/src/nodes/plugins/_SpreadOperations/DeleteSlice.cs
@@ -19,10 +19,10 @@ public class DeleteSlice<T> : IPluginEvaluate
{
#region fields & pins
[Input("Input", BinSize = 1, BinName = "Bin Size")]
- ISpread<ISpread<T>> FInput;
+ IDiffSpread<ISpread<T>> FInput;
[Input("Index")]
- ISpread<int> FIndex;
+ IDiffSpread<int> FIndex;
[Output("Output")]
ISpread<ISpread<T>> FOutput;
@@ -31,9 +31,12 @@ public class DeleteSlice<T> : IPluginEvaluate
//called when data for any output pin is requested
public void Evaluate(int SpreadMax)
{
- FOutput.AssignFrom(FInput);
- foreach (int i in FIndex.Select(x => x%FInput.SliceCount).Distinct().OrderByDescending(x => x))
- FOutput.RemoveAt(i);
+ if (FInput.IsChanged || FIndex.IsChanged)
+ {
+ FOutput.AssignFrom(FInput);
+ foreach (int i in FIndex.Select(x => x%FInput.SliceCount).Distinct().OrderByDescending(x => x))
+ FOutput.RemoveAt(i);
+ }
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.