Lights: remove unused Blender Internal properties
For falloff, attenuation and shadow buffers. Pull Request: https://projects.blender.org/blender/blender/pulls/109738
This commit is contained in:
parent
c591eb1b40
commit
57d85b32a9
@ -267,28 +267,6 @@ class DATA_PT_spot(DataButtonsPanel, Panel):
|
||||
col.prop(light, "show_cone")
|
||||
|
||||
|
||||
class DATA_PT_falloff_curve(DataButtonsPanel, Panel):
|
||||
bl_label = "Falloff Curve"
|
||||
bl_options = {'DEFAULT_CLOSED'}
|
||||
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE'}
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
light = context.light
|
||||
engine = context.engine
|
||||
|
||||
return (
|
||||
(light and light.type in {'POINT', 'SPOT'} and light.falloff_type == 'CUSTOM_CURVE') and
|
||||
(engine in cls.COMPAT_ENGINES)
|
||||
)
|
||||
|
||||
def draw(self, context):
|
||||
light = context.light
|
||||
|
||||
self.layout.template_curve_mapping(
|
||||
light, "falloff_curve", use_negative_slope=True)
|
||||
|
||||
|
||||
class DATA_PT_custom_props_light(DataButtonsPanel, PropertyPanel, Panel):
|
||||
COMPAT_ENGINES = {
|
||||
'BLENDER_RENDER',
|
||||
@ -310,7 +288,6 @@ classes = (
|
||||
DATA_PT_EEVEE_shadow_cascaded_shadow_map,
|
||||
DATA_PT_EEVEE_shadow_contact,
|
||||
DATA_PT_spot,
|
||||
DATA_PT_falloff_curve,
|
||||
DATA_PT_custom_props_light,
|
||||
)
|
||||
|
||||
|
@ -47,9 +47,6 @@ static void light_init_data(ID *id)
|
||||
BLI_assert(MEMCMP_STRUCT_AFTER_IS_ZERO(la, id));
|
||||
|
||||
MEMCPY_STRUCT_AFTER(la, DNA_struct_default_get(Light), id);
|
||||
|
||||
la->curfalloff = BKE_curvemapping_add(1, 0.0f, 1.0f, 1.0f, 0.0f);
|
||||
BKE_curvemapping_init(la->curfalloff);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -71,8 +68,6 @@ static void light_copy_data(Main *bmain, ID *id_dst, const ID *id_src, const int
|
||||
/* We always need allocation of our private ID data. */
|
||||
const int flag_private_id_data = flag & ~LIB_ID_CREATE_NO_ALLOCATE;
|
||||
|
||||
la_dst->curfalloff = BKE_curvemapping_copy(la_src->curfalloff);
|
||||
|
||||
if (la_src->nodetree) {
|
||||
if (is_localized) {
|
||||
la_dst->nodetree = ntreeLocalize(la_src->nodetree);
|
||||
@ -96,8 +91,6 @@ static void light_free_data(ID *id)
|
||||
{
|
||||
Light *la = (Light *)id;
|
||||
|
||||
BKE_curvemapping_free(la->curfalloff);
|
||||
|
||||
/* is no lib link block, but light extension */
|
||||
if (la->nodetree) {
|
||||
ntreeFreeEmbeddedTree(la->nodetree);
|
||||
@ -132,10 +125,6 @@ static void light_blend_write(BlendWriter *writer, ID *id, const void *id_addres
|
||||
BKE_animdata_blend_write(writer, la->adt);
|
||||
}
|
||||
|
||||
if (la->curfalloff) {
|
||||
BKE_curvemapping_blend_write(writer, la->curfalloff);
|
||||
}
|
||||
|
||||
/* Node-tree is integral part of lights, no libdata. */
|
||||
if (la->nodetree) {
|
||||
BLO_Write_IDBuffer *temp_embedded_id_buffer = BLO_write_allocate_id_buffer();
|
||||
@ -156,11 +145,6 @@ static void light_blend_read_data(BlendDataReader *reader, ID *id)
|
||||
BLO_read_data_address(reader, &la->adt);
|
||||
BKE_animdata_blend_read_data(reader, la->adt);
|
||||
|
||||
BLO_read_data_address(reader, &la->curfalloff);
|
||||
if (la->curfalloff) {
|
||||
BKE_curvemapping_blend_read(reader, la->curfalloff);
|
||||
}
|
||||
|
||||
BLO_read_data_address(reader, &la->preview);
|
||||
BKE_previewimg_blend_read(reader, la->preview);
|
||||
}
|
||||
|
@ -990,12 +990,6 @@ static void do_version_curvemapping_walker(Main *bmain, void (*callback)(CurveMa
|
||||
}
|
||||
FOREACH_NODETREE_END;
|
||||
|
||||
LISTBASE_FOREACH (Light *, light, &bmain->lights) {
|
||||
if (light->curfalloff) {
|
||||
callback(light->curfalloff);
|
||||
}
|
||||
}
|
||||
|
||||
LISTBASE_FOREACH (Brush *, brush, &bmain->brushes) {
|
||||
if (brush->curve) {
|
||||
callback(brush->curve);
|
||||
|
@ -1545,7 +1545,6 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
|
||||
if (bmain->versionfile <= 241) {
|
||||
Object *ob;
|
||||
Scene *sce;
|
||||
Light *la;
|
||||
bArmature *arm;
|
||||
bNodeTree *ntree;
|
||||
|
||||
@ -1590,12 +1589,6 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
|
||||
ntree_version_241(ntree);
|
||||
}
|
||||
|
||||
for (la = bmain->lights.first; la; la = la->id.next) {
|
||||
if (la->buffers == 0) {
|
||||
la->buffers = 1;
|
||||
}
|
||||
}
|
||||
|
||||
/* for empty drawsize and drawtype */
|
||||
for (ob = bmain->objects.first; ob; ob = ob->id.next) {
|
||||
if (ob->empty_drawsize == 0.0f) {
|
||||
@ -1921,7 +1914,6 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
|
||||
Scene *sce;
|
||||
Object *ob;
|
||||
Image *ima;
|
||||
Light *la;
|
||||
Material *ma;
|
||||
ParticleSettings *part;
|
||||
bNodeTree *ntree;
|
||||
@ -2038,17 +2030,6 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
|
||||
}
|
||||
}
|
||||
|
||||
if (bmain->versionfile != 245 || bmain->subversionfile < 1) {
|
||||
for (la = bmain->lights.first; la; la = la->id.next) {
|
||||
la->falloff_type = LA_FALLOFF_INVLINEAR;
|
||||
|
||||
if (la->curfalloff == NULL) {
|
||||
la->curfalloff = BKE_curvemapping_add(1, 0.0f, 1.0f, 1.0f, 0.0f);
|
||||
BKE_curvemapping_init(la->curfalloff);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (ma = bmain->materials.first; ma; ma = ma->id.next) {
|
||||
if (ma->gloss_mir == 0.0f) {
|
||||
ma->gloss_mir = 1.0f;
|
||||
|
@ -1000,7 +1000,6 @@ bool DocumentImporter::writeLight(const COLLADAFW::Light *light)
|
||||
et->setData("type", &(lamp->type));
|
||||
et->setData("flag", &(lamp->flag));
|
||||
et->setData("mode", &(lamp->mode));
|
||||
et->setData("gamma", &(lamp->k));
|
||||
et->setData("red", &(lamp->r));
|
||||
et->setData("green", &(lamp->g));
|
||||
et->setData("blue", &(lamp->b));
|
||||
@ -1012,14 +1011,9 @@ bool DocumentImporter::writeLight(const COLLADAFW::Light *light)
|
||||
et->setData("spotsize", &(lamp->spotsize));
|
||||
lamp->spotsize = DEG2RADF(lamp->spotsize);
|
||||
et->setData("spotblend", &(lamp->spotblend));
|
||||
et->setData("att1", &(lamp->att1));
|
||||
et->setData("att2", &(lamp->att2));
|
||||
et->setData("falloff_type", &(lamp->falloff_type));
|
||||
et->setData("clipsta", &(lamp->clipsta));
|
||||
et->setData("clipend", &(lamp->clipend));
|
||||
et->setData("bias", &(lamp->bias));
|
||||
et->setData("bufsize", &(lamp->bufsize));
|
||||
et->setData("buffers", &(lamp->buffers));
|
||||
et->setData("radius", &(lamp->radius));
|
||||
et->setData("area_shape", &(lamp->area_shape));
|
||||
et->setData("area_size", &(lamp->area_size));
|
||||
@ -1027,12 +1021,7 @@ bool DocumentImporter::writeLight(const COLLADAFW::Light *light)
|
||||
et->setData("area_sizez", &(lamp->area_sizez));
|
||||
}
|
||||
else {
|
||||
float constatt = light->getConstantAttenuation().getValue();
|
||||
float linatt = light->getLinearAttenuation().getValue();
|
||||
float quadatt = light->getQuadraticAttenuation().getValue();
|
||||
float d = 25.0f;
|
||||
float att1 = 0.0f;
|
||||
float att2 = 0.0f;
|
||||
float e = 1.0f;
|
||||
|
||||
if (light->getColor().isValid()) {
|
||||
@ -1042,27 +1031,7 @@ bool DocumentImporter::writeLight(const COLLADAFW::Light *light)
|
||||
lamp->b = col.getBlue();
|
||||
}
|
||||
|
||||
if (IS_EQ(linatt, 0.0f) && quadatt > 0.0f) {
|
||||
att2 = quadatt;
|
||||
d = sqrt(1.0f / quadatt);
|
||||
}
|
||||
/* linear light */
|
||||
else if (IS_EQ(quadatt, 0.0f) && linatt > 0.0f) {
|
||||
att1 = linatt;
|
||||
d = (1.0f / linatt);
|
||||
}
|
||||
else if (IS_EQ(constatt, 1.0f)) {
|
||||
att1 = 1.0f;
|
||||
}
|
||||
else {
|
||||
/* assuming point light (const att = 1.0); */
|
||||
att1 = 1.0f;
|
||||
}
|
||||
|
||||
d *= (1.0f / unit_converter.getLinearMeter());
|
||||
|
||||
lamp->energy = e;
|
||||
lamp->dist = d;
|
||||
|
||||
switch (light->getLightType()) {
|
||||
case COLLADAFW::Light::AMBIENT_LIGHT: {
|
||||
@ -1070,14 +1039,6 @@ bool DocumentImporter::writeLight(const COLLADAFW::Light *light)
|
||||
} break;
|
||||
case COLLADAFW::Light::SPOT_LIGHT: {
|
||||
lamp->type = LA_SPOT;
|
||||
lamp->att1 = att1;
|
||||
lamp->att2 = att2;
|
||||
if (IS_EQ(att1, 0.0f) && att2 > 0) {
|
||||
lamp->falloff_type = LA_FALLOFF_INVSQUARE;
|
||||
}
|
||||
if (IS_EQ(att2, 0.0f) && att1 > 0) {
|
||||
lamp->falloff_type = LA_FALLOFF_INVLINEAR;
|
||||
}
|
||||
lamp->spotsize = DEG2RADF(light->getFallOffAngle().getValue());
|
||||
lamp->spotblend = light->getFallOffExponent().getValue();
|
||||
} break;
|
||||
@ -1087,14 +1048,6 @@ bool DocumentImporter::writeLight(const COLLADAFW::Light *light)
|
||||
} break;
|
||||
case COLLADAFW::Light::POINT_LIGHT: {
|
||||
lamp->type = LA_LOCAL;
|
||||
lamp->att1 = att1;
|
||||
lamp->att2 = att2;
|
||||
if (IS_EQ(att1, 0.0f) && att2 > 0) {
|
||||
lamp->falloff_type = LA_FALLOFF_INVSQUARE;
|
||||
}
|
||||
if (IS_EQ(att2, 0.0f) && att1 > 0) {
|
||||
lamp->falloff_type = LA_FALLOFF_INVLINEAR;
|
||||
}
|
||||
} break;
|
||||
case COLLADAFW::Light::UNDEFINED: {
|
||||
fprintf(stderr, "Current light type is not supported.\n");
|
||||
|
@ -49,26 +49,11 @@ void LightsExporter::operator()(Object *ob)
|
||||
std::string la_id(get_light_id(ob));
|
||||
std::string la_name(id_name(la));
|
||||
COLLADASW::Color col(la->r * la->energy, la->g * la->energy, la->b * la->energy);
|
||||
float d, constatt, linatt, quadatt;
|
||||
|
||||
d = la->dist;
|
||||
|
||||
constatt = 1.0f;
|
||||
|
||||
if (la->falloff_type == LA_FALLOFF_INVLINEAR) {
|
||||
linatt = 1.0f / d;
|
||||
quadatt = 0.0f;
|
||||
}
|
||||
else {
|
||||
linatt = 0.0f;
|
||||
quadatt = 1.0f / (d * d);
|
||||
}
|
||||
|
||||
/* sun */
|
||||
if (la->type == LA_SUN) {
|
||||
COLLADASW::DirectionalLight cla(mSW, la_id, la_name);
|
||||
cla.setColor(col, false, "color");
|
||||
cla.setConstantAttenuation(constatt);
|
||||
exportBlenderProfile(cla, la);
|
||||
addLight(cla);
|
||||
}
|
||||
@ -79,9 +64,6 @@ void LightsExporter::operator()(Object *ob)
|
||||
cla.setColor(col, false, "color");
|
||||
cla.setFallOffAngle(RAD2DEGF(la->spotsize), false, "fall_off_angle");
|
||||
cla.setFallOffExponent(la->spotblend, false, "fall_off_exponent");
|
||||
cla.setConstantAttenuation(constatt);
|
||||
cla.setLinearAttenuation(linatt);
|
||||
cla.setQuadraticAttenuation(quadatt);
|
||||
exportBlenderProfile(cla, la);
|
||||
addLight(cla);
|
||||
}
|
||||
@ -89,9 +71,6 @@ void LightsExporter::operator()(Object *ob)
|
||||
else if (la->type == LA_LOCAL) {
|
||||
COLLADASW::PointLight cla(mSW, la_id, la_name);
|
||||
cla.setColor(col, false, "color");
|
||||
cla.setConstantAttenuation(constatt);
|
||||
cla.setLinearAttenuation(linatt);
|
||||
cla.setQuadraticAttenuation(quadatt);
|
||||
exportBlenderProfile(cla, la);
|
||||
addLight(cla);
|
||||
}
|
||||
@ -100,9 +79,6 @@ void LightsExporter::operator()(Object *ob)
|
||||
else {
|
||||
COLLADASW::PointLight cla(mSW, la_id, la_name);
|
||||
cla.setColor(col, false, "color");
|
||||
cla.setConstantAttenuation(constatt);
|
||||
cla.setLinearAttenuation(linatt);
|
||||
cla.setQuadraticAttenuation(quadatt);
|
||||
exportBlenderProfile(cla, la);
|
||||
addLight(cla);
|
||||
}
|
||||
@ -113,7 +89,6 @@ bool LightsExporter::exportBlenderProfile(COLLADASW::Light &cla, Light *la)
|
||||
cla.addExtraTechniqueParameter("blender", "type", la->type);
|
||||
cla.addExtraTechniqueParameter("blender", "flag", la->flag);
|
||||
cla.addExtraTechniqueParameter("blender", "mode", la->mode);
|
||||
cla.addExtraTechniqueParameter("blender", "gamma", la->k, "blender_gamma");
|
||||
cla.addExtraTechniqueParameter("blender", "red", la->r);
|
||||
cla.addExtraTechniqueParameter("blender", "green", la->g);
|
||||
cla.addExtraTechniqueParameter("blender", "blue", la->b);
|
||||
@ -121,19 +96,11 @@ bool LightsExporter::exportBlenderProfile(COLLADASW::Light &cla, Light *la)
|
||||
cla.addExtraTechniqueParameter("blender", "shadow_g", la->shdwg, "blender_shadow_g");
|
||||
cla.addExtraTechniqueParameter("blender", "shadow_b", la->shdwb, "blender_shadow_b");
|
||||
cla.addExtraTechniqueParameter("blender", "energy", la->energy, "blender_energy");
|
||||
cla.addExtraTechniqueParameter("blender", "dist", la->dist, "blender_dist");
|
||||
cla.addExtraTechniqueParameter("blender", "spotsize", RAD2DEGF(la->spotsize));
|
||||
cla.addExtraTechniqueParameter("blender", "spotblend", la->spotblend);
|
||||
cla.addExtraTechniqueParameter("blender", "att1", la->att1);
|
||||
cla.addExtraTechniqueParameter("blender", "att2", la->att2);
|
||||
/* \todo figure out how we can have falloff curve supported here */
|
||||
cla.addExtraTechniqueParameter("blender", "falloff_type", la->falloff_type);
|
||||
cla.addExtraTechniqueParameter("blender", "clipsta", la->clipsta);
|
||||
cla.addExtraTechniqueParameter("blender", "clipend", la->clipend);
|
||||
cla.addExtraTechniqueParameter("blender", "bias", la->bias);
|
||||
cla.addExtraTechniqueParameter("blender", "bufsize", la->bufsize);
|
||||
cla.addExtraTechniqueParameter("blender", "samp", la->samp);
|
||||
cla.addExtraTechniqueParameter("blender", "buffers", la->buffers);
|
||||
cla.addExtraTechniqueParameter("blender", "radius", la->radius);
|
||||
cla.addExtraTechniqueParameter("blender", "area_shape", la->area_shape);
|
||||
cla.addExtraTechniqueParameter("blender", "area_size", la->area_size);
|
||||
|
@ -20,27 +20,17 @@
|
||||
.r = 1.0f, \
|
||||
.g = 1.0f, \
|
||||
.b = 1.0f, \
|
||||
.k = 1.0f, \
|
||||
.energy = 10.0f, \
|
||||
.dist = 25.0f, \
|
||||
.spotsize = DEG2RADF(45.0f), \
|
||||
.spotblend = 0.15f, \
|
||||
.att2 = 1.0f, \
|
||||
.mode = LA_SHADOW, \
|
||||
.bufsize = 512, \
|
||||
.clipsta = 0.05f, \
|
||||
.clipend = 40.0f, \
|
||||
.samp = 3, \
|
||||
.bias = 1.0f, \
|
||||
.area_size = 0.25f, \
|
||||
.area_sizey = 0.25f, \
|
||||
.area_sizez = 0.25f, \
|
||||
.buffers = 1, \
|
||||
.preview = NULL, \
|
||||
.falloff_type = LA_FALLOFF_INVSQUARE, \
|
||||
.coeff_const = 1.0f, \
|
||||
.coeff_lin = 0.0f, \
|
||||
.coeff_quad = 0.0f, \
|
||||
.cascade_max_dist = 200.0f, \
|
||||
.cascade_count = 4, \
|
||||
.cascade_exponent = 0.8f, \
|
||||
|
@ -31,42 +31,43 @@ typedef struct Light {
|
||||
/** Animation data (must be immediately after id for utilities to use it). */
|
||||
struct AnimData *adt;
|
||||
|
||||
/* Type and flags. */
|
||||
short type, flag;
|
||||
int mode;
|
||||
|
||||
float r, g, b, k;
|
||||
float shdwr, shdwg, shdwb, shdwpad;
|
||||
/* Color and energy. */
|
||||
float r, g, b;
|
||||
float energy, dist;
|
||||
|
||||
float energy, dist, spotsize, spotblend;
|
||||
|
||||
/** Quad1 and Quad2 attenuation. */
|
||||
float att1, att2;
|
||||
float coeff_const, coeff_lin, coeff_quad;
|
||||
char _pad0[4];
|
||||
struct CurveMapping *curfalloff;
|
||||
short falloff_type;
|
||||
char _pad2[2];
|
||||
|
||||
float clipsta, clipend;
|
||||
float bias;
|
||||
/* Point light. */
|
||||
float radius;
|
||||
short bufsize, samp, buffers, filtertype;
|
||||
char bufflag, buftype;
|
||||
|
||||
/* Spot Light. */
|
||||
float spotsize;
|
||||
float spotblend;
|
||||
|
||||
/* Area light. */
|
||||
short area_shape;
|
||||
float area_size, area_sizey, area_sizez;
|
||||
short _pad1;
|
||||
float area_size;
|
||||
float area_sizey;
|
||||
float area_sizez;
|
||||
float area_spread;
|
||||
|
||||
/* Sun light. */
|
||||
float sun_angle;
|
||||
|
||||
/* texact is for buttons */
|
||||
short texact, shadhalostep;
|
||||
/* Shadow color. */
|
||||
float shdwr, shdwg, shdwb;
|
||||
|
||||
/** Old animation system, deprecated for 2.5. */
|
||||
struct Ipo *ipo DNA_DEPRECATED;
|
||||
/* Nodes. */
|
||||
short pr_texture, use_nodes;
|
||||
|
||||
/* Eevee */
|
||||
float bias;
|
||||
float clipsta;
|
||||
float clipend;
|
||||
|
||||
float cascade_max_dist;
|
||||
float cascade_exponent;
|
||||
float cascade_fade;
|
||||
@ -79,11 +80,14 @@ typedef struct Light {
|
||||
float diff_fac, volume_fac;
|
||||
float spec_fac, att_dist;
|
||||
|
||||
/* preview */
|
||||
/* Preview */
|
||||
struct PreviewImage *preview;
|
||||
|
||||
/* nodes */
|
||||
/* Nodes */
|
||||
struct bNodeTree *nodetree;
|
||||
|
||||
/* Deprecated. */
|
||||
struct Ipo *ipo DNA_DEPRECATED; /* Old animation system. */
|
||||
} Light;
|
||||
|
||||
/* **************** LIGHT ********************* */
|
||||
|
@ -36,15 +36,6 @@
|
||||
# include "WM_api.h"
|
||||
# include "WM_types.h"
|
||||
|
||||
static void rna_Light_buffer_size_set(PointerRNA *ptr, int value)
|
||||
{
|
||||
Light *la = (Light *)ptr->data;
|
||||
|
||||
CLAMP(value, 128, 10240);
|
||||
la->bufsize = value;
|
||||
la->bufsize &= (~15); /* round to multiple of 16 */
|
||||
}
|
||||
|
||||
static StructRNA *rna_Light_refine(PointerRNA *ptr)
|
||||
{
|
||||
Light *la = (Light *)ptr->data;
|
||||
@ -237,63 +228,6 @@ static void rna_def_light_energy(StructRNA *srna, const short light_type)
|
||||
}
|
||||
}
|
||||
|
||||
static void rna_def_light_falloff(StructRNA *srna)
|
||||
{
|
||||
PropertyRNA *prop;
|
||||
|
||||
static const EnumPropertyItem prop_fallofftype_items[] = {
|
||||
{LA_FALLOFF_CONSTANT, "CONSTANT", 0, "Constant", ""},
|
||||
{LA_FALLOFF_INVLINEAR, "INVERSE_LINEAR", 0, "Inverse Linear", ""},
|
||||
{LA_FALLOFF_INVSQUARE, "INVERSE_SQUARE", 0, "Inverse Square", ""},
|
||||
{LA_FALLOFF_INVCOEFFICIENTS, "INVERSE_COEFFICIENTS", 0, "Inverse Coefficients", ""},
|
||||
{LA_FALLOFF_CURVE, "CUSTOM_CURVE", 0, "Custom Curve", ""},
|
||||
{LA_FALLOFF_SLIDERS, "LINEAR_QUADRATIC_WEIGHTED", 0, "Lin/Quad Weighted", ""},
|
||||
{0, nullptr, 0, nullptr, nullptr},
|
||||
};
|
||||
|
||||
prop = RNA_def_property(srna, "falloff_type", PROP_ENUM, PROP_NONE);
|
||||
RNA_def_property_enum_items(prop, prop_fallofftype_items);
|
||||
RNA_def_property_ui_text(prop, "Falloff Type", "Intensity Decay with distance");
|
||||
RNA_def_property_update(prop, 0, "rna_Light_update");
|
||||
|
||||
prop = RNA_def_property(srna, "falloff_curve", PROP_POINTER, PROP_NONE);
|
||||
RNA_def_property_pointer_sdna(prop, nullptr, "curfalloff");
|
||||
RNA_def_property_ui_text(prop, "Falloff Curve", "Custom light falloff curve");
|
||||
RNA_def_property_update(prop, 0, "rna_Light_update");
|
||||
|
||||
prop = RNA_def_property(srna, "linear_attenuation", PROP_FLOAT, PROP_FACTOR);
|
||||
RNA_def_property_float_sdna(prop, nullptr, "att1");
|
||||
RNA_def_property_range(prop, 0.0f, 1.0f);
|
||||
RNA_def_property_ui_text(prop, "Linear Attenuation", "Linear distance attenuation");
|
||||
RNA_def_property_update(prop, 0, "rna_Light_draw_update");
|
||||
|
||||
prop = RNA_def_property(srna, "quadratic_attenuation", PROP_FLOAT, PROP_FACTOR);
|
||||
RNA_def_property_float_sdna(prop, nullptr, "att2");
|
||||
RNA_def_property_range(prop, 0.0f, 1.0f);
|
||||
RNA_def_property_ui_text(prop, "Quadratic Attenuation", "Quadratic distance attenuation");
|
||||
RNA_def_property_update(prop, 0, "rna_Light_draw_update");
|
||||
|
||||
prop = RNA_def_property(srna, "constant_coefficient", PROP_FLOAT, PROP_NONE);
|
||||
RNA_def_property_float_sdna(prop, nullptr, "coeff_const");
|
||||
RNA_def_property_range(prop, 0.0f, FLT_MAX);
|
||||
RNA_def_property_ui_text(
|
||||
prop, "Constant Coefficient", "Constant distance attenuation coefficient");
|
||||
RNA_def_property_update(prop, 0, "rna_Light_draw_update");
|
||||
|
||||
prop = RNA_def_property(srna, "linear_coefficient", PROP_FLOAT, PROP_NONE);
|
||||
RNA_def_property_float_sdna(prop, nullptr, "coeff_lin");
|
||||
RNA_def_property_range(prop, 0.0f, FLT_MAX);
|
||||
RNA_def_property_ui_text(prop, "Linear Coefficient", "Linear distance attenuation coefficient");
|
||||
RNA_def_property_update(prop, 0, "rna_Light_draw_update");
|
||||
|
||||
prop = RNA_def_property(srna, "quadratic_coefficient", PROP_FLOAT, PROP_NONE);
|
||||
RNA_def_property_float_sdna(prop, nullptr, "coeff_quad");
|
||||
RNA_def_property_range(prop, 0.0f, FLT_MAX);
|
||||
RNA_def_property_ui_text(
|
||||
prop, "Quadratic Coefficient", "Quadratic distance attenuation coefficient");
|
||||
RNA_def_property_update(prop, 0, "rna_Light_draw_update");
|
||||
}
|
||||
|
||||
static void rna_def_light_shadow(StructRNA *srna, bool sun)
|
||||
{
|
||||
PropertyRNA *prop;
|
||||
@ -302,16 +236,6 @@ static void rna_def_light_shadow(StructRNA *srna, bool sun)
|
||||
RNA_def_property_boolean_sdna(prop, nullptr, "mode", LA_SHADOW);
|
||||
RNA_def_property_update(prop, 0, "rna_Light_draw_update");
|
||||
|
||||
prop = RNA_def_property(srna, "shadow_buffer_size", PROP_INT, PROP_NONE);
|
||||
RNA_def_property_int_sdna(prop, nullptr, "bufsize");
|
||||
RNA_def_property_range(prop, 128, 10240);
|
||||
RNA_def_property_ui_text(prop,
|
||||
"Shadow Buffer Size",
|
||||
"Resolution of the shadow buffer, higher values give crisper shadows "
|
||||
"but use more memory");
|
||||
RNA_def_property_int_funcs(prop, nullptr, "rna_Light_buffer_size_set", nullptr);
|
||||
RNA_def_property_update(prop, 0, "rna_Light_update");
|
||||
|
||||
prop = RNA_def_property(srna, "shadow_buffer_clip_start", PROP_FLOAT, PROP_DISTANCE);
|
||||
RNA_def_property_float_sdna(prop, nullptr, "clipsta");
|
||||
RNA_def_property_range(prop, 1e-6f, FLT_MAX);
|
||||
@ -328,12 +252,6 @@ static void rna_def_light_shadow(StructRNA *srna, bool sun)
|
||||
RNA_def_property_ui_text(prop, "Shadow Buffer Bias", "Bias for reducing self shadowing");
|
||||
RNA_def_property_update(prop, 0, "rna_Light_update");
|
||||
|
||||
prop = RNA_def_property(srna, "shadow_buffer_samples", PROP_INT, PROP_NONE);
|
||||
RNA_def_property_int_sdna(prop, nullptr, "samp");
|
||||
RNA_def_property_range(prop, 1, 16);
|
||||
RNA_def_property_ui_text(prop, "Samples", "Number of shadow buffer samples");
|
||||
RNA_def_property_update(prop, 0, "rna_Light_update");
|
||||
|
||||
prop = RNA_def_property(srna, "shadow_color", PROP_FLOAT, PROP_COLOR);
|
||||
RNA_def_property_float_sdna(prop, nullptr, "shdwr");
|
||||
RNA_def_property_array(prop, 3);
|
||||
@ -425,7 +343,6 @@ static void rna_def_point_light(BlenderRNA *brna)
|
||||
RNA_def_struct_ui_icon(srna, ICON_LIGHT_POINT);
|
||||
|
||||
rna_def_light_energy(srna, LA_LOCAL);
|
||||
rna_def_light_falloff(srna);
|
||||
rna_def_light_shadow(srna, false);
|
||||
}
|
||||
|
||||
@ -449,7 +366,6 @@ static void rna_def_area_light(BlenderRNA *brna)
|
||||
|
||||
rna_def_light_energy(srna, LA_AREA);
|
||||
rna_def_light_shadow(srna, false);
|
||||
rna_def_light_falloff(srna);
|
||||
|
||||
prop = RNA_def_property(srna, "shape", PROP_ENUM, PROP_NONE);
|
||||
RNA_def_property_enum_sdna(prop, nullptr, "area_shape");
|
||||
@ -496,7 +412,6 @@ static void rna_def_spot_light(BlenderRNA *brna)
|
||||
RNA_def_struct_ui_icon(srna, ICON_LIGHT_SPOT);
|
||||
|
||||
rna_def_light_energy(srna, LA_SPOT);
|
||||
rna_def_light_falloff(srna);
|
||||
rna_def_light_shadow(srna, false);
|
||||
|
||||
prop = RNA_def_property(srna, "use_square", PROP_BOOLEAN, PROP_NONE);
|
||||
|
Loading…
Reference in New Issue
Block a user