「Dev:Ref/Release Notes/2.60/Python」の版間の差分

提供: wiki
移動先: 案内検索
(相違点なし)

2012年5月20日 (日) 21:45時点における版

Blender 2.60 Python Updates

Callbacks

Various callbacks, to replace scriptlinks as existed in 2.4x. Example on how to use:

def stats_call(context):
    print("Thanks for calling!")
bpy.app.handlers.render_stats.append(stats_call)
bpy.ops.render.render(animation=False, write_still=True)

Currently available callbacks:

  • frame_change_pre, frame_change_post
  • render_pre, render_post
  • render_stats
  • load_pre, load_post
  • save_pre, save_post

GLSL Shader Export

New gpu module with export_shader(scene, material) function to export GLSL shader. This returns the GLSL shader that blender generates to produce the visual effect of material in scene for the purpose of reusing the shader in an external engine. This function is meant to be used in a material exporter so that the GLSL shader can be exported entirely. The return value is a dictionary containing the shader source code and all associated data. (TODO documentation link goes here)

Various

  • Modified behavior of Vector() * Matrix() multiplication, this is now implemented as (row * vector) multiplication - r39445, r40360
  • bpy.types as a module for convenient imports - r39324
    • Example: from bpy.types import Menu
  • Object.matrix_parent_inverse, inverse of object's parent matrix at time of parenting - r39424
  • bpy_extra.io_utils.unique_name() optional argument to specify separator string - r39406
  • Environment map texture is_valid property, clear and save (with configurable layout) functions: - r39760
  • Texture evaluation function - r39963
    • Example: red, green, blue, intensity = texture.evaluate(vec)
  • Image.pack()/unpack() functions - r40324
  • Enum properties can now manually specify a unique id for each item - r40649
  • Camera.view_frame(scene) function - r40684
  • Object data material assignment - r40735
    • Example: object.data.materials[0] = bpy.data.materials["SomeMaterial"]