private void RunScript(string name, ref object Mode, ref object Colors)
{
var displayMode = doc.Views.Find(name, false).ActiveViewport.DisplayMode;
var fillMode = displayMode.DisplayAttributes.FillMode;
Mode = fillMode;
var colors = new Color[4];
displayMode.DisplayAttributes.GetFill(out colors[0], out colors[1], out colors[2], out colors[3]);
switch (fillMode)
{
case DisplayPipelineAttributes.FrameBufferFillMode.DefaultColor:
Colors = Rhino.ApplicationSettings.AppearanceSettings.ViewportBackgroundColor;
break;
case DisplayPipelineAttributes.FrameBufferFillMode.SolidColor:
Colors = colors[0];
break;
case DisplayPipelineAttributes.FrameBufferFillMode.Gradient2Color:
Colors = new[] { colors[0], colors[1] };
break;
case DisplayPipelineAttributes.FrameBufferFillMode.Gradient4Color:
Colors = colors;
break;
case DisplayPipelineAttributes.FrameBufferFillMode.Bitmap:
break;
case DisplayPipelineAttributes.FrameBufferFillMode.Renderer:
switch (RhinoDocument.RenderSettings.BackgroundStyle)
{
case BackgroundStyle.SolidColor:
Colors = RhinoDocument.RenderSettings.BackgroundColorTop;
break;
case BackgroundStyle.WallpaperImage:
break;
case BackgroundStyle.Gradient:
Colors = new[]
{
RhinoDocument.RenderSettings.BackgroundColorTop,
RhinoDocument.RenderSettings.BackgroundColorBottom
};
break;
case BackgroundStyle.Environment:
break;
default:
throw new ArgumentOutOfRangeException();
}
break;
case DisplayPipelineAttributes.FrameBufferFillMode.Transparent:
break;
default:
throw new ArgumentOutOfRangeException();
}
}
Background.gh (4.3 KB)