[#18936] Particle Related Patch
from Alberto Santos (dnakhain) This also adds the option to duplicate a particle system with an object. --- description from the patch submission. This patch includes my latest additions to the Python API developed for my Degree's Project. It includes: - Particle - Vertex group dictionary in doc (to use with setvertexgroup/getvertexgroup) - Particle.New return psys (not specified in doc) - Draw As variable and dict - Strand render toggle - Object - psys variable in duplicate - Material - Strand render variables - Texture - Use colorbands - Lamp - Spot buffer type selection
This commit is contained in:
@@ -125,6 +125,8 @@
|
||||
#define EXPP_LAMP_COL_MAX 1.0
|
||||
#define EXPP_LAMP_FALLOFF_MIN LA_FALLOFF_CONSTANT
|
||||
#define EXPP_LAMP_FALLOFF_MAX LA_FALLOFF_SLIDERS
|
||||
#define EXPP_LAMP_BUFFERTYPE_MIN LA_SHADBUF_REGULAR
|
||||
#define EXPP_LAMP_BUFFERTYPE_MAX LA_SHADBUF_HALFWAY
|
||||
|
||||
/* Raytracing settings */
|
||||
#define EXPP_LAMP_RAYSAMPLES_MIN 1
|
||||
@@ -268,6 +270,8 @@ static PyObject *Lamp_clearScriptLinks( BPy_Lamp * self, PyObject * args );
|
||||
static int Lamp_setComponent( BPy_Lamp * self, PyObject * value, void * closure );
|
||||
static PyObject *Lamp_getFalloffType( BPy_Lamp * self );
|
||||
static int Lamp_setFalloffType( BPy_Lamp * self, PyObject * value );
|
||||
static PyObject *Lamp_getBufferType( BPy_Lamp * self );
|
||||
static int Lamp_setBufferType( BPy_Lamp * self, PyObject * value );
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Python BPy_Lamp methods table: */
|
||||
@@ -489,6 +493,10 @@ static PyGetSetDef BPy_Lamp_getseters[] = {
|
||||
(getter)Lamp_getFalloffType, (setter)Lamp_setFalloffType,
|
||||
"Lamp falloff type",
|
||||
NULL},
|
||||
{"bufferType",
|
||||
(getter)Lamp_getBufferType, (setter)Lamp_setBufferType,
|
||||
"Lamp buffer type",
|
||||
NULL},
|
||||
{"R",
|
||||
(getter)Lamp_getComponent, (setter)Lamp_setComponent,
|
||||
"Lamp color red component",
|
||||
@@ -828,13 +836,31 @@ static PyObject *Lamp_FalloffsDict( void )
|
||||
return Falloffs;
|
||||
}
|
||||
|
||||
static PyObject *Lamp_BufferTypesDict( void )
|
||||
{ /* create the Blender.Lamp.BufferTypes constant dict */
|
||||
PyObject *Types = PyConstant_New( );
|
||||
|
||||
if( Types ) {
|
||||
BPy_constant *c = ( BPy_constant * ) Types;
|
||||
|
||||
PyConstant_Insert( c, "REGULAR",
|
||||
PyInt_FromLong( LA_SHADBUF_REGULAR ) );
|
||||
PyConstant_Insert( c, "IRREGULAR",
|
||||
PyInt_FromLong( LA_SHADBUF_IRREGULAR ) );
|
||||
PyConstant_Insert( c, "HALFWAY",
|
||||
PyInt_FromLong( LA_SHADBUF_HALFWAY ) );
|
||||
}
|
||||
|
||||
return Types;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Function: Lamp_Init */
|
||||
/*****************************************************************************/
|
||||
/* Needed by the Blender module, to register the Blender.Lamp submodule */
|
||||
PyObject *Lamp_Init( void )
|
||||
{
|
||||
PyObject *submodule, *Types, *Modes, *Falloffs;
|
||||
PyObject *submodule, *Types, *Modes, *Falloffs, *BufferTypes;
|
||||
|
||||
if( PyType_Ready( &Lamp_Type ) < 0)
|
||||
return NULL;
|
||||
@@ -842,6 +868,7 @@ PyObject *Lamp_Init( void )
|
||||
Types = Lamp_TypesDict( );
|
||||
Modes = Lamp_ModesDict( );
|
||||
Falloffs = Lamp_FalloffsDict( );
|
||||
BufferTypes = Lamp_BufferTypesDict( );
|
||||
|
||||
submodule =
|
||||
Py_InitModule3( "Blender.Lamp", M_Lamp_methods, M_Lamp_doc );
|
||||
@@ -852,6 +879,8 @@ PyObject *Lamp_Init( void )
|
||||
PyModule_AddObject( submodule, "Modes", Modes );
|
||||
if( Falloffs )
|
||||
PyModule_AddObject( submodule, "Falloffs", Falloffs );
|
||||
if( BufferTypes )
|
||||
PyModule_AddObject( submodule, "BufferTypes", BufferTypes );
|
||||
|
||||
PyModule_AddIntConstant( submodule, "RGB", IPOKEY_RGB );
|
||||
PyModule_AddIntConstant( submodule, "ENERGY", IPOKEY_ENERGY );
|
||||
@@ -1029,6 +1058,11 @@ static PyObject *Lamp_getFalloffType( BPy_Lamp * self )
|
||||
return PyInt_FromLong( (int)self->lamp->falloff_type );
|
||||
}
|
||||
|
||||
static PyObject *Lamp_getBufferType( BPy_Lamp * self )
|
||||
{
|
||||
return PyInt_FromLong( (int)self->lamp->buftype );
|
||||
}
|
||||
|
||||
static int Lamp_setType( BPy_Lamp * self, PyObject * value )
|
||||
{
|
||||
return EXPP_setIValueRange ( value, &self->lamp->type,
|
||||
@@ -1217,6 +1251,11 @@ static int Lamp_setFalloffType( BPy_Lamp * self, PyObject * value )
|
||||
EXPP_LAMP_FALLOFF_MIN, EXPP_LAMP_FALLOFF_MAX, 'h' );
|
||||
}
|
||||
|
||||
static int Lamp_setBufferType( BPy_Lamp * self, PyObject * value )
|
||||
{
|
||||
return EXPP_setIValueRange ( value, &self->lamp->buftype,
|
||||
EXPP_LAMP_BUFFERTYPE_MIN, EXPP_LAMP_BUFFERTYPE_MAX, 'h' );
|
||||
}
|
||||
|
||||
static PyObject *Lamp_getComponent( BPy_Lamp * self, void * closure )
|
||||
{
|
||||
|
@@ -747,6 +747,26 @@ static PyObject *Material_getColorbandSpecularInput( BPy_Material * self );
|
||||
static int Material_setColorbandDiffuseInput ( BPy_Material * self, PyObject * value);
|
||||
static int Material_setColorbandSpecularInput ( BPy_Material * self, PyObject * value);
|
||||
|
||||
static PyObject *Material_getStrandTangentShad( BPy_Material * self );
|
||||
static int Material_setStrandTangentShad( BPy_Material * self, PyObject * value);
|
||||
static PyObject *Material_getStrandSurfDiff( BPy_Material * self );
|
||||
static int Material_setStrandSurfDiff( BPy_Material * self, PyObject * value);
|
||||
static PyObject *Material_getStrandDist( BPy_Material * self );
|
||||
static int Material_setStrandDist( BPy_Material * self, PyObject * value);
|
||||
static PyObject *Material_getStrandBlendUnit( BPy_Material * self );
|
||||
static int Material_setStrandBlendUnit( BPy_Material * self, PyObject * value);
|
||||
static PyObject *Material_getStrandStart( BPy_Material * self );
|
||||
static int Material_setStrandStart( BPy_Material * self, PyObject * value);
|
||||
static PyObject *Material_getStrandEnd( BPy_Material * self );
|
||||
static int Material_setStrandEnd( BPy_Material * self, PyObject * value);
|
||||
static PyObject *Material_getStrandMin( BPy_Material * self );
|
||||
static int Material_setStrandMin( BPy_Material * self, PyObject * value);
|
||||
static PyObject *Material_getStrandShape( BPy_Material * self );
|
||||
static int Material_setStrandShape( BPy_Material * self, PyObject * value);
|
||||
static PyObject *Material_getStrandWidthFad( BPy_Material * self );
|
||||
static int Material_setStrandWidthFad( BPy_Material * self, PyObject * value);
|
||||
static PyObject *Material_getStrandUV( BPy_Material * self );
|
||||
static int Material_setStrandUV( BPy_Material * self, PyObject * value);
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
@@ -1313,6 +1333,46 @@ static PyGetSetDef BPy_Material_getseters[] = {
|
||||
(getter)Material_getColorbandDiffuseInput, (setter)Material_setColorbandDiffuseInput,
|
||||
"The diffuse colorband input for this material",
|
||||
NULL},
|
||||
{"strandTanShad",
|
||||
(getter)Material_getStrandTangentShad, (setter)Material_setStrandTangentShad,
|
||||
"Uses direction of strands as normal for tangent-shading",
|
||||
NULL},
|
||||
{"strandSurfDiff",
|
||||
(getter)Material_getStrandSurfDiff, (setter)Material_setStrandSurfDiff,
|
||||
"Make diffuse shading more similar to shading the surface",
|
||||
NULL},
|
||||
{"strandDist",
|
||||
(getter)Material_getStrandDist, (setter)Material_setStrandDist,
|
||||
"Distance in Blender units over which to blend in the surface normal",
|
||||
NULL},
|
||||
{"strandBlendUnit",
|
||||
(getter)Material_getStrandBlendUnit, (setter)Material_setStrandBlendUnit,
|
||||
"Use actual Blender units for widths instead of pixels",
|
||||
NULL},
|
||||
{"strandStart",
|
||||
(getter)Material_getStrandStart, (setter)Material_setStrandStart,
|
||||
"Start size of strands",
|
||||
NULL},
|
||||
{"strandEnd",
|
||||
(getter)Material_getStrandEnd, (setter)Material_setStrandEnd,
|
||||
"End size of strands",
|
||||
NULL},
|
||||
{"strandMin",
|
||||
(getter)Material_getStrandMin, (setter)Material_setStrandMin,
|
||||
"Minimum size of strands in pixels",
|
||||
NULL},
|
||||
{"strandShape",
|
||||
(getter)Material_getStrandShape, (setter)Material_setStrandShape,
|
||||
"Shape of strands, positive value makes it rounder, negative makes it spiky",
|
||||
NULL},
|
||||
{"strandFade",
|
||||
(getter)Material_getStrandWidthFad, (setter)Material_setStrandWidthFad,
|
||||
"Transparency along the width of the strand",
|
||||
NULL},
|
||||
{"strandUV",
|
||||
(getter)Material_getStrandUV, (setter)Material_setStrandUV,
|
||||
"Set name of UV layer to override",
|
||||
NULL},
|
||||
|
||||
/* SSS settings */
|
||||
{"enableSSS",
|
||||
@@ -3582,3 +3642,146 @@ static int Material_setColorbandSpecularInput ( BPy_Material * self, PyObject *
|
||||
return EXPP_setIValueClamped(value, &self->material->rampin_spec,
|
||||
MA_RAMP_IN_SHADER, MA_RAMP_IN_RESULT, 'b');
|
||||
}
|
||||
|
||||
/* Strand */
|
||||
|
||||
static PyObject *Material_getStrandTangentShad( BPy_Material * self )
|
||||
{
|
||||
return PyInt_FromLong( ((long)( self->material->mode & MA_TANGENT_STR )) > 0 );
|
||||
}
|
||||
|
||||
static int Material_setStrandTangentShad( BPy_Material * self, PyObject * value)
|
||||
{
|
||||
int number;
|
||||
|
||||
if( !PyInt_Check( value ) )
|
||||
return EXPP_ReturnIntError( PyExc_TypeError, "expected int argument" );
|
||||
|
||||
number = PyInt_AS_LONG( value );
|
||||
|
||||
if (number){
|
||||
self->material->mode |= MA_TANGENT_STR;
|
||||
}else{
|
||||
self->material->mode &= ~MA_TANGENT_STR;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static PyObject *Material_getStrandSurfDiff( BPy_Material * self )
|
||||
{
|
||||
return PyInt_FromLong( ((long)( self->material->mode & MA_STR_SURFDIFF )) > 0 );
|
||||
}
|
||||
|
||||
static int Material_setStrandSurfDiff( BPy_Material * self, PyObject * value)
|
||||
{
|
||||
int number;
|
||||
|
||||
if( !PyInt_Check( value ) )
|
||||
return EXPP_ReturnIntError( PyExc_TypeError, "expected int argument" );
|
||||
|
||||
number = PyInt_AS_LONG( value );
|
||||
|
||||
if (number){
|
||||
self->material->mode |= MA_STR_SURFDIFF;
|
||||
}else{
|
||||
self->material->mode &= ~MA_STR_SURFDIFF;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static PyObject *Material_getStrandDist( BPy_Material * self )
|
||||
{
|
||||
return PyFloat_FromDouble( ((float)( self->material->strand_surfnor )) );
|
||||
}
|
||||
|
||||
static int Material_setStrandDist( BPy_Material * self, PyObject * value)
|
||||
{
|
||||
return EXPP_setFloatRange( value, &self->material->strand_surfnor, 0.0, 10.0 );
|
||||
}
|
||||
|
||||
static PyObject *Material_getStrandBlendUnit( BPy_Material * self )
|
||||
{
|
||||
return PyInt_FromLong( ((long)( self->material->mode & MA_STR_B_UNITS )) > 0 );
|
||||
}
|
||||
|
||||
static int Material_setStrandBlendUnit( BPy_Material * self, PyObject * value)
|
||||
{
|
||||
int number;
|
||||
|
||||
if( !PyInt_Check( value ) )
|
||||
return EXPP_ReturnIntError( PyExc_TypeError, "expected int argument" );
|
||||
|
||||
number = PyInt_AS_LONG( value );
|
||||
|
||||
if (number){
|
||||
self->material->mode |= MA_STR_B_UNITS;
|
||||
}else{
|
||||
self->material->mode &= ~MA_STR_B_UNITS;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static PyObject *Material_getStrandStart( BPy_Material * self )
|
||||
{
|
||||
return PyFloat_FromDouble( ((float)( self->material->strand_sta )) );
|
||||
}
|
||||
|
||||
static int Material_setStrandStart( BPy_Material * self, PyObject * value)
|
||||
{
|
||||
return EXPP_setFloatRange( value, &self->material->strand_sta, 0.0001, 2.0 );
|
||||
}
|
||||
|
||||
static PyObject *Material_getStrandEnd( BPy_Material * self )
|
||||
{
|
||||
return PyFloat_FromDouble( ((float)( self->material->strand_end )) );
|
||||
}
|
||||
|
||||
static int Material_setStrandEnd( BPy_Material * self, PyObject * value)
|
||||
{
|
||||
return EXPP_setFloatRange( value, &self->material->strand_end, 0.0001, 1.0 );
|
||||
}
|
||||
|
||||
static PyObject *Material_getStrandMin( BPy_Material * self )
|
||||
{
|
||||
return PyFloat_FromDouble( ((float)( self->material->strand_min )) );
|
||||
}
|
||||
|
||||
static int Material_setStrandMin( BPy_Material * self, PyObject * value)
|
||||
{
|
||||
return EXPP_setFloatRange( value, &self->material->strand_min, 0.0001, 10.0 );
|
||||
}
|
||||
|
||||
static PyObject *Material_getStrandShape( BPy_Material * self )
|
||||
{
|
||||
return PyFloat_FromDouble( ((float)( self->material->strand_ease )) );
|
||||
}
|
||||
|
||||
static int Material_setStrandShape( BPy_Material * self, PyObject * value)
|
||||
{
|
||||
return EXPP_setFloatRange( value, &self->material->strand_ease, -0.9, 0.9 );
|
||||
}
|
||||
|
||||
static PyObject *Material_getStrandWidthFad( BPy_Material * self )
|
||||
{
|
||||
return PyFloat_FromDouble( ((float)( self->material->strand_widthfade )) );
|
||||
}
|
||||
|
||||
static int Material_setStrandWidthFad( BPy_Material * self, PyObject * value)
|
||||
{
|
||||
return EXPP_setFloatRange( value, &self->material->strand_widthfade, 0.0, 2.0 );
|
||||
}
|
||||
|
||||
static PyObject *Material_getStrandUV( BPy_Material * self )
|
||||
{
|
||||
return EXPP_ReturnPyObjError( PyExc_NotImplementedError,
|
||||
"Material.strandUV not implemented" );
|
||||
}
|
||||
|
||||
static int Material_setStrandUV( BPy_Material * self, PyObject * value)
|
||||
{
|
||||
return EXPP_ReturnPyObjError( PyExc_NotImplementedError,
|
||||
"Material.strandUV not implemented" );
|
||||
}
|
||||
|
@@ -1001,9 +1001,10 @@ static PyObject *M_Object_Duplicate( PyObject * self_unused,
|
||||
int material_dupe = 0;
|
||||
int texture_dupe = 0;
|
||||
int ipo_dupe = 0;
|
||||
int psys_dupe = 0;
|
||||
|
||||
static char *kwlist[] = {"mesh", "surface", "curve",
|
||||
"text", "metaball", "armature", "lamp", "material", "texture", "ipo", NULL};
|
||||
"text", "metaball", "armature", "lamp", "material", "texture", "ipo", "psys", NULL};
|
||||
|
||||
/* duplicating in background causes segfaults */
|
||||
if( G.background == 1 )
|
||||
@@ -1011,11 +1012,11 @@ static PyObject *M_Object_Duplicate( PyObject * self_unused,
|
||||
"cannot duplicate objects in background mode" );
|
||||
|
||||
|
||||
if (!PyArg_ParseTupleAndKeywords(args, kwd, "|iiiiiiiiii", kwlist,
|
||||
if (!PyArg_ParseTupleAndKeywords(args, kwd, "|iiiiiiiiiii", kwlist,
|
||||
&mesh_dupe, &surface_dupe, &curve_dupe, &text_dupe, &metaball_dupe,
|
||||
&armature_dupe, &lamp_dupe, &material_dupe, &texture_dupe, &ipo_dupe))
|
||||
&armature_dupe, &lamp_dupe, &material_dupe, &texture_dupe, &ipo_dupe, &psys_dupe))
|
||||
return EXPP_ReturnPyObjError( PyExc_TypeError,
|
||||
"expected nothing or bool keywords 'mesh', 'surface', 'curve', 'text', 'metaball', 'armature', 'lamp' 'material', 'texture' and 'ipo' as arguments" );
|
||||
"expected nothing or bool keywords 'mesh', 'surface', 'curve', 'text', 'metaball', 'armature', 'lamp' 'material', 'texture', 'ipo' and 'psys' as arguments" );
|
||||
|
||||
/* USER_DUP_ACT for actions is not supported in the UI so dont support it here */
|
||||
if (mesh_dupe) dupflag |= USER_DUP_MESH;
|
||||
@@ -1028,6 +1029,7 @@ static PyObject *M_Object_Duplicate( PyObject * self_unused,
|
||||
if (material_dupe) dupflag |= USER_DUP_MAT;
|
||||
if (texture_dupe) dupflag |= USER_DUP_TEX;
|
||||
if (ipo_dupe) dupflag |= USER_DUP_IPO;
|
||||
if (psys_dupe) dupflag |= USER_DUP_PSYS;
|
||||
adduplicate(2, dupflag); /* 2 is a mode with no transform and no redraw, Duplicate the current selection, context sensitive */
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
@@ -42,6 +42,7 @@
|
||||
#include "BKE_utildefines.h"
|
||||
#include "BKE_pointcache.h"
|
||||
#include "BKE_DerivedMesh.h"
|
||||
#include "BKE_library.h"
|
||||
#include "BIF_editparticle.h"
|
||||
#include "BIF_space.h"
|
||||
#include "blendef.h"
|
||||
@@ -70,6 +71,9 @@ static PyObject *Part_GetMat( BPy_PartSys * self, PyObject * args );
|
||||
static PyObject *Part_GetSize( BPy_PartSys * self, PyObject * args );
|
||||
static PyObject *Part_GetVertGroup( BPy_PartSys * self, PyObject * args );
|
||||
static PyObject *Part_SetVertGroup( BPy_PartSys * self, PyObject * args );
|
||||
static int Part_SetName( BPy_PartSys * self, PyObject * args );
|
||||
static PyObject *Part_SetNameWithMethod( BPy_PartSys * self, PyObject * args );
|
||||
static PyObject *Part_GetName( BPy_PartSys * self, PyObject * args );
|
||||
static int Part_setSeed( BPy_PartSys * self, PyObject * args );
|
||||
static PyObject *Part_getSeed( BPy_PartSys * self );
|
||||
static int Part_setType( BPy_PartSys * self, PyObject * args );
|
||||
@@ -141,11 +145,16 @@ static int Part_setRenderDied( BPy_PartSys * self, PyObject * args );
|
||||
static PyObject *Part_getRenderDied( BPy_PartSys * self );
|
||||
static int Part_setRenderMaterialIndex( BPy_PartSys * self, PyObject * args );
|
||||
static PyObject *Part_getRenderMaterialIndex( BPy_PartSys * self );
|
||||
static int Part_setStrandRender( BPy_PartSys * self, PyObject * args );
|
||||
static PyObject *Part_getStrandRender( BPy_PartSys * self );
|
||||
static int Part_setStrandRenderAn( BPy_PartSys * self, PyObject * args );
|
||||
static PyObject *Part_getStrandRenderAn( BPy_PartSys * self );
|
||||
static int Part_setStep( BPy_PartSys * self, PyObject * args );
|
||||
static PyObject *Part_getStep( BPy_PartSys * self );
|
||||
static int Part_setRenderStep( BPy_PartSys * self, PyObject * args );
|
||||
static PyObject *Part_getRenderStep( BPy_PartSys * self );
|
||||
static PyObject *Part_getDupOb( BPy_PartSys * self );
|
||||
static int Part_setDrawAs( BPy_PartSys * self, PyObject * args );
|
||||
static PyObject *Part_getDrawAs( BPy_PartSys * self );
|
||||
static int Part_setPhysType( BPy_PartSys * self, PyObject * args );
|
||||
static PyObject *Part_getPhysType( BPy_PartSys * self );
|
||||
@@ -283,6 +292,10 @@ static PyMethodDef BPy_ParticleSys_methods[] = {
|
||||
METH_VARARGS, "() - Get the vertex group which affects a particles attribute"},
|
||||
{"setVertGroup", ( PyCFunction ) Part_SetVertGroup,
|
||||
METH_VARARGS, "() - Set the vertex group to affect a particles attribute"},
|
||||
{"getName", ( PyCFunction ) Part_GetName, METH_NOARGS,
|
||||
"() - Return particle system's name"},
|
||||
{"setName", ( PyCFunction ) Part_SetNameWithMethod, METH_VARARGS,
|
||||
"(s) - Change particle system's name"},
|
||||
{NULL, NULL, 0, NULL}
|
||||
};
|
||||
|
||||
@@ -430,6 +443,14 @@ static PyGetSetDef BPy_ParticleSys_getseters[] = {
|
||||
(getter)Part_getRenderMaterialIndex, (setter)Part_setRenderMaterialIndex,
|
||||
"Specify material index used for the particles",
|
||||
NULL},
|
||||
{"strandRender",
|
||||
(getter)Part_getStrandRender, (setter)Part_setStrandRender,
|
||||
"Use the strand primitive to render",
|
||||
NULL},
|
||||
{"strandRenderAngle",
|
||||
(getter)Part_getStrandRenderAn, (setter)Part_setStrandRenderAn,
|
||||
"How many degrees path has to curve to make another render segment",
|
||||
NULL},
|
||||
{"displayPercentage",
|
||||
(getter)Part_getParticleDisp, (setter)Part_setParticleDisp,
|
||||
"Particle display percentage",
|
||||
@@ -447,8 +468,8 @@ static PyGetSetDef BPy_ParticleSys_getseters[] = {
|
||||
"Get the duplicate ob",
|
||||
NULL},
|
||||
{"drawAs",
|
||||
(getter)Part_getDrawAs, NULL,
|
||||
"Get draw type Particle.DRAWAS([ 'NONE' | 'OBJECT' | 'POINT' | ... ] )",
|
||||
(getter)Part_getDrawAs, (setter)Part_setDrawAs,
|
||||
"Draw type Particle.DRAWAS([ 'NONE' | 'OBJECT' | 'POINT' | ... ] )",
|
||||
NULL},
|
||||
/* Newtonian Physics */
|
||||
{"physics",
|
||||
@@ -2008,6 +2029,33 @@ static PyObject *Part_SetVertGroup( BPy_PartSys * self, PyObject * args ){
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
PyObject *Part_GetName( BPy_PartSys * self, PyObject * args )
|
||||
{
|
||||
ID *id = (ID*) self->psys->part;
|
||||
if (!id) return ( EXPP_ReturnPyObjError( PyExc_RuntimeError, "data has been removed" ) );
|
||||
return PyString_FromString( id->name + 2 );
|
||||
}
|
||||
|
||||
int Part_SetName( BPy_PartSys * self, PyObject * args )
|
||||
{
|
||||
ID *id = (ID*) self->psys->part;
|
||||
char *name = NULL;
|
||||
if (!id) return ( EXPP_ReturnIntError( PyExc_RuntimeError, "data has been removed" ) );
|
||||
|
||||
name = PyString_AsString ( args );
|
||||
if( !name )
|
||||
return EXPP_ReturnIntError( PyExc_TypeError,
|
||||
"expected string argument" );
|
||||
|
||||
rename_id( id, name );
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
PyObject * Part_SetNameWithMethod( BPy_PartSys *self, PyObject *args )
|
||||
{
|
||||
return EXPP_setterWrapper( (void *)self, args, (setter)Part_SetName );
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Function: Set/Get Seed */
|
||||
@@ -2714,6 +2762,44 @@ static PyObject *Part_getRenderDied( BPy_PartSys * self )
|
||||
return PyInt_FromLong( ((long)( self->psys->part->flag & PART_DIED )) > 0 );
|
||||
}
|
||||
|
||||
static int Part_setStrandRender( BPy_PartSys * self, PyObject * args )
|
||||
{
|
||||
int number;
|
||||
|
||||
if( !PyInt_Check( args ) )
|
||||
return EXPP_ReturnIntError( PyExc_TypeError, "expected int argument" );
|
||||
|
||||
number = PyInt_AS_LONG( args );
|
||||
|
||||
if (number){
|
||||
self->psys->part->draw |= PART_DRAW_REN_STRAND;
|
||||
}else{
|
||||
self->psys->part->draw &= ~PART_DRAW_REN_STRAND;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static PyObject *Part_getStrandRender( BPy_PartSys * self )
|
||||
{
|
||||
return PyInt_FromLong( ((long)( self->psys->part->draw & PART_DRAW_REN_STRAND )) > 0 );
|
||||
}
|
||||
|
||||
static int Part_setStrandRenderAn( BPy_PartSys * self, PyObject * args )
|
||||
{
|
||||
int res = EXPP_setIValueRange( args, &self->psys->part->adapt_angle,
|
||||
0, 45, 'i' );
|
||||
|
||||
psys_flush_settings( self->psys->part, PSYS_ALLOC, 1 );
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
static PyObject *Part_getStrandRenderAn( BPy_PartSys * self )
|
||||
{
|
||||
return PyInt_FromLong( ((int)( self->psys->part->adapt_angle )) );
|
||||
}
|
||||
|
||||
static int Part_setParticleDisp( BPy_PartSys * self, PyObject * args )
|
||||
{
|
||||
int res = EXPP_setIValueRange( args, &self->psys->part->disp,
|
||||
@@ -2762,6 +2848,16 @@ static PyObject *Part_getRenderStep( BPy_PartSys * self )
|
||||
return PyInt_FromLong( ((short)( self->psys->part->ren_step )) );
|
||||
}
|
||||
|
||||
static int Part_setDrawAs( BPy_PartSys * self, PyObject * args )
|
||||
{
|
||||
int res = EXPP_setIValueRange( args, &self->psys->part->draw_as,
|
||||
0, 9, 'h' );
|
||||
|
||||
psys_flush_settings( self->psys->part, PSYS_ALLOC, 1 );
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
static PyObject *Part_getDrawAs( BPy_PartSys * self )
|
||||
{
|
||||
return PyInt_FromLong( (long)( self->psys->part->draw_as ) );
|
||||
|
@@ -511,6 +511,8 @@ static int Texture_setNoiseBasis2( BPy_Texture *self, PyObject *args,
|
||||
|
||||
static PyObject *Texture_getColorband( BPy_Texture * self);
|
||||
int Texture_setColorband( BPy_Texture * self, PyObject * value);
|
||||
static PyObject *Texture_getUseColorband( BPy_Texture * self);
|
||||
int Texture_setUseColorband( BPy_Texture * self, PyObject * value);
|
||||
static PyObject *Texture_evaluate( BPy_Texture *self, PyObject *value );
|
||||
static PyObject *Texture_copy( BPy_Texture *self );
|
||||
|
||||
@@ -791,6 +793,10 @@ static PyGetSetDef BPy_Texture_getseters[] = {
|
||||
(getter)Texture_getColorband, (setter)Texture_setColorband,
|
||||
"The colorband for this texture",
|
||||
NULL},
|
||||
{"useColorband",
|
||||
(getter)Texture_getUseColorband, (setter)Texture_setUseColorband,
|
||||
"Use colorband for this texture",
|
||||
NULL},
|
||||
{NULL,NULL,NULL,NULL,NULL} /* Sentinel */
|
||||
};
|
||||
|
||||
@@ -2525,6 +2531,29 @@ int Texture_setColorband( BPy_Texture * self, PyObject * value)
|
||||
return EXPP_Colorband_fromPyList( &self->texture->coba, value );
|
||||
}
|
||||
|
||||
static PyObject *Texture_getUseColorband( BPy_Texture * self)
|
||||
{
|
||||
return PyInt_FromLong( ((long)( self->texture->flag & TEX_COLORBAND )) > 0 );
|
||||
}
|
||||
|
||||
int Texture_setUseColorband( BPy_Texture * self, PyObject * value)
|
||||
{
|
||||
int number;
|
||||
|
||||
if( !PyInt_Check( value ) )
|
||||
return EXPP_ReturnIntError( PyExc_TypeError, "expected int argument" );
|
||||
|
||||
number = PyInt_AS_LONG( value );
|
||||
|
||||
if (number){
|
||||
self->texture->flag |= TEX_COLORBAND;
|
||||
}else{
|
||||
self->texture->flag &= ~TEX_COLORBAND;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static PyObject *Texture_evaluate( BPy_Texture * self, PyObject * value )
|
||||
{
|
||||
TexResult texres= {0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0, NULL};
|
||||
|
@@ -46,6 +46,11 @@ Example::
|
||||
- 'NoDiffuse'
|
||||
- 'NoSpecular'
|
||||
- 'RayShadow'
|
||||
@type BufferTypes: read-only dictionary
|
||||
@var BufferTypes: The lamp shadowbuffer types.
|
||||
- 'Regular'
|
||||
- 'Irregular'
|
||||
- 'Halfway'
|
||||
|
||||
Example::
|
||||
from Blender import Lamp, Object
|
||||
@@ -101,6 +106,8 @@ class Lamp:
|
||||
@ivar bufferSize: Lamp shadow buffer size.
|
||||
Value is clamped to the range [512,5120].
|
||||
@type bufferSize: int
|
||||
@ivar bufferType: Lamp shadowbuffer type. See L{BufferTypes} for values.
|
||||
@type bufferType: int
|
||||
@ivar clipEnd: Lamp shadow map clip end.
|
||||
Value is clamped to the range [1.0,5000.0].
|
||||
@type clipEnd: float
|
||||
|
@@ -408,6 +408,24 @@ class Material:
|
||||
|
||||
@type textures: a tuple of Blender MTex objects.
|
||||
@ivar textures: the Material's Texture list. Empty texture channels contains None.
|
||||
@ivar strandTanShad: Uses direction of strands as normal for tangent-shading
|
||||
@type strandTanShad: int
|
||||
@ivar strandSurfDiff: Make diffuse shading more similar to shading the surface
|
||||
@type strandSurfDiff: int
|
||||
@ivar strandDist: Distance in Blender units over which to blend in the surface normal
|
||||
@type strandDist: float
|
||||
@ivar strandBlendUnit: Use actual Blender units for widths instead of pixels
|
||||
@type strandBlendUnit: int
|
||||
@ivar strandStart: Start size of strands
|
||||
@type strandStart: float
|
||||
@ivar strandEnd: End size of strands
|
||||
@type strandEnd: float
|
||||
@ivar strandMin: Minimum size of strands in pixels
|
||||
@type strandMin: float
|
||||
@ivar strandShape: Shape of strands, positive value makes it rounder, negative makes it spiky
|
||||
@type strandShape: float
|
||||
@ivar strandFade: Transparency along the width of the strand
|
||||
@type strandFade: float
|
||||
@ivar enableSSS: If True, subsurface scattering will be rendered on this material.
|
||||
@type enableSSS: bool
|
||||
@ivar sssScale: If True, subsurface scattering will be rendered on this material.
|
||||
|
@@ -205,7 +205,7 @@ def GetSelected ():
|
||||
"""
|
||||
|
||||
|
||||
def Duplicate (mesh=0, surface=0, curve=0, text=0, metaball=0, armature=0, lamp=0, material=0, texture=0, ipo=0):
|
||||
def Duplicate (mesh=0, surface=0, curve=0, text=0, metaball=0, armature=0, lamp=0, material=0, texture=0, ipo=0, psys=0):
|
||||
"""
|
||||
Duplicate selected objects on visible layers from Blenders current scene,
|
||||
de-selecting the currently visible, selected objects and making a copy where all new objects are selected.
|
||||
@@ -234,6 +234,8 @@ def Duplicate (mesh=0, surface=0, curve=0, text=0, metaball=0, armature=0, lamp=
|
||||
@param texture: When non-zero, texture data used by the object's materials will be duplicated with the objects.
|
||||
@type ipo: bool
|
||||
@param ipo: When non-zero, Ipo data linked to the object will be duplicated with the objects.
|
||||
@type psys: bool
|
||||
@param psys: When non-zero, particle systems used by the object or its object data will be duplicated with the objects.
|
||||
|
||||
I{B{Example:}}
|
||||
|
||||
@@ -663,6 +665,7 @@ class Object:
|
||||
particle system with that name exists, it is linked to the object.
|
||||
@type name: string
|
||||
@param name: The name of the requested Particle system (optional).
|
||||
@return: The particle system linked.
|
||||
"""
|
||||
|
||||
def addVertexGroupsFromArmature(object):
|
||||
|
@@ -69,6 +69,20 @@ This module provides access to the B{Particle} in Blender.
|
||||
- NONE: No particle angular velocity
|
||||
- SPIN: Spin particle angular velocity
|
||||
- RANDOM: Random particle angular velocity
|
||||
@type VERTEXGROUPS: readonly dictionary
|
||||
@var VERTEXGROUPS: Constant dict used for with L{Particle.VERTEXGROUP}
|
||||
- DENSITY: VertexGroup affect to particles density
|
||||
- VELOCITY: VertexGroup affect to particles velocity
|
||||
- LENGHT: VertexGroup affect to particles lenght
|
||||
- CLUMP: VertexGroup affect to particles clump
|
||||
- KINK: VertexGroup affect to particles kink
|
||||
- ROUGH1: VertexGroup affect to particles rough1
|
||||
- ROUGH2: VertexGroup affect to particles rough2
|
||||
- ROUGHE: VertexGroup affect to particles roughE
|
||||
- SIZE: VertexGroup affect to particles size
|
||||
- TANVEL: VertexGroup affect to particles tangent velocity
|
||||
- TANROT: VertexGroup affect to particles tangent rotation
|
||||
- EFFECTOR: VertexGroup affect to particles effector
|
||||
@type CHILDTYPE: readonly dictionary
|
||||
@var CHILDTYPE: Constant dict used for with L{Particle.CHILDTYPE}
|
||||
- NONE: set no children
|
||||
@@ -171,6 +185,10 @@ class Particle:
|
||||
@type renderDied: int
|
||||
@ivar renderMaterial: Specify material used for the particles.
|
||||
@type renderMaterial: int
|
||||
@ivar strandRender: Use the strand primitive to render.
|
||||
@type strandRender: int
|
||||
@ivar strandRenderAngle: How many degrees path has to curve to make another render segment.
|
||||
@type strandRenderAngle: int
|
||||
@ivar displayPercentage: Particle display percentage.
|
||||
@type displayPercentage: int
|
||||
@ivar hairDisplayStep: How many steps paths are drawn with (power of 2) in visu mode.
|
||||
@@ -179,7 +197,7 @@ class Particle:
|
||||
@type hairRenderStep: int
|
||||
@ivar duplicateObject: Get the duplicate object.
|
||||
@type duplicateObject: Blender Object
|
||||
@ivar drawAs: Get draw type Particle.DRAWAS([ 'NONE' | 'OBJECT' | 'POINT' | ... ]).
|
||||
@ivar drawAs: Draw type Particle.DRAWAS([ 'NONE' | 'OBJECT' | 'POINT' | ... ]).
|
||||
@type drawAs: int
|
||||
@ivar physics: Select particle physics type Particle.PHYSICS([ 'BOIDS' | 'KEYED' | 'NEWTONIAN' | 'NONE' ])
|
||||
@type physics: int
|
||||
@@ -276,6 +294,18 @@ class Particle:
|
||||
@ivar childBranch: Threshold of branching
|
||||
@type childBranch: float
|
||||
"""
|
||||
def getName():
|
||||
"""
|
||||
Get the name of this Particle System object.
|
||||
@rtype: string
|
||||
"""
|
||||
|
||||
def setName(name):
|
||||
"""
|
||||
Set the name of this Particle System object.
|
||||
@type name: string
|
||||
@param name: The new name.
|
||||
"""
|
||||
|
||||
def freeEdit():
|
||||
"""
|
||||
|
@@ -393,6 +393,8 @@ class Texture:
|
||||
each color a list of 5 floats [0 - 1], [r,g,b,a,pos].
|
||||
The colorband can have between 1 and 31 colors.
|
||||
@type colorband: list
|
||||
@ivar useColorband: Use colorband for this texture.
|
||||
@type colorband: int
|
||||
@ivar autoRefresh: Refresh image on frame changes enabled.
|
||||
@type autoRefresh: boolean
|
||||
"""
|
||||
|
Reference in New Issue
Block a user