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
path: root/source
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2011-06-09 12:58:27 +0400
committerCampbell Barton <ideasman42@gmail.com>2011-06-09 12:58:27 +0400
commit09e96f6b56754f395e7d1383c8e1603fd2fc88a4 (patch)
tree836ab235ece5e5b1c9678366f204750149b2dc89 /source
parent152b06dc825c9b674b56e469af1028a3f8e58d7f (diff)
RNA properties - expose values as radians rather then degrees
- sequencer wipe angle - mesh autosmooth - bevel modifier angle - edge split angle
Diffstat (limited to 'source')
-rw-r--r--source/blender/makesrna/intern/rna_mesh.c23
-rw-r--r--source/blender/makesrna/intern/rna_modifier.c43
-rw-r--r--source/blender/makesrna/intern/rna_sequencer.c25
3 files changed, 89 insertions, 2 deletions
diff --git a/source/blender/makesrna/intern/rna_mesh.c b/source/blender/makesrna/intern/rna_mesh.c
index 2d3c3fe7a3a..479e449958b 100644
--- a/source/blender/makesrna/intern/rna_mesh.c
+++ b/source/blender/makesrna/intern/rna_mesh.c
@@ -40,6 +40,9 @@
#include "WM_types.h"
+#include "BLI_math_base.h"
+#include "BLI_math_rotation.h"
+
#ifdef RNA_RUNTIME
#include "DNA_scene_types.h"
@@ -912,6 +915,20 @@ static void rna_TextureFace_image_set(PointerRNA *ptr, PointerRNA value)
tf->tpage= (struct Image*)id;
}
+static void rna_Mesh_auto_smooth_angle_set(PointerRNA *ptr, float value)
+{
+ Mesh *me= (Mesh*)ptr->id.data;
+ value= RAD2DEGF(value);
+ CLAMP(value, 1.0f, 80.0f);
+ me->smoothresh= (int)value;
+}
+
+static float rna_Mesh_auto_smooth_angle_get(PointerRNA *ptr)
+{
+ Mesh *me= (Mesh*)ptr->id.data;
+ return DEG2RADF((float)me->smoothresh);
+}
+
static int rna_MeshFace_verts_get_length(PointerRNA *ptr, int length[RNA_MAX_ARRAY_DIMENSION])
{
MFace *face= (MFace*)ptr->data;
@@ -1913,9 +1930,15 @@ static void rna_def_mesh(BlenderRNA *brna)
RNA_def_property_boolean_sdna(prop, NULL, "flag", ME_AUTOSMOOTH);
RNA_def_property_ui_text(prop, "Auto Smooth", "Treats all set-smoothed faces with angles less than the specified angle as 'smooth' during render");
+#if 1 /* expose as radians */
+ prop= RNA_def_property(srna, "auto_smooth_angle", PROP_FLOAT, PROP_ANGLE);
+ RNA_def_property_float_funcs(prop, "rna_Mesh_auto_smooth_angle_get", "rna_Mesh_auto_smooth_angle_set", NULL);
+ RNA_def_property_ui_range(prop, DEG2RAD(1.0), DEG2RAD(80), 1.0, 1);
+#else
prop= RNA_def_property(srna, "auto_smooth_angle", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "smoothresh");
RNA_def_property_range(prop, 1, 80);
+#endif
RNA_def_property_ui_text(prop, "Auto Smooth Angle", "Defines maximum angle between face normals that 'Auto Smooth' will operate on");
prop= RNA_def_property(srna, "show_double_sided", PROP_BOOLEAN, PROP_NONE);
diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c
index 75f3f1ef238..ff277b6d9b0 100644
--- a/source/blender/makesrna/intern/rna_modifier.c
+++ b/source/blender/makesrna/intern/rna_modifier.c
@@ -578,6 +578,34 @@ static void rna_UVProjectModifier_num_projectors_set(PointerRNA *ptr, int value)
md->projectors[a]= NULL;
}
+static float rna_EdgeSplitModifier_split_angle_get(PointerRNA *ptr)
+{
+ EdgeSplitModifierData *md= (EdgeSplitModifierData*)ptr->data;
+ return DEG2RADF(md->split_angle);
+}
+
+static void rna_EdgeSplitModifier_split_angle_set(PointerRNA *ptr, float value)
+{
+ EdgeSplitModifierData *md= (EdgeSplitModifierData*)ptr->data;
+ value= RAD2DEGF(value);
+ CLAMP(value, 0.0f, 180.0f);
+ md->split_angle= (int)value;
+}
+
+static float rna_BevelModifier_angle_limit_get(PointerRNA *ptr)
+{
+ BevelModifierData *md= (BevelModifierData*)ptr->data;
+ return DEG2RADF(md->bevel_angle);
+}
+
+static void rna_BevelModifier_angle_limit_set(PointerRNA *ptr, float value)
+{
+ BevelModifierData *md= (BevelModifierData*)ptr->data;
+ value= RAD2DEGF(value);
+ CLAMP(value, 0.0f, 180.0f);
+ md->bevel_angle= (int)value;
+}
+
#else
static void rna_def_property_subdivision_common(StructRNA *srna, const char type[])
@@ -1365,10 +1393,16 @@ static void rna_def_modifier_edgesplit(BlenderRNA *brna)
RNA_def_struct_sdna(srna, "EdgeSplitModifierData");
RNA_def_struct_ui_icon(srna, ICON_MOD_EDGESPLIT);
- // XXX, convert to radians.
+#if 1 /* expose as radians */
+ prop= RNA_def_property(srna, "split_angle", PROP_FLOAT, PROP_ANGLE);
+ RNA_def_property_float_funcs(prop, "rna_EdgeSplitModifier_split_angle_get", "rna_EdgeSplitModifier_split_angle_set", NULL);
+ RNA_def_property_range(prop, 0, DEG2RAD(180));
+ RNA_def_property_ui_range(prop, 0, DEG2RAD(180), 100, 2);
+#else
prop= RNA_def_property(srna, "split_angle", PROP_FLOAT, PROP_NONE);
RNA_def_property_range(prop, 0, 180);
RNA_def_property_ui_range(prop, 0, 180, 100, 2);
+#endif
RNA_def_property_ui_text(prop, "Split Angle", "Angle above which to split edges");
RNA_def_property_update(prop, 0, "rna_Modifier_update");
@@ -1965,10 +1999,17 @@ static void rna_def_modifier_bevel(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Edge Weight Method", "What edge weight to use for weighting a vertex");
RNA_def_property_update(prop, 0, "rna_Modifier_update");
+#if 1 /* expose as radians */
+ prop= RNA_def_property(srna, "angle_limit", PROP_FLOAT, PROP_ANGLE);
+ RNA_def_property_float_funcs(prop, "rna_BevelModifier_angle_limit_get", "rna_BevelModifier_angle_limit_set", NULL);
+ RNA_def_property_range(prop, 0, DEG2RAD(180));
+ RNA_def_property_ui_range(prop, 0, DEG2RAD(180), 100, 2);
+#else
prop= RNA_def_property(srna, "angle_limit", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "bevel_angle");
RNA_def_property_range(prop, 0, 180);
RNA_def_property_ui_range(prop, 0, 180, 100, 2);
+#endif
RNA_def_property_ui_text(prop, "Angle", "Angle above which to bevel edges");
RNA_def_property_update(prop, 0, "rna_Modifier_update");
}
diff --git a/source/blender/makesrna/intern/rna_sequencer.c b/source/blender/makesrna/intern/rna_sequencer.c
index 4171189d928..8c4e4d9e736 100644
--- a/source/blender/makesrna/intern/rna_sequencer.c
+++ b/source/blender/makesrna/intern/rna_sequencer.c
@@ -680,6 +680,23 @@ static void rna_SequenceEditor_overlay_frame_set(PointerRNA *ptr, int value)
ed->over_ofs= value;
}
+
+static void rna_WipeSequence_angle_set(PointerRNA *ptr, float value)
+{
+ Sequence *seq= (Sequence *)(ptr->data);
+ value= RAD2DEGF(value);
+ CLAMP(value, -90.0f, 90.0f);
+ ((WipeVars *)seq->effectdata)->angle= value;
+}
+
+static float rna_WipeSequence_angle_get(PointerRNA *ptr)
+{
+ Sequence *seq= (Sequence *)(ptr->data);
+
+ return DEG2RADF(((WipeVars *)seq->effectdata)->angle);
+}
+
+
#else
static void rna_def_strip_element(BlenderRNA *brna)
@@ -1460,10 +1477,16 @@ static void rna_def_wipe(BlenderRNA *brna)
RNA_def_property_range(prop, 0.0f, 1.0f);
RNA_def_property_ui_text(prop, "Blur Width", "Width of the blur edge, in percentage relative to the image size");
RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
-
+
+#if 1 /* expose as radians */
+ prop= RNA_def_property(srna, "angle", PROP_FLOAT, PROP_ANGLE);
+ RNA_def_property_float_funcs(prop, "rna_WipeSequence_angle_get", "rna_WipeSequence_angle_set", NULL);
+ RNA_def_property_range(prop, DEG2RAD(-90.0f), DEG2RAD(90.0f));
+#else
prop= RNA_def_property(srna, "angle", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "angle");
RNA_def_property_range(prop, -90.0f, 90.0f);
+#endif
RNA_def_property_ui_text(prop, "Angle", "Edge angle");
RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");