move geometry python module into mathutils.geometry, since it provides utility functions using mathutils types.

This commit is contained in:
Campbell Barton 2010-10-25 22:44:01 +00:00
parent 29605fc06d
commit 3264ced377
12 changed files with 15 additions and 12 deletions

@ -364,7 +364,7 @@ def rna2sphinx(BASEPATH):
fw(" These parts of the API are relatively stable and are unlikely to change significantly\n") fw(" These parts of the API are relatively stable and are unlikely to change significantly\n")
fw(" * data API, access to attributes of blender data such as mesh verts, material color, timeline frames and scene objects\n") fw(" * data API, access to attributes of blender data such as mesh verts, material color, timeline frames and scene objects\n")
fw(" * user interface functions for defining buttons, creation of menus, headers, panels\n") fw(" * user interface functions for defining buttons, creation of menus, headers, panels\n")
fw(" * modules: bgl, mathutils and geometry\n") fw(" * modules: bgl and mathutils\n")
fw(" * game engine modules\n") fw(" * game engine modules\n")
fw("\n") fw("\n")

@ -268,7 +268,7 @@ def banner(context):
add_scrollback("Execute: Enter", 'OUTPUT') add_scrollback("Execute: Enter", 'OUTPUT')
add_scrollback("Autocomplete: Ctrl+Space", 'OUTPUT') add_scrollback("Autocomplete: Ctrl+Space", 'OUTPUT')
add_scrollback("Ctrl +/- Wheel: Zoom", 'OUTPUT') add_scrollback("Ctrl +/- Wheel: Zoom", 'OUTPUT')
add_scrollback("Builtin Modules: bpy, bpy.data, bpy.ops, bpy.props, bpy.types, bpy.context, bgl, blf, mathutils, geometry", 'OUTPUT') add_scrollback("Builtin Modules: bpy, bpy.data, bpy.ops, bpy.props, bpy.types, bpy.context, bgl, blf, mathutils", 'OUTPUT')
add_scrollback("", 'OUTPUT') add_scrollback("", 'OUTPUT')
add_scrollback(" WARNING!!! Blender 2.5 API is subject to change, see API reference for more info.", 'ERROR') add_scrollback(" WARNING!!! Blender 2.5 API is subject to change, see API reference for more info.", 'ERROR')
add_scrollback("", 'OUTPUT') add_scrollback("", 'OUTPUT')

@ -35,7 +35,7 @@ import os
import time import time
import bpy import bpy
import mathutils import mathutils
from geometry import PolyFill from mathutils.geometry import PolyFill
from io_utils import load_image, unpack_list, unpack_face_list from io_utils import load_image, unpack_list, unpack_face_list

@ -256,7 +256,7 @@ class ShapeTransfer(bpy.types.Operator):
ob.active_shape_key_index = len(me.shape_keys.keys) - 1 ob.active_shape_key_index = len(me.shape_keys.keys) - 1
ob.show_shape_key = True ob.show_shape_key = True
from geometry import BarycentricTransform from mathutils.geometry import BarycentricTransform
from mathutils import Vector from mathutils import Vector
if use_clamp and mode == 'OFFSET': if use_clamp and mode == 'OFFSET':

@ -22,9 +22,8 @@
# <pep8 compliant> # <pep8 compliant>
from mathutils import Matrix, Vector from mathutils import Matrix, Vector, geometry
import time import time
import geometry
import bpy import bpy
from math import cos, radians from math import cos, radians

@ -34,10 +34,10 @@ SET(SRC
bgl.c bgl.c
blf_api.c blf_api.c
bpy_internal_import.c bpy_internal_import.c
geometry.c
mathutils.c mathutils.c
mathutils_color.c mathutils_color.c
mathutils_euler.c mathutils_euler.c
mathutils_geometry.c
mathutils_matrix.c mathutils_matrix.c
mathutils_quat.c mathutils_quat.c
mathutils_vector.c mathutils_vector.c

@ -249,6 +249,8 @@ PyObject *Mathutils_Init(void)
{ {
PyObject *submodule; PyObject *submodule;
if( PyType_Ready( &vector_Type ) < 0 ) if( PyType_Ready( &vector_Type ) < 0 )
return NULL; return NULL;
if( PyType_Ready( &matrix_Type ) < 0 ) if( PyType_Ready( &matrix_Type ) < 0 )
@ -270,6 +272,9 @@ PyObject *Mathutils_Init(void)
PyModule_AddObject( submodule, "Quaternion", (PyObject *)&quaternion_Type ); PyModule_AddObject( submodule, "Quaternion", (PyObject *)&quaternion_Type );
PyModule_AddObject( submodule, "Color", (PyObject *)&color_Type ); PyModule_AddObject( submodule, "Color", (PyObject *)&color_Type );
/* submodule */
PyModule_AddObject( submodule, "geometry", Geometry_Init());
mathutils_matrix_vector_cb_index= Mathutils_RegisterCallback(&mathutils_matrix_vector_cb); mathutils_matrix_vector_cb_index= Mathutils_RegisterCallback(&mathutils_matrix_vector_cb);
return (submodule); return (submodule);

@ -55,6 +55,7 @@ typedef struct {
#include "mathutils_quat.h" #include "mathutils_quat.h"
#include "mathutils_euler.h" #include "mathutils_euler.h"
#include "mathutils_color.h" #include "mathutils_color.h"
#include "mathutils_geometry.h"
PyObject *BaseMathObject_getOwner( BaseMathObject * self, void * ); PyObject *BaseMathObject_getOwner( BaseMathObject * self, void * );
PyObject *BaseMathObject_getWrapped( BaseMathObject *self, void * ); PyObject *BaseMathObject_getWrapped( BaseMathObject *self, void * );

@ -27,7 +27,7 @@
* ***** END GPL LICENSE BLOCK ***** * ***** END GPL LICENSE BLOCK *****
*/ */
#include "geometry.h" #include "mathutils_geometry.h"
/* Used for PolyFill */ /* Used for PolyFill */
#include "BKE_displist.h" #include "BKE_displist.h"
@ -819,7 +819,7 @@ struct PyMethodDef M_Geometry_methods[] = {
static struct PyModuleDef M_Geometry_module_def = { static struct PyModuleDef M_Geometry_module_def = {
PyModuleDef_HEAD_INIT, PyModuleDef_HEAD_INIT,
"geometry", /* m_name */ "mathutils.geometry", /* m_name */
M_Geometry_doc, /* m_doc */ M_Geometry_doc, /* m_doc */
0, /* m_size */ 0, /* m_size */
M_Geometry_methods, /* m_methods */ M_Geometry_methods, /* m_methods */

@ -38,7 +38,7 @@
#include "BKE_utildefines.h" #include "BKE_utildefines.h"
/* external util modules */ /* external util modules */
#include "../generic/geometry.h" #include "../generic/mathutils.h"
#include "../generic/bgl.h" #include "../generic/bgl.h"
#include "../generic/blf_api.h" #include "../generic/blf_api.h"
#include "../generic/IDProp.h" #include "../generic/IDProp.h"
@ -195,7 +195,6 @@ void BPy_init_modules( void )
printf("bpy: couldnt find 'scripts/modules', blender probably wont start.\n"); printf("bpy: couldnt find 'scripts/modules', blender probably wont start.\n");
} }
/* stand alone utility modules not related to blender directly */ /* stand alone utility modules not related to blender directly */
Geometry_Init();
Mathutils_Init(); Mathutils_Init();
Noise_Init(); Noise_Init();
BGL_Init(); BGL_Init();

@ -40,7 +40,6 @@ extern "C" {
#include "bpy_internal_import.h" /* from the blender python api, but we want to import text too! */ #include "bpy_internal_import.h" /* from the blender python api, but we want to import text too! */
#include "py_capi_utils.h" #include "py_capi_utils.h"
#include "mathutils.h" // Blender.Mathutils module copied here so the blenderlayer can use. #include "mathutils.h" // Blender.Mathutils module copied here so the blenderlayer can use.
#include "geometry.h" // Blender.Geometry module copied here so the blenderlayer can use.
#include "bgl.h" #include "bgl.h"
#include "blf_api.h" #include "blf_api.h"