diff --git a/install/games/darkmod.game b/install/games/darkmod.game
index 79be7aed52..e227609cc2 100644
--- a/install/games/darkmod.game
+++ b/install/games/darkmod.game
@@ -350,5 +350,6 @@
+
diff --git a/radiant/ui/materials/editor/MaterialPreview.cpp b/radiant/ui/materials/editor/MaterialPreview.cpp
index abcd5de307..c25272f73e 100644
--- a/radiant/ui/materials/editor/MaterialPreview.cpp
+++ b/radiant/ui/materials/editor/MaterialPreview.cpp
@@ -21,6 +21,7 @@ namespace
{
const char* const FUNC_STATIC_CLASS = "func_static";
const char* const GKEY_DEFAULT_ROOM_MATERIAL = "/materialPreview/defaultRoomMaterial";
+ const char* const GKEY_DEFAULT_LIGHT_DEF = "/materialPreview/defaultLightDef";
}
MaterialPreview::MaterialPreview(wxWindow* parent) :
@@ -104,6 +105,18 @@ std::string MaterialPreview::getRoomMaterial()
return game::current::getValue(GKEY_DEFAULT_ROOM_MATERIAL);
}
+std::string MaterialPreview::getDefaultLightDef()
+{
+ auto className = game::current::getValue(GKEY_DEFAULT_LIGHT_DEF);
+
+ if (className.empty() || !GlobalEntityClassManager().findClass(className))
+ {
+ className = "light";
+ }
+
+ return className;
+}
+
void MaterialPreview::updateRoomSkin()
{
auto roomMaterial = getRoomMaterial();
@@ -228,7 +241,7 @@ void MaterialPreview::setupSceneGraph()
// Set up the light
_light = GlobalEntityModule().createEntity(
- GlobalEntityClassManager().findClass("light"));
+ GlobalEntityClassManager().findClass(getDefaultLightDef()));
Node_getEntity(_light)->setKeyValue("light_radius", "750 750 750");
Node_getEntity(_light)->setKeyValue("origin", "150 150 150");
diff --git a/radiant/ui/materials/editor/MaterialPreview.h b/radiant/ui/materials/editor/MaterialPreview.h
index 6d47a6fbb8..31b80c81e4 100644
--- a/radiant/ui/materials/editor/MaterialPreview.h
+++ b/radiant/ui/materials/editor/MaterialPreview.h
@@ -71,6 +71,7 @@ class MaterialPreview :
void updateModelSkin();
void updateRoomSkin();
std::string getRoomMaterial();
+ std::string getDefaultLightDef();
void onTestModelSelectionChanged(wxCommandEvent& ev);
};