I’ve done my due diligence before posting this question. For the life of me I cannot get an iterator to work for render lights. I am using the simple code below. Might I be missing something? The light, in question, does show up in a scene Dump(). I am attaching a Rhino v3 test file as an example.
--------------------------my_spot_light.3dm (2.4 KB)
ONX_ModelComponentIterator light_it( model, ON_ModelComponent::Type::RenderLight );
// const ON_ModelComponent* model_component = nullptr;
// model_component = light_it.FirstComponent();
// const ON_ModelGeometryComponent* model_geometry = ON_ModelGeometryComponent::Cast(model_component);
// const ON_Light *light2 = ON_Light::Cast(light_it.FirstComponent());
for (const ON_Light *light = ON_Light::Cast(light_it.FirstComponent()); nullptr != light; light = ON_Light::Cast(light_it.NextComponent()) ) {
ON_String light_name = "Light";
const ON_ModelGeometryComponent* model_geometry = ON_ModelGeometryComponent::Cast(light);
if (model_geometry) {
const ON_3dmObjectAttributes *m_attributes = model_geometry->Attributes(nullptr);
if (m_attributes)
light_name = m_attributes->Name();
}