diff options
Diffstat (limited to 'source/blender/makesrna/intern')
59 files changed, 4776 insertions, 392 deletions
diff --git a/source/blender/makesrna/intern/CMakeLists.txt b/source/blender/makesrna/intern/CMakeLists.txt index ec82fcafe76..cd3f63f317c 100644 --- a/source/blender/makesrna/intern/CMakeLists.txt +++ b/source/blender/makesrna/intern/CMakeLists.txt @@ -38,6 +38,7 @@ set(DEFSRC rna_armature.c rna_boid.c rna_brush.c + rna_cache_library.c rna_camera.c rna_cloth.c rna_color.c @@ -45,6 +46,7 @@ set(DEFSRC rna_context.c rna_controller.c rna_curve.c + rna_depsgraph.c rna_dynamicpaint.c rna_fcurve.c rna_fluidsim.c @@ -59,6 +61,7 @@ set(DEFSRC rna_mask.c rna_material.c rna_mesh.c + rna_mesh_sample.c rna_meta.c rna_modifier.c rna_movieclip.c @@ -67,6 +70,7 @@ set(DEFSRC rna_object.c rna_object_force.c rna_packedfile.c + rna_palette.c rna_particle.c rna_pose.c rna_property.c @@ -82,6 +86,7 @@ set(DEFSRC rna_sound.c rna_space.c rna_speaker.c + rna_strands.c rna_test.c rna_text.c rna_texture.c @@ -124,6 +129,9 @@ set(APISRC ) string(REGEX REPLACE "rna_([a-zA-Z0-9_-]*).c" "${CMAKE_CURRENT_BINARY_DIR}/rna_\\1_gen.c" GENSRC "${DEFSRC}") +list(APPEND GENSRC + "${CMAKE_CURRENT_BINARY_DIR}/rna_prototypes_gen.h" +) set_source_files_properties(${GENSRC} PROPERTIES GENERATED TRUE) # -------------------------- @@ -303,6 +311,7 @@ blender_include_dirs( ../../blenlib ../../bmesh ../../blenfont + ../../depsgraph ../../gpu ../../imbuf ../../ikplugin diff --git a/source/blender/makesrna/intern/SConscript b/source/blender/makesrna/intern/SConscript index 3d190fc6a13..afa4ab3a67d 100644 --- a/source/blender/makesrna/intern/SConscript +++ b/source/blender/makesrna/intern/SConscript @@ -66,6 +66,7 @@ incs = [ '../../blenkernel', '../../blenlib', '../../bmesh', + '../../depsgraph', '../../editors/include', '../../gpu', '../../ikplugin', diff --git a/source/blender/makesrna/intern/makesrna.c b/source/blender/makesrna/intern/makesrna.c index 14c39862467..0c2082c9597 100644 --- a/source/blender/makesrna/intern/makesrna.c +++ b/source/blender/makesrna/intern/makesrna.c @@ -936,7 +936,7 @@ static char *rna_def_property_set_func(FILE *f, StructRNA *srna, PropertyRNA *pr if (dp->dnaarraylength == 1) { if (prop->type == PROP_BOOLEAN && dp->booleanbit) { - fprintf(f, " if (%svalues[i]) data->%s |= (%d<<i);\n", + fprintf(f, " if (%svalues[i]) data->%s |= (%du << i);\n", (dp->booleannegative) ? "!" : "", dp->dnaname, dp->booleanbit); fprintf(f, " else data->%s &= ~(%du << i);\n", dp->dnaname, dp->booleanbit); } @@ -2027,7 +2027,8 @@ static void rna_def_struct_function_call_impl_cpp(FILE *f, StructRNA *srna, Func if ((func->flag & FUNC_NO_SELF) == 0) { WRITE_COMMA; - if (dsrna->dnaname) fprintf(f, "(::%s *) this->ptr.data", dsrna->dnaname); + if (dsrna->dnafromprop) fprintf(f, "(::%s *) this->ptr.data", dsrna->dnafromname); + else if (dsrna->dnaname) fprintf(f, "(::%s *) this->ptr.data", dsrna->dnaname); else fprintf(f, "(::%s *) this->ptr.data", srna->identifier); } else if (func->flag & FUNC_USE_SELF_TYPE) { @@ -2222,7 +2223,8 @@ static void rna_def_function_funcs(FILE *f, StructDefRNA *dsrna, FunctionDefRNA } if ((func->flag & FUNC_NO_SELF) == 0) { - if (dsrna->dnaname) fprintf(f, "\tstruct %s *_self;\n", dsrna->dnaname); + if (dsrna->dnafromprop) fprintf(f, "\tstruct %s *_self;\n", dsrna->dnafromname); + else if (dsrna->dnaname) fprintf(f, "\tstruct %s *_self;\n", dsrna->dnaname); else fprintf(f, "\tstruct %s *_self;\n", srna->identifier); } else if (func->flag & FUNC_USE_SELF_TYPE) { @@ -2274,7 +2276,8 @@ static void rna_def_function_funcs(FILE *f, StructDefRNA *dsrna, FunctionDefRNA } if ((func->flag & FUNC_NO_SELF) == 0) { - if (dsrna->dnaname) fprintf(f, "\t_self = (struct %s *)_ptr->data;\n", dsrna->dnaname); + if (dsrna->dnafromprop) fprintf(f, "\t_self = (struct %s *)_ptr->data;\n", dsrna->dnafromname); + else if (dsrna->dnaname) fprintf(f, "\t_self = (struct %s *)_ptr->data;\n", dsrna->dnaname); else fprintf(f, "\t_self = (struct %s *)_ptr->data;\n", srna->identifier); } else if (func->flag & FUNC_USE_SELF_TYPE) { @@ -2675,7 +2678,8 @@ static void rna_generate_static_parameter_prototypes(FILE *f, StructRNA *srna, F if ((func->flag & FUNC_NO_SELF) == 0) { if (!first) fprintf(f, ", "); - if (dsrna->dnaname) fprintf(f, "struct %s *_self", dsrna->dnaname); + if (dsrna->dnafromprop) fprintf(f, "struct %s *_self", dsrna->dnafromname); + else if (dsrna->dnaname) fprintf(f, "struct %s *_self", dsrna->dnaname); else fprintf(f, "struct %s *_self", srna->identifier); first = 0; } @@ -3283,12 +3287,14 @@ static RNAProcessItem PROCESS_ITEMS[] = { {"rna_boid.c", NULL, RNA_def_boid}, {"rna_brush.c", NULL, RNA_def_brush}, {"rna_camera.c", "rna_camera_api.c", RNA_def_camera}, + {"rna_cache_library.c", NULL, RNA_def_cache_library}, {"rna_cloth.c", NULL, RNA_def_cloth}, {"rna_color.c", NULL, RNA_def_color}, {"rna_constraint.c", NULL, RNA_def_constraint}, {"rna_context.c", NULL, RNA_def_context}, {"rna_controller.c", "rna_controller_api.c", RNA_def_controller}, {"rna_curve.c", "rna_curve_api.c", RNA_def_curve}, + {"rna_depsgraph.c", NULL, RNA_def_depsgraph}, {"rna_dynamicpaint.c", NULL, RNA_def_dynamic_paint}, {"rna_fcurve.c", "rna_fcurve_api.c", RNA_def_fcurve}, {"rna_fluidsim.c", NULL, RNA_def_fluidsim}, @@ -3302,6 +3308,7 @@ static RNAProcessItem PROCESS_ITEMS[] = { {"rna_main.c", "rna_main_api.c", RNA_def_main}, {"rna_material.c", "rna_material_api.c", RNA_def_material}, {"rna_mesh.c", "rna_mesh_api.c", RNA_def_mesh}, + {"rna_mesh_sample.c", NULL, RNA_def_mesh_sample}, {"rna_meta.c", "rna_meta_api.c", RNA_def_meta}, {"rna_modifier.c", NULL, RNA_def_modifier}, {"rna_nla.c", NULL, RNA_def_nla}, @@ -3309,6 +3316,7 @@ static RNAProcessItem PROCESS_ITEMS[] = { {"rna_object.c", "rna_object_api.c", RNA_def_object}, {"rna_object_force.c", NULL, RNA_def_object_force}, {"rna_packedfile.c", NULL, RNA_def_packedfile}, + {"rna_palette.c", NULL, RNA_def_palette}, {"rna_particle.c", NULL, RNA_def_particle}, {"rna_pose.c", "rna_pose_api.c", RNA_def_pose}, {"rna_property.c", NULL, RNA_def_gameproperty}, @@ -3322,6 +3330,7 @@ static RNAProcessItem PROCESS_ITEMS[] = { {"rna_smoke.c", NULL, RNA_def_smoke}, {"rna_space.c", "rna_space_api.c", RNA_def_space}, {"rna_speaker.c", NULL, RNA_def_speaker}, + {"rna_strands.c", NULL, RNA_def_strands}, {"rna_test.c", NULL, RNA_def_test}, {"rna_text.c", "rna_text_api.c", RNA_def_text}, {"rna_timeline.c", NULL, RNA_def_timeline_marker}, @@ -3372,7 +3381,9 @@ static void rna_generate(BlenderRNA *brna, FILE *f, const char *filename, const fprintf(f, "#include \"RNA_types.h\"\n"); fprintf(f, "#include \"rna_internal.h\"\n\n"); - rna_generate_prototypes(brna, f); + + /* include the generated prototypes header */ + fprintf(f, "#include \"rna_prototypes_gen.h\"\n\n"); fprintf(f, "#include \"%s\"\n", filename); if (api_filename) @@ -3760,7 +3771,7 @@ static const char *cpp_classes = "" "\n" "class DefaultCollectionFunctions {\n" "public:\n" -" DefaultCollectionFunctions(const PointerRNA &p) {}\n" +" DefaultCollectionFunctions(const PointerRNA & /*p*/) {}\n" "};\n" "\n" "\n"; @@ -3967,6 +3978,26 @@ static int rna_preprocess(const char *outfile) status = (DefRNA.error != 0); + /* create rna prototype header file */ + strcpy(deffile, outfile); + strcat(deffile, "rna_prototypes_gen.h"); + if (status) { + make_bad_file(deffile, __LINE__); + } + file = fopen(deffile, "w"); + if (!file) { + fprintf(stderr, "Unable to open file: %s\n", deffile); + status = 1; + } + else { + fprintf(file, + "/* Automatically generated function declarations for the Data API.\n" + " * Do not edit manually, changes will be overwritten. */\n\n"); + rna_generate_prototypes(brna, file); + fclose(file); + status = (DefRNA.error != 0); + } + /* create rna_gen_*.c files */ for (i = 0; PROCESS_ITEMS[i].filename; i++) { strcpy(deffile, outfile); diff --git a/source/blender/makesrna/intern/rna_ID.c b/source/blender/makesrna/intern/rna_ID.c index 009e3799c49..d29450aa320 100644 --- a/source/blender/makesrna/intern/rna_ID.c +++ b/source/blender/makesrna/intern/rna_ID.c @@ -34,6 +34,8 @@ #include "BLI_utildefines.h" +#include "BKE_icons.h" + #include "RNA_access.h" #include "RNA_define.h" #include "RNA_enum_types.h" @@ -50,6 +52,7 @@ EnumPropertyItem id_type_items[] = { {ID_AR, "ARMATURE", ICON_ARMATURE_DATA, "Armature", ""}, {ID_BR, "BRUSH", ICON_BRUSH_DATA, "Brush", ""}, {ID_CA, "CAMERA", ICON_CAMERA_DATA, "Camera", ""}, + {ID_CL, "CACHELIBRARY", ICON_PHYSICS, "Cache Library", ""}, {ID_CU, "CURVE", ICON_CURVE_DATA, "Curve", ""}, {ID_VF, "FONT", ICON_FONT_DATA, "Font", ""}, {ID_GD, "GREASEPENCIL", ICON_GREASEPENCIL, "Grease Pencil", ""}, @@ -130,6 +133,7 @@ short RNA_type_to_ID_code(StructRNA *type) if (RNA_struct_is_a(type, &RNA_Action)) return ID_AC; if (RNA_struct_is_a(type, &RNA_Armature)) return ID_AR; if (RNA_struct_is_a(type, &RNA_Brush)) return ID_BR; + if (RNA_struct_is_a(type, &RNA_CacheLibrary)) return ID_CL; if (RNA_struct_is_a(type, &RNA_Camera)) return ID_CA; if (RNA_struct_is_a(type, &RNA_Curve)) return ID_CU; if (RNA_struct_is_a(type, &RNA_GreasePencil)) return ID_GD; @@ -170,6 +174,7 @@ StructRNA *ID_code_to_RNA_type(short idcode) case ID_AR: return &RNA_Armature; case ID_BR: return &RNA_Brush; case ID_CA: return &RNA_Camera; + case ID_CL: return &RNA_CacheLibrary; case ID_CU: return &RNA_Curve; case ID_GD: return &RNA_GreasePencil; case ID_GR: return &RNA_Group; @@ -406,6 +411,183 @@ static void rna_Library_filepath_set(PointerRNA *ptr, const char *value) BKE_library_filepath_set(lib, value); } +/* ***** ImagePreview ***** */ + +static void rna_ImagePreview_is_custom_set(PointerRNA *ptr, int value, enum eIconSizes size) +{ + ID *id = ptr->id.data; + PreviewImage *prv_img = (PreviewImage *)ptr->data; + + if (id != NULL) { + BLI_assert(prv_img == BKE_previewimg_id_ensure(id)); + } + + if ((value && (prv_img->flag[size] & PRV_USER_EDITED)) || (!value && !(prv_img->flag[size] & PRV_USER_EDITED))) { + return; + } + + if (value) + prv_img->flag[size] |= PRV_USER_EDITED; + else + prv_img->flag[size] &= ~PRV_USER_EDITED; + + prv_img->flag[size] |= PRV_CHANGED; + + BKE_previewimg_clear_single(prv_img, size); +} + +static void rna_ImagePreview_size_get(PointerRNA *ptr, int *values, enum eIconSizes size) +{ + ID *id = (ID *)ptr->id.data; + PreviewImage *prv_img = (PreviewImage *)ptr->data; + + if (id != NULL) { + BLI_assert(prv_img == BKE_previewimg_id_ensure(id)); + } + + BKE_previewimg_ensure(prv_img, size); + + values[0] = prv_img->w[size]; + values[1] = prv_img->h[size]; +} + +static void rna_ImagePreview_size_set(PointerRNA *ptr, const int *values, enum eIconSizes size) +{ + ID *id = (ID *)ptr->id.data; + PreviewImage *prv_img = (PreviewImage *)ptr->data; + + if (id != NULL) { + BLI_assert(prv_img == BKE_previewimg_id_ensure(id)); + } + + BKE_previewimg_ensure(prv_img, size); + + if (values[0] && values[1]) { + prv_img->rect[size] = MEM_callocN(values[0] * values[1] * sizeof(unsigned int), "prv_rect"); + } + + prv_img->w[size] = values[0]; + prv_img->h[size] = values[1]; + + prv_img->flag[size] |= (PRV_CHANGED | PRV_USER_EDITED); +} + +static int rna_ImagePreview_pixels_get_length(PointerRNA *ptr, int length[RNA_MAX_ARRAY_DIMENSION], enum eIconSizes size) +{ + ID *id = ptr->id.data; + PreviewImage *prv_img = (PreviewImage *)ptr->data; + + if (id != NULL) { + BLI_assert(prv_img == BKE_previewimg_id_ensure(id)); + } + + BKE_previewimg_ensure(prv_img, size); + + length[0] = prv_img->w[size] * prv_img->h[size]; + + return length[0]; +} + +static void rna_ImagePreview_pixels_get(PointerRNA *ptr, int *values, enum eIconSizes size) +{ + ID *id = ptr->id.data; + PreviewImage *prv_img = (PreviewImage *)ptr->data; + + if (id != NULL) { + BLI_assert(prv_img == BKE_previewimg_id_ensure(id)); + } + + BKE_previewimg_ensure(prv_img, size); + + memcpy(values, prv_img->rect[size], prv_img->w[size] * prv_img->h[size] * sizeof(unsigned int)); +} + +static void rna_ImagePreview_pixels_set(PointerRNA *ptr, const int *values, enum eIconSizes size) +{ + ID *id = ptr->id.data; + PreviewImage *prv_img = (PreviewImage *)ptr->data; + + if (id != NULL) { + BLI_assert(prv_img == BKE_previewimg_id_ensure(id)); + } + + memcpy(prv_img->rect[size], values, prv_img->w[size] * prv_img->h[size] * sizeof(unsigned int)); + prv_img->flag[size] |= PRV_USER_EDITED; +} + +static void rna_ImagePreview_is_image_custom_set(PointerRNA *ptr, int value) +{ + rna_ImagePreview_is_custom_set(ptr, value, ICON_SIZE_PREVIEW); +} + +static void rna_ImagePreview_image_size_get(PointerRNA *ptr, int *values) +{ + rna_ImagePreview_size_get(ptr, values, ICON_SIZE_PREVIEW); +} + +static void rna_ImagePreview_image_size_set(PointerRNA *ptr, const int *values) +{ + rna_ImagePreview_size_set(ptr, values, ICON_SIZE_PREVIEW); +} + +static int rna_ImagePreview_image_pixels_get_length(PointerRNA *ptr, int length[RNA_MAX_ARRAY_DIMENSION]) +{ + return rna_ImagePreview_pixels_get_length(ptr, length, ICON_SIZE_PREVIEW); +} + +static void rna_ImagePreview_image_pixels_get(PointerRNA *ptr, int *values) +{ + rna_ImagePreview_pixels_get(ptr, values, ICON_SIZE_PREVIEW); +} + +static void rna_ImagePreview_image_pixels_set(PointerRNA *ptr, const int *values) +{ + rna_ImagePreview_pixels_set(ptr, values, ICON_SIZE_PREVIEW); +} + +static void rna_ImagePreview_is_icon_custom_set(PointerRNA *ptr, int value) +{ + rna_ImagePreview_is_custom_set(ptr, value, ICON_SIZE_ICON); +} + +static void rna_ImagePreview_icon_size_get(PointerRNA *ptr, int *values) +{ + rna_ImagePreview_size_get(ptr, values, ICON_SIZE_ICON); +} + +static void rna_ImagePreview_icon_size_set(PointerRNA *ptr, const int *values) +{ + rna_ImagePreview_size_set(ptr, values, ICON_SIZE_ICON); +} + +static int rna_ImagePreview_icon_pixels_get_length(PointerRNA *ptr, int length[RNA_MAX_ARRAY_DIMENSION]) +{ + return rna_ImagePreview_pixels_get_length(ptr, length, ICON_SIZE_ICON); +} + +static void rna_ImagePreview_icon_pixels_get(PointerRNA *ptr, int *values) +{ + rna_ImagePreview_pixels_get(ptr, values, ICON_SIZE_ICON); +} + +static void rna_ImagePreview_icon_pixels_set(PointerRNA *ptr, const int *values) +{ + rna_ImagePreview_pixels_set(ptr, values, ICON_SIZE_ICON); +} + +static int rna_ImagePreview_icon_id_get(PointerRNA *ptr) +{ + /* Using a callback here allows us to only generate icon matching that preview when icon_id is requested. */ + return BKE_icon_preview_ensure((PreviewImage *)(ptr->data)); +} +static void rna_ImagePreview_icon_reload(PreviewImage *prv) +{ + /* will lazy load on next use, but only in case icon is not user-modified! */ + if (!(prv->flag[ICON_SIZE_ICON] & PRV_USER_EDITED) && !(prv->flag[ICON_SIZE_PREVIEW] & PRV_USER_EDITED)) { + BKE_previewimg_clear(prv); + } +} + #else static void rna_def_ID_properties(BlenderRNA *brna) @@ -524,6 +706,62 @@ static void rna_def_ID_materials(BlenderRNA *brna) RNA_def_boolean(func, "update_data", 0, "", "Update data by re-adjusting the material slots assigned"); } +static void rna_def_image_preview(BlenderRNA *brna) +{ + StructRNA *srna; + FunctionRNA *func; + PropertyRNA *prop; + + srna = RNA_def_struct(brna, "ImagePreview", NULL); + RNA_def_struct_sdna(srna, "PreviewImage"); + RNA_def_struct_ui_text(srna, "Image Preview", "Preview image and icon"); + + prop = RNA_def_property(srna, "is_image_custom", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag[ICON_SIZE_PREVIEW]", PRV_USER_EDITED); + RNA_def_property_boolean_funcs(prop, NULL, "rna_ImagePreview_is_image_custom_set"); + RNA_def_property_ui_text(prop, "Custom Image", "True if this preview image has been modified by py script," + "and is no more auto-generated by Blender"); + + prop = RNA_def_int_vector(srna, "image_size", 2, NULL, 0, 0, "Image Size", + "Width and height in pixels", 0, 0); + RNA_def_property_subtype(prop, PROP_PIXEL); + RNA_def_property_int_funcs(prop, "rna_ImagePreview_image_size_get", "rna_ImagePreview_image_size_set", NULL); + + prop = RNA_def_property(srna, "image_pixels", PROP_INT, PROP_NONE); + RNA_def_property_flag(prop, PROP_DYNAMIC); + RNA_def_property_multi_array(prop, 1, NULL); + RNA_def_property_ui_text(prop, "Image Pixels", "Image pixels, as bytes (always RGBA 32bits)"); + RNA_def_property_dynamic_array_funcs(prop, "rna_ImagePreview_image_pixels_get_length"); + RNA_def_property_int_funcs(prop, "rna_ImagePreview_image_pixels_get", "rna_ImagePreview_image_pixels_set", NULL); + + + prop = RNA_def_property(srna, "is_icon_custom", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag[ICON_SIZE_ICON]", PRV_USER_EDITED); + RNA_def_property_boolean_funcs(prop, NULL, "rna_ImagePreview_is_icon_custom_set"); + RNA_def_property_ui_text(prop, "Custom Icon", "True if this preview icon has been modified by py script," + "and is no more auto-generated by Blender"); + + prop = RNA_def_int_vector(srna, "icon_size", 2, NULL, 0, 0, "Icon Size", + "Width and height in pixels", 0, 0); + RNA_def_property_subtype(prop, PROP_PIXEL); + RNA_def_property_int_funcs(prop, "rna_ImagePreview_icon_size_get", "rna_ImagePreview_icon_size_set", NULL); + + prop = RNA_def_property(srna, "icon_pixels", PROP_INT, PROP_NONE); + RNA_def_property_flag(prop, PROP_DYNAMIC); + RNA_def_property_multi_array(prop, 1, NULL); + RNA_def_property_ui_text(prop, "Icon Pixels", "Icon pixels, as bytes (always RGBA 32bits)"); + RNA_def_property_dynamic_array_funcs(prop, "rna_ImagePreview_icon_pixels_get_length"); + RNA_def_property_int_funcs(prop, "rna_ImagePreview_icon_pixels_get", "rna_ImagePreview_icon_pixels_set", NULL); + + prop = RNA_def_int(srna, "icon_id", 0, INT_MIN, INT_MAX, "Icon ID", + "Unique integer identifying this preview as an icon (zero means invalid)", INT_MIN, INT_MAX); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_int_funcs(prop, "rna_ImagePreview_icon_id_get", NULL, NULL); + + func = RNA_def_function(srna, "reload", "rna_ImagePreview_icon_reload"); + RNA_def_function_ui_description(func, "Reload the preview from its source path"); +} + static void rna_def_ID(BlenderRNA *brna) { StructRNA *srna; @@ -566,7 +804,9 @@ static void rna_def_ID(BlenderRNA *brna) prop = RNA_def_property(srna, "tag", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", LIB_DOIT); 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)"); + RNA_def_property_ui_text(prop, "Tag", + "Tools can use this to tag data for their own purposes " + "(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); @@ -598,17 +838,19 @@ static void rna_def_ID(BlenderRNA *brna) RNA_def_function_ui_description(func, "Clear the user count of a datablock so its not saved, " "on reload the data will be removed"); - func = RNA_def_function(srna, "animation_data_create", "BKE_id_add_animdata"); + func = RNA_def_function(srna, "animation_data_create", "BKE_animdata_add_id"); RNA_def_function_ui_description(func, "Create animation data to this ID, note that not all ID types support this"); parm = RNA_def_pointer(func, "anim_data", "AnimData", "", "New animation data or NULL"); RNA_def_function_return(func, parm); - func = RNA_def_function(srna, "animation_data_clear", "BKE_free_animdata"); + func = RNA_def_function(srna, "animation_data_clear", "BKE_animdata_free"); RNA_def_function_ui_description(func, "Clear animation on this this ID"); func = RNA_def_function(srna, "update_tag", "rna_ID_update_tag"); RNA_def_function_flag(func, FUNC_USE_REPORTS); - RNA_def_function_ui_description(func, "Tag the ID to update its display data"); + RNA_def_function_ui_description(func, + "Tag the ID to update its display data, " + "e.g. when calling :class:`bpy.types.Scene.update`"); RNA_def_enum_flag(func, "refresh", update_flag_items, 0, "", "Type of updates to perform"); } @@ -647,6 +889,7 @@ void RNA_def_ID(BlenderRNA *brna) RNA_def_struct_ui_text(srna, "Any Type", "RNA type used for pointers to any possible data"); rna_def_ID(brna); + rna_def_image_preview(brna); rna_def_ID_properties(brna); rna_def_ID_materials(brna); rna_def_library(brna); diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c index c3499d0b139..ef798820321 100644 --- a/source/blender/makesrna/intern/rna_access.c +++ b/source/blender/makesrna/intern/rna_access.c @@ -1622,7 +1622,7 @@ bool RNA_property_animateable(PointerRNA *ptr, PropertyRNA *prop) bool RNA_property_animated(PointerRNA *ptr, PropertyRNA *prop) { int len = 1, index; - bool driven; + bool driven, special; if (!prop) return false; @@ -1631,7 +1631,7 @@ bool RNA_property_animated(PointerRNA *ptr, PropertyRNA *prop) len = RNA_property_array_length(ptr, prop); for (index = 0; index < len; index++) { - if (rna_get_fcurve(ptr, prop, index, NULL, NULL, &driven)) + if (rna_get_fcurve(ptr, prop, index, NULL, NULL, &driven, &special)) return true; } @@ -5462,14 +5462,20 @@ char *RNA_property_as_string(bContext *C, PointerRNA *ptr, PropertyRNA *prop, in BLI_dynstr_append(dynstr, bool_as_py_string(RNA_property_boolean_get_index(ptr, prop, index))); } else { + int fixedbuf[RNA_MAX_ARRAY_LENGTH]; + int *buf = ARRAY_SIZE(fixedbuf) >= len ? fixedbuf : MEM_mallocN(sizeof(*buf) * len, __func__); + + RNA_property_boolean_get_array(ptr, prop, buf); BLI_dynstr_append(dynstr, "("); for (i = 0; i < len; i++) { - BLI_dynstr_appendf(dynstr, i ? ", %s" : "%s", - bool_as_py_string(RNA_property_boolean_get_index(ptr, prop, i))); + BLI_dynstr_appendf(dynstr, i ? ", %s" : "%s", bool_as_py_string(buf[i])); } if (len == 1) BLI_dynstr_append(dynstr, ","); /* otherwise python wont see it as a tuple */ BLI_dynstr_append(dynstr, ")"); + if (buf != fixedbuf) { + MEM_freeN(buf); + } } } break; @@ -5482,13 +5488,20 @@ char *RNA_property_as_string(bContext *C, PointerRNA *ptr, PropertyRNA *prop, in BLI_dynstr_appendf(dynstr, "%d", RNA_property_int_get_index(ptr, prop, index)); } else { + int fixedbuf[RNA_MAX_ARRAY_LENGTH]; + int *buf = ARRAY_SIZE(fixedbuf) >= len ? fixedbuf : MEM_mallocN(sizeof(*buf) * len, __func__); + + RNA_property_int_get_array(ptr, prop, buf); BLI_dynstr_append(dynstr, "("); for (i = 0; i < len; i++) { - BLI_dynstr_appendf(dynstr, i ? ", %d" : "%d", RNA_property_int_get_index(ptr, prop, i)); + BLI_dynstr_appendf(dynstr, i ? ", %d" : "%d", buf[i]); } if (len == 1) BLI_dynstr_append(dynstr, ","); /* otherwise python wont see it as a tuple */ BLI_dynstr_append(dynstr, ")"); + if (buf != fixedbuf) { + MEM_freeN(buf); + } } } break; @@ -5501,13 +5514,20 @@ char *RNA_property_as_string(bContext *C, PointerRNA *ptr, PropertyRNA *prop, in BLI_dynstr_appendf(dynstr, "%g", RNA_property_float_get_index(ptr, prop, index)); } else { + float fixedbuf[RNA_MAX_ARRAY_LENGTH]; + float *buf = ARRAY_SIZE(fixedbuf) >= len ? fixedbuf : MEM_mallocN(sizeof(*buf) * len, __func__); + + RNA_property_float_get_array(ptr, prop, buf); BLI_dynstr_append(dynstr, "("); for (i = 0; i < len; i++) { - BLI_dynstr_appendf(dynstr, i ? ", %g" : "%g", RNA_property_float_get_index(ptr, prop, i)); + BLI_dynstr_appendf(dynstr, i ? ", %g" : "%g", buf[i]); } if (len == 1) BLI_dynstr_append(dynstr, ","); /* otherwise python wont see it as a tuple */ BLI_dynstr_append(dynstr, ")"); + if (buf != fixedbuf) { + MEM_freeN(buf); + } } } break; @@ -6497,6 +6517,12 @@ bool RNA_property_copy(PointerRNA *ptr, PointerRNA *fromptr, PropertyRNA *prop, /* In case of IDProperty, we have to find the *real* idprop of ptr, * since prop in this case is just a fake wrapper around actual IDProp data, and not a 'real' PropertyRNA. */ prop = (PropertyRNA *)rna_idproperty_find(ptr, ((IDProperty *)fromprop)->name); + + /* its possible the custom-prop doesn't exist on this datablock */ + if (prop == NULL) { + return false; + } + /* Even though currently we now prop will always be the 'fromprop', this might not be the case in the future. */ if (prop == fromprop) { fromprop = (PropertyRNA *)rna_idproperty_find(fromptr, ((IDProperty *)prop)->name); diff --git a/source/blender/makesrna/intern/rna_action.c b/source/blender/makesrna/intern/rna_action.c index 3fed505b9d6..29e699a57b2 100644 --- a/source/blender/makesrna/intern/rna_action.c +++ b/source/blender/makesrna/intern/rna_action.c @@ -329,6 +329,21 @@ static void rna_def_dopesheet(BlenderRNA *brna) prop = RNA_def_property(srna, "filter_fcurve_name", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "searchstr"); RNA_def_property_ui_text(prop, "F-Curve Name Filter", "F-Curve live filtering string"); + RNA_def_property_flag(prop, PROP_TEXTEDIT_UPDATE); + RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL); + + /* NLA Name Search Settings (Shared with FCurve setting, but with different labels) */ + prop = RNA_def_property(srna, "use_filter_text", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "filterflag", ADS_FILTER_BY_FCU_NAME); + RNA_def_property_ui_text(prop, "Only Matching Channels", + "Only include channels with names containing search text"); + RNA_def_property_ui_icon(prop, ICON_VIEWZOOM, 0); + RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL); + + prop = RNA_def_property(srna, "filter_text", PROP_STRING, PROP_NONE); + RNA_def_property_string_sdna(prop, NULL, "searchstr"); + RNA_def_property_ui_text(prop, "Name Filter", "Live filtering string"); + RNA_def_property_flag(prop, PROP_TEXTEDIT_UPDATE); RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL); /* NLA Specific Settings */ diff --git a/source/blender/makesrna/intern/rna_animation.c b/source/blender/makesrna/intern/rna_animation.c index df1e6dd55dd..ac30c615438 100644 --- a/source/blender/makesrna/intern/rna_animation.c +++ b/source/blender/makesrna/intern/rna_animation.c @@ -112,6 +112,7 @@ static void rna_AnimData_action_set(PointerRNA *ptr, PointerRNA value) adt = BKE_animdata_from_id(ownerId); if (adt) { adt->recalc |= ADT_RECALC_ANIM; + DAG_id_tag_update(ownerId, OB_RECALC_TIME); } } diff --git a/source/blender/makesrna/intern/rna_armature.c b/source/blender/makesrna/intern/rna_armature.c index 421d7b28dda..93e5ceaa229 100644 --- a/source/blender/makesrna/intern/rna_armature.c +++ b/source/blender/makesrna/intern/rna_armature.c @@ -247,8 +247,8 @@ static void rna_bone_layer_set(int *layer, const int *values) return; for (i = 0; i < 32; i++) { - if (values[i]) *layer |= (1 << i); - else *layer &= ~(1 << i); + if (values[i]) *layer |= (1u << i); + else *layer &= ~(1u << i); } } @@ -272,8 +272,8 @@ static void rna_Armature_layer_set(PointerRNA *ptr, const int *values) return; for (i = 0; i < 32; i++) { - if (values[i]) arm->layer |= (1 << i); - else arm->layer &= ~(1 << i); + if (values[i]) arm->layer |= (1u << i); + else arm->layer &= ~(1u << i); } } diff --git a/source/blender/makesrna/intern/rna_brush.c b/source/blender/makesrna/intern/rna_brush.c index 81ba3a9066f..f6e60471a58 100644 --- a/source/blender/makesrna/intern/rna_brush.c +++ b/source/blender/makesrna/intern/rna_brush.c @@ -107,6 +107,17 @@ EnumPropertyItem brush_image_tool_items[] = { {0, NULL, 0, NULL, NULL} }; +EnumPropertyItem brush_hair_tool_items[] = { + {HAIR_TOOL_COMB, "COMB", ICON_BRUSH_HAIR_COMB, "Comb", "Align hairs to the stroke direction"}, + {HAIR_TOOL_CUT, "CUT", ICON_BRUSH_HAIR_CUT, "Cut", "Shorten and/or remove hairs"}, + {HAIR_TOOL_LENGTH, "LENGTH", ICON_BRUSH_HAIR_LENGTH, "Length", "Increase hair length"}, + {HAIR_TOOL_PUFF, "PUFF", ICON_BRUSH_HAIR_PUFF, "Puff", "Increase spacing between hairs"}, + {HAIR_TOOL_ADD, "ADD", ICON_BRUSH_HAIR_ADD, "Add", "Add more hairs on the object"}, + {HAIR_TOOL_SMOOTH, "SMOOTH", ICON_BRUSH_HAIR_SMOOTH, "Smooth", "Align hairs in the same direction"}, + {HAIR_TOOL_WEIGHT, "WEIGHT", ICON_BRUSH_HAIR_WEIGHT, "Weight", "Set hair vertex weights"}, + {0, NULL, 0, NULL, NULL} +}; + #ifdef RNA_RUNTIME #include "MEM_guardedalloc.h" @@ -125,9 +136,7 @@ EnumPropertyItem brush_image_tool_items[] = { static int rna_SculptToolCapabilities_has_accumulate_get(PointerRNA *ptr) { Brush *br = (Brush *)ptr->data; - return ELEM(br->sculpt_tool, - SCULPT_TOOL_BLOB, SCULPT_TOOL_CLAY, SCULPT_TOOL_CREASE, - SCULPT_TOOL_DRAW, SCULPT_TOOL_INFLATE, SCULPT_TOOL_LAYER); + return SCULPT_TOOL_HAS_ACCUMULATE(br->sculpt_tool); } static int rna_SculptToolCapabilities_has_auto_smooth_get(PointerRNA *ptr) @@ -155,7 +164,7 @@ static int rna_SculptToolCapabilities_has_jitter_get(PointerRNA *ptr) static int rna_SculptToolCapabilities_has_normal_weight_get(PointerRNA *ptr) { Brush *br = (Brush *)ptr->data; - return ELEM(br->sculpt_tool, SCULPT_TOOL_GRAB, SCULPT_TOOL_SNAKE_HOOK); + return SCULPT_TOOL_HAS_NORMAL_WEIGHT(br->sculpt_tool); } static int rna_BrushCapabilities_has_overlay_get(PointerRNA *ptr) @@ -344,8 +353,8 @@ static void rna_Brush_reset_icon(Brush *br, const char *UNUSED(type)) return; if (id->icon_id >= BIFICONID_LAST) { - BKE_icon_delete(id); - BKE_previewimg_free_id(id); + BKE_icon_id_delete(id); + BKE_previewimg_id_free(id); } id->icon_id = 0; @@ -399,6 +408,13 @@ static void rna_Brush_imagepaint_tool_update(Main *bmain, Scene *scene, PointerR rna_Brush_update(bmain, scene, ptr); } +static void rna_Brush_hair_tool_update(Main *bmain, Scene *scene, PointerRNA *ptr) +{ + Brush *br = (Brush *)ptr->data; + rna_Brush_reset_icon(br, "hair"); + rna_Brush_update(bmain, scene, ptr); +} + static void rna_Brush_stroke_update(Main *bmain, Scene *scene, PointerRNA *ptr) { WM_main_add_notifier(NC_SCENE | ND_TOOLSETTINGS, scene); @@ -417,8 +433,8 @@ static void rna_Brush_icon_update(Main *UNUSED(bmain), Scene *UNUSED(scene), Poi br->id.icon_id = 0; if (br->flag & BRUSH_CUSTOM_ICON) { - BKE_previewimg_get(&br->id); - BKE_icon_changed(BKE_icon_getid(&br->id)); + BKE_previewimg_id_ensure(&br->id); + BKE_icon_changed(BKE_icon_id_ensure(&br->id)); } WM_main_add_notifier(NC_BRUSH | NA_EDITED, br); @@ -881,6 +897,12 @@ static void rna_def_brush(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Image Paint Tool", ""); RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, "rna_Brush_imagepaint_tool_update"); + prop = RNA_def_property(srna, "hair_tool", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "hair_tool"); + RNA_def_property_enum_items(prop, brush_hair_tool_items); + RNA_def_property_ui_text(prop, "Hair Tool", ""); + RNA_def_property_update(prop, 0, "rna_Brush_hair_tool_update"); + prop = RNA_def_property(srna, "direction", PROP_ENUM, PROP_NONE); RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag"); RNA_def_property_enum_items(prop, prop_direction_items); @@ -1323,6 +1345,10 @@ static void rna_def_brush(BlenderRNA *brna) RNA_def_property_boolean_sdna(prop, NULL, "ob_mode", OB_MODE_TEXTURE_PAINT); RNA_def_property_ui_text(prop, "Use Texture", "Use this brush in texture paint mode"); + prop = RNA_def_property(srna, "use_hair_edit", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "ob_mode", OB_MODE_HAIR_EDIT); + RNA_def_property_ui_text(prop, "Use Hair", "Use this brush in hair edit mode"); + /* texture */ prop = RNA_def_property(srna, "texture_slot", PROP_POINTER, PROP_NONE); RNA_def_property_struct_type(prop, "BrushTextureSlot"); diff --git a/source/blender/makesrna/intern/rna_cache_library.c b/source/blender/makesrna/intern/rna_cache_library.c new file mode 100644 index 00000000000..4c8b8835491 --- /dev/null +++ b/source/blender/makesrna/intern/rna_cache_library.c @@ -0,0 +1,1049 @@ +/* + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * Contributor(s): Blender Foundation (2015). + * + * ***** END GPL LICENSE BLOCK ***** + */ + +/** \file blender/makesrna/intern/rna_cache_library.c + * \ingroup RNA + */ + +#include <stdlib.h> +#include <assert.h> +#include <string.h> + +#include "DNA_cache_library_types.h" + +#include "RNA_define.h" +#include "RNA_enum_types.h" + +#include "rna_internal.h" + +#include "WM_types.h" + +EnumPropertyItem cache_library_data_type_items[] = { + {CACHE_TYPE_OBJECT, "OBJECT", ICON_OBJECT_DATA, "Object", "Object base properties"}, + {CACHE_TYPE_DERIVED_MESH, "DERIVED_MESH", ICON_OUTLINER_OB_MESH, "Derived Mesh", "Mesh result from modifiers"}, + {CACHE_TYPE_HAIR, "HAIR", ICON_PARTICLE_POINT, "Hair", "Hair parent strands"}, + {CACHE_TYPE_HAIR_PATHS, "HAIR_PATHS", ICON_PARTICLE_PATH, "Hair Paths", "Full hair paths"}, + {CACHE_TYPE_PARTICLES, "PARTICLES", ICON_PARTICLES, "Particles", "Emitter particles"}, + {0, NULL, 0, NULL, NULL} +}; + +EnumPropertyItem cache_library_read_result_items[] = { + {CACHE_READ_SAMPLE_INVALID, "INVALID", ICON_ERROR, "Invalid", "No valid sample found"}, + {CACHE_READ_SAMPLE_EXACT, "EXACT", ICON_SPACE3, "Exact", "Found sample for requested frame"}, + {CACHE_READ_SAMPLE_INTERPOLATED, "INTERPOLATED", ICON_TRIA_DOWN_BAR, "Interpolated", "Enclosing samples found for interpolation"}, + {CACHE_READ_SAMPLE_EARLY, "EARLY", ICON_TRIA_RIGHT_BAR, "Early", "Requested frame before the first sample"}, + {CACHE_READ_SAMPLE_LATE, "LATE", ICON_TRIA_LEFT_BAR, "Late", "Requested frame after the last sample"}, + {0, NULL, 0, NULL, NULL} +}; + +EnumPropertyItem cache_modifier_type_items[] = { + {eCacheModifierType_HairSimulation, "HAIR_SIMULATION", ICON_HAIR, "Hair Simulation", ""}, + {eCacheModifierType_ForceField, "FORCE_FIELD", ICON_FORCE_FORCE, "Force Field", ""}, + {eCacheModifierType_ShrinkWrap, "SHRINK_WRAP", ICON_MOD_SHRINKWRAP, "Shrink Wrap", ""}, + {eCacheModifierType_StrandsKey, "STRANDS_KEY", ICON_SHAPEKEY_DATA, "Strands Key", "Shape key for strands"}, + {eCacheModifierType_Haircut, "HAIRCUT", ICON_HAIR, "Hair Cut", "Cut strands where they intersect with an object"}, + {0, NULL, 0, NULL, NULL} +}; + +#ifdef RNA_RUNTIME + +#include "MEM_guardedalloc.h" + +#include "BLI_listbase.h" +#include "BLI_math.h" +#include "BLI_string.h" + +#include "DNA_key_types.h" +#include "DNA_object_types.h" +#include "DNA_particle_types.h" + +#include "BKE_animsys.h" +#include "BKE_cache_library.h" +#include "BKE_depsgraph.h" +#include "BKE_main.h" + +#include "RNA_access.h" + +#include "WM_api.h" + +/* ========================================================================= */ + +static void rna_CacheLibrary_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) +{ + CacheLibrary *cachelib = ptr->data; + DAG_id_tag_update(&cachelib->id, OB_RECALC_DATA); + WM_main_add_notifier(NC_WINDOW, NULL); +} + +static void rna_CacheArchiveInfo_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *UNUSED(ptr)) +{ +// CacheLibrary *cachelib = ptr->id.data; +// WM_main_add_notifier(NC_OBJECT | ND_DRAW, NULL); +} + +/* ========================================================================= */ + +static void rna_CacheModifier_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *UNUSED(ptr)) +{ +} + +#if 0 /* unused */ +static void rna_CacheModifier_dependency_update(Main *bmain, Scene *scene, PointerRNA *ptr) +{ + rna_CacheModifier_update(bmain, scene, ptr); + DAG_relations_tag_update(bmain); +} +#endif + + +static StructRNA *rna_CacheModifier_refine(struct PointerRNA *ptr) +{ + CacheModifier *md = (CacheModifier *)ptr->data; + + switch ((eCacheModifier_Type)md->type) { + case eCacheModifierType_HairSimulation: + return &RNA_HairSimulationCacheModifier; + case eCacheModifierType_ForceField: + return &RNA_ForceFieldCacheModifier; + case eCacheModifierType_ShrinkWrap: + return &RNA_ShrinkWrapCacheModifier; + case eCacheModifierType_StrandsKey: + return &RNA_StrandsKeyCacheModifier; + case eCacheModifierType_Haircut: + return &RNA_HaircutCacheModifier; + + /* Default */ + case eCacheModifierType_None: + case NUM_CACHE_MODIFIER_TYPES: + return &RNA_CacheLibraryModifier; + } + + return &RNA_CacheLibraryModifier; +} + +static void rna_CacheLibraryModifier_name_set(PointerRNA *ptr, const char *value) +{ + CacheModifier *md = ptr->data; + char oldname[sizeof(md->name)]; + + /* make a copy of the old name first */ + BLI_strncpy(oldname, md->name, sizeof(md->name)); + + /* copy the new name into the name slot */ + BLI_strncpy_utf8(md->name, value, sizeof(md->name)); + + /* make sure the name is truly unique */ + if (ptr->id.data) { + CacheLibrary *cachelib = ptr->id.data; + BKE_cache_modifier_unique_name(&cachelib->modifiers, md); + } + + /* fix all the animation data which may link to this */ + BKE_animdata_fix_paths_rename_all(NULL, "modifiers", oldname, md->name); +} + +static char *rna_CacheLibraryModifier_path(PointerRNA *ptr) +{ + CacheModifier *md = ptr->data; + char name_esc[sizeof(md->name) * 2]; + + BLI_strescape(name_esc, md->name, sizeof(name_esc)); + return BLI_sprintfN("modifiers[\"%s\"]", name_esc); +} + +static CacheModifier *rna_CacheLibrary_modifier_new(CacheLibrary *cachelib, bContext *UNUSED(C), ReportList *UNUSED(reports), + const char *name, int type) +{ + return BKE_cache_modifier_add(cachelib, name, type); +} + +static void rna_CacheLibrary_modifier_remove(CacheLibrary *cachelib, bContext *UNUSED(C), ReportList *UNUSED(reports), PointerRNA *md_ptr) +{ + CacheModifier *md = md_ptr->data; + + BKE_cache_modifier_remove(cachelib, md); + + RNA_POINTER_INVALIDATE(md_ptr); +} + +static void rna_CacheLibrary_modifier_clear(CacheLibrary *cachelib, bContext *UNUSED(C)) +{ + BKE_cache_modifier_clear(cachelib); +} + +/* ------------------------------------------------------------------------- */ + +static int rna_CacheLibraryModifier_mesh_object_poll(PointerRNA *UNUSED(ptr), PointerRNA value) +{ + /*HairSimCacheModifier *hsmd = ptr->data;*/ + Object *ob = value.data; + + return ob->type == OB_MESH && ob->data != NULL; +} + +static int rna_CacheLibraryModifier_hair_object_poll(PointerRNA *UNUSED(ptr), PointerRNA value) +{ + /*HairSimCacheModifier *hsmd = ptr->data;*/ + Object *ob = value.data; + ParticleSystem *psys; + bool has_hair_system = false; + + for (psys = ob->particlesystem.first; psys; psys = psys->next) { + if (psys->part && psys->part->type == PART_HAIR) { + has_hair_system = true; + break; + } + } + return has_hair_system; +} + +static PointerRNA rna_HairSimulationCacheModifier_hair_system_get(PointerRNA *ptr) +{ + HairSimCacheModifier *hsmd = ptr->data; + ParticleSystem *psys = hsmd->object ? BLI_findlink(&hsmd->object->particlesystem, hsmd->hair_system) : NULL; + PointerRNA value; + + RNA_pointer_create(ptr->id.data, &RNA_ParticleSystem, psys, &value); + return value; +} + +static void rna_HairSimulationCacheModifier_hair_system_set(PointerRNA *ptr, PointerRNA value) +{ + HairSimCacheModifier *hsmd = ptr->data; + ParticleSystem *psys = value.data; + hsmd->hair_system = hsmd->object ? BLI_findindex(&hsmd->object->particlesystem, psys) : -1; +} + +static int rna_HairSimulationCacheModifier_hair_system_poll(PointerRNA *ptr, PointerRNA value) +{ + HairSimCacheModifier *hsmd = ptr->data; + ParticleSystem *psys = value.data; + + if (!hsmd->object) + return false; + if (BLI_findindex(&hsmd->object->particlesystem, psys) == -1) + return false; + if (!psys->part || psys->part->type != PART_HAIR) + return false; + return true; +} + +static PointerRNA rna_ShrinkWrapCacheModifier_hair_system_get(PointerRNA *ptr) +{ + ShrinkWrapCacheModifier *smd = ptr->data; + ParticleSystem *psys = smd->object ? BLI_findlink(&smd->object->particlesystem, smd->hair_system) : NULL; + PointerRNA value; + + RNA_pointer_create(ptr->id.data, &RNA_ParticleSystem, psys, &value); + return value; +} + +static void rna_ShrinkWrapCacheModifier_hair_system_set(PointerRNA *ptr, PointerRNA value) +{ + ShrinkWrapCacheModifier *smd = ptr->data; + ParticleSystem *psys = value.data; + smd->hair_system = smd->object ? BLI_findindex(&smd->object->particlesystem, psys) : -1; +} + +static int rna_ShrinkWrapCacheModifier_hair_system_poll(PointerRNA *ptr, PointerRNA value) +{ + ShrinkWrapCacheModifier *smd = ptr->data; + ParticleSystem *psys = value.data; + + if (!smd->object) + return false; + if (BLI_findindex(&smd->object->particlesystem, psys) == -1) + return false; + if (!psys->part || psys->part->type != PART_HAIR) + return false; + return true; +} + +static PointerRNA rna_StrandsKeyCacheModifier_hair_system_get(PointerRNA *ptr) +{ + StrandsKeyCacheModifier *skmd = ptr->data; + ParticleSystem *psys = skmd->object ? BLI_findlink(&skmd->object->particlesystem, skmd->hair_system) : NULL; + PointerRNA value; + + RNA_pointer_create(ptr->id.data, &RNA_ParticleSystem, psys, &value); + return value; +} + +static void rna_StrandsKeyCacheModifier_hair_system_set(PointerRNA *ptr, PointerRNA value) +{ + StrandsKeyCacheModifier *skmd = ptr->data; + ParticleSystem *psys = value.data; + skmd->hair_system = skmd->object ? BLI_findindex(&skmd->object->particlesystem, psys) : -1; +} + +static int rna_StrandsKeyCacheModifier_hair_system_poll(PointerRNA *ptr, PointerRNA value) +{ + StrandsKeyCacheModifier *skmd = ptr->data; + ParticleSystem *psys = value.data; + + if (!skmd->object) + return false; + if (BLI_findindex(&skmd->object->particlesystem, psys) == -1) + return false; + if (!psys->part || psys->part->type != PART_HAIR) + return false; + return true; +} + +static void rna_StrandsKeyCacheModifier_active_shape_update(Main *bmain, Scene *scene, PointerRNA *ptr) +{ +#if 0 // TODO + StrandsKeyCacheModifier *skmd = ptr->data; + + if (scene->obedit == ob) { + /* exit/enter editmode to get new shape */ + switch (ob->type) { + case OB_MESH: + EDBM_mesh_load(ob); + EDBM_mesh_make(scene->toolsettings, ob); + EDBM_mesh_normals_update(((Mesh *)ob->data)->edit_btmesh); + BKE_editmesh_tessface_calc(((Mesh *)ob->data)->edit_btmesh); + break; + case OB_CURVE: + case OB_SURF: + load_editNurb(ob); + make_editNurb(ob); + break; + case OB_LATTICE: + load_editLatt(ob); + make_editLatt(ob); + break; + } + } +#endif + + rna_CacheModifier_update(bmain, scene, ptr); +} + +static void rna_StrandsKeyCacheModifier_active_shape_key_index_range(PointerRNA *ptr, int *min, int *max, int *UNUSED(softmin), int *UNUSED(softmax)) +{ + StrandsKeyCacheModifier *skmd = ptr->data; + Key *key = skmd->key; + + *min = 0; + if (key) { + *max = BLI_listbase_count(&key->block) - 1; + if (*max < 0) *max = 0; + } + else { + *max = 0; + } +} + +static int rna_StrandsKeyCacheModifier_active_shape_key_index_get(PointerRNA *ptr) +{ + StrandsKeyCacheModifier *skmd = ptr->data; + + return max_ii(skmd->shapenr - 1, 0); +} + +static void rna_StrandsKeyCacheModifier_active_shape_key_index_set(PointerRNA *ptr, int value) +{ + StrandsKeyCacheModifier *skmd = ptr->data; + + skmd->shapenr = value + 1; +} + +static PointerRNA rna_StrandsKeyCacheModifier_active_shape_key_get(PointerRNA *ptr) +{ + StrandsKeyCacheModifier *skmd = ptr->data; + Key *key = skmd->key; + KeyBlock *kb; + PointerRNA keyptr; + + if (key == NULL) + return PointerRNA_NULL; + + kb = BLI_findlink(&key->block, skmd->shapenr - 1); + RNA_pointer_create((ID *)key, &RNA_ShapeKey, kb, &keyptr); + return keyptr; +} + +static PointerRNA rna_HaircutCacheModifier_hair_system_get(PointerRNA *ptr) +{ + HaircutCacheModifier *hmd = ptr->data; + ParticleSystem *psys = hmd->object ? BLI_findlink(&hmd->object->particlesystem, hmd->hair_system) : NULL; + PointerRNA value; + + RNA_pointer_create(ptr->id.data, &RNA_ParticleSystem, psys, &value); + return value; +} + +static void rna_HaircutCacheModifier_hair_system_set(PointerRNA *ptr, PointerRNA value) +{ + HaircutCacheModifier *hmd = ptr->data; + ParticleSystem *psys = value.data; + hmd->hair_system = hmd->object ? BLI_findindex(&hmd->object->particlesystem, psys) : -1; +} + +static int rna_HaircutCacheModifier_hair_system_poll(PointerRNA *ptr, PointerRNA value) +{ + HaircutCacheModifier *hmd = ptr->data; + ParticleSystem *psys = value.data; + + if (!hmd->object) + return false; + if (BLI_findindex(&hmd->object->particlesystem, psys) == -1) + return false; + if (!psys->part || psys->part->type != PART_HAIR) + return false; + return true; +} + +static void rna_CacheArchiveInfoNode_bytes_size_get(PointerRNA *ptr, char *value) +{ + CacheArchiveInfoNode *node = ptr->data; + BLI_snprintf(value, MAX_NAME, "%lld", (long long int)node->bytes_size); +} + +static int rna_CacheArchiveInfoNode_bytes_size_length(PointerRNA *ptr) +{ + char buf[MAX_NAME]; + /* theoretically could do a dummy BLI_snprintf here, but BLI does not allow NULL buffer ... */ + CacheArchiveInfoNode *node = ptr->data; + return BLI_snprintf(buf, sizeof(buf), "%lld", (long long int)node->bytes_size); +} + +#else + +static void rna_def_hair_sim_params(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + + srna = RNA_def_struct(brna, "HairSimulationParameters", NULL); + RNA_def_struct_sdna(srna, "HairSimParams"); + RNA_def_struct_ui_text(srna, "Hair Simulation Parameters", "Simulation parameters for hair simulation"); + RNA_def_struct_ui_icon(srna, ICON_HAIR); + + prop = RNA_def_property(srna, "timescale", PROP_FLOAT, PROP_NONE); + RNA_def_property_range(prop, 0.0f, FLT_MAX); + RNA_def_property_ui_range(prop, 0.0f, 10.0f, 0.1f, 3); + RNA_def_property_ui_text(prop, "Time Scale", "Simulation time scale relative to scene time"); + RNA_def_property_update(prop, 0, "rna_CacheModifier_update"); + + prop = RNA_def_property(srna, "substeps", PROP_INT, PROP_NONE); + RNA_def_property_range(prop, 1, 80); + RNA_def_property_ui_text(prop, "Substeps", "Simulation steps per frame"); + RNA_def_property_update(prop, 0, "rna_CacheModifier_update"); + + prop = RNA_def_property(srna, "effector_weights", PROP_POINTER, PROP_NONE); + RNA_def_property_struct_type(prop, "EffectorWeights"); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Effector Weights", ""); + + prop = RNA_def_property(srna, "mass", PROP_FLOAT, PROP_NONE); + RNA_def_property_range(prop, 0.0f, 10.0f); + RNA_def_property_ui_text(prop, "Mass", "Mass of hair vertices"); + RNA_def_property_update(prop, 0, "rna_CacheModifier_update"); + + prop = RNA_def_property(srna, "drag", PROP_FLOAT, PROP_NONE); + RNA_def_property_range(prop, 0.0f, FLT_MAX); + RNA_def_property_ui_range(prop, 0.0f, 10.0f, 0.1f, 3); + RNA_def_property_ui_text(prop, "Drag", "Drag simulating friction with surrounding air"); + RNA_def_property_update(prop, 0, "rna_CacheModifier_update"); + + prop = RNA_def_property(srna, "goal_stiffness", PROP_FLOAT, PROP_NONE); + RNA_def_property_range(prop, 0.0f, FLT_MAX); + RNA_def_property_ui_range(prop, 0.0f, 10.0f, 0.1f, 3); + RNA_def_property_float_default(prop, 0.0f); + RNA_def_property_ui_text(prop, "Goal Strength", "Goal spring, pulling vertices toward their rest position"); + RNA_def_property_update(prop, 0, "rna_CacheModifier_update"); + + prop = RNA_def_property(srna, "goal_damping", PROP_FLOAT, PROP_FACTOR); + RNA_def_property_range(prop, 0.0f, FLT_MAX); + RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1f, 3); + RNA_def_property_float_default(prop, 1.0f); + RNA_def_property_ui_text(prop, "Goal Damping", "Damping factor of goal springs"); + RNA_def_property_update(prop, 0, "rna_CacheModifier_update"); + + prop = RNA_def_property(srna, "use_goal_stiffness_curve", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", eHairSimParams_Flag_UseGoalStiffnessCurve); + RNA_def_property_ui_text(prop, "Use Goal Stiffness Curve", "Use a curve to define goal stiffness along the strand"); + RNA_def_property_update(prop, 0, "rna_CacheModifier_update"); + + prop = RNA_def_property(srna, "goal_stiffness_curve", PROP_POINTER, PROP_NONE); + RNA_def_property_pointer_sdna(prop, NULL, "goal_stiffness_mapping"); + RNA_def_property_struct_type(prop, "CurveMapping"); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Goal Stiffness Curve", "Stiffness of goal springs along the strand curves"); + RNA_def_property_update(prop, 0, "rna_CacheModifier_update"); + + prop = RNA_def_property(srna, "use_goal_deflect", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", eHairSimParams_Flag_UseGoalDeflect); + RNA_def_property_ui_text(prop, "Use Goal Deflect", "Disable goal springs inside deflectors, to avoid unstable deformations"); + RNA_def_property_update(prop, 0, "rna_CacheModifier_update"); + + prop = RNA_def_property(srna, "use_bend_stiffness_curve", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", eHairSimParams_Flag_UseBendStiffnessCurve); + RNA_def_property_ui_text(prop, "Use Bend Stiffness Curve", "Use a curve to define bend resistance along the strand"); + RNA_def_property_update(prop, 0, "rna_CacheModifier_update"); + + prop = RNA_def_property(srna, "bend_stiffness_curve", PROP_POINTER, PROP_NONE); + RNA_def_property_pointer_sdna(prop, NULL, "bend_stiffness_mapping"); + RNA_def_property_struct_type(prop, "CurveMapping"); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Bend Stiffness Curve", "Resistance to bending along the strand curves"); + RNA_def_property_update(prop, 0, "rna_CacheModifier_update"); + + prop = RNA_def_property(srna, "stretch_stiffness", PROP_FLOAT, PROP_NONE); + RNA_def_property_range(prop, 0.0f, FLT_MAX); + RNA_def_property_ui_range(prop, 0.0f, 10000.0f, 0.1f, 3); + RNA_def_property_float_default(prop, 10000.0f); + RNA_def_property_ui_text(prop, "Stretch Stiffness", "Resistance to stretching"); + RNA_def_property_update(prop, 0, "rna_CacheModifier_update"); + + prop = RNA_def_property(srna, "stretch_damping", PROP_FLOAT, PROP_FACTOR); + RNA_def_property_range(prop, 0.0f, FLT_MAX); + RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1f, 3); + RNA_def_property_float_default(prop, 0.1f); + RNA_def_property_ui_text(prop, "Stretch Damping", "Damping factor of stretch springs"); + RNA_def_property_update(prop, 0, "rna_CacheModifier_update"); + + prop = RNA_def_property(srna, "bend_stiffness", PROP_FLOAT, PROP_NONE); + RNA_def_property_range(prop, 0.0f, FLT_MAX); + RNA_def_property_ui_range(prop, 0.0f, 1000.0f, 0.1f, 3); + RNA_def_property_float_default(prop, 100.0f); + RNA_def_property_ui_text(prop, "Bend Stiffness", "Resistance to bending of the rest shape"); + RNA_def_property_update(prop, 0, "rna_CacheModifier_update"); + + prop = RNA_def_property(srna, "bend_damping", PROP_FLOAT, PROP_FACTOR); + RNA_def_property_range(prop, 0.0f, FLT_MAX); + RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1f, 3); + RNA_def_property_float_default(prop, 1.0f); + RNA_def_property_ui_text(prop, "Bend Damping", "Damping factor of bending springs"); + RNA_def_property_update(prop, 0, "rna_CacheModifier_update"); +} + +static void rna_def_cache_modifier_hair_simulation(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + + rna_def_hair_sim_params(brna); + + srna = RNA_def_struct(brna, "HairSimulationCacheModifier", "CacheLibraryModifier"); + RNA_def_struct_sdna(srna, "HairSimCacheModifier"); + RNA_def_struct_ui_text(srna, "Hair Simulation Cache Modifier", "Apply hair dynamics simulation to the cache"); + RNA_def_struct_ui_icon(srna, ICON_HAIR); + + prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE); + RNA_def_property_pointer_sdna(prop, NULL, "object"); + RNA_def_property_struct_type(prop, "Object"); + RNA_def_property_pointer_funcs(prop, NULL, NULL, NULL, "rna_CacheLibraryModifier_hair_object_poll"); + RNA_def_property_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Object", "Object whose cache to simulate"); + RNA_def_property_update(prop, 0, "rna_CacheModifier_update"); + + prop = RNA_def_property(srna, "hair_system_index", PROP_INT, PROP_NONE); + RNA_def_property_int_sdna(prop, NULL, "hair_system"); + RNA_def_property_ui_text(prop, "Hair System Index", "Hair system cache to simulate"); + RNA_def_property_update(prop, 0, "rna_CacheModifier_update"); + + prop = RNA_def_property(srna, "hair_system", PROP_POINTER, PROP_NONE); + RNA_def_property_pointer_funcs(prop, "rna_HairSimulationCacheModifier_hair_system_get", "rna_HairSimulationCacheModifier_hair_system_set", NULL, "rna_HairSimulationCacheModifier_hair_system_poll"); + RNA_def_property_struct_type(prop, "ParticleSystem"); + RNA_def_property_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Hair System", "Hair system cache to simulate"); + RNA_def_property_update(prop, 0, "rna_CacheModifier_update"); + + prop = RNA_def_property(srna, "parameters", PROP_POINTER, PROP_NONE); + RNA_def_property_pointer_sdna(prop, NULL, "sim_params"); + RNA_def_property_struct_type(prop, "HairSimulationParameters"); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Simulation Parameters", "Parameters of the simulation"); +} + +static void rna_def_cache_modifier_force_field(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + + static EnumPropertyItem force_type_items[] = { + {eForceFieldCacheModifier_Type_Deflect, "DEFLECT", ICON_FORCE_FORCE, "Deflect", "Push away from the surface"}, + {eForceFieldCacheModifier_Type_Drag, "DRAG", ICON_FORCE_DRAG, "Drag", "Adjust velocity to the surface"}, + {0, NULL, 0, NULL, NULL} + }; + + srna = RNA_def_struct(brna, "ForceFieldCacheModifier", "CacheLibraryModifier"); + RNA_def_struct_sdna(srna, "ForceFieldCacheModifier"); + RNA_def_struct_ui_text(srna, "Force Field Cache Modifier", "Use an object as a force field"); + RNA_def_struct_ui_icon(srna, ICON_FORCE_FORCE); + + prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE); + RNA_def_property_pointer_sdna(prop, NULL, "object"); + RNA_def_property_struct_type(prop, "Object"); + RNA_def_property_pointer_funcs(prop, NULL, NULL, NULL, "rna_CacheLibraryModifier_mesh_object_poll"); + RNA_def_property_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Object", "Object whose cache to simulate"); + RNA_def_property_update(prop, 0, "rna_CacheModifier_update"); + + prop = RNA_def_property(srna, "force_type", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "type"); + RNA_def_property_enum_items(prop, force_type_items); + RNA_def_property_ui_text(prop, "Force Type", "Type of force field"); + + prop = RNA_def_property(srna, "strength", PROP_FLOAT, PROP_NONE); + RNA_def_property_range(prop, -FLT_MAX, FLT_MAX); + RNA_def_property_ui_range(prop, -10000.0f, 10000.0f, 0.1, 3); + RNA_def_property_ui_text(prop, "Strength", ""); + RNA_def_property_update(prop, 0, "rna_CacheModifier_update"); + + prop = RNA_def_property(srna, "falloff", PROP_FLOAT, PROP_NONE); + RNA_def_property_range(prop, 0.0f, FLT_MAX); + RNA_def_property_ui_range(prop, 0.0f, 10.0f, 0.1, 3); + RNA_def_property_ui_text(prop, "Falloff", ""); + RNA_def_property_update(prop, 0, "rna_CacheModifier_update"); + + prop = RNA_def_property(srna, "min_distance", PROP_FLOAT, PROP_DISTANCE); + RNA_def_property_range(prop, -FLT_MAX, FLT_MAX); + RNA_def_property_ui_range(prop, -100.0f, 100.0f, 0.1, 4); + RNA_def_property_ui_text(prop, "Minimum Distance", ""); + RNA_def_property_update(prop, 0, "rna_CacheModifier_update"); + + prop = RNA_def_property(srna, "max_distance", PROP_FLOAT, PROP_DISTANCE); + RNA_def_property_range(prop, -FLT_MAX, FLT_MAX); + RNA_def_property_ui_range(prop, -100.0f, 100.0f, 0.1, 4); + RNA_def_property_ui_text(prop, "Maximum Distance", ""); + RNA_def_property_update(prop, 0, "rna_CacheModifier_update"); + + prop = RNA_def_property(srna, "use_double_sided", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", eForceFieldCacheModifier_Flag_DoubleSided); + RNA_def_property_ui_text(prop, "Use Double Sided", ""); + RNA_def_property_update(prop, 0, "rna_CacheModifier_update"); +} + +static void rna_def_cache_modifier_shrink_wrap(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + + srna = RNA_def_struct(brna, "ShrinkWrapCacheModifier", "CacheLibraryModifier"); + RNA_def_struct_sdna(srna, "ShrinkWrapCacheModifier"); + RNA_def_struct_ui_text(srna, "Shrink Wrap Cache Modifier", ""); + RNA_def_struct_ui_icon(srna, ICON_HAIR); + + prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE); + RNA_def_property_pointer_sdna(prop, NULL, "object"); + RNA_def_property_struct_type(prop, "Object"); + RNA_def_property_pointer_funcs(prop, NULL, NULL, NULL, "rna_CacheLibraryModifier_hair_object_poll"); + RNA_def_property_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Object", "Object whose cache to simulate"); + RNA_def_property_update(prop, 0, "rna_CacheModifier_update"); + + prop = RNA_def_property(srna, "hair_system_index", PROP_INT, PROP_NONE); + RNA_def_property_int_sdna(prop, NULL, "hair_system"); + RNA_def_property_ui_text(prop, "Hair System Index", "Hair system cache to simulate"); + RNA_def_property_update(prop, 0, "rna_CacheModifier_update"); + + prop = RNA_def_property(srna, "hair_system", PROP_POINTER, PROP_NONE); + RNA_def_property_pointer_funcs(prop, "rna_ShrinkWrapCacheModifier_hair_system_get", "rna_ShrinkWrapCacheModifier_hair_system_set", NULL, "rna_ShrinkWrapCacheModifier_hair_system_poll"); + RNA_def_property_struct_type(prop, "ParticleSystem"); + RNA_def_property_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Hair System", "Hair system cache to simulate"); + RNA_def_property_update(prop, 0, "rna_CacheModifier_update"); + + prop = RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE); + RNA_def_property_pointer_sdna(prop, NULL, "target"); + RNA_def_property_struct_type(prop, "Object"); + RNA_def_property_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Target", "Mesh object to wrap onto"); + RNA_def_property_update(prop, 0, "rna_CacheModifier_update"); + + prop = RNA_def_property(srna, "use_internal_target", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", eShrinkWrapCacheModifier_Flag_InternalTarget); + RNA_def_property_ui_text(prop, "Use Internal Target", "Use a cached object from the group instead of an object in the scene"); + RNA_def_property_update(prop, 0, "rna_CacheModifier_update"); +} + +static void rna_def_cache_modifier_strands_key(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + + srna = RNA_def_struct(brna, "StrandsKeyCacheModifier", "CacheLibraryModifier"); + RNA_def_struct_sdna(srna, "StrandsKeyCacheModifier"); + RNA_def_struct_ui_text(srna, "Strands Key Cache Modifier", ""); + RNA_def_struct_ui_icon(srna, ICON_SHAPEKEY_DATA); + + prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE); + RNA_def_property_pointer_sdna(prop, NULL, "object"); + RNA_def_property_struct_type(prop, "Object"); + RNA_def_property_pointer_funcs(prop, NULL, NULL, NULL, "rna_CacheLibraryModifier_hair_object_poll"); + RNA_def_property_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Object", "Object whose cache to simulate"); + RNA_def_property_update(prop, 0, "rna_CacheModifier_update"); + + prop = RNA_def_property(srna, "hair_system_index", PROP_INT, PROP_NONE); + RNA_def_property_int_sdna(prop, NULL, "hair_system"); + RNA_def_property_ui_text(prop, "Hair System Index", "Hair system cache to simulate"); + RNA_def_property_update(prop, 0, "rna_CacheModifier_update"); + + prop = RNA_def_property(srna, "hair_system", PROP_POINTER, PROP_NONE); + RNA_def_property_pointer_funcs(prop, "rna_StrandsKeyCacheModifier_hair_system_get", "rna_StrandsKeyCacheModifier_hair_system_set", NULL, "rna_StrandsKeyCacheModifier_hair_system_poll"); + RNA_def_property_struct_type(prop, "ParticleSystem"); + RNA_def_property_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Hair System", "Hair system cache to simulate"); + RNA_def_property_update(prop, 0, "rna_CacheModifier_update"); + + /* shape keys */ + prop = RNA_def_property(srna, "shape_keys", PROP_POINTER, PROP_NONE); + RNA_def_property_pointer_sdna(prop, NULL, "key"); + RNA_def_property_ui_text(prop, "Shape Keys", ""); + + prop = RNA_def_property(srna, "use_motion_state", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", eStrandsKeyCacheModifier_Flag_UseMotionState); + RNA_def_property_ui_text(prop, "Use Motion State", "Apply the shape key to the motion state instead of the base shape"); + RNA_def_property_update(prop, 0, "rna_CacheModifier_update"); + + prop = RNA_def_property(srna, "show_only_shape_key", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", eStrandsKeyCacheModifier_Flag_ShapeLock); + RNA_def_property_ui_text(prop, "Shape Key Lock", "Always show the current Shape for this Object"); + RNA_def_property_ui_icon(prop, ICON_UNPINNED, 1); + RNA_def_property_update(prop, 0, "rna_CacheModifier_update"); + + prop = RNA_def_property(srna, "active_shape_key", PROP_POINTER, PROP_NONE); + RNA_def_property_struct_type(prop, "ShapeKey"); + RNA_def_property_pointer_funcs(prop, "rna_StrandsKeyCacheModifier_active_shape_key_get", NULL, NULL, NULL); + RNA_def_property_ui_text(prop, "Active Shape Key", "Current shape key"); + + prop = RNA_def_property(srna, "active_shape_key_index", PROP_INT, PROP_NONE); + RNA_def_property_int_sdna(prop, NULL, "shapenr"); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); /* XXX this is really unpredictable... */ + RNA_def_property_int_funcs(prop, "rna_StrandsKeyCacheModifier_active_shape_key_index_get", "rna_StrandsKeyCacheModifier_active_shape_key_index_set", + "rna_StrandsKeyCacheModifier_active_shape_key_index_range"); + RNA_def_property_ui_text(prop, "Active Shape Key Index", "Current shape key index"); + RNA_def_property_update(prop, 0, "rna_StrandsKeyCacheModifier_active_shape_update"); +} + +static void rna_def_cache_modifier_haircut(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + + static EnumPropertyItem cut_mode_items[] = { + {eHaircutCacheModifier_CutMode_Enter, "ENTER", 0, "Enter", "Cut strands when entering the target mesh"}, + {eHaircutCacheModifier_CutMode_Exit, "EXIT", 0, "Exit", "Cut strands when exiting the target mesh"}, + {0, NULL, 0, NULL, NULL} + }; + + srna = RNA_def_struct(brna, "HaircutCacheModifier", "CacheLibraryModifier"); + RNA_def_struct_sdna(srna, "HaircutCacheModifier"); + RNA_def_struct_ui_text(srna, "Hair Cut Cache Modifier", ""); + RNA_def_struct_ui_icon(srna, ICON_HAIR); + + prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE); + RNA_def_property_pointer_sdna(prop, NULL, "object"); + RNA_def_property_struct_type(prop, "Object"); + RNA_def_property_pointer_funcs(prop, NULL, NULL, NULL, "rna_CacheLibraryModifier_hair_object_poll"); + RNA_def_property_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Object", "Object whose cache to simulate"); + RNA_def_property_update(prop, 0, "rna_CacheModifier_update"); + + prop = RNA_def_property(srna, "hair_system_index", PROP_INT, PROP_NONE); + RNA_def_property_int_sdna(prop, NULL, "hair_system"); + RNA_def_property_ui_text(prop, "Hair System Index", "Hair system cache to simulate"); + RNA_def_property_update(prop, 0, "rna_CacheModifier_update"); + + prop = RNA_def_property(srna, "hair_system", PROP_POINTER, PROP_NONE); + RNA_def_property_pointer_funcs(prop, "rna_HaircutCacheModifier_hair_system_get", "rna_HaircutCacheModifier_hair_system_set", NULL, "rna_HaircutCacheModifier_hair_system_poll"); + RNA_def_property_struct_type(prop, "ParticleSystem"); + RNA_def_property_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Hair System", "Hair system cache to simulate"); + RNA_def_property_update(prop, 0, "rna_CacheModifier_update"); + + prop = RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE); + RNA_def_property_pointer_sdna(prop, NULL, "target"); + RNA_def_property_struct_type(prop, "Object"); + RNA_def_property_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Target", "Mesh object to wrap onto"); + RNA_def_property_update(prop, 0, "rna_CacheModifier_update"); + + prop = RNA_def_property(srna, "use_internal_target", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", eHaircutCacheModifier_Flag_InternalTarget); + RNA_def_property_ui_text(prop, "Use Internal Target", "Use a cached object from the group instead of an object in the scene"); + RNA_def_property_update(prop, 0, "rna_CacheModifier_update"); + + prop = RNA_def_property(srna, "cut_mode", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "cut_mode"); + RNA_def_property_enum_items(prop, cut_mode_items); + RNA_def_property_flag(prop, PROP_ENUM_FLAG); + RNA_def_property_ui_text(prop, "Cut Mode", "When to cut strands with the target"); + RNA_def_property_update(prop, 0, "rna_CacheModifier_update"); +} + +static void rna_def_cache_modifier(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + + srna = RNA_def_struct(brna, "CacheLibraryModifier", NULL); + RNA_def_struct_sdna(srna, "CacheModifier"); + RNA_def_struct_path_func(srna, "rna_CacheLibraryModifier_path"); + RNA_def_struct_refine_func(srna, "rna_CacheModifier_refine"); + RNA_def_struct_ui_text(srna, "Cache Modifier", "Cache Modifier"); + RNA_def_struct_ui_icon(srna, ICON_PHYSICS); + + prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "type"); + RNA_def_property_enum_items(prop, cache_modifier_type_items); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Type", "Type of the cache modifier"); + + prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE); + RNA_def_property_string_funcs(prop, NULL, NULL, "rna_CacheLibraryModifier_name_set"); + RNA_def_property_ui_text(prop, "Name", "Modifier name"); + RNA_def_property_update(prop, NC_ID | NA_RENAME, NULL); + RNA_def_struct_name_property(srna, prop); + + rna_def_cache_modifier_hair_simulation(brna); + rna_def_cache_modifier_force_field(brna); + rna_def_cache_modifier_shrink_wrap(brna); + rna_def_cache_modifier_strands_key(brna); + rna_def_cache_modifier_haircut(brna); +} + +static void rna_def_cache_library_modifiers(BlenderRNA *brna, PropertyRNA *cprop) +{ + StructRNA *srna; + FunctionRNA *func; + PropertyRNA *parm; + + RNA_def_property_srna(cprop, "CacheLibraryModifiers"); + srna = RNA_def_struct(brna, "CacheLibraryModifiers", NULL); + RNA_def_struct_sdna(srna, "CacheLibrary"); + RNA_def_struct_ui_text(srna, "Cache Modifiers", "Collection of cache modifiers"); + + /* add modifier */ + func = RNA_def_function(srna, "new", "rna_CacheLibrary_modifier_new"); + RNA_def_function_flag(func, FUNC_USE_CONTEXT | FUNC_USE_REPORTS); + RNA_def_function_ui_description(func, "Add a new modifier"); + parm = RNA_def_string(func, "name", "Name", 0, "", "New name for the modifier"); + RNA_def_property_flag(parm, PROP_REQUIRED); + /* modifier to add */ + parm = RNA_def_enum(func, "type", cache_modifier_type_items, 1, "", "Modifier type to add"); + RNA_def_property_flag(parm, PROP_REQUIRED); + /* return type */ + parm = RNA_def_pointer(func, "modifier", "CacheLibraryModifier", "", "Newly created modifier"); + RNA_def_function_return(func, parm); + + /* remove modifier */ + func = RNA_def_function(srna, "remove", "rna_CacheLibrary_modifier_remove"); + RNA_def_function_flag(func, FUNC_USE_CONTEXT | FUNC_USE_REPORTS); + RNA_def_function_ui_description(func, "Remove an existing modifier"); + /* modifier to remove */ + parm = RNA_def_pointer(func, "modifier", "CacheLibraryModifier", "", "Modifier to remove"); + RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL | PROP_RNAPTR); + RNA_def_property_clear_flag(parm, PROP_THICK_WRAP); + + /* clear all modifiers */ + func = RNA_def_function(srna, "clear", "rna_CacheLibrary_modifier_clear"); + RNA_def_function_flag(func, FUNC_USE_CONTEXT); + RNA_def_function_ui_description(func, "Remove all modifiers"); +} + +static void rna_def_cache_library(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + + static EnumPropertyItem source_mode_items[] = { + {CACHE_LIBRARY_SOURCE_SCENE, "SCENE", 0, "Scene", "Use generated scene data as source"}, + {CACHE_LIBRARY_SOURCE_CACHE, "CACHE", 0, "Cache", "Use cache data as source"}, + {0, NULL, 0, NULL, NULL} + }; + + static EnumPropertyItem display_mode_items[] = { + {CACHE_LIBRARY_DISPLAY_SOURCE, "SOURCE", 0, "Source", "Display source data unmodified"}, + {CACHE_LIBRARY_DISPLAY_MODIFIERS, "MODIFIERS", 0, "Modifiers", "Display source data with modifiers applied"}, + {CACHE_LIBRARY_DISPLAY_RESULT, "RESULT", 0, "Result", "Display resulting data"}, + {0, NULL, 0, NULL, NULL} + }; + + srna = RNA_def_struct(brna, "CacheLibrary", "ID"); + RNA_def_struct_ui_text(srna, "Cache Library", "Cache Library datablock for constructing an archive of caches"); + RNA_def_struct_ui_icon(srna, ICON_PHYSICS); + + prop = RNA_def_property(srna, "input_filepath", PROP_STRING, PROP_FILEPATH); + RNA_def_property_string_sdna(prop, NULL, "input_filepath"); + RNA_def_property_ui_text(prop, "Input File Path", "Path to a cache archive for reading input"); + RNA_def_property_update(prop, 0, "rna_CacheLibrary_update"); + + prop = RNA_def_property(srna, "output_filepath", PROP_STRING, PROP_FILEPATH); + RNA_def_property_string_sdna(prop, NULL, "output_filepath"); + RNA_def_property_ui_text(prop, "Output File Path", "Path where cache output is written"); + RNA_def_property_update(prop, 0, "rna_CacheLibrary_update"); + + prop = RNA_def_property(srna, "source_mode", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "source_mode"); + RNA_def_property_enum_items(prop, source_mode_items); + RNA_def_property_ui_text(prop, "Source Mode", "Source of the cache library data"); + RNA_def_property_update(prop, 0, "rna_CacheLibrary_update"); + + prop = RNA_def_property(srna, "display_mode", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "display_mode"); + RNA_def_property_enum_items(prop, display_mode_items); + RNA_def_property_ui_text(prop, "Display Mode", "What data to display in the viewport"); + RNA_def_property_update(prop, 0, "rna_CacheLibrary_update"); + + prop = RNA_def_property(srna, "display_motion", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "display_flag", CACHE_LIBRARY_DISPLAY_MOTION); + RNA_def_property_ui_text(prop, "Display Motion", "Display motion state result from simulation, if available"); + RNA_def_property_update(prop, 0, "rna_CacheLibrary_update"); + + prop = RNA_def_property(srna, "display_children", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "display_flag", CACHE_LIBRARY_DISPLAY_CHILDREN); + RNA_def_property_ui_text(prop, "Display Children", "Display child strands, if available"); + RNA_def_property_update(prop, 0, "rna_CacheLibrary_update"); + + prop = RNA_def_property(srna, "data_types", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "data_types"); + RNA_def_property_enum_items(prop, cache_library_data_type_items); + RNA_def_property_flag(prop, PROP_ENUM_FLAG); + RNA_def_property_ui_text(prop, "Data Types", "Types of data to store in the cache"); + + prop = RNA_def_property(srna, "filter_group", PROP_POINTER, PROP_NONE); + RNA_def_property_pointer_sdna(prop, NULL, "filter_group"); + RNA_def_property_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Filter Group", "If set, only objects in this group will be cached"); + + prop = RNA_def_property(srna, "description", PROP_STRING, PROP_NONE); + RNA_def_property_ui_text(prop, "Description", "Description of the output archive"); + + /* modifiers */ + prop = RNA_def_property(srna, "modifiers", PROP_COLLECTION, PROP_NONE); + RNA_def_property_struct_type(prop, "CacheLibraryModifier"); + RNA_def_property_ui_text(prop, "Modifiers", "Modifiers applying to the cached data"); + rna_def_cache_library_modifiers(brna, prop); + + prop = RNA_def_property(srna, "archive_info", PROP_POINTER, PROP_NONE); + RNA_def_property_struct_type(prop, "CacheArchiveInfo"); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Archive Info", "Information about structure and contents of the archive"); +} + +static void rna_def_cache_archive_info_node(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + + static EnumPropertyItem type_items[] = { + {eCacheArchiveInfoNode_Type_Object, "OBJECT", 0, "Object", "Structural object node forming the hierarchy"}, + {eCacheArchiveInfoNode_Type_ScalarProperty, "SCALAR_PROPERTY", 0, "Scalar Property", "Property with a single value per sample"}, + {eCacheArchiveInfoNode_Type_ArrayProperty, "ARRAY_PROPERTY", 0, "Array Property", "Array property with an arbitrary number of values per sample"}, + {eCacheArchiveInfoNode_Type_CompoundProperty, "COMPOUND_PROPERTY", 0, "Compound Property", "Compound property containing other properties"}, + {0, NULL, 0, NULL, NULL} + }; + + srna = RNA_def_struct(brna, "CacheArchiveInfoNode", NULL); + RNA_def_struct_ui_text(srna, "Cache Archive Info Node", "Node in the structure of a cache archive"); + + prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_items(prop, type_items); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Type", "Type of archive node"); + + prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Name", "Name of the archive node"); + RNA_def_struct_name_property(srna, prop); + + prop = RNA_def_property(srna, "child_nodes", PROP_COLLECTION, PROP_NONE); + RNA_def_property_struct_type(prop, "CacheArchiveInfoNode"); + RNA_def_property_ui_text(prop, "Child Nodes", "Nested archive nodes"); + + prop = RNA_def_property(srna, "expand", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", eCacheArchiveInfoNode_Flag_Expand); + RNA_def_property_ui_text(prop, "Expand", "Show contents of the node"); + RNA_def_property_update(prop, 0, "rna_CacheArchiveInfo_update"); + + /* XXX this is a 64bit integer, not supported nicely by RNA, + * but string encoding is sufficient for feedback + */ + prop = RNA_def_property(srna, "bytes_size", PROP_STRING, PROP_NONE); + RNA_def_property_string_funcs(prop, "rna_CacheArchiveInfoNode_bytes_size_get", "rna_CacheArchiveInfoNode_bytes_size_length", NULL); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Bytes Size", "Overall size of the node data in bytes"); + + prop = RNA_def_property(srna, "datatype", PROP_STRING, PROP_NONE); + RNA_def_property_string_sdna(prop, NULL, "datatype_name"); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Datatype", "Type of values stored in the property"); + + prop = RNA_def_property(srna, "datatype_extent", PROP_INT, PROP_NONE); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Datatype Extent", "Array extent of a single data element"); + + prop = RNA_def_property(srna, "samples", PROP_INT, PROP_NONE); + RNA_def_property_int_sdna(prop, NULL, "num_samples"); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Samples", "Number of samples stored for the property"); + + prop = RNA_def_property(srna, "array_size", PROP_INT, PROP_NONE); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Array Size", "Maximum array size for any sample of the property"); +} + +static void rna_def_cache_archive_info(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + + srna = RNA_def_struct(brna, "CacheArchiveInfo", NULL); + RNA_def_struct_ui_text(srna, "Cache Archive Info", "Information about structure and contents of a cache file"); + + prop = RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "File Path", "Path to the cache archive"); + + prop = RNA_def_property(srna, "app_name", PROP_STRING, PROP_NONE); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Application", "Name of the application that created the archive"); + + prop = RNA_def_property(srna, "date_written", PROP_STRING, PROP_NONE); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Date", "Date and time when the archive was created"); + + prop = RNA_def_property(srna, "description", PROP_STRING, PROP_NONE); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Description", "Description of the archive"); + + prop = RNA_def_property(srna, "root_node", PROP_POINTER, PROP_NONE); + RNA_def_property_struct_type(prop, "CacheArchiveInfoNode"); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Root Node", "Root node of the archive"); +} + +void RNA_def_cache_library(BlenderRNA *brna) +{ + rna_def_cache_modifier(brna); + rna_def_cache_library(brna); + rna_def_cache_archive_info_node(brna); + rna_def_cache_archive_info(brna); +} + +#endif diff --git a/source/blender/makesrna/intern/rna_camera.c b/source/blender/makesrna/intern/rna_camera.c index 31e991dd2b6..16f74a05f7b 100644 --- a/source/blender/makesrna/intern/rna_camera.c +++ b/source/blender/makesrna/intern/rna_camera.c @@ -87,8 +87,74 @@ static void rna_Camera_update(Main *UNUSED(bmain), Scene *UNUSED(scene), Pointer DAG_id_tag_update(&camera->id, 0); } +static void rna_Camera_dependency_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr) +{ + Camera *camera = (Camera *)ptr->id.data; + DAG_relations_tag_update(bmain); + DAG_id_tag_update(&camera->id, 0); +} + #else +static void rna_def_camera_stereo_data(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + + static EnumPropertyItem convergence_mode_items[] = { + {CAM_S3D_OFFAXIS, "OFFAXIS", 0, "Off-Axis", "Off-axis frustums converging in a plane"}, + {CAM_S3D_PARALLEL, "PARALLEL", 0, "Parallel", "Parallel cameras with no convergence"}, + {CAM_S3D_TOE, "TOE", 0, "Toe-in", "Rotated cameras, looking at the convergence distance"}, + {0, NULL, 0, NULL, NULL} + }; + + static EnumPropertyItem pivot_items[] = { + {CAM_S3D_PIVOT_LEFT, "LEFT", 0, "Left", ""}, + {CAM_S3D_PIVOT_RIGHT, "RIGHT", 0, "Right", ""}, + {CAM_S3D_PIVOT_CENTER, "CENTER", 0, "Center", ""}, + {0, NULL, 0, NULL, NULL} + }; + + srna = RNA_def_struct(brna, "CameraStereoData", NULL); + RNA_def_struct_sdna(srna, "CameraStereoSettings"); + RNA_def_struct_nested(brna, srna, "Camera"); + RNA_def_struct_ui_text(srna, "Stereo", "Stereoscopy settings for a Camera datablock"); + + prop = RNA_def_property(srna, "convergence_mode", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_items(prop, convergence_mode_items); + RNA_def_property_ui_text(prop, "Mode", ""); + RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL); + + prop = RNA_def_property(srna, "pivot", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_items(prop, pivot_items); + RNA_def_property_ui_text(prop, "Pivot", ""); + RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL); + + prop = RNA_def_property(srna, "interocular_distance", PROP_FLOAT, PROP_DISTANCE); + RNA_def_property_range(prop, 0.0f, 100.0f); + RNA_def_property_ui_range(prop, 0.0f, 1.f, 1, 2); + RNA_def_property_ui_text(prop, "Interocular Distance", + "Set the distance between the eyes - the stereo plane distance / 30 should be fine"); + RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL); + + prop = RNA_def_property(srna, "convergence_distance", PROP_FLOAT, PROP_DISTANCE); + RNA_def_property_range(prop, 0.00001f, FLT_MAX); + RNA_def_property_ui_range(prop, 0.0f, 15.f, 1, 2); + RNA_def_property_ui_text(prop, "Convergence Plane Distance", + "The converge point for the stereo cameras " + "(often the distance between a projector and the projection screen)"); + RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL); + + prop = RNA_def_property(srna, "viewport_convergence", PROP_FLOAT, PROP_DISTANCE); + RNA_def_property_float_sdna(prop, NULL, "convergence_distance"); + RNA_def_property_range(prop, 0.00001f, FLT_MAX); + RNA_def_property_ui_range(prop, 0.0f, 15.f, 1, 2); + RNA_def_property_ui_text(prop, "Viewport Convergence", + "Preview convergence distance for the stereo effect in the viewport " + "(it does not affect the render!)"); + RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL); +} + void RNA_def_camera(BlenderRNA *brna) { StructRNA *srna; @@ -241,6 +307,13 @@ void RNA_def_camera(BlenderRNA *brna) RNA_def_property_ui_text(prop, "DOF Distance", "Distance to the focus point for depth of field"); RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL); + /* Stereo Settings */ + prop = RNA_def_property(srna, "stereo", PROP_POINTER, PROP_NONE); + RNA_def_property_flag(prop, PROP_NEVER_NULL); + RNA_def_property_pointer_sdna(prop, NULL, "stereo"); + RNA_def_property_struct_type(prop, "CameraStereoData"); + RNA_def_property_ui_text(prop, "Stereo", ""); + /* flag */ prop = RNA_def_property(srna, "show_limits", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", CAM_SHOWLIMITS); @@ -265,7 +338,8 @@ void RNA_def_camera(BlenderRNA *brna) prop = RNA_def_property(srna, "show_safe_center", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", CAM_SHOW_SAFE_CENTER); - RNA_def_property_ui_text(prop, "Show Center-cut safe areas", "Show safe areas to fit content in a different aspect ratio"); + RNA_def_property_ui_text(prop, "Show Center-cut safe areas", + "Show safe areas to fit content in a different aspect ratio"); RNA_def_property_update(prop, NC_CAMERA | ND_DRAW_RENDER_VIEWPORT, NULL); prop = RNA_def_property(srna, "show_name", PROP_BOOLEAN, PROP_NONE); @@ -289,7 +363,7 @@ void RNA_def_camera(BlenderRNA *brna) RNA_def_property_pointer_sdna(prop, NULL, "dof_ob"); RNA_def_property_flag(prop, PROP_EDITABLE); RNA_def_property_ui_text(prop, "DOF Object", "Use this object to define the depth of field focal point"); - RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL); + RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Camera_dependency_update"); prop = RNA_def_property(srna, "gpu_dof", PROP_POINTER, PROP_NONE); RNA_def_property_struct_type(prop, "GPUDOFSettings"); @@ -298,6 +372,12 @@ void RNA_def_camera(BlenderRNA *brna) rna_def_animdata_common(srna); + /* Nested Data */ + RNA_define_animate_sdna(true); + + /* *** Animated *** */ + rna_def_camera_stereo_data(brna); + /* Camera API */ RNA_api_camera(srna); } diff --git a/source/blender/makesrna/intern/rna_color.c b/source/blender/makesrna/intern/rna_color.c index 5e114a51ceb..8ea67a34fbb 100644 --- a/source/blender/makesrna/intern/rna_color.c +++ b/source/blender/makesrna/intern/rna_color.c @@ -447,6 +447,7 @@ static void rna_ColorManagedDisplaySettings_display_device_update(Main *UNUSED(b IMB_colormanagement_validate_settings(&scene->display_settings, &scene->view_settings); + DAG_id_tag_update(id, 0); WM_main_add_notifier(NC_SCENE | ND_SEQUENCER, NULL); } } @@ -619,10 +620,8 @@ static void rna_ColorManagedColorspaceSettings_reload_update(Main *UNUSED(bmain) } if (seq_found) { - if (seq->anim) { - IMB_free_anim(seq->anim); - seq->anim = NULL; - } + BKE_sequence_free_anim(seq); + if (seq->strip->proxy && seq->strip->proxy->anim) { IMB_free_anim(seq->strip->proxy->anim); seq->strip->proxy->anim = NULL; @@ -634,10 +633,7 @@ static void rna_ColorManagedColorspaceSettings_reload_update(Main *UNUSED(bmain) else { SEQ_BEGIN(scene->ed, seq); { - if (seq->anim) { - IMB_free_anim(seq->anim); - seq->anim = NULL; - } + BKE_sequence_free_anim(seq); } SEQ_END; @@ -677,7 +673,7 @@ static void rna_ColorManagement_update(Main *UNUSED(bmain), Scene *UNUSED(scene) static float rna_CurveMap_evaluateF(struct CurveMap *cuma, ReportList *reports, float value) { if (!cuma->table) { - BKE_reportf(reports, RPT_ERROR, "CurveMap table not initialized, call initialize() on CurveMapping owner of the CurveMap"); + BKE_report(reports, RPT_ERROR, "CurveMap table not initialized, call initialize() on CurveMapping owner of the CurveMap"); return 0.0f; } return curvemap_evaluateF(cuma, value); diff --git a/source/blender/makesrna/intern/rna_constraint.c b/source/blender/makesrna/intern/rna_constraint.c index aaacf07567e..abc489bb9b0 100644 --- a/source/blender/makesrna/intern/rna_constraint.c +++ b/source/blender/makesrna/intern/rna_constraint.c @@ -241,7 +241,7 @@ static void rna_Constraint_name_set(PointerRNA *ptr, const char *value) } /* fix all the animation data which may link to this */ - BKE_all_animdata_fix_paths_rename(NULL, "constraints", oldname, con->name); + BKE_animdata_fix_paths_rename_all(NULL, "constraints", oldname, con->name); } static char *rna_Constraint_path(PointerRNA *ptr) @@ -271,12 +271,12 @@ static char *rna_Constraint_path(PointerRNA *ptr) static void rna_Constraint_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) { - ED_object_constraint_update(ptr->id.data); + ED_object_constraint_tag_update(ptr->id.data, ptr->data); } static void rna_Constraint_dependency_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr) { - ED_object_constraint_dependency_update(bmain, ptr->id.data); + ED_object_constraint_dependency_tag_update(bmain, ptr->id.data, ptr->data); } static void rna_Constraint_influence_update(Main *bmain, Scene *scene, PointerRNA *ptr) @@ -323,7 +323,7 @@ static EnumPropertyItem *rna_Constraint_target_space_itemf(bContext *UNUSED(C), PropertyRNA *UNUSED(prop), bool *UNUSED(r_free)) { bConstraint *con = (bConstraint *)ptr->data; - bConstraintTypeInfo *cti = BKE_constraint_typeinfo_get(con); + const bConstraintTypeInfo *cti = BKE_constraint_typeinfo_get(con); ListBase targets = {NULL, NULL}; bConstraintTarget *ct; @@ -1357,7 +1357,8 @@ static void rna_def_constraint_stretch_to(BlenderRNA *brna) prop = RNA_def_property(srna, "rest_length", PROP_FLOAT, PROP_DISTANCE); RNA_def_property_float_sdna(prop, NULL, "orglength"); - RNA_def_property_range(prop, 0.0, 100.f); + RNA_def_property_range(prop, 0.0, 1000.f); + RNA_def_property_ui_range(prop, 0, 100.0f, 10, RNA_TRANSLATION_PREC_DEFAULT); RNA_def_property_ui_text(prop, "Original Length", "Length at rest position"); RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update"); diff --git a/source/blender/makesrna/intern/rna_context.c b/source/blender/makesrna/intern/rna_context.c index d7a679e9702..a512f1d750f 100644 --- a/source/blender/makesrna/intern/rna_context.c +++ b/source/blender/makesrna/intern/rna_context.c @@ -148,6 +148,7 @@ void RNA_def_context(BlenderRNA *brna) {CTX_MODE_PAINT_VERTEX, "PAINT_VERTEX", 0, "Vertex Paint", ""}, {CTX_MODE_PAINT_TEXTURE, "PAINT_TEXTURE", 0, "Texture Paint", ""}, {CTX_MODE_PARTICLE, "PARTICLE", 0, "Particle", ""}, + {CTX_MODE_HAIR, "HAIR", 0, "Hair", ""}, {CTX_MODE_OBJECT, "OBJECT", 0, "Object", ""}, {0, NULL, 0, NULL, NULL} }; diff --git a/source/blender/makesrna/intern/rna_controller.c b/source/blender/makesrna/intern/rna_controller.c index ba0214d36ec..605e28653f9 100644 --- a/source/blender/makesrna/intern/rna_controller.c +++ b/source/blender/makesrna/intern/rna_controller.c @@ -120,7 +120,7 @@ static int rna_Controller_state_number_get(struct PointerRNA *ptr) int bit; for (bit = 0; bit < 32; bit++) { - if (cont->state_mask & (1 << bit)) + if (cont->state_mask & (1u << bit)) return bit + 1; } return 0; diff --git a/source/blender/makesrna/intern/rna_curve.c b/source/blender/makesrna/intern/rna_curve.c index 29f1dd5f29f..9a9ac28a7fd 100644 --- a/source/blender/makesrna/intern/rna_curve.c +++ b/source/blender/makesrna/intern/rna_curve.c @@ -1300,16 +1300,13 @@ static void rna_def_curve_splines(BlenderRNA *brna, PropertyRNA *cprop) RNA_def_property_clear_flag(parm, PROP_THICK_WRAP); func = RNA_def_function(srna, "clear", "rna_Curve_spline_clear"); - RNA_def_function_ui_description(func, "Remove all spline from a curve"); + RNA_def_function_ui_description(func, "Remove all splines from a curve"); prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE); - RNA_def_property_struct_type(prop, "Object"); + RNA_def_property_struct_type(prop, "Spline"); RNA_def_property_pointer_funcs(prop, "rna_Curve_active_spline_get", "rna_Curve_active_spline_set", NULL, NULL); RNA_def_property_flag(prop, PROP_EDITABLE); RNA_def_property_ui_text(prop, "Active Spline", "Active curve spline"); - /* Could call: ED_base_object_activate(C, scene->basact); - * but would be a bad level call and it seems the notifier is enough */ - RNA_def_property_update(prop, NC_SCENE | ND_OB_ACTIVE, NULL); } diff --git a/source/blender/makesrna/intern/rna_define.c b/source/blender/makesrna/intern/rna_define.c index 6a0ae0a60f8..dd2a49c8380 100644 --- a/source/blender/makesrna/intern/rna_define.c +++ b/source/blender/makesrna/intern/rna_define.c @@ -3411,7 +3411,7 @@ static void rna_def_property_free(StructOrFunctionRNA *cont_, PropertyRNA *prop) if (prop->flag & PROP_RUNTIME) { if (cont->prophash) - BLI_ghash_remove(cont->prophash, (void *)prop->identifier, NULL, NULL); + BLI_ghash_remove(cont->prophash, prop->identifier, NULL, NULL); RNA_def_property_free_pointers(prop); rna_freelinkN(&cont->properties, prop); diff --git a/source/blender/makesrna/intern/rna_depsgraph.c b/source/blender/makesrna/intern/rna_depsgraph.c new file mode 100644 index 00000000000..8ac1e2acc60 --- /dev/null +++ b/source/blender/makesrna/intern/rna_depsgraph.c @@ -0,0 +1,112 @@ +/* + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * Contributor(s): Blender Foundation (2014). + * + * ***** END GPL LICENSE BLOCK ***** + */ + +/** \file blender/makesrna/intern/rna_depsgraph.c + * \ingroup RNA + */ + +#include <stdlib.h> + +#include "BLI_utildefines.h" +#include "BLI_path_util.h" + +#include "RNA_define.h" +#include "RNA_enum_types.h" + +#include "rna_internal.h" + +#include "DEG_depsgraph.h" + +#include "BKE_depsgraph.h" + +#ifdef RNA_RUNTIME + +#include "BKE_report.h" + +#include "DEG_depsgraph_debug.h" + +static void rna_Depsgraph_debug_graphviz(Depsgraph *graph, const char *filename) +{ + FILE *f = fopen(filename, "w"); + if (f == NULL) + return; + + DEG_debug_graphviz(graph, f, "Depsgraph", false); + + fclose(f); +} + +static void rna_Depsgraph_debug_rebuild(Depsgraph *UNUSED(graph), Main *bmain) +{ + Scene *sce; + DAG_relations_tag_update(bmain); + for (sce = bmain->scene.first; sce; sce = sce->id.next) { + DAG_scene_relations_rebuild(bmain, sce); + DEG_graph_on_visible_update(bmain, sce); + } +} + +static void rna_Depsgraph_debug_stats(Depsgraph *graph, ReportList *reports) +{ + size_t outer, ops, rels; + + DEG_stats_simple(graph, &outer, &ops, &rels); + + // XXX: report doesn't seem to work + printf("Approx %lu Operations, %lu Relations, %lu Outer Nodes\n", + ops, rels, outer); + + BKE_reportf(reports, RPT_WARNING, "Approx. %lu Operations, %lu Relations, %lu Outer Nodes", + ops, rels, outer); +} + +#else + +static void rna_def_depsgraph(BlenderRNA *brna) +{ + StructRNA *srna; + FunctionRNA *func; + PropertyRNA *parm; + + srna = RNA_def_struct(brna, "Depsgraph", NULL); + RNA_def_struct_ui_text(srna, "Dependency Graph", ""); + + func = RNA_def_function(srna, "debug_graphviz", "rna_Depsgraph_debug_graphviz"); + parm = RNA_def_string_file_path(func, "filename", NULL, FILE_MAX, "File Name", + "File in which to store graphviz debug output"); + RNA_def_property_flag(parm, PROP_REQUIRED); + + func = RNA_def_function(srna, "debug_rebuild", "rna_Depsgraph_debug_rebuild"); + RNA_def_function_flag(func, FUNC_USE_MAIN); + RNA_def_property_flag(parm, PROP_REQUIRED); + + func = RNA_def_function(srna, "debug_stats", "rna_Depsgraph_debug_stats"); + RNA_def_function_ui_description(func, "Report the number of elements in the Dependency Graph"); + RNA_def_function_flag(func, FUNC_USE_REPORTS); +} + +void RNA_def_depsgraph(BlenderRNA *brna) +{ + rna_def_depsgraph(brna); +} + +#endif diff --git a/source/blender/makesrna/intern/rna_fcurve.c b/source/blender/makesrna/intern/rna_fcurve.c index 6c893255601..576af7b3a1c 100644 --- a/source/blender/makesrna/intern/rna_fcurve.c +++ b/source/blender/makesrna/intern/rna_fcurve.c @@ -574,7 +574,7 @@ static void rna_FModifier_blending_range(PointerRNA *ptr, float *min, float *max static void rna_FModifier_verify_data_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) { FModifier *fcm = (FModifier *)ptr->data; - FModifierTypeInfo *fmi = fmodifier_get_typeinfo(fcm); + const FModifierTypeInfo *fmi = fmodifier_get_typeinfo(fcm); /* call the verify callback on the modifier if applicable */ if (fmi && fmi->verify_data) diff --git a/source/blender/makesrna/intern/rna_gpencil.c b/source/blender/makesrna/intern/rna_gpencil.c index 6b61b37ce5c..7d7df0f91a7 100644 --- a/source/blender/makesrna/intern/rna_gpencil.c +++ b/source/blender/makesrna/intern/rna_gpencil.c @@ -568,7 +568,7 @@ static void rna_def_gpencil_frame(BlenderRNA *brna) prop = RNA_def_property(srna, "frame_number", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "framenum"); /* XXX note: this cannot occur on the same frame as another sketch */ - RNA_def_property_range(prop, MINAFRAME, MAXFRAME); + RNA_def_property_range(prop, -MAXFRAME, MAXFRAME); RNA_def_property_ui_text(prop, "Frame Number", "The frame on which this sketch appears"); /* Flags */ @@ -579,7 +579,9 @@ static void rna_def_gpencil_frame(BlenderRNA *brna) prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_FRAME_SELECT); RNA_def_property_ui_text(prop, "Select", "Frame is selected for editing in the Dope Sheet"); - + + + /* API */ func = RNA_def_function(srna, "clear", "rna_GPencil_frame_clear"); RNA_def_function_ui_description(func, "Remove all the grease pencil frame data"); } @@ -773,8 +775,8 @@ static void rna_def_gpencil_layer(BlenderRNA *brna) prop = RNA_def_property(srna, "show_points", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_LAYER_DRAWDEBUG); RNA_def_property_ui_text(prop, "Show Points", "Draw the points which make up the strokes (for debugging purposes)"); - RNA_def_property_update_runtime(prop, "rna_GPencil_update"); - + RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update"); + /* X-Ray */ prop = RNA_def_property(srna, "show_x_ray", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", GP_LAYER_NO_XRAY); diff --git a/source/blender/makesrna/intern/rna_image.c b/source/blender/makesrna/intern/rna_image.c index 5ab6d1a231b..8b464e74569 100644 --- a/source/blender/makesrna/intern/rna_image.c +++ b/source/blender/makesrna/intern/rna_image.c @@ -35,6 +35,7 @@ #include "BKE_depsgraph.h" #include "BKE_image.h" +#include "RNA_access.h" #include "RNA_define.h" #include "RNA_enum_types.h" @@ -137,6 +138,23 @@ static void rna_Image_colormanage_update(Main *UNUSED(bmain), Scene *UNUSED(scen WM_main_add_notifier(NC_IMAGE | NA_EDITED, &ima->id); } +static void rna_Image_views_format_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *ptr) +{ + Image *ima = ptr->id.data; + ImBuf *ibuf; + void *lock; + + ibuf = BKE_image_acquire_ibuf(ima, NULL, &lock); + + if (ibuf) { + ImageUser iuser = {NULL}; + iuser.scene = scene; + BKE_image_signal(ima, &iuser, IMA_SIGNAL_FREE); + } + + BKE_image_release_ibuf(ima, ibuf, lock); +} + static void rna_ImageUser_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *ptr) { ImageUser *iuser = ptr->data; @@ -295,17 +313,16 @@ static int rna_Image_frame_duration_get(PointerRNA *ptr) Image *ima = ptr->id.data; int duration = 1; - if (!ima->anim) { + if (BKE_image_has_anim(ima)) { + duration = IMB_anim_get_duration(((ImageAnim *)ima->anims.first)->anim, IMB_TC_RECORD_RUN); + } + else { /* acquire ensures ima->anim is set, if possible! */ void *lock; ImBuf *ibuf = BKE_image_acquire_ibuf(ima, NULL, &lock); BKE_image_release_ibuf(ima, ibuf, lock); } - if (ima->anim) { - duration = IMB_anim_get_duration(ima->anim, IMB_TC_RECORD_RUN); - } - return duration; } @@ -409,6 +426,19 @@ static int rna_Image_is_float_get(PointerRNA *ptr) return is_float; } +static PointerRNA rna_Image_packed_file_get(PointerRNA *ptr) +{ + Image *ima = (Image *)ptr->id.data; + + if (BKE_image_has_packedfile(ima)) { + ImagePackedFile *imapf = ima->packedfiles.first; + return rna_pointer_inherit_refine(ptr, &RNA_PackedFile, imapf->packedfile); + } + else { + return PointerRNA_NULL; + } +} + static void rna_Image_render_slots_begin(CollectionPropertyIterator *iter, PointerRNA *ptr) { Image *image = (Image *)ptr->id.data; @@ -508,10 +538,31 @@ static void rna_def_imageuser(BlenderRNA *brna) RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* image_multi_cb */ RNA_def_property_ui_text(prop, "Layer", "Layer in multilayer image"); - prop = RNA_def_property(srna, "multilayer_pass", PROP_INT, PROP_UNSIGNED); - RNA_def_property_int_sdna(prop, NULL, "pass"); + prop = RNA_def_property(srna, "multilayer_view", PROP_INT, PROP_UNSIGNED); + RNA_def_property_int_sdna(prop, NULL, "view"); RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* image_multi_cb */ - RNA_def_property_ui_text(prop, "Pass", "Pass in multilayer image"); + RNA_def_property_ui_text(prop, "View", "View in multilayer image"); +} + +/* image.packed_files */ +static void rna_def_image_packed_files(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + + srna = RNA_def_struct(brna, "ImagePackedFile", NULL); + RNA_def_struct_sdna(srna, "ImagePackedFile"); + + prop = RNA_def_property(srna, "packed_file", PROP_POINTER, PROP_NONE); + RNA_def_property_pointer_sdna(prop, NULL, "packedfile"); + RNA_def_property_ui_text(prop, "Packed File", ""); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + + prop = RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH); + RNA_def_property_string_sdna(prop, NULL, "filepath"); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_struct_name_property(srna, prop); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); } static void rna_def_render_slot(BlenderRNA *brna) @@ -613,15 +664,23 @@ static void rna_def_image(BlenderRNA *brna) RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, NULL); prop = RNA_def_property(srna, "packed_file", PROP_POINTER, PROP_NONE); + RNA_def_property_struct_type(prop, "PackedFile"); RNA_def_property_pointer_sdna(prop, NULL, "packedfile"); - RNA_def_property_ui_text(prop, "Packed File", ""); - + RNA_def_property_pointer_funcs(prop, "rna_Image_packed_file_get", NULL, NULL, NULL); + RNA_def_property_ui_text(prop, "Packed File", "First packed file of the image"); + + prop = RNA_def_property(srna, "packed_files", PROP_COLLECTION, PROP_NONE); + RNA_def_property_collection_sdna(prop, NULL, "packedfiles", NULL); + RNA_def_property_struct_type(prop, "ImagePackedFile"); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Packed Files", "Collection of packed images"); + prop = RNA_def_property(srna, "field_order", PROP_ENUM, PROP_NONE); RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag"); RNA_def_property_enum_items(prop, prop_field_order_items); RNA_def_property_ui_text(prop, "Field Order", "Order of video fields (select which lines are displayed first)"); RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, NULL); - + /* booleans */ prop = RNA_def_property(srna, "use_fields", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", IMA_FIELDS); @@ -645,6 +704,21 @@ static void rna_def_image(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Deinterlace", "Deinterlace movie file on load"); RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_Image_reload_update"); + prop = RNA_def_property(srna, "use_multiview", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", IMA_USE_VIEWS); + RNA_def_property_ui_text(prop, "Use Multi-View", "Use Multiple Views (when available)"); + RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_Image_views_format_update"); + + prop = RNA_def_property(srna, "is_stereo_3d", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", IMA_IS_STEREO); + RNA_def_property_ui_text(prop, "Stereo 3D", "Image has left and right views"); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + + prop = RNA_def_property(srna, "is_multiview", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", IMA_IS_MULTIVIEW); + RNA_def_property_ui_text(prop, "Multiple Views", "Image has more than one view"); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + prop = RNA_def_property(srna, "is_dirty", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_funcs(prop, "rna_Image_dirty_get", NULL); RNA_def_property_clear_flag(prop, PROP_EDITABLE); @@ -709,13 +783,13 @@ static void rna_def_image(BlenderRNA *brna) prop = RNA_def_property(srna, "frame_start", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "twsta"); - RNA_def_property_range(prop, 0, 128); + RNA_def_property_range(prop, 0, 255); RNA_def_property_ui_text(prop, "Animation Start", "Start frame of an animated texture"); RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_Image_animated_update"); prop = RNA_def_property(srna, "frame_end", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "twend"); - RNA_def_property_range(prop, 0, 128); + RNA_def_property_range(prop, 0, 255); RNA_def_property_ui_text(prop, "Animation End", "End frame of an animated texture"); RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_Image_animated_update"); @@ -825,6 +899,19 @@ static void rna_def_image(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Alpha Mode", "Representation of alpha information in the RGBA pixels"); RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_Image_colormanage_update"); + /* multiview */ + prop = RNA_def_property(srna, "views_format", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "views_format"); + RNA_def_property_enum_items(prop, views_format_items); + RNA_def_property_ui_text(prop, "Views Format", "Mode to load image views"); + RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_Image_views_format_update"); + + prop = RNA_def_property(srna, "stereo_3d_format", PROP_POINTER, PROP_NONE); + RNA_def_property_pointer_sdna(prop, NULL, "stereo3d_format"); + RNA_def_property_flag(prop, PROP_NEVER_NULL); + RNA_def_property_struct_type(prop, "Stereo3dFormat"); + RNA_def_property_ui_text(prop, "Stereo 3D Format", "Settings for stereo 3d"); + RNA_api_image(srna); } @@ -834,6 +921,7 @@ void RNA_def_image(BlenderRNA *brna) rna_def_render_slots(brna); rna_def_image(brna); rna_def_imageuser(brna); + rna_def_image_packed_files(brna); } #endif diff --git a/source/blender/makesrna/intern/rna_image_api.c b/source/blender/makesrna/intern/rna_image_api.c index 5fc65ea385c..945359515ab 100644 --- a/source/blender/makesrna/intern/rna_image_api.c +++ b/source/blender/makesrna/intern/rna_image_api.c @@ -35,6 +35,7 @@ #include <time.h> #include "DNA_packedFile_types.h" +#include "DNA_userdef_types.h" #include "BLI_utildefines.h" #include "BLI_path_util.h" @@ -57,6 +58,7 @@ #include "BIF_gl.h" #include "GPU_draw.h" +#include "GPU_debug.h" #include "DNA_image_types.h" #include "DNA_scene_types.h" @@ -72,7 +74,7 @@ static void rna_Image_save_render(Image *image, bContext *C, ReportList *reports } if (scene) { - ImageUser iuser = {0}; + ImageUser iuser = {NULL}; void *lock; iuser.scene = scene; @@ -115,9 +117,14 @@ static void rna_Image_save(Image *image, Main *bmain, bContext *C, ReportList *r BLI_strncpy(filename, image->name, sizeof(filename)); BLI_path_abs(filename, ID_BLEND_PATH(bmain, &image->id)); - if (image->packedfile) { - if (writePackedFile(reports, image->name, image->packedfile, 0) != RET_OK) { - BKE_reportf(reports, RPT_ERROR, "Image '%s' could not save packed file to '%s'", image->id.name + 2, image->name); + if (BKE_image_has_packedfile(image)) { + ImagePackedFile *imapf; + + for (imapf = image->packedfiles.first; imapf; imapf = imapf->next) { + if (writePackedFile(reports, imapf->filepath, imapf->packedfile, 0) != RET_OK) { + BKE_reportf(reports, RPT_ERROR, "Image '%s' could not save packed file to '%s'", + image->id.name + 2, imapf->filepath); + } } } else if (IMB_saveiff(ibuf, filename, ibuf->flags)) { @@ -152,20 +159,17 @@ static void rna_Image_pack( BKE_report(reports, RPT_ERROR, "Cannot pack edited image from disk, only as internal PNG"); } else { - if (image->packedfile) { - freePackedFile(image->packedfile); - image->packedfile = NULL; - } + BKE_image_free_packedfiles(image); if (as_png) { BKE_image_memorypack(image); } else if (data) { char *data_dup = MEM_mallocN(sizeof(*data_dup) * (size_t)data_len, __func__); memcpy(data_dup, data, (size_t)data_len); - image->packedfile = newPackedFileMemory(data_dup, data_len); + BKE_image_packfiles_from_mem(reports, image, data_dup, (size_t)data_len); } else { - image->packedfile = newPackedFile(reports, image->name, ID_BLEND_PATH(bmain, &image->id)); + BKE_image_packfiles(reports, image, ID_BLEND_PATH(bmain, &image->id)); } } @@ -175,7 +179,7 @@ static void rna_Image_pack( static void rna_Image_unpack(Image *image, ReportList *reports, int method) { - if (!image->packedfile) { + if (!BKE_image_has_packedfile(image)) { BKE_report(reports, RPT_ERROR, "Image not packed"); } else if (BKE_image_is_animated(image)) { @@ -232,31 +236,23 @@ static int rna_Image_gl_load(Image *image, ReportList *reports, int frame, int f ibuf = BKE_image_acquire_ibuf(image, &iuser, &lock); + /* clean glError buffer */ + while (glGetError() != GL_NO_ERROR) {} + if (ibuf == NULL || ibuf->rect == NULL) { BKE_reportf(reports, RPT_ERROR, "Image '%s' does not have any image data", image->id.name + 2); BKE_image_release_ibuf(image, ibuf, NULL); return (int)GL_INVALID_OPERATION; } - /* could be made into a function? */ - glGenTextures(1, (GLuint *)bind); - glBindTexture(GL_TEXTURE_2D, *bind); + GPU_create_gl_tex(bind, ibuf->rect, ibuf->rect_float, ibuf->x, ibuf->y, + (filter != GL_NEAREST && filter != GL_LINEAR), false, image); - if (filter != GL_NEAREST && filter != GL_LINEAR) - error = (int)gluBuild2DMipmaps(GL_TEXTURE_2D, GL_RGBA, ibuf->x, ibuf->y, GL_RGBA, GL_UNSIGNED_BYTE, ibuf->rect); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, (GLint)filter); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, (GLint)mag); + glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); - if (!error) { - /* clean glError buffer */ - while (glGetError() != GL_NO_ERROR) {} - - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, image->tpageflag & IMA_CLAMP_U ? GL_CLAMP : GL_REPEAT); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, image->tpageflag & IMA_CLAMP_V ? GL_CLAMP : GL_REPEAT); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, (GLint)filter); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, (GLint)mag); - glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, ibuf->x, ibuf->y, 0, GL_RGBA, GL_UNSIGNED_BYTE, ibuf->rect); - error = (int)glGetError(); - } + error = glGetError(); if (error) { glDeleteTextures(1, (GLuint *)bind); @@ -294,6 +290,11 @@ static void rna_Image_filepath_from_user(Image *image, ImageUser *image_user, ch BKE_image_user_file_path(image_user, image, filepath); } +static void rna_Image_buffers_free(Image *image) +{ + BKE_image_free_buffers(image); +} + #else void RNA_api_image(StructRNA *srna) @@ -380,6 +381,9 @@ void RNA_api_image(StructRNA *srna) RNA_def_property_flag(parm, PROP_THICK_WRAP); /* needed for string return value */ RNA_def_function_output(func, parm); + func = RNA_def_function(srna, "buffers_free", "rna_Image_buffers_free"); + RNA_def_function_ui_description(func, "Free the image buffers from memory"); + /* TODO, pack/unpack, maybe should be generic functions? */ } diff --git a/source/blender/makesrna/intern/rna_internal.h b/source/blender/makesrna/intern/rna_internal.h index ef3144f65de..62fe71fe8a5 100644 --- a/source/blender/makesrna/intern/rna_internal.h +++ b/source/blender/makesrna/intern/rna_internal.h @@ -35,16 +35,13 @@ #define RNA_MAGIC ((int)~0) -struct ColorBand; struct ID; struct IDProperty; struct Main; struct Mesh; struct Object; -struct RenderEngine; struct ReportList; struct SDNA; -struct Sequence; /* Data structures used during define */ @@ -136,6 +133,7 @@ void RNA_def_armature(struct BlenderRNA *brna); void RNA_def_actuator(struct BlenderRNA *brna); void RNA_def_boid(struct BlenderRNA *brna); void RNA_def_brush(struct BlenderRNA *brna); +void RNA_def_cache_library(struct BlenderRNA *brna); void RNA_def_camera(struct BlenderRNA *brna); void RNA_def_cloth(struct BlenderRNA *brna); void RNA_def_color(struct BlenderRNA *brna); @@ -143,6 +141,7 @@ void RNA_def_constraint(struct BlenderRNA *brna); void RNA_def_context(struct BlenderRNA *brna); void RNA_def_controller(struct BlenderRNA *brna); void RNA_def_curve(struct BlenderRNA *brna); +void RNA_def_depsgraph(struct BlenderRNA *brna); void RNA_def_dynamic_paint(struct BlenderRNA *brna); void RNA_def_fluidsim(struct BlenderRNA *brna); void RNA_def_fcurve(struct BlenderRNA *brna); @@ -157,6 +156,7 @@ void RNA_def_linestyle(struct BlenderRNA *brna); void RNA_def_main(struct BlenderRNA *brna); void RNA_def_material(struct BlenderRNA *brna); void RNA_def_mesh(struct BlenderRNA *brna); +void RNA_def_mesh_sample(struct BlenderRNA *brna); void RNA_def_meta(struct BlenderRNA *brna); void RNA_def_modifier(struct BlenderRNA *brna); void RNA_def_nla(struct BlenderRNA *brna); @@ -164,6 +164,7 @@ void RNA_def_nodetree(struct BlenderRNA *brna); void RNA_def_object(struct BlenderRNA *brna); void RNA_def_object_force(struct BlenderRNA *brna); void RNA_def_packedfile(struct BlenderRNA *brna); +void RNA_def_palette(struct BlenderRNA *brna); void RNA_def_particle(struct BlenderRNA *brna); void RNA_def_pose(struct BlenderRNA *brna); void RNA_def_render(struct BlenderRNA *brna); @@ -177,6 +178,7 @@ void RNA_def_sequencer(struct BlenderRNA *brna); void RNA_def_smoke(struct BlenderRNA *brna); void RNA_def_space(struct BlenderRNA *brna); void RNA_def_speaker(struct BlenderRNA *brna); +void RNA_def_strands(struct BlenderRNA *brna); void RNA_def_test(struct BlenderRNA *brna); void RNA_def_text(struct BlenderRNA *brna); void RNA_def_texture(struct BlenderRNA *brna); @@ -327,10 +329,12 @@ void RNA_def_main_sounds(BlenderRNA *brna, PropertyRNA *cprop); void RNA_def_main_armatures(BlenderRNA *brna, PropertyRNA *cprop); void RNA_def_main_actions(BlenderRNA *brna, PropertyRNA *cprop); void RNA_def_main_particles(BlenderRNA *brna, PropertyRNA *cprop); +void RNA_def_main_palettes(BlenderRNA *brna, PropertyRNA *cprop); void RNA_def_main_gpencil(BlenderRNA *brna, PropertyRNA *cprop); void RNA_def_main_movieclips(BlenderRNA *brna, PropertyRNA *cprop); void RNA_def_main_masks(BlenderRNA *brna, PropertyRNA *cprop); void RNA_def_main_linestyles(BlenderRNA *brna, PropertyRNA *cprop); +void RNA_def_main_cache_libraries(BlenderRNA *brna, PropertyRNA *cprop); /* ID Properties */ diff --git a/source/blender/makesrna/intern/rna_internal_types.h b/source/blender/makesrna/intern/rna_internal_types.h index 845d76debd2..ba0705b5caa 100644 --- a/source/blender/makesrna/intern/rna_internal_types.h +++ b/source/blender/makesrna/intern/rna_internal_types.h @@ -38,10 +38,8 @@ struct StructRNA; struct PropertyRNA; struct PointerRNA; struct FunctionRNA; -struct ReportList; struct CollectionPropertyIterator; struct bContext; -struct EnumProperty; struct IDProperty; struct GHash; struct Main; diff --git a/source/blender/makesrna/intern/rna_key.c b/source/blender/makesrna/intern/rna_key.c index fe62df57eed..b462729657c 100644 --- a/source/blender/makesrna/intern/rna_key.c +++ b/source/blender/makesrna/intern/rna_key.c @@ -48,10 +48,12 @@ #include <stddef.h> +#include "DNA_cache_library_types.h" #include "DNA_object_types.h" #include "DNA_scene_types.h" #include "BKE_animsys.h" +#include "BKE_cache_library.h" #include "BKE_depsgraph.h" #include "BKE_key.h" #include "BKE_main.h" @@ -90,7 +92,7 @@ static void rna_ShapeKey_name_set(PointerRNA *ptr, const char *value) } /* fix all the animation data which may link to this */ - BKE_all_animdata_fix_paths_rename(NULL, "key_blocks", oldname, kb->name); + BKE_animdata_fix_paths_rename_all(NULL, "key_blocks", oldname, kb->name); } static float rna_ShapeKey_frame_get(PointerRNA *ptr) @@ -304,7 +306,7 @@ static void rna_ShapeKey_data_begin(CollectionPropertyIterator *iter, PointerRNA Nurb *nu; int tot = kb->totelem, size = key->elemsize; - if (key->from_extra.type == KEY_OWNER_CURVE) { + if (key->from && key->fromtype == KEY_OWNER_CURVE) { cu = (Curve *)key->from; nu = cu->nurb.first; @@ -325,7 +327,7 @@ static int rna_ShapeKey_data_length(PointerRNA *ptr) Nurb *nu; int tot = kb->totelem; - if (key->from_extra.type == KEY_OWNER_CURVE) { + if (key->from && key->fromtype == KEY_OWNER_CURVE) { cu = (Curve *)key->from; nu = cu->nurb.first; @@ -343,7 +345,7 @@ static PointerRNA rna_ShapeKey_data_get(CollectionPropertyIterator *iter) Curve *cu; Nurb *nu; - if (key->from_extra.type == KEY_OWNER_CURVE) { + if (key->from && key->fromtype == KEY_OWNER_CURVE) { cu = (Curve *)key->from; nu = cu->nurb.first; @@ -376,8 +378,9 @@ static void rna_Key_update_data(Main *bmain, Scene *UNUSED(scene), PointerRNA *p { Key *key = ptr->id.data; Object *ob; + CacheLibrary *cachelib; - switch (key->from_extra.type) { + switch (key->fromtype) { case KEY_OWNER_MESH: case KEY_OWNER_CURVE: case KEY_OWNER_LATTICE: @@ -401,6 +404,13 @@ static void rna_Key_update_data(Main *bmain, Scene *UNUSED(scene), PointerRNA *p } break; } + + for (cachelib = bmain->cache_library.first; cachelib; cachelib = cachelib->id.next) { + if (BKE_cache_library_uses_key(cachelib, key)) { + DAG_id_tag_update(&cachelib->id, OB_RECALC_DATA); + WM_main_add_notifier(NC_WINDOW, NULL); + } + } } static KeyBlock *rna_ShapeKeyData_find_keyblock(Key *key, float *point) diff --git a/source/blender/makesrna/intern/rna_lamp.c b/source/blender/makesrna/intern/rna_lamp.c index 81c26af189d..6140a34b271 100644 --- a/source/blender/makesrna/intern/rna_lamp.c +++ b/source/blender/makesrna/intern/rna_lamp.c @@ -94,7 +94,7 @@ static int rna_use_shadow_get(PointerRNA *ptr) Lamp *la = (Lamp *)ptr->data; if (la->type == LA_SPOT) { - return (la->mode & LA_SHAD_BUF) != 0; + return (la->mode & (LA_SHAD_BUF | LA_SHAD_RAY)) != 0; } else { return (la->mode & LA_SHAD_RAY) != 0; @@ -104,14 +104,10 @@ static int rna_use_shadow_get(PointerRNA *ptr) static void rna_use_shadow_set(PointerRNA *ptr, int value) { Lamp *la = (Lamp *)ptr->data; + la->mode &= ~(LA_SHAD_BUF | LA_SHAD_RAY); if (value) { - if (la->type == LA_SPOT) - la->mode |= LA_SHAD_BUF; - else - la->mode |= LA_SHAD_RAY; + la->mode |= LA_SHAD_RAY; } - else - la->mode &= ~(LA_SHAD_BUF | LA_SHAD_RAY); } static StructRNA *rna_Lamp_refine(struct PointerRNA *ptr) @@ -829,6 +825,12 @@ static void rna_def_sun_lamp(BlenderRNA *brna) RNA_def_property_ui_range(prop, 0.001, 100.0, 2, 1); RNA_def_property_ui_text(prop, "Frustum Size", "Size of the frustum used for creating the shadow map"); RNA_def_property_update(prop, 0, "rna_Lamp_draw_update"); + + prop = RNA_def_property(srna, "show_shadow_box", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "mode", LA_SHOW_SHADOW_BOX); + RNA_def_property_ui_text(prop, "Show Shadow Box", + "Draw a box in 3D view to visualize which objects are contained in it"); + RNA_def_property_update(prop, 0, "rna_Lamp_draw_update"); } static void rna_def_hemi_lamp(BlenderRNA *brna) diff --git a/source/blender/makesrna/intern/rna_main.c b/source/blender/makesrna/intern/rna_main.c index 65d81359045..926c5db5ae6 100644 --- a/source/blender/makesrna/intern/rna_main.c +++ b/source/blender/makesrna/intern/rna_main.c @@ -251,6 +251,12 @@ static void rna_Main_particle_begin(CollectionPropertyIterator *iter, PointerRNA rna_iterator_listbase_begin(iter, &bmain->particle, NULL); } +static void rna_Main_palettes_begin(CollectionPropertyIterator *iter, PointerRNA *ptr) +{ + Main *bmain = (Main *)ptr->data; + rna_iterator_listbase_begin(iter, &bmain->palettes, NULL); +} + static void rna_Main_gpencil_begin(CollectionPropertyIterator *iter, PointerRNA *ptr) { Main *bmain = (Main *)ptr->data; @@ -281,6 +287,12 @@ static void rna_Main_linestyle_begin(CollectionPropertyIterator *iter, PointerRN rna_iterator_listbase_begin(iter, &bmain->linestyle, NULL); } +static void rna_Main_cachelibraries_begin(CollectionPropertyIterator *iter, PointerRNA *ptr) +{ + Main *bmain = (Main *)ptr->data; + rna_iterator_listbase_begin(iter, &bmain->cache_library, NULL); +} + static void rna_Main_version_get(PointerRNA *ptr, int *value) { Main *bmain = (Main *)ptr->data; @@ -350,10 +362,12 @@ void RNA_def_main(BlenderRNA *brna) {"armatures", "Armature", "rna_Main_armature_begin", "Armatures", "Armature datablocks", RNA_def_main_armatures}, {"actions", "Action", "rna_Main_action_begin", "Actions", "Action datablocks", RNA_def_main_actions}, {"particles", "ParticleSettings", "rna_Main_particle_begin", "Particles", "Particle datablocks", RNA_def_main_particles}, + {"palettes", "Palette", "rna_Main_palettes_begin", "Palettes", "Palette datablocks", RNA_def_main_palettes}, {"grease_pencil", "GreasePencil", "rna_Main_gpencil_begin", "Grease Pencil", "Grease Pencil datablocks", RNA_def_main_gpencil}, {"movieclips", "MovieClip", "rna_Main_movieclips_begin", "Movie Clips", "Movie Clip datablocks", RNA_def_main_movieclips}, {"masks", "Mask", "rna_Main_masks_begin", "Masks", "Masks datablocks", RNA_def_main_masks}, {"linestyles", "FreestyleLineStyle", "rna_Main_linestyle_begin", "Line Styles", "Line Style datablocks", RNA_def_main_linestyles}, + {"cache_libraries", "CacheLibrary", "rna_Main_cachelibraries_begin", "Cache Libraries", "Cache Library datablocks", RNA_def_main_cache_libraries}, {NULL, NULL, NULL, NULL, NULL, NULL} }; diff --git a/source/blender/makesrna/intern/rna_main_api.c b/source/blender/makesrna/intern/rna_main_api.c index 8aa447f523e..b9b3bb519ca 100644 --- a/source/blender/makesrna/intern/rna_main_api.c +++ b/source/blender/makesrna/intern/rna_main_api.c @@ -35,6 +35,7 @@ #include "DNA_ID.h" #include "DNA_modifier_types.h" +#include "DNA_space_types.h" #include "BLI_utildefines.h" #include "BLI_path_util.h" @@ -48,6 +49,8 @@ #ifdef RNA_RUNTIME #include "BKE_main.h" +#include "BKE_anim.h" +#include "BKE_cache_library.h" #include "BKE_camera.h" #include "BKE_curve.h" #include "BKE_DerivedMesh.h" @@ -58,9 +61,11 @@ #include "BKE_library.h" #include "BKE_object.h" #include "BKE_material.h" +#include "BKE_icons.h" #include "BKE_image.h" #include "BKE_texture.h" #include "BKE_scene.h" +#include "BKE_sound.h" #include "BKE_text.h" #include "BKE_action.h" #include "BKE_group.h" @@ -69,6 +74,7 @@ #include "BKE_mball.h" #include "BKE_world.h" #include "BKE_particle.h" +#include "BKE_paint.h" #include "BKE_font.h" #include "BKE_node.h" #include "BKE_depsgraph.h" @@ -79,6 +85,7 @@ #include "BKE_linestyle.h" #include "DNA_armature_types.h" +#include "DNA_cache_library_types.h" #include "DNA_camera_types.h" #include "DNA_curve_types.h" #include "DNA_lamp_types.h" @@ -86,6 +93,7 @@ #include "DNA_mesh_types.h" #include "DNA_object_types.h" #include "DNA_speaker_types.h" +#include "DNA_sound_types.h" #include "DNA_text_types.h" #include "DNA_texture_types.h" #include "DNA_group_types.h" @@ -307,6 +315,61 @@ Mesh *rna_Main_meshes_new_from_object( return BKE_mesh_new_from_object(bmain, sce, ob, apply_modifiers, settings, calc_tessface, calc_undeformed); } +/* copied from Mesh_getFromObject and adapted to RNA interface */ +/* settings: 1 - preview, 2 - render */ +Mesh *rna_Main_meshes_new_from_dupli( + Main *bmain, ReportList *reports, Scene *scene, Object *parent, DupliObject *dob, + int settings, int calc_tessface, int calc_undeformed) +{ + Mesh *mesh = NULL; + bool is_cached = parent->cache_library && (parent->cache_library->source_mode == CACHE_LIBRARY_SOURCE_CACHE || parent->cache_library->display_mode == CACHE_LIBRARY_DISPLAY_RESULT); + + switch (dob->ob->type) { + case OB_FONT: + case OB_CURVE: + case OB_SURF: + case OB_MBALL: + case OB_MESH: + break; + default: + BKE_report(reports, RPT_ERROR, "Object does not have geometry data"); + return NULL; + } + + if (is_cached) { + float frame = (float)scene->r.cfra + scene->r.subframe; + bool use_render = (settings == 2); + + if (!ELEM(settings, 1, 2)) + return NULL; + + if (settings == 1 && parent->dup_cache) { + DupliObjectData *data; + + /* use dupli cache for realtime dupli data if possible */ + data = BKE_dupli_cache_find_data(parent->dup_cache, dob->ob); + if (data) + mesh = BKE_mesh_new_from_dupli_data(bmain, data, calc_tessface, calc_undeformed); + } + else { + DupliObjectData data; + + memset(&data, 0, sizeof(data)); + if (BKE_cache_read_dupli_object(parent->cache_library, &data, scene, dob->ob, frame, use_render, true)) + mesh = BKE_mesh_new_from_dupli_data(bmain, &data, calc_tessface, calc_undeformed); + + BKE_dupli_object_data_clear(&data); + } + } + + /* default, and fallback in case no mesh data was stored in the cache */ + if (!mesh) { + mesh = BKE_mesh_new_from_object(bmain, scene, dob->ob, true, settings, calc_tessface, calc_undeformed); + } + + return mesh; +} + static void rna_Main_meshes_remove(Main *bmain, ReportList *reports, PointerRNA *mesh_ptr) { Mesh *mesh = mesh_ptr->data; @@ -340,10 +403,10 @@ static void rna_Main_lamps_remove(Main *bmain, ReportList *reports, PointerRNA * } } -static Image *rna_Main_images_new(Main *bmain, const char *name, int width, int height, int alpha, int float_buffer) +static Image *rna_Main_images_new(Main *bmain, const char *name, int width, int height, int alpha, int float_buffer, int stereo3d) { float color[4] = {0.0, 0.0, 0.0, 1.0}; - Image *image = BKE_image_add_generated(bmain, width, height, name, alpha ? 32 : 24, float_buffer, 0, color); + Image *image = BKE_image_add_generated(bmain, width, height, name, alpha ? 32 : 24, float_buffer, 0, color, stereo3d); id_us_min(&image->id); return image; } @@ -460,8 +523,8 @@ static void rna_Main_fonts_remove(Main *bmain, ReportList *reports, PointerRNA * static Tex *rna_Main_textures_new(Main *bmain, const char *name, int type) { - Tex *tex = add_texture(bmain, name); - tex_set_type(tex, type); + Tex *tex = BKE_texture_add(bmain, name); + BKE_texture_type_set(tex, type); id_us_min(&tex->id); return tex; } @@ -547,6 +610,25 @@ static void rna_Main_speakers_remove(Main *bmain, ReportList *reports, PointerRN } } +static bSound *rna_Main_sounds_load(Main *bmain, const char *name) +{ + bSound *sound = BKE_sound_new_file(bmain, name); + id_us_min(&sound->id); + return sound; +} +static void rna_Main_sounds_remove(Main *bmain, ReportList *reports, PointerRNA *sound_ptr) +{ + Speaker *sound = sound_ptr->data; + if (ID_REAL_USERS(sound) <= 0) { + BKE_libblock_free(bmain, sound); + RNA_POINTER_INVALIDATE(sound_ptr); + } + else { + BKE_reportf(reports, RPT_ERROR, "Sound '%s' must have zero users to be removed, found %d", + sound->id.name + 2, ID_REAL_USERS(sound)); + } +} + static Text *rna_Main_texts_new(Main *bmain, const char *name) { return BKE_text_add(bmain, name); @@ -631,6 +713,25 @@ static void rna_Main_particles_remove(Main *bmain, ReportList *reports, PointerR } } +static Palette *rna_Main_palettes_new(Main *bmain, const char *name) +{ + Palette *palette = BKE_palette_add(bmain, name); + id_us_min(&palette->id); + return (Palette *)palette; +} +static void rna_Main_palettes_remove(Main *bmain, ReportList *reports, PointerRNA *palette_ptr) +{ + Palette *palette = palette_ptr->data; + if (ID_REAL_USERS(palette) <= 0) { + BKE_libblock_free(bmain, palette); + RNA_POINTER_INVALIDATE(palette_ptr); + } + else { + BKE_reportf(reports, RPT_ERROR, "Palette settings '%s' must have zero users to be removed, found %d", + palette->id.name + 2, ID_REAL_USERS(palette)); + } +} + static MovieClip *rna_Main_movieclip_load(Main *bmain, ReportList *reports, const char *filepath) { MovieClip *clip; @@ -685,7 +786,7 @@ static void rna_Main_grease_pencil_remove(Main *bmain, ReportList *reports, Poin static FreestyleLineStyle *rna_Main_linestyles_new(Main *bmain, const char *name) { - FreestyleLineStyle *linestyle = BKE_linestyle_new(name, bmain); + FreestyleLineStyle *linestyle = BKE_linestyle_new(bmain, name); id_us_min(&linestyle->id); return linestyle; } @@ -701,6 +802,22 @@ static void rna_Main_linestyles_remove(Main *bmain, ReportList *reports, Freesty /* XXX python now has invalid pointer? */ } +static CacheLibrary *rna_Main_cachelibraries_new(Main *bmain, const char *name) +{ + CacheLibrary *cachelib = BKE_cache_library_add(bmain, name); + id_us_min(&cachelib->id); + return cachelib; +} + +static void rna_Main_cachelibraries_remove(Main *bmain, ReportList *reports, CacheLibrary *cachelib) +{ + if (ID_REAL_USERS(cachelib) <= 0) + BKE_libblock_free(bmain, cachelib); + else + BKE_reportf(reports, RPT_ERROR, "Cache library '%s' must have zero users to be removed, found %d", + cachelib->id.name + 2, ID_REAL_USERS(cachelib)); +} + /* tag functions, all the same */ static void rna_Main_cameras_tag(Main *bmain, int value) { BKE_main_id_tag_listbase(&bmain->camera, value); } static void rna_Main_scenes_tag(Main *bmain, int value) { BKE_main_id_tag_listbase(&bmain->scene, value); } @@ -729,10 +846,12 @@ static void rna_Main_sounds_tag(Main *bmain, int value) { BKE_main_id_tag_listba static void rna_Main_armatures_tag(Main *bmain, int value) { BKE_main_id_tag_listbase(&bmain->armature, value); } static void rna_Main_actions_tag(Main *bmain, int value) { BKE_main_id_tag_listbase(&bmain->action, value); } static void rna_Main_particles_tag(Main *bmain, int value) { BKE_main_id_tag_listbase(&bmain->particle, value); } +static void rna_Main_palettes_tag(Main *bmain, int value) { BKE_main_id_tag_listbase(&bmain->palettes, value); } static void rna_Main_gpencil_tag(Main *bmain, int value) { BKE_main_id_tag_listbase(&bmain->gpencil, value); } static void rna_Main_movieclips_tag(Main *bmain, int value) { BKE_main_id_tag_listbase(&bmain->movieclip, value); } static void rna_Main_masks_tag(Main *bmain, int value) { BKE_main_id_tag_listbase(&bmain->mask, value); } static void rna_Main_linestyle_tag(Main *bmain, int value) { BKE_main_id_tag_listbase(&bmain->linestyle, value); } +static void rna_Main_cachelibraries_tag(Main *bmain, int value) { BKE_main_id_tag_listbase(&bmain->cache_library, value); } static int rna_Main_cameras_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_CA) != 0; } static int rna_Main_scenes_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_SCE) != 0; } @@ -759,16 +878,19 @@ static int rna_Main_sounds_is_updated_get(PointerRNA *ptr) { return DAG_id_type_ static int rna_Main_armatures_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_AR) != 0; } static int rna_Main_actions_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_AC) != 0; } static int rna_Main_particles_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_PA) != 0; } +static int rna_Main_palettes_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_PAL) != 0; } static int rna_Main_gpencil_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_GD) != 0; } static int rna_Main_linestyle_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_LS) != 0; } +static int rna_Main_cachelibraries_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_CL) != 0; } #else -void RNA_api_main(StructRNA *srna) +void RNA_api_main(StructRNA *UNUSED(srna)) { #if 0 FunctionRNA *func; PropertyRNA *parm; + /* maybe we want to add functions in 'bpy.data' still? * for now they are all in collections bpy.data.images.new(...) */ func = RNA_def_function(srna, "add_image", "rna_Main_add_image"); @@ -777,8 +899,6 @@ void RNA_api_main(StructRNA *srna) RNA_def_property_flag(parm, PROP_REQUIRED); parm = RNA_def_pointer(func, "image", "Image", "", "New image"); RNA_def_function_return(func, parm); -#else - (void)srna; #endif } @@ -1015,6 +1135,23 @@ void RNA_def_main_meshes(BlenderRNA *brna, PropertyRNA *cprop) "Mesh created from object, remove it if it is only used for export"); RNA_def_function_return(func, parm); + func = RNA_def_function(srna, "new_from_dupli", "rna_Main_meshes_new_from_dupli"); + RNA_def_function_ui_description(func, "Add a new mesh created from dupli cache data"); + RNA_def_function_flag(func, FUNC_USE_REPORTS); + parm = RNA_def_pointer(func, "scene", "Scene", "", "Scene within which to evaluate modifiers"); + RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL); + parm = RNA_def_pointer(func, "parent", "Object", "", "Duplicator parent of the object"); + RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL); + parm = RNA_def_pointer(func, "dupli_object", "DupliObject", "", "Dupli Object to create mesh from"); + RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL); + parm = RNA_def_enum(func, "settings", mesh_type_items, 0, "", "Modifier settings to apply"); + RNA_def_property_flag(parm, PROP_REQUIRED); + RNA_def_boolean(func, "calc_tessface", true, "Calculate Tessellation", "Calculate tessellation faces"); + RNA_def_boolean(func, "calc_undeformed", false, "Calculate Undeformed", "Calculate undeformed vertex coordinates"); + parm = RNA_def_pointer(func, "mesh", "Mesh", "", + "Mesh created from object, remove it if it is only used for export"); + RNA_def_function_return(func, parm); + func = RNA_def_function(srna, "remove", "rna_Main_meshes_remove"); RNA_def_function_flag(func, FUNC_USE_REPORTS); RNA_def_function_ui_description(func, "Remove a mesh from the current blendfile"); @@ -1152,6 +1289,7 @@ void RNA_def_main_images(BlenderRNA *brna, PropertyRNA *cprop) RNA_def_property_flag(parm, PROP_REQUIRED); RNA_def_boolean(func, "alpha", 0, "Alpha", "Use alpha channel"); RNA_def_boolean(func, "float_buffer", 0, "Float Buffer", "Create an image with floating point color"); + RNA_def_boolean(func, "stereo3d", 0, "Stereo 3D", "Create left and right views"); /* return type */ parm = RNA_def_pointer(func, "image", "Image", "", "New image datablock"); RNA_def_function_return(func, parm); @@ -1562,7 +1700,21 @@ void RNA_def_main_sounds(BlenderRNA *brna, PropertyRNA *cprop) RNA_def_struct_sdna(srna, "Main"); RNA_def_struct_ui_text(srna, "Main Sounds", "Collection of sounds"); - /* TODO, 'load' */ + /* load func */ + func = RNA_def_function(srna, "load", "rna_Main_sounds_load"); + RNA_def_function_ui_description(func, "Add a new sound to the main database from a file"); + parm = RNA_def_string_file_path(func, "filepath", "Path", FILE_MAX, "", "path for the datablock"); + RNA_def_property_flag(parm, PROP_REQUIRED); + /* return type */ + parm = RNA_def_pointer(func, "sound", "Sound", "", "New text datablock"); + RNA_def_function_return(func, parm); + + func = RNA_def_function(srna, "remove", "rna_Main_sounds_remove"); + RNA_def_function_flag(func, FUNC_USE_REPORTS); + RNA_def_function_ui_description(func, "Remove a sound from the current blendfile"); + parm = RNA_def_pointer(func, "sound", "Sound", "", "Sound to remove"); + RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL | PROP_RNAPTR); + RNA_def_property_clear_flag(parm, PROP_THICK_WRAP); func = RNA_def_function(srna, "tag", "rna_Main_sounds_tag"); parm = RNA_def_boolean(func, "value", 0, "Value", ""); @@ -1678,7 +1830,41 @@ void RNA_def_main_particles(BlenderRNA *brna, PropertyRNA *cprop) 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_palettes(BlenderRNA *brna, PropertyRNA *cprop) +{ + StructRNA *srna; + FunctionRNA *func; + PropertyRNA *parm; + PropertyRNA *prop; + + RNA_def_property_srna(cprop, "BlendDataPalettes"); + srna = RNA_def_struct(brna, "BlendDataPalettes", NULL); + RNA_def_struct_sdna(srna, "Main"); + RNA_def_struct_ui_text(srna, "Main Palettes", "Collection of palettes"); + + func = RNA_def_function(srna, "new", "rna_Main_palettes_new"); + RNA_def_function_ui_description(func, "Add a new palette to the main database"); + parm = RNA_def_string(func, "name", "Palette", 0, "", "New name for the datablock"); + RNA_def_property_flag(parm, PROP_REQUIRED); + /* return type */ + parm = RNA_def_pointer(func, "palette", "Palette", "", "New palette datablock"); + RNA_def_function_return(func, parm); + + func = RNA_def_function(srna, "remove", "rna_Main_palettes_remove"); + RNA_def_function_flag(func, FUNC_USE_REPORTS); + RNA_def_function_ui_description(func, "Remove a palette from the current blendfile"); + parm = RNA_def_pointer(func, "palette", "Palette", "", "Palette to remove"); + RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL | PROP_RNAPTR); + RNA_def_property_clear_flag(parm, PROP_THICK_WRAP); + + func = RNA_def_function(srna, "tag", "rna_Main_palettes_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_palettes_is_updated_get", NULL); +} void RNA_def_main_gpencil(BlenderRNA *brna, PropertyRNA *cprop) { StructRNA *srna; @@ -1813,4 +1999,39 @@ void RNA_def_main_linestyles(BlenderRNA *brna, PropertyRNA *cprop) RNA_def_property_boolean_funcs(prop, "rna_Main_linestyle_is_updated_get", NULL); } +void RNA_def_main_cache_libraries(BlenderRNA *brna, PropertyRNA *cprop) +{ + StructRNA *srna; + FunctionRNA *func; + PropertyRNA *parm; + PropertyRNA *prop; + + RNA_def_property_srna(cprop, "BlendDataCacheLibraries"); + srna = RNA_def_struct(brna, "BlendDataCacheLibraries", NULL); + RNA_def_struct_sdna(srna, "Main"); + RNA_def_struct_ui_text(srna, "Main Cache Libraries", "Collection of cache libraries"); + + func = RNA_def_function(srna, "tag", "rna_Main_cachelibraries_tag"); + parm = RNA_def_boolean(func, "value", 0, "Value", ""); + RNA_def_property_flag(parm, PROP_REQUIRED); + + func = RNA_def_function(srna, "new", "rna_Main_cachelibraries_new"); + RNA_def_function_ui_description(func, "Add a new cache library to the main database"); + parm = RNA_def_string(func, "name", "CacheLibrary", 0, "", "New name for the datablock"); + RNA_def_property_flag(parm, PROP_REQUIRED); + /* return type */ + parm = RNA_def_pointer(func, "cachelib", "CacheLibrary", "", "New cache library datablock"); + RNA_def_function_return(func, parm); + + func = RNA_def_function(srna, "remove", "rna_Main_cachelibraries_remove"); + RNA_def_function_flag(func, FUNC_USE_REPORTS); + RNA_def_function_ui_description(func, "Remove a cache library from the current blendfile"); + parm = RNA_def_pointer(func, "cachelib", "CacheLibrary", "", "Cache Library to remove"); + 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_cachelibraries_is_updated_get", NULL); +} + #endif diff --git a/source/blender/makesrna/intern/rna_material.c b/source/blender/makesrna/intern/rna_material.c index 7a06b647ae3..874e861f75f 100644 --- a/source/blender/makesrna/intern/rna_material.c +++ b/source/blender/makesrna/intern/rna_material.c @@ -377,7 +377,7 @@ static EnumPropertyItem *rna_Material_texture_coordinates_itemf(bContext *UNUSED MTex *rna_mtex_texture_slots_add(ID *self_id, struct bContext *C, ReportList *reports) { - MTex *mtex = add_mtex_id(self_id, -1); + MTex *mtex = BKE_texture_mtex_add_id(self_id, -1); if (mtex == NULL) { BKE_reportf(reports, RPT_ERROR, "Maximum number of textures added %d", MAX_MTEX); return NULL; @@ -398,7 +398,7 @@ MTex *rna_mtex_texture_slots_create(ID *self_id, struct bContext *C, ReportList return NULL; } - mtex = add_mtex_id(self_id, index); + mtex = BKE_texture_mtex_add_id(self_id, index); /* for redraw only */ WM_event_add_notifier(C, NC_TEXTURE, CTX_data_scene(C)); diff --git a/source/blender/makesrna/intern/rna_mesh.c b/source/blender/makesrna/intern/rna_mesh.c index 400e98befd0..9b25fbbaca3 100644 --- a/source/blender/makesrna/intern/rna_mesh.c +++ b/source/blender/makesrna/intern/rna_mesh.c @@ -55,6 +55,8 @@ EnumPropertyItem mesh_delimit_mode_items[] = { {BMO_DELIM_NORMAL, "NORMAL", 0, "Normal", "Delimit by face directions"}, {BMO_DELIM_MATERIAL, "MATERIAL", 0, "Material", "Delimit by face material"}, {BMO_DELIM_SEAM, "SEAM", 0, "Seam", "Delimit by edge seams"}, + {BMO_DELIM_SHARP, "SHARP", 0, "Sharp", "Delimit by sharp edges"}, + {BMO_DELIM_UV, "UV", 0, "UVs", "Delimit by UV coordinates"}, {0, NULL, 0, NULL, NULL}, }; diff --git a/source/blender/makesrna/intern/rna_mesh_api.c b/source/blender/makesrna/intern/rna_mesh_api.c index a994bf5e9d1..632b07c19ce 100644 --- a/source/blender/makesrna/intern/rna_mesh_api.c +++ b/source/blender/makesrna/intern/rna_mesh_api.c @@ -69,47 +69,6 @@ static void rna_Mesh_create_normals_split(Mesh *mesh) } } -static void rna_Mesh_calc_normals_split(Mesh *mesh) -{ - float (*r_loopnors)[3]; - float (*polynors)[3]; - short (*clnors)[2] = NULL; - bool free_polynors = false; - - if (CustomData_has_layer(&mesh->ldata, CD_NORMAL)) { - r_loopnors = CustomData_get_layer(&mesh->ldata, CD_NORMAL); - memset(r_loopnors, 0, sizeof(float[3]) * mesh->totloop); - } - else { - r_loopnors = CustomData_add_layer(&mesh->ldata, CD_NORMAL, CD_CALLOC, NULL, mesh->totloop); - CustomData_set_layer_flag(&mesh->ldata, CD_NORMAL, CD_FLAG_TEMPORARY); - } - - /* may be NULL */ - clnors = CustomData_get_layer(&mesh->ldata, CD_CUSTOMLOOPNORMAL); - - if (CustomData_has_layer(&mesh->pdata, CD_NORMAL)) { - /* This assume that layer is always up to date, not sure this is the case (esp. in Edit mode?)... */ - polynors = CustomData_get_layer(&mesh->pdata, CD_NORMAL); - free_polynors = false; - } - else { - polynors = MEM_mallocN(sizeof(float[3]) * mesh->totpoly, __func__); - BKE_mesh_calc_normals_poly(mesh->mvert, mesh->totvert, mesh->mloop, mesh->mpoly, mesh->totloop, mesh->totpoly, - polynors, false); - free_polynors = true; - } - - BKE_mesh_normals_loop_split( - mesh->mvert, mesh->totvert, mesh->medge, mesh->totedge, - mesh->mloop, r_loopnors, mesh->totloop, mesh->mpoly, (const float (*)[3])polynors, mesh->totpoly, - (mesh->flag & ME_AUTOSMOOTH) != 0, mesh->smoothresh, NULL, clnors, NULL); - - if (free_polynors) { - MEM_freeN(polynors); - } -} - static void rna_Mesh_free_normals_split(Mesh *mesh) { CustomData_free_layers(&mesh->ldata, CD_NORMAL, mesh->totloop); @@ -130,7 +89,7 @@ static void rna_Mesh_calc_tangents(Mesh *mesh, ReportList *reports, const char * /* Compute loop normals if needed. */ if (!CustomData_has_layer(&mesh->ldata, CD_NORMAL)) { - rna_Mesh_calc_normals_split(mesh); + BKE_mesh_calc_normals_split(mesh); } BKE_mesh_loop_tangents(mesh, uvmap, r_looptangents, reports); @@ -211,6 +170,8 @@ static void rna_Mesh_normals_split_custom_set(Mesh *mesh, ReportList *reports, i } rna_Mesh_normals_split_custom_do(mesh, loopnors, false); + + DAG_id_tag_update(&mesh->id, 0); } static void rna_Mesh_normals_split_custom_set_from_vertices( @@ -227,6 +188,8 @@ static void rna_Mesh_normals_split_custom_set_from_vertices( } rna_Mesh_normals_split_custom_do(mesh, vertnors, true); + + DAG_id_tag_update(&mesh->id, 0); } static void rna_Mesh_transform(Mesh *mesh, float *mat, int shape_keys) @@ -256,7 +219,7 @@ void RNA_api_mesh(StructRNA *srna) func = RNA_def_function(srna, "create_normals_split", "rna_Mesh_create_normals_split"); RNA_def_function_ui_description(func, "Empty split vertex normals"); - func = RNA_def_function(srna, "calc_normals_split", "rna_Mesh_calc_normals_split"); + func = RNA_def_function(srna, "calc_normals_split", "BKE_mesh_calc_normals_split"); RNA_def_function_ui_description(func, "Calculate split vertex normals, which preserve sharp edges"); func = RNA_def_function(srna, "free_normals_split", "rna_Mesh_free_normals_split"); @@ -279,7 +242,7 @@ void RNA_api_mesh(StructRNA *srna) RNA_def_boolean(func, "free_mpoly", 0, "Free MPoly", "Free data used by polygons and loops. " "WARNING: This destructive operation removes regular faces, " "only used on temporary mesh data-blocks to reduce memory footprint of render " - "engines and export scripts."); + "engines and export scripts"); func = RNA_def_function(srna, "calc_smooth_groups", "rna_Mesh_calc_smooth_groups"); RNA_def_function_ui_description(func, "Calculate smooth groups from sharp edges"); diff --git a/source/blender/makesrna/intern/rna_mesh_sample.c b/source/blender/makesrna/intern/rna_mesh_sample.c new file mode 100644 index 00000000000..81a3f4bf5e4 --- /dev/null +++ b/source/blender/makesrna/intern/rna_mesh_sample.c @@ -0,0 +1,73 @@ +/* + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * ***** END GPL LICENSE BLOCK ***** + */ + +/** \file blender/makesrna/intern/rna_mesh_sample.c + * \ingroup RNA + */ + +#include <stdlib.h> + +#include "MEM_guardedalloc.h" + +#include "DNA_meshdata_types.h" + +#include "BLI_utildefines.h" + +#include "BKE_mesh_sample.h" + +#include "RNA_access.h" +#include "RNA_define.h" +#include "RNA_types.h" + +#include "rna_internal.h" + +#include "WM_types.h" + + +#ifdef RNA_RUNTIME + +#include "WM_api.h" +#include "WM_types.h" + + + +#else + +static void rna_def_mesh_sample(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + + srna = RNA_def_struct(brna, "MeshSample", NULL); + RNA_def_struct_sdna(srna, "MSurfaceSample"); + RNA_def_struct_ui_text(srna, "Mesh Sample", "Point on a mesh that follows deformation"); + + prop = RNA_def_property(srna, "vertex_indices", PROP_INT, PROP_UNSIGNED); + RNA_def_property_int_sdna(prop, NULL, "orig_verts"); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Vertex Indices", "Index of the mesh vertices used for interpolation"); +} + +void RNA_def_mesh_sample(BlenderRNA *brna) +{ + rna_def_mesh_sample(brna); +} + +#endif diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c index fb01a407b73..859f2760b29 100644 --- a/source/blender/makesrna/intern/rna_modifier.c +++ b/source/blender/makesrna/intern/rna_modifier.c @@ -92,6 +92,7 @@ EnumPropertyItem modifier_type_items[] = { {0, "", 0, N_("Deform"), ""}, {eModifierType_Armature, "ARMATURE", ICON_MOD_ARMATURE, "Armature", ""}, {eModifierType_Cast, "CAST", ICON_MOD_CAST, "Cast", ""}, + {eModifierType_CorrectiveSmooth, "CORRECTIVE_SMOOTH", ICON_MOD_SMOOTH, "Corrective Smooth", ""}, {eModifierType_Curve, "CURVE", ICON_MOD_CURVE, "Curve", ""}, {eModifierType_Displace, "DISPLACE", ICON_MOD_DISPLACE, "Displace", ""}, {eModifierType_Hook, "HOOK", ICON_HOOK, "Hook", ""}, @@ -379,6 +380,8 @@ static StructRNA *rna_Modifier_refine(struct PointerRNA *ptr) return &RNA_DataTransferModifier; case eModifierType_NormalEdit: return &RNA_NormalEditModifier; + case eModifierType_CorrectiveSmooth: + return &RNA_CorrectiveSmoothModifier; /* Default */ case eModifierType_None: case eModifierType_ShapeKey: @@ -407,7 +410,7 @@ static void rna_Modifier_name_set(PointerRNA *ptr, const char *value) } /* fix all the animation data which may link to this */ - BKE_all_animdata_fix_paths_rename(NULL, "modifiers", oldname, md->name); + BKE_animdata_fix_paths_rename_all(NULL, "modifiers", oldname, md->name); } static char *rna_Modifier_path(PointerRNA *ptr) @@ -446,6 +449,7 @@ RNA_MOD_VGROUP_NAME_SET(Cast, defgrp_name); RNA_MOD_VGROUP_NAME_SET(Curve, name); RNA_MOD_VGROUP_NAME_SET(DataTransfer, defgrp_name); RNA_MOD_VGROUP_NAME_SET(Decimate, defgrp_name); +RNA_MOD_VGROUP_NAME_SET(CorrectiveSmooth, defgrp_name); RNA_MOD_VGROUP_NAME_SET(Displace, defgrp_name); RNA_MOD_VGROUP_NAME_SET(Hook, name); RNA_MOD_VGROUP_NAME_SET(LaplacianDeform, anchor_grp_name); @@ -1036,6 +1040,33 @@ static EnumPropertyItem *rna_DataTransferModifier_mix_mode_itemf(bContext *C, Po return item; } +static void rna_CorrectiveSmoothModifier_update(Main *bmain, Scene *scene, PointerRNA *ptr) +{ + CorrectiveSmoothModifierData *csmd = (CorrectiveSmoothModifierData *)ptr->data; + + MEM_SAFE_FREE(csmd->delta_cache); + + rna_Modifier_update(bmain, scene, ptr); +} + +static void rna_CorrectiveSmoothModifier_rest_source_update(Main *bmain, Scene *scene, PointerRNA *ptr) +{ + CorrectiveSmoothModifierData *csmd = (CorrectiveSmoothModifierData *)ptr->data; + + if (csmd->rest_source != MOD_CORRECTIVESMOOTH_RESTSOURCE_BIND) { + MEM_SAFE_FREE(csmd->bind_coords); + csmd->bind_coords_num = 0; + } + + rna_CorrectiveSmoothModifier_update(bmain, scene, ptr); +} + +static int rna_CorrectiveSmoothModifier_is_bind_get(PointerRNA *ptr) +{ + CorrectiveSmoothModifierData *csmd = (CorrectiveSmoothModifierData *)ptr->data; + return (csmd->bind_coords != NULL); +} + static int rna_ParticleInstanceModifier_particle_system_poll(PointerRNA *ptr, const PointerRNA value) { ParticleInstanceModifierData *psmd = ptr->data; @@ -1441,7 +1472,7 @@ static void rna_def_modifier_mirror(BlenderRNA *brna) RNA_def_property_float_sdna(prop, NULL, "tolerance"); RNA_def_property_range(prop, 0, FLT_MAX); RNA_def_property_ui_range(prop, 0, 1, 0.01, 6); - RNA_def_property_ui_text(prop, "Merge Limit", "Distance from axis within which mirrored vertices are merged"); + RNA_def_property_ui_text(prop, "Merge Limit", "Distance within which mirrored vertices are merged"); RNA_def_property_update(prop, 0, "rna_Modifier_update"); prop = RNA_def_property(srna, "mirror_object", PROP_POINTER, PROP_NONE); @@ -1514,6 +1545,13 @@ static void rna_def_modifier_decimate(BlenderRNA *brna) RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_DECIM_FLAG_TRIANGULATE); RNA_def_property_ui_text(prop, "Triangulate", "Keep triangulated faces resulting from decimation (collapse only)"); RNA_def_property_update(prop, 0, "rna_Modifier_update"); + + prop = RNA_def_property(srna, "vertex_group_factor", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "defgrp_factor"); + RNA_def_property_range(prop, 0, 1000); + RNA_def_property_ui_range(prop, 0, 10, 1, 4); + RNA_def_property_ui_text(prop, "Factor", "Vertex group strength"); + RNA_def_property_update(prop, 0, "rna_Modifier_update"); /* end collapse-only option */ /* (mode == MOD_DECIM_MODE_DISSOLVE) */ @@ -2155,6 +2193,90 @@ static void rna_def_modifier_smooth(BlenderRNA *brna) RNA_def_property_update(prop, 0, "rna_Modifier_update"); } + +static void rna_def_modifier_correctivesmooth(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + + static EnumPropertyItem modifier_smooth_type_items[] = { + {MOD_CORRECTIVESMOOTH_SMOOTH_SIMPLE, "SIMPLE", 0, "Simple", + "Use the average of adjacent edge-vertices"}, + {MOD_CORRECTIVESMOOTH_SMOOTH_LENGTH_WEIGHT, "LENGTH_WEIGHTED", 0, "Length Weight", + "Use the average of adjacent edge-vertices weighted by their length"}, + {0, NULL, 0, NULL, NULL} + }; + + static EnumPropertyItem modifier_rest_source_items[] = { + {MOD_CORRECTIVESMOOTH_RESTSOURCE_ORCO, "ORCO", 0, "Original Coords", + "Use base mesh vert coords as the rest position"}, + {MOD_CORRECTIVESMOOTH_RESTSOURCE_BIND, "BIND", 0, "Bind Coords", + "Use bind vert coords for rest position"}, + {0, NULL, 0, NULL, NULL} + }; + + srna = RNA_def_struct(brna, "CorrectiveSmoothModifier", "Modifier"); + RNA_def_struct_ui_text(srna, "Corrective Smooth Modifier", "Correct distortion caused by deformation"); + RNA_def_struct_sdna(srna, "CorrectiveSmoothModifierData"); + RNA_def_struct_ui_icon(srna, ICON_MOD_SMOOTH); + + prop = RNA_def_property(srna, "factor", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "lambda"); + RNA_def_property_range(prop, -FLT_MAX, FLT_MAX); + RNA_def_property_ui_range(prop, 0.0, 1.0, 5, 3); + RNA_def_property_ui_text(prop, "Lambda Factor", "Smooth factor effect"); + RNA_def_property_update(prop, 0, "rna_CorrectiveSmoothModifier_update"); + + prop = RNA_def_property(srna, "iterations", PROP_INT, PROP_NONE); + RNA_def_property_int_sdna(prop, NULL, "repeat"); + RNA_def_property_ui_range(prop, 0, 200, 1, -1); + RNA_def_property_ui_text(prop, "Repeat", ""); + RNA_def_property_update(prop, 0, "rna_CorrectiveSmoothModifier_update"); + + prop = RNA_def_property(srna, "rest_source", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "rest_source"); + RNA_def_property_enum_items(prop, modifier_rest_source_items); + RNA_def_property_ui_text(prop, "Rest Source", "Select the source of rest positions"); + RNA_def_property_update(prop, 0, "rna_CorrectiveSmoothModifier_rest_source_update"); + + prop = RNA_def_property(srna, "smooth_type", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "smooth_type"); + RNA_def_property_enum_items(prop, modifier_smooth_type_items); + RNA_def_property_ui_text(prop, "Smooth Type", "Method used for smoothing"); + RNA_def_property_update(prop, 0, "rna_CorrectiveSmoothModifier_update"); + + prop = RNA_def_property(srna, "invert_vertex_group", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_CORRECTIVESMOOTH_INVERT_VGROUP); + RNA_def_property_ui_text(prop, "Invert", "Invert vertex group influence"); + RNA_def_property_update(prop, 0, "rna_CorrectiveSmoothModifier_update"); + + prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE); + RNA_def_property_string_sdna(prop, NULL, "defgrp_name"); + RNA_def_property_ui_text(prop, "Vertex Group", + "Name of Vertex Group which determines influence of modifier per point"); + RNA_def_property_string_funcs(prop, NULL, NULL, "rna_CorrectiveSmoothModifier_defgrp_name_set"); + RNA_def_property_update(prop, 0, "rna_CorrectiveSmoothModifier_update"); + + prop = RNA_def_property(srna, "is_bind", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_ui_text(prop, "Bind current shape", ""); + RNA_def_property_boolean_funcs(prop, "rna_CorrectiveSmoothModifier_is_bind_get", NULL); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_update(prop, 0, "rna_Modifier_update"); + + prop = RNA_def_property(srna, "use_only_smooth", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_CORRECTIVESMOOTH_ONLY_SMOOTH); + RNA_def_property_ui_text(prop, "Only Smooth", + "Apply smoothing without reconstructing the surface"); + RNA_def_property_update(prop, 0, "rna_Modifier_update"); + + prop = RNA_def_property(srna, "use_pin_boundary", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_CORRECTIVESMOOTH_PIN_BOUNDARY); + RNA_def_property_ui_text(prop, "Pin Boundaries", + "Excludes boundary vertices from being smoothed"); + RNA_def_property_update(prop, 0, "rna_CorrectiveSmoothModifier_update"); +} + + static void rna_def_modifier_laplaciansmooth(BlenderRNA *brna) { StructRNA *srna; @@ -2485,6 +2607,18 @@ static void rna_def_modifier_particleinstance(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Random Position", "Randomize position along path"); RNA_def_property_update(prop, 0, "rna_Modifier_update"); + prop = RNA_def_property(srna, "rotation", PROP_FLOAT, PROP_FACTOR); + RNA_def_property_float_sdna(prop, NULL, "rotation"); + RNA_def_property_range(prop, 0.0, 1.0); + RNA_def_property_ui_text(prop, "Rotation", "Rotation around path"); + RNA_def_property_update(prop, 0, "rna_Modifier_update"); + + prop = RNA_def_property(srna, "random_rotation", PROP_FLOAT, PROP_FACTOR); + RNA_def_property_float_sdna(prop, NULL, "random_rotation"); + RNA_def_property_range(prop, 0.0, 1.0); + RNA_def_property_ui_text(prop, "Random Rotation", "Randomize rotation around path"); + RNA_def_property_update(prop, 0, "rna_Modifier_update"); + prop = RNA_def_property(srna, "particle_amount", PROP_FLOAT, PROP_FACTOR); RNA_def_property_range(prop, 0.0, 1.0); RNA_def_property_ui_text(prop, "Particle Amount", "Amount of particles to use for instancing"); @@ -2584,7 +2718,7 @@ static void rna_def_modifier_cloth(BlenderRNA *brna) RNA_def_property_struct_type(prop, "ClothSolverResult"); RNA_def_property_pointer_sdna(prop, NULL, "solver_result"); RNA_def_property_ui_text(prop, "Solver Result", ""); - + prop = RNA_def_property(srna, "point_cache", PROP_POINTER, PROP_NONE); RNA_def_property_flag(prop, PROP_NEVER_NULL); RNA_def_property_ui_text(prop, "Point Cache", ""); @@ -4504,7 +4638,7 @@ static void rna_def_modifier_normaledit(BlenderRNA *brna) RNA_def_property_string_funcs(prop, NULL, NULL, "rna_NormalEditModifier_defgrp_name_set"); RNA_def_property_update(prop, 0, "rna_Modifier_update"); - prop = RNA_def_property(srna, "use_invert_vertex_group", PROP_BOOLEAN, PROP_NONE); + prop = RNA_def_property(srna, "invert_vertex_group", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_NORMALEDIT_INVERT_VGROUP); RNA_def_property_ui_text(prop, "Invert", "Invert vertex group influence"); RNA_def_property_update(prop, 0, "rna_Modifier_update"); @@ -4606,6 +4740,7 @@ void RNA_def_modifier(BlenderRNA *brna) rna_def_modifier_displace(brna); rna_def_modifier_uvproject(brna); rna_def_modifier_smooth(brna); + rna_def_modifier_correctivesmooth(brna); rna_def_modifier_cast(brna); rna_def_modifier_meshdeform(brna); rna_def_modifier_particlesystem(brna); diff --git a/source/blender/makesrna/intern/rna_movieclip.c b/source/blender/makesrna/intern/rna_movieclip.c index e891ab520f9..9ccde654af2 100644 --- a/source/blender/makesrna/intern/rna_movieclip.c +++ b/source/blender/makesrna/intern/rna_movieclip.c @@ -196,7 +196,7 @@ static void rna_def_movieclip_proxy(BlenderRNA *brna) RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_enum_items(prop, clip_tc_items); RNA_def_property_ui_text(prop, "Timecode", ""); - RNA_def_property_update(prop, NC_MOVIECLIP | ND_DISPLAY, NULL); + RNA_def_property_update(prop, NC_MOVIECLIP | ND_DISPLAY, "rna_MovieClip_reload_update"); /* directory */ prop = RNA_def_property(srna, "directory", PROP_STRING, PROP_DIRPATH); diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c index eb2cb9e9312..f7570f7eaf0 100644 --- a/source/blender/makesrna/intern/rna_nodetree.c +++ b/source/blender/makesrna/intern/rna_nodetree.c @@ -39,6 +39,7 @@ #include "DNA_mesh_types.h" #include "DNA_node_types.h" #include "DNA_object_types.h" +#include "DNA_particle_types.h" #include "DNA_scene_types.h" #include "DNA_text_types.h" #include "DNA_texture_types.h" @@ -64,6 +65,8 @@ #include "MEM_guardedalloc.h" +#include "RE_render_ext.h" + EnumPropertyItem node_socket_in_out_items[] = { { SOCK_IN, "IN", 0, "Input", "" }, { SOCK_OUT, "OUT", 0, "Output", "" }, @@ -1549,7 +1552,7 @@ static void rna_Node_name_set(PointerRNA *ptr, const char *value) nodeUniqueName(ntree, node); /* fix all the animation data which may link to this */ - BKE_all_animdata_fix_paths_rename(NULL, "nodes", oldname, node->name); + BKE_animdata_fix_paths_rename_all(NULL, "nodes", oldname, node->name); } static bNodeSocket *rna_Node_inputs_new(ID *id, bNode *node, ReportList *reports, const char *type, const char *name, const char *identifier) @@ -1578,7 +1581,7 @@ static bNodeSocket *rna_Node_outputs_new(ID *id, bNode *node, ReportList *report sock = nodeAddSocket(ntree, node, SOCK_OUT, type, identifier, name); if (sock == NULL) { - BKE_reportf(reports, RPT_ERROR, "Unable to create socket"); + BKE_report(reports, RPT_ERROR, "Unable to create socket"); } else { ntreeUpdateTree(G.main, ntree); @@ -2258,8 +2261,13 @@ static void rna_NodeSocketStandard_value_update(struct bContext *C, PointerRNA * nodeFindNode(ntree, sock, &node, NULL); } - if (node) + if (node) { nodeSynchronizeID(node, true); + + /* extra update for sockets that get synced to material */ + if (node->id && ELEM(node->type, SH_NODE_MATERIAL, SH_NODE_MATERIAL_EXT)) + WM_main_add_notifier(NC_MATERIAL | ND_SHADING_DRAW, node->id); + } } @@ -2616,6 +2624,70 @@ static EnumPropertyItem *rna_Node_image_layer_itemf(bContext *UNUSED(C), Pointer return item; } +static int rna_Node_image_has_layers_get(PointerRNA *ptr) +{ + bNode *node = (bNode *)ptr->data; + Image *ima = (Image *)node->id; + + if (!ima || !(ima->rr)) return 0; + + return RE_layers_have_name(ima->rr); +} + +static int rna_Node_image_has_views_get(PointerRNA *ptr) +{ + bNode *node = (bNode *)ptr->data; + Image *ima = (Image *)node->id; + + if (!ima || !(ima->rr)) return 0; + + return BLI_listbase_count_ex(&ima->rr->views, 2) > 1; +} + +static EnumPropertyItem *renderresult_views_add_enum(RenderView *rv) +{ + EnumPropertyItem *item = NULL; + EnumPropertyItem tmp = {0, "ALL", 0, "All", ""}; + int i = 1, totitem = 0; + + /* option to use all views */ + RNA_enum_item_add(&item, &totitem, &tmp); + + while (rv) { + tmp.identifier = rv->name; + /* little trick: using space char instead empty string makes the item selectable in the dropdown */ + if (rv->name[0] == '\0') + tmp.name = " "; + else + tmp.name = rv->name; + tmp.value = i++; + RNA_enum_item_add(&item, &totitem, &tmp); + rv = rv->next; + } + + RNA_enum_item_end(&item, &totitem); + + return item; +} + +static EnumPropertyItem *rna_Node_image_view_itemf(bContext *UNUSED(C), PointerRNA *ptr, + PropertyRNA *UNUSED(prop), bool *free) +{ + bNode *node = (bNode *)ptr->data; + Image *ima = (Image *)node->id; + EnumPropertyItem *item = NULL; + RenderView *rv; + + if (!ima || !(ima->rr)) return NULL; + + rv = ima->rr->views.first; + item = renderresult_views_add_enum(rv); + + *free = true; + + return item; +} + static EnumPropertyItem *rna_Node_scene_layer_itemf(bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *r_free) { @@ -2701,7 +2773,7 @@ static void rna_Image_Node_update_id(Main *UNUSED(bmain), Scene *UNUSED(scene), static void rna_Mapping_Node_update(Main *bmain, Scene *scene, PointerRNA *ptr) { bNode *node = ptr->data; - init_tex_mapping(node->storage); + BKE_texture_mapping_init(node->storage); rna_Node_update(bmain, scene, ptr); } @@ -2900,6 +2972,89 @@ static void rna_CompositorNodeScale_update(Main *bmain, Scene *scene, PointerRNA rna_Node_update(bmain, scene, ptr); } +static PointerRNA rna_ShaderNodePointDensity_psys_get(PointerRNA *ptr) +{ + bNode *node = ptr->data; + NodeShaderTexPointDensity *shader_point_density = node->storage; + Object *ob = (Object*)node->id; + ParticleSystem *psys = NULL; + PointerRNA value; + + if (ob && shader_point_density->particle_system) { + psys = BLI_findlink(&ob->particlesystem, shader_point_density->particle_system - 1); + } + + RNA_pointer_create(&ob->id, &RNA_ParticleSystem, psys, &value); + return value; +} + +static void rna_ShaderNodePointDensity_psys_set(PointerRNA *ptr, PointerRNA value) +{ + bNode *node = ptr->data; + NodeShaderTexPointDensity *shader_point_density = node->storage; + Object *ob = (Object*)node->id; + + if (ob && value.id.data == ob) { + shader_point_density->particle_system = BLI_findindex(&ob->particlesystem, value.data) + 1; + } + else { + shader_point_density->particle_system = 0; + } +} + +static int point_density_color_source_from_shader(NodeShaderTexPointDensity *shader_point_density) +{ + switch (shader_point_density->color_source) { + case SHD_POINTDENSITY_COLOR_CONSTANT: return TEX_PD_COLOR_CONSTANT; + case SHD_POINTDENSITY_COLOR_PARTAGE: return TEX_PD_COLOR_PARTAGE; + case SHD_POINTDENSITY_COLOR_PARTSPEED: return TEX_PD_COLOR_PARTSPEED; + case SHD_POINTDENSITY_COLOR_PARTVEL: return TEX_PD_COLOR_PARTVEL; + case SHD_POINTDENSITY_COLOR_PARTTEX: return TEX_PD_COLOR_PARTTEX; + default: BLI_assert(false); return TEX_PD_COLOR_CONSTANT; + } +} + +/* TODO(sergey): This functio nassumes allocated array was passed, + * works fine with Cycles via C++ RNA, but fails with call from python. + */ +void rna_ShaderNodePointDensity_density_calc(bNode *self, Scene *scene, int *length, float **values) +{ + NodeShaderTexPointDensity *shader_point_density = self->storage; + PointDensity pd; + + *length = 4 * shader_point_density->resolution * + shader_point_density->resolution * + shader_point_density->resolution; + + if (*values == NULL) { + *values = MEM_mallocN(sizeof(float) * (*length), "point density dynamic array"); + } + + /* Create PointDensity structure from node for sampling. */ + BKE_texture_pointdensity_init_data(&pd); + pd.object = (Object *)self->id; + pd.radius = shader_point_density->radius; + if (shader_point_density->point_source == SHD_POINTDENSITY_SOURCE_PSYS) { + pd.source = TEX_PD_PSYS; + pd.psys = shader_point_density->particle_system; + pd.psys_cache_space = TEX_PD_OBJECTSPACE; + } + else { + BLI_assert(shader_point_density->point_source == SHD_POINTDENSITY_SOURCE_OBJECT); + pd.source = TEX_PD_OBJECT; + pd.ob_cache_space = TEX_PD_OBJECTSPACE; + } + pd.color_source = point_density_color_source_from_shader(shader_point_density); + + /* Single-threaded sampling of the voxel domain. */ + RE_sample_point_density(scene, &pd, + shader_point_density->resolution, + *values); + + /* We're done, time to clean up. */ + BKE_texture_pointdensity_free_data(&pd); +} + #else static EnumPropertyItem prop_image_layer_items[] = { @@ -2907,6 +3062,11 @@ static EnumPropertyItem prop_image_layer_items[] = { {0, NULL, 0, NULL, NULL} }; +static EnumPropertyItem prop_image_view_items[] = { + { 0, "ALL", 0, "All", ""}, + {0, NULL, 0, NULL, NULL} +}; + static EnumPropertyItem prop_scene_layer_items[] = { { 0, "PLACEHOLDER", 0, "Placeholder", ""}, {0, NULL, 0, NULL, NULL} @@ -3234,6 +3394,8 @@ static void def_sh_mapping(StructRNA *srna) {0, NULL, 0, NULL, NULL} }; + static float default_1[3] = {1.f, 1.f, 1.f}; + PropertyRNA *prop; RNA_def_struct_sdna_from(srna, "TexMapping", "storage"); @@ -3257,6 +3419,7 @@ static void def_sh_mapping(StructRNA *srna) prop = RNA_def_property(srna, "scale", PROP_FLOAT, PROP_XYZ); RNA_def_property_float_sdna(prop, NULL, "size"); + RNA_def_property_float_array_default(prop, default_1); RNA_def_property_flag(prop, PROP_PROPORTIONAL); RNA_def_property_ui_text(prop, "Scale", ""); RNA_def_property_update(prop, 0, "rna_Mapping_Node_update"); @@ -3268,6 +3431,7 @@ static void def_sh_mapping(StructRNA *srna) prop = RNA_def_property(srna, "max", PROP_FLOAT, PROP_XYZ); RNA_def_property_float_sdna(prop, NULL, "max"); + RNA_def_property_float_array_default(prop, default_1); RNA_def_property_ui_text(prop, "Maximum", "Maximum value for clipping"); RNA_def_property_update(prop, 0, "rna_Mapping_Node_update"); @@ -3410,6 +3574,7 @@ static void def_sh_tex_environment(StructRNA *srna) prop = RNA_def_property(srna, "color_space", PROP_ENUM, PROP_NONE); RNA_def_property_enum_items(prop, prop_color_space_items); + RNA_def_property_enum_default(prop, SHD_COLORSPACE_COLOR); RNA_def_property_ui_text(prop, "Color Space", "Image file color space"); RNA_def_property_update(prop, 0, "rna_Node_update"); @@ -3475,6 +3640,7 @@ static void def_sh_tex_image(StructRNA *srna) prop = RNA_def_property(srna, "color_space", PROP_ENUM, PROP_NONE); RNA_def_property_enum_items(prop, prop_color_space_items); + RNA_def_property_enum_default(prop, SHD_COLORSPACE_COLOR); RNA_def_property_ui_text(prop, "Color Space", "Image file color space"); RNA_def_property_update(prop, 0, "rna_Node_update"); @@ -3715,6 +3881,105 @@ static void def_sh_tex_wireframe(StructRNA *srna) RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update"); } +static void def_sh_tex_pointdensity(StructRNA *srna) +{ + PropertyRNA *prop; + FunctionRNA *func; + + static EnumPropertyItem point_source_items[] = { + {SHD_POINTDENSITY_SOURCE_PSYS, "PARTICLE_SYSTEM", 0, "Particle System", + "Generate point density from a particle system"}, + {SHD_POINTDENSITY_SOURCE_OBJECT, "OBJECT", 0, "Object Vertices", + "Generate point density from an object's vertices"}, + {0, NULL, 0, NULL, NULL} + }; + + static const EnumPropertyItem prop_interpolation_items[] = { + {SHD_INTERP_CLOSEST, "Closest", 0, "Closest", + "No interpolation (sample closest texel)"}, + {SHD_INTERP_LINEAR, "Linear", 0, "Linear", + "Linear interpolation"}, + {SHD_INTERP_CUBIC, "Cubic", 0, "Cubic", + "Cubic interpolation (CPU only)"}, + {0, NULL, 0, NULL, NULL} + }; + + static EnumPropertyItem space_items[] = { + {SHD_POINTDENSITY_SPACE_OBJECT, "OBJECT", 0, "Object Space", ""}, + {SHD_POINTDENSITY_SPACE_WORLD, "WORLD", 0, "World Space", ""}, + {0, NULL, 0, NULL, NULL} + }; + + static EnumPropertyItem color_source_items[] = { + {SHD_POINTDENSITY_COLOR_CONSTANT, "CONSTANT", 0, "Constant", ""}, + {SHD_POINTDENSITY_COLOR_PARTAGE, "PARTICLE_AGE", 0, "Particle Age", + "Lifetime mapped as 0.0 - 1.0 intensity"}, + {SHD_POINTDENSITY_COLOR_PARTSPEED, "PARTICLE_SPEED", 0, "Particle Speed", + "Particle speed (absolute magnitude of velocity) mapped as 0.0-1.0 intensity"}, + {SHD_POINTDENSITY_COLOR_PARTVEL, "PARTICLE_VELOCITY", 0, "Particle Velocity", + "XYZ velocity mapped to RGB colors"}, + {SHD_POINTDENSITY_COLOR_PARTTEX, "PARTICLE_TEXTURE", 0, "Particle Texture", "Texture color of particles"}, + {0, NULL, 0, NULL, NULL} + }; + + prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE); + RNA_def_property_pointer_sdna(prop, NULL, "id"); + RNA_def_property_struct_type(prop, "Object"); + RNA_def_property_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Object", "Object to take point data from)"); + RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update"); + + RNA_def_struct_sdna_from(srna, "NodeShaderTexPointDensity", "storage"); + + prop = RNA_def_property(srna, "point_source", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_items(prop, point_source_items); + RNA_def_property_ui_text(prop, "Point Source", "Point data to use as renderable point density"); + RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update"); + + prop = RNA_def_property(srna, "particle_system", PROP_POINTER, PROP_NONE); + RNA_def_property_ui_text(prop, "Particle System", "Particle System to render as points"); + RNA_def_property_struct_type(prop, "ParticleSystem"); + RNA_def_property_pointer_funcs(prop, "rna_ShaderNodePointDensity_psys_get", + "rna_ShaderNodePointDensity_psys_set", NULL, NULL); + RNA_def_property_flag(prop, PROP_EDITABLE); + RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update"); + + prop = RNA_def_property(srna, "resolution", PROP_INT, PROP_NONE); + RNA_def_property_range(prop, 1, 32768); + RNA_def_property_ui_text(prop, "Resolution", "Resolution used by the texture holding the point density"); + RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update"); + + prop = RNA_def_property(srna, "radius", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "radius"); + RNA_def_property_range(prop, 0.001, FLT_MAX); + RNA_def_property_ui_text(prop, "Radius", "Radius from the shaded sample to look for points within"); + RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update"); + + prop = RNA_def_property(srna, "space", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_items(prop, space_items); + RNA_def_property_ui_text(prop, "Space", "Coordinate system to calculate voxels in"); + RNA_def_property_update(prop, 0, "rna_Node_update"); + + prop = RNA_def_property(srna, "interpolation", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_items(prop, prop_interpolation_items); + RNA_def_property_ui_text(prop, "Interpolation", "Texture interpolation"); + RNA_def_property_update(prop, 0, "rna_Node_update"); + + prop = RNA_def_property(srna, "color_source", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "color_source"); + RNA_def_property_enum_items(prop, color_source_items); + RNA_def_property_ui_text(prop, "Color Source", "Data to derive color results from"); + RNA_def_property_update(prop, 0, "rna_Node_update"); + + func = RNA_def_function(srna, "calc_point_density", "rna_ShaderNodePointDensity_density_calc"); + RNA_def_function_ui_description(func, "Calculate point density"); + RNA_def_pointer(func, "scene", "Scene", "", ""); + /* TODO, See how array size of 0 works, this shouldnt be used. */ + prop = RNA_def_float_array(func, "rgba_values", 1, NULL, 0, 0, "", "RGBA Values", 0, 0); + RNA_def_property_flag(prop, PROP_DYNAMIC); + RNA_def_function_output(func, prop); +} + static void def_glossy(StructRNA *srna) { PropertyRNA *prop; @@ -4263,6 +4528,24 @@ static void def_node_image_user(StructRNA *srna) RNA_def_property_flag(prop, PROP_ENUM_NO_TRANSLATE); RNA_def_property_ui_text(prop, "Layer", ""); RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_image_layer_update"); + + prop = RNA_def_property(srna, "has_layers", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_funcs(prop, "rna_Node_image_has_layers_get", NULL); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Has Layers", "True if this image has any named layer"); + + prop = RNA_def_property(srna, "view", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "view"); + RNA_def_property_enum_items(prop, prop_image_view_items); + RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Node_image_view_itemf"); + RNA_def_property_flag(prop, PROP_ENUM_NO_TRANSLATE); + RNA_def_property_ui_text(prop, "View", ""); + RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update"); + + prop = RNA_def_property(srna, "has_views", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_funcs(prop, "rna_Node_image_has_views_get", NULL); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Has View", "True if this image has multiple views"); } static void def_cmp_image(StructRNA *srna) @@ -5811,6 +6094,16 @@ static void def_cmp_switch(StructRNA *srna) RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update"); } +static void def_cmp_switch_view(StructRNA *srna) +{ + PropertyRNA *prop; + + prop = RNA_def_property(srna, "check", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "custom1", 0); + RNA_def_property_ui_text(prop, "Switch", "Off: first socket, On: second socket"); + RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update"); +} + static void def_cmp_colorcorrection(StructRNA *srna) { PropertyRNA *prop; diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c index 6b7b6e538a9..17c75da2c87 100644 --- a/source/blender/makesrna/intern/rna_object.c +++ b/source/blender/makesrna/intern/rna_object.c @@ -71,6 +71,7 @@ EnumPropertyItem object_mode_items[] = { {OB_MODE_WEIGHT_PAINT, "WEIGHT_PAINT", ICON_WPAINT_HLT, "Weight Paint", ""}, {OB_MODE_TEXTURE_PAINT, "TEXTURE_PAINT", ICON_TPAINT_HLT, "Texture Paint", ""}, {OB_MODE_PARTICLE_EDIT, "PARTICLE_EDIT", ICON_PARTICLEMODE, "Particle Edit", ""}, + {OB_MODE_HAIR_EDIT, "HAIR_EDIT", ICON_PARTICLEMODE, "Hair Edit", ""}, {0, NULL, 0, NULL, NULL} }; @@ -183,12 +184,15 @@ EnumPropertyItem object_axis_unsigned_items[] = { #include "BLI_math.h" #include "DNA_key_types.h" +#include "DNA_cache_library_types.h" #include "DNA_constraint_types.h" #include "DNA_lattice_types.h" #include "DNA_node_types.h" +#include "BKE_anim.h" #include "BKE_armature.h" #include "BKE_bullet.h" +#include "BKE_cache_library.h" #include "BKE_constraint.h" #include "BKE_context.h" #include "BKE_curve.h" @@ -201,6 +205,7 @@ EnumPropertyItem object_axis_unsigned_items[] = { #include "BKE_mesh.h" #include "BKE_particle.h" #include "BKE_scene.h" +#include "BKE_strands.h" #include "BKE_deform.h" #include "ED_mesh.h" @@ -1031,6 +1036,7 @@ static void rna_MaterialSlot_update(Main *bmain, Scene *scene, PointerRNA *ptr) WM_main_add_notifier(NC_OBJECT | ND_OB_SHADING, ptr->id.data); WM_main_add_notifier(NC_MATERIAL | ND_SHADING_LINKS, NULL); + DAG_relations_tag_update(bmain); } static char *rna_MaterialSlot_path(PointerRNA *ptr) @@ -1091,7 +1097,7 @@ static int rna_GameObjectSettings_physics_type_get(PointerRNA *ptr) static void rna_GameObjectSettings_physics_type_set(PointerRNA *ptr, int value) { Object *ob = (Object *)ptr->id.data; - const int was_navmesh = (ob->gameflag & OB_NAVMESH); + const int gameflag_prev = ob->gameflag; ob->body_type = value; switch (ob->body_type) { @@ -1149,7 +1155,7 @@ static void rna_GameObjectSettings_physics_type_set(PointerRNA *ptr, int value) break; } - if (was_navmesh != (ob->gameflag & OB_NAVMESH)) { + if ((gameflag_prev & OB_NAVMESH) != (ob->gameflag & OB_NAVMESH)) { 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); @@ -1469,7 +1475,7 @@ static void rna_Object_boundbox_get(PointerRNA *ptr, float *values) memcpy(values, bb->vec, sizeof(bb->vec)); } else { - fill_vn_fl(values, sizeof(bb->vec) / sizeof(float), 0.0f); + copy_vn_fl(values, sizeof(bb->vec) / sizeof(float), 0.0f); } } @@ -1661,6 +1667,120 @@ static void rna_Object_lod_distance_update(Main *UNUSED(bmain), Scene *UNUSED(sc (void)ob; #endif } + +/* settings: 1 - preview, 2 - render */ +Strands *rna_DupliObject_strands_new(DupliObject *dob, ReportList *UNUSED(reports), Scene *scene, Object *parent, ParticleSystem *psys, int settings) +{ + Strands *strands = NULL; + bool is_cached = parent->cache_library && (parent->cache_library->source_mode == CACHE_LIBRARY_SOURCE_CACHE || parent->cache_library->display_mode == CACHE_LIBRARY_DISPLAY_RESULT); + + if (is_cached) { + float frame = (float)scene->r.cfra + scene->r.subframe; + bool use_render = (settings == 2); + + if (!ELEM(settings, 1, 2)) + return NULL; + + if (!use_render && parent->dup_cache) { + DupliObjectData *data; + + /* use dupli cache for realtime dupli data if possible */ + data = BKE_dupli_cache_find_data(parent->dup_cache, dob->ob); + if (data) { + /* TODO(sergey): Consider sharing the data between viewport and + * render engine. + */ + BKE_dupli_object_data_find_strands(data, psys->name, &strands, NULL); + if (strands) { + strands = BKE_strands_copy(strands); + } + } + } + else { + DupliObjectData data; + + memset(&data, 0, sizeof(data)); + if (BKE_cache_read_dupli_object(parent->cache_library, &data, scene, dob->ob, frame, use_render, true)) { + BKE_dupli_object_data_find_strands(&data, psys->name, &strands, NULL); + if (strands) + BKE_dupli_object_data_acquire_strands(&data, strands); + } + + BKE_dupli_object_data_clear(&data); + } + } + + return strands; +} + +static void rna_DupliObject_strands_free(DupliObject *UNUSED(dob), ReportList *UNUSED(reports), PointerRNA *strands_ptr) +{ + Strands *strands = strands_ptr->data; + if (strands) + BKE_strands_free(strands); +} + +/* settings: 1 - preview, 2 - render */ +StrandsChildren *rna_DupliObject_strands_children_new(DupliObject *dob, ReportList *UNUSED(reports), Scene *scene, Object *parent, ParticleSystem *psys, int settings) +{ + StrandsChildren *strands = NULL; + bool is_cached = parent->cache_library && (parent->cache_library->source_mode == CACHE_LIBRARY_SOURCE_CACHE || parent->cache_library->display_mode == CACHE_LIBRARY_DISPLAY_RESULT); + + if (is_cached) { + float frame = (float)scene->r.cfra + scene->r.subframe; + bool use_render = (settings == 2); + + if (!ELEM(settings, 1, 2)) + return NULL; + + if (!use_render && parent->dup_cache) { + DupliObjectData *data; + + /* use dupli cache for realtime dupli data if possible */ + data = BKE_dupli_cache_find_data(parent->dup_cache, dob->ob); + if (data) { + /* TODO(sergey): Consider sharing the data between viewport and + * render engine. + */ + BKE_dupli_object_data_find_strands(data, psys->name, NULL, &strands); + if (strands) { + strands = BKE_strands_children_copy(strands); + } + } + } + else { + DupliObjectData data; + + memset(&data, 0, sizeof(data)); + if (BKE_cache_read_dupli_object(parent->cache_library, &data, scene, dob->ob, frame, use_render, true)) { + Strands *parents; + BKE_dupli_object_data_find_strands(&data, psys->name, &parents, &strands); + if (strands) { + BKE_dupli_object_data_acquire_strands_children(&data, strands); + + /* Deform child strands to follow parent motion. + * Note that this is an optional feature for viewport/render display, + * strand motion is not applied to raw child data in caches. + */ + if (parents) + BKE_strands_children_deform(strands, parents, true); + } + } + + BKE_dupli_object_data_clear(&data); + } + } + + return strands; +} + +static void rna_DupliObject_strands_children_free(DupliObject *UNUSED(dob), ReportList *UNUSED(reports), PointerRNA *strands_ptr) +{ + StrandsChildren *strands = strands_ptr->data; + if (strands) + BKE_strands_children_free(strands); +} + #else static void rna_def_vertex_group(BlenderRNA *brna) @@ -1869,6 +1989,7 @@ static void rna_def_object_game_settings(BlenderRNA *brna) prop = RNA_def_property(srna, "physics_type", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "body_type"); RNA_def_property_enum_items(prop, body_type_items); + RNA_def_property_enum_default(prop, OB_BODY_TYPE_STATIC); RNA_def_property_enum_funcs(prop, "rna_GameObjectSettings_physics_type_get", "rna_GameObjectSettings_physics_type_set", NULL); RNA_def_property_ui_text(prop, "Physics Type", "Select the type of physical representation"); @@ -1888,12 +2009,14 @@ static void rna_def_object_game_settings(BlenderRNA *brna) prop = RNA_def_property(srna, "mass", PROP_FLOAT, PROP_NONE); RNA_def_property_range(prop, 0.01, 10000.0); + RNA_def_property_float_default(prop, 1.0f); RNA_def_property_ui_text(prop, "Mass", "Mass of the object"); prop = RNA_def_property(srna, "radius", PROP_FLOAT, PROP_NONE | PROP_UNIT_LENGTH); RNA_def_property_float_sdna(prop, NULL, "inertia"); RNA_def_property_range(prop, 0.01f, FLT_MAX); RNA_def_property_ui_range(prop, 0.01f, 10.0f, 1, 3); + RNA_def_property_float_default(prop, 1.0f); RNA_def_property_ui_text(prop, "Radius", "Radius of bounding sphere and material physics"); RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL); @@ -1904,11 +2027,13 @@ static void rna_def_object_game_settings(BlenderRNA *brna) prop = RNA_def_property(srna, "damping", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "damping"); RNA_def_property_range(prop, 0.0, 1.0); + RNA_def_property_float_default(prop, 0.04f); RNA_def_property_ui_text(prop, "Damping", "General movement damping"); prop = RNA_def_property(srna, "rotation_damping", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "rdamping"); RNA_def_property_range(prop, 0.0, 1.0); + RNA_def_property_float_default(prop, 0.1f); RNA_def_property_ui_text(prop, "Rotation Damping", "General rotation damping"); prop = RNA_def_property(srna, "velocity_min", PROP_FLOAT, PROP_NONE); @@ -1925,16 +2050,19 @@ static void rna_def_object_game_settings(BlenderRNA *brna) prop = RNA_def_property(srna, "step_height", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "step_height"); RNA_def_property_range(prop, 0.01, 1.0); + RNA_def_property_float_default(prop, 0.15f); RNA_def_property_ui_text(prop, "Step Height", "Maximum height of steps the character can run over"); prop = RNA_def_property(srna, "jump_speed", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "jump_speed"); RNA_def_property_range(prop, 0.0, 1000.0); + RNA_def_property_float_default(prop, 10.0f); RNA_def_property_ui_text(prop, "Jump Force", "Upward velocity applied to the character when jumping"); prop = RNA_def_property(srna, "fall_speed", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "fall_speed"); RNA_def_property_range(prop, 0.0, 1000.0); + RNA_def_property_float_default(prop, 55.0f); RNA_def_property_ui_text(prop, "Fall Speed Max", "Maximum speed at which the character will fall"); /* Collision Masks */ @@ -1995,6 +2123,7 @@ static void rna_def_object_game_settings(BlenderRNA *brna) prop = RNA_def_property(srna, "form_factor", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "formfactor"); RNA_def_property_range(prop, 0.0, 1.0); + RNA_def_property_float_default(prop, 0.4f); RNA_def_property_ui_text(prop, "Form Factor", "Form factor scales the inertia tensor"); prop = RNA_def_property(srna, "use_anisotropic_friction", PROP_BOOLEAN, PROP_NONE); @@ -2027,6 +2156,7 @@ static void rna_def_object_game_settings(BlenderRNA *brna) prop = RNA_def_property(srna, "collision_margin", PROP_FLOAT, PROP_NONE | PROP_UNIT_LENGTH); RNA_def_property_float_sdna(prop, NULL, "margin"); RNA_def_property_range(prop, 0.0, 1.0); + RNA_def_property_float_default(prop, 0.04f); RNA_def_property_ui_text(prop, "Collision Margin", "Extra margin around object for collision detection, small amount required " "for stability"); @@ -2042,6 +2172,7 @@ static void rna_def_object_game_settings(BlenderRNA *brna) prop = RNA_def_property(srna, "obstacle_radius", PROP_FLOAT, PROP_NONE | PROP_UNIT_LENGTH); RNA_def_property_float_sdna(prop, NULL, "obstacleRad"); RNA_def_property_range(prop, 0.0, 1000.0); + RNA_def_property_float_default(prop, 1.0f); RNA_def_property_ui_text(prop, "Obstacle Radius", "Radius of object representation in obstacle simulation"); /* state */ @@ -2320,6 +2451,14 @@ static void rna_def_object_lodlevel(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Distance", "Distance to begin using this level of detail"); RNA_def_property_update(prop, NC_OBJECT | ND_LOD, "rna_Object_lod_distance_update"); + prop = RNA_def_property(srna, "object_hysteresis_percentage", PROP_INT, PROP_PERCENTAGE); + RNA_def_property_int_sdna(prop, NULL, "obhysteresis"); + RNA_def_property_range(prop, 0, 100); + RNA_def_property_ui_range(prop, 0, 100, 10, 1); + RNA_def_property_ui_text(prop, "Hysteresis %", + "Minimum distance change required to transition to the previous level of detail"); + RNA_def_property_update(prop, NC_OBJECT | ND_LOD, NULL); + prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "source"); RNA_def_property_struct_type(prop, "Object"); @@ -2338,6 +2477,11 @@ static void rna_def_object_lodlevel(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Use Material", "Use the material from this object at this level of detail"); RNA_def_property_ui_icon(prop, ICON_MATERIAL, 0); RNA_def_property_update(prop, NC_OBJECT | ND_LOD, NULL); + + prop = RNA_def_property(srna, "use_object_hysteresis", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flags", OB_LOD_USE_HYST); + RNA_def_property_ui_text(prop, "Hysteresis Override", "Override LoD Hysteresis scene setting for this LoD level"); + RNA_def_property_update(prop, NC_OBJECT | ND_LOD, NULL); } @@ -2880,6 +3024,12 @@ static void rna_def_object(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Dupli Group", "Instance an existing group"); RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_dependency_update"); + prop = RNA_def_property(srna, "cache_library", PROP_POINTER, PROP_NONE); + RNA_def_property_pointer_sdna(prop, NULL, "cache_library"); + RNA_def_property_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Cache Library", "Cache Library to use"); + RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_dependency_update"); + prop = RNA_def_property(srna, "dupli_frames_start", PROP_INT, PROP_NONE | PROP_UNIT_TIME); RNA_def_property_int_sdna(prop, NULL, "dupsta"); RNA_def_property_range(prop, MINAFRAME, MAXFRAME); @@ -3041,6 +3191,14 @@ static void rna_def_dupli_object(BlenderRNA *brna) { StructRNA *srna; PropertyRNA *prop; + FunctionRNA *func; + PropertyRNA *parm; + + static EnumPropertyItem strand_settings_items[] = { + {1, "PREVIEW", 0, "Preview", "Apply preview settings"}, + {2, "RENDER", 0, "Render", "Apply render settings"}, + {0, NULL, 0, NULL, NULL} + }; srna = RNA_def_struct(brna, "DupliObject", NULL); RNA_def_struct_sdna(srna, "DupliObject"); @@ -3089,6 +3247,60 @@ static void rna_def_dupli_object(BlenderRNA *brna) RNA_def_property_enum_items(prop, dupli_items); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE | PROP_EDITABLE); RNA_def_property_ui_text(prop, "Dupli Type", "Duplicator type that generated this dupli object"); + + func = RNA_def_function(srna, "strands_new", "rna_DupliObject_strands_new"); + RNA_def_function_ui_description(func, "Add new strands created from dupli cache data"); + RNA_def_function_flag(func, FUNC_USE_REPORTS); + parm = RNA_def_pointer(func, "scene", "Scene", "", "Scene within which to evaluate modifiers"); + RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL); + parm = RNA_def_pointer(func, "parent", "Object", "", "Duplicator parent of the object"); + RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL); + parm = RNA_def_pointer(func, "particle_system", "ParticleSystem", "", "Particle System"); + RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL); + parm = RNA_def_enum(func, "settings", strand_settings_items, 0, "", "Modifier settings to apply"); + RNA_def_property_flag(parm, PROP_REQUIRED); + parm = RNA_def_pointer(func, "strands", "Strands", "", + "Strands created from object, remove it if it is only used for export"); + RNA_def_function_return(func, parm); + + func = RNA_def_function(srna, "strands_free", "rna_DupliObject_strands_free"); + RNA_def_function_flag(func, FUNC_USE_REPORTS); + RNA_def_function_ui_description(func, "Free strands data"); + parm = RNA_def_pointer(func, "strands", "Strands", "", "Strands to remove"); + RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL | PROP_RNAPTR); + RNA_def_property_clear_flag(parm, PROP_THICK_WRAP); + + func = RNA_def_function(srna, "strands_children_new", "rna_DupliObject_strands_children_new"); + RNA_def_function_ui_description(func, "Add new strands created from dupli cache data"); + RNA_def_function_flag(func, FUNC_USE_REPORTS); + parm = RNA_def_pointer(func, "scene", "Scene", "", "Scene within which to evaluate modifiers"); + RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL); + parm = RNA_def_pointer(func, "parent", "Object", "", "Duplicator parent of the object"); + RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL); + parm = RNA_def_pointer(func, "particle_system", "ParticleSystem", "", "Particle System"); + RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL); + parm = RNA_def_enum(func, "settings", strand_settings_items, 0, "", "Modifier settings to apply"); + RNA_def_property_flag(parm, PROP_REQUIRED); + parm = RNA_def_pointer(func, "strands", "StrandsChildren", "", + "Strands created from object, remove it if it is only used for export"); + RNA_def_function_return(func, parm); + + func = RNA_def_function(srna, "strands_children_free", "rna_DupliObject_strands_children_free"); + RNA_def_function_flag(func, FUNC_USE_REPORTS); + RNA_def_function_ui_description(func, "Free strands data"); + parm = RNA_def_pointer(func, "strands", "StrandsChildren", "", "Strands to remove"); + RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL | PROP_RNAPTR); + RNA_def_property_clear_flag(parm, PROP_THICK_WRAP); +} + +static void rna_def_dupli_object_data(BlenderRNA *brna) +{ + StructRNA *srna; + /*PropertyRNA *prop;*/ + + srna = RNA_def_struct(brna, "DupliObjectData", NULL); + RNA_def_struct_sdna(srna, "DupliObjectData"); + RNA_def_struct_ui_text(srna, "Object Duplicate Data", "Override of object data for duplis"); } static void rna_def_object_base(BlenderRNA *brna) @@ -3138,6 +3350,7 @@ void RNA_def_object(BlenderRNA *brna) rna_def_face_map(brna); rna_def_material_slot(brna); rna_def_dupli_object(brna); + rna_def_dupli_object_data(brna); RNA_define_animate_sdna(true); rna_def_object_lodlevel(brna); } diff --git a/source/blender/makesrna/intern/rna_object_api.c b/source/blender/makesrna/intern/rna_object_api.c index a312ec5d41a..c0aee13d37b 100644 --- a/source/blender/makesrna/intern/rna_object_api.c +++ b/source/blender/makesrna/intern/rna_object_api.c @@ -87,6 +87,8 @@ static EnumPropertyItem space_items[] = { #include "MEM_guardedalloc.h" +#include "DEG_depsgraph.h" + /* Convert a given matrix from a space to another (using the object and/or a bone as reference). */ static void rna_Scene_mat_convert_space(Object *ob, ReportList *reports, bPoseChannel *pchan, float *mat, float *mat_ret, int from, int to) @@ -131,7 +133,7 @@ static void rna_Object_calc_matrix_camera( static void rna_Object_camera_fit_coords( Object *ob, Scene *scene, int num_cos, float *cos, float co_ret[3], float *scale_ret) { - BKE_camera_view_frame_fit_to_coords(scene, (float (*)[3])cos, num_cos / 3, ob, co_ret, scale_ret); + BKE_camera_view_frame_fit_to_coords(scene, (const float (*)[3])cos, num_cos / 3, ob, co_ret, scale_ret); } /* copied from Mesh_getFromObject and adapted to RNA interface */ @@ -191,8 +193,8 @@ static void dupli_render_particle_set(Scene *scene, Object *ob, int level, int e static void rna_Object_create_duplilist(Object *ob, ReportList *reports, Scene *sce, int settings) { bool for_render = (settings == DAG_EVAL_RENDER); - EvaluationContext eval_ctx = {0}; - eval_ctx.mode = settings; + EvaluationContext eval_ctx; + DEG_evaluation_context_init(&eval_ctx, settings); if (!(ob->transflag & OB_DUPLI)) { BKE_report(reports, RPT_ERROR, "Object does not have duplis"); @@ -222,12 +224,24 @@ static void rna_Object_free_duplilist(Object *ob) } } +static PointerRNA rna_Object_find_dupli_cache(Object *ob, Object *dupob) +{ + DupliObjectData *data = NULL; + PointerRNA ptr; + + if (ob->dup_cache) + data = BKE_dupli_cache_find_data(ob->dup_cache, dupob); + + RNA_pointer_create((ID *)ob, &RNA_DupliObjectData, data, &ptr); + return ptr; +} + static PointerRNA rna_Object_shape_key_add(Object *ob, bContext *C, ReportList *reports, const char *name, int from_mix) { KeyBlock *kb = NULL; - if ((kb = BKE_object_insert_shape_key(ob, name, from_mix))) { + if ((kb = BKE_object_shapekey_insert(ob, name, from_mix))) { PointerRNA keyptr; RNA_pointer_create((ID *)ob->data, &RNA_ShapeKey, kb, &keyptr); @@ -241,6 +255,29 @@ static PointerRNA rna_Object_shape_key_add(Object *ob, bContext *C, ReportList * } } +static void rna_Object_shape_key_remove( + Object *ob, Main *bmain, ReportList *reports, + PointerRNA *kb_ptr) +{ + KeyBlock *kb = kb_ptr->data; + Key *key = BKE_key_from_object(ob); + + if ((key == NULL) || BLI_findindex(&key->block, kb) == -1) { + BKE_reportf(reports, RPT_ERROR, "ShapeKey not found"); + return; + } + + if (!BKE_object_shapekey_remove(bmain, ob, kb)) { + BKE_reportf(reports, RPT_ERROR, "Could not remove ShapeKey"); + return; + } + + DAG_id_tag_update(&ob->id, OB_RECALC_DATA); + WM_main_add_notifier(NC_OBJECT | ND_DRAW, ob); + + RNA_POINTER_INVALIDATE(kb_ptr); +} + static int rna_Object_is_visible(Object *ob, Scene *sce) { return !(ob->restrictflag & OB_RESTRICT_VIEW) && (ob->lay & sce->lay); @@ -441,6 +478,12 @@ static int rna_Object_update_from_editmode(Object *ob) } return false; } + +static void rna_Object_cache_release(Object *object, int free_smoke_sim) +{ + BKE_object_free_caches(object, free_smoke_sim != 0); +} + #else /* RNA_RUNTIME */ void RNA_api_object(StructRNA *srna) @@ -547,6 +590,14 @@ void RNA_api_object(StructRNA *srna) func = RNA_def_function(srna, "dupli_list_clear", "rna_Object_free_duplilist"); RNA_def_function_ui_description(func, "Free the list of dupli objects"); + func = RNA_def_function(srna, "find_dupli_cache", "rna_Object_find_dupli_cache"); + RNA_def_function_ui_description(func, "Find cached data for a dupli object"); + parm = RNA_def_pointer(func, "object", "Object", "", "Object data to look up"); + RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL); + parm = RNA_def_pointer(func, "data", "DupliObjectData", "", "Cached object data"); + RNA_def_property_flag(parm, PROP_RNAPTR); + RNA_def_function_return(func, parm); + /* Armature */ func = RNA_def_function(srna, "find_armature", "modifiers_isDeformedByArmature"); RNA_def_function_ui_description(func, "Find armature influencing this object as a parent or via a modifier"); @@ -555,14 +606,21 @@ void RNA_api_object(StructRNA *srna) /* Shape key */ func = RNA_def_function(srna, "shape_key_add", "rna_Object_shape_key_add"); - RNA_def_function_ui_description(func, "Add shape key to an object"); + RNA_def_function_ui_description(func, "Add shape key to this object"); RNA_def_function_flag(func, FUNC_USE_CONTEXT | FUNC_USE_REPORTS); - RNA_def_string(func, "name", "Key", 0, "", "Unique name for the new keylock"); /* optional */ + RNA_def_string(func, "name", "Key", 0, "", "Unique name for the new keyblock"); /* optional */ RNA_def_boolean(func, "from_mix", 1, "", "Create new shape from existing mix of shapes"); parm = RNA_def_pointer(func, "key", "ShapeKey", "", "New shape keyblock"); RNA_def_property_flag(parm, PROP_RNAPTR); RNA_def_function_return(func, parm); + func = RNA_def_function(srna, "shape_key_remove", "rna_Object_shape_key_remove"); + RNA_def_function_ui_description(func, "Remove a Shape Key from this object"); + RNA_def_function_flag(func, FUNC_USE_MAIN | FUNC_USE_REPORTS); + parm = RNA_def_pointer(func, "key", "ShapeKey", "", "Keyblock to be removed"); + RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL | PROP_RNAPTR); + RNA_def_property_clear_flag(parm, PROP_THICK_WRAP); + /* Ray Cast */ func = RNA_def_function(srna, "ray_cast", "rna_Object_ray_cast"); RNA_def_function_ui_description(func, "Cast a ray onto in object space"); @@ -656,7 +714,8 @@ void RNA_api_object(StructRNA *srna) parm = RNA_def_boolean(func, "result", 0, "", "Success"); RNA_def_function_return(func, parm); - func = RNA_def_function(srna, "cache_release", "BKE_object_free_caches"); + func = RNA_def_function(srna, "cache_release", "rna_Object_cache_release"); + RNA_def_boolean(func, "free_smoke_sim", 0, "", "Free baked smoke simulation data"); RNA_def_function_ui_description(func, "Release memory used by caches associated with this object. Intended to be used by render engines only"); } diff --git a/source/blender/makesrna/intern/rna_object_force.c b/source/blender/makesrna/intern/rna_object_force.c index ac74c7e7580..21f53f86d90 100644 --- a/source/blender/makesrna/intern/rna_object_force.c +++ b/source/blender/makesrna/intern/rna_object_force.c @@ -845,7 +845,7 @@ static void rna_def_pointcache(BlenderRNA *brna) RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_ui_text(prop, "Cache is outdated", ""); - prop = RNA_def_property(srna, "frames_skipped", PROP_BOOLEAN, PROP_NONE); + prop = RNA_def_property(srna, "is_frame_skip", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", PTCACHE_FRAMES_SKIPPED); RNA_def_property_clear_flag(prop, PROP_EDITABLE); diff --git a/source/blender/makesrna/intern/rna_palette.c b/source/blender/makesrna/intern/rna_palette.c new file mode 100644 index 00000000000..8cbb57fde2c --- /dev/null +++ b/source/blender/makesrna/intern/rna_palette.c @@ -0,0 +1,181 @@ +/* + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * ***** END GPL LICENSE BLOCK ***** + */ + +/** \file blender/makesrna/intern/rna_palette.c + * \ingroup RNA + */ + +#include <stdlib.h> + +#include "BLI_utildefines.h" + +#include "RNA_define.h" +#include "RNA_access.h" + +#include "rna_internal.h" + +#include "WM_types.h" + +#ifdef RNA_RUNTIME + +#include "DNA_brush_types.h" + +#include "BKE_paint.h" +#include "BKE_report.h" + +static PaletteColor *rna_Palette_color_new(Palette *palette) +{ + PaletteColor *color = BKE_palette_color_add(palette); + return color; +} + +static void rna_Palette_color_remove(Palette *palette, ReportList *reports, PointerRNA *color_ptr) +{ + PaletteColor *color = color_ptr->data; + + if (BLI_findindex(&palette->colors, color) == -1) { + BKE_reportf(reports, RPT_ERROR, "Palette '%s' does not contain color given", palette->id.name + 2); + return; + } + + BKE_palette_color_remove(palette, color); + + RNA_POINTER_INVALIDATE(color_ptr); +} + +static void rna_Palette_color_clear(Palette *palette) +{ + BKE_palette_clear(palette); +} + +static PointerRNA rna_Palette_active_color_get(PointerRNA *ptr) +{ + Palette *palette = ptr->data; + PaletteColor *color; + + color = BLI_findlink(&palette->colors, palette->active_color); + + if (color) + return rna_pointer_inherit_refine(ptr, &RNA_PaletteColor, color); + + return rna_pointer_inherit_refine(ptr, NULL, NULL); +} + +static void rna_Palette_active_color_set(PointerRNA *ptr, PointerRNA value) +{ + Palette *palette = ptr->data; + PaletteColor *color = value.data; + + /* -1 is ok for an unset index */ + if (color == NULL) + palette->active_color = -1; + else + palette->active_color = BLI_findindex(&palette->colors, color); +} + +#else + +/* palette.colors */ +static void rna_def_palettecolors(BlenderRNA *brna, PropertyRNA *cprop) +{ + StructRNA *srna; + PropertyRNA *prop; + + FunctionRNA *func; + PropertyRNA *parm; + + RNA_def_property_srna(cprop, "PaletteColors"); + srna = RNA_def_struct(brna, "PaletteColors", NULL); + RNA_def_struct_sdna(srna, "Palette"); + RNA_def_struct_ui_text(srna, "Palette Splines", "Collection of palette colors"); + + func = RNA_def_function(srna, "new", "rna_Palette_color_new"); + RNA_def_function_ui_description(func, "Add a new color to the palette"); + parm = RNA_def_pointer(func, "color", "PaletteColor", "", "The newly created color"); + RNA_def_function_return(func, parm); + + func = RNA_def_function(srna, "remove", "rna_Palette_color_remove"); + RNA_def_function_ui_description(func, "Remove a color from the palette"); + RNA_def_function_flag(func, FUNC_USE_REPORTS); + parm = RNA_def_pointer(func, "color", "PaletteColor", "", "The color to remove"); + RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL | PROP_RNAPTR); + RNA_def_property_clear_flag(parm, PROP_THICK_WRAP); + + func = RNA_def_function(srna, "clear", "rna_Palette_color_clear"); + RNA_def_function_ui_description(func, "Remove all colors from the palette"); + + prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE); + RNA_def_property_struct_type(prop, "PaletteColor"); + RNA_def_property_pointer_funcs(prop, "rna_Palette_active_color_get", "rna_Palette_active_color_set", NULL, NULL); + RNA_def_property_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Active Palette Color", ""); +} + +static void rna_def_palettecolor(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + + srna = RNA_def_struct(brna, "PaletteColor", NULL); + RNA_def_struct_ui_text(srna, "Palette Color", ""); + + prop = RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR_GAMMA); + RNA_def_property_range(prop, 0.0, 1.0); + RNA_def_property_float_sdna(prop, NULL, "rgb"); + RNA_def_property_ui_text(prop, "Color", ""); + RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); + + prop = RNA_def_property(srna, "strength", PROP_FLOAT, PROP_NONE); + RNA_def_property_range(prop, 0.0, 1.0); + RNA_def_property_float_sdna(prop, NULL, "value"); + RNA_def_property_ui_text(prop, "Value", ""); + RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); + + prop = RNA_def_property(srna, "weight", PROP_FLOAT, PROP_NONE); + RNA_def_property_range(prop, 0.0, 1.0); + RNA_def_property_float_sdna(prop, NULL, "value"); + RNA_def_property_ui_text(prop, "Weight", ""); + RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); +} + +static void rna_def_palette(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + + srna = RNA_def_struct(brna, "Palette", "ID"); + RNA_def_struct_ui_text(srna, "Palette", ""); + RNA_def_struct_ui_icon(srna, ICON_COLOR); + + prop = RNA_def_property(srna, "colors", PROP_COLLECTION, PROP_NONE); + RNA_def_property_struct_type(prop, "PaletteColor"); + rna_def_palettecolors(brna, prop); +} + +void RNA_def_palette(BlenderRNA *brna) +{ + /* *** Non-Animated *** */ + RNA_define_animate_sdna(false); + rna_def_palettecolor(brna); + rna_def_palette(brna); + RNA_define_animate_sdna(true); +} + +#endif diff --git a/source/blender/makesrna/intern/rna_particle.c b/source/blender/makesrna/intern/rna_particle.c index 0248c453e5a..a6bbbfcb8b4 100644 --- a/source/blender/makesrna/intern/rna_particle.c +++ b/source/blender/makesrna/intern/rna_particle.c @@ -1908,6 +1908,11 @@ static void rna_def_particle_settings_mtex(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Shape Key", "Affect the blend factor of a hair shape key"); RNA_def_property_update(prop, 0, "rna_Particle_reset"); + prop = RNA_def_property(srna, "use_map_particle_color", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "mapto", PAMAP_COLOR); + RNA_def_property_ui_text(prop, "Color", "Affect the particle color"); + RNA_def_property_update(prop, 0, "rna_Particle_reset"); + /* influence factors */ prop = RNA_def_property(srna, "time_factor", PROP_FLOAT, PROP_NONE); @@ -2000,6 +2005,12 @@ static void rna_def_particle_settings_mtex(BlenderRNA *brna) RNA_def_property_string_sdna(prop, NULL, "shapekey"); RNA_def_property_ui_text(prop, "Shape Key", "Name of the shape key affected by the texture"); RNA_def_property_update(prop, 0, "rna_Particle_reset"); + + prop = RNA_def_property(srna, "particle_color_factor", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "pacolfac"); + RNA_def_property_ui_range(prop, 0, 1, 10, 3); + RNA_def_property_ui_text(prop, "Particle Color Factor", "Amount texture affects particle color"); + RNA_def_property_update(prop, 0, "rna_Particle_redo_child"); } static void rna_def_particle_settings(BlenderRNA *brna) @@ -2121,6 +2132,7 @@ static void rna_def_particle_settings(BlenderRNA *brna) #ifdef USE_PARTICLE_HULL_DRAWING {PART_DRAW_COL_PARENT, "PARENT", 0, "Parent", ""}, #endif + {PART_DRAW_COL_TEX, "TEXTURE", 0, "Texture", ""}, {0, NULL, 0, NULL, NULL} }; @@ -2808,7 +2820,7 @@ static void rna_def_particle_settings(BlenderRNA *brna) prop = RNA_def_property(srna, "phase_factor_random", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "randphasefac"); - RNA_def_property_range(prop, 0.0f, 1.0f); + RNA_def_property_range(prop, 0.0f, 2.0f); RNA_def_property_ui_text(prop, "Random Phase", "Randomize rotation around the chosen orientation axis"); RNA_def_property_update(prop, 0, "rna_Particle_reset"); diff --git a/source/blender/makesrna/intern/rna_pose.c b/source/blender/makesrna/intern/rna_pose.c index 0428f5d8a9f..3ff51423e9a 100644 --- a/source/blender/makesrna/intern/rna_pose.c +++ b/source/blender/makesrna/intern/rna_pose.c @@ -231,7 +231,7 @@ static void rna_Pose_ik_solver_update(Main *bmain, Scene *UNUSED(scene), Pointer Object *ob = ptr->id.data; bPose *pose = ptr->data; - pose->flag |= POSE_RECALC; /* checks & sorts pose channels */ + BKE_pose_tag_recalc(bmain, pose); /* checks & sorts pose channels */ DAG_relations_tag_update(bmain); BKE_pose_update_constraint_flags(pose); @@ -356,7 +356,7 @@ static void rna_Itasc_update_rebuild(Main *bmain, Scene *scene, PointerRNA *ptr) Object *ob = ptr->id.data; bPose *pose = ob->pose; - pose->flag |= POSE_RECALC; /* checks & sorts pose channels */ + BKE_pose_tag_recalc(bmain, pose); /* checks & sorts pose channels */ rna_Itasc_update(bmain, scene, ptr); } diff --git a/source/blender/makesrna/intern/rna_render.c b/source/blender/makesrna/intern/rna_render.c index 124a83a5f30..ee51dcf2acf 100644 --- a/source/blender/makesrna/intern/rna_render.c +++ b/source/blender/makesrna/intern/rna_render.c @@ -27,6 +27,7 @@ #include <stdlib.h> #include "DNA_scene_types.h" +#include "DNA_object_types.h" #include "BLI_utildefines.h" #include "BLI_path_util.h" @@ -153,8 +154,10 @@ static void engine_render(RenderEngine *engine, struct Scene *scene) RNA_parameter_list_free(&list); } -static void engine_bake(RenderEngine *engine, struct Scene *scene, struct Object *object, const int pass_type, - const struct BakePixel *pixel_array, const int num_pixels, const int depth, void *result) +static void engine_bake(RenderEngine *engine, struct Scene *scene, + struct Object *object, const int pass_type, + const int object_id, const struct BakePixel *pixel_array, + const int num_pixels, const int depth, void *result) { extern FunctionRNA rna_RenderEngine_bake_func; PointerRNA ptr; @@ -168,6 +171,7 @@ static void engine_bake(RenderEngine *engine, struct Scene *scene, struct Object RNA_parameter_set_lookup(&list, "scene", &scene); RNA_parameter_set_lookup(&list, "object", &object); RNA_parameter_set_lookup(&list, "pass_type", &pass_type); + RNA_parameter_set_lookup(&list, "object_id", &object_id); RNA_parameter_set_lookup(&list, "pixel_array", &pixel_array); RNA_parameter_set_lookup(&list, "num_pixels", &num_pixels); RNA_parameter_set_lookup(&list, "depth", &depth); @@ -253,6 +257,7 @@ static StructRNA *rna_RenderEngine_register(Main *bmain, ReportList *reports, vo /* setup dummy engine & engine type to store static properties in */ dummyengine.type = &dummyet; + dummyet.flag |= RE_USE_SHADING_NODES_CUSTOM; RNA_pointer_create(NULL, &RNA_RenderEngine, &dummyengine, &dummyptr); /* validate the python class */ @@ -322,38 +327,35 @@ static PointerRNA rna_RenderEngine_render_get(PointerRNA *ptr) } } -static void rna_RenderResult_layers_begin(CollectionPropertyIterator *iter, PointerRNA *ptr) +static PointerRNA rna_RenderEngine_camera_override_get(PointerRNA *ptr) { - RenderResult *rr = (RenderResult *)ptr->data; - rna_iterator_listbase_begin(iter, &rr->layers, NULL); -} + RenderEngine *engine = (RenderEngine *)ptr->data; -static void rna_RenderLayer_passes_begin(CollectionPropertyIterator *iter, PointerRNA *ptr) -{ - RenderLayer *rl = (RenderLayer *)ptr->data; - rna_iterator_listbase_begin(iter, &rl->passes, NULL); + if (engine->re) { + Object *cam = RE_GetCamera(engine->re); + return rna_pointer_inherit_refine(ptr, &RNA_Object, cam); + } + else { + return rna_pointer_inherit_refine(ptr, &RNA_Object, engine->camera_override); + } } -static int rna_RenderLayer_rect_get_length(PointerRNA *ptr, int length[RNA_MAX_ARRAY_DIMENSION]) +static void rna_RenderResult_views_begin(CollectionPropertyIterator *iter, PointerRNA *ptr) { - RenderLayer *rl = (RenderLayer *)ptr->data; - - length[0] = rl->rectx * rl->recty; - length[1] = 4; - - return length[0] * length[1]; + RenderResult *rr = (RenderResult *)ptr->data; + rna_iterator_listbase_begin(iter, &rr->views, NULL); } -static void rna_RenderLayer_rect_get(PointerRNA *ptr, float *values) +static void rna_RenderResult_layers_begin(CollectionPropertyIterator *iter, PointerRNA *ptr) { - RenderLayer *rl = (RenderLayer *)ptr->data; - memcpy(values, rl->rectf, sizeof(float) * rl->rectx * rl->recty * 4); + RenderResult *rr = (RenderResult *)ptr->data; + rna_iterator_listbase_begin(iter, &rr->layers, NULL); } -void rna_RenderLayer_rect_set(PointerRNA *ptr, const float *values) +static void rna_RenderLayer_passes_begin(CollectionPropertyIterator *iter, PointerRNA *ptr) { RenderLayer *rl = (RenderLayer *)ptr->data; - memcpy(rl->rectf, values, sizeof(float) * rl->rectx * rl->recty * 4); + rna_iterator_listbase_begin(iter, &rl->passes, NULL); } static int rna_RenderPass_rect_get_length(PointerRNA *ptr, int length[RNA_MAX_ARRAY_DIMENSION]) @@ -384,6 +386,11 @@ static PointerRNA rna_BakePixel_next_get(PointerRNA *ptr) return rna_pointer_inherit_refine(ptr, &RNA_BakePixel, bp + 1); } +static RenderPass *rna_RenderPass_find_by_type(RenderLayer *rl, int passtype, const char *view) +{ + return RE_pass_find_by_type(rl, passtype, view); +} + #else /* RNA_RUNTIME */ static void rna_def_render_engine(BlenderRNA *brna) @@ -420,6 +427,8 @@ static void rna_def_render_engine(BlenderRNA *brna) RNA_def_property_flag(prop, PROP_REQUIRED); prop = RNA_def_enum(func, "pass_type", render_pass_type_items, 0, "Pass", "Pass to bake"); RNA_def_property_flag(prop, PROP_REQUIRED); + prop = RNA_def_int(func, "object_id", 0, 0, INT_MAX, "Object Id", "Id of the current object being baked in relation to the others", 0, INT_MAX); + RNA_def_property_flag(prop, PROP_REQUIRED); prop = RNA_def_pointer(func, "pixel_array", "BakePixel", "", ""); RNA_def_property_flag(prop, PROP_REQUIRED); prop = RNA_def_int(func, "num_pixels", 0, 0, INT_MAX, "Number of Pixels", "Size of the baking batch", 0, INT_MAX); @@ -467,6 +476,7 @@ static void rna_def_render_engine(BlenderRNA *brna) prop = RNA_def_int(func, "h", 0, 0, INT_MAX, "Height", "", 0, INT_MAX); RNA_def_property_flag(prop, PROP_REQUIRED); RNA_def_string(func, "layer", NULL, 0, "Layer", "Single layer to get render result for"); /* NULL ok here */ + RNA_def_string(func, "view", NULL, 0, "View", "Single view to get render result for"); /* NULL ok here */ prop = RNA_def_pointer(func, "result", "RenderResult", "Result", ""); RNA_def_function_return(func, prop); @@ -487,6 +497,22 @@ static void rna_def_render_engine(BlenderRNA *brna) prop = RNA_def_boolean(func, "do_break", 0, "Break", ""); RNA_def_function_return(func, prop); + func = RNA_def_function(srna, "active_view_set", "RE_engine_active_view_set"); + RNA_def_string(func, "view", NULL, 0, "View", "Single view to set as active"); /* NULL ok here */ + RNA_def_property_flag(prop, PROP_REQUIRED); + + func = RNA_def_function(srna, "camera_shift_x", "RE_engine_get_camera_shift_x"); + prop = RNA_def_pointer(func, "camera", "Object", "", ""); + RNA_def_property_flag(prop, PROP_REQUIRED); + prop = RNA_def_float(func, "shift_x", 0.0f, 0.0f, FLT_MAX, "Shift X", "", 0.0f, FLT_MAX); + RNA_def_function_return(func, prop); + + func = RNA_def_function(srna, "camera_model_matrix", "RE_engine_get_camera_model_matrix"); + prop = RNA_def_pointer(func, "camera", "Object", "", ""); + RNA_def_property_flag(prop, PROP_REQUIRED); + prop = RNA_def_float_matrix(func, "r_model_matrix", 4, 4, NULL, 0.0f, 0.0f, "Model Matrix", "Normalized camera model matrix", 0.0f, 0.0f); + RNA_def_property_flag(prop, PROP_REQUIRED); + func = RNA_def_function(srna, "update_stats", "RE_engine_update_stats"); RNA_def_function_ui_description(func, "Update and signal to redraw render status text"); prop = RNA_def_string(func, "stats", NULL, 0, "Stats", ""); @@ -548,7 +574,7 @@ static void rna_def_render_engine(BlenderRNA *brna) RNA_def_property_boolean_sdna(prop, NULL, "flag", RE_ENGINE_PREVIEW); prop = RNA_def_property(srna, "camera_override", PROP_POINTER, PROP_NONE); - RNA_def_property_pointer_sdna(prop, NULL, "camera_override"); + RNA_def_property_pointer_funcs(prop, "rna_RenderEngine_camera_override_get", NULL, NULL, NULL); RNA_def_property_struct_type(prop, "Object"); prop = RNA_def_property(srna, "layer_override", PROP_BOOLEAN, PROP_LAYER_MEMBER); @@ -603,6 +629,11 @@ static void rna_def_render_engine(BlenderRNA *brna) RNA_def_property_boolean_sdna(prop, NULL, "type->flag", RE_USE_SHADING_NODES); RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL); + prop = RNA_def_property(srna, "bl_use_shading_nodes_custom", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "type->flag", RE_USE_SHADING_NODES_CUSTOM); + RNA_def_property_boolean_default(prop, true); + RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL); + prop = RNA_def_property(srna, "bl_use_exclude_layers", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "type->flag", RE_USE_EXCLUDE_LAYERS); RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL); @@ -647,9 +678,56 @@ static void rna_def_render_result(BlenderRNA *brna) "rna_iterator_listbase_end", "rna_iterator_listbase_get", NULL, NULL, NULL, NULL); + parm = RNA_def_property(srna, "views", PROP_COLLECTION, PROP_NONE); + RNA_def_property_struct_type(parm, "RenderView"); + RNA_def_property_collection_funcs(parm, "rna_RenderResult_views_begin", "rna_iterator_listbase_next", + "rna_iterator_listbase_end", "rna_iterator_listbase_get", + NULL, NULL, NULL, NULL); + RNA_define_verify_sdna(1); } +static void rna_def_render_view(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + + srna = RNA_def_struct(brna, "RenderView", NULL); + RNA_def_struct_ui_text(srna, "Render View", ""); + + RNA_define_verify_sdna(0); + + prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE); + RNA_def_property_string_sdna(prop, NULL, "name"); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_struct_name_property(srna, prop); + + RNA_define_verify_sdna(1); +} + +static void rna_def_render_passes(BlenderRNA *brna, PropertyRNA *cprop) +{ + StructRNA *srna; + + FunctionRNA *func; + PropertyRNA *parm; + + RNA_def_property_srna(cprop, "RenderPasses"); + srna = RNA_def_struct(brna, "RenderPasses", NULL); + RNA_def_struct_sdna(srna, "RenderLayer"); + RNA_def_struct_ui_text(srna, "Render Passes", "Collection of render passes"); + + func = RNA_def_function(srna, "find_by_type", "rna_RenderPass_find_by_type"); + RNA_def_function_ui_description(func, "Get the render pass for a given type and view"); + parm = RNA_def_enum(func, "pass_type", render_pass_type_items, SCE_PASS_COMBINED, "Pass", ""); + RNA_def_property_flag(parm, PROP_REQUIRED); + parm = RNA_def_string(func, "view", NULL, 0, "View", "Render view to get pass from"); /* NULL ok here */ + RNA_def_property_flag(parm, PROP_REQUIRED); + parm = RNA_def_pointer(func, "render_pass", "RenderPass", "", "The matching render pass"); + RNA_def_function_return(func, parm); + +} + static void rna_def_render_layer(BlenderRNA *brna) { StructRNA *srna; @@ -679,12 +757,7 @@ static void rna_def_render_layer(BlenderRNA *brna) RNA_def_property_collection_funcs(prop, "rna_RenderLayer_passes_begin", "rna_iterator_listbase_next", "rna_iterator_listbase_end", "rna_iterator_listbase_get", NULL, NULL, NULL, NULL); - - prop = RNA_def_property(srna, "rect", PROP_FLOAT, PROP_NONE); - RNA_def_property_flag(prop, PROP_DYNAMIC); - RNA_def_property_multi_array(prop, 2, NULL); - RNA_def_property_dynamic_array_funcs(prop, "rna_RenderLayer_rect_get_length"); - RNA_def_property_float_funcs(prop, "rna_RenderLayer_rect_get", "rna_RenderLayer_rect_set", NULL); + rna_def_render_passes(brna, prop); RNA_define_verify_sdna(1); } @@ -728,6 +801,10 @@ static void rna_def_render_pass(BlenderRNA *brna) RNA_def_property_dynamic_array_funcs(prop, "rna_RenderPass_rect_get_length"); RNA_def_property_float_funcs(prop, "rna_RenderPass_rect_get", "rna_RenderPass_rect_set", NULL); + prop = RNA_def_property(srna, "view_id", PROP_INT, PROP_NONE); + RNA_def_property_int_sdna(prop, NULL, "view_id"); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + prop = RNA_def_property(srna, "debug_type", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "debug_type"); RNA_def_property_enum_items(prop, render_pass_debug_type_items); @@ -750,6 +827,10 @@ static void rna_def_render_bake_pixel(BlenderRNA *brna) RNA_def_property_int_sdna(prop, NULL, "primitive_id"); RNA_def_property_clear_flag(prop, PROP_EDITABLE); + prop = RNA_def_property(srna, "object_id", PROP_INT, PROP_NONE); + RNA_def_property_int_sdna(prop, NULL, "object_id"); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + prop = RNA_def_property(srna, "uv", PROP_FLOAT, PROP_NONE); RNA_def_property_array(prop, 2); RNA_def_property_float_sdna(prop, NULL, "uv"); @@ -783,6 +864,7 @@ void RNA_def_render(BlenderRNA *brna) { rna_def_render_engine(brna); rna_def_render_result(brna); + rna_def_render_view(brna); rna_def_render_layer(brna); rna_def_render_pass(brna); rna_def_render_bake_pixel(brna); diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index d8feebaa129..810d83a8ddf 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -36,6 +36,8 @@ #include "DNA_userdef_types.h" #include "DNA_world_types.h" +#include "IMB_imbuf_types.h" + #include "BLI_math.h" #include "BLF_translation.h" @@ -45,6 +47,8 @@ #include "BKE_paint.h" #include "BKE_scene.h" +#include "GPU_extensions.h" + #include "RNA_define.h" #include "RNA_enum_types.h" @@ -82,6 +86,11 @@ EnumPropertyItem exr_codec_items[] = { {R_IMF_EXR_CODEC_ZIP, "ZIP", 0, "ZIP (lossless)", ""}, {R_IMF_EXR_CODEC_PIZ, "PIZ", 0, "PIZ (lossless)", ""}, {R_IMF_EXR_CODEC_RLE, "RLE", 0, "RLE (lossless)", ""}, + {R_IMF_EXR_CODEC_ZIPS, "ZIPS", 0, "ZIPS (lossless)", ""}, + {R_IMF_EXR_CODEC_B44, "B44", 0, "B44 (lossy)", ""}, + {R_IMF_EXR_CODEC_B44A, "B44A", 0, "B44A (lossy)", ""}, + {R_IMF_EXR_CODEC_DWAA, "DWAA", 0, "DWAA (lossy)", ""}, + {R_IMF_EXR_CODEC_DWAB, "DWAB", 0, "DWAB (lossy)", ""}, {0, NULL, 0, NULL, NULL} }; #endif @@ -125,6 +134,7 @@ EnumPropertyItem proportional_falloff_curve_only_items[] = { {PROP_SMOOTH, "SMOOTH", ICON_SMOOTHCURVE, "Smooth", "Smooth falloff"}, {PROP_SPHERE, "SPHERE", ICON_SPHERECURVE, "Sphere", "Spherical falloff"}, {PROP_ROOT, "ROOT", ICON_ROOTCURVE, "Root", "Root falloff"}, + {PROP_INVSQUARE, "INVERSE_SQUARE", ICON_ROOTCURVE, "Inverse Square", "Inverse Square falloff"}, {PROP_SHARP, "SHARP", ICON_SHARPCURVE, "Sharp", "Sharp falloff"}, {PROP_LIN, "LINEAR", ICON_LINCURVE, "Linear", "Linear falloff"}, {0, NULL, 0, NULL, NULL} @@ -210,13 +220,13 @@ EnumPropertyItem snap_uv_element_items[] = { #endif #ifdef WITH_OPENEXR -# define R_IMF_ENUM_EXR_MULTI {R_IMF_IMTYPE_MULTILAYER, "OPEN_EXR_MULTILAYER", ICON_FILE_IMAGE, \ +# define R_IMF_ENUM_EXR_MULTILAYER {R_IMF_IMTYPE_MULTILAYER, "OPEN_EXR_MULTILAYER", ICON_FILE_IMAGE, \ "OpenEXR MultiLayer", \ "Output image in multilayer OpenEXR format"}, # define R_IMF_ENUM_EXR {R_IMF_IMTYPE_OPENEXR, "OPEN_EXR", ICON_FILE_IMAGE, "OpenEXR", \ "Output image in OpenEXR format"}, #else -# define R_IMF_ENUM_EXR_MULTI +# define R_IMF_ENUM_EXR_MULTILAYER # define R_IMF_ENUM_EXR #endif @@ -245,7 +255,7 @@ EnumPropertyItem snap_uv_element_items[] = { {0, "", 0, " ", NULL}, \ R_IMF_ENUM_CINEON \ R_IMF_ENUM_DPX \ - R_IMF_ENUM_EXR_MULTI \ + R_IMF_ENUM_EXR_MULTILAYER \ R_IMF_ENUM_EXR \ R_IMF_ENUM_HDR \ R_IMF_ENUM_TIFF \ @@ -329,6 +339,62 @@ EnumPropertyItem bake_save_mode_items[] = { {0, NULL, 0, NULL, NULL} }; +#define R_IMF_VIEWS_ENUM_IND {R_IMF_VIEWS_INDIVIDUAL, "INDIVIDUAL", 0, "Individual", \ + "Individual files for each view with the prefix as defined by the scene views"}, +#define R_IMF_VIEWS_ENUM_S3D {R_IMF_VIEWS_STEREO_3D, "STEREO_3D", 0, "Stereo 3D", \ + "Single file with an encoded stereo pair"}, +#define R_IMF_VIEWS_ENUM_MV {R_IMF_VIEWS_MULTIVIEW, "MULTIVIEW", 0, "Multi-View", "Single file with all the views"}, + +EnumPropertyItem views_format_items[] = { + R_IMF_VIEWS_ENUM_IND + R_IMF_VIEWS_ENUM_S3D + {0, NULL, 0, NULL, NULL} +}; + +EnumPropertyItem views_format_multilayer_items[] = { + R_IMF_VIEWS_ENUM_IND + R_IMF_VIEWS_ENUM_MV + {0, NULL, 0, NULL, NULL} +}; + +EnumPropertyItem views_format_multiview_items[] = { + R_IMF_VIEWS_ENUM_IND + R_IMF_VIEWS_ENUM_S3D + R_IMF_VIEWS_ENUM_MV + {0, NULL, 0, NULL, NULL} +}; + +#undef R_IMF_VIEWS_ENUM_IND +#undef R_IMF_VIEWS_ENUM_S3D +#undef R_IMF_VIEWS_ENUM_MV + +EnumPropertyItem stereo3d_display_items[] = { + {S3D_DISPLAY_ANAGLYPH, "ANAGLYPH", 0, "Anaglyph", + "Render views for left and right eyes as two differently filtered colors in a single image " + "(anaglyph glasses are required)"}, + {S3D_DISPLAY_INTERLACE, "INTERLACE", 0, "Interlace", + "Render views for left and right eyes interlaced in a single image (3D-ready monitor is required)"}, + {S3D_DISPLAY_PAGEFLIP, "TIMESEQUENTIAL", 0, "Time Sequential", + "Render alternate eyes (also known as page flip, quad buffer support in the graphic card is required)"}, + {S3D_DISPLAY_SIDEBYSIDE, "SIDEBYSIDE", 0, "Side-by-Side", "Render views for left and right eyes side-by-side"}, + {S3D_DISPLAY_TOPBOTTOM, "TOPBOTTOM", 0, "Top-Bottom", "Render views for left and right eyes one above another"}, + {0, NULL, 0, NULL, NULL} +}; + +EnumPropertyItem stereo3d_anaglyph_type_items[] = { + {S3D_ANAGLYPH_REDCYAN, "RED_CYAN", 0, "Red-Cyan", ""}, + {S3D_ANAGLYPH_GREENMAGENTA, "GREEN_MAGENTA", 0, "Green-Magenta", ""}, + {S3D_ANAGLYPH_YELLOWBLUE, "YELLOW_BLUE", 0, "Yellow-Blue", ""}, + {0, NULL, 0, NULL, NULL} +}; + +EnumPropertyItem stereo3d_interlace_type_items[] = { + {S3D_INTERLACE_ROW, "ROW_INTERLEAVED", 0, "Row Interleaved", ""}, + {S3D_INTERLACE_COLUMN, "COLUMN_INTERLEAVED", 0, "Column Interleaved", ""}, + {S3D_INTERLACE_CHECKERBOARD, "CHECKERBOARD_INTERLEAVED", 0, "Checkerboard Interleaved", ""}, + {0, NULL, 0, NULL, NULL} +}; + #ifdef RNA_RUNTIME #include "DNA_anim_types.h" @@ -533,13 +599,13 @@ static void rna_Scene_layer_update(Main *bmain, Scene *scene, PointerRNA *ptr) static void rna_Scene_fps_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *UNUSED(ptr)) { - sound_update_fps(scene); + BKE_sound_update_fps(scene); BKE_sequencer_update_sound_bounds_all(scene); } static void rna_Scene_listener_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *UNUSED(ptr)) { - sound_update_scene_listener(scene); + BKE_sound_update_scene_listener(scene); } static void rna_Scene_volume_set(PointerRNA *ptr, float value) @@ -548,7 +614,7 @@ static void rna_Scene_volume_set(PointerRNA *ptr, float value) scene->audio.volume = value; if (scene->sound_scene) - sound_set_scene_volume(scene, value); + BKE_sound_set_scene_volume(scene, value); } static void rna_Scene_framelen_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *UNUSED(ptr)) @@ -649,7 +715,7 @@ static void rna_Scene_preview_range_end_frame_set(PointerRNA *ptr, int value) static void rna_Scene_frame_update(Main *bmain, Scene *UNUSED(current_scene), PointerRNA *ptr) { Scene *scene = (Scene *)ptr->id.data; - sound_seek_scene(bmain, scene); + BKE_sound_seek_scene(bmain, scene); } static PointerRNA rna_Scene_active_keying_set_get(PointerRNA *ptr) @@ -716,6 +782,26 @@ static void rna_Scene_all_keyingsets_next(CollectionPropertyIterator *iter) iter->valid = (internal->link != NULL); } +static int rna_RenderSettings_stereoViews_skip(CollectionPropertyIterator *iter, void *UNUSED(data)) +{ + ListBaseIterator *internal = &iter->internal.listbase; + SceneRenderView *srv = (SceneRenderView *)internal->link; + + if ((STREQ(srv->name, STEREO_LEFT_NAME)) || + (STREQ(srv->name, STEREO_RIGHT_NAME))) + { + return 0; + } + + return 1; +}; + +static void rna_RenderSettings_stereoViews_begin(CollectionPropertyIterator *iter, PointerRNA *ptr) +{ + RenderData *rd = (RenderData *)ptr->data; + rna_iterator_listbase_begin(iter, &rd->views, rna_RenderSettings_stereoViews_skip); +} + static char *rna_RenderSettings_path(PointerRNA *UNUSED(ptr)) { return BLI_sprintfN("render"); @@ -818,8 +904,8 @@ static void rna_ImageFormatSettings_file_format_set(PointerRNA *ptr, int value) } } -static EnumPropertyItem *rna_ImageFormatSettings_file_format_itemf(bContext *UNUSED(C), PointerRNA *ptr, - PropertyRNA *UNUSED(prop), bool *UNUSED(r_free)) +static EnumPropertyItem *rna_ImageFormatSettings_file_format_itemf( + bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *UNUSED(r_free)) { ID *id = ptr->id.data; if (id && GS(id->name) == ID_SCE) { @@ -830,8 +916,8 @@ static EnumPropertyItem *rna_ImageFormatSettings_file_format_itemf(bContext *UNU } } -static EnumPropertyItem *rna_ImageFormatSettings_color_mode_itemf(bContext *UNUSED(C), PointerRNA *ptr, - PropertyRNA *UNUSED(prop), bool *r_free) +static EnumPropertyItem *rna_ImageFormatSettings_color_mode_itemf( + bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *r_free) { ImageFormatData *imf = (ImageFormatData *)ptr->data; ID *id = ptr->id.data; @@ -875,8 +961,8 @@ static EnumPropertyItem *rna_ImageFormatSettings_color_mode_itemf(bContext *UNUS } } -static EnumPropertyItem *rna_ImageFormatSettings_color_depth_itemf(bContext *UNUSED(C), PointerRNA *ptr, - PropertyRNA *UNUSED(prop), bool *r_free) +static EnumPropertyItem *rna_ImageFormatSettings_color_depth_itemf( + bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *r_free) { ImageFormatData *imf = (ImageFormatData *)ptr->data; @@ -938,6 +1024,54 @@ static EnumPropertyItem *rna_ImageFormatSettings_color_depth_itemf(bContext *UNU } } +static EnumPropertyItem *rna_ImageFormatSettings_views_format_itemf( + bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *UNUSED(r_free)) +{ + ImageFormatData *imf = (ImageFormatData *)ptr->data; + + if (imf == NULL) { + return views_format_items; + } + else if (imf->imtype == R_IMF_IMTYPE_OPENEXR) { + return views_format_multiview_items; + } + else if (imf->imtype == R_IMF_IMTYPE_MULTILAYER) { + return views_format_multilayer_items; + } + else { + return views_format_items; + } +} + +#ifdef WITH_OPENEXR + /* OpenEXR */ + +static EnumPropertyItem *rna_ImageFormatSettings_exr_codec_itemf( + bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *r_free) +{ + ImageFormatData *imf = (ImageFormatData *)ptr->data; + + EnumPropertyItem *item = NULL; + int i = 1, totitem = 0; + + if (imf->depth == 16) + return exr_codec_items; /* All compression types are defined for halfs */ + + for (i = 0; i < R_IMF_EXR_CODEC_MAX; i++) { + if ((i == R_IMF_EXR_CODEC_B44 || i == R_IMF_EXR_CODEC_B44A)) { + continue; /* B44 and B44A are not defined for 32 bit floats */ + } + + RNA_enum_item_add(&item, &totitem, &exr_codec_items[i]); + } + + RNA_enum_item_end(&item, &totitem); + *r_free = true; + + return item; +} + +#endif static int rna_SceneRender_file_ext_length(PointerRNA *ptr) { RenderData *rd = (RenderData *)ptr->data; @@ -969,8 +1103,8 @@ static void rna_RenderSettings_qtcodecsettings_codecType_set(PointerRNA *ptr, in settings->codecType = quicktime_videocodecType_from_rnatmpvalue(value); } -static EnumPropertyItem *rna_RenderSettings_qtcodecsettings_codecType_itemf(bContext *UNUSED(C), PointerRNA *UNUSED(ptr), - PropertyRNA *UNUSED(prop), bool *r_free) +static EnumPropertyItem *rna_RenderSettings_qtcodecsettings_codecType_itemf( + bContext *UNUSED(C), PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool *r_free) { EnumPropertyItem *item = NULL; EnumPropertyItem tmp = {0, "", 0, "", ""}; @@ -1007,8 +1141,8 @@ static void rna_RenderSettings_qtcodecsettings_audiocodecType_set(PointerRNA *pt settings->audiocodecType = quicktime_audiocodecType_from_rnatmpvalue(value); } -static EnumPropertyItem *rna_RenderSettings_qtcodecsettings_audiocodecType_itemf(bContext *UNUSED(C), PointerRNA *UNUSED(ptr), - PropertyRNA *UNUSED(prop), bool *r_free) +static EnumPropertyItem *rna_RenderSettings_qtcodecsettings_audiocodecType_itemf( + bContext *UNUSED(C), PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool *r_free) { EnumPropertyItem *item = NULL; EnumPropertyItem tmp = {0, "", 0, "", ""}; @@ -1068,8 +1202,8 @@ static void rna_RenderSettings_active_layer_index_set(PointerRNA *ptr, int value rd->actlay = min_ff(value, num_layers - 1); } -static void rna_RenderSettings_active_layer_index_range(PointerRNA *ptr, int *min, int *max, - int *UNUSED(softmin), int *UNUSED(softmax)) +static void rna_RenderSettings_active_layer_index_range( + PointerRNA *ptr, int *min, int *max, int *UNUSED(softmin), int *UNUSED(softmax)) { RenderData *rd = (RenderData *)ptr->data; @@ -1104,8 +1238,8 @@ static SceneRenderLayer *rna_RenderLayer_new(ID *id, RenderData *UNUSED(rd), con return srl; } -static void rna_RenderLayer_remove(ID *id, RenderData *UNUSED(rd), Main *bmain, ReportList *reports, - PointerRNA *srl_ptr) +static void rna_RenderLayer_remove( + ID *id, RenderData *UNUSED(rd), Main *bmain, ReportList *reports, PointerRNA *srl_ptr) { SceneRenderLayer *srl = srl_ptr->data; Scene *scene = (Scene *)id; @@ -1122,6 +1256,70 @@ static void rna_RenderLayer_remove(ID *id, RenderData *UNUSED(rd), Main *bmain, WM_main_add_notifier(NC_SCENE | ND_RENDER_OPTIONS, NULL); } +static int rna_RenderSettings_active_view_index_get(PointerRNA *ptr) +{ + RenderData *rd = (RenderData *)ptr->data; + return rd->actview; +} + +static void rna_RenderSettings_active_view_index_set(PointerRNA *ptr, int value) +{ + RenderData *rd = (RenderData *)ptr->data; + rd->actview = value; +} + +static void rna_RenderSettings_active_view_index_range( + PointerRNA *ptr, int *min, int *max, int *UNUSED(softmin), int *UNUSED(softmax)) +{ + RenderData *rd = (RenderData *)ptr->data; + + *min = 0; + *max = max_ii(0, BLI_listbase_count(&rd->views) - 1); +} + +static PointerRNA rna_RenderSettings_active_view_get(PointerRNA *ptr) +{ + RenderData *rd = (RenderData *)ptr->data; + SceneRenderView *srv = BLI_findlink(&rd->views, rd->actview); + + return rna_pointer_inherit_refine(ptr, &RNA_SceneRenderView, srv); +} + +static void rna_RenderSettings_active_view_set(PointerRNA *ptr, PointerRNA value) +{ + RenderData *rd = (RenderData *)ptr->data; + SceneRenderView *srv = (SceneRenderView *)value.data; + const int index = BLI_findindex(&rd->views, srv); + if (index != -1) rd->actview = index; +} + +static SceneRenderView *rna_RenderView_new(ID *id, RenderData *UNUSED(rd), const char *name) +{ + Scene *scene = (Scene *)id; + SceneRenderView *srv = BKE_scene_add_render_view(scene, name); + + WM_main_add_notifier(NC_SCENE | ND_RENDER_OPTIONS, NULL); + + return srv; +} + +static void rna_RenderView_remove( + ID *id, RenderData *UNUSED(rd), Main *UNUSED(bmain), ReportList *reports, PointerRNA *srv_ptr) +{ + SceneRenderView *srv = srv_ptr->data; + Scene *scene = (Scene *)id; + + if (!BKE_scene_remove_render_view(scene, srv)) { + BKE_reportf(reports, RPT_ERROR, "Render view '%s' could not be removed from scene '%s'", + srv->name, scene->id.name + 2); + return; + } + + RNA_POINTER_INVALIDATE(srv_ptr); + + WM_main_add_notifier(NC_SCENE | ND_RENDER_OPTIONS, NULL); +} + static void rna_RenderSettings_engine_set(PointerRNA *ptr, int value) { RenderData *rd = (RenderData *)ptr->data; @@ -1131,8 +1329,8 @@ static void rna_RenderSettings_engine_set(PointerRNA *ptr, int value) BLI_strncpy_utf8(rd->engine, type->idname, sizeof(rd->engine)); } -static EnumPropertyItem *rna_RenderSettings_engine_itemf(bContext *UNUSED(C), PointerRNA *UNUSED(ptr), - PropertyRNA *UNUSED(prop), bool *r_free) +static EnumPropertyItem *rna_RenderSettings_engine_itemf( + bContext *UNUSED(C), PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool *r_free) { RenderEngineType *type; EnumPropertyItem *item = NULL; @@ -1215,7 +1413,7 @@ static void rna_SceneRenderLayer_name_set(PointerRNA *ptr, const char *value) } /* fix all the animation data which may link to this */ - BKE_all_animdata_fix_paths_rename(NULL, "render.layers", oldname, rl->name); + BKE_animdata_fix_paths_rename_all(NULL, "render.layers", oldname, rl->name); } static char *rna_SceneRenderLayer_path(PointerRNA *ptr) @@ -1227,6 +1425,34 @@ static char *rna_SceneRenderLayer_path(PointerRNA *ptr) return BLI_sprintfN("render.layers[\"%s\"]", name_esc); } +static void rna_SceneRenderView_name_set(PointerRNA *ptr, const char *value) +{ + Scene *scene = (Scene *)ptr->id.data; + SceneRenderView *rv = (SceneRenderView *)ptr->data; + BLI_strncpy_utf8(rv->name, value, sizeof(rv->name)); + BLI_uniquename(&scene->r.views, rv, DATA_("RenderView"), '.', offsetof(SceneRenderView, name), sizeof(rv->name)); +} + +static char *rna_SceneRenderView_path(PointerRNA *ptr) +{ + SceneRenderView *srv = (SceneRenderView *)ptr->data; + return BLI_sprintfN("render.views[\"%s\"]", srv->name); +} + +static void rna_RenderSettings_views_format_set(PointerRNA *ptr, int value) +{ + RenderData *rd = (RenderData *)ptr->data; + + if (rd->views_format == SCE_VIEWS_FORMAT_MULTIVIEW && + value == SCE_VIEWS_FORMAT_STEREO_3D) + { + /* make sure the actview is visible */ + if (rd->actview > 1) rd->actview = 1; + } + + rd->views_format = value; +} + static int rna_RenderSettings_multiple_engines_get(PointerRNA *UNUSED(ptr)) { return (BLI_listbase_count(&R_engines) > 1); @@ -1388,7 +1614,7 @@ static void rna_Scene_use_audio_set(PointerRNA *ptr, int value) else scene->audio.flag &= ~AUDIO_MUTE; - sound_mute_scene(scene, value); + BKE_sound_mute_scene(scene, value); } static int rna_Scene_sync_mode_get(PointerRNA *ptr) @@ -1602,10 +1828,11 @@ static void rna_FreestyleLineSet_linestyle_set(PointerRNA *ptr, PointerRNA value lineset->linestyle->id.us++; } -static FreestyleLineSet *rna_FreestyleSettings_lineset_add(ID *id, FreestyleSettings *config, const char *name) +static FreestyleLineSet *rna_FreestyleSettings_lineset_add( + ID *id, FreestyleSettings *config, Main *bmain, const char *name) { Scene *scene = (Scene *)id; - FreestyleLineSet *lineset = BKE_freestyle_lineset_add((FreestyleConfig *)config, name); + FreestyleLineSet *lineset = BKE_freestyle_lineset_add(bmain, (FreestyleConfig *)config, name); DAG_id_tag_update(&scene->id, 0); WM_main_add_notifier(NC_SCENE | ND_RENDER_OPTIONS, NULL); @@ -1613,8 +1840,8 @@ static FreestyleLineSet *rna_FreestyleSettings_lineset_add(ID *id, FreestyleSett return lineset; } -static void rna_FreestyleSettings_lineset_remove(ID *id, FreestyleSettings *config, ReportList *reports, - PointerRNA *lineset_ptr) +static void rna_FreestyleSettings_lineset_remove( + ID *id, FreestyleSettings *config, ReportList *reports, PointerRNA *lineset_ptr) { FreestyleLineSet *lineset = lineset_ptr->data; Scene *scene = (Scene *)id; @@ -1637,8 +1864,8 @@ static PointerRNA rna_FreestyleSettings_active_lineset_get(PointerRNA *ptr) return rna_pointer_inherit_refine(ptr, &RNA_FreestyleLineSet, lineset); } -static void rna_FreestyleSettings_active_lineset_index_range(PointerRNA *ptr, int *min, int *max, - int *UNUSED(softmin), int *UNUSED(softmax)) +static void rna_FreestyleSettings_active_lineset_index_range( + PointerRNA *ptr, int *min, int *max, int *UNUSED(softmin), int *UNUSED(softmax)) { FreestyleConfig *config = (FreestyleConfig *)ptr->data; @@ -1669,8 +1896,8 @@ static FreestyleModuleConfig *rna_FreestyleSettings_module_add(ID *id, Freestyle return module; } -static void rna_FreestyleSettings_module_remove(ID *id, FreestyleSettings *config, ReportList *reports, - PointerRNA *module_ptr) +static void rna_FreestyleSettings_module_remove( + ID *id, FreestyleSettings *config, ReportList *reports, PointerRNA *module_ptr) { Scene *scene = (Scene *)id; FreestyleModuleConfig *module = module_ptr->data; @@ -1679,7 +1906,7 @@ static void rna_FreestyleSettings_module_remove(ID *id, FreestyleSettings *confi if (module->script) BKE_reportf(reports, RPT_ERROR, "Style module '%s' could not be removed", module->script->id.name + 2); else - BKE_reportf(reports, RPT_ERROR, "Style module could not be removed"); + BKE_report(reports, RPT_ERROR, "Style module could not be removed"); return; } @@ -1711,6 +1938,44 @@ static void rna_GPUFXSettings_fx_update(Main *UNUSED(bmain), Scene *UNUSED(scene BKE_screen_gpu_fx_validate(fx_settings); } +static void rna_GPUDOFSettings_blades_set(PointerRNA *ptr, const int value) +{ + GPUDOFSettings *dofsettings = (GPUDOFSettings *)ptr->data; + + if (value < 3 && dofsettings->num_blades > 2) + dofsettings->num_blades = 0; + else if (value > 0 && dofsettings->num_blades == 0) + dofsettings->num_blades = 3; + else + dofsettings->num_blades = value; +} + +static void rna_Stereo3dFormat_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) +{ + ID *id = ptr->id.data; + + if (id && GS(id->name) == ID_IM) { + Image *ima = (Image *)id; + ImBuf *ibuf; + void *lock; + + if ((ima->flag & IMA_IS_STEREO) == 0) + return; + + ibuf = BKE_image_acquire_ibuf(ima, NULL, &lock); + + if (ibuf) { + BKE_image_signal(ima, NULL, IMA_SIGNAL_FREE); + } + BKE_image_release_ibuf(ima, ibuf, lock); + } +} + +static int rna_gpu_is_hq_supported_get(PointerRNA *UNUSED(ptr)) +{ + return GPU_instanced_drawing_support() && GPU_geometry_shader_support(); +} + #else static void rna_def_transform_orientation(BlenderRNA *brna) @@ -1796,9 +2061,11 @@ static void rna_def_tool_settings(BlenderRNA *brna) static EnumPropertyItem gpencil_source_3d_items[] = { {GP_TOOL_SOURCE_SCENE, "SCENE", 0, "Scene", - "Grease Pencil data attached to the current scene is used, unless the active object already has Grease Pencil data (i.e. for old files)"}, + "Grease Pencil data attached to the current scene is used, " + "unless the active object already has Grease Pencil data (i.e. for old files)"}, {GP_TOOL_SOURCE_OBJECT, "OBJECT", 0, "Object", - "Grease Pencil datablocks attached to the active object are used (required using pre 2.73 add-ons, e.g. BSurfaces)"}, + "Grease Pencil datablocks attached to the active object are used " + "(required using pre 2.73 add-ons, e.g. BSurfaces)"}, {0, NULL, 0, NULL, NULL} }; @@ -1856,6 +2123,10 @@ static void rna_def_tool_settings(BlenderRNA *brna) RNA_def_property_pointer_sdna(prop, NULL, "particle"); RNA_def_property_ui_text(prop, "Particle Edit", ""); + prop = RNA_def_property(srna, "hair_edit", PROP_POINTER, PROP_NONE); + RNA_def_property_pointer_sdna(prop, NULL, "hair_edit"); + RNA_def_property_ui_text(prop, "Hair Edit", ""); + prop = RNA_def_property(srna, "use_uv_sculpt", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "use_uv_sculpt", 1); RNA_def_property_ui_text(prop, "UV Sculpt", "Enable brush for UV sculpting"); @@ -1906,6 +2177,22 @@ static void rna_def_tool_settings(BlenderRNA *brna) RNA_def_property_ui_icon(prop, ICON_PROP_OFF, 1); RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */ + prop = RNA_def_property(srna, "use_proportional_action", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "proportional_action", 0); + RNA_def_property_ui_text(prop, "Proportional Editing Actions", "Proportional editing in action editor"); + RNA_def_property_ui_icon(prop, ICON_PROP_OFF, 1); + RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */ + + prop = RNA_def_property(srna, "use_proportional_fcurve", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "proportional_fcurve", 0); + RNA_def_property_ui_text(prop, "Proportional Editing FCurves", "Proportional editing in FCurve editor"); + RNA_def_property_ui_icon(prop, ICON_PROP_OFF, 1); + RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */ + + prop = RNA_def_property(srna, "lock_markers", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "lock_markers", 0); + RNA_def_property_ui_text(prop, "Lock Markers", "Prevent marker editing"); + prop = RNA_def_property(srna, "proportional_edit_falloff", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "prop_mode"); RNA_def_property_enum_items(prop, proportional_falloff_items); @@ -2086,7 +2373,8 @@ static void rna_def_tool_settings(BlenderRNA *brna) prop = RNA_def_property(srna, "use_etch_autoname", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "skgen_retarget_options", SK_RETARGET_AUTONAME); - RNA_def_property_ui_text(prop, "Autoname Bones", "Automatically generate values to replace &N and &S suffix placeholders in template names"); + RNA_def_property_ui_text(prop, "Autoname Bones", + "Automatically generate values to replace &N and &S suffix placeholders in template names"); prop = RNA_def_property(srna, "etch_number", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "skgen_num_string"); @@ -2813,7 +3101,7 @@ static void rna_def_freestyle_linesets(BlenderRNA *brna, PropertyRNA *cprop) func = RNA_def_function(srna, "new", "rna_FreestyleSettings_lineset_add"); RNA_def_function_ui_description(func, "Add a line set to scene render layer Freestyle settings"); - RNA_def_function_flag(func, FUNC_USE_SELF_ID); + RNA_def_function_flag(func, FUNC_USE_MAIN | FUNC_USE_SELF_ID); parm = RNA_def_string(func, "name", "LineSet", 0, "", "New name for the line set (not unique)"); RNA_def_property_flag(parm, PROP_REQUIRED); parm = RNA_def_pointer(func, "lineset", "FreestyleLineSet", "", "Newly created line set"); @@ -2974,12 +3262,14 @@ static void rna_def_freestyle_settings(BlenderRNA *brna) prop = RNA_def_property(srna, "face_mark_condition", PROP_ENUM, PROP_NONE); RNA_def_property_enum_bitflag_sdna(prop, NULL, "flags"); RNA_def_property_enum_items(prop, face_mark_condition_items); - RNA_def_property_ui_text(prop, "Face Mark Condition", "Specify a feature edge selection condition based on face marks"); + RNA_def_property_ui_text(prop, "Face Mark Condition", + "Specify a feature edge selection condition based on face marks"); RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update"); prop = RNA_def_property(srna, "select_silhouette", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "edge_types", FREESTYLE_FE_SILHOUETTE); - RNA_def_property_ui_text(prop, "Silhouette", "Select silhouettes (edges at the boundary of visible and hidden faces)"); + RNA_def_property_ui_text(prop, "Silhouette", + "Select silhouettes (edges at the boundary of visible and hidden faces)"); RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update"); prop = RNA_def_property(srna, "select_border", PROP_BOOLEAN, PROP_NONE); @@ -2989,12 +3279,14 @@ static void rna_def_freestyle_settings(BlenderRNA *brna) prop = RNA_def_property(srna, "select_crease", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "edge_types", FREESTYLE_FE_CREASE); - RNA_def_property_ui_text(prop, "Crease", "Select crease edges (those between two faces making an angle smaller than the Crease Angle)"); + RNA_def_property_ui_text(prop, "Crease", + "Select crease edges (those between two faces making an angle smaller than the Crease Angle)"); RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update"); prop = RNA_def_property(srna, "select_ridge_valley", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "edge_types", FREESTYLE_FE_RIDGE_VALLEY); - RNA_def_property_ui_text(prop, "Ridge & Valley", "Select ridges and valleys (boundary lines between convex and concave areas of surface)"); + RNA_def_property_ui_text(prop, "Ridge & Valley", + "Select ridges and valleys (boundary lines between convex and concave areas of surface)"); RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update"); prop = RNA_def_property(srna, "select_suggestive_contour", PROP_BOOLEAN, PROP_NONE); @@ -3014,7 +3306,8 @@ static void rna_def_freestyle_settings(BlenderRNA *brna) prop = RNA_def_property(srna, "select_external_contour", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "edge_types", FREESTYLE_FE_EXTERNAL_CONTOUR); - RNA_def_property_ui_text(prop, "External Contour", "Select external contours (outer silhouettes of occluding and occluded objects)"); + RNA_def_property_ui_text(prop, "External Contour", + "Select external contours (outer silhouettes of occluding and occluded objects)"); RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update"); prop = RNA_def_property(srna, "select_edge_mark", PROP_BOOLEAN, PROP_NONE); @@ -3163,7 +3456,8 @@ static void rna_def_freestyle_settings(BlenderRNA *brna) prop = RNA_def_property(srna, "use_view_map_cache", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flags", FREESTYLE_VIEW_MAP_CACHE); - RNA_def_property_ui_text(prop, "View Map Cache", "Keep the computed view map and avoid re-calculating it if mesh geometry is unchanged"); + RNA_def_property_ui_text(prop, "View Map Cache", + "Keep the computed view map and avoid re-calculating it if mesh geometry is unchanged"); RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_use_view_map_cache_update"); prop = RNA_def_property(srna, "sphere_radius", PROP_FLOAT, PROP_NONE); @@ -3204,36 +3498,42 @@ static void rna_def_scene_game_recast_data(BlenderRNA *brna) prop = RNA_def_property(srna, "cell_size", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "cellsize"); RNA_def_property_ui_range(prop, 0.1, 1, 1, 2); + RNA_def_property_float_default(prop, 0.3f); RNA_def_property_ui_text(prop, "Cell Size", "Rasterized cell size"); RNA_def_property_update(prop, NC_SCENE, NULL); prop = RNA_def_property(srna, "cell_height", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "cellheight"); RNA_def_property_ui_range(prop, 0.1, 1, 1, 2); + RNA_def_property_float_default(prop, 0.2f); RNA_def_property_ui_text(prop, "Cell Height", "Rasterized cell height"); RNA_def_property_update(prop, NC_SCENE, NULL); prop = RNA_def_property(srna, "agent_height", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "agentheight"); RNA_def_property_ui_range(prop, 0.1, 5, 1, 2); + RNA_def_property_float_default(prop, 2.0f); RNA_def_property_ui_text(prop, "Agent Height", "Minimum height where the agent can still walk"); RNA_def_property_update(prop, NC_SCENE, NULL); prop = RNA_def_property(srna, "agent_radius", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "agentradius"); RNA_def_property_ui_range(prop, 0.1, 5, 1, 2); + RNA_def_property_float_default(prop, 0.6f); RNA_def_property_ui_text(prop, "Agent Radius", "Radius of the agent"); RNA_def_property_update(prop, NC_SCENE, NULL); prop = RNA_def_property(srna, "climb_max", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "agentmaxclimb"); RNA_def_property_ui_range(prop, 0.1, 5, 1, 2); + RNA_def_property_float_default(prop, 0.9f); RNA_def_property_ui_text(prop, "Max Climb", "Maximum height between grid cells the agent can climb"); RNA_def_property_update(prop, NC_SCENE, NULL); prop = RNA_def_property(srna, "slope_max", PROP_FLOAT, PROP_ANGLE); RNA_def_property_float_sdna(prop, NULL, "agentmaxslope"); RNA_def_property_range(prop, 0, M_PI_2); + RNA_def_property_float_default(prop, M_PI_4); RNA_def_property_ui_text(prop, "Max Slope", "Maximum walkable slope angle"); RNA_def_property_update(prop, NC_SCENE, NULL); @@ -3241,42 +3541,49 @@ static void rna_def_scene_game_recast_data(BlenderRNA *brna) prop = RNA_def_property(srna, "region_min_size", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "regionminsize"); RNA_def_property_ui_range(prop, 0, 150, 1, 2); + RNA_def_property_float_default(prop, 8.0f); RNA_def_property_ui_text(prop, "Min Region Size", "Minimum regions size (smaller regions will be deleted)"); RNA_def_property_update(prop, NC_SCENE, NULL); prop = RNA_def_property(srna, "region_merge_size", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "regionmergesize"); RNA_def_property_ui_range(prop, 0, 150, 1, 2); + RNA_def_property_float_default(prop, 20.0f); RNA_def_property_ui_text(prop, "Merged Region Size", "Minimum regions size (smaller regions will be merged)"); RNA_def_property_update(prop, NC_SCENE, NULL); prop = RNA_def_property(srna, "edge_max_len", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "edgemaxlen"); RNA_def_property_ui_range(prop, 0, 50, 1, 2); + RNA_def_property_float_default(prop, 12.0f); RNA_def_property_ui_text(prop, "Max Edge Length", "Maximum contour edge length"); RNA_def_property_update(prop, NC_SCENE, NULL); prop = RNA_def_property(srna, "edge_max_error", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "edgemaxerror"); RNA_def_property_ui_range(prop, 0.1, 3.0, 1, 2); + RNA_def_property_float_default(prop, 1.3f); RNA_def_property_ui_text(prop, "Max Edge Error", "Maximum distance error from contour to cells"); RNA_def_property_update(prop, NC_SCENE, NULL); prop = RNA_def_property(srna, "verts_per_poly", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "vertsperpoly"); RNA_def_property_ui_range(prop, 3, 12, 1, -1); + RNA_def_property_int_default(prop, 6); RNA_def_property_ui_text(prop, "Verts Per Poly", "Max number of vertices per polygon"); RNA_def_property_update(prop, NC_SCENE, NULL); prop = RNA_def_property(srna, "sample_dist", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "detailsampledist"); RNA_def_property_ui_range(prop, 0.0, 16.0, 1, 2); + RNA_def_property_float_default(prop, 6.0f); RNA_def_property_ui_text(prop, "Sample Distance", "Detail mesh sample spacing"); RNA_def_property_update(prop, NC_SCENE, NULL); prop = RNA_def_property(srna, "sample_max_error", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "detailsamplemaxerror"); RNA_def_property_ui_range(prop, 0.0, 16.0, 1, 2); + RNA_def_property_float_default(prop, 1.0f); RNA_def_property_ui_text(prop, "Max Sample Error", "Detail mesh simplification max sample error"); RNA_def_property_update(prop, NC_SCENE, NULL); } @@ -3488,12 +3795,14 @@ static void rna_def_scene_game_data(BlenderRNA *brna) prop = RNA_def_property(srna, "resolution_x", PROP_INT, PROP_PIXEL); RNA_def_property_int_sdna(prop, NULL, "xplay"); RNA_def_property_range(prop, 4, 10000); + RNA_def_property_int_default(prop, 640); RNA_def_property_ui_text(prop, "Resolution X", "Number of horizontal pixels in the screen"); RNA_def_property_update(prop, NC_SCENE, NULL); prop = RNA_def_property(srna, "resolution_y", PROP_INT, PROP_PIXEL); RNA_def_property_int_sdna(prop, NULL, "yplay"); RNA_def_property_range(prop, 4, 10000); + RNA_def_property_int_default(prop, 480); RNA_def_property_ui_text(prop, "Resolution Y", "Number of vertical pixels in the screen"); RNA_def_property_update(prop, NC_SCENE, NULL); @@ -3510,12 +3819,14 @@ static void rna_def_scene_game_data(BlenderRNA *brna) prop = RNA_def_property(srna, "depth", PROP_INT, PROP_UNSIGNED); RNA_def_property_int_sdna(prop, NULL, "depth"); RNA_def_property_range(prop, 8, 32); + RNA_def_property_int_default(prop, 32); RNA_def_property_ui_text(prop, "Bits", "Display bit depth of full screen display"); RNA_def_property_update(prop, NC_SCENE, NULL); prop = RNA_def_property(srna, "exit_key", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "exitkey"); RNA_def_property_enum_items(prop, event_type_items); + RNA_def_property_enum_default(prop, ESCKEY); RNA_def_property_enum_funcs(prop, NULL, "rna_GameSettings_exit_key_set", NULL); RNA_def_property_ui_text(prop, "Exit Key", "The key that exits the Game Engine"); RNA_def_property_update(prop, NC_SCENE, NULL); @@ -3530,6 +3841,7 @@ static void rna_def_scene_game_data(BlenderRNA *brna) prop = RNA_def_property(srna, "frequency", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "freqplay"); RNA_def_property_range(prop, 4, 2000); + RNA_def_property_int_default(prop, 60); RNA_def_property_ui_text(prop, "Freq", "Display clock frequency of fullscreen display"); RNA_def_property_update(prop, NC_SCENE, NULL); @@ -3567,12 +3879,14 @@ static void rna_def_scene_game_data(BlenderRNA *brna) prop = RNA_def_property(srna, "stereo_mode", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "stereomode"); RNA_def_property_enum_items(prop, stereo_modes_items); + RNA_def_property_enum_default(prop, STEREO_ANAGLYPH); RNA_def_property_ui_text(prop, "Stereo Mode", "Stereographic techniques"); RNA_def_property_update(prop, NC_SCENE, NULL); prop = RNA_def_property(srna, "stereo_eye_separation", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "eyeseparation"); RNA_def_property_range(prop, 0.01, 5.0); + RNA_def_property_float_default(prop, 0.1f); RNA_def_property_ui_text(prop, "Eye Separation", "Set the distance between the eyes - the camera focal distance/30 should be fine"); RNA_def_property_update(prop, NC_SCENE, NULL); @@ -3587,18 +3901,21 @@ static void rna_def_scene_game_data(BlenderRNA *brna) prop = RNA_def_property(srna, "dome_tessellation", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "dome.res"); RNA_def_property_ui_range(prop, 1, 8, 1, 1); + RNA_def_property_int_default(prop, 4); RNA_def_property_ui_text(prop, "Tessellation", "Tessellation level - check the generated mesh in wireframe mode"); RNA_def_property_update(prop, NC_SCENE, NULL); prop = RNA_def_property(srna, "dome_buffer_resolution", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "dome.resbuf"); RNA_def_property_ui_range(prop, 0.1, 1.0, 0.1, 2); + RNA_def_property_float_default(prop, 1.0f); RNA_def_property_ui_text(prop, "Buffer Resolution", "Buffer Resolution - decrease it to increase speed"); RNA_def_property_update(prop, NC_SCENE, NULL); prop = RNA_def_property(srna, "dome_angle", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "dome.angle"); RNA_def_property_ui_range(prop, 90, 250, 1, 1); + RNA_def_property_int_default(prop, 180); RNA_def_property_ui_text(prop, "Angle", "Field of View of the Dome - it only works in mode Fisheye and Truncated"); RNA_def_property_update(prop, NC_SCENE, NULL); @@ -3619,6 +3936,7 @@ static void rna_def_scene_game_data(BlenderRNA *brna) prop = RNA_def_property(srna, "physics_engine", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "physicsEngine"); RNA_def_property_enum_items(prop, physics_engine_items); + RNA_def_property_enum_default(prop, WOPHY_BULLET); RNA_def_property_ui_text(prop, "Physics Engine", "Physics engine used for physics simulation in the game engine"); RNA_def_property_update(prop, NC_SCENE, NULL); @@ -3626,6 +3944,7 @@ static void rna_def_scene_game_data(BlenderRNA *brna) RNA_def_property_float_sdna(prop, NULL, "gravity"); RNA_def_property_ui_range(prop, 0.0, 25.0, 1, 2); RNA_def_property_range(prop, 0.0, 10000.0); + RNA_def_property_float_default(prop, 9.8f); RNA_def_property_ui_text(prop, "Physics Gravity", "Gravitational constant used for physics simulation in the game engine"); RNA_def_property_update(prop, NC_SCENE, NULL); @@ -3633,6 +3952,7 @@ static void rna_def_scene_game_data(BlenderRNA *brna) prop = RNA_def_property(srna, "occlusion_culling_resolution", PROP_INT, PROP_PIXEL); RNA_def_property_int_sdna(prop, NULL, "occlusionRes"); RNA_def_property_range(prop, 128.0, 1024.0); + RNA_def_property_int_default(prop, 128); RNA_def_property_ui_text(prop, "Occlusion Resolution", "Size of the occlusion buffer, use higher value for better precision (slower)"); RNA_def_property_update(prop, NC_SCENE, NULL); @@ -3641,6 +3961,7 @@ static void rna_def_scene_game_data(BlenderRNA *brna) RNA_def_property_int_sdna(prop, NULL, "ticrate"); RNA_def_property_ui_range(prop, 1, 60, 1, 1); RNA_def_property_range(prop, 1, 10000); + RNA_def_property_int_default(prop, 60); RNA_def_property_ui_text(prop, "Frames Per Second", "Nominal number of game frames per second " "(physics fixed timestep = 1/fps, independently of actual frame rate)"); @@ -3650,6 +3971,7 @@ static void rna_def_scene_game_data(BlenderRNA *brna) RNA_def_property_int_sdna(prop, NULL, "maxlogicstep"); RNA_def_property_range(prop, 1, 10000); RNA_def_property_ui_range(prop, 1, 50, 1, 1); + RNA_def_property_int_default(prop, 5); RNA_def_property_ui_text(prop, "Max Logic Steps", "Maximum number of logic frame per game frame if graphics slows down the game, " "higher value allows better synchronization with physics"); @@ -3659,6 +3981,7 @@ static void rna_def_scene_game_data(BlenderRNA *brna) RNA_def_property_int_sdna(prop, NULL, "maxphystep"); RNA_def_property_range(prop, 1, 10000); RNA_def_property_ui_range(prop, 1, 50, 1, 1); + RNA_def_property_int_default(prop, 5); RNA_def_property_ui_text(prop, "Max Physics Steps", "Maximum number of physics step per game frame if graphics slows down the game, " "higher value allows physics to keep up with realtime"); @@ -3668,6 +3991,7 @@ static void rna_def_scene_game_data(BlenderRNA *brna) RNA_def_property_int_sdna(prop, NULL, "physubstep"); RNA_def_property_range(prop, 1, 50); RNA_def_property_ui_range(prop, 1, 5, 1, 1); + RNA_def_property_int_default(prop, 1); RNA_def_property_ui_text(prop, "Physics Sub Steps", "Number of simulation substep per physic timestep, " "higher value give better physics precision"); @@ -3677,6 +4001,7 @@ static void rna_def_scene_game_data(BlenderRNA *brna) RNA_def_property_float_sdna(prop, NULL, "lineardeactthreshold"); RNA_def_property_ui_range(prop, 0.001, 10000.0, 2, 3); RNA_def_property_range(prop, 0.001, 10000.0); + RNA_def_property_float_default(prop, 0.8f); RNA_def_property_ui_text(prop, "Deactivation Linear Threshold", "Linear velocity that an object must be below before the deactivation timer can start"); RNA_def_property_update(prop, NC_SCENE, NULL); @@ -3685,6 +4010,7 @@ static void rna_def_scene_game_data(BlenderRNA *brna) RNA_def_property_float_sdna(prop, NULL, "angulardeactthreshold"); RNA_def_property_ui_range(prop, 0.001, 10000.0, 2, 3); RNA_def_property_range(prop, 0.001, 10000.0); + RNA_def_property_float_default(prop, 1.0f); RNA_def_property_ui_text(prop, "Deactivation Angular Threshold", "Angular velocity that an object must be below before the deactivation timer can start"); RNA_def_property_update(prop, NC_SCENE, NULL); @@ -3828,6 +4154,7 @@ static void rna_def_scene_game_data(BlenderRNA *brna) prop = RNA_def_property(srna, "level_height", PROP_FLOAT, PROP_ACCELERATION); RNA_def_property_float_sdna(prop, NULL, "levelHeight"); RNA_def_property_range(prop, 0.0f, 200.0f); + RNA_def_property_float_default(prop, 2.0f); RNA_def_property_ui_text(prop, "Level height", "Max difference in heights of obstacles to enable their interaction"); RNA_def_property_update(prop, NC_SCENE, NULL); @@ -3845,6 +4172,21 @@ static void rna_def_scene_game_data(BlenderRNA *brna) /* Nestled Data */ rna_def_scene_game_recast_data(brna); + + /* LoD */ + prop = RNA_def_property(srna, "use_scene_hysteresis", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "lodflag", SCE_LOD_USE_HYST); + RNA_def_property_ui_text(prop, "Hysteresis", "Use LoD Hysteresis setting for the scene"); + RNA_def_property_update(prop, NC_SCENE, NULL); + + prop = RNA_def_property(srna, "scene_hysteresis_percentage", PROP_INT, PROP_PERCENTAGE); + RNA_def_property_int_sdna(prop, NULL, "scehysteresis"); + RNA_def_property_range(prop, 0, 100); + RNA_def_property_ui_range(prop, 0, 100, 10, 1); + RNA_def_property_int_default(prop, 10); + RNA_def_property_ui_text(prop, "Hysteresis %", + "Minimum distance change required to transition to the previous level of detail"); + RNA_def_property_update(prop, NC_SCENE, NULL); } static void rna_def_gpu_dof_fx(BlenderRNA *brna) @@ -3876,10 +4218,28 @@ static void rna_def_gpu_dof_fx(BlenderRNA *brna) RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); prop = RNA_def_property(srna, "fstop", PROP_FLOAT, PROP_NONE); - RNA_def_property_ui_text(prop, "Viewport F-stop", "F-stop for dof effect"); + RNA_def_property_ui_text(prop, "F-stop", "F-stop for dof effect"); RNA_def_property_range(prop, 0.0f, FLT_MAX); RNA_def_property_ui_range(prop, 0.1f, 128.0f, 10, 1); RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); + + prop = RNA_def_property(srna, "blades", PROP_INT, PROP_NONE); + RNA_def_property_int_sdna(prop, NULL, "num_blades"); + RNA_def_property_ui_text(prop, "Blades", "Blades for dof effect"); + RNA_def_property_range(prop, 0, 16); + RNA_def_property_int_funcs(prop, NULL, "rna_GPUDOFSettings_blades_set", NULL); + RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); + + prop = RNA_def_property(srna, "use_high_quality", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "high_quality", 1); + RNA_def_property_ui_text(prop, "High Quality", "Use high quality depth of field"); + RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); + + prop = RNA_def_property(srna, "is_hq_supported", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_funcs(prop, "rna_gpu_is_hq_supported_get", NULL); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "High Quality", "Use high quality depth of field"); + RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); } static void rna_def_gpu_ssao_fx(BlenderRNA *brna) @@ -3939,7 +4299,8 @@ static void rna_def_gpu_fx(BlenderRNA *brna) prop = RNA_def_property(srna, "use_dof", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "fx_flag", GPU_FX_FLAG_DOF); - RNA_def_property_ui_text(prop, "Depth Of Field", "Use depth of field on viewport using the values from active camera"); + RNA_def_property_ui_text(prop, "Depth Of Field", + "Use depth of field on viewport using the values from active camera"); RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, "rna_GPUFXSettings_fx_update"); @@ -4023,6 +4384,138 @@ static void rna_def_render_layers(BlenderRNA *brna, PropertyRNA *cprop) RNA_def_property_clear_flag(parm, PROP_THICK_WRAP); } +/* Render Views - MultiView */ +static void rna_def_scene_render_view(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + + srna = RNA_def_struct(brna, "SceneRenderView", NULL); + RNA_def_struct_ui_text(srna, "Scene Render View", "Render viewpoint for 3D stereo and multiview rendering"); + RNA_def_struct_ui_icon(srna, ICON_RESTRICT_RENDER_OFF); + RNA_def_struct_path_func(srna, "rna_SceneRenderView_path"); + + prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE); + RNA_def_property_string_funcs(prop, NULL, NULL, "rna_SceneRenderView_name_set"); + RNA_def_property_ui_text(prop, "Name", "Render view name"); + RNA_def_struct_name_property(srna, prop); + RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL); + + prop = RNA_def_property(srna, "file_suffix", PROP_STRING, PROP_NONE); + RNA_def_property_string_sdna(prop, NULL, "suffix"); + RNA_def_property_ui_text(prop, "File Suffix", "Suffix added to the render images for this view"); + RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL); + + prop = RNA_def_property(srna, "camera_suffix", PROP_STRING, PROP_NONE); + RNA_def_property_string_sdna(prop, NULL, "suffix"); + RNA_def_property_ui_text(prop, "Camera Suffix", + "Suffix to identify the cameras to use, and added to the render images for this view"); + RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL); + + prop = RNA_def_property(srna, "use", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_negative_sdna(prop, NULL, "viewflag", SCE_VIEW_DISABLE); + RNA_def_property_ui_text(prop, "Enabled", "Disable or enable the render view"); + RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL); +} + +static void rna_def_render_views(BlenderRNA *brna, PropertyRNA *cprop) +{ + StructRNA *srna; + PropertyRNA *prop; + + FunctionRNA *func; + PropertyRNA *parm; + + RNA_def_property_srna(cprop, "RenderViews"); + srna = RNA_def_struct(brna, "RenderViews", NULL); + RNA_def_struct_sdna(srna, "RenderData"); + RNA_def_struct_ui_text(srna, "Render Views", "Collection of render views"); + + prop = RNA_def_property(srna, "active_index", PROP_INT, PROP_UNSIGNED); + RNA_def_property_int_sdna(prop, NULL, "actview"); + RNA_def_property_int_funcs(prop, "rna_RenderSettings_active_view_index_get", + "rna_RenderSettings_active_view_index_set", + "rna_RenderSettings_active_view_index_range"); + RNA_def_property_ui_text(prop, "Active View Index", "Active index in render view array"); + RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL); + + prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE); + RNA_def_property_struct_type(prop, "SceneRenderView"); + RNA_def_property_pointer_funcs(prop, "rna_RenderSettings_active_view_get", + "rna_RenderSettings_active_view_set", NULL, NULL); + RNA_def_property_flag(prop, PROP_EDITABLE | PROP_NEVER_NULL); + RNA_def_property_ui_text(prop, "Active Render View", "Active Render View"); + RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL); + + func = RNA_def_function(srna, "new", "rna_RenderView_new"); + RNA_def_function_ui_description(func, "Add a render view to scene"); + RNA_def_function_flag(func, FUNC_USE_SELF_ID); + parm = RNA_def_string(func, "name", "RenderView", 0, "", "New name for the marker (not unique)"); + RNA_def_property_flag(parm, PROP_REQUIRED); + parm = RNA_def_pointer(func, "result", "SceneRenderView", "", "Newly created render view"); + RNA_def_function_return(func, parm); + + func = RNA_def_function(srna, "remove", "rna_RenderView_remove"); + RNA_def_function_ui_description(func, "Remove a render view"); + RNA_def_function_flag(func, FUNC_USE_MAIN | FUNC_USE_REPORTS | FUNC_USE_SELF_ID); + parm = RNA_def_pointer(func, "view", "SceneRenderView", "", "Render view to remove"); + RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL | PROP_RNAPTR); + RNA_def_property_clear_flag(parm, PROP_THICK_WRAP); +} + +static void rna_def_image_format_stereo3d_format(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + + static EnumPropertyItem stereo3d_display_items[] = { + {S3D_DISPLAY_ANAGLYPH, "ANAGLYPH", 0, "Anaglyph", + "Render views for left and right eyes as two differently filtered colors in a single image " + "(anaglyph glasses are required)"}, + {S3D_DISPLAY_INTERLACE, "INTERLACE", 0, "Interlace", + "Render views for left and right eyes interlaced in a single image (3D-ready monitor is required)"}, + {S3D_DISPLAY_SIDEBYSIDE, "SIDEBYSIDE", 0, "Side-by-Side", "Render views for left and right eyes side-by-side"}, + {S3D_DISPLAY_TOPBOTTOM, "TOPBOTTOM", 0, "Top-Bottom", "Render views for left and right eyes one above another"}, + {0, NULL, 0, NULL, NULL} + }; + + srna = RNA_def_struct(brna, "Stereo3dFormat", NULL); + RNA_def_struct_sdna(srna, "Stereo3dFormat"); + RNA_def_struct_clear_flag(srna, STRUCT_UNDO); + RNA_def_struct_ui_text(srna, "Stereo Output", "Settings for stereo output"); + + prop = RNA_def_property(srna, "display_mode", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "display_mode"); + RNA_def_property_enum_items(prop, stereo3d_display_items); + RNA_def_property_ui_text(prop, "Stereo Mode", ""); + RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_Stereo3dFormat_update"); + + prop = RNA_def_property(srna, "anaglyph_type", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_items(prop, stereo3d_anaglyph_type_items); + RNA_def_property_ui_text(prop, "Anaglyph Type", ""); + RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_Stereo3dFormat_update"); + + prop = RNA_def_property(srna, "interlace_type", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_items(prop, stereo3d_interlace_type_items); + RNA_def_property_ui_text(prop, "Interlace Type", ""); + RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_Stereo3dFormat_update"); + + prop = RNA_def_property(srna, "use_interlace_swap", PROP_BOOLEAN, PROP_BOOLEAN); + RNA_def_property_boolean_sdna(prop, NULL, "flag", S3D_INTERLACE_SWAP); + RNA_def_property_ui_text(prop, "Swap Left/Right", "Swap left and right stereo channels"); + RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_Stereo3dFormat_update"); + + prop = RNA_def_property(srna, "use_sidebyside_crosseyed", PROP_BOOLEAN, PROP_BOOLEAN); + RNA_def_property_boolean_sdna(prop, NULL, "flag", S3D_SIDEBYSIDE_CROSSEYED); + RNA_def_property_ui_text(prop, "Cross-Eyed", "Right eye should see left image and vice-versa"); + RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_Stereo3dFormat_update"); + + prop = RNA_def_property(srna, "use_squeezed_frame", PROP_BOOLEAN, PROP_BOOLEAN); + RNA_def_property_boolean_sdna(prop, NULL, "flag", S3D_SQUEEZED_FRAME); + RNA_def_property_ui_text(prop, "Squeezed Frame", "Combine both views in a squeezed image"); + RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_Stereo3dFormat_update"); +} + /* use for render output and image save operator, * note: there are some cases where the members act differently when this is * used from a scene, video formats can only be selected for render output @@ -4042,6 +4535,8 @@ static void rna_def_scene_image_format_data(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; + rna_def_image_format_stereo3d_format(brna); + srna = RNA_def_struct(brna, "ImageFormatSettings", NULL); RNA_def_struct_sdna(srna, "ImageFormatData"); RNA_def_struct_nested(brna, srna, "Scene"); @@ -4107,9 +4602,9 @@ static void rna_def_scene_image_format_data(BlenderRNA *brna) prop = RNA_def_property(srna, "exr_codec", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "exr_codec"); RNA_def_property_enum_items(prop, exr_codec_items); + RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_ImageFormatSettings_exr_codec_itemf"); RNA_def_property_ui_text(prop, "Codec", "Codec settings for OpenEXR"); RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL); - #endif #ifdef WITH_OPENJPEG @@ -4161,6 +4656,20 @@ static void rna_def_scene_image_format_data(BlenderRNA *brna) RNA_def_property_ui_text(prop, "G", "Log conversion gamma"); RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL); + /* multiview */ + prop = RNA_def_property(srna, "views_format", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "views_format"); + RNA_def_property_enum_items(prop, views_format_items); + RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_ImageFormatSettings_views_format_itemf"); + RNA_def_property_ui_text(prop, "Views Format", "Format of multiview media"); + RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL); + + prop = RNA_def_property(srna, "stereo_3d_format", PROP_POINTER, PROP_NONE); + RNA_def_property_pointer_sdna(prop, NULL, "stereo3d_format"); + RNA_def_property_flag(prop, PROP_NEVER_NULL); + RNA_def_property_struct_type(prop, "Stereo3dFormat"); + RNA_def_property_ui_text(prop, "Stereo 3D Format", "Settings for stereo 3d"); + /* color management */ prop = RNA_def_property(srna, "view_settings", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "view_settings"); @@ -4563,6 +5072,16 @@ static void rna_def_scene_render_data(BlenderRNA *brna) "resolution to 480 pixels"}, {0, NULL, 0, NULL, NULL}}; + static EnumPropertyItem views_format_items[] = { + {SCE_VIEWS_FORMAT_STEREO_3D, "STEREO_3D", 0, "Stereo 3D", + "Single stereo camera system, adjust the stereo settings in the camera panel"}, + {SCE_VIEWS_FORMAT_MULTIVIEW, "MULTIVIEW", 0, "Multi-View", + "Multi camera system, adjust the cameras individually"}, + {0, NULL, 0, NULL, NULL} + }; + + + rna_def_scene_ffmpeg_settings(brna); #ifdef WITH_QUICKTIME rna_def_scene_quicktime_settings(brna); @@ -5245,6 +5764,32 @@ static void rna_def_scene_render_data(BlenderRNA *brna) RNA_def_property_ui_icon(prop, ICON_UNPINNED, 1); RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL); + /* views (stereoscopy et al) */ + prop = RNA_def_property(srna, "views", PROP_COLLECTION, PROP_NONE); + RNA_def_property_struct_type(prop, "SceneRenderView"); + RNA_def_property_ui_text(prop, "Render Views", ""); + rna_def_render_views(brna, prop); + + prop = RNA_def_property(srna, "stereo_views", PROP_COLLECTION, PROP_NONE); + RNA_def_property_collection_sdna(prop, NULL, "views", NULL); + RNA_def_property_collection_funcs(prop, "rna_RenderSettings_stereoViews_begin", "rna_iterator_listbase_next", + "rna_iterator_listbase_end", "rna_iterator_listbase_get", + NULL, NULL, NULL, NULL); + RNA_def_property_struct_type(prop, "SceneRenderView"); + RNA_def_property_ui_text(prop, "Render Views", ""); + + prop = RNA_def_property(srna, "use_multiview", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "scemode", R_MULTIVIEW); + RNA_def_property_ui_text(prop, "Multiple Views", "Use multiple views in the scene"); + RNA_def_property_update(prop, NC_WINDOW, NULL); + + prop = RNA_def_property(srna, "views_format", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_items(prop, views_format_items); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); + RNA_def_property_ui_text(prop, "Setup Stereo Mode", ""); + RNA_def_property_enum_funcs(prop, NULL, "rna_RenderSettings_views_format_set", NULL); + RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); + /* engine */ prop = RNA_def_property(srna, "engine", PROP_ENUM, PROP_NONE); RNA_def_property_enum_items(prop, engine_items); @@ -5286,6 +5831,17 @@ static void rna_def_scene_render_data(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Simplify Child Particles", "Global child particles percentage"); RNA_def_property_update(prop, 0, "rna_Scene_simplify_update"); + prop = RNA_def_property(srna, "simplify_subdivision_render", PROP_INT, PROP_UNSIGNED); + RNA_def_property_int_sdna(prop, NULL, "simplify_subsurf_render"); + RNA_def_property_ui_range(prop, 0, 6, 1, -1); + RNA_def_property_ui_text(prop, "Simplify Subdivision", "Global maximum subdivision level during rendering"); + RNA_def_property_update(prop, 0, "rna_Scene_simplify_update"); + + prop = RNA_def_property(srna, "simplify_child_particles_render", PROP_FLOAT, PROP_FACTOR); + RNA_def_property_float_sdna(prop, NULL, "simplify_particles_render"); + RNA_def_property_ui_text(prop, "Simplify Child Particles", "Global child particles percentage during rendering"); + RNA_def_property_update(prop, 0, "rna_Scene_simplify_update"); + prop = RNA_def_property(srna, "simplify_shadow_samples", PROP_INT, PROP_UNSIGNED); RNA_def_property_int_sdna(prop, NULL, "simplify_shadowsamples"); RNA_def_property_ui_range(prop, 1, 16, 1, -1); @@ -5979,6 +6535,11 @@ void RNA_def_scene(BlenderRNA *brna) RNA_def_property_struct_type(prop, "ColorManagedSequencerColorspaceSettings"); RNA_def_property_ui_text(prop, "Sequencer Color Space Settings", "Settings of color space sequencer is working in"); + /* Dependency Graph */ + prop = RNA_def_property(srna, "depsgraph", PROP_POINTER, PROP_NONE); + RNA_def_property_struct_type(prop, "Depsgraph"); + RNA_def_property_ui_text(prop, "Dependency Graph", "Dependencies in the scene data"); + /* Nestled Data */ /* *** Non-Animated *** */ RNA_define_animate_sdna(false); @@ -5995,8 +6556,8 @@ void RNA_def_scene(BlenderRNA *brna) /* *** Animated *** */ rna_def_scene_render_data(brna); rna_def_scene_render_layer(brna); - rna_def_gpu_fx(brna); + rna_def_scene_render_view(brna); /* Scene API */ RNA_api_scene(srna); diff --git a/source/blender/makesrna/intern/rna_scene_api.c b/source/blender/makesrna/intern/rna_scene_api.c index 36657c8a898..9d63dfe0f55 100644 --- a/source/blender/makesrna/intern/rna_scene_api.c +++ b/source/blender/makesrna/intern/rna_scene_api.c @@ -119,15 +119,21 @@ static void rna_Scene_update_tagged(Scene *scene) #endif } -static void rna_SceneRender_get_frame_path(RenderData *rd, int frame, char *name) +static void rna_SceneRender_get_frame_path(RenderData *rd, int frame, int preview, const char *view, char *name) { + const char *suffix = BKE_scene_multiview_view_suffix_get(rd, view); + + /* avoid NULL pointer */ + if (!suffix) + suffix = ""; + if (BKE_imtype_is_movie(rd->im_format.imtype)) { - BKE_movie_filepath_get(name, rd); + BKE_movie_filepath_get(name, rd, preview != 0, suffix); } else { BKE_image_path_from_imformat( name, rd->pic, G.main->name, (frame == INT_MIN) ? rd->cfra : frame, - &rd->im_format, (rd->scemode & R_EXTENSION) != 0, true); + &rd->im_format, (rd->scemode & R_EXTENSION) != 0, true, suffix); } } @@ -287,6 +293,10 @@ void RNA_api_scene_render(StructRNA *srna) RNA_def_function_ui_description(func, "Return the absolute path to the filename to be written for a given frame"); RNA_def_int(func, "frame", INT_MIN, INT_MIN, INT_MAX, "", "Frame number to use, if unset the current frame will be used", MINAFRAME, MAXFRAME); + parm = RNA_def_boolean(func, "preview", 0, "Preview", "Use preview range"); + parm = RNA_def_string_file_path(func, "view", NULL, FILE_MAX, "View", + "The name of the view to use to replace the \"%\" chars"); + parm = RNA_def_string_file_path(func, "filepath", NULL, FILE_MAX, "File Path", "The resulting filepath from the scenes render settings"); RNA_def_property_flag(parm, PROP_THICK_WRAP); /* needed for string return value */ diff --git a/source/blender/makesrna/intern/rna_sculpt_paint.c b/source/blender/makesrna/intern/rna_sculpt_paint.c index fd27381c0d6..acde663a799 100644 --- a/source/blender/makesrna/intern/rna_sculpt_paint.c +++ b/source/blender/makesrna/intern/rna_sculpt_paint.c @@ -77,6 +77,8 @@ EnumPropertyItem symmetrize_direction_items[] = { #include "BKE_context.h" #include "BKE_DerivedMesh.h" +#include "BKE_editstrands.h" +#include "BKE_effect.h" #include "BKE_pointcache.h" #include "BKE_particle.h" #include "BKE_depsgraph.h" @@ -221,6 +223,8 @@ static int rna_Brush_mode_poll(PointerRNA *ptr, PointerRNA value) mode = OB_MODE_VERTEX_PAINT; else if (ptr->data == ts->wpaint) mode = OB_MODE_WEIGHT_PAINT; + else if (ptr->data == &ts->hair_edit) + mode = OB_MODE_HAIR_EDIT; return brush->ob_mode & mode; } @@ -359,51 +363,32 @@ static int rna_ImaPaint_detect_data(ImagePaintSettings *imapaint) { return imapaint->missing_data == 0; } -#else -static void rna_def_palettecolor(BlenderRNA *brna) -{ - StructRNA *srna; - PropertyRNA *prop; +/* ==== Hair Edit ==== */ - srna = RNA_def_struct(brna, "PaletteColor", NULL); - RNA_def_struct_ui_text(srna, "Palette Color", ""); - - prop = RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR_GAMMA); - RNA_def_property_range(prop, 0.0, 1.0); - RNA_def_property_float_sdna(prop, NULL, "rgb"); - RNA_def_property_ui_text(prop, "Color", ""); - RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); - - prop = RNA_def_property(srna, "strength", PROP_FLOAT, PROP_NONE); - RNA_def_property_range(prop, 0.0, 1.0); - RNA_def_property_float_sdna(prop, NULL, "value"); - RNA_def_property_ui_text(prop, "Value", ""); - RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); - - prop = RNA_def_property(srna, "weight", PROP_FLOAT, PROP_NONE); - RNA_def_property_range(prop, 0.0, 1.0); - RNA_def_property_float_sdna(prop, NULL, "value"); - RNA_def_property_ui_text(prop, "Weight", ""); - RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); +static char *rna_HairEdit_path(PointerRNA *UNUSED(ptr)) +{ + return BLI_strdup("tool_settings.hair_edit"); } - -static void rna_def_palette(BlenderRNA *brna) +static void rna_HairEdit_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *UNUSED(ptr)) { - StructRNA *srna; - PropertyRNA *prop; + Object *ob = OBACT; - srna = RNA_def_struct(brna, "Palette", "ID"); - RNA_def_struct_ui_text(srna, "Palette", ""); - RNA_def_struct_ui_icon(srna, ICON_COLOR); + if (ob) + DAG_id_tag_update(&ob->id, OB_RECALC_DATA); +} - prop = RNA_def_property(srna, "colors", PROP_COLLECTION, PROP_NONE); - RNA_def_property_struct_type(prop, "PaletteColor"); - RNA_def_property_ui_text(prop, "Palette Color", "Colors that are part of this palette"); - RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); +static void rna_HairEdit_brush_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) +{ + HairEditSettings *settings = ptr->data; + Brush *brush = settings->brush; + BKE_paint_invalidate_overlay_all(); + WM_main_add_notifier(NC_BRUSH | NA_EDITED, brush); } +#else + static void rna_def_paint_curve(BlenderRNA *brna) { StructRNA *srna; @@ -505,6 +490,8 @@ static void rna_def_sculpt(BlenderRNA *brna) "Relative Detail", "Mesh detail is relative to the brush size and detail size"}, {SCULPT_DYNTOPO_DETAIL_CONSTANT, "CONSTANT", 0, "Constant Detail", "Mesh detail is constant in object space according to detail size"}, + {SCULPT_DYNTOPO_DETAIL_BRUSH, "BRUSH", 0, + "Brush Detail", "Mesh detail is relative to brush radius"}, {0, NULL, 0, NULL, NULL} }; @@ -562,6 +549,11 @@ static void rna_def_sculpt(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Detail Size", "Maximum edge length for dynamic topology sculpting (in pixels)"); RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); + prop = RNA_def_property(srna, "detail_percent", PROP_FLOAT, PROP_PERCENTAGE); + RNA_def_property_ui_range(prop, 0.5, 100.0, 10, 2); + RNA_def_property_ui_text(prop, "Detail Percentage", "Maximum edge length for dynamic topology sculpting (in brush percenage)"); + RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); + prop = RNA_def_property(srna, "constant_detail", PROP_FLOAT, PROP_PERCENTAGE); RNA_def_property_range(prop, 0.001, 10000.0); RNA_def_property_ui_range(prop, 0.1, 100.0, 10, 2); @@ -907,6 +899,7 @@ static void rna_def_particle_edit(BlenderRNA *brna) prop = RNA_def_property(srna, "shape_object", PROP_POINTER, PROP_NONE); RNA_def_property_flag(prop, PROP_EDITABLE); RNA_def_property_ui_text(prop, "Shape Object", "Outer shape to use for tools"); + RNA_def_property_pointer_funcs(prop, NULL, NULL, NULL, "rna_Mesh_object_poll"); RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_ParticleEdit_redo"); /* brush */ @@ -918,7 +911,7 @@ static void rna_def_particle_edit(BlenderRNA *brna) prop = RNA_def_property(srna, "size", PROP_INT, PROP_PIXEL); RNA_def_property_range(prop, 1, SHRT_MAX); - RNA_def_property_ui_range(prop, 1, 100, 10, 3); + RNA_def_property_ui_range(prop, 1, MAX_BRUSH_PIXEL_RADIUS, 10, 3); RNA_def_property_ui_text(prop, "Radius", "Radius of the brush in pixels"); prop = RNA_def_property(srna, "strength", PROP_FLOAT, PROP_FACTOR); @@ -962,12 +955,45 @@ static void rna_def_particle_edit(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Curve", ""); } +static void rna_def_hair_edit(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + + static EnumPropertyItem select_mode_items[] = { + {HAIR_SELECT_STRAND, "STRAND", ICON_PARTICLE_PATH, "Strand", "Strand edit mode"}, + {HAIR_SELECT_VERTEX, "VERTEX", ICON_PARTICLE_POINT, "Vertex", "Vertex select mode"}, + {HAIR_SELECT_TIP, "TIP", ICON_PARTICLE_TIP, "Tip", "Tip select mode"}, + {0, NULL, 0, NULL, NULL} + }; + + srna = RNA_def_struct(brna, "HairEdit", NULL); + RNA_def_struct_sdna(srna, "HairEditSettings"); + RNA_def_struct_path_func(srna, "rna_HairEdit_path"); + RNA_def_struct_ui_text(srna, "Hair Edit", "Settings for hair editing mode"); + + prop = RNA_def_property(srna, "brush", PROP_POINTER, PROP_NONE); + RNA_def_property_flag(prop, PROP_EDITABLE); + RNA_def_property_pointer_funcs(prop, NULL, NULL, NULL, "rna_Brush_mode_poll"); + RNA_def_property_ui_text(prop, "Brush", "Active Brush"); + RNA_def_property_update(prop, 0, "rna_HairEdit_brush_update"); + + prop = RNA_def_property(srna, "select_mode", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_bitflag_sdna(prop, NULL, "select_mode"); + RNA_def_property_enum_items(prop, select_mode_items); + RNA_def_property_ui_text(prop, "Selection Mode", "Hair selection mode"); + RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_HairEdit_update"); + + prop = RNA_def_property(srna, "shape_object", PROP_POINTER, PROP_NONE); + RNA_def_property_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Shape Object", "Outer shape to use for tools"); + RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_HairEdit_update"); +} + void RNA_def_sculpt_paint(BlenderRNA *brna) { /* *** Non-Animated *** */ RNA_define_animate_sdna(false); - rna_def_palettecolor(brna); - rna_def_palette(brna); rna_def_paint_curve(brna); rna_def_paint(brna); rna_def_sculpt(brna); @@ -975,6 +1001,7 @@ void RNA_def_sculpt_paint(BlenderRNA *brna) rna_def_vertex_paint(brna); rna_def_image_paint(brna); rna_def_particle_edit(brna); + rna_def_hair_edit(brna); RNA_define_animate_sdna(true); } diff --git a/source/blender/makesrna/intern/rna_sensor.c b/source/blender/makesrna/intern/rna_sensor.c index 5d7bb6d2d94..cbc02858f78 100644 --- a/source/blender/makesrna/intern/rna_sensor.c +++ b/source/blender/makesrna/intern/rna_sensor.c @@ -325,9 +325,11 @@ static void rna_def_sensor(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Pulse False Level", "Activate FALSE level triggering (pulse mode)"); RNA_def_property_update(prop, NC_LOGIC, NULL); - prop = RNA_def_property(srna, "frequency", PROP_INT, PROP_NONE); + prop = RNA_def_property(srna, "tick_skip", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "freq"); - RNA_def_property_ui_text(prop, "Frequency", "Delay between repeated pulses(in logic tics, 0=no delay)"); + RNA_def_property_ui_text(prop, "Skip", + "Number of logic ticks skipped between 2 active pulses " + "(0 = pulse every logic tick, 1 = skip 1 logic tick between pulses, etc.)"); RNA_def_property_range(prop, 0, 10000); RNA_def_property_update(prop, NC_LOGIC, NULL); @@ -402,8 +404,8 @@ static void rna_def_mouse_sensor(BlenderRNA *brna) }; static const EnumPropertyItem prop_mouse_type_items[] = { - {SENS_COLLISION_PROPERTY, "PROPERTY", ICON_LOGIC, "Property", "Use a material for ray intersections"}, - {SENS_COLLISION_MATERIAL, "MATERIAL", ICON_MATERIAL_DATA, "Material", "Use a property for ray intersections"}, + {SENS_COLLISION_PROPERTY, "PROPERTY", ICON_LOGIC, "Property", "Use a property for ray intersections"}, + {SENS_COLLISION_MATERIAL, "MATERIAL", ICON_MATERIAL_DATA, "Material", "Use a material for ray intersections"}, {0, NULL, 0, NULL, NULL} }; @@ -736,8 +738,8 @@ static void rna_def_ray_sensor(BlenderRNA *brna) }; static const EnumPropertyItem prop_ray_type_items[] = { - {SENS_COLLISION_PROPERTY, "PROPERTY", ICON_LOGIC, "Property", "Use a material for ray intersections"}, - {SENS_COLLISION_MATERIAL, "MATERIAL", ICON_MATERIAL_DATA, "Material", "Use a property for ray intersections"}, + {SENS_COLLISION_PROPERTY, "PROPERTY", ICON_LOGIC, "Property", "Use a property for ray intersections"}, + {SENS_COLLISION_MATERIAL, "MATERIAL", ICON_MATERIAL_DATA, "Material", "Use a material for ray intersections"}, {0, NULL, 0, NULL, NULL} }; diff --git a/source/blender/makesrna/intern/rna_sequencer.c b/source/blender/makesrna/intern/rna_sequencer.c index e9ba9b45ccf..b0d9c22887f 100644 --- a/source/blender/makesrna/intern/rna_sequencer.c +++ b/source/blender/makesrna/intern/rna_sequencer.c @@ -72,6 +72,7 @@ EnumPropertyItem sequence_modifier_type_items[] = { #ifdef RNA_RUNTIME #include "BKE_report.h" +#include "BKE_idprop.h" #include "WM_api.h" #include "WM_types.h" @@ -134,6 +135,14 @@ static void rna_SequenceEditor_sequences_all_begin(CollectionPropertyIterator *i rna_iterator_listbase_begin(iter, &ed->seqbase, NULL); } +static void rna_SequenceEditor_update_cache(Main *UNUSED(bmain), Scene *scene, PointerRNA *UNUSED(ptr)) +{ + Editing *ed = scene->ed; + + BKE_sequencer_free_imbuf(scene, &ed->seqbase, false); +} + + static void rna_SequenceEditor_sequences_all_next(CollectionPropertyIterator *iter) { ListBaseIterator *internal = &iter->internal.listbase; @@ -177,6 +186,11 @@ static void rna_SequenceEditor_elements_begin(CollectionPropertyIterator *iter, rna_SequenceEditor_elements_length(ptr), 0, NULL); } +static void rna_Sequence_views_format_update(Main *bmain, Scene *scene, PointerRNA *ptr) +{ + rna_Sequence_update(bmain, scene, ptr); +} + static void do_sequence_frame_change_update(Scene *scene, Sequence *seq) { Editing *ed = BKE_sequencer_editing_get(scene, false); @@ -476,7 +490,7 @@ static void rna_Sequence_name_set(PointerRNA *ptr, const char *value) /* fix all the animation data which may link to this */ /* don't rename everywhere because these are per scene */ - /* BKE_all_animdata_fix_paths_rename(NULL, "sequence_editor.sequences_all", oldname, seq->name + 2); */ + /* BKE_animdata_fix_paths_rename_all(NULL, "sequence_editor.sequences_all", oldname, seq->name + 2); */ adt = BKE_animdata_from_id(&scene->id); if (adt) BKE_animdata_fix_paths_rename(&scene->id, adt, NULL, "sequence_editor.sequences_all", oldname, seq->name + 2, 0, 0, 1); @@ -556,6 +570,18 @@ static char *rna_Sequence_path(PointerRNA *ptr) } } +static IDProperty *rna_Sequence_idprops(PointerRNA *ptr, bool create) +{ + Sequence *seq = ptr->data; + + if (create && !seq->prop) { + IDPropertyTemplate val = {0}; + seq->prop = IDP_New(IDP_GROUP, &val, "Sequence ID properties"); + } + + return seq->prop; +} + static PointerRNA rna_SequenceEditor_meta_stack_get(CollectionPropertyIterator *iter) { ListBaseIterator *internal = &iter->internal.listbase; @@ -577,8 +603,8 @@ static void rna_Sequence_filepath_set(PointerRNA *ptr, const char *value) PointerRNA id_ptr; RNA_id_pointer_create((ID *)seq->sound, &id_ptr); RNA_string_set(&id_ptr, "filepath", value); - sound_load(G.main, seq->sound); - sound_update_scene_sound(seq->scene_sound, seq->sound); + BKE_sound_load(G.main, seq->sound); + BKE_sound_update_scene_sound(seq->scene_sound, seq->sound); } BLI_split_dirfile(value, seq->strip->dir, seq->strip->stripdata->name, sizeof(seq->strip->dir), @@ -633,7 +659,7 @@ static void rna_Sequence_volume_set(PointerRNA *ptr, float value) seq->volume = value; if (seq->scene_sound) - sound_set_scene_sound_volume(seq->scene_sound, value, (seq->flag & SEQ_AUDIO_VOLUME_ANIMATED) != 0); + BKE_sound_set_scene_sound_volume(seq->scene_sound, value, (seq->flag & SEQ_AUDIO_VOLUME_ANIMATED) != 0); } static void rna_Sequence_pitch_set(PointerRNA *ptr, float value) @@ -642,7 +668,7 @@ static void rna_Sequence_pitch_set(PointerRNA *ptr, float value) seq->pitch = value; if (seq->scene_sound) - sound_set_scene_sound_pitch(seq->scene_sound, value, (seq->flag & SEQ_AUDIO_PITCH_ANIMATED) != 0); + BKE_sound_set_scene_sound_pitch(seq->scene_sound, value, (seq->flag & SEQ_AUDIO_PITCH_ANIMATED) != 0); } static void rna_Sequence_pan_set(PointerRNA *ptr, float value) @@ -651,7 +677,7 @@ static void rna_Sequence_pan_set(PointerRNA *ptr, float value) seq->pan = value; if (seq->scene_sound) - sound_set_scene_sound_pan(seq->scene_sound, value, (seq->flag & SEQ_AUDIO_PAN_ANIMATED) != 0); + BKE_sound_set_scene_sound_pan(seq->scene_sound, value, (seq->flag & SEQ_AUDIO_PAN_ANIMATED) != 0); } @@ -783,7 +809,7 @@ static int colbalance_seq_cmp_cb(Sequence *seq, void *arg_pt) return 1; } -static Sequence *sequence_get_by_colorbalance(Editing *ed, StripColorBalance *cb, SequenceModifierData **smd_r) +static Sequence *sequence_get_by_colorbalance(Editing *ed, StripColorBalance *cb, SequenceModifierData **r_smd) { SequenceSearchData data; @@ -794,7 +820,7 @@ static Sequence *sequence_get_by_colorbalance(Editing *ed, StripColorBalance *cb /* irritating we need to search for our sequence! */ BKE_sequencer_base_recursive_apply(&ed->seqbase, colbalance_seq_cmp_cb, &data); - *smd_r = data.smd; + *r_smd = data.smd; return data.seq; } @@ -1222,6 +1248,15 @@ static void rna_def_strip_proxy(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Timecode", ""); RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_tcindex_update"); + prop = RNA_def_property(srna, "use_proxy_custom_directory", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "storage", SEQ_STORAGE_PROXY_CUSTOM_DIR); + RNA_def_property_ui_text(prop, "Proxy Custom Directory", "Use a custom directory to store data"); + RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update"); + + prop = RNA_def_property(srna, "use_proxy_custom_file", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "storage", SEQ_STORAGE_PROXY_CUSTOM_FILE); + RNA_def_property_ui_text(prop, "Proxy Custom File", "Use a custom file to read proxy data from"); + RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update"); } static void rna_def_color_balance(BlenderRNA *brna) @@ -1380,6 +1415,7 @@ static void rna_def_sequence(BlenderRNA *brna) RNA_def_struct_ui_text(srna, "Sequence", "Sequence strip in the sequence editor"); RNA_def_struct_refine_func(srna, "rna_Sequence_refine"); RNA_def_struct_path_func(srna, "rna_Sequence_path"); + RNA_def_struct_idprops_func(srna, "rna_Sequence_idprops"); prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE); RNA_def_property_string_funcs(prop, "rna_Sequence_name_get", "rna_Sequence_name_length", "rna_Sequence_name_set"); @@ -1559,7 +1595,12 @@ static void rna_def_editor(BlenderRNA *brna) { StructRNA *srna; PropertyRNA *prop; - + + static const EnumPropertyItem editing_storage_items[] = { + {0, "PER_STRIP", 0, "Per Strip", "Store proxies using per strip settings"}, + {SEQ_EDIT_PROXY_DIR_STORAGE, "PROJECT", 0, "Project", "Store proxies using project directory"}, + {0, NULL, 0, NULL, NULL} + }; srna = RNA_def_struct(brna, "SequenceEditor", NULL); RNA_def_struct_ui_text(srna, "Sequence Editor", "Sequence editing data for a Scene datablock"); RNA_def_struct_ui_icon(srna, ICON_SEQUENCE); @@ -1607,6 +1648,16 @@ static void rna_def_editor(BlenderRNA *brna) RNA_def_property_int_funcs(prop, "rna_SequenceEditor_overlay_frame_get", "rna_SequenceEditor_overlay_frame_set", NULL); RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SEQUENCER, NULL); + + prop = RNA_def_property(srna, "proxy_storage", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_items(prop, editing_storage_items); + RNA_def_property_ui_text(prop, "Proxy Storage", "How to store proxies for this project"); + RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SEQUENCER, "rna_SequenceEditor_update_cache"); + + prop = RNA_def_property(srna, "proxy_dir", PROP_STRING, PROP_DIRPATH); + RNA_def_property_string_sdna(prop, NULL, "proxy_dir"); + RNA_def_property_ui_text(prop, "Proxy Directory", ""); + RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SEQUENCER, "rna_SequenceEditor_update_cache"); } static void rna_def_filter_video(StructRNA *srna) @@ -1702,16 +1753,6 @@ static void rna_def_proxy(StructRNA *srna) prop = RNA_def_property(srna, "proxy", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "strip->proxy"); RNA_def_property_ui_text(prop, "Proxy", ""); - - prop = RNA_def_property(srna, "use_proxy_custom_directory", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_USE_PROXY_CUSTOM_DIR); - RNA_def_property_ui_text(prop, "Proxy Custom Directory", "Use a custom directory to store data"); - RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update"); - - prop = RNA_def_property(srna, "use_proxy_custom_file", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_USE_PROXY_CUSTOM_FILE); - RNA_def_property_ui_text(prop, "Proxy Custom File", "Use a custom file to read proxy data from"); - RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update"); } static void rna_def_input(StructRNA *srna) @@ -1798,6 +1839,24 @@ static void rna_def_image(BlenderRNA *brna) "rna_SequenceEditor_elements_length", NULL, NULL, NULL); RNA_api_sequence_elements(brna, prop); + /* multiview */ + prop = RNA_def_property(srna, "use_multiview", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_USE_VIEWS); + RNA_def_property_ui_text(prop, "Use Multi-View", "Use Multiple Views (when available)"); + RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_views_format_update"); + + prop = RNA_def_property(srna, "views_format", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "views_format"); + RNA_def_property_enum_items(prop, views_format_items); + RNA_def_property_ui_text(prop, "Views Format", "Mode to load image views"); + RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_Sequence_views_format_update"); + + prop = RNA_def_property(srna, "stereo_3d_format", PROP_POINTER, PROP_NONE); + RNA_def_property_pointer_sdna(prop, NULL, "stereo3d_format"); + RNA_def_property_flag(prop, PROP_NEVER_NULL); + RNA_def_property_struct_type(prop, "Stereo3dFormat"); + RNA_def_property_ui_text(prop, "Stereo 3D Format", "Settings for stereo 3d"); + rna_def_filter_video(srna); rna_def_proxy(srna); rna_def_input(srna); @@ -1894,6 +1953,24 @@ static void rna_def_movie(BlenderRNA *brna) "rna_Sequence_filepath_set"); RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_filepath_update"); + /* multiview */ + prop = RNA_def_property(srna, "use_multiview", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_USE_VIEWS); + RNA_def_property_ui_text(prop, "Use Multi-View", "Use Multiple Views (when available)"); + RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_views_format_update"); + + prop = RNA_def_property(srna, "views_format", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "views_format"); + RNA_def_property_enum_items(prop, views_format_items); + RNA_def_property_ui_text(prop, "Views Format", "Mode to load movie views"); + RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_Sequence_views_format_update"); + + prop = RNA_def_property(srna, "stereo_3d_format", PROP_POINTER, PROP_NONE); + RNA_def_property_pointer_sdna(prop, NULL, "stereo3d_format"); + RNA_def_property_flag(prop, PROP_NEVER_NULL); + RNA_def_property_struct_type(prop, "Stereo3dFormat"); + RNA_def_property_ui_text(prop, "Stereo 3D Format", "Settings for stereo 3d"); + rna_def_filter_video(srna); rna_def_proxy(srna); rna_def_input(srna); diff --git a/source/blender/makesrna/intern/rna_sequencer_api.c b/source/blender/makesrna/intern/rna_sequencer_api.c index 351a15c0171..44169fa641e 100644 --- a/source/blender/makesrna/intern/rna_sequencer_api.c +++ b/source/blender/makesrna/intern/rna_sequencer_api.c @@ -158,7 +158,7 @@ static Sequence *rna_Sequences_new_scene(ID *id, Editing *ed, seq = alloc_generic_sequence(ed, name, frame_start, channel, SEQ_TYPE_SCENE, NULL); seq->scene = sce_seq; seq->len = sce_seq->r.efra - sce_seq->r.sfra + 1; - seq->scene_sound = sound_scene_add_scene_sound(scene, seq, frame_start, frame_start + seq->len, 0); + seq->scene_sound = BKE_sound_scene_add_scene_sound(scene, seq, frame_start, frame_start + seq->len, 0); id_us_plus((ID *)sce_seq); BKE_sequence_calc_disp(scene, seq); @@ -198,6 +198,7 @@ static Sequence *rna_Sequences_new_movie(ID *id, Editing *ed, ReportList *report { Scene *scene = (Scene *)id; Sequence *seq; + StripAnim *sanim; struct anim *an = openanim(file, IB_rect, 0, NULL); @@ -207,7 +208,11 @@ static Sequence *rna_Sequences_new_movie(ID *id, Editing *ed, ReportList *report } seq = alloc_generic_sequence(ed, name, frame_start, channel, SEQ_TYPE_MOVIE, file); - seq->anim = an; + + sanim = MEM_mallocN(sizeof(StripAnim), "Strip Anim"); + BLI_addtail(&seq->anims, sanim); + sanim->anim = an; + seq->anim_preseek = IMB_anim_get_preseek(an); seq->len = IMB_anim_get_duration(an, IMB_TC_RECORD_RUN); @@ -225,18 +230,19 @@ static Sequence *rna_Sequences_new_sound(ID *id, Editing *ed, Main *bmain, Repor Scene *scene = (Scene *)id; Sequence *seq; - bSound *sound = sound_new_file(bmain, file); + bSound *sound = BKE_sound_new_file(bmain, file); - if (sound == NULL || sound->playback_handle == NULL) { + if (sound->playback_handle == NULL) { + BKE_libblock_free(bmain, sound); BKE_report(reports, RPT_ERROR, "Sequences.new_sound: unable to open sound file"); return NULL; } seq = alloc_generic_sequence(ed, name, frame_start, channel, SEQ_TYPE_SOUND_RAM, sound->name); seq->sound = sound; - seq->len = ceil((double)sound_get_length(sound) * FPS); + seq->len = ceil((double)BKE_sound_get_length(sound) * FPS); - seq->scene_sound = sound_add_scene_sound(scene, seq, frame_start, frame_start + seq->len, 0); + seq->scene_sound = BKE_sound_add_scene_sound(scene, seq, frame_start, frame_start + seq->len, 0); BKE_sequence_calc_disp(scene, seq); diff --git a/source/blender/makesrna/intern/rna_smoke.c b/source/blender/makesrna/intern/rna_smoke.c index 55262a98b2e..420aede872d 100644 --- a/source/blender/makesrna/intern/rna_smoke.c +++ b/source/blender/makesrna/intern/rna_smoke.c @@ -414,6 +414,14 @@ static void rna_def_smoke_domain_settings(BlenderRNA *brna) RNA_def_property_enum_items(prop, smoke_cache_comp_items); RNA_def_property_ui_text(prop, "Cache Compression", "Compression method to be used"); + prop = RNA_def_property(srna, "point_cache_offset", PROP_INT, PROP_NONE); + RNA_def_property_int_sdna(prop, NULL, "point_cache_offset"); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); + RNA_def_property_range(prop, -10000, 10000); + RNA_def_property_ui_range(prop, -10000, 10000, 1, -1); + RNA_def_property_ui_text(prop, "Point Cache Offset", "Offset to add to cached frames"); + RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_update"); + prop = RNA_def_property(srna, "collision_extents", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "border_collisions"); RNA_def_property_enum_items(prop, smoke_domain_colli_items); @@ -544,6 +552,14 @@ static void rna_def_smoke_domain_settings(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Threshold", "Maximum amount of fluid cell can contain before it is considered empty"); RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_resetCache"); + + /* display */ + prop = RNA_def_property(srna, "display_thickness", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "display_thickness"); + RNA_def_property_range(prop, 0.001f, 1000.0f); + RNA_def_property_ui_range(prop, 0.1f, 10.0f, 0.1, 3); + RNA_def_property_ui_text(prop, "Thickness", "Thickness of smoke drawing in the viewport"); + RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, NULL); } static void rna_def_smoke_flow_settings(BlenderRNA *brna) @@ -675,6 +691,11 @@ static void rna_def_smoke_flow_settings(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Set Size", "Set particle size in simulation cells or use nearest cell"); RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset"); + prop = RNA_def_property(srna, "use_particle_texture_color", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_SMOKE_FLOW_USE_PART_TEXCOLOR); + RNA_def_property_ui_text(prop, "Set Texture Color", "Set particle texture color in simulation cells"); + RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset"); + prop = RNA_def_property(srna, "subframes", PROP_INT, PROP_NONE); RNA_def_property_range(prop, 0, 50); RNA_def_property_ui_range(prop, 0, 10, 1, -1); diff --git a/source/blender/makesrna/intern/rna_sound.c b/source/blender/makesrna/intern/rna_sound.c index 4b745c60b5b..25b3475c423 100644 --- a/source/blender/makesrna/intern/rna_sound.c +++ b/source/blender/makesrna/intern/rna_sound.c @@ -42,7 +42,7 @@ static void rna_Sound_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr) { - sound_load(bmain, (bSound *)ptr->data); + BKE_sound_load(bmain, (bSound *)ptr->data); } static int rna_Sound_caching_get(PointerRNA *ptr) @@ -55,9 +55,9 @@ static void rna_Sound_caching_set(PointerRNA *ptr, const int value) { bSound *sound = (bSound *)(ptr->data); if (value) - sound_cache(sound); + BKE_sound_cache(sound); else - sound_delete_cache(sound); + BKE_sound_delete_cache(sound); } static void rna_Sound_caching_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *ptr) diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index d7ea3d9ca48..f97cc1eadd9 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -31,6 +31,7 @@ #include "BLF_translation.h" +#include "BKE_image.h" #include "BKE_key.h" #include "BKE_movieclip.h" #include "BKE_node.h" @@ -90,6 +91,41 @@ EnumPropertyItem space_type_items[] = { {0, NULL, 0, NULL, NULL} }; +#define V3D_S3D_CAMERA_LEFT {STEREO_LEFT_ID, "LEFT", ICON_RESTRICT_RENDER_OFF, "Left", ""}, +#define V3D_S3D_CAMERA_RIGHT {STEREO_RIGHT_ID, "RIGHT", ICON_RESTRICT_RENDER_OFF, "Right", ""}, +#define V3D_S3D_CAMERA_S3D {STEREO_3D_ID, "S3D", ICON_CAMERA_STEREO, "3D", ""}, +#ifdef RNA_RUNTIME +#define V3D_S3D_CAMERA_VIEWS {STEREO_MONO_ID, "MONO", ICON_RESTRICT_RENDER_OFF, "Views", ""}, +#endif + +static EnumPropertyItem stereo3d_camera_items[] = { + V3D_S3D_CAMERA_LEFT + V3D_S3D_CAMERA_RIGHT + V3D_S3D_CAMERA_S3D + {0, NULL, 0, NULL, NULL} +}; + +#ifdef RNA_RUNTIME +static EnumPropertyItem multiview_camera_items[] = { + V3D_S3D_CAMERA_VIEWS + V3D_S3D_CAMERA_S3D + {0, NULL, 0, NULL, NULL} +}; +#endif + +#undef V3D_S3D_CAMERA_LEFT +#undef V3D_S3D_CAMERA_RIGHT +#undef V3D_S3D_CAMERA_S3D +#undef V3D_S3D_CAMERA_VIEWS + +#ifndef RNA_RUNTIME +static EnumPropertyItem stereo3d_eye_items[] = { + {STEREO_LEFT_ID, "LEFT_EYE", ICON_NONE, "Left Eye"}, + {STEREO_RIGHT_ID, "RIGHT_EYE", ICON_NONE, "Right Eye"}, + {0, NULL, 0, NULL, NULL} +}; +#endif + static EnumPropertyItem pivot_items_full[] = { {V3D_CENTER, "BOUNDING_BOX_CENTER", ICON_ROTATE, "Bounding Box Center", "Pivot around bounding box center of selected object(s)"}, @@ -201,6 +237,7 @@ static EnumPropertyItem buttons_texture_context_items[] = { #include "BKE_colortools.h" #include "BKE_context.h" #include "BKE_depsgraph.h" +#include "BKE_nla.h" #include "BKE_paint.h" #include "BKE_scene.h" #include "BKE_screen.h" @@ -413,8 +450,8 @@ static void rna_SpaceView3D_lock_camera_and_layers_set(PointerRNA *ptr, int valu /* seek for layact */ bit = 0; while (bit < 32) { - if (v3d->lay & (1 << bit)) { - v3d->layact = 1 << bit; + if (v3d->lay & (1u << bit)) { + v3d->layact = (1u << bit); break; } bit++; @@ -493,8 +530,11 @@ static void rna_SpaceView3D_matcap_enable(Main *UNUSED(bmain), Scene *UNUSED(sce { View3D *v3d = (View3D *)(ptr->data); - if (v3d->matcap_icon == 0) + if (v3d->matcap_icon < ICON_MATCAP_01 || + v3d->matcap_icon > ICON_MATCAP_24) + { v3d->matcap_icon = ICON_MATCAP_01; + } } static void rna_SpaceView3D_pivot_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr) @@ -656,6 +696,17 @@ static EnumPropertyItem *rna_SpaceView3D_viewport_shade_itemf(bContext *UNUSED(C return item; } +static EnumPropertyItem *rna_SpaceView3D_stereo3d_camera_itemf(bContext *UNUSED(C), PointerRNA *ptr, + PropertyRNA *UNUSED(prop), bool *UNUSED(r_free)) +{ + Scene *scene = ((bScreen *)ptr->id.data)->scene; + + if (scene->r.views_format == SCE_VIEWS_FORMAT_MULTIVIEW) + return multiview_camera_items; + else + return stereo3d_camera_items; +} + /* Space Image Editor */ static PointerRNA rna_SpaceImageEditor_uvedit_get(PointerRNA *ptr) @@ -668,6 +719,38 @@ static void rna_SpaceImageEditor_mode_update(Main *bmain, Scene *scene, PointerR ED_space_image_paint_update(bmain->wm.first, scene->toolsettings); } + +static void rna_SpaceImageEditor_show_stereo_set(PointerRNA *ptr, int value) +{ + SpaceImage *sima = (SpaceImage *)(ptr->data); + + if (value) + sima->iuser.flag |= IMA_SHOW_STEREO; + else + sima->iuser.flag &= ~IMA_SHOW_STEREO; +} + +static int rna_SpaceImageEditor_show_stereo_get(PointerRNA *ptr) +{ + SpaceImage *sima = (SpaceImage *)(ptr->data); + return (sima->iuser.flag & IMA_SHOW_STEREO) != 0; +} + +static void rna_SpaceImageEditor_show_stereo_update(Main *UNUSED(bmain), Scene *UNUSED(unused), PointerRNA *ptr) +{ + SpaceImage *sima = (SpaceImage *)(ptr->data); + Image *ima = sima->image; + + if (ima) { + if (ima->rr) { + BKE_image_multilayer_index(ima->rr, &sima->iuser); + } + else { + BKE_image_multiview_index(ima, &sima->iuser); + } + } +} + static int rna_SpaceImageEditor_show_render_get(PointerRNA *ptr) { SpaceImage *sima = (SpaceImage *)(ptr->data); @@ -795,6 +878,24 @@ static void rna_SpaceImageEditor_cursor_location_set(PointerRNA *ptr, const floa } } +static void rna_SpaceImageEditor_image_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) +{ + SpaceImage *sima = (SpaceImage *)ptr->data; + Image *ima = sima->image; + + /* make sure all the iuser settings are valid for the sima image */ + if (ima) { + if (ima->rr) { + if (BKE_image_multilayer_index(sima->image->rr, &sima->iuser) == NULL) { + BKE_image_init_imageuser(sima->image, &sima->iuser); + } + } + else { + BKE_image_multiview_index(ima, &sima->iuser); + } + } +} + static void rna_SpaceImageEditor_scopes_update(struct bContext *C, struct PointerRNA *ptr) { SpaceImage *sima = (SpaceImage *)ptr->data; @@ -1114,24 +1215,60 @@ static void rna_SpaceDopeSheetEditor_action_update(Main *UNUSED(bmain), Scene *s if (saction->mode == SACTCONT_ACTION) { /* TODO: context selector could help decide this with more control? */ - adt = BKE_id_add_animdata(&obact->id); /* this only adds if non-existent */ + adt = BKE_animdata_add_id(&obact->id); /* this only adds if non-existent */ } else if (saction->mode == SACTCONT_SHAPEKEY) { Key *key = BKE_key_from_object(obact); if (key) - adt = BKE_id_add_animdata(&key->id); /* this only adds if non-existent */ + adt = BKE_animdata_add_id(&key->id); /* this only adds if non-existent */ } /* set action */ + // FIXME: this overlaps a lot with the BKE_animdata_set_action() API method if (adt) { - /* fix id-count of action we're replacing */ - id_us_min(&adt->action->id); - - /* assign new action, and adjust the usercounts accordingly */ - adt->action = saction->action; - id_us_plus(&adt->action->id); + /* Don't do anything if old and new actions are the same... */ + if (adt->action != saction->action) { + /* NLA Tweak Mode needs special handling... */ + if (adt->flag & ADT_NLA_EDIT_ON) { + /* Exit editmode first - we cannot change actions while in tweakmode + * NOTE: This will clear the action ref properly + */ + BKE_nla_tweakmode_exit(adt); + + /* Assign new action, and adjust the usercounts accordingly */ + adt->action = saction->action; + id_us_plus((ID *)adt->action); + } + else { + /* Handle old action... */ + if (adt->action) { + /* Fix id-count of action we're replacing */ + id_us_min(&adt->action->id); + + /* To prevent data loss (i.e. if users flip between actions using the Browse menu), + * stash this action if nothing else uses it. + * + * EXCEPTION: + * This callback runs when unlinking actions. In that case, we don't want to + * stash the action, as the user is signalling that they want to detach it. + * This can be reviewed again later, but it could get annoying if we keep these instead. + */ + if ((adt->action->id.us <= 0) && (saction->action != NULL)) { + /* XXX: Things here get dodgy if this action is only partially completed, + * and the user then uses the browse menu to get back to this action, + * assigning it as the active action (i.e. the stash strip gets out of sync) + */ + BKE_nla_action_stash(adt); + } + } + + /* Assign new action, and adjust the usercounts accordingly */ + adt->action = saction->action; + id_us_plus((ID *)adt->action); + } + } - /* force update of animdata */ + /* Force update of animdata */ adt->recalc |= ADT_RECALC_ANIM; } @@ -1211,6 +1348,19 @@ static void rna_BackgroundImage_opacity_set(PointerRNA *ptr, float value) bgpic->blend = 1.0f - value; } +/* radius internally (expose as a distance value) */ +static float rna_BackgroundImage_size_get(PointerRNA *ptr) +{ + BGpic *bgpic = ptr->data; + return bgpic->size * 2.0f; +} + +static void rna_BackgroundImage_size_set(PointerRNA *ptr, float value) +{ + BGpic *bgpic = ptr->data; + bgpic->size = value * 0.5f; +} + static BGpic *rna_BackgroundImage_new(View3D *v3d) { BGpic *bgpic = ED_view3D_background_image_new(v3d); @@ -1780,6 +1930,11 @@ static void rna_def_space_image_uv(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Draw Other Objects", "Draw other selected objects that share the same image"); RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL); + prop = RNA_def_property(srna, "show_metadata", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", SI_DRAW_METADATA); + RNA_def_property_ui_text(prop, "Draw Metadata", "Draw metadata properties of the image"); + RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL); + prop = RNA_def_property(srna, "show_texpaint", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SI_NO_DRAW_TEXPAINT); RNA_def_property_ui_text(prop, "Draw Texture Paint UVs", "Draw overlay of texture paint uv layer"); @@ -1966,15 +2121,16 @@ static void rna_def_background_image(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Y Offset", "Offset image vertically from the world origin"); RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); - prop = RNA_def_property(srna, "size", PROP_FLOAT, PROP_NONE); + prop = RNA_def_property(srna, "size", PROP_FLOAT, PROP_DISTANCE); RNA_def_property_float_sdna(prop, NULL, "size"); - RNA_def_property_ui_text(prop, "Size", "Scaling factor for the background image"); + RNA_def_property_float_funcs(prop, "rna_BackgroundImage_size_get", "rna_BackgroundImage_size_set", NULL); + RNA_def_property_ui_text(prop, "Size", "Size of the background image (ortho view only)"); RNA_def_property_range(prop, 0.0, FLT_MAX); RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); prop = RNA_def_property(srna, "rotation", PROP_FLOAT, PROP_EULER); RNA_def_property_float_sdna(prop, NULL, "rotation"); - RNA_def_property_ui_text(prop, "Rotation", "Rotation for the background image"); + RNA_def_property_ui_text(prop, "Rotation", "Rotation for the background image (ortho view only)"); RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); prop = RNA_def_property(srna, "use_flip_x", PROP_BOOLEAN, PROP_NONE); @@ -2479,6 +2635,48 @@ static void rna_def_space_view3d(BlenderRNA *brna) RNA_def_property_ui_text(prop, "FX Options", "Options used for real time compositing"); RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); + /* Stereo Settings */ + prop = RNA_def_property(srna, "stereo_3d_eye", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "multiview_eye"); + RNA_def_property_enum_items(prop, stereo3d_eye_items); + RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_SpaceView3D_stereo3d_camera_itemf"); + RNA_def_property_ui_text(prop, "Stereo Eye", "Current stereo eye being drawn"); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + + prop = RNA_def_property(srna, "stereo_3d_camera", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "stereo3d_camera"); + RNA_def_property_enum_items(prop, stereo3d_camera_items); + RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_SpaceView3D_stereo3d_camera_itemf"); + RNA_def_property_ui_text(prop, "Camera", ""); + RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); + + prop = RNA_def_property(srna, "show_stereo_3d_cameras", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "stereo3d_flag", V3D_S3D_DISPCAMERAS); + RNA_def_property_ui_text(prop, "Cameras", "Show the left and right cameras"); + RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); + + prop = RNA_def_property(srna, "show_stereo_3d_convergence_plane", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "stereo3d_flag", V3D_S3D_DISPPLANE); + RNA_def_property_ui_text(prop, "Plane", "Show the stereo 3d convergence plane"); + RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); + + prop = RNA_def_property(srna, "stereo_3d_convergence_plane_alpha", PROP_FLOAT, PROP_FACTOR); + RNA_def_property_float_sdna(prop, NULL, "stereo3d_convergence_alpha"); + RNA_def_property_ui_text(prop, "Plane Alpha", "Opacity (alpha) of the convergence plane"); + RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); + + prop = RNA_def_property(srna, "show_stereo_3d_volume", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "stereo3d_flag", V3D_S3D_DISPVOLUME); + RNA_def_property_ui_text(prop, "Volume", "Show the stereo 3d frustum volume"); + RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); + + prop = RNA_def_property(srna, "stereo_3d_volume_alpha", PROP_FLOAT, PROP_FACTOR); + RNA_def_property_float_sdna(prop, NULL, "stereo3d_volume_alpha"); + RNA_def_property_ui_text(prop, "Volume Alpha", "Opacity (alpha) of the cameras' frustum volume"); + RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); + + /* *** Animated *** */ + RNA_define_animate_sdna(true); /* region */ srna = RNA_def_struct(brna, "RegionView3D", NULL); @@ -2652,7 +2850,7 @@ static void rna_def_space_image(BlenderRNA *brna) RNA_def_property_pointer_funcs(prop, NULL, "rna_SpaceImageEditor_image_set", NULL, NULL); RNA_def_property_ui_text(prop, "Image", "Image displayed and edited in this space"); RNA_def_property_flag(prop, PROP_EDITABLE); - RNA_def_property_update(prop, NC_GEOM | ND_DATA, NULL); /* is handled in image editor too */ + RNA_def_property_update(prop, NC_GEOM | ND_DATA, "rna_SpaceImageEditor_image_update"); /* is handled in image editor too */ prop = RNA_def_property(srna, "image_user", PROP_POINTER, PROP_NONE); RNA_def_property_flag(prop, PROP_NEVER_NULL); @@ -2704,6 +2902,12 @@ static void rna_def_space_image(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Draw Channels", "Channels of the image to draw"); RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL); + prop = RNA_def_property(srna, "show_stereo_3d", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_funcs(prop, "rna_SpaceImageEditor_show_stereo_get", "rna_SpaceImageEditor_show_stereo_set"); + RNA_def_property_ui_text(prop, "Show Stereo", "Display the image in Stereo 3D"); + RNA_def_property_ui_icon(prop, ICON_CAMERA_STEREO, 0); + RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, "rna_SpaceImageEditor_show_stereo_update"); + /* uv */ prop = RNA_def_property(srna, "uv_editor", PROP_POINTER, PROP_NONE); RNA_def_property_flag(prop, PROP_NEVER_NULL); @@ -2880,6 +3084,16 @@ static void rna_def_space_sequencer(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Center-Cut Safe Areas", "Show safe areas to fit content in a different aspect ratio"); RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SEQUENCER, NULL); + prop = RNA_def_property(srna, "show_metadata", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_SHOW_METADATA); + RNA_def_property_ui_text(prop, "Show Metadata", "Show metadata of first visible strip"); + RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SEQUENCER, NULL); + + prop = RNA_def_property(srna, "show_info", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SEQ_NO_INFO); + RNA_def_property_ui_text(prop, "Show Strip Info", "Show source info on the strip"); + RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SEQUENCER, NULL); + prop = RNA_def_property(srna, "show_seconds", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SEQ_DRAWFRAMES); RNA_def_property_ui_text(prop, "Show Seconds", "Show timing in seconds not frames"); @@ -3311,6 +3525,23 @@ static void rna_def_space_graph(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Auto Normalization", "Automatically recalculate curve normalization on every curve edit"); RNA_def_property_update(prop, NC_SPACE | ND_SPACE_GRAPH, NULL); + + prop = RNA_def_property(srna, "show_backdrop", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", SIPO_DRAW_BACKDROP); + RNA_def_property_ui_text(prop, "Show Backdrop", "Draw a backdrop showing the content of the 3D View"); + RNA_def_property_update(prop, NC_SPACE | ND_SPACE_GRAPH, NULL); + + prop = RNA_def_property(srna, "backdrop_camera", PROP_POINTER, PROP_NONE); + RNA_def_property_flag(prop, PROP_EDITABLE); + RNA_def_property_pointer_funcs(prop, NULL, NULL, NULL, "rna_Camera_object_poll"); + RNA_def_property_ui_text(prop, "Backdrop Camera", "The camera that is used to project the backdrop"); + RNA_def_property_update(prop, NC_SPACE | ND_SPACE_GRAPH, NULL); + + prop = RNA_def_property(srna, "backdrop_opacity", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "backdrop_opacity"); + RNA_def_property_range(prop, 0.0f, 1.0f); + RNA_def_property_ui_text(prop, "Backdrop Opacity", "Opacity of the backdrop"); + RNA_def_property_update(prop, NC_SPACE | ND_SPACE_GRAPH, NULL); } static void rna_def_space_nla(BlenderRNA *brna) @@ -3516,6 +3747,14 @@ static void rna_def_fileselect_params(BlenderRNA *brna) {0, NULL, 0, NULL, NULL} }; + static EnumPropertyItem thumbnail_size_items[] = { + {32, "TINY", 0, "Tiny", ""}, + {64, "SMALL", 0, "Small", ""}, + {128, "NORMAL", 0, "Normal", ""}, + {256, "LARGE", 0, "Large", ""}, + {0, NULL, 0, NULL, NULL} + }; + srna = RNA_def_struct(brna, "FileSelectParams", NULL); RNA_def_struct_ui_text(srna, "File Select Parameters", "File Select Parameters"); @@ -3550,6 +3789,11 @@ static void rna_def_fileselect_params(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Show Hidden", "Show hidden dot files"); RNA_def_property_update(prop, NC_SPACE | ND_SPACE_FILE_PARAMS, NULL); + prop = RNA_def_property(srna, "collapse_seq", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", FILE_COLLAPSE_IMAGES); + RNA_def_property_ui_text(prop, "Collapse Image Sequences", "Collapse image sequences"); + RNA_def_property_update(prop, NC_SPACE | ND_SPACE_FILE_PARAMS, NULL); + prop = RNA_def_property(srna, "sort_method", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "sort"); RNA_def_property_enum_items(prop, file_sort_items); @@ -3620,6 +3864,12 @@ static void rna_def_fileselect_params(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Name Filter", "Filter by name, supports '*' wildcard"); RNA_def_property_flag(prop, PROP_TEXTEDIT_UPDATE); RNA_def_property_update(prop, NC_SPACE | ND_SPACE_FILE_LIST, NULL); + + prop = RNA_def_property(srna, "thumbnail_size", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "thumbnail_size"); + RNA_def_property_enum_items(prop, thumbnail_size_items); + RNA_def_property_ui_text(prop, "Thumbnails Size", "Change the size of the thumbnails"); + RNA_def_property_update(prop, NC_SPACE | ND_SPACE_FILE_LIST, NULL); } static void rna_def_filemenu_entry(BlenderRNA *brna) diff --git a/source/blender/makesrna/intern/rna_space_api.c b/source/blender/makesrna/intern/rna_space_api.c index 4114ee8a289..3cfbd798ad6 100644 --- a/source/blender/makesrna/intern/rna_space_api.c +++ b/source/blender/makesrna/intern/rna_space_api.c @@ -101,7 +101,7 @@ void RNA_api_space_text(StructRNA *srna) RNA_def_property_flag(parm, PROP_REQUIRED); parm = RNA_def_int(func, "column", 0, INT_MIN, INT_MAX, "Column", "Column index", 0, INT_MAX); RNA_def_property_flag(parm, PROP_REQUIRED); - parm = RNA_def_int_array(func, "result", 2, 0, -1, INT_MAX, "", "Region coordinates", -1, INT_MAX); + parm = RNA_def_int_array(func, "result", 2, NULL, -1, INT_MAX, "", "Region coordinates", -1, INT_MAX); RNA_def_function_output(func, parm); } diff --git a/source/blender/makesrna/intern/rna_strands.c b/source/blender/makesrna/intern/rna_strands.c new file mode 100644 index 00000000000..f6154fd1e01 --- /dev/null +++ b/source/blender/makesrna/intern/rna_strands.c @@ -0,0 +1,312 @@ +/* + * Copyright 2015, Blender Foundation. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +/** \file blender/makesrna/intern/rna_strands.c + * \ingroup RNA + */ + +#include <stdlib.h> + +#include "BLI_utildefines.h" + +#include "RNA_define.h" +#include "RNA_access.h" + +#include "rna_internal.h" + +#include "WM_types.h" + +#ifdef RNA_RUNTIME + +#include "BLI_math.h" + +#include "BKE_strands.h" +#include "BKE_report.h" + +static int rna_Strands_has_motion_state_get(PointerRNA *ptr) +{ + Strands *strands = ptr->data; + return (bool)(strands->state != NULL); +} + +static int rna_StrandsChildCurve_render_size_get(PointerRNA *ptr) +{ + StrandsChildCurve *curve = ptr->data; + return curve->cutoff < 0.0f ? curve->numverts : min_ii(curve->numverts, (int)ceilf(curve->cutoff) + 1); +} + +static void rna_StrandsChildren_curve_uvs_begin(CollectionPropertyIterator *iter, PointerRNA *ptr) +{ + StrandsChildren *strands = ptr->data; + rna_iterator_array_begin(iter, strands->curve_uvs, sizeof(StrandsChildCurveUV), strands->totcurves * strands->numuv, false, NULL); +} + +static int rna_StrandsChildren_curve_uvs_length(PointerRNA *ptr) +{ + StrandsChildren *strands = ptr->data; + return strands->totcurves * strands->numuv; +} + +static int rna_StrandsChildren_curve_uvs_lookup_int(PointerRNA *ptr, int index, PointerRNA *r_ptr) +{ + StrandsChildren *strands = ptr->data; + if (index >= 0 && index < strands->totcurves * strands->numuv) { + RNA_pointer_create(ptr->id.data, &RNA_StrandsChildCurveUV, strands->curve_uvs + index, r_ptr); + return true; + } + else { + RNA_pointer_create(ptr->id.data, &RNA_StrandsChildCurveUV, NULL, r_ptr); + return false; + } +} + +static void rna_StrandsChildren_curve_vcols_begin(CollectionPropertyIterator *iter, PointerRNA *ptr) +{ + StrandsChildren *strands = ptr->data; + rna_iterator_array_begin(iter, strands->curve_vcols, sizeof(StrandsChildCurveVCol), strands->totcurves * strands->numvcol, false, NULL); +} + +static int rna_StrandsChildren_curve_vcols_length(PointerRNA *ptr) +{ + StrandsChildren *strands = ptr->data; + return strands->totcurves * strands->numvcol; +} + +static int rna_StrandsChildren_curve_vcols_lookup_int(PointerRNA *ptr, int index, PointerRNA *r_ptr) +{ + StrandsChildren *strands = ptr->data; + if (index >= 0 && index < strands->totcurves * strands->numvcol) { + RNA_pointer_create(ptr->id.data, &RNA_StrandsChildCurveVCol, strands->curve_vcols + index, r_ptr); + return true; + } + else { + RNA_pointer_create(ptr->id.data, &RNA_StrandsChildCurveVCol, NULL, r_ptr); + return false; + } +} + +#else + +static void rna_def_strands_curve(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + + srna = RNA_def_struct(brna, "StrandsCurve", NULL); + RNA_def_struct_sdna(srna, "StrandsCurve"); + RNA_def_struct_ui_text(srna, "Strand Curve", "Strand curve"); + + prop = RNA_def_property(srna, "size", PROP_INT, PROP_NONE); + RNA_def_property_int_sdna(prop, NULL, "numverts"); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Size", "Number of vertices of the curve"); + + /* same as "size", defined for consistency */ + prop = RNA_def_property(srna, "render_size", PROP_INT, PROP_NONE); + RNA_def_property_int_sdna(prop, NULL, "numverts"); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Render Size", "Number of vertices of the curve for rendering based on cutoff length"); +} + +static void rna_def_strands_vertex(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + + srna = RNA_def_struct(brna, "StrandsVertex", NULL); + RNA_def_struct_sdna(srna, "StrandsVertex"); + RNA_def_struct_ui_text(srna, "Strand Vertex", "Strand vertex"); + + prop = RNA_def_property(srna, "location", PROP_FLOAT, PROP_TRANSLATION); + RNA_def_property_float_sdna(prop, NULL, "co"); + RNA_def_property_array(prop, 3); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Location", ""); +} + +static void rna_def_strands_motion_state(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + + srna = RNA_def_struct(brna, "StrandsMotionState", NULL); + RNA_def_struct_sdna(srna, "StrandsMotionState"); + RNA_def_struct_ui_text(srna, "Strand Vertex Motion State", "Physical motion state of a vertex"); + + prop = RNA_def_property(srna, "location", PROP_FLOAT, PROP_TRANSLATION); + RNA_def_property_float_sdna(prop, NULL, "co"); + RNA_def_property_array(prop, 3); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Location", ""); +} + +static void rna_def_strands(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + + srna = RNA_def_struct(brna, "Strands", NULL); + RNA_def_struct_sdna(srna, "Strands"); + RNA_def_struct_ui_text(srna, "Strands", "Strand geometry to represent hair and similar linear structures"); + + prop = RNA_def_property(srna, "curves", PROP_COLLECTION, PROP_NONE); + RNA_def_property_collection_sdna(prop, NULL, "curves", "totcurves"); + RNA_def_property_struct_type(prop, "StrandsCurve"); + RNA_def_property_ui_text(prop, "Strand Curves", ""); + + prop = RNA_def_property(srna, "vertices", PROP_COLLECTION, PROP_NONE); + RNA_def_property_collection_sdna(prop, NULL, "verts", "totverts"); + RNA_def_property_struct_type(prop, "StrandsVertex"); + RNA_def_property_ui_text(prop, "Strand Vertex", ""); + + prop = RNA_def_property(srna, "has_motion_state", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_funcs(prop, "rna_Strands_has_motion_state_get", NULL); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Has Motion State", "Strands have physical motion data associated with vertices"); + + prop = RNA_def_property(srna, "motion_state", PROP_COLLECTION, PROP_NONE); + RNA_def_property_collection_sdna(prop, NULL, "state", "totverts"); + RNA_def_property_struct_type(prop, "StrandsMotionState"); + RNA_def_property_ui_text(prop, "Strand Motion State", ""); +} + +static void rna_def_strands_child_curve(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + + srna = RNA_def_struct(brna, "StrandsChildCurve", NULL); + RNA_def_struct_sdna(srna, "StrandsChildCurve"); + RNA_def_struct_ui_text(srna, "Strand Child Curve", "Strand child curve"); + + prop = RNA_def_property(srna, "size", PROP_INT, PROP_NONE); + RNA_def_property_int_sdna(prop, NULL, "numverts"); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Size", "Number of vertices of the curve"); + + prop = RNA_def_property(srna, "render_size", PROP_INT, PROP_NONE); + RNA_def_property_int_funcs(prop, "rna_StrandsChildCurve_render_size_get", NULL, NULL); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Render Size", "Number of vertices of the curve for rendering based on cutoff length"); + + prop = RNA_def_property(srna, "cutoff", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "cutoff"); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Cutoff", "Curve parameter at which the curve is cut short for rendering"); +} + +static void rna_def_strands_child_curve_uv(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + + srna = RNA_def_struct(brna, "StrandsChildCurveUV", NULL); + RNA_def_struct_sdna(srna, "StrandsChildCurveUV"); + RNA_def_struct_ui_text(srna, "Strand Child Curve UV", "UV data for child strand curves"); + + prop = RNA_def_property(srna, "uv", PROP_FLOAT, PROP_NONE); + RNA_def_property_array(prop, 2); + RNA_def_property_ui_text(prop, "UV", ""); +} + +static void rna_def_strands_child_curve_vcol(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + + srna = RNA_def_struct(brna, "StrandsChildCurveVCol", NULL); + RNA_def_struct_sdna(srna, "StrandsChildCurveVCol"); + RNA_def_struct_ui_text(srna, "Strand Child Curve Vertex Color", "Vertex color data for child strand curves"); + + prop = RNA_def_property(srna, "vcol", PROP_FLOAT, PROP_NONE); + RNA_def_property_array(prop, 3); + RNA_def_property_ui_text(prop, "Vertex Color", ""); +} + +static void rna_def_strands_child_vertex(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + + srna = RNA_def_struct(brna, "StrandsChildVertex", NULL); + RNA_def_struct_sdna(srna, "StrandsChildVertex"); + RNA_def_struct_ui_text(srna, "Strand Child Vertex", "Strand child vertex"); + + prop = RNA_def_property(srna, "location", PROP_FLOAT, PROP_TRANSLATION); + RNA_def_property_float_sdna(prop, NULL, "co"); + RNA_def_property_array(prop, 3); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Location", ""); +} + +static void rna_def_strands_children(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + + srna = RNA_def_struct(brna, "StrandsChildren", NULL); + RNA_def_struct_sdna(srna, "StrandsChildren"); + RNA_def_struct_ui_text(srna, "Child Strands", "Strand geometry to represent hair and similar linear structures"); + + prop = RNA_def_property(srna, "curves", PROP_COLLECTION, PROP_NONE); + RNA_def_property_collection_sdna(prop, NULL, "curves", "totcurves"); + RNA_def_property_struct_type(prop, "StrandsChildCurve"); + RNA_def_property_ui_text(prop, "Strand Child Curves", ""); + + prop = RNA_def_property(srna, "curve_uvs", PROP_COLLECTION, PROP_NONE); + RNA_def_property_collection_funcs(prop, "rna_StrandsChildren_curve_uvs_begin", "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_get", + "rna_StrandsChildren_curve_uvs_length", "rna_StrandsChildren_curve_uvs_lookup_int", NULL, NULL); + RNA_def_property_struct_type(prop, "StrandsChildCurveUV"); + RNA_def_property_ui_text(prop, "Strand Child Curves UV", ""); + + prop = RNA_def_property(srna, "num_curve_uv_layers", PROP_INT, PROP_NONE); + RNA_def_property_int_sdna(prop, NULL, "numuv"); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "UV Layers", "Number of UV layers"); + + prop = RNA_def_property(srna, "curve_vcols", PROP_COLLECTION, PROP_NONE); + RNA_def_property_collection_funcs(prop, "rna_StrandsChildren_curve_vcols_begin", "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_get", + "rna_StrandsChildren_curve_vcols_length", "rna_StrandsChildren_curve_vcols_lookup_int", NULL, NULL); + RNA_def_property_struct_type(prop, "StrandsChildCurveVCol"); + RNA_def_property_ui_text(prop, "Strand Child Curves Vertex Colors", ""); + + prop = RNA_def_property(srna, "num_curve_vcol_layers", PROP_INT, PROP_NONE); + RNA_def_property_int_sdna(prop, NULL, "numvcol"); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Vertex Color Layers", "Number of Vertex Color layers"); + + prop = RNA_def_property(srna, "vertices", PROP_COLLECTION, PROP_NONE); + RNA_def_property_collection_sdna(prop, NULL, "verts", "totverts"); + RNA_def_property_struct_type(prop, "StrandsChildVertex"); + RNA_def_property_ui_text(prop, "Strand Child Vertex", ""); +} + +void RNA_def_strands(BlenderRNA *brna) +{ + rna_def_strands_curve(brna); + rna_def_strands_vertex(brna); + rna_def_strands_motion_state(brna); + rna_def_strands(brna); + rna_def_strands_child_curve(brna); + rna_def_strands_child_curve_uv(brna); + rna_def_strands_child_curve_vcol(brna); + rna_def_strands_child_vertex(brna); + rna_def_strands_children(brna); +} + +#endif diff --git a/source/blender/makesrna/intern/rna_texture.c b/source/blender/makesrna/intern/rna_texture.c index c1882e7767d..88f164193d4 100644 --- a/source/blender/makesrna/intern/rna_texture.c +++ b/source/blender/makesrna/intern/rna_texture.c @@ -181,7 +181,7 @@ static void rna_Texture_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *pt static void rna_Texture_mapping_update(Main *bmain, Scene *scene, PointerRNA *ptr) { TexMapping *texmap = ptr->data; - init_tex_mapping(texmap); + BKE_texture_mapping_init(texmap); rna_Texture_update(bmain, scene, ptr); } @@ -222,7 +222,7 @@ static void rna_Texture_type_set(PointerRNA *ptr, int value) { Tex *tex = (Tex *)ptr->data; - tex_set_type(tex, value); + BKE_texture_type_set(tex, value); } void rna_TextureSlot_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) @@ -445,7 +445,7 @@ static void rna_Envmap_update_generic(Main *bmain, Scene *scene, PointerRNA *ptr Tex *tex = ptr->id.data; if (tex->env) { ED_preview_kill_jobs(bmain->wm.first, bmain); - BKE_free_envmapdata(tex->env); + BKE_texture_envmap_free_data(tex->env); } rna_Texture_update(bmain, scene, ptr); } @@ -1674,6 +1674,7 @@ static void rna_def_texture_pointdensity(BlenderRNA *brna) {TEX_PD_COLOR_PARTSPEED, "PARTICLE_SPEED", 0, "Particle Speed", "Particle speed (absolute magnitude of velocity) mapped as 0.0-1.0 intensity"}, {TEX_PD_COLOR_PARTVEL, "PARTICLE_VELOCITY", 0, "Particle Velocity", "XYZ velocity mapped to RGB colors"}, + {TEX_PD_COLOR_PARTTEX, "PARTICLE_TEXTURE", 0, "Particle Texture", "Texture color of particles"}, {0, NULL, 0, NULL, NULL} }; diff --git a/source/blender/makesrna/intern/rna_texture_api.c b/source/blender/makesrna/intern/rna_texture_api.c index acf8333d6dc..a27ba6ea06d 100644 --- a/source/blender/makesrna/intern/rna_texture_api.c +++ b/source/blender/makesrna/intern/rna_texture_api.c @@ -60,7 +60,7 @@ static void clear_envmap(struct EnvMap *env, bContext *C) Main *bmain = CTX_data_main(C); Tex *tex; - BKE_free_envmapdata(env); + BKE_texture_envmap_free_data(env); for (tex = bmain->tex.first; tex; tex = tex->id.next) if (tex->env == env) { diff --git a/source/blender/makesrna/intern/rna_ui_api.c b/source/blender/makesrna/intern/rna_ui_api.c index f56da1e92b7..d19b7dc9efa 100644 --- a/source/blender/makesrna/intern/rna_ui_api.c +++ b/source/blender/makesrna/intern/rna_ui_api.c @@ -464,15 +464,6 @@ void RNA_api_ui_layout(StructRNA *srna) RNA_def_float(func, "percentage", 0.0f, 0.0f, 1.0f, "Percentage", "Percentage of width to split at", 0.0f, 1.0f); RNA_def_boolean(func, "align", false, "", "Align buttons to each other"); - /* sub-block */ - func = RNA_def_function(srna, "subblock_begin", "uiLayoutSubblockBegin"); - parm = RNA_def_string(func, "identifier", NULL, MAX_NAME, "", "Name/ID of the sub-block"); - RNA_def_property_flag(parm, PROP_REQUIRED); - RNA_def_function_ui_description(func, "Set the beginning of a sub-block"); - - func = RNA_def_function(srna, "subblock_end", "uiLayoutSubblockEnd"); - RNA_def_function_ui_description(func, "Set the end of a sub-block"); - /* radial/pie layout */ func = RNA_def_function(srna, "menu_pie", "uiLayoutRadial"); parm = RNA_def_pointer(func, "layout", "UILayout", "", "Sub-layout to put items in"); @@ -728,11 +719,12 @@ void RNA_api_ui_layout(StructRNA *srna) RNA_def_function_ui_description(func, "Item. A color ramp widget"); api_ui_item_rna_common(func); RNA_def_boolean(func, "expand", false, "", "Expand button to show more detail"); - + func = RNA_def_function(srna, "template_icon_view", "uiTemplateIconView"); RNA_def_function_ui_description(func, "Enum. Large widget showing Icon previews"); api_ui_item_rna_common(func); - + RNA_def_boolean(func, "show_labels", false, "", "Show enum label in preview buttons"); + func = RNA_def_function(srna, "template_histogram", "uiTemplateHistogram"); RNA_def_function_ui_description(func, "Item. A histogramm widget to analyze imaga data"); api_ui_item_rna_common(func); @@ -788,6 +780,16 @@ void RNA_api_ui_layout(StructRNA *srna) RNA_def_property_flag(parm, PROP_REQUIRED | PROP_RNAPTR | PROP_NEVER_NULL); RNA_def_boolean(func, "color_management", false, "", "Show color management settings"); + func = RNA_def_function(srna, "template_image_stereo_3d", "uiTemplateImageStereo3d"); + RNA_def_function_ui_description(func, "User interface for setting image stereo 3d options"); + parm = RNA_def_pointer(func, "stereo_3d_format", "Stereo3dFormat", "", ""); + RNA_def_property_flag(parm, PROP_REQUIRED | PROP_RNAPTR | PROP_NEVER_NULL); + + func = RNA_def_function(srna, "template_image_views", "uiTemplateImageViews"); + RNA_def_function_ui_description(func, "User interface for setting image views output options"); + parm = RNA_def_pointer(func, "image_settings", "ImageFormatSettings", "", ""); + RNA_def_property_flag(parm, PROP_REQUIRED | PROP_RNAPTR | PROP_NEVER_NULL); + func = RNA_def_function(srna, "template_movieclip", "uiTemplateMovieClip"); RNA_def_function_ui_description(func, "Item(s). User interface for selecting movie clips and their source paths"); RNA_def_function_flag(func, FUNC_USE_CONTEXT); @@ -908,6 +910,19 @@ void RNA_api_ui_layout(StructRNA *srna) RNA_def_function_ui_description(func, "Node Socket Icon"); RNA_def_function_flag(func, FUNC_USE_CONTEXT); RNA_def_float_array(func, "color", 4, node_socket_color_default, 0.0f, 1.0f, "Color", "", 0.0f, 1.0f); + + /* cache library item */ + func = RNA_def_function(srna, "template_cache_library_item", "uiTemplateCacheLibraryItem"); + RNA_def_function_ui_description(func, "Cache Library Item"); + RNA_def_function_flag(func, FUNC_USE_CONTEXT); + RNA_def_pointer(func, "cachelib", "CacheLibrary", "Cache Library", "Cache library containing the item"); + RNA_def_pointer(func, "object", "Object", "Object", "Object to cache"); + parm = RNA_def_enum(func, "datatype", cache_library_data_type_items, 0, "Data Type", "Type of cached data"); + RNA_def_property_flag(parm, PROP_REQUIRED); + RNA_def_int(func, "index", -1, -1, INT_MAX, "Index", "Index of cached data", -1, INT_MAX); + RNA_def_boolean(func, "enabled", true, "Enabled", "Enable the item"); + parm = RNA_def_pointer(func, "layout", "UILayout", "", "Sub-layout to put items in"); + RNA_def_function_return(func, parm); } #endif diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c index 92409b80adc..535ade75e13 100644 --- a/source/blender/makesrna/intern/rna_userdef.c +++ b/source/blender/makesrna/intern/rna_userdef.c @@ -331,7 +331,7 @@ static PointerRNA rna_UserDef_system_get(PointerRNA *ptr) static void rna_UserDef_audio_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *UNUSED(ptr)) { - sound_init(bmain); + BKE_sound_init(bmain); } static void rna_Userdef_memcache_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *UNUSED(ptr)) @@ -548,7 +548,7 @@ static EnumPropertyItem *rna_userdef_audio_device_itemf(bContext *UNUSED(C), Poi #endif #ifdef WITH_JACK - if (sound_is_jack_supported()) { + if (BKE_sound_is_jack_supported()) { RNA_enum_item_add(&item, &totitem, &audio_device_items[index]); } index++; @@ -2386,6 +2386,18 @@ static void rna_def_userdef_theme_space_image(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Current Frame", ""); RNA_def_property_update(prop, 0, "rna_userdef_update"); + prop = RNA_def_property(srna, "metadatabg", PROP_FLOAT, PROP_COLOR_GAMMA); + RNA_def_property_float_sdna(prop, NULL, "metadatabg"); + RNA_def_property_array(prop, 3); + RNA_def_property_ui_text(prop, "Metadata Background", ""); + RNA_def_property_update(prop, 0, "rna_userdef_update"); + + prop = RNA_def_property(srna, "metadatatext", PROP_FLOAT, PROP_COLOR_GAMMA); + RNA_def_property_float_sdna(prop, NULL, "metadatatext"); + RNA_def_property_array(prop, 3); + RNA_def_property_ui_text(prop, "Metadata Text", ""); + RNA_def_property_update(prop, 0, "rna_userdef_update"); + rna_def_userdef_theme_spaces_curves(srna, false, false, false, true); rna_def_userdef_theme_spaces_paint_curves(srna); @@ -2488,6 +2500,18 @@ static void rna_def_userdef_theme_space_seq(BlenderRNA *brna) RNA_def_property_array(prop, 3); RNA_def_property_ui_text(prop, "Preview Background", ""); RNA_def_property_update(prop, 0, "rna_userdef_update"); + + prop = RNA_def_property(srna, "metadatabg", PROP_FLOAT, PROP_COLOR_GAMMA); + RNA_def_property_float_sdna(prop, NULL, "metadatabg"); + RNA_def_property_array(prop, 3); + RNA_def_property_ui_text(prop, "Metadata Background", ""); + RNA_def_property_update(prop, 0, "rna_userdef_update"); + + prop = RNA_def_property(srna, "metadatatext", PROP_FLOAT, PROP_COLOR_GAMMA); + RNA_def_property_float_sdna(prop, NULL, "metadatatext"); + RNA_def_property_array(prop, 3); + RNA_def_property_ui_text(prop, "Metadata Text", ""); + RNA_def_property_update(prop, 0, "rna_userdef_update"); } static void rna_def_userdef_theme_space_action(BlenderRNA *brna) @@ -3239,7 +3263,14 @@ static void rna_def_userdef_view(BlenderRNA *brna) "Direct conversion of frame numbers to seconds"}, {0, NULL, 0, NULL, NULL} }; - + + static EnumPropertyItem zoom_frame_modes[] = { + {ZOOM_FRAME_MODE_KEEP_RANGE, "KEEP_RANGE", 0, "Keep Range", ""}, + {ZOOM_FRAME_MODE_SECONDS, "SECONDS", 0, "Seconds", ""}, + {ZOOM_FRAME_MODE_KEYFRAMES, "KEYFRAMES", 0, "Keyframes", ""}, + {0, NULL, 0, NULL, NULL} + }; + PropertyRNA *prop; StructRNA *srna; @@ -3491,6 +3522,22 @@ static void rna_def_userdef_view(BlenderRNA *brna) RNA_def_property_ui_text(prop, "TimeCode Style", "Format of Time Codes displayed when not displaying timing in terms of frames"); RNA_def_property_update(prop, 0, "rna_userdef_update"); + + prop = RNA_def_property(srna, "view_frame_type", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_items(prop, zoom_frame_modes); + RNA_def_property_enum_sdna(prop, NULL, "view_frame_type"); + RNA_def_property_ui_text(prop, "Zoom To Frame Type", "How zooming to frame focuses around current frame"); + + prop = RNA_def_property(srna, "view_frame_keyframes", PROP_INT, PROP_NONE); + RNA_def_property_range(prop, 1, 500); + RNA_def_property_ui_text(prop, "Zoom Keyframes", + "Keyframes around cursor that we zoom around"); + + prop = RNA_def_property(srna, "view_frame_seconds", PROP_FLOAT, PROP_TIME); + RNA_def_property_range(prop, 0.0, 10000.0); + RNA_def_property_ui_text(prop, "Zoom Seconds", + "Seconds around cursor that we zoom around"); + } static void rna_def_userdef_edit(BlenderRNA *brna) @@ -3611,7 +3658,7 @@ static void rna_def_userdef_edit(BlenderRNA *brna) RNA_def_property_ui_text(prop, "New Interpolation Type", "Interpolation mode used for first keyframe on newly added F-Curves " "(subsequent keyframes take interpolation from preceding keyframe)"); - + prop = RNA_def_property(srna, "keyframe_new_handle_type", PROP_ENUM, PROP_NONE); RNA_def_property_enum_items(prop, keyframe_handle_type_items); RNA_def_property_enum_sdna(prop, NULL, "keyhandles_new"); @@ -3658,7 +3705,7 @@ static void rna_def_userdef_edit(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Grease Pencil Eraser Radius", "Radius of eraser 'brush'"); - prop = RNA_def_property(srna, "grease_pencil_default_color", PROP_FLOAT, PROP_COLOR); + prop = RNA_def_property(srna, "grease_pencil_default_color", PROP_FLOAT, PROP_COLOR_GAMMA); RNA_def_property_float_sdna(prop, NULL, "gpencil_new_layer_col"); RNA_def_property_array(prop, 4); RNA_def_property_ui_text(prop, "Grease Pencil Default Color", "Color of new Grease Pencil layers"); @@ -4134,8 +4181,8 @@ static void rna_def_userdef_system(BlenderRNA *brna) RNA_def_property_boolean_sdna(prop, NULL, "uiflag2", USER_REGION_OVERLAP); RNA_def_property_ui_text(prop, "Region Overlap", "Draw tool/property regions over the main region, when using Triple Buffer"); - RNA_def_property_update(prop, 0, "rna_userdef_dpi_update"); - + RNA_def_property_update(prop, 0, "rna_userdef_dpi_update"); + #ifdef WITH_CYCLES prop = RNA_def_property(srna, "compute_device_type", PROP_ENUM, PROP_NONE); RNA_def_property_flag(prop, PROP_ENUM_NO_CONTEXT); diff --git a/source/blender/makesrna/intern/rna_wm.c b/source/blender/makesrna/intern/rna_wm.c index 0b63539aab9..c23b56582b6 100644 --- a/source/blender/makesrna/intern/rna_wm.c +++ b/source/blender/makesrna/intern/rna_wm.c @@ -415,7 +415,7 @@ static EnumPropertyItem operator_flag_items[] = { {OPTYPE_UNDO, "UNDO", 0, "Undo", "Push an undo event (needed for operator redo)"}, {OPTYPE_BLOCKING, "BLOCKING", 0, "Blocking", "Block anything else from using the cursor"}, {OPTYPE_MACRO, "MACRO", 0, "Macro", "Use to check if an operator is a macro"}, - {OPTYPE_GRAB_POINTER, "GRAB_POINTER", 0, "Grab Pointer", + {OPTYPE_GRAB_CURSOR, "GRAB_CURSOR", 0, "Grab Pointer", "Use so the operator grabs the mouse focus, enables wrapping when continuous grab " "is enabled"}, {OPTYPE_PRESET, "PRESET", 0, "Preset", "Display a preset button with the operators settings"}, @@ -512,6 +512,11 @@ static int rna_Operator_has_reports_get(PointerRNA *ptr) return (op->reports && op->reports->list.first); } +static PointerRNA rna_Operator_options_get(PointerRNA *ptr) +{ + return rna_pointer_inherit_refine(ptr, &RNA_OperatorOptions, ptr->data); +} + static PointerRNA rna_Operator_properties_get(PointerRNA *ptr) { wmOperator *op = (wmOperator *)ptr->data; @@ -811,6 +816,29 @@ static void rna_KeyMapItem_any_set(PointerRNA *ptr, int value) } } +static int rna_KeyMapItem_shift_get(PointerRNA *ptr) +{ + wmKeyMapItem *kmi = (wmKeyMapItem *)ptr->data; + return kmi->shift != 0; +} + +static int rna_KeyMapItem_ctrl_get(PointerRNA *ptr) +{ + wmKeyMapItem *kmi = (wmKeyMapItem *)ptr->data; + return kmi->ctrl != 0; +} + +static int rna_KeyMapItem_alt_get(PointerRNA *ptr) +{ + wmKeyMapItem *kmi = (wmKeyMapItem *)ptr->data; + return kmi->alt != 0; +} + +static int rna_KeyMapItem_oskey_get(PointerRNA *ptr) +{ + wmKeyMapItem *kmi = (wmKeyMapItem *)ptr->data; + return kmi->oskey != 0; +} static PointerRNA rna_WindowManager_active_keyconfig_get(PointerRNA *ptr) { @@ -1562,6 +1590,33 @@ static void rna_KeyMapItem_update(Main *UNUSED(bmain), Scene *UNUSED(scene), Poi #else /* RNA_RUNTIME */ +/** + * expose ``Operator.options`` as its own type so we can control each flags use (some are read-only). + */ +static void rna_def_operator_options_runtime(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + + srna = RNA_def_struct(brna, "OperatorOptions", NULL); + RNA_def_struct_ui_text(srna, "Operator Options", "Runtime options"); + RNA_def_struct_sdna(srna, "wmOperator"); + + prop = RNA_def_property(srna, "is_grab_cursor", PROP_BOOLEAN, PROP_BOOLEAN); + RNA_def_property_boolean_sdna(prop, NULL, "flag", OP_IS_MODAL_GRAB_CURSOR); + RNA_def_property_ui_text(prop, "Grab Cursor", "True when the cursor is grabbed"); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + + prop = RNA_def_property(srna, "is_invoke", PROP_BOOLEAN, PROP_BOOLEAN); + RNA_def_property_boolean_sdna(prop, NULL, "flag", OP_IS_INVOKE); + RNA_def_property_ui_text(prop, "Invoke", "True when invoked (even if only the execute callbacks available)"); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + + prop = RNA_def_property(srna, "use_cursor_region", PROP_BOOLEAN, PROP_BOOLEAN); + RNA_def_property_boolean_sdna(prop, NULL, "flag", OP_IS_MODAL_CURSOR_REGION); + RNA_def_property_ui_text(prop, "Focus Region", "Enable to use the region under the cursor for modal execution"); +} + static void rna_def_operator(BlenderRNA *brna) { StructRNA *srna; @@ -1596,6 +1651,12 @@ static void rna_def_operator(BlenderRNA *brna) prop = RNA_def_property(srna, "layout", PROP_POINTER, PROP_NONE); RNA_def_property_struct_type(prop, "UILayout"); + prop = RNA_def_property(srna, "options", PROP_POINTER, PROP_NONE); + RNA_def_property_flag(prop, PROP_NEVER_NULL); + RNA_def_property_struct_type(prop, "OperatorOptions"); + RNA_def_property_pointer_funcs(prop, "rna_Operator_options_get", NULL, NULL, NULL); + RNA_def_property_ui_text(prop, "Options", "Runtime options"); + /* Registration */ prop = RNA_def_property(srna, "bl_idname", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "type->idname"); @@ -1635,6 +1696,11 @@ static void rna_def_operator(BlenderRNA *brna) RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL | PROP_ENUM_FLAG); RNA_def_property_ui_text(prop, "Options", "Options for this operator type"); + prop = RNA_def_property(srna, "macros", PROP_COLLECTION, PROP_NONE); + RNA_def_property_collection_sdna(prop, NULL, "macro", NULL); + RNA_def_property_struct_type(prop, "Macro"); + RNA_def_property_ui_text(prop, "Macros", ""); + RNA_api_operator(srna); srna = RNA_def_struct(brna, "OperatorProperties", NULL); @@ -1998,6 +2064,37 @@ static void rna_def_piemenu(BlenderRNA *brna) RNA_define_verify_sdna(1); /* not in sdna */ } +static void rna_def_window_stereo3d(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + + srna = RNA_def_struct(brna, "Stereo3dDisplay", NULL); + RNA_def_struct_sdna(srna, "Stereo3dFormat"); + RNA_def_struct_clear_flag(srna, STRUCT_UNDO); + RNA_def_struct_ui_text(srna, "Stereo 3D Display", "Settings for stereo 3D display"); + + prop = RNA_def_property(srna, "display_mode", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_items(prop, stereo3d_display_items); + RNA_def_property_ui_text(prop, "Display Mode", ""); + + prop = RNA_def_property(srna, "anaglyph_type", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_items(prop, stereo3d_anaglyph_type_items); + RNA_def_property_ui_text(prop, "Anaglyph Type", ""); + + prop = RNA_def_property(srna, "interlace_type", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_items(prop, stereo3d_interlace_type_items); + RNA_def_property_ui_text(prop, "Interlace Type", ""); + + prop = RNA_def_property(srna, "use_interlace_swap", PROP_BOOLEAN, PROP_BOOLEAN); + RNA_def_property_boolean_sdna(prop, NULL, "flag", S3D_INTERLACE_SWAP); + RNA_def_property_ui_text(prop, "Swap Left/Right", "Swap left and right stereo channels"); + + prop = RNA_def_property(srna, "use_sidebyside_crosseyed", PROP_BOOLEAN, PROP_BOOLEAN); + RNA_def_property_boolean_sdna(prop, NULL, "flag", S3D_SIDEBYSIDE_CROSSEYED); + RNA_def_property_ui_text(prop, "Cross-Eyed", "Right eye should see left image and vice-versa"); +} + static void rna_def_window(BlenderRNA *brna) { StructRNA *srna; @@ -2007,6 +2104,8 @@ static void rna_def_window(BlenderRNA *brna) RNA_def_struct_ui_text(srna, "Window", "Open window"); RNA_def_struct_sdna(srna, "wmWindow"); + rna_def_window_stereo3d(brna); + prop = RNA_def_property(srna, "screen", PROP_POINTER, PROP_NONE); RNA_def_property_flag(prop, PROP_NEVER_NULL); RNA_def_property_struct_type(prop, "Screen"); @@ -2036,6 +2135,12 @@ static void rna_def_window(BlenderRNA *brna) RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_ui_text(prop, "Height", "Window height"); + prop = RNA_def_property(srna, "stereo_3d_display", PROP_POINTER, PROP_NONE); + RNA_def_property_pointer_sdna(prop, NULL, "stereo3d_format"); + RNA_def_property_flag(prop, PROP_NEVER_NULL); + RNA_def_property_struct_type(prop, "Stereo3dDisplay"); + RNA_def_property_ui_text(prop, "Stereo 3D Display", "Settings for stereo 3d display"); + RNA_api_window(srna); } @@ -2284,6 +2389,7 @@ static void rna_def_keyconfig(BlenderRNA *brna) prop = RNA_def_property(srna, "shift", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "shift", 0); + RNA_def_property_boolean_funcs(prop, "rna_KeyMapItem_shift_get", NULL); /* RNA_def_property_enum_sdna(prop, NULL, "shift"); */ /* RNA_def_property_enum_items(prop, keymap_modifiers_items); */ RNA_def_property_ui_text(prop, "Shift", "Shift key pressed"); @@ -2291,6 +2397,7 @@ static void rna_def_keyconfig(BlenderRNA *brna) prop = RNA_def_property(srna, "ctrl", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "ctrl", 0); + RNA_def_property_boolean_funcs(prop, "rna_KeyMapItem_ctrl_get", NULL); /* RNA_def_property_enum_sdna(prop, NULL, "ctrl"); */ /* RNA_def_property_enum_items(prop, keymap_modifiers_items); */ RNA_def_property_ui_text(prop, "Ctrl", "Control key pressed"); @@ -2298,6 +2405,7 @@ static void rna_def_keyconfig(BlenderRNA *brna) prop = RNA_def_property(srna, "alt", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "alt", 0); + RNA_def_property_boolean_funcs(prop, "rna_KeyMapItem_alt_get", NULL); /* RNA_def_property_enum_sdna(prop, NULL, "alt"); */ /* RNA_def_property_enum_items(prop, keymap_modifiers_items); */ RNA_def_property_ui_text(prop, "Alt", "Alt key pressed"); @@ -2305,6 +2413,7 @@ static void rna_def_keyconfig(BlenderRNA *brna) prop = RNA_def_property(srna, "oskey", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "oskey", 0); + RNA_def_property_boolean_funcs(prop, "rna_KeyMapItem_oskey_get", NULL); /* RNA_def_property_enum_sdna(prop, NULL, "oskey"); */ /* RNA_def_property_enum_items(prop, keymap_modifiers_items); */ RNA_def_property_ui_text(prop, "OS Key", "Operating system key pressed"); @@ -2353,6 +2462,7 @@ static void rna_def_keyconfig(BlenderRNA *brna) void RNA_def_wm(BlenderRNA *brna) { rna_def_operator(brna); + rna_def_operator_options_runtime(brna); rna_def_operator_utils(brna); rna_def_operator_filelist_element(brna); rna_def_macro_operator(brna); diff --git a/source/blender/makesrna/intern/rna_world.c b/source/blender/makesrna/intern/rna_world.c index 721cbaf21c7..3f55ad9c668 100644 --- a/source/blender/makesrna/intern/rna_world.c +++ b/source/blender/makesrna/intern/rna_world.c @@ -92,6 +92,7 @@ static void rna_World_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerR WM_main_add_notifier(NC_WORLD | ND_WORLD, wo); } +#if 0 static void rna_World_draw_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) { World *wo = ptr->id.data; @@ -99,6 +100,7 @@ static void rna_World_draw_update(Main *UNUSED(bmain), Scene *UNUSED(scene), Poi DAG_id_tag_update(&wo->id, 0); WM_main_add_notifier(NC_WORLD | ND_WORLD_DRAW, wo); } +#endif /* so camera mist limits redraw */ static void rna_World_draw_mist_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) @@ -403,13 +405,13 @@ static void rna_def_world_mist(BlenderRNA *brna) prop = RNA_def_property(srna, "use_mist", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "mode", WO_MIST); RNA_def_property_ui_text(prop, "Use Mist", "Occlude objects with the environment color as they are further away"); - RNA_def_property_update(prop, 0, "rna_World_draw_update"); + RNA_def_property_update(prop, 0, "rna_World_draw_mist_update"); 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, "Minimum", "Overall minimum intensity of the mist effect"); - RNA_def_property_update(prop, 0, "rna_World_update"); + RNA_def_property_update(prop, 0, "rna_World_draw_mist_update"); prop = RNA_def_property(srna, "start", PROP_FLOAT, PROP_DISTANCE); RNA_def_property_float_sdna(prop, NULL, "miststa"); @@ -435,7 +437,7 @@ static void rna_def_world_mist(BlenderRNA *brna) RNA_def_property_enum_sdna(prop, NULL, "mistype"); RNA_def_property_enum_items(prop, falloff_items); RNA_def_property_ui_text(prop, "Falloff", "Type of transition used to fade mist"); - RNA_def_property_update(prop, 0, "rna_World_update"); + RNA_def_property_update(prop, 0, "rna_World_draw_mist_update"); } void RNA_def_world(BlenderRNA *brna) @@ -460,8 +462,7 @@ void RNA_def_world(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Horizon Color", "Color at the horizon"); /* RNA_def_property_update(prop, 0, "rna_World_update"); */ /* render-only uses this */ - RNA_def_property_update(prop, NC_WORLD | ND_WORLD_DRAW, "rna_World_update"); - + RNA_def_property_update(prop, 0, "rna_World_draw_mist_update"); prop = RNA_def_property(srna, "zenith_color", PROP_FLOAT, PROP_COLOR); RNA_def_property_float_sdna(prop, NULL, "zenr"); @@ -473,7 +474,7 @@ void RNA_def_world(BlenderRNA *brna) RNA_def_property_float_sdna(prop, NULL, "ambr"); RNA_def_property_array(prop, 3); RNA_def_property_ui_text(prop, "Ambient Color", "Ambient color of the world"); - RNA_def_property_update(prop, 0, "rna_World_update"); + RNA_def_property_update(prop, 0, "rna_World_draw_mist_update"); /* exp, range */ prop = RNA_def_property(srna, "exposure", PROP_FLOAT, PROP_NONE); |