[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [39704] branches/soc-2011-cucumber: Merge from trunk r39703
Daniel Stokes
kupomail at gmail.com
Fri Aug 26 04:42:23 CEST 2011
Revision: 39704
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=39704
Author: kupoman
Date: 2011-08-26 02:42:22 +0000 (Fri, 26 Aug 2011)
Log Message:
-----------
Merge from trunk r39703
Revision Links:
--------------
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=39703
Modified Paths:
--------------
branches/soc-2011-cucumber/SConstruct
branches/soc-2011-cucumber/build_files/scons/config/darwin-config.py
branches/soc-2011-cucumber/doc/python_api/examples/bpy.types.BlendDataLibraries.load.py
branches/soc-2011-cucumber/doc/python_api/sphinx_doc_gen.py
branches/soc-2011-cucumber/doc/python_api/sphinx_doc_gen.sh
branches/soc-2011-cucumber/release/scripts/modules/console_python.py
branches/soc-2011-cucumber/source/blender/editors/interface/interface_draw.c
branches/soc-2011-cucumber/source/blender/editors/interface/interface_handlers.c
branches/soc-2011-cucumber/source/blender/editors/interface/interface_icons.c
branches/soc-2011-cucumber/source/blender/editors/screen/screen_edit.c
branches/soc-2011-cucumber/source/blender/editors/screen/screen_ops.c
branches/soc-2011-cucumber/source/blender/editors/space_file/file_ops.c
branches/soc-2011-cucumber/source/blender/editors/space_file/fsmenu.c
branches/soc-2011-cucumber/source/blender/editors/space_image/image_ops.c
branches/soc-2011-cucumber/source/blender/editors/space_view3d/drawobject.c
branches/soc-2011-cucumber/source/blender/editors/space_view3d/view3d_draw.c
branches/soc-2011-cucumber/source/blender/editors/space_view3d/view3d_edit.c
branches/soc-2011-cucumber/source/blender/editors/space_view3d/view3d_view.c
branches/soc-2011-cucumber/source/blender/makesdna/DNA_windowmanager_types.h
branches/soc-2011-cucumber/source/blender/python/intern/bpy_operator.c
branches/soc-2011-cucumber/source/blender/python/intern/bpy_rna.c
branches/soc-2011-cucumber/source/blender/render/intern/source/convertblender.c
branches/soc-2011-cucumber/source/blender/windowmanager/intern/wm_event_system.c
branches/soc-2011-cucumber/source/blender/windowmanager/intern/wm_operators.c
Added Paths:
-----------
branches/soc-2011-cucumber/doc/python_api/rst/info_overview.rst
branches/soc-2011-cucumber/doc/python_api/rst/info_quickstart.rst
Property Changed:
----------------
branches/soc-2011-cucumber/
branches/soc-2011-cucumber/intern/audaspace/OpenAL/
branches/soc-2011-cucumber/source/blender/editors/space_outliner/
Property changes on: branches/soc-2011-cucumber
___________________________________________________________________
Modified: svn:mergeinfo
- /trunk/blender:36829-39684
+ /trunk/blender:36829-39703
Modified: branches/soc-2011-cucumber/SConstruct
===================================================================
--- branches/soc-2011-cucumber/SConstruct 2011-08-26 01:32:07 UTC (rev 39703)
+++ branches/soc-2011-cucumber/SConstruct 2011-08-26 02:42:22 UTC (rev 39704)
@@ -272,13 +272,13 @@
# for now, Mac builders must download and install the 3DxWare 10 Beta 4 driver framework from 3Dconnexion
# necessary header file lives here when installed:
# /Library/Frameworks/3DconnexionClient.framework/Versions/Current/Headers/ConnexionClientAPI.h
- if env['WITH_BF_3DMOUSE'] == 1 and not os.path.exists('/Library/Frameworks/3DconnexionClient.framework'):
- print "3D_CONNEXION_CLIENT_LIBRARY not found, disabling WITH_BF_3DMOUSE" # avoid build errors !
- env['WITH_BF_3DMOUSE'] = 0
- else:
- env.Append(LINKFLAGS=['-weak_framework','3DconnexionClient'])
+ if env['WITH_BF_3DMOUSE'] == 1:
+ if not os.path.exists('/Library/Frameworks/3DconnexionClient.framework'):
+ print "3D_CONNEXION_CLIENT_LIBRARY not found, disabling WITH_BF_3DMOUSE" # avoid build errors !
+ env['WITH_BF_3DMOUSE'] = 0
+ else:
+ env.Append(LINKFLAGS=['-weak_framework','3DconnexionClient'])
-
if env['WITH_BF_OPENMP'] == 1:
if env['OURPLATFORM'] in ('win32-vc', 'win64-vc'):
env['CCFLAGS'].append('/openmp')
Modified: branches/soc-2011-cucumber/build_files/scons/config/darwin-config.py
===================================================================
--- branches/soc-2011-cucumber/build_files/scons/config/darwin-config.py 2011-08-26 01:32:07 UTC (rev 39703)
+++ branches/soc-2011-cucumber/build_files/scons/config/darwin-config.py 2011-08-26 02:42:22 UTC (rev 39704)
@@ -316,7 +316,11 @@
PLATFORM_LINKFLAGS = PLATFORM_LINKFLAGS+['-framework','QuickTime']
#note to build succesfully on 10.3.9 SDK you need to patch 10.3.9 by adding the SystemStubs.a lib from 10.4
-LLIBS = ['stdc++', 'SystemStubs']
+#for 10.7.sdk, SystemStubs needs to be excluded (lib doesn't exist anymore)
+if MACOSX_DEPLOYMENT_TARGET == '10.7':
+ LLIBS = ['stdc++']
+else:
+ LLIBS = ['stdc++', 'SystemStubs']
# some flags shuffling for different OS versions
if MAC_MIN_VERS == '10.3':
Modified: branches/soc-2011-cucumber/doc/python_api/examples/bpy.types.BlendDataLibraries.load.py
===================================================================
--- branches/soc-2011-cucumber/doc/python_api/examples/bpy.types.BlendDataLibraries.load.py 2011-08-26 01:32:07 UTC (rev 39703)
+++ branches/soc-2011-cucumber/doc/python_api/examples/bpy.types.BlendDataLibraries.load.py 2011-08-26 02:42:22 UTC (rev 39704)
@@ -23,11 +23,6 @@
setattr(data_to, attr, getattr(data_from, attr))
-# the 'data_to' variables lists are
-with bpy.data.libraries.load(filepath) as (data_from, data_to):
- data_to.scenes = ["Scene"]
-
-
# the loaded objects can be accessed from 'data_to' outside of the context
# since loading the data replaces the strings for the datablocks or None
# if the datablock could not be loaded.
Copied: branches/soc-2011-cucumber/doc/python_api/rst/info_overview.rst (from rev 39703, trunk/blender/doc/python_api/rst/info_overview.rst)
===================================================================
--- branches/soc-2011-cucumber/doc/python_api/rst/info_overview.rst (rev 0)
+++ branches/soc-2011-cucumber/doc/python_api/rst/info_overview.rst 2011-08-26 02:42:22 UTC (rev 39704)
@@ -0,0 +1,386 @@
+###################
+Python API Overview
+###################
+
+This document is to give an understanding of how python and blender fit together, covering some of the functionality that isn't obvious from reading the API reference and example scripts.
+
+*****************
+Python in Blender
+*****************
+
+Blender embeds a python interpreter which is started with blender and stays active. This interpreter runs scripts to draw the user interface and is used for some of Blender's internal tools too.
+
+This is a typical python environment so tutorials on how to write python scripts will work running the scripts in blender too. Blender provides the :mod:`bpy` module to the python interpreter. This module can be imported in a script and gives access to blender data, classes, and functions. Scripts that deal with blender data will need to import this module.
+
+Here is a simple example of moving a vertex of the object named **Cube**:
+
+.. code-block:: python
+
+ import bpy
+ bpy.data.objects["Cube"].data.vertices[0].co.x += 1.0
+
+This modifies Blender's internal data directly. When you run this in the interactive console you will see the 3D viewport update.
+
+
+***********************
+The Default Environment
+***********************
+
+When developing your own scripts it may help to understand how blender sets up its python environment. Many python scripts come bundled with blender and can be used as a reference because they use the same API that script authors write tools in. Typical usage for scripts include: user interface, import/export, scene manipulation, automation, defining your own toolset and customization.
+
+On startup blender scans the ``scripts/startup/`` directory for python modules and imports them. The exact location of this directory depends on your installation. `See the directory layout docs <http://wiki.blender.org/index.php/Doc:2.5/Manual/Introduction/Installing_Blender/DirectoryLayout>`_
+
+
+**************
+Script Loading
+**************
+
+This may seem obvious but it's important to note the difference between executing a script directly or importing it as a module.
+
+Scripts that extend blender - define classes that exist beyond the scripts execution, this makes future access to these classes (to unregister for example) more difficult than importing as a module where class instance is kept in the module and can be accessed by importing that module later on.
+
+For this reason it's preferable to only use directly execute scripts that don't extend blender by registering classes.
+
+
+Here are some ways to run scripts directly in blender.
+
+* Loaded in the text editor and press **Run Script**.
+
+* Typed or pasted into the interactive console.
+
+* Execute a python file from the command line with blender, eg:
+
+ ``blender --python /home/me/my_script.py``
+
+
+To run as modules:
+
+* The obvious way, ``import some_module`` command from the text window or interactive console.
+
+* Open as a text block and tick "Register" option, this will load with the blend file.
+
+* copy into one of the directories ``scripts/startup``, where they will be automatically imported on startup.
+
+* define as an addon, enabling the addon will load it as a python module.
+
+
+======
+Addons
+======
+
+Some of blenders functionality is best kept optional, alongside scripts loaded at startup we have addons which are kept in their own directory ``scripts/addons``, and only load on startup if selected from the user preferences.
+
+The only difference between addons and built-in python modules is that addons must contain a **bl_info** variable which blender uses to read metadata such as name, author, category and URL.
+
+The user preferences addon listing uses **bl_info** to display information about each addon.
+
+`See Addons <http://wiki.blender.org/index.php/Dev:2.5/Py/Scripts/Guidelines/Addons>`_ for details on the **bl_info** dictionary.
+
+
+***************************
+Integration through Classes
+***************************
+
+Running python scripts in the text editor is useful for testing but you’ll want to extend blender to make tools accessible like other built-in functionality.
+
+The blender python api allows integration for:
+
+* :class:`bpy.types.Panel`
+
+* :class:`bpy.types.Menu`
+
+* :class:`bpy.types.Operator`
+
+* :class:`bpy.types.PropertyGroup`
+
+* :class:`bpy.types.KeyingSet`
+
+* :class:`bpy.types.RenderEngine`
+
+
+This is intentionally limited. Currently, for more advanced features such as mesh modifiers, object types, or shader nodes, C/C++ must be used.
+
+For python intergration Blender defines methods which are common to all types. This works by creating a python subclass of a Blender class which contains variables and functions specified by the parent class which are pre-defined to interface with Blender.
+
+For example:
+
+.. code-block:: python
+
+ import bpy
+ class SimpleOperator(bpy.types.Operator):
+ bl_idname = "object.simple_operator"
+ bl_label = "Tool Name"
+
+ def execute(self, context):
+ print("Hello World")
+ return {'FINISHED'}
+
+ bpy.utils.register_class(SimpleOperator)
+
+First note that we subclass a member of :mod:`bpy.types`, this is common for all classes which can be integrated with blender and used so we know if this is an Operator and not a Panel when registering.
+
+Both class properties start with a **bl_** prefix. This is a convention used to distinguish blender properties from those you add yourself.
+
+Next see the execute function, which takes an instance of the operator and the current context. A common prefix is not used for functions.
+
+Lastly the register function is called, this takes the class and loads it into blender. See `Class Registration`_.
+
+Regarding inheritance, blender doesn't impose restrictions on the kinds of class inheritance used, the registration checks will use attributes and functions defined in parent classes.
+
+class mix-in example:
+
+.. code-block:: python
+
+ import bpy
+ class BaseOperator:
+ def execute(self, context):
+ print("Hello World BaseClass")
+ return {'FINISHED'}
+
+ class SimpleOperator(bpy.types.Operator, BaseOperator):
+ bl_idname = "object.simple_operator"
+ bl_label = "Tool Name"
+
+ bpy.utils.register_class(SimpleOperator)
+
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list