[Bf-python] wishes about colorbands
nicolas bonnand
nicolas.bonnand at wanadoo.fr
Fri Mar 26 22:12:18 CET 2004
Hi,
If I could make a wish...
I'd like colorband to be a class
by itself.
I'd like to manipulate colorbands
instances as objects, and even
as "named" objects.
I could have a rainbow colorband called "rainbow",
, etc ...
and I could ask "Give me the colorband object whose
name is 'rainbow' "
A colorband class would facilitate works with colorbands
(colorbands import and export with other applications
such as The Gimp for example.)
The idea would be somethings like this:
(the following is not python code,
it is rather imaginary code)
###### class ColorBandPoint #######
attributes:
-----------
r: red value from 0.000 to 1.000
g: green...
b: blue....
a: alpha...
methods:
-------
new() constructor
###### class ColorBand #####
attributes:
-----------
data: { hash of ColorBandPoint objects, the hash keys being the ColorBandPoint positions}
name: the name of the color band
interpol: the interpolation type (E, L or S )
methods:
-------
new() constructor
getColorband(optional string name)
-> returns a colorBand object whose name is name
-> returns the complete list of colorbands defined
in the scene, if name is not given
addPoint(ColorBandPoint cbp,float pos)
-> insert the colorbandpoint cbp in the colorband
at the position pos
delPoint(float position)
-> delete a point in the colorband
delColorBand()
-> delete the colorband
### and for the existing Class Texture ####
new attributes:
---------------
colorband: the colorband object linked with the texture
new methods:
------------
setColorBand(ColorBand cbd)
-> link texture instance with colorband
unsetColorBand()
-> delete link between colorband from texture
but don't delete colorband object of course !
registerColorBand(string name)
Suppose someone, creates a colorband, not
from python, but directly from blender user
interface.Python might not be aware of it.
This function, would be used to tell python:
" Hey ! There's a colorband in this texture !
Python, could you please create a colorband
object that matches it "
Regards,
Nicolas
More information about the Bf-python
mailing list