Exppython:
- More documentation files for epydoc. - Few minor changes in other files.
This commit is contained in:
76
source/blender/python/api2_2x/doc/Armature.py
Normal file
76
source/blender/python/api2_2x/doc/Armature.py
Normal file
@@ -0,0 +1,76 @@
|
||||
# Blender.Armature module and the Armature PyType object
|
||||
|
||||
"""
|
||||
The Blender.Armature submodule.
|
||||
|
||||
Armature
|
||||
========
|
||||
|
||||
This module provides access to B{Armature} objects in Blender. These are
|
||||
"skeletons", used to deform and animate other objects -- meshes, for
|
||||
example.
|
||||
|
||||
Example::
|
||||
import Blender
|
||||
from Blender import Armature
|
||||
#
|
||||
armatures = Armature.Get()
|
||||
for a in armatures:
|
||||
print "Armature ", a
|
||||
print "- The root bones of %s: %s" % (a.name, a.getBones())
|
||||
"""
|
||||
|
||||
def New (name = 'ArmatureData'):
|
||||
"""
|
||||
Create a new Armature object.
|
||||
@type name: string
|
||||
@param name: The Armature name.
|
||||
@rtype: Blender Armature
|
||||
@return: The created Armature object.
|
||||
"""
|
||||
|
||||
def Get (name = None):
|
||||
"""
|
||||
Get the Armature object(s) from Blender.
|
||||
@type name: string
|
||||
@param name: The name of the Armature.
|
||||
@rtype: Blender Armature or a list of Blender Armatures
|
||||
@return: It depends on the I{name} parameter:
|
||||
- (name): The Armature object with the given I{name};
|
||||
- (): A list with all Armature objects in the current scene.
|
||||
"""
|
||||
|
||||
class Armature:
|
||||
"""
|
||||
The Armature object
|
||||
===================
|
||||
This object gives access to Armature-specific data in Blender.
|
||||
@cvar name: The Armature name.
|
||||
@cvar bones: The Armature root bones (cannot be set yet).
|
||||
"""
|
||||
|
||||
def getName():
|
||||
"""
|
||||
Get the name of this Armature object.
|
||||
@rtype: string
|
||||
"""
|
||||
|
||||
def setName(name):
|
||||
"""
|
||||
Set the name of this Armature object.
|
||||
@type name: string
|
||||
@param name: The new name.
|
||||
"""
|
||||
|
||||
def getBones():
|
||||
"""
|
||||
Get the Armature root bones.
|
||||
@rtype: list
|
||||
@return: a list of Armature bones.
|
||||
"""
|
||||
|
||||
def setBones(bones):
|
||||
"""
|
||||
Set the Armature root bones (still unimplemented).
|
||||
@warn: This method wasn't implemented yet.
|
||||
"""
|
@@ -12,14 +12,22 @@ This is the main Blender module.
|
||||
Blender Python
|
||||
==============
|
||||
|
||||
- The L{Blender} module
|
||||
|
||||
Submodules:
|
||||
-----------
|
||||
|
||||
- L{Types}
|
||||
- L{Scene}
|
||||
- L{NMesh}
|
||||
- L{Material}
|
||||
- L{Armature}
|
||||
- L{Camera}
|
||||
- L{Lamp}
|
||||
- L{BGL}
|
||||
- L{Window}
|
||||
- L{Draw}
|
||||
- L{Image}
|
||||
- L{Text}
|
||||
|
||||
Introduction:
|
||||
@@ -31,7 +39,7 @@ Blender Python
|
||||
- Links to Blender, Blender Python, later: script lists
|
||||
|
||||
@author: The Blender Python Team
|
||||
@requires: Blender 2.28 or newer.
|
||||
@requires: Blender 2.27-NewPy (2.28 pre-release) or newer.
|
||||
@version: 0.1
|
||||
@see: U{www.blender.org<http://www.blender.org>}
|
||||
@see: U{projects.blender.org<http://projects.blender.org>}
|
||||
|
@@ -37,8 +37,8 @@ def Get (name = None):
|
||||
@type name: string
|
||||
@param name: The name of the Camera Data.
|
||||
@rtype: Blender Camera or a list of Blender Cameras
|
||||
@return: It depends on the 'name' parameter:
|
||||
- (name): The Camera Data object with the given name;
|
||||
@return: It depends on the I{name} parameter:
|
||||
- (name): The Camera Data object with the given I{name};
|
||||
- (): A list with all Camera Data objects in the current scene.
|
||||
"""
|
||||
|
||||
|
353
source/blender/python/api2_2x/doc/Draw.py
Normal file
353
source/blender/python/api2_2x/doc/Draw.py
Normal file
@@ -0,0 +1,353 @@
|
||||
# Blender.Draw module and the Button PyType object
|
||||
|
||||
"""
|
||||
The Blender.Draw submodule.
|
||||
|
||||
Draw
|
||||
====
|
||||
|
||||
This module provides access to a B{windowing interface} in Blender. Its widgets
|
||||
include many kinds of buttons: push, toggle, menu, number, string, slider,
|
||||
scrollbar, plus support for text drawing. It also includes keyboard keys and
|
||||
mouse button code values in its dictionary (print dir(Blender.Draw)).
|
||||
|
||||
Example::
|
||||
import Blender
|
||||
from Blender import Draw, BGL
|
||||
#
|
||||
mystring = ""
|
||||
mymsg = ""
|
||||
toggle = 0
|
||||
#
|
||||
def event(evt, val): # the function to handle input events
|
||||
global mystring, mymsg
|
||||
|
||||
if not val: # val = 0: it's a key/mbutton release
|
||||
if evt in [Draw.LEFTMOUSE, Draw.MIDDLEMOUSE, Draw.RIGHTMOUSE]:
|
||||
mymsg = "You released a mouse button."
|
||||
Draw.Redraw(1)
|
||||
return
|
||||
|
||||
if evt == Draw.ESCKEY:
|
||||
Draw.Exit() # exit when user presses ESC
|
||||
return
|
||||
|
||||
elif Draw.AKEY <= evt <= Draw.ZKEY: mystring += chr(evt)
|
||||
elif evt == Draw.SPACEKEY: mystring += ' '
|
||||
elif evt == Draw.BACKSPACEKEY and len(mystring):
|
||||
mystring = mystring[:-1]
|
||||
else: return # this is important: only re-register if an event was caught
|
||||
|
||||
Draw.Register(gui, event, button_event) # re-register to stay in the loop
|
||||
#
|
||||
def button_event(evt): # the function to handle Draw Button events
|
||||
global mymsg, toggle
|
||||
if evt == 1:
|
||||
mymsg = "You pressed the toggle button."
|
||||
toggle = 1 - toggle
|
||||
Draw.Redraw(1)
|
||||
else:
|
||||
Draw.Register(gui, event, button_event)
|
||||
#
|
||||
def gui(): # the function to draw the screen
|
||||
global mystring, mymsg, toggle
|
||||
if len(mystring) > 90: mystring = ""
|
||||
BGL.glClearColor(0,0,1,1)
|
||||
BGL.glClear(BGL.GL_COLOR_BUFFER_BIT)
|
||||
BGL.glColor3f(1,1,1)
|
||||
Draw.Toggle("Toggle", 1, 10, 10, 55, 20, toggle,"A toggle button")
|
||||
BGL.glRasterPos2i(72, 16)
|
||||
if toggle: toggle_state = "down"
|
||||
else: toggle_state = "up"
|
||||
Draw.Text("The toggle button is %s." % toggle_state, "small")
|
||||
BGL.glRasterPos2i(10, 230)
|
||||
Draw.Text("Type letters from a to z, ESC to leave.")
|
||||
BGL.glRasterPos2i(20, 200)
|
||||
Draw.Text(mystring)
|
||||
BGL.glColor3f(1,0.4,0.3)
|
||||
BGL.glRasterPos2i(340, 70)
|
||||
Draw.Text(mymsg, "tiny")
|
||||
#
|
||||
Draw.Register(gui, event, button_event) # registering the 3 callbacks
|
||||
@warn: Inside the windowing loop (after Draw.Register() has been executed and
|
||||
before Draw.Exit() is called), don't use the redraw functions from other
|
||||
modules (Blender and Window). The Draw submodule has its own Draw.Redraw() and
|
||||
Draw.Draw() functions that can be used inside the windowing loop.
|
||||
"""
|
||||
|
||||
def Exit():
|
||||
"""
|
||||
Exit the windowing interface.
|
||||
"""
|
||||
|
||||
def Register(draw = None, event = None, button = None):
|
||||
"""
|
||||
Register callbacks for windowing.
|
||||
@type draw: function
|
||||
@type event: function
|
||||
@type button: function
|
||||
@param draw: A function to draw the screen, taking no arguments: f().
|
||||
@param event: A function to handle keyboard and mouse input events, taking
|
||||
two arguments: f(evt, val), where:
|
||||
- 'evt' (int) is the event number;
|
||||
- 'val' (int) is the value modifier. If val = 0, the event refers to a
|
||||
key or mouse button being released. Otherwise it's a key/button press.
|
||||
@param button: A function to handle Draw Button events, taking one argument:
|
||||
f(evt), where:
|
||||
- 'evt' is the button number (see the I{event} parameter in L{Button}).
|
||||
"""
|
||||
|
||||
def Redraw(after = 0):
|
||||
"""
|
||||
Queue a redraw event. Redraw events are buffered so that, regardless of how
|
||||
many events are queued, the window only receives one redraw event.
|
||||
@type after: int
|
||||
@param after: If non-zero, the redraw is processed before other input events.
|
||||
"""
|
||||
|
||||
def Draw():
|
||||
"""
|
||||
Force an immediate redraw. Forced redraws are not buffered. In other words,
|
||||
the window is redrawn once every time this function is called.
|
||||
"""
|
||||
|
||||
def Create(value):
|
||||
"""
|
||||
Create a default Button object.
|
||||
@type value: int, float or string
|
||||
@param value: The value to store in the button.
|
||||
@rtype: Blender Button
|
||||
@return: The Button created.
|
||||
"""
|
||||
|
||||
def Button(name, event, x, y, width, height, tooltip = None):
|
||||
"""
|
||||
Create a new (push) Button object.
|
||||
@type name: string
|
||||
@param name: The string to display on the button.
|
||||
@type event: int
|
||||
@param event: The event number to pass to the button event function when
|
||||
activated.
|
||||
@type x: int
|
||||
@type y: int
|
||||
@param x: The lower left x (horizontal) coordinate of the button.
|
||||
@param y: The lower left y (vertical) coordinate of the button.
|
||||
@type width: int
|
||||
@type height: int
|
||||
@param width: The button width.
|
||||
@param height: The button height.
|
||||
@type tooltip: string
|
||||
@param tooltip: The button's tooltip (the string that appears when the mouse
|
||||
is kept over the button).
|
||||
"""
|
||||
|
||||
def Menu(name, event, x, y, width, height, default, tooltip = None):
|
||||
"""
|
||||
Create a new Menu Button object.
|
||||
|
||||
The menu options are specified through the 'name' of the button. Options are
|
||||
I{followed} by a format code and separated by the '|' (pipe) character. Valid
|
||||
format codes are:
|
||||
- %t - The option should be used as the title;
|
||||
- %xB{N} - The option should set the integer B{N} in the button value.
|
||||
|
||||
Example::
|
||||
name = "The Title %t|First Entry %x1|Second Entry %x2|Third Entry %x3"
|
||||
menu = Draw.Menu(name, 2, 60, 120, 200, 40, 3, "Just a test menu.")
|
||||
# note that, since default = 3, the "Third Entry"
|
||||
# will appear as the default choice in the Menu.
|
||||
|
||||
@type name: string
|
||||
@param name: The string to display on the button.
|
||||
@type event: int
|
||||
@param event: The event number to pass to the button event function when
|
||||
activated.
|
||||
@type x: int
|
||||
@type y: int
|
||||
@param x: The lower left x (horizontal) coordinate of the button.
|
||||
@param y: The lower left y (vertical) coordinate of the button.
|
||||
@type width: int
|
||||
@type height: int
|
||||
@param width: The button width.
|
||||
@param height: The button height.
|
||||
@type default: int
|
||||
@param default: The number of the option to be selected by default.
|
||||
@type tooltip: string
|
||||
@param tooltip: The button's tooltip (the string that appears when the mouse
|
||||
is kept over the button).
|
||||
@rtype: Blender Button
|
||||
@return: The Button created.
|
||||
"""
|
||||
|
||||
def Toggle(name, event, x, y, width, height, default, tooltip = None):
|
||||
"""
|
||||
Create a new Toggle Button object.
|
||||
@type name: string
|
||||
@param name: The string to display on the button.
|
||||
@type event: int
|
||||
@param event: The event number to pass to the button event function when
|
||||
activated.
|
||||
@type x: int
|
||||
@type y: int
|
||||
@param x: The lower left x (horizontal) coordinate of the button.
|
||||
@param y: The lower left y (vertical) coordinate of the button.
|
||||
@type width: int
|
||||
@type height: int
|
||||
@param width: The button width.
|
||||
@param height: The button height.
|
||||
@type default: int
|
||||
@param default: The value specifying the default state:
|
||||
(0 for "up", 1 for "down").
|
||||
@type tooltip: string
|
||||
@param tooltip: The button's tooltip (the string that appears when the mouse
|
||||
is kept over the button).
|
||||
@rtype: Blender Button
|
||||
@return: The Button created.
|
||||
"""
|
||||
|
||||
def Slider(name, event, x, y, width, height, initial, min, max, realtime = 1,
|
||||
tooltip = None):
|
||||
"""
|
||||
Create a new Toggle Button object.
|
||||
@type name: string
|
||||
@param name: The string to display on the button.
|
||||
@type event: int
|
||||
@param event: The event number to pass to the button event function when
|
||||
activated.
|
||||
@type x: int
|
||||
@type y: int
|
||||
@param x: The lower left x (horizontal) coordinate of the button.
|
||||
@param y: The lower left y (vertical) coordinate of the button.
|
||||
@type width: int
|
||||
@type height: int
|
||||
@param width: The button width.
|
||||
@param height: The button height.
|
||||
@type initial: int or float
|
||||
@type min: int or float
|
||||
@type max: int or float
|
||||
@param initial: The initial value.
|
||||
@param min: The minimum value.
|
||||
@param max: The maximum value.
|
||||
@type realtime: int
|
||||
@param realtime: If non-zero (the default), the slider will emit events as
|
||||
it is edited.
|
||||
@type tooltip: string
|
||||
@param tooltip: The button's tooltip (the string that appears when the mouse
|
||||
is kept over the button).
|
||||
@rtype: Blender Button
|
||||
@return: The Button created.
|
||||
"""
|
||||
|
||||
def Scrollbar(event, x, y, width, height, initial, min, max, realtime = 1,
|
||||
tooltip = None):
|
||||
"""
|
||||
Create a new Scrollbar Button object.
|
||||
@type event: int
|
||||
@param event: The event number to pass to the button event function when
|
||||
activated.
|
||||
@type x: int
|
||||
@type y: int
|
||||
@param x: The lower left x (horizontal) coordinate of the button.
|
||||
@param y: The lower left y (vertical) coordinate of the button.
|
||||
@type width: int
|
||||
@type height: int
|
||||
@param width: The button width.
|
||||
@param height: The button height.
|
||||
@type initial: int or float
|
||||
@type min: int or float
|
||||
@type max: int or float
|
||||
@param initial: The initial value.
|
||||
@param min: The minimum value.
|
||||
@param max: The maximum value.
|
||||
@type realtime: int
|
||||
@param realtime: If non-zero (the default), the slider will emit events as
|
||||
it is edited.
|
||||
@type tooltip: string
|
||||
@param tooltip: The button's tooltip (the string that appears when the mouse
|
||||
is kept over the button).
|
||||
@rtype: Blender Button
|
||||
@return: The Button created.
|
||||
"""
|
||||
|
||||
def Number(name, event, x, y, width, height, initial, min, max, realtime = 1,
|
||||
tooltip = None):
|
||||
"""
|
||||
Create a new Number Button object.
|
||||
@type name: string
|
||||
@param name: The string to display on the button.
|
||||
@type event: int
|
||||
@param event: The event number to pass to the button event function when
|
||||
activated.
|
||||
@type x: int
|
||||
@type y: int
|
||||
@param x: The lower left x (horizontal) coordinate of the button.
|
||||
@param y: The lower left y (vertical) coordinate of the button.
|
||||
@type width: int
|
||||
@type height: int
|
||||
@param width: The button width.
|
||||
@param height: The button height.
|
||||
@type initial: int or float
|
||||
@type min: int or float
|
||||
@type max: int or float
|
||||
@param initial: The initial value.
|
||||
@param min: The minimum value.
|
||||
@param max: The maximum value.
|
||||
@type realtime: int
|
||||
@param realtime: If non-zero (the default), the slider will emit events as
|
||||
it is edited.
|
||||
@type tooltip: string
|
||||
@param tooltip: The button's tooltip (the string that appears when the mouse
|
||||
is kept over the button).
|
||||
@rtype: Blender Button
|
||||
@return: The Button created.
|
||||
"""
|
||||
|
||||
|
||||
def String(name, event, x, y, width, height, initial, length, tooltip = None):
|
||||
"""
|
||||
Create a new String Button object.
|
||||
@type name: string
|
||||
@param name: The string to display on the button.
|
||||
@type event: int
|
||||
@param event: The event number to pass to the button event function when
|
||||
activated.
|
||||
@type x: int
|
||||
@type y: int
|
||||
@param x: The lower left x (horizontal) coordinate of the button.
|
||||
@param y: The lower left y (vertical) coordinate of the button.
|
||||
@type width: int
|
||||
@type height: int
|
||||
@param width: The button width.
|
||||
@param height: The button height.
|
||||
@type initial: string
|
||||
@param initial: The string to display initially.
|
||||
@type length: int
|
||||
@param length: The maximum input length.
|
||||
@type tooltip: string
|
||||
@param tooltip: The button's tooltip (the string that appears when the mouse
|
||||
is kept over the button).
|
||||
@rtype: Blender Button
|
||||
@return: The Button created.
|
||||
"""
|
||||
|
||||
def GetStringWidth(string, fontsize = 'normal'):
|
||||
"""
|
||||
Get the width in pixels of a string.
|
||||
@type string: string
|
||||
@param string: A string.
|
||||
@type fontsize: string
|
||||
@param fontsize: The size of the font: 'normal', 'small' or 'tiny'.
|
||||
@rtype: int
|
||||
@return: The width of I{string} with the chosen I{fontsize}.
|
||||
"""
|
||||
|
||||
def Text(string, fontsize = 'normal'):
|
||||
"""
|
||||
Draw a string on the screen.
|
||||
@type string: string
|
||||
@param string: The text string to draw.
|
||||
@type fontsize: string
|
||||
@param fontsize: The size of the font: 'normal', 'small' or 'tiny'.
|
||||
@rtype: int
|
||||
@return: The width of I{string} drawn with the chosen I{fontsize}.
|
||||
"""
|
115
source/blender/python/api2_2x/doc/Image.py
Normal file
115
source/blender/python/api2_2x/doc/Image.py
Normal file
@@ -0,0 +1,115 @@
|
||||
# Blender.Image module and the Image PyType object
|
||||
|
||||
"""
|
||||
The Blender.Image submodule.
|
||||
|
||||
Image
|
||||
=====
|
||||
|
||||
This module provides access to B{Image} objects in Blender.
|
||||
|
||||
Example::
|
||||
import Blender
|
||||
from Blender import Image
|
||||
#
|
||||
image = Image.Load("/path/to/my/image.png") # load an image file
|
||||
print "Image from", image.getFilename(),
|
||||
print "loaded to obj", image.getName())
|
||||
image.setXRep(4) # set x tiling factor
|
||||
image.setYRep(2) # set y tiling factor
|
||||
print "All Images available now:", Image.Get()
|
||||
"""
|
||||
|
||||
def Load (filename):
|
||||
"""
|
||||
Load the image called 'filename' into an Image object.
|
||||
@type filename: string
|
||||
@param filename: The full path to the image file.
|
||||
@rtype: Blender Image
|
||||
@return: A Blender Image object with the data from I{filename}.
|
||||
"""
|
||||
|
||||
def New (name):
|
||||
"""
|
||||
Create a new Image object (not implemented yet!).
|
||||
@type name: string
|
||||
@param name: The name of the new Image object.
|
||||
@rtype: Blender Image
|
||||
@return: A new Blender Image object.
|
||||
@warn: This function wasn't implemented yet. It simply returns None.
|
||||
"""
|
||||
|
||||
def Get (name = None):
|
||||
"""
|
||||
Get the Image object(s) from Blender.
|
||||
@type name: string
|
||||
@param name: The name of the Image object.
|
||||
@rtype: Blender Image or a list of Blender Images
|
||||
@return: It depends on the I{name} parameter:
|
||||
- (name): The Image object called I{name}, None if not found;
|
||||
- (): A list with all Image objects in the current scene.
|
||||
"""
|
||||
|
||||
|
||||
class Image:
|
||||
"""
|
||||
The Image object
|
||||
================
|
||||
This object gives access to Images in Blender. In the future it will allow
|
||||
direct read/write access to their pixel buffers, too.
|
||||
@cvar name: The name of this Image object.
|
||||
@cvar filename: The filename (path) to the image file loaded into this Image
|
||||
object.
|
||||
@cvar xrep: Texture tiling: the number of repetitions in the x (horizontal)
|
||||
axis.
|
||||
@cvar yrep: Texture tiling: the number of repetitions in the y (vertical)
|
||||
axis.
|
||||
"""
|
||||
|
||||
def getName():
|
||||
"""
|
||||
Get the name of this Image object.
|
||||
@rtype: string
|
||||
"""
|
||||
|
||||
def getFilename():
|
||||
"""
|
||||
Get the filename of the image file loaded into this Image object.
|
||||
@rtype: string
|
||||
"""
|
||||
|
||||
def getXRep():
|
||||
"""
|
||||
Get the number of repetitions in the x (horizontal) axis for this Image.
|
||||
This is for texture tiling.
|
||||
@rtype: int
|
||||
"""
|
||||
|
||||
def getYRep():
|
||||
"""
|
||||
Get the number of repetitions in the y (vertical) axis for this Image.
|
||||
This is for texture tiling.
|
||||
@rtype: int
|
||||
"""
|
||||
|
||||
def setName(name):
|
||||
"""
|
||||
Set the name of this Image object.
|
||||
@type name: string
|
||||
@param name: The new name.
|
||||
"""
|
||||
|
||||
def setXRep(xrep):
|
||||
"""
|
||||
Texture tiling: set the number of x repetitions for this Image.
|
||||
@type xrep: int
|
||||
@param xrep: The new value in [1, 16].
|
||||
"""
|
||||
|
||||
def setYRep(yrep):
|
||||
"""
|
||||
Texture tiling: set the number of y repetitions for this Image.
|
||||
@type yrep: int
|
||||
@param yrep: The new value in [1, 16].
|
||||
"""
|
||||
|
@@ -34,8 +34,8 @@ def Get (name = None):
|
||||
@type name: string
|
||||
@param name: The name of the Lamp Data.
|
||||
@rtype: Blender Lamp or a list of Blender Lamps
|
||||
@return: It depends on the 'name' parameter:
|
||||
- (name): The Lamp Data object with the given name;
|
||||
@return: It depends on the I{name} parameter:
|
||||
- (name): The Lamp Data object with the given I{name};
|
||||
- (): A list with all Lamp Data objects in the current scene.
|
||||
"""
|
||||
|
||||
|
468
source/blender/python/api2_2x/doc/Material.py
Normal file
468
source/blender/python/api2_2x/doc/Material.py
Normal file
@@ -0,0 +1,468 @@
|
||||
# Blender.Material module and the Material PyObject
|
||||
|
||||
"""
|
||||
The Blender.Material submodule.
|
||||
|
||||
Material
|
||||
========
|
||||
|
||||
This module provides access to B{Material} objects in Blender.
|
||||
|
||||
Example::
|
||||
import Blender
|
||||
from Blender import Material
|
||||
mat = Material.New('newMat') # create a new Material called 'newMat'
|
||||
print mat.rgbCol # print its rgb color triplet
|
||||
mat.rgbCol = [0.8, 0.2, 0.2] # change its color
|
||||
mat.setAlpha(0.2) # mat.alpha = 0.2 -- almost transparent
|
||||
mat.emit = 0.7 # equivalent to mat.setEmit(0.8)
|
||||
mat.mode |= Material.Modes.ZTRANSP # turn on Z-Buffer transparency
|
||||
mat.setName('RedBansheeSkin') # change its name
|
||||
mat.setAdd(0.8) # make it glow
|
||||
mat.setMode('Halo') # turn 'Halo' "on" and all others "off"
|
||||
|
||||
@type Modes: readonly dictionary
|
||||
@var Modes: The available Material Modes.
|
||||
- TRACEABLE - Make Material visible for shadow lamps.
|
||||
- SHADOW - Enable Material for shadows.
|
||||
- SHADELESS - Make Material insensitive to light or shadow.
|
||||
- WIRE - Render only the edges of faces.
|
||||
- VCOL_LIGHT - Add vertex colors as extra light.
|
||||
- VCOL_PAINT - Replace basic colors with vertex colors.
|
||||
- HALO - Render as a halo.
|
||||
- ZTRANSP - Z-buffer transparent faces.
|
||||
- ZINVERT - Render with inverted Z-buffer.
|
||||
- - HALORINGS - Render rings over the basic halo.
|
||||
- ENV - Do not render Material.
|
||||
- - HALOLINES - Render star shaped lines over the basic halo.
|
||||
- ONLYSHADOW - Let alpha be determined on the degree of shadow.
|
||||
- - HALOXALPHA - Use extreme alpha.
|
||||
- TEXFACE - UV-Editor assigned texture gives color and texture info
|
||||
for faces.
|
||||
- - HALOSTAR - Render halo as a star.
|
||||
- NOMIST - Set the Material insensitive to mist.
|
||||
- - HALOSHADED - Let halo receive light.
|
||||
- HALOTEX - Give halo a texture.
|
||||
- HALOPUNO - Use the vertex normal to specify the dimension of the halo.
|
||||
- HALOFLARE - Render halo as a lens flare.
|
||||
|
||||
@warn: Some Modes are only available when the 'Halo' mode is I{off} and
|
||||
others only when it is I{on}. But these two subsets of modes share the same
|
||||
numerical values in their Blender C #defines. So, for example, if 'Halo' is
|
||||
on, then 'NoMist' is actually interpreted as 'HaloShaded'. We marked all
|
||||
such possibilities in the Modes dict below: each halo-related mode that
|
||||
uses an already taken value is preceded by "-" and appear below the normal
|
||||
mode which also uses that value.
|
||||
"""
|
||||
|
||||
def New (name = 'Mat'):
|
||||
"""
|
||||
Create a new Material object.
|
||||
@type name: string
|
||||
@param name: The Material name.
|
||||
@rtype: Blender Material
|
||||
@return: The created Material object.
|
||||
"""
|
||||
|
||||
def Get (name = None):
|
||||
"""
|
||||
Get the Material object(s) from Blender.
|
||||
@type name: string
|
||||
@param name: The name of the Material.
|
||||
@rtype: Blender Material or a list of Blender Materials
|
||||
@return: It depends on the 'name' parameter:
|
||||
- (name): The Material object with the given name;
|
||||
- (): A list with all Material objects in the current scene.
|
||||
"""
|
||||
|
||||
class Material:
|
||||
"""
|
||||
The Material object
|
||||
===================
|
||||
This object gives access to Materials in Blender.
|
||||
@cvar name: Material's name.
|
||||
@type mode: int
|
||||
@cvar mode: Mode flags as an or'ed int value. See the Modes dictionary keys
|
||||
and descriptions in L{Modes}.
|
||||
@cvar rgbCol: Material's RGB color triplet.
|
||||
@cvar ambCol: Ambient color rgb triplet.
|
||||
@cvar specCol: Specular color rgb triplet.
|
||||
@cvar mirCol: Mirror color rgb triplet.
|
||||
@cvar R: Red component of L{rgbCol} - [0.0, 1.0].
|
||||
@cvar G: Green component of L{rgbCol} - [0.0, 1.0].
|
||||
@cvar B: Blue component of L{rgbCol} - [0.0, 1.0].
|
||||
@cvar alpha: Alpha (translucency) component of the Material - [0.0, 1.0].
|
||||
@cvar amb: Ambient factor - [0.0, 1.0].
|
||||
@cvar emit: Emitting light intensity - [0.0, 1.0].
|
||||
@cvar ref: Reflectivity - [0.0, 1.0].
|
||||
@cvar spec: Specularity - [0.0, 2.0].
|
||||
@cvar specTransp: Specular transparency - [0.0, 1.0].
|
||||
@cvar add: Glow factor - [0.0, 1.0].
|
||||
@cvar zOffset: Artificial Z offset for faces - [0.0, 10.0].
|
||||
@cvar haloSize: Dimension of the halo - [0.0, 100.0].
|
||||
@cvar flareSize: Factor the flare is larger than the halo - [0.1, 25.0].
|
||||
@cvar flareBoost: Flare's extra strength - [0.1, 10.0].
|
||||
@cvar haloSeed: To use random values for ring dimension and line location -
|
||||
[0, 255].
|
||||
@cvar flareSeed: Offset in the seed table - [0, 255].
|
||||
@cvar subSize: Dimension of subflares, dots and circles - [0.1, 25.0].
|
||||
@cvar hard: Hardness of the specularity - [1, 255].
|
||||
@cvar nFlares: Number of halo subflares - [1, 32].
|
||||
@cvar nStars: Number of points on the halo stars - [3, 50].
|
||||
@cvar nLines: Number of star shaped lines on each halo - [0, 250].
|
||||
@cvar nRings: Number of halo rings - [0, 24].
|
||||
@warning: Most member variables assume values in some [Min, Max] interval.
|
||||
When trying to set them, the given parameter will be clamped to lie in
|
||||
that range: if val < Min, then val = Min, if val > Max, then val = Max.
|
||||
"""
|
||||
|
||||
def getName():
|
||||
"""
|
||||
Get the name of this Material object.
|
||||
@rtype: string
|
||||
"""
|
||||
|
||||
def setName(name):
|
||||
"""
|
||||
Set the name of this Material object.
|
||||
@type name: string
|
||||
@param name: The new name.
|
||||
"""
|
||||
|
||||
def getMode():
|
||||
"""
|
||||
Get this Material's mode flags.
|
||||
@rtype: int
|
||||
@return: B{OR'ed value}. Use the Modes dictionary to check which flags
|
||||
are 'on'.
|
||||
|
||||
Example::
|
||||
import Blender
|
||||
from Blender import Material
|
||||
flags = mymat.getMode()
|
||||
if flags & Material.Modes['HALO']:
|
||||
print "This material is rendered as a halo"
|
||||
else:
|
||||
print "Not a halo"
|
||||
"""
|
||||
|
||||
def setMode(m = None, m2 = None, m3 = None, and_so_on = None,
|
||||
up_to_21 = None):
|
||||
"""
|
||||
Set this Material's mode flags. Mode strings given are turned 'on'.
|
||||
Those not provided are turned 'off', so mat.setMode() -- without
|
||||
arguments -- turns off all mode flags for Material mat.
|
||||
@type m: string
|
||||
@param m: A mode flag. From 1 to 21 can be set at the same time.
|
||||
"""
|
||||
|
||||
def getRGBCol():
|
||||
"""
|
||||
Get the rgb color triplet.
|
||||
@rtype: list of 3 floats
|
||||
@return: [r, g, b]
|
||||
"""
|
||||
|
||||
def setRGBCol(rgb = None):
|
||||
"""
|
||||
Set the rgb color triplet. If B{rgb} is None, set the color to black.
|
||||
@type rgb: three floats or a list of three floats
|
||||
@param rgb: The rgb color values in [0.0, 1.0] as:
|
||||
- a list of three floats: setRGBCol ([r, g, b]) B{or}
|
||||
- three floats as separate parameters: setRGBCol (r,g,b).
|
||||
"""
|
||||
|
||||
def getAmbCol():
|
||||
"""
|
||||
Get the ambient color triplet.
|
||||
@rtype: list of 3 floats
|
||||
@return: [ambR, ambG, ambB]
|
||||
"""
|
||||
|
||||
def setAmbCol(rgb = None):
|
||||
"""
|
||||
Set the ambient color triplet. If B{rgb} is None, set the color to black.
|
||||
@type rgb: three floats or a list of three floats
|
||||
@param rgb: The rgb color values in [0.0, 1.0] as:
|
||||
- a list of three floats: setAmbCol ([r, g, b]) B{or}
|
||||
- three floats as separate parameters: setAmbCol (r,g,b).
|
||||
"""
|
||||
|
||||
def getSpecCol():
|
||||
"""
|
||||
Get the specular color triplet.
|
||||
@rtype: list of 3 floats
|
||||
@return: [specR, specG, specB]
|
||||
"""
|
||||
|
||||
def setSpecCol(rgb = None):
|
||||
"""
|
||||
Set the specular color triplet. If B{rgb} is None, set the color to black.
|
||||
@type rgb: three floats or a list of three floats
|
||||
@param rgb: The rgb color values in [0.0, 1.0] as:
|
||||
- a list of three floats: setSpecCol ([r, g, b]) B{or}
|
||||
- three floats as separate parameters: setSpecCol (r,g,b).
|
||||
"""
|
||||
|
||||
def getMirCol():
|
||||
"""
|
||||
Get the mirror color triplet.
|
||||
@rtype: list of 3 floats
|
||||
@return: [mirR, mirG, mirb]
|
||||
"""
|
||||
|
||||
def setMirCol(rgb = None):
|
||||
"""
|
||||
Set the mirror color triplet. If B{rgb} is None, set the color to black.
|
||||
@type rgb: three floats or a list of three floats
|
||||
@param rgb: The rgb color values in [0.0, 1.0] as:
|
||||
- a list of three floats: setMirCol ([r, g, b]) B{or}
|
||||
- three floats as separate parameters: setMirCol (r,g,b).
|
||||
"""
|
||||
|
||||
def getAlpha():
|
||||
"""
|
||||
Get the alpha (transparency) value.
|
||||
@rtype: float
|
||||
"""
|
||||
|
||||
def setAlpha(alpha):
|
||||
"""
|
||||
Set the alpha (transparency) value.
|
||||
@type alpha: float
|
||||
@param alpha: The new value in [0.0, 1.0].
|
||||
"""
|
||||
|
||||
def getAmb():
|
||||
"""
|
||||
Get the ambient color blend factor.
|
||||
@rtype: float
|
||||
"""
|
||||
|
||||
def setAmb(amb):
|
||||
"""
|
||||
Set the ambient color blend factor.
|
||||
@type amb: float
|
||||
@param amb: The new value in [0.0, 1.0].
|
||||
"""
|
||||
|
||||
def getEmit():
|
||||
"""
|
||||
Get the emitting light intensity.
|
||||
@rtype: float
|
||||
"""
|
||||
|
||||
def setEmit(emit):
|
||||
"""
|
||||
Set the emitting light intensity.
|
||||
@type emit: float
|
||||
@param emit: The new value in [0.0, 1.0].
|
||||
"""
|
||||
|
||||
def getRef():
|
||||
"""
|
||||
Get the reflectivity value.
|
||||
@rtype: float
|
||||
"""
|
||||
|
||||
def setRef(ref):
|
||||
"""
|
||||
Set the reflectivity value.
|
||||
@type ref: float
|
||||
@param ref: The new value in [0.0, 1.0].
|
||||
"""
|
||||
|
||||
def getSpec():
|
||||
"""
|
||||
Get the specularity value.
|
||||
@rtype: float
|
||||
"""
|
||||
|
||||
def setSpec(spec):
|
||||
"""
|
||||
Set the specularity value.
|
||||
@type spec: float
|
||||
@param spec: The new value in [0.0, 2.0].
|
||||
"""
|
||||
|
||||
def getSpecTransp():
|
||||
"""
|
||||
Get the specular transparency.
|
||||
@rtype: float
|
||||
"""
|
||||
|
||||
def setSpecTransp(spectransp):
|
||||
"""
|
||||
Set the specular transparency.
|
||||
@type spectransp: float
|
||||
@param spectransp: The new value in [0.0, 1.0].
|
||||
"""
|
||||
|
||||
def getAdd():
|
||||
"""
|
||||
Get the glow factor.
|
||||
@rtype: float
|
||||
"""
|
||||
|
||||
def setAdd(add):
|
||||
"""
|
||||
Set the glow factor.
|
||||
@type add: float
|
||||
@param add: The new value in [0.0, 1.0].
|
||||
"""
|
||||
|
||||
def getZOffset():
|
||||
"""
|
||||
Get the artificial offset for faces with this Material.
|
||||
@rtype: float
|
||||
"""
|
||||
|
||||
def setZOffset(zoffset):
|
||||
"""
|
||||
Set the artificial offset for faces with this Material.
|
||||
@type zoffset: float
|
||||
@param zoffset: The new value in [0.0, 10.0].
|
||||
"""
|
||||
|
||||
def getHaloSize():
|
||||
"""
|
||||
Get the halo size.
|
||||
@rtype: float
|
||||
"""
|
||||
|
||||
def setHaloSize(halosize):
|
||||
"""
|
||||
Set the halo size.
|
||||
@type halosize: float
|
||||
@param halosize: The new value in [0.0, 100.0].
|
||||
"""
|
||||
|
||||
def getHaloSeed():
|
||||
"""
|
||||
Get the seed for random ring dimension and line location in halos.
|
||||
@rtype: int
|
||||
"""
|
||||
|
||||
def setHaloSeed(haloseed):
|
||||
"""
|
||||
Set the seed for random ring dimension and line location in halos.
|
||||
@type haloseed: int
|
||||
@param haloseed: The new value in [0, 255].
|
||||
"""
|
||||
|
||||
def getFlareSize():
|
||||
"""
|
||||
Get the ratio: flareSize / haloSize.
|
||||
@rtype: float
|
||||
"""
|
||||
|
||||
def setFlareSize(flaresize):
|
||||
"""
|
||||
Set the ratio: flareSize / haloSize.
|
||||
@type flaresize: float
|
||||
@param flaresize: The new value in [0.1, 25.0].
|
||||
"""
|
||||
|
||||
def getFlareSeed():
|
||||
"""
|
||||
Get flare's offset in the seed table.
|
||||
@rtype: int
|
||||
"""
|
||||
|
||||
def setFlareSeed(flareseed):
|
||||
"""
|
||||
Set flare's offset in the seed table.
|
||||
@type flareseed: int
|
||||
@param flareseed: The new value in [0, 255].
|
||||
"""
|
||||
|
||||
def getFlareBoost():
|
||||
"""
|
||||
Get the flare's extra strength.
|
||||
@rtype: float
|
||||
"""
|
||||
|
||||
def setFlareBoost(flareboost):
|
||||
"""
|
||||
Set the flare's extra strength.
|
||||
@type flareboost: float
|
||||
@param flareboost: The new value in [0.1, 10.0].
|
||||
"""
|
||||
|
||||
def getSubSize():
|
||||
"""
|
||||
Get the dimension of subflare, dots and circles.
|
||||
@rtype: float
|
||||
"""
|
||||
|
||||
def setSubSize(subsize):
|
||||
"""
|
||||
Set the dimension of subflare, dots and circles.
|
||||
@type subsize: float
|
||||
@param subsize: The new value in [0.1, 25.0].
|
||||
"""
|
||||
|
||||
def getHardness():
|
||||
"""
|
||||
Get the hardness of the specularity.
|
||||
@rtype: int
|
||||
"""
|
||||
|
||||
def setHardness(hardness):
|
||||
"""
|
||||
Set the hardness of the specularity.
|
||||
@type hardness: int
|
||||
@param hardness: The new value in [1, 255].
|
||||
"""
|
||||
|
||||
def getNFlares():
|
||||
"""
|
||||
Get the number of halo subflares.
|
||||
@rtype: int
|
||||
"""
|
||||
|
||||
def setNFlares(nflares):
|
||||
"""
|
||||
Set the number of halo subflares.
|
||||
@type nflares: int
|
||||
@param nflares: The new value in [1, 32].
|
||||
"""
|
||||
|
||||
def getNStars():
|
||||
"""
|
||||
Get the number of points in the halo stars.
|
||||
@rtype: int
|
||||
"""
|
||||
|
||||
def setNStars(nstars):
|
||||
"""
|
||||
Set the number of points in the halo stars.
|
||||
@type nstars: int
|
||||
@param nstars: The new value in [3, 50].
|
||||
"""
|
||||
|
||||
def getNLines():
|
||||
"""
|
||||
Get the number of star shaped lines on each halo.
|
||||
@rtype: int
|
||||
"""
|
||||
|
||||
def setNLines(nlines):
|
||||
"""
|
||||
Set the number of star shaped lines on each halo.
|
||||
@type nlines: int
|
||||
@param nlines: The new value in [0, 250].
|
||||
"""
|
||||
|
||||
def getNRings():
|
||||
"""
|
||||
Get the number of rings on each halo.
|
||||
@rtype: int
|
||||
"""
|
||||
|
||||
def setNRings(nrings):
|
||||
"""
|
||||
Set the number of rings on each halo.
|
||||
@type nrings: int
|
||||
@param nrings: The new value in [0, 24].
|
||||
"""
|
297
source/blender/python/api2_2x/doc/NMesh.py
Normal file
297
source/blender/python/api2_2x/doc/NMesh.py
Normal file
@@ -0,0 +1,297 @@
|
||||
# Blender.NMesh module and the NMesh PyType object
|
||||
|
||||
"""
|
||||
The Blender.NMesh submodule.
|
||||
|
||||
Mesh Data
|
||||
=========
|
||||
|
||||
This module provides access to B{Mesh Data} objects in Blender.
|
||||
|
||||
Example::
|
||||
|
||||
import Blender
|
||||
from Blender import NMesh, Object, Scene
|
||||
#
|
||||
me = NMesh.GetRaw("Plane") # get the mesh data called "Plane"
|
||||
if me.materials:
|
||||
print me.materials # print the list of materials
|
||||
mat = me.materials[0] # grab the first material in the list
|
||||
mat.R = 1.0 # redefine its red component
|
||||
for v in me.verts: # loop the list of vertices
|
||||
v.co[0] *= 2.5 # multiply the coordinates
|
||||
v.co[1] *= 5.0
|
||||
v.co[2] *= 2.5
|
||||
me.update() # update the real mesh in Blender
|
||||
|
||||
@type FaceFlags: readonly dictionary
|
||||
@type FaceModes: readonly dictionary
|
||||
@type FaceTranspModes: readonly dictionary
|
||||
@var FaceFlags: The available face selection flags:
|
||||
- SELECT - selected.
|
||||
- HIDE - hidden.
|
||||
- ACTIVE - the active face.
|
||||
@var FaceModes: The available face modes:
|
||||
- ALL - set all modes at once.
|
||||
- BILLBOARD - always orient after camera.
|
||||
- HALO - halo face, always point to camera.
|
||||
- DINAMYC - respond to collisions.
|
||||
- INVISIBLE - invisible face.
|
||||
- LIGHT - dinamyc lighting.
|
||||
- OBCOL - use object colour instead of vertex colours.
|
||||
- SHADOW - shadow type.
|
||||
- SHAREDVERT - apparently unused in Blender.
|
||||
- SHAREDCOL - shared vertex colours (per vertex).
|
||||
- TEX - has texture image.
|
||||
- TILES - uses tiled image.
|
||||
- TWOSIDE - two-sided face.
|
||||
@var FaceTranspModes: Note: these are ENUMS, they can't be combined (and'ed,
|
||||
or'ed, etc) like a bit vector. The available face transparency modes:
|
||||
- SOLID - draw solid.
|
||||
- ADD - add to background (halo).
|
||||
- ALPHA - draw with transparency.
|
||||
- SUB - subtract from background.
|
||||
"""
|
||||
|
||||
def Col(col = [255, 255, 255, 255]):
|
||||
"""
|
||||
Get a new mesh rgba color.
|
||||
@type col: list
|
||||
@param col: A list [red, green, blue, alpha] of int values in [0, 255].
|
||||
@rtype: NMCol
|
||||
@return: A new NMCol (mesh rgba color) object.
|
||||
"""
|
||||
|
||||
def Vert(x = 0, y = 0, z = 0):
|
||||
"""
|
||||
Get a new vertex object.
|
||||
@type x: float
|
||||
@type y: float
|
||||
@type z: float
|
||||
@param x: The x coordinate of the vertex.
|
||||
@param y: The y coordinate of the vertex.
|
||||
@param z: The z coordinate of the vertex.
|
||||
@rtype: NMVert
|
||||
@return: A new NMVert object.
|
||||
"""
|
||||
|
||||
def Face(vertexList = None):
|
||||
"""
|
||||
Get a new face object.
|
||||
@type vertexList: list
|
||||
@param vertexList: A list of B{up to 4} NMVerts (mesh vertex
|
||||
objects).
|
||||
@rtype: NMFace
|
||||
@return: A new NMFace object.
|
||||
"""
|
||||
|
||||
def New():
|
||||
"""
|
||||
Create a new mesh object.
|
||||
rtype: NMesh
|
||||
@return: A new (B{empty}) NMesh object.
|
||||
"""
|
||||
|
||||
def GetRaw(name = None):
|
||||
"""
|
||||
Get the mesh data object called I{name} from Blender.
|
||||
@type name: string
|
||||
@param name: The name of the mesh data object.
|
||||
@rtype: NMesh
|
||||
@return: It depends on the 'name' parameter:
|
||||
- (name) - The NMesh wrapper of the mesh called I{name},
|
||||
None if not found.
|
||||
- () - A new (empty) NMesh object.
|
||||
"""
|
||||
|
||||
def GetRawFromObject(name):
|
||||
"""
|
||||
Get the mesh data object from the Object in Blender called I{name}.
|
||||
@type name: string
|
||||
@param name: The name of an Object of type "Mesh".
|
||||
@rtype: NMesh
|
||||
@return: The NMesh wrapper of the mesh data from the Object called I{name}.
|
||||
"""
|
||||
|
||||
def PutRaw(nmesh, name = None, recalculate_normals = 1):
|
||||
"""
|
||||
Put an NMesh object back in Blender.
|
||||
@type nmesh: NMesh
|
||||
@type name: string
|
||||
@type recalculate_normals: int
|
||||
@param name: The name of the mesh data object in Blender which will receive
|
||||
this nmesh data. It can be an existing mesh data object or a new one.
|
||||
@param recalculate_normals: If non-zero, the vertex normals for the mesh will
|
||||
be recalculated.
|
||||
@rtype: None or Object
|
||||
@return: It depends on the 'name' parameter:
|
||||
- I{name} refers to an existing mesh data obj already linked to an
|
||||
object: return None.
|
||||
- I{name} refers to a new mesh data obj or an unlinked (no users) one:
|
||||
return the created Blender Object wrapper.
|
||||
"""
|
||||
|
||||
class NMCol:
|
||||
"""
|
||||
The NMCol object
|
||||
================
|
||||
This object is a list of ints: [r, g, b, a] representing an
|
||||
rgba colour.
|
||||
@cvar r: The Red component in [0, 255].
|
||||
@cvar g: The Green component in [0, 255].
|
||||
@cvar b: The Blue component in [0, 255].
|
||||
@cvar a: The Alpha (transparency) component in [0, 255].
|
||||
"""
|
||||
|
||||
class NMVert:
|
||||
"""
|
||||
The NMVert object
|
||||
=================
|
||||
This object holds mesh vertex data.
|
||||
@cvar co: The vertex coordinates (x, y, z).
|
||||
@cvar no: The vertex normal vector (nx, ny, nz).
|
||||
@cvar uvco: The vertex texture "sticky" coordinates.
|
||||
@cvar index: The vertex index, if owned by a mesh.
|
||||
"""
|
||||
|
||||
class NMFace:
|
||||
"""
|
||||
The NMFace object
|
||||
=================
|
||||
This object holds mesh face data.
|
||||
@type v: list
|
||||
@cvar v: The list of face vertices (B{up to 4}).
|
||||
@cvar col: The list of vertex colours.
|
||||
@cvar mat: Same as I{materialIndex} below.
|
||||
@cvar materialIndex: The index of this face's material in its NMesh materials
|
||||
list.
|
||||
@cvar smooth: If non-zero, the vertex normals are averaged to make this
|
||||
face look smooth.
|
||||
@cvar image: The Image used as a texture for this face.
|
||||
@cvar mode: The display mode (see L{Mesh.FaceModes<FaceModes>})
|
||||
@cvar flag: Bit vector specifying selection flags
|
||||
(see L{NMesh.FaceFlags<FaceFlags>}).
|
||||
@cvar transp: Transparency mode bit vector
|
||||
(see L{NMesh.FaceTranspModes<FaceTranspModes>}).
|
||||
@cvar uv: List of per-face UV coordinates: [(u0, v0), (u1, v1), ...].
|
||||
"""
|
||||
|
||||
def append(vertex):
|
||||
"""
|
||||
Append a vertex to this face's vertex list.
|
||||
@type vertex: NMVert
|
||||
@param vertex: An NMVert object.
|
||||
"""
|
||||
|
||||
class NMesh :
|
||||
"""
|
||||
The NMesh Data object
|
||||
=====================
|
||||
This object gives access to mesh data in Blender. We refer to mesh as the
|
||||
object in Blender and NMesh as its Python counterpart.
|
||||
@cvar name: The NMesh name. It's common to use this field to store extra
|
||||
data about the mesh (to be exported to another program, for example).
|
||||
@cvar materials: The list of materials used by this NMesh.
|
||||
@cvar verts: The list of NMesh vertices (NMVerts).
|
||||
@cvar users: The number of Objects using (linked to) this mesh.
|
||||
@cvar faces: The list of NMesh faces (NMFaces).
|
||||
"""
|
||||
|
||||
def hasVertexColours(flag = None):
|
||||
"""
|
||||
Get (and optionally set) if this NMesh has vertex colours.
|
||||
@type flag: int
|
||||
@param flag: If given and non-zero, the "vertex colour" flag for this NMesh
|
||||
is turned I{on}.
|
||||
@rtype: bool
|
||||
@return: The current value of the "vertex colour" flag.
|
||||
@warn: If a mesh has both vertex colours and textured faces, this function
|
||||
will return False. This is due to the way Blender deals internally with
|
||||
the vertex colours array (if there are textured faces, it is copied to
|
||||
the textured face structure and the original array is freed/deleted).
|
||||
If you want to know if a mesh has both textured faces and vertex
|
||||
colours, set *in Blender* the "VCol Paint" flag for each material that
|
||||
covers an area that was also vertex painted and then check in your
|
||||
Python script if that material flag is set. Of course also tell others
|
||||
who use your script to do the same. The "VCol Paint" material mode flag
|
||||
is the way to tell Blender itself to render with vertex colours, too, so
|
||||
it's a natural solution.
|
||||
"""
|
||||
|
||||
def hasFaceUV(flag = None):
|
||||
"""
|
||||
Get (and optionally set) if this NMesh has UV-mapped textured faces.
|
||||
@type flag: int
|
||||
@param flag: If given and non-zero, the "textured faces" flag for this
|
||||
NMesh is turned I{on}.
|
||||
@rtype: bool
|
||||
@return: The current value of the "textured faces" flag.
|
||||
"""
|
||||
|
||||
def hasVertexUV(flag = None):
|
||||
"""
|
||||
Get (and optionally set) the "sticky" flag that controls if a mesh has
|
||||
per vertex UV coordinates.
|
||||
@type flag: int
|
||||
@param flag: If given and non-zero, the "sticky" flag for this NMesh is
|
||||
turned I{on}.
|
||||
@rtype: bool
|
||||
@return: The current value of the "sticky" flag.
|
||||
"""
|
||||
|
||||
def getActiveFace():
|
||||
"""
|
||||
Get the index of the active face.
|
||||
@rtype: int
|
||||
@return: The index of the active face.
|
||||
"""
|
||||
|
||||
def getSelectedFaces(flag = None):
|
||||
"""
|
||||
Get list of selected faces.
|
||||
@type flag: int
|
||||
@param flag: If given and non-zero, the list will have indices instead of
|
||||
the NMFace objects themselves.
|
||||
@rtype: list
|
||||
@return: It depends on the I{flag} parameter:
|
||||
- if None or zero: List of NMFace objects.
|
||||
- if non-zero: List of indices to NMFace objects.
|
||||
"""
|
||||
|
||||
def getVertexInfluences(index):
|
||||
"""
|
||||
Get influences of bones in a specific vertex.
|
||||
@type index: int
|
||||
@param index: The index of a vertex.
|
||||
@rtype: list
|
||||
@return: List of pairs (name, weight), where name is the bone name (string)
|
||||
and its weight is a float value.
|
||||
"""
|
||||
|
||||
def insertKey(frame = None):
|
||||
"""
|
||||
Insert a mesh key at the given frame.
|
||||
@type frame: int
|
||||
@param frame: The Scene frame where the mesh key should be inserted. If
|
||||
None, the current frame is used.
|
||||
"""
|
||||
|
||||
def removeAllKeys():
|
||||
"""
|
||||
Remove all mesh keys stored in this mesh.
|
||||
@rtype: bool
|
||||
@return: True if succesful or False if this NMesh wasn't linked to a real
|
||||
Blender Mesh yet (or was, but the Mesh had no keys).
|
||||
@warn: Currently the mesh keys from meshs that are grabbed with
|
||||
NMesh.GetRaw() or .GetRawFromObject() are preserved, so if you want to
|
||||
clear them or don't want them at all, remember to call this method. Of
|
||||
course NMeshes created with NMesh.New() don't have mesh keys until you
|
||||
add them.
|
||||
"""
|
||||
|
||||
def update():
|
||||
"""
|
||||
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 linked to one, yet.
|
||||
"""
|
193
source/blender/python/api2_2x/doc/Scene.py
Normal file
193
source/blender/python/api2_2x/doc/Scene.py
Normal file
@@ -0,0 +1,193 @@
|
||||
# Blender.Scene module and the Scene PyType object
|
||||
|
||||
"""
|
||||
The Blender.Scene submodule.
|
||||
|
||||
Scene
|
||||
=====
|
||||
|
||||
This module provides access to B{Scenes} in Blender.
|
||||
|
||||
Example::
|
||||
|
||||
"""
|
||||
|
||||
def New (name = 'Scene'):
|
||||
"""
|
||||
Create a new Scene in Blender.
|
||||
@type name: string
|
||||
@param name: The Scene name.
|
||||
@rtype: Blender Scene
|
||||
@return: The created Scene.
|
||||
"""
|
||||
|
||||
def Get (name = None):
|
||||
"""
|
||||
Get the Scene(s) from Blender.
|
||||
@type name: string
|
||||
@param name: The name of a Scene.
|
||||
@rtype: Blender Scene or a list of Blender Scenes
|
||||
@return: It depends on the I{name} parameter:
|
||||
- (name): The Scene with the given I{name};
|
||||
- (): A list with all Scenes currently in Blender.
|
||||
"""
|
||||
|
||||
def GetCurrent():
|
||||
"""
|
||||
Get the currently active Scene in Blender.
|
||||
@rtype: Blender Scene
|
||||
@return: The currently active Scene.
|
||||
"""
|
||||
|
||||
def Unlink(scene):
|
||||
"""
|
||||
Unlink (delete) a Scene from Blender.
|
||||
@type scene: Blender Scene
|
||||
@param scene: The Scene to be unlinked.
|
||||
"""
|
||||
|
||||
class Scene:
|
||||
"""
|
||||
The Scene object
|
||||
================
|
||||
This object gives access to Scene data in Blender.
|
||||
@cvar name: The Scene name.
|
||||
"""
|
||||
|
||||
def getName():
|
||||
"""
|
||||
Get the name of this Scene.
|
||||
@rtype: string
|
||||
"""
|
||||
|
||||
def setName(name):
|
||||
"""
|
||||
Set the name of this Scene.
|
||||
@type name: string
|
||||
@param name: The new name.
|
||||
"""
|
||||
|
||||
def getWinSize():
|
||||
"""
|
||||
Get the current x,y resolution of the render window. These are the
|
||||
dimensions of the image created by the Blender Renderer.
|
||||
@rtype: list
|
||||
@return: [width, height].
|
||||
"""
|
||||
|
||||
def setWinSize(dimensions):
|
||||
"""
|
||||
Set the width and height of the render window. These are the dimensions
|
||||
of the image created by the Blender Renderer.
|
||||
@type dimensions: list
|
||||
@param dimensions: The new [width, height] values.
|
||||
"""
|
||||
|
||||
def copy(duplicate_objects = 1):
|
||||
"""
|
||||
Make a copy of this Scene.
|
||||
@type duplicate_objects: int
|
||||
@param duplicate_objects: Defines how the Scene children are duplicated:
|
||||
- 0: Link Objects;
|
||||
- 1: Link Object Data;
|
||||
- 2: Full copy.
|
||||
@rtype: Scene
|
||||
@return: The copied Blender Scene.
|
||||
"""
|
||||
|
||||
def startFrame(frame = None):
|
||||
"""
|
||||
Get (and optionally set) the start frame value.
|
||||
@type frame: int
|
||||
@param frame: The start frame. If None, this method simply returns the
|
||||
current start frame.
|
||||
@rtype: int
|
||||
@return: The start frame value.
|
||||
"""
|
||||
|
||||
def endFrame(frame = None):
|
||||
"""
|
||||
Get (and optionally set) the end frame value.
|
||||
@type frame: int
|
||||
@param frame: The end frame. If None, this method simply returns the
|
||||
current end frame.
|
||||
@rtype: int
|
||||
@return: The end frame value.
|
||||
"""
|
||||
|
||||
def currentFrame(frame = None):
|
||||
"""
|
||||
Get (and optionally set) the current frame value.
|
||||
@type frame: int
|
||||
@param frame: The current frame. If None, this method simply returns the
|
||||
current frame value.
|
||||
@rtype: int
|
||||
@return: The current frame value.
|
||||
"""
|
||||
|
||||
def frameSettings(start = None, end = None, current = None):
|
||||
"""
|
||||
Get (and optionally set) the start, end and current frame values.
|
||||
@type start: int
|
||||
@type end: int
|
||||
@type current: int
|
||||
@param start: The start frame value.
|
||||
@param end: The end frame value.
|
||||
@param current: The current frame value.
|
||||
@rtype: tuple
|
||||
@return: The frame values in a tuple: [start, end, current].
|
||||
"""
|
||||
|
||||
def makeCurrent():
|
||||
"""
|
||||
Make this Scene the currently active one in Blender.
|
||||
"""
|
||||
|
||||
def link(object):
|
||||
"""
|
||||
Link an Object to this Scene.
|
||||
@type object: Blender Object
|
||||
@param object: A Blender Object.
|
||||
"""
|
||||
|
||||
def unlink(object):
|
||||
"""
|
||||
Unlink an Object from this Scene.
|
||||
@type object: Blender Object
|
||||
@param object: A Blender Object.
|
||||
"""
|
||||
|
||||
def getRenderdir():
|
||||
"""
|
||||
Get the current directory where rendered images are saved.
|
||||
@rtype: string
|
||||
@return: The path to the current render dir
|
||||
"""
|
||||
|
||||
def getBackbufdir():
|
||||
"""
|
||||
Get the location of the backbuffer image.
|
||||
@rtype: string
|
||||
@return: The path to the chosen backbuffer image.
|
||||
"""
|
||||
|
||||
def getChildren():
|
||||
"""
|
||||
Get all objects linked to this Scene.
|
||||
@rtype: list
|
||||
@return: A list with all Blender Objects linked to this Scene.
|
||||
"""
|
||||
|
||||
def getCurrentCamera():
|
||||
"""
|
||||
Get the currently active Camera for this Scene.
|
||||
@rtype: Blender Camera
|
||||
@return: The currently active Camera.
|
||||
"""
|
||||
|
||||
def setCurrentCamera(camera):
|
||||
"""
|
||||
Set the currently active Camera in this Scene.
|
||||
@type camera: Blender Camera
|
||||
@param camera: The new active Camera.
|
||||
"""
|
53
source/blender/python/api2_2x/doc/Types.py
Normal file
53
source/blender/python/api2_2x/doc/Types.py
Normal file
@@ -0,0 +1,53 @@
|
||||
# The Blender.Types submodule
|
||||
|
||||
"""
|
||||
The Blender.Types submodule
|
||||
===========================
|
||||
|
||||
This module is a dictionary of Blender Python types, for type checking.
|
||||
|
||||
Example::
|
||||
|
||||
import Blender
|
||||
from Blender import Types, Object, NMesh, Camera, Lamp
|
||||
#
|
||||
objs = Object.Get() # a list of all objects in the current scene
|
||||
for o in objs:
|
||||
print
|
||||
print o, type(o)
|
||||
data = o.getData()
|
||||
print type(data)
|
||||
if type(data) == Types.NMeshType:
|
||||
if len(data.verts):
|
||||
print "its vertices are obviously of type:", type(data.verts[0])
|
||||
print "and its faces:", Types.NMFaceType
|
||||
elif type(data) == Types.CameraType:
|
||||
print "It's a Camera."
|
||||
elif type(data) == Types.LampType:
|
||||
print "Let there be light!"
|
||||
|
||||
@var ObjectType: Blender Object. The base object, linked to its specific data
|
||||
at its .data member variable.
|
||||
@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.
|
||||
@var NMVertType: Blender NMVert. A mesh vertex.
|
||||
@var NMColType: Blender NMCol. A mesh rgba colour.
|
||||
@var ArmatureType: Blender Armature. The "skeleton", for animating and deforming
|
||||
objects.
|
||||
@var BoneType: Blender Bone. Bones are, obviously, the "pieces" of an Armature.
|
||||
@var CurveType: Blender Curve.
|
||||
@var IpoType: Blender Ipo.
|
||||
@var MetaballType: Blender Metaball.
|
||||
@var CameraType: Blender Camera.
|
||||
@var ImageType: Blender Image.
|
||||
@var LampType: Blender Lamp.
|
||||
@var TextType: Blender Text.
|
||||
@var MaterialType: Blender Material.
|
||||
@var SceneType: A Blender Scene. Container of all other objects.
|
||||
@var ButtonType: Blender Button. One of the Draw widgets.
|
||||
@var vectorType: Blender vector. Used in NMesh.
|
||||
@var bufferType: Blender buffer. A contiguous piece of storage, used in BGL.
|
||||
@var constantType: Blender constant. A constant dictionary.
|
||||
@var rgbTupleType: Blender rgbTuple. A (red, green, blue) triplet.
|
||||
"""
|
@@ -108,9 +108,10 @@ def ImageSelector (callback, title = 'SELECT IMAGE'):
|
||||
def DrawProgressBar (done, text):
|
||||
"""
|
||||
Draw a progress bar in the upper right corner of the screen. To cancel it
|
||||
prematurely, users can press the "Esc" key.
|
||||
prematurely, users can press the "Esc" key. Start it with done = 0 and end
|
||||
it with done = 1.
|
||||
@type done: float
|
||||
@param done: A float in [0, 1] that tells the advance in the progress
|
||||
@param done: A float in [0.0, 1.0] that tells the advance in the progress
|
||||
bar.
|
||||
@type text: string
|
||||
@param text: Info about what is currently being done "behind the scenes".
|
||||
|
Reference in New Issue
Block a user