diff options
Diffstat (limited to 'source/blender/makesrna/intern')
-rw-r--r-- | source/blender/makesrna/intern/rna_actuator.c | 13 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_camera.c | 122 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_controller.c | 13 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_curve.c | 22 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_main.c | 2 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_main_api.c | 1 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_object.c | 9 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_sensor.c | 13 |
8 files changed, 153 insertions, 42 deletions
diff --git a/source/blender/makesrna/intern/rna_actuator.c b/source/blender/makesrna/intern/rna_actuator.c index 596e1a7f357..db71dee26ce 100644 --- a/source/blender/makesrna/intern/rna_actuator.c +++ b/source/blender/makesrna/intern/rna_actuator.c @@ -109,6 +109,18 @@ static StructRNA* rna_Actuator_refine(struct PointerRNA *ptr) } } +void rna_Actuator_name_set(PointerRNA *ptr, const char *value) +{ + bActuator *act= (bActuator *)ptr->data; + + BLI_strncpy_utf8(act->name, value, sizeof(act->name)); + + if (ptr->id.data) { + Object *ob= (Object *)ptr->id.data; + BLI_uniquename(&ob->actuators, act, "Actuator", '.', offsetof(bActuator, name), sizeof(act->name)); + } +} + static void rna_Actuator_type_set(struct PointerRNA *ptr, int value) { bActuator *act= (bActuator *)ptr->data; @@ -525,6 +537,7 @@ void rna_def_actuator(BlenderRNA *brna) prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE); RNA_def_property_ui_text(prop, "Name", ""); + RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Actuator_name_set"); RNA_def_struct_name_property(srna, prop); prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE); diff --git a/source/blender/makesrna/intern/rna_camera.c b/source/blender/makesrna/intern/rna_camera.c index 9e89c4aaab0..1e7a969caaa 100644 --- a/source/blender/makesrna/intern/rna_camera.c +++ b/source/blender/makesrna/intern/rna_camera.c @@ -40,19 +40,65 @@ #ifdef RNA_RUNTIME #include "BKE_object.h" +#include "BKE_depsgraph.h" /* only for rad/deg conversion! can remove later */ +static float get_camera_sensor(Camera *cam) +{ + if(cam->sensor_fit==CAMERA_SENSOR_FIT_AUTO) { + return cam->sensor_x; + } + else if(cam->sensor_fit==CAMERA_SENSOR_FIT_HOR) { + return cam->sensor_x; + } + else { + return cam->sensor_y; + } +} + static float rna_Camera_angle_get(PointerRNA *ptr) { Camera *cam= ptr->id.data; - - return lens_to_angle(cam->lens); + float sensor= get_camera_sensor(cam); + return focallength_to_fov(cam->lens, sensor); } static void rna_Camera_angle_set(PointerRNA *ptr, float value) { Camera *cam= ptr->id.data; - cam->lens= angle_to_lens(value); + float sensor= get_camera_sensor(cam); + cam->lens= fov_to_focallength(value, sensor); +} + +static float rna_Camera_angle_x_get(PointerRNA *ptr) +{ + Camera *cam= ptr->id.data; + return focallength_to_fov(cam->lens, cam->sensor_x); +} + +static void rna_Camera_angle_x_set(PointerRNA *ptr, float value) +{ + Camera *cam= ptr->id.data; + cam->lens= fov_to_focallength(value, cam->sensor_x); +} + +static float rna_Camera_angle_y_get(PointerRNA *ptr) +{ + Camera *cam= ptr->id.data; + return focallength_to_fov(cam->lens, cam->sensor_y); +} + +static void rna_Camera_angle_y_set(PointerRNA *ptr, float value) +{ + Camera *cam= ptr->id.data; + cam->lens= fov_to_focallength(value, cam->sensor_y); +} + +static void rna_Camera_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) +{ + Camera *camera= (Camera*)ptr->id.data; + + DAG_id_tag_update(&camera->id, 0); } #else @@ -79,6 +125,11 @@ void RNA_def_camera(BlenderRNA *brna) {0, "MILLIMETERS", 0, "Millimeters", ""}, {CAM_ANGLETOGGLE, "DEGREES", 0, "Degrees", ""}, {0, NULL, 0, NULL, NULL}}; + static EnumPropertyItem sensor_fit_items[] = { + {CAMERA_SENSOR_FIT_AUTO, "AUTO", 0, "Auto", "Calculate field of view using sensor size, with direction depending on image resolution"}, + {CAMERA_SENSOR_FIT_HOR, "HORIZONTAL", 0, "Horizontal", "Calculate field of view using sensor width"}, + {CAMERA_SENSOR_FIT_VERT, "VERTICAL", 0, "Vertical", "Calculate field of view using sensor height"}, + {0, NULL, 0, NULL, NULL}}; srna= RNA_def_struct(brna, "Camera", "ID"); RNA_def_struct_ui_text(srna, "Camera", "Camera datablock for storing camera settings"); @@ -88,7 +139,7 @@ void RNA_def_camera(BlenderRNA *brna) prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE); RNA_def_property_enum_items(prop, prop_type_items); RNA_def_property_ui_text(prop, "Type", "Camera types"); - RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL); + RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Camera_update"); prop= RNA_def_property(srna, "show_guide", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "dtx"); @@ -96,7 +147,13 @@ void RNA_def_camera(BlenderRNA *brna) RNA_def_property_flag(prop, PROP_ENUM_FLAG); RNA_def_property_ui_text(prop, "Composition Guides", "Draw overlay"); RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL); - + + prop= RNA_def_property(srna, "sensor_fit", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "sensor_fit"); + RNA_def_property_enum_items(prop, sensor_fit_items); + RNA_def_property_ui_text(prop, "Sensor Fit", "Mode of calculating field of view from sensor dimensions and focal length"); + RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Camera_update"); + /* Number values */ prop= RNA_def_property(srna, "passepartout_alpha", PROP_FLOAT, PROP_FACTOR); @@ -104,6 +161,27 @@ void RNA_def_camera(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Passepartout Alpha", "Opacity (alpha) of the darkened overlay in Camera view"); RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL); + prop= RNA_def_property(srna, "angle_x", PROP_FLOAT, PROP_ANGLE); + RNA_def_property_range(prop, M_PI * (0.367/180.0), M_PI * (172.847/180.0)); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); + RNA_def_property_ui_text(prop, "Horizontal FOV", "Camera lens horizontal field of view in degrees"); + RNA_def_property_float_funcs(prop, "rna_Camera_angle_x_get", "rna_Camera_angle_x_set", NULL); + RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Camera_update"); + + prop= RNA_def_property(srna, "angle_y", PROP_FLOAT, PROP_ANGLE); + RNA_def_property_range(prop, M_PI * (0.367/180.0), M_PI * (172.847/180.0)); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); + RNA_def_property_ui_text(prop, "Vertical FOV", "Camera lens vertical field of view in degrees"); + RNA_def_property_float_funcs(prop, "rna_Camera_angle_y_get", "rna_Camera_angle_y_set", NULL); + RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Camera_update"); + + prop= RNA_def_property(srna, "angle", PROP_FLOAT, PROP_ANGLE); + RNA_def_property_range(prop, M_PI * (0.367/180.0), M_PI * (172.847/180.0)); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); + RNA_def_property_ui_text(prop, "Field of View", "Camera lens field of view in degrees"); + RNA_def_property_float_funcs(prop, "rna_Camera_angle_get", "rna_Camera_angle_set", NULL); + RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Camera_update"); + prop= RNA_def_property(srna, "clip_start", PROP_FLOAT, PROP_DISTANCE); RNA_def_property_float_sdna(prop, NULL, "clipsta"); RNA_def_property_range(prop, 0.001f, FLT_MAX); @@ -120,20 +198,27 @@ void RNA_def_camera(BlenderRNA *brna) RNA_def_property_float_sdna(prop, NULL, "lens"); RNA_def_property_range(prop, 1.0f, 5000.0f); RNA_def_property_ui_text(prop, "Focal Length", "Perspective Camera lens value in millimeters"); - RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL); - - prop= RNA_def_property(srna, "angle", PROP_FLOAT, PROP_ANGLE); - RNA_def_property_range(prop, M_PI * (0.367/180.0), M_PI * (172.847/180.0)); - RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); - RNA_def_property_ui_text(prop, "Angle", "Perspective Camera lens field of view in degrees"); - RNA_def_property_float_funcs(prop, "rna_Camera_angle_get", "rna_Camera_angle_set", NULL); /* only for deg/rad conversion */ - RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL); + RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Camera_update"); + + prop= RNA_def_property(srna, "sensor_width", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "sensor_x"); + RNA_def_property_range(prop, 1.0f, FLT_MAX); + RNA_def_property_ui_range(prop, 1.0f, 100.f, 1, 2); + RNA_def_property_ui_text(prop, "Sensor Width", "Horizontal size of the image sensor area in millimeters"); + RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Camera_update"); + + prop= RNA_def_property(srna, "sensor_height", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "sensor_y"); + RNA_def_property_range(prop, 1.0f, FLT_MAX); + RNA_def_property_ui_range(prop, 1.0f, 100.f, 1, 2); + RNA_def_property_ui_text(prop, "Sensor Height", "Vertical size of the image sensor area in millimeters"); + RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Camera_update"); prop= RNA_def_property(srna, "ortho_scale", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "ortho_scale"); RNA_def_property_range(prop, 0.01f, 4000.0f); RNA_def_property_ui_text(prop, "Orthographic Scale", "Orthographic Camera scale (similar to zoom)"); - RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL); + RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Camera_update"); prop= RNA_def_property(srna, "draw_size", PROP_FLOAT, PROP_DISTANCE); RNA_def_property_float_sdna(prop, NULL, "drawsize"); @@ -147,14 +232,14 @@ void RNA_def_camera(BlenderRNA *brna) RNA_def_property_range(prop, -10.0f, 10.0f); RNA_def_property_ui_range(prop, -2.0, 2.0, 1, 3); RNA_def_property_ui_text(prop, "Shift X", "Perspective Camera horizontal shift"); - RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL); + RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Camera_update"); prop= RNA_def_property(srna, "shift_y", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "shifty"); RNA_def_property_range(prop, -10.0f, 10.0f); RNA_def_property_ui_range(prop, -2.0, 2.0, 1, 3); RNA_def_property_ui_text(prop, "Shift Y", "Perspective Camera vertical shift"); - RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL); + RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Camera_update"); prop= RNA_def_property(srna, "dof_distance", PROP_FLOAT, PROP_DISTANCE); RNA_def_property_float_sdna(prop, NULL, "YF_dofdist"); @@ -188,6 +273,11 @@ void RNA_def_camera(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Show Name", "Show the active Camera's name in Camera view"); RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL); + prop= RNA_def_property(srna, "show_sensor", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", CAM_SHOWSENSOR); + RNA_def_property_ui_text(prop, "Show Sensor Size", "Show sensor size (film gate) in Camera view"); + RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL); + prop= RNA_def_property(srna, "lens_unit", PROP_ENUM, PROP_NONE); RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag"); RNA_def_property_enum_items(prop, prop_lens_unit_items); diff --git a/source/blender/makesrna/intern/rna_controller.c b/source/blender/makesrna/intern/rna_controller.c index fe899f99ed2..89239c10ffd 100644 --- a/source/blender/makesrna/intern/rna_controller.c +++ b/source/blender/makesrna/intern/rna_controller.c @@ -75,6 +75,18 @@ static struct StructRNA* rna_Controller_refine(struct PointerRNA *ptr) } } +void rna_Constroller_name_set(PointerRNA *ptr, const char *value) +{ + bController *cont= (bController *)ptr->data; + + BLI_strncpy_utf8(cont->name, value, sizeof(cont->name)); + + if (ptr->id.data) { + Object *ob= (Object *)ptr->id.data; + BLI_uniquename(&ob->controllers, cont, "Controller", '.', offsetof(bController, name), sizeof(cont->name)); + } +} + static void rna_Controller_type_set(struct PointerRNA *ptr, int value) { bController *cont= (bController *)ptr->data; @@ -177,6 +189,7 @@ 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_property_string_funcs(prop, NULL, NULL, "rna_Constroller_name_set"); RNA_def_struct_name_property(srna, prop); RNA_def_property_update(prop, NC_LOGIC, NULL); diff --git a/source/blender/makesrna/intern/rna_curve.c b/source/blender/makesrna/intern/rna_curve.c index cbac594a80f..93fdc2b2136 100644 --- a/source/blender/makesrna/intern/rna_curve.c +++ b/source/blender/makesrna/intern/rna_curve.c @@ -268,26 +268,10 @@ static void rna_Curve_active_textbox_index_range(PointerRNA *ptr, int *min, int static void rna_Curve_dimension_set(PointerRNA *ptr, int value) { Curve *cu= (Curve*)ptr->id.data; - ListBase *nurbs= BKE_curve_nurbs(cu); - Nurb *nu= nurbs->first; + if(value==CU_3D) cu->flag |= CU_3D; + else cu->flag &= ~CU_3D; - if(value==CU_3D) { - cu->flag |= CU_3D; - for( ; nu; nu= nu->next) { - nu->flag &= ~CU_2D; - } - } - else { - cu->flag &= ~CU_3D; - for( ; nu; nu= nu->next) { - nu->flag |= CU_2D; - test2DNurb(nu); - - /* since the handles are moved they need to be auto-located again */ - if(nu->type == CU_BEZIER) - calchandlesNurb(nu); - } - } + update_curve_dimension(cu); } static EnumPropertyItem *rna_Curve_fill_mode_itemf(bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *UNUSED(free)) diff --git a/source/blender/makesrna/intern/rna_main.c b/source/blender/makesrna/intern/rna_main.c index 92c84da165b..076bdfe1964 100644 --- a/source/blender/makesrna/intern/rna_main.c +++ b/source/blender/makesrna/intern/rna_main.c @@ -324,7 +324,7 @@ void RNA_def_main(BlenderRNA *brna) prop= RNA_def_property(srna, "is_dirty", PROP_BOOLEAN, PROP_NONE); RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_boolean_funcs(prop, "rna_Main_is_dirty_get", NULL); - RNA_def_property_ui_text(prop, "File is Saved", "Have recent edits been saved to disk"); + RNA_def_property_ui_text(prop, "File Has Unsaved Changes", "Have recent edits been saved to disk"); prop= RNA_def_property(srna, "is_saved", PROP_BOOLEAN, PROP_NONE); RNA_def_property_clear_flag(prop, PROP_EDITABLE); diff --git a/source/blender/makesrna/intern/rna_main_api.c b/source/blender/makesrna/intern/rna_main_api.c index a0402ed3593..1b80e33b40c 100644 --- a/source/blender/makesrna/intern/rna_main_api.c +++ b/source/blender/makesrna/intern/rna_main_api.c @@ -568,7 +568,6 @@ static int rna_Main_textures_is_updated_get(PointerRNA *ptr) { return DAG_id_typ static int rna_Main_brushes_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_BR); } static int rna_Main_worlds_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_WO); } static int rna_Main_groups_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_GR); } -static int rna_Main_shape_keys_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_KE); } static int rna_Main_texts_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_TXT); } static int rna_Main_speakers_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_SPK); } static int rna_Main_sounds_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_SO); } diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c index 0fa63671951..7e2700629ad 100644 --- a/source/blender/makesrna/intern/rna_object.c +++ b/source/blender/makesrna/intern/rna_object.c @@ -948,10 +948,10 @@ static void rna_GameObjectSettings_physics_type_set(PointerRNA *ptr, int value) if (ob->type == OB_MESH) { /* this is needed to refresh the derived meshes draw func */ DAG_id_tag_update(ptr->id.data, OB_RECALC_DATA); - WM_main_add_notifier(NC_OBJECT|ND_DRAW, ptr->id.data); } } + WM_main_add_notifier(NC_OBJECT|ND_DRAW, ptr->id.data); } static PointerRNA rna_Object_active_particle_system_get(PointerRNA *ptr) @@ -1532,9 +1532,10 @@ static void rna_def_object_game_settings(BlenderRNA *brna) prop= RNA_def_property(srna, "use_collision_bounds", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "gameflag", OB_BOUNDS); RNA_def_property_ui_text(prop, "Use Collision Bounds", "Specify a collision bounds type other than the default"); + RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL); prop= RNA_def_property(srna, "collision_bounds_type", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_sdna(prop, NULL, "boundtype"); + RNA_def_property_enum_sdna(prop, NULL, "collision_boundtype"); RNA_def_property_enum_items(prop, collision_bounds_items); RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Object_collision_bounds_itemf"); RNA_def_property_ui_text(prop, "Collision Bounds", "Select the collision type"); @@ -1803,8 +1804,6 @@ static void rna_def_object(BlenderRNA *brna) {OB_BOUND_SPHERE, "SPHERE", 0, "Sphere", "Draw bounds as sphere"}, {OB_BOUND_CYLINDER, "CYLINDER", 0, "Cylinder", "Draw bounds as cylinder"}, {OB_BOUND_CONE, "CONE", 0, "Cone", "Draw bounds as cone"}, - {OB_BOUND_TRIANGLE_MESH, "POLYHEDRON", 0, "Polyhedron", "Draw bounds as polyhedron"}, - {OB_BOUND_CAPSULE, "CAPSULE", 0, "Capsule", "Draw bounds as capsule"}, {0, NULL, 0, NULL, NULL}}; static EnumPropertyItem dupli_items[] = { @@ -2226,7 +2225,7 @@ static void rna_def_object(BlenderRNA *brna) prop= RNA_def_property(srna, "use_dupli_frames_speed", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_negative_sdna(prop, NULL, "transflag", OB_DUPLINOSPEED); - RNA_def_property_ui_text(prop, "Dupli Frames Speed", "Set dupliframes to use the frame"); // TODO, better descriptio! + RNA_def_property_ui_text(prop, "Dupli Frames Speed", "Set dupliframes to use the current frame instead of parent curve's evaluation time"); RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Object_internal_update"); prop= RNA_def_property(srna, "use_dupli_vertices_rotation", PROP_BOOLEAN, PROP_NONE); diff --git a/source/blender/makesrna/intern/rna_sensor.c b/source/blender/makesrna/intern/rna_sensor.c index 217b50b38e5..ba58a66a2d6 100644 --- a/source/blender/makesrna/intern/rna_sensor.c +++ b/source/blender/makesrna/intern/rna_sensor.c @@ -102,6 +102,18 @@ static StructRNA* rna_Sensor_refine(struct PointerRNA *ptr) } } +void rna_Sensor_name_set(PointerRNA *ptr, const char *value) +{ + bSensor *sens= (bSensor *)ptr->data; + + BLI_strncpy_utf8(sens->name, value, sizeof(sens->name)); + + if (ptr->id.data) { + Object *ob= (Object *)ptr->id.data; + BLI_uniquename(&ob->sensors, sens, "Sensor", '.', offsetof(bSensor, name), sizeof(sens->name)); + } +} + static void rna_Sensor_type_set(struct PointerRNA *ptr, int value) { bSensor *sens= (bSensor *)ptr->data; @@ -260,6 +272,7 @@ 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_property_string_funcs(prop, NULL, NULL, "rna_Sensor_name_set"); RNA_def_struct_name_property(srna, prop); RNA_def_property_update(prop, NC_LOGIC, NULL); |