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>2011-10-17 06:20:53 +0400
committerCampbell Barton <ideasman42@gmail.com>2011-10-17 06:20:53 +0400
commit67c15da97de7644fc4deb3ab1b03c3db22f1f647 (patch)
tree2381852d6f5957db9c20c379cd3559df79e24ac4
parent8fae0c6d7e0d24bfa6c12e2121c5fa7a62440141 (diff)
docs / clenup (no functional code changes)
- added API examples for mathutils.Color/Euler/Quaternion/Matrix. - corrected own bad spelling matricies --> matrices. - minor pep8 edits. - update CMake ignore file list.
-rw-r--r--build_files/cmake/cmake_consistency_check_config.py8
-rw-r--r--doc/python_api/examples/mathutils.Color.py30
-rw-r--r--doc/python_api/examples/mathutils.Euler.py31
-rw-r--r--doc/python_api/examples/mathutils.Matrix.py27
-rw-r--r--doc/python_api/examples/mathutils.Quaternion.py22
-rw-r--r--doc/python_api/rst/bge.logic.rst2
-rw-r--r--release/scripts/startup/bl_ui/properties_particle.py3
-rw-r--r--source/blender/blenkernel/BKE_paint.h2
-rw-r--r--source/blender/blenkernel/intern/constraint.c2
-rw-r--r--source/blender/editors/util/crazyspace.c2
-rw-r--r--source/blender/python/mathutils/mathutils_Matrix.c6
11 files changed, 123 insertions, 12 deletions
diff --git a/build_files/cmake/cmake_consistency_check_config.py b/build_files/cmake/cmake_consistency_check_config.py
index 60a46d3a1dd..86f51273ff5 100644
--- a/build_files/cmake/cmake_consistency_check_config.py
+++ b/build_files/cmake/cmake_consistency_check_config.py
@@ -27,6 +27,10 @@ IGNORE = (
"extern/eltopo/common/openglutils.cpp",
"extern/eltopo/eltopo3d/broadphase_blenderbvh.cpp",
"source/blender/imbuf/intern/imbuf_cocoa.m",
+ "extern/recastnavigation/Recast/Source/RecastLog.cpp",
+ "extern/recastnavigation/Recast/Source/RecastTimer.cpp",
+ "entern/audaspace/SRC/AUD_SRCResampleFactory.cpp",
+ "entern/audaspace/SRC/AUD_SRCResampleReader.cpp",
"extern/bullet2/src/BulletCollision/CollisionDispatch/btBox2dBox2dCollisionAlgorithm.h",
"extern/bullet2/src/BulletCollision/CollisionDispatch/btConvex2dConvex2dAlgorithm.h",
@@ -41,6 +45,10 @@ IGNORE = (
"extern/eltopo/common/meshes/TriangleIndex.hpp",
"extern/eltopo/common/meshes/meshloader.h",
"extern/eltopo/eltopo3d/broadphase_blenderbvh.h"
+ "extern/recastnavigation/Recast/Include/RecastLog.h",
+ "extern/recastnavigation/Recast/Include/RecastTimer.h",
+ "intern/audaspace/SRC/AUD_SRCResampleFactory.h",
+ "intern/audaspace/SRC/AUD_SRCResampleReader.h",
)
UTF8_CHECK = True
diff --git a/doc/python_api/examples/mathutils.Color.py b/doc/python_api/examples/mathutils.Color.py
new file mode 100644
index 00000000000..a55f1195bf6
--- /dev/null
+++ b/doc/python_api/examples/mathutils.Color.py
@@ -0,0 +1,30 @@
+import mathutils
+
+# color values are represented as RGB values from 0 - 1, this is blue
+col = mathutils.Color((0.0, 0.0, 1.0))
+
+# as well as r/g/b attribute access you can adjust them by h/s/v
+col.s *= 0.5
+
+# you can access its components by attribute or index
+print("Color R:", col.r)
+print("Color G:", col[1])
+print("Color B:", col[-1])
+print("Color HSV: %.2f, %.2f, %.2f", col[:])
+
+
+# components of an existing color can be set
+col[:] = 0.0, 0.5, 1.0
+
+# components of an existing color can use slice notation to get a tuple
+print("Values: %f, %f, %f" % col[:])
+
+# colors can be added and subtracted
+col += mathutils.Color((0.25, 0.0, 0.0))
+
+# Color can be multiplied, in this example color is scaled to 0-255
+# can printed as integers
+print("Color: %d, %d, %d" % (col * 255.0)[:])
+
+# This example prints the color as hexidecimal
+print("Hexidecimal: %.2x%.2x%.2x" % (col * 255.0)[:])
diff --git a/doc/python_api/examples/mathutils.Euler.py b/doc/python_api/examples/mathutils.Euler.py
index bc7702c1d53..3f87cc0ab04 100644
--- a/doc/python_api/examples/mathutils.Euler.py
+++ b/doc/python_api/examples/mathutils.Euler.py
@@ -1,3 +1,32 @@
import mathutils
+import math
-# todo
+# create a new euler with default axis rotation order
+eul = mathutils.Euler((0.0, math.radians(45.0), 0.0), 'XYZ')
+
+# rotate the euler
+eul.rotate_axis(math.radians(10.0), 'Z')
+
+# you can access its components by attribute or index
+print("Euler X", eul.x)
+print("Euler Y", eul[1])
+print("Euler Z", eul[-1])
+
+# components of an existing euler can be set
+eul[:] = 1.0, 2.0, 3.0
+
+# components of an existing euler can use slice notation to get a tuple
+print("Values: %f, %f, %f" % eul[:])
+
+# the order can be set at any time too
+eul.order = 'ZYX'
+
+# eulers can be used to rotate vectors
+vec = mathutils.Vector((0.0, 0.0, 1.0))
+vec.rotate(eul)
+
+# often its useful to convert the euler into a matrix so it can be used as
+# transformations with more flexibility
+mat_rot = eul.to_matrix()
+mat_loc = mathutils.Matrix.Translation((2.0, 3.0, 4.0))
+mat = mat_loc * mat_rot.to_4x4()
diff --git a/doc/python_api/examples/mathutils.Matrix.py b/doc/python_api/examples/mathutils.Matrix.py
index bc7702c1d53..079070a5ec7 100644
--- a/doc/python_api/examples/mathutils.Matrix.py
+++ b/doc/python_api/examples/mathutils.Matrix.py
@@ -1,3 +1,28 @@
import mathutils
+import math
-# todo
+# create a location matrix
+mat_loc = mathutils.Matrix.Translation((2.0, 3.0, 4.0))
+
+# create an identitiy matrix
+mat_sca = mathutils.Matrix.Scale(0.5, 4, (0.0, 0.0, 1.0))
+
+# create a rotation matrix
+mat_rot = mathutils.Matrix.Rotation(math.radians(45.0), 4, 'X')
+
+# combine transformations
+mat_out = mat_loc * mat_rot * mat_sca
+print(mat_out)
+
+# extract components back out of the matrix
+loc, rot, sca = mat_out.decompose()
+print(loc, rot, sca)
+
+# it can also be useful to access components of a matrix directly
+mat = mathutils.Matrix()
+mat[0][0], mat[1][0], mat[2][0] = 0.0, 1.0, 2.0
+
+mat[0][0:3] = 0.0, 1.0, 2.0
+
+# each item in a matrix is a vector so vector utility functions can be used
+mat[0].xyz = 0.0, 1.0, 2.0
diff --git a/doc/python_api/examples/mathutils.Quaternion.py b/doc/python_api/examples/mathutils.Quaternion.py
index bc7702c1d53..d8c696e6ba6 100644
--- a/doc/python_api/examples/mathutils.Quaternion.py
+++ b/doc/python_api/examples/mathutils.Quaternion.py
@@ -1,3 +1,23 @@
import mathutils
+import math
-# todo
+# a new rotation 90 degrees about the Y axis
+quat_a = mathutils.Quaternion((0.7071068, 0.0, 0.7071068, 0.0))
+
+# passing values to Quaternion's directly can be confusing so axis, angle
+# is supported for initializing too
+quat_b = mathutils.Quaternion((0.0, 1.0, 0.0), math.radians(90.0))
+
+print("Check quaternions match", quat_a == quat_b)
+
+# like matrices, quaternions can be multiplied to accumulate rotational values
+quat_a = mathutils.Quaternion((0.0, 1.0, 0.0), math.radians(90.0))
+quat_b = mathutils.Quaternion((0.0, 0.0, 1.0), math.radians(45.0))
+quat_out = quat_a * quat_b
+
+# print the quat, euler degrees for mear mortals and (axis, angle)
+print("Final Rotation:")
+print(quat_out)
+print("%.2f, %.2f, %.2f" % tuple(math.degrees(a) for a in quat_out.to_euler()))
+print("(%.2f, %.2f, %.2f), %.2f" % (quat_out.axis[:] +
+ (math.degrees(quat_out.angle), )))
diff --git a/doc/python_api/rst/bge.logic.rst b/doc/python_api/rst/bge.logic.rst
index 798491b4710..82e69965840 100644
--- a/doc/python_api/rst/bge.logic.rst
+++ b/doc/python_api/rst/bge.logic.rst
@@ -106,7 +106,7 @@ There are also methods to access the current :class:`bge.types.KX_Scene`
Matricies as used by the game engine are **row major**
``matrix[row][col] = float``
-:class:`bge.types.KX_Camera` has some examples using matricies.
+:class:`bge.types.KX_Camera` has some examples using matrices.
*********
Variables
diff --git a/release/scripts/startup/bl_ui/properties_particle.py b/release/scripts/startup/bl_ui/properties_particle.py
index d24aef56a8b..0e7fccae8df 100644
--- a/release/scripts/startup/bl_ui/properties_particle.py
+++ b/release/scripts/startup/bl_ui/properties_particle.py
@@ -404,7 +404,7 @@ class PARTICLE_PT_rotation(ParticleButtonsPanel, Panel):
part = context.space_data.pin_id
layout.enabled = particle_panel_enabled(context, psys)
-
+
layout.prop(part, "use_dynamic_rotation")
if part.use_dynamic_rotation:
@@ -433,7 +433,6 @@ class PARTICLE_PT_rotation(ParticleButtonsPanel, Panel):
subsub = sub.column()
subsub.active = part.angular_velocity_mode != 'NONE'
subsub.prop(part, "angular_velocity_factor", text="")
-
class PARTICLE_PT_physics(ParticleButtonsPanel, Panel):
diff --git a/source/blender/blenkernel/BKE_paint.h b/source/blender/blenkernel/BKE_paint.h
index f8463bab55f..89733f1623c 100644
--- a/source/blender/blenkernel/BKE_paint.h
+++ b/source/blender/blenkernel/BKE_paint.h
@@ -84,7 +84,7 @@ typedef struct SculptSession {
int modifiers_active; /* object is deformed with some modifiers */
float (*orig_cos)[3]; /* coords of undeformed mesh */
float (*deform_cos)[3]; /* coords of deformed mesh but without stroke displacement */
- float (*deform_imats)[3][3]; /* crazyspace deformation matricies */
+ float (*deform_imats)[3][3]; /* crazyspace deformation matrices */
/* Partial redraw */
int partial_redraw;
diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c
index 08a3eab55e6..6dbea2c9ab6 100644
--- a/source/blender/blenkernel/intern/constraint.c
+++ b/source/blender/blenkernel/intern/constraint.c
@@ -4351,7 +4351,7 @@ short proxylocked_constraints_owner (Object *ob, bPoseChannel *pchan)
* constraints either had one or no targets. It used to be called during the main constraint solving
* loop, but is now only used for the remaining cases for a few constraints.
*
- * None of the actual calculations of the matricies should be done here! Also, this function is
+ * None of the actual calculations of the matrices should be done here! Also, this function is
* not to be used by any new constraints, particularly any that have multiple targets.
*/
void get_constraint_target_matrix (struct Scene *scene, bConstraint *con, int n, short ownertype, void *ownerdata, float mat[][4], float ctime)
diff --git a/source/blender/editors/util/crazyspace.c b/source/blender/editors/util/crazyspace.c
index 9560924941d..53ccd37952d 100644
--- a/source/blender/editors/util/crazyspace.c
+++ b/source/blender/editors/util/crazyspace.c
@@ -384,7 +384,7 @@ void crazyspace_build_sculpt(Scene *scene, Object *ob, float (**deformmats)[3][3
int totleft= sculpt_get_first_deform_matrices(scene, ob, deformmats, deformcos);
if(totleft) {
- /* there are deformation modifier which doesn't support deformation matricies
+ /* there are deformation modifier which doesn't support deformation matrices
calculation. Need additional crazyspace correction */
float (*deformedVerts)[3]= *deformcos;
diff --git a/source/blender/python/mathutils/mathutils_Matrix.c b/source/blender/python/mathutils/mathutils_Matrix.c
index b1700aa53c6..7570b5642ef 100644
--- a/source/blender/python/mathutils/mathutils_Matrix.c
+++ b/source/blender/python/mathutils/mathutils_Matrix.c
@@ -1089,7 +1089,7 @@ static PyObject *Matrix_decompose(MatrixObject *self)
PyDoc_STRVAR(Matrix_lerp_doc,
".. function:: lerp(other, factor)\n"
"\n"
-" Returns the interpolation of two matricies.\n"
+" Returns the interpolation of two matrices.\n"
"\n"
" :arg other: value to interpolate with.\n"
" :type other: :class:`Matrix`\n"
@@ -1669,7 +1669,7 @@ static PyObject *Matrix_subscript(MatrixObject* self, PyObject* item)
}
else {
PyErr_SetString(PyExc_IndexError,
- "slice steps not supported with matricies");
+ "slice steps not supported with matrices");
return NULL;
}
}
@@ -1701,7 +1701,7 @@ static int Matrix_ass_subscript(MatrixObject* self, PyObject* item, PyObject* va
return Matrix_ass_slice(self, start, stop, value);
else {
PyErr_SetString(PyExc_IndexError,
- "slice steps not supported with matricies");
+ "slice steps not supported with matrices");
return -1;
}
}