Index: source/blender/python/api2_2x/doc/Particle.py =================================================================== --- source/blender/python/api2_2x/doc/Particle.py (revision 19614) +++ source/blender/python/api2_2x/doc/Particle.py (working copy) @@ -141,6 +141,38 @@ @type childSize: float @ivar childRand: Random variation to the size of the child particles @type childRand: float + @ivar childRough1: Amount of location dependant rough + @type childRough1: float + @ivar childRough1Size: Size of location dependant rough + @type childRough1Size: float + @ivar childRough2: Amount of random rough + @type childRough2: float + @ivar childRough2Size: Size of random rough + @type childRough2Size: float + @ivar childRough2Thresh: Amount of particles left untouched by random rough + @type childRough2Thresh: float + @ivar childRoughE: Amount of end point rough + @type childRoughE: float + @ivar childRoughEShape: Shape of end point rough + @type childRoughEShape: float + @ivar childKink: Type of periodic offset on the path (Particle.CHILDKINK[ 'BRAID' | 'WAVE' | 'RADIAL' | 'CURL' | 'NOTHING' ]) + @type childKink: int + @ivar childKinkAxis: Which axis to use for offset (Particle.CHILDKINKAXIS[ 'Z' | 'Y' | 'X' ]) + @type childKinkAxis: int + @ivar childKinkFreq: The frequency of the offset (1/total length) + @type childKinkFreq: float + @ivar childKinkShape: Adjust the offset to the beginning/end + @type childKinkShape: float + @ivar childKinkAmp: The amplitude of the offset + @type childKinkAmp: float + @ivar childBranch: Branch child paths from eachother + @type childBranch: int + @ivar childBranch: Animate branching + @type childBranch: int + @ivar childBranch: Start and end points are the same + @type childBranch: int + @ivar childBranch: Threshold of branching + @type childBranch: float """ def freeEdit(): Index: source/blender/python/api2_2x/Particle.c =================================================================== --- source/blender/python/api2_2x/Particle.c (revision 19614) +++ source/blender/python/api2_2x/Particle.c (working copy) @@ -152,6 +152,38 @@ static PyObject *Part_getChildSize( BPy_PartSys * self ); static int Part_setChildRandom( BPy_PartSys * self, PyObject * args ); static PyObject *Part_getChildRandom( BPy_PartSys * self ); +static int Part_setChildRough1( BPy_PartSys * self, PyObject * args ); +static PyObject *Part_getChildRough1( BPy_PartSys * self ); +static int Part_setChildRough1Size( BPy_PartSys * self, PyObject * args ); +static PyObject *Part_getChildRough1Size( BPy_PartSys * self ); +static int Part_setChildRough2( BPy_PartSys * self, PyObject * args ); +static PyObject *Part_getChildRough2( BPy_PartSys * self ); +static int Part_setChildRough2Size( BPy_PartSys * self, PyObject * args ); +static PyObject *Part_getChildRough2Size( BPy_PartSys * self ); +static int Part_setChildRough2Thres( BPy_PartSys * self, PyObject * args ); +static PyObject *Part_getChildRough2Thres( BPy_PartSys * self ); +static int Part_setChildRoughE( BPy_PartSys * self, PyObject * args ); +static PyObject *Part_getChildRoughE( BPy_PartSys * self ); +static int Part_setChildRoughEShape( BPy_PartSys * self, PyObject * args ); +static PyObject *Part_getChildRoughEShape( BPy_PartSys * self ); +static int Part_setChildKink( BPy_PartSys * self, PyObject * args ); +static PyObject *Part_getChildKink( BPy_PartSys * self ); +static int Part_setChildKinkAxis( BPy_PartSys * self, PyObject * args ); +static PyObject *Part_getChildKinkAxis( BPy_PartSys * self ); +static int Part_setChildKinkFreq( BPy_PartSys * self, PyObject * args ); +static PyObject *Part_getChildKinkFreq( BPy_PartSys * self ); +static int Part_setChildKinkShape( BPy_PartSys * self, PyObject * args ); +static PyObject *Part_getChildKinkShape( BPy_PartSys * self ); +static int Part_setChildKinkAmp( BPy_PartSys * self, PyObject * args ); +static PyObject *Part_getChildKinkAmp( BPy_PartSys * self ); +static int Part_setChildBranch( BPy_PartSys * self, PyObject * args ); +static PyObject *Part_getChildBranch( BPy_PartSys * self ); +static int Part_setChildBranchAnim( BPy_PartSys * self, PyObject * args ); +static PyObject *Part_getChildBranchAnim( BPy_PartSys * self ); +static int Part_setChildBranchSymm( BPy_PartSys * self, PyObject * args ); +static PyObject *Part_getChildBranchSymm( BPy_PartSys * self ); +static int Part_setChildBranchThre( BPy_PartSys * self, PyObject * args ); +static PyObject *Part_getChildBranchThre( BPy_PartSys * self ); /*****************************************************************************/ /* Python Effect_Type callback function prototypes: */ @@ -371,6 +403,70 @@ (getter)Part_getChildRandom, (setter)Part_setChildRandom, "Random variation to the size of the child particles", NULL}, + {"childRough1", + (getter)Part_getChildRough1, (setter)Part_setChildRough1, + "Amount of location dependant rough", + NULL}, + {"childRough1Size", + (getter)Part_getChildRough1Size, (setter)Part_setChildRough1Size, + "Size of location dependant rough", + NULL}, + {"childRough2", + (getter)Part_getChildRough2, (setter)Part_setChildRough2, + "Amount of random rough", + NULL}, + {"childRough2Size", + (getter)Part_getChildRough2Size, (setter)Part_setChildRough2Size, + "Size of random rough", + NULL}, + {"childRough2Thresh", + (getter)Part_getChildRough2Thres, (setter)Part_setChildRough2Thres, + "Amount of particles left untouched by random rough", + NULL}, + {"childRoughE", + (getter)Part_getChildRoughE, (setter)Part_setChildRoughE, + "Amount of end point rough", + NULL}, + {"childRoughEShape", + (getter)Part_getChildRoughEShape, (setter)Part_setChildRoughEShape, + "Shape of end point rough", + NULL}, + {"childKink", + (getter)Part_getChildKink, (setter)Part_setChildKink, + "Type of periodic offset on the path (Particle.CHILDKINK[ 'BRAID' | 'WAVE' | 'RADIAL' | 'CURL' | 'NOTHING' ])", + NULL}, + {"childKinkAxis", + (getter)Part_getChildKinkAxis, (setter)Part_setChildKinkAxis, + "Which axis to use for offset (Particle.CHILDKINKAXIS[ 'Z' | 'Y' | 'X' ])", + NULL}, + {"childKinkFreq", + (getter)Part_getChildKinkFreq, (setter)Part_setChildKinkFreq, + "The frequency of the offset (1/total length)", + NULL}, + {"childKinkShape", + (getter)Part_getChildKinkShape, (setter)Part_setChildKinkShape, + "Adjust the offset to the beginning/end", + NULL}, + {"childKinkAmp", + (getter)Part_getChildKinkAmp, (setter)Part_setChildKinkAmp, + "The amplitude of the offset", + NULL}, + {"childBranch", + (getter)Part_getChildBranch, (setter)Part_setChildBranch, + "Branch child paths from eachother", + NULL}, + {"childBranchAnim", + (getter)Part_getChildBranchAnim, (setter)Part_setChildBranchAnim, + "Animate branching", + NULL}, + {"childBranchSymm", + (getter)Part_getChildBranchSymm, (setter)Part_setChildBranchSymm, + "Start and end points are the same", + NULL}, + {"childBranchThre", + (getter)Part_getChildBranchThre, (setter)Part_setChildBranchThre, + "Threshold of branching", + NULL}, {NULL,NULL,NULL,NULL,NULL} /* Sentinel */ }; @@ -785,6 +881,48 @@ return ChildTypes; } +/* create the Blender.Particle.ChildKink constant dict */ + +static PyObject *Particle_ChildKinkDict( void ) +{ + PyObject *ChildKinks = PyConstant_New( ); + + if( ChildKinks ) { + BPy_constant *c = ( BPy_constant * ) ChildKinks; + + PyConstant_Insert( c, "BRAID", + PyInt_FromLong( 4 ) ); + PyConstant_Insert( c, "WAVE", + PyInt_FromLong( 3 ) ); + PyConstant_Insert( c, "RADIAL", + PyInt_FromLong( 2 ) ); + PyConstant_Insert( c, "CURL", + PyInt_FromLong( 1 ) ); + PyConstant_Insert( c, "NOTHING", + PyInt_FromLong( 0 ) ); + } + return ChildKinks; +} + +/* create the Blender.Particle.ChildKinkAxis constant dict */ + +static PyObject *Particle_ChildKinkAxisDict( void ) +{ + PyObject *ChildKinkAxes = PyConstant_New( ); + + if( ChildKinkAxes ) { + BPy_constant *c = ( BPy_constant * ) ChildKinkAxes; + + PyConstant_Insert( c, "Z", + PyInt_FromLong( 2 ) ); + PyConstant_Insert( c, "Y", + PyInt_FromLong( 1 ) ); + PyConstant_Insert( c, "X", + PyInt_FromLong( 0 ) ); + } + return ChildKinkAxes; +} + static PyObject *Particle_DrawAs( void ) { PyObject *DrawAs = PyConstant_New( ); @@ -832,6 +970,8 @@ PyObject *Dist; PyObject *DrawAs; PyObject *ChildTypes; + PyObject *ChildKinks; + PyObject *ChildKinkAxes; if( PyType_Ready( &ParticleSys_Type ) < 0) @@ -843,6 +983,8 @@ DrawAs = Particle_DrawAs(); Dist = Particle_DistrDict(); ChildTypes = Particle_ChildTypeDict(); + ChildKinks = Particle_ChildKinkDict(); + ChildKinkAxes = Particle_ChildKinkAxisDict(); submodule = Py_InitModule3( "Blender.Particle", M_ParticleSys_methods, M_ParticleSys_doc ); @@ -859,6 +1001,10 @@ PyModule_AddObject( submodule, "DRAWAS", DrawAs ); if( ChildTypes ) PyModule_AddObject( submodule, "CHILDTYPE", ChildTypes ); + if( ChildKinks ) + PyModule_AddObject( submodule, "CHILDKINK", ChildKinks ); + if( ChildKinkAxes ) + PyModule_AddObject( submodule, "CHILDKINKAXIS", ChildKinkAxes ); return ( submodule ); } @@ -2225,3 +2371,282 @@ { return PyFloat_FromDouble( ((float)( self->psys->part->childrandsize )) ); } + +static int Part_setChildRough1( BPy_PartSys * self, PyObject * args ) +{ + int res = EXPP_setFloatRange( args, &self->psys->part->rough1, + 0.0, 10.0 ); + + psys_flush_settings( self->psys->part, PSYS_ALLOC, 1 ); + + return res; +} + +static PyObject *Part_getChildRough1( BPy_PartSys * self ) +{ + return PyFloat_FromDouble( ((float)( self->psys->part->rough1 )) ); +} + +static int Part_setChildRough1Size( BPy_PartSys * self, PyObject * args ) +{ + int res = EXPP_setFloatRange( args, &self->psys->part->rough1_size, + 0.01, 10.0 ); + + psys_flush_settings( self->psys->part, PSYS_ALLOC, 1 ); + + return res; +} + +static PyObject *Part_getChildRough1Size( BPy_PartSys * self ) +{ + return PyFloat_FromDouble( ((float)( self->psys->part->rough1_size )) ); +} + +static int Part_setChildRough2( BPy_PartSys * self, PyObject * args ) +{ + int res = EXPP_setFloatRange( args, &self->psys->part->rough2, + 0.0, 10.0 ); + + psys_flush_settings( self->psys->part, PSYS_ALLOC, 1 ); + + return res; +} + +static PyObject *Part_getChildRough2( BPy_PartSys * self ) +{ + return PyFloat_FromDouble( ((float)( self->psys->part->rough2 )) ); +} + +static int Part_setChildRough2Size( BPy_PartSys * self, PyObject * args ) +{ + int res = EXPP_setFloatRange( args, &self->psys->part->rough2_size, + 0.01, 10.0 ); + + psys_flush_settings( self->psys->part, PSYS_ALLOC, 1 ); + + return res; +} + +static PyObject *Part_getChildRough2Size( BPy_PartSys * self ) +{ + return PyFloat_FromDouble( ((float)( self->psys->part->rough2_size )) ); +} + +static int Part_setChildRough2Thres( BPy_PartSys * self, PyObject * args ) +{ + int res = EXPP_setFloatRange( args, &self->psys->part->rough2_thres, + 0.0, 10.0 ); + + psys_flush_settings( self->psys->part, PSYS_ALLOC, 1 ); + + return res; +} + +static PyObject *Part_getChildRough2Thres( BPy_PartSys * self ) +{ + return PyFloat_FromDouble( ((float)( self->psys->part->rough2_thres )) ); +} + +static int Part_setChildRoughE( BPy_PartSys * self, PyObject * args ) +{ + int res = EXPP_setFloatRange( args, &self->psys->part->rough_end, + 0.0, 10.0 ); + + psys_flush_settings( self->psys->part, PSYS_ALLOC, 1 ); + + return res; +} + +static PyObject *Part_getChildRoughE( BPy_PartSys * self ) +{ + return PyFloat_FromDouble( ((float)( self->psys->part->rough_end )) ); +} + +static int Part_setChildRoughEShape( BPy_PartSys * self, PyObject * args ) +{ + int res = EXPP_setFloatRange( args, &self->psys->part->rough_end_shape, + 0.0, 10.0 ); + + psys_flush_settings( self->psys->part, PSYS_ALLOC, 1 ); + + return res; +} + +static PyObject *Part_getChildRoughEShape( BPy_PartSys * self ) +{ + return PyFloat_FromDouble( ((float)( self->psys->part->rough_end_shape )) ); +} + +static int Part_setChildKink( BPy_PartSys * self, PyObject * args ) +{ + int res = EXPP_setIValueRange( args, &self->psys->part->kink, + 0, 4, 'h' ); + + psys_flush_settings( self->psys->part, PSYS_ALLOC, 1 ); + + return res; +} + +static PyObject *Part_getChildKink( BPy_PartSys * self ) +{ + return PyInt_FromLong( (short)( self->psys->part->kink ) ); +} + +static int Part_setChildKinkAxis( BPy_PartSys * self, PyObject * args ) +{ + int res = EXPP_setIValueRange( args, &self->psys->part->kink_axis, + 0, 2, 'h' ); + + psys_flush_settings( self->psys->part, PSYS_ALLOC, 1 ); + + return res; +} + +static PyObject *Part_getChildKinkAxis( BPy_PartSys * self ) +{ + return PyInt_FromLong( (short)( self->psys->part->kink_axis ) ); +} + +static int Part_setChildKinkFreq( BPy_PartSys * self, PyObject * args ) +{ + int res = EXPP_setFloatRange( args, &self->psys->part->kink_freq, + 0.0, 10.0 ); + + psys_flush_settings( self->psys->part, PSYS_ALLOC, 1 ); + + return res; +} + +static PyObject *Part_getChildKinkFreq( BPy_PartSys * self ) +{ + return PyFloat_FromDouble( ((float)( self->psys->part->kink_freq )) ); +} + +static int Part_setChildKinkShape( BPy_PartSys * self, PyObject * args ) +{ + int res = EXPP_setFloatRange( args, &self->psys->part->kink_shape, + -0.999, 0.999 ); + + psys_flush_settings( self->psys->part, PSYS_ALLOC, 1 ); + + return res; +} + +static PyObject *Part_getChildKinkShape( BPy_PartSys * self ) +{ + return PyFloat_FromDouble( ((float)( self->psys->part->kink_shape )) ); +} + +static int Part_setChildKinkAmp( BPy_PartSys * self, PyObject * args ) +{ + int res = EXPP_setFloatRange( args, &self->psys->part->kink_amp, + 0.0, 10.0 ); + + psys_flush_settings( self->psys->part, PSYS_ALLOC, 1 ); + + return res; +} + +static PyObject *Part_getChildKinkAmp( BPy_PartSys * self ) +{ + return PyFloat_FromDouble( ((float)( self->psys->part->kink_amp )) ); +} + +static int Part_setChildBranch( BPy_PartSys * self, PyObject * args ) +{ + int number; + + if( !PyInt_Check( args ) ) { + char errstr[128]; + sprintf ( errstr, "expected int argument" ); + return EXPP_ReturnIntError( PyExc_TypeError, errstr ); + } + + number = PyInt_AS_LONG( args ); + + if (number){ + self->psys->part->flag |= PART_BRANCHING; + }else{ + self->psys->part->flag &= ~PART_BRANCHING; + } + + psys_flush_settings( self->psys->part, PSYS_ALLOC, 1 ); + + return 0; +} + +static PyObject *Part_getChildBranch( BPy_PartSys * self ) +{ + return PyInt_FromLong( ((long)( self->psys->part->flag & PART_BRANCHING )) > 0 ); +} + +static int Part_setChildBranchAnim( BPy_PartSys * self, PyObject * args ) +{ + int number; + + if( !PyInt_Check( args ) ) { + char errstr[128]; + sprintf ( errstr, "expected int argument" ); + return EXPP_ReturnIntError( PyExc_TypeError, errstr ); + } + + number = PyInt_AS_LONG( args ); + + if (number){ + self->psys->part->flag |= PART_ANIM_BRANCHING; + }else{ + self->psys->part->flag &= ~PART_ANIM_BRANCHING; + } + + psys_flush_settings( self->psys->part, PSYS_ALLOC, 1 ); + + return 0; +} + +static PyObject *Part_getChildBranchAnim( BPy_PartSys * self ) +{ + return PyInt_FromLong( ((long)( self->psys->part->flag & PART_ANIM_BRANCHING )) > 0 ); +} + +static int Part_setChildBranchSymm( BPy_PartSys * self, PyObject * args ) +{ + int number; + + if( !PyInt_Check( args ) ) { + char errstr[128]; + sprintf ( errstr, "expected int argument" ); + return EXPP_ReturnIntError( PyExc_TypeError, errstr ); + } + + number = PyInt_AS_LONG( args ); + + if (number){ + self->psys->part->flag |= PART_SYMM_BRANCHING; + }else{ + self->psys->part->flag &= ~PART_SYMM_BRANCHING; + } + + psys_flush_settings( self->psys->part, PSYS_ALLOC, 1 ); + + return 0; +} + +static PyObject *Part_getChildBranchSymm( BPy_PartSys * self ) +{ + return PyInt_FromLong( ((long)( self->psys->part->flag & PART_SYMM_BRANCHING )) > 0 ); +} + +static int Part_setChildBranchThre( BPy_PartSys * self, PyObject * args ) +{ + int res = EXPP_setFloatRange( args, &self->psys->part->branch_thres, + 0.0, 1.0 ); + + psys_flush_settings( self->psys->part, PSYS_ALLOC, 1 ); + + return res; +} + +static PyObject *Part_getChildBranchThre( BPy_PartSys * self ) +{ + return PyFloat_FromDouble( ((float)( self->psys->part->branch_thres )) ); +} \ No newline at end of file