[Bf-committers] [#17481] Python Complete Access to ColorBand Properties

Emilio José Encinas Mir asfhalen at gmail.com
Fri Aug 15 13:26:55 CEST 2008

In the patch I edited two files:
 - ./source/blender/python/api2_2x/Material.h
 - ./source/blender/python/api2_2x/Material.c

This patch I've done achieves fullaccess to the Color Bands of a
material instance. While it remains the actual mode
Material.Modes.RAMPCOL* to know if a Color Band is active or not and
the list of color points with the
MatInstance.colorbandDiffuse o MatInstance.colorbandSpecular, the
patch adds functions to the Python Material Instance
to make fully accesible. The Functions added are:

For Diffuse RampCol:
MatInstance.getColorBandDiffuseFactor() - Returns the actual Factor
MatInstance.getColorBandDiffuseMethod() - Returns the actual Method
MatInstance.getColorBandDiffuseInput() - Returns the actual Input
MatInstance.setColorBandDiffuseFactor(float) - Sets/Chages the Factor
MatInstance.setColorBandDiffuseMethod(int) - Sets/Changes the Method
MatInstance.setColorBandDiffuseInput(int) - Sets/Changes the Input

For Specular RampCol:
MatInstance.getColorBandSpecularFactor() - Returns the actual Factor
MatInstance.getColorBandSpecularMethod() - Returns the actual Method
MatInstance.getColorBandSpecularInput() - Returns the actual Input
MatInstance.setColorBandSpecularFactor(float) - Sets/Chages the Factor
MatInstance.setColorBandSpecularMethod(int) - Sets/Changes the Method
MatInstance.setColorBandSpecularInput(int) - Sets/Changes the Input

In adittion, to make it easy to use the Patch adds two Dictionary to
de Material Class, so among the Material.Modes
and Material.Shaders thera are two dictionaries more:

 - SHADER - Returns the value assigned to Shader Input for ColRamps
 - ENERGY - Returns the value assigned to Energy Input for ColRamps
 - NORMAL - Returns the value assigned to Normal Input for ColRamps
 - RESULT - Returns the value assigned to Result Input for ColRamps

 - BLEND - Returns the value of Blend Method for ColRamps
 - MIX - Returns the same value of Blend, added to avoid confusion
between Blend internal name and Mix name showed in
the GUI
 - ADD - Returns the value of Add Method for ColRamps
 - MULT - Returns the value of Multiply Method for ColRamps
 - SUB - Returns the value of Substract Method for ColRamps
 - SCREEN - Returns the value of Screen Method for ColRamps
 - DIV - Returns the value of Divide Method for ColRamps
 - DIFF - Returns the value of Difference Method for ColRamps
 - DARK - Returns the value of Darken Method for ColRamps
 - LIGHT - Returns the value of Lighten Method for ColRamps
 - OVERLAY - Returns the value of Overlay Method for ColRamps
 - DODGE - Returns the value of Dodge Method for ColRamps
 - BURN - Returns the value of Burn Method for ColRamps
 - HUE - Returns the value of Hue Method for ColRamps
 - SAT - Returns the value of Saturation Method for ColRamps
 - VAL - Returns the value of Value Method for ColRamps
 - COLOR - Returns the value of Color Method for ColRamps

The only file I haven't patched is the
./source/blender/python/api2_2x/doc/Material.py, but the only thing to
do is
add all the new information to it.

I added the two diff files of Material.c and Material.h based on the
stable source release Blender 2.46 tar package
downloaded from the web. (If it's of help, I would say that the diff
files are generated with the comand "diff
original_file modified_by_me_file > dif_file")
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.blender.org/pipermail/bf-committers/attachments/20080815/937e9b73/attachment.htm 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 2008-08-15_Material_c.diff
Type: application/octet-stream
Size: 10619 bytes
Desc: not available
Url : http://lists.blender.org/pipermail/bf-committers/attachments/20080815/937e9b73/attachment.obj 

More information about the Bf-committers mailing list