Mathutils doc improvements + other small things
- bpy.app moved into PyStructSequence (used by sys.float_info) - added buildinfo into bpy.app.build_* - bpy.ui removed (wasnt used) - include external example files in Mathutils docs (only Mathutils and Vector are currently written) - added support to auto document PyStructSequence's - CMake had "'s inside all its strings.
This commit is contained in:
@@ -20,14 +20,13 @@
|
||||
|
||||
# internal blender C module
|
||||
import _bpy
|
||||
from _bpy import types, props
|
||||
from _bpy import types, props, app
|
||||
|
||||
data = _bpy.data
|
||||
context = _bpy.context
|
||||
|
||||
# python modules
|
||||
from bpy import utils
|
||||
from bpy import app
|
||||
|
||||
from bpy import ops as _ops_module
|
||||
|
||||
|
@@ -1,52 +0,0 @@
|
||||
# ##### BEGIN GPL LICENSE BLOCK #####
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
#
|
||||
# ##### END GPL LICENSE BLOCK #####
|
||||
|
||||
# <pep8 compliant>
|
||||
|
||||
"""
|
||||
This module contains application values that remain unchanged during runtime.
|
||||
|
||||
.. data:: version
|
||||
|
||||
The Blender version as a tuple of 3 numbers. eg. (2, 50, 11)
|
||||
|
||||
|
||||
.. data:: version_string
|
||||
|
||||
The Blender version formatted as a string.
|
||||
|
||||
.. data:: home
|
||||
|
||||
The blender home directory, normally matching $HOME
|
||||
|
||||
.. data:: binary_path
|
||||
|
||||
The location of blenders executable, useful for utilities that spawn new instances.
|
||||
|
||||
.. data:: debug
|
||||
|
||||
Boolean, set when blender is running in debug mode (started with -d)
|
||||
|
||||
"""
|
||||
# constants
|
||||
import _bpy
|
||||
version = _bpy._VERSION
|
||||
version_string = _bpy._VERSION_STR
|
||||
home = _bpy._HOME
|
||||
binary_path = _bpy._BINPATH
|
||||
debug = _bpy._DEBUG
|
@@ -19,33 +19,30 @@
|
||||
#
|
||||
# The Original Code is: all of this file.
|
||||
#
|
||||
# Contributor(s): Jacques Beaurain.
|
||||
# Contributor(s): Jacques Beaurainm, Campbell Barton
|
||||
#
|
||||
# ***** END GPL LICENSE BLOCK *****
|
||||
|
||||
ADD_SUBDIRECTORY(generic)
|
||||
|
||||
FILE(GLOB SRC intern/*.c)
|
||||
FILE(GLOB GENSRC generic/*.c)
|
||||
|
||||
SET(INC
|
||||
. ../../../intern/guardedalloc ../blenlib ../makesdna ../makesrna
|
||||
../blenkernel ../editors/include ../windowmanager ${PYTHON_INC}
|
||||
../../../extern/glew/include
|
||||
.
|
||||
../blenlib
|
||||
../makesdna
|
||||
../makesrna
|
||||
../blenkernel
|
||||
../windowmanager
|
||||
../editors/include
|
||||
../../../intern/guardedalloc
|
||||
${PYTHON_INC}
|
||||
)
|
||||
|
||||
IF(WITH_OPENEXR)
|
||||
ADD_DEFINITIONS(-DWITH_OPENEXR)
|
||||
ENDIF(WITH_OPENEXR)
|
||||
|
||||
IF(WITH_QUICKTIME)
|
||||
SET(INC ${INC} ${QUICKTIME_INC})
|
||||
ADD_DEFINITIONS(-DWITH_QUICKTIME)
|
||||
ENDIF(WITH_QUICKTIME)
|
||||
|
||||
IF(WITH_FFMPEG)
|
||||
SET(INC ${INC} ${FFMPEG_INC})
|
||||
ADD_DEFINITIONS(-DWITH_FFMPEG)
|
||||
ENDIF(WITH_FFMPEG)
|
||||
# only to check if buildinfo is available
|
||||
IF(WITH_BUILDINFO)
|
||||
ADD_DEFINITIONS(-DBUILD_DATE)
|
||||
ENDIF(WITH_BUILDINFO)
|
||||
|
||||
BLENDERLIB(bf_python "${SRC}" "${INC}")
|
||||
BLENDERLIB(bf_gen_python "${GENSRC}" "${INC}")
|
||||
|
||||
|
@@ -1,60 +1,9 @@
|
||||
# Blender.Mathutils module and its subtypes
|
||||
|
||||
"""
|
||||
The Blender.Mathutils submodule.
|
||||
|
||||
Mathutils
|
||||
=========
|
||||
(when accessing it from the Game Engine use Mathutils instead of Blender.Mathutils)
|
||||
|
||||
This module provides access to matrices, eulers, quaternions and vectors.
|
||||
|
||||
Example::
|
||||
import Blender
|
||||
from Blender import Mathutils
|
||||
from Blender.Mathutils import *
|
||||
|
||||
vec = Vector([1,2,3])
|
||||
mat = RotationMatrix(90, 4, 'x')
|
||||
matT = TranslationMatrix(vec)
|
||||
|
||||
matTotal = mat * matT
|
||||
matTotal.invert()
|
||||
|
||||
mat3 = matTotal.rotationPart
|
||||
quat1 = mat.to_quat()
|
||||
quat2 = mat3.to_quat()
|
||||
|
||||
angle = DifferenceQuats(quat1, quat2)
|
||||
print angle
|
||||
"""
|
||||
|
||||
class Vector:
|
||||
"""
|
||||
The Vector object
|
||||
=================
|
||||
@note: Comparison operators can be done on Vector classes:
|
||||
- >, >=, <, <= test the vector magnitude
|
||||
- ==, != test vector values e.g. 1,2,3 != 1,2,4 even if they are the same length
|
||||
@note: Math can be performed on Vector classes
|
||||
- vec + vec
|
||||
- vec - vec
|
||||
- vec * float/int
|
||||
- vec * matrix
|
||||
- vec * vec
|
||||
- vec * quat
|
||||
- -vec
|
||||
@note: You can access a vector object like a sequence
|
||||
- x = vector[0]
|
||||
- vec_a[:] vec_b
|
||||
- vec2d[:] vec3d[:2]
|
||||
@note: Vectors support 'swizzle' operations
|
||||
- vec.xyz = vec.zyx
|
||||
- vec.xy = vec.zw
|
||||
- vec.xxy = vec.wzz
|
||||
- vec.yzyz = vec.yxyx
|
||||
|
||||
See U{http://en.wikipedia.org/wiki/Swizzling_(computer_graphics)}
|
||||
|
||||
@attention: Vector data can be wrapped or non-wrapped. When a object is wrapped it
|
||||
means that the object will give you direct access to the data inside of blender. Modification
|
||||
@@ -62,15 +11,6 @@ class Vector:
|
||||
you need to use the object's constructor. If you copy and object by assignment you will not get
|
||||
a second copy but a second reference to the same data. Only certain functions will return
|
||||
wrapped data. This will be indicated in the method description.
|
||||
Example::
|
||||
wrappedObject = Object.getAttribute() #this is wrapped data
|
||||
print wrappedObject.wrapped #prints 'True'
|
||||
copyOfObject = wrappedObject.copy() #creates a copy of the object
|
||||
secondPointer = wrappedObject #creates a second pointer to the same data
|
||||
print wrappedObject.attribute #prints '5'
|
||||
secondPointer.attribute = 10
|
||||
print wrappedObject.attribute #prints '10'
|
||||
print copyOfObject.attribute #prints '5'
|
||||
"""
|
||||
|
||||
def __init__(list = None):
|
||||
@@ -107,15 +47,6 @@ class Euler:
|
||||
you need to use the object's constructor. If you copy and object by assignment you will not get
|
||||
a second copy but a second reference to the same data. Only certain functions will return
|
||||
wrapped data. This will be indicated in the method description.
|
||||
Example::
|
||||
wrappedObject = Object.getAttribute() #this is wrapped data
|
||||
print wrappedObject.wrapped #prints 'True'
|
||||
copyOfObject = wrappedObject.copy() #creates a copy of the object
|
||||
secondPointer = wrappedObject #creates a second pointer to the same data
|
||||
print wrappedObject.attribute #prints '5'
|
||||
secondPointer.attribute = 10
|
||||
print wrappedObject.attribute #prints '10'
|
||||
print copyOfObject.attribute #prints '5'
|
||||
"""
|
||||
|
||||
def __init__(list = None):
|
||||
@@ -154,15 +85,6 @@ class Quaternion:
|
||||
you need to use the object's constructor. If you copy and object by assignment you will not get
|
||||
a second copy but a second reference to the same data. Only certain functions will return
|
||||
wrapped data. This will be indicated in the method description.
|
||||
Example::
|
||||
wrappedObject = Object.getAttribute() #this is wrapped data
|
||||
print wrappedObject.wrapped #prints 'True'
|
||||
copyOfObject = wrappedObject.copy() #creates a copy of the object
|
||||
secondPointer = wrappedObject #creates a second pointer to the same data
|
||||
print wrappedObject.attribute #prints '5'
|
||||
secondPointer.attribute = 10
|
||||
print wrappedObject.attribute #prints '10'
|
||||
print copyOfObject.attribute #prints '5'
|
||||
"""
|
||||
|
||||
def __init__(list, angle = None):
|
||||
@@ -208,15 +130,6 @@ class Matrix:
|
||||
you need to use the object's constructor. If you copy and object by assignment you will not get
|
||||
a second copy but a second reference to the same data. Only certain functions will return
|
||||
wrapped data. This will be indicated in the method description.
|
||||
Example::
|
||||
wrappedObject = Object.getAttribute() #this is wrapped data
|
||||
print wrappedObject.wrapped #prints 'True'
|
||||
copyOfObject = wrappedObject.copy() #creates a copy of the object
|
||||
secondPointer = wrappedObject #creates a second pointer to the same data
|
||||
print wrappedObject.attribute #prints '5'
|
||||
secondPointer.attribute = 10
|
||||
print wrappedObject.attribute #prints '10'
|
||||
print copyOfObject.attribute #prints '5'
|
||||
"""
|
||||
|
||||
def __init__(list1 = None, list2 = None, list3 = None, list4 = None):
|
||||
|
17
source/blender/python/doc/examples/mathutils.py
Normal file
17
source/blender/python/doc/examples/mathutils.py
Normal file
@@ -0,0 +1,17 @@
|
||||
import Mathutils
|
||||
|
||||
vec = Mathutils.Vector(1.0, 2.0, 3.0)
|
||||
|
||||
mat_rot = Mathutils.RotationMatrix(90, 4, 'X')
|
||||
mat_trans = Mathutils.TranslationMatrix(vec)
|
||||
|
||||
mat = mat_trans * mat_rot
|
||||
mat.invert()
|
||||
|
||||
mat3 = mat.rotation_part()
|
||||
quat1 = mat.to_quat()
|
||||
quat2 = mat3.to_quat()
|
||||
|
||||
angle = quat1.difference(quat2)
|
||||
|
||||
print(angle)
|
3
source/blender/python/doc/examples/mathutils_euler.py
Normal file
3
source/blender/python/doc/examples/mathutils_euler.py
Normal file
@@ -0,0 +1,3 @@
|
||||
import Mathutils
|
||||
|
||||
# todo
|
3
source/blender/python/doc/examples/mathutils_matrix.py
Normal file
3
source/blender/python/doc/examples/mathutils_matrix.py
Normal file
@@ -0,0 +1,3 @@
|
||||
import Mathutils
|
||||
|
||||
# todo
|
3
source/blender/python/doc/examples/mathutils_quat.py
Normal file
3
source/blender/python/doc/examples/mathutils_quat.py
Normal file
@@ -0,0 +1,3 @@
|
||||
import Mathutils
|
||||
|
||||
# todo
|
55
source/blender/python/doc/examples/mathutils_vector.py
Normal file
55
source/blender/python/doc/examples/mathutils_vector.py
Normal file
@@ -0,0 +1,55 @@
|
||||
import Mathutils
|
||||
|
||||
# zero length vector
|
||||
vec = Mathutils.Vector(0, 0, 1)
|
||||
|
||||
# unit length vector
|
||||
vec_a = vec.copy().normalize()
|
||||
|
||||
vec_b = Mathutils.Vector(0, 1, 2)
|
||||
|
||||
vec2d = Mathutils.Vector(1, 2)
|
||||
vec3d = Mathutils.Vector([1, 0, 0])
|
||||
vec4d = vec_a.copy().resize4D()
|
||||
|
||||
# other mathutuls types
|
||||
quat = Mathutils.Quaternion()
|
||||
matrix = Mathutils.Matrix()
|
||||
|
||||
# Comparison operators can be done on Vector classes:
|
||||
|
||||
# greater and less then test vector length.
|
||||
vec_a > vec_b
|
||||
vec_a >= vec_b
|
||||
vec_a < vec_b
|
||||
vec_a <= vec_b
|
||||
|
||||
# ==, != test vector values e.g. 1,2,3 != 3,2,1 even if they are the same length
|
||||
vec_a == vec_b
|
||||
vec_a != vec_b
|
||||
|
||||
|
||||
# Math can be performed on Vector classes
|
||||
vec_a + vec_b
|
||||
vec_a - vec_b
|
||||
vec_a * vec_b
|
||||
vec_a * 10.0
|
||||
vec_a * matrix
|
||||
vec_a * vec_b
|
||||
vec_a * quat
|
||||
-vec_a
|
||||
|
||||
|
||||
# You can access a vector object like a sequence
|
||||
x = vec_a[0]
|
||||
len(vec)
|
||||
vec_a[:] = vec_b
|
||||
vec2d[:] = vec3d[:2]
|
||||
|
||||
|
||||
# Vectors support 'swizzle' operations
|
||||
# See http://en.wikipedia.org/wiki/Swizzling_(computer_graphics)
|
||||
vec.xyz = vec.zyx
|
||||
vec.xy = vec.zw
|
||||
vec.xxy = vec.wzz
|
||||
vec.yzyz = vec.yxyx
|
@@ -21,7 +21,7 @@
|
||||
script_help_msg = '''
|
||||
Usage,
|
||||
run this script from blenders root path once you have compiled blender
|
||||
./blender.bin -b -P /b/source/blender/python/sphinx_doc_gen.py
|
||||
./blender.bin -b -P /b/source/blender/python/doc/sphinx_doc_gen.py
|
||||
|
||||
This will generate python files in "./source/blender/python/doc/sphinx-in"
|
||||
Generate html docs by running...
|
||||
@@ -51,11 +51,14 @@ def range_str(val):
|
||||
else:
|
||||
return str(val)
|
||||
|
||||
def write_indented_lines(ident, fn, text):
|
||||
def write_indented_lines(ident, fn, text, strip=True):
|
||||
if text is None:
|
||||
return
|
||||
for l in text.split("\n"):
|
||||
fn(ident + l.strip() + "\n")
|
||||
if strip:
|
||||
fn(ident + l.strip() + "\n")
|
||||
else:
|
||||
fn(ident + l + "\n")
|
||||
|
||||
|
||||
def pymethod2sphinx(ident, fw, identifier, py_func):
|
||||
@@ -109,8 +112,7 @@ def py_c_func2sphinx(ident, fw, identifier, py_func, is_class=True):
|
||||
|
||||
# dump the docstring, assume its formatted correctly
|
||||
if py_func.__doc__:
|
||||
for l in py_func.__doc__.split("\n"):
|
||||
fw(ident + l + "\n")
|
||||
write_indented_lines(ident, fw, py_func.__doc__, False)
|
||||
fw("\n")
|
||||
else:
|
||||
fw(ident + ".. function:: %s()\n\n" % identifier)
|
||||
@@ -133,6 +135,7 @@ def pymodule2sphinx(BASEPATH, module_name, module, title):
|
||||
MethodDescriptorType = type(dict.get)
|
||||
GetSetDescriptorType = type(int.real)
|
||||
|
||||
|
||||
|
||||
filepath = os.path.join(BASEPATH, module_name + ".rst")
|
||||
|
||||
@@ -150,6 +153,16 @@ def pymodule2sphinx(BASEPATH, module_name, module, title):
|
||||
fw(module.__doc__.strip())
|
||||
fw("\n\n")
|
||||
|
||||
# write members of the module
|
||||
# only tested with PyStructs which are not exactly modules
|
||||
for attribute, descr in sorted(type(module).__dict__.items()):
|
||||
if type(descr) == types.MemberDescriptorType:
|
||||
if descr.__doc__:
|
||||
fw(".. data:: %s\n\n" % attribute)
|
||||
write_indented_lines(" ", fw, descr.__doc__, False)
|
||||
fw("\n")
|
||||
|
||||
|
||||
classes = []
|
||||
|
||||
for attribute in dir(module):
|
||||
@@ -173,8 +186,7 @@ def pymodule2sphinx(BASEPATH, module_name, module, title):
|
||||
# May need to be its own function
|
||||
fw(".. class:: %s\n\n" % attribute)
|
||||
if value.__doc__:
|
||||
for l in value.__doc__.split("\n"):
|
||||
fw(" %s\n" % l)
|
||||
write_indented_lines(" ", fw, value.__doc__, False)
|
||||
fw("\n")
|
||||
|
||||
for key in sorted(value.__dict__.keys()):
|
||||
@@ -184,8 +196,7 @@ def pymodule2sphinx(BASEPATH, module_name, module, title):
|
||||
if type(descr) == GetSetDescriptorType:
|
||||
if descr.__doc__:
|
||||
fw(" .. attribute:: %s\n\n" % key)
|
||||
for l in descr.__doc__.split("\n"):
|
||||
fw(" %s\n" % l)
|
||||
write_indented_lines(" ", fw, descr.__doc__, False)
|
||||
fw("\n")
|
||||
|
||||
for key in sorted(value.__dict__.keys()):
|
||||
@@ -194,8 +205,7 @@ def pymodule2sphinx(BASEPATH, module_name, module, title):
|
||||
descr = value.__dict__[key]
|
||||
if type(descr) == MethodDescriptorType: # GetSetDescriptorType, GetSetDescriptorType's are not documented yet
|
||||
if descr.__doc__:
|
||||
for l in descr.__doc__.split("\n"):
|
||||
fw(" %s\n" % l)
|
||||
write_indented_lines(" ", fw, descr.__doc__, False)
|
||||
fw("\n")
|
||||
|
||||
fw("\n\n")
|
||||
@@ -203,6 +213,7 @@ def pymodule2sphinx(BASEPATH, module_name, module, title):
|
||||
file.close()
|
||||
|
||||
|
||||
|
||||
def rna2sphinx(BASEPATH):
|
||||
|
||||
structs, funcs, ops, props = rna_info.BuildRNAInfo()
|
||||
@@ -217,11 +228,16 @@ def rna2sphinx(BASEPATH):
|
||||
file = open(filepath, "w")
|
||||
fw = file.write
|
||||
|
||||
|
||||
version_string = bpy.app.version_string.split("(")[0]
|
||||
if bpy.app.build_revision != "Unknown":
|
||||
version_string = version_string + " r" + bpy.app.build_revision
|
||||
|
||||
fw("project = 'Blender 3D'\n")
|
||||
# fw("master_doc = 'index'\n")
|
||||
fw("copyright = u'Blender Foundation'\n")
|
||||
fw("version = '%s'\n" % bpy.app.version_string)
|
||||
fw("release = '%s'\n" % bpy.app.version_string)
|
||||
fw("version = '%s'\n" % version_string)
|
||||
fw("release = '%s'\n" % version_string)
|
||||
fw("\n")
|
||||
# needed for latex, pdf gen
|
||||
fw("latex_documents = [ ('contents', 'contents.tex', 'Blender Index', 'Blender Foundation', 'manual'), ]\n")
|
||||
@@ -237,7 +253,7 @@ def rna2sphinx(BASEPATH):
|
||||
fw(" Blender Documentation contents\n")
|
||||
fw("%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n")
|
||||
fw("\n")
|
||||
fw("This document is an API reference for Blender %s.\n" % bpy.app.version_string.split()[0])
|
||||
fw("This document is an API reference for Blender %s. built %s.\n" % (version_string, bpy.app.build_date))
|
||||
fw("\n")
|
||||
fw("An introduction to blender and python can be found at <http://wiki.blender.org/index.php/Dev:2.5/Py/API/Intro>\n")
|
||||
fw("\n")
|
||||
@@ -285,6 +301,8 @@ def rna2sphinx(BASEPATH):
|
||||
# python modules
|
||||
from bpy import utils as module
|
||||
pymodule2sphinx(BASEPATH, "bpy.utils", module, "Utilities (bpy.utils)")
|
||||
|
||||
# C modules
|
||||
from bpy import app as module
|
||||
pymodule2sphinx(BASEPATH, "bpy.app", module, "Application Data (bpy.app)")
|
||||
|
||||
@@ -473,10 +491,18 @@ if __name__ == '__main__':
|
||||
print("\nError, this script must run from inside blender2.5")
|
||||
print(script_help_msg)
|
||||
else:
|
||||
# os.system("rm source/blender/python/doc/sphinx-in/*.rst")
|
||||
# os.system("rm -rf source/blender/python/doc/sphinx-out/*")
|
||||
rna2sphinx('source/blender/python/doc/sphinx-in')
|
||||
import shutil
|
||||
|
||||
path_in = 'source/blender/python/doc/sphinx-in'
|
||||
path_out = 'source/blender/python/doc/sphinx-in'
|
||||
|
||||
shutil.rmtree(path_in, True)
|
||||
shutil.rmtree(path_out, True)
|
||||
rna2sphinx(path_in)
|
||||
|
||||
# for fast module testing
|
||||
# os.system("rm source/blender/python/doc/sphinx-in/bpy.types.*.rst")
|
||||
# os.system("rm source/blender/python/doc/sphinx-in/bpy.ops.*.rst")
|
||||
|
||||
import sys
|
||||
sys.exit()
|
@@ -33,7 +33,7 @@
|
||||
* allowing script writers to make OpenGL calls in their Python scripts. */
|
||||
|
||||
#include "BGL.h" /*This must come first */
|
||||
|
||||
#include <GL/glew.h>
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
static int type_size( int type );
|
||||
|
@@ -41,7 +41,6 @@
|
||||
#endif
|
||||
|
||||
#include <Python.h>
|
||||
#include <GL/glew.h>
|
||||
|
||||
PyObject *BGL_Init(void);
|
||||
|
||||
|
34
source/blender/python/generic/CMakeLists.txt
Normal file
34
source/blender/python/generic/CMakeLists.txt
Normal file
@@ -0,0 +1,34 @@
|
||||
# ***** BEGIN GPL LICENSE BLOCK *****
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
#
|
||||
# Contributor(s): Campbell Barton
|
||||
#
|
||||
# ***** END GPL LICENSE BLOCK *****
|
||||
|
||||
FILE(GLOB SRC *.c)
|
||||
|
||||
SET(INC
|
||||
.
|
||||
../../blenlib
|
||||
../../makesdna
|
||||
../../blenkernel
|
||||
../../editors/include
|
||||
../../../../intern/guardedalloc
|
||||
../../../../extern/glew/include
|
||||
${PYTHON_INC}
|
||||
)
|
||||
|
||||
BLENDERLIB(bf_gen_python "${SRC}" "${INC}")
|
@@ -54,7 +54,10 @@
|
||||
#include "BKE_utildefines.h"
|
||||
|
||||
//-------------------------DOC STRINGS ---------------------------
|
||||
static char M_Mathutils_doc[] = "This module provides access to matrices, eulers, quaternions and vectors.";
|
||||
static char M_Mathutils_doc[] =
|
||||
"This module provides access to matrices, eulers, quaternions and vectors.\n"
|
||||
"\n"
|
||||
".. literalinclude:: ../examples/mathutils.py\n";
|
||||
|
||||
//-----------------------------METHODS----------------------------
|
||||
//-----------------quat_rotation (internal)-----------
|
||||
|
@@ -591,7 +591,10 @@ static struct PyMethodDef Euler_methods[] = {
|
||||
};
|
||||
|
||||
//------------------PY_OBECT DEFINITION--------------------------
|
||||
static char euler_doc[] = "This object gives access to Eulers in Blender.";
|
||||
static char euler_doc[] =
|
||||
"This object gives access to Eulers in Blender.\n"
|
||||
"\n"
|
||||
".. literalinclude:: ../examples/mathutils_euler.py\n";
|
||||
|
||||
PyTypeObject euler_Type = {
|
||||
PyVarObject_HEAD_INIT(NULL, 0)
|
||||
|
@@ -1280,7 +1280,10 @@ static struct PyMethodDef Matrix_methods[] = {
|
||||
};
|
||||
|
||||
/*------------------PY_OBECT DEFINITION--------------------------*/
|
||||
static char matrix_doc[] = "This object gives access to Matrices in Blender.";
|
||||
static char matrix_doc[] =
|
||||
"This object gives access to Matrices in Blender.\n"
|
||||
"\n"
|
||||
".. literalinclude:: ../examples/mathutils_matrix.py\n";
|
||||
|
||||
PyTypeObject matrix_Type = {
|
||||
PyVarObject_HEAD_INIT(NULL, 0)
|
||||
|
@@ -860,7 +860,10 @@ static PyGetSetDef Quaternion_getseters[] = {
|
||||
};
|
||||
|
||||
//------------------PY_OBECT DEFINITION--------------------------
|
||||
static char quaternion_doc[] = "This object gives access to Quaternions in Blender.";
|
||||
static char quaternion_doc[] =
|
||||
"This object gives access to Quaternions in Blender.\n"
|
||||
"\n"
|
||||
".. literalinclude:: ../examples/mathutils_quat.py\n";
|
||||
|
||||
PyTypeObject quaternion_Type = {
|
||||
PyVarObject_HEAD_INIT(NULL, 0)
|
||||
|
@@ -2110,7 +2110,10 @@ static struct PyMethodDef Vector_methods[] = {
|
||||
vec*mat and mat*vec both get sent to Vector_mul and it neesd to sort out the order
|
||||
*/
|
||||
|
||||
static char vector_doc[] = "This object gives access to Vectors in Blender.";
|
||||
static char vector_doc[] =
|
||||
"This object gives access to Vectors in Blender.\n"
|
||||
"\n"
|
||||
".. literalinclude:: ../examples/mathutils_vector.py\n";
|
||||
|
||||
PyTypeObject vector_Type = {
|
||||
PyVarObject_HEAD_INIT(NULL, 0)
|
||||
|
@@ -41,7 +41,6 @@
|
||||
#include "bpy_rna.h"
|
||||
#include "bpy_props.h"
|
||||
#include "bpy_operator.h"
|
||||
#include "bpy_ui.h"
|
||||
#include "bpy_util.h"
|
||||
|
||||
#ifndef WIN32
|
||||
@@ -60,11 +59,9 @@
|
||||
#include "BLI_fileops.h"
|
||||
#include "BLI_string.h"
|
||||
|
||||
#include "BKE_blender.h"
|
||||
#include "BKE_context.h"
|
||||
#include "BKE_text.h"
|
||||
#include "BKE_context.h"
|
||||
#include "BKE_global.h"
|
||||
#include "BKE_main.h"
|
||||
|
||||
#include "BPY_extern.h"
|
||||
@@ -210,9 +207,7 @@ static void bpy_init_modules( void )
|
||||
/* PyModule_AddObject( mod, "doc", BPY_rna_doc() ); */
|
||||
PyModule_AddObject( mod, "props", BPY_rna_props() );
|
||||
PyModule_AddObject( mod, "ops", BPY_operator_module() ); /* ops is now a python module that does the conversion from SOME_OT_foo -> some.foo */
|
||||
PyModule_AddObject( mod, "ui", BPY_ui_module() ); // XXX very experimental, consider this a test, especially PyCObject is not meant to be permanent
|
||||
|
||||
|
||||
PyModule_AddObject( mod, "app", BPY_app_struct() );
|
||||
|
||||
/* bpy context */
|
||||
{
|
||||
@@ -224,20 +219,6 @@ static void bpy_init_modules( void )
|
||||
PyModule_AddObject(mod, "context", (PyObject *)bpy_context_module);
|
||||
}
|
||||
|
||||
/* blender info that wont change at runtime, add into _bpy */
|
||||
{
|
||||
extern char bprogname[]; /* argv[0] from creator.c */
|
||||
|
||||
PyObject *mod_dict= PyModule_GetDict(mod);
|
||||
char tmpstr[256];
|
||||
PyModule_AddStringConstant(mod, "_HOME", BLI_gethome());
|
||||
PyDict_SetItemString(mod_dict, "_VERSION", Py_BuildValue("(iii)", BLENDER_VERSION/100, BLENDER_VERSION%100, BLENDER_SUBVERSION));
|
||||
sprintf(tmpstr, "%d.%02d (sub %d)", BLENDER_VERSION/100, BLENDER_VERSION%100, BLENDER_SUBVERSION);
|
||||
PyModule_AddStringConstant(mod, "_VERSION_STR", tmpstr);
|
||||
PyModule_AddStringConstant(mod, "_BINPATH", bprogname);
|
||||
PyModule_AddIntConstant(mod, "_DEBUG", G.f & G_DEBUG ? 1:0);
|
||||
}
|
||||
|
||||
/* add our own modules dir, this is a python package */
|
||||
bpy_import_test("bpy");
|
||||
}
|
||||
@@ -794,7 +775,7 @@ int BPY_context_get(bContext *C, const char *member, bContextDataResult *result)
|
||||
if (item) printf("Context '%s' not a valid type\n", member);
|
||||
else printf("Context '%s' not found\n", member);
|
||||
}
|
||||
else if (G.f & G_DEBUG) {
|
||||
else {
|
||||
printf("Context '%s' found\n", member);
|
||||
}
|
||||
|
||||
|
@@ -1,69 +0,0 @@
|
||||
/**
|
||||
* $Id$
|
||||
*
|
||||
* ***** BEGIN GPL LICENSE BLOCK *****
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* Contributor(s): Campbell Barton
|
||||
*
|
||||
* ***** END GPL LICENSE BLOCK *****
|
||||
*/
|
||||
|
||||
#include "bpy_ui.h"
|
||||
#include "bpy_util.h"
|
||||
#include "bpy_rna.h" /* for rna buttons */
|
||||
#include "bpy_operator.h" /* for setting button operator properties */
|
||||
|
||||
#include "WM_types.h" /* for WM_OP_INVOKE_DEFAULT & friends */
|
||||
|
||||
#include "BLI_dynstr.h"
|
||||
|
||||
#include "MEM_guardedalloc.h"
|
||||
#include "BKE_global.h" /* evil G.* */
|
||||
#include "BKE_context.h"
|
||||
|
||||
#include "DNA_screen_types.h"
|
||||
#include "DNA_space_types.h" /* only for SpaceLink */
|
||||
#include "UI_interface.h"
|
||||
#include "WM_api.h"
|
||||
|
||||
/* Dummy Module, may want to include non RNA UI functions here, else it can be removed */
|
||||
|
||||
static struct PyMethodDef ui_methods[] = {
|
||||
{NULL, NULL, 0, NULL}
|
||||
};
|
||||
|
||||
static struct PyModuleDef ui_module = {
|
||||
PyModuleDef_HEAD_INIT,
|
||||
"_bpy.ui",
|
||||
"",
|
||||
-1,/* multiple "initialization" just copies the module dict. */
|
||||
ui_methods,
|
||||
NULL, NULL, NULL, NULL
|
||||
};
|
||||
|
||||
PyObject *BPY_ui_module( void )
|
||||
{
|
||||
PyObject *submodule;
|
||||
submodule= PyModule_Create(&ui_module);
|
||||
|
||||
/* INCREF since its its assumed that all these functions return the
|
||||
* module with a new ref like PyDict_New, since they are passed to
|
||||
* PyModule_AddObject which steals a ref */
|
||||
Py_INCREF(submodule);
|
||||
|
||||
return submodule;
|
||||
}
|
@@ -1,31 +0,0 @@
|
||||
/**
|
||||
* $Id$
|
||||
*
|
||||
* ***** BEGIN GPL LICENSE BLOCK *****
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* Contributor(s): Campbell Barton
|
||||
*
|
||||
* ***** END GPL LICENSE BLOCK *****
|
||||
*/
|
||||
#ifndef BPY_UI_H__
|
||||
#define BPY_UI_H__
|
||||
|
||||
#include <Python.h>
|
||||
|
||||
PyObject *BPY_ui_module( void );
|
||||
|
||||
#endif
|
@@ -88,11 +88,11 @@ IF(WIN32)
|
||||
ENDIF(WIN32)
|
||||
|
||||
IF(WITH_BUILDINFO)
|
||||
ADD_DEFINITIONS(-DBUILD_DATE="${BUILD_DATE}")
|
||||
ADD_DEFINITIONS(-DBUILD_TIME="${BUILD_TIME}")
|
||||
ADD_DEFINITIONS(-DBUILD_REV="${BUILD_REV}")
|
||||
ADD_DEFINITIONS(-DBUILD_PLATFORM="${CMAKE_SYSTEM_NAME}")
|
||||
ADD_DEFINITIONS(-DBUILD_TYPE="${CMAKE_BUILD_TYPE}")
|
||||
ADD_DEFINITIONS(-DBUILD_DATE=${BUILD_DATE})
|
||||
ADD_DEFINITIONS(-DBUILD_TIME=${BUILD_TIME})
|
||||
ADD_DEFINITIONS(-DBUILD_REV=${BUILD_REV})
|
||||
ADD_DEFINITIONS(-DBUILD_PLATFORM=${CMAKE_SYSTEM_NAME})
|
||||
ADD_DEFINITIONS(-DBUILD_TYPE=${CMAKE_BUILD_TYPE})
|
||||
|
||||
SET(EXESRC ${EXESRC} buildinfo.c)
|
||||
ENDIF(WITH_BUILDINFO)
|
||||
|
Reference in New Issue
Block a user