Lamps: Remove HEMI light type

This type is not supported by either Eevee or Cycles. If other types of
lamps are needed by external engines, we should support adding custom types.
This commit is contained in:
Clément Foucault 2018-11-14 11:44:05 +01:00
parent 0b0b3d7f7e
commit c3d03b4434
12 changed files with 28 additions and 34 deletions

View File

@ -1371,9 +1371,6 @@ class CYCLES_LIGHT_PT_light(CyclesButtonsPanel, Panel):
if light.type == 'AREA':
col.prop(clamp, "is_portal", text="Portal")
if light.type == 'HEMI':
layout.label(text="Not supported, interpreted as sun light")
class CYCLES_LIGHT_PT_nodes(CyclesButtonsPanel, Panel):
bl_label = "Nodes"

View File

@ -145,11 +145,12 @@ void BlenderSync::sync_light(BL::Object& b_parent,
light->spot_smooth = b_spot_light.spot_blend();
break;
}
case BL::Light::type_HEMI: {
light->type = LIGHT_DISTANT;
light->size = 0.0f;
break;
}
/* Hemi were removed from 2.8 */
// case BL::Light::type_HEMI: {
// light->type = LIGHT_DISTANT;
// light->size = 0.0f;
// break;
// }
case BL::Light::type_SUN: {
BL::SunLight b_sun_light(b_light);
light->size = b_sun_light.shadow_soft_size();

View File

@ -2258,6 +2258,13 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
}
}
for (Lamp *la = bmain->lamp.first; la; la = la->id.next) {
/* Removed Hemi lights. */
if (!ELEM(la->type, LA_LOCAL, LA_SUN, LA_SPOT, LA_AREA)) {
la->type = LA_SUN;
}
}
if (!DNA_struct_elem_find(fd->filesdna, "Brush", "char", "weightpaint_tool")) {
/* Magic defines from old files (2.7x) */

View File

@ -1200,7 +1200,8 @@ bool DocumentImporter::writeLight(const COLLADAFW::Light *light)
switch (type) {
case COLLADAFW::Light::AMBIENT_LIGHT:
{
lamp->type = LA_HEMI;
/* TODO Fix */
// lamp->type = LA_HEMI;
}
break;
case COLLADAFW::Light::SPOT_LIGHT:

View File

@ -90,13 +90,14 @@ void LightsExporter::operator()(Object *ob)
addLight(cla);
}
// hemi
else if (la->type == LA_HEMI) {
COLLADASW::AmbientLight cla(mSW, la_id, la_name);
cla.setColor(col, false, "color");
cla.setConstantAttenuation(constatt);
exportBlenderProfile(cla, la);
addLight(cla);
}
/* Hemi were removed from 2.8 */
// else if (la->type == LA_HEMI) {
// COLLADASW::AmbientLight cla(mSW, la_id, la_name);
// cla.setColor(col, false, "color");
// cla.setConstantAttenuation(constatt);
// exportBlenderProfile(cla, la);
// addLight(cla);
// }
// spot
else if (la->type == LA_SPOT) {
COLLADASW::SpotLight cla(mSW, la_id, la_name);

View File

@ -1471,12 +1471,10 @@ static void DRW_shgroup_lamp(OBJECT_ShadingGroupList *sgl, Object *ob, ViewLayer
DRW_shgroup_call_dynamic_add(sgl->lamp_circle, ob->obmat[3], color);
/* draw dashed outer circle for shadow */
if (la->type != LA_HEMI) {
DRW_shgroup_call_dynamic_add(sgl->lamp_circle_shadow, ob->obmat[3], color);
}
DRW_shgroup_call_dynamic_add(sgl->lamp_circle_shadow, ob->obmat[3], color);
/* Distance */
if (ELEM(la->type, LA_HEMI, LA_SUN, LA_AREA)) {
if (ELEM(la->type, LA_SUN, LA_AREA)) {
DRW_shgroup_call_dynamic_add(sgl->lamp_distance, color, &zero, &la->dist, ob->obmat);
}
@ -1538,10 +1536,6 @@ static void DRW_shgroup_lamp(OBJECT_ShadingGroupList *sgl, Object *ob, ViewLayer
DRW_shgroup_call_dynamic_add(sgl->lamp_buflimit, color, &la->clipsta, &la->clipend, ob->obmat);
DRW_shgroup_call_dynamic_add(sgl->lamp_buflimit_points, color, &la->clipsta, &la->clipend, ob->obmat);
}
else if (la->type == LA_HEMI) {
static float hemisize = 2.0f;
DRW_shgroup_call_dynamic_add(sgl->lamp_hemi, color, &hemisize, shapemat);
}
else if (la->type == LA_AREA) {
float size[3] = {1.0f, 1.0f, 1.0f}, sizemat[4][4];

View File

@ -125,7 +125,6 @@ const EnumPropertyItem rna_enum_light_type_items[] = {
{LA_LOCAL, "POINT", ICON_LIGHT_POINT, "Point", "Omnidirectional point light source"},
{LA_SUN, "SUN", ICON_LIGHT_SUN, "Sun", "Constant direction parallel ray light source"},
{LA_SPOT, "SPOT", ICON_LIGHT_SPOT, "Spot", "Directional cone light source"},
{LA_HEMI, "HEMI", ICON_LIGHT_HEMI, "Hemi", "180 degree constant light source"},
{LA_AREA, "AREA", ICON_LIGHT_AREA, "Area", "Directional area light source"},
{0, NULL, 0, NULL, NULL}
};
@ -1066,7 +1065,6 @@ static const char *get_light_defname(int type)
case LA_LOCAL: return CTX_DATA_(BLT_I18NCONTEXT_ID_LAMP, "Point");
case LA_SUN: return CTX_DATA_(BLT_I18NCONTEXT_ID_LAMP, "Sun");
case LA_SPOT: return CTX_DATA_(BLT_I18NCONTEXT_ID_LAMP, "Spot");
case LA_HEMI: return CTX_DATA_(BLT_I18NCONTEXT_ID_LAMP, "Hemi");
case LA_AREA: return CTX_DATA_(BLT_I18NCONTEXT_ID_LAMP, "Area");
default:
return CTX_DATA_(BLT_I18NCONTEXT_ID_LAMP, "Light");

View File

@ -1321,7 +1321,7 @@ static bool object_is_target_compat(const Object *ob)
{
if (ob->type == OB_LAMP) {
const Lamp *la = ob->data;
if (ELEM(la->type, LA_SUN, LA_SPOT, LA_HEMI, LA_AREA)) {
if (ELEM(la->type, LA_SUN, LA_SPOT, LA_AREA)) {
return true;
}
}

View File

@ -1272,8 +1272,6 @@ TreeElementIcon tree_element_get_icon(TreeStoreElem *tselem, TreeElement *te)
data.icon = ICON_LIGHT_SUN; break;
case LA_SPOT:
data.icon = ICON_LIGHT_SPOT; break;
case LA_HEMI:
data.icon = ICON_LIGHT_HEMI; break;
case LA_AREA:
data.icon = ICON_LIGHT_AREA; break;
default:

View File

@ -247,7 +247,7 @@ static bool WIDGETGROUP_lamp_target_poll(const bContext *C, wmGizmoGroupType *UN
if (ob != NULL) {
if (ob->type == OB_LAMP) {
Lamp *la = ob->data;
return (ELEM(la->type, LA_SUN, LA_SPOT, LA_HEMI, LA_AREA));
return (ELEM(la->type, LA_SUN, LA_SPOT, LA_AREA));
}
#if 0
else if (ob->type == OB_CAMERA) {

View File

@ -108,7 +108,7 @@ typedef struct Lamp {
#define LA_LOCAL 0
#define LA_SUN 1
#define LA_SPOT 2
#define LA_HEMI 3
/* #define LA_HEMI 3 */ /* not used anymore */
#define LA_AREA 4
/* mode */

View File

@ -74,8 +74,6 @@ static StructRNA *rna_Light_refine(struct PointerRNA *ptr)
return &RNA_SunLight;
case LA_SPOT:
return &RNA_SpotLight;
case LA_HEMI:
return &RNA_HemiLight;
case LA_AREA:
return &RNA_AreaLight;
default:
@ -115,7 +113,6 @@ const EnumPropertyItem rna_enum_light_type_items[] = {
{LA_LOCAL, "POINT", 0, "Point", "Omnidirectional point light source"},
{LA_SUN, "SUN", 0, "Sun", "Constant direction parallel ray light source"},
{LA_SPOT, "SPOT", 0, "Spot", "Directional cone light source"},
{LA_HEMI, "HEMI", 0, "Hemi", "180 degree constant light source"},
{LA_AREA, "AREA", 0, "Area", "Directional area light source"},
{0, NULL, 0, NULL, NULL}
};