[Bf-blender-cvs] [c3d03b4434c] blender2.8: Lamps: Remove HEMI light type

Clément Foucault noreply at git.blender.org
Wed Nov 14 11:50:46 CET 2018


Commit: c3d03b4434c8554bbfff6cdc549bb089dec1da28
Author: Clément Foucault
Date:   Wed Nov 14 11:44:05 2018 +0100
Branches: blender2.8
https://developer.blender.org/rBc3d03b4434c8554bbfff6cdc549bb089dec1da28

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.

===================================================================

M	intern/cycles/blender/addon/ui.py
M	intern/cycles/blender/blender_object.cpp
M	source/blender/blenloader/intern/versioning_280.c
M	source/blender/collada/DocumentImporter.cpp
M	source/blender/collada/LightExporter.cpp
M	source/blender/draw/modes/object_mode.c
M	source/blender/editors/object/object_add.c
M	source/blender/editors/object/object_transform.c
M	source/blender/editors/space_outliner/outliner_draw.c
M	source/blender/editors/space_view3d/view3d_gizmo_lamp.c
M	source/blender/makesdna/DNA_lamp_types.h
M	source/blender/makesrna/intern/rna_lamp.c

===================================================================

diff --git a/intern/cycles/blender/addon/ui.py b/intern/cycles/blender/addon/ui.py
index 6372a2f5eba..e0bea93e1c2 100644
--- a/intern/cycles/blender/addon/ui.py
+++ b/intern/cycles/blender/addon/ui.py
@@ -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"
diff --git a/intern/cycles/blender/blender_object.cpp b/intern/cycles/blender/blender_object.cpp
index dcadc735b8e..a57edf9b940 100644
--- a/intern/cycles/blender/blender_object.cpp
+++ b/intern/cycles/blender/blender_object.cpp
@@ -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();
diff --git a/source/blender/blenloader/intern/versioning_280.c b/source/blender/blenloader/intern/versioning_280.c
index a72304a6d92..2049856cfa6 100644
--- a/source/blender/blenloader/intern/versioning_280.c
+++ b/source/blender/blenloader/intern/versioning_280.c
@@ -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) */
 
diff --git a/source/blender/collada/DocumentImporter.cpp b/source/blender/collada/DocumentImporter.cpp
index 50a9e351bc6..f10252c01c5 100644
--- a/source/blender/collada/DocumentImporter.cpp
+++ b/source/blender/collada/DocumentImporter.cpp
@@ -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:
diff --git a/source/blender/collada/LightExporter.cpp b/source/blender/collada/LightExporter.cpp
index 11377e06ce8..53fcbd1bb1a 100644
--- a/source/blender/collada/LightExporter.cpp
+++ b/source/blender/collada/LightExporter.cpp
@@ -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);
diff --git a/source/blender/draw/modes/object_mode.c b/source/blender/draw/modes/object_mode.c
index 53f128463fe..7f364698d07 100644
--- a/source/blender/draw/modes/object_mode.c
+++ b/source/blender/draw/modes/object_mode.c
@@ -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];
 
diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c
index 4f0961978f9..772199b8d91 100644
--- a/source/blender/editors/object/object_add.c
+++ b/source/blender/editors/object/object_add.c
@@ -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");
diff --git a/source/blender/editors/object/object_transform.c b/source/blender/editors/object/object_transform.c
index 6de96aa30ad..65ac910a237 100644
--- a/source/blender/editors/object/object_transform.c
+++ b/source/blender/editors/object/object_transform.c
@@ -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;
 		}
 	}
diff --git a/source/blender/editors/space_outliner/outliner_draw.c b/source/blender/editors/space_outliner/outliner_draw.c
index 64b09eca890..722ed393492 100644
--- a/source/blender/editors/space_outliner/outliner_draw.c
+++ b/source/blender/editors/space_outliner/outliner_draw.c
@@ -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:
diff --git a/source/blender/editors/space_view3d/view3d_gizmo_lamp.c b/source/blender/editors/space_view3d/view3d_gizmo_lamp.c
index 044efae0402..3eaddce582b 100644
--- a/source/blender/editors/space_view3d/view3d_gizmo_lamp.c
+++ b/source/blender/editors/space_view3d/view3d_gizmo_lamp.c
@@ -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) {
diff --git a/source/blender/makesdna/DNA_lamp_types.h b/source/blender/makesdna/DNA_lamp_types.h
index ff649f3ffe3..f9958abb603 100644
--- a/source/blender/makesdna/DNA_lamp_types.h
+++ b/source/blender/makesdna/DNA_lamp_types.h
@@ -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 */
diff --git a/source/blender/makesrna/intern/rna_lamp.c b/source/blender/makesrna/intern/rna_lamp.c
index 126c5e82206..7828d4a7b7d 100644
--- a/source/blender/makesrna/intern/rna_lamp.c
+++ b/source/blender/makesrna/intern/rna_lamp.c
@@ -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}
 };



More information about the Bf-blender-cvs mailing list