Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2010-02-04 22:24:20 +0300
committerCampbell Barton <ideasman42@gmail.com>2010-02-04 22:24:20 +0300
commitfe5b216030d7cf376f007ba797d72d04c43d65bd (patch)
treed24f9ef03d34f2141bd49ae1d38862eeba26885e /source/blender/makesrna/intern/rna_lamp.c
parenteedf5cbe89826faa728cf90d935cc696dd79b045 (diff)
access spot size in radians from python.
Diffstat (limited to 'source/blender/makesrna/intern/rna_lamp.c')
-rw-r--r--source/blender/makesrna/intern/rna_lamp.c23
1 files changed, 20 insertions, 3 deletions
diff --git a/source/blender/makesrna/intern/rna_lamp.c b/source/blender/makesrna/intern/rna_lamp.c
index 56913d6275c..e3780b1b66b 100644
--- a/source/blender/makesrna/intern/rna_lamp.c
+++ b/source/blender/makesrna/intern/rna_lamp.c
@@ -33,6 +33,8 @@
#include "DNA_material_types.h"
#include "DNA_texture_types.h"
+#include "BLI_math_base.h"
+
#ifdef RNA_RUNTIME
#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);
}
+/* 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
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_update(prop, 0, "rna_Lamp_draw_update");
- prop= RNA_def_property(srna, "spot_size", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "spotsize");
- RNA_def_property_range(prop, 1.0f ,180.0f);
+ prop= RNA_def_property(srna, "spot_size", PROP_FLOAT, PROP_ANGLE);
+ // RNA_def_property_float_sdna(prop, NULL, "spotsize");
+ 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_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");
prop= RNA_def_property(srna, "show_cone", PROP_BOOLEAN, PROP_NONE);