4 * ***** BEGIN GPL LICENSE BLOCK *****
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software Foundation,
18 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 * Contributor(s): Blender Foundation (2008).
22 * ***** END GPL LICENSE BLOCK *****
27 #include "RNA_define.h"
28 #include "RNA_access.h"
30 #include "rna_internal.h"
31 #include "DNA_constraint_types.h"
32 #include "DNA_object_types.h"
33 #include "DNA_actuator_types.h"
34 #include "DNA_scene_types.h" // for MAXFRAME
38 #include "BLI_utildefines.h"
40 /* Always keep in alphabetical order */
41 EnumPropertyItem actuator_type_items[] ={
42 {ACT_ACTION, "ACTION", 0, "Action", ""},
43 {ACT_ARMATURE, "ARMATURE", 0, "Armature", ""},
44 {ACT_CAMERA, "CAMERA", 0, "Camera", ""},
45 {ACT_CONSTRAINT, "CONSTRAINT", 0, "Constraint", ""},
46 {ACT_EDIT_OBJECT, "EDIT_OBJECT", 0, "Edit Object", ""},
47 {ACT_IPO, "FCURVE", 0, "F-Curve", ""},
48 {ACT_2DFILTER, "FILTER_2D", 0, "Filter 2D", ""},
49 {ACT_GAME, "GAME", 0, "Game", ""},
50 {ACT_MESSAGE, "MESSAGE", 0, "Message", ""},
51 {ACT_OBJECT, "OBJECT", 0, "Motion", ""},
52 {ACT_PARENT, "PARENT", 0, "Parent", ""},
53 {ACT_PROPERTY, "PROPERTY", 0, "Property", ""},
54 {ACT_RANDOM, "RANDOM", 0, "Random", ""},
55 {ACT_SCENE, "SCENE", 0, "Scene", ""},
56 {ACT_SHAPEACTION, "SHAPE_ACTION", 0, "Shape Action", ""},
57 {ACT_SOUND, "SOUND", 0, "Sound", ""},
58 {ACT_STATE, "STATE", 0, "State", ""},
59 {ACT_VISIBILITY, "VISIBILITY", 0, "Visibility", ""},
60 {0, NULL, 0, NULL, NULL}};
66 static StructRNA* rna_Actuator_refine(struct PointerRNA *ptr)
68 bActuator *actuator= (bActuator*)ptr->data;
70 switch(actuator->type) {
72 return &RNA_ActionActuator;
74 return &RNA_ObjectActuator;
76 return &RNA_FCurveActuator;
78 return &RNA_CameraActuator;
80 return &RNA_SoundActuator;
82 return &RNA_PropertyActuator;
84 return &RNA_ConstraintActuator;
86 return &RNA_EditObjectActuator;
88 return &RNA_SceneActuator;
90 return &RNA_RandomActuator;
92 return &RNA_MessageActuator;
94 return &RNA_GameActuator;
96 return &RNA_VisibilityActuator;
98 return &RNA_Filter2DActuator;
100 return &RNA_ParentActuator;
101 case ACT_SHAPEACTION:
102 return &RNA_ShapeActionActuator;
104 return &RNA_StateActuator;
106 return &RNA_ArmatureActuator;
108 return &RNA_Actuator;
112 static void rna_Actuator_type_set(struct PointerRNA *ptr, int value)
114 bActuator *act= (bActuator *)ptr->data;
115 if (value != act->type)
122 static void rna_ConstraintActuator_type_set(struct PointerRNA *ptr, int value)
124 bActuator *act= (bActuator *)ptr->data;
125 bConstraintActuator *ca= act->data;
126 if (value != ca->type)
130 case ACT_CONST_TYPE_ORI:
131 /* negative axis not supported in the orientation mode */
132 if (ELEM3(ca->mode, ACT_CONST_DIRNX,ACT_CONST_DIRNY, ACT_CONST_DIRNZ))
133 ca->mode = ACT_CONST_NONE;
136 case ACT_CONST_TYPE_LOC:
137 case ACT_CONST_TYPE_DIST:
138 case ACT_CONST_TYPE_FH:
145 static float rna_ConstraintActuator_limitmin_get(struct PointerRNA *ptr)
147 bActuator *act = (bActuator*)ptr->data;
148 bConstraintActuator *ca = act->data;
151 if(ca->flag & ACT_CONST_LOCX) fp= ca->minloc;
152 else if(ca->flag & ACT_CONST_LOCY) fp= ca->minloc+1;
153 else if(ca->flag & ACT_CONST_LOCZ) fp= ca->minloc+2;
154 else if(ca->flag & ACT_CONST_ROTX) fp= ca->minrot;
155 else if(ca->flag & ACT_CONST_ROTY) fp= ca->minrot+1;
156 else fp= ca->minrot+2;
161 static void rna_ConstraintActuator_limitmin_set(struct PointerRNA *ptr, float value)
163 bActuator *act = (bActuator*)ptr->data;
164 bConstraintActuator *ca = act->data;
167 if(ca->flag & ACT_CONST_LOCX) fp= ca->minloc;
168 else if(ca->flag & ACT_CONST_LOCY) fp= ca->minloc+1;
169 else if(ca->flag & ACT_CONST_LOCZ) fp= ca->minloc+2;
170 else if(ca->flag & ACT_CONST_ROTX) fp= ca->minrot;
171 else if(ca->flag & ACT_CONST_ROTY) fp= ca->minrot+1;
172 else fp= ca->minrot+2;
177 static float rna_ConstraintActuator_limitmax_get(struct PointerRNA *ptr)
179 bActuator *act = (bActuator*)ptr->data;
180 bConstraintActuator *ca = act->data;
183 if(ca->flag & ACT_CONST_LOCX) fp= ca->maxloc;
184 else if(ca->flag & ACT_CONST_LOCY) fp= ca->maxloc+1;
185 else if(ca->flag & ACT_CONST_LOCZ) fp= ca->maxloc+2;
186 else if(ca->flag & ACT_CONST_ROTX) fp= ca->maxrot;
187 else if(ca->flag & ACT_CONST_ROTY) fp= ca->maxrot+1;
188 else fp= ca->maxrot+2;
193 static void rna_ConstraintActuator_limitmax_set(struct PointerRNA *ptr, float value)
195 bActuator *act = (bActuator*)ptr->data;
196 bConstraintActuator *ca = act->data;
199 if(ca->flag & ACT_CONST_LOCX) fp= ca->maxloc;
200 else if(ca->flag & ACT_CONST_LOCY) fp= ca->maxloc+1;
201 else if(ca->flag & ACT_CONST_LOCZ) fp= ca->maxloc+2;
202 else if(ca->flag & ACT_CONST_ROTX) fp= ca->maxrot;
203 else if(ca->flag & ACT_CONST_ROTY) fp= ca->maxrot+1;
204 else fp= ca->maxrot+2;
209 static float rna_ConstraintActuator_distance_get(struct PointerRNA *ptr)
211 bActuator *act = (bActuator*)ptr->data;
212 bConstraintActuator *ca = act->data;
215 if(ca->mode & (ACT_CONST_DIRPX|ACT_CONST_DIRNX)) fp= ca->minloc;
216 else if(ca->mode & (ACT_CONST_DIRPY|ACT_CONST_DIRNY)) fp= ca->minloc+1;
217 else fp= ca->minloc+2;
222 static void rna_ConstraintActuator_distance_set(struct PointerRNA *ptr, float value)
224 bActuator *act = (bActuator*)ptr->data;
225 bConstraintActuator *ca = act->data;
228 if(ca->mode & (ACT_CONST_DIRPX|ACT_CONST_DIRNX)) fp= ca->minloc;
229 else if(ca->mode & (ACT_CONST_DIRPY|ACT_CONST_DIRNY)) fp= ca->minloc+1;
230 else fp= ca->minloc+2;
235 static float rna_ConstraintActuator_range_get(struct PointerRNA *ptr)
237 bActuator *act = (bActuator*)ptr->data;
238 bConstraintActuator *ca = act->data;
241 if(ca->mode & (ACT_CONST_DIRPX|ACT_CONST_DIRNX)) fp= ca->maxloc;
242 else if(ca->mode & (ACT_CONST_DIRPY|ACT_CONST_DIRNY)) fp= ca->maxloc+1;
243 else fp= ca->maxloc+2;
248 static void rna_ConstraintActuator_range_set(struct PointerRNA *ptr, float value)
250 bActuator *act = (bActuator*)ptr->data;
251 bConstraintActuator *ca = act->data;
254 if(ca->mode & (ACT_CONST_DIRPX|ACT_CONST_DIRNX)) fp= ca->maxloc;
255 else if(ca->mode & (ACT_CONST_DIRPY|ACT_CONST_DIRNY)) fp= ca->maxloc+1;
256 else fp= ca->maxloc+2;
261 static float rna_ConstraintActuator_fhheight_get(struct PointerRNA *ptr)
263 bActuator *act = (bActuator*)ptr->data;
264 bConstraintActuator *ca = act->data;
267 if(ca->mode & (ACT_CONST_DIRPX|ACT_CONST_DIRNX)) fp= ca->minloc;
268 else if(ca->mode & (ACT_CONST_DIRPY|ACT_CONST_DIRNY)) fp= ca->minloc+1;
269 else fp= ca->minloc+2;
274 static void rna_ConstraintActuator_fhheight_set(struct PointerRNA *ptr, float value)
276 bActuator *act = (bActuator*)ptr->data;
277 bConstraintActuator *ca = act->data;
280 if(ca->mode & (ACT_CONST_DIRPX|ACT_CONST_DIRNX)) fp= ca->minloc;
281 else if(ca->mode & (ACT_CONST_DIRPY|ACT_CONST_DIRNY)) fp= ca->minloc+1;
282 else fp= ca->minloc+2;
287 static float rna_ConstraintActuator_spring_get(struct PointerRNA *ptr)
289 bActuator *act = (bActuator*)ptr->data;
290 bConstraintActuator *ca = act->data;
293 if(ca->mode & (ACT_CONST_DIRPX|ACT_CONST_DIRNX)) fp= ca->maxloc;
294 else if(ca->mode & (ACT_CONST_DIRPY|ACT_CONST_DIRNY)) fp= ca->maxloc+1;
295 else fp= ca->maxloc+2;
300 static void rna_ConstraintActuator_spring_set(struct PointerRNA *ptr, float value)
302 bActuator *act = (bActuator*)ptr->data;
303 bConstraintActuator *ca = act->data;
306 if(ca->mode & (ACT_CONST_DIRPX|ACT_CONST_DIRNX)) fp= ca->maxloc;
307 else if(ca->mode & (ACT_CONST_DIRPY|ACT_CONST_DIRNY)) fp= ca->maxloc+1;
308 else fp= ca->maxloc+2;
312 /* ConstraintActuator uses the same property for Material and Property.
313 Therefore we need to clear the property when "use_material_detect" mode changes */
314 static void rna_Actuator_constraint_detect_material_set(struct PointerRNA *ptr, int value)
316 bActuator *act = (bActuator*)ptr->data;
317 bConstraintActuator *ca = act->data;
319 short old_value = (ca->flag & ACT_CONST_MATERIAL? 1:0);
321 if (old_value != value) {
322 ca->flag ^= ACT_CONST_MATERIAL;
323 ca->matprop[0] = '\0';
327 static void rna_FcurveActuator_add_set(struct PointerRNA *ptr, int value)
329 bActuator *act = (bActuator *)ptr->data;
330 bIpoActuator *ia = act->data;
333 ia->flag &= ~ACT_IPOFORCE;
334 ia->flag |= ACT_IPOADD;
336 ia->flag &= ~ACT_IPOADD;
339 static void rna_FcurveActuator_force_set(struct PointerRNA *ptr, int value)
341 bActuator *act = (bActuator *)ptr->data;
342 bIpoActuator *ia = act->data;
345 ia->flag &= ~ACT_IPOADD;
346 ia->flag |= ACT_IPOFORCE;
348 ia->flag &= ~ACT_IPOFORCE;
352 static void rna_ObjectActuator_type_set(struct PointerRNA *ptr, int value)
354 bActuator *act= (bActuator *)ptr->data;
355 bObjectActuator *oa = act->data;
356 if (value != oa->type)
360 case ACT_OBJECT_NORMAL:
361 memset(oa, 0, sizeof(bObjectActuator));
362 oa->flag = ACT_FORCE_LOCAL|ACT_TORQUE_LOCAL|ACT_DLOC_LOCAL|ACT_DROT_LOCAL;
363 oa->type = ACT_OBJECT_NORMAL;
366 case ACT_OBJECT_SERVO:
367 memset(oa, 0, sizeof(bObjectActuator));
368 oa->flag = ACT_LIN_VEL_LOCAL;
369 oa->type = ACT_OBJECT_SERVO;
370 oa->forcerot[0] = 30.0f;
371 oa->forcerot[1] = 0.5f;
372 oa->forcerot[2] = 0.0f;
378 static void rna_ObjectActuator_integralcoefficient_set(struct PointerRNA *ptr, float value)
380 bActuator *act = (bActuator*)ptr->data;
381 bObjectActuator *oa = act->data;
383 oa->forcerot[1] = value;
384 oa->forcerot[0] = 60.0f*oa->forcerot[1];
387 static void rna_StateActuator_state_set(PointerRNA *ptr, const int *values)
389 bActuator *act = (bActuator*)ptr->data;
390 bStateActuator *sa = act->data;
394 /* ensure we always have some state selected */
395 for(i=0; i<OB_MAX_STATES; i++)
402 for(i=0; i<OB_MAX_STATES; i++) {
403 if(values[i]) sa->mask |= (1<<i);
404 else sa->mask &= ~(1<<i);
408 /* Always keep in alphabetical order */
409 EnumPropertyItem *rna_Actuator_type_itemf(bContext *C, PointerRNA *ptr, int *free)
411 EnumPropertyItem *item= NULL;
415 if (ptr->type==&RNA_Actuator || RNA_struct_is_a(ptr->type, &RNA_Actuator)){
416 ob = (Object *)ptr->id.data;
418 /* can't use ob from ptr->id.data because that enum is also used by operators */
419 ob = CTX_data_active_object(C);
423 if (ob->type==OB_ARMATURE) {
424 RNA_enum_items_add_value(&item, &totitem, actuator_type_items, ACT_ACTION);
425 RNA_enum_items_add_value(&item, &totitem, actuator_type_items, ACT_ARMATURE);
429 RNA_enum_items_add_value(&item, &totitem, actuator_type_items, ACT_CAMERA);
430 RNA_enum_items_add_value(&item, &totitem, actuator_type_items, ACT_CONSTRAINT);
431 RNA_enum_items_add_value(&item, &totitem, actuator_type_items, ACT_EDIT_OBJECT);
432 RNA_enum_items_add_value(&item, &totitem, actuator_type_items, ACT_IPO);
433 RNA_enum_items_add_value(&item, &totitem, actuator_type_items, ACT_2DFILTER);
434 RNA_enum_items_add_value(&item, &totitem, actuator_type_items, ACT_GAME);
435 RNA_enum_items_add_value(&item, &totitem, actuator_type_items, ACT_MESSAGE);
436 RNA_enum_items_add_value(&item, &totitem, actuator_type_items, ACT_OBJECT);
437 RNA_enum_items_add_value(&item, &totitem, actuator_type_items, ACT_PARENT);
438 RNA_enum_items_add_value(&item, &totitem, actuator_type_items, ACT_PROPERTY);
439 RNA_enum_items_add_value(&item, &totitem, actuator_type_items, ACT_RANDOM);
440 RNA_enum_items_add_value(&item, &totitem, actuator_type_items, ACT_SCENE);
443 if (ob->type==OB_MESH){
444 RNA_enum_items_add_value(&item, &totitem, actuator_type_items, ACT_SHAPEACTION);
448 RNA_enum_items_add_value(&item, &totitem, actuator_type_items, ACT_SOUND);
449 RNA_enum_items_add_value(&item, &totitem, actuator_type_items, ACT_STATE);
450 RNA_enum_items_add_value(&item, &totitem, actuator_type_items, ACT_VISIBILITY);
452 RNA_enum_item_end(&item, &totitem);
458 static void rna_Actuator_Armature_update(Main *bmain, Scene *scene, PointerRNA *ptr)
460 bActuator *act= (bActuator *)ptr->data;
461 bArmatureActuator *aa = act->data;
462 Object *ob = (Object *)ptr->id.data;
464 char *posechannel= aa->posechannel;
465 char *constraint= aa->constraint;
467 /* check that bone exist in the active object */
468 if (ob->type == OB_ARMATURE && ob->pose) {
470 bPose *pose = ob->pose;
471 for (pchan=pose->chanbase.first; pchan; pchan=pchan->next) {
472 if (!strcmp(pchan->name, posechannel)) {
473 /* found it, now look for constraint channel */
475 for (con=pchan->constraints.first; con; con=con->next) {
476 if (!strcmp(con->name, constraint)) {
477 /* found it, all ok */
481 /* didn't find constraint, make empty */
487 /* didn't find any */
492 /* note: the following set functions exists only to avoid id refcounting */
493 static void rna_Actuator_editobject_mesh_set(PointerRNA *ptr, PointerRNA value)
495 bActuator *act = (bActuator *)ptr->data;
496 bEditObjectActuator *eoa = (bEditObjectActuator *) act->data;
498 eoa->me = value.data;
501 static void rna_Actuator_action_action_set(PointerRNA *ptr, PointerRNA value)
503 bActuator *act = (bActuator *)ptr->data;
504 bActionActuator *aa = (bActionActuator *) act->data;
506 aa->act = value.data;
511 void rna_def_actuator(BlenderRNA *brna)
516 srna= RNA_def_struct(brna, "Actuator", NULL);
517 RNA_def_struct_ui_text(srna, "Actuator", "Actuator to apply actions in the game engine");
518 RNA_def_struct_sdna(srna, "bActuator");
519 RNA_def_struct_refine_func(srna, "rna_Actuator_refine");
521 prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
522 RNA_def_property_ui_text(prop, "Name", "");
523 RNA_def_struct_name_property(srna, prop);
525 prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
526 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
527 RNA_def_property_enum_items(prop, actuator_type_items);
528 RNA_def_property_enum_funcs(prop, NULL, "rna_Actuator_type_set", "rna_Actuator_type_itemf");
529 RNA_def_property_ui_text(prop, "Type", "");
531 prop= RNA_def_property(srna, "pin", PROP_BOOLEAN, PROP_NONE);
532 RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_PIN);
533 RNA_def_property_ui_text(prop, "Pinned", "Display when not linked to a visible states controller");
534 RNA_def_property_ui_icon(prop, ICON_UNPINNED, 1);
535 RNA_def_property_update(prop, NC_LOGIC, NULL);
537 prop= RNA_def_property(srna, "show_expanded", PROP_BOOLEAN, PROP_NONE);
538 RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_SHOW);
539 RNA_def_property_ui_text(prop, "Expanded", "Set actuator expanded in the user interface");
540 RNA_def_property_ui_icon(prop, ICON_TRIA_RIGHT, 1);
542 RNA_api_actuator(srna);
545 static void rna_def_action_actuator(BlenderRNA *brna)
550 static EnumPropertyItem prop_type_items[] ={
551 {ACT_ACTION_PLAY, "PLAY", 0, "Play", ""},
552 {ACT_ACTION_FLIPPER, "FLIPPER", 0, "Flipper", ""},
553 {ACT_ACTION_LOOP_STOP, "LOOPSTOP", 0, "Loop Stop", ""},
554 {ACT_ACTION_LOOP_END, "LOOPEND", 0, "Loop End", ""},
555 {ACT_ACTION_FROM_PROP, "PROPERTY", 0, "Property", ""},
556 #ifdef __NLA_ACTION_BY_MOTION_ACTUATOR
557 {ACT_ACTION_MOTION, "MOTION", 0, "Displacement", ""},
559 {0, NULL, 0, NULL, NULL}};
561 srna= RNA_def_struct(brna, "ActionActuator", "Actuator");
562 RNA_def_struct_ui_text(srna, "Action Actuator", "Actuator to control the object movement");
563 RNA_def_struct_sdna_from(srna, "bActionActuator", "data");
565 prop= RNA_def_property(srna, "play_mode", PROP_ENUM, PROP_NONE);
566 RNA_def_property_enum_sdna(prop, NULL, "type");
567 RNA_def_property_enum_items(prop, prop_type_items);
568 RNA_def_property_ui_text(prop, "Action type", "Action playback type");
569 RNA_def_property_update(prop, NC_LOGIC, NULL);
571 prop= RNA_def_property(srna, "action", PROP_POINTER, PROP_NONE);
572 RNA_def_property_pointer_sdna(prop, NULL, "act");
573 RNA_def_property_struct_type(prop, "Action");
574 RNA_def_property_flag(prop, PROP_EDITABLE);
575 RNA_def_property_ui_text(prop, "Action", "");
576 /* note: custom set function is ONLY to avoid rna setting a user for this. */
577 RNA_def_property_pointer_funcs(prop, NULL, "rna_Actuator_action_action_set", NULL, NULL);
578 RNA_def_property_update(prop, NC_LOGIC, NULL);
580 prop= RNA_def_property(srna, "use_continue_last_frame", PROP_BOOLEAN, PROP_NONE);
581 RNA_def_property_boolean_sdna(prop, NULL, "end_reset", 1);
582 RNA_def_property_ui_text(prop, "Continue", "Restore last frame when switching on/off, otherwise play from the start each time");
583 RNA_def_property_update(prop, NC_LOGIC, NULL);
585 prop= RNA_def_property(srna, "property", PROP_STRING, PROP_NONE);
586 RNA_def_property_string_sdna(prop, NULL, "name");
587 RNA_def_property_ui_text(prop, "Property", "Use this property to define the Action position");
588 RNA_def_property_update(prop, NC_LOGIC, NULL);
590 prop= RNA_def_property(srna, "frame_start", PROP_INT, PROP_NONE);
591 RNA_def_property_int_sdna(prop, NULL, "sta");
592 RNA_def_property_range(prop, 0, MAXFRAME);
593 RNA_def_property_ui_text(prop, "Start frame", "");
594 RNA_def_property_update(prop, NC_LOGIC, NULL);
596 prop= RNA_def_property(srna, "frame_end", PROP_INT, PROP_NONE);
597 RNA_def_property_int_sdna(prop, NULL, "end");
598 RNA_def_property_range(prop, 0, MAXFRAME);
599 RNA_def_property_ui_text(prop, "End frame", "");
600 RNA_def_property_update(prop, NC_LOGIC, NULL);
602 prop= RNA_def_property(srna, "frame_blend_in", PROP_INT, PROP_NONE);
603 RNA_def_property_int_sdna(prop, NULL, "blendin");
604 RNA_def_property_range(prop, 0, 32767);
605 RNA_def_property_ui_text(prop, "Blendin", "Number of frames of motion blending");
606 RNA_def_property_update(prop, NC_LOGIC, NULL);
608 prop= RNA_def_property(srna, "priority", PROP_INT, PROP_NONE);
609 RNA_def_property_range(prop, 0, 100);
610 RNA_def_property_ui_text(prop, "Priority", "Execution priority - lower numbers will override actions with higher numbers. With 2 or more actions at once, the overriding channels must be lower in the stack");
611 RNA_def_property_update(prop, NC_LOGIC, NULL);
613 prop= RNA_def_property(srna, "frame_property", PROP_STRING, PROP_NONE);
614 RNA_def_property_string_sdna(prop, NULL, "frameProp");
615 RNA_def_property_ui_text(prop, "Frame Property", "Assign the action's current frame number to this property");
616 RNA_def_property_update(prop, NC_LOGIC, NULL);
618 #ifdef __NLA_ACTION_BY_MOTION_ACTUATOR
619 prop= RNA_def_property(srna, "stride_length", PROP_FLOAT, PROP_NONE);
620 RNA_def_property_float_sdna(prop, NULL, "stridelength");
621 RNA_def_property_range(prop, 0.0, 2500.0);
622 RNA_def_property_ui_text(prop, "Cycle", "Distance covered by a single cycle of the action");
623 RNA_def_property_update(prop, NC_LOGIC, NULL);
627 static void rna_def_object_actuator(BlenderRNA *brna)
632 static EnumPropertyItem prop_type_items[] ={
633 {ACT_OBJECT_NORMAL, "OBJECT_NORMAL", 0, "Simple Motion", ""},
634 {ACT_OBJECT_SERVO, "OBJECT_SERVO", 0, "Servo Control", ""},
635 {0, NULL, 0, NULL, NULL}};
637 srna= RNA_def_struct(brna, "ObjectActuator", "Actuator");
638 RNA_def_struct_ui_text(srna, "Motion Actuator", "Actuator to control the object movement");
639 RNA_def_struct_sdna_from(srna, "bObjectActuator", "data");
642 prop= RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
643 RNA_def_property_enum_sdna(prop, NULL, "type");
644 RNA_def_property_enum_items(prop, prop_type_items);
645 RNA_def_property_enum_funcs(prop, NULL, "rna_ObjectActuator_type_set", NULL);
646 RNA_def_property_ui_text(prop, "Motion Type", "Specify the motion system");
647 RNA_def_property_update(prop, NC_LOGIC, NULL);
649 prop= RNA_def_property(srna, "reference_object", PROP_POINTER, PROP_NONE);
650 RNA_def_property_struct_type(prop, "Object");
651 RNA_def_property_pointer_sdna(prop, NULL, "reference");
652 RNA_def_property_flag(prop, PROP_EDITABLE);
653 RNA_def_property_ui_text(prop, "Reference Object", "Reference object for velocity calculation, leave empty for world reference");
654 RNA_def_property_update(prop, NC_LOGIC, NULL);
656 prop= RNA_def_property(srna, "damping", PROP_INT, PROP_NONE);
657 RNA_def_property_ui_range(prop, 0, 1000, 1, 1);
658 RNA_def_property_ui_text(prop, "Damping Frames", "Number of frames to reach the target velocity");
659 RNA_def_property_update(prop, NC_LOGIC, NULL);
661 prop= RNA_def_property(srna, "proportional_coefficient", PROP_FLOAT, PROP_NONE);
662 RNA_def_property_float_sdna(prop, NULL, "forcerot[0]");
663 RNA_def_property_ui_range(prop, 0.0, 200.0, 10, 2);
664 RNA_def_property_ui_text(prop, "Proportional Coefficient", "Typical value is 60x integral coefficient");
665 RNA_def_property_update(prop, NC_LOGIC, NULL);
667 prop= RNA_def_property(srna, "integral_coefficient", PROP_FLOAT, PROP_NONE);
668 RNA_def_property_float_sdna(prop, NULL, "forcerot[1]");
669 RNA_def_property_ui_range(prop, 0.0, 3.0, 10, 2);
670 RNA_def_property_float_funcs(prop, NULL, "rna_ObjectActuator_integralcoefficient_set", NULL);
671 RNA_def_property_ui_text(prop, "Integral Coefficient", "Low value (0.01) for slow response, high value (0.5) for fast response");
672 RNA_def_property_update(prop, NC_LOGIC, NULL);
674 prop= RNA_def_property(srna, "derivate_coefficient", PROP_FLOAT, PROP_NONE);
675 RNA_def_property_float_sdna(prop, NULL, "forcerot[2]");
676 RNA_def_property_ui_range(prop, -100.0, 100.0, 10, 2);
677 RNA_def_property_ui_text(prop, "Derivate Coefficient", "Not required, high values can cause instability");
678 RNA_def_property_update(prop, NC_LOGIC, NULL);
681 prop= RNA_def_property(srna, "force_max_x", PROP_FLOAT, PROP_NONE);
682 RNA_def_property_float_sdna(prop, NULL, "dloc[0]");
683 RNA_def_property_ui_range(prop, -100.0, 100.0, 1, 2);
684 RNA_def_property_ui_text(prop, "Max", "Set the upper limit for force");
685 RNA_def_property_update(prop, NC_LOGIC, NULL);
687 prop= RNA_def_property(srna, "force_min_x", PROP_FLOAT, PROP_NONE);
688 RNA_def_property_float_sdna(prop, NULL, "drot[0]");
689 RNA_def_property_ui_range(prop, -100.0, 100.0, 1, 2);
690 RNA_def_property_ui_text(prop, "Min", "Set the lower limit for force");
691 RNA_def_property_update(prop, NC_LOGIC, NULL);
693 prop= RNA_def_property(srna, "force_max_y", PROP_FLOAT, PROP_NONE);
694 RNA_def_property_float_sdna(prop, NULL, "dloc[1]");
695 RNA_def_property_ui_range(prop, -100.0, 100.0, 1, 2);
696 RNA_def_property_ui_text(prop, "Max", "Set the upper limit for force");
697 RNA_def_property_update(prop, NC_LOGIC, NULL);
699 prop= RNA_def_property(srna, "force_min_y", PROP_FLOAT, PROP_NONE);
700 RNA_def_property_float_sdna(prop, NULL, "drot[1]");
701 RNA_def_property_ui_range(prop, -100.0, 100.0, 1, 2);
702 RNA_def_property_ui_text(prop, "Min", "Set the lower limit for force");
703 RNA_def_property_update(prop, NC_LOGIC, NULL);
705 prop= RNA_def_property(srna, "force_max_z", PROP_FLOAT, PROP_NONE);
706 RNA_def_property_float_sdna(prop, NULL, "dloc[2]");
707 RNA_def_property_ui_range(prop, -100.0, 100.0, 1, 2);
708 RNA_def_property_ui_text(prop, "Max", "Set the upper limit for force");
709 RNA_def_property_update(prop, NC_LOGIC, NULL);
711 prop= RNA_def_property(srna, "force_min_z", PROP_FLOAT, PROP_NONE);
712 RNA_def_property_float_sdna(prop, NULL, "drot[2]");
713 RNA_def_property_ui_range(prop, -100.0, 100.0, 1, 2);
714 RNA_def_property_ui_text(prop, "Min", "Set the lower limit for force");
715 RNA_def_property_update(prop, NC_LOGIC, NULL);
718 prop= RNA_def_property(srna, "offset_location", PROP_FLOAT, PROP_XYZ);
719 RNA_def_property_float_sdna(prop, NULL, "dloc");
720 RNA_def_property_array(prop, 3);
721 RNA_def_property_ui_range(prop, -10000.0, 10000.0, 10, 2);
722 RNA_def_property_ui_text(prop, "Loc", "Sets the location");
723 RNA_def_property_update(prop, NC_LOGIC, NULL);
725 prop= RNA_def_property(srna, "offset_rotation", PROP_FLOAT, PROP_EULER);
726 RNA_def_property_float_sdna(prop, NULL, "drot");
727 RNA_def_property_array(prop, 3);
728 RNA_def_property_ui_range(prop, -10000.0, 10000.0, 10, 2);
729 RNA_def_property_ui_text(prop, "Rot", "Sets the rotation");
730 RNA_def_property_update(prop, NC_LOGIC, NULL);
732 prop= RNA_def_property(srna, "force", PROP_FLOAT, PROP_XYZ);
733 RNA_def_property_float_sdna(prop, NULL, "forceloc");
734 RNA_def_property_array(prop, 3);
735 RNA_def_property_ui_range(prop, -10000.0, 10000.0, 10, 2);
736 RNA_def_property_ui_text(prop, "Force", "Sets the force");
737 RNA_def_property_update(prop, NC_LOGIC, NULL);
739 prop= RNA_def_property(srna, "torque", PROP_FLOAT, PROP_XYZ);
740 RNA_def_property_float_sdna(prop, NULL, "forcerot");
741 RNA_def_property_array(prop, 3);
742 RNA_def_property_ui_range(prop, -10000.0, 10000.0, 10, 2);
743 RNA_def_property_ui_text(prop, "Torque", "Sets the torque");
744 RNA_def_property_update(prop, NC_LOGIC, NULL);
746 prop= RNA_def_property(srna, "linear_velocity", PROP_FLOAT, PROP_XYZ);
747 RNA_def_property_float_sdna(prop, NULL, "linearvelocity");
748 RNA_def_property_array(prop, 3);
749 RNA_def_property_ui_range(prop, -10000.0, 10000.0, 10, 2);
750 RNA_def_property_ui_text(prop, "Linear Velocity", "Sets the linear velocity (in Servo mode it sets the target relative linear velocity, it will be achieved by automatic application of force. Null velocity is a valid target)");
751 RNA_def_property_update(prop, NC_LOGIC, NULL);
753 prop= RNA_def_property(srna, "angular_velocity", PROP_FLOAT, PROP_XYZ);
754 RNA_def_property_float_sdna(prop, NULL, "angularvelocity");
755 RNA_def_property_array(prop, 3);
756 RNA_def_property_ui_range(prop, -10000.0, 10000.0, 10, 2);
757 RNA_def_property_ui_text(prop, "Angular Velocity", "Sets the angular velocity");
758 RNA_def_property_update(prop, NC_LOGIC, NULL);
761 prop= RNA_def_property(srna, "use_local_location", PROP_BOOLEAN, PROP_NONE);
762 RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_DLOC_LOCAL);
763 RNA_def_property_ui_text(prop, "L", "Location is defined in local coordinates");
764 RNA_def_property_update(prop, NC_LOGIC, NULL);
766 prop= RNA_def_property(srna, "use_local_rotation", PROP_BOOLEAN, PROP_NONE);
767 RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_DROT_LOCAL);
768 RNA_def_property_ui_text(prop, "L", "Rotation is defined in local coordinates");
769 RNA_def_property_update(prop, NC_LOGIC, NULL);
771 prop= RNA_def_property(srna, "use_local_force", PROP_BOOLEAN, PROP_NONE);
772 RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_FORCE_LOCAL);
773 RNA_def_property_ui_text(prop, "L", "Force is defined in local coordinates");
774 RNA_def_property_update(prop, NC_LOGIC, NULL);
776 prop= RNA_def_property(srna, "use_local_torque", PROP_BOOLEAN, PROP_NONE);
777 RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_TORQUE_LOCAL);
778 RNA_def_property_ui_text(prop, "L", "Torque is defined in local coordinates");
779 RNA_def_property_update(prop, NC_LOGIC, NULL);
781 prop= RNA_def_property(srna, "use_local_linear_velocity", PROP_BOOLEAN, PROP_NONE);
782 RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_LIN_VEL_LOCAL);
783 RNA_def_property_ui_text(prop, "L", "Velocity is defined in local coordinates");
784 RNA_def_property_update(prop, NC_LOGIC, NULL);
786 prop= RNA_def_property(srna, "use_local_angular_velocity", PROP_BOOLEAN, PROP_NONE);
787 RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_ANG_VEL_LOCAL);
788 RNA_def_property_ui_text(prop, "L", "Angular velocity is defined in local coordinates");
789 RNA_def_property_update(prop, NC_LOGIC, NULL);
791 prop= RNA_def_property(srna, "use_add_linear_velocity", PROP_BOOLEAN, PROP_NONE);
792 RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_ADD_LIN_VEL);
793 RNA_def_property_ui_text(prop, "Add", "Toggles between ADD and SET linV");
794 RNA_def_property_update(prop, NC_LOGIC, NULL);
796 prop= RNA_def_property(srna, "use_servo_limit_x", PROP_BOOLEAN, PROP_NONE);
797 RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_SERVO_LIMIT_X);
798 RNA_def_property_ui_text(prop, "X", "Set limit to force along the X axis");
799 RNA_def_property_update(prop, NC_LOGIC, NULL);
801 prop= RNA_def_property(srna, "use_servo_limit_y", PROP_BOOLEAN, PROP_NONE);
802 RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_SERVO_LIMIT_Y);
803 RNA_def_property_ui_text(prop, "Y", "Set limit to force along the Y axis");
804 RNA_def_property_update(prop, NC_LOGIC, NULL);
806 prop= RNA_def_property(srna, "use_servo_limit_z", PROP_BOOLEAN, PROP_NONE);
807 RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_SERVO_LIMIT_Z);
808 RNA_def_property_ui_text(prop, "Z", "Set limit to force along the Z axis");
809 RNA_def_property_update(prop, NC_LOGIC, NULL);
812 static void rna_def_fcurve_actuator(BlenderRNA *brna)
817 static EnumPropertyItem prop_type_items[] ={
818 {ACT_IPO_PLAY, "PLAY", 0, "Play", ""},
819 {ACT_IPO_PINGPONG, "PINGPONG", 0, "Ping Pong", ""},
820 {ACT_IPO_FLIPPER, "FLIPPER", 0, "Flipper", ""},
821 {ACT_IPO_LOOP_STOP, "STOP", 0, "Loop Stop", ""},
822 {ACT_IPO_LOOP_END, "END", 0, "Loop End", ""},
823 // {ACT_IPO_KEY2KEY, "IPOCHILD", 0, "Key to Key", ""},
824 {ACT_IPO_FROM_PROP, "PROP", 0, "Property", ""},
825 {0, NULL, 0, NULL, NULL}};
827 srna= RNA_def_struct(brna, "FCurveActuator", "Actuator");
828 RNA_def_struct_ui_text(srna, "F-Curve Actuator", "Actuator to animate the object");
829 RNA_def_struct_sdna_from(srna, "bIpoActuator", "data");
831 prop= RNA_def_property(srna, "play_type", PROP_ENUM, PROP_NONE);
832 RNA_def_property_enum_sdna(prop, NULL, "type");
833 RNA_def_property_enum_items(prop, prop_type_items);
834 RNA_def_property_ui_text(prop, "F-Curve Type", "Specify the way you want to play the animation");
835 RNA_def_property_update(prop, NC_LOGIC, NULL);
837 prop= RNA_def_property(srna, "frame_start", PROP_INT, PROP_NONE);
838 RNA_def_property_int_sdna(prop, NULL, "sta");
839 RNA_def_property_ui_range(prop, 1, MAXFRAME, 1, 1);
840 RNA_def_property_ui_text(prop, "Start Frame", "");
841 RNA_def_property_update(prop, NC_SCENE, NULL);
843 prop= RNA_def_property(srna, "frame_end", PROP_INT, PROP_NONE);
844 RNA_def_property_int_sdna(prop, NULL, "end");
845 RNA_def_property_ui_range(prop, 1, MAXFRAME, 1, 1);
846 RNA_def_property_ui_text(prop, "End Frame", "");
847 RNA_def_property_update(prop, NC_LOGIC, NULL);
849 prop= RNA_def_property(srna, "property", PROP_STRING, PROP_NONE);
850 RNA_def_property_string_sdna(prop, NULL, "name");
851 RNA_def_property_ui_text(prop, "Property", "Use this property to define the F-Curve position");
852 RNA_def_property_update(prop, NC_LOGIC, NULL);
854 prop= RNA_def_property(srna, "frame_property", PROP_STRING, PROP_NONE);
855 RNA_def_property_string_sdna(prop, NULL, "frameProp");
856 RNA_def_property_ui_text(prop, "Frame Property", "Assign the action's current frame number to this property");
859 prop= RNA_def_property(srna, "use_additive", PROP_BOOLEAN, PROP_NONE);
860 RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_IPOADD);
861 RNA_def_property_boolean_funcs(prop, NULL, "rna_FcurveActuator_add_set");
862 RNA_def_property_ui_text(prop, "Add", "F-Curve is added to the current loc/rot/scale in global or local coordinate according to Local flag");
863 RNA_def_property_update(prop, NC_LOGIC, NULL);
865 prop= RNA_def_property(srna, "use_force", PROP_BOOLEAN, PROP_NONE);
866 RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_IPOFORCE);
867 RNA_def_property_boolean_funcs(prop, NULL, "rna_FcurveActuator_force_set");
868 RNA_def_property_ui_text(prop, "Force", "Apply F-Curve as a global or local force depending on the local option (dynamic objects only)");
869 RNA_def_property_update(prop, NC_LOGIC, NULL);
871 prop= RNA_def_property(srna, "use_local", PROP_BOOLEAN, PROP_NONE);
872 RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_IPOLOCAL);
873 RNA_def_property_ui_text(prop, "L", "Let the F-Curve act in local coordinates, used in Force and Add mode");
874 RNA_def_property_update(prop, NC_LOGIC, NULL);
876 prop= RNA_def_property(srna, "apply_to_children", PROP_BOOLEAN, PROP_NONE);
877 RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_IPOCHILD);
878 RNA_def_property_ui_text(prop, "Child", "Update F-Curve on all children Objects as well");
879 RNA_def_property_update(prop, NC_LOGIC, NULL);
882 static void rna_def_camera_actuator(BlenderRNA *brna)
887 static EnumPropertyItem prop_axis_items[] ={
888 {ACT_CAMERA_X, "X", 0, "X", "Camera tries to get behind the X axis"},
889 {ACT_CAMERA_Y, "Y", 0, "Y", "Camera tries to get behind the Y axis"},
890 {0, NULL, 0, NULL, NULL}};
892 srna= RNA_def_struct(brna, "CameraActuator", "Actuator");
893 RNA_def_struct_ui_text(srna, "Camera Actuator", "Actuator to ..");
894 RNA_def_struct_sdna_from(srna, "bCameraActuator", "data");
896 prop= RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
897 RNA_def_property_struct_type(prop, "Object");
898 RNA_def_property_pointer_sdna(prop, NULL, "ob");
899 RNA_def_property_flag(prop, PROP_EDITABLE);
900 RNA_def_property_ui_text(prop, "Camera Object", "Look at this Object");
901 RNA_def_property_update(prop, NC_LOGIC, NULL);
904 prop= RNA_def_property(srna, "height", PROP_FLOAT, PROP_NONE);
905 RNA_def_property_ui_range(prop, 0.0, 20.0, 1, 2);
906 RNA_def_property_ui_text(prop, "Height", "");
907 RNA_def_property_update(prop, NC_LOGIC, NULL);
909 prop= RNA_def_property(srna, "min", PROP_FLOAT, PROP_NONE);
910 RNA_def_property_ui_range(prop, 0.0, 20.0, 1, 2);
911 RNA_def_property_ui_text(prop, "Min", "");
912 RNA_def_property_update(prop, NC_LOGIC, NULL);
914 prop= RNA_def_property(srna, "max", PROP_FLOAT, PROP_NONE);
915 RNA_def_property_ui_range(prop, 0.0, 20.0, 1, 2);
916 RNA_def_property_ui_text(prop, "Max", "");
917 RNA_def_property_update(prop, NC_LOGIC, NULL);
920 prop= RNA_def_property(srna, "axis", PROP_ENUM, PROP_NONE);
921 RNA_def_property_enum_sdna(prop, NULL, "axis");
922 RNA_def_property_enum_items(prop, prop_axis_items);
923 RNA_def_property_ui_text(prop, "Axis", "Specify the axis the Camera will try to get behind");
924 RNA_def_property_update(prop, NC_LOGIC, NULL);
927 static void rna_def_sound_actuator(BlenderRNA *brna)
932 static EnumPropertyItem prop_type_items[] ={
933 {ACT_SND_PLAY_STOP_SOUND, "PLAYSTOP", 0, "Play Stop", ""},
934 {ACT_SND_PLAY_END_SOUND, "PLAYEND", 0, "Play End", ""},
935 {ACT_SND_LOOP_STOP_SOUND, "LOOPSTOP", 0, "Loop Stop", ""},
936 {ACT_SND_LOOP_END_SOUND, "LOOPEND", 0, "Loop End", ""},
937 {ACT_SND_LOOP_BIDIRECTIONAL_SOUND, "LOOPBIDIRECTIONAL", 0, "Loop Bidirectional", ""},
938 {ACT_SND_LOOP_BIDIRECTIONAL_STOP_SOUND, "LOOPBIDIRECTIONALSTOP", 0, "Loop Bidirectional Stop", ""},
939 {0, NULL, 0, NULL, NULL}
942 srna= RNA_def_struct(brna, "SoundActuator", "Actuator");
943 RNA_def_struct_ui_text(srna, "Sound Actuator", "Actuator to handle sound");
944 RNA_def_struct_sdna_from(srna, "bSoundActuator", "data");
946 prop= RNA_def_property(srna, "sound", PROP_POINTER, PROP_NONE);
947 RNA_def_property_struct_type(prop, "Sound");
948 RNA_def_property_flag(prop, PROP_EDITABLE);
949 RNA_def_struct_ui_text(srna, "Sound", "Sound file");
950 RNA_def_property_update(prop, NC_LOGIC, NULL);
952 prop= RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
953 RNA_def_property_enum_sdna(prop, NULL, "type");
954 RNA_def_property_enum_items(prop, prop_type_items);
955 RNA_def_property_ui_text(prop, "Play Mode", "");
956 RNA_def_property_update(prop, NC_LOGIC, NULL);
958 prop= RNA_def_property(srna, "volume", PROP_FLOAT, PROP_NONE);
959 RNA_def_property_ui_range(prop, 0.0, 1.0, 1, 2);
960 RNA_def_property_range(prop, 0.0, 2.0);
961 RNA_def_property_ui_text(prop, "Volume", "Sets the initial volume of the sound");
962 RNA_def_property_update(prop, NC_LOGIC, NULL);
964 prop= RNA_def_property(srna, "pitch", PROP_FLOAT, PROP_NONE);
965 RNA_def_property_ui_range(prop, -12.0, 12.0, 1, 2);
966 RNA_def_property_ui_text(prop, "Pitch", "Sets the pitch of the sound");
967 RNA_def_property_update(prop, NC_LOGIC, NULL);
969 /* floats - 3D Parameters */
970 prop= RNA_def_property(srna, "gain_3d_min", PROP_FLOAT, PROP_NONE);
971 RNA_def_property_float_sdna(prop, NULL, "sound3D.min_gain");
972 RNA_def_property_ui_range(prop, 0.0, 1.0, 1, 2);
973 RNA_def_property_ui_text(prop, "Minimum Gain", "The minimum gain of the sound, no matter how far it is away");
974 RNA_def_property_update(prop, NC_LOGIC, NULL);
976 prop= RNA_def_property(srna, "gain_3d_max", PROP_FLOAT, PROP_NONE);
977 RNA_def_property_float_sdna(prop, NULL, "sound3D.max_gain");
978 RNA_def_property_ui_range(prop, 0.0, 1.0, 1, 2);
979 RNA_def_property_ui_text(prop, "Maximum Gain", "The maximum gain of the sound, no matter how near it is");
980 RNA_def_property_update(prop, NC_LOGIC, NULL);
982 prop= RNA_def_property(srna, "distance_3d_reference", PROP_FLOAT, PROP_NONE);
983 RNA_def_property_float_sdna(prop, NULL, "sound3D.reference_distance");
984 RNA_def_property_ui_range(prop, 0.0, FLT_MAX, 1, 2);
985 RNA_def_property_ui_text(prop, "Reference Distance", "The distance where the sound has a gain of 1.0");
986 RNA_def_property_update(prop, NC_LOGIC, NULL);
988 prop= RNA_def_property(srna, "distance_3d_max", PROP_FLOAT, PROP_NONE);
989 RNA_def_property_float_sdna(prop, NULL, "sound3D.max_distance");
990 RNA_def_property_ui_range(prop, 0.0, FLT_MAX, 1, 2);
991 RNA_def_property_ui_text(prop, "Maximum Distance", "The maximum distance at which you can hear the sound");
992 RNA_def_property_update(prop, NC_LOGIC, NULL);
994 prop= RNA_def_property(srna, "rolloff_factor_3d", PROP_FLOAT, PROP_NONE);
995 RNA_def_property_float_sdna(prop, NULL, "sound3D.rolloff_factor");
996 RNA_def_property_ui_range(prop, 0.0, 5.0, 1, 2);
997 RNA_def_property_ui_text(prop, "Rolloff", "The influence factor on volume depending on distance");
998 RNA_def_property_update(prop, NC_LOGIC, NULL);
1000 prop= RNA_def_property(srna, "cone_outer_gain_3d", PROP_FLOAT, PROP_NONE);
1001 RNA_def_property_float_sdna(prop, NULL, "sound3D.cone_outer_gain");
1002 RNA_def_property_ui_range(prop, 0.0, 1.0, 1, 2);
1003 RNA_def_property_ui_text(prop, "Cone Outer Gain", "The gain outside the outer cone. The gain in the outer cone will be interpolated between this value and the normal gain in the inner cone");
1004 RNA_def_property_update(prop, NC_LOGIC, NULL);
1006 prop= RNA_def_property(srna, "cone_outer_angle_3d", PROP_FLOAT, PROP_NONE);
1007 RNA_def_property_float_sdna(prop, NULL, "sound3D.cone_outer_angle");
1008 RNA_def_property_ui_range(prop, 0.0, 360.0, 1, 2);
1009 RNA_def_property_ui_text(prop, "Cone Outer Angle", "The angle of the outer cone");
1010 RNA_def_property_update(prop, NC_LOGIC, NULL);
1012 prop= RNA_def_property(srna, "cone_inner_angle_3d", PROP_FLOAT, PROP_NONE);
1013 RNA_def_property_float_sdna(prop, NULL, "sound3D.cone_inner_angle");
1014 RNA_def_property_ui_range(prop, 0.0, 360.0, 1, 2);
1015 RNA_def_property_ui_text(prop, "Cone Inner Angle", "The angle of the inner cone");
1016 RNA_def_property_update(prop, NC_LOGIC, NULL);
1019 prop= RNA_def_property(srna, "use_sound_3d", PROP_BOOLEAN, PROP_NONE);
1020 RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_SND_3D_SOUND);
1021 RNA_def_property_ui_text(prop, "3D Sound", "Enable/Disable 3D Sound");
1022 RNA_def_property_update(prop, NC_LOGIC, NULL);
1025 static void rna_def_property_actuator(BlenderRNA *brna)
1030 static EnumPropertyItem prop_type_items[] ={
1031 {ACT_PROP_ASSIGN, "ASSIGN", 0, "Assign", ""},
1032 {ACT_PROP_ADD, "ADD", 0, "Add", ""},
1033 {ACT_PROP_COPY, "COPY", 0, "Copy", ""},
1034 {ACT_PROP_TOGGLE, "TOGGLE", 0, "Toggle", "For bool/int/float/timer properties only"},
1035 {0, NULL, 0, NULL, NULL}
1038 srna= RNA_def_struct(brna, "PropertyActuator", "Actuator");
1039 RNA_def_struct_ui_text(srna, "Property Actuator", "Actuator to handle properties");
1040 RNA_def_struct_sdna_from(srna, "bPropertyActuator", "data");
1042 prop= RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
1043 RNA_def_property_enum_sdna(prop, NULL, "type");
1044 RNA_def_property_enum_items(prop, prop_type_items);
1045 RNA_def_property_ui_text(prop, "Mode", "");
1046 RNA_def_property_update(prop, NC_LOGIC, NULL);
1048 prop= RNA_def_property(srna, "property", PROP_STRING, PROP_NONE);
1049 RNA_def_property_string_sdna(prop, NULL, "name");
1050 RNA_def_property_ui_text(prop, "Property", "The name of the property");
1051 RNA_def_property_update(prop, NC_LOGIC, NULL);
1053 prop= RNA_def_property(srna, "value", PROP_STRING, PROP_NONE);
1054 RNA_def_property_ui_text(prop, "Value", "The name of the property or the value to use (use \"\" around strings)");
1055 RNA_def_property_update(prop, NC_LOGIC, NULL);
1058 prop= RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
1059 RNA_def_property_struct_type(prop, "Object");
1060 RNA_def_property_pointer_sdna(prop, NULL, "ob");
1061 RNA_def_property_flag(prop, PROP_EDITABLE);
1062 RNA_def_property_ui_text(prop, "Object", "Copy from this Object");
1063 RNA_def_property_update(prop, NC_LOGIC, NULL);
1065 //XXX add even magic'er property lookup (need to look for the property list of the target object)
1066 prop= RNA_def_property(srna, "object_property", PROP_STRING, PROP_NONE);
1067 RNA_def_property_string_sdna(prop, NULL, "value");
1068 RNA_def_property_ui_text(prop, "Property Name", "Copy this property");
1069 RNA_def_property_update(prop, NC_LOGIC, NULL);
1072 static void rna_def_constraint_actuator(BlenderRNA *brna)
1077 static EnumPropertyItem prop_type_items[] ={
1078 {ACT_CONST_TYPE_LOC, "LOC", 0, "Location Constraint", ""},
1079 {ACT_CONST_TYPE_DIST, "DIST", 0, "Distance Constraint", ""},
1080 {ACT_CONST_TYPE_ORI, "ORI", 0, "Orientation Constraint", ""},
1081 {ACT_CONST_TYPE_FH, "FH", 0, "Force Field Constraint", ""},
1082 {0, NULL, 0, NULL, NULL}
1085 static EnumPropertyItem prop_limit_items[] ={
1086 {ACT_CONST_NONE, "NONE", 0, "None", ""},
1087 {ACT_CONST_LOCX, "LOCX", 0, "Loc X", ""},
1088 {ACT_CONST_LOCY, "LOCY", 0, "Loc Y", ""},
1089 {ACT_CONST_LOCZ, "LOCZ", 0, "Loc Z", ""},
1090 {0, NULL, 0, NULL, NULL}
1093 static EnumPropertyItem prop_direction_items[] ={
1094 {ACT_CONST_NONE, "NONE", 0, "None", ""},
1095 {ACT_CONST_DIRPX, "DIRPX", 0, "X axis", ""},
1096 {ACT_CONST_DIRPY, "DIRPY", 0, "Y axis", ""},
1097 {ACT_CONST_DIRPZ, "DIRPZ", 0, "Z axis", ""},
1098 {ACT_CONST_DIRNX, "DIRNX", 0, "-X axis", ""},
1099 {ACT_CONST_DIRNY, "DIRNY", 0, "-Y axis", ""},
1100 {ACT_CONST_DIRNZ, "DIRNZ", 0, "-Z axis", ""},
1101 {0, NULL, 0, NULL, NULL}
1104 static EnumPropertyItem prop_direction_pos_items[] ={
1105 {ACT_CONST_NONE, "NONE", 0, "None", ""},
1106 {ACT_CONST_DIRPX, "DIRPX", 0, "X axis", ""},
1107 {ACT_CONST_DIRPY, "DIRPY", 0, "Y axis", ""},
1108 {ACT_CONST_DIRPZ, "DIRPZ", 0, "Z axis", ""},
1109 {0, NULL, 0, NULL, NULL}
1112 srna= RNA_def_struct(brna, "ConstraintActuator", "Actuator");
1113 RNA_def_struct_ui_text(srna, "Constraint Actuator", "Actuator to handle Constraints");
1114 RNA_def_struct_sdna_from(srna, "bConstraintActuator", "data");
1116 prop= RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
1117 RNA_def_property_enum_sdna(prop, NULL, "type");
1118 RNA_def_property_enum_items(prop, prop_type_items);
1119 RNA_def_property_enum_funcs(prop, NULL, "rna_ConstraintActuator_type_set", NULL);
1120 RNA_def_property_ui_text(prop, "Constraints Mode", "The type of the constraint");
1121 RNA_def_property_update(prop, NC_LOGIC, NULL);
1123 prop= RNA_def_property(srna, "limit", PROP_ENUM, PROP_NONE);
1124 RNA_def_property_enum_sdna(prop, NULL, "flag");
1125 RNA_def_property_enum_items(prop, prop_limit_items);
1126 RNA_def_property_ui_text(prop, "Limit", "");
1127 RNA_def_property_update(prop, NC_LOGIC, NULL);
1129 prop= RNA_def_property(srna, "direction", PROP_ENUM, PROP_NONE);
1130 RNA_def_property_enum_sdna(prop, NULL, "mode");
1131 RNA_def_property_enum_items(prop, prop_direction_items);
1132 RNA_def_property_ui_text(prop, "Direction", "Set the direction of the ray");
1133 RNA_def_property_update(prop, NC_LOGIC, NULL);
1135 prop= RNA_def_property(srna, "direction_axis", PROP_ENUM, PROP_NONE);
1136 RNA_def_property_enum_sdna(prop, NULL, "mode");
1137 RNA_def_property_enum_items(prop, prop_direction_items);
1138 RNA_def_property_ui_text(prop, "Direction", "Select the axis to be aligned along the reference direction");
1139 RNA_def_property_update(prop, NC_LOGIC, NULL);
1141 /* ACT_CONST_TYPE_LOC */
1142 prop= RNA_def_property(srna, "limit_min", PROP_FLOAT, PROP_NONE);
1143 RNA_def_property_float_funcs(prop, "rna_ConstraintActuator_limitmin_get", "rna_ConstraintActuator_limitmin_set", NULL);
1144 RNA_def_property_ui_range(prop, -2000.f, 2000.f, 1, 2);
1145 RNA_def_property_ui_text(prop, "Min", "");
1146 RNA_def_property_update(prop, NC_LOGIC, NULL);
1148 prop= RNA_def_property(srna, "limit_max", PROP_FLOAT, PROP_NONE);
1149 RNA_def_property_float_funcs(prop, "rna_ConstraintActuator_limitmax_get", "rna_ConstraintActuator_limitmax_set", NULL);
1150 RNA_def_property_ui_range(prop, -2000.f, 2000.f, 1, 2);
1151 RNA_def_property_ui_text(prop, "Max", "");
1152 RNA_def_property_update(prop, NC_LOGIC, NULL);
1154 prop= RNA_def_property(srna, "damping", PROP_INT, PROP_NONE);
1155 RNA_def_property_int_sdna(prop, NULL, "damp");
1156 RNA_def_property_ui_range(prop, 0, 100, 1, 1);
1157 RNA_def_property_ui_text(prop, "Damping", "Damping factor: time constant (in frame) of low pass filter");
1158 RNA_def_property_update(prop, NC_LOGIC, NULL);
1160 /* ACT_CONST_TYPE_DIST */
1161 prop= RNA_def_property(srna, "range", PROP_FLOAT, PROP_NONE);
1162 RNA_def_property_float_funcs(prop, "rna_ConstraintActuator_range_get", "rna_ConstraintActuator_range_set", NULL);
1163 RNA_def_property_ui_range(prop, 0.f, 2000.f, 1, 2);
1164 RNA_def_property_ui_text(prop, "Range", "Set the maximum length of ray");
1165 RNA_def_property_update(prop, NC_LOGIC, NULL);
1167 prop= RNA_def_property(srna, "distance", PROP_FLOAT, PROP_NONE);
1168 RNA_def_property_float_funcs(prop, "rna_ConstraintActuator_distance_get", "rna_ConstraintActuator_distance_set", NULL);
1169 RNA_def_property_ui_range(prop, -2000.f, 2000.f, 1, 2);
1170 RNA_def_property_ui_text(prop, "Distance", "Set the maximum length of ray");
1171 RNA_def_property_update(prop, NC_LOGIC, NULL);
1173 //XXX to use a pointer or add a material lookup
1174 prop= RNA_def_property(srna, "material", PROP_STRING, PROP_NONE);
1175 RNA_def_property_string_sdna(prop, NULL, "matprop");
1176 RNA_def_property_flag(prop, PROP_EDITABLE);
1177 RNA_def_property_ui_text(prop, "Material", "Ray detects only Objects with this material");
1178 RNA_def_property_update(prop, NC_LOGIC, NULL);
1180 //XXX add magic property lookup
1181 prop= RNA_def_property(srna, "property", PROP_STRING, PROP_NONE);
1182 RNA_def_property_string_sdna(prop, NULL, "matprop");
1183 RNA_def_property_ui_text(prop, "Property", "Ray detect only Objects with this property");
1184 RNA_def_property_update(prop, NC_LOGIC, NULL);
1186 prop= RNA_def_property(srna, "time", PROP_INT, PROP_NONE);
1187 RNA_def_property_ui_range(prop, 0, 1000, 1, 2);
1188 RNA_def_property_ui_text(prop, "Time", "Maximum activation time in frame, 0 for unlimited");
1189 RNA_def_property_update(prop, NC_LOGIC, NULL);
1191 prop= RNA_def_property(srna, "damping_rotation", PROP_INT, PROP_NONE);
1192 RNA_def_property_int_sdna(prop, NULL, "rotdamp");
1193 RNA_def_property_ui_range(prop, 0, 100, 1, 1);
1194 RNA_def_property_ui_text(prop, "rotDamp", "Use a different damping for orientation");
1195 RNA_def_property_update(prop, NC_LOGIC, NULL);
1197 /* ACT_CONST_TYPE_ORI */
1198 prop= RNA_def_property(srna, "direction_axis_pos", PROP_ENUM, PROP_NONE);
1199 RNA_def_property_enum_sdna(prop, NULL, "mode");
1200 RNA_def_property_enum_items(prop, prop_direction_pos_items);
1201 RNA_def_property_ui_text(prop, "Direction", "Select the axis to be aligned along the reference direction");
1202 RNA_def_property_update(prop, NC_LOGIC, NULL);
1204 prop= RNA_def_property(srna, "rotation_max", PROP_FLOAT, PROP_XYZ);
1205 RNA_def_property_float_sdna(prop, NULL, "maxrot");
1206 RNA_def_property_array(prop, 3);
1207 RNA_def_property_ui_range(prop, -2000.0, 2000.0, 10, 2);
1208 RNA_def_property_ui_text(prop, "Reference Direction", "Reference Direction");
1209 RNA_def_property_update(prop, NC_LOGIC, NULL);
1211 prop= RNA_def_property(srna, "angle_min", PROP_FLOAT, PROP_ANGLE);
1212 RNA_def_property_float_sdna(prop, NULL, "minloc[0]");
1213 RNA_def_property_range(prop, 0.0, 180.0);
1214 RNA_def_property_ui_text(prop, "Min Angle", "Minimum angle to maintain with target direction. No correction is done if angle with target direction is between min and max");
1215 RNA_def_property_update(prop, NC_LOGIC, NULL);
1217 prop= RNA_def_property(srna, "angle_max", PROP_FLOAT, PROP_ANGLE);
1218 RNA_def_property_float_sdna(prop, NULL, "maxloc[0]");
1219 RNA_def_property_range(prop, 0.0, 180.0);
1220 RNA_def_property_ui_text(prop, "Max Angle", "Maximum angle allowed with target direction. No correction is done if angle with target direction is between min and max");
1221 RNA_def_property_update(prop, NC_LOGIC, NULL);
1223 /* ACT_CONST_TYPE_FH */
1224 prop= RNA_def_property(srna, "fh_height", PROP_FLOAT, PROP_NONE);
1225 RNA_def_property_float_funcs(prop, "rna_ConstraintActuator_fhheight_get", "rna_ConstraintActuator_fhheight_set", NULL);
1226 RNA_def_property_ui_range(prop, 0.01, 2000.0, 10, 2);
1227 RNA_def_property_ui_text(prop, "Distance", "Height of the Fh area");
1228 RNA_def_property_update(prop, NC_LOGIC, NULL);
1230 prop= RNA_def_property(srna, "spring", PROP_FLOAT, PROP_PERCENTAGE);
1231 RNA_def_property_float_funcs(prop, "rna_ConstraintActuator_spring_get", "rna_ConstraintActuator_spring_set", NULL);
1232 RNA_def_property_ui_range(prop, 0.0, 1.0, 10, 2);
1233 RNA_def_property_ui_text(prop, "Fh", "Spring force within the Fh area");
1234 RNA_def_property_update(prop, NC_LOGIC, NULL);
1236 prop= RNA_def_property(srna, "fh_damping", PROP_FLOAT, PROP_NONE);
1237 RNA_def_property_float_sdna(prop, NULL, "maxrot[0]");
1238 RNA_def_property_ui_range(prop, 0.0, 1.0, 10, 2);
1239 RNA_def_property_ui_text(prop, "Damping", "Damping factor of the Fh spring force");
1240 RNA_def_property_update(prop, NC_LOGIC, NULL);
1243 prop= RNA_def_property(srna, "use_force_distance", PROP_BOOLEAN, PROP_NONE);
1244 RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_CONST_DISTANCE);
1245 RNA_def_property_ui_text(prop, "Force Distance", "Force distance of object to point of impact of ray");
1246 RNA_def_property_update(prop, NC_LOGIC, NULL);
1248 prop= RNA_def_property(srna, "use_local", PROP_BOOLEAN, PROP_NONE);
1249 RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_CONST_LOCAL);
1250 RNA_def_property_ui_text(prop, "L", "Set ray along object's axis or global axis");
1251 RNA_def_property_update(prop, NC_LOGIC, NULL);
1253 prop= RNA_def_property(srna, "use_normal", PROP_BOOLEAN, PROP_NONE);
1254 RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_CONST_NORMAL);
1255 RNA_def_property_ui_text(prop, "N", "Set object axis along (local axis) or parallel (global axis) to the normal at hit position");
1256 RNA_def_property_update(prop, NC_LOGIC, NULL);
1258 prop= RNA_def_property(srna, "use_persistent", PROP_BOOLEAN, PROP_NONE);
1259 RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_CONST_PERMANENT);
1260 RNA_def_property_ui_text(prop, "PER", "Persistent actuator: stays active even if ray does not reach target");
1261 RNA_def_property_update(prop, NC_LOGIC, NULL);
1263 //XXX to use an enum instead of a flag if possible
1264 prop= RNA_def_property(srna, "use_material_detect", PROP_BOOLEAN, PROP_NONE);
1265 RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_CONST_MATERIAL);
1266 RNA_def_property_ui_text(prop, "M/P", "Detect material instead of property");
1267 RNA_def_property_boolean_funcs(prop, NULL, "rna_Actuator_constraint_detect_material_set");
1268 RNA_def_property_update(prop, NC_LOGIC, NULL);
1270 prop= RNA_def_property(srna, "use_fh_paralel_axis", PROP_BOOLEAN, PROP_NONE);
1271 RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_CONST_DOROTFH);
1272 RNA_def_property_ui_text(prop, "Rot Fh", "Keep object axis parallel to normal");
1273 RNA_def_property_update(prop, NC_LOGIC, NULL);
1275 prop= RNA_def_property(srna, "use_fh_normal", PROP_BOOLEAN, PROP_NONE);
1276 RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_CONST_NORMAL);
1277 RNA_def_property_ui_text(prop, "N", "Add a horizontal spring force on slopes");
1278 RNA_def_property_update(prop, NC_LOGIC, NULL);
1281 static void rna_def_edit_object_actuator(BlenderRNA *brna)
1286 static EnumPropertyItem prop_dyn_items[] ={
1287 {ACT_EDOB_RESTORE_DYN, "RESTOREDYN", 0, "Restore Dynamics", ""},
1288 {ACT_EDOB_SUSPEND_DYN, "SUSPENDDYN", 0, "Suspend Dynamics", ""},
1289 {ACT_EDOB_ENABLE_RB, "ENABLERIGIDBODY", 0, "Enable Rigid Body", ""},
1290 {ACT_EDOB_DISABLE_RB, "DISABLERIGIDBODY", 0, "Disable Rigid Body", ""},
1291 {ACT_EDOB_SET_MASS, "SETMASS", 0, "Set Mass", ""},
1292 {0, NULL, 0, NULL, NULL} };
1294 static EnumPropertyItem prop_type_items[] ={
1295 {ACT_EDOB_ADD_OBJECT, "ADDOBJECT", 0, "Add Object", ""},
1296 {ACT_EDOB_END_OBJECT, "ENDOBJECT", 0, "End Object", ""},
1297 {ACT_EDOB_REPLACE_MESH, "REPLACEMESH", 0, "Replace Mesh", ""},
1298 {ACT_EDOB_TRACK_TO, "TRACKTO", 0, "Track to", ""},
1299 {ACT_EDOB_DYNAMICS, "DYNAMICS", 0, "Dynamics", ""},
1300 {0, NULL, 0, NULL, NULL} };
1302 srna= RNA_def_struct(brna, "EditObjectActuator", "Actuator");
1303 RNA_def_struct_ui_text(srna, "Edit Object Actuator", "Actuator used to edit objects");
1304 RNA_def_struct_sdna_from(srna, "bEditObjectActuator", "data");
1306 prop= RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
1307 RNA_def_property_enum_sdna(prop, NULL, "type");
1308 RNA_def_property_enum_items(prop, prop_type_items);
1309 RNA_def_property_ui_text(prop, "Edit Object", "The mode of the actuator");
1310 RNA_def_property_update(prop, NC_LOGIC, NULL);
1312 prop= RNA_def_property(srna, "dynamic_operation", PROP_ENUM, PROP_NONE);
1313 RNA_def_property_enum_sdna(prop, NULL, "dyn_operation");
1314 RNA_def_property_enum_items(prop, prop_dyn_items);
1315 RNA_def_property_ui_text(prop, "Dynamic Operation", "");
1316 RNA_def_property_update(prop, NC_LOGIC, NULL);
1318 prop= RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
1319 RNA_def_property_struct_type(prop, "Object");
1320 RNA_def_property_pointer_sdna(prop, NULL, "ob");
1321 RNA_def_property_flag(prop, PROP_EDITABLE);
1322 RNA_def_property_ui_text(prop, "Object", "Add this Object and all its children (cant be on an visible layer)");
1323 RNA_def_property_update(prop, NC_LOGIC, NULL);
1325 prop= RNA_def_property(srna, "track_object", PROP_POINTER, PROP_NONE);
1326 RNA_def_property_struct_type(prop, "Object");
1327 RNA_def_property_pointer_sdna(prop, NULL, "ob");
1328 RNA_def_property_flag(prop, PROP_EDITABLE);
1329 RNA_def_property_ui_text(prop, "Object", "Track to this Object");
1330 RNA_def_property_update(prop, NC_LOGIC, NULL);
1332 prop= RNA_def_property(srna, "mesh", PROP_POINTER, PROP_NONE);
1333 RNA_def_property_struct_type(prop, "Mesh");
1334 RNA_def_property_pointer_sdna(prop, NULL, "me");
1335 RNA_def_property_flag(prop, PROP_EDITABLE);
1336 RNA_def_property_ui_text(prop, "Mesh", "Replace the existing, when left blank 'Phys' will remake the existing physics mesh");
1337 /* note: custom set function is ONLY to avoid rna setting a user for this. */
1338 RNA_def_property_pointer_funcs(prop, NULL, "rna_Actuator_editobject_mesh_set", NULL, NULL);
1339 RNA_def_property_update(prop, NC_LOGIC, NULL);
1341 prop= RNA_def_property(srna, "time", PROP_INT, PROP_NONE);
1342 RNA_def_property_ui_range(prop, 0, 2000, 1, 1);
1343 RNA_def_property_ui_text(prop, "Time", "Duration the new Object lives or the track takes");
1344 RNA_def_property_update(prop, NC_LOGIC, NULL);
1346 prop= RNA_def_property(srna, "mass", PROP_FLOAT, PROP_NONE);
1347 RNA_def_property_ui_range(prop, 0, 10000, 1, 2);
1348 RNA_def_property_ui_text(prop, "Mass", "The mass of the object");
1349 RNA_def_property_update(prop, NC_LOGIC, NULL);
1351 /* floats 3 Arrays*/
1352 prop= RNA_def_property(srna, "linear_velocity", PROP_FLOAT, PROP_XYZ);
1353 RNA_def_property_float_sdna(prop, NULL, "linVelocity");
1354 RNA_def_property_array(prop, 3);
1355 RNA_def_property_ui_range(prop, -100.0, 100.0, 10, 2);
1356 RNA_def_property_ui_text(prop, "Linear Velocity", "Velocity upon creation");
1357 RNA_def_property_update(prop, NC_LOGIC, NULL);
1359 prop= RNA_def_property(srna, "angular_velocity", PROP_FLOAT, PROP_XYZ);
1360 RNA_def_property_float_sdna(prop, NULL, "angVelocity");
1361 RNA_def_property_array(prop, 3);
1362 RNA_def_property_ui_range(prop, -10000.0, 10000.0, 10, 2);
1363 RNA_def_property_ui_text(prop, "Angular Velocity", "Angular velocity upon creation");
1364 RNA_def_property_update(prop, NC_LOGIC, NULL);
1367 prop= RNA_def_property(srna, "use_local_linear_velocity", PROP_BOOLEAN, PROP_NONE);
1368 RNA_def_property_boolean_sdna(prop, NULL, "localflag", ACT_EDOB_LOCAL_LINV);
1369 RNA_def_property_ui_text(prop, "L", "Apply the transformation locally");
1370 RNA_def_property_update(prop, NC_LOGIC, NULL);
1372 prop= RNA_def_property(srna, "use_local_angular_velocity", PROP_BOOLEAN, PROP_NONE);
1373 RNA_def_property_boolean_sdna(prop, NULL, "localflag", ACT_EDOB_LOCAL_ANGV);
1374 RNA_def_property_ui_text(prop, "L", "Apply the rotation locally");
1375 RNA_def_property_update(prop, NC_LOGIC, NULL);
1377 prop= RNA_def_property(srna, "use_replace_display_mesh", PROP_BOOLEAN, PROP_NONE);
1378 RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_EDOB_REPLACE_MESH_NOGFX);
1379 RNA_def_property_ui_text(prop, "Gfx", "Replace the display mesh");
1380 RNA_def_property_update(prop, NC_LOGIC, NULL);
1382 prop= RNA_def_property(srna, "use_replace_physics_mesh", PROP_BOOLEAN, PROP_NONE);
1383 RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_EDOB_REPLACE_MESH_PHYS);
1384 RNA_def_property_ui_text(prop, "Phys", "Replace the physics mesh (triangle bounds only - compound shapes not supported)");
1385 RNA_def_property_update(prop, NC_LOGIC, NULL);
1387 prop= RNA_def_property(srna, "use_3d_tracking", PROP_BOOLEAN, PROP_NONE);
1388 RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_TRACK_3D);
1389 RNA_def_property_ui_text(prop, "3D", "Enable 3D tracking");
1390 RNA_def_property_update(prop, NC_LOGIC, NULL);
1393 static void rna_def_scene_actuator(BlenderRNA *brna)
1398 static EnumPropertyItem prop_type_items[] ={
1399 {ACT_SCENE_RESTART, "RESTART", 0, "Restart", ""},
1400 {ACT_SCENE_SET, "SET", 0, "Set Scene", ""},
1401 {ACT_SCENE_CAMERA, "CAMERA", 0, "Set Camera", ""},
1402 {ACT_SCENE_ADD_FRONT, "ADDFRONT", 0, "Add OverlayScene", ""},
1403 {ACT_SCENE_ADD_BACK, "ADDBACK", 0, "Add BackgroundScene", ""},
1404 {ACT_SCENE_REMOVE, "REMOVE", 0, "Remove Scene", ""},
1405 {ACT_SCENE_SUSPEND, "SUSPEND", 0, "Suspend Scene", ""},
1406 {ACT_SCENE_RESUME, "RESUME", 0, "Resume Scene", ""},
1407 {0, NULL, 0, NULL, NULL}};
1409 srna= RNA_def_struct(brna, "SceneActuator", "Actuator");
1410 RNA_def_struct_ui_text(srna, "Scene Actuator", "Actuator to ..");
1411 RNA_def_struct_sdna_from(srna, "bSceneActuator", "data");
1413 prop= RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
1414 RNA_def_property_enum_sdna(prop, NULL, "type");
1415 RNA_def_property_enum_items(prop, prop_type_items);
1416 RNA_def_property_ui_text(prop, "Scene", "");
1417 RNA_def_property_update(prop, NC_LOGIC, NULL);
1419 //XXX filter only camera objects
1420 prop= RNA_def_property(srna, "camera", PROP_POINTER, PROP_NONE);
1421 RNA_def_property_struct_type(prop, "Object");
1422 RNA_def_property_flag(prop, PROP_EDITABLE);
1423 RNA_def_property_ui_text(prop, "Camera Object", "Set this Camera. Leave empty to refer to self object");
1424 RNA_def_property_update(prop, NC_LOGIC, NULL);
1426 prop= RNA_def_property(srna, "scene", PROP_POINTER, PROP_NONE);
1427 RNA_def_property_struct_type(prop, "Scene");
1428 RNA_def_property_flag(prop, PROP_EDITABLE);
1429 RNA_def_property_ui_text(prop, "Scene", "Set the Scene to be added/removed/paused/resumed");
1430 RNA_def_property_update(prop, NC_LOGIC, NULL);
1432 /* XXX no need for those tooltips. to remove soon
1433 Originally we had different 'scene' tooltips for different values of 'type'.
1435 ACT_SCENE_RESTART ""
1437 ACT_SCENE_SET "Set this Scene"
1438 ACT_SCENE_ADD_FRONT "Add an Overlay Scene"
1439 ACT_SCENE_ADD_BACK "Add a Background Scene"
1440 ACT_SCENE_REMOVE "Remove a Scene"
1441 ACT_SCENE_SUSPEND "Pause a Scene"
1442 ACT_SCENE_RESUME "Unpause a Scene"
1444 It can be done in the ui script if still needed.
1449 static void rna_def_random_actuator(BlenderRNA *brna)
1454 static EnumPropertyItem prop_distribution_items[] ={
1455 {ACT_RANDOM_BOOL_CONST, "BOOL_CONSTANT", 0, "Bool Constant", ""},
1456 {ACT_RANDOM_BOOL_UNIFORM, "BOOL_UNIFORM", 0, "Bool Uniform", ""},
1457 {ACT_RANDOM_BOOL_BERNOUILLI, "BOOL_BERNOUILLI", 0, "Bool Bernouilli", ""},
1458 {ACT_RANDOM_INT_CONST, "INT_CONSTANT", 0, "Int Constant", ""},
1459 {ACT_RANDOM_INT_UNIFORM, "INT_UNIFORM", 0, "Int Uniform", ""},
1460 {ACT_RANDOM_INT_POISSON, "INT_POISSON", 0, "Int Poisson", ""},
1461 {ACT_RANDOM_FLOAT_CONST, "FLOAT_CONSTANT", 0, "Float Constant", ""},
1462 {ACT_RANDOM_FLOAT_UNIFORM, "FLOAT_UNIFORM", 0, "Float Uniform", ""},
1463 {ACT_RANDOM_FLOAT_NORMAL, "FLOAT_NORMAL", 0, "Float Normal", ""},
1464 {ACT_RANDOM_FLOAT_NEGATIVE_EXPONENTIAL, "FLOAT_NEGATIVE_EXPONENTIAL", 0, "Float Neg. Exp.", ""},
1465 {0, NULL, 0, NULL, NULL}};
1467 srna= RNA_def_struct(brna, "RandomActuator", "Actuator");
1468 RNA_def_struct_ui_text(srna, "Random Actuator", "Actuator to ..");
1469 RNA_def_struct_sdna_from(srna, "bRandomActuator", "data");
1471 prop= RNA_def_property(srna, "seed", PROP_INT, PROP_NONE);
1472 RNA_def_property_ui_range(prop, 0, 1000, 1, 1);
1473 RNA_def_property_range(prop, 0, MAXFRAME);
1474 RNA_def_property_ui_text(prop, "Seed", "Initial seed of the random generator. Use Python for more freedom (choose 0 for not random)");
1475 RNA_def_property_update(prop, NC_LOGIC, NULL);
1477 prop= RNA_def_property(srna, "property", PROP_STRING, PROP_NONE);
1478 RNA_def_property_string_sdna(prop, NULL, "propname");
1479 RNA_def_property_ui_text(prop, "Property", "Assign the random value to this property");
1480 RNA_def_property_update(prop, NC_LOGIC, NULL);
1482 prop= RNA_def_property(srna, "distribution", PROP_ENUM, PROP_NONE);
1483 RNA_def_property_enum_items(prop, prop_distribution_items);
1484 RNA_def_property_ui_text(prop, "Distribution", "Choose the type of distribution");
1485 RNA_def_property_update(prop, NC_LOGIC, NULL);
1487 /* arguments for the distribution */
1488 /* int_arg_1, int_arg_2, float_arg_1, float_arg_2 */
1490 /* ACT_RANDOM_BOOL_CONST */
1491 prop= RNA_def_property(srna, "use_always_true", PROP_BOOLEAN, PROP_NONE);
1492 RNA_def_property_boolean_sdna(prop, NULL, "int_arg_1", 1);
1493 RNA_def_property_ui_text(prop, "Always true", "Always false or always true");
1494 RNA_def_property_update(prop, NC_LOGIC, NULL);
1496 /* ACT_RANDOM_BOOL_UNIFORM */
1497 // label => "Choose between true and false, 50% chance each"
1499 /* ACT_RANDOM_BOOL_BERNOUILLI */
1500 prop= RNA_def_property(srna, "chance", PROP_FLOAT, PROP_PERCENTAGE);
1501 RNA_def_property_float_sdna(prop, NULL, "float_arg_1");
1502 RNA_def_property_range(prop, 0.0, 1.0);
1503 RNA_def_property_ui_text(prop, "Chance", "Pick a number between 0 and 1. Success if you stay below this value");
1504 RNA_def_property_update(prop, NC_LOGIC, NULL);
1506 /* ACT_RANDOM_INT_CONST */
1507 prop= RNA_def_property(srna, "int_value", PROP_INT, PROP_NONE);
1508 RNA_def_property_int_sdna(prop, NULL, "int_arg_1");
1509 RNA_def_property_ui_range(prop, -1000, 1000, 1, 1);
1510 RNA_def_property_ui_text(prop, "Value", "Always return this number");
1511 RNA_def_property_update(prop, NC_LOGIC, NULL);
1513 /* ACT_RANDOM_INT_UNIFORM */
1514 prop= RNA_def_property(srna, "int_min", PROP_INT, PROP_NONE);
1515 RNA_def_property_int_sdna(prop, NULL, "int_arg_1");
1516 RNA_def_property_range(prop, -1000, 1000);
1517 RNA_def_property_ui_text(prop, "Min", "Choose a number from a range. Lower boundary of the range");
1518 RNA_def_property_update(prop, NC_LOGIC, NULL);
1520 prop= RNA_def_property(srna, "int_max", PROP_INT, PROP_NONE);
1521 RNA_def_property_int_sdna(prop, NULL, "int_arg_2");
1522 RNA_def_property_range(prop, -1000, 1000);
1523 RNA_def_property_ui_text(prop, "Max", "Choose a number from a range. Upper boundary of the range");
1524 RNA_def_property_update(prop, NC_LOGIC, NULL);
1526 /* ACT_RANDOM_INT_POISSON */
1527 prop= RNA_def_property(srna, "int_mean", PROP_FLOAT, PROP_NONE);
1528 RNA_def_property_float_sdna(prop, NULL, "float_arg_1");
1529 RNA_def_property_range(prop, 0.01, 100.0);
1530 RNA_def_property_ui_text(prop, "Mean", "Expected mean value of the distribution");
1531 RNA_def_property_update(prop, NC_LOGIC, NULL);
1533 /* ACT_RANDOM_FLOAT_CONST */
1534 prop= RNA_def_property(srna, "float_value", PROP_FLOAT, PROP_NONE);
1535 RNA_def_property_float_sdna(prop, NULL, "float_arg_1");
1536 RNA_def_property_range(prop, 0.0, 1.0);
1537 RNA_def_property_ui_text(prop, "Value", "Always return this number");
1538 RNA_def_property_update(prop, NC_LOGIC, NULL);
1540 /* ACT_RANDOM_FLOAT_UNIFORM */
1541 prop= RNA_def_property(srna, "float_min", PROP_FLOAT, PROP_NONE);
1542 RNA_def_property_float_sdna(prop, NULL, "float_arg_1");
1543 RNA_def_property_range(prop, -1000.0, 1000.0);
1544 RNA_def_property_ui_text(prop, "Min", "Choose a number from a range. Lower boundary of the range");
1545 RNA_def_property_update(prop, NC_LOGIC, NULL);
1547 prop= RNA_def_property(srna, "float_max", PROP_FLOAT, PROP_NONE);
1548 RNA_def_property_float_sdna(prop, NULL, "float_arg_2");
1549 RNA_def_property_range(prop, -1000.0, 1000.0);
1550 RNA_def_property_ui_text(prop, "Max", "Choose a number from a range. Upper boundary of the range");
1551 RNA_def_property_update(prop, NC_LOGIC, NULL);
1553 /* ACT_RANDOM_FLOAT_NORMAL */
1554 prop= RNA_def_property(srna, "float_mean", PROP_FLOAT, PROP_NONE);
1555 RNA_def_property_float_sdna(prop, NULL, "float_arg_1");
1556 RNA_def_property_range(prop, -1000.0, 1000.0);
1557 RNA_def_property_ui_text(prop, "Mean", "A normal distribution. Mean of the distribution");
1558 RNA_def_property_update(prop, NC_LOGIC, NULL);
1560 prop= RNA_def_property(srna, "standard_derivation", PROP_FLOAT, PROP_NONE);
1561 RNA_def_property_float_sdna(prop, NULL, "float_arg_2");
1562 RNA_def_property_range(prop, -1000.0, 1000.0);
1563 RNA_def_property_ui_text(prop, "SD", "A normal distribution. Standard deviation of the distribution");
1564 RNA_def_property_update(prop, NC_LOGIC, NULL);
1566 /* ACT_RANDOM_FLOAT_NEGATIVE_EXPONENTIAL */
1567 prop= RNA_def_property(srna, "half_life_time", PROP_FLOAT, PROP_NONE);
1568 RNA_def_property_float_sdna(prop, NULL, "float_arg_1");
1569 RNA_def_property_range(prop, -1000.0, 1000.0);
1570 RNA_def_property_ui_text(prop, "Half-life time", "Negative exponential dropoff");
1571 RNA_def_property_update(prop, NC_LOGIC, NULL);
1574 static void rna_def_message_actuator(BlenderRNA *brna)
1579 static EnumPropertyItem prop_body_type_items[] ={
1580 {ACT_MESG_MESG, "TEXT", 0, "Text", ""},
1581 {ACT_MESG_PROP, "PROPERTY", 0, "Property", ""},
1582 {0, NULL, 0, NULL, NULL}};
1584 srna= RNA_def_struct(brna, "MessageActuator", "Actuator");
1585 RNA_def_struct_ui_text(srna, "Message Actuator", "Actuator to ..");
1586 RNA_def_struct_sdna_from(srna, "bMessageActuator", "data");
1588 prop= RNA_def_property(srna, "to_property", PROP_STRING, PROP_NONE);
1589 RNA_def_property_string_sdna(prop, NULL, "toPropName");
1590 RNA_def_property_ui_text(prop, "To", "Optional send message to objects with this name only, or empty to broadcast");
1591 RNA_def_property_update(prop, NC_LOGIC, NULL);
1593 prop= RNA_def_property(srna, "subject", PROP_STRING, PROP_NONE);
1594 RNA_def_property_ui_text(prop, "Subject", "Optional message subject. This is what can be filtered on");
1595 RNA_def_property_update(prop, NC_LOGIC, NULL);
1597 prop= RNA_def_property(srna, "body_type", PROP_ENUM, PROP_NONE);
1598 RNA_def_property_enum_sdna(prop, NULL, "bodyType");
1599 RNA_def_property_enum_items(prop, prop_body_type_items);
1600 RNA_def_property_ui_text(prop, "Body", "Toggle message type: either Text or a PropertyName");
1603 prop= RNA_def_property(srna, "body_message", PROP_STRING, PROP_NONE);
1604 RNA_def_property_string_sdna(prop, NULL, "body");
1605 RNA_def_property_ui_text(prop, "Body", "Optional message body Text");
1606 RNA_def_property_update(prop, NC_LOGIC, NULL);
1609 prop= RNA_def_property(srna, "body_property", PROP_STRING, PROP_NONE);
1610 RNA_def_property_string_sdna(prop, NULL, "body");
1611 RNA_def_property_ui_text(prop, "Propname", "The message body will be set by the Property Value");
1612 RNA_def_property_update(prop, NC_LOGIC, NULL);
1615 static void rna_def_game_actuator(BlenderRNA *brna)
1620 static EnumPropertyItem prop_type_items[] ={
1621 // {ACT_GAME_LOAD, "LOAD", 0, "Load game", ""},
1622 // {ACT_GAME_START, "START", 0, "Start loaded game", ""},
1623 // keeping the load/start hacky for compatibility with 2.49
1624 // ideally we could use ACT_GAME_START again and do a do_version()
1626 {ACT_GAME_LOAD, "START", 0, "Start new game", ""},
1627 {ACT_GAME_RESTART, "RESTART", 0, "Restart this game", ""},
1628 {ACT_GAME_QUIT, "QUIT", 0, "Quit this game", ""},
1629 {ACT_GAME_SAVECFG, "SAVECFG", 0, "Save bge.logic.globalDict", ""},
1630 {ACT_GAME_LOADCFG, "LOADCFG", 0, "Load bge.logic.globalDict", ""},
1631 {0, NULL, 0, NULL, NULL}};
1633 srna= RNA_def_struct(brna, "GameActuator", "Actuator");
1634 RNA_def_struct_ui_text(srna, "Game Actuator", "");
1635 RNA_def_struct_sdna_from(srna, "bGameActuator", "data");
1637 prop= RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
1638 RNA_def_property_enum_sdna(prop, NULL, "type");
1639 RNA_def_property_enum_items(prop, prop_type_items);
1640 RNA_def_property_ui_text(prop, "Game", "");
1641 RNA_def_property_update(prop, NC_LOGIC, NULL);
1644 prop= RNA_def_property(srna, "filename", PROP_STRING, PROP_FILEPATH);
1645 RNA_def_property_ui_text(prop, "File", "Load this blend file, use the \"//\" prefix for a path relative to the current blend file");
1646 RNA_def_property_update(prop, NC_LOGIC, NULL);
1647 //XXX to do: an operator that calls file_browse with relative_path on and blender filtering active
1650 static void rna_def_visibility_actuator(BlenderRNA *brna)
1655 srna= RNA_def_struct(brna, "VisibilityActuator", "Actuator");
1656 RNA_def_struct_ui_text(srna, "Visibility Actuator", "Actuator to set visibility and occlusion of the object");
1657 RNA_def_struct_sdna_from(srna, "bVisibilityActuator", "data");
1659 prop= RNA_def_property(srna, "use_visible", PROP_BOOLEAN, PROP_NONE);
1660 RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", ACT_VISIBILITY_INVISIBLE);
1661 RNA_def_property_ui_text(prop, "Visible", "Set the objects visible. Initialized from the object render restriction toggle in physics button");
1662 RNA_def_property_update(prop, NC_LOGIC, NULL);
1664 prop= RNA_def_property(srna, "use_occlusion", PROP_BOOLEAN, PROP_NONE);
1665 RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_VISIBILITY_OCCLUSION);
1666 RNA_def_property_ui_text(prop, "Occlusion", "Set the object to occlude objects behind it. Initialized from the object type in physics button");
1667 RNA_def_property_update(prop, NC_LOGIC, NULL);
1669 prop= RNA_def_property(srna, "apply_to_children", PROP_BOOLEAN, PROP_NONE);
1670 RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_VISIBILITY_RECURSIVE);
1671 RNA_def_property_ui_text(prop, "Children", "Set all the children of this object to the same visibility/occlusion recursively");
1672 RNA_def_property_update(prop, NC_LOGIC, NULL);
1675 static void rna_def_twodfilter_actuator(BlenderRNA *brna)
1680 static EnumPropertyItem prop_type_items[] ={
1681 {ACT_2DFILTER_ENABLED, "ENABLE", 0, "Enable Filter", ""},
1682 {ACT_2DFILTER_DISABLED, "DISABLE", 0, "Disable Filter", ""},
1683 {ACT_2DFILTER_NOFILTER, "REMOVE", 0, "Remove Filter", ""},
1684 {ACT_2DFILTER_MOTIONBLUR, "MOTIONBLUR", 0, "Motion Blur", ""},
1685 {ACT_2DFILTER_BLUR, "BLUR", 0, "Blur", ""},
1686 {ACT_2DFILTER_SHARPEN, "SHARPEN", 0, "Sharpen", ""},
1687 {ACT_2DFILTER_DILATION, "DILATION", 0, "Dilation", ""},
1688 {ACT_2DFILTER_EROSION, "EROSION", 0, "Erosion", ""},
1689 {ACT_2DFILTER_LAPLACIAN, "LAPLACIAN", 0, "Laplacian", ""},
1690 {ACT_2DFILTER_SOBEL, "SOBEL", 0, "Sobel", ""},
1691 {ACT_2DFILTER_PREWITT, "PREWITT", 0, "Prewitt", ""},
1692 {ACT_2DFILTER_GRAYSCALE, "GRAYSCALE", 0, "Gray Scale", ""},
1693 {ACT_2DFILTER_SEPIA, "SEPIA", 0, "Sepia", ""},
1694 {ACT_2DFILTER_INVERT, "INVERT", 0, "Invert", ""},
1695 {ACT_2DFILTER_CUSTOMFILTER, "CUSTOMFILTER", 0, "Custom Filter", ""},
1696 // {ACT_2DFILTER_NUMBER_OF_FILTERS, "", 0, "Do not use it. Sentinel", ""},
1697 {0, NULL, 0, NULL, NULL}};
1699 srna= RNA_def_struct(brna, "Filter2DActuator", "Actuator");
1700 RNA_def_struct_ui_text(srna, "2D Filter Actuator", "Actuator to ..");
1701 RNA_def_struct_sdna_from(srna, "bTwoDFilterActuator", "data");
1703 prop= RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
1704 RNA_def_property_enum_sdna(prop, NULL, "type");
1705 RNA_def_property_enum_items(prop, prop_type_items);
1706 RNA_def_property_ui_text(prop, "2D Filter Type", "");
1707 RNA_def_property_update(prop, NC_LOGIC, NULL);
1709 prop= RNA_def_property(srna, "glsl_shader", PROP_POINTER, PROP_NONE);
1710 RNA_def_property_pointer_sdna(prop, NULL, "text");
1711 RNA_def_property_struct_type(prop, "Text");
1712 RNA_def_property_flag(prop, PROP_EDITABLE);
1713 RNA_def_property_ui_text(prop, "Script", "");
1714 RNA_def_property_update(prop, NC_LOGIC, NULL);
1716 prop= RNA_def_property(srna, "filter_pass", PROP_INT, PROP_NONE);
1717 RNA_def_property_int_sdna(prop, NULL, "int_arg");
1718 RNA_def_property_ui_text(prop, "Pass Number", "Set filter order");
1719 RNA_def_property_range(prop, 0, 99); //MAX_RENDER_PASS-1
1720 RNA_def_property_update(prop, NC_LOGIC, NULL);
1722 prop= RNA_def_property(srna, "motion_blur_factor", PROP_FLOAT, PROP_NONE);
1723 RNA_def_property_float_sdna(prop, NULL, "float_arg");
1724 RNA_def_property_ui_text(prop, "Value", "Set motion blur factor");
1725 RNA_def_property_range(prop, 0.0, 1.0);
1726 RNA_def_property_update(prop, NC_LOGIC, NULL);
1729 prop= RNA_def_property(srna, "use_motion_blur", PROP_BOOLEAN, PROP_NONE);
1730 RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", 1);
1731 RNA_def_property_ui_text(prop, "Enable", "Enable/Disable Motion Blur");
1732 RNA_def_property_update(prop, NC_LOGIC, NULL);
1735 static void rna_def_parent_actuator(BlenderRNA *brna)
1740 static EnumPropertyItem prop_type_items[] ={
1741 {ACT_PARENT_SET, "SETPARENT", 0, "Set Parent", ""},
1742 {ACT_PARENT_REMOVE, "REMOVEPARENT", 0, "Remove Parent", ""},
1743 {0, NULL, 0, NULL, NULL}};
1745 srna= RNA_def_struct(brna, "ParentActuator", "Actuator");
1746 RNA_def_struct_ui_text(srna, "Parent Actuator", "");
1747 RNA_def_struct_sdna_from(srna, "bParentActuator", "data");
1749 prop= RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
1750 RNA_def_property_enum_sdna(prop, NULL, "type");
1751 RNA_def_property_enum_items(prop, prop_type_items);
1752 RNA_def_property_ui_text(prop, "Scene", "");
1753 RNA_def_property_update(prop, NC_LOGIC, NULL);
1755 prop= RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
1756 RNA_def_property_struct_type(prop, "Object");
1757 RNA_def_property_pointer_sdna(prop, NULL, "ob");
1758 RNA_def_property_flag(prop, PROP_EDITABLE);
1759 RNA_def_property_ui_text(prop, "Parent Object", "Set this object as parent");
1760 RNA_def_property_update(prop, NC_LOGIC, NULL);
1763 prop= RNA_def_property(srna, "use_compound", PROP_BOOLEAN, PROP_NONE);
1764 RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_PARENT_COMPOUND);
1765 RNA_def_property_ui_text(prop, "Compound", "Add this object shape to the parent shape (only if the parent shape is already compound)");
1766 RNA_def_property_update(prop, NC_LOGIC, NULL);
1768 prop= RNA_def_property(srna, "use_ghost", PROP_BOOLEAN, PROP_NONE);
1769 RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_PARENT_GHOST);
1770 RNA_def_property_ui_text(prop, "Ghost", "Make this object ghost while parented");
1771 RNA_def_property_update(prop, NC_LOGIC, NULL);
1774 static void rna_def_shape_action_actuator(BlenderRNA *brna)
1779 static EnumPropertyItem prop_type_items[] ={
1780 {ACT_ACTION_PLAY, "PLAY", 0, "Play", ""},
1781 {ACT_ACTION_FLIPPER, "FLIPPER", 0, "Flipper", ""},
1782 {ACT_ACTION_LOOP_STOP, "LOOPSTOP", 0, "Loop Stop", ""},
1783 {ACT_ACTION_LOOP_END, "LOOPEND", 0, "Loop End", ""},
1784 {ACT_ACTION_FROM_PROP, "PROPERTY", 0, "Property", ""},
1785 #ifdef __NLA_ACTION_BY_MOTION_ACTUATOR
1786 {ACT_ACTION_MOTION, "MOTION", 0, "Displacement", ""},
1788 {0, NULL, 0, NULL, NULL}};
1790 srna= RNA_def_struct(brna, "ShapeActionActuator", "Actuator");
1791 RNA_def_struct_ui_text(srna, "Shape Action Actuator", "Actuator to control shape key animations");
1792 RNA_def_struct_sdna_from(srna, "bActionActuator", "data");
1794 prop= RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
1795 RNA_def_property_enum_sdna(prop, NULL, "type");
1796 RNA_def_property_enum_items(prop, prop_type_items);
1797 RNA_def_property_ui_text(prop, "Action type", "Action playback type");
1798 RNA_def_property_update(prop, NC_LOGIC, NULL);
1800 prop= RNA_def_property(srna, "action", PROP_POINTER, PROP_NONE);
1801 RNA_def_property_pointer_sdna(prop, NULL, "act");
1802 RNA_def_property_struct_type(prop, "Action");
1803 RNA_def_property_flag(prop, PROP_EDITABLE);
1804 RNA_def_property_ui_text(prop, "Action", "");
1805 /* note: custom set function is ONLY to avoid rna setting a user for this. */
1806 RNA_def_property_pointer_funcs(prop, NULL, "rna_Actuator_action_action_set", NULL, NULL);
1807 RNA_def_property_update(prop, NC_LOGIC, NULL);
1809 prop= RNA_def_property(srna, "use_continue_last_frame", PROP_BOOLEAN, PROP_NONE);
1810 RNA_def_property_boolean_sdna(prop, NULL, "end_reset", 1);
1811 RNA_def_property_ui_text(prop, "Continue", "Restore last frame when switching on/off, otherwise play from the start each time");
1812 RNA_def_property_update(prop, NC_LOGIC, NULL);
1814 prop= RNA_def_property(srna, "property", PROP_STRING, PROP_NONE);
1815 RNA_def_property_string_sdna(prop, NULL, "name");
1816 RNA_def_property_ui_text(prop, "Property", "Use this property to define the Action position");
1817 RNA_def_property_update(prop, NC_LOGIC, NULL);
1819 prop= RNA_def_property(srna, "frame_start", PROP_INT, PROP_NONE);
1820 RNA_def_property_int_sdna(prop, NULL, "sta");
1821 RNA_def_property_range(prop, 0, MAXFRAME);
1822 RNA_def_property_ui_text(prop, "Start frame", "");
1823 RNA_def_property_update(prop, NC_LOGIC, NULL);
1825 prop= RNA_def_property(srna, "frame_end", PROP_INT, PROP_NONE);
1826 RNA_def_property_int_sdna(prop, NULL, "end");
1827 RNA_def_property_range(prop, 0, MAXFRAME);
1828 RNA_def_property_ui_text(prop, "End frame", "");
1829 RNA_def_property_update(prop, NC_LOGIC, NULL);
1831 prop= RNA_def_property(srna, "frame_blend_in", PROP_INT, PROP_NONE);
1832 RNA_def_property_int_sdna(prop, NULL, "blendin");
1833 RNA_def_property_range(prop, 0, 32767);
1834 RNA_def_property_ui_text(prop, "Blendin", "Number of frames of motion blending");
1835 RNA_def_property_update(prop, NC_LOGIC, NULL);
1837 prop= RNA_def_property(srna, "priority", PROP_INT, PROP_NONE);
1838 RNA_def_property_range(prop, 0, 100);
1839 RNA_def_property_ui_text(prop, "Priority", "Execution priority - lower numbers will override actions with higher numbers. With 2 or more actions at once, the overriding channels must be lower in the stack");
1840 RNA_def_property_update(prop, NC_LOGIC, NULL);
1842 prop= RNA_def_property(srna, "frame_property", PROP_STRING, PROP_NONE);
1843 RNA_def_property_string_sdna(prop, NULL, "frameProp");
1844 RNA_def_property_ui_text(prop, "Frame Property", "Assign the action's current frame number to this property");
1845 RNA_def_property_update(prop, NC_LOGIC, NULL);
1847 #ifdef __NLA_ACTION_BY_MOTION_ACTUATOR
1848 prop= RNA_def_property(srna, "stride_length", PROP_FLOAT, PROP_NONE);
1849 RNA_def_property_float_sdna(prop, NULL, "stridelength");
1850 RNA_def_property_range(prop, 0.0, 2500.0);
1851 RNA_def_property_ui_text(prop, "Cycle", "Distance covered by a single cycle of the action");
1852 RNA_def_property_update(prop, NC_LOGIC, NULL);
1856 static void rna_def_state_actuator(BlenderRNA *brna)
1861 static EnumPropertyItem prop_type_items[] ={
1862 {ACT_STATE_SET, "SET", 0, "Set State", ""},
1863 {ACT_STATE_ADD, "ADD", 0, "Add State", ""},
1864 {ACT_STATE_REMOVE, "REMOVE", 0, "Remove State", ""},
1865 {ACT_STATE_CHANGE, "CHANGE", 0, "Change State", ""},
1866 {0, NULL, 0, NULL, NULL}};
1868 srna= RNA_def_struct(brna, "StateActuator", "Actuator");
1869 RNA_def_struct_ui_text(srna, "State Actuator", "Actuator to handle states");
1870 RNA_def_struct_sdna_from(srna, "bStateActuator", "data");
1872 prop= RNA_def_property(srna, "operation", PROP_ENUM, PROP_NONE);
1873 RNA_def_property_enum_sdna(prop, NULL, "type");
1874 RNA_def_property_enum_items(prop, prop_type_items);
1875 RNA_def_property_ui_text(prop, "Operation", "Select the bit operation on object state mask");
1876 RNA_def_property_update(prop, NC_LOGIC, NULL);
1878 prop= RNA_def_property(srna, "states", PROP_BOOLEAN, PROP_LAYER_MEMBER);
1879 RNA_def_property_boolean_sdna(prop, NULL, "mask", 1);
1880 RNA_def_property_array(prop, OB_MAX_STATES);
1881 RNA_def_property_ui_text(prop, "State", "");
1882 RNA_def_property_boolean_funcs(prop, NULL, "rna_StateActuator_state_set");
1885 static void rna_def_armature_actuator(BlenderRNA *brna)
1890 static EnumPropertyItem prop_type_items[] ={
1891 {ACT_ARM_RUN, "RUN", 0, "Run Armature", ""},
1892 {ACT_ARM_ENABLE, "ENABLE", 0, "Enable", ""},
1893 {ACT_ARM_DISABLE, "DISABLE", 0, "Disable", ""},
1894 {ACT_ARM_SETTARGET, "SETTARGET", 0, "Set Target", ""},
1895 {ACT_ARM_SETWEIGHT, "SETWEIGHT", 0, "Set Weight", ""},
1896 {0, NULL, 0, NULL, NULL}};
1898 srna= RNA_def_struct(brna, "ArmatureActuator", "Actuator");
1899 RNA_def_struct_ui_text(srna, "Armature Actuator", "Actuator to ..");
1900 RNA_def_struct_sdna_from(srna, "bArmatureActuator", "data");
1902 prop= RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
1903 RNA_def_property_enum_sdna(prop, NULL, "type");
1904 RNA_def_property_enum_items(prop, prop_type_items);
1905 RNA_def_property_ui_text(prop, "Constraint Type", "");
1906 RNA_def_property_update(prop, NC_LOGIC, NULL);
1908 prop= RNA_def_property(srna, "bone", PROP_STRING, PROP_NONE);
1909 RNA_def_property_string_sdna(prop, NULL, "posechannel");
1910 RNA_def_property_ui_text(prop, "Bone", "Bone on which the constraint is defined");
1911 RNA_def_property_update(prop, NC_LOGIC, "rna_Actuator_Armature_update");
1913 prop= RNA_def_property(srna, "constraint", PROP_STRING, PROP_NONE);
1914 RNA_def_property_string_sdna(prop, NULL, "constraint");
1915 RNA_def_property_ui_text(prop, "Constraint", "Name of the constraint you want to control");
1916 RNA_def_property_update(prop, NC_LOGIC, "rna_Actuator_Armature_update");
1918 prop= RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
1919 RNA_def_property_struct_type(prop, "Object");
1920 RNA_def_property_flag(prop, PROP_EDITABLE);
1921 RNA_def_property_ui_text(prop, "Target", "Set this object as the target of the constraint");
1922 RNA_def_property_update(prop, NC_LOGIC, NULL);
1924 prop= RNA_def_property(srna, "secondary_target", PROP_POINTER, PROP_NONE);
1925 RNA_def_property_pointer_sdna(prop, NULL, "subtarget");
1926 RNA_def_property_struct_type(prop, "Object");
1927 RNA_def_property_flag(prop, PROP_EDITABLE);
1928 RNA_def_property_ui_text(prop, "Secondary Target", "Set weight of this constraint");
1929 RNA_def_property_update(prop, NC_LOGIC, NULL);
1931 prop= RNA_def_property(srna, "weight", PROP_FLOAT, PROP_NONE);
1932 RNA_def_property_float_sdna(prop, NULL, "weight");
1933 RNA_def_property_range(prop, 0.0, 1.0);
1934 RNA_def_property_ui_text(prop, "Weight", "Set weight of this constraint");
1935 RNA_def_property_update(prop, NC_LOGIC, NULL);
1938 void RNA_def_actuator(BlenderRNA *brna)
1940 rna_def_actuator(brna);
1942 rna_def_action_actuator(brna);
1943 rna_def_object_actuator(brna);
1944 rna_def_fcurve_actuator(brna);
1945 rna_def_camera_actuator(brna);
1946 rna_def_sound_actuator(brna);
1947 rna_def_property_actuator(brna);
1948 rna_def_constraint_actuator(brna);
1949 rna_def_edit_object_actuator(brna);
1950 rna_def_scene_actuator(brna);
1951 rna_def_random_actuator(brna);
1952 rna_def_message_actuator(brna);
1953 rna_def_game_actuator(brna);
1954 rna_def_visibility_actuator(brna);
1955 rna_def_twodfilter_actuator(brna);
1956 rna_def_parent_actuator(brna);
1957 rna_def_shape_action_actuator(brna);
1958 rna_def_state_actuator(brna);
1959 rna_def_armature_actuator(brna);