diff options
author | Miika Hamalainen <blender@miikah.org> | 2011-11-05 12:04:49 +0400 |
---|---|---|
committer | Miika Hamalainen <blender@miikah.org> | 2011-11-05 12:04:49 +0400 |
commit | 2ed6f077b3952123d56916980d18a379ecb3e5ac (patch) | |
tree | 1aa273e5566c95214739fb224d4c6cf115417882 /source/blender/makesrna/intern | |
parent | b9c83456b27da57a14bcf8d274b460e670d49990 (diff) | |
parent | 62f22185546e80b661424b45c88006f8b592d8b1 (diff) |
Merge with trunk r41545
Diffstat (limited to 'source/blender/makesrna/intern')
21 files changed, 633 insertions, 171 deletions
diff --git a/source/blender/makesrna/intern/makesrna.c b/source/blender/makesrna/intern/makesrna.c index 5007aefeaef..d4a9cf1f830 100644 --- a/source/blender/makesrna/intern/makesrna.c +++ b/source/blender/makesrna/intern/makesrna.c @@ -70,25 +70,28 @@ static int replace_if_different(char *tmpfile, const char *dep_files[]) { // return 0; // use for testing had edited rna -#define REN_IF_DIFF \ - { \ - FILE *file_test= fopen(orgfile, "rb"); \ - if(file_test) { \ - fclose(file_test); \ - if(fp_org) fclose(fp_org); \ - if(fp_new) fclose(fp_new); \ - if(remove(orgfile) != 0) { \ - fprintf(stderr, "%s:%d, Remove Error (%s): \"%s\"\n", __FILE__, __LINE__, strerror(errno), orgfile); \ - return -1; \ - } \ - } \ - } \ - if(rename(tmpfile, orgfile) != 0) { \ - fprintf(stderr, "%s:%d, Rename Error (%s): \"%s\" -> \"%s\"\n", __FILE__, __LINE__, strerror(errno), tmpfile, orgfile); \ - return -1; \ - } \ - remove(tmpfile); \ - return 1; \ +#define REN_IF_DIFF \ + { \ + FILE *file_test= fopen(orgfile, "rb"); \ + if(file_test) { \ + fclose(file_test); \ + if(fp_org) fclose(fp_org); \ + if(fp_new) fclose(fp_new); \ + if(remove(orgfile) != 0) { \ + fprintf(stderr, "%s:%d, Remove Error (%s): \"%s\"\n", \ + __FILE__, __LINE__, strerror(errno), orgfile); \ + return -1; \ + } \ + } \ + } \ + if(rename(tmpfile, orgfile) != 0) { \ + fprintf(stderr, "%s:%d, Rename Error (%s): \"%s\" -> \"%s\"\n", \ + __FILE__, __LINE__, strerror(errno), tmpfile, orgfile); \ + return -1; \ + } \ + remove(tmpfile); \ + return 1; \ + /* end REN_IF_DIFF */ diff --git a/source/blender/makesrna/intern/rna_ID.c b/source/blender/makesrna/intern/rna_ID.c index 194c3e8d18e..e4692d32338 100644 --- a/source/blender/makesrna/intern/rna_ID.c +++ b/source/blender/makesrna/intern/rna_ID.c @@ -486,6 +486,16 @@ static void rna_def_ID(BlenderRNA *brna) RNA_def_property_flag(prop, PROP_LIB_EXCEPTION); RNA_def_property_ui_text(prop, "Tag", "Tools can use this to tag data (initial state is undefined)"); + prop= RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", LIB_ID_RECALC); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Is Updated", "Datablock is tagged for recalculation"); + + prop= RNA_def_property(srna, "is_updated_data", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", LIB_ID_RECALC_DATA); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Is Updated Data", "Datablock data is tagged for recalculation"); + prop= RNA_def_property(srna, "library", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "lib"); RNA_def_property_clear_flag(prop, PROP_EDITABLE); diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c index a33efda38d0..793d0112af7 100644 --- a/source/blender/makesrna/intern/rna_access.c +++ b/source/blender/makesrna/intern/rna_access.c @@ -2930,28 +2930,28 @@ int RNA_property_collection_raw_array(PointerRNA *ptr, PropertyRNA *prop, Proper return 1; } -#define RAW_GET(dtype, var, raw, a) \ -{ \ - switch(raw.type) { \ - case PROP_RAW_CHAR: var = (dtype)((char*)raw.array)[a]; break; \ - case PROP_RAW_SHORT: var = (dtype)((short*)raw.array)[a]; break; \ - case PROP_RAW_INT: var = (dtype)((int*)raw.array)[a]; break; \ - case PROP_RAW_FLOAT: var = (dtype)((float*)raw.array)[a]; break; \ - case PROP_RAW_DOUBLE: var = (dtype)((double*)raw.array)[a]; break; \ - default: var = (dtype)0; \ - } \ -} - -#define RAW_SET(dtype, raw, a, var) \ -{ \ - switch(raw.type) { \ - case PROP_RAW_CHAR: ((char*)raw.array)[a] = (char)var; break; \ - case PROP_RAW_SHORT: ((short*)raw.array)[a] = (short)var; break; \ - case PROP_RAW_INT: ((int*)raw.array)[a] = (int)var; break; \ - case PROP_RAW_FLOAT: ((float*)raw.array)[a] = (float)var; break; \ - case PROP_RAW_DOUBLE: ((double*)raw.array)[a] = (double)var; break; \ - default: break; \ - } \ +#define RAW_GET(dtype, var, raw, a) \ +{ \ + switch(raw.type) { \ + case PROP_RAW_CHAR: var = (dtype)((char*)raw.array)[a]; break; \ + case PROP_RAW_SHORT: var = (dtype)((short*)raw.array)[a]; break; \ + case PROP_RAW_INT: var = (dtype)((int*)raw.array)[a]; break; \ + case PROP_RAW_FLOAT: var = (dtype)((float*)raw.array)[a]; break; \ + case PROP_RAW_DOUBLE: var = (dtype)((double*)raw.array)[a]; break; \ + default: var = (dtype)0; \ + } \ +} + +#define RAW_SET(dtype, raw, a, var) \ +{ \ + switch(raw.type) { \ + case PROP_RAW_CHAR: ((char*)raw.array)[a] = (char)var; break; \ + case PROP_RAW_SHORT: ((short*)raw.array)[a] = (short)var; break; \ + case PROP_RAW_INT: ((int*)raw.array)[a] = (int)var; break; \ + case PROP_RAW_FLOAT: ((float*)raw.array)[a] = (float)var; break; \ + case PROP_RAW_DOUBLE: ((double*)raw.array)[a] = (double)var; break; \ + default: break; \ + } \ } int RNA_raw_type_sizeof(RawPropertyType type) 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_color.c b/source/blender/makesrna/intern/rna_color.c index 59d23b7a878..60144e0cf7f 100644 --- a/source/blender/makesrna/intern/rna_color.c +++ b/source/blender/makesrna/intern/rna_color.c @@ -167,19 +167,20 @@ static char *rna_ColorRampElement_path(PointerRNA *ptr) /* helper macro for use here to try and get the path * - this calls the standard code for getting a path to a texture... */ -#define COLRAMP_GETPATH \ -{ \ -prop= RNA_struct_find_property(&ramp_ptr, "elements"); \ -if (prop) { \ -index= RNA_property_collection_lookup_index(&ramp_ptr, prop, ptr); \ -if (index >= 0) { \ -char *texture_path= rna_ColorRamp_path(&ramp_ptr); \ -path= BLI_sprintfN("%s.elements[%d]", texture_path, index); \ -MEM_freeN(texture_path); \ -} \ -} \ + +#define COLRAMP_GETPATH \ +{ \ + prop= RNA_struct_find_property(&ramp_ptr, "elements"); \ + if (prop) { \ + index= RNA_property_collection_lookup_index(&ramp_ptr, prop, ptr); \ + if (index >= 0) { \ + char *texture_path= rna_ColorRamp_path(&ramp_ptr); \ + path= BLI_sprintfN("%s.elements[%d]", texture_path, index); \ + MEM_freeN(texture_path); \ + } \ + } \ } - + /* determine the path from the ID-block to the ramp */ // FIXME: this is a very slow way to do it, but it will have to suffice... if (ptr->id.data) { 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_lamp.c b/source/blender/makesrna/intern/rna_lamp.c index 572559546c8..629711fcf96 100644 --- a/source/blender/makesrna/intern/rna_lamp.c +++ b/source/blender/makesrna/intern/rna_lamp.c @@ -46,6 +46,7 @@ #include "BKE_main.h" #include "BKE_texture.h" +#include "ED_node.h" #include "WM_api.h" #include "WM_types.h" @@ -145,6 +146,15 @@ static void rna_Lamp_spot_size_set(PointerRNA *ptr, float value) la->spotsize= RAD2DEGF(value); } +static void rna_Lamp_use_nodes_update(Main *blain, Scene *scene, PointerRNA *ptr) +{ + Lamp *la= (Lamp*)ptr->data; + + if(la->use_nodes && la->nodetree==NULL) + ED_node_shader_default(scene, &la->id); + + rna_Lamp_update(blain, scene, ptr); +} #else @@ -366,6 +376,17 @@ static void rna_def_lamp(BlenderRNA *brna) RNA_def_property_boolean_negative_sdna(prop, NULL, "mode", LA_NO_DIFF); RNA_def_property_ui_text(prop, "Diffuse", "Lamp does diffuse shading"); RNA_def_property_update(prop, 0, "rna_Lamp_update"); + + /* nodes */ + prop= RNA_def_property(srna, "node_tree", PROP_POINTER, PROP_NONE); + RNA_def_property_pointer_sdna(prop, NULL, "nodetree"); + RNA_def_property_ui_text(prop, "Node Tree", "Node tree for node based lamps"); + + prop= RNA_def_property(srna, "use_nodes", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "use_nodes", 1); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); + RNA_def_property_ui_text(prop, "Use Nodes", "Use shader nodes to render the lamp"); + RNA_def_property_update(prop, 0, "rna_Lamp_use_nodes_update"); /* common */ rna_def_animdata_common(srna); 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 3f7cdf8d204..1b80e33b40c 100644 --- a/source/blender/makesrna/intern/rna_main_api.c +++ b/source/blender/makesrna/intern/rna_main_api.c @@ -62,6 +62,7 @@ #include "BKE_particle.h" #include "BKE_font.h" #include "BKE_node.h" +#include "BKE_depsgraph.h" #include "BKE_speaker.h" #include "DNA_armature_types.h" @@ -548,6 +549,33 @@ void rna_Main_actions_tag(Main *bmain, int value) { tag_main_lb(&bmain->action, void rna_Main_particles_tag(Main *bmain, int value) { tag_main_lb(&bmain->particle, value); } void rna_Main_gpencil_tag(Main *bmain, int value) { tag_main_lb(&bmain->gpencil, value); } +static int rna_Main_cameras_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_CA); } +static int rna_Main_scenes_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_SCE); } +static int rna_Main_objects_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_OB); } +static int rna_Main_materials_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_MA); } +static int rna_Main_node_groups_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_NT); } +static int rna_Main_meshes_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_ME); } +static int rna_Main_lamps_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_LA); } +static int rna_Main_libraries_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_LI); } +static int rna_Main_screens_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_SCR); } +static int rna_Main_window_managers_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_WM); } +static int rna_Main_images_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_IM); } +static int rna_Main_lattices_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_LT); } +static int rna_Main_curves_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_CU); } +static int rna_Main_metaballs_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_MB); } +static int rna_Main_fonts_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_VF); } +static int rna_Main_textures_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_TE); } +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_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); } +static int rna_Main_armatures_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_AR); } +static int rna_Main_actions_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_AC); } +static int rna_Main_particles_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_PA); } +static int rna_Main_gpencil_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_GD); } + #else void RNA_api_main(StructRNA *srna) @@ -574,6 +602,7 @@ void RNA_def_main_cameras(BlenderRNA *brna, PropertyRNA *cprop) StructRNA *srna; FunctionRNA *func; PropertyRNA *parm; + PropertyRNA *prop; RNA_def_property_srna(cprop, "BlendDataCameras"); srna= RNA_def_struct(brna, "BlendDataCameras", NULL); @@ -597,6 +626,10 @@ void RNA_def_main_cameras(BlenderRNA *brna, PropertyRNA *cprop) func= RNA_def_function(srna, "tag", "rna_Main_cameras_tag"); parm= RNA_def_boolean(func, "value", 0, "Value", ""); RNA_def_property_flag(parm, PROP_REQUIRED); + + prop= RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_boolean_funcs(prop, "rna_Main_cameras_is_updated_get", NULL); } void RNA_def_main_scenes(BlenderRNA *brna, PropertyRNA *cprop) @@ -604,6 +637,7 @@ void RNA_def_main_scenes(BlenderRNA *brna, PropertyRNA *cprop) StructRNA *srna; FunctionRNA *func; PropertyRNA *parm; + PropertyRNA *prop; RNA_def_property_srna(cprop, "BlendDataScenes"); srna= RNA_def_struct(brna, "BlendDataScenes", NULL); @@ -623,6 +657,10 @@ void RNA_def_main_scenes(BlenderRNA *brna, PropertyRNA *cprop) RNA_def_function_ui_description(func, "Remove a scene from the current blendfile"); parm= RNA_def_pointer(func, "scene", "Scene", "", "Scene to remove"); RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL); + + prop= RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_boolean_funcs(prop, "rna_Main_scenes_is_updated_get", NULL); } void RNA_def_main_objects(BlenderRNA *brna, PropertyRNA *cprop) @@ -630,6 +668,7 @@ void RNA_def_main_objects(BlenderRNA *brna, PropertyRNA *cprop) StructRNA *srna; FunctionRNA *func; PropertyRNA *parm; + PropertyRNA *prop; RNA_def_property_srna(cprop, "BlendDataObjects"); srna= RNA_def_struct(brna, "BlendDataObjects", NULL); @@ -657,6 +696,10 @@ void RNA_def_main_objects(BlenderRNA *brna, PropertyRNA *cprop) func= RNA_def_function(srna, "tag", "rna_Main_objects_tag"); parm= RNA_def_boolean(func, "value", 0, "Value", ""); RNA_def_property_flag(parm, PROP_REQUIRED); + + prop= RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_boolean_funcs(prop, "rna_Main_objects_is_updated_get", NULL); } void RNA_def_main_materials(BlenderRNA *brna, PropertyRNA *cprop) @@ -664,6 +707,7 @@ void RNA_def_main_materials(BlenderRNA *brna, PropertyRNA *cprop) StructRNA *srna; FunctionRNA *func; PropertyRNA *parm; + PropertyRNA *prop; RNA_def_property_srna(cprop, "BlendDataMaterials"); srna= RNA_def_struct(brna, "BlendDataMaterials", NULL); @@ -687,12 +731,17 @@ void RNA_def_main_materials(BlenderRNA *brna, PropertyRNA *cprop) func= RNA_def_function(srna, "tag", "rna_Main_materials_tag"); parm= RNA_def_boolean(func, "value", 0, "Value", ""); RNA_def_property_flag(parm, PROP_REQUIRED); + + prop= RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_boolean_funcs(prop, "rna_Main_materials_is_updated_get", NULL); } void RNA_def_main_node_groups(BlenderRNA *brna, PropertyRNA *cprop) { StructRNA *srna; FunctionRNA *func; PropertyRNA *parm; + PropertyRNA *prop; static EnumPropertyItem node_nodetree_items[] = { {0, "SHADER", 0, "Shader", ""}, @@ -724,12 +773,17 @@ void RNA_def_main_node_groups(BlenderRNA *brna, PropertyRNA *cprop) func= RNA_def_function(srna, "tag", "rna_Main_node_groups_tag"); parm= RNA_def_boolean(func, "value", 0, "Value", ""); RNA_def_property_flag(parm, PROP_REQUIRED); + + prop= RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_boolean_funcs(prop, "rna_Main_node_groups_is_updated_get", NULL); } void RNA_def_main_meshes(BlenderRNA *brna, PropertyRNA *cprop) { StructRNA *srna; FunctionRNA *func; PropertyRNA *parm; + PropertyRNA *prop; RNA_def_property_srna(cprop, "BlendDataMeshes"); srna= RNA_def_struct(brna, "BlendDataMeshes", NULL); @@ -753,12 +807,17 @@ void RNA_def_main_meshes(BlenderRNA *brna, PropertyRNA *cprop) func= RNA_def_function(srna, "tag", "rna_Main_meshes_tag"); parm= RNA_def_boolean(func, "value", 0, "Value", ""); RNA_def_property_flag(parm, PROP_REQUIRED); + + prop= RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_boolean_funcs(prop, "rna_Main_meshes_is_updated_get", NULL); } void RNA_def_main_lamps(BlenderRNA *brna, PropertyRNA *cprop) { StructRNA *srna; FunctionRNA *func; PropertyRNA *parm; + PropertyRNA *prop; RNA_def_property_srna(cprop, "BlendDataLamps"); srna= RNA_def_struct(brna, "BlendDataLamps", NULL); @@ -784,6 +843,10 @@ void RNA_def_main_lamps(BlenderRNA *brna, PropertyRNA *cprop) func= RNA_def_function(srna, "tag", "rna_Main_lamps_tag"); parm= RNA_def_boolean(func, "value", 0, "Value", ""); RNA_def_property_flag(parm, PROP_REQUIRED); + + prop= RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_boolean_funcs(prop, "rna_Main_lamps_is_updated_get", NULL); } void RNA_def_main_libraries(BlenderRNA *brna, PropertyRNA *cprop) @@ -791,6 +854,7 @@ void RNA_def_main_libraries(BlenderRNA *brna, PropertyRNA *cprop) StructRNA *srna; FunctionRNA *func; PropertyRNA *parm; + PropertyRNA *prop; RNA_def_property_srna(cprop, "BlendDataLibraries"); srna= RNA_def_struct(brna, "BlendDataLibraries", NULL); @@ -800,6 +864,10 @@ void RNA_def_main_libraries(BlenderRNA *brna, PropertyRNA *cprop) func= RNA_def_function(srna, "tag", "rna_Main_libraries_tag"); parm= RNA_def_boolean(func, "value", 0, "Value", ""); RNA_def_property_flag(parm, PROP_REQUIRED); + + prop= RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_boolean_funcs(prop, "rna_Main_libraries_is_updated_get", NULL); } void RNA_def_main_screens(BlenderRNA *brna, PropertyRNA *cprop) @@ -807,6 +875,7 @@ void RNA_def_main_screens(BlenderRNA *brna, PropertyRNA *cprop) StructRNA *srna; FunctionRNA *func; PropertyRNA *parm; + PropertyRNA *prop; RNA_def_property_srna(cprop, "BlendDataScreens"); srna= RNA_def_struct(brna, "BlendDataScreens", NULL); @@ -816,6 +885,10 @@ void RNA_def_main_screens(BlenderRNA *brna, PropertyRNA *cprop) func= RNA_def_function(srna, "tag", "rna_Main_screens_tag"); parm= RNA_def_boolean(func, "value", 0, "Value", ""); RNA_def_property_flag(parm, PROP_REQUIRED); + + prop= RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_boolean_funcs(prop, "rna_Main_screens_is_updated_get", NULL); } void RNA_def_main_window_managers(BlenderRNA *brna, PropertyRNA *cprop) @@ -823,6 +896,7 @@ void RNA_def_main_window_managers(BlenderRNA *brna, PropertyRNA *cprop) StructRNA *srna; FunctionRNA *func; PropertyRNA *parm; + PropertyRNA *prop; RNA_def_property_srna(cprop, "BlendDataWindowManagers"); srna= RNA_def_struct(brna, "BlendDataWindowManagers", NULL); @@ -832,12 +906,17 @@ void RNA_def_main_window_managers(BlenderRNA *brna, PropertyRNA *cprop) func= RNA_def_function(srna, "tag", "rna_Main_window_managers_tag"); parm= RNA_def_boolean(func, "value", 0, "Value", ""); RNA_def_property_flag(parm, PROP_REQUIRED); + + prop= RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_boolean_funcs(prop, "rna_Main_window_managers_is_updated_get", NULL); } void RNA_def_main_images(BlenderRNA *brna, PropertyRNA *cprop) { StructRNA *srna; FunctionRNA *func; PropertyRNA *parm; + PropertyRNA *prop; RNA_def_property_srna(cprop, "BlendDataImages"); srna= RNA_def_struct(brna, "BlendDataImages", NULL); @@ -876,6 +955,10 @@ void RNA_def_main_images(BlenderRNA *brna, PropertyRNA *cprop) func= RNA_def_function(srna, "tag", "rna_Main_images_tag"); parm= RNA_def_boolean(func, "value", 0, "Value", ""); RNA_def_property_flag(parm, PROP_REQUIRED); + + prop= RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_boolean_funcs(prop, "rna_Main_images_is_updated_get", NULL); } void RNA_def_main_lattices(BlenderRNA *brna, PropertyRNA *cprop) @@ -883,6 +966,7 @@ void RNA_def_main_lattices(BlenderRNA *brna, PropertyRNA *cprop) StructRNA *srna; FunctionRNA *func; PropertyRNA *parm; + PropertyRNA *prop; RNA_def_property_srna(cprop, "BlendDataLattices"); srna= RNA_def_struct(brna, "BlendDataLattices", NULL); @@ -906,12 +990,17 @@ void RNA_def_main_lattices(BlenderRNA *brna, PropertyRNA *cprop) func= RNA_def_function(srna, "tag", "rna_Main_lattices_tag"); parm= RNA_def_boolean(func, "value", 0, "Value", ""); RNA_def_property_flag(parm, PROP_REQUIRED); + + prop= RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_boolean_funcs(prop, "rna_Main_lattices_is_updated_get", NULL); } void RNA_def_main_curves(BlenderRNA *brna, PropertyRNA *cprop) { StructRNA *srna; FunctionRNA *func; PropertyRNA *parm; + PropertyRNA *prop; RNA_def_property_srna(cprop, "BlendDataCurves"); srna= RNA_def_struct(brna, "BlendDataCurves", NULL); @@ -937,12 +1026,17 @@ void RNA_def_main_curves(BlenderRNA *brna, PropertyRNA *cprop) func= RNA_def_function(srna, "tag", "rna_Main_curves_tag"); parm= RNA_def_boolean(func, "value", 0, "Value", ""); RNA_def_property_flag(parm, PROP_REQUIRED); + + prop= RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_boolean_funcs(prop, "rna_Main_curves_is_updated_get", NULL); } void RNA_def_main_metaballs(BlenderRNA *brna, PropertyRNA *cprop) { StructRNA *srna; FunctionRNA *func; PropertyRNA *parm; + PropertyRNA *prop; RNA_def_property_srna(cprop, "BlendDataMetaBalls"); srna= RNA_def_struct(brna, "BlendDataMetaBalls", NULL); @@ -966,12 +1060,17 @@ void RNA_def_main_metaballs(BlenderRNA *brna, PropertyRNA *cprop) func= RNA_def_function(srna, "tag", "rna_Main_metaballs_tag"); parm= RNA_def_boolean(func, "value", 0, "Value", ""); RNA_def_property_flag(parm, PROP_REQUIRED); + + prop= RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_boolean_funcs(prop, "rna_Main_metaballs_is_updated_get", NULL); } void RNA_def_main_fonts(BlenderRNA *brna, PropertyRNA *cprop) { StructRNA *srna; FunctionRNA *func; PropertyRNA *parm; + PropertyRNA *prop; RNA_def_property_srna(cprop, "BlendDataFonts"); srna= RNA_def_struct(brna, "BlendDataFonts", NULL); @@ -996,12 +1095,17 @@ void RNA_def_main_fonts(BlenderRNA *brna, PropertyRNA *cprop) func= RNA_def_function(srna, "tag", "rna_Main_fonts_tag"); parm= RNA_def_boolean(func, "value", 0, "Value", ""); RNA_def_property_flag(parm, PROP_REQUIRED); + + prop= RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_boolean_funcs(prop, "rna_Main_fonts_is_updated_get", NULL); } void RNA_def_main_textures(BlenderRNA *brna, PropertyRNA *cprop) { StructRNA *srna; FunctionRNA *func; PropertyRNA *parm; + PropertyRNA *prop; RNA_def_property_srna(cprop, "BlendDataTextures"); srna= RNA_def_struct(brna, "BlendDataTextures", NULL); @@ -1027,12 +1131,17 @@ void RNA_def_main_textures(BlenderRNA *brna, PropertyRNA *cprop) func= RNA_def_function(srna, "tag", "rna_Main_textures_tag"); parm= RNA_def_boolean(func, "value", 0, "Value", ""); RNA_def_property_flag(parm, PROP_REQUIRED); + + prop= RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_boolean_funcs(prop, "rna_Main_textures_is_updated_get", NULL); } void RNA_def_main_brushes(BlenderRNA *brna, PropertyRNA *cprop) { StructRNA *srna; FunctionRNA *func; PropertyRNA *parm; + PropertyRNA *prop; RNA_def_property_srna(cprop, "BlendDataBrushes"); srna= RNA_def_struct(brna, "BlendDataBrushes", NULL); @@ -1056,6 +1165,10 @@ void RNA_def_main_brushes(BlenderRNA *brna, PropertyRNA *cprop) func= RNA_def_function(srna, "tag", "rna_Main_brushes_tag"); parm= RNA_def_boolean(func, "value", 0, "Value", ""); RNA_def_property_flag(parm, PROP_REQUIRED); + + prop= RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_boolean_funcs(prop, "rna_Main_brushes_is_updated_get", NULL); } void RNA_def_main_worlds(BlenderRNA *brna, PropertyRNA *cprop) @@ -1063,6 +1176,7 @@ void RNA_def_main_worlds(BlenderRNA *brna, PropertyRNA *cprop) StructRNA *srna; FunctionRNA *func; PropertyRNA *parm; + PropertyRNA *prop; RNA_def_property_srna(cprop, "BlendDataWorlds"); srna= RNA_def_struct(brna, "BlendDataWorlds", NULL); @@ -1086,6 +1200,10 @@ void RNA_def_main_worlds(BlenderRNA *brna, PropertyRNA *cprop) func= RNA_def_function(srna, "tag", "rna_Main_worlds_tag"); parm= RNA_def_boolean(func, "value", 0, "Value", ""); RNA_def_property_flag(parm, PROP_REQUIRED); + + prop= RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_boolean_funcs(prop, "rna_Main_worlds_is_updated_get", NULL); } void RNA_def_main_groups(BlenderRNA *brna, PropertyRNA *cprop) @@ -1093,6 +1211,7 @@ void RNA_def_main_groups(BlenderRNA *brna, PropertyRNA *cprop) StructRNA *srna; FunctionRNA *func; PropertyRNA *parm; + PropertyRNA *prop; RNA_def_property_srna(cprop, "BlendDataGroups"); srna= RNA_def_struct(brna, "BlendDataGroups", NULL); @@ -1115,6 +1234,10 @@ void RNA_def_main_groups(BlenderRNA *brna, PropertyRNA *cprop) func= RNA_def_function(srna, "tag", "rna_Main_groups_tag"); parm= RNA_def_boolean(func, "value", 0, "Value", ""); RNA_def_property_flag(parm, PROP_REQUIRED); + + prop= RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_boolean_funcs(prop, "rna_Main_groups_is_updated_get", NULL); } void RNA_def_main_speakers(BlenderRNA *brna, PropertyRNA *cprop) @@ -1122,6 +1245,7 @@ void RNA_def_main_speakers(BlenderRNA *brna, PropertyRNA *cprop) StructRNA *srna; FunctionRNA *func; PropertyRNA *parm; + PropertyRNA *prop; RNA_def_property_srna(cprop, "BlendDataSpeakers"); srna= RNA_def_struct(brna, "BlendDataSpeakers", NULL); @@ -1145,6 +1269,10 @@ void RNA_def_main_speakers(BlenderRNA *brna, PropertyRNA *cprop) func= RNA_def_function(srna, "tag", "rna_Main_speakers_tag"); parm= RNA_def_boolean(func, "value", 0, "Value", ""); RNA_def_property_flag(parm, PROP_REQUIRED); + + prop= RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_boolean_funcs(prop, "rna_Main_speakers_is_updated_get", NULL); } void RNA_def_main_texts(BlenderRNA *brna, PropertyRNA *cprop) @@ -1152,6 +1280,7 @@ void RNA_def_main_texts(BlenderRNA *brna, PropertyRNA *cprop) StructRNA *srna; FunctionRNA *func; PropertyRNA *parm; + PropertyRNA *prop; RNA_def_property_srna(cprop, "BlendDataTexts"); srna= RNA_def_struct(brna, "BlendDataTexts", NULL); @@ -1184,6 +1313,10 @@ void RNA_def_main_texts(BlenderRNA *brna, PropertyRNA *cprop) func= RNA_def_function(srna, "tag", "rna_Main_texts_tag"); parm= RNA_def_boolean(func, "value", 0, "Value", ""); RNA_def_property_flag(parm, PROP_REQUIRED); + + prop= RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_boolean_funcs(prop, "rna_Main_texts_is_updated_get", NULL); } void RNA_def_main_sounds(BlenderRNA *brna, PropertyRNA *cprop) @@ -1191,6 +1324,7 @@ void RNA_def_main_sounds(BlenderRNA *brna, PropertyRNA *cprop) StructRNA *srna; FunctionRNA *func; PropertyRNA *parm; + PropertyRNA *prop; RNA_def_property_srna(cprop, "BlendDataSounds"); srna= RNA_def_struct(brna, "BlendDataSounds", NULL); @@ -1202,6 +1336,10 @@ void RNA_def_main_sounds(BlenderRNA *brna, PropertyRNA *cprop) func= RNA_def_function(srna, "tag", "rna_Main_sounds_tag"); parm= RNA_def_boolean(func, "value", 0, "Value", ""); RNA_def_property_flag(parm, PROP_REQUIRED); + + prop= RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_boolean_funcs(prop, "rna_Main_sounds_is_updated_get", NULL); } void RNA_def_main_armatures(BlenderRNA *brna, PropertyRNA *cprop) @@ -1209,6 +1347,7 @@ void RNA_def_main_armatures(BlenderRNA *brna, PropertyRNA *cprop) StructRNA *srna; FunctionRNA *func; PropertyRNA *parm; + PropertyRNA *prop; RNA_def_property_srna(cprop, "BlendDataArmatures"); srna= RNA_def_struct(brna, "BlendDataArmatures", NULL); @@ -1232,12 +1371,17 @@ void RNA_def_main_armatures(BlenderRNA *brna, PropertyRNA *cprop) func= RNA_def_function(srna, "tag", "rna_Main_armatures_tag"); parm= RNA_def_boolean(func, "value", 0, "Value", ""); RNA_def_property_flag(parm, PROP_REQUIRED); + + prop= RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_boolean_funcs(prop, "rna_Main_armatures_is_updated_get", NULL); } void RNA_def_main_actions(BlenderRNA *brna, PropertyRNA *cprop) { StructRNA *srna; FunctionRNA *func; PropertyRNA *parm; + PropertyRNA *prop; RNA_def_property_srna(cprop, "BlendDataActions"); srna= RNA_def_struct(brna, "BlendDataActions", NULL); @@ -1261,12 +1405,17 @@ void RNA_def_main_actions(BlenderRNA *brna, PropertyRNA *cprop) func= RNA_def_function(srna, "tag", "rna_Main_actions_tag"); parm= RNA_def_boolean(func, "value", 0, "Value", ""); RNA_def_property_flag(parm, PROP_REQUIRED); + + prop= RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_boolean_funcs(prop, "rna_Main_actions_is_updated_get", NULL); } void RNA_def_main_particles(BlenderRNA *brna, PropertyRNA *cprop) { StructRNA *srna; FunctionRNA *func; PropertyRNA *parm; + PropertyRNA *prop; RNA_def_property_srna(cprop, "BlendDataParticles"); srna= RNA_def_struct(brna, "BlendDataParticles", NULL); @@ -1290,6 +1439,10 @@ void RNA_def_main_particles(BlenderRNA *brna, PropertyRNA *cprop) func= RNA_def_function(srna, "tag", "rna_Main_particles_tag"); parm= RNA_def_boolean(func, "value", 0, "Value", ""); RNA_def_property_flag(parm, PROP_REQUIRED); + + prop= RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_boolean_funcs(prop, "rna_Main_particles_is_updated_get", NULL); } void RNA_def_main_gpencil(BlenderRNA *brna, PropertyRNA *cprop) @@ -1297,6 +1450,7 @@ void RNA_def_main_gpencil(BlenderRNA *brna, PropertyRNA *cprop) StructRNA *srna; FunctionRNA *func; PropertyRNA *parm; + PropertyRNA *prop; RNA_def_property_srna(cprop, "BlendDataGreasePencils"); srna= RNA_def_struct(brna, "BlendDataGreasePencils", NULL); @@ -1306,6 +1460,10 @@ void RNA_def_main_gpencil(BlenderRNA *brna, PropertyRNA *cprop) func= RNA_def_function(srna, "tag", "rna_Main_gpencil_tag"); parm= RNA_def_boolean(func, "value", 0, "Value", ""); RNA_def_property_flag(parm, PROP_REQUIRED); + + prop= RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_boolean_funcs(prop, "rna_Main_gpencil_is_updated_get", NULL); } #endif diff --git a/source/blender/makesrna/intern/rna_material.c b/source/blender/makesrna/intern/rna_material.c index 990d3b89bce..57770be57eb 100644 --- a/source/blender/makesrna/intern/rna_material.c +++ b/source/blender/makesrna/intern/rna_material.c @@ -269,13 +269,14 @@ static void rna_Material_use_specular_ramp_set(PointerRNA *ptr, int value) ma->ramp_spec= add_colorband(0); } -static void rna_Material_use_nodes_set(PointerRNA *ptr, int value) +static void rna_Material_use_nodes_update(Main *bmain, Scene *scene, PointerRNA *ptr) { Material *ma= (Material*)ptr->data; - ma->use_nodes= value; if(ma->use_nodes && ma->nodetree==NULL) - ED_node_shader_default(ma); + ED_node_shader_default(scene, &ma->id); + + rna_Material_update(bmain, scene, ptr); } static EnumPropertyItem *rna_Material_texture_coordinates_itemf(bContext *UNUSED(C), PointerRNA *ptr, @@ -1954,9 +1955,9 @@ void RNA_def_material(BlenderRNA *brna) prop= RNA_def_property(srna, "use_nodes", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "use_nodes", 1); - RNA_def_property_boolean_funcs(prop, NULL, "rna_Material_use_nodes_set"); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_ui_text(prop, "Use Nodes", "Use shader nodes to render the material"); - RNA_def_property_update(prop, 0, "rna_Material_update"); + RNA_def_property_update(prop, 0, "rna_Material_use_nodes_update"); prop= RNA_def_property(srna, "active_node_material", PROP_POINTER, PROP_NONE); RNA_def_property_struct_type(prop, "Material"); diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c index 96c23effdfb..1445cf3b537 100644 --- a/source/blender/makesrna/intern/rna_nodetree.c +++ b/source/blender/makesrna/intern/rna_nodetree.c @@ -56,7 +56,7 @@ #include "MEM_guardedalloc.h" EnumPropertyItem nodetree_type_items[] = { - {NTREE_SHADER, "MATERIAL", ICON_MATERIAL, "Material", "Material nodes" }, + {NTREE_SHADER, "SHADER", ICON_MATERIAL, "Shader", "Shader nodes" }, {NTREE_TEXTURE, "TEXTURE", ICON_TEXTURE, "Texture", "Texture nodes" }, {NTREE_COMPOSIT, "COMPOSITING", ICON_RENDERLAYERS, "Compositing", "Compositing nodes" }, {0, NULL, 0, NULL, NULL} @@ -189,7 +189,7 @@ static StructRNA *rna_NodeTree_refine(struct PointerRNA *ptr) case NTREE_TEXTURE: return &RNA_TextureNodeTree; default: - return &RNA_UnknownType; + return &RNA_NodeTree; } } @@ -232,6 +232,8 @@ static StructRNA *rna_NodeSocket_refine(PointerRNA *ptr) case SOCK_RGBA: return &RNA_NodeSocketRGBA; break; + case SOCK_SHADER: + return &RNA_NodeSocketShader; } #undef SUBTYPE @@ -2998,6 +3000,7 @@ void RNA_def_nodetree(BlenderRNA *brna) #undef SUBTYPE rna_def_node_socket_subtype(brna, SOCK_BOOLEAN, 0, "NodeSocketBoolean", "Boolean Node Socket"); rna_def_node_socket_subtype(brna, SOCK_RGBA, 0, "NodeSocketRGBA", "RGBA Node Socket"); + rna_def_node_socket_subtype(brna, SOCK_SHADER, 0, "NodeSocketShader", "Shader Closure Node Socket"); rna_def_node(brna); rna_def_node_link(brna); diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c index f0ba435954b..be2375f5716 100644 --- a/source/blender/makesrna/intern/rna_object.c +++ b/source/blender/makesrna/intern/rna_object.c @@ -286,6 +286,8 @@ static void rna_Object_layer_update__internal(Main *bmain, Scene *scene, Base *b else { DAG_scene_sort(bmain, scene); } + + DAG_id_type_tag(bmain, ID_OB); } static void rna_Object_layer_update(Main *bmain, Scene *scene, PointerRNA *ptr) @@ -899,11 +901,11 @@ static void rna_GameObjectSettings_physics_type_set(PointerRNA *ptr, int value) break; case OB_BODY_TYPE_OCCLUDER: ob->gameflag |= OB_OCCLUDER; - ob->gameflag &= ~(OB_SENSOR|OB_COLLISION|OB_DYNAMIC|OB_NAVMESH); + ob->gameflag &= ~(OB_SENSOR|OB_RIGID_BODY|OB_SOFT_BODY|OB_COLLISION|OB_DYNAMIC|OB_NAVMESH); break; case OB_BODY_TYPE_NAVMESH: ob->gameflag |= OB_NAVMESH; - ob->gameflag &= ~(OB_SENSOR|OB_COLLISION|OB_DYNAMIC|OB_OCCLUDER); + ob->gameflag &= ~(OB_SENSOR|OB_RIGID_BODY|OB_SOFT_BODY|OB_COLLISION|OB_DYNAMIC|OB_OCCLUDER); if (ob->type == OB_MESH) { /* could be moved into mesh UI but for now ensure mesh data layer */ @@ -912,7 +914,7 @@ static void rna_GameObjectSettings_physics_type_set(PointerRNA *ptr, int value) break; case OB_BODY_TYPE_NO_COLLISION: - ob->gameflag &= ~(OB_SENSOR|OB_COLLISION|OB_OCCLUDER|OB_DYNAMIC|OB_NAVMESH); + ob->gameflag &= ~(OB_SENSOR|OB_RIGID_BODY|OB_SOFT_BODY|OB_COLLISION|OB_OCCLUDER|OB_DYNAMIC|OB_NAVMESH); break; case OB_BODY_TYPE_STATIC: ob->gameflag |= OB_COLLISION; @@ -946,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) @@ -1530,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"); @@ -1793,7 +1796,6 @@ static void rna_def_object(BlenderRNA *brna) {OB_BOUNDBOX, "BOUNDS", 0, "Bounds", "Draw the bounding box of the object"}, {OB_WIRE, "WIRE", 0, "Wire", "Draw the object as a wireframe"}, {OB_SOLID, "SOLID", 0, "Solid", "Draw the object as a solid (if solid drawing is enabled in the viewport)"}, - // disabled {OB_SHADED, "SHADED", 0, "Shaded", ""}, {OB_TEXTURE, "TEXTURED", 0, "Textured", "Draw the object with textures (if textures are enabled in the viewport)"}, {0, NULL, 0, NULL, NULL}}; @@ -1802,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[] = { @@ -2225,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_render.c b/source/blender/makesrna/intern/rna_render.c index 1498d161209..530d162b1fe 100644 --- a/source/blender/makesrna/intern/rna_render.c +++ b/source/blender/makesrna/intern/rna_render.c @@ -48,12 +48,39 @@ #include "BKE_context.h" #include "BKE_report.h" -/* RenderEngine */ +/* RenderEngine Callbacks */ + +void engine_tag_redraw(RenderEngine *engine) +{ + engine->flag |= RE_ENGINE_DO_DRAW; +} + +void engine_tag_update(RenderEngine *engine) +{ + engine->flag |= RE_ENGINE_DO_UPDATE; +} + +static void engine_update(RenderEngine *engine, Main *bmain, Scene *scene) +{ + extern FunctionRNA rna_RenderEngine_update_func; + PointerRNA ptr; + ParameterList list; + FunctionRNA *func; + + RNA_pointer_create(NULL, engine->type->ext.srna, engine, &ptr); + func= &rna_RenderEngine_update_func; + + RNA_parameter_list_create(&list, &ptr, func); + RNA_parameter_set_lookup(&list, "data", &bmain); + RNA_parameter_set_lookup(&list, "scene", &scene); + engine->type->ext.call(NULL, &ptr, func, &list); + + RNA_parameter_list_free(&list); +} static void engine_render(RenderEngine *engine, struct Scene *scene) { extern FunctionRNA rna_RenderEngine_render_func; - PointerRNA ptr; ParameterList list; FunctionRNA *func; @@ -68,6 +95,40 @@ static void engine_render(RenderEngine *engine, struct Scene *scene) RNA_parameter_list_free(&list); } +static void engine_view_update(RenderEngine *engine, const struct bContext *context) +{ + extern FunctionRNA rna_RenderEngine_view_update_func; + PointerRNA ptr; + ParameterList list; + FunctionRNA *func; + + RNA_pointer_create(NULL, engine->type->ext.srna, engine, &ptr); + func= &rna_RenderEngine_view_update_func; + + RNA_parameter_list_create(&list, &ptr, func); + RNA_parameter_set_lookup(&list, "context", &context); + engine->type->ext.call(NULL, &ptr, func, &list); + + RNA_parameter_list_free(&list); +} + +static void engine_view_draw(RenderEngine *engine, const struct bContext *context) +{ + extern FunctionRNA rna_RenderEngine_view_draw_func; + PointerRNA ptr; + ParameterList list; + FunctionRNA *func; + + RNA_pointer_create(NULL, engine->type->ext.srna, engine, &ptr); + func= &rna_RenderEngine_view_draw_func; + + RNA_parameter_list_create(&list, &ptr, func); + RNA_parameter_set_lookup(&list, "context", &context); + engine->type->ext.call(NULL, &ptr, func, &list); + + RNA_parameter_list_free(&list); +} + /* RenderEngine registration */ static void rna_RenderEngine_unregister(Main *UNUSED(bmain), StructRNA *type) @@ -87,7 +148,7 @@ static StructRNA *rna_RenderEngine_register(Main *bmain, ReportList *reports, vo RenderEngineType *et, dummyet = {NULL}; RenderEngine dummyengine= {NULL}; PointerRNA dummyptr; - int have_function[1]; + int have_function[4]; /* setup dummy engine & engine type to store static properties in */ dummyengine.type= &dummyet; @@ -122,13 +183,22 @@ static StructRNA *rna_RenderEngine_register(Main *bmain, ReportList *reports, vo et->ext.free= free; RNA_struct_blender_type_set(et->ext.srna, et); - et->render= (have_function[0])? engine_render: NULL; + et->update= (have_function[0])? engine_update: NULL; + et->render= (have_function[1])? engine_render: NULL; + et->view_update= (have_function[2])? engine_view_update: NULL; + et->view_draw= (have_function[3])? engine_view_draw: NULL; BLI_addtail(&R_engines, et); return et->ext.srna; } +static void **rna_RenderEngine_instance(PointerRNA *ptr) +{ + RenderEngine *engine = ptr->data; + return &engine->py_instance; +} + static StructRNA* rna_RenderEngine_refine(PointerRNA *ptr) { RenderEngine *engine= (RenderEngine*)ptr->data; @@ -203,14 +273,39 @@ static void rna_def_render_engine(BlenderRNA *brna) RNA_def_struct_sdna(srna, "RenderEngine"); RNA_def_struct_ui_text(srna, "Render Engine", "Render engine"); RNA_def_struct_refine_func(srna, "rna_RenderEngine_refine"); - RNA_def_struct_register_funcs(srna, "rna_RenderEngine_register", "rna_RenderEngine_unregister", NULL); + RNA_def_struct_register_funcs(srna, "rna_RenderEngine_register", "rna_RenderEngine_unregister", "rna_RenderEngine_instance"); + + /* final render callbacks */ + func= RNA_def_function(srna, "update", NULL); + RNA_def_function_ui_description(func, "Export scene data for render"); + RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL); + RNA_def_pointer(func, "data", "BlendData", "", ""); + RNA_def_pointer(func, "scene", "Scene", "", ""); - /* render */ func= RNA_def_function(srna, "render", NULL); RNA_def_function_ui_description(func, "Render scene into an image"); - RNA_def_function_flag(func, FUNC_REGISTER); + RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL); RNA_def_pointer(func, "scene", "Scene", "", ""); + /* viewport render callbacks */ + func= RNA_def_function(srna, "view_update", NULL); + RNA_def_function_ui_description(func, "Update on data changes for viewport render"); + RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL); + RNA_def_pointer(func, "context", "Context", "", ""); + + func= RNA_def_function(srna, "view_draw", NULL); + RNA_def_function_ui_description(func, "Draw viewport render"); + RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL); + RNA_def_pointer(func, "context", "Context", "", ""); + + /* tag for redraw */ + RNA_def_function(srna, "tag_redraw", "engine_tag_redraw"); + RNA_def_function_ui_description(func, "Request redraw for viewport rendering"); + + /* tag for update */ + RNA_def_function(srna, "tag_update", "engine_tag_update"); + RNA_def_function_ui_description(func, "Request update call for viewport rendering"); + func= RNA_def_function(srna, "begin_result", "RE_engine_begin_result"); prop= RNA_def_int(func, "x", 0, 0, INT_MAX, "X", "", 0, INT_MAX); RNA_def_property_flag(prop, PROP_REQUIRED); @@ -251,9 +346,16 @@ static void rna_def_render_engine(BlenderRNA *brna) prop= RNA_def_string(func, "message", "", 0, "Report Message", ""); RNA_def_property_flag(prop, PROP_REQUIRED); - /* registration */ RNA_define_verify_sdna(0); + prop= RNA_def_property(srna, "is_animation", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", RE_ENGINE_ANIMATION); + + prop= RNA_def_property(srna, "is_preview", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", RE_ENGINE_PREVIEW); + + /* registration */ + prop= RNA_def_property(srna, "bl_idname", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "type->idname"); RNA_def_property_flag(prop, PROP_REGISTER|PROP_NEVER_CLAMP); @@ -270,6 +372,10 @@ static void rna_def_render_engine(BlenderRNA *brna) RNA_def_property_boolean_negative_sdna(prop, NULL, "type->flag", RE_USE_POSTPROCESS); RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL); + prop= RNA_def_property(srna, "bl_use_shading_nodes", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "type->flag", RE_USE_SHADING_NODES); + RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL); + RNA_define_verify_sdna(1); } diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index 7bdaa0a512f..63fce2d9edb 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -40,6 +40,7 @@ #include "BLI_math.h" /* Include for Bake Options */ +#include "RE_engine.h" #include "RE_pipeline.h" #ifdef WITH_QUICKTIME @@ -55,6 +56,8 @@ #include <libavformat/avformat.h> #endif +#include "ED_render.h" + #include "WM_api.h" #include "WM_types.h" @@ -773,6 +776,11 @@ static int rna_RenderSettings_engine_get(PointerRNA *ptr) return 0; } +static void rna_RenderSettings_engine_update(Main *bmain, Scene *UNUSED(unused), PointerRNA *UNUSED(ptr)) +{ + ED_render_engine_changed(bmain); +} + static void rna_Scene_glsl_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) { Scene *scene= (Scene*)ptr->id.data; @@ -830,6 +838,12 @@ static int rna_RenderSettings_multiple_engines_get(PointerRNA *UNUSED(ptr)) return (BLI_countlist(&R_engines) > 1); } +static int rna_RenderSettings_use_shading_nodes_get(PointerRNA *ptr) +{ + Scene *scene= (Scene*)ptr->id.data; + return scene_use_new_shading_nodes(scene); +} + static int rna_RenderSettings_use_game_engine_get(PointerRNA *ptr) { RenderData *rd= (RenderData*)ptr->data; @@ -3212,13 +3226,18 @@ static void rna_def_scene_render_data(BlenderRNA *brna) RNA_def_property_enum_funcs(prop, "rna_RenderSettings_engine_get", "rna_RenderSettings_engine_set", "rna_RenderSettings_engine_itemf"); RNA_def_property_ui_text(prop, "Engine", "Engine to use for rendering"); - RNA_def_property_update(prop, NC_WINDOW, NULL); + RNA_def_property_update(prop, NC_WINDOW, "rna_RenderSettings_engine_update"); prop= RNA_def_property(srna, "has_multiple_engines", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_funcs(prop, "rna_RenderSettings_multiple_engines_get", NULL); RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_ui_text(prop, "Multiple Engines", "More than one rendering engine is available"); + prop= RNA_def_property(srna, "use_shading_nodes", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_funcs(prop, "rna_RenderSettings_use_shading_nodes_get", NULL); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Use Shading Nodes", "Active render engine uses new shading nodes system"); + prop= RNA_def_property(srna, "use_game_engine", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_funcs(prop, "rna_RenderSettings_use_game_engine_get", NULL); RNA_def_property_clear_flag(prop, PROP_EDITABLE); diff --git a/source/blender/makesrna/intern/rna_scene_api.c b/source/blender/makesrna/intern/rna_scene_api.c index 345ebb2cd80..250c61ed5f4 100644 --- a/source/blender/makesrna/intern/rna_scene_api.c +++ b/source/blender/makesrna/intern/rna_scene_api.c @@ -69,6 +69,7 @@ static void rna_Scene_frame_set(Scene *scene, int frame, float subframe) static void rna_Scene_update_tagged(Scene *scene) { scene_update_tagged(G.main, scene); + scene_clear_tagged(G.main, scene); } static void rna_SceneRender_get_frame_path(RenderData *rd, int frame, char *name) 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); diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index 33dcc2eb0b9..2aa99b5941a 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -47,6 +47,9 @@ #include "WM_api.h" #include "WM_types.h" +#include "RE_engine.h" +#include "RE_pipeline.h" + #include "RNA_enum_types.h" EnumPropertyItem space_type_items[] = { @@ -60,11 +63,8 @@ EnumPropertyItem space_type_items[] = { {SPACE_INFO, "INFO", 0, "Info", ""}, {SPACE_SEQ, "SEQUENCE_EDITOR", 0, "Sequence Editor", ""}, {SPACE_TEXT, "TEXT_EDITOR", 0, "Text Editor", ""}, - //{SPACE_IMASEL, "IMAGE_BROWSER", 0, "Image Browser", ""}, - {SPACE_SOUND, "AUDIO_WINDOW", 0, "Audio Window", ""}, {SPACE_ACTION, "DOPESHEET_EDITOR", 0, "DopeSheet Editor", ""}, {SPACE_NLA, "NLA_EDITOR", 0, "NLA Editor", ""}, - {SPACE_SCRIPT, "SCRIPTS_WINDOW", 0, "Scripts Window", ""}, {SPACE_TIME, "TIMELINE", 0, "Timeline", ""}, {SPACE_NODE, "NODE_EDITOR", 0, "Node Editor", ""}, {SPACE_LOGIC, "LOGIC_EDITOR", 0, "Logic Editor", ""}, @@ -101,8 +101,8 @@ EnumPropertyItem viewport_shade_items[] = { {OB_BOUNDBOX, "BOUNDBOX", ICON_BBOX, "Bounding Box", "Display the object's local bounding boxes only"}, {OB_WIRE, "WIREFRAME", ICON_WIRE, "Wireframe", "Display the object as wire edges"}, {OB_SOLID, "SOLID", ICON_SOLID, "Solid", "Display the object solid, lit with default OpenGL lights"}, - //{OB_SHADED, "SHADED", ICON_SMOOTH, "Shaded", "Display the object solid, with preview shading interpolated at vertices"}, {OB_TEXTURE, "TEXTURED", ICON_POTATO, "Textured", "Display the object solid, with face-assigned textures"}, + {OB_RENDER, "RENDERED", ICON_SMOOTH, "Rendered", "Display render preview"}, {0, NULL, 0, NULL, NULL}}; #ifdef RNA_RUNTIME @@ -152,16 +152,10 @@ static StructRNA* rna_Space_refine(struct PointerRNA *ptr) return &RNA_SpaceSequenceEditor; case SPACE_TEXT: return &RNA_SpaceTextEditor; - //case SPACE_IMASEL: - // return &RNA_SpaceImageBrowser; - /*case SPACE_SOUND: - return &RNA_SpaceAudioWindow;*/ case SPACE_ACTION: return &RNA_SpaceDopeSheetEditor; case SPACE_NLA: return &RNA_SpaceNLA; - /*case SPACE_SCRIPT: - return &RNA_SpaceScriptsWindow;*/ case SPACE_TIME: return &RNA_SpaceTimeline; case SPACE_NODE: @@ -322,6 +316,25 @@ static void rna_SpaceView3D_layer_update(Main *bmain, Scene *UNUSED(scene), Poin DAG_on_visible_update(bmain, FALSE); } +static void rna_SpaceView3D_viewport_shade_update(Main *bmain, Scene *scene, PointerRNA *ptr) +{ + View3D *v3d= (View3D*)(ptr->data); + ScrArea *sa= rna_area_from_space(ptr); + + if(v3d->drawtype != OB_RENDER) { + ARegion *ar; + + for(ar=sa->regionbase.first; ar; ar=ar->next) { + RegionView3D *rv3d = ar->regiondata; + + if(rv3d && rv3d->render_engine) { + RE_engine_free(rv3d->render_engine); + rv3d->render_engine= NULL; + } + } + } +} + static void rna_SpaceView3D_pivot_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr) { if (U.uiflag & USER_LOCKAROUND) { @@ -432,6 +445,29 @@ static void rna_RegionView3D_view_matrix_set(PointerRNA *ptr, const float *value ED_view3d_from_m4((float (*)[4])values, rv3d->ofs, rv3d->viewquat, &rv3d->dist); } +static EnumPropertyItem *rna_SpaceView3D_viewport_shade_itemf(bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *free) +{ + Scene *scene = ((bScreen*)ptr->id.data)->scene; + RenderEngineType *type = RE_engines_find(scene->r.engine); + + EnumPropertyItem *item= NULL; + int totitem= 0; + + RNA_enum_items_add_value(&item, &totitem, viewport_shade_items, OB_BOUNDBOX); + RNA_enum_items_add_value(&item, &totitem, viewport_shade_items, OB_WIRE); + RNA_enum_items_add_value(&item, &totitem, viewport_shade_items, OB_SOLID); + RNA_enum_items_add_value(&item, &totitem, viewport_shade_items, OB_TEXTURE); + + if(type->view_draw) { + RNA_enum_items_add_value(&item, &totitem, viewport_shade_items, OB_RENDER); + } + + RNA_enum_item_end(&item, &totitem); + *free= 1; + + return item; +} + /* Space Image Editor */ static PointerRNA rna_SpaceImageEditor_uvedit_get(PointerRNA *ptr) @@ -1236,8 +1272,9 @@ static void rna_def_space_view3d(BlenderRNA *brna) prop= RNA_def_property(srna, "viewport_shade", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "drawtype"); RNA_def_property_enum_items(prop, viewport_shade_items); + RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_SpaceView3D_viewport_shade_itemf"); RNA_def_property_ui_text(prop, "Viewport Shading", "Method to display/shade objects in the 3D View"); - RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL); + RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, "rna_SpaceView3D_viewport_shade_update"); prop= RNA_def_property(srna, "local_view", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "localvd"); @@ -2473,6 +2510,11 @@ static void rna_def_space_node(BlenderRNA *brna) {SNODE_TEX_BRUSH, "BRUSH", ICON_BRUSH_DATA, "Brush", "Edit texture nodes from Brush"}, {0, NULL, 0, NULL, NULL}}; + static EnumPropertyItem shader_type_items[] = { + {SNODE_SHADER_OBJECT, "OBJECT", ICON_OBJECT_DATA, "Object", "Edit shader nodes from Object"}, + {SNODE_SHADER_WORLD, "WORLD", ICON_WORLD_DATA, "World", "Edit shader nodes from World"}, + {0, NULL, 0, NULL, NULL}}; + static EnumPropertyItem backdrop_channels_items[] = { {0, "COLOR", ICON_IMAGE_RGB, "Color", "Draw image with RGB colors"}, {SNODE_USE_ALPHA, "COLOR_ALPHA", ICON_IMAGE_RGB_ALPHA, "Color and Alpha", @@ -2496,6 +2538,12 @@ static void rna_def_space_node(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Texture Type", "Type of data to take texture from"); RNA_def_property_update(prop, NC_SPACE|ND_SPACE_NODE, NULL); + prop= RNA_def_property(srna, "shader_type", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "shaderfrom"); + RNA_def_property_enum_items(prop, shader_type_items); + RNA_def_property_ui_text(prop, "Shader Type", "Type of data to take shader from"); + RNA_def_property_update(prop, NC_SPACE|ND_SPACE_NODE, NULL); + prop= RNA_def_property(srna, "id", PROP_POINTER, PROP_NONE); RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_ui_text(prop, "ID", "Datablock whose nodes are being edited"); diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c index 898ee2b2623..fc9c8a241c6 100644 --- a/source/blender/makesrna/intern/rna_userdef.c +++ b/source/blender/makesrna/intern/rna_userdef.c @@ -1392,7 +1392,7 @@ static void rna_def_userdef_theme_space_logic(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - /* space_buts */ + /* space_logic */ srna= RNA_def_struct(brna, "ThemeLogicEditor", NULL); RNA_def_struct_sdna(srna, "ThemeSpace"); @@ -1451,37 +1451,6 @@ static void rna_def_userdef_theme_space_time(BlenderRNA *brna) RNA_def_property_update(prop, 0, "rna_userdef_update"); } -static void rna_def_userdef_theme_space_sound(BlenderRNA *brna) -{ - StructRNA *srna; - PropertyRNA *prop; - - /* space_sound */ - - srna= RNA_def_struct(brna, "ThemeAudioWindow", NULL); - RNA_def_struct_sdna(srna, "ThemeSpace"); - RNA_def_struct_ui_text(srna, "Theme Audio Window", "Theme settings for the Audio Window"); - - rna_def_userdef_theme_spaces_main(srna, SPACE_SOUND); - - prop= RNA_def_property(srna, "grid", PROP_FLOAT, PROP_COLOR_GAMMA); - RNA_def_property_array(prop, 3); - RNA_def_property_ui_text(prop, "Grid", ""); - RNA_def_property_update(prop, 0, "rna_userdef_update"); - - prop= RNA_def_property(srna, "window_sliders", PROP_FLOAT, PROP_COLOR_GAMMA); - RNA_def_property_float_sdna(prop, NULL, "shade1"); - RNA_def_property_array(prop, 3); - RNA_def_property_ui_text(prop, "Window Sliders", ""); - RNA_def_property_update(prop, 0, "rna_userdef_update"); - - prop= RNA_def_property(srna, "frame_current", PROP_FLOAT, PROP_COLOR_GAMMA); - RNA_def_property_float_sdna(prop, NULL, "cframe"); - RNA_def_property_array(prop, 3); - RNA_def_property_ui_text(prop, "Current Frame", ""); - RNA_def_property_update(prop, 0, "rna_userdef_update"); -} - static void rna_def_userdef_theme_space_image(BlenderRNA *brna) { StructRNA *srna; @@ -1956,7 +1925,6 @@ static void rna_def_userdef_dothemes(BlenderRNA *brna) rna_def_userdef_theme_space_info(brna); rna_def_userdef_theme_space_userpref(brna); rna_def_userdef_theme_space_console(brna); - rna_def_userdef_theme_space_sound(brna); rna_def_userdef_theme_space_logic(brna); rna_def_userdef_theme_colorset(brna); rna_def_userdef_themes(brna); diff --git a/source/blender/makesrna/intern/rna_world.c b/source/blender/makesrna/intern/rna_world.c index 22570460093..d421aff7157 100644 --- a/source/blender/makesrna/intern/rna_world.c +++ b/source/blender/makesrna/intern/rna_world.c @@ -46,6 +46,8 @@ #include "BKE_main.h" #include "BKE_texture.h" +#include "ED_node.h" + #include "WM_api.h" static PointerRNA rna_World_lighting_get(PointerRNA *ptr) @@ -119,6 +121,15 @@ static void rna_World_stars_update(Main *UNUSED(bmain), Scene *UNUSED(scene), Po WM_main_add_notifier(NC_WORLD|ND_WORLD_STARS, wo); } +static void rna_World_use_nodes_update(Main *bmain, Scene *scene, PointerRNA *ptr) +{ + World *wrld= (World*)ptr->data; + + if(wrld->use_nodes && wrld->nodetree==NULL) + ED_node_shader_default(scene, &wrld->id); + + rna_World_update(bmain, scene, ptr); +} #else @@ -161,11 +172,6 @@ static void rna_def_world_mtex(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Zenith Down", "Affect the color of the zenith below"); RNA_def_property_update(prop, 0, "rna_World_update"); - /* unused - prop= RNA_def_property(srna, "map_mist", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "mapto", WOMAP_MIST); - RNA_def_property_ui_text(prop, "Mist", "Causes the texture to affect the intensity of the mist");*/ - prop= RNA_def_property(srna, "texture_coords", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "texco"); RNA_def_property_enum_items(prop, texco_items); @@ -393,7 +399,7 @@ static void rna_def_world_mist(BlenderRNA *brna) prop= RNA_def_property(srna, "intensity", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "misi"); RNA_def_property_range(prop, 0, 1); - RNA_def_property_ui_text(prop, "Intensity", "Intensity of the mist effect"); + RNA_def_property_ui_text(prop, "Minimum", "Overall minimum intensity of the mist effect"); RNA_def_property_update(prop, 0, "rna_World_update"); prop= RNA_def_property(srna, "start", PROP_FLOAT, PROP_DISTANCE); @@ -461,13 +467,6 @@ static void rna_def_world_stars(BlenderRNA *brna) RNA_def_property_range(prop, 0, 1); RNA_def_property_ui_text(prop, "Color Randomization", "Randomize star colors"); RNA_def_property_update(prop, 0, "rna_World_stars_update"); - - /* unused - prop= RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR); - RNA_def_property_float_sdna(prop, NULL, "starr"); - RNA_def_property_array(prop, 3); - RNA_def_property_ui_text(prop, "Color", "Stars color"); - RNA_def_property_update(prop, 0, "rna_World_update");*/ } void RNA_def_world(BlenderRNA *brna) @@ -564,6 +563,17 @@ void RNA_def_world(BlenderRNA *brna) RNA_def_property_pointer_funcs(prop, "rna_World_stars_get", NULL, NULL, NULL); RNA_def_property_ui_text(prop, "Stars", "World stars settings"); + /* nodes */ + prop= RNA_def_property(srna, "node_tree", PROP_POINTER, PROP_NONE); + RNA_def_property_pointer_sdna(prop, NULL, "nodetree"); + RNA_def_property_ui_text(prop, "Node Tree", "Node tree for node based worlds"); + + prop= RNA_def_property(srna, "use_nodes", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "use_nodes", 1); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); + RNA_def_property_ui_text(prop, "Use Nodes", "Use shader nodes to render the world"); + RNA_def_property_update(prop, 0, "rna_World_use_nodes_update"); + rna_def_lighting(brna); rna_def_world_mist(brna); rna_def_world_stars(brna); |