Merged changes in the trunk up to revision 35203.

Conflicts resolved:
source/creator/creator.c
source/blender/python/intern/bpy.c
This commit is contained in:
2011-02-26 20:21:09 +00:00
2086 changed files with 13208 additions and 6121 deletions

View File

@@ -27,4 +27,4 @@ bpy.ops.mesh.subdivide(number_cuts=3, smoothness=0.5)
# check poll() to avoid exception.
if bpy.ops.object.mode_set.poll():
bpy.ops.object.mode_set(mode='EDIT')
bpy.ops.object.mode_set(mode='EDIT')

View File

@@ -8,6 +8,7 @@ Custom properties can be added to any subclass of an :class:`ID`,
import bpy
# Assign a collection
class SceneSettingItem(bpy.types.PropertyGroup):
name = bpy.props.StringProperty(name="Test Prop", default="Unknown")
@@ -30,4 +31,4 @@ my_item.name = "Eggs"
my_item.value = 30
for my_item in bpy.context.scene.my_settings:
print(my_item.name, my_item.value)
print(my_item.name, my_item.value)

View File

@@ -12,7 +12,7 @@ class SubMenu(bpy.types.Menu):
def draw(self, context):
layout = self.layout
layout.operator("object.select_all", text="Select/Deselect All")
layout.operator("object.select_inverse", text="Inverse")
layout.operator("object.select_random", text="Random")

View File

@@ -10,6 +10,7 @@ The function menu_draw acts like Menu.draw
"""
import bpy
def menu_draw(self, context):
self.layout.operator("wm.save_homefile")

View File

@@ -20,7 +20,7 @@ class BasicMenu(bpy.types.Menu):
def draw(self, context):
layout = self.layout
layout.operator("object.select_all", text="Select/Deselect All")
layout.operator("object.select_inverse", text="Inverse")
layout.operator("object.select_random", text="Random")

View File

@@ -25,7 +25,7 @@ class ModalOperator(bpy.types.Operator):
def __init__(self):
print("Start")
def __del__(self):
print("End")
@@ -33,7 +33,7 @@ class ModalOperator(bpy.types.Operator):
context.object.location.x = self.value / 100.0
def modal(self, context, event):
if event.type == 'MOUSEMOVE': # Apply
if event.type == 'MOUSEMOVE': # Apply
self.value = event.mouse_x
self.execute(context)
elif event.type == 'LEFTMOUSE': # Confirm
@@ -51,7 +51,6 @@ class ModalOperator(bpy.types.Operator):
return {'RUNNING_MODAL'}
bpy.utils.register_class(ModalOperator)
# test call

View File

@@ -23,7 +23,6 @@ class ObjectSelectPanel(bpy.types.Panel):
layout = self.layout
obj = context.object
layout.prop(obj, "select", text="")
def draw(self, context):
layout = self.layout

View File

@@ -6,6 +6,7 @@ A mix-in parent class can be used to share common properties and
"""
import bpy
class View3DPanel():
bl_space_type = 'VIEW_3D'
bl_region_type = 'TOOLS'

View File

@@ -33,8 +33,8 @@ class MyPropertyGroup(bpy.types.PropertyGroup):
bpy.utils.register_class(MyPropertyGroup)
bpy.types.Object.my_properties = MyPropertyGroup
bpy.types.Object.my_prop_grp = bpy.props.PointerProperty(type=MyPropertyGroup)
# test this worked
bpy.data.objects[0].my_properties.custom_1 = 22.0
bpy.data.objects[0].my_prop_grp.custom_1 = 22.0

View File

@@ -20,15 +20,6 @@ Game Engine bge.types Module
:type: boolean
.. method:: isA(game_type)
Check if this is a type or a subtype game_type.
:arg game_type: the name of the type or the type its self from the :mod:`bge.types` module.
:type game_type: string or type
:return: True if this object is a type or a subtype of game_type.
:rtype: boolean
.. class:: CValue(PyObjectPlus)
This class is a basis for other classes.

View File

@@ -519,6 +519,8 @@ def pycontext2sphinx(BASEPATH):
else:
pass # will have raised an error above
file.close()
def pyrna2sphinx(BASEPATH):
""" bpy.types and bpy.ops
@@ -739,6 +741,7 @@ def pyrna2sphinx(BASEPATH):
# docs last?, disable for now
# write_example_ref("", fw, "bpy.types.%s" % struct.identifier)
file.close()
if "bpy.types" not in EXCLUDE_MODULES:
for struct in structs.values():
@@ -777,46 +780,51 @@ def pyrna2sphinx(BASEPATH):
for key, descr in descr_items:
if type(descr) == GetSetDescriptorType:
py_descr2sphinx(" ", fw, descr, "bpy.types", _BPY_STRUCT_FAKE, key)
file.close()
# operators
def write_ops():
API_BASEURL = "https://svn.blender.org/svnroot/bf-blender/trunk/blender/release/scripts"
fw = None
last_mod = ''
for op_key in sorted(ops.keys()):
op = ops[op_key]
op_modules = {}
for op in ops.values():
op_modules.setdefault(op.module_name, []).append(op)
del op
if last_mod != op.module_name:
filepath = os.path.join(BASEPATH, "bpy.ops.%s.rst" % op.module_name)
file = open(filepath, "w")
fw = file.write
for op_module_name, ops_mod in op_modules.items():
filepath = os.path.join(BASEPATH, "bpy.ops.%s.rst" % op_module_name)
file = open(filepath, "w")
fw = file.write
title = "%s Operators" % (op.module_name[0].upper() + op.module_name[1:])
fw("%s\n%s\n\n" % (title, "=" * len(title)))
title = "%s Operators" % op_module_name.replace("_", " ").title()
fw("%s\n%s\n\n" % (title, "=" * len(title)))
fw(".. module:: bpy.ops.%s\n\n" % op.module_name)
last_mod = op.module_name
fw(".. module:: bpy.ops.%s\n\n" % op_module_name)
args_str = ", ".join(prop.get_arg_default(force=True) for prop in op.args)
fw(".. function:: %s(%s)\n\n" % (op.func_name, args_str))
ops_mod.sort(key=lambda op: op.func_name)
# if the description isn't valid, we output the standard warning
# with a link to the wiki so that people can help
if not op.description or op.description == "(undocumented operator)":
operator_description = undocumented_message('bpy.ops', op.module_name, op.func_name)
else:
operator_description = op.description
for op in ops_mod:
args_str = ", ".join(prop.get_arg_default(force=True) for prop in op.args)
fw(".. function:: %s(%s)\n\n" % (op.func_name, args_str))
fw(" %s\n\n" % operator_description)
for prop in op.args:
write_param(" ", fw, prop)
if op.args:
fw("\n")
# if the description isn't valid, we output the standard warning
# with a link to the wiki so that people can help
if not op.description or op.description == "(undocumented operator)":
operator_description = undocumented_message('bpy.ops', op.module_name, op.func_name)
else:
operator_description = op.description
location = op.get_location()
if location != (None, None):
fw(" :file: `%s <%s/%s>`_:%d\n\n" % (location[0], API_BASEURL, location[0], location[1]))
fw(" %s\n\n" % operator_description)
for prop in op.args:
write_param(" ", fw, prop)
if op.args:
fw("\n")
location = op.get_location()
if location != (None, None):
fw(" :file: `%s <%s/%s>`_:%d\n\n" % (location[0], API_BASEURL, location[0], location[1]))
file.close()
if "bpy.ops" not in EXCLUDE_MODULES:
write_ops()