diff options
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/python/api2_2x/doc/Camera.py | 12 | ||||
-rw-r--r-- | source/blender/python/api2_2x/doc/Curve.py | 79 | ||||
-rw-r--r-- | source/blender/python/api2_2x/doc/Effect.py | 10 | ||||
-rw-r--r-- | source/blender/python/api2_2x/doc/Geometry.py | 5 | ||||
-rw-r--r-- | source/blender/python/api2_2x/doc/Lamp.py | 6 | ||||
-rw-r--r-- | source/blender/python/api2_2x/doc/Lattice.py | 13 | ||||
-rw-r--r-- | source/blender/python/api2_2x/doc/Mesh.py | 7 | ||||
-rw-r--r-- | source/blender/python/api2_2x/doc/Modifier.py | 6 | ||||
-rw-r--r-- | source/blender/python/api2_2x/doc/Object.py | 26 | ||||
-rw-r--r-- | source/blender/python/api2_2x/doc/Scene.py | 1 | ||||
-rw-r--r-- | source/blender/python/api2_2x/doc/Text3d.py | 7 |
11 files changed, 76 insertions, 96 deletions
diff --git a/source/blender/python/api2_2x/doc/Camera.py b/source/blender/python/api2_2x/doc/Camera.py index 0ced68670c4..9f384a797bc 100644 --- a/source/blender/python/api2_2x/doc/Camera.py +++ b/source/blender/python/api2_2x/doc/Camera.py @@ -13,13 +13,11 @@ This module provides access to B{Camera Data} objects in Blender. Example:: from Blender import Camera, Object, Scene - c = Camera.New('ortho') # create new ortho camera data - c.scale = 6.0 # set scale value - cur = Scene.GetCurrent() # get current scene - ob = Object.New('Camera') # make camera object - ob.link(c) # link camera data with this object - cur.link(ob) # link object into scene - cur.setCurrentCamera(ob) # make this camera the active" + cam = Camera.New('ortho') # create new ortho camera data + cam.scale = 6.0 # set scale value for ortho view + scn = Scene.GetCurrent() # get current scene + ob = scn.objects.new(cam) # add a new camera object from the data + cur.setCurrentCamera(ob) # make this camera the active """ def New (type = 'persp', name = 'CamData'): diff --git a/source/blender/python/api2_2x/doc/Curve.py b/source/blender/python/api2_2x/doc/Curve.py index 78dcd87aaff..cc1b1647d50 100644 --- a/source/blender/python/api2_2x/doc/Curve.py +++ b/source/blender/python/api2_2x/doc/Curve.py @@ -8,29 +8,31 @@ Curve Data This module provides access to B{Curve Data} objects in Blender. -A Blender Curve can consist of multiple curves. Try converting a Text object to a Curve to see an example of this. Each curve is of -type Bezier or Nurb. The underlying curves can be accessed with -the [] operator. Operator [] returns an object of type CurNurb. +A Blender Curve Data consists of multiple L{CurNurb}(s). Try converting a Text object to a Curve to see an example of this. Each curve is of +type Bezier or Nurb. The underlying L{CurNurb}(s) can be accessed with +the [] operator. Operator [] returns an object of type L{CurNurb}. + +Note that L{CurNurb} can be used to acces a curve of any type (Poly, Bezier or Nurb) The Curve module also supports the Python iterator interface. This means you -can access the curves in a Curve and the control points in a CurNurb using a +can access the L{CurNurb}(s) in a Curve and the control points in a L{CurNurb} using a Python B{for} statement. Add a Curve to a Scene Example:: from Blender import Curve, Object, Scene - c = Curve.New() # create new curve data - cur = Scene.getCurrent() # get current scene - ob = Object.New('Curve') # make curve object - ob.link(c) # link curve data with this object - cur.link(ob) # link object into scene + cu = Curve.New() # create new curve data + scn = Scene.GetCurrent() # get current scene + ob = scn.objects.new(cu) # make a new curve from the curve data Iterator Example:: - ob = Object.GetSelected()[0] - curve = ob.getData() - for cur in curve: - print type( cur ), cur - for point in cur: + from Blender import Curve, Object, Scene + scn = Scene.GetCurrent() # get current scene + ob = scn.objects.active + curvedata = ob.data + for curnurb in curvedata: + print type( curnurb ), curnurb + for point in curnurb: print type( point ), point Creating a Curve from a list of Vec triples Examples:: @@ -67,11 +69,8 @@ Creating a Curve from a list of Vec triples Examples:: i+=1 # Add the Curve into the scene - ob= Object.New('Curve') - ob.link(cu) scn= Scene.GetCurrent() - scn.link(ob) - ob.Layers= scn.Layers + ob = scn.objects.new(cu) return ob """ @@ -99,24 +98,24 @@ class Curve: """ The Curve Data object ===================== - This object gives access to Curve-specific data in Blender. + This object gives access to Curve and Surface data linked from Blender Objects. @ivar name: The Curve Data name. @type name: string - @ivar pathlen: The Curve Data path length. + @ivar pathlen: The Curve Data path length, used to set the number of frames for an animation (not the physical length). @type pathlen: int @ivar totcol: The Curve Data maximal number of linked materials. Read-only. @type totcol: int @ivar flag: The Curve Data flag value; see L{getFlag()} for the semantics. - @ivar bevresol: The Curve Data bevel resolution. - @type bevresol: float - @ivar resolu: The Curve Data U-resolution. - @type resolu: float - @ivar resolv: The Curve Data V-resolution. - @type resolv: float - @ivar width: The Curve Data width. + @ivar bevresol: The Curve Data bevel resolution. [0 - 32] + @type bevresol: int + @ivar resolu: The Curve Data U-resolution (used for curve and surface resolution) [0 - 1024]. + @type resolu: int + @ivar resolv: The Curve Data V-resolution (used for surface resolution) [0 - 1024]. + @type resolv: int + @ivar width: The Curve Data width [0 - 2]. @type width: float - @ivar ext1: The Curve Data extent 1(for bevels). + @ivar ext1: The Curve Data extent1 (for bevels). @type ext1: float @ivar ext2: The Curve Data extent2 (for bevels). @type ext2: float @@ -157,7 +156,7 @@ class Curve: def getPathLen(): """ - Get this Curve's path length. + Get this Curve's path frame length, used for an animated path. @rtype: int @return: the path length. """ @@ -233,7 +232,8 @@ class Curve: def setResolu(resolu): """ - Set the Curve's U-resolution value. + Set the Curve's U-resolution value. [0 - 1024] + This is used for surfaces and curves. @rtype: None @type resolu: float @param resolu: The new Curve's U-resolution value. @@ -247,7 +247,8 @@ class Curve: def setResolv(resolv): """ - Set the Curve's V-resolution value. + Set the Curve's V-resolution value. [0 - 1024]. + This is used for surfaces only. @rtype: None @type resolv: float @param resolv: The new Curve's V-resolution value. @@ -520,12 +521,14 @@ class CurNurb: """ The CurNurb Object ================== - This object provides access to the control points of the curves that make up a Blender Curve. + This object provides access to the control points of the curves that make up a Blender Curve ObData. The CurNurb supports the python iterator protocol which means you can use a python for statement to access the points in a curve. The CurNurb also supports the sequence protocol which means you can access the control points of a CurNurb using the [] operator. + Note that CurNurb is used for accesing poly, bezier and nurbs type curves. + @ivar flagU: The CurNurb knot flag U. See L{setFlagU} for description. @type flagU: int @ivar flagV: The CurNurb knot flag V. See L{setFlagU} for description. @@ -533,10 +536,10 @@ class CurNurb: @ivar type: The type of the curve (Poly: 0, Bezier: 1, NURBS: 4) @type type: int """ - + def __setitem__( n, point ): """ - Replace the Nth point in the curve. The type of the argument must match the type of the curve. List of 4 floats (optional 5th float is the tilt value in radians) for Nurbs or BezTriple for Bezier. + Replace the Nth point in the curve. The type of the argument must match the type of the curve. List of 4 floats (optional 5th float is the tilt value in radians) for Nurbs or BezTriple for Bezier. @rtype: None @return: None @type n: integer @@ -547,7 +550,7 @@ class CurNurb: def __getitem__( n ): """ - Get the Nth element in the curve. For Bezier curves, that element is a BezTriple. For the rest (Poly and Nurbs), it is a list of 5 floats: x, y, z, weight, tilt (in radians). NOTE 1: This element is independent on the curve, modifying it will not affect the curve. NOTE 2: Each successive call returns a new object. + Get the Nth element in the curve. For Bezier curves, that element is a BezTriple. For the rest (Poly and Nurbs), it is a list of 5 floats: x, y, z, weight, tilt (in radians). NOTE 1: This element is independent on the curve, modifying it will not affect the curve. NOTE 2: Each successive call returns a new object. @rtype: BezTriple (Bezier Curve) or List of 5 floats [x, y, z, w, t] for Poly or Nurbs @return: The Nth element in the curve @type n: integer @@ -591,7 +594,7 @@ class CurNurb: Boolean method checks whether a CurNurb is cyclic (a closed curve) or not. @rtype: boolean @return: True or False - """ + """ def getFlagU(): """ @@ -685,7 +688,7 @@ class SurfNurb: def __setitem__( n, point ): """ - Set the Nth control point in the surface. + Set the Nth control point in the surface. @rtype: None @return: None @type n: integer @@ -699,7 +702,7 @@ class SurfNurb: def __getitem__( n ): """ - Get the Nth control point in the surface. + Get the Nth control point in the surface. @rtype: List of 5 floats [x, y, z, w, t] for Poly or Nurbs @return: The Nth point in the curve @type n: integer diff --git a/source/blender/python/api2_2x/doc/Effect.py b/source/blender/python/api2_2x/doc/Effect.py index 6ad8de7138a..70f4287ae36 100644 --- a/source/blender/python/api2_2x/doc/Effect.py +++ b/source/blender/python/api2_2x/doc/Effect.py @@ -557,16 +557,14 @@ class Effect: # Check that particles are points only (not static and not vectors) if not effect.getFlag() & Effect.Flags.STATIC or not effect.getStype(): for pt in particles: - ob_empty= Object.New('Empty') + ob_empty= scn.objects.new('Empty') ob_empty.setLocation(pt) - scn.link(ob_empty) else: # Particles will be a list for pt in particles: for pt_item in pt: - ob_empty= Object.New('Empty') + ob_empty= scn.objects.new('Empty') ob_empty.setLocation(pt_item) - scn.link(ob_empty) Example:: # Converts particles into a mesh with edges for strands @@ -588,7 +586,5 @@ class Effect: me.edges.extend( edges ) print len(me.verts) - ob= Object.New('Mesh') - ob.link(me) - scn.link(ob) + ob= scn.objects.new(me) """ diff --git a/source/blender/python/api2_2x/doc/Geometry.py b/source/blender/python/api2_2x/doc/Geometry.py index 733569cfe76..bff5f677f5b 100644 --- a/source/blender/python/api2_2x/doc/Geometry.py +++ b/source/blender/python/api2_2x/doc/Geometry.py @@ -36,11 +36,8 @@ def PolyFill(polylines): me.verts.extend(polyline2) me.faces.extend(fill) # Add the faces, they reference the verts in polyline 1 and 2 - ob= Blender.Object.New('Mesh') - ob.link(me) scn = Blender.Scene.GetCurrent() - scn.link(ob) - + ob = scn.objects.new(me) Blender.Redraw() """ diff --git a/source/blender/python/api2_2x/doc/Lamp.py b/source/blender/python/api2_2x/doc/Lamp.py index 7f509ec2e45..865cf7a152f 100644 --- a/source/blender/python/api2_2x/doc/Lamp.py +++ b/source/blender/python/api2_2x/doc/Lamp.py @@ -12,11 +12,11 @@ This module provides control over B{Lamp Data} objects in Blender. Example:: - from Blender import Lamp + from Blender import Lamp, Scene l = Lamp.New('Spot') # create new 'Spot' lamp data l.setMode('Square', 'Shadow') # set these two lamp mode flags - ob = Object.New('Lamp') # create new lamp object - ob.link(l) # link lamp obj with lamp data + scn = Scene.GetCurrent() + ob = scn.objects.new(l) @type Types: read-only dictionary @var Types: The lamp types. diff --git a/source/blender/python/api2_2x/doc/Lattice.py b/source/blender/python/api2_2x/doc/Lattice.py index f6b84746950..309e54a5f92 100644 --- a/source/blender/python/api2_2x/doc/Lattice.py +++ b/source/blender/python/api2_2x/doc/Lattice.py @@ -13,7 +13,6 @@ Example:: from Blender import Lattice, Object, Scene, Modifier # Make new lattice data - ob_lattice = Object.New('Lattice') lattice_data = Lattice.New() lattice_data.setPartitions(5,5,5) lattice_data.setKeyTypes(Lattice.LINEAR, Lattice.CARDINAL, Lattice.BSPLINE) @@ -25,16 +24,14 @@ Example:: co2 = vec[1] - vec[2] * 0.3 co3 = vec[2] * 3 lattice_data.setPoint(y,[co1,co2,co3]) - - # Link the data to an object - ob_lattice.link(lattice_data) - + + # Create a new object from the lattice in the current scene + scn = Scene.GetCurrent() + ob_lattice = scn.objects.new(lattice_data) + # Get an object to deform with this lattice mySphere = Object.Get('Sphere') - scn = Scene.getCurrent() - scn.link(ob_lattice) - # Apply lattice modifier mod= mySphere.modifiers.append(Modifier.Type.LATTICE) mod[Modifier.Settings.OBJECT] = ob_lattice diff --git a/source/blender/python/api2_2x/doc/Mesh.py b/source/blender/python/api2_2x/doc/Mesh.py index 663d618b35b..884821758b4 100644 --- a/source/blender/python/api2_2x/doc/Mesh.py +++ b/source/blender/python/api2_2x/doc/Mesh.py @@ -36,11 +36,8 @@ Example:: me.faces[1].col[1].g = 255 me.faces[1].col[2].b = 255 - ob = Object.New('Mesh','myObj') # link mesh to an object - ob.link(me) - - sc = Scene.GetCurrent() # link object to current scene - sc.link(ob) + scn = Scene.GetCurrent() # link object to current scene + ob = scn.objects.new(me, 'myObj') if editmode: Window.EditMode(1) # optional, just being nice diff --git a/source/blender/python/api2_2x/doc/Modifier.py b/source/blender/python/api2_2x/doc/Modifier.py index 8d52be8243b..5425f31d7c7 100644 --- a/source/blender/python/api2_2x/doc/Modifier.py +++ b/source/blender/python/api2_2x/doc/Modifier.py @@ -46,7 +46,7 @@ Example:: @type Types: readonly dictionary -@var Types: Constant Modifier dict used for L{ModSeq.append()} to a +@var Types: Constant Modifier dict used for L{ModSeq.append} to a modifier sequence and comparing with L{Modifier.type}: - ARMATURE - type value for Armature modifiers - BOOLEAN - type value for Boolean modifiers @@ -137,7 +137,7 @@ class ModSeq: def append(type): """ Appends a new modifier to the end of the object's modifier stack. - @type type: a constant specifying the type of modifier to create. as from L{Type} + @type type: a constant specifying the type of modifier to create. as from L{Types} @rtype: Modifier @return: the new Modifier """ @@ -178,7 +178,7 @@ class Modifier: @ivar name: The name of this modifier. 31 chars max. @type name: string @ivar type: The type of this modifier. Read-only. The returned value - matches the types in L{Type}. + matches the types in L{Types}. @type type: int """ diff --git a/source/blender/python/api2_2x/doc/Object.py b/source/blender/python/api2_2x/doc/Object.py index 2782a40bb07..1b035e1f2c8 100644 --- a/source/blender/python/api2_2x/doc/Object.py +++ b/source/blender/python/api2_2x/doc/Object.py @@ -26,11 +26,9 @@ This module provides access to the B{Objects} in Blender. Example:: import Blender - scene = Blender.Scene.getCurrent () # get the current scene - ob = Blender.Object.New ('Camera') # make camera object - cam = Blender.Camera.New ('ortho') # make ortho camera data object - ob.link (cam) # link camera data with the object - scene.link (ob) # link the object into the scene + scn = Blender.Scene.GetCurrent() # get the current scene + cam = Blender.Camera.New('ortho') # make ortho camera data object + ob = scn.objects.new(cam) # make a new object in this scene using the camera data ob.setLocation (0.0, -5.0, 1.0) # position the object in the scene Blender.Redraw() # redraw the scene to show the updates. @@ -223,17 +221,16 @@ def Duplicate (mesh=0, surface=0, curve=0, text=0, metaball=0, armature=0, lamp= import Blender scn = Scene.GetCurrent() - activeObject = scn.getActiveObject() + ob_act = scn.objects.active # Unselect all - for ob in Blender.Object.GetSelected(): - ob.sel = 0 - activeObject.sel = 1 + scn.objects.selected = [] + ob_act.sel = 1 for x in xrange(10): Blender.Object.Duplicate() # Duplicate linked - activeObject = scn.getActiveObject() - activeObject.LocX += 1 + ob_act = scn.objects.active + ob_act.LocX += 1 Blender.Redraw() """ @@ -400,8 +397,7 @@ class Object: scn= Scene.GetCurrent() for dupe_ob, dupe_matrix in dupe_obs: print dupe_ob.name - empty_ob= Object.New('Empty') - scn.link(empty_ob) + empty_ob = scn.objects.new('Empty') empty_ob.setMatrix(dupe_matrix) Blender.Redraw() @type DupObjects: list of tuples containing (object, matrix) @@ -1193,8 +1189,8 @@ class Object: Example:: import Blender - scene = Blender.Scene.GetCurrent() - object = scene.getActiveObject() + scn = Blender.Scene.GetCurrent() + object = scn.objects.active object.modifiers.append(Blender.Modifier.Type.SUBSURF) object.makeDisplayList() Blender.Window.RedrawAll() diff --git a/source/blender/python/api2_2x/doc/Scene.py b/source/blender/python/api2_2x/doc/Scene.py index af747b217cc..7276c035e85 100644 --- a/source/blender/python/api2_2x/doc/Scene.py +++ b/source/blender/python/api2_2x/doc/Scene.py @@ -7,7 +7,6 @@ B{New}: - L{Scene.clearScriptLinks<Scene.Scene.clearScriptLinks>} accepts a parameter now. - acess methods L{Scene.getLayers<Scene.Scene.getLayers>}, L{Scene.setLayers<Scene.Scene.setLayers>} via lists to complement the layers and Layers Scene attributes which use bitmasks. - - L{Scene.getActiveObject<Scene.Scene.getActiveObject>} method. Scene ===== diff --git a/source/blender/python/api2_2x/doc/Text3d.py b/source/blender/python/api2_2x/doc/Text3d.py index d77aae45a4a..fc4815ba057 100644 --- a/source/blender/python/api2_2x/doc/Text3d.py +++ b/source/blender/python/api2_2x/doc/Text3d.py @@ -11,12 +11,9 @@ This module provides access to B{Font} objects in Blender. Example:: import Blender from Blender import Curve, Object, Scene, Text3d - # txt = Text3d.New("MyText") # create a new Text3d object called MyText - cur = Scene.getCurrent() # get current scene - ob = Object.New('Text') # make curve object - ob.link(txt) # link curve data with this object - cur.link(ob) # link object into scene + scn = Scene.GetCurrent() # get current scene + ob = scn.objects.new(txt) # create an object from the obdata in the current scene ob.makeDisplayList() # rebuild the display list for this object Window.RedrawAll() """ |