Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDalai Felinto <dfelinto@gmail.com>2010-05-07 22:53:28 +0400
committerDalai Felinto <dfelinto@gmail.com>2010-05-07 22:53:28 +0400
commit22978ebfdc8a4506431492ac39d0ffd5d975093f (patch)
treec82e40a32b23cd53bfc82da874a393522f8b15ed /source/blender
parent5774e61f4a4b7ebbc12017eebf454847bc5ab25a (diff)
Logic UI - fixing missing rna default values
there are some cases (i.e. Constraint Actuator) where the same DNA property is being used by different RNAs with different ranges. It's easy to change (reset the values to their default in the set func of the constrant type rna). Not sure it's necessary though.
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/blenkernel/intern/sca.c14
-rw-r--r--source/blender/editors/space_logic/logic_window.c4
-rw-r--r--source/blender/makesdna/DNA_actuator_types.h4
-rw-r--r--source/blender/makesrna/intern/rna_actuator.c7
4 files changed, 23 insertions, 6 deletions
diff --git a/source/blender/blenkernel/intern/sca.c b/source/blender/blenkernel/intern/sca.c
index 060c9312f99..5a06c251b88 100644
--- a/source/blender/blenkernel/intern/sca.c
+++ b/source/blender/blenkernel/intern/sca.c
@@ -98,6 +98,8 @@ void init_sensor(bSensor *sens)
/* also use when sensor changes type */
bNearSensor *ns;
bMouseSensor *ms;
+ bJoystickSensor *js;
+ bRaySensor *rs;
if(sens->data) MEM_freeN(sens->data);
sens->data= NULL;
@@ -145,12 +147,18 @@ void init_sensor(bSensor *sens)
break;
case SENS_RAY:
sens->data= MEM_callocN(sizeof(bRaySensor), "raysens");
+ rs = sens->data;
+ rs->range = 0.01f;
break;
case SENS_MESSAGE:
sens->data= MEM_callocN(sizeof(bMessageSensor), "messagesens");
break;
case SENS_JOYSTICK:
sens->data= MEM_callocN(sizeof(bJoystickSensor), "joysticksens");
+ js= sens->data;
+ js->hatf = SENS_JOY_HAT_UP;
+ js->axis = 1;
+ js->hat = 1;
break;
default:
; /* this is very severe... I cannot make any memory for this */
@@ -383,7 +391,9 @@ void copy_actuators(ListBase *lbn, ListBase *lbo)
void init_actuator(bActuator *act)
{
/* also use when actuator changes type */
+ bCameraActuator *ca;
bObjectActuator *oa;
+ bRandomActuator *ra;
bSoundActuator *sa;
if(act->data) MEM_freeN(act->data);
@@ -417,6 +427,8 @@ void init_actuator(bActuator *act)
break;
case ACT_CAMERA:
act->data= MEM_callocN(sizeof(bCameraActuator), "camact");
+ ca = act->data;
+ ca->axis = ACT_CAMERA_X;
break;
case ACT_EDIT_OBJECT:
act->data= MEM_callocN(sizeof(bEditObjectActuator), "editobact");
@@ -432,6 +444,8 @@ void init_actuator(bActuator *act)
break;
case ACT_RANDOM:
act->data= MEM_callocN(sizeof(bRandomActuator), "random act");
+ ra=act->data;
+ ra->float_arg_1 = 0.1f;
break;
case ACT_MESSAGE:
act->data= MEM_callocN(sizeof(bMessageActuator), "message act");
diff --git a/source/blender/editors/space_logic/logic_window.c b/source/blender/editors/space_logic/logic_window.c
index daeb3df908a..aab4f948401 100644
--- a/source/blender/editors/space_logic/logic_window.c
+++ b/source/blender/editors/space_logic/logic_window.c
@@ -3284,7 +3284,7 @@ static void draw_sensor_joystick(uiLayout *layout, PointerRNA *ptr)
col = uiLayoutColumn(layout, 0);
uiLayoutSetActive(col, RNA_boolean_get(ptr, "all_events")==0);
- uiItemR(col, ptr, "hat_direction", 0, NULL, 0); //XXXSENSOR - needs a default value (somewhere else in the code)
+ uiItemR(col, ptr, "hat_direction", 0, NULL, 0);
break;
case SENS_JOY_AXIS_SINGLE:
row = uiLayoutRow(layout, 0);
@@ -3924,6 +3924,8 @@ static void draw_actuator_motion(uiLayout *layout, PointerRNA *ptr)
uiItemR(subcol, ptr, "force_min_z", 0, NULL, 0);
//XXXACTUATOR missing labels from original 2.49 ui (e.g. Servo, Min, Max, Fast)
+ //Layout designers willing to help on that, please compare with 2.49 ui
+ // (since the old code is going to be deleted ... soon)
col = uiLayoutColumn(layout, 1);
uiItemR(col, ptr, "proportional_coefficient", UI_ITEM_R_SLIDER, NULL, 0);
diff --git a/source/blender/makesdna/DNA_actuator_types.h b/source/blender/makesdna/DNA_actuator_types.h
index 923f7f232e0..03200b784b4 100644
--- a/source/blender/makesdna/DNA_actuator_types.h
+++ b/source/blender/makesdna/DNA_actuator_types.h
@@ -498,6 +498,10 @@ typedef struct FreeCamera {
#define ACT_STATE_REMOVE 2
#define ACT_STATE_CHANGE 3
+/* cameraactuator->axis */
+#define ACT_CAMERA_X (float)'x'
+#define ACT_CAMERA_Y (float)'y'
+
#endif
diff --git a/source/blender/makesrna/intern/rna_actuator.c b/source/blender/makesrna/intern/rna_actuator.c
index 5e5ca2cd2b1..f83cf4a296c 100644
--- a/source/blender/makesrna/intern/rna_actuator.c
+++ b/source/blender/makesrna/intern/rna_actuator.c
@@ -776,8 +776,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");
@@ -808,14 +808,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)