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 *****
25 /** \file blender/makesrna/intern/rna_actuator.c
32 #include "RNA_define.h"
33 #include "RNA_access.h"
35 #include "rna_internal.h"
36 #include "DNA_constraint_types.h"
37 #include "DNA_object_types.h"
38 #include "DNA_actuator_types.h"
39 #include "DNA_scene_types.h" // for MAXFRAME
43 #include "BLI_utildefines.h"
45 /* Always keep in alphabetical order */
46 EnumPropertyItem actuator_type_items[] ={
47 {ACT_ACTION, "ACTION", 0, "Action", ""},
48 {ACT_ARMATURE, "ARMATURE", 0, "Armature", ""},
49 {ACT_CAMERA, "CAMERA", 0, "Camera", ""},
50 {ACT_CONSTRAINT, "CONSTRAINT", 0, "Constraint", ""},
51 {ACT_EDIT_OBJECT, "EDIT_OBJECT", 0, "Edit Object", ""},
52 {ACT_IPO, "FCURVE", 0, "F-Curve", ""},
53 {ACT_2DFILTER, "FILTER_2D", 0, "Filter 2D", ""},
54 {ACT_GAME, "GAME", 0, "Game", ""},
55 {ACT_MESSAGE, "MESSAGE", 0, "Message", ""},
56 {ACT_OBJECT, "MOTION", 0, "Motion", ""},
57 {ACT_PARENT, "PARENT", 0, "Parent", ""},
58 {ACT_PROPERTY, "PROPERTY", 0, "Property", ""},
59 {ACT_RANDOM, "RANDOM", 0, "Random", ""},
60 {ACT_SCENE, "SCENE", 0, "Scene", ""},
61 {ACT_SHAPEACTION, "SHAPE_ACTION", 0, "Shape Action", ""},
62 {ACT_SOUND, "SOUND", 0, "Sound", ""},
63 {ACT_STATE, "STATE", 0, "State", ""},
64 {ACT_VISIBILITY, "VISIBILITY", 0, "Visibility", ""},
65 {0, NULL, 0, NULL, NULL}};
71 static StructRNA* rna_Actuator_refine(struct PointerRNA *ptr)
73 bActuator *actuator= (bActuator*)ptr->data;
75 switch(actuator->type) {
77 return &RNA_ActionActuator;
79 return &RNA_ObjectActuator;
81 return &RNA_FCurveActuator;
83 return &RNA_CameraActuator;
85 return &RNA_SoundActuator;
87 return &RNA_PropertyActuator;
89 return &RNA_ConstraintActuator;
91 return &RNA_EditObjectActuator;
93 return &RNA_SceneActuator;
95 return &RNA_RandomActuator;
97 return &RNA_MessageActuator;
99 return &RNA_GameActuator;
101 return &RNA_VisibilityActuator;
103 return &RNA_Filter2DActuator;
105 return &RNA_ParentActuator;
106 case ACT_SHAPEACTION:
107 return &RNA_ShapeActionActuator;
109 return &RNA_StateActuator;
111 return &RNA_ArmatureActuator;
113 return &RNA_Actuator;
117 static void rna_Actuator_type_set(struct PointerRNA *ptr, int value)
119 bActuator *act= (bActuator *)ptr->data;
120 if (value != act->type)
127 static void rna_ConstraintActuator_type_set(struct PointerRNA *ptr, int value)
129 bActuator *act= (bActuator *)ptr->data;
130 bConstraintActuator *ca= act->data;
131 if (value != ca->type)
135 case ACT_CONST_TYPE_ORI:
136 /* negative axis not supported in the orientation mode */
137 if (ELEM3(ca->mode, ACT_CONST_DIRNX,ACT_CONST_DIRNY, ACT_CONST_DIRNZ))
138 ca->mode = ACT_CONST_NONE;
141 case ACT_CONST_TYPE_LOC:
142 case ACT_CONST_TYPE_DIST:
143 case ACT_CONST_TYPE_FH:
150 static float rna_ConstraintActuator_limitmin_get(struct PointerRNA *ptr)
152 bActuator *act = (bActuator*)ptr->data;
153 bConstraintActuator *ca = act->data;
156 if(ca->flag & ACT_CONST_LOCX) fp= ca->minloc;
157 else if(ca->flag & ACT_CONST_LOCY) fp= ca->minloc+1;
158 else if(ca->flag & ACT_CONST_LOCZ) fp= ca->minloc+2;
159 else if(ca->flag & ACT_CONST_ROTX) fp= ca->minrot;
160 else if(ca->flag & ACT_CONST_ROTY) fp= ca->minrot+1;
161 else fp= ca->minrot+2;
166 static void rna_ConstraintActuator_limitmin_set(struct PointerRNA *ptr, float value)
168 bActuator *act = (bActuator*)ptr->data;
169 bConstraintActuator *ca = act->data;
172 if(ca->flag & ACT_CONST_LOCX) fp= ca->minloc;
173 else if(ca->flag & ACT_CONST_LOCY) fp= ca->minloc+1;
174 else if(ca->flag & ACT_CONST_LOCZ) fp= ca->minloc+2;
175 else if(ca->flag & ACT_CONST_ROTX) fp= ca->minrot;
176 else if(ca->flag & ACT_CONST_ROTY) fp= ca->minrot+1;
177 else fp= ca->minrot+2;
182 static float rna_ConstraintActuator_limitmax_get(struct PointerRNA *ptr)
184 bActuator *act = (bActuator*)ptr->data;
185 bConstraintActuator *ca = act->data;
188 if(ca->flag & ACT_CONST_LOCX) fp= ca->maxloc;
189 else if(ca->flag & ACT_CONST_LOCY) fp= ca->maxloc+1;
190 else if(ca->flag & ACT_CONST_LOCZ) fp= ca->maxloc+2;
191 else if(ca->flag & ACT_CONST_ROTX) fp= ca->maxrot;
192 else if(ca->flag & ACT_CONST_ROTY) fp= ca->maxrot+1;
193 else fp= ca->maxrot+2;
198 static void rna_ConstraintActuator_limitmax_set(struct PointerRNA *ptr, float value)
200 bActuator *act = (bActuator*)ptr->data;
201 bConstraintActuator *ca = act->data;
204 if(ca->flag & ACT_CONST_LOCX) fp= ca->maxloc;
205 else if(ca->flag & ACT_CONST_LOCY) fp= ca->maxloc+1;
206 else if(ca->flag & ACT_CONST_LOCZ) fp= ca->maxloc+2;
207 else if(ca->flag & ACT_CONST_ROTX) fp= ca->maxrot;
208 else if(ca->flag & ACT_CONST_ROTY) fp= ca->maxrot+1;
209 else fp= ca->maxrot+2;
214 static float rna_ConstraintActuator_distance_get(struct PointerRNA *ptr)
216 bActuator *act = (bActuator*)ptr->data;
217 bConstraintActuator *ca = act->data;
220 if(ca->mode & (ACT_CONST_DIRPX|ACT_CONST_DIRNX)) fp= ca->minloc;
221 else if(ca->mode & (ACT_CONST_DIRPY|ACT_CONST_DIRNY)) fp= ca->minloc+1;
222 else fp= ca->minloc+2;
227 static void rna_ConstraintActuator_distance_set(struct PointerRNA *ptr, float value)
229 bActuator *act = (bActuator*)ptr->data;
230 bConstraintActuator *ca = act->data;
233 if(ca->mode & (ACT_CONST_DIRPX|ACT_CONST_DIRNX)) fp= ca->minloc;
234 else if(ca->mode & (ACT_CONST_DIRPY|ACT_CONST_DIRNY)) fp= ca->minloc+1;
235 else fp= ca->minloc+2;
240 static float rna_ConstraintActuator_range_get(struct PointerRNA *ptr)
242 bActuator *act = (bActuator*)ptr->data;
243 bConstraintActuator *ca = act->data;
246 if(ca->mode & (ACT_CONST_DIRPX|ACT_CONST_DIRNX)) fp= ca->maxloc;
247 else if(ca->mode & (ACT_CONST_DIRPY|ACT_CONST_DIRNY)) fp= ca->maxloc+1;
248 else fp= ca->maxloc+2;
253 static void rna_ConstraintActuator_range_set(struct PointerRNA *ptr, float value)
255 bActuator *act = (bActuator*)ptr->data;
256 bConstraintActuator *ca = act->data;
259 if(ca->mode & (ACT_CONST_DIRPX|ACT_CONST_DIRNX)) fp= ca->maxloc;
260 else if(ca->mode & (ACT_CONST_DIRPY|ACT_CONST_DIRNY)) fp= ca->maxloc+1;
261 else fp= ca->maxloc+2;
266 static float rna_ConstraintActuator_fhheight_get(struct PointerRNA *ptr)
268 bActuator *act = (bActuator*)ptr->data;
269 bConstraintActuator *ca = act->data;
272 if(ca->mode & (ACT_CONST_DIRPX|ACT_CONST_DIRNX)) fp= ca->minloc;
273 else if(ca->mode & (ACT_CONST_DIRPY|ACT_CONST_DIRNY)) fp= ca->minloc+1;
274 else fp= ca->minloc+2;
279 static void rna_ConstraintActuator_fhheight_set(struct PointerRNA *ptr, float value)
281 bActuator *act = (bActuator*)ptr->data;
282 bConstraintActuator *ca = act->data;
285 if(ca->mode & (ACT_CONST_DIRPX|ACT_CONST_DIRNX)) fp= ca->minloc;
286 else if(ca->mode & (ACT_CONST_DIRPY|ACT_CONST_DIRNY)) fp= ca->minloc+1;
287 else fp= ca->minloc+2;
292 static float rna_ConstraintActuator_spring_get(struct PointerRNA *ptr)
294 bActuator *act = (bActuator*)ptr->data;
295 bConstraintActuator *ca = act->data;
298 if(ca->mode & (ACT_CONST_DIRPX|ACT_CONST_DIRNX)) fp= ca->maxloc;
299 else if(ca->mode & (ACT_CONST_DIRPY|ACT_CONST_DIRNY)) fp= ca->maxloc+1;
300 else fp= ca->maxloc+2;
305 static void rna_ConstraintActuator_spring_set(struct PointerRNA *ptr, float value)
307 bActuator *act = (bActuator*)ptr->data;
308 bConstraintActuator *ca = act->data;
311 if(ca->mode & (ACT_CONST_DIRPX|ACT_CONST_DIRNX)) fp= ca->maxloc;
312 else if(ca->mode & (ACT_CONST_DIRPY|ACT_CONST_DIRNY)) fp= ca->maxloc+1;
313 else fp= ca->maxloc+2;
317 /* ConstraintActuator uses the same property for Material and Property.
318 Therefore we need to clear the property when "use_material_detect" mode changes */
319 static void rna_Actuator_constraint_detect_material_set(struct PointerRNA *ptr, int value)
321 bActuator *act = (bActuator*)ptr->data;
322 bConstraintActuator *ca = act->data;
324 short old_value = (ca->flag & ACT_CONST_MATERIAL? 1:0);
326 if (old_value != value) {
327 ca->flag ^= ACT_CONST_MATERIAL;
328 ca->matprop[0] = '\0';
332 static void rna_FcurveActuator_add_set(struct PointerRNA *ptr, int value)
334 bActuator *act = (bActuator *)ptr->data;
335 bIpoActuator *ia = act->data;
338 ia->flag &= ~ACT_IPOFORCE;
339 ia->flag |= ACT_IPOADD;
341 ia->flag &= ~ACT_IPOADD;
344 static void rna_FcurveActuator_force_set(struct PointerRNA *ptr, int value)
346 bActuator *act = (bActuator *)ptr->data;
347 bIpoActuator *ia = act->data;
350 ia->flag &= ~ACT_IPOADD;
351 ia->flag |= ACT_IPOFORCE;
353 ia->flag &= ~ACT_IPOFORCE;
357 static void rna_ObjectActuator_type_set(struct PointerRNA *ptr, int value)
359 bActuator *act= (bActuator *)ptr->data;
360 bObjectActuator *oa = act->data;
361 if (value != oa->type)
365 case ACT_OBJECT_NORMAL:
366 memset(oa, 0, sizeof(bObjectActuator));
367 oa->flag = ACT_FORCE_LOCAL|ACT_TORQUE_LOCAL|ACT_DLOC_LOCAL|ACT_DROT_LOCAL;
368 oa->type = ACT_OBJECT_NORMAL;
371 case ACT_OBJECT_SERVO:
372 memset(oa, 0, sizeof(bObjectActuator));
373 oa->flag = ACT_LIN_VEL_LOCAL;
374 oa->type = ACT_OBJECT_SERVO;
375 oa->forcerot[0] = 30.0f;
376 oa->forcerot[1] = 0.5f;
377 oa->forcerot[2] = 0.0f;
383 static void rna_ObjectActuator_integralcoefficient_set(struct PointerRNA *ptr, float value)
385 bActuator *act = (bActuator*)ptr->data;
386 bObjectActuator *oa = act->data;
388 oa->forcerot[1] = value;
389 oa->forcerot[0] = 60.0f*oa->forcerot[1];
392 static void rna_StateActuator_state_set(PointerRNA *ptr, const int *values)
394 bActuator *act = (bActuator*)ptr->data;
395 bStateActuator *sa = act->data;
399 /* ensure we always have some state selected */
400 for(i=0; i<OB_MAX_STATES; i++)
407 for(i=0; i<OB_MAX_STATES; i++) {
408 if(values[i]) sa->mask |= (1<<i);
409 else sa->mask &= ~(1<<i);
413 /* Always keep in alphabetical order */
414 EnumPropertyItem *rna_Actuator_type_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *free)
416 EnumPropertyItem *item= NULL;
420 if (ptr->type==&RNA_Actuator || RNA_struct_is_a(ptr->type, &RNA_Actuator)){
421 ob = (Object *)ptr->id.data;
423 /* can't use ob from ptr->id.data because that enum is also used by operators */
424 ob = CTX_data_active_object(C);
428 if (ob->type==OB_ARMATURE) {
429 RNA_enum_items_add_value(&item, &totitem, actuator_type_items, ACT_ARMATURE);
433 RNA_enum_items_add_value(&item, &totitem, actuator_type_items, ACT_ACTION);
434 RNA_enum_items_add_value(&item, &totitem, actuator_type_items, ACT_CAMERA);
435 RNA_enum_items_add_value(&item, &totitem, actuator_type_items, ACT_CONSTRAINT);
436 RNA_enum_items_add_value(&item, &totitem, actuator_type_items, ACT_EDIT_OBJECT);
437 RNA_enum_items_add_value(&item, &totitem, actuator_type_items, ACT_IPO);
438 RNA_enum_items_add_value(&item, &totitem, actuator_type_items, ACT_2DFILTER);
439 RNA_enum_items_add_value(&item, &totitem, actuator_type_items, ACT_GAME);
440 RNA_enum_items_add_value(&item, &totitem, actuator_type_items, ACT_MESSAGE);
441 RNA_enum_items_add_value(&item, &totitem, actuator_type_items, ACT_OBJECT);
442 RNA_enum_items_add_value(&item, &totitem, actuator_type_items, ACT_PARENT);
443 RNA_enum_items_add_value(&item, &totitem, actuator_type_items, ACT_PROPERTY);
444 RNA_enum_items_add_value(&item, &totitem, actuator_type_items, ACT_RANDOM);
445 RNA_enum_items_add_value(&item, &totitem, actuator_type_items, ACT_SCENE);
448 if (ob->type==OB_MESH){
449 RNA_enum_items_add_value(&item, &totitem, actuator_type_items, ACT_SHAPEACTION);
453 RNA_enum_items_add_value(&item, &totitem, actuator_type_items, ACT_SOUND);
454 RNA_enum_items_add_value(&item, &totitem, actuator_type_items, ACT_STATE);
455 RNA_enum_items_add_value(&item, &totitem, actuator_type_items, ACT_VISIBILITY);
457 RNA_enum_item_end(&item, &totitem);
463 static void rna_Actuator_Armature_update(Main *bmain, Scene *scene, PointerRNA *ptr)
465 bActuator *act= (bActuator *)ptr->data;
466 bArmatureActuator *aa = act->data;
467 Object *ob = (Object *)ptr->id.data;
469 char *posechannel= aa->posechannel;
470 char *constraint= aa->constraint;
472 /* check that bone exist in the active object */
473 if (ob->type == OB_ARMATURE && ob->pose) {
475 bPose *pose = ob->pose;
476 for (pchan=pose->chanbase.first; pchan; pchan=pchan->next) {
477 if (!strcmp(pchan->name, posechannel)) {
478 /* found it, now look for constraint channel */
480 for (con=pchan->constraints.first; con; con=con->next) {
481 if (!strcmp(con->name, constraint)) {
482 /* found it, all ok */
486 /* didn't find constraint, make empty */
492 /* didn't find any */
497 /* note: the following set functions exists only to avoid id refcounting */
498 static void rna_Actuator_editobject_mesh_set(PointerRNA *ptr, PointerRNA value)
500 bActuator *act = (bActuator *)ptr->data;
501 bEditObjectActuator *eoa = (bEditObjectActuator *) act->data;
503 eoa->me = value.data;
506 static void rna_Actuator_action_action_set(PointerRNA *ptr, PointerRNA value)
508 bActuator *act = (bActuator *)ptr->data;
509 bActionActuator *aa = (bActionActuator *) act->data;
511 aa->act = value.data;
516 void rna_def_actuator(BlenderRNA *brna)
521 srna= RNA_def_struct(brna, "Actuator", NULL);
522 RNA_def_struct_ui_text(srna, "Actuator", "Actuator to apply actions in the game engine");
523 RNA_def_struct_sdna(srna, "bActuator");
524 RNA_def_struct_refine_func(srna, "rna_Actuator_refine");
526 prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
527 RNA_def_property_ui_text(prop, "Name", "");
528 RNA_def_struct_name_property(srna, prop);
530 prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
531 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
532 RNA_def_property_enum_items(prop, actuator_type_items);
533 RNA_def_property_enum_funcs(prop, NULL, "rna_Actuator_type_set", "rna_Actuator_type_itemf");
534 RNA_def_property_ui_text(prop, "Type", "");
536 prop= RNA_def_property(srna, "pin", PROP_BOOLEAN, PROP_NONE);
537 RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_PIN);
538 RNA_def_property_ui_text(prop, "Pinned", "Display when not linked to a visible states controller");
539 RNA_def_property_ui_icon(prop, ICON_UNPINNED, 1);
540 RNA_def_property_update(prop, NC_LOGIC, NULL);
542 prop= RNA_def_property(srna, "show_expanded", PROP_BOOLEAN, PROP_NONE);
543 RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_SHOW);
544 RNA_def_property_ui_text(prop, "Expanded", "Set actuator expanded in the user interface");
545 RNA_def_property_ui_icon(prop, ICON_TRIA_RIGHT, 1);
547 RNA_api_actuator(srna);
550 static void rna_def_action_actuator(BlenderRNA *brna)
555 static EnumPropertyItem prop_type_items[] ={
556 {ACT_ACTION_PLAY, "PLAY", 0, "Play", ""},
557 {ACT_ACTION_PINGPONG, "PINGPONG", 0, "Ping Pong", ""},
558 {ACT_ACTION_FLIPPER, "FLIPPER", 0, "Flipper", ""},
559 {ACT_ACTION_LOOP_STOP, "LOOPSTOP", 0, "Loop Stop", ""},
560 {ACT_ACTION_LOOP_END, "LOOPEND", 0, "Loop End", ""},
561 {ACT_ACTION_FROM_PROP, "PROPERTY", 0, "Property", ""},
562 #ifdef __NLA_ACTION_BY_MOTION_ACTUATOR
563 {ACT_ACTION_MOTION, "MOTION", 0, "Displacement", ""},
565 {0, NULL, 0, NULL, NULL}};
567 srna= RNA_def_struct(brna, "ActionActuator", "Actuator");
568 RNA_def_struct_ui_text(srna, "Action Actuator", "Actuator to control the object movement");
569 RNA_def_struct_sdna_from(srna, "bActionActuator", "data");
571 prop= RNA_def_property(srna, "play_mode", PROP_ENUM, PROP_NONE);
572 RNA_def_property_enum_sdna(prop, NULL, "type");
573 RNA_def_property_enum_items(prop, prop_type_items);
574 RNA_def_property_ui_text(prop, "Action Type", "Action playback type");
575 RNA_def_property_update(prop, NC_LOGIC, NULL);
577 prop= RNA_def_property(srna, "action", PROP_POINTER, PROP_NONE);
578 RNA_def_property_pointer_sdna(prop, NULL, "act");
579 RNA_def_property_struct_type(prop, "Action");
580 RNA_def_property_flag(prop, PROP_EDITABLE);
581 RNA_def_property_ui_text(prop, "Action", "");
582 /* note: custom set function is ONLY to avoid rna setting a user for this. */
583 RNA_def_property_pointer_funcs(prop, NULL, "rna_Actuator_action_action_set", NULL, NULL);
584 RNA_def_property_update(prop, NC_LOGIC, NULL);
586 prop= RNA_def_property(srna, "use_continue_last_frame", PROP_BOOLEAN, PROP_NONE);
587 RNA_def_property_boolean_negative_sdna(prop, NULL, "end_reset", 1);
588 RNA_def_property_ui_text(prop, "Continue", "Restore last frame when switching on/off, otherwise play from the start each time");
589 RNA_def_property_update(prop, NC_LOGIC, NULL);
591 prop= RNA_def_property(srna, "property", PROP_STRING, PROP_NONE);
592 RNA_def_property_string_sdna(prop, NULL, "name");
593 RNA_def_property_ui_text(prop, "Property", "Use this property to define the Action position");
594 RNA_def_property_update(prop, NC_LOGIC, NULL);
596 prop= RNA_def_property(srna, "frame_start", PROP_FLOAT, PROP_NONE);
597 RNA_def_property_float_sdna(prop, NULL, "sta");
598 RNA_def_property_ui_range(prop, 0.0, MAXFRAME, 100, 2);
599 RNA_def_property_ui_text(prop, "Start Frame", "");
600 RNA_def_property_update(prop, NC_LOGIC, NULL);
602 prop= RNA_def_property(srna, "frame_end", PROP_FLOAT, PROP_NONE);
603 RNA_def_property_float_sdna(prop, NULL, "end");
604 RNA_def_property_ui_range(prop, 0.0, MAXFRAME, 100, 2);
605 RNA_def_property_ui_text(prop, "End Frame", "");
606 RNA_def_property_update(prop, NC_LOGIC, NULL);
608 prop= RNA_def_property(srna, "frame_blend_in", PROP_INT, PROP_NONE);
609 RNA_def_property_int_sdna(prop, NULL, "blendin");
610 RNA_def_property_range(prop, 0, 32767);
611 RNA_def_property_ui_text(prop, "Blendin", "Number of frames of motion blending");
612 RNA_def_property_update(prop, NC_LOGIC, NULL);
614 prop= RNA_def_property(srna, "priority", PROP_INT, PROP_NONE);
615 RNA_def_property_range(prop, 0, 100);
616 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");
617 RNA_def_property_update(prop, NC_LOGIC, NULL);
619 prop= RNA_def_property(srna, "frame_property", PROP_STRING, PROP_NONE);
620 RNA_def_property_string_sdna(prop, NULL, "frameProp");
621 RNA_def_property_ui_text(prop, "Frame Property", "Assign the action's current frame number to this property");
622 RNA_def_property_update(prop, NC_LOGIC, NULL);
624 #ifdef __NLA_ACTION_BY_MOTION_ACTUATOR
625 prop= RNA_def_property(srna, "stride_length", PROP_FLOAT, PROP_NONE);
626 RNA_def_property_float_sdna(prop, NULL, "stridelength");
627 RNA_def_property_range(prop, 0.0, 2500.0);
628 RNA_def_property_ui_text(prop, "Cycle", "Distance covered by a single cycle of the action");
629 RNA_def_property_update(prop, NC_LOGIC, NULL);
633 static void rna_def_object_actuator(BlenderRNA *brna)
638 static EnumPropertyItem prop_type_items[] ={
639 {ACT_OBJECT_NORMAL, "OBJECT_NORMAL", 0, "Simple Motion", ""},
640 {ACT_OBJECT_SERVO, "OBJECT_SERVO", 0, "Servo Control", ""},
641 {0, NULL, 0, NULL, NULL}};
643 srna= RNA_def_struct(brna, "ObjectActuator", "Actuator");
644 RNA_def_struct_ui_text(srna, "Motion Actuator", "Actuator to control the object movement");
645 RNA_def_struct_sdna_from(srna, "bObjectActuator", "data");
648 prop= RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
649 RNA_def_property_enum_sdna(prop, NULL, "type");
650 RNA_def_property_enum_items(prop, prop_type_items);
651 RNA_def_property_enum_funcs(prop, NULL, "rna_ObjectActuator_type_set", NULL);
652 RNA_def_property_ui_text(prop, "Motion Type", "Specify the motion system");
653 RNA_def_property_update(prop, NC_LOGIC, NULL);
655 prop= RNA_def_property(srna, "reference_object", PROP_POINTER, PROP_NONE);
656 RNA_def_property_struct_type(prop, "Object");
657 RNA_def_property_pointer_sdna(prop, NULL, "reference");
658 RNA_def_property_flag(prop, PROP_EDITABLE);
659 RNA_def_property_ui_text(prop, "Reference Object", "Reference object for velocity calculation, leave empty for world reference");
660 RNA_def_property_update(prop, NC_LOGIC, NULL);
662 prop= RNA_def_property(srna, "damping", PROP_INT, PROP_NONE);
663 RNA_def_property_ui_range(prop, 0, 1000, 1, 1);
664 RNA_def_property_ui_text(prop, "Damping Frames", "Number of frames to reach the target velocity");
665 RNA_def_property_update(prop, NC_LOGIC, NULL);
667 prop= RNA_def_property(srna, "proportional_coefficient", PROP_FLOAT, PROP_NONE);
668 RNA_def_property_float_sdna(prop, NULL, "forcerot[0]");
669 RNA_def_property_ui_range(prop, 0.0, 200.0, 10, 2);
670 RNA_def_property_ui_text(prop, "Proportional Coefficient", "Typical value is 60x integral coefficient");
671 RNA_def_property_update(prop, NC_LOGIC, NULL);
673 prop= RNA_def_property(srna, "integral_coefficient", PROP_FLOAT, PROP_NONE);
674 RNA_def_property_float_sdna(prop, NULL, "forcerot[1]");
675 RNA_def_property_ui_range(prop, 0.0, 3.0, 10, 2);
676 RNA_def_property_float_funcs(prop, NULL, "rna_ObjectActuator_integralcoefficient_set", NULL);
677 RNA_def_property_ui_text(prop, "Integral Coefficient", "Low value (0.01) for slow response, high value (0.5) for fast response");
678 RNA_def_property_update(prop, NC_LOGIC, NULL);
680 prop= RNA_def_property(srna, "derivate_coefficient", PROP_FLOAT, PROP_NONE);
681 RNA_def_property_float_sdna(prop, NULL, "forcerot[2]");
682 RNA_def_property_ui_range(prop, -100.0, 100.0, 10, 2);
683 RNA_def_property_ui_text(prop, "Derivate Coefficient", "Not required, high values can cause instability");
684 RNA_def_property_update(prop, NC_LOGIC, NULL);
687 prop= RNA_def_property(srna, "force_max_x", PROP_FLOAT, PROP_NONE);
688 RNA_def_property_float_sdna(prop, NULL, "dloc[0]");
689 RNA_def_property_ui_range(prop, -100.0, 100.0, 1, 2);
690 RNA_def_property_ui_text(prop, "Max", "Set the upper limit for force");
691 RNA_def_property_update(prop, NC_LOGIC, NULL);
693 prop= RNA_def_property(srna, "force_min_x", PROP_FLOAT, PROP_NONE);
694 RNA_def_property_float_sdna(prop, NULL, "drot[0]");
695 RNA_def_property_ui_range(prop, -100.0, 100.0, 1, 2);
696 RNA_def_property_ui_text(prop, "Min", "Set the lower limit for force");
697 RNA_def_property_update(prop, NC_LOGIC, NULL);
699 prop= RNA_def_property(srna, "force_max_y", PROP_FLOAT, PROP_NONE);
700 RNA_def_property_float_sdna(prop, NULL, "dloc[1]");
701 RNA_def_property_ui_range(prop, -100.0, 100.0, 1, 2);
702 RNA_def_property_ui_text(prop, "Max", "Set the upper limit for force");
703 RNA_def_property_update(prop, NC_LOGIC, NULL);
705 prop= RNA_def_property(srna, "force_min_y", PROP_FLOAT, PROP_NONE);
706 RNA_def_property_float_sdna(prop, NULL, "drot[1]");
707 RNA_def_property_ui_range(prop, -100.0, 100.0, 1, 2);
708 RNA_def_property_ui_text(prop, "Min", "Set the lower limit for force");
709 RNA_def_property_update(prop, NC_LOGIC, NULL);
711 prop= RNA_def_property(srna, "force_max_z", PROP_FLOAT, PROP_NONE);
712 RNA_def_property_float_sdna(prop, NULL, "dloc[2]");
713 RNA_def_property_ui_range(prop, -100.0, 100.0, 1, 2);
714 RNA_def_property_ui_text(prop, "Max", "Set the upper limit for force");
715 RNA_def_property_update(prop, NC_LOGIC, NULL);
717 prop= RNA_def_property(srna, "force_min_z", PROP_FLOAT, PROP_NONE);
718 RNA_def_property_float_sdna(prop, NULL, "drot[2]");
719 RNA_def_property_ui_range(prop, -100.0, 100.0, 1, 2);
720 RNA_def_property_ui_text(prop, "Min", "Set the lower limit for force");
721 RNA_def_property_update(prop, NC_LOGIC, NULL);
724 prop= RNA_def_property(srna, "offset_location", PROP_FLOAT, PROP_XYZ);
725 RNA_def_property_float_sdna(prop, NULL, "dloc");
726 RNA_def_property_array(prop, 3);
727 RNA_def_property_ui_range(prop, -10000.0, 10000.0, 10, 2);
728 RNA_def_property_ui_text(prop, "Loc", "Sets the location");
729 RNA_def_property_update(prop, NC_LOGIC, NULL);
731 prop= RNA_def_property(srna, "offset_rotation", PROP_FLOAT, PROP_EULER);
732 RNA_def_property_float_sdna(prop, NULL, "drot");
733 RNA_def_property_array(prop, 3);
734 RNA_def_property_ui_range(prop, -10000.0, 10000.0, 10, 2);
735 RNA_def_property_ui_text(prop, "Rot", "Sets the rotation");
736 RNA_def_property_update(prop, NC_LOGIC, NULL);
738 prop= RNA_def_property(srna, "force", PROP_FLOAT, PROP_XYZ);
739 RNA_def_property_float_sdna(prop, NULL, "forceloc");
740 RNA_def_property_array(prop, 3);
741 RNA_def_property_ui_range(prop, -10000.0, 10000.0, 10, 2);
742 RNA_def_property_ui_text(prop, "Force", "Sets the force");
743 RNA_def_property_update(prop, NC_LOGIC, NULL);
745 prop= RNA_def_property(srna, "torque", PROP_FLOAT, PROP_XYZ);
746 RNA_def_property_float_sdna(prop, NULL, "forcerot");
747 RNA_def_property_array(prop, 3);
748 RNA_def_property_ui_range(prop, -10000.0, 10000.0, 10, 2);
749 RNA_def_property_ui_text(prop, "Torque", "Sets the torque");
750 RNA_def_property_update(prop, NC_LOGIC, NULL);
752 prop= RNA_def_property(srna, "linear_velocity", PROP_FLOAT, PROP_XYZ);
753 RNA_def_property_float_sdna(prop, NULL, "linearvelocity");
754 RNA_def_property_array(prop, 3);
755 RNA_def_property_ui_range(prop, -10000.0, 10000.0, 10, 2);
756 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)");
757 RNA_def_property_update(prop, NC_LOGIC, NULL);
759 prop= RNA_def_property(srna, "angular_velocity", PROP_FLOAT, PROP_XYZ);
760 RNA_def_property_float_sdna(prop, NULL, "angularvelocity");
761 RNA_def_property_array(prop, 3);
762 RNA_def_property_ui_range(prop, -10000.0, 10000.0, 10, 2);
763 RNA_def_property_ui_text(prop, "Angular Velocity", "Sets the angular velocity");
764 RNA_def_property_update(prop, NC_LOGIC, NULL);
767 prop= RNA_def_property(srna, "use_local_location", PROP_BOOLEAN, PROP_NONE);
768 RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_DLOC_LOCAL);
769 RNA_def_property_ui_text(prop, "L", "Location is defined in local coordinates");
770 RNA_def_property_update(prop, NC_LOGIC, NULL);
772 prop= RNA_def_property(srna, "use_local_rotation", PROP_BOOLEAN, PROP_NONE);
773 RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_DROT_LOCAL);
774 RNA_def_property_ui_text(prop, "L", "Rotation is defined in local coordinates");
775 RNA_def_property_update(prop, NC_LOGIC, NULL);
777 prop= RNA_def_property(srna, "use_local_force", PROP_BOOLEAN, PROP_NONE);
778 RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_FORCE_LOCAL);
779 RNA_def_property_ui_text(prop, "L", "Force is defined in local coordinates");
780 RNA_def_property_update(prop, NC_LOGIC, NULL);
782 prop= RNA_def_property(srna, "use_local_torque", PROP_BOOLEAN, PROP_NONE);
783 RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_TORQUE_LOCAL);
784 RNA_def_property_ui_text(prop, "L", "Torque is defined in local coordinates");
785 RNA_def_property_update(prop, NC_LOGIC, NULL);
787 prop= RNA_def_property(srna, "use_local_linear_velocity", PROP_BOOLEAN, PROP_NONE);
788 RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_LIN_VEL_LOCAL);
789 RNA_def_property_ui_text(prop, "L", "Velocity is defined in local coordinates");
790 RNA_def_property_update(prop, NC_LOGIC, NULL);
792 prop= RNA_def_property(srna, "use_local_angular_velocity", PROP_BOOLEAN, PROP_NONE);
793 RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_ANG_VEL_LOCAL);
794 RNA_def_property_ui_text(prop, "L", "Angular velocity is defined in local coordinates");
795 RNA_def_property_update(prop, NC_LOGIC, NULL);
797 prop= RNA_def_property(srna, "use_add_linear_velocity", PROP_BOOLEAN, PROP_NONE);
798 RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_ADD_LIN_VEL);
799 RNA_def_property_ui_text(prop, "Add", "Toggles between ADD and SET linV");
800 RNA_def_property_update(prop, NC_LOGIC, NULL);
802 prop= RNA_def_property(srna, "use_servo_limit_x", PROP_BOOLEAN, PROP_NONE);
803 RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_SERVO_LIMIT_X);
804 RNA_def_property_ui_text(prop, "X", "Set limit to force along the X axis");
805 RNA_def_property_update(prop, NC_LOGIC, NULL);
807 prop= RNA_def_property(srna, "use_servo_limit_y", PROP_BOOLEAN, PROP_NONE);
808 RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_SERVO_LIMIT_Y);
809 RNA_def_property_ui_text(prop, "Y", "Set limit to force along the Y axis");
810 RNA_def_property_update(prop, NC_LOGIC, NULL);
812 prop= RNA_def_property(srna, "use_servo_limit_z", PROP_BOOLEAN, PROP_NONE);
813 RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_SERVO_LIMIT_Z);
814 RNA_def_property_ui_text(prop, "Z", "Set limit to force along the Z axis");
815 RNA_def_property_update(prop, NC_LOGIC, NULL);
818 static void rna_def_fcurve_actuator(BlenderRNA *brna)
823 static EnumPropertyItem prop_type_items[] ={
824 {ACT_IPO_PLAY, "PLAY", 0, "Play", ""},
825 {ACT_IPO_PINGPONG, "PINGPONG", 0, "Ping Pong", ""},
826 {ACT_IPO_FLIPPER, "FLIPPER", 0, "Flipper", ""},
827 {ACT_IPO_LOOP_STOP, "STOP", 0, "Loop Stop", ""},
828 {ACT_IPO_LOOP_END, "END", 0, "Loop End", ""},
829 // {ACT_IPO_KEY2KEY, "IPOCHILD", 0, "Key to Key", ""},
830 {ACT_IPO_FROM_PROP, "PROP", 0, "Property", ""},
831 {0, NULL, 0, NULL, NULL}};
833 srna= RNA_def_struct(brna, "FCurveActuator", "Actuator");
834 RNA_def_struct_ui_text(srna, "F-Curve Actuator", "Actuator to animate the object");
835 RNA_def_struct_sdna_from(srna, "bIpoActuator", "data");
837 prop= RNA_def_property(srna, "play_type", PROP_ENUM, PROP_NONE);
838 RNA_def_property_enum_sdna(prop, NULL, "type");
839 RNA_def_property_enum_items(prop, prop_type_items);
840 RNA_def_property_ui_text(prop, "F-Curve Type", "Specify the way you want to play the animation");
841 RNA_def_property_update(prop, NC_LOGIC, NULL);
843 prop= RNA_def_property(srna, "frame_start", PROP_FLOAT, PROP_NONE);
844 RNA_def_property_float_sdna(prop, NULL, "sta");
845 RNA_def_property_ui_range(prop, 1.0, MAXFRAME, 100, 2);
846 RNA_def_property_ui_text(prop, "Start Frame", "");
847 RNA_def_property_update(prop, NC_SCENE, NULL);
849 prop= RNA_def_property(srna, "frame_end", PROP_FLOAT, PROP_NONE);
850 RNA_def_property_float_sdna(prop, NULL, "end");
851 RNA_def_property_ui_range(prop, 1.0, MAXFRAME, 100, 2);
852 RNA_def_property_ui_text(prop, "End Frame", "");
853 RNA_def_property_update(prop, NC_LOGIC, NULL);
855 prop= RNA_def_property(srna, "property", PROP_STRING, PROP_NONE);
856 RNA_def_property_string_sdna(prop, NULL, "name");
857 RNA_def_property_ui_text(prop, "Property", "Use this property to define the F-Curve position");
858 RNA_def_property_update(prop, NC_LOGIC, NULL);
860 prop= RNA_def_property(srna, "frame_property", PROP_STRING, PROP_NONE);
861 RNA_def_property_string_sdna(prop, NULL, "frameProp");
862 RNA_def_property_ui_text(prop, "Frame Property", "Assign the action's current frame number to this property");
865 prop= RNA_def_property(srna, "use_additive", PROP_BOOLEAN, PROP_NONE);
866 RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_IPOADD);
867 RNA_def_property_boolean_funcs(prop, NULL, "rna_FcurveActuator_add_set");
868 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");
869 RNA_def_property_update(prop, NC_LOGIC, NULL);
871 prop= RNA_def_property(srna, "use_force", PROP_BOOLEAN, PROP_NONE);
872 RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_IPOFORCE);
873 RNA_def_property_boolean_funcs(prop, NULL, "rna_FcurveActuator_force_set");
874 RNA_def_property_ui_text(prop, "Force", "Apply F-Curve as a global or local force depending on the local option (dynamic objects only)");
875 RNA_def_property_update(prop, NC_LOGIC, NULL);
877 prop= RNA_def_property(srna, "use_local", PROP_BOOLEAN, PROP_NONE);
878 RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_IPOLOCAL);
879 RNA_def_property_ui_text(prop, "L", "Let the F-Curve act in local coordinates, used in Force and Add mode");
880 RNA_def_property_update(prop, NC_LOGIC, NULL);
882 prop= RNA_def_property(srna, "apply_to_children", PROP_BOOLEAN, PROP_NONE);
883 RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_IPOCHILD);
884 RNA_def_property_ui_text(prop, "Child", "Update F-Curve on all children Objects as well");
885 RNA_def_property_update(prop, NC_LOGIC, NULL);
888 static void rna_def_camera_actuator(BlenderRNA *brna)
893 static EnumPropertyItem prop_axis_items[] ={
894 {ACT_CAMERA_X, "X", 0, "X", "Camera tries to get behind the X axis"},
895 {ACT_CAMERA_Y, "Y", 0, "Y", "Camera tries to get behind the Y axis"},
896 {0, NULL, 0, NULL, NULL}};
898 srna= RNA_def_struct(brna, "CameraActuator", "Actuator");
899 RNA_def_struct_ui_text(srna, "Camera Actuator", "Actuator to ..");
900 RNA_def_struct_sdna_from(srna, "bCameraActuator", "data");
902 prop= RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
903 RNA_def_property_struct_type(prop, "Object");
904 RNA_def_property_pointer_sdna(prop, NULL, "ob");
905 RNA_def_property_flag(prop, PROP_EDITABLE);
906 RNA_def_property_ui_text(prop, "Camera Object", "Look at this Object");
907 RNA_def_property_update(prop, NC_LOGIC, NULL);
910 prop= RNA_def_property(srna, "height", PROP_FLOAT, PROP_NONE);
911 RNA_def_property_ui_range(prop, 0.0, 20.0, 1, 2);
912 RNA_def_property_ui_text(prop, "Height", "");
913 RNA_def_property_update(prop, NC_LOGIC, NULL);
915 prop= RNA_def_property(srna, "min", PROP_FLOAT, PROP_NONE);
916 RNA_def_property_ui_range(prop, 0.0, 20.0, 1, 2);
917 RNA_def_property_ui_text(prop, "Min", "");
918 RNA_def_property_update(prop, NC_LOGIC, NULL);
920 prop= RNA_def_property(srna, "max", PROP_FLOAT, PROP_NONE);
921 RNA_def_property_ui_range(prop, 0.0, 20.0, 1, 2);
922 RNA_def_property_ui_text(prop, "Max", "");
923 RNA_def_property_update(prop, NC_LOGIC, NULL);
926 prop= RNA_def_property(srna, "axis", PROP_ENUM, PROP_NONE);
927 RNA_def_property_enum_sdna(prop, NULL, "axis");
928 RNA_def_property_enum_items(prop, prop_axis_items);
929 RNA_def_property_ui_text(prop, "Axis", "Specify the axis the Camera will try to get behind");
930 RNA_def_property_update(prop, NC_LOGIC, NULL);
933 static void rna_def_sound_actuator(BlenderRNA *brna)
938 static EnumPropertyItem prop_type_items[] ={
939 {ACT_SND_PLAY_STOP_SOUND, "PLAYSTOP", 0, "Play Stop", ""},
940 {ACT_SND_PLAY_END_SOUND, "PLAYEND", 0, "Play End", ""},
941 {ACT_SND_LOOP_STOP_SOUND, "LOOPSTOP", 0, "Loop Stop", ""},
942 {ACT_SND_LOOP_END_SOUND, "LOOPEND", 0, "Loop End", ""},
943 {ACT_SND_LOOP_BIDIRECTIONAL_SOUND, "LOOPBIDIRECTIONAL", 0, "Loop Bidirectional", ""},
944 {ACT_SND_LOOP_BIDIRECTIONAL_STOP_SOUND, "LOOPBIDIRECTIONALSTOP", 0, "Loop Bidirectional Stop", ""},
945 {0, NULL, 0, NULL, NULL}
948 srna= RNA_def_struct(brna, "SoundActuator", "Actuator");
949 RNA_def_struct_ui_text(srna, "Sound Actuator", "Actuator to handle sound");
950 RNA_def_struct_sdna_from(srna, "bSoundActuator", "data");
952 prop= RNA_def_property(srna, "sound", PROP_POINTER, PROP_NONE);
953 RNA_def_property_struct_type(prop, "Sound");
954 RNA_def_property_flag(prop, PROP_EDITABLE);
955 RNA_def_struct_ui_text(srna, "Sound", "Sound file");
956 RNA_def_property_update(prop, NC_LOGIC, NULL);
958 prop= RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
959 RNA_def_property_enum_sdna(prop, NULL, "type");
960 RNA_def_property_enum_items(prop, prop_type_items);
961 RNA_def_property_ui_text(prop, "Play Mode", "");
962 RNA_def_property_update(prop, NC_LOGIC, NULL);
964 prop= RNA_def_property(srna, "volume", PROP_FLOAT, PROP_NONE);
965 RNA_def_property_ui_range(prop, 0.0, 1.0, 1, 2);
966 RNA_def_property_range(prop, 0.0, 2.0);
967 RNA_def_property_ui_text(prop, "Volume", "Sets the initial volume of the sound");
968 RNA_def_property_update(prop, NC_LOGIC, NULL);
970 prop= RNA_def_property(srna, "pitch", PROP_FLOAT, PROP_NONE);
971 RNA_def_property_ui_range(prop, -12.0, 12.0, 1, 2);
972 RNA_def_property_ui_text(prop, "Pitch", "Sets the pitch of the sound");
973 RNA_def_property_update(prop, NC_LOGIC, NULL);
975 /* floats - 3D Parameters */
976 prop= RNA_def_property(srna, "gain_3d_min", PROP_FLOAT, PROP_NONE);
977 RNA_def_property_float_sdna(prop, NULL, "sound3D.min_gain");
978 RNA_def_property_ui_range(prop, 0.0, 1.0, 1, 2);
979 RNA_def_property_ui_text(prop, "Minimum Gain", "The minimum gain of the sound, no matter how far it is away");
980 RNA_def_property_update(prop, NC_LOGIC, NULL);
982 prop= RNA_def_property(srna, "gain_3d_max", PROP_FLOAT, PROP_NONE);
983 RNA_def_property_float_sdna(prop, NULL, "sound3D.max_gain");
984 RNA_def_property_ui_range(prop, 0.0, 1.0, 1, 2);
985 RNA_def_property_ui_text(prop, "Maximum Gain", "The maximum gain of the sound, no matter how near it is");
986 RNA_def_property_update(prop, NC_LOGIC, NULL);
988 prop= RNA_def_property(srna, "distance_3d_reference", PROP_FLOAT, PROP_NONE);
989 RNA_def_property_float_sdna(prop, NULL, "sound3D.reference_distance");
990 RNA_def_property_ui_range(prop, 0.0, FLT_MAX, 1, 2);
991 RNA_def_property_ui_text(prop, "Reference Distance", "The distance where the sound has a gain of 1.0");
992 RNA_def_property_update(prop, NC_LOGIC, NULL);
994 prop= RNA_def_property(srna, "distance_3d_max", PROP_FLOAT, PROP_NONE);
995 RNA_def_property_float_sdna(prop, NULL, "sound3D.max_distance");
996 RNA_def_property_ui_range(prop, 0.0, FLT_MAX, 1, 2);
997 RNA_def_property_ui_text(prop, "Maximum Distance", "The maximum distance at which you can hear the sound");
998 RNA_def_property_update(prop, NC_LOGIC, NULL);
1000 prop= RNA_def_property(srna, "rolloff_factor_3d", PROP_FLOAT, PROP_NONE);
1001 RNA_def_property_float_sdna(prop, NULL, "sound3D.rolloff_factor");
1002 RNA_def_property_ui_range(prop, 0.0, 5.0, 1, 2);
1003 RNA_def_property_ui_text(prop, "Rolloff", "The influence factor on volume depending on distance");
1004 RNA_def_property_update(prop, NC_LOGIC, NULL);
1006 prop= RNA_def_property(srna, "cone_outer_gain_3d", PROP_FLOAT, PROP_NONE);
1007 RNA_def_property_float_sdna(prop, NULL, "sound3D.cone_outer_gain");
1008 RNA_def_property_ui_range(prop, 0.0, 1.0, 1, 2);
1009 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");
1010 RNA_def_property_update(prop, NC_LOGIC, NULL);
1012 prop= RNA_def_property(srna, "cone_outer_angle_3d", PROP_FLOAT, PROP_NONE);
1013 RNA_def_property_float_sdna(prop, NULL, "sound3D.cone_outer_angle");
1014 RNA_def_property_ui_range(prop, 0.0, 360.0, 1, 2);
1015 RNA_def_property_ui_text(prop, "Cone Outer Angle", "The angle of the outer cone");
1016 RNA_def_property_update(prop, NC_LOGIC, NULL);
1018 prop= RNA_def_property(srna, "cone_inner_angle_3d", PROP_FLOAT, PROP_NONE);
1019 RNA_def_property_float_sdna(prop, NULL, "sound3D.cone_inner_angle");
1020 RNA_def_property_ui_range(prop, 0.0, 360.0, 1, 2);
1021 RNA_def_property_ui_text(prop, "Cone Inner Angle", "The angle of the inner cone");
1022 RNA_def_property_update(prop, NC_LOGIC, NULL);
1025 prop= RNA_def_property(srna, "use_sound_3d", PROP_BOOLEAN, PROP_NONE);
1026 RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_SND_3D_SOUND);
1027 RNA_def_property_ui_text(prop, "3D Sound", "Enable/Disable 3D Sound");
1028 RNA_def_property_update(prop, NC_LOGIC, NULL);
1031 static void rna_def_property_actuator(BlenderRNA *brna)
1036 static EnumPropertyItem prop_type_items[] ={
1037 {ACT_PROP_ASSIGN, "ASSIGN", 0, "Assign", ""},
1038 {ACT_PROP_ADD, "ADD", 0, "Add", ""},
1039 {ACT_PROP_COPY, "COPY", 0, "Copy", ""},
1040 {ACT_PROP_TOGGLE, "TOGGLE", 0, "Toggle", "For bool/int/float/timer properties only"},
1041 {0, NULL, 0, NULL, NULL}
1044 srna= RNA_def_struct(brna, "PropertyActuator", "Actuator");
1045 RNA_def_struct_ui_text(srna, "Property Actuator", "Actuator to handle properties");
1046 RNA_def_struct_sdna_from(srna, "bPropertyActuator", "data");
1048 prop= RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
1049 RNA_def_property_enum_sdna(prop, NULL, "type");
1050 RNA_def_property_enum_items(prop, prop_type_items);
1051 RNA_def_property_ui_text(prop, "Mode", "");
1052 RNA_def_property_update(prop, NC_LOGIC, NULL);
1054 prop= RNA_def_property(srna, "property", PROP_STRING, PROP_NONE);
1055 RNA_def_property_string_sdna(prop, NULL, "name");
1056 RNA_def_property_ui_text(prop, "Property", "The name of the property");
1057 RNA_def_property_update(prop, NC_LOGIC, NULL);
1059 prop= RNA_def_property(srna, "value", PROP_STRING, PROP_NONE);
1060 RNA_def_property_ui_text(prop, "Value", "The name of the property or the value to use (use \"\" around strings)");
1061 RNA_def_property_update(prop, NC_LOGIC, NULL);
1064 prop= RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
1065 RNA_def_property_struct_type(prop, "Object");
1066 RNA_def_property_pointer_sdna(prop, NULL, "ob");
1067 RNA_def_property_flag(prop, PROP_EDITABLE);
1068 RNA_def_property_ui_text(prop, "Object", "Copy from this Object");
1069 RNA_def_property_update(prop, NC_LOGIC, NULL);
1071 //XXX add even magic'er property lookup (need to look for the property list of the target object)
1072 prop= RNA_def_property(srna, "object_property", PROP_STRING, PROP_NONE);
1073 RNA_def_property_string_sdna(prop, NULL, "value");
1074 RNA_def_property_ui_text(prop, "Property Name", "Copy this property");
1075 RNA_def_property_update(prop, NC_LOGIC, NULL);
1078 static void rna_def_constraint_actuator(BlenderRNA *brna)
1083 static EnumPropertyItem prop_type_items[] ={
1084 {ACT_CONST_TYPE_LOC, "LOC", 0, "Location Constraint", ""},
1085 {ACT_CONST_TYPE_DIST, "DIST", 0, "Distance Constraint", ""},
1086 {ACT_CONST_TYPE_ORI, "ORI", 0, "Orientation Constraint", ""},
1087 {ACT_CONST_TYPE_FH, "FH", 0, "Force Field Constraint", ""},
1088 {0, NULL, 0, NULL, NULL}
1091 static EnumPropertyItem prop_limit_items[] ={
1092 {ACT_CONST_NONE, "NONE", 0, "None", ""},
1093 {ACT_CONST_LOCX, "LOCX", 0, "Loc X", ""},
1094 {ACT_CONST_LOCY, "LOCY", 0, "Loc Y", ""},
1095 {ACT_CONST_LOCZ, "LOCZ", 0, "Loc Z", ""},
1096 {0, NULL, 0, NULL, NULL}
1099 static EnumPropertyItem prop_direction_items[] ={
1100 {ACT_CONST_NONE, "NONE", 0, "None", ""},
1101 {ACT_CONST_DIRPX, "DIRPX", 0, "X axis", ""},
1102 {ACT_CONST_DIRPY, "DIRPY", 0, "Y axis", ""},
1103 {ACT_CONST_DIRPZ, "DIRPZ", 0, "Z axis", ""},
1104 {ACT_CONST_DIRNX, "DIRNX", 0, "-X axis", ""},
1105 {ACT_CONST_DIRNY, "DIRNY", 0, "-Y axis", ""},
1106 {ACT_CONST_DIRNZ, "DIRNZ", 0, "-Z axis", ""},
1107 {0, NULL, 0, NULL, NULL}
1110 static EnumPropertyItem prop_direction_pos_items[] ={
1111 {ACT_CONST_NONE, "NONE", 0, "None", ""},
1112 {ACT_CONST_DIRPX, "DIRPX", 0, "X axis", ""},
1113 {ACT_CONST_DIRPY, "DIRPY", 0, "Y axis", ""},
1114 {ACT_CONST_DIRPZ, "DIRPZ", 0, "Z axis", ""},
1115 {0, NULL, 0, NULL, NULL}
1118 srna= RNA_def_struct(brna, "ConstraintActuator", "Actuator");
1119 RNA_def_struct_ui_text(srna, "Constraint Actuator", "Actuator to handle Constraints");
1120 RNA_def_struct_sdna_from(srna, "bConstraintActuator", "data");
1122 prop= RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
1123 RNA_def_property_enum_sdna(prop, NULL, "type");
1124 RNA_def_property_enum_items(prop, prop_type_items);
1125 RNA_def_property_enum_funcs(prop, NULL, "rna_ConstraintActuator_type_set", NULL);
1126 RNA_def_property_ui_text(prop, "Constraints Mode", "The type of the constraint");
1127 RNA_def_property_update(prop, NC_LOGIC, NULL);
1129 prop= RNA_def_property(srna, "limit", PROP_ENUM, PROP_NONE);
1130 RNA_def_property_enum_sdna(prop, NULL, "flag");
1131 RNA_def_property_enum_items(prop, prop_limit_items);
1132 RNA_def_property_ui_text(prop, "Limit", "");
1133 RNA_def_property_update(prop, NC_LOGIC, NULL);
1135 prop= RNA_def_property(srna, "direction", 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", "Set the direction of the ray");
1139 RNA_def_property_update(prop, NC_LOGIC, NULL);
1141 prop= RNA_def_property(srna, "direction_axis", PROP_ENUM, PROP_NONE);
1142 RNA_def_property_enum_sdna(prop, NULL, "mode");
1143 RNA_def_property_enum_items(prop, prop_direction_items);
1144 RNA_def_property_ui_text(prop, "Direction", "Select the axis to be aligned along the reference direction");
1145 RNA_def_property_update(prop, NC_LOGIC, NULL);
1147 /* ACT_CONST_TYPE_LOC */
1148 prop= RNA_def_property(srna, "limit_min", PROP_FLOAT, PROP_NONE);
1149 RNA_def_property_float_funcs(prop, "rna_ConstraintActuator_limitmin_get", "rna_ConstraintActuator_limitmin_set", NULL);
1150 RNA_def_property_ui_range(prop, -2000.f, 2000.f, 1, 2);
1151 RNA_def_property_ui_text(prop, "Min", "");
1152 RNA_def_property_update(prop, NC_LOGIC, NULL);
1154 prop= RNA_def_property(srna, "limit_max", PROP_FLOAT, PROP_NONE);
1155 RNA_def_property_float_funcs(prop, "rna_ConstraintActuator_limitmax_get", "rna_ConstraintActuator_limitmax_set", NULL);
1156 RNA_def_property_ui_range(prop, -2000.f, 2000.f, 1, 2);
1157 RNA_def_property_ui_text(prop, "Max", "");
1158 RNA_def_property_update(prop, NC_LOGIC, NULL);
1160 prop= RNA_def_property(srna, "damping", PROP_INT, PROP_NONE);
1161 RNA_def_property_int_sdna(prop, NULL, "damp");
1162 RNA_def_property_ui_range(prop, 0, 100, 1, 1);
1163 RNA_def_property_ui_text(prop, "Damping", "Damping factor: time constant (in frame) of low pass filter");
1164 RNA_def_property_update(prop, NC_LOGIC, NULL);
1166 /* ACT_CONST_TYPE_DIST */
1167 prop= RNA_def_property(srna, "range", PROP_FLOAT, PROP_NONE);
1168 RNA_def_property_float_funcs(prop, "rna_ConstraintActuator_range_get", "rna_ConstraintActuator_range_set", NULL);
1169 RNA_def_property_ui_range(prop, 0.f, 2000.f, 1, 2);
1170 RNA_def_property_ui_text(prop, "Range", "Set the maximum length of ray");
1171 RNA_def_property_update(prop, NC_LOGIC, NULL);
1173 prop= RNA_def_property(srna, "distance", PROP_FLOAT, PROP_NONE);
1174 RNA_def_property_float_funcs(prop, "rna_ConstraintActuator_distance_get", "rna_ConstraintActuator_distance_set", NULL);
1175 RNA_def_property_ui_range(prop, -2000.f, 2000.f, 1, 2);
1176 RNA_def_property_ui_text(prop, "Distance", "Keep this distance to target");
1177 RNA_def_property_update(prop, NC_LOGIC, NULL);
1179 //XXX to use a pointer or add a material lookup
1180 prop= RNA_def_property(srna, "material", PROP_STRING, PROP_NONE);
1181 RNA_def_property_string_sdna(prop, NULL, "matprop");
1182 RNA_def_property_flag(prop, PROP_EDITABLE);
1183 RNA_def_property_ui_text(prop, "Material", "Ray detects only Objects with this material");
1184 RNA_def_property_update(prop, NC_LOGIC, NULL);
1186 //XXX add magic property lookup
1187 prop= RNA_def_property(srna, "property", PROP_STRING, PROP_NONE);
1188 RNA_def_property_string_sdna(prop, NULL, "matprop");
1189 RNA_def_property_ui_text(prop, "Property", "Ray detect only Objects with this property");
1190 RNA_def_property_update(prop, NC_LOGIC, NULL);
1192 prop= RNA_def_property(srna, "time", PROP_INT, PROP_NONE);
1193 RNA_def_property_ui_range(prop, 0, 1000, 1, 2);
1194 RNA_def_property_ui_text(prop, "Time", "Maximum activation time in frame, 0 for unlimited");
1195 RNA_def_property_update(prop, NC_LOGIC, NULL);
1197 prop= RNA_def_property(srna, "damping_rotation", PROP_INT, PROP_NONE);
1198 RNA_def_property_int_sdna(prop, NULL, "rotdamp");
1199 RNA_def_property_ui_range(prop, 0, 100, 1, 1);
1200 RNA_def_property_ui_text(prop, "RotDamp", "Use a different damping for orientation");
1201 RNA_def_property_update(prop, NC_LOGIC, NULL);
1203 /* ACT_CONST_TYPE_ORI */
1204 prop= RNA_def_property(srna, "direction_axis_pos", PROP_ENUM, PROP_NONE);
1205 RNA_def_property_enum_sdna(prop, NULL, "mode");
1206 RNA_def_property_enum_items(prop, prop_direction_pos_items);
1207 RNA_def_property_ui_text(prop, "Direction", "Select the axis to be aligned along the reference direction");
1208 RNA_def_property_update(prop, NC_LOGIC, NULL);
1210 prop= RNA_def_property(srna, "rotation_max", PROP_FLOAT, PROP_XYZ);
1211 RNA_def_property_float_sdna(prop, NULL, "maxrot");
1212 RNA_def_property_array(prop, 3);
1213 RNA_def_property_ui_range(prop, -2000.0, 2000.0, 10, 2);
1214 RNA_def_property_ui_text(prop, "Reference Direction", "Reference Direction");
1215 RNA_def_property_update(prop, NC_LOGIC, NULL);
1217 //XXX TODO - use radians internally then change to PROP_ANGLE
1218 prop= RNA_def_property(srna, "angle_min", PROP_FLOAT, PROP_NONE);
1219 RNA_def_property_float_sdna(prop, NULL, "minloc[0]");
1220 RNA_def_property_range(prop, 0.0, 180.0);
1221 RNA_def_property_ui_text(prop, "Min Angle", "Minimum angle (in degree) to maintain with target direction. No correction is done if angle with target direction is between min and max");
1222 RNA_def_property_update(prop, NC_LOGIC, NULL);
1224 //XXX TODO - use radians internally then change to PROP_ANGLE
1225 prop= RNA_def_property(srna, "angle_max", PROP_FLOAT, PROP_NONE);
1226 RNA_def_property_float_sdna(prop, NULL, "maxloc[0]");
1227 RNA_def_property_range(prop, 0.0, 180.0);
1228 RNA_def_property_ui_text(prop, "Max Angle", "Maximum angle (in degree) allowed with target direction. No correction is done if angle with target direction is between min and max");
1229 RNA_def_property_update(prop, NC_LOGIC, NULL);
1231 /* ACT_CONST_TYPE_FH */
1232 prop= RNA_def_property(srna, "fh_height", PROP_FLOAT, PROP_NONE);
1233 RNA_def_property_float_funcs(prop, "rna_ConstraintActuator_fhheight_get", "rna_ConstraintActuator_fhheight_set", NULL);
1234 RNA_def_property_ui_range(prop, 0.01, 2000.0, 10, 2);
1235 RNA_def_property_ui_text(prop, "Distance", "Height of the force field area");
1236 RNA_def_property_update(prop, NC_LOGIC, NULL);
1238 prop= RNA_def_property(srna, "fh_force", PROP_FLOAT, PROP_NONE);
1239 RNA_def_property_float_funcs(prop, "rna_ConstraintActuator_spring_get", "rna_ConstraintActuator_spring_set", NULL);
1240 RNA_def_property_ui_range(prop, 0.0, 1.0, 10, 2);
1241 RNA_def_property_ui_text(prop, "Force", "Spring force within the force field area");
1242 RNA_def_property_update(prop, NC_LOGIC, NULL);
1244 prop= RNA_def_property(srna, "fh_damping", PROP_FLOAT, PROP_NONE);
1245 RNA_def_property_float_sdna(prop, NULL, "maxrot[0]");
1246 RNA_def_property_ui_range(prop, 0.0, 1.0, 10, 2);
1247 RNA_def_property_ui_text(prop, "Damping", "Damping factor of the force field spring");
1248 RNA_def_property_update(prop, NC_LOGIC, NULL);
1251 prop= RNA_def_property(srna, "use_force_distance", PROP_BOOLEAN, PROP_NONE);
1252 RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_CONST_DISTANCE);
1253 RNA_def_property_ui_text(prop, "Force Distance", "Force distance of object to point of impact of ray");
1254 RNA_def_property_update(prop, NC_LOGIC, NULL);
1256 prop= RNA_def_property(srna, "use_local", PROP_BOOLEAN, PROP_NONE);
1257 RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_CONST_LOCAL);
1258 RNA_def_property_ui_text(prop, "L", "Set ray along object's axis or global axis");
1259 RNA_def_property_update(prop, NC_LOGIC, NULL);
1261 prop= RNA_def_property(srna, "use_normal", PROP_BOOLEAN, PROP_NONE);
1262 RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_CONST_NORMAL);
1263 RNA_def_property_ui_text(prop, "N", "Set object axis along (local axis) or parallel (global axis) to the normal at hit position");
1264 RNA_def_property_update(prop, NC_LOGIC, NULL);
1266 prop= RNA_def_property(srna, "use_persistent", PROP_BOOLEAN, PROP_NONE);
1267 RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_CONST_PERMANENT);
1268 RNA_def_property_ui_text(prop, "PER", "Persistent actuator: stays active even if ray does not reach target");
1269 RNA_def_property_update(prop, NC_LOGIC, NULL);
1271 //XXX to use an enum instead of a flag if possible
1272 prop= RNA_def_property(srna, "use_material_detect", PROP_BOOLEAN, PROP_NONE);
1273 RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_CONST_MATERIAL);
1274 RNA_def_property_ui_text(prop, "M/P", "Detect material instead of property");
1275 RNA_def_property_boolean_funcs(prop, NULL, "rna_Actuator_constraint_detect_material_set");
1276 RNA_def_property_update(prop, NC_LOGIC, NULL);
1278 prop= RNA_def_property(srna, "use_fh_paralel_axis", PROP_BOOLEAN, PROP_NONE);
1279 RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_CONST_DOROTFH);
1280 RNA_def_property_ui_text(prop, "Rot Fh", "Keep object axis parallel to normal");
1281 RNA_def_property_update(prop, NC_LOGIC, NULL);
1283 prop= RNA_def_property(srna, "use_fh_normal", PROP_BOOLEAN, PROP_NONE);
1284 RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_CONST_NORMAL);
1285 RNA_def_property_ui_text(prop, "N", "Add a horizontal spring force on slopes");
1286 RNA_def_property_update(prop, NC_LOGIC, NULL);
1289 static void rna_def_edit_object_actuator(BlenderRNA *brna)
1294 static EnumPropertyItem prop_dyn_items[] ={
1295 {ACT_EDOB_RESTORE_DYN, "RESTOREDYN", 0, "Restore Dynamics", ""},
1296 {ACT_EDOB_SUSPEND_DYN, "SUSPENDDYN", 0, "Suspend Dynamics", ""},
1297 {ACT_EDOB_ENABLE_RB, "ENABLERIGIDBODY", 0, "Enable Rigid Body", ""},
1298 {ACT_EDOB_DISABLE_RB, "DISABLERIGIDBODY", 0, "Disable Rigid Body", ""},
1299 {ACT_EDOB_SET_MASS, "SETMASS", 0, "Set Mass", ""},
1300 {0, NULL, 0, NULL, NULL} };
1302 static EnumPropertyItem prop_type_items[] ={
1303 {ACT_EDOB_ADD_OBJECT, "ADDOBJECT", 0, "Add Object", ""},
1304 {ACT_EDOB_END_OBJECT, "ENDOBJECT", 0, "End Object", ""},
1305 {ACT_EDOB_REPLACE_MESH, "REPLACEMESH", 0, "Replace Mesh", ""},
1306 {ACT_EDOB_TRACK_TO, "TRACKTO", 0, "Track to", ""},
1307 {ACT_EDOB_DYNAMICS, "DYNAMICS", 0, "Dynamics", ""},
1308 {0, NULL, 0, NULL, NULL} };
1310 srna= RNA_def_struct(brna, "EditObjectActuator", "Actuator");
1311 RNA_def_struct_ui_text(srna, "Edit Object Actuator", "Actuator used to edit objects");
1312 RNA_def_struct_sdna_from(srna, "bEditObjectActuator", "data");
1314 prop= RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
1315 RNA_def_property_enum_sdna(prop, NULL, "type");
1316 RNA_def_property_enum_items(prop, prop_type_items);
1317 RNA_def_property_ui_text(prop, "Edit Object", "The mode of the actuator");
1318 RNA_def_property_update(prop, NC_LOGIC, NULL);
1320 prop= RNA_def_property(srna, "dynamic_operation", PROP_ENUM, PROP_NONE);
1321 RNA_def_property_enum_sdna(prop, NULL, "dyn_operation");
1322 RNA_def_property_enum_items(prop, prop_dyn_items);
1323 RNA_def_property_ui_text(prop, "Dynamic Operation", "");
1324 RNA_def_property_update(prop, NC_LOGIC, NULL);
1326 prop= RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
1327 RNA_def_property_struct_type(prop, "Object");
1328 RNA_def_property_pointer_sdna(prop, NULL, "ob");
1329 RNA_def_property_flag(prop, PROP_EDITABLE);
1330 RNA_def_property_ui_text(prop, "Object", "Add this Object and all its children (cant be on an visible layer)");
1331 RNA_def_property_update(prop, NC_LOGIC, NULL);
1333 prop= RNA_def_property(srna, "track_object", PROP_POINTER, PROP_NONE);
1334 RNA_def_property_struct_type(prop, "Object");
1335 RNA_def_property_pointer_sdna(prop, NULL, "ob");
1336 RNA_def_property_flag(prop, PROP_EDITABLE);
1337 RNA_def_property_ui_text(prop, "Object", "Track to this Object");
1338 RNA_def_property_update(prop, NC_LOGIC, NULL);
1340 prop= RNA_def_property(srna, "mesh", PROP_POINTER, PROP_NONE);
1341 RNA_def_property_struct_type(prop, "Mesh");
1342 RNA_def_property_pointer_sdna(prop, NULL, "me");
1343 RNA_def_property_flag(prop, PROP_EDITABLE);
1344 RNA_def_property_ui_text(prop, "Mesh", "Replace the existing, when left blank 'Phys' will remake the existing physics mesh");
1345 /* note: custom set function is ONLY to avoid rna setting a user for this. */
1346 RNA_def_property_pointer_funcs(prop, NULL, "rna_Actuator_editobject_mesh_set", NULL, NULL);
1347 RNA_def_property_update(prop, NC_LOGIC, NULL);
1349 prop= RNA_def_property(srna, "time", PROP_INT, PROP_NONE);
1350 RNA_def_property_ui_range(prop, 0, 2000, 1, 1);
1351 RNA_def_property_ui_text(prop, "Time", "Duration the new Object lives or the track takes");
1352 RNA_def_property_update(prop, NC_LOGIC, NULL);
1354 prop= RNA_def_property(srna, "mass", PROP_FLOAT, PROP_NONE);
1355 RNA_def_property_ui_range(prop, 0, 10000, 1, 2);
1356 RNA_def_property_ui_text(prop, "Mass", "The mass of the object");
1357 RNA_def_property_update(prop, NC_LOGIC, NULL);
1359 /* floats 3 Arrays*/
1360 prop= RNA_def_property(srna, "linear_velocity", PROP_FLOAT, PROP_XYZ);
1361 RNA_def_property_float_sdna(prop, NULL, "linVelocity");
1362 RNA_def_property_array(prop, 3);
1363 RNA_def_property_ui_range(prop, -100.0, 100.0, 10, 2);
1364 RNA_def_property_ui_text(prop, "Linear Velocity", "Velocity upon creation");
1365 RNA_def_property_update(prop, NC_LOGIC, NULL);
1367 prop= RNA_def_property(srna, "angular_velocity", PROP_FLOAT, PROP_XYZ);
1368 RNA_def_property_float_sdna(prop, NULL, "angVelocity");
1369 RNA_def_property_array(prop, 3);
1370 RNA_def_property_ui_range(prop, -10000.0, 10000.0, 10, 2);
1371 RNA_def_property_ui_text(prop, "Angular Velocity", "Angular velocity upon creation");
1372 RNA_def_property_update(prop, NC_LOGIC, NULL);
1375 prop= RNA_def_property(srna, "use_local_linear_velocity", PROP_BOOLEAN, PROP_NONE);
1376 RNA_def_property_boolean_sdna(prop, NULL, "localflag", ACT_EDOB_LOCAL_LINV);
1377 RNA_def_property_ui_text(prop, "L", "Apply the transformation locally");
1378 RNA_def_property_update(prop, NC_LOGIC, NULL);
1380 prop= RNA_def_property(srna, "use_local_angular_velocity", PROP_BOOLEAN, PROP_NONE);
1381 RNA_def_property_boolean_sdna(prop, NULL, "localflag", ACT_EDOB_LOCAL_ANGV);
1382 RNA_def_property_ui_text(prop, "L", "Apply the rotation locally");
1383 RNA_def_property_update(prop, NC_LOGIC, NULL);
1385 prop= RNA_def_property(srna, "use_replace_display_mesh", PROP_BOOLEAN, PROP_NONE);
1386 RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", ACT_EDOB_REPLACE_MESH_NOGFX);
1387 RNA_def_property_ui_text(prop, "Gfx", "Replace the display mesh");
1388 RNA_def_property_update(prop, NC_LOGIC, NULL);
1390 prop= RNA_def_property(srna, "use_replace_physics_mesh", PROP_BOOLEAN, PROP_NONE);
1391 RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_EDOB_REPLACE_MESH_PHYS);
1392 RNA_def_property_ui_text(prop, "Phys", "Replace the physics mesh (triangle bounds only - compound shapes not supported)");
1393 RNA_def_property_update(prop, NC_LOGIC, NULL);
1395 prop= RNA_def_property(srna, "use_3d_tracking", PROP_BOOLEAN, PROP_NONE);
1396 RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_TRACK_3D);
1397 RNA_def_property_ui_text(prop, "3D", "Enable 3D tracking");
1398 RNA_def_property_update(prop, NC_LOGIC, NULL);
1401 static void rna_def_scene_actuator(BlenderRNA *brna)
1406 static EnumPropertyItem prop_type_items[] ={
1407 {ACT_SCENE_RESTART, "RESTART", 0, "Restart", ""},
1408 {ACT_SCENE_SET, "SET", 0, "Set Scene", ""},
1409 {ACT_SCENE_CAMERA, "CAMERA", 0, "Set Camera", ""},
1410 {ACT_SCENE_ADD_FRONT, "ADDFRONT", 0, "Add Overlay Scene", ""},
1411 {ACT_SCENE_ADD_BACK, "ADDBACK", 0, "Add Background Scene", ""},
1412 {ACT_SCENE_REMOVE, "REMOVE", 0, "Remove Scene", ""},
1413 {ACT_SCENE_SUSPEND, "SUSPEND", 0, "Suspend Scene", ""},
1414 {ACT_SCENE_RESUME, "RESUME", 0, "Resume Scene", ""},
1415 {0, NULL, 0, NULL, NULL}};
1417 srna= RNA_def_struct(brna, "SceneActuator", "Actuator");
1418 RNA_def_struct_ui_text(srna, "Scene Actuator", "Actuator to ..");
1419 RNA_def_struct_sdna_from(srna, "bSceneActuator", "data");
1421 prop= RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
1422 RNA_def_property_enum_sdna(prop, NULL, "type");
1423 RNA_def_property_enum_items(prop, prop_type_items);
1424 RNA_def_property_ui_text(prop, "Scene", "");
1425 RNA_def_property_update(prop, NC_LOGIC, NULL);
1427 //XXX filter only camera objects
1428 prop= RNA_def_property(srna, "camera", PROP_POINTER, PROP_NONE);
1429 RNA_def_property_struct_type(prop, "Object");
1430 RNA_def_property_flag(prop, PROP_EDITABLE);
1431 RNA_def_property_ui_text(prop, "Camera Object", "Set this Camera. Leave empty to refer to self object");
1432 RNA_def_property_update(prop, NC_LOGIC, NULL);
1434 prop= RNA_def_property(srna, "scene", PROP_POINTER, PROP_NONE);
1435 RNA_def_property_struct_type(prop, "Scene");
1436 RNA_def_property_flag(prop, PROP_EDITABLE);
1437 RNA_def_property_ui_text(prop, "Scene", "Set the Scene to be added/removed/paused/resumed");
1438 RNA_def_property_update(prop, NC_LOGIC, NULL);
1440 /* XXX no need for those tooltips. to remove soon
1441 Originally we had different 'scene' tooltips for different values of 'type'.
1443 ACT_SCENE_RESTART ""
1445 ACT_SCENE_SET "Set this Scene"
1446 ACT_SCENE_ADD_FRONT "Add an Overlay Scene"
1447 ACT_SCENE_ADD_BACK "Add a Background Scene"
1448 ACT_SCENE_REMOVE "Remove a Scene"
1449 ACT_SCENE_SUSPEND "Pause a Scene"
1450 ACT_SCENE_RESUME "Unpause a Scene"
1452 It can be done in the ui script if still needed.
1457 static void rna_def_random_actuator(BlenderRNA *brna)
1462 static EnumPropertyItem prop_distribution_items[] ={
1463 {ACT_RANDOM_BOOL_CONST, "BOOL_CONSTANT", 0, "Bool Constant", ""},
1464 {ACT_RANDOM_BOOL_UNIFORM, "BOOL_UNIFORM", 0, "Bool Uniform", ""},
1465 {ACT_RANDOM_BOOL_BERNOUILLI, "BOOL_BERNOUILLI", 0, "Bool Bernoulli", ""},
1466 {ACT_RANDOM_INT_CONST, "INT_CONSTANT", 0, "Int Constant", ""},
1467 {ACT_RANDOM_INT_UNIFORM, "INT_UNIFORM", 0, "Int Uniform", ""},
1468 {ACT_RANDOM_INT_POISSON, "INT_POISSON", 0, "Int Poisson", ""},
1469 {ACT_RANDOM_FLOAT_CONST, "FLOAT_CONSTANT", 0, "Float Constant", ""},
1470 {ACT_RANDOM_FLOAT_UNIFORM, "FLOAT_UNIFORM", 0, "Float Uniform", ""},
1471 {ACT_RANDOM_FLOAT_NORMAL, "FLOAT_NORMAL", 0, "Float Normal", ""},
1472 {ACT_RANDOM_FLOAT_NEGATIVE_EXPONENTIAL, "FLOAT_NEGATIVE_EXPONENTIAL", 0, "Float Neg. Exp.", ""},
1473 {0, NULL, 0, NULL, NULL}};
1475 srna= RNA_def_struct(brna, "RandomActuator", "Actuator");
1476 RNA_def_struct_ui_text(srna, "Random Actuator", "Actuator to ..");
1477 RNA_def_struct_sdna_from(srna, "bRandomActuator", "data");
1479 prop= RNA_def_property(srna, "seed", PROP_INT, PROP_NONE);
1480 RNA_def_property_ui_range(prop, 0, 1000, 1, 1);
1481 RNA_def_property_range(prop, 0, MAXFRAME);
1482 RNA_def_property_ui_text(prop, "Seed", "Initial seed of the random generator. Use Python for more freedom (choose 0 for not random)");
1483 RNA_def_property_update(prop, NC_LOGIC, NULL);
1485 prop= RNA_def_property(srna, "property", PROP_STRING, PROP_NONE);
1486 RNA_def_property_string_sdna(prop, NULL, "propname");
1487 RNA_def_property_ui_text(prop, "Property", "Assign the random value to this property");
1488 RNA_def_property_update(prop, NC_LOGIC, NULL);
1490 prop= RNA_def_property(srna, "distribution", PROP_ENUM, PROP_NONE);
1491 RNA_def_property_enum_items(prop, prop_distribution_items);
1492 RNA_def_property_ui_text(prop, "Distribution", "Choose the type of distribution");
1493 RNA_def_property_update(prop, NC_LOGIC, NULL);
1495 /* arguments for the distribution */
1496 /* int_arg_1, int_arg_2, float_arg_1, float_arg_2 */
1498 /* ACT_RANDOM_BOOL_CONST */
1499 prop= RNA_def_property(srna, "use_always_true", PROP_BOOLEAN, PROP_NONE);
1500 RNA_def_property_boolean_sdna(prop, NULL, "int_arg_1", 1);
1501 RNA_def_property_ui_text(prop, "Always True", "Always false or always true");
1502 RNA_def_property_update(prop, NC_LOGIC, NULL);
1504 /* ACT_RANDOM_BOOL_UNIFORM */
1505 // label => "Choose between true and false, 50% chance each"
1507 /* ACT_RANDOM_BOOL_BERNOUILLI */
1508 prop= RNA_def_property(srna, "chance", PROP_FLOAT, PROP_PERCENTAGE);
1509 RNA_def_property_float_sdna(prop, NULL, "float_arg_1");
1510 RNA_def_property_range(prop, 0.0, 1.0);
1511 RNA_def_property_ui_text(prop, "Chance", "Pick a number between 0 and 1. Success if you stay below this value");
1512 RNA_def_property_update(prop, NC_LOGIC, NULL);
1514 /* ACT_RANDOM_INT_CONST */
1515 prop= RNA_def_property(srna, "int_value", PROP_INT, PROP_NONE);
1516 RNA_def_property_int_sdna(prop, NULL, "int_arg_1");
1517 RNA_def_property_ui_range(prop, -1000, 1000, 1, 1);
1518 RNA_def_property_ui_text(prop, "Value", "Always return this number");
1519 RNA_def_property_update(prop, NC_LOGIC, NULL);
1521 /* ACT_RANDOM_INT_UNIFORM */
1522 prop= RNA_def_property(srna, "int_min", PROP_INT, PROP_NONE);
1523 RNA_def_property_int_sdna(prop, NULL, "int_arg_1");
1524 RNA_def_property_range(prop, -1000, 1000);
1525 RNA_def_property_ui_text(prop, "Min", "Choose a number from a range. Lower boundary of the range");
1526 RNA_def_property_update(prop, NC_LOGIC, NULL);
1528 prop= RNA_def_property(srna, "int_max", PROP_INT, PROP_NONE);
1529 RNA_def_property_int_sdna(prop, NULL, "int_arg_2");
1530 RNA_def_property_range(prop, -1000, 1000);
1531 RNA_def_property_ui_text(prop, "Max", "Choose a number from a range. Upper boundary of the range");
1532 RNA_def_property_update(prop, NC_LOGIC, NULL);
1534 /* ACT_RANDOM_INT_POISSON */
1535 prop= RNA_def_property(srna, "int_mean", PROP_FLOAT, PROP_NONE);
1536 RNA_def_property_float_sdna(prop, NULL, "float_arg_1");
1537 RNA_def_property_range(prop, 0.01, 100.0);
1538 RNA_def_property_ui_text(prop, "Mean", "Expected mean value of the distribution");
1539 RNA_def_property_update(prop, NC_LOGIC, NULL);
1541 /* ACT_RANDOM_FLOAT_CONST */
1542 prop= RNA_def_property(srna, "float_value", PROP_FLOAT, PROP_NONE);
1543 RNA_def_property_float_sdna(prop, NULL, "float_arg_1");
1544 RNA_def_property_range(prop, 0.0, 1.0);
1545 RNA_def_property_ui_text(prop, "Value", "Always return this number");
1546 RNA_def_property_update(prop, NC_LOGIC, NULL);
1548 /* ACT_RANDOM_FLOAT_UNIFORM */
1549 prop= RNA_def_property(srna, "float_min", PROP_FLOAT, PROP_NONE);
1550 RNA_def_property_float_sdna(prop, NULL, "float_arg_1");
1551 RNA_def_property_range(prop, -1000.0, 1000.0);
1552 RNA_def_property_ui_text(prop, "Min", "Choose a number from a range. Lower boundary of the range");
1553 RNA_def_property_update(prop, NC_LOGIC, NULL);
1555 prop= RNA_def_property(srna, "float_max", PROP_FLOAT, PROP_NONE);
1556 RNA_def_property_float_sdna(prop, NULL, "float_arg_2");
1557 RNA_def_property_range(prop, -1000.0, 1000.0);
1558 RNA_def_property_ui_text(prop, "Max", "Choose a number from a range. Upper boundary of the range");
1559 RNA_def_property_update(prop, NC_LOGIC, NULL);
1561 /* ACT_RANDOM_FLOAT_NORMAL */
1562 prop= RNA_def_property(srna, "float_mean", PROP_FLOAT, PROP_NONE);
1563 RNA_def_property_float_sdna(prop, NULL, "float_arg_1");
1564 RNA_def_property_range(prop, -1000.0, 1000.0);
1565 RNA_def_property_ui_text(prop, "Mean", "A normal distribution. Mean of the distribution");
1566 RNA_def_property_update(prop, NC_LOGIC, NULL);
1568 prop= RNA_def_property(srna, "standard_derivation", PROP_FLOAT, PROP_NONE);
1569 RNA_def_property_float_sdna(prop, NULL, "float_arg_2");
1570 RNA_def_property_range(prop, -1000.0, 1000.0);
1571 RNA_def_property_ui_text(prop, "SD", "A normal distribution. Standard deviation of the distribution");
1572 RNA_def_property_update(prop, NC_LOGIC, NULL);
1574 /* ACT_RANDOM_FLOAT_NEGATIVE_EXPONENTIAL */
1575 prop= RNA_def_property(srna, "half_life_time", PROP_FLOAT, PROP_NONE);
1576 RNA_def_property_float_sdna(prop, NULL, "float_arg_1");
1577 RNA_def_property_range(prop, -1000.0, 1000.0);
1578 RNA_def_property_ui_text(prop, "Half-Life Time", "Negative exponential dropoff");
1579 RNA_def_property_update(prop, NC_LOGIC, NULL);
1582 static void rna_def_message_actuator(BlenderRNA *brna)
1587 static EnumPropertyItem prop_body_type_items[] ={
1588 {ACT_MESG_MESG, "TEXT", 0, "Text", ""},
1589 {ACT_MESG_PROP, "PROPERTY", 0, "Property", ""},
1590 {0, NULL, 0, NULL, NULL}};
1592 srna= RNA_def_struct(brna, "MessageActuator", "Actuator");
1593 RNA_def_struct_ui_text(srna, "Message Actuator", "Actuator to ..");
1594 RNA_def_struct_sdna_from(srna, "bMessageActuator", "data");
1596 prop= RNA_def_property(srna, "to_property", PROP_STRING, PROP_NONE);
1597 RNA_def_property_string_sdna(prop, NULL, "toPropName");
1598 RNA_def_property_ui_text(prop, "To", "Optional send message to objects with this name only, or empty to broadcast");
1599 RNA_def_property_update(prop, NC_LOGIC, NULL);
1601 prop= RNA_def_property(srna, "subject", PROP_STRING, PROP_NONE);
1602 RNA_def_property_ui_text(prop, "Subject", "Optional message subject. This is what can be filtered on");
1603 RNA_def_property_update(prop, NC_LOGIC, NULL);
1605 prop= RNA_def_property(srna, "body_type", PROP_ENUM, PROP_NONE);
1606 RNA_def_property_enum_sdna(prop, NULL, "bodyType");
1607 RNA_def_property_enum_items(prop, prop_body_type_items);
1608 RNA_def_property_ui_text(prop, "Body", "Toggle message type: either Text or a PropertyName");
1611 prop= RNA_def_property(srna, "body_message", PROP_STRING, PROP_NONE);
1612 RNA_def_property_string_sdna(prop, NULL, "body");
1613 RNA_def_property_ui_text(prop, "Body", "Optional message body Text");
1614 RNA_def_property_update(prop, NC_LOGIC, NULL);
1617 prop= RNA_def_property(srna, "body_property", PROP_STRING, PROP_NONE);
1618 RNA_def_property_string_sdna(prop, NULL, "body");
1619 RNA_def_property_ui_text(prop, "Prop Name", "The message body will be set by the Property Value");
1620 RNA_def_property_update(prop, NC_LOGIC, NULL);
1623 static void rna_def_game_actuator(BlenderRNA *brna)
1628 static EnumPropertyItem prop_type_items[] ={
1629 // {ACT_GAME_LOAD, "LOAD", 0, "Load Game", ""},
1630 // {ACT_GAME_START, "START", 0, "Start Loaded Game", ""},
1631 // keeping the load/start hacky for compatibility with 2.49
1632 // ideally we could use ACT_GAME_START again and do a do_version()
1634 {ACT_GAME_LOAD, "START", 0, "Start Game From File", ""},
1635 {ACT_GAME_RESTART, "RESTART", 0, "Restart Game", ""},
1636 {ACT_GAME_QUIT, "QUIT", 0, "Quit Game", ""},
1637 {ACT_GAME_SAVECFG, "SAVECFG", 0, "Save bge.logic.globalDict", ""},
1638 {ACT_GAME_LOADCFG, "LOADCFG", 0, "Load bge.logic.globalDict", ""},
1639 {0, NULL, 0, NULL, NULL}};
1641 srna= RNA_def_struct(brna, "GameActuator", "Actuator");
1642 RNA_def_struct_ui_text(srna, "Game Actuator", "");
1643 RNA_def_struct_sdna_from(srna, "bGameActuator", "data");
1645 prop= RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
1646 RNA_def_property_enum_sdna(prop, NULL, "type");
1647 RNA_def_property_enum_items(prop, prop_type_items);
1648 RNA_def_property_ui_text(prop, "Game", "");
1649 RNA_def_property_update(prop, NC_LOGIC, NULL);
1652 prop= RNA_def_property(srna, "filename", PROP_STRING, PROP_FILEPATH);
1653 RNA_def_property_ui_text(prop, "File", "Load this blend file, use the \"//\" prefix for a path relative to the current blend file");
1654 RNA_def_property_update(prop, NC_LOGIC, NULL);
1655 //XXX to do: an operator that calls file_browse with relative_path on and blender filtering active
1658 static void rna_def_visibility_actuator(BlenderRNA *brna)
1663 srna= RNA_def_struct(brna, "VisibilityActuator", "Actuator");
1664 RNA_def_struct_ui_text(srna, "Visibility Actuator", "Actuator to set visibility and occlusion of the object");
1665 RNA_def_struct_sdna_from(srna, "bVisibilityActuator", "data");
1667 prop= RNA_def_property(srna, "use_visible", PROP_BOOLEAN, PROP_NONE);
1668 RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", ACT_VISIBILITY_INVISIBLE);
1669 RNA_def_property_ui_text(prop, "Visible", "Set the objects visible. Initialized from the object render restriction toggle in physics button");
1670 RNA_def_property_update(prop, NC_LOGIC, NULL);
1672 prop= RNA_def_property(srna, "use_occlusion", PROP_BOOLEAN, PROP_NONE);
1673 RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_VISIBILITY_OCCLUSION);
1674 RNA_def_property_ui_text(prop, "Occlusion", "Set the object to occlude objects behind it. Initialized from the object type in physics button");
1675 RNA_def_property_update(prop, NC_LOGIC, NULL);
1677 prop= RNA_def_property(srna, "apply_to_children", PROP_BOOLEAN, PROP_NONE);
1678 RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_VISIBILITY_RECURSIVE);
1679 RNA_def_property_ui_text(prop, "Children", "Set all the children of this object to the same visibility/occlusion recursively");
1680 RNA_def_property_update(prop, NC_LOGIC, NULL);
1683 static void rna_def_twodfilter_actuator(BlenderRNA *brna)
1688 static EnumPropertyItem prop_type_items[] ={
1689 {ACT_2DFILTER_ENABLED, "ENABLE", 0, "Enable Filter", ""},
1690 {ACT_2DFILTER_DISABLED, "DISABLE", 0, "Disable Filter", ""},
1691 {ACT_2DFILTER_NOFILTER, "REMOVE", 0, "Remove Filter", ""},
1692 {ACT_2DFILTER_MOTIONBLUR, "MOTIONBLUR", 0, "Motion Blur", ""},
1693 {ACT_2DFILTER_BLUR, "BLUR", 0, "Blur", ""},
1694 {ACT_2DFILTER_SHARPEN, "SHARPEN", 0, "Sharpen", ""},
1695 {ACT_2DFILTER_DILATION, "DILATION", 0, "Dilation", ""},
1696 {ACT_2DFILTER_EROSION, "EROSION", 0, "Erosion", ""},
1697 {ACT_2DFILTER_LAPLACIAN, "LAPLACIAN", 0, "Laplacian", ""},
1698 {ACT_2DFILTER_SOBEL, "SOBEL", 0, "Sobel", ""},
1699 {ACT_2DFILTER_PREWITT, "PREWITT", 0, "Prewitt", ""},
1700 {ACT_2DFILTER_GRAYSCALE, "GRAYSCALE", 0, "Gray Scale", ""},
1701 {ACT_2DFILTER_SEPIA, "SEPIA", 0, "Sepia", ""},
1702 {ACT_2DFILTER_INVERT, "INVERT", 0, "Invert", ""},
1703 {ACT_2DFILTER_CUSTOMFILTER, "CUSTOMFILTER", 0, "Custom Filter", ""},
1704 // {ACT_2DFILTER_NUMBER_OF_FILTERS, "", 0, "Do not use it. Sentinel", ""},
1705 {0, NULL, 0, NULL, NULL}};
1707 srna= RNA_def_struct(brna, "Filter2DActuator", "Actuator");
1708 RNA_def_struct_ui_text(srna, "Filter 2D Actuator", "Actuator to apply screen graphic effects");
1709 RNA_def_struct_sdna_from(srna, "bTwoDFilterActuator", "data");
1711 prop= RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
1712 RNA_def_property_enum_sdna(prop, NULL, "type");
1713 RNA_def_property_enum_items(prop, prop_type_items);
1714 RNA_def_property_ui_text(prop, "Filter 2D Type", "");
1715 RNA_def_property_update(prop, NC_LOGIC, NULL);
1717 prop= RNA_def_property(srna, "glsl_shader", PROP_POINTER, PROP_NONE);
1718 RNA_def_property_pointer_sdna(prop, NULL, "text");
1719 RNA_def_property_struct_type(prop, "Text");
1720 RNA_def_property_flag(prop, PROP_EDITABLE);
1721 RNA_def_property_ui_text(prop, "Script", "");
1722 RNA_def_property_update(prop, NC_LOGIC, NULL);
1724 prop= RNA_def_property(srna, "filter_pass", PROP_INT, PROP_NONE);
1725 RNA_def_property_int_sdna(prop, NULL, "int_arg");
1726 RNA_def_property_ui_text(prop, "Pass Number", "Set filter order");
1727 RNA_def_property_range(prop, 0, 99); //MAX_RENDER_PASS-1
1728 RNA_def_property_update(prop, NC_LOGIC, NULL);
1730 prop= RNA_def_property(srna, "motion_blur_factor", PROP_FLOAT, PROP_NONE);
1731 RNA_def_property_float_sdna(prop, NULL, "float_arg");
1732 RNA_def_property_ui_text(prop, "Value", "Set motion blur factor");
1733 RNA_def_property_range(prop, 0.0, 1.0);
1734 RNA_def_property_update(prop, NC_LOGIC, NULL);
1737 prop= RNA_def_property(srna, "use_motion_blur", PROP_BOOLEAN, PROP_NONE);
1738 RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", 1);
1739 RNA_def_property_ui_text(prop, "Enable", "Enable/Disable Motion Blur");
1740 RNA_def_property_update(prop, NC_LOGIC, NULL);
1743 static void rna_def_parent_actuator(BlenderRNA *brna)
1748 static EnumPropertyItem prop_type_items[] ={
1749 {ACT_PARENT_SET, "SETPARENT", 0, "Set Parent", ""},
1750 {ACT_PARENT_REMOVE, "REMOVEPARENT", 0, "Remove Parent", ""},
1751 {0, NULL, 0, NULL, NULL}};
1753 srna= RNA_def_struct(brna, "ParentActuator", "Actuator");
1754 RNA_def_struct_ui_text(srna, "Parent Actuator", "");
1755 RNA_def_struct_sdna_from(srna, "bParentActuator", "data");
1757 prop= RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
1758 RNA_def_property_enum_sdna(prop, NULL, "type");
1759 RNA_def_property_enum_items(prop, prop_type_items);
1760 RNA_def_property_ui_text(prop, "Scene", "");
1761 RNA_def_property_update(prop, NC_LOGIC, NULL);
1763 prop= RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
1764 RNA_def_property_struct_type(prop, "Object");
1765 RNA_def_property_pointer_sdna(prop, NULL, "ob");
1766 RNA_def_property_flag(prop, PROP_EDITABLE);
1767 RNA_def_property_ui_text(prop, "Parent Object", "Set this object as parent");
1768 RNA_def_property_update(prop, NC_LOGIC, NULL);
1771 prop= RNA_def_property(srna, "use_compound", PROP_BOOLEAN, PROP_NONE);
1772 RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", ACT_PARENT_COMPOUND);
1773 RNA_def_property_ui_text(prop, "Compound", "Add this object shape to the parent shape (only if the parent shape is already compound)");
1774 RNA_def_property_update(prop, NC_LOGIC, NULL);
1776 prop= RNA_def_property(srna, "use_ghost", PROP_BOOLEAN, PROP_NONE);
1777 RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", ACT_PARENT_GHOST);
1778 RNA_def_property_ui_text(prop, "Ghost", "Make this object ghost while parented");
1779 RNA_def_property_update(prop, NC_LOGIC, NULL);
1782 static void rna_def_shape_action_actuator(BlenderRNA *brna)
1787 static EnumPropertyItem prop_type_items[] ={
1788 {ACT_ACTION_PLAY, "PLAY", 0, "Play", ""},
1789 {ACT_ACTION_PINGPONG, "PINGPONG", 0, "Ping Pong", ""},
1790 {ACT_ACTION_FLIPPER, "FLIPPER", 0, "Flipper", ""},
1791 {ACT_ACTION_LOOP_STOP, "LOOPSTOP", 0, "Loop Stop", ""},
1792 {ACT_ACTION_LOOP_END, "LOOPEND", 0, "Loop End", ""},
1793 {ACT_ACTION_FROM_PROP, "PROPERTY", 0, "Property", ""},
1794 #ifdef __NLA_ACTION_BY_MOTION_ACTUATOR
1795 {ACT_ACTION_MOTION, "MOTION", 0, "Displacement", ""},
1797 {0, NULL, 0, NULL, NULL}};
1799 srna= RNA_def_struct(brna, "ShapeActionActuator", "Actuator");
1800 RNA_def_struct_ui_text(srna, "Shape Action Actuator", "Actuator to control shape key animations");
1801 RNA_def_struct_sdna_from(srna, "bActionActuator", "data");
1803 prop= RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
1804 RNA_def_property_enum_sdna(prop, NULL, "type");
1805 RNA_def_property_enum_items(prop, prop_type_items);
1806 RNA_def_property_ui_text(prop, "Action Type", "Action playback type");
1807 RNA_def_property_update(prop, NC_LOGIC, NULL);
1809 prop= RNA_def_property(srna, "action", PROP_POINTER, PROP_NONE);
1810 RNA_def_property_pointer_sdna(prop, NULL, "act");
1811 RNA_def_property_struct_type(prop, "Action");
1812 RNA_def_property_flag(prop, PROP_EDITABLE);
1813 RNA_def_property_ui_text(prop, "Action", "");
1814 /* note: custom set function is ONLY to avoid rna setting a user for this. */
1815 RNA_def_property_pointer_funcs(prop, NULL, "rna_Actuator_action_action_set", NULL, NULL);
1816 RNA_def_property_update(prop, NC_LOGIC, NULL);
1818 prop= RNA_def_property(srna, "use_continue_last_frame", PROP_BOOLEAN, PROP_NONE);
1819 RNA_def_property_boolean_negative_sdna(prop, NULL, "end_reset", 1);
1820 RNA_def_property_ui_text(prop, "Continue", "Restore last frame when switching on/off, otherwise play from the start each time");
1821 RNA_def_property_update(prop, NC_LOGIC, NULL);
1823 prop= RNA_def_property(srna, "property", PROP_STRING, PROP_NONE);
1824 RNA_def_property_string_sdna(prop, NULL, "name");
1825 RNA_def_property_ui_text(prop, "Property", "Use this property to define the Action position");
1826 RNA_def_property_update(prop, NC_LOGIC, NULL);
1828 prop= RNA_def_property(srna, "frame_start", PROP_FLOAT, PROP_NONE);
1829 RNA_def_property_float_sdna(prop, NULL, "sta");
1830 RNA_def_property_ui_range(prop, 0.0, MAXFRAME, 100, 2);
1831 RNA_def_property_ui_text(prop, "Start Frame", "");
1832 RNA_def_property_update(prop, NC_LOGIC, NULL);
1834 prop= RNA_def_property(srna, "frame_end", PROP_FLOAT, PROP_NONE);
1835 RNA_def_property_float_sdna(prop, NULL, "end");
1836 RNA_def_property_ui_range(prop, 0.0, MAXFRAME, 100, 2);
1837 RNA_def_property_ui_text(prop, "End Frame", "");
1838 RNA_def_property_update(prop, NC_LOGIC, NULL);
1840 prop= RNA_def_property(srna, "frame_blend_in", PROP_INT, PROP_NONE);
1841 RNA_def_property_int_sdna(prop, NULL, "blendin");
1842 RNA_def_property_range(prop, 0, 32767);
1843 RNA_def_property_ui_text(prop, "Blendin", "Number of frames of motion blending");
1844 RNA_def_property_update(prop, NC_LOGIC, NULL);
1846 prop= RNA_def_property(srna, "priority", PROP_INT, PROP_NONE);
1847 RNA_def_property_range(prop, 0, 100);
1848 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");
1849 RNA_def_property_update(prop, NC_LOGIC, NULL);
1851 prop= RNA_def_property(srna, "frame_property", PROP_STRING, PROP_NONE);
1852 RNA_def_property_string_sdna(prop, NULL, "frameProp");
1853 RNA_def_property_ui_text(prop, "Frame Property", "Assign the action's current frame number to this property");
1854 RNA_def_property_update(prop, NC_LOGIC, NULL);
1856 #ifdef __NLA_ACTION_BY_MOTION_ACTUATOR
1857 prop= RNA_def_property(srna, "stride_length", PROP_FLOAT, PROP_NONE);
1858 RNA_def_property_float_sdna(prop, NULL, "stridelength");
1859 RNA_def_property_range(prop, 0.0, 2500.0);
1860 RNA_def_property_ui_text(prop, "Cycle", "Distance covered by a single cycle of the action");
1861 RNA_def_property_update(prop, NC_LOGIC, NULL);
1865 static void rna_def_state_actuator(BlenderRNA *brna)
1870 static EnumPropertyItem prop_type_items[] ={
1871 {ACT_STATE_SET, "SET", 0, "Set State", ""},
1872 {ACT_STATE_ADD, "ADD", 0, "Add State", ""},
1873 {ACT_STATE_REMOVE, "REMOVE", 0, "Remove State", ""},
1874 {ACT_STATE_CHANGE, "CHANGE", 0, "Change State", ""},
1875 {0, NULL, 0, NULL, NULL}};
1877 srna= RNA_def_struct(brna, "StateActuator", "Actuator");
1878 RNA_def_struct_ui_text(srna, "State Actuator", "Actuator to handle states");
1879 RNA_def_struct_sdna_from(srna, "bStateActuator", "data");
1881 prop= RNA_def_property(srna, "operation", PROP_ENUM, PROP_NONE);
1882 RNA_def_property_enum_sdna(prop, NULL, "type");
1883 RNA_def_property_enum_items(prop, prop_type_items);
1884 RNA_def_property_ui_text(prop, "Operation", "Select the bit operation on object state mask");
1885 RNA_def_property_update(prop, NC_LOGIC, NULL);
1887 prop= RNA_def_property(srna, "states", PROP_BOOLEAN, PROP_LAYER_MEMBER);
1888 RNA_def_property_boolean_sdna(prop, NULL, "mask", 1);
1889 RNA_def_property_array(prop, OB_MAX_STATES);
1890 RNA_def_property_ui_text(prop, "State", "");
1891 RNA_def_property_boolean_funcs(prop, NULL, "rna_StateActuator_state_set");
1894 static void rna_def_armature_actuator(BlenderRNA *brna)
1899 static EnumPropertyItem prop_type_items[] ={
1900 {ACT_ARM_RUN, "RUN", 0, "Run Armature", ""},
1901 {ACT_ARM_ENABLE, "ENABLE", 0, "Enable", ""},
1902 {ACT_ARM_DISABLE, "DISABLE", 0, "Disable", ""},
1903 {ACT_ARM_SETTARGET, "SETTARGET", 0, "Set Target", ""},
1904 {ACT_ARM_SETWEIGHT, "SETWEIGHT", 0, "Set Weight", ""},
1905 {0, NULL, 0, NULL, NULL}};
1907 srna= RNA_def_struct(brna, "ArmatureActuator", "Actuator");
1908 RNA_def_struct_ui_text(srna, "Armature Actuator", "Actuator to ..");
1909 RNA_def_struct_sdna_from(srna, "bArmatureActuator", "data");
1911 prop= RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
1912 RNA_def_property_enum_sdna(prop, NULL, "type");
1913 RNA_def_property_enum_items(prop, prop_type_items);
1914 RNA_def_property_ui_text(prop, "Constraint Type", "");
1915 RNA_def_property_update(prop, NC_LOGIC, NULL);
1917 prop= RNA_def_property(srna, "bone", PROP_STRING, PROP_NONE);
1918 RNA_def_property_string_sdna(prop, NULL, "posechannel");
1919 RNA_def_property_ui_text(prop, "Bone", "Bone on which the constraint is defined");
1920 RNA_def_property_update(prop, NC_LOGIC, "rna_Actuator_Armature_update");
1922 prop= RNA_def_property(srna, "constraint", PROP_STRING, PROP_NONE);
1923 RNA_def_property_string_sdna(prop, NULL, "constraint");
1924 RNA_def_property_ui_text(prop, "Constraint", "Name of the constraint you want to control");
1925 RNA_def_property_update(prop, NC_LOGIC, "rna_Actuator_Armature_update");
1927 prop= RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
1928 RNA_def_property_struct_type(prop, "Object");
1929 RNA_def_property_flag(prop, PROP_EDITABLE);
1930 RNA_def_property_ui_text(prop, "Target", "Set this object as the target of the constraint");
1931 RNA_def_property_update(prop, NC_LOGIC, NULL);
1933 prop= RNA_def_property(srna, "secondary_target", PROP_POINTER, PROP_NONE);
1934 RNA_def_property_pointer_sdna(prop, NULL, "subtarget");
1935 RNA_def_property_struct_type(prop, "Object");
1936 RNA_def_property_flag(prop, PROP_EDITABLE);
1937 RNA_def_property_ui_text(prop, "Secondary Target", "Set this object as the secondary target of the constraint (only IK polar target at the moment)");
1938 RNA_def_property_update(prop, NC_LOGIC, NULL);
1940 prop= RNA_def_property(srna, "weight", PROP_FLOAT, PROP_NONE);
1941 RNA_def_property_float_sdna(prop, NULL, "weight");
1942 RNA_def_property_range(prop, 0.0, 1.0);
1943 RNA_def_property_ui_text(prop, "Weight", "Set weight of this constraint");
1944 RNA_def_property_update(prop, NC_LOGIC, NULL);
1947 void RNA_def_actuator(BlenderRNA *brna)
1949 rna_def_actuator(brna);
1951 rna_def_action_actuator(brna);
1952 rna_def_object_actuator(brna);
1953 rna_def_fcurve_actuator(brna);
1954 rna_def_camera_actuator(brna);
1955 rna_def_sound_actuator(brna);
1956 rna_def_property_actuator(brna);
1957 rna_def_constraint_actuator(brna);
1958 rna_def_edit_object_actuator(brna);
1959 rna_def_scene_actuator(brna);
1960 rna_def_random_actuator(brna);
1961 rna_def_message_actuator(brna);
1962 rna_def_game_actuator(brna);
1963 rna_def_visibility_actuator(brna);
1964 rna_def_twodfilter_actuator(brna);
1965 rna_def_parent_actuator(brna);
1966 rna_def_shape_action_actuator(brna);
1967 rna_def_state_actuator(brna);
1968 rna_def_armature_actuator(brna);