/// <summary> /// The CustomLightManagerSupport constructor /// </summary> public CustomLightManager() { m_light_array = new List <Rhino.Geometry.Light>(); // The Guid of the plugin m_plugin_uuid = new Guid("0d54f97c-fe13-4d6f-86d8-960fd4c8c5de"); // The Guid of the render engine that the lightmanger represents m_render_uuid = new Guid("0d54f97c-fe13-4d6f-86d8-960fd4c8c5de"); // Create first custom light CustomLight custom_light_1 = new CustomLight(); custom_light_1.Name = "Custom Light 1"; custom_light_1.Intensity = 0.26; custom_light_1.IsEnabled = true; custom_light_1.CustomLightDescription = "Disco ball"; // all custom lights should have unique ids custom_light_1.Id = new Guid("5115C78B-4483-4F5F-BEE6-9B35637A7F6B"); // Create second custom light CustomLight custom_light_2 = new CustomLight(); custom_light_2.Name = "Custom Light 2"; custom_light_2.Intensity = 0.75; custom_light_2.IsEnabled = true; custom_light_2.CustomLightDescription = "Studio light"; // all custom lights should have unique ids custom_light_2.Id = new Guid("8F6CE74C-ACEF-4DB9-AA07-374F615FD073"); // Add all custom lights to internal lights array m_light_array.Add(custom_light_1); m_light_array.Add(custom_light_2); }
/// <summary> /// Return a description of the light /// </summary> public override string LightDescription(RhinoDoc doc, ref Light light) { string description = ""; // Check if light is in doc and return it int index = doc.Lights.Find(light.Id, true); if (index > -1) { if (light.IsPointLight) { description = "Point"; } else if (light.IsDirectionalLight) { description = "Directional"; } else if (light.IsLinearLight) { description = "Linear"; } else if (light.IsRectangularLight) { description = "Rectangular"; } else if (light.IsSpotLight) { description = "Spotlight"; } } else { // If not in doc, check if light matches custom light foreach (Rhino.Geometry.Light c_light in m_light_array) { if (c_light.Id == light.Id) { CustomLight custom_light = (CustomLight)c_light; return(custom_light.CustomLightDescription); } } } return(description); }