[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [52831] branches/soc-2008-mxcurioni: All angle properties were switched from degrees to radians ( using PROP_ANGLE
Tamito Kajiyama
rd6t-kjym at asahi-net.or.jp
Mon Dec 10 00:19:49 CET 2012
Revision: 52831
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=52831
Author: kjym3
Date: 2012-12-09 23:19:46 +0000 (Sun, 09 Dec 2012)
Log Message:
-----------
All angle properties were switched from degrees to radians (using PROP_ANGLE
RNA subtype), since Freestyle internally use angles in radians.
A patch set by Bastien Montagne (many thanks!)
NOTICE FOR BRANCH USERS:
This commit may break line drawing settings of already saved Freestyle files.
All angles are now treated as radians instead of degrees, so collections of
angle values might be necessary in order to recover previous visual results.
Affected properties are:
- Crease Angle in the edge detection options
- Min 2D Angle in the 'Splitting' section of a line style
- Max 2D Angle in the 'Splitting' section of a line style
- 'orientation' parameter of the Calligraphy thickness modifier
- 'angle' parameter of the PerlinNoise1D geometry modifier
- 'angle' parameter of the PerlinNoise2D geometry modifier
- 'angle' parameter of the 2DTransform geometry modifier
Modified Paths:
--------------
branches/soc-2008-mxcurioni/release/datafiles/startup.blend
branches/soc-2008-mxcurioni/release/scripts/freestyle/style_modules/parameter_editor.py
branches/soc-2008-mxcurioni/source/blender/blenkernel/intern/linestyle.c
branches/soc-2008-mxcurioni/source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp
branches/soc-2008-mxcurioni/source/blender/makesdna/DNA_freestyle_types.h
branches/soc-2008-mxcurioni/source/blender/makesdna/DNA_linestyle_types.h
branches/soc-2008-mxcurioni/source/blender/makesrna/intern/rna_linestyle.c
branches/soc-2008-mxcurioni/source/blender/makesrna/intern/rna_scene.c
Modified: branches/soc-2008-mxcurioni/release/datafiles/startup.blend
===================================================================
(Binary files differ)
Modified: branches/soc-2008-mxcurioni/release/scripts/freestyle/style_modules/parameter_editor.py
===================================================================
--- branches/soc-2008-mxcurioni/release/scripts/freestyle/style_modules/parameter_editor.py 2012-12-09 17:42:36 UTC (rev 52830)
+++ branches/soc-2008-mxcurioni/release/scripts/freestyle/style_modules/parameter_editor.py 2012-12-09 23:19:46 UTC (rev 52831)
@@ -480,8 +480,7 @@
blend, influence, orientation, min_thickness, max_thickness):
ThicknessBlenderMixIn.__init__(self, thickness_position, thickness_ratio)
ScalarBlendModifier.__init__(self, blend, influence)
- rad = orientation / 180.0 * math.pi
- self.__orientation = mathutils.Vector((math.cos(rad), math.sin(rad)))
+ self.__orientation = mathutils.Vector((math.cos(orientation), math.sin(orientation)))
self.__min_thickness = min_thickness
self.__max_thickness = max_thickness
def shade(self, stroke):
@@ -533,14 +532,13 @@
stroke.UpdateLength()
class PerlinNoise1DShader(StrokeShader):
- def __init__(self, freq = 10, amp = 10, oct = 4, angle = 45, seed = -1):
+ def __init__(self, freq = 10, amp = 10, oct = 4, angle = math.radians(45), seed = -1):
StrokeShader.__init__(self)
self.__noise = Noise(seed)
self.__freq = freq
self.__amp = amp
self.__oct = oct
- theta = pi * angle / 180.0
- self.__dir = Vector([cos(theta), sin(theta)])
+ self.__dir = Vector([cos(angle), sin(angle)])
def getName(self):
return "PerlinNoise1DShader"
def shade(self, stroke):
@@ -554,14 +552,13 @@
stroke.UpdateLength()
class PerlinNoise2DShader(StrokeShader):
- def __init__(self, freq = 10, amp = 10, oct = 4, angle = 45, seed = -1):
+ def __init__(self, freq = 10, amp = 10, oct = 4, angle = math.radians(45), seed = -1):
StrokeShader.__init__(self)
self.__noise = Noise(seed)
self.__freq = freq
self.__amp = amp
self.__oct = oct
- theta = pi * angle / 180.0
- self.__dir = Vector([cos(theta), sin(theta)])
+ self.__dir = Vector([cos(angle), sin(angle)])
def getName(self):
return "PerlinNoise2DShader"
def shade(self, stroke):
@@ -647,8 +644,8 @@
elif self.__pivot == "ABSOLUTE":
pivot = Vector([self.__pivot_x, self.__pivot_y])
# apply scaling and rotation operations
- cos_theta = math.cos(math.pi * self.__angle / 180.0)
- sin_theta = math.sin(math.pi * self.__angle / 180.0)
+ cos_theta = math.cos(self.__angle)
+ sin_theta = math.sin(self.__angle)
it = stroke.strokeVerticesBegin()
while not it.isEnd():
v = it.getObject()
@@ -883,7 +880,7 @@
class AngleLargerThanBP1D(BinaryPredicate1D):
def __init__(self, angle):
BinaryPredicate1D.__init__(self)
- self._angle = math.pi * angle / 180.0
+ self._angle = angle
def getName(self):
return "AngleLargerThanBP1D"
def __call__(self, i1, i2):
Modified: branches/soc-2008-mxcurioni/source/blender/blenkernel/intern/linestyle.c
===================================================================
--- branches/soc-2008-mxcurioni/source/blender/blenkernel/intern/linestyle.c 2012-12-09 17:42:36 UTC (rev 52830)
+++ branches/soc-2008-mxcurioni/source/blender/blenkernel/intern/linestyle.c 2012-12-09 23:19:46 UTC (rev 52831)
@@ -47,6 +47,7 @@
#include "BKE_animsys.h"
#include "BLI_blenlib.h"
+#include "BLI_math.h"
static const char *modifier_name[LS_MODIFIER_NUM] = {
NULL,
@@ -506,7 +507,7 @@
case LS_MODIFIER_CALLIGRAPHY:
((LineStyleThicknessModifier_Calligraphy *)m)->min_thickness = 1.0f;
((LineStyleThicknessModifier_Calligraphy *)m)->max_thickness = 10.0f;
- ((LineStyleThicknessModifier_Calligraphy *)m)->orientation = 60.0f;
+ ((LineStyleThicknessModifier_Calligraphy *)m)->orientation = DEG2RADF(60.0f);
break;
default:
return NULL; /* unknown modifier type */
@@ -683,13 +684,13 @@
((LineStyleGeometryModifier_PerlinNoise1D *)m)->frequency = 10.0;
((LineStyleGeometryModifier_PerlinNoise1D *)m)->amplitude = 10.0;
((LineStyleGeometryModifier_PerlinNoise1D *)m)->octaves = 4;
- ((LineStyleGeometryModifier_PerlinNoise1D *)m)->angle = 45.0;
+ ((LineStyleGeometryModifier_PerlinNoise1D *)m)->angle = DEG2RADF(45.0f);
break;
case LS_MODIFIER_PERLIN_NOISE_2D:
((LineStyleGeometryModifier_PerlinNoise2D *)m)->frequency = 10.0;
((LineStyleGeometryModifier_PerlinNoise2D *)m)->amplitude = 10.0;
((LineStyleGeometryModifier_PerlinNoise2D *)m)->octaves = 4;
- ((LineStyleGeometryModifier_PerlinNoise2D *)m)->angle = 45.0;
+ ((LineStyleGeometryModifier_PerlinNoise2D *)m)->angle = DEG2RADF(45.0f);
break;
case LS_MODIFIER_BACKBONE_STRETCHER:
((LineStyleGeometryModifier_BackboneStretcher *)m)->backbone_length = 10.0;
@@ -721,7 +722,7 @@
((LineStyleGeometryModifier_2DTransform *)m)->pivot = LS_MODIFIER_2D_TRANSFORM_PIVOT_CENTER;
((LineStyleGeometryModifier_2DTransform *)m)->scale_x = 1.f;
((LineStyleGeometryModifier_2DTransform *)m)->scale_y = 1.f;
- ((LineStyleGeometryModifier_2DTransform *)m)->angle = 0.f;
+ ((LineStyleGeometryModifier_2DTransform *)m)->angle = DEG2RADF(0.0f);
((LineStyleGeometryModifier_2DTransform *)m)->pivot_u = 0.5f;
((LineStyleGeometryModifier_2DTransform *)m)->pivot_x = 0.f;
((LineStyleGeometryModifier_2DTransform *)m)->pivot_y = 0.f;
Modified: branches/soc-2008-mxcurioni/source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp
===================================================================
--- branches/soc-2008-mxcurioni/source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp 2012-12-09 17:42:36 UTC (rev 52830)
+++ branches/soc-2008-mxcurioni/source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp 2012-12-09 23:19:46 UTC (rev 52831)
@@ -351,7 +351,7 @@
controller->setSuggestiveContourKrDerivativeEpsilon( DEFAULT_DKR_EPSILON );
}
controller->setFaceSmoothness( (config->flags & FREESTYLE_FACE_SMOOTHNESS_FLAG) ? true : false);
- controller->setCreaseAngle( config->crease_angle );
+ controller->setCreaseAngle( RAD2DEGF(config->crease_angle) );
controller->setVisibilityAlgo( (config->flags & FREESTYLE_CULLING) ?
FREESTYLE_ALGO_CULLED_ADAPTIVE_CUMULATIVE : FREESTYLE_ALGO_ADAPTIVE_CUMULATIVE );
Modified: branches/soc-2008-mxcurioni/source/blender/makesdna/DNA_freestyle_types.h
===================================================================
--- branches/soc-2008-mxcurioni/source/blender/makesdna/DNA_freestyle_types.h 2012-12-09 17:42:36 UTC (rev 52830)
+++ branches/soc-2008-mxcurioni/source/blender/makesdna/DNA_freestyle_types.h 2012-12-09 23:19:46 UTC (rev 52831)
@@ -125,7 +125,7 @@
int flags; /* suggestive contours, ridges/valleys, material boundaries */
float sphere_radius;
float dkr_epsilon;
- float crease_angle;
+ float crease_angle; /* in radians! */
ListBase linesets;
Modified: branches/soc-2008-mxcurioni/source/blender/makesdna/DNA_linestyle_types.h
===================================================================
--- branches/soc-2008-mxcurioni/source/blender/makesdna/DNA_linestyle_types.h 2012-12-09 17:42:36 UTC (rev 52830)
+++ branches/soc-2008-mxcurioni/source/blender/makesdna/DNA_linestyle_types.h 2012-12-09 23:19:46 UTC (rev 52831)
@@ -267,7 +267,8 @@
typedef struct LineStyleGeometryModifier_PerlinNoise1D {
struct LineStyleModifier modifier;
- float frequency, amplitude, angle;
+ float frequency, amplitude;
+ float angle; /* in radians! */
unsigned int octaves;
int seed;
int pad1;
@@ -277,7 +278,8 @@
typedef struct LineStyleGeometryModifier_PerlinNoise2D {
struct LineStyleModifier modifier;
- float frequency, amplitude, angle;
+ float frequency, amplitude;
+ float angle; /* in radians! */
unsigned int octaves;
int seed;
int pad1;
@@ -353,7 +355,7 @@
int pivot;
float scale_x, scale_y;
- float angle;
+ float angle; /* in radians! */
float pivot_u;
float pivot_x, pivot_y;
int pad;
@@ -366,7 +368,7 @@
struct LineStyleModifier modifier;
float min_thickness, max_thickness;
- float orientation;
+ float orientation; /* in radians! */
int pad;
} LineStyleThicknessModifier_Calligraphy;
@@ -419,7 +421,7 @@
int chaining;
unsigned int rounds;
float split_length;
- float min_angle, max_angle; /* for splitting */
+ float min_angle, max_angle; /* in radians, for splitting */
float min_length, max_length;
unsigned short split_dash1, split_gap1;
unsigned short split_dash2, split_gap2;
Modified: branches/soc-2008-mxcurioni/source/blender/makesrna/intern/rna_linestyle.c
===================================================================
--- branches/soc-2008-mxcurioni/source/blender/makesrna/intern/rna_linestyle.c 2012-12-09 17:42:36 UTC (rev 52830)
+++ branches/soc-2008-mxcurioni/source/blender/makesrna/intern/rna_linestyle.c 2012-12-09 23:19:46 UTC (rev 52831)
@@ -565,7 +565,7 @@
RNA_def_struct_ui_text(srna, "Calligraphy", "Change line thickness so that stroke looks like made with a calligraphic pen");
rna_def_thickness_modifier(srna);
- prop= RNA_def_property(srna, "orientation", PROP_FLOAT, PROP_NONE);
+ prop= RNA_def_property(srna, "orientation", PROP_FLOAT, PROP_ANGLE);
RNA_def_property_float_sdna(prop, NULL, "orientation");
RNA_def_property_ui_text(prop, "Orientation", "Angle of the main direction");
RNA_def_property_update(prop, NC_LINESTYLE, NULL);
@@ -675,9 +675,9 @@
RNA_def_property_ui_text(prop, "Octaves", "Number of octaves (i.e., the amount of detail of the Perlin noise)");
RNA_def_property_update(prop, NC_LINESTYLE, NULL);
- prop= RNA_def_property(srna, "angle", PROP_FLOAT, PROP_NONE);
+ prop= RNA_def_property(srna, "angle", PROP_FLOAT, PROP_ANGLE);
RNA_def_property_float_sdna(prop, NULL, "angle");
- RNA_def_property_ui_text(prop, "Angle", "Displacement direction in degrees");
+ RNA_def_property_ui_text(prop, "Angle", "Displacement direction");
RNA_def_property_update(prop, NC_LINESTYLE, NULL);
prop= RNA_def_property(srna, "seed", PROP_INT, PROP_NONE);
@@ -704,9 +704,9 @@
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list