/*******************************************/ private static INode ToNode(IGH_Param component) { if (component is CallerValueList) { CallerValueList cc = component as CallerValueList; if (cc.Caller != null) { return(cc.IToNode(cc.Caller.Choices, cc.Caller.SelectedItem)); } } else { return(Engine.Grasshopper.Convert.IToNode(component as dynamic)); } return(null); }
/*******************************************/ private void MessageLabelColours(out Color fill, out Color text, out Color edge) { try { // Define the colour of the render to match the component's borders GH_Palette palette = GH_CapsuleRenderEngine.GetImpliedPalette(this.Owner); if (palette == GH_Palette.Normal && !this.Owner.IsPreviewCapable) { palette = GH_Palette.Hidden; } GH_PaletteStyle style = GH_CapsuleRenderEngine.GetImpliedStyle(palette, this.Selected, this.Owner.Locked, this.Owner.Hidden); edge = style.Edge; fill = style.Edge; if (!Visible) { //If message is warning message, set fill to GH wraning colour. //This is only done if the Prototype label is not already on the component, as extra warning colour is then not needed. CallerValueList owner = (this.Owner as CallerValueList); if (owner != null && owner.IsWarningMessage && !Visible) { if (this.Selected) { fill = Color.FromArgb(210, 230, 25); } else { fill = Color.FromArgb(241, 175, 29); } } } //Set text colour to contrast background colour text = GH_GraphicsUtil.ForegroundColour(fill, 200); } catch { fill = Color.Black; text = Color.White; edge = Color.Black; } }