diff options
Diffstat (limited to 'source/blender/makesrna/intern')
23 files changed, 362 insertions, 136 deletions
diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c index 71a3be24810..aeb6d528cdb 100644 --- a/source/blender/makesrna/intern/rna_access.c +++ b/source/blender/makesrna/intern/rna_access.c @@ -393,7 +393,7 @@ bool RNA_struct_idprops_check(StructRNA *srna) return (srna && srna->idproperties); } -static IDProperty *rna_idproperty_find(PointerRNA *ptr, const char *name) +IDProperty *rna_idproperty_find(PointerRNA *ptr, const char *name) { IDProperty *group = RNA_struct_idprops(ptr, 0); diff --git a/source/blender/makesrna/intern/rna_access_compare_override.c b/source/blender/makesrna/intern/rna_access_compare_override.c index b061c72157e..18fbe7886e9 100644 --- a/source/blender/makesrna/intern/rna_access_compare_override.c +++ b/source/blender/makesrna/intern/rna_access_compare_override.c @@ -400,9 +400,39 @@ static bool rna_property_override_operation_store(Main *bmain, return changed; } - BLI_assert(prop_local->override_store == prop_reference->override_store && - (!ptr_storage || prop_local->override_store == prop_storage->override_store) && - prop_local->override_store != NULL); + RNAPropOverrideStore override_store = NULL; + /* Special case for IDProps, we use default callback then. */ + if (prop_local->magic != RNA_MAGIC) { + override_store = rna_property_override_store_default; + if (prop_reference->magic == RNA_MAGIC && prop_reference->override_store != override_store) { + override_store = NULL; + } + } + else if (prop_reference->magic != RNA_MAGIC) { + override_store = rna_property_override_store_default; + if (prop_local->override_store != override_store) { + override_store = NULL; + } + } + else if (prop_local->override_store == prop_reference->override_store) { + override_store = prop_local->override_store; + } + + if (ptr_storage != NULL && prop_storage->magic == RNA_MAGIC && + prop_storage->override_store != override_store) { + override_store = NULL; + } + + if (override_store == NULL) { +#ifndef NDEBUG + printf("'%s' gives unmatching or NULL RNA store callbacks, should not happen (%d vs. %d).\n", + op->rna_path, + prop_local->magic == RNA_MAGIC, + prop_reference->magic == RNA_MAGIC); +#endif + BLI_assert(0); + return changed; + } for (IDOverrideLibraryPropertyOperation *opop = op->operations.first; opop; opop = opop->next) { /* Only needed for diff operations. */ @@ -413,17 +443,17 @@ static bool rna_property_override_operation_store(Main *bmain, continue; } - if (prop_local->override_store(bmain, - ptr_local, - ptr_reference, - ptr_storage, - prop_local, - prop_reference, - prop_storage, - len_local, - len_reference, - len_storage, - opop)) { + if (override_store(bmain, + ptr_local, + ptr_reference, + ptr_storage, + prop_local, + prop_reference, + prop_storage, + len_local, + len_reference, + len_storage, + opop)) { changed = true; } } @@ -595,6 +625,21 @@ bool RNA_struct_override_matches(Main *bmain, prop_local = rna_ensure_property_realdata(&prop_local, ptr_local); prop_reference = rna_ensure_property_realdata(&prop_reference, ptr_reference); + /* IDProps (custom properties) are even more of a PITA here, we cannot use + * `rna_ensure_property_realdata()` to deal with them, we have to use the path generated from + * `prop_local` (which is valid) to access to the actual reference counterpart... */ + if (prop_local != NULL && prop_local->magic != RNA_MAGIC && prop_local == prop_reference) { + /* We could also use (lower in this code, after rna_path has been computed): + * RNA_path_resolve_property(ptr_reference, rna_path, &some_rna_ptr, &prop_reference); + * But that would be much more costly, and would also fail when ptr_reference + * is not an ID pointer itself, so we'd need to rebuild it from its owner_id, then check that + * generated some_rna_ptr and ptr_reference do point to the same data, etc. + * For now, let's try that simple access, it won't cover all cases but should handle fine + * most basic custom properties situations. */ + prop_reference = (PropertyRNA *)rna_idproperty_find(ptr_reference, + ((IDProperty *)prop_local)->name); + } + if (ELEM(NULL, prop_local, prop_reference)) { continue; } diff --git a/source/blender/makesrna/intern/rna_access_internal.h b/source/blender/makesrna/intern/rna_access_internal.h index 28ec504e376..c7995746d08 100644 --- a/source/blender/makesrna/intern/rna_access_internal.h +++ b/source/blender/makesrna/intern/rna_access_internal.h @@ -30,5 +30,6 @@ struct IDProperty; PropertyRNA *rna_ensure_property(PropertyRNA *prop); void rna_idproperty_touch(struct IDProperty *idprop); +struct IDProperty *rna_idproperty_find(PointerRNA *ptr, const char *name); #endif /* __ACCESS_RNA_INTERNAL_H__ */ diff --git a/source/blender/makesrna/intern/rna_brush.c b/source/blender/makesrna/intern/rna_brush.c index d7bb941b266..57a3d889437 100644 --- a/source/blender/makesrna/intern/rna_brush.c +++ b/source/blender/makesrna/intern/rna_brush.c @@ -1452,81 +1452,77 @@ static void rna_def_brush(BlenderRNA *brna) PropertyRNA *prop; static const EnumPropertyItem prop_blend_items[] = { - {IMB_BLEND_MIX, "MIX", 0, "Mix", "Use mix blending mode while painting"}, + {IMB_BLEND_MIX, "MIX", 0, "Mix", "Use Mix blending mode while painting"}, {0, "", ICON_NONE, NULL, NULL}, - {IMB_BLEND_DARKEN, "DARKEN", 0, "Darken", "Use darken blending mode while painting"}, - {IMB_BLEND_MUL, "MUL", 0, "Multiply", "Use multiply blending mode while painting"}, + {IMB_BLEND_DARKEN, "DARKEN", 0, "Darken", "Use Darken blending mode while painting"}, + {IMB_BLEND_MUL, "MUL", 0, "Multiply", "Use Multiply blending mode while painting"}, {IMB_BLEND_COLORBURN, "COLORBURN", 0, - "Color burn", - "Use color burn blending mode while painting"}, + "Color Burn", + "Use Color Burn blending mode while painting"}, {IMB_BLEND_LINEARBURN, "LINEARBURN", 0, - "Linear burn", - "Use linear burn blending mode while painting"}, + "Linear Burn", + "Use Linear Burn blending mode while painting"}, {0, "", ICON_NONE, NULL, NULL}, - {IMB_BLEND_LIGHTEN, "LIGHTEN", 0, "Lighten", "Use lighten blending mode while painting"}, - {IMB_BLEND_SCREEN, "SCREEN", 0, "Screen", "Use screen blending mode while painting"}, + {IMB_BLEND_LIGHTEN, "LIGHTEN", 0, "Lighten", "Use Lighten blending mode while painting"}, + {IMB_BLEND_SCREEN, "SCREEN", 0, "Screen", "Use Screen blending mode while painting"}, {IMB_BLEND_COLORDODGE, "COLORDODGE", 0, - "Color dodge", - "Use color dodge blending mode while painting"}, - {IMB_BLEND_ADD, "ADD", 0, "Add", "Use add blending mode while painting"}, + "Color Dodge", + "Use Color Dodge blending mode while painting"}, + {IMB_BLEND_ADD, "ADD", 0, "Add", "Use Add blending mode while painting"}, {0, "", ICON_NONE, NULL, NULL}, - {IMB_BLEND_OVERLAY, "OVERLAY", 0, "Overlay", "Use overlay blending mode while painting"}, + {IMB_BLEND_OVERLAY, "OVERLAY", 0, "Overlay", "Use Overlay blending mode while painting"}, {IMB_BLEND_SOFTLIGHT, "SOFTLIGHT", 0, - "Soft light", - "Use softlight blending mode while painting"}, + "Soft Light", + "Use Soft Light blending mode while painting"}, {IMB_BLEND_HARDLIGHT, "HARDLIGHT", 0, - "Hard light", - "Use hard light blending mode while painting"}, + "Hard Light", + "Use Hard Light blending mode while painting"}, {IMB_BLEND_VIVIDLIGHT, "VIVIDLIGHT", 0, - "Vivid light", - "Use vividlight blending mode while painting"}, + "Vivid Light", + "Use Vivid Light blending mode while painting"}, {IMB_BLEND_LINEARLIGHT, "LINEARLIGHT", 0, - "Linear light", - "Use linearlight blending mode while painting"}, + "Linear Light", + "Use Linear Light blending mode while painting"}, {IMB_BLEND_PINLIGHT, "PINLIGHT", 0, - "Pin light", - "Use pinlight blending mode while painting"}, + "Pin Light", + "Use Pin Light blending mode while painting"}, {0, "", ICON_NONE, NULL, NULL}, {IMB_BLEND_DIFFERENCE, "DIFFERENCE", 0, "Difference", - "Use difference blending mode while painting"}, + "Use Difference blending mode while painting"}, {IMB_BLEND_EXCLUSION, "EXCLUSION", 0, "Exclusion", - "Use exclusion blending mode while painting"}, - {IMB_BLEND_SUB, "SUB", 0, "Subtract", "Use subtract blending mode while painting"}, + "Use Exclusion blending mode while painting"}, + {IMB_BLEND_SUB, "SUB", 0, "Subtract", "Use Subtract blending mode while painting"}, {0, "", ICON_NONE, NULL, NULL}, - {IMB_BLEND_HUE, "HUE", 0, "Hue", "Use hue blending mode while painting"}, + {IMB_BLEND_HUE, "HUE", 0, "Hue", "Use Hue blending mode while painting"}, {IMB_BLEND_SATURATION, "SATURATION", 0, "Saturation", - "Use saturation blending mode while painting"}, - {IMB_BLEND_COLOR, "COLOR", 0, "Color", "Use color blending mode while painting"}, - {IMB_BLEND_LUMINOSITY, - "LUMINOSITY", - 0, - "Luminosity", - "Use luminosity blending mode while painting"}, + "Use Saturation blending mode while painting"}, + {IMB_BLEND_COLOR, "COLOR", 0, "Color", "Use Color blending mode while painting"}, + {IMB_BLEND_LUMINOSITY, "LUMINOSITY", 0, "Value", "Use Value blending mode while painting"}, {0, "", ICON_NONE, NULL, NULL}, {IMB_BLEND_ERASE_ALPHA, "ERASE_ALPHA", 0, "Erase Alpha", "Erase alpha while painting"}, {IMB_BLEND_ADD_ALPHA, "ADD_ALPHA", 0, "Add Alpha", "Add alpha while painting"}, @@ -1610,15 +1606,11 @@ static void rna_def_brush(BlenderRNA *brna) }; static const EnumPropertyItem brush_elastic_deform_type_items[] = { - {BRUSH_ELASTIC_DEFORM_GRAB, "ELASTIC_DEFORM_GRAB", 0, "Grab", ""}, - {BRUSH_ELASTIC_DEFORM_GRAB_BISCALE, "ELASTIC_DEFORM_GRAB_BISCALE", 0, "Bi-scale Grab", ""}, - {BRUSH_ELASTIC_DEFORM_GRAB_TRISCALE, - "ELASTIC_DEFORM_GRAB_TRISCALE", - 0, - "Tri-scale Grab", - ""}, - {BRUSH_ELASTIC_DEFORM_SCALE, "ELASTIC_DEFORM_SCALE", 0, "Scale", ""}, - {BRUSH_ELASTIC_DEFORM_TWIST, "ELASTIC_DEFORM_TWIST", 0, "Twist", ""}, + {BRUSH_ELASTIC_DEFORM_GRAB, "GRAB", 0, "Grab", ""}, + {BRUSH_ELASTIC_DEFORM_GRAB_BISCALE, "GRAB_BISCALE", 0, "Bi-scale Grab", ""}, + {BRUSH_ELASTIC_DEFORM_GRAB_TRISCALE, "GRAB_TRISCALE", 0, "Tri-scale Grab", ""}, + {BRUSH_ELASTIC_DEFORM_SCALE, "SCALE", 0, "Scale", ""}, + {BRUSH_ELASTIC_DEFORM_TWIST, "TWIST", 0, "Twist", ""}, {0, NULL, 0, NULL, NULL}, }; @@ -1893,8 +1885,8 @@ static void rna_def_brush(BlenderRNA *brna) prop = RNA_def_property(srna, "normal_radius_factor", PROP_FLOAT, PROP_FACTOR); RNA_def_property_float_sdna(prop, NULL, "normal_radius_factor"); - RNA_def_property_range(prop, 0.0f, 1.0f); - RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.001, 3); + RNA_def_property_range(prop, 0.0f, 2.0f); + RNA_def_property_ui_range(prop, 0.0f, 2.0f, 0.001, 3); RNA_def_property_ui_text(prop, "Normal Radius", "Ratio between the brush radius and the radius that is going to be " @@ -1967,7 +1959,7 @@ static void rna_def_brush(BlenderRNA *brna) /* flag */ /* This is an enum but its unlikely we add other shapes, so expose as a boolean. */ prop = RNA_def_property(srna, "use_projected", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "falloff_shape", BRUSH_AIRBRUSH); + RNA_def_property_boolean_sdna(prop, NULL, "falloff_shape", PAINT_FALLOFF_SHAPE_TUBE); RNA_def_property_ui_text( prop, "2D Falloff", "Apply brush influence in 2D circle instead of a sphere"); RNA_def_property_update(prop, 0, "rna_Brush_update"); @@ -2419,7 +2411,7 @@ static void rna_def_operator_stroke_element(BlenderRNA *brna) prop = RNA_def_property(srna, "size", PROP_FLOAT, PROP_NONE); RNA_def_property_flag(prop, PROP_IDPROPERTY); RNA_def_property_range(prop, 0.0f, FLT_MAX); - RNA_def_property_ui_text(prop, "Brush Size", "Brush Size in screen space"); + RNA_def_property_ui_text(prop, "Brush Size", "Brush size in screen space"); prop = RNA_def_property(srna, "pen_flip", PROP_BOOLEAN, PROP_NONE); RNA_def_property_flag(prop, PROP_IDPROPERTY); diff --git a/source/blender/makesrna/intern/rna_depsgraph.c b/source/blender/makesrna/intern/rna_depsgraph.c index ebd9bd8e925..2072b07ecb3 100644 --- a/source/blender/makesrna/intern/rna_depsgraph.c +++ b/source/blender/makesrna/intern/rna_depsgraph.c @@ -261,8 +261,13 @@ static void rna_Depsgraph_debug_stats(Depsgraph *depsgraph, char *result) outer); } -static void rna_Depsgraph_update(Depsgraph *depsgraph, Main *bmain) +static void rna_Depsgraph_update(Depsgraph *depsgraph, Main *bmain, ReportList *reports) { + if (DEG_is_evaluating(depsgraph)) { + BKE_report(reports, RPT_ERROR, "Dependency graph update requested during evaluation"); + return; + } + # ifdef WITH_PYTHON /* Allow drivers to be evaluated */ BPy_BEGIN_ALLOW_THREADS; @@ -654,7 +659,7 @@ static void rna_def_depsgraph(BlenderRNA *brna) func, "Re-evaluate any modified data-blocks, for example for animation or modifiers. " "This invalidates all references to evaluated data-blocks from this dependency graph."); - RNA_def_function_flag(func, FUNC_USE_MAIN); + RNA_def_function_flag(func, FUNC_USE_MAIN | FUNC_USE_REPORTS); /* Queries for original datablockls (the ones depsgraph is built for). */ diff --git a/source/blender/makesrna/intern/rna_fcurve.c b/source/blender/makesrna/intern/rna_fcurve.c index 254f3bc3710..424bb4a492f 100644 --- a/source/blender/makesrna/intern/rna_fcurve.c +++ b/source/blender/makesrna/intern/rna_fcurve.c @@ -76,6 +76,22 @@ const EnumPropertyItem rna_enum_fmodifier_type_items[] = { {0, NULL, 0, NULL, NULL}, }; +const EnumPropertyItem rna_enum_fcurve_auto_smoothing_items[] = { + {FCURVE_SMOOTH_NONE, + "NONE", + 0, + "None", + "Automatic handles only take immediately adjacent keys into account"}, + {FCURVE_SMOOTH_CONT_ACCEL, + "CONT_ACCEL", + 0, + "Continuous Acceleration", + "Automatic handles are adjusted to avoid jumps in acceleration, resulting " + "in smoother curves. However, key changes may affect interpolation over a " + "larger stretch of the curve"}, + {0, NULL, 0, NULL, NULL}, +}; + const EnumPropertyItem rna_enum_beztriple_keyframe_type_items[] = { {BEZT_KEYTYPE_KEYFRAME, "KEYFRAME", @@ -2258,19 +2274,6 @@ static void rna_def_fcurve(BlenderRNA *brna) "Use custom hand-picked color for F-Curve"}, {0, NULL, 0, NULL, NULL}, }; - static EnumPropertyItem prop_mode_smoothing_items[] = { - {FCURVE_SMOOTH_NONE, - "NONE", - 0, - "None", - "Auto handles only take adjacent keys into account (legacy mode)"}, - {FCURVE_SMOOTH_CONT_ACCEL, - "CONT_ACCEL", - 0, - "Continuous Acceleration", - "Auto handles are placed to avoid jumps in acceleration"}, - {0, NULL, 0, NULL, NULL}, - }; srna = RNA_def_struct(brna, "FCurve", NULL); RNA_def_struct_ui_text(srna, "F-Curve", "F-Curve defining values of a period of time"); @@ -2350,7 +2353,7 @@ static void rna_def_fcurve(BlenderRNA *brna) RNA_def_property_update(prop, NC_SPACE | ND_SPACE_GRAPH, NULL); prop = RNA_def_property(srna, "auto_smoothing", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_items(prop, prop_mode_smoothing_items); + RNA_def_property_enum_items(prop, rna_enum_fcurve_auto_smoothing_items); RNA_def_property_ui_text( prop, "Auto Handle Smoothing", "Algorithm used to compute automatic handles"); RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_FCurve_update_data"); diff --git a/source/blender/makesrna/intern/rna_gpencil.c b/source/blender/makesrna/intern/rna_gpencil.c index 3ad18fcc7a3..2601600c6ee 100644 --- a/source/blender/makesrna/intern/rna_gpencil.c +++ b/source/blender/makesrna/intern/rna_gpencil.c @@ -1457,6 +1457,12 @@ static void rna_def_gpencil_layer(BlenderRNA *brna) prop, "Solo Mode", "In Paint mode display only layers with keyframe in current frame"); RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update"); + /* Layer is used as Ruler. */ + prop = RNA_def_property(srna, "is_ruler", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_LAYER_IS_RULER); + RNA_def_property_ui_text(prop, "Ruler", "This is a special ruler layer"); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + /* exposed as layers.active */ # if 0 prop = RNA_def_property(srna, "active", PROP_BOOLEAN, PROP_NONE); diff --git a/source/blender/makesrna/intern/rna_layer.c b/source/blender/makesrna/intern/rna_layer.c index bab7375f01b..40c6229f9b1 100644 --- a/source/blender/makesrna/intern/rna_layer.c +++ b/source/blender/makesrna/intern/rna_layer.c @@ -123,18 +123,13 @@ static IDProperty *rna_ViewLayer_idprops(PointerRNA *ptr, bool create) static bool rna_LayerCollection_visible_get(LayerCollection *layer_collection, bContext *C) { View3D *v3d = CTX_wm_view3d(C); - const bool runtime_visible = (layer_collection->runtime_flag & LAYER_COLLECTION_VISIBLE) != 0; - if (v3d == NULL) { - return runtime_visible; - } - - if ((v3d->flag & V3D_LOCAL_COLLECTIONS) == 0) { - return runtime_visible; + if ((v3d == NULL) || ((v3d->flag & V3D_LOCAL_COLLECTIONS) == 0)) { + return (layer_collection->runtime_flag & LAYER_COLLECTION_VISIBLE_VIEW_LAYER) != 0; } if (v3d->local_collections_uuid & layer_collection->local_collections_bits) { - return true; + return (layer_collection->runtime_flag & LAYER_COLLECTION_RESTRICT_VIEWPORT) == 0; } return false; @@ -192,15 +187,24 @@ static void rna_LayerObjects_selected_begin(CollectionPropertyIterator *iter, Po iter, &view_layer->object_bases, rna_ViewLayer_objects_selected_skip); } -static void rna_ViewLayer_update_tagged(ID *id_ptr, ViewLayer *view_layer, Main *bmain) +static void rna_ViewLayer_update_tagged(ID *id_ptr, + ViewLayer *view_layer, + Main *bmain, + ReportList *reports) { + Scene *scene = (Scene *)id_ptr; + Depsgraph *depsgraph = BKE_scene_get_depsgraph(bmain, scene, view_layer, true); + + if (DEG_is_evaluating(depsgraph)) { + BKE_report(reports, RPT_ERROR, "Dependency graph update requested during evaluation"); + return; + } + # ifdef WITH_PYTHON /* Allow drivers to be evaluated */ BPy_BEGIN_ALLOW_THREADS; # endif - Scene *scene = (Scene *)id_ptr; - Depsgraph *depsgraph = BKE_scene_get_depsgraph(bmain, scene, view_layer, true); /* NOTE: This is similar to CTX_data_depsgraph_pointer(). Ideally such access would be * de-duplicated across all possible cases, but for now this is safest and easiest way to go. * @@ -415,12 +419,12 @@ static void rna_def_layer_collection(BlenderRNA *brna) /* Run-time flags. */ prop = RNA_def_property(srna, "is_visible", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "runtime_flag", LAYER_COLLECTION_VISIBLE); + RNA_def_property_boolean_sdna(prop, NULL, "runtime_flag", LAYER_COLLECTION_VISIBLE_VIEW_LAYER); RNA_def_property_clear_flag(prop, PROP_EDITABLE); - RNA_def_property_ui_text( - prop, - "Visible", - "Whether this collection is visible, take into account the collection parent"); + RNA_def_property_ui_text(prop, + "Visible", + "Whether this collection is visible for the viewlayer, take into " + "account the collection parent"); func = RNA_def_function(srna, "has_objects", "rna_LayerCollection_has_objects"); RNA_def_function_ui_description(func, ""); @@ -573,7 +577,7 @@ void RNA_def_view_layer(BlenderRNA *brna) /* debug update routine */ func = RNA_def_function(srna, "update", "rna_ViewLayer_update_tagged"); - RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_MAIN); + RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_MAIN | FUNC_USE_REPORTS); RNA_def_function_ui_description( func, "Update data tagged to be updated from previous access to data or operators"); diff --git a/source/blender/makesrna/intern/rna_main_api.c b/source/blender/makesrna/intern/rna_main_api.c index fec991e16da..2c42dba9131 100644 --- a/source/blender/makesrna/intern/rna_main_api.c +++ b/source/blender/makesrna/intern/rna_main_api.c @@ -461,8 +461,6 @@ static VFont *rna_Main_fonts_load(Main *bmain, "Cannot read '%s': %s", filepath, errno ? strerror(errno) : TIP_("unsupported font format")); - - id_us_min((ID *)font); } return font; } diff --git a/source/blender/makesrna/intern/rna_material.c b/source/blender/makesrna/intern/rna_material.c index 9da17c5f0b1..a29031900ac 100644 --- a/source/blender/makesrna/intern/rna_material.c +++ b/source/blender/makesrna/intern/rna_material.c @@ -41,7 +41,7 @@ const EnumPropertyItem rna_enum_ramp_blend_items[] = { {0, "", ICON_NONE, NULL, NULL}, {MA_RAMP_LIGHT, "LIGHTEN", 0, "Lighten", ""}, {MA_RAMP_SCREEN, "SCREEN", 0, "Screen", ""}, - {MA_RAMP_DODGE, "DODGE", 0, "Dodge", ""}, + {MA_RAMP_DODGE, "DODGE", 0, "Color Dodge", ""}, {MA_RAMP_ADD, "ADD", 0, "Add", ""}, {0, "", ICON_NONE, NULL, NULL}, {MA_RAMP_OVERLAY, "OVERLAY", 0, "Overlay", ""}, diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c index 48562cf2684..287c7502c41 100644 --- a/source/blender/makesrna/intern/rna_nodetree.c +++ b/source/blender/makesrna/intern/rna_nodetree.c @@ -3986,7 +3986,7 @@ static void def_mix_rgb(StructRNA *srna) prop = RNA_def_property(srna, "blend_type", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "custom1"); RNA_def_property_enum_items(prop, rna_enum_ramp_blend_items); - RNA_def_property_ui_text(prop, "Blend Type", ""); + RNA_def_property_ui_text(prop, "Blending Mode", ""); RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update"); prop = RNA_def_property(srna, "use_alpha", PROP_BOOLEAN, PROP_NONE); diff --git a/source/blender/makesrna/intern/rna_object_api.c b/source/blender/makesrna/intern/rna_object_api.c index 56d25f5bebf..babf388bfc7 100644 --- a/source/blender/makesrna/intern/rna_object_api.c +++ b/source/blender/makesrna/intern/rna_object_api.c @@ -70,6 +70,7 @@ static const EnumPropertyItem space_items[] = { # include "BKE_customdata.h" # include "BKE_font.h" # include "BKE_global.h" +# include "BKE_layer.h" # include "BKE_main.h" # include "BKE_mesh.h" # include "BKE_mball.h" @@ -283,6 +284,11 @@ static void rna_Object_local_view_set(Object *ob, } } +static bool rna_Object_visible_in_viewport_get(Object *ob, View3D *v3d) +{ + return BKE_object_is_visible_in_viewport(v3d, ob); +} + /* Convert a given matrix from a space to another (using the object and/or a bone as * reference). */ static void rna_Object_mat_convert_space(Object *ob, @@ -825,6 +831,15 @@ void RNA_api_object(StructRNA *srna) parm = RNA_def_boolean(func, "state", 0, "", "Local view state to define"); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); + /* Viewport */ + func = RNA_def_function(srna, "visible_in_viewport_get", "rna_Object_visible_in_viewport_get"); + RNA_def_function_ui_description( + func, "Check for local view and local collections for this viewport and object"); + parm = RNA_def_pointer(func, "viewport", "SpaceView3D", "", "Viewport in local collections"); + RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); + parm = RNA_def_boolean(func, "result", 0, "", "Object viewport visibility"); + RNA_def_function_return(func, parm); + /* Matrix space conversion */ func = RNA_def_function(srna, "convert_space", "rna_Object_mat_convert_space"); RNA_def_function_ui_description( diff --git a/source/blender/makesrna/intern/rna_pose.c b/source/blender/makesrna/intern/rna_pose.c index 0f8f8d39c41..8c4b7dd52d9 100644 --- a/source/blender/makesrna/intern/rna_pose.c +++ b/source/blender/makesrna/intern/rna_pose.c @@ -648,7 +648,7 @@ bool rna_PoseChannel_constraints_override_apply(Main *UNUSED(bmain), /* Remember that insertion operations are defined and stored in correct order, which means that * even if we insert several items in a row, we always insert first one, then second one, etc. - * So we should always find 'anchor' constraint in both _src *and* _dst> */ + * So we should always find 'anchor' constraint in both _src *and* _dst */ bConstraint *con_anchor = NULL; if (opop->subitem_local_name && opop->subitem_local_name[0]) { con_anchor = BLI_findstring( @@ -669,7 +669,11 @@ bool rna_PoseChannel_constraints_override_apply(Main *UNUSED(bmain), } con_src = con_src ? con_src->next : pchan_src->constraints.first; - BLI_assert(con_src != NULL); + if (con_src == NULL) { + printf("%s: Could not find constraint to insert, doing nothing...\n", __func__); + BLI_assert(0); + return false; + } bConstraint *con_dst = BKE_constraint_duplicate_ex(con_src, 0, true); diff --git a/source/blender/makesrna/intern/rna_rna.c b/source/blender/makesrna/intern/rna_rna.c index 26c8df4c7bb..4db702b215f 100644 --- a/source/blender/makesrna/intern/rna_rna.c +++ b/source/blender/makesrna/intern/rna_rna.c @@ -1157,20 +1157,21 @@ static bool rna_property_override_diff_propptr_validate_diffing(PointerRNA *prop *r_is_id = *r_is_null = *r_is_type_diff = false; /* Beware, PointerRNA_NULL has no type and is considered a 'blank page'! */ - if (propptr_a->type == NULL) { - if (propptr_b == NULL || propptr_b->type == NULL) { + if (ELEM(NULL, propptr_a->type, propptr_a->data)) { + if (ELEM(NULL, propptr_b, propptr_b->type, propptr_b->data)) { *r_is_null = true; } else { *r_is_id = RNA_struct_is_ID(propptr_b->type); *r_is_null = true; - *r_is_type_diff = true; + *r_is_type_diff = propptr_a->type != propptr_b->type; } is_valid_for_diffing = false; } else { *r_is_id = RNA_struct_is_ID(propptr_a->type); - *r_is_null = *r_is_type_diff = (ELEM(NULL, propptr_b, propptr_b->type)); + *r_is_null = (ELEM(NULL, propptr_b, propptr_b->type, propptr_b->data)); + *r_is_type_diff = (propptr_b == NULL || propptr_b->type != propptr_a->type); is_valid_for_diffing = !(*r_is_id || *r_is_null); } diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index 1f967df7232..ef97b184491 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -5683,7 +5683,8 @@ static void rna_def_scene_render_data(BlenderRNA *brna) RNA_def_property_float_sdna(prop, NULL, "frs_sec_base"); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_range(prop, 1e-5f, 1e6f); - RNA_def_property_ui_range(prop, 0.1f, 120.0f, 2, -1); + /* Important to show at least 3 decimal points because multiple presets set this to 1.001. */ + RNA_def_property_ui_range(prop, 0.1f, 120.0f, 2, 3); RNA_def_property_ui_text(prop, "FPS Base", "Framerate base"); RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_fps_update"); diff --git a/source/blender/makesrna/intern/rna_scene_api.c b/source/blender/makesrna/intern/rna_scene_api.c index 2b1b23a40f4..8a06d594c1f 100644 --- a/source/blender/makesrna/intern/rna_scene_api.c +++ b/source/blender/makesrna/intern/rna_scene_api.c @@ -88,7 +88,11 @@ static void rna_Scene_frame_set(Scene *scene, Main *bmain, int frame, float subf BPy_END_ALLOW_THREADS; # endif - BKE_scene_camera_switch_update(scene); + if (BKE_scene_camera_switch_update(scene)) { + for (bScreen *sc = bmain->screens.first; sc; sc = sc->id.next) { + BKE_screen_view3d_scene_sync(sc, scene); + } + } /* don't do notifier when we're rendering, avoid some viewport crashes * redrawing while the data is being modified for render */ diff --git a/source/blender/makesrna/intern/rna_screen.c b/source/blender/makesrna/intern/rna_screen.c index 728ef3fb706..1637f8cfed5 100644 --- a/source/blender/makesrna/intern/rna_screen.c +++ b/source/blender/makesrna/intern/rna_screen.c @@ -272,7 +272,7 @@ static void rna_Area_ui_type_update(bContext *C, PointerRNA *ptr) sa->butspacetype_subtype = 0; } -static void rna_View2D_region_to_view(struct View2D *v2d, int x, int y, float result[2]) +static void rna_View2D_region_to_view(struct View2D *v2d, float x, float y, float result[2]) { UI_view2d_region_to_view(v2d, x, y, &result[0], &result[1]); } @@ -406,9 +406,9 @@ static void rna_def_view2d_api(StructRNA *srna) func = RNA_def_function(srna, "region_to_view", "rna_View2D_region_to_view"); RNA_def_function_ui_description(func, "Transform region coordinates to 2D view"); - parm = RNA_def_int(func, "x", 0, INT_MIN, INT_MAX, "x", "Region x coordinate", -10000, 10000); + parm = RNA_def_float(func, "x", 0, -FLT_MAX, FLT_MAX, "x", "Region x coordinate", -10000, 10000); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); - parm = RNA_def_int(func, "y", 0, INT_MIN, INT_MAX, "y", "Region y coordinate", -10000, 10000); + parm = RNA_def_float(func, "y", 0, -FLT_MAX, FLT_MAX, "y", "Region y coordinate", -10000, 10000); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); parm = RNA_def_float_array(func, "result", diff --git a/source/blender/makesrna/intern/rna_sequencer.c b/source/blender/makesrna/intern/rna_sequencer.c index dc0cc0482aa..31ead989f25 100644 --- a/source/blender/makesrna/intern/rna_sequencer.c +++ b/source/blender/makesrna/intern/rna_sequencer.c @@ -1462,7 +1462,7 @@ static const EnumPropertyItem blend_mode_items[] = { {0, "", ICON_NONE, NULL, NULL}, {SEQ_TYPE_LIGHTEN, "LIGHTEN", 0, "Lighten", ""}, {SEQ_TYPE_SCREEN, "SCREEN", 0, "Screen", ""}, - {SEQ_TYPE_DODGE, "DODGE", 0, "Dodge", ""}, + {SEQ_TYPE_DODGE, "DODGE", 0, "Color Dodge", ""}, {SEQ_TYPE_ADD, "ADD", 0, "Add", ""}, {0, "", ICON_NONE, NULL, NULL}, {SEQ_TYPE_OVERLAY, "OVERLAY", 0, "Overlay", ""}, @@ -1723,7 +1723,7 @@ static void rna_def_sequence(BlenderRNA *brna) RNA_def_property_enum_sdna(prop, NULL, "blend_mode"); RNA_def_property_enum_items(prop, blend_mode_items); RNA_def_property_ui_text( - prop, "Blend Mode", "Method for controlling how the strip combines with other strips"); + prop, "Blending Mode", "Method for controlling how the strip combines with other strips"); RNA_def_property_update( prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_invalidate_preprocessed_update"); @@ -2225,7 +2225,7 @@ static void rna_def_scene(BlenderRNA *brna) RNA_def_struct_sdna(srna, "Sequence"); prop = RNA_def_property(srna, "scene", PROP_POINTER, PROP_NONE); - RNA_def_property_flag(prop, PROP_EDITABLE); + RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK); RNA_def_property_ui_text(prop, "Scene", "Scene that this sequence uses"); RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_invalidate_raw_update"); @@ -2785,27 +2785,31 @@ static void rna_def_text(StructRNA *srna) static void rna_def_color_mix(StructRNA *srna) { static EnumPropertyItem blend_color_items[] = { - {SEQ_TYPE_ADD, "ADD", 0, "Add", ""}, - {SEQ_TYPE_SUB, "SUBTRACT", 0, "Subtract", ""}, + {SEQ_TYPE_DARKEN, "DARKEN", 0, "Darken", ""}, {SEQ_TYPE_MUL, "MULTIPLY", 0, "Multiply", ""}, + {SEQ_TYPE_COLOR_BURN, "BURN", 0, "Color Burn", ""}, + {SEQ_TYPE_LINEAR_BURN, "LINEAR_BURN", 0, "Linear Burn", ""}, + {0, "", ICON_NONE, NULL, NULL}, {SEQ_TYPE_LIGHTEN, "LIGHTEN", 0, "Lighten", ""}, - {SEQ_TYPE_DARKEN, "DARKEN", 0, "Darken", ""}, {SEQ_TYPE_SCREEN, "SCREEN", 0, "Screen", ""}, + {SEQ_TYPE_DODGE, "DODGE", 0, "Color Dodge", ""}, + {SEQ_TYPE_ADD, "ADD", 0, "Add", ""}, + {0, "", ICON_NONE, NULL, NULL}, {SEQ_TYPE_OVERLAY, "OVERLAY", 0, "Overlay", ""}, - {SEQ_TYPE_DODGE, "DODGE", 0, "Dodge", ""}, - {SEQ_TYPE_COLOR_BURN, "BURN", 0, "Color Burn", ""}, - {SEQ_TYPE_LINEAR_BURN, "LINEAR_BURN", 0, "Linear Burn", ""}, {SEQ_TYPE_SOFT_LIGHT, "SOFT_LIGHT", 0, "Soft Light", ""}, {SEQ_TYPE_HARD_LIGHT, "HARD_LIGHT", 0, "Hard Light", ""}, - {SEQ_TYPE_PIN_LIGHT, "PIN_LIGHT", 0, "Pin Light", ""}, - {SEQ_TYPE_LIN_LIGHT, "LINEAR_LIGHT", 0, "Linear Light", ""}, {SEQ_TYPE_VIVID_LIGHT, "VIVID_LIGHT", 0, "Vivid Light", ""}, - {SEQ_TYPE_BLEND_COLOR, "COLOR", 0, "Color", ""}, + {SEQ_TYPE_LIN_LIGHT, "LINEAR_LIGHT", 0, "Linear Light", ""}, + {SEQ_TYPE_PIN_LIGHT, "PIN_LIGHT", 0, "Pin Light", ""}, + {0, "", ICON_NONE, NULL, NULL}, + {SEQ_TYPE_DIFFERENCE, "DIFFERENCE", 0, "Difference", ""}, + {SEQ_TYPE_EXCLUSION, "EXCLUSION", 0, "Exclusion", ""}, + {SEQ_TYPE_SUB, "SUBTRACT", 0, "Subtract", ""}, + {0, "", ICON_NONE, NULL, NULL}, {SEQ_TYPE_HUE, "HUE", 0, "Hue", ""}, {SEQ_TYPE_SATURATION, "SATURATION", 0, "Saturation", ""}, + {SEQ_TYPE_BLEND_COLOR, "COLOR", 0, "Color", ""}, {SEQ_TYPE_VALUE, "VALUE", 0, "Value", ""}, - {SEQ_TYPE_DIFFERENCE, "DIFFERENCE", 0, "Difference", ""}, - {SEQ_TYPE_EXCLUSION, "EXCLUSION", 0, "Exclusion", ""}, {0, NULL, 0, NULL, NULL}, }; @@ -2817,7 +2821,7 @@ static void rna_def_color_mix(StructRNA *srna) RNA_def_property_enum_sdna(prop, NULL, "blend_effect"); RNA_def_property_enum_items(prop, blend_color_items); RNA_def_property_ui_text( - prop, "Blend Effect", "Method for controlling how the strip combines with other strips"); + prop, "Blending Mode", "Method for controlling how the strip combines with other strips"); RNA_def_property_update( prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_invalidate_preprocessed_update"); diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index 56ba6403596..1b2adfd28c6 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -589,7 +589,7 @@ static void rna_Space_bool_from_region_flag_set_by_type(PointerRNA *ptr, { ScrArea *sa = rna_area_from_space(ptr); ARegion *ar = BKE_area_find_region_type(sa, region_type); - if (ar) { + if (ar && (ar->alignment != RGN_ALIGN_NONE)) { SET_FLAG_FROM_TEST(ar->flag, value, region_flag); } ED_region_tag_redraw(ar); @@ -787,13 +787,18 @@ static void rna_Space_view2d_sync_update(Main *UNUSED(bmain), static void rna_GPencil_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *UNUSED(ptr)) { + bool changed = false; /* need set all caches as dirty to recalculate onion skinning */ for (Object *ob = bmain->objects.first; ob; ob = ob->id.next) { if (ob->type == OB_GPENCIL) { - DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY); + bGPdata *gpd = (bGPdata *)ob->data; + DEG_id_tag_update(&gpd->id, ID_RECALC_GEOMETRY); + changed = true; } } - WM_main_add_notifier(NC_GPENCIL | NA_EDITED, NULL); + if (changed) { + WM_main_add_notifier(NC_GPENCIL | NA_EDITED, NULL); + } } /* Space 3D View */ @@ -1105,7 +1110,7 @@ static const EnumPropertyItem *rna_View3DShading_color_type_itemf(bContext *UNUS } else { /* Solid mode, or lookdev mode for workbench engine. */ - r_free = false; + *r_free = false; return rna_enum_shading_color_type_items; } } diff --git a/source/blender/makesrna/intern/rna_text.c b/source/blender/makesrna/intern/rna_text.c index 64a23dfa985..778e817c73e 100644 --- a/source/blender/makesrna/intern/rna_text.c +++ b/source/blender/makesrna/intern/rna_text.c @@ -87,8 +87,60 @@ static int rna_Text_current_line_index_get(PointerRNA *ptr) static void rna_Text_current_line_index_set(PointerRNA *ptr, int value) { - Text *text = (Text *)ptr->data; - txt_move_toline(text, value, 0); + Text *text = ptr->data; + TextLine *line = BLI_findlink(&text->lines, value); + if (line == NULL) { + line = text->lines.last; + } + text->curl = line; + text->curc = 0; +} + +static int rna_Text_select_end_line_index_get(PointerRNA *ptr) +{ + Text *text = ptr->data; + return BLI_findindex(&text->lines, text->sell); +} + +static void rna_Text_select_end_line_index_set(PointerRNA *ptr, int value) +{ + Text *text = ptr->data; + TextLine *line = BLI_findlink(&text->lines, value); + if (line == NULL) { + line = text->lines.last; + } + text->sell = line; + text->selc = 0; +} + +static int rna_Text_current_character_get(PointerRNA *ptr) +{ + Text *text = ptr->data; + return BLI_str_utf8_offset_to_index(text->curl->line, text->curc); +} + +static void rna_Text_current_character_set(PointerRNA *ptr, int index) +{ + Text *text = ptr->data; + TextLine *line = text->curl; + const int len_utf8 = BLI_strlen_utf8(line->line); + CLAMP_MAX(index, len_utf8); + text->curc = BLI_str_utf8_offset_from_index(line->line, index); +} + +static int rna_Text_select_end_character_get(PointerRNA *ptr) +{ + Text *text = ptr->data; + return BLI_str_utf8_offset_to_index(text->sell->line, text->selc); +} + +static void rna_Text_select_end_character_set(PointerRNA *ptr, int index) +{ + Text *text = ptr->data; + TextLine *line = text->sell; + const int len_utf8 = BLI_strlen_utf8(line->line); + CLAMP_MAX(index, len_utf8); + text->selc = BLI_str_utf8_offset_from_index(line->line, index); } static void rna_TextLine_body_get(PointerRNA *ptr, char *value) @@ -209,12 +261,14 @@ static void rna_def_text(BlenderRNA *brna) prop, "Current Line", "Current line, and start line of selection if one exists"); prop = RNA_def_property(srna, "current_character", PROP_INT, PROP_UNSIGNED); - RNA_def_property_int_sdna(prop, NULL, "curc"); - RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_range(prop, 0, INT_MAX); RNA_def_property_ui_text(prop, "Current Character", "Index of current character in current line, and also start index of " "character in selection if one exists"); + RNA_def_property_int_funcs( + prop, "rna_Text_current_character_get", "rna_Text_current_character_set", NULL); + RNA_def_property_update(prop, NC_TEXT | ND_CURSOR, NULL); prop = RNA_def_property(srna, "current_line_index", PROP_INT, PROP_NONE); RNA_def_property_int_funcs( @@ -230,12 +284,20 @@ static void rna_def_text(BlenderRNA *brna) RNA_def_property_struct_type(prop, "TextLine"); RNA_def_property_ui_text(prop, "Selection End Line", "End line of selection"); + prop = RNA_def_property(srna, "select_end_line_index", PROP_INT, PROP_NONE); + RNA_def_property_int_funcs( + prop, "rna_Text_select_end_line_index_get", "rna_Text_select_end_line_index_set", NULL); + RNA_def_property_ui_text(prop, "Select End Line Index", "Index of last TextLine in selection"); + RNA_def_property_update(prop, NC_TEXT | ND_CURSOR, NULL); + prop = RNA_def_property(srna, "select_end_character", PROP_INT, PROP_UNSIGNED); - RNA_def_property_int_sdna(prop, NULL, "selc"); - RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_range(prop, 0, INT_MAX); RNA_def_property_ui_text(prop, "Selection End Character", "Index of character after end of selection in the selection end line"); + RNA_def_property_int_funcs( + prop, "rna_Text_select_end_character_get", "rna_Text_select_end_character_set", NULL); + RNA_def_property_update(prop, NC_TEXT | ND_CURSOR, NULL); RNA_api_text(srna); } diff --git a/source/blender/makesrna/intern/rna_text_api.c b/source/blender/makesrna/intern/rna_text_api.c index 524dcfa9ad7..000076eccec 100644 --- a/source/blender/makesrna/intern/rna_text_api.c +++ b/source/blender/makesrna/intern/rna_text_api.c @@ -46,6 +46,18 @@ static void rna_Text_write(Text *text, const char *str) WM_main_add_notifier(NC_TEXT | NA_EDITED, text); } +static void rna_Text_select_set(Text *text, int startl, int startc, int endl, int endc) +{ + txt_sel_set(text, startl, startc, endl, endc); + WM_main_add_notifier(NC_TEXT | NA_EDITED, text); +} + +static void rna_Text_cursor_set(Text *text, int line, int ch, bool select) +{ + txt_move_to(text, line, ch, select); + WM_main_add_notifier(NC_TEXT | NA_EDITED, text); +} + #else void RNA_api_text(StructRNA *srna) @@ -69,6 +81,25 @@ void RNA_api_text(StructRNA *srna) RNA_def_function_ui_description(func, "Returns True if the editor supports syntax highlighting " "for the current text datablock"); + + func = RNA_def_function(srna, "select_set", "rna_Text_select_set"); + RNA_def_function_ui_description(func, "Set selection range by line and character index"); + parm = RNA_def_int(func, "line_start", 0, INT_MIN, INT_MAX, "Start Line", "", INT_MIN, INT_MAX); + RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); + parm = RNA_def_int( + func, "char_start", 0, INT_MIN, INT_MAX, "Start Character", "", INT_MIN, INT_MAX); + RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); + parm = RNA_def_int(func, "line_end", 0, INT_MIN, INT_MAX, "End Line", "", INT_MIN, INT_MAX); + RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); + parm = RNA_def_int(func, "char_end", 0, INT_MIN, INT_MAX, "End Character", "", INT_MIN, INT_MAX); + RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); + + func = RNA_def_function(srna, "cursor_set", "rna_Text_cursor_set"); + RNA_def_function_ui_description(func, "Set cursor by line and (optionally) character index"); + parm = RNA_def_int(func, "line", 0, 0, INT_MAX, "Line", "", 0, INT_MAX); + RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); + parm = RNA_def_int(func, "character", 0, 0, INT_MAX, "Character", "", 0, INT_MAX); + RNA_def_boolean(func, "select", false, "", "Select when moving the cursor"); } #endif diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c index c9b6f46ab04..07ce07710b1 100644 --- a/source/blender/makesrna/intern/rna_userdef.c +++ b/source/blender/makesrna/intern/rna_userdef.c @@ -424,6 +424,17 @@ static void rna_userdef_timecode_style_set(PointerRNA *ptr, int value) } } +static int rna_UserDef_mouse_emulate_3_button_modifier_get(PointerRNA *ptr) +{ +# if !defined(WIN32) + UserDef *userdef = ptr->data; + return userdef->mouse_emulate_3_button_modifier; +# else + UNUSED_VARS(ptr); + return USER_EMU_MMB_MOD_ALT; +# endif +} + static PointerRNA rna_UserDef_view_get(PointerRNA *ptr) { return rna_pointer_inherit_refine(ptr, &RNA_PreferencesView, ptr->data); @@ -3190,6 +3201,18 @@ static void rna_def_userdef_theme_space_nla(BlenderRNA *brna) RNA_def_property_ui_text(prop, "View Sliders", ""); RNA_def_property_update(prop, 0, "rna_userdef_theme_update"); + prop = RNA_def_property(srna, "dopesheet_channel", PROP_FLOAT, PROP_COLOR_GAMMA); + RNA_def_property_float_sdna(prop, NULL, "ds_channel"); + RNA_def_property_array(prop, 3); + RNA_def_property_ui_text(prop, "Channel", "Nonlinear Animation Channel"); + RNA_def_property_update(prop, 0, "rna_userdef_theme_update"); + + prop = RNA_def_property(srna, "nla_track", PROP_FLOAT, PROP_COLOR_GAMMA); + RNA_def_property_float_sdna(prop, NULL, "nla_track"); + RNA_def_property_array(prop, 3); + RNA_def_property_ui_text(prop, "Track", "Nonlinear Animation Track"); + RNA_def_property_update(prop, 0, "rna_userdef_theme_update"); + prop = RNA_def_property(srna, "active_action", PROP_FLOAT, PROP_COLOR_GAMMA); RNA_def_property_float_sdna(prop, NULL, "anim_active"); RNA_def_property_array(prop, 4); @@ -4634,6 +4657,13 @@ static void rna_def_userdef_edit(BlenderRNA *brna) "Color for newly added transformation F-Curves (Location, Rotation, Scale) " "and also Color is based on the transform axis"); + prop = RNA_def_property(srna, "fcurve_new_auto_smoothing", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_items(prop, rna_enum_fcurve_auto_smoothing_items); + RNA_def_property_enum_sdna(prop, NULL, "auto_smoothing_new"); + RNA_def_property_ui_text(prop, + "New Curve Smoothing Mode", + "Auto Handle Smoothing mode used for newly added F-Curves"); + prop = RNA_def_property(srna, "keyframe_new_interpolation_type", PROP_ENUM, PROP_NONE); RNA_def_property_enum_items(prop, rna_enum_beztriple_interpolation_mode_items); RNA_def_property_enum_sdna(prop, NULL, "ipo_new"); @@ -5487,6 +5517,21 @@ static void rna_def_userdef_input(BlenderRNA *brna) RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); RNA_def_property_update(prop, 0, "rna_userdef_keyconfig_reload_update"); + static const EnumPropertyItem mouse_emulate_3_button_modifier[] = { + {USER_EMU_MMB_MOD_ALT, "ALT", 0, "Alt", ""}, + {USER_EMU_MMB_MOD_OSKEY, "OSKEY", 0, "OS-Key", ""}, + {0, NULL, 0, NULL, NULL}, + }; + + prop = RNA_def_property(srna, "mouse_emulate_3_button_modifier", PROP_ENUM, PROP_NONE); + /* Only needed because of WIN32 inability to support the option. */ + RNA_def_property_enum_funcs(prop, "rna_UserDef_mouse_emulate_3_button_modifier_get", NULL, NULL); + RNA_def_property_enum_items(prop, mouse_emulate_3_button_modifier); + RNA_def_property_ui_text( + prop, "Emulate 3 Button Modifier", "Hold this modifier to emulate the middle mouse button"); + RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); + RNA_def_property_update(prop, 0, "rna_userdef_keyconfig_reload_update"); + prop = RNA_def_property(srna, "use_emulate_numpad", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", USER_NONUMPAD); RNA_def_property_ui_text( diff --git a/source/blender/makesrna/intern/rna_workspace_api.c b/source/blender/makesrna/intern/rna_workspace_api.c index b8c6a25ace8..f22c86b3ff2 100644 --- a/source/blender/makesrna/intern/rna_workspace_api.c +++ b/source/blender/makesrna/intern/rna_workspace_api.c @@ -110,7 +110,7 @@ void RNA_api_workspace(StructRNA *srna) FunctionRNA *func; PropertyRNA *parm; - func = RNA_def_function(srna, "status_text_set", "ED_workspace_status_text"); + func = RNA_def_function(srna, "status_text_set_internal", "ED_workspace_status_text"); RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_USE_CONTEXT); RNA_def_function_ui_description( func, "Set the status bar text, typically key shortcuts for modal operators"); |