diff options
Diffstat (limited to 'source/blender/makesrna/intern')
-rw-r--r-- | source/blender/makesrna/intern/rna_access.c | 2 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_action.c | 73 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_actuator.c | 678 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_constraint.c | 2 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_controller.c | 22 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_define.c | 34 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_image.c | 5 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_internal.h | 2 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_main.c | 5 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_main_api.c | 2 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_object.c | 12 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_object_force.c | 5 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_property.c | 11 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_sensor.c | 200 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_sequencer.c | 14 |
15 files changed, 936 insertions, 131 deletions
diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c index c110b89a818..078b4d995ee 100644 --- a/source/blender/makesrna/intern/rna_access.c +++ b/source/blender/makesrna/intern/rna_access.c @@ -64,7 +64,7 @@ void RNA_init() for(srna=BLENDER_RNA.structs.first; srna; srna=srna->cont.next) { if(!srna->cont.prophash) { - srna->cont.prophash= BLI_ghash_new(BLI_ghashutil_strhash, BLI_ghashutil_strcmp); + srna->cont.prophash= BLI_ghash_new(BLI_ghashutil_strhash, BLI_ghashutil_strcmp, "RNA_init gh"); for(prop=srna->cont.properties.first; prop; prop=prop->next) if(!(prop->flag & PROP_BUILTIN)) diff --git a/source/blender/makesrna/intern/rna_action.c b/source/blender/makesrna/intern/rna_action.c index 127aa191b5c..df0159d22a4 100644 --- a/source/blender/makesrna/intern/rna_action.c +++ b/source/blender/makesrna/intern/rna_action.c @@ -41,6 +41,9 @@ #ifdef RNA_RUNTIME +#include "ED_keyframing.h" +#include "BKE_fcurve.h" + static void rna_ActionGroup_channels_next(CollectionPropertyIterator *iter) { ListBaseIterator *internal= iter->internal; @@ -86,6 +89,43 @@ static void rna_Action_groups_remove(bAction *act, ReportList *reports, bActionG MEM_freeN(agrp); } +static FCurve *rna_Action_fcurve_new(bAction *act, ReportList *reports, char *data_path, int index, char *group) +{ + if(group && group[0]=='\0') group= NULL; + + if(data_path[0] == '\0') { + BKE_report(reports, RPT_ERROR, "FCurve data path empty, invalid argument"); + return NULL; + } + + /* annoying, check if this exists */ + if(verify_fcurve(act, group, data_path, index, 0)) { + BKE_reportf(reports, RPT_ERROR, "FCurve '%s[%d]' alredy exists in action '%s'", data_path, index, act->id.name+2); + return NULL; + } + return verify_fcurve(act, group, data_path, index, 1); +} + +static void rna_Action_fcurve_remove(bAction *act, ReportList *reports, FCurve *fcu) +{ + if(fcu->grp) { + if (BLI_findindex(&act->groups, fcu->grp) == -1) { + BKE_reportf(reports, RPT_ERROR, "FCurve's ActionGroup '%s' not found in action '%s'", fcu->grp->name, act->id.name+2); + return; + } + + action_groups_remove_channel(act, fcu); + } + else { + if(BLI_findindex(&act->curves, fcu) == -1) { + BKE_reportf(reports, RPT_ERROR, "FCurve not found in action '%s'", act->id.name+2); + return; + } + + BLI_remlink(&act->curves, fcu); + free_fcurve(fcu); + } +} #else @@ -291,7 +331,7 @@ static void rna_def_action_groups(BlenderRNA *brna, PropertyRNA *cprop) RNA_def_property_srna(cprop, "ActionGroups"); srna= RNA_def_struct(brna, "ActionGroups", NULL); RNA_def_struct_sdna(srna, "bAction"); - RNA_def_struct_ui_text(srna, "Action Points", "Collection of action groups"); + RNA_def_struct_ui_text(srna, "Action Groups", "Collection of action groups"); func= RNA_def_function(srna, "add", "rna_Action_groups_add"); RNA_def_function_ui_description(func, "Add a keyframe to the curve."); @@ -309,6 +349,36 @@ static void rna_def_action_groups(BlenderRNA *brna, PropertyRNA *cprop) RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL); } +static void rna_def_action_fcurves(BlenderRNA *brna, PropertyRNA *cprop) +{ + StructRNA *srna; + + FunctionRNA *func; + PropertyRNA *parm; + + RNA_def_property_srna(cprop, "ActionFCurves"); + srna= RNA_def_struct(brna, "ActionFCurves", NULL); + RNA_def_struct_sdna(srna, "bAction"); + RNA_def_struct_ui_text(srna, "Action FCurves", "Collection of action fcurves"); + + func= RNA_def_function(srna, "new", "rna_Action_fcurve_new"); + RNA_def_function_ui_description(func, "Add a keyframe to the curve."); + RNA_def_function_flag(func, FUNC_USE_REPORTS); + parm= RNA_def_string(func, "data_path", "", 0, "Data Path", "FCurve data path to use."); + parm= RNA_def_int(func, "array_index", 0, 0, INT_MAX, "Index", "Array index.", 0, INT_MAX); + parm= RNA_def_string(func, "action_group", "", 0, "Action Group", "Acton group to add this fcurve into."); + + parm= RNA_def_pointer(func, "fcurve", "FCurve", "", "Newly created fcurve"); + RNA_def_function_return(func, parm); + + + func= RNA_def_function(srna, "remove", "rna_Action_fcurve_remove"); + RNA_def_function_ui_description(func, "Remove action group."); + RNA_def_function_flag(func, FUNC_USE_REPORTS); + parm= RNA_def_pointer(func, "fcurve", "FCurve", "", "FCurve to remove."); + RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL); +} + static void rna_def_action(BlenderRNA *brna) { StructRNA *srna; @@ -323,6 +393,7 @@ static void rna_def_action(BlenderRNA *brna) RNA_def_property_collection_sdna(prop, NULL, "curves", NULL); RNA_def_property_struct_type(prop, "FCurve"); RNA_def_property_ui_text(prop, "F-Curves", "The individual F-Curves that make up the Action"); + rna_def_action_fcurves(brna, prop); prop= RNA_def_property(srna, "groups", PROP_COLLECTION, PROP_NONE); RNA_def_property_collection_sdna(prop, NULL, "groups", NULL); diff --git a/source/blender/makesrna/intern/rna_actuator.c b/source/blender/makesrna/intern/rna_actuator.c index 4254f4280f8..cb99f4dbbe7 100644 --- a/source/blender/makesrna/intern/rna_actuator.c +++ b/source/blender/makesrna/intern/rna_actuator.c @@ -27,7 +27,7 @@ #include "RNA_define.h" #include "rna_internal.h" - +#include "DNA_object_types.h" #include "DNA_actuator_types.h" #include "DNA_scene_types.h" // for MAXFRAME @@ -41,7 +41,7 @@ EnumPropertyItem actuator_type_items[] ={ {ACT_EDIT_OBJECT, "EDIT_OBJECT", 0, "Edit Object", ""}, {ACT_2DFILTER, "FILTER_2D", 0, "2D Filter", ""}, {ACT_GAME, "GAME", 0, "Game", ""}, - {ACT_IPO, "IPO", 0, "IPO", ""}, + {ACT_IPO, "F-Curve", 0, "F-Curve", ""}, {ACT_MESSAGE, "MESSAGE", 0, "Message", ""}, {ACT_OBJECT, "OBJECT", 0, "Motion", ""}, {ACT_PARENT, "PARENT", 0, "Parent", ""}, @@ -54,6 +54,14 @@ EnumPropertyItem actuator_type_items[] ={ {ACT_VISIBILITY, "VISIBILITY", 0, "Visibility", ""}, {0, NULL, 0, NULL, NULL}}; +EnumPropertyItem edit_object_type_items[] ={ + {ACT_EDOB_ADD_OBJECT, "ADDOBJECT", 0, "Add Object", ""}, + {ACT_EDOB_END_OBJECT, "ENDOBJECT", 0, "End Object", ""}, + {ACT_EDOB_REPLACE_MESH, "REPLACEMESH", 0, "Replace Mesh", ""}, + {ACT_EDOB_TRACK_TO, "TRACKTO", 0, "Track to", ""}, + {ACT_EDOB_DYNAMICS, "DYNAMICS", 0, "Dynamics", ""}, + {0, NULL, 0, NULL, NULL} }; + #ifdef RNA_RUNTIME #include "BKE_sca.h" @@ -63,10 +71,12 @@ static StructRNA* rna_Actuator_refine(struct PointerRNA *ptr) bActuator *actuator= (bActuator*)ptr->data; switch(actuator->type) { + case ACT_ACTION: + return &RNA_ActionActuator; case ACT_OBJECT: return &RNA_ObjectActuator; case ACT_IPO: - return &RNA_IpoActuator; + return &RNA_FcurveActuator; case ACT_CAMERA: return &RNA_CameraActuator; case ACT_SOUND: @@ -102,11 +112,307 @@ static StructRNA* rna_Actuator_refine(struct PointerRNA *ptr) } } -static void rna_Actuator_type_update(Main *bmain, Scene *scene, PointerRNA *ptr) +static void rna_Actuator_type_set(struct PointerRNA *ptr, int value) { bActuator *act= (bActuator *)ptr->data; + if (value != act->type) + { + act->type = value; + init_actuator(act); + } +} + +static float rna_ConstraintActuator_limitmin_get(struct PointerRNA *ptr) +{ + bActuator *act = (bActuator*)ptr->data; + bConstraintActuator *ca = act->data; + float *fp; + + if(ca->flag & ACT_CONST_LOCX) fp= ca->minloc; + else if(ca->flag & ACT_CONST_LOCY) fp= ca->minloc+1; + else if(ca->flag & ACT_CONST_LOCZ) fp= ca->minloc+2; + else if(ca->flag & ACT_CONST_ROTX) fp= ca->minrot; + else if(ca->flag & ACT_CONST_ROTY) fp= ca->minrot+1; + else fp= ca->minrot+2; + + return *fp; +} + +static void rna_ConstraintActuator_limitmin_set(struct PointerRNA *ptr, float value) +{ + bActuator *act = (bActuator*)ptr->data; + bConstraintActuator *ca = act->data; + float *fp; + + if(ca->flag & ACT_CONST_LOCX) fp= ca->minloc; + else if(ca->flag & ACT_CONST_LOCY) fp= ca->minloc+1; + else if(ca->flag & ACT_CONST_LOCZ) fp= ca->minloc+2; + else if(ca->flag & ACT_CONST_ROTX) fp= ca->minrot; + else if(ca->flag & ACT_CONST_ROTY) fp= ca->minrot+1; + else fp= ca->minrot+2; + + *fp = value; +} + +static float rna_ConstraintActuator_limitmax_get(struct PointerRNA *ptr) +{ + bActuator *act = (bActuator*)ptr->data; + bConstraintActuator *ca = act->data; + float *fp; + + if(ca->flag & ACT_CONST_LOCX) fp= ca->maxloc; + else if(ca->flag & ACT_CONST_LOCY) fp= ca->maxloc+1; + else if(ca->flag & ACT_CONST_LOCZ) fp= ca->maxloc+2; + else if(ca->flag & ACT_CONST_ROTX) fp= ca->maxrot; + else if(ca->flag & ACT_CONST_ROTY) fp= ca->maxrot+1; + else fp= ca->maxrot+2; + + return *fp; +} + +static void rna_ConstraintActuator_limitmax_set(struct PointerRNA *ptr, float value) +{ + bActuator *act = (bActuator*)ptr->data; + bConstraintActuator *ca = act->data; + float *fp; + + if(ca->flag & ACT_CONST_LOCX) fp= ca->maxloc; + else if(ca->flag & ACT_CONST_LOCY) fp= ca->maxloc+1; + else if(ca->flag & ACT_CONST_LOCZ) fp= ca->maxloc+2; + else if(ca->flag & ACT_CONST_ROTX) fp= ca->maxrot; + else if(ca->flag & ACT_CONST_ROTY) fp= ca->maxrot+1; + else fp= ca->maxrot+2; + + *fp = value; +} + +static float rna_ConstraintActuator_distance_get(struct PointerRNA *ptr) +{ + bActuator *act = (bActuator*)ptr->data; + bConstraintActuator *ca = act->data; + float *fp; + + if(ca->mode & (ACT_CONST_DIRPX|ACT_CONST_DIRNX)) fp= ca->minloc; + else if(ca->mode & (ACT_CONST_DIRPY|ACT_CONST_DIRNY)) fp= ca->minloc+1; + else fp= ca->minloc+2; + + return *fp; +} + +static void rna_ConstraintActuator_distance_set(struct PointerRNA *ptr, float value) +{ + bActuator *act = (bActuator*)ptr->data; + bConstraintActuator *ca = act->data; + float *fp; + + if(ca->mode & (ACT_CONST_DIRPX|ACT_CONST_DIRNX)) fp= ca->minloc; + else if(ca->mode & (ACT_CONST_DIRPY|ACT_CONST_DIRNY)) fp= ca->minloc+1; + else fp= ca->minloc+2; + + *fp = value; +} + +static float rna_ConstraintActuator_range_get(struct PointerRNA *ptr) +{ + bActuator *act = (bActuator*)ptr->data; + bConstraintActuator *ca = act->data; + float *fp; + + if(ca->mode & (ACT_CONST_DIRPX|ACT_CONST_DIRNX)) fp= ca->maxloc; + else if(ca->mode & (ACT_CONST_DIRPY|ACT_CONST_DIRNY)) fp= ca->maxloc+1; + else fp= ca->maxloc+2; + + return *fp; +} + +static void rna_ConstraintActuator_range_set(struct PointerRNA *ptr, float value) +{ + bActuator *act = (bActuator*)ptr->data; + bConstraintActuator *ca = act->data; + float *fp; + + if(ca->mode & (ACT_CONST_DIRPX|ACT_CONST_DIRNX)) fp= ca->maxloc; + else if(ca->mode & (ACT_CONST_DIRPY|ACT_CONST_DIRNY)) fp= ca->maxloc+1; + else fp= ca->maxloc+2; + + *fp = value; +} + +static float rna_ConstraintActuator_fhheight_get(struct PointerRNA *ptr) +{ + bActuator *act = (bActuator*)ptr->data; + bConstraintActuator *ca = act->data; + float *fp; + + if(ca->mode & (ACT_CONST_DIRPX|ACT_CONST_DIRNX)) fp= ca->minloc; + else if(ca->mode & (ACT_CONST_DIRPY|ACT_CONST_DIRNY)) fp= ca->minloc+1; + else fp= ca->minloc+2; + + return *fp; +} + +static void rna_ConstraintActuator_fhheight_set(struct PointerRNA *ptr, float value) +{ + bActuator *act = (bActuator*)ptr->data; + bConstraintActuator *ca = act->data; + float *fp; + + if(ca->mode & (ACT_CONST_DIRPX|ACT_CONST_DIRNX)) fp= ca->minloc; + else if(ca->mode & (ACT_CONST_DIRPY|ACT_CONST_DIRNY)) fp= ca->minloc+1; + else fp= ca->minloc+2; + + *fp = value; +} + +static float rna_ConstraintActuator_spring_get(struct PointerRNA *ptr) +{ + bActuator *act = (bActuator*)ptr->data; + bConstraintActuator *ca = act->data; + float *fp; + + if(ca->mode & (ACT_CONST_DIRPX|ACT_CONST_DIRNX)) fp= ca->maxloc; + else if(ca->mode & (ACT_CONST_DIRPY|ACT_CONST_DIRNY)) fp= ca->maxloc+1; + else fp= ca->maxloc+2; + + return *fp; +} + +static void rna_ConstraintActuator_spring_set(struct PointerRNA *ptr, float value) +{ + bActuator *act = (bActuator*)ptr->data; + bConstraintActuator *ca = act->data; + float *fp; + + if(ca->mode & (ACT_CONST_DIRPX|ACT_CONST_DIRNX)) fp= ca->maxloc; + else if(ca->mode & (ACT_CONST_DIRPY|ACT_CONST_DIRNY)) fp= ca->maxloc+1; + else fp= ca->maxloc+2; + + *fp = value; +} + +static void rna_FcurveActuator_add_set(struct PointerRNA *ptr, int value) +{ + bActuator *act = (bActuator *)ptr->data; + bIpoActuator *ia = act->data; + + if(value == 1){ + ia->flag &= ~ACT_IPOFORCE; + ia->flag |= ACT_IPOADD; + }else + ia->flag &= ~ACT_IPOADD; +} + +static void rna_FcurveActuator_force_set(struct PointerRNA *ptr, int value) +{ + bActuator *act = (bActuator *)ptr->data; + bIpoActuator *ia = act->data; + + if(value == 1){ + ia->flag &= ~ACT_IPOADD; + ia->flag |= ACT_IPOFORCE; + }else + ia->flag &= ~ACT_IPOFORCE; +} + +static void rna_ObjectActuator_integralcoefficient_set(struct PointerRNA *ptr, float value) +{ + bActuator *act = (bActuator*)ptr->data; + bObjectActuator *oa = act->data; + + oa->forcerot[1] = value; + oa->forcerot[0] = 60.0f*oa->forcerot[1]; +} + +static void rna_StateActuator_state_set(PointerRNA *ptr, const int *values) +{ + bActuator *act = (bActuator*)ptr->data; + bStateActuator *sa = act->data; + + int i, tot= 0; + + /* ensure we always have some state selected */ + for(i=0; i<OB_MAX_STATES; i++) + if(values[i]) + tot++; - init_actuator(act); + if(tot==0) + return; + + for(i=0; i<OB_MAX_STATES; i++) { + if(values[i]) sa->mask |= (1<<i); + else sa->mask &= ~(1<<i); + } +} + +static EnumPropertyItem *rna_EditObjectActuator_mode_itemf(bContext *C, PointerRNA *ptr, int *free) +{ + EnumPropertyItem *item= NULL; + Object *ob = (Object *)ptr->id.data; + + int totitem= 0; + if (ob->type!=OB_ARMATURE) + { + RNA_enum_items_add_value(&item, &totitem, edit_object_type_items, ACT_EDOB_REPLACE_MESH); + RNA_enum_items_add_value(&item, &totitem, edit_object_type_items, ACT_EDOB_DYNAMICS); + } + + RNA_enum_items_add_value(&item, &totitem, edit_object_type_items, ACT_EDOB_ADD_OBJECT); + RNA_enum_items_add_value(&item, &totitem, edit_object_type_items, ACT_EDOB_END_OBJECT); + RNA_enum_items_add_value(&item, &totitem, edit_object_type_items, ACT_EDOB_TRACK_TO); + + RNA_enum_item_end(&item, &totitem); + *free= 1; + + return item; +} + +EnumPropertyItem *rna_Actuator_type_itemf(bContext *C, PointerRNA *ptr, int *free) +{ + EnumPropertyItem *item= NULL; + Object *ob= NULL; + int totitem= 0; + + if (ptr->type == &RNA_Actuator) { + ob = (Object *)ptr->id.data; + } else { + /* can't use ob from ptr->id.data because that enum is also used by operators */ + ob = CTX_data_active_object(C); + } + + if (ob != NULL) { + if (ob->type==OB_ARMATURE) { + RNA_enum_items_add_value(&item, &totitem, actuator_type_items, ACT_ACTION); + RNA_enum_items_add_value(&item, &totitem, actuator_type_items, ACT_ARMATURE); + } + } + + RNA_enum_items_add_value(&item, &totitem, actuator_type_items, ACT_CAMERA); + RNA_enum_items_add_value(&item, &totitem, actuator_type_items, ACT_CONSTRAINT); + RNA_enum_items_add_value(&item, &totitem, actuator_type_items, ACT_EDIT_OBJECT); + RNA_enum_items_add_value(&item, &totitem, actuator_type_items, ACT_2DFILTER); + RNA_enum_items_add_value(&item, &totitem, actuator_type_items, ACT_GAME); + RNA_enum_items_add_value(&item, &totitem, actuator_type_items, ACT_IPO); + RNA_enum_items_add_value(&item, &totitem, actuator_type_items, ACT_MESSAGE); + RNA_enum_items_add_value(&item, &totitem, actuator_type_items, ACT_OBJECT); + RNA_enum_items_add_value(&item, &totitem, actuator_type_items, ACT_PARENT); + RNA_enum_items_add_value(&item, &totitem, actuator_type_items, ACT_PROPERTY); + RNA_enum_items_add_value(&item, &totitem, actuator_type_items, ACT_RANDOM); + RNA_enum_items_add_value(&item, &totitem, actuator_type_items, ACT_SCENE); + + if (ob != NULL) { + if (ob->type==OB_MESH){ + RNA_enum_items_add_value(&item, &totitem, actuator_type_items, ACT_SHAPEACTION); + } + } + + RNA_enum_items_add_value(&item, &totitem, actuator_type_items, ACT_SOUND); + RNA_enum_items_add_value(&item, &totitem, actuator_type_items, ACT_STATE); + RNA_enum_items_add_value(&item, &totitem, actuator_type_items, ACT_VISIBILITY); + + RNA_enum_item_end(&item, &totitem); + *free= 1; + + return item; } #else @@ -127,15 +433,92 @@ void rna_def_actuator(BlenderRNA *brna) prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_enum_items(prop, actuator_type_items); + RNA_def_property_enum_funcs(prop, NULL, "rna_Actuator_type_set", "rna_Actuator_type_itemf"); RNA_def_property_ui_text(prop, "Type", ""); - RNA_def_property_update(prop, 0, "rna_Actuator_type_update"); - prop= RNA_def_property(srna, "expanded", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_SHOW); RNA_def_property_ui_text(prop, "Expanded", "Set actuator expanded in the user interface"); RNA_def_property_ui_icon(prop, ICON_TRIA_RIGHT, 1); +} + +static void rna_def_action_actuator(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + static EnumPropertyItem prop_type_items[] ={ + {ACT_ACTION_PLAY, "PLAY", 0, "Play", ""}, + {ACT_ACTION_FLIPPER, "FLIPPER", 0, "Flipper", ""}, + {ACT_ACTION_LOOP_STOP, "LOOPSTOP", 0, "Loop Stop", ""}, + {ACT_ACTION_LOOP_END, "LOOPEND", 0, "Loop End", ""}, + {ACT_ACTION_FROM_PROP, "PROPERTY", 0, "Property", ""}, +#ifdef __NLA_ACTION_BY_MOTION_ACTUATOR + {ACT_ACTION_MOTION, "MOTION", 0, "Displacement", ""}, +#endif + {0, NULL, 0, NULL, NULL}}; + + srna= RNA_def_struct(brna, "ActionActuator", "Actuator"); + RNA_def_struct_ui_text(srna, "Action Actuator", "Actuator to control the object movement"); + RNA_def_struct_sdna_from(srna, "bActionActuator", "data"); + + prop= RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "type"); + RNA_def_property_enum_items(prop, prop_type_items); + RNA_def_property_ui_text(prop, "Action type", "Action playback type"); + RNA_def_property_update(prop, NC_LOGIC, NULL); + + prop= RNA_def_property(srna, "action", PROP_POINTER, PROP_NONE); + RNA_def_property_pointer_sdna(prop, NULL, "act"); + RNA_def_property_struct_type(prop, "Action"); + RNA_def_property_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Action", ""); + RNA_def_property_update(prop, NC_LOGIC, NULL); + + prop= RNA_def_property(srna, "continue_last_frame", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "end_reset", 1); + RNA_def_property_ui_text(prop, "Continue", "Restore last frame when switching on/off, otherwise play from the start each time"); + RNA_def_property_update(prop, NC_LOGIC, NULL); + + prop= RNA_def_property(srna, "property", PROP_STRING, PROP_NONE); + RNA_def_property_string_sdna(prop, NULL, "name"); + RNA_def_property_ui_text(prop, "Property", "Use this property to define the Action position"); + RNA_def_property_update(prop, NC_LOGIC, NULL); + + prop= RNA_def_property(srna, "frame_start", PROP_INT, PROP_NONE); + RNA_def_property_int_sdna(prop, NULL, "sta"); + RNA_def_property_range(prop, 0, MAXFRAME); + RNA_def_property_ui_text(prop, "Start frame", ""); + RNA_def_property_update(prop, NC_LOGIC, NULL); + + prop= RNA_def_property(srna, "frame_end", PROP_INT, PROP_NONE); + RNA_def_property_int_sdna(prop, NULL, "end"); + RNA_def_property_range(prop, 0, MAXFRAME); + RNA_def_property_ui_text(prop, "End frame", ""); + RNA_def_property_update(prop, NC_LOGIC, NULL); + + prop= RNA_def_property(srna, "blendin", PROP_INT, PROP_NONE); + RNA_def_property_range(prop, 0, 32767); + RNA_def_property_ui_text(prop, "Blendin", "Number of frames of motion blending"); + RNA_def_property_update(prop, NC_LOGIC, NULL); + + prop= RNA_def_property(srna, "priority", PROP_INT, PROP_NONE); + RNA_def_property_range(prop, 0, 100); + 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"); + RNA_def_property_update(prop, NC_LOGIC, NULL); + + prop= RNA_def_property(srna, "frame_property", PROP_STRING, PROP_NONE); + RNA_def_property_string_sdna(prop, NULL, "frameProp"); + RNA_def_property_ui_text(prop, "Frame Property", "Assign the action's current frame number to this property"); + RNA_def_property_update(prop, NC_LOGIC, NULL); + +#ifdef __NLA_ACTION_BY_MOTION_ACTUATOR + prop= RNA_def_property(srna, "stride_length", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "stridelength"); + RNA_def_property_range(prop, 0.0, 2500.0); + RNA_def_property_ui_text(prop, "Cycle", "Distance covered by a single cycle of the action"); + RNA_def_property_update(prop, NC_LOGIC, NULL); +#endif } static void rna_def_object_actuator(BlenderRNA *brna) @@ -144,7 +527,7 @@ static void rna_def_object_actuator(BlenderRNA *brna) PropertyRNA* prop; static EnumPropertyItem prop_type_items[] ={ - {ACT_OBJECT_NORMAL, "OBJECT_NORMAL", 0, "Simple motion", ""}, + {ACT_OBJECT_NORMAL, "OBJECT_NORMAL", 0, "Simple Motion", ""}, {ACT_OBJECT_SERVO, "OBJECT_SERVO", 0, "Servo Control", ""}, {0, NULL, 0, NULL, NULL}}; @@ -158,7 +541,6 @@ static void rna_def_object_actuator(BlenderRNA *brna) RNA_def_property_enum_items(prop, prop_type_items); RNA_def_property_ui_text(prop, "Motion Type", "Specify the motion system"); RNA_def_property_update(prop, NC_LOGIC, NULL); - // XXX otype = type prop= RNA_def_property(srna, "reference_object", PROP_POINTER, PROP_NONE); RNA_def_property_struct_type(prop, "Object"); @@ -169,7 +551,7 @@ static void rna_def_object_actuator(BlenderRNA *brna) prop= RNA_def_property(srna, "damping", PROP_INT, PROP_NONE); RNA_def_property_ui_range(prop, 0, 1000, 1, 1); - RNA_def_property_ui_text(prop, "Damping", "Number of frames to reach the target velocity"); + RNA_def_property_ui_text(prop, "Damping Frames", "Number of frames to reach the target velocity"); RNA_def_property_update(prop, NC_LOGIC, NULL); prop= RNA_def_property(srna, "proportional_coefficient", PROP_FLOAT, PROP_NONE); @@ -181,6 +563,7 @@ static void rna_def_object_actuator(BlenderRNA *brna) prop= RNA_def_property(srna, "integral_coefficient", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "forcerot[1]"); RNA_def_property_ui_range(prop, 0.0, 3.0, 0.1, 0.01); + RNA_def_property_float_funcs(prop, NULL, "rna_ObjectActuator_integralcoefficient_set", NULL); RNA_def_property_ui_text(prop, "Integral Coefficient", "Low value (0.01) for slow response, high value (0.5) for fast response"); RNA_def_property_update(prop, NC_LOGIC, NULL); @@ -200,7 +583,7 @@ static void rna_def_object_actuator(BlenderRNA *brna) prop= RNA_def_property(srna, "force_min_x", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "drot[0]"); RNA_def_property_ui_range(prop, -100.0, 100.0, 1.0, 0.1); - RNA_def_property_ui_text(prop, "Max", "Set the lower limit for force"); + RNA_def_property_ui_text(prop, "Min", "Set the lower limit for force"); RNA_def_property_update(prop, NC_LOGIC, NULL); prop= RNA_def_property(srna, "force_max_y", PROP_FLOAT, PROP_NONE); @@ -212,7 +595,7 @@ static void rna_def_object_actuator(BlenderRNA *brna) prop= RNA_def_property(srna, "force_min_y", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "drot[1]"); RNA_def_property_ui_range(prop, -100.0, 100.0, 1.0, 0.1); - RNA_def_property_ui_text(prop, "Max", "Set the lower limit for force"); + RNA_def_property_ui_text(prop, "Min", "Set the lower limit for force"); RNA_def_property_update(prop, NC_LOGIC, NULL); prop= RNA_def_property(srna, "force_max_z", PROP_FLOAT, PROP_NONE); @@ -224,7 +607,7 @@ static void rna_def_object_actuator(BlenderRNA *brna) prop= RNA_def_property(srna, "force_min_z", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "drot[2]"); RNA_def_property_ui_range(prop, -100.0, 100.0, 1.0, 0.1); - RNA_def_property_ui_text(prop, "Max", "Set the lower limit for force"); + RNA_def_property_ui_text(prop, "Min", "Set the lower limit for force"); RNA_def_property_update(prop, NC_LOGIC, NULL); /* floats 3 Arrays*/ @@ -322,7 +705,7 @@ static void rna_def_object_actuator(BlenderRNA *brna) RNA_def_property_update(prop, NC_LOGIC, NULL); } -static void rna_def_ipo_actuator(BlenderRNA *brna) +static void rna_def_fcurve_actuator(BlenderRNA *brna) { StructRNA *srna; PropertyRNA *prop; @@ -337,14 +720,14 @@ static void rna_def_ipo_actuator(BlenderRNA *brna) {ACT_IPO_FROM_PROP, "PROP", 0, "Property", ""}, {0, NULL, 0, NULL, NULL}}; - srna= RNA_def_struct(brna, "IpoActuator", "Actuator"); - RNA_def_struct_ui_text(srna, "IPO Actuator", "Actuator to animate the object"); + srna= RNA_def_struct(brna, "FcurveActuator", "Actuator"); + RNA_def_struct_ui_text(srna, "F-Curve Actuator", "Actuator to animate the object"); RNA_def_struct_sdna_from(srna, "bIpoActuator", "data"); prop= RNA_def_property(srna, "play_type", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "type"); RNA_def_property_enum_items(prop, prop_type_items); - RNA_def_property_ui_text(prop, "IPO Type", "Specify the way you want to play the animation"); + RNA_def_property_ui_text(prop, "F-Curve Type", "Specify the way you want to play the animation"); RNA_def_property_update(prop, NC_LOGIC, NULL); prop= RNA_def_property(srna, "frame_start", PROP_INT, PROP_NONE); @@ -361,7 +744,7 @@ static void rna_def_ipo_actuator(BlenderRNA *brna) prop= RNA_def_property(srna, "property", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "name"); - RNA_def_property_ui_text(prop, "Property", "Use this property to define the Ipo position"); + RNA_def_property_ui_text(prop, "Property", "Use this property to define the F-Curve position"); RNA_def_property_update(prop, NC_LOGIC, NULL); prop= RNA_def_property(srna, "frame_property", PROP_STRING, PROP_NONE); @@ -369,29 +752,27 @@ static void rna_def_ipo_actuator(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Frame Property", "Assign the action's current frame number to this property"); /* booleans */ + prop= RNA_def_property(srna, "add", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_IPOADD); + RNA_def_property_boolean_funcs(prop, NULL, "rna_FcurveActuator_add_set"); + 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"); + RNA_def_property_update(prop, NC_LOGIC, NULL); + prop= RNA_def_property(srna, "force", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_IPOFORCE); - RNA_def_property_ui_text(prop, "Force", "Apply IPO as a global or local force depending on the local option (dynamic objects only)"); + RNA_def_property_boolean_funcs(prop, NULL, "rna_FcurveActuator_force_set"); + RNA_def_property_ui_text(prop, "Force", "Apply F-Curve as a global or local force depending on the local option (dynamic objects only)"); RNA_def_property_update(prop, NC_LOGIC, NULL); -//XXX logic_window::change_ipo_actuator -// RNA_def_property_boolean_funcs(prop, "rna_Actuator_Ipo_get", "rna_Actuator_Ipo_get", "rna_Actuator_Ipo_range"); prop= RNA_def_property(srna, "local", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_IPOLOCAL); - RNA_def_property_ui_text(prop, "L", "Let the IPO act in local coordinates, used in Force and Add mode"); + RNA_def_property_ui_text(prop, "L", "Let the F-Curve act in local coordinates, used in Force and Add mode"); RNA_def_property_update(prop, NC_LOGIC, NULL); prop= RNA_def_property(srna, "child", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_IPOCHILD); - RNA_def_property_ui_text(prop, "Child", "Update IPO on all children Objects as well"); + RNA_def_property_ui_text(prop, "Child", "Update F-Curve on all children Objects as well"); RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop= RNA_def_property(srna, "add", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_IPOADD); - RNA_def_property_ui_text(prop, "Add", "Ipo is added to the current loc/rot/scale in global or local coordinate according to Local flag"); - RNA_def_property_update(prop, NC_LOGIC, NULL); -//XXX logic_window::change_ipo_actuator -// RNA_def_property_boolean_funcs(prop, "rna_Actuator_Ipo_get", "rna_Actuator_Ipo_get", "rna_Actuator_Ipo_range"); } static void rna_def_camera_actuator(BlenderRNA *brna) @@ -400,8 +781,8 @@ static void rna_def_camera_actuator(BlenderRNA *brna) PropertyRNA *prop; static EnumPropertyItem prop_axis_items[] ={ - {(float)'x', "X", 0, "X", "Camera tries to get behind the X axis"}, - {(float)'y', "Y", 0, "Y", "Camera tries to get behind the Y axis"}, + {ACT_CAMERA_X, "X", 0, "X", "Camera tries to get behind the X axis"}, + {ACT_CAMERA_Y, "Y", 0, "Y", "Camera tries to get behind the Y axis"}, {0, NULL, 0, NULL, NULL}}; srna= RNA_def_struct(brna, "CameraActuator", "Actuator"); @@ -432,14 +813,11 @@ static void rna_def_camera_actuator(BlenderRNA *brna) RNA_def_property_update(prop, NC_LOGIC, NULL); /* x/y */ - // It could be changed to be a regular ENUM instead of this weird "(float)string enum" prop= RNA_def_property(srna, "axis", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "axis"); RNA_def_property_enum_items(prop, prop_axis_items); RNA_def_property_ui_text(prop, "Axis", "Specify the axis the Camera will try to get behind"); RNA_def_property_update(prop, NC_LOGIC, NULL); - //XXX it's not working (no default value) - // probably need to make a get/set function } static void rna_def_sound_actuator(BlenderRNA *brna) @@ -470,7 +848,7 @@ static void rna_def_sound_actuator(BlenderRNA *brna) prop= RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "type"); RNA_def_property_enum_items(prop, prop_type_items); - RNA_def_property_ui_text(prop, "Type", ""); + RNA_def_property_ui_text(prop, "Play Mode", ""); RNA_def_property_update(prop, NC_LOGIC, NULL); prop= RNA_def_property(srna, "volume", PROP_FLOAT, PROP_NONE); @@ -563,8 +941,7 @@ static void rna_def_property_actuator(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Mode", ""); RNA_def_property_update(prop, NC_LOGIC, NULL); - //XXX add magic property lookup - prop= RNA_def_property(srna, "prop_name", PROP_STRING, PROP_NONE); + prop= RNA_def_property(srna, "property", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "name"); RNA_def_property_ui_text(prop, "Property", "The name of the property"); RNA_def_property_update(prop, NC_LOGIC, NULL); @@ -582,7 +959,7 @@ static void rna_def_property_actuator(BlenderRNA *brna) RNA_def_property_update(prop, NC_LOGIC, NULL); //XXX add even magic'er property lookup (need to look for the property list of the target object) - prop= RNA_def_property(srna, "object_prop_name", PROP_STRING, PROP_NONE); + prop= RNA_def_property(srna, "object_property", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "value"); RNA_def_property_ui_text(prop, "Property Name", "Copy this property"); RNA_def_property_update(prop, NC_LOGIC, NULL); @@ -591,7 +968,7 @@ static void rna_def_property_actuator(BlenderRNA *brna) static void rna_def_constraint_actuator(BlenderRNA *brna) { StructRNA *srna; - /*PropertyRNA *prop; + PropertyRNA *prop; static EnumPropertyItem prop_type_items[] ={ {ACT_CONST_TYPE_LOC, "LOC", 0, "Location Constraint", ""}, @@ -599,13 +976,186 @@ static void rna_def_constraint_actuator(BlenderRNA *brna) {ACT_CONST_TYPE_ORI, "ORI", 0, "Orientation Constraint", ""}, {ACT_CONST_TYPE_FH, "FH", 0, "Force Field Constraint", ""}, {0, NULL, 0, NULL, NULL} - };*/ + }; + + static EnumPropertyItem prop_limit_items[] ={ + {ACT_CONST_NONE, "NONE", 0, "None", ""}, + {ACT_CONST_LOCX, "LOCX", 0, "Loc X", ""}, + {ACT_CONST_LOCY, "LOCY", 0, "Loc Y", ""}, + {ACT_CONST_LOCZ, "LOCZ", 0, "Loc Z", ""}, + {0, NULL, 0, NULL, NULL} + }; + + static EnumPropertyItem prop_direction_items[] ={ + {ACT_CONST_NONE, "NONE", 0, "None", ""}, + {ACT_CONST_DIRPX, "DIRPX", 0, "X axis", ""}, + {ACT_CONST_DIRPY, "DIRPY", 0, "Y axis", ""}, + {ACT_CONST_DIRPZ, "DIRPZ", 0, "Z axis", ""}, + {ACT_CONST_DIRNX, "DIRNX", 0, "-X axis", ""}, + {ACT_CONST_DIRNY, "DIRNY", 0, "-Y axis", ""}, + {ACT_CONST_DIRNZ, "DIRNZ", 0, "-Z axis", ""}, + {0, NULL, 0, NULL, NULL} + }; srna= RNA_def_struct(brna, "ConstraintActuator", "Actuator"); - RNA_def_struct_ui_text(srna, "Constraint Actuator", "Actuator to .."); + RNA_def_struct_ui_text(srna, "Constraint Actuator", "Actuator to handle Constraints"); RNA_def_struct_sdna_from(srna, "bConstraintActuator", "data"); - //XXX + prop= RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "type"); + RNA_def_property_enum_items(prop, prop_type_items); + RNA_def_property_ui_text(prop, "Constraints Mode", "The type of the constraint"); + RNA_def_property_update(prop, NC_LOGIC, NULL); + + prop= RNA_def_property(srna, "limit", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "flag"); + RNA_def_property_enum_items(prop, prop_limit_items); + RNA_def_property_ui_text(prop, "Limit", ""); + RNA_def_property_update(prop, NC_LOGIC, NULL); + + prop= RNA_def_property(srna, "direction", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "mode"); + RNA_def_property_enum_items(prop, prop_direction_items); + RNA_def_property_ui_text(prop, "Direction", "Set the direction of the ray"); + RNA_def_property_update(prop, NC_LOGIC, NULL); + + prop= RNA_def_property(srna, "direction_axis", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "mode"); + RNA_def_property_enum_items(prop, prop_direction_items); + RNA_def_property_ui_text(prop, "Direction", "Select the axis to be aligned along the reference direction"); + RNA_def_property_update(prop, NC_LOGIC, NULL); + + /* ACT_CONST_TYPE_LOC */ + prop= RNA_def_property(srna, "limit_min", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_funcs(prop, "rna_ConstraintActuator_limitmin_get", "rna_ConstraintActuator_limitmin_set", NULL); + RNA_def_property_ui_range(prop, -2000.f, 2000.f, 1, 2); + RNA_def_property_ui_text(prop, "Min", ""); + RNA_def_property_update(prop, NC_LOGIC, NULL); + + prop= RNA_def_property(srna, "limit_max", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_funcs(prop, "rna_ConstraintActuator_limitmax_get", "rna_ConstraintActuator_limitmax_set", NULL); + RNA_def_property_ui_range(prop, -2000.f, 2000.f, 1, 2); + RNA_def_property_ui_text(prop, "Max", ""); + RNA_def_property_update(prop, NC_LOGIC, NULL); + + prop= RNA_def_property(srna, "damping", PROP_INT, PROP_PERCENTAGE); + RNA_def_property_int_sdna(prop, NULL, "damp"); + RNA_def_property_ui_range(prop, 0, 100, 1, 1); + RNA_def_property_ui_text(prop, "Damping", "Damping factor: time constant (in frame) of low pass filter"); + RNA_def_property_update(prop, NC_LOGIC, NULL); + + /* ACT_CONST_TYPE_DIST */ + prop= RNA_def_property(srna, "range", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_funcs(prop, "rna_ConstraintActuator_range_get", "rna_ConstraintActuator_range_set", NULL); + RNA_def_property_ui_range(prop, 0.f, 2000.f, 1, 2); + RNA_def_property_ui_text(prop, "Range", "Set the maximum length of ray"); + RNA_def_property_update(prop, NC_LOGIC, NULL); + + prop= RNA_def_property(srna, "distance", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_funcs(prop, "rna_ConstraintActuator_distance_get", "rna_ConstraintActuator_distance_set", NULL); + RNA_def_property_ui_range(prop, -2000.f, 2000.f, 1, 2); + RNA_def_property_ui_text(prop, "Distance", "Set the maximum length of ray"); + RNA_def_property_update(prop, NC_LOGIC, NULL); + + //XXX to use a pointer or add a material lookup + prop= RNA_def_property(srna, "material", PROP_STRING, PROP_NONE); + RNA_def_property_string_sdna(prop, NULL, "matprop"); + RNA_def_property_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Material", "Ray detects only Objects with this material"); + RNA_def_property_update(prop, NC_LOGIC, NULL); + + //XXX add magic property lookup + prop= RNA_def_property(srna, "property", PROP_STRING, PROP_NONE); + RNA_def_property_string_sdna(prop, NULL, "matprop"); + RNA_def_property_ui_text(prop, "Property", "Ray detect only Objects with this property"); + RNA_def_property_update(prop, NC_LOGIC, NULL); + + prop= RNA_def_property(srna, "time", PROP_INT, PROP_NONE); + RNA_def_property_ui_range(prop, 0, 1000, 1, 2); + RNA_def_property_ui_text(prop, "Time", "Maximum activation time in frame, 0 for unlimited"); + RNA_def_property_update(prop, NC_LOGIC, NULL); + + prop= RNA_def_property(srna, "damping_rotation", PROP_INT, PROP_PERCENTAGE); + RNA_def_property_int_sdna(prop, NULL, "rotdamp"); + RNA_def_property_ui_range(prop, 0, 100, 1, 1); + RNA_def_property_ui_text(prop, "rotDamp", "Use a different damping for orientation"); + RNA_def_property_update(prop, NC_LOGIC, NULL); + + /* ACT_CONST_TYPE_ORI */ + prop= RNA_def_property(srna, "max_rotation", PROP_FLOAT, PROP_TRANSLATION); + RNA_def_property_float_sdna(prop, NULL, "maxrot"); + RNA_def_property_array(prop, 3); + RNA_def_property_ui_range(prop, -2000.0, 2000.0, 0.1, 0.001); + RNA_def_property_ui_text(prop, "Reference Direction", "Reference Direction"); + RNA_def_property_update(prop, NC_LOGIC, NULL); + + prop= RNA_def_property(srna, "min_angle", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "minloc[0]"); + RNA_def_property_ui_range(prop, 0.0, 180.0, 0.1, 0.01); + 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"); + RNA_def_property_update(prop, NC_LOGIC, NULL); + + prop= RNA_def_property(srna, "max_angle", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "maxloc[0]"); + RNA_def_property_ui_range(prop, 0.0, 180.0, 0.1, 0.01); + 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"); + RNA_def_property_update(prop, NC_LOGIC, NULL); + + /* ACT_CONST_TYPE_FH */ + prop= RNA_def_property(srna, "fh_height", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_funcs(prop, "rna_ConstraintActuator_fhheight_get", "rna_ConstraintActuator_fhheight_set", NULL); + RNA_def_property_ui_range(prop, 0.01, 2000.0, 0.1, 0.01); + RNA_def_property_ui_text(prop, "Distance", "Height of the Fh area"); + RNA_def_property_update(prop, NC_LOGIC, NULL); + + prop= RNA_def_property(srna, "spring", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_funcs(prop, "rna_ConstraintActuator_spring_get", "rna_ConstraintActuator_spring_set", NULL); + RNA_def_property_ui_range(prop, 0.0, 1.0, 0.1, 0.01); + RNA_def_property_ui_text(prop, "Fh", "Spring force within the Fh area"); + RNA_def_property_update(prop, NC_LOGIC, NULL); + + prop= RNA_def_property(srna, "fh_damping", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "maxrot[0]"); + RNA_def_property_ui_range(prop, 0.0, 1.0, 1, 1); + RNA_def_property_ui_text(prop, "Damping", "Damping factor of the Fh spring force"); + RNA_def_property_update(prop, NC_LOGIC, NULL); + + /* booleans */ + prop= RNA_def_property(srna, "force_distance", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_CONST_DISTANCE); + RNA_def_property_ui_text(prop, "Force Distance", "Force distance of object to point of impact of ray"); + RNA_def_property_update(prop, NC_LOGIC, NULL); + + prop= RNA_def_property(srna, "local", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_CONST_LOCAL); + RNA_def_property_ui_text(prop, "L", "Set ray along object's axis or global axis"); + RNA_def_property_update(prop, NC_LOGIC, NULL); + + prop= RNA_def_property(srna, "normal", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_CONST_NORMAL); + RNA_def_property_ui_text(prop, "N", "Set object axis along (local axis) or parallel (global axis) to the normal at hit position"); + RNA_def_property_update(prop, NC_LOGIC, NULL); + + prop= RNA_def_property(srna, "persistent", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_CONST_PERMANENT); + RNA_def_property_ui_text(prop, "PER", "Persistent actuator: stays active even if ray does not reach target"); + RNA_def_property_update(prop, NC_LOGIC, NULL); + + //XXX to use an enum instead of a flag if possible + prop= RNA_def_property(srna, "detect_material", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_CONST_MATERIAL); + RNA_def_property_ui_text(prop, "M/P", "Detect material instead of property"); + RNA_def_property_update(prop, NC_LOGIC, NULL); + + prop= RNA_def_property(srna, "fh_paralel_axis", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_CONST_DOROTFH); + RNA_def_property_ui_text(prop, "Rot Fh", "Keep object axis parallel to normal"); + RNA_def_property_update(prop, NC_LOGIC, NULL); + + prop= RNA_def_property(srna, "fh_normal", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_CONST_NORMAL); + RNA_def_property_ui_text(prop, "N", "Add a horizontal spring force on slopes"); + RNA_def_property_update(prop, NC_LOGIC, NULL); } static void rna_def_edit_object_actuator(BlenderRNA *brna) @@ -613,19 +1163,11 @@ static void rna_def_edit_object_actuator(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem prop_type_items[] ={ - {ACT_EDOB_ADD_OBJECT, "ADDOBJECT", 0, "Add Object", ""}, - {ACT_EDOB_END_OBJECT, "ENDOBJECT", 0, "End Object", ""}, - {ACT_EDOB_REPLACE_MESH, "REPLACEMESH", 0, "Replace Mesh", ""}, - {ACT_EDOB_TRACK_TO, "TRACKTO", 0, "Track to", ""}, - {ACT_EDOB_DYNAMICS, "DYNAMICS", 0, "Dynamics", ""}, - {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem prop_dyn_items[] ={ {ACT_EDOB_RESTORE_DYN, "RESTOREDYN", 0, "Restore Dynamics", ""}, {ACT_EDOB_SUSPEND_DYN, "SUSPENDDYN", 0, "Suspend Dynamics", ""}, - {ACT_EDOB_ENABLE_RB, "ENABLERIGIDBOBY", 0, "Enable Rigid Body", ""}, - {ACT_EDOB_DISABLE_RB, "DISABLERIGIDBOBY", 0, "Disable Rigid Body", ""}, + {ACT_EDOB_ENABLE_RB, "ENABLERIGIDBODY", 0, "Enable Rigid Body", ""}, + {ACT_EDOB_DISABLE_RB, "DISABLERIGIDBODY", 0, "Disable Rigid Body", ""}, {ACT_EDOB_SET_MASS, "SETMASS", 0, "Set Mass", ""}, {0, NULL, 0, NULL, NULL} }; @@ -635,7 +1177,8 @@ static void rna_def_edit_object_actuator(BlenderRNA *brna) prop= RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "type"); - RNA_def_property_enum_items(prop, prop_type_items); + RNA_def_property_enum_items(prop, edit_object_type_items); + RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_EditObjectActuator_mode_itemf"); RNA_def_property_ui_text(prop, "Edit Object", "The mode of the actuator"); RNA_def_property_update(prop, NC_LOGIC, NULL); @@ -801,7 +1344,6 @@ static void rna_def_random_actuator(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Seed", "Initial seed of the random generator. Use Python for more freedom (choose 0 for not random)"); RNA_def_property_update(prop, NC_LOGIC, NULL); - //XXX add magic property lookup prop= RNA_def_property(srna, "property", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "propname"); RNA_def_property_ui_text(prop, "Property", "Assign the random value to this property"); @@ -925,7 +1467,7 @@ static void rna_def_message_actuator(BlenderRNA *brna) prop= RNA_def_property(srna, "body_type", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "bodyType"); RNA_def_property_enum_items(prop, prop_body_type_items); - RNA_def_property_ui_text(prop, "Body Type", "Toggle message type: either Text or a PropertyName"); + RNA_def_property_ui_text(prop, "Body", "Toggle message type: either Text or a PropertyName"); /* ACT_MESG_MESG */ prop= RNA_def_property(srna, "body_message", PROP_STRING, PROP_NONE); @@ -1116,9 +1658,9 @@ static void rna_def_shape_action_actuator(BlenderRNA *brna) {0, NULL, 0, NULL, NULL}}; srna= RNA_def_struct(brna, "ShapeActionActuator", "Actuator"); - RNA_def_struct_ui_text(srna, "Shape Action Actuator", "Actuator to .."); + RNA_def_struct_ui_text(srna, "Shape Action Actuator", "Actuator to control shape key animations"); RNA_def_struct_sdna_from(srna, "bActionActuator", "data"); - + prop= RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "type"); RNA_def_property_enum_items(prop, prop_type_items); @@ -1200,14 +1742,11 @@ static void rna_def_state_actuator(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Operation", "Select the bit operation on object state mask"); RNA_def_property_update(prop, NC_LOGIC, NULL); -/* - XXX mask needs a template or to use RNA layer type - prop= RNA_def_property(srna, "mask", PROP_BOOLEAN, PROP_LAYER); - RNA_def_property_array(prop, 20); -*/ - prop= RNA_def_property(srna, "mask", PROP_INT, PROP_NONE); - RNA_def_property_ui_text(prop, "Mask", ""); - RNA_def_property_update(prop, NC_LOGIC, NULL); + prop= RNA_def_property(srna, "state", PROP_BOOLEAN, PROP_LAYER_MEMBER); + RNA_def_property_boolean_sdna(prop, NULL, "mask", 1); + RNA_def_property_array(prop, OB_MAX_STATES); + RNA_def_property_ui_text(prop, "State", ""); + RNA_def_property_boolean_funcs(prop, NULL, "rna_StateActuator_state_set"); } static void rna_def_armature_actuator(BlenderRNA *brna) @@ -1227,7 +1766,7 @@ static void rna_def_armature_actuator(BlenderRNA *brna) RNA_def_struct_ui_text(srna, "Armature Actuator", "Actuator to .."); RNA_def_struct_sdna_from(srna, "bArmatureActuator", "data"); - prop= RNA_def_property(srna, "contraint_type", PROP_ENUM, PROP_NONE); + prop= RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "type"); RNA_def_property_enum_items(prop, prop_type_items); RNA_def_property_ui_text(prop, "Constraint Type", ""); @@ -1241,7 +1780,7 @@ static void rna_def_armature_actuator(BlenderRNA *brna) /* XXX eventually move to a datablock pointer. However datablocking this may be a problem we would need to update the value whenever the armature changes. */ - prop= RNA_def_property(srna, "contraint", PROP_STRING, PROP_NONE); + prop= RNA_def_property(srna, "constraint", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "constraint"); RNA_def_property_ui_text(prop, "Constraint", "Name of the constraint you want to control"); RNA_def_property_update(prop, NC_LOGIC, NULL); @@ -1273,8 +1812,9 @@ void RNA_def_actuator(BlenderRNA *brna) { rna_def_actuator(brna); + rna_def_action_actuator(brna); rna_def_object_actuator(brna); - rna_def_ipo_actuator(brna); + rna_def_fcurve_actuator(brna); rna_def_camera_actuator(brna); rna_def_sound_actuator(brna); rna_def_property_actuator(brna); diff --git a/source/blender/makesrna/intern/rna_constraint.c b/source/blender/makesrna/intern/rna_constraint.c index c61ebf5adfc..b4ae49ae2f4 100644 --- a/source/blender/makesrna/intern/rna_constraint.c +++ b/source/blender/makesrna/intern/rna_constraint.c @@ -1855,7 +1855,7 @@ void RNA_def_constraint(BlenderRNA *brna) /* strings */ prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE); RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Constraint_name_set"); - RNA_def_property_ui_text(prop, "Name", ""); + RNA_def_property_ui_text(prop, "Name", "Constraint name"); RNA_def_struct_name_property(srna, prop); /* enums */ diff --git a/source/blender/makesrna/intern/rna_controller.c b/source/blender/makesrna/intern/rna_controller.c index fe68fbc6b7c..dd174c668f2 100644 --- a/source/blender/makesrna/intern/rna_controller.c +++ b/source/blender/makesrna/intern/rna_controller.c @@ -24,6 +24,7 @@ #include <stdlib.h> +#include "WM_types.h" #include "RNA_define.h" #include "rna_internal.h" @@ -71,11 +72,14 @@ static struct StructRNA* rna_Controller_refine(struct PointerRNA *ptr) } } -static void rna_Controller_type_update(Main *bmain, Scene *scene, PointerRNA *ptr) +static void rna_Controller_type_set(struct PointerRNA *ptr, int value) { bController *cont= (bController *)ptr->data; - - init_controller(cont); + if (value != cont->type) + { + cont->type = value; + init_controller(cont); + } } #else @@ -99,23 +103,26 @@ void RNA_def_controller(BlenderRNA *brna) prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE); RNA_def_property_ui_text(prop, "Name", ""); RNA_def_struct_name_property(srna, prop); + RNA_def_property_update(prop, NC_LOGIC, NULL); prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); + RNA_def_property_enum_funcs(prop, NULL, "rna_Controller_type_set", NULL); RNA_def_property_enum_items(prop, controller_type_items); RNA_def_property_ui_text(prop, "Type", ""); - - RNA_def_property_update(prop, 0, "rna_Controller_type_update"); + RNA_def_property_update(prop, NC_LOGIC, NULL); prop= RNA_def_property(srna, "expanded", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", CONT_SHOW); RNA_def_property_ui_text(prop, "Expanded", "Set controller expanded in the user interface"); RNA_def_property_ui_icon(prop, ICON_TRIA_RIGHT, 1); + RNA_def_property_update(prop, NC_LOGIC, NULL); prop= RNA_def_property(srna, "priority", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", CONT_PRIO); RNA_def_property_ui_text(prop, "Priority", "Mark controller for execution before all non-marked controllers (good for startup scripts)"); RNA_def_property_ui_icon(prop, ICON_BOOKMARKS, 1); + RNA_def_property_update(prop, NC_LOGIC, NULL); /* Expression Controller */ srna= RNA_def_struct(brna, "ExpressionController", "Controller"); @@ -126,6 +133,7 @@ void RNA_def_controller(BlenderRNA *brna) RNA_def_property_string_sdna(prop, NULL, "str"); RNA_def_property_string_maxlength(prop, 127); RNA_def_property_ui_text(prop, "Expression", ""); + RNA_def_property_update(prop, NC_LOGIC, NULL); /* Python Controller */ srna= RNA_def_struct(brna, "PythonController", "Controller" ); @@ -135,19 +143,23 @@ void RNA_def_controller(BlenderRNA *brna) prop= RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE); RNA_def_property_enum_items(prop, python_controller_modes); RNA_def_property_ui_text(prop, "Execution Method", "Python script type (textblock or module - faster)"); + RNA_def_property_update(prop, NC_LOGIC, NULL); prop= RNA_def_property(srna, "text", PROP_POINTER, PROP_NONE); RNA_def_property_struct_type(prop, "Text"); RNA_def_property_flag(prop, PROP_EDITABLE); RNA_def_property_ui_text(prop, "Text", "Text datablock with the python script"); + RNA_def_property_update(prop, NC_LOGIC, NULL); prop= RNA_def_property(srna, "module", PROP_STRING, PROP_NONE); RNA_def_property_ui_text(prop, "Module", "Module name and function to run e.g. \"someModule.main\". Internal texts and external python files can be used"); RNA_def_struct_name_property(srna, prop); + RNA_def_property_update(prop, NC_LOGIC, NULL); prop= RNA_def_property(srna, "debug", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", CONT_PY_DEBUG); RNA_def_property_ui_text(prop, "D", "Continuously reload the module from disk for editing external modules without restarting"); + RNA_def_property_update(prop, NC_LOGIC, NULL); /* Other Controllers */ srna= RNA_def_struct(brna, "AndController", "Controller"); diff --git a/source/blender/makesrna/intern/rna_define.c b/source/blender/makesrna/intern/rna_define.c index d0a8763baa7..fbcc3109af4 100644 --- a/source/blender/makesrna/intern/rna_define.c +++ b/source/blender/makesrna/intern/rna_define.c @@ -2722,5 +2722,39 @@ void RNA_def_property_free_pointers(PropertyRNA *prop) } } } + +void RNA_def_property_free(StructOrFunctionRNA *cont_, PropertyRNA *prop) +{ + ContainerRNA *cont= cont_; + + RNA_def_property_free_pointers(prop); + + if(prop->flag & PROP_RUNTIME) { + if(cont->prophash) + BLI_ghash_remove(cont->prophash, (void*)prop->identifier, NULL, NULL); + + rna_freelinkN(&cont->properties, prop); + } +} + +/* note: only intended for removing dynamic props */ +int RNA_def_property_free_identifier(StructOrFunctionRNA *cont_, const char *identifier) +{ + ContainerRNA *cont= cont_; + PropertyRNA *prop; + + for(prop= cont->properties.first; prop; prop= prop->next) { + if(strcmp(prop->identifier, identifier)==0) { + if(prop->flag & PROP_RUNTIME) { + RNA_def_property_free(cont_, prop); + return 1; + } + else { + return -1; + } + } + } + return 0; +} #endif diff --git a/source/blender/makesrna/intern/rna_image.c b/source/blender/makesrna/intern/rna_image.c index f13bdd4ceee..52f4b289368 100644 --- a/source/blender/makesrna/intern/rna_image.c +++ b/source/blender/makesrna/intern/rna_image.c @@ -339,11 +339,6 @@ static void rna_def_image(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Fields", "Use fields of the image"); RNA_def_property_update(prop, NC_IMAGE|ND_DISPLAY, "rna_Image_fields_update"); - prop= RNA_def_property(srna, "antialias", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", IMA_ANTIALI); - RNA_def_property_ui_text(prop, "Anti-alias", "Toggles image anti-aliasing, only works with solid colors"); - RNA_def_property_update(prop, NC_IMAGE|ND_DISPLAY, NULL); - prop= RNA_def_property(srna, "premultiply", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", IMA_DO_PREMUL); RNA_def_property_ui_text(prop, "Premultiply", "Convert RGB from key alpha to premultiplied alpha"); diff --git a/source/blender/makesrna/intern/rna_internal.h b/source/blender/makesrna/intern/rna_internal.h index 433d5ff2904..005efdb9bc4 100644 --- a/source/blender/makesrna/intern/rna_internal.h +++ b/source/blender/makesrna/intern/rna_internal.h @@ -249,7 +249,7 @@ void RNA_def_main_images(BlenderRNA *brna, PropertyRNA *cprop); void RNA_def_main_lattices(BlenderRNA *brna, PropertyRNA *cprop); void RNA_def_main_curves(BlenderRNA *brna, PropertyRNA *cprop); void RNA_def_main_metaballs(BlenderRNA *brna, PropertyRNA *cprop); -void RNA_def_main_vfonts(BlenderRNA *brna, PropertyRNA *cprop); +void RNA_def_main_fonts(BlenderRNA *brna, PropertyRNA *cprop); void RNA_def_main_textures(BlenderRNA *brna, PropertyRNA *cprop); void RNA_def_main_brushes(BlenderRNA *brna, PropertyRNA *cprop); void RNA_def_main_worlds(BlenderRNA *brna, PropertyRNA *cprop); diff --git a/source/blender/makesrna/intern/rna_main.c b/source/blender/makesrna/intern/rna_main.c index 7688d92f2e1..b683f5dc4b1 100644 --- a/source/blender/makesrna/intern/rna_main.c +++ b/source/blender/makesrna/intern/rna_main.c @@ -173,7 +173,7 @@ static void rna_Main_script_begin(CollectionPropertyIterator *iter, PointerRNA * rna_iterator_listbase_begin(iter, &bmain->script, NULL); } -static void rna_Main_vfont_begin(CollectionPropertyIterator *iter, PointerRNA *ptr) +static void rna_Main_font_begin(CollectionPropertyIterator *iter, PointerRNA *ptr) { Main *bmain= (Main*)ptr->data; rna_iterator_listbase_begin(iter, &bmain->vfont, NULL); @@ -271,6 +271,7 @@ void RNA_def_main(BlenderRNA *brna) PropertyRNA *prop; CollectionDefFunc *func; + /* plural must match idtypes in readblenentry.c */ MainCollectionDef lists[]= { {"cameras", "Camera", "rna_Main_camera_begin", "Cameras", "Camera datablocks.", RNA_def_main_cameras}, {"scenes", "Scene", "rna_Main_scene_begin", "Scenes", "Scene datablocks.", RNA_def_main_scenes}, @@ -286,7 +287,7 @@ void RNA_def_main(BlenderRNA *brna) {"lattices", "Lattice", "rna_Main_latt_begin", "Lattices", "Lattice datablocks.", RNA_def_main_lattices}, {"curves", "Curve", "rna_Main_curve_begin", "Curves", "Curve datablocks.", RNA_def_main_curves} , {"metaballs", "MetaBall", "rna_Main_mball_begin", "Metaballs", "Metaball datablocks.", RNA_def_main_metaballs}, - {"vfonts", "VectorFont", "rna_Main_vfont_begin", "Vector Fonts", "Vector font datablocks.", RNA_def_main_vfonts}, + {"fonts", "VectorFont", "rna_Main_font_begin", "Vector Fonts", "Vector font datablocks.", RNA_def_main_fonts}, {"textures", "Texture", "rna_Main_tex_begin", "Textures", "Texture datablocks.", RNA_def_main_textures}, {"brushes", "Brush", "rna_Main_brush_begin", "Brushes", "Brush datablocks.", RNA_def_main_brushes}, {"worlds", "World", "rna_Main_world_begin", "Worlds", "World datablocks.", RNA_def_main_worlds}, diff --git a/source/blender/makesrna/intern/rna_main_api.c b/source/blender/makesrna/intern/rna_main_api.c index d70962568e5..186334f12a4 100644 --- a/source/blender/makesrna/intern/rna_main_api.c +++ b/source/blender/makesrna/intern/rna_main_api.c @@ -594,7 +594,7 @@ void RNA_def_main_metaballs(BlenderRNA *brna, PropertyRNA *cprop) { } -void RNA_def_main_vfonts(BlenderRNA *brna, PropertyRNA *cprop) +void RNA_def_main_fonts(BlenderRNA *brna, PropertyRNA *cprop) { } diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c index 9a67c7fbf17..c34769dbeec 100644 --- a/source/blender/makesrna/intern/rna_object.c +++ b/source/blender/makesrna/intern/rna_object.c @@ -1128,6 +1128,7 @@ static void rna_def_object_game_settings(BlenderRNA *brna) RNA_def_property_enum_items(prop, body_type_items); RNA_def_property_enum_funcs(prop, "rna_GameObjectSettings_physics_type_get", "rna_GameObjectSettings_physics_type_set", NULL); RNA_def_property_ui_text(prop, "Physics Type", "Selects the type of physical representation"); + RNA_def_property_update(prop, NC_LOGIC, NULL); prop= RNA_def_property(srna, "actor", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "gameflag", OB_ACTOR); @@ -1650,17 +1651,20 @@ static void rna_def_object(BlenderRNA *brna) RNA_def_property_boolean_sdna(prop, NULL, "protectflag", OB_LOCK_LOCX); RNA_def_property_array(prop, 3); RNA_def_property_ui_text(prop, "Lock Location", "Lock editing of location in the interface"); + RNA_def_property_ui_icon(prop, ICON_UNLOCKED, 1); RNA_def_property_update(prop, NC_OBJECT|ND_TRANSFORM, "rna_Object_update"); prop= RNA_def_property(srna, "lock_rotation", PROP_BOOLEAN, PROP_XYZ); RNA_def_property_boolean_sdna(prop, NULL, "protectflag", OB_LOCK_ROTX); RNA_def_property_array(prop, 3); RNA_def_property_ui_text(prop, "Lock Rotation", "Lock editing of rotation in the interface"); + RNA_def_property_ui_icon(prop, ICON_UNLOCKED, 1); RNA_def_property_update(prop, NC_OBJECT|ND_TRANSFORM, "rna_Object_update"); // XXX this is sub-optimal - it really should be included above, but due to technical reasons we can't do this! prop= RNA_def_property(srna, "lock_rotation_w", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "protectflag", OB_LOCK_ROTW); + RNA_def_property_ui_icon(prop, ICON_UNLOCKED, 1); RNA_def_property_ui_text(prop, "Lock Rotation (4D Angle)", "Lock editing of 'angle' component of four-component rotations in the interface"); // XXX this needs a better name prop= RNA_def_property(srna, "lock_rotations_4d", PROP_BOOLEAN, PROP_NONE); @@ -1671,6 +1675,7 @@ static void rna_def_object(BlenderRNA *brna) RNA_def_property_boolean_sdna(prop, NULL, "protectflag", OB_LOCK_SCALEX); RNA_def_property_array(prop, 3); RNA_def_property_ui_text(prop, "Lock Scale", "Lock editing of scale in the interface"); + RNA_def_property_ui_icon(prop, ICON_UNLOCKED, 1); RNA_def_property_update(prop, NC_OBJECT|ND_TRANSFORM, "rna_Object_update"); /* matrix */ @@ -1780,16 +1785,19 @@ static void rna_def_object(BlenderRNA *brna) prop= RNA_def_property(srna, "restrict_view", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "restrictflag", OB_RESTRICT_VIEW); RNA_def_property_ui_text(prop, "Restrict View", "Restrict visibility in the viewport"); + RNA_def_property_ui_icon(prop, ICON_RESTRICT_VIEW_OFF, 1); RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL); prop= RNA_def_property(srna, "restrict_select", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "restrictflag", OB_RESTRICT_SELECT); RNA_def_property_ui_text(prop, "Restrict Select", "Restrict selection in the viewport"); + RNA_def_property_ui_icon(prop, ICON_RESTRICT_SELECT_OFF, 1); RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL); prop= RNA_def_property(srna, "restrict_render", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "restrictflag", OB_RESTRICT_RENDER); RNA_def_property_ui_text(prop, "Restrict Render", "Restrict renderability"); + RNA_def_property_ui_icon(prop, ICON_RESTRICT_RENDER_OFF, 1); RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL); /* anim */ @@ -1877,12 +1885,12 @@ static void rna_def_object(BlenderRNA *brna) prop= RNA_def_property(srna, "time_offset", PROP_FLOAT, PROP_NONE|PROP_UNIT_TIME); RNA_def_property_float_sdna(prop, NULL, "sf"); RNA_def_property_range(prop, MINAFRAMEF, MAXFRAMEF); - RNA_def_property_ui_text(prop, "Time Offset", "Animation offset in frames for IPO's and dupligroup instances"); + RNA_def_property_ui_text(prop, "Time Offset", "Animation offset in frames for F-Curve and dupligroup instances"); RNA_def_property_update(prop, NC_OBJECT|ND_TRANSFORM, "rna_Object_update"); prop= RNA_def_property(srna, "time_offset_edit", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "ipoflag", OB_OFFS_OB); - RNA_def_property_ui_text(prop, "Time Offset Edit", "Use time offset when inserting keys and display time offset for IPO and action views"); + RNA_def_property_ui_text(prop, "Time Offset Edit", "Use time offset when inserting keys and display time offset for F-Curve and action views"); prop= RNA_def_property(srna, "time_offset_parent", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "ipoflag", OB_OFFS_PARENT); diff --git a/source/blender/makesrna/intern/rna_object_force.c b/source/blender/makesrna/intern/rna_object_force.c index d7acb427efe..5cb58d50f8f 100644 --- a/source/blender/makesrna/intern/rna_object_force.c +++ b/source/blender/makesrna/intern/rna_object_force.c @@ -746,6 +746,11 @@ static void rna_def_pointcache(BlenderRNA *brna) RNA_def_property_boolean_sdna(prop, NULL, "flag", PTCACHE_EXTERNAL); RNA_def_property_ui_text(prop, "External", "Read cache from an external location"); RNA_def_property_update(prop, NC_OBJECT, "rna_Cache_idname_change"); + + prop= RNA_def_property(srna, "use_library_path", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", PTCACHE_IGNORE_LIBPATH); + RNA_def_property_ui_text(prop, "Library Path", "Use this files path when library linked indo another file."); + RNA_def_property_update(prop, NC_OBJECT, "rna_Cache_idname_change"); prop= RNA_def_property(srna, "point_cache_list", PROP_COLLECTION, PROP_NONE); RNA_def_property_collection_funcs(prop, "rna_Cache_list_begin", "rna_iterator_listbase_next", "rna_iterator_listbase_end", "rna_iterator_listbase_get", 0, 0, 0); diff --git a/source/blender/makesrna/intern/rna_property.c b/source/blender/makesrna/intern/rna_property.c index c65aa4ac725..7bcb58ea28d 100644 --- a/source/blender/makesrna/intern/rna_property.c +++ b/source/blender/makesrna/intern/rna_property.c @@ -30,6 +30,8 @@ #include "DNA_property_types.h" +#include "WM_types.h" + #ifdef RNA_RUNTIME #include "BKE_property.h" @@ -111,24 +113,29 @@ void RNA_def_gameproperty(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Name", "Available as GameObject attributes in the game engine's python API"); RNA_def_struct_name_property(srna, prop); RNA_def_property_string_funcs(prop, NULL, NULL, "rna_GameProperty_name_set"); + RNA_def_property_update(prop, NC_LOGIC, NULL); prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE); RNA_def_property_enum_items(prop, gameproperty_type_items); RNA_def_property_ui_text(prop, "Type", ""); RNA_def_property_enum_funcs(prop, NULL, "rna_GameProperty_type_set", NULL); + RNA_def_property_update(prop, NC_LOGIC, NULL); prop= RNA_def_property(srna, "debug", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", PROP_DEBUG); RNA_def_property_ui_text(prop, "Debug", "Print debug information for this property"); + RNA_def_property_update(prop, NC_LOGIC, NULL); /* GameBooleanProperty */ srna= RNA_def_struct(brna, "GameBooleanProperty", "GameProperty"); RNA_def_struct_ui_text(srna , "Game Boolean Property", "Game engine user defined Boolean property"); RNA_def_struct_sdna(srna, "bProperty"); + RNA_def_property_update(prop, NC_LOGIC, NULL); prop= RNA_def_property(srna, "value", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "data", 1); RNA_def_property_ui_text(prop, "Value", "Property value"); + RNA_def_property_update(prop, NC_LOGIC, NULL); /* GameIntProperty */ srna= RNA_def_struct(brna, "GameIntProperty", "GameProperty"); @@ -139,6 +146,7 @@ void RNA_def_gameproperty(BlenderRNA *brna) RNA_def_property_int_sdna(prop, NULL, "data"); RNA_def_property_ui_text(prop, "Value", "Property value"); RNA_def_property_range(prop, -10000, 10000); + RNA_def_property_update(prop, NC_LOGIC, NULL); /* GameFloatProperty */ srna= RNA_def_struct(brna, "GameFloatProperty", "GameProperty"); @@ -150,6 +158,7 @@ void RNA_def_gameproperty(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Value", "Property value"); RNA_def_property_range(prop, -10000, 10000); RNA_def_property_float_funcs(prop, "rna_GameFloatProperty_value_get", "rna_GameFloatProperty_value_set", NULL); + RNA_def_property_update(prop, NC_LOGIC, NULL); /* GameTimerProperty */ srna= RNA_def_struct(brna, "GameTimerProperty", "GameProperty"); @@ -161,6 +170,7 @@ void RNA_def_gameproperty(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Value", "Property value"); RNA_def_property_range(prop, -10000, 10000); RNA_def_property_float_funcs(prop, "rna_GameFloatProperty_value_get", "rna_GameFloatProperty_value_set", NULL); + RNA_def_property_update(prop, NC_LOGIC, NULL); /* GameStringProperty */ srna= RNA_def_struct(brna, "GameStringProperty", "GameProperty"); @@ -171,6 +181,7 @@ void RNA_def_gameproperty(BlenderRNA *brna) RNA_def_property_string_sdna(prop, NULL, "poin"); RNA_def_property_string_maxlength(prop, MAX_PROPSTRING); RNA_def_property_ui_text(prop, "Value", "Property value"); + RNA_def_property_update(prop, NC_LOGIC, NULL); } #endif diff --git a/source/blender/makesrna/intern/rna_sensor.c b/source/blender/makesrna/intern/rna_sensor.c index 93eec4cbbdd..45a660a0895 100644 --- a/source/blender/makesrna/intern/rna_sensor.c +++ b/source/blender/makesrna/intern/rna_sensor.c @@ -29,8 +29,11 @@ #include "rna_internal.h" +#include "DNA_object_types.h" #include "DNA_sensor_types.h" +#include "WM_types.h" + EnumPropertyItem sensor_type_items[] ={ {SENS_ACTUATOR, "ACTUATOR", 0, "Actuator", ""}, {SENS_ALWAYS, "ALWAYS", 0, "Always", ""}, @@ -93,11 +96,88 @@ static StructRNA* rna_Sensor_refine(struct PointerRNA *ptr) } } -static void rna_Sensor_type_update(Main *bmain, Scene *scene, PointerRNA *ptr) +static void rna_Sensor_type_set(struct PointerRNA *ptr, int value) +{ + bSensor *sens= (bSensor *)ptr->data; + if (value != sens->type) + { + sens->type = value; + init_sensor(sens); + } +} + +EnumPropertyItem *rna_Sensor_type_itemf(bContext *C, PointerRNA *ptr, int *free) +{ + EnumPropertyItem *item= NULL; + Object *ob=NULL; + int totitem= 0; + + if (ptr->type == &RNA_Sensor) { + ob = (Object *)ptr->id.data; + } else { + /* can't use ob from ptr->id.data because that enum is also used by operators */ + ob = CTX_data_active_object(C); + } + + RNA_enum_items_add_value(&item, &totitem, sensor_type_items, SENS_ACTUATOR); + RNA_enum_items_add_value(&item, &totitem, sensor_type_items, SENS_ALWAYS); + + if (ob != NULL) { + if (ob->type==OB_ARMATURE) { + RNA_enum_items_add_value(&item, &totitem, sensor_type_items, SENS_ARMATURE); + } else if(ob->type==OB_MESH) { + RNA_enum_items_add_value(&item, &totitem, sensor_type_items, SENS_COLLISION); + } + } + + RNA_enum_items_add_value(&item, &totitem, sensor_type_items, SENS_DELAY); + RNA_enum_items_add_value(&item, &totitem, sensor_type_items, SENS_JOYSTICK); + RNA_enum_items_add_value(&item, &totitem, sensor_type_items, SENS_KEYBOARD); + RNA_enum_items_add_value(&item, &totitem, sensor_type_items, SENS_MESSAGE); + RNA_enum_items_add_value(&item, &totitem, sensor_type_items, SENS_MOUSE); + RNA_enum_items_add_value(&item, &totitem, sensor_type_items, SENS_NEAR); + RNA_enum_items_add_value(&item, &totitem, sensor_type_items, SENS_PROPERTY); + RNA_enum_items_add_value(&item, &totitem, sensor_type_items, SENS_RADAR); + RNA_enum_items_add_value(&item, &totitem, sensor_type_items, SENS_RANDOM); + RNA_enum_items_add_value(&item, &totitem, sensor_type_items, SENS_RAY); + + if (ob != NULL) { + if(ob->type==OB_MESH) { + RNA_enum_items_add_value(&item, &totitem, sensor_type_items, SENS_TOUCH); + } + } + + RNA_enum_item_end(&item, &totitem); + *free= 1; + + return item; +} + +static void rna_Sensor_keyboard_key_set(struct PointerRNA *ptr, int value) +{ + bSensor *sens= (bSensor *)ptr->data; + bKeyboardSensor *ks = sens->data; + + if (ISKEYBOARD(value) && !ISKEYMODIFIER(value)) + ks->key = value; +} + +static void rna_Sensor_keyboard_modifier_set(struct PointerRNA *ptr, int value) +{ + bSensor *sens= (bSensor *)ptr->data; + bKeyboardSensor *ks = sens->data; + + if (ISKEYMODIFIER(value)) + ks->qual = value; +} + +static void rna_Sensor_keyboard_modifier2_set(struct PointerRNA *ptr, int value) { bSensor *sens= (bSensor *)ptr->data; + bKeyboardSensor *ks = sens->data; - init_sensor(sens); + if (ISKEYMODIFIER(value)) + ks->qual2 = value; } #else @@ -115,40 +195,49 @@ static void rna_def_sensor(BlenderRNA *brna) prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE); RNA_def_property_ui_text(prop, "Name", "Sensor name"); RNA_def_struct_name_property(srna, prop); + RNA_def_property_update(prop, NC_LOGIC, NULL); prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_enum_items(prop, sensor_type_items); + RNA_def_property_enum_funcs(prop, NULL, "rna_Sensor_type_set", "rna_Sensor_type_itemf"); RNA_def_property_ui_text(prop, "Type", ""); - RNA_def_property_update(prop, 0, "rna_Sensor_type_update"); - + RNA_def_property_update(prop, NC_LOGIC, NULL); + prop= RNA_def_property(srna, "expanded", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", SENS_SHOW); RNA_def_property_ui_text(prop, "Expanded", "Set sensor expanded in the user interface"); RNA_def_property_ui_icon(prop, ICON_TRIA_RIGHT, 1); - + RNA_def_property_update(prop, NC_LOGIC, NULL); + prop= RNA_def_property(srna, "invert", PROP_BOOLEAN, PROP_NONE); RNA_def_property_ui_text(prop, "Invert Output", "Invert the level(output) of this sensor"); + RNA_def_property_update(prop, NC_LOGIC, NULL); prop= RNA_def_property(srna, "level", PROP_BOOLEAN, PROP_NONE); RNA_def_property_ui_text(prop, "Level", "Level detector, trigger controllers of new states(only applicable upon logic state transition)"); + RNA_def_property_update(prop, NC_LOGIC, NULL); prop= RNA_def_property(srna, "pulse_true_level", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "pulse", SENS_PULSE_REPEAT); RNA_def_property_ui_text(prop, "Pulse True Level", "Activate TRUE level triggering (pulse mode)"); + RNA_def_property_update(prop, NC_LOGIC, NULL); prop= RNA_def_property(srna, "pulse_false_level", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "pulse", SENS_NEG_PULSE_MODE); RNA_def_property_ui_text(prop, "Pulse False Level", "Activate FALSE level triggering (pulse mode)"); + RNA_def_property_update(prop, NC_LOGIC, NULL); prop= RNA_def_property(srna, "frequency", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "freq"); RNA_def_property_ui_text(prop, "Frequency", "Delay between repeated pulses(in logic tics, 0=no delay)"); RNA_def_property_range(prop, 0, 10000); + RNA_def_property_update(prop, NC_LOGIC, NULL); prop= RNA_def_property(srna, "tap", PROP_BOOLEAN, PROP_NONE);\ RNA_def_property_boolean_sdna(prop, NULL, "tap", 1); RNA_def_property_ui_text(prop, "Tap", "Trigger controllers only for an instant, even while the sensor remains true"); + RNA_def_property_update(prop, NC_LOGIC, NULL); } static void rna_def_always_sensor(BlenderRNA *brna) @@ -170,16 +259,19 @@ static void rna_def_near_sensor(BlenderRNA *brna) prop= RNA_def_property(srna, "property", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "name"); RNA_def_property_ui_text(prop, "Property", "Only look for objects with this property"); + RNA_def_property_update(prop, NC_LOGIC, NULL); prop= RNA_def_property(srna, "distance", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "dist"); RNA_def_property_ui_text(prop, "Distance", "Trigger distance"); RNA_def_property_range(prop, 0.0f, 10000.0f); + RNA_def_property_update(prop, NC_LOGIC, NULL); prop= RNA_def_property(srna, "reset_distance", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "resetdist"); RNA_def_property_ui_text(prop, "Reset Distance", ""); RNA_def_property_range(prop, 0.0f, 10000.0f); + RNA_def_property_update(prop, NC_LOGIC, NULL); } static void rna_def_mouse_sensor(BlenderRNA *brna) @@ -206,6 +298,7 @@ static void rna_def_mouse_sensor(BlenderRNA *brna) RNA_def_property_enum_sdna(prop, NULL, "type"); RNA_def_property_enum_items(prop, mouse_event_items); RNA_def_property_ui_text(prop, "Mouse Event", "Specify the type of event this mouse sensor should trigger on"); + RNA_def_property_update(prop, NC_LOGIC, NULL); } static void rna_def_touch_sensor(BlenderRNA *brna) @@ -221,7 +314,8 @@ static void rna_def_touch_sensor(BlenderRNA *brna) RNA_def_property_struct_type(prop, "Material"); RNA_def_property_pointer_sdna(prop, NULL, "ma"); RNA_def_property_flag(prop, PROP_EDITABLE); - RNA_def_property_ui_text(prop, "Material", "Only look for floors with this material"); + RNA_def_property_ui_text(prop, "Material", "Only look for objects with this material"); + RNA_def_property_update(prop, NC_LOGIC, NULL); } static void rna_def_keyboard_sensor(BlenderRNA *brna) @@ -233,39 +327,41 @@ static void rna_def_keyboard_sensor(BlenderRNA *brna) RNA_def_struct_ui_text(srna, "Keyboard Sensor", "Sensor to detect keyboard events"); RNA_def_struct_sdna_from(srna, "bKeyboardSensor", "data"); - /* - prop= RNA_def_property(srna, "key", PROP_INT, PROP_NONE);//XXX need to use another input template - //RNA_def_property_clear_flag(prop, PROP_EDITABLE); // need better range or enum check - RNA_def_property_ui_text(prop, "Key", "Input key code"); - RNA_def_property_range(prop, 0, 255); - */ - prop= RNA_def_property(srna, "key", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "key"); RNA_def_property_enum_items(prop, event_type_items); + RNA_def_property_enum_funcs(prop, NULL, "rna_Sensor_keyboard_key_set", NULL); RNA_def_property_ui_text(prop, "Key", ""); + RNA_def_property_update(prop, NC_LOGIC, NULL); prop= RNA_def_property(srna, "modifier_key", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "qual"); RNA_def_property_enum_items(prop, event_type_items); + RNA_def_property_enum_funcs(prop, NULL, "rna_Sensor_keyboard_modifier_set", NULL); RNA_def_property_ui_text(prop, "Modifier Key", "Modifier key code"); + RNA_def_property_update(prop, NC_LOGIC, NULL); prop= RNA_def_property(srna, "second_modifier_key", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "qual2"); RNA_def_property_enum_items(prop, event_type_items); + RNA_def_property_enum_funcs(prop, NULL, "rna_Sensor_keyboard_modifier2_set", NULL); RNA_def_property_ui_text(prop, "Second Modifier Key", "Modifier key code"); + RNA_def_property_update(prop, NC_LOGIC, NULL); prop= RNA_def_property(srna, "target", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "targetName"); RNA_def_property_ui_text(prop, "Target", "Property that indicates whether to log keystrokes as a string"); + RNA_def_property_update(prop, NC_LOGIC, NULL); prop= RNA_def_property(srna, "log", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "toggleName"); RNA_def_property_ui_text(prop, "Log Toggle", "Property that receive the keystrokes in case a string is logged"); + RNA_def_property_update(prop, NC_LOGIC, NULL); prop= RNA_def_property(srna, "all_keys", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "type", 1); RNA_def_property_ui_text(prop, "All Keys", "Trigger this sensor on any keystroke"); + RNA_def_property_update(prop, NC_LOGIC, NULL); } static void rna_def_property_sensor(BlenderRNA *brna) @@ -288,22 +384,27 @@ static void rna_def_property_sensor(BlenderRNA *brna) RNA_def_property_enum_sdna(prop, NULL, "type"); RNA_def_property_enum_items(prop, prop_type_items); RNA_def_property_ui_text(prop, "Evaluation Type", "Type of property evaluation"); + RNA_def_property_update(prop, NC_LOGIC, NULL); prop= RNA_def_property(srna, "property", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "name"); RNA_def_property_ui_text(prop, "Property", ""); + RNA_def_property_update(prop, NC_LOGIC, NULL); prop= RNA_def_property(srna, "value", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "value"); RNA_def_property_ui_text(prop, "Value", "Check for this value in types in Equal or Not Equal types"); + RNA_def_property_update(prop, NC_LOGIC, NULL); prop= RNA_def_property(srna, "min_value", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "value"); RNA_def_property_ui_text(prop, "Minimum Value", "Specify minimum value in Interval type"); + RNA_def_property_update(prop, NC_LOGIC, NULL); prop= RNA_def_property(srna, "max_value", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "maxvalue"); RNA_def_property_ui_text(prop, "Maximum Value", "Specify maximum value in Interval type"); + RNA_def_property_update(prop, NC_LOGIC, NULL); } static void rna_def_armature_sensor(BlenderRNA *brna) @@ -322,22 +423,26 @@ static void rna_def_armature_sensor(BlenderRNA *brna) RNA_def_struct_ui_text(srna, "Armature Sensor", "Sensor to detect values and changes in values of IK solver"); RNA_def_struct_sdna_from(srna, "bArmatureSensor", "data"); - prop= RNA_def_property(srna, "armature_type", PROP_ENUM, PROP_NONE); + prop= RNA_def_property(srna, "test_type", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "type"); RNA_def_property_enum_items(prop, prop_type_items); RNA_def_property_ui_text(prop, "Test Type", "Type of value and test"); + RNA_def_property_update(prop, NC_LOGIC, NULL); prop= RNA_def_property(srna, "channel_name", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "posechannel"); RNA_def_property_ui_text(prop, "Bone name", "Identify the bone to check value from"); + RNA_def_property_update(prop, NC_LOGIC, NULL); prop= RNA_def_property(srna, "constraint_name", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "constraint"); RNA_def_property_ui_text(prop, "Constraint name", "Identify the bone constraint to check value from"); + RNA_def_property_update(prop, NC_LOGIC, NULL); prop= RNA_def_property(srna, "value", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "value"); RNA_def_property_ui_text(prop, "Compare Value", "Specify value to be used in comparison"); + RNA_def_property_update(prop, NC_LOGIC, NULL); } static void rna_def_actuator_sensor(BlenderRNA *brna) @@ -353,6 +458,7 @@ static void rna_def_actuator_sensor(BlenderRNA *brna) prop= RNA_def_property(srna, "actuator", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "name"); RNA_def_property_ui_text(prop, "Actuator", "Actuator name, actuator active state modifications will be detected"); + RNA_def_property_update(prop, NC_LOGIC, NULL); } static void rna_def_delay_sensor(BlenderRNA *brna) @@ -367,51 +473,48 @@ static void rna_def_delay_sensor(BlenderRNA *brna) prop= RNA_def_property(srna, "delay", PROP_INT, PROP_NONE); RNA_def_property_ui_text(prop, "Delay", "Delay in number of logic tics before the positive trigger (default 60 per second)"); RNA_def_property_range(prop, 0, 5000); + RNA_def_property_update(prop, NC_LOGIC, NULL); prop= RNA_def_property(srna, "duration", PROP_INT, PROP_NONE); RNA_def_property_ui_text(prop, "Duration", "If >0, delay in number of logic tics before the negative trigger following the positive trigger"); RNA_def_property_range(prop, 0, 5000); + RNA_def_property_update(prop, NC_LOGIC, NULL); prop= RNA_def_property(srna, "repeat", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", SENS_DELAY_REPEAT); RNA_def_property_ui_text(prop, "Repeat", "Toggle repeat option. If selected, the sensor restarts after Delay+Dur logic tics"); + RNA_def_property_update(prop, NC_LOGIC, NULL); } static void rna_def_collision_sensor(BlenderRNA *brna) { StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem prop_type_items[] ={ -// {SENS_COLLISION_PULSE, "PULSE", 0, "Property", ""}, - {SENS_COLLISION_PROPERTY, "PROPERTY", 0, "Property", ""}, - {SENS_COLLISION_MATERIAL, "MATERIAL", 0, "Material", ""}, - {0, NULL, 0, NULL, NULL}}; srna= RNA_def_struct(brna, "CollisionSensor", "Sensor"); RNA_def_struct_ui_text(srna, "Collision Sensor", "Sensor to detect objects colliding with the current object, with more settings than the Touch sensor"); RNA_def_struct_sdna_from(srna, "bCollisionSensor", "data"); - prop= RNA_def_property(srna, "collision_type", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_sdna(prop, NULL, "mode"); - RNA_def_property_enum_items(prop, prop_type_items); - RNA_def_property_ui_text(prop, "Collision Type", "Toggle collision on material or property"); + prop= RNA_def_property(srna, "pulse", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "mode", SENS_COLLISION_PULSE); + RNA_def_property_ui_text(prop, "Pulse", "Changes to the set of colliding objects generates pulse"); + RNA_def_property_update(prop, NC_LOGIC, NULL); - /* - //XXX bad, ugly. pulse in 2.49 is part of the same "enum" of collision type - //to investigate: is pulse exclusive? or it works with mat/prop? - prop= RNA_def_property(srna, "pulse", PROP_STRING, PROP_NONE); - RNA_def_property_string_sdna(prop, NULL, "mode"); - RNA_def_property_ui_text(prop, "Property Name", "changes to the set of colliding objects generates pulse"); - */ + prop= RNA_def_property(srna, "collision_type", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "mode", SENS_COLLISION_MATERIAL); + RNA_def_property_ui_text(prop, "M/P", "Toggle collision on material or property"); + RNA_def_property_update(prop, NC_LOGIC, NULL); prop= RNA_def_property(srna, "property", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "name"); - RNA_def_property_ui_text(prop, "Property Name", "Only look for Objects with this property"); + RNA_def_property_ui_text(prop, "Property", "Only look for Objects with this property"); + RNA_def_property_update(prop, NC_LOGIC, NULL); //XXX to make a setFunction to create a lookup with all materials in Blend File (not only this object mat.) prop= RNA_def_property(srna, "material", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "materialName"); - RNA_def_property_ui_text(prop, "Material Name", "Only look for Objects with this material"); + RNA_def_property_ui_text(prop, "Material", "Only look for Objects with this material"); + RNA_def_property_update(prop, NC_LOGIC, NULL); /*//XXX either use a datablock look up to store the string name (material) // or to do a doversion and use a material pointer. @@ -443,19 +546,23 @@ static void rna_def_radar_sensor(BlenderRNA *brna) prop= RNA_def_property(srna, "property", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "name"); RNA_def_property_ui_text(prop, "Property", "Only look for Objects with this property"); + RNA_def_property_update(prop, NC_LOGIC, NULL); prop= RNA_def_property(srna, "axis", PROP_ENUM, PROP_NONE); RNA_def_property_enum_items(prop, axis_items); RNA_def_property_ui_text(prop, "Axis", "Specify along which axis the radar cone is cast"); + RNA_def_property_update(prop, NC_LOGIC, NULL); prop= RNA_def_property(srna, "angle", PROP_FLOAT, PROP_NONE); RNA_def_property_range(prop, 0.0, 179.9); RNA_def_property_ui_text(prop, "Angle", "Opening angle of the radar cone"); + RNA_def_property_update(prop, NC_LOGIC, NULL); prop= RNA_def_property(srna, "distance", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "range"); RNA_def_property_range(prop, 0.0, 10000.0); RNA_def_property_ui_text(prop, "Distance", "Depth of the radar cone"); + RNA_def_property_update(prop, NC_LOGIC, NULL); } static void rna_def_random_sensor(BlenderRNA *brna) @@ -470,6 +577,7 @@ static void rna_def_random_sensor(BlenderRNA *brna) prop= RNA_def_property(srna, "seed", PROP_INT, PROP_NONE); RNA_def_property_range(prop, 0, 1000); RNA_def_property_ui_text(prop, "Seed", "Initial seed of the generator. (Choose 0 for not random)"); + RNA_def_property_update(prop, NC_LOGIC, NULL); } static void rna_def_ray_sensor(BlenderRNA *brna) @@ -484,10 +592,6 @@ static void rna_def_ray_sensor(BlenderRNA *brna) {SENS_RAY_NEG_Y_AXIS, "NEGYAXIS", 0, "-Y axis", ""}, {SENS_RAY_NEG_Z_AXIS, "NEGZAXIS", 0, "-Z axis", ""}, {0, NULL, 0, NULL, NULL}}; - static EnumPropertyItem prop_type_items[] ={ - {SENS_RAY_PROPERTY, "PROPERTY", 0, "Property", ""}, - {SENS_RAY_MATERIAL, "MATERIAL", 0, "Material", ""}, - {0, NULL, 0, NULL, NULL}}; srna= RNA_def_struct(brna, "RaySensor", "Sensor"); RNA_def_struct_ui_text(srna, "Ray Sensor", "Sensor to detect intersections with a ray emanating from the current object"); @@ -496,10 +600,12 @@ static void rna_def_ray_sensor(BlenderRNA *brna) prop= RNA_def_property(srna, "property", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "propname"); RNA_def_property_ui_text(prop, "Property", "Only look for Objects with this property"); + RNA_def_property_update(prop, NC_LOGIC, NULL); prop= RNA_def_property(srna, "material", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "matname"); RNA_def_property_ui_text(prop, "Material", "Only look for Objects with this material"); + RNA_def_property_update(prop, NC_LOGIC, NULL); /* //XXX either use a datablock look up to store the string name (material) // or to do a doversion and use a material pointer. @@ -510,23 +616,26 @@ static void rna_def_ray_sensor(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Material", "Only look for Objects with this material"); */ - prop= RNA_def_property(srna, "ray_type", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_sdna(prop, NULL, "mode"); - RNA_def_property_enum_items(prop, prop_type_items); - RNA_def_property_ui_text(prop, "Collision Type", "Toggle collision on material or property"); + prop= RNA_def_property(srna, "ray_type", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "mode", SENS_COLLISION_MATERIAL); + RNA_def_property_ui_text(prop, "M/P", "Toggle collision on material or property"); + RNA_def_property_update(prop, NC_LOGIC, NULL); prop= RNA_def_property(srna, "x_ray_mode", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "mode", SENS_RAY_XRAY); RNA_def_property_ui_text(prop, "X-Ray Mode", "Toggle X-Ray option (see through objects that don't have the property)"); + RNA_def_property_update(prop, NC_LOGIC, NULL); prop= RNA_def_property(srna, "range", PROP_FLOAT, PROP_NONE); RNA_def_property_range(prop, 0.01, 10000.0); RNA_def_property_ui_text(prop, "Range", "Sense objects no farther than this distance"); + RNA_def_property_update(prop, NC_LOGIC, NULL); prop= RNA_def_property(srna, "axis", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "axisflag"); RNA_def_property_enum_items(prop, axis_items); RNA_def_property_ui_text(prop, "Axis", "Specify along which axis the ray is cast"); + RNA_def_property_update(prop, NC_LOGIC, NULL); } static void rna_def_message_sensor(BlenderRNA *brna) @@ -540,6 +649,7 @@ static void rna_def_message_sensor(BlenderRNA *brna) prop= RNA_def_property(srna, "subject", PROP_STRING, PROP_NONE); RNA_def_property_ui_text(prop, "Subject", "Optional subject filter: only accept messages with this subject, or empty for all"); + RNA_def_property_update(prop, NC_LOGIC, NULL); } static void rna_def_joystick_sensor(BlenderRNA *brna) @@ -581,54 +691,64 @@ static void rna_def_joystick_sensor(BlenderRNA *brna) RNA_def_property_int_sdna(prop, NULL, "joyindex"); RNA_def_property_ui_text(prop, "Index", "Specify which joystick to use"); RNA_def_property_range(prop, 0, SENS_JOY_MAXINDEX-1); + RNA_def_property_update(prop, NC_LOGIC, NULL); prop= RNA_def_property(srna, "event_type", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "type"); RNA_def_property_enum_items(prop, event_type_items); RNA_def_property_ui_text(prop, "Event Type", "The type of event this joystick sensor is triggered on"); + RNA_def_property_update(prop, NC_LOGIC, NULL); prop= RNA_def_property(srna, "all_events", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", SENS_JOY_ANY_EVENT); RNA_def_property_ui_text(prop, "All Events", "Triggered by all events on this joysticks current type (axis/button/hat)"); + RNA_def_property_update(prop, NC_LOGIC, NULL); /* Button */ prop= RNA_def_property(srna, "button_number", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "button"); RNA_def_property_ui_text(prop, "Button Number", "Specify which button to use"); RNA_def_property_range(prop, 0, 18); + RNA_def_property_update(prop, NC_LOGIC, NULL); /* Axis */ prop= RNA_def_property(srna, "axis_number", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "axis"); RNA_def_property_ui_text(prop, "Axis Number", "Specify which axis pair to use, 1 is usually the main direction input"); RNA_def_property_range(prop, 1, 2); + RNA_def_property_update(prop, NC_LOGIC, NULL); prop= RNA_def_property(srna, "axis_threshold", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "precision"); RNA_def_property_ui_text(prop, "Axis Threshold", "Specify the precision of the axis"); RNA_def_property_range(prop, 0, 32768); + RNA_def_property_update(prop, NC_LOGIC, NULL); prop= RNA_def_property(srna, "axis_direction", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "axisf"); RNA_def_property_enum_items(prop, axis_direction_items); RNA_def_property_ui_text(prop, "Axis Direction", "The direction of the axis"); + RNA_def_property_update(prop, NC_LOGIC, NULL); /* Single Axis */ prop= RNA_def_property(srna, "single_axis_number", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "axis_single"); RNA_def_property_ui_text(prop, "Axis Number", "Specify a single axis (verticle/horizontal/other) to detect"); RNA_def_property_range(prop, 1, 16); + RNA_def_property_update(prop, NC_LOGIC, NULL); /* Hat */ prop= RNA_def_property(srna, "hat_number", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "hat"); RNA_def_property_ui_text(prop, "Hat Number", "Specify which hat to use"); RNA_def_property_range(prop, 1, 2); + RNA_def_property_update(prop, NC_LOGIC, NULL); prop= RNA_def_property(srna, "hat_direction", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "hatf"); RNA_def_property_enum_items(prop, hat_direction_items); RNA_def_property_ui_text(prop, "Hat Direction", "Specify hat direction"); + RNA_def_property_update(prop, NC_LOGIC, NULL); } void RNA_def_sensor(BlenderRNA *brna) diff --git a/source/blender/makesrna/intern/rna_sequencer.c b/source/blender/makesrna/intern/rna_sequencer.c index 4af4727b43c..bbcc1f82826 100644 --- a/source/blender/makesrna/intern/rna_sequencer.c +++ b/source/blender/makesrna/intern/rna_sequencer.c @@ -137,7 +137,7 @@ static void rna_Sequence_anim_startofs_final_set(PointerRNA *ptr, int value) seq->anim_startofs = MIN2(value, seq->len + seq->anim_startofs); - reload_sequence_new_file(scene, seq); + reload_sequence_new_file(scene, seq, FALSE); rna_Sequence_frame_change_update(scene, seq); } @@ -148,7 +148,7 @@ static void rna_Sequence_anim_endofs_final_set(PointerRNA *ptr, int value) seq->anim_endofs = MIN2(value, seq->len + seq->anim_endofs); - reload_sequence_new_file(scene, seq); + reload_sequence_new_file(scene, seq, FALSE); rna_Sequence_frame_change_update(scene, seq); } @@ -431,6 +431,14 @@ static void rna_Sequence_mute_update(Main *bmain, Scene *scene, PointerRNA *ptr) rna_Sequence_update(bmain, scene, ptr); } +static void rna_Sequence_filepath_update(Main *bmain, Scene *scene, PointerRNA *ptr) +{ + Sequence *seq= (Sequence*)(ptr->data); + reload_sequence_new_file(scene, seq, TRUE); + calc_sequence(scene, seq); + rna_Sequence_update(bmain, scene, ptr); +} + /* do_versions? */ static float rna_Sequence_opacity_get(PointerRNA *ptr) { return ((Sequence*)(ptr->data))->blend_opacity / 100.0f; @@ -1014,7 +1022,7 @@ static void rna_def_movie(BlenderRNA *brna) RNA_def_property_ui_text(prop, "File", ""); RNA_def_property_string_funcs(prop, "rna_Sequence_filepath_get", "rna_Sequence_filepath_length", "rna_Sequence_filepath_set"); - RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update"); + RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_filepath_update"); rna_def_filter_video(srna); rna_def_proxy(srna); |