diff --git a/DataSpec/DNACommon/BabeDead.hpp b/DataSpec/DNACommon/BabeDead.hpp index 2882fa65a..2a9009917 100644 --- a/DataSpec/DNACommon/BabeDead.hpp +++ b/DataSpec/DNACommon/BabeDead.hpp @@ -3,6 +3,7 @@ #include "BlenderConnection.hpp" #include "zeus/Math.hpp" +#include namespace DataSpec { @@ -50,6 +51,7 @@ void ReadBabeDeadLightToBlender(hecl::BlenderConnection::PyOutStream& os, os.format("lamp.retro_layer = %u\n" "lamp.retro_origtype = %u\n" "lamp.falloff_type = 'INVERSE_COEFFICIENTS'\n" + "lamp.constant_coefficient = 0\n" "lamp.use_nodes = True\n" "falloff_node = lamp.node_tree.nodes.new('ShaderNodeLightFalloff')\n" "lamp.energy = 0.0\n" @@ -69,15 +71,18 @@ void ReadBabeDeadLightToBlender(hecl::BlenderConnection::PyOutStream& os, case BabeDeadLight::Falloff::Constant: os << "falloff_node.inputs[0].default_value *= 75.0\n" "lamp.node_tree.links.new(falloff_node.outputs[2], lamp.node_tree.nodes['Emission'].inputs[1])\n"; - os.format("lamp.constant_coefficient = 2.0 / %f\n", light.q); + if (light.q > FLT_EPSILON) + os.format("lamp.constant_coefficient = 2.0 / %f\n", light.q); break; case BabeDeadLight::Falloff::Linear: os << "lamp.node_tree.links.new(falloff_node.outputs[1], lamp.node_tree.nodes['Emission'].inputs[1])\n"; - os.format("lamp.linear_coefficient = 250 / %f\n", light.q); + if (light.q > FLT_EPSILON) + os.format("lamp.linear_coefficient = 250 / %f\n", light.q); break; case BabeDeadLight::Falloff::Quadratic: os << "lamp.node_tree.links.new(falloff_node.outputs[0], lamp.node_tree.nodes['Emission'].inputs[1])\n"; - os.format("lamp.quadratic_coefficient = 25000 / %f\n", light.q); + if (light.q > FLT_EPSILON) + os.format("lamp.quadratic_coefficient = 25000 / %f\n", light.q); break; default: break; }