access spot size in radians from python.
This commit is contained in:
@@ -169,8 +169,8 @@ def write_pov(filename, scene=None, info_callback=None):
|
|||||||
file.write('\tspotlight\n')
|
file.write('\tspotlight\n')
|
||||||
|
|
||||||
# Falloff is the main radius from the centre line
|
# Falloff is the main radius from the centre line
|
||||||
file.write('\tfalloff %.2f\n' % (lamp.spot_size / 2.0)) # 1 TO 179 FOR BOTH
|
file.write('\tfalloff %.2f\n' % (degrees(lamp.spot_size) / 2.0)) # 1 TO 179 FOR BOTH
|
||||||
file.write('\tradius %.6f\n' % ((lamp.spot_size / 2.0) * (1.0 - lamp.spot_blend)))
|
file.write('\tradius %.6f\n' % ((degrees(lamp.spot_size) / 2.0) * (1.0 - lamp.spot_blend)))
|
||||||
|
|
||||||
# Blender does not have a tightness equivilent, 0 is most like blender default.
|
# Blender does not have a tightness equivilent, 0 is most like blender default.
|
||||||
file.write('\ttightness 0\n') # 0:10f
|
file.write('\ttightness 0\n') # 0:10f
|
||||||
|
|||||||
@@ -1142,7 +1142,7 @@ def write(filename, batch_objects = None, \
|
|||||||
file.write('\n\t\t\tProperty: "Color", "Color", "A+",1,1,1')
|
file.write('\n\t\t\tProperty: "Color", "Color", "A+",1,1,1')
|
||||||
file.write('\n\t\t\tProperty: "Intensity", "Intensity", "A+",%.2f' % (min(light.energy*100, 200))) # clamp below 200
|
file.write('\n\t\t\tProperty: "Intensity", "Intensity", "A+",%.2f' % (min(light.energy*100, 200))) # clamp below 200
|
||||||
if light.type == 'SPOT':
|
if light.type == 'SPOT':
|
||||||
file.write('\n\t\t\tProperty: "Cone angle", "Cone angle", "A+",%.2f' % (light.spot_size * scale))
|
file.write('\n\t\t\tProperty: "Cone angle", "Cone angle", "A+",%.2f' % math.degrees(light.spot_size))
|
||||||
# file.write('\n\t\t\tProperty: "Cone angle", "Cone angle", "A+",%.2f' % (light.spotSize * scale))
|
# file.write('\n\t\t\tProperty: "Cone angle", "Cone angle", "A+",%.2f' % (light.spotSize * scale))
|
||||||
file.write('\n\t\t\tProperty: "Fog", "Fog", "A+",50')
|
file.write('\n\t\t\tProperty: "Fog", "Fog", "A+",50')
|
||||||
file.write('\n\t\t\tProperty: "Color", "Color", "A",%.2f,%.2f,%.2f' % tuple(light.color))
|
file.write('\n\t\t\tProperty: "Color", "Color", "A",%.2f,%.2f,%.2f' % tuple(light.color))
|
||||||
|
|||||||
@@ -291,7 +291,7 @@ class x3d_class:
|
|||||||
|
|
||||||
# compute cutoff and beamwidth
|
# compute cutoff and beamwidth
|
||||||
intensity=min(lamp.energy/1.75,1.0)
|
intensity=min(lamp.energy/1.75,1.0)
|
||||||
beamWidth=((lamp.spot_size*math.pi)/180.0)*.37;
|
beamWidth=lamp.spot_size * 0.37;
|
||||||
# beamWidth=((lamp.spotSize*math.pi)/180.0)*.37;
|
# beamWidth=((lamp.spotSize*math.pi)/180.0)*.37;
|
||||||
cutOffAngle=beamWidth*1.3
|
cutOffAngle=beamWidth*1.3
|
||||||
|
|
||||||
|
|||||||
@@ -33,6 +33,8 @@
|
|||||||
#include "DNA_material_types.h"
|
#include "DNA_material_types.h"
|
||||||
#include "DNA_texture_types.h"
|
#include "DNA_texture_types.h"
|
||||||
|
|
||||||
|
#include "BLI_math_base.h"
|
||||||
|
|
||||||
#ifdef RNA_RUNTIME
|
#ifdef RNA_RUNTIME
|
||||||
|
|
||||||
#include "MEM_guardedalloc.h"
|
#include "MEM_guardedalloc.h"
|
||||||
@@ -124,6 +126,20 @@ static void rna_Lamp_sky_update(Main *bmain, Scene *scene, PointerRNA *ptr)
|
|||||||
WM_main_add_notifier(NC_LAMP|ND_SKY, la);
|
WM_main_add_notifier(NC_LAMP|ND_SKY, la);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* only for rad/deg conversion! can remove later */
|
||||||
|
static float rna_Lamp_spot_size_get(PointerRNA *ptr)
|
||||||
|
{
|
||||||
|
Lamp *la= ptr->id.data;
|
||||||
|
return la->spotsize * (M_PI / 180.0);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void rna_Lamp_spot_size_set(PointerRNA *ptr, float value)
|
||||||
|
{
|
||||||
|
Lamp *la= ptr->id.data;
|
||||||
|
la->spotsize= value * (180.0 / M_PI);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
static void rna_def_lamp_mtex(BlenderRNA *brna)
|
static void rna_def_lamp_mtex(BlenderRNA *brna)
|
||||||
@@ -640,10 +656,11 @@ static void rna_def_spot_lamp(BlenderRNA *brna)
|
|||||||
RNA_def_property_ui_text(prop, "Spot Blend", "The softness of the spotlight edge.");
|
RNA_def_property_ui_text(prop, "Spot Blend", "The softness of the spotlight edge.");
|
||||||
RNA_def_property_update(prop, 0, "rna_Lamp_draw_update");
|
RNA_def_property_update(prop, 0, "rna_Lamp_draw_update");
|
||||||
|
|
||||||
prop= RNA_def_property(srna, "spot_size", PROP_FLOAT, PROP_NONE);
|
prop= RNA_def_property(srna, "spot_size", PROP_FLOAT, PROP_ANGLE);
|
||||||
RNA_def_property_float_sdna(prop, NULL, "spotsize");
|
// RNA_def_property_float_sdna(prop, NULL, "spotsize");
|
||||||
RNA_def_property_range(prop, 1.0f ,180.0f);
|
RNA_def_property_range(prop, M_PI/180.0f, M_PI);
|
||||||
RNA_def_property_ui_text(prop, "Spot Size", "Angle of the spotlight beam in degrees.");
|
RNA_def_property_ui_text(prop, "Spot Size", "Angle of the spotlight beam in degrees.");
|
||||||
|
RNA_def_property_float_funcs(prop, "rna_Lamp_spot_size_get", "rna_Lamp_spot_size_set", NULL); /* only for deg/rad conversion */
|
||||||
RNA_def_property_update(prop, 0, "rna_Lamp_draw_update");
|
RNA_def_property_update(prop, 0, "rna_Lamp_draw_update");
|
||||||
|
|
||||||
prop= RNA_def_property(srna, "show_cone", PROP_BOOLEAN, PROP_NONE);
|
prop= RNA_def_property(srna, "show_cone", PROP_BOOLEAN, PROP_NONE);
|
||||||
|
|||||||
Reference in New Issue
Block a user