- NMesh: made nmesh.update accept an optional 'vertex_shade' param to init vcols with shading info, like when you enter vpaint mode or press the relevant "make" button for a mesh without vcols.  This is still a test, the functionality was requested by Manuel Bastioni for the SSS script they are working on:
http://www.dedalo-3d.com/index.php?filename=SXCOL/makehuman/articles/subsurface_scattering_in_python.html
- sys: made makename() accept files with max FILE_MAXDIR+FILE_MAXFILE name length, should fix #2192.  Was only FILE_MAXFILE, a mistake;
- Image: added .setFilename(), contributed by Campbell Barton;
- Camera: added camera.get/setScale for the new param added by Ton for ortho cameras.  Requested by Jean-Michel Soler for the Texture Baker script;
- related doc updates.
This commit is contained in:
2005-02-09 05:19:24 +00:00
parent 955d5aa6eb
commit 05bf482f6a
12 changed files with 201 additions and 53 deletions

View File

@@ -15,8 +15,8 @@ The Blender Python API Reference
- L{Bone}
- L{NLA}
- L{BGL}
- L{Camera}
- L{Curve}
- L{Camera} (*)
- L{Curve} (*)
- L{Draw}
- L{Effect}
- L{Image} (*)
@@ -25,11 +25,11 @@ The Blender Python API Reference
- L{Lattice}
- L{Library}
- L{Material}
- L{Mathutils}
- L{Mathutils} (*)
- L{Metaball}
- L{NMesh}
- L{NMesh} (*)
- L{Noise}
- L{Object}
- L{Object} (*)
- L{Registry}
- L{Scene}
- L{Radio}

View File

@@ -3,7 +3,7 @@
"""
The Blender.Camera submodule.
B{New}: scriptLink methods: L{Camera.getScriptLinks}, ...
B{New}: L{Camera.getScale}, L{Camera.setScale} for ortho cameras.
Camera Data
===========
@@ -14,7 +14,7 @@ Example::
from Blender import Camera, Object, Scene
c = Camera.New('ortho') # create new ortho camera data
c.lens = 35.0 # set lens value
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
@@ -52,7 +52,10 @@ class Camera:
@cvar name: The Camera Data name.
@cvar type: The Camera type: 'persp':0 or 'ortho':1.
@cvar mode: The mode flags: B{or'ed value}: 'showLimits':1, 'showMist':2.
@cvar lens: The lens value in [1.0, 250.0].
@cvar lens: The lens value in [1.0, 250.0], only relevant to *persp*
cameras.
@cvar scale: The scale value in [0.01, 1000.00], only relevant to *ortho*
cameras.
@cvar clipStart: The clip start value in [0.0, 100.0].
@cvar clipEnd: The clip end value in [1.0, 5000.0].
@cvar drawSize: The draw size value in [0.1, 10.0].
@@ -133,6 +136,7 @@ class Camera:
"""
Get the lens value.
@rtype: float
@warn: lens is only relevant for perspective (L{getType}) cameras.
"""
def setLens(lens):
@@ -140,6 +144,22 @@ class Camera:
Set the lens value.
@type lens: float
@param lens: The new lens value.
@warn: lens is only relevant for perspective (L{getType}) cameras.
"""
def getScale():
"""
Get the scale value.
@rtype: float
@warn: scale is only relevant for ortho (L{getType}) cameras.
"""
def setScale(scale):
"""
Set the scale value.
@type scale: float
@param scale: The new scale value in [0.01, 1000.00].
@warn: scale is only relevant for ortho (L{getType}) cameras.
"""
def getClipStart():

View File

@@ -6,7 +6,7 @@ The Blender.Image submodule.
Image
=====
B{New}: L{Image.glLoad}, L{Image.glFree}.
B{New}: L{Image.setFilename}.
This module provides access to B{Image} objects in Blender.
@@ -155,6 +155,15 @@ class Image:
@param name: The new name.
"""
def setFilename(name):
"""
Change the filename of this Image object.
@type name: string
@param name: The new full filename.
@warn: use this with caution and note that the filename is truncated if
larger than 160 characters.
"""
def setXRep(xrep):
"""
Texture tiling: set the number of x repetitions for this Image.

View File

@@ -3,7 +3,8 @@
"""
The Blender.NMesh submodule.
B{New}: L{NMesh.getMaterials}, L{NMesh.setMaterials}.
B{New}: edges class (L{NMEdge}) and nmesh methods (L{NMesh.addEdge},
L{NMesh.addEdgesData}, etc.); new optional arguments to L{NMesh.update}.
Mesh Data
=========
@@ -13,8 +14,11 @@ This module provides access to B{Mesh Data} objects in Blender.
Example::
import Blender
from Blender import NMesh, Material
#
from Blender import NMesh, Material, Window
editmode = Window.EditMode() # are we in edit mode? If so ...
if editmode: Window.EditMode(0) # leave edit mode before getting the mesh
me = NMesh.GetRaw("Plane") # get the mesh data called "Plane"
if not me.materials: # if there are no materials ...
@@ -30,6 +34,8 @@ Example::
v.co[2] *= 2.5
me.update() # update the real mesh in Blender
if editmode: Window.EditMode(1) # optional, just being nice
@type Modes: readonly dictionary
@type FaceFlags: readonly dictionary
@type FaceModes: readonly dictionary
@@ -532,16 +538,28 @@ class NMesh:
add them.
"""
def update(recalc_normals = 0, store_edges = 0):
def update(recalc_normals = 0, store_edges = 0, vertex_shade = 0):
"""
Update the mesh in Blender. The changes made are put back to the mesh in
Blender, if available, or put in a newly created mesh object if this NMesh
wasn't already linked to one.
@type recalc_normals: int
@param recalc_normals: If given and equal to 1, the vertex normals are
recalculated.
@type store_edges: int
@param store_edges: if not 0, then edge data are stored.
@type recalc_normals: int (bool)
@param recalc_normals: if nonzero the vertex normals are recalculated.
@type store_edges: int (bool)
@param store_edges: if nonzero, then edge data is stored.
@type vertex_shade: int (bool)
@param vertex_shade: if nonzero vertices are colored based on the
current lighting setup. To use it, be out of edit mode or else
an error will be returned.
@warn: edit mesh and normal mesh are two different structures in Blender,
synchronized upon leaving or entering edit mode. Always remember to
leave edit mode (L{Window.EditMode}) before calling this update
method, or your changes will be lost. Even better: for the same reason
programmers should leave EditMode B{before} getting a mesh, or changes
made to the editmesh in Blender may not be visible to your script
(check the example at the top of NMesh module doc).
@note: this method also redraws the 3d view and -- if 'vertex_shade' is
nonzero -- the edit buttons window.
@note: if your mesh disappears after it's updated, try
L{Object.Object.makeDisplayList}. 'Subsurf' meshes (see L{getMode},
L{setMode}) need their display lists updated, too.

View File

@@ -186,16 +186,16 @@ class Object:
other value, or no value at all will update the scene hierarchy.
"""
def getData(only_name = False):
def getData(name_only = False):
"""
Returns the Datablock object (new: or just its name) containing the
object's data. For example the Mesh, Lamp or the Camera.
@type only_name: bool
@param only_name: if True on nonzero, only the name of the data object
@type name_only: bool
@param name_only: if True on nonzero, only the name of the data object
is returned.
@rtype: Object type specific or string
@return: Depending on the type of the Object, it returns a specific object
for the data requested. If only_name is True, it returns a string.
for the data requested. If name_only is True, it returns a string.
"""
def getDeltaLocation():