~ubuntu-branches/ubuntu/lucid/blender/lucid

« back to all changes in this revision

Viewing changes to source/blender/python/api2_2x/Particle.c

  • Committer: Bazaar Package Importer
  • Author(s): Chris Coulson
  • Date: 2009-08-06 22:32:19 UTC
  • mfrom: (1.2.10 upstream)
  • Revision ID: james.westby@ubuntu.com-20090806223219-8z4eej1u8levu4pz
Tags: 2.49a+dfsg-0ubuntu1
* Merge from debian unstable, remaining changes:
  - debian/control: Build-depend on python-2.6 rather than python-2.5.
  - debian/misc/*.desktop: Add Spanish translation to .desktop 
    files.
  - debian/pyversions: 2.6.
  - debian/rules: Clean *.o of source/blender/python/api2_2x/
* New upstream release (LP: #382153).
* Refreshed patches:
  - 01_sanitize_sys.patch
  - 02_tmp_in_HOME
  - 10_use_systemwide_ftgl
  - 70_portability_platform_detection
* Removed patches merged upstream:
  - 30_fix_python_syntax_warning
  - 90_ubuntu_ffmpeg_52_changes

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
 
 * $Id: Particle.c 16974 2008-10-08 16:37:33Z khughes $
 
2
 * $Id: Particle.c 20923 2009-06-16 08:52:04Z campbellbarton $
3
3
 *
4
4
 * ***** BEGIN GPL LICENSE BLOCK *****
5
5
 *
31
31
 
32
32
#include "Particle.h"
33
33
#include "gen_utils.h"
 
34
#include "gen_library.h"
34
35
#include "BKE_object.h"
35
36
#include "BKE_main.h"
36
37
#include "BKE_particle.h"
57
58
 
58
59
 
59
60
/* Type Methods */
60
 
static PyObject *M_ParticleSys_New( PyObject * self, PyObject * args );
 
61
static PyObject *M_ParticleSys_New( PyObject * self, PyObject * value );
61
62
static PyObject *M_ParticleSys_Get( PyObject * self, PyObject * args );
62
63
 
63
64
/* Particle Methods */
64
65
static PyObject *Part_freeEdit( BPy_PartSys * self, PyObject * args );
65
66
static PyObject *Part_GetLoc( BPy_PartSys * self, PyObject * args );
66
67
static PyObject *Part_GetRot( BPy_PartSys * self, PyObject * args );
 
68
static PyObject *Part_SetMat( BPy_PartSys * self, PyObject * args );
67
69
static PyObject *Part_GetMat( BPy_PartSys * self, PyObject * args );
68
70
static PyObject *Part_GetSize( BPy_PartSys * self, PyObject * args );
 
71
static PyObject *Part_GetVertGroup( BPy_PartSys * self, PyObject * args );
 
72
static PyObject *Part_SetVertGroup( BPy_PartSys * self, PyObject * args );
69
73
static int Part_setSeed( BPy_PartSys * self, PyObject * args );
70
74
static PyObject *Part_getSeed( BPy_PartSys * self );
71
75
static int Part_setType( BPy_PartSys * self, PyObject * args );
127
131
static PyObject *Part_getTargetPsys( BPy_PartSys * self );
128
132
static int Part_setRenderObject( BPy_PartSys * self, PyObject * args );
129
133
static PyObject *Part_getRenderObject( BPy_PartSys * self );
 
134
static int Part_setRenderMaterialColor( BPy_PartSys * self, PyObject * args );
 
135
static PyObject *Part_getRenderMaterialColor( BPy_PartSys * self );
 
136
static int Part_setRenderParents( BPy_PartSys * self, PyObject * args );
 
137
static PyObject *Part_getRenderParents( BPy_PartSys * self );
 
138
static int Part_setRenderUnborn( BPy_PartSys * self, PyObject * args );
 
139
static PyObject *Part_getRenderUnborn( BPy_PartSys * self );
 
140
static int Part_setRenderDied( BPy_PartSys * self, PyObject * args );
 
141
static PyObject *Part_getRenderDied( BPy_PartSys * self );
 
142
static int Part_setRenderMaterialIndex( BPy_PartSys * self, PyObject * args );
 
143
static PyObject *Part_getRenderMaterialIndex( BPy_PartSys * self );
130
144
static int Part_setStep( BPy_PartSys * self, PyObject * args );
131
145
static PyObject *Part_getStep( BPy_PartSys * self );
132
146
static int Part_setRenderStep( BPy_PartSys * self, PyObject * args );
133
147
static PyObject *Part_getRenderStep( BPy_PartSys * self );
134
148
static PyObject *Part_getDupOb( BPy_PartSys * self );
135
149
static PyObject *Part_getDrawAs( BPy_PartSys * self );
 
150
static int Part_setPhysType( BPy_PartSys * self, PyObject * args );
 
151
static PyObject *Part_getPhysType( BPy_PartSys * self );
 
152
static int Part_setIntegrator( BPy_PartSys * self, PyObject * args );
 
153
static PyObject *Part_getIntegrator( BPy_PartSys * self );
 
154
static int Part_setIniVelObject( BPy_PartSys * self, PyObject * args );
 
155
static PyObject *Part_getIniVelObject( BPy_PartSys * self );
 
156
static int Part_setIniVelNormal( BPy_PartSys * self, PyObject * args );
 
157
static PyObject *Part_getIniVelNormal( BPy_PartSys * self );
 
158
static int Part_setIniVelRandom( BPy_PartSys * self, PyObject * args );
 
159
static PyObject *Part_getIniVelRandom( BPy_PartSys * self );
 
160
static int Part_setIniVelTan( BPy_PartSys * self, PyObject * args );
 
161
static PyObject *Part_getIniVelTan( BPy_PartSys * self );
 
162
static int Part_setIniVelRot( BPy_PartSys * self, PyObject * args );
 
163
static PyObject *Part_getIniVelRot( BPy_PartSys * self );
 
164
static int Part_setIniVelPart( BPy_PartSys * self, PyObject * args );
 
165
static PyObject *Part_getIniVelPart( BPy_PartSys * self );
 
166
static int Part_setIniVelReact( BPy_PartSys * self, PyObject * args );
 
167
static PyObject *Part_getIniVelReact( BPy_PartSys * self );
 
168
static int Part_setRotDynamic( BPy_PartSys * self, PyObject * args );
 
169
static PyObject *Part_getRotDynamic( BPy_PartSys * self );
 
170
static int Part_setRotation( BPy_PartSys * self, PyObject * args );
 
171
static PyObject *Part_getRotation( BPy_PartSys * self );
 
172
static int Part_setRotRandom( BPy_PartSys * self, PyObject * args );
 
173
static PyObject *Part_getRotRandom( BPy_PartSys * self );
 
174
static int Part_setRotPhase( BPy_PartSys * self, PyObject * args );
 
175
static PyObject *Part_getRotPhase( BPy_PartSys * self );
 
176
static int Part_setRotPhaseR( BPy_PartSys * self, PyObject * args );
 
177
static PyObject *Part_getRotPhaseR( BPy_PartSys * self );
 
178
static int Part_setRotAngularV( BPy_PartSys * self, PyObject * args );
 
179
static PyObject *Part_getRotAngularV( BPy_PartSys * self );
 
180
static int Part_setRotAngularVAm( BPy_PartSys * self, PyObject * args );
 
181
static PyObject *Part_getRotAngularVAm( BPy_PartSys * self );
 
182
static int Part_setGlobAccX( BPy_PartSys * self, PyObject * args );
 
183
static PyObject *Part_getGlobAccX( BPy_PartSys * self );
 
184
static int Part_setGlobAccY( BPy_PartSys * self, PyObject * args );
 
185
static PyObject *Part_getGlobAccY( BPy_PartSys * self );
 
186
static int Part_setGlobAccZ( BPy_PartSys * self, PyObject * args );
 
187
static PyObject *Part_getGlobAccZ( BPy_PartSys * self );
 
188
static int Part_setGlobDrag( BPy_PartSys * self, PyObject * args );
 
189
static PyObject *Part_getGlobDrag( BPy_PartSys * self );
 
190
static int Part_setGlobBrown( BPy_PartSys * self, PyObject * args );
 
191
static PyObject *Part_getGlobBrown( BPy_PartSys * self );
 
192
static int Part_setGlobDamp( BPy_PartSys * self, PyObject * args );
 
193
static PyObject *Part_getGlobDamp( BPy_PartSys * self );
136
194
static PyObject *Part_GetAge( BPy_PartSys * self, PyObject * args );
 
195
static int Part_setChildAmount( BPy_PartSys * self, PyObject * args );
 
196
static PyObject *Part_getChildAmount( BPy_PartSys * self );
 
197
static int Part_setChildType( BPy_PartSys * self, PyObject * args );
 
198
static PyObject *Part_getChildType( BPy_PartSys * self );
 
199
static int Part_setChildRenderAmount( BPy_PartSys * self, PyObject * args );
 
200
static PyObject *Part_getChildRenderAmount( BPy_PartSys * self );
 
201
static int Part_setChildRadius( BPy_PartSys * self, PyObject * args );
 
202
static PyObject *Part_getChildRadius( BPy_PartSys * self );
 
203
static int Part_setChildRoundness( BPy_PartSys * self, PyObject * args );
 
204
static PyObject *Part_getChildRoundness( BPy_PartSys * self );
 
205
static int Part_setChildClumping( BPy_PartSys * self, PyObject * args );
 
206
static PyObject *Part_getChildClumping( BPy_PartSys * self );
 
207
static int Part_setChildShape( BPy_PartSys * self, PyObject * args );
 
208
static PyObject *Part_getChildShape( BPy_PartSys * self );
 
209
static int Part_setChildSize( BPy_PartSys * self, PyObject * args );
 
210
static PyObject *Part_getChildSize( BPy_PartSys * self );
 
211
static int Part_setChildRandom( BPy_PartSys * self, PyObject * args );
 
212
static PyObject *Part_getChildRandom( BPy_PartSys * self );
 
213
static int Part_setChildRough1( BPy_PartSys * self, PyObject * args );
 
214
static PyObject *Part_getChildRough1( BPy_PartSys * self );
 
215
static int Part_setChildRough1Size( BPy_PartSys * self, PyObject * args );
 
216
static PyObject *Part_getChildRough1Size( BPy_PartSys * self );
 
217
static int Part_setChildRough2( BPy_PartSys * self, PyObject * args );
 
218
static PyObject *Part_getChildRough2( BPy_PartSys * self );
 
219
static int Part_setChildRough2Size( BPy_PartSys * self, PyObject * args );
 
220
static PyObject *Part_getChildRough2Size( BPy_PartSys * self );
 
221
static int Part_setChildRough2Thres( BPy_PartSys * self, PyObject * args );
 
222
static PyObject *Part_getChildRough2Thres( BPy_PartSys * self );
 
223
static int Part_setChildRoughE( BPy_PartSys * self, PyObject * args );
 
224
static PyObject *Part_getChildRoughE( BPy_PartSys * self );
 
225
static int Part_setChildRoughEShape( BPy_PartSys * self, PyObject * args );
 
226
static PyObject *Part_getChildRoughEShape( BPy_PartSys * self );
 
227
static int Part_setChildKink( BPy_PartSys * self, PyObject * args );
 
228
static PyObject *Part_getChildKink( BPy_PartSys * self );
 
229
static int Part_setChildKinkAxis( BPy_PartSys * self, PyObject * args );
 
230
static PyObject *Part_getChildKinkAxis( BPy_PartSys * self );
 
231
static int Part_setChildKinkFreq( BPy_PartSys * self, PyObject * args );
 
232
static PyObject *Part_getChildKinkFreq( BPy_PartSys * self );
 
233
static int Part_setChildKinkShape( BPy_PartSys * self, PyObject * args );
 
234
static PyObject *Part_getChildKinkShape( BPy_PartSys * self );
 
235
static int Part_setChildKinkAmp( BPy_PartSys * self, PyObject * args );
 
236
static PyObject *Part_getChildKinkAmp( BPy_PartSys * self );
 
237
static int Part_setChildBranch( BPy_PartSys * self, PyObject * args );
 
238
static PyObject *Part_getChildBranch( BPy_PartSys * self );
 
239
static int Part_setChildBranchAnim( BPy_PartSys * self, PyObject * args );
 
240
static PyObject *Part_getChildBranchAnim( BPy_PartSys * self );
 
241
static int Part_setChildBranchSymm( BPy_PartSys * self, PyObject * args );
 
242
static PyObject *Part_getChildBranchSymm( BPy_PartSys * self );
 
243
static int Part_setChildBranchThre( BPy_PartSys * self, PyObject * args );
 
244
static PyObject *Part_getChildBranchThre( BPy_PartSys * self );
137
245
 
138
246
/*****************************************************************************/
139
247
/* Python Effect_Type callback function prototypes:                           */
163
271
         METH_VARARGS, "() - Get particles location"},
164
272
        {"getRot", ( PyCFunction ) Part_GetRot,
165
273
         METH_VARARGS, "() - Get particles rotations (list of 4 floats quaternion)"},
 
274
    {"setMat", ( PyCFunction ) Part_SetMat,
 
275
         METH_VARARGS, "() - Set particles material"},
166
276
        {"getMat", ( PyCFunction ) Part_GetMat,
167
277
         METH_NOARGS, "() - Get particles material"},
168
278
        {"getSize", ( PyCFunction ) Part_GetSize,
169
279
         METH_VARARGS, "() - Get particles size in a list"},
170
280
        {"getAge", ( PyCFunction ) Part_GetAge,
171
281
         METH_VARARGS, "() - Get particles life in a list"},
 
282
        {"getVertGroup", ( PyCFunction ) Part_GetVertGroup,
 
283
         METH_VARARGS, "() - Get the vertex group which affects a particles attribute"},
 
284
        {"setVertGroup", ( PyCFunction ) Part_SetVertGroup,
 
285
         METH_VARARGS, "() - Set the vertex group to affect a particles attribute"},
172
286
        {NULL, NULL, 0, NULL}
173
287
};
174
288
 
296
410
         (getter)Part_getRenderObject, (setter)Part_setRenderObject,
297
411
         "Render emitter object",
298
412
         NULL},
 
413
         {"renderMatCol",
 
414
         (getter)Part_getRenderMaterialColor, (setter)Part_setRenderMaterialColor,
 
415
         "Draw particles using material's diffuse color",
 
416
         NULL},
 
417
         {"renderParents",
 
418
         (getter)Part_getRenderParents, (setter)Part_setRenderParents,
 
419
         "Render parent particles",
 
420
         NULL},
 
421
         {"renderUnborn",
 
422
         (getter)Part_getRenderUnborn, (setter)Part_setRenderUnborn,
 
423
         "Show particles before they are emitted",
 
424
         NULL},
 
425
         {"renderDied",
 
426
         (getter)Part_getRenderDied, (setter)Part_setRenderDied,
 
427
         "Show particles after they have died",
 
428
         NULL},
 
429
         {"renderMaterial",
 
430
         (getter)Part_getRenderMaterialIndex, (setter)Part_setRenderMaterialIndex,
 
431
         "Specify material index used for the particles",
 
432
         NULL},
299
433
     {"displayPercentage",
300
434
         (getter)Part_getParticleDisp, (setter)Part_setParticleDisp,
301
435
         "Particle display percentage",
316
450
         (getter)Part_getDrawAs, NULL,
317
451
         "Get draw type Particle.DRAWAS([ 'NONE' | 'OBJECT' | 'POINT' | ... ] )",
318
452
         NULL},
 
453
/* Newtonian Physics */
 
454
        {"physics",
 
455
         (getter)Part_getPhysType, (setter)Part_setPhysType,
 
456
         "Select particle physics type Particle.PHYSICS([ 'BOIDS' | 'KEYED' | 'NEWTONIAN' | 'NONE' ])",
 
457
         NULL},
 
458
        {"integration",
 
459
         (getter)Part_getIntegrator, (setter)Part_setIntegrator,
 
460
         "Select physics integrator type Particle.INTEGRATOR([ 'RK4' | 'MIDPOINT' | 'EULER' ])",
 
461
         NULL},
 
462
         {"inVelObj",
 
463
         (getter)Part_getIniVelObject, (setter)Part_setIniVelObject,
 
464
         "Let the object give the particle a starting speed",
 
465
         NULL},
 
466
         {"inVelNor",
 
467
         (getter)Part_getIniVelNormal, (setter)Part_setIniVelNormal,
 
468
         "Let the surface normal give the particle a starting speed",
 
469
         NULL},
 
470
         {"inVelRan",
 
471
         (getter)Part_getIniVelRandom, (setter)Part_setIniVelRandom,
 
472
         "Give the starting speed a random variation",
 
473
         NULL},
 
474
         {"inVelTan",
 
475
         (getter)Part_getIniVelTan, (setter)Part_setIniVelTan,
 
476
         "Let the surface tangent give the particle a starting speed",
 
477
         NULL},
 
478
         {"inVelRot",
 
479
         (getter)Part_getIniVelRot, (setter)Part_setIniVelRot,
 
480
         "Rotate the surface tangent",
 
481
         NULL},
 
482
         {"inVelPart",
 
483
         (getter)Part_getIniVelPart, (setter)Part_setIniVelPart,
 
484
         "Let the target particle give the particle a starting speed",
 
485
         NULL},
 
486
         {"inVelReact",
 
487
         (getter)Part_getIniVelReact, (setter)Part_setIniVelReact,
 
488
         "Let the vector away from the target particles location give the particle a starting speed",
 
489
         NULL},
 
490
         {"rotation",
 
491
         (getter)Part_getRotation, (setter)Part_setRotation,
 
492
         "Particles initial rotation Particle.ROTATION([ 'OBZ' | 'OBY' | 'OBX' | 'GLZ' | 'GLY' | 'GLX' | 'VEL' | 'NOR' | 'NONE' ])",
 
493
         NULL},
 
494
         {"rotDyn",
 
495
         (getter)Part_getRotDynamic, (setter)Part_setRotDynamic,
 
496
         "Sets rotation to dynamic/constant",
 
497
         NULL},
 
498
         {"rotRand",
 
499
         (getter)Part_getRotRandom, (setter)Part_setRotRandom,
 
500
         "Randomize rotation",
 
501
         NULL},
 
502
         {"rotPhase",
 
503
         (getter)Part_getRotPhase, (setter)Part_setRotPhase,
 
504
         "Initial rotation phase",
 
505
         NULL},
 
506
         {"rotPhaseR",
 
507
         (getter)Part_getRotPhaseR, (setter)Part_setRotPhaseR,
 
508
         "Randomize rotation phase",
 
509
         NULL},
 
510
         {"rotAnV",
 
511
         (getter)Part_getRotAngularV, (setter)Part_setRotAngularV,
 
512
         "Select particle angular velocity mode Particle.ANGULARV([ 'RANDOM' | 'SPIN' | 'NONE' ])",
 
513
         NULL},
 
514
         {"rotAnVAm",
 
515
         (getter)Part_getRotAngularVAm, (setter)Part_setRotAngularVAm,
 
516
         "Angular velocity amount",
 
517
         NULL},
 
518
         {"glAccX",
 
519
         (getter)Part_getGlobAccX, (setter)Part_setGlobAccX,
 
520
         "Specify a constant acceleration along the X-axis",
 
521
         NULL},
 
522
         {"glAccY",
 
523
         (getter)Part_getGlobAccY, (setter)Part_setGlobAccY,
 
524
         "Specify a constant acceleration along the Y-axis",
 
525
         NULL},
 
526
         {"glAccZ",
 
527
         (getter)Part_getGlobAccZ, (setter)Part_setGlobAccZ,
 
528
         "Specify a constant acceleration along the Z-axis",
 
529
         NULL},
 
530
         {"glDrag",
 
531
         (getter)Part_getGlobDrag, (setter)Part_setGlobDrag,
 
532
         "Specify the amount of air-drag",
 
533
         NULL},
 
534
         {"glBrown",
 
535
         (getter)Part_getGlobBrown, (setter)Part_setGlobBrown,
 
536
         "Specify the amount of brownian motion",
 
537
         NULL},
 
538
         {"glDamp",
 
539
         (getter)Part_getGlobDamp, (setter)Part_setGlobDamp,
 
540
         "Specify the amount of damping",
 
541
         NULL},
 
542
/* Children */
 
543
        {"childAmount",
 
544
         (getter)Part_getChildAmount, (setter)Part_setChildAmount,
 
545
         "The total number of children",
 
546
         NULL},
 
547
         {"childType",
 
548
         (getter)Part_getChildType, (setter)Part_setChildType,
 
549
         "Type of childrens ( Particle.CHILDTYPE[ 'FACES' | 'PARTICLES' | 'NONE' ] )",
 
550
         NULL},
 
551
         {"childRenderAmount",
 
552
         (getter)Part_getChildRenderAmount, (setter)Part_setChildRenderAmount,
 
553
         "Amount of children/parent for rendering",
 
554
         NULL},
 
555
         {"childRadius",
 
556
         (getter)Part_getChildRadius, (setter)Part_setChildRadius,
 
557
         "Radius of children around parent",
 
558
         NULL},
 
559
         {"childRound",
 
560
         (getter)Part_getChildRoundness, (setter)Part_setChildRoundness,
 
561
         "Roundness of children around parent",
 
562
         NULL},
 
563
         {"childClump",
 
564
         (getter)Part_getChildClumping, (setter)Part_setChildClumping,
 
565
         "Amount of clumpimg",
 
566
         NULL},
 
567
         {"childShape",
 
568
         (getter)Part_getChildShape, (setter)Part_setChildShape,
 
569
         "Shape of clumpimg",
 
570
         NULL},
 
571
         {"childSize",
 
572
         (getter)Part_getChildSize, (setter)Part_setChildSize,
 
573
         "A multiplier for the child particle size",
 
574
         NULL},
 
575
         {"childRand",
 
576
         (getter)Part_getChildRandom, (setter)Part_setChildRandom,
 
577
         "Random variation to the size of the child particles",
 
578
         NULL},
 
579
         {"childRough1",
 
580
         (getter)Part_getChildRough1, (setter)Part_setChildRough1,
 
581
         "Amount of location dependant rough",
 
582
         NULL},
 
583
         {"childRough1Size",
 
584
         (getter)Part_getChildRough1Size, (setter)Part_setChildRough1Size,
 
585
         "Size of location dependant rough",
 
586
         NULL},
 
587
         {"childRough2",
 
588
         (getter)Part_getChildRough2, (setter)Part_setChildRough2,
 
589
         "Amount of random rough",
 
590
         NULL},
 
591
         {"childRough2Size",
 
592
         (getter)Part_getChildRough2Size, (setter)Part_setChildRough2Size,
 
593
         "Size of random rough",
 
594
         NULL},
 
595
         {"childRough2Thresh",
 
596
         (getter)Part_getChildRough2Thres, (setter)Part_setChildRough2Thres,
 
597
         "Amount of particles left untouched by random rough",
 
598
         NULL},
 
599
         {"childRoughE",
 
600
         (getter)Part_getChildRoughE, (setter)Part_setChildRoughE,
 
601
         "Amount of end point rough",
 
602
         NULL},
 
603
         {"childRoughEShape",
 
604
         (getter)Part_getChildRoughEShape, (setter)Part_setChildRoughEShape,
 
605
         "Shape of end point rough",
 
606
         NULL},
 
607
         {"childKink",
 
608
         (getter)Part_getChildKink, (setter)Part_setChildKink,
 
609
         "Type of periodic offset on the path (Particle.CHILDKINK[ 'BRAID' | 'WAVE' | 'RADIAL' | 'CURL' | 'NOTHING' ])",
 
610
         NULL},
 
611
         {"childKinkAxis",
 
612
         (getter)Part_getChildKinkAxis, (setter)Part_setChildKinkAxis,
 
613
         "Which axis to use for offset (Particle.CHILDKINKAXIS[ 'Z' | 'Y' | 'X' ])",
 
614
         NULL},
 
615
         {"childKinkFreq",
 
616
         (getter)Part_getChildKinkFreq, (setter)Part_setChildKinkFreq,
 
617
         "The frequency of the offset (1/total length)",
 
618
         NULL},
 
619
         {"childKinkShape",
 
620
         (getter)Part_getChildKinkShape, (setter)Part_setChildKinkShape,
 
621
         "Adjust the offset to the beginning/end",
 
622
         NULL},
 
623
         {"childKinkAmp",
 
624
         (getter)Part_getChildKinkAmp, (setter)Part_setChildKinkAmp,
 
625
         "The amplitude of the offset",
 
626
         NULL},
 
627
         {"childBranch",
 
628
         (getter)Part_getChildBranch, (setter)Part_setChildBranch,
 
629
         "Branch child paths from eachother",
 
630
         NULL},
 
631
         {"childBranchAnim",
 
632
         (getter)Part_getChildBranchAnim, (setter)Part_setChildBranchAnim,
 
633
         "Animate branching",
 
634
         NULL},
 
635
         {"childBranchSymm",
 
636
         (getter)Part_getChildBranchSymm, (setter)Part_setChildBranchSymm,
 
637
         "Start and end points are the same",
 
638
         NULL},
 
639
         {"childBranchThre",
 
640
         (getter)Part_getChildBranchThre, (setter)Part_setChildBranchThre,
 
641
         "Threshold of branching",
 
642
         NULL},
319
643
        {NULL,NULL,NULL,NULL,NULL}  /* Sentinel */
320
644
};
321
645
 
323
647
/* Python method structure definition for Blender.Particle module:           */
324
648
/*****************************************************************************/
325
649
static struct PyMethodDef M_ParticleSys_methods[] = {
326
 
        {"New", ( PyCFunction ) M_ParticleSys_New, METH_VARARGS, M_ParticleSys_New_doc},
 
650
        {"New", ( PyCFunction ) M_ParticleSys_New, METH_O, M_ParticleSys_New_doc},
327
651
        {"Get", M_ParticleSys_Get, METH_VARARGS, M_ParticleSys_Get_doc},
328
652
        {NULL, NULL, 0, NULL}
329
653
};
456
780
}
457
781
 
458
782
 
459
 
PyObject *M_ParticleSys_New( PyObject * self, PyObject * args ){
 
783
PyObject *M_ParticleSys_New( PyObject * self, PyObject * value)
 
784
{
460
785
        ParticleSystem *psys = 0;
461
786
        ParticleSystem *rpsys = 0;
462
787
        ModifierData *md;
463
788
        ParticleSystemModifierData *psmd;
464
789
        Object *ob = NULL;
465
 
        char *name = NULL;
466
790
        ID *id;
467
791
        int nr;
468
 
 
469
 
        if( !PyArg_ParseTuple( args, "s", &name ) )
470
 
                return EXPP_ReturnPyObjError( PyExc_TypeError,
471
 
                        "expected string argument" );
472
 
 
473
 
        for( ob = G.main->object.first; ob; ob = ob->id.next )
474
 
                if( !strcmp( name, ob->id.name + 2 ) )
475
 
                        break;
476
 
 
477
 
        if( !ob )
478
 
                return EXPP_ReturnPyObjError( PyExc_AttributeError, 
479
 
                        "object does not exist" );
 
792
        
 
793
        if ( PyString_Check( value ) ) {
 
794
                char *name;
 
795
                name = PyString_AsString ( value );
 
796
                ob = ( Object * ) GetIdFromList( &( G.main->object ), name );
 
797
                if( !ob )
 
798
                        return EXPP_ReturnPyObjError( PyExc_AttributeError, name );
 
799
        } else if ( BPy_Object_Check(value) ) {
 
800
                ob = (( BPy_Object * ) value)->object;
 
801
        } else {
 
802
                return EXPP_ReturnPyObjError( PyExc_TypeError, "expected object or string" );
 
803
        }
480
804
 
481
805
        id = (ID *)psys_new_settings("PSys", G.main);
482
806
 
559
883
                }
560
884
 
561
885
                if( !wanted_obj){  /* requested object not found */
562
 
                        char error_msg[64];
563
 
                        PyOS_snprintf( error_msg, sizeof( error_msg ),
564
 
                                                   "Particle System '%s' not found", name);
565
 
                        return EXPP_ReturnPyObjError( PyExc_NameError, error_msg );
 
886
                        PyErr_Format(PyExc_NameError, "Particle System '%s' not found", name);
 
887
                        return NULL;
566
888
                }
567
889
 
568
890
                return wanted_obj;
710
1032
        return ReactOn;
711
1033
}
712
1034
 
 
1035
/* create the Blender.Particle.Physics constant dict */
 
1036
 
 
1037
static PyObject *Particle_PhysicsDict( void )
 
1038
{
 
1039
        PyObject *Physics = PyConstant_New(  );
 
1040
 
 
1041
        if( Physics ) {
 
1042
                BPy_constant *c = ( BPy_constant * ) Physics;
 
1043
 
 
1044
                PyConstant_Insert( c, "BOIDS",
 
1045
                                 PyInt_FromLong( 3 ) );
 
1046
                PyConstant_Insert( c, "KEYED",
 
1047
                                 PyInt_FromLong( 2 ) );
 
1048
                PyConstant_Insert( c, "NEWTONIAN",
 
1049
                                 PyInt_FromLong( 1 ) );
 
1050
                PyConstant_Insert( c, "NONE",
 
1051
                                 PyInt_FromLong( 0 ) );
 
1052
        }
 
1053
        return Physics;
 
1054
}
 
1055
 
 
1056
/* create the Blender.Particle.Integrator constant dict */
 
1057
 
 
1058
static PyObject *Particle_IntegratorDict( void )
 
1059
{
 
1060
        PyObject *Integrator = PyConstant_New(  );
 
1061
 
 
1062
        if( Integrator ) {
 
1063
                BPy_constant *c = ( BPy_constant * ) Integrator;
 
1064
 
 
1065
                PyConstant_Insert( c, "EULER",
 
1066
                                 PyInt_FromLong( 2 ) );
 
1067
                PyConstant_Insert( c, "MIDPOINT",
 
1068
                                 PyInt_FromLong( 1 ) );
 
1069
                PyConstant_Insert( c, "EULER",
 
1070
                                 PyInt_FromLong( 0 ) );
 
1071
        }
 
1072
        return Integrator;
 
1073
}
 
1074
 
 
1075
/* create the Blender.Particle.Rotation constant dict */
 
1076
 
 
1077
static PyObject *Particle_RotationDict( void )
 
1078
{
 
1079
        PyObject *Rotation = PyConstant_New(  );
 
1080
 
 
1081
        if( Rotation ) {
 
1082
                BPy_constant *c = ( BPy_constant * ) Rotation;
 
1083
 
 
1084
                PyConstant_Insert( c, "OBZ",
 
1085
                                 PyInt_FromLong( 8 ) );
 
1086
                PyConstant_Insert( c, "OBY",
 
1087
                                 PyInt_FromLong( 7 ) );
 
1088
                PyConstant_Insert( c, "OBX",
 
1089
                                 PyInt_FromLong( 6 ) );
 
1090
                PyConstant_Insert( c, "GLZ",
 
1091
                                 PyInt_FromLong( 5 ) );
 
1092
                PyConstant_Insert( c, "GLY",
 
1093
                                 PyInt_FromLong( 4 ) );
 
1094
                PyConstant_Insert( c, "GLX",
 
1095
                                 PyInt_FromLong( 3 ) );
 
1096
                PyConstant_Insert( c, "VEL",
 
1097
                                 PyInt_FromLong( 2 ) );
 
1098
                PyConstant_Insert( c, "NOR",
 
1099
                                 PyInt_FromLong( 1 ) );
 
1100
                PyConstant_Insert( c, "NONE",
 
1101
                                 PyInt_FromLong( 0 ) );
 
1102
        }
 
1103
        return Rotation;
 
1104
}
 
1105
 
 
1106
/* create the Blender.Particle.AngularV constant dict */
 
1107
 
 
1108
static PyObject *Particle_AngularVDict( void )
 
1109
{
 
1110
        PyObject *AngularV = PyConstant_New(  );
 
1111
 
 
1112
        if( AngularV ) {
 
1113
                BPy_constant *c = ( BPy_constant * ) AngularV;
 
1114
 
 
1115
                PyConstant_Insert( c, "RANDOM",
 
1116
                                 PyInt_FromLong( 2 ) );
 
1117
                PyConstant_Insert( c, "SPIN",
 
1118
                                 PyInt_FromLong( 1 ) );
 
1119
                PyConstant_Insert( c, "NONE",
 
1120
                                 PyInt_FromLong( 0 ) );
 
1121
        }
 
1122
        return AngularV;
 
1123
}
 
1124
 
 
1125
/* create the Blender.Particle.ChildType constant dict */
 
1126
 
 
1127
static PyObject *Particle_ChildTypeDict( void )
 
1128
{
 
1129
        PyObject *ChildTypes = PyConstant_New(  );
 
1130
 
 
1131
        if( ChildTypes ) {
 
1132
                BPy_constant *c = ( BPy_constant * ) ChildTypes;
 
1133
 
 
1134
                PyConstant_Insert( c, "FACES",
 
1135
                                 PyInt_FromLong( 2 ) );
 
1136
                PyConstant_Insert( c, "PARTICLES",
 
1137
                                 PyInt_FromLong( 1 ) );
 
1138
                PyConstant_Insert( c, "NONE",
 
1139
                                 PyInt_FromLong( 0 ) );
 
1140
        }
 
1141
        return ChildTypes;
 
1142
}
 
1143
 
 
1144
/* create the Blender.Particle.VertexGroups constant dict */
 
1145
 
 
1146
static PyObject *Particle_VertexGroupsDict( void )
 
1147
{
 
1148
        PyObject *VertexGroups = PyConstant_New(  );
 
1149
 
 
1150
        if( VertexGroups ) {
 
1151
                BPy_constant *c = ( BPy_constant * ) VertexGroups;
 
1152
 
 
1153
                PyConstant_Insert( c, "EFFECTOR",
 
1154
                                 PyInt_FromLong( 11 ) );
 
1155
                PyConstant_Insert( c, "TANROT",
 
1156
                                 PyInt_FromLong( 10 ) );
 
1157
                PyConstant_Insert( c, "TANVEL",
 
1158
                                 PyInt_FromLong( 9 ) );
 
1159
                PyConstant_Insert( c, "SIZE",
 
1160
                                 PyInt_FromLong( 8 ) );
 
1161
                PyConstant_Insert( c, "ROUGHE",
 
1162
                                 PyInt_FromLong( 7 ) );
 
1163
                PyConstant_Insert( c, "ROUGH2",
 
1164
                                 PyInt_FromLong( 6 ) );
 
1165
                PyConstant_Insert( c, "ROUGH1",
 
1166
                                 PyInt_FromLong( 5 ) );
 
1167
                PyConstant_Insert( c, "KINK",
 
1168
                                 PyInt_FromLong( 4 ) );
 
1169
                PyConstant_Insert( c, "CLUMP",
 
1170
                                 PyInt_FromLong( 3 ) );
 
1171
                PyConstant_Insert( c, "LENGHT",
 
1172
                                 PyInt_FromLong( 2 ) );
 
1173
                PyConstant_Insert( c, "VELOCITY",
 
1174
                                 PyInt_FromLong( 1 ) );
 
1175
                PyConstant_Insert( c, "DENSITY",
 
1176
                                 PyInt_FromLong( 0 ) );
 
1177
        }
 
1178
        return VertexGroups;
 
1179
}
 
1180
 
 
1181
 
 
1182
/* create the Blender.Particle.ChildKink constant dict */
 
1183
 
 
1184
static PyObject *Particle_ChildKinkDict( void )
 
1185
{
 
1186
        PyObject *ChildKinks = PyConstant_New(  );
 
1187
 
 
1188
        if( ChildKinks ) {
 
1189
                BPy_constant *c = ( BPy_constant * ) ChildKinks;
 
1190
 
 
1191
                PyConstant_Insert( c, "BRAID",
 
1192
                                 PyInt_FromLong( 4 ) );
 
1193
                PyConstant_Insert( c, "WAVE",
 
1194
                                 PyInt_FromLong( 3 ) );
 
1195
                PyConstant_Insert( c, "RADIAL",
 
1196
                                 PyInt_FromLong( 2 ) );
 
1197
                PyConstant_Insert( c, "CURL",
 
1198
                                 PyInt_FromLong( 1 ) );
 
1199
                PyConstant_Insert( c, "NOTHING",
 
1200
                                 PyInt_FromLong( 0 ) );
 
1201
        }
 
1202
        return ChildKinks;
 
1203
}
 
1204
 
 
1205
/* create the Blender.Particle.ChildKinkAxis constant dict */
 
1206
 
 
1207
static PyObject *Particle_ChildKinkAxisDict( void )
 
1208
{
 
1209
        PyObject *ChildKinkAxes = PyConstant_New(  );
 
1210
 
 
1211
        if( ChildKinkAxes ) {
 
1212
                BPy_constant *c = ( BPy_constant * ) ChildKinkAxes;
 
1213
 
 
1214
                PyConstant_Insert( c, "Z",
 
1215
                                 PyInt_FromLong( 2 ) );
 
1216
                PyConstant_Insert( c, "Y",
 
1217
                                 PyInt_FromLong( 1 ) );
 
1218
                PyConstant_Insert( c, "X",
 
1219
                                 PyInt_FromLong( 0 ) );
 
1220
        }
 
1221
        return ChildKinkAxes;
 
1222
}
 
1223
 
713
1224
static PyObject *Particle_DrawAs( void )
714
1225
{
715
1226
        PyObject *DrawAs = PyConstant_New(  );
756
1267
        PyObject *EmitFrom;
757
1268
        PyObject *Dist;
758
1269
        PyObject *DrawAs;
 
1270
        PyObject *Physics;
 
1271
        PyObject *Integrator;
 
1272
        PyObject *Rotation;
 
1273
        PyObject *AngularV;
 
1274
        PyObject *ChildTypes;
 
1275
        PyObject *VertexGroups;
 
1276
        PyObject *ChildKinks;
 
1277
        PyObject *ChildKinkAxes;
 
1278
 
759
1279
 
760
1280
        if( PyType_Ready( &ParticleSys_Type ) < 0)
761
1281
                return NULL;
765
1285
        EmitFrom = Particle_EmitFrom();
766
1286
        DrawAs = Particle_DrawAs();
767
1287
        Dist = Particle_DistrDict();
 
1288
        Physics = Particle_PhysicsDict();
 
1289
        Integrator = Particle_IntegratorDict();
 
1290
        Rotation = Particle_RotationDict();
 
1291
        AngularV = Particle_AngularVDict();
 
1292
        VertexGroups = Particle_VertexGroupsDict();
 
1293
        ChildTypes = Particle_ChildTypeDict();
 
1294
        ChildKinks = Particle_ChildKinkDict();
 
1295
        ChildKinkAxes = Particle_ChildKinkAxisDict();
768
1296
 
769
1297
        submodule = Py_InitModule3( "Blender.Particle", 
770
1298
                                                                M_ParticleSys_methods, M_ParticleSys_doc );
779
1307
                PyModule_AddObject( submodule, "DISTRIBUTION", Dist );
780
1308
        if( DrawAs )
781
1309
                PyModule_AddObject( submodule, "DRAWAS", DrawAs );
 
1310
        if( Physics )
 
1311
                PyModule_AddObject( submodule, "PHYSICS", Physics );
 
1312
        if( Integrator )
 
1313
                PyModule_AddObject( submodule, "INTEGRATOR", Integrator );
 
1314
        if( Rotation )
 
1315
                PyModule_AddObject( submodule, "ROTATION", Rotation );
 
1316
        if( AngularV )
 
1317
                PyModule_AddObject( submodule, "ANGULARV", AngularV );
 
1318
        if( VertexGroups )
 
1319
                PyModule_AddObject( submodule, "VERTEXGROUPS", VertexGroups );
 
1320
        if( ChildTypes )
 
1321
                PyModule_AddObject( submodule, "CHILDTYPE", ChildTypes );
 
1322
        if( ChildKinks )
 
1323
                PyModule_AddObject( submodule, "CHILDKINK", ChildKinks );
 
1324
        if( ChildKinkAxes )
 
1325
                PyModule_AddObject( submodule, "CHILDKINKAXIS", ChildKinkAxes );
782
1326
 
783
1327
        return ( submodule );
784
1328
}
1316
1860
        return NULL;
1317
1861
}
1318
1862
 
 
1863
static PyObject *Part_SetMat( BPy_PartSys * self, PyObject * args )
 
1864
{
 
1865
        Object *ob = self->object;
 
1866
        BPy_Material *pymat;
 
1867
        Material *mat;
 
1868
        short index;
 
1869
 
 
1870
        if( !PyArg_ParseTuple( args, "O!", &Material_Type, &pymat ) )
 
1871
                return EXPP_ReturnPyObjError( PyExc_TypeError,
 
1872
                                              "expected Blender Material PyObject" );
 
1873
 
 
1874
        mat = pymat->material;
 
1875
 
 
1876
        if( ob->totcol >= MAXMAT )
 
1877
                return EXPP_ReturnPyObjError( PyExc_RuntimeError,
 
1878
                                              "object data material lists can't have more than 16 materials" );
 
1879
 
 
1880
        index = find_material_index(ob,mat);
 
1881
        if (index == 0){        /*Not found*/
 
1882
                assign_material(ob,mat,ob->totcol+1);
 
1883
                index = find_material_index(ob,mat);
 
1884
        }
 
1885
 
 
1886
        if (index>0 && index<MAXMAT)
 
1887
                self->psys->part->omat = index;
 
1888
 
 
1889
        /* since we have messed with object, we need to flag for DAG recalc */
 
1890
        self->object->recalc |= OB_RECALC_OB;
 
1891
 
 
1892
        Py_RETURN_NONE;
 
1893
}
1319
1894
 
1320
1895
static PyObject *Part_GetMat( BPy_PartSys * self, PyObject * args ){
1321
1896
        Material *ma;
1328
1903
        return mat;
1329
1904
}
1330
1905
 
 
1906
static PyObject *Part_GetVertGroup( BPy_PartSys * self, PyObject * args ){
 
1907
        PyObject *list;
 
1908
        char errstr[128];
 
1909
        bDeformGroup *defGroup = NULL;
 
1910
        Object *obj = self->object;
 
1911
        int vg_attribute = 0;
 
1912
        int vg_number = 0;
 
1913
        int count;
 
1914
        PyObject *vg_neg;
 
1915
        PyObject *vg_name;
 
1916
 
 
1917
        if( !obj )
 
1918
                return EXPP_ReturnPyObjError( PyExc_AttributeError,
 
1919
                                              "particle system must be linked to an object first" );
 
1920
        
 
1921
        if( obj->type != OB_MESH )
 
1922
                return EXPP_ReturnPyObjError( PyExc_AttributeError,
 
1923
                                              "linked object is not a mesh" );
 
1924
        
 
1925
        if( !PyArg_ParseTuple( args, "i", &vg_attribute ) )
 
1926
                return EXPP_ReturnPyObjError( PyExc_TypeError,
 
1927
                                              "expected integer argument" );
 
1928
        
 
1929
        if( vg_attribute < 0 || vg_attribute > PSYS_TOT_VG-1 ){
 
1930
                sprintf ( errstr, "expected int argument in [0,%d]", PSYS_TOT_VG-1 );
 
1931
                return EXPP_ReturnPyObjError( PyExc_TypeError, errstr );
 
1932
        }
 
1933
 
 
1934
        /*search*/
 
1935
        vg_number = self->psys->vgroup[vg_attribute];
 
1936
        count = 1;
 
1937
        defGroup = obj->defbase.first;
 
1938
        while(count<vg_number && defGroup){
 
1939
                defGroup = defGroup->next;
 
1940
                count++;
 
1941
        }
 
1942
 
 
1943
        /*vg_name*/
 
1944
        if (defGroup && vg_number>0)
 
1945
                vg_name = PyString_FromString( defGroup->name );
 
1946
        else
 
1947
                vg_name = PyString_FromString( "" );
 
1948
        
 
1949
        /*vg_neg*/
 
1950
        vg_neg = PyInt_FromLong( ((long)( self->psys->vg_neg & (1<<vg_attribute) )) > 0 );
 
1951
 
 
1952
        list = PyList_New( 2 );
 
1953
        PyList_SET_ITEM( list, 0, vg_name );
 
1954
        PyList_SET_ITEM( list, 1, vg_neg );
 
1955
 
 
1956
        return list;
 
1957
}
 
1958
 
 
1959
static PyObject *Part_SetVertGroup( BPy_PartSys * self, PyObject * args ){
 
1960
        char errstr[128];
 
1961
        bDeformGroup *defGroup;
 
1962
        Object *obj = self->object;
 
1963
        char *vg_name = NULL;
 
1964
        int vg_attribute = 0;
 
1965
        int vg_neg = 0;
 
1966
        int vg_number = 0;
 
1967
        int count;
 
1968
 
 
1969
        if( !obj )
 
1970
                return EXPP_ReturnPyObjError( PyExc_AttributeError,
 
1971
                                              "particle system must be linked to an object first" );
 
1972
        
 
1973
        if( obj->type != OB_MESH )
 
1974
                return EXPP_ReturnPyObjError( PyExc_AttributeError,
 
1975
                                              "linked object is not a mesh" );
 
1976
        
 
1977
        if( !PyArg_ParseTuple( args, "sii", &vg_name, &vg_attribute, &vg_neg ) )
 
1978
                return EXPP_ReturnPyObjError( PyExc_TypeError,
 
1979
                                              "expected one string and two integers arguments" );
 
1980
        
 
1981
        if( vg_attribute < 0 || vg_attribute > PSYS_TOT_VG-1 ){
 
1982
                sprintf ( errstr, "expected int argument in [0,%d]", PSYS_TOT_VG-1 );
 
1983
                return EXPP_ReturnPyObjError( PyExc_TypeError, errstr );
 
1984
        }
 
1985
 
 
1986
        /*search*/
 
1987
        count = 1;
 
1988
        defGroup = obj->defbase.first;
 
1989
        while (defGroup){
 
1990
                if (strcmp(vg_name,defGroup->name)==0)
 
1991
                        vg_number = count;
 
1992
                defGroup = defGroup->next;
 
1993
                count++;
 
1994
        }
 
1995
 
 
1996
        /*vgroup*/
 
1997
        self->psys->vgroup[vg_attribute] = vg_number;
 
1998
 
 
1999
        /*vg_neg*/
 
2000
        if (vg_neg){
 
2001
                self->psys->vg_neg |= (1<<vg_attribute);
 
2002
        }else{
 
2003
                self->psys->vg_neg &= ~(1<<vg_attribute);
 
2004
        }
 
2005
 
 
2006
        psys_flush_settings( self->psys->part, PSYS_ALLOC, 1 );
 
2007
 
 
2008
        Py_RETURN_NONE;
 
2009
}
 
2010
 
1331
2011
 
1332
2012
/*****************************************************************************/
1333
2013
/* Function:              Set/Get Seed                                       */
1408
2088
{
1409
2089
        int number;
1410
2090
 
1411
 
        if( !PyInt_Check( args ) ) {
1412
 
                char errstr[128];
1413
 
                sprintf ( errstr, "expected int argument" );
1414
 
                return EXPP_ReturnIntError( PyExc_TypeError, errstr );
1415
 
        }
 
2091
        if( !PyInt_Check( args ) )
 
2092
                return EXPP_ReturnIntError( PyExc_TypeError, "expected int argument" );
1416
2093
 
1417
2094
        number = PyInt_AS_LONG( args );
1418
2095
 
1459
2136
{
1460
2137
        int number;
1461
2138
 
1462
 
        if( !PyInt_Check( args ) ) {
1463
 
                char errstr[128];
1464
 
                sprintf ( errstr, "expected int argument" );
1465
 
                return EXPP_ReturnIntError( PyExc_TypeError, errstr );
1466
 
        }
 
2139
        if( !PyInt_Check( args ) )
 
2140
                return EXPP_ReturnIntError( PyExc_TypeError, "expected int argument" );
1467
2141
 
1468
2142
        number = PyInt_AS_LONG( args );
1469
2143
 
1647
2321
static int Part_setOb( BPy_PartSys * self, PyObject * args )
1648
2322
{
1649
2323
        Object *obj;
1650
 
        if( !BPy_Object_Check( args ) ) {
1651
 
                char errstr[128];
1652
 
                sprintf ( errstr, "expected object argument" );
1653
 
                return EXPP_ReturnIntError( PyExc_TypeError, errstr );
1654
 
        }
 
2324
        if( !BPy_Object_Check( args ) )
 
2325
                return EXPP_ReturnIntError( PyExc_TypeError, "expected object argument" );
1655
2326
 
1656
2327
        obj = Object_FromPyObject(args);
1657
2328
 
1674
2345
{
1675
2346
        int number;
1676
2347
 
1677
 
        if( !PyInt_Check( args ) ) {
1678
 
                char errstr[128];
1679
 
                sprintf ( errstr, "expected int argument" );
1680
 
                return EXPP_ReturnIntError( PyExc_TypeError, errstr );
1681
 
        }
 
2348
        if( !PyInt_Check( args ) )
 
2349
                return EXPP_ReturnIntError( PyExc_TypeError, "expected int argument" );
1682
2350
 
1683
2351
        number = PyInt_AS_LONG( args );
1684
2352
 
1701
2369
static int Part_setParticleDist( BPy_PartSys * self, PyObject * args )
1702
2370
{
1703
2371
        int number;
1704
 
        char errstr[128];
1705
2372
 
1706
 
        if( !PyInt_Check( args ) ) {
1707
 
                sprintf ( errstr, "expected int argument" );
1708
 
                return EXPP_ReturnIntError( PyExc_TypeError, errstr );
1709
 
        }
 
2373
        if( !PyInt_Check( args ) )
 
2374
                return EXPP_ReturnIntError( PyExc_TypeError, "expected int argument" );
1710
2375
 
1711
2376
        number = PyInt_AS_LONG( args );
1712
2377
 
1713
 
        if (number < 0 || number > 3){
1714
 
                sprintf ( errstr, "expected int argument between 0 - 3" );
1715
 
                return EXPP_ReturnIntError( PyExc_TypeError, errstr );
1716
 
        }
 
2378
        if (number < 0 || number > 3)
 
2379
                return EXPP_ReturnIntError( PyExc_TypeError, "expected int argument between 0 - 3" );
1717
2380
 
1718
2381
        self->psys->part->from = (short)number;
1719
2382
 
1731
2394
{
1732
2395
        int number;
1733
2396
 
1734
 
        if( !PyInt_Check( args ) ) {
1735
 
                char errstr[128];
1736
 
                sprintf ( errstr, "expected int argument" );
1737
 
                return EXPP_ReturnIntError( PyExc_TypeError, errstr );
1738
 
        }
 
2397
        if( !PyInt_Check( args ) )
 
2398
                return EXPP_ReturnIntError( PyExc_TypeError, "expected int argument" );
1739
2399
 
1740
2400
        number = PyInt_AS_LONG( args );
1741
2401
 
1758
2418
static int Part_setDist( BPy_PartSys * self, PyObject * args )
1759
2419
{
1760
2420
        int number;
1761
 
        char errstr[128];
1762
2421
 
1763
 
        if( !PyInt_Check( args ) ) {
1764
 
                sprintf ( errstr, "expected int argument" );
1765
 
                return EXPP_ReturnIntError( PyExc_TypeError, errstr );
1766
 
        }
 
2422
        if( !PyInt_Check( args ) )
 
2423
                return EXPP_ReturnIntError( PyExc_TypeError, "expected int argument" );
1767
2424
 
1768
2425
        number = PyInt_AS_LONG( args );
1769
2426
 
1770
 
        if (number < 0 || number > 2){
1771
 
                sprintf ( errstr, "expected int argument between 0 - 2" );
1772
 
                return EXPP_ReturnIntError( PyExc_TypeError, errstr );
1773
 
        }
 
2427
        if (number < 0 || number > 2)
 
2428
                return EXPP_ReturnIntError( PyExc_TypeError, "expected int argument between 0 - 2" );
1774
2429
 
1775
2430
        self->psys->part->distr = (short)number;
1776
2431
 
1820
2475
{
1821
2476
        int number;
1822
2477
 
1823
 
        if( !PyInt_Check( args ) ) {
1824
 
                char errstr[128];
1825
 
                sprintf ( errstr, "expected int argument" );
1826
 
                return EXPP_ReturnIntError( PyExc_TypeError, errstr );
1827
 
        }
 
2478
        if( !PyInt_Check( args ) )
 
2479
                return EXPP_ReturnIntError( PyExc_TypeError, "expected int argument" );
1828
2480
 
1829
2481
        number = PyInt_AS_LONG( args );
1830
2482
 
1847
2499
static int Part_setTargetOb( BPy_PartSys * self, PyObject * args )
1848
2500
{
1849
2501
        Object *obj;
1850
 
        if( !BPy_Object_Check( args ) ) {
1851
 
                char errstr[128];
1852
 
                sprintf ( errstr, "expected object argument" );
1853
 
                return EXPP_ReturnIntError( PyExc_TypeError, errstr );
1854
 
        }
 
2502
        
 
2503
        if( !BPy_Object_Check( args ) )
 
2504
                return EXPP_ReturnIntError( PyExc_TypeError, "expected object argument" );
1855
2505
 
1856
2506
        obj = Object_FromPyObject(args);
1857
2507
 
1925
2575
        int number,nr;
1926
2576
        ParticleSystem *psys = 0L;
1927
2577
 
1928
 
        if( !PyInt_Check( args ) ) {
1929
 
                char errstr[128];
1930
 
                sprintf ( errstr, "expected int argument" );
1931
 
                return EXPP_ReturnIntError( PyExc_TypeError, errstr );
1932
 
        }
 
2578
        if( !PyInt_Check( args ) )
 
2579
                return EXPP_ReturnIntError( PyExc_TypeError, "expected int argument" );
1933
2580
 
1934
2581
        number = PyInt_AS_LONG( args );
1935
2582
 
1958
2605
        return PyInt_FromLong( ((long)( self->psys->part->draw & PART_DRAW_EMITTER )) > 0 );
1959
2606
}
1960
2607
 
 
2608
static int Part_setRenderMaterialColor( BPy_PartSys * self, PyObject * args )
 
2609
{
 
2610
        int number;
 
2611
 
 
2612
        if( !PyInt_Check( args ) )
 
2613
                return EXPP_ReturnIntError( PyExc_TypeError, "expected int argument" );
 
2614
 
 
2615
        number = PyInt_AS_LONG( args );
 
2616
 
 
2617
        if (number){
 
2618
                self->psys->part->draw |= PART_DRAW_MAT_COL;
 
2619
        }else{
 
2620
                self->psys->part->draw &= ~PART_DRAW_MAT_COL;
 
2621
        }
 
2622
 
 
2623
        psys_flush_settings( self->psys->part, PSYS_ALLOC, 1 );
 
2624
 
 
2625
        return 0;
 
2626
}
 
2627
 
 
2628
static PyObject *Part_getRenderMaterialColor( BPy_PartSys * self )
 
2629
{
 
2630
        return PyInt_FromLong( ((long)( self->psys->part->draw & PART_DRAW_MAT_COL )) > 0 );
 
2631
}
 
2632
 
 
2633
static int Part_setRenderParents( BPy_PartSys * self, PyObject * args )
 
2634
{
 
2635
        int number;
 
2636
 
 
2637
        if( !PyInt_Check( args ) )
 
2638
                return EXPP_ReturnIntError( PyExc_TypeError, "expected int argument" );
 
2639
 
 
2640
        number = PyInt_AS_LONG( args );
 
2641
 
 
2642
        if (number){
 
2643
                self->psys->part->draw |= PART_DRAW_PARENT;
 
2644
        }else{
 
2645
                self->psys->part->draw &= ~PART_DRAW_PARENT;
 
2646
        }
 
2647
 
 
2648
        return 0;
 
2649
}
 
2650
 
 
2651
static PyObject *Part_getRenderParents( BPy_PartSys * self )
 
2652
{
 
2653
        return PyInt_FromLong( ((long)( self->psys->part->draw & PART_DRAW_PARENT )) > 0 );
 
2654
}
 
2655
 
 
2656
static int Part_setRenderUnborn( BPy_PartSys * self, PyObject * args )
 
2657
{
 
2658
        int number;
 
2659
 
 
2660
        if( !PyInt_Check( args ) )
 
2661
                return EXPP_ReturnIntError( PyExc_TypeError, "expected int argument" );
 
2662
 
 
2663
        number = PyInt_AS_LONG( args );
 
2664
 
 
2665
        if (number){
 
2666
                self->psys->part->flag |= PART_UNBORN;
 
2667
        }else{
 
2668
                self->psys->part->flag &= ~PART_UNBORN;
 
2669
        }
 
2670
 
 
2671
        return 0;
 
2672
}
 
2673
 
 
2674
static PyObject *Part_getRenderUnborn( BPy_PartSys * self )
 
2675
{
 
2676
        return PyInt_FromLong( ((long)( self->psys->part->flag & PART_UNBORN )) > 0 );
 
2677
}
 
2678
 
 
2679
static int Part_setRenderDied( BPy_PartSys * self, PyObject * args )
 
2680
{
 
2681
        int number;
 
2682
 
 
2683
        if( !PyInt_Check( args ) )
 
2684
                return EXPP_ReturnIntError( PyExc_TypeError, "expected int argument" );
 
2685
 
 
2686
        number = PyInt_AS_LONG( args );
 
2687
 
 
2688
        if (number){
 
2689
                self->psys->part->flag |= PART_DIED;
 
2690
        }else{
 
2691
                self->psys->part->flag &= ~PART_DIED;
 
2692
        }
 
2693
 
 
2694
        return 0;
 
2695
}
 
2696
 
 
2697
static int Part_setRenderMaterialIndex( BPy_PartSys * self, PyObject * args )
 
2698
{
 
2699
        int res = EXPP_setIValueRange( args, &self->psys->part->omat,
 
2700
                        1, 16, 'i' );
 
2701
 
 
2702
        psys_flush_settings( self->psys->part, PSYS_ALLOC, 1 );
 
2703
 
 
2704
        return res;
 
2705
}
 
2706
 
 
2707
static PyObject *Part_getRenderMaterialIndex( BPy_PartSys * self )
 
2708
{
 
2709
        return PyInt_FromLong( ((int)( self->psys->part->omat )) );
 
2710
}
 
2711
 
 
2712
static PyObject *Part_getRenderDied( BPy_PartSys * self )
 
2713
{
 
2714
        return PyInt_FromLong( ((long)( self->psys->part->flag & PART_DIED )) > 0 );
 
2715
}
 
2716
 
1961
2717
static int Part_setParticleDisp( BPy_PartSys * self, PyObject * args )
1962
2718
{
1963
2719
        int res = EXPP_setIValueRange( args, &self->psys->part->disp,
2010
2766
{
2011
2767
        return PyInt_FromLong( (long)( self->psys->part->draw_as ) );
2012
2768
}
 
2769
 
 
2770
static int Part_setPhysType( BPy_PartSys * self, PyObject * args )
 
2771
{
 
2772
        int res = EXPP_setIValueRange( args, &self->psys->part->phystype,
 
2773
                        0, 3, 'h' );
 
2774
 
 
2775
        psys_flush_settings( self->psys->part, PSYS_ALLOC, 1 );
 
2776
 
 
2777
        return res;
 
2778
}
 
2779
 
 
2780
static PyObject *Part_getPhysType( BPy_PartSys * self )
 
2781
{
 
2782
        return PyInt_FromLong( (short)( self->psys->part->phystype ) );
 
2783
}
 
2784
 
 
2785
static int Part_setIntegrator( BPy_PartSys * self, PyObject * args )
 
2786
{
 
2787
        int res = EXPP_setIValueRange( args, &self->psys->part->integrator,
 
2788
                        0, 2, 'h' );
 
2789
 
 
2790
        psys_flush_settings( self->psys->part, PSYS_ALLOC, 1 );
 
2791
 
 
2792
        return res;
 
2793
}
 
2794
 
 
2795
static PyObject *Part_getIntegrator( BPy_PartSys * self )
 
2796
{
 
2797
        return PyInt_FromLong( (short)( self->psys->part->integrator ) );
 
2798
}
 
2799
 
 
2800
static int Part_setIniVelObject( BPy_PartSys * self, PyObject * args )
 
2801
{
 
2802
        int res = EXPP_setFloatRange( args, &self->psys->part->obfac,
 
2803
                        -1.0, 1.0 );
 
2804
 
 
2805
        psys_flush_settings( self->psys->part, PSYS_ALLOC, 1 );
 
2806
 
 
2807
        return res;
 
2808
}
 
2809
 
 
2810
static PyObject *Part_getIniVelObject( BPy_PartSys * self )
 
2811
{
 
2812
        return PyFloat_FromDouble( ((float)( self->psys->part->obfac )) );
 
2813
}
 
2814
 
 
2815
static int Part_setIniVelNormal( BPy_PartSys * self, PyObject * args )
 
2816
{
 
2817
        int res = EXPP_setFloatRange( args, &self->psys->part->normfac,
 
2818
                        -200.0, 200.0 );
 
2819
 
 
2820
        psys_flush_settings( self->psys->part, PSYS_ALLOC, 1 );
 
2821
 
 
2822
        return res;
 
2823
}
 
2824
 
 
2825
static PyObject *Part_getIniVelNormal( BPy_PartSys * self )
 
2826
{
 
2827
        return PyFloat_FromDouble( ((float)( self->psys->part->normfac )) );
 
2828
}
 
2829
 
 
2830
static int Part_setIniVelRandom( BPy_PartSys * self, PyObject * args )
 
2831
{
 
2832
        int res = EXPP_setFloatRange( args, &self->psys->part->randfac,
 
2833
                        0.0, 200.0 );
 
2834
 
 
2835
        psys_flush_settings( self->psys->part, PSYS_ALLOC, 1 );
 
2836
 
 
2837
        return res;
 
2838
}
 
2839
 
 
2840
static PyObject *Part_getIniVelRandom( BPy_PartSys * self )
 
2841
{
 
2842
        return PyFloat_FromDouble( ((float)( self->psys->part->randfac )) );
 
2843
}
 
2844
 
 
2845
static int Part_setIniVelTan( BPy_PartSys * self, PyObject * args )
 
2846
{
 
2847
        int res = EXPP_setFloatRange( args, &self->psys->part->tanfac,
 
2848
                        -200.0, 200.0 );
 
2849
 
 
2850
        psys_flush_settings( self->psys->part, PSYS_ALLOC, 1 );
 
2851
 
 
2852
        return res;
 
2853
}
 
2854
 
 
2855
static PyObject *Part_getIniVelTan( BPy_PartSys * self )
 
2856
{
 
2857
        return PyFloat_FromDouble( ((float)( self->psys->part->tanfac )) );
 
2858
}
 
2859
 
 
2860
static int Part_setIniVelRot( BPy_PartSys * self, PyObject * args )
 
2861
{
 
2862
        int res = EXPP_setFloatRange( args, &self->psys->part->tanphase,
 
2863
                        -1.0, 1.0 );
 
2864
 
 
2865
        psys_flush_settings( self->psys->part, PSYS_ALLOC, 1 );
 
2866
 
 
2867
        return res;
 
2868
}
 
2869
 
 
2870
static PyObject *Part_getIniVelRot( BPy_PartSys * self )
 
2871
{
 
2872
        return PyFloat_FromDouble( ((float)( self->psys->part->tanphase )) );
 
2873
}
 
2874
 
 
2875
static int Part_setIniVelPart( BPy_PartSys * self, PyObject * args )
 
2876
{
 
2877
        int res = EXPP_setFloatRange( args, &self->psys->part->partfac,
 
2878
                        -10.0, 10.0 );
 
2879
 
 
2880
        psys_flush_settings( self->psys->part, PSYS_ALLOC, 1 );
 
2881
 
 
2882
        return res;
 
2883
}
 
2884
 
 
2885
static PyObject *Part_getIniVelPart( BPy_PartSys * self )
 
2886
{
 
2887
        return PyFloat_FromDouble( ((float)( self->psys->part->partfac )) );
 
2888
}
 
2889
 
 
2890
static int Part_setIniVelReact( BPy_PartSys * self, PyObject * args )
 
2891
{
 
2892
        int res = EXPP_setFloatRange( args, &self->psys->part->reactfac,
 
2893
                        -10.0, 10.0 );
 
2894
 
 
2895
        psys_flush_settings( self->psys->part, PSYS_ALLOC, 1 );
 
2896
 
 
2897
        return res;
 
2898
}
 
2899
 
 
2900
static PyObject *Part_getIniVelReact( BPy_PartSys * self )
 
2901
{
 
2902
        return PyFloat_FromDouble( ((float)( self->psys->part->reactfac )) );
 
2903
}
 
2904
 
 
2905
static int Part_setRotation( BPy_PartSys * self, PyObject * args )
 
2906
{
 
2907
        int res = EXPP_setIValueRange( args, &self->psys->part->rotmode,
 
2908
                        0, 8, 'h' );
 
2909
 
 
2910
        psys_flush_settings( self->psys->part, PSYS_ALLOC, 1 );
 
2911
 
 
2912
        return res;
 
2913
}
 
2914
 
 
2915
static PyObject *Part_getRotation( BPy_PartSys * self )
 
2916
{
 
2917
        return PyInt_FromLong( (short)( self->psys->part->rotmode ) );
 
2918
}
 
2919
 
 
2920
static int Part_setRotDynamic( BPy_PartSys * self, PyObject * args )
 
2921
{
 
2922
        int number;
 
2923
 
 
2924
        if( !PyInt_Check( args ) )
 
2925
                return EXPP_ReturnIntError( PyExc_TypeError, "expected int argument" );
 
2926
 
 
2927
        number = PyInt_AS_LONG( args );
 
2928
 
 
2929
        if (number){
 
2930
                self->psys->part->flag |= PART_ROT_DYN;
 
2931
        }else{
 
2932
                self->psys->part->flag &= ~PART_ROT_DYN;
 
2933
        }
 
2934
 
 
2935
        psys_flush_settings( self->psys->part, PSYS_ALLOC, 1 );
 
2936
 
 
2937
        return 0;
 
2938
}
 
2939
 
 
2940
static PyObject *Part_getRotDynamic( BPy_PartSys * self )
 
2941
{
 
2942
        return PyInt_FromLong( ((long)( self->psys->part->flag & PART_ROT_DYN )) > 0 );
 
2943
}
 
2944
 
 
2945
static int Part_setRotRandom( BPy_PartSys * self, PyObject * args )
 
2946
{
 
2947
        int res = EXPP_setFloatRange( args, &self->psys->part->randrotfac,
 
2948
                        0.0, 1.0 );
 
2949
 
 
2950
        psys_flush_settings( self->psys->part, PSYS_ALLOC, 1 );
 
2951
 
 
2952
        return res;
 
2953
}
 
2954
 
 
2955
static PyObject *Part_getRotRandom( BPy_PartSys * self )
 
2956
{
 
2957
        return PyFloat_FromDouble( ((float)( self->psys->part->randrotfac )) );
 
2958
}
 
2959
 
 
2960
static int Part_setRotPhase( BPy_PartSys * self, PyObject * args )
 
2961
{
 
2962
        int res = EXPP_setFloatRange( args, &self->psys->part->phasefac,
 
2963
                        -1.0, 1.0 );
 
2964
 
 
2965
        psys_flush_settings( self->psys->part, PSYS_ALLOC, 1 );
 
2966
 
 
2967
        return res;
 
2968
}
 
2969
 
 
2970
static PyObject *Part_getRotPhase( BPy_PartSys * self )
 
2971
{
 
2972
        return PyFloat_FromDouble( ((float)( self->psys->part->phasefac )) );
 
2973
}
 
2974
 
 
2975
static int Part_setRotPhaseR( BPy_PartSys * self, PyObject * args )
 
2976
{
 
2977
        int res = EXPP_setFloatRange( args, &self->psys->part->randphasefac,
 
2978
                        0.0, 1.0 );
 
2979
 
 
2980
        psys_flush_settings( self->psys->part, PSYS_ALLOC, 1 );
 
2981
 
 
2982
        return res;
 
2983
}
 
2984
 
 
2985
static PyObject *Part_getRotPhaseR( BPy_PartSys * self )
 
2986
{
 
2987
        return PyFloat_FromDouble( ((float)( self->psys->part->randphasefac )) );
 
2988
}
 
2989
 
 
2990
static int Part_setRotAngularV( BPy_PartSys * self, PyObject * args )
 
2991
{
 
2992
        int res = EXPP_setIValueRange( args, &self->psys->part->avemode,
 
2993
                        0, 2, 'h' );
 
2994
 
 
2995
        psys_flush_settings( self->psys->part, PSYS_ALLOC, 1 );
 
2996
 
 
2997
        return res;
 
2998
}
 
2999
 
 
3000
static PyObject *Part_getRotAngularV( BPy_PartSys * self )
 
3001
{
 
3002
        return PyInt_FromLong( ((int)( self->psys->part->avemode )) );
 
3003
}
 
3004
 
 
3005
static int Part_setRotAngularVAm( BPy_PartSys * self, PyObject * args )
 
3006
{
 
3007
        int res = EXPP_setFloatRange( args, &self->psys->part->avefac,
 
3008
                        -200.0, 200.0 );
 
3009
 
 
3010
        psys_flush_settings( self->psys->part, PSYS_ALLOC, 1 );
 
3011
 
 
3012
        return res;
 
3013
}
 
3014
 
 
3015
static PyObject *Part_getRotAngularVAm( BPy_PartSys * self )
 
3016
{
 
3017
        return PyFloat_FromDouble( ((float)( self->psys->part->avefac )) );
 
3018
}
 
3019
 
 
3020
static int Part_setGlobAccX( BPy_PartSys * self, PyObject * args )
 
3021
{
 
3022
        int res = EXPP_setFloatRange( args, &self->psys->part->acc[0],
 
3023
                        -200.0, 200.0 );
 
3024
 
 
3025
        psys_flush_settings( self->psys->part, PSYS_ALLOC, 1 );
 
3026
 
 
3027
        return res;
 
3028
}
 
3029
 
 
3030
static PyObject *Part_getGlobAccX( BPy_PartSys * self )
 
3031
{
 
3032
        return PyFloat_FromDouble( ((float)( self->psys->part->acc[0] )) );
 
3033
}
 
3034
 
 
3035
static int Part_setGlobAccY( BPy_PartSys * self, PyObject * args )
 
3036
{
 
3037
        int res = EXPP_setFloatRange( args, &self->psys->part->acc[1],
 
3038
                        -200.0, 200.0 );
 
3039
 
 
3040
        psys_flush_settings( self->psys->part, PSYS_ALLOC, 1 );
 
3041
 
 
3042
        return res;
 
3043
}
 
3044
 
 
3045
static PyObject *Part_getGlobAccY( BPy_PartSys * self )
 
3046
{
 
3047
        return PyFloat_FromDouble( ((float)( self->psys->part->acc[1] )) );
 
3048
}
 
3049
 
 
3050
static int Part_setGlobAccZ( BPy_PartSys * self, PyObject * args )
 
3051
{
 
3052
        int res = EXPP_setFloatRange( args, &self->psys->part->acc[2],
 
3053
                        -200.0, 200.0 );
 
3054
 
 
3055
        psys_flush_settings( self->psys->part, PSYS_ALLOC, 1 );
 
3056
 
 
3057
        return res;
 
3058
}
 
3059
 
 
3060
static PyObject *Part_getGlobAccZ( BPy_PartSys * self )
 
3061
{
 
3062
        return PyFloat_FromDouble( ((float)( self->psys->part->acc[2] )) );
 
3063
}
 
3064
 
 
3065
static int Part_setGlobDrag( BPy_PartSys * self, PyObject * args )
 
3066
{
 
3067
        int res = EXPP_setFloatRange( args, &self->psys->part->dragfac,
 
3068
                        0.0, 1.0 );
 
3069
 
 
3070
        psys_flush_settings( self->psys->part, PSYS_ALLOC, 1 );
 
3071
 
 
3072
        return res;
 
3073
}
 
3074
 
 
3075
static PyObject *Part_getGlobDrag( BPy_PartSys * self )
 
3076
{
 
3077
        return PyFloat_FromDouble( ((float)( self->psys->part->dragfac )) );
 
3078
}
 
3079
 
 
3080
static int Part_setGlobBrown( BPy_PartSys * self, PyObject * args )
 
3081
{
 
3082
        int res = EXPP_setFloatRange( args, &self->psys->part->brownfac,
 
3083
                        0.0, 200.0 );
 
3084
 
 
3085
        psys_flush_settings( self->psys->part, PSYS_ALLOC, 1 );
 
3086
 
 
3087
        return res;
 
3088
}
 
3089
 
 
3090
static PyObject *Part_getGlobBrown( BPy_PartSys * self )
 
3091
{
 
3092
        return PyFloat_FromDouble( ((float)( self->psys->part->brownfac )) );
 
3093
}
 
3094
 
 
3095
static int Part_setGlobDamp( BPy_PartSys * self, PyObject * args )
 
3096
{
 
3097
        int res = EXPP_setFloatRange( args, &self->psys->part->dampfac,
 
3098
                        0.0, 1.0 );
 
3099
 
 
3100
        psys_flush_settings( self->psys->part, PSYS_ALLOC, 1 );
 
3101
 
 
3102
        return res;
 
3103
}
 
3104
 
 
3105
static PyObject *Part_getGlobDamp( BPy_PartSys * self )
 
3106
{
 
3107
        return PyFloat_FromDouble( ((float)( self->psys->part->dampfac )) );
 
3108
}
 
3109
 
 
3110
static int Part_setChildAmount( BPy_PartSys * self, PyObject * args )
 
3111
{
 
3112
        int res = EXPP_setIValueRange( args, &self->psys->part->child_nbr,
 
3113
                        0, MAX_PART_CHILDREN, 'i' );
 
3114
 
 
3115
        psys_flush_settings( self->psys->part, PSYS_ALLOC, 1 );
 
3116
 
 
3117
        return res;
 
3118
}
 
3119
 
 
3120
static PyObject *Part_getChildAmount( BPy_PartSys * self )
 
3121
{
 
3122
        return PyInt_FromLong( ((int)( self->psys->part->child_nbr )) );
 
3123
}
 
3124
 
 
3125
static int Part_setChildType( BPy_PartSys * self, PyObject * args )
 
3126
{
 
3127
        int res = EXPP_setIValueRange( args, &self->psys->part->childtype,
 
3128
                        0, 2, 'h' );
 
3129
 
 
3130
        psys_flush_settings( self->psys->part, PSYS_ALLOC, 1 );
 
3131
 
 
3132
        return res;
 
3133
}
 
3134
 
 
3135
static PyObject *Part_getChildType( BPy_PartSys * self )
 
3136
{
 
3137
        return PyInt_FromLong( (short)( self->psys->part->childtype ) );
 
3138
}
 
3139
 
 
3140
static int Part_setChildRenderAmount( BPy_PartSys * self, PyObject * args )
 
3141
{
 
3142
        int res = EXPP_setIValueRange( args, &self->psys->part->ren_child_nbr,
 
3143
                        0, MAX_PART_CHILDREN, 'i' );
 
3144
 
 
3145
        psys_flush_settings( self->psys->part, PSYS_ALLOC, 1 );
 
3146
 
 
3147
        return res;
 
3148
}
 
3149
 
 
3150
static PyObject *Part_getChildRenderAmount( BPy_PartSys * self )
 
3151
{
 
3152
        return PyInt_FromLong( ((int)( self->psys->part->ren_child_nbr )) );
 
3153
}
 
3154
 
 
3155
static int Part_setChildRadius( BPy_PartSys * self, PyObject * args )
 
3156
{
 
3157
        int res = EXPP_setFloatRange( args, &self->psys->part->childrad,
 
3158
                        0.0, 10.0 );
 
3159
 
 
3160
        psys_flush_settings( self->psys->part, PSYS_ALLOC, 1 );
 
3161
 
 
3162
        return res;
 
3163
}
 
3164
 
 
3165
static PyObject *Part_getChildRadius( BPy_PartSys * self )
 
3166
{
 
3167
        return PyFloat_FromDouble( ((float)( self->psys->part->childrad )) );
 
3168
}
 
3169
 
 
3170
static int Part_setChildRoundness( BPy_PartSys * self, PyObject * args )
 
3171
{
 
3172
        int res = EXPP_setFloatRange( args, &self->psys->part->childflat,
 
3173
                        0.0, 1.0 );
 
3174
 
 
3175
        psys_flush_settings( self->psys->part, PSYS_ALLOC, 1 );
 
3176
 
 
3177
        return res;
 
3178
}
 
3179
 
 
3180
static PyObject *Part_getChildRoundness( BPy_PartSys * self )
 
3181
{
 
3182
        return PyFloat_FromDouble( ((float)( self->psys->part->childflat )) );
 
3183
}
 
3184
 
 
3185
static int Part_setChildClumping( BPy_PartSys * self, PyObject * args )
 
3186
{
 
3187
        int res = EXPP_setFloatRange( args, &self->psys->part->clumpfac,
 
3188
                        -1.0, 1.0 );
 
3189
 
 
3190
        psys_flush_settings( self->psys->part, PSYS_ALLOC, 1 );
 
3191
 
 
3192
        return res;
 
3193
}
 
3194
 
 
3195
static PyObject *Part_getChildClumping( BPy_PartSys * self )
 
3196
{
 
3197
        return PyFloat_FromDouble( ((float)( self->psys->part->clumpfac )) );
 
3198
}
 
3199
 
 
3200
static int Part_setChildShape( BPy_PartSys * self, PyObject * args )
 
3201
{
 
3202
        int res = EXPP_setFloatRange( args, &self->psys->part->clumppow,
 
3203
                        -0.999, 0.999 );
 
3204
 
 
3205
        psys_flush_settings( self->psys->part, PSYS_ALLOC, 1 );
 
3206
 
 
3207
        return res;
 
3208
}
 
3209
 
 
3210
static PyObject *Part_getChildShape( BPy_PartSys * self )
 
3211
{
 
3212
        return PyFloat_FromDouble( ((float)( self->psys->part->clumppow )) );
 
3213
}
 
3214
 
 
3215
static int Part_setChildSize( BPy_PartSys * self, PyObject * args )
 
3216
{
 
3217
        int res = EXPP_setFloatRange( args, &self->psys->part->childsize,
 
3218
                        0.01, 100.0 );
 
3219
 
 
3220
        psys_flush_settings( self->psys->part, PSYS_ALLOC, 1 );
 
3221
 
 
3222
        return res;
 
3223
}
 
3224
 
 
3225
static PyObject *Part_getChildSize( BPy_PartSys * self )
 
3226
{
 
3227
        return PyFloat_FromDouble( ((float)( self->psys->part->childsize )) );
 
3228
}
 
3229
 
 
3230
static int Part_setChildRandom( BPy_PartSys * self, PyObject * args )
 
3231
{
 
3232
        int res = EXPP_setFloatRange( args, &self->psys->part->childrandsize,
 
3233
                        0.0, 1.0 );
 
3234
 
 
3235
        psys_flush_settings( self->psys->part, PSYS_ALLOC, 1 );
 
3236
 
 
3237
        return res;
 
3238
}
 
3239
 
 
3240
static PyObject *Part_getChildRandom( BPy_PartSys * self )
 
3241
{
 
3242
        return PyFloat_FromDouble( ((float)( self->psys->part->childrandsize )) );
 
3243
}
 
3244
 
 
3245
static int Part_setChildRough1( BPy_PartSys * self, PyObject * args )
 
3246
{
 
3247
        int res = EXPP_setFloatRange( args, &self->psys->part->rough1,
 
3248
                        0.0, 10.0 );
 
3249
 
 
3250
        psys_flush_settings( self->psys->part, PSYS_ALLOC, 1 );
 
3251
 
 
3252
        return res;
 
3253
}
 
3254
 
 
3255
static PyObject *Part_getChildRough1( BPy_PartSys * self )
 
3256
{
 
3257
        return PyFloat_FromDouble( ((float)( self->psys->part->rough1 )) );
 
3258
}
 
3259
 
 
3260
static int Part_setChildRough1Size( BPy_PartSys * self, PyObject * args )
 
3261
{
 
3262
        int res = EXPP_setFloatRange( args, &self->psys->part->rough1_size,
 
3263
                        0.01, 10.0 );
 
3264
 
 
3265
        psys_flush_settings( self->psys->part, PSYS_ALLOC, 1 );
 
3266
 
 
3267
        return res;
 
3268
}
 
3269
 
 
3270
static PyObject *Part_getChildRough1Size( BPy_PartSys * self )
 
3271
{
 
3272
        return PyFloat_FromDouble( ((float)( self->psys->part->rough1_size )) );
 
3273
}
 
3274
 
 
3275
static int Part_setChildRough2( BPy_PartSys * self, PyObject * args )
 
3276
{
 
3277
        int res = EXPP_setFloatRange( args, &self->psys->part->rough2,
 
3278
                        0.0, 10.0 );
 
3279
 
 
3280
        psys_flush_settings( self->psys->part, PSYS_ALLOC, 1 );
 
3281
 
 
3282
        return res;
 
3283
}
 
3284
 
 
3285
static PyObject *Part_getChildRough2( BPy_PartSys * self )
 
3286
{
 
3287
        return PyFloat_FromDouble( ((float)( self->psys->part->rough2 )) );
 
3288
}
 
3289
 
 
3290
static int Part_setChildRough2Size( BPy_PartSys * self, PyObject * args )
 
3291
{
 
3292
        int res = EXPP_setFloatRange( args, &self->psys->part->rough2_size,
 
3293
                        0.01, 10.0 );
 
3294
 
 
3295
        psys_flush_settings( self->psys->part, PSYS_ALLOC, 1 );
 
3296
 
 
3297
        return res;
 
3298
}
 
3299
 
 
3300
static PyObject *Part_getChildRough2Size( BPy_PartSys * self )
 
3301
{
 
3302
        return PyFloat_FromDouble( ((float)( self->psys->part->rough2_size )) );
 
3303
}
 
3304
 
 
3305
static int Part_setChildRough2Thres( BPy_PartSys * self, PyObject * args )
 
3306
{
 
3307
        int res = EXPP_setFloatRange( args, &self->psys->part->rough2_thres,
 
3308
                        0.0, 10.0 );
 
3309
 
 
3310
        psys_flush_settings( self->psys->part, PSYS_ALLOC, 1 );
 
3311
 
 
3312
        return res;
 
3313
}
 
3314
 
 
3315
static PyObject *Part_getChildRough2Thres( BPy_PartSys * self )
 
3316
{
 
3317
        return PyFloat_FromDouble( ((float)( self->psys->part->rough2_thres )) );
 
3318
}
 
3319
 
 
3320
static int Part_setChildRoughE( BPy_PartSys * self, PyObject * args )
 
3321
{
 
3322
        int res = EXPP_setFloatRange( args, &self->psys->part->rough_end,
 
3323
                        0.0, 10.0 );
 
3324
 
 
3325
        psys_flush_settings( self->psys->part, PSYS_ALLOC, 1 );
 
3326
 
 
3327
        return res;
 
3328
}
 
3329
 
 
3330
static PyObject *Part_getChildRoughE( BPy_PartSys * self )
 
3331
{
 
3332
        return PyFloat_FromDouble( ((float)( self->psys->part->rough_end )) );
 
3333
}
 
3334
 
 
3335
static int Part_setChildRoughEShape( BPy_PartSys * self, PyObject * args )
 
3336
{
 
3337
        int res = EXPP_setFloatRange( args, &self->psys->part->rough_end_shape,
 
3338
                        0.0, 10.0 );
 
3339
 
 
3340
        psys_flush_settings( self->psys->part, PSYS_ALLOC, 1 );
 
3341
 
 
3342
        return res;
 
3343
}
 
3344
 
 
3345
static PyObject *Part_getChildRoughEShape( BPy_PartSys * self )
 
3346
{
 
3347
        return PyFloat_FromDouble( ((float)( self->psys->part->rough_end_shape )) );
 
3348
}
 
3349
 
 
3350
static int Part_setChildKink( BPy_PartSys * self, PyObject * args )
 
3351
{
 
3352
        int res = EXPP_setIValueRange( args, &self->psys->part->kink,
 
3353
                        0, 4, 'h' );
 
3354
 
 
3355
        psys_flush_settings( self->psys->part, PSYS_ALLOC, 1 );
 
3356
 
 
3357
        return res;
 
3358
}
 
3359
 
 
3360
static PyObject *Part_getChildKink( BPy_PartSys * self )
 
3361
{
 
3362
        return PyInt_FromLong( (short)( self->psys->part->kink ) );
 
3363
}
 
3364
 
 
3365
static int Part_setChildKinkAxis( BPy_PartSys * self, PyObject * args )
 
3366
{
 
3367
        int res = EXPP_setIValueRange( args, &self->psys->part->kink_axis,
 
3368
                        0, 2, 'h' );
 
3369
 
 
3370
        psys_flush_settings( self->psys->part, PSYS_ALLOC, 1 );
 
3371
 
 
3372
        return res;
 
3373
}
 
3374
 
 
3375
static PyObject *Part_getChildKinkAxis( BPy_PartSys * self )
 
3376
{
 
3377
        return PyInt_FromLong( (short)( self->psys->part->kink_axis ) );
 
3378
}
 
3379
 
 
3380
static int Part_setChildKinkFreq( BPy_PartSys * self, PyObject * args )
 
3381
{
 
3382
        int res = EXPP_setFloatRange( args, &self->psys->part->kink_freq,
 
3383
                        0.0, 10.0 );
 
3384
 
 
3385
        psys_flush_settings( self->psys->part, PSYS_ALLOC, 1 );
 
3386
 
 
3387
        return res;
 
3388
}
 
3389
 
 
3390
static PyObject *Part_getChildKinkFreq( BPy_PartSys * self )
 
3391
{
 
3392
        return PyFloat_FromDouble( ((float)( self->psys->part->kink_freq )) );
 
3393
}
 
3394
 
 
3395
static int Part_setChildKinkShape( BPy_PartSys * self, PyObject * args )
 
3396
{
 
3397
        int res = EXPP_setFloatRange( args, &self->psys->part->kink_shape,
 
3398
                        -0.999, 0.999 );
 
3399
 
 
3400
        psys_flush_settings( self->psys->part, PSYS_ALLOC, 1 );
 
3401
 
 
3402
        return res;
 
3403
}
 
3404
 
 
3405
static PyObject *Part_getChildKinkShape( BPy_PartSys * self )
 
3406
{
 
3407
        return PyFloat_FromDouble( ((float)( self->psys->part->kink_shape )) );
 
3408
}
 
3409
 
 
3410
static int Part_setChildKinkAmp( BPy_PartSys * self, PyObject * args )
 
3411
{
 
3412
        int res = EXPP_setFloatRange( args, &self->psys->part->kink_amp,
 
3413
                        0.0, 10.0 );
 
3414
 
 
3415
        psys_flush_settings( self->psys->part, PSYS_ALLOC, 1 );
 
3416
 
 
3417
        return res;
 
3418
}
 
3419
 
 
3420
static PyObject *Part_getChildKinkAmp( BPy_PartSys * self )
 
3421
{
 
3422
        return PyFloat_FromDouble( ((float)( self->psys->part->kink_amp )) );
 
3423
}
 
3424
 
 
3425
static int Part_setChildBranch( BPy_PartSys * self, PyObject * args )
 
3426
{
 
3427
        int number;
 
3428
 
 
3429
        if( !PyInt_Check( args ) )
 
3430
                return EXPP_ReturnIntError( PyExc_TypeError, "expected int argument" );
 
3431
 
 
3432
        number = PyInt_AS_LONG( args );
 
3433
 
 
3434
        if (number){
 
3435
                self->psys->part->flag |= PART_BRANCHING;
 
3436
        }else{
 
3437
                self->psys->part->flag &= ~PART_BRANCHING;
 
3438
        }
 
3439
 
 
3440
        psys_flush_settings( self->psys->part, PSYS_ALLOC, 1 );
 
3441
 
 
3442
        return 0;
 
3443
}
 
3444
 
 
3445
static PyObject *Part_getChildBranch( BPy_PartSys * self )
 
3446
{
 
3447
        return PyInt_FromLong( ((long)( self->psys->part->flag & PART_BRANCHING )) > 0 );
 
3448
}
 
3449
 
 
3450
static int Part_setChildBranchAnim( BPy_PartSys * self, PyObject * args )
 
3451
{
 
3452
        int number;
 
3453
 
 
3454
        if( !PyInt_Check( args ) )
 
3455
                return EXPP_ReturnIntError( PyExc_TypeError, "expected int argument" );
 
3456
 
 
3457
        number = PyInt_AS_LONG( args );
 
3458
 
 
3459
        if (number){
 
3460
                self->psys->part->flag |= PART_ANIM_BRANCHING;
 
3461
        }else{
 
3462
                self->psys->part->flag &= ~PART_ANIM_BRANCHING;
 
3463
        }
 
3464
 
 
3465
        psys_flush_settings( self->psys->part, PSYS_ALLOC, 1 );
 
3466
 
 
3467
        return 0;
 
3468
}
 
3469
 
 
3470
static PyObject *Part_getChildBranchAnim( BPy_PartSys * self )
 
3471
{
 
3472
        return PyInt_FromLong( ((long)( self->psys->part->flag & PART_ANIM_BRANCHING )) > 0 );
 
3473
}
 
3474
 
 
3475
static int Part_setChildBranchSymm( BPy_PartSys * self, PyObject * args )
 
3476
{
 
3477
        int number;
 
3478
 
 
3479
        if( !PyInt_Check( args ) )
 
3480
                return EXPP_ReturnIntError( PyExc_TypeError, "expected int argument" );
 
3481
 
 
3482
        number = PyInt_AS_LONG( args );
 
3483
 
 
3484
        if (number){
 
3485
                self->psys->part->flag |= PART_SYMM_BRANCHING;
 
3486
        }else{
 
3487
                self->psys->part->flag &= ~PART_SYMM_BRANCHING;
 
3488
        }
 
3489
 
 
3490
        psys_flush_settings( self->psys->part, PSYS_ALLOC, 1 );
 
3491
 
 
3492
        return 0;
 
3493
}
 
3494
 
 
3495
static PyObject *Part_getChildBranchSymm( BPy_PartSys * self )
 
3496
{
 
3497
        return PyInt_FromLong( ((long)( self->psys->part->flag & PART_SYMM_BRANCHING )) > 0 );
 
3498
}
 
3499
 
 
3500
static int Part_setChildBranchThre( BPy_PartSys * self, PyObject * args )
 
3501
{
 
3502
        int res = EXPP_setFloatRange( args, &self->psys->part->branch_thres,
 
3503
                        0.0, 1.0 );
 
3504
 
 
3505
        psys_flush_settings( self->psys->part, PSYS_ALLOC, 1 );
 
3506
 
 
3507
        return res;
 
3508
}
 
3509
 
 
3510
static PyObject *Part_getChildBranchThre( BPy_PartSys * self )
 
3511
{
 
3512
        return PyFloat_FromDouble( ((float)( self->psys->part->branch_thres )) );
 
3513
}