Added Group to Blender.Types, tested and working.
Added Group Epydocs, with 2 examples. also added http://en.wikibooks.org/wiki/Blender_3D:_Blending_Into_Python to the blender links main page.
This commit is contained in:
@@ -322,7 +322,7 @@ PyObject *M_Group_New( PyObject * self, PyObject * args )
|
||||
|
||||
if( !PyArg_ParseTuple( args, "|s", &name ) )
|
||||
return EXPP_ReturnPyObjError( PyExc_TypeError,
|
||||
"string expected as argument" );
|
||||
"string expected as argument or nothing" );
|
||||
|
||||
bl_group= add_group();
|
||||
|
||||
|
||||
@@ -50,6 +50,7 @@ extern PyTypeObject NMFace_Type, NMVert_Type, NMCol_Type, NMesh_Type;
|
||||
extern PyTypeObject MFace_Type, MVert_Type, PVert_Type, MEdge_Type, MCol_Type,
|
||||
Mesh_Type;
|
||||
extern PyTypeObject Object_Type;
|
||||
extern PyTypeObject Group_Type;
|
||||
extern PyTypeObject Particle_Type;
|
||||
extern PyTypeObject Scene_Type, RenderData_Type;
|
||||
extern PyTypeObject Text_Type, Text3d_Type, Texture_Type;
|
||||
@@ -104,6 +105,7 @@ void types_InitAll( void )
|
||||
MCol_Type.ob_type = &PyType_Type;
|
||||
Mesh_Type.ob_type = &PyType_Type;
|
||||
Object_Type.ob_type = &PyType_Type;
|
||||
Group_Type.ob_type = &PyType_Type;
|
||||
RenderData_Type.ob_type = &PyType_Type;
|
||||
Scene_Type.ob_type = &PyType_Type;
|
||||
Text_Type.ob_type = &PyType_Type;
|
||||
@@ -140,6 +142,9 @@ PyObject *Types_Init( void )
|
||||
|
||||
/* Blender Object Data Types */
|
||||
|
||||
PyDict_SetItemString( dict, "GroupType",
|
||||
( PyObject * ) &Group_Type );
|
||||
|
||||
PyDict_SetItemString( dict, "SceneType", ( PyObject * ) &Scene_Type );
|
||||
PyDict_SetItemString( dict, "RenderDataType",
|
||||
( PyObject * ) &RenderData_Type );
|
||||
|
||||
@@ -20,6 +20,7 @@ The Blender Python API Reference
|
||||
- L{Curve}
|
||||
- L{Draw}
|
||||
- L{Effect}
|
||||
- L{Group} (*)
|
||||
- L{Image}
|
||||
- L{Ipo}
|
||||
- L{Key} (*)
|
||||
@@ -56,7 +57,7 @@ The Blender Python API Reference
|
||||
- L{Special features<API_related>}:
|
||||
- scripts: registering in menus, documenting, configuring (new);
|
||||
- command line examples (new);
|
||||
- script links (*), space handler script links (new).
|
||||
- script links (*), space handler script links, Group module (new).
|
||||
|
||||
Introduction:
|
||||
=============
|
||||
@@ -222,6 +223,7 @@ A note to newbie script writers:
|
||||
@see: U{blender architecture<http://www.blender3d.org/cms/Blender_Architecture.336.0.html>}: blender architecture document
|
||||
@see: U{www.python.org<http://www.python.org>}
|
||||
@see: U{www.python.org/doc<http://www.python.org/doc>}
|
||||
@see: U{en.wikibooks.org/wiki/Blender_3D:_Blending_Into_Python>}: User contributed documentation, featuring a blender/python cookbook with many examples.
|
||||
@note: this documentation was generated by epydoc, which can output html and
|
||||
pdf. For pdf it requires a working LaTeX environment.
|
||||
|
||||
|
||||
97
source/blender/python/api2_2x/doc/Group.py
Normal file
97
source/blender/python/api2_2x/doc/Group.py
Normal file
@@ -0,0 +1,97 @@
|
||||
# Blender.Group module and the Group PyType object
|
||||
|
||||
"""
|
||||
The Blender.Group submodule.
|
||||
|
||||
Group
|
||||
=====
|
||||
|
||||
This module provides access to B{Group} data in Blender.
|
||||
|
||||
Example::
|
||||
|
||||
# Make Dupli's Real, as a python script.
|
||||
|
||||
from Blender import *
|
||||
|
||||
scn= Scene.GetCurrent()
|
||||
for ob in Object.GetSelected():
|
||||
print 'Object Group Settings'
|
||||
print ob.name, ob.getType()
|
||||
print 'enableDupVerts:', ob.enableDupVerts
|
||||
print 'enableDupFrames:', ob.enableDupFrames
|
||||
print 'enableDupGroup:', ob.enableDupGroup
|
||||
print 'DupGroup:', ob.DupGroup
|
||||
dupe_obs= ob.DupObjects
|
||||
print 'num dup obs:', len(dupe_obs)
|
||||
|
||||
for dup_ob, dup_matrix in dupe_obs:
|
||||
print '\tDupOb', dup_ob.name
|
||||
new_ob= Object.New(dup_ob.getType())
|
||||
new_ob.shareFrom(dup_ob)
|
||||
scn.link(new_ob)
|
||||
new_ob.setMatrix(dup_matrix)
|
||||
new_ob.sel= 1 # select all real instances.
|
||||
|
||||
ob.sel=0 # Desel the original object
|
||||
|
||||
Window.RedrawAll()
|
||||
|
||||
Example::
|
||||
|
||||
# Make a new group with the selected objects, and add an instance of this group.
|
||||
|
||||
from Blender import *
|
||||
|
||||
scn= Scene.GetCurrent()
|
||||
|
||||
# New Group
|
||||
gp= Group.New('mygroup')
|
||||
gp.objects= Object.GetSelected()
|
||||
|
||||
# Instance the group at an empty using dupligroups
|
||||
ob= Object.New('Empty')
|
||||
scn.link(ob)
|
||||
ob.enableDupGroup= True
|
||||
ob.DupGroup= gp
|
||||
Window.RedrawAll()
|
||||
"""
|
||||
|
||||
def New (name = None):
|
||||
"""
|
||||
Make a new empty group, name optional, default is "Group"
|
||||
@type name: string
|
||||
@param name: The name of the new group.
|
||||
@rtype: Blender Group
|
||||
@return: A Empty Blender Group object
|
||||
"""
|
||||
|
||||
def Get (name = None):
|
||||
"""
|
||||
Get the Group object(s) from Blender.
|
||||
@type name: string
|
||||
@param name: The name of the Group object.
|
||||
@rtype: Blender Group or a list of Blender Groups
|
||||
@return: It depends on the I{name} parameter:
|
||||
- (name): The Group object called I{name}, Exception if it is not found.
|
||||
- (): A list with all Group objects in the current blend file.
|
||||
"""
|
||||
|
||||
def Unlink (group):
|
||||
"""
|
||||
Unlink (delete) this group from Blender.
|
||||
@type group: group
|
||||
@param group: A group to remove from this blend file, does not remove objects that this group uses.
|
||||
"""
|
||||
|
||||
|
||||
class Group:
|
||||
"""
|
||||
The Group object
|
||||
================
|
||||
This object gives access to Groups in Blender.
|
||||
@ivar name: The name of this Group object.
|
||||
@ivar users: Number of users this group has (read only)
|
||||
@ivar objects: Objects that this group uses. This is an iterator with list like access so use list(gp.objects) if you need to use a list). where gp is a group object.
|
||||
"""
|
||||
|
||||
@@ -27,6 +27,7 @@ Example::
|
||||
|
||||
@var ObjectType: Blender Object. The base object, linked to its specific data
|
||||
at its .data member variable.
|
||||
@var GroupType: Blender Group. A Group that references a list of objects that are a part of this group.
|
||||
@var NMeshType: Blender NMesh. The mesh structure.
|
||||
@var NMFaceType: Blender NMFace. A mesh face, with one (a point), two (an edge),
|
||||
three (a triangular face) or four (a quad face) vertices.
|
||||
|
||||
Reference in New Issue
Block a user