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

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoseph Eagar <joeedh@gmail.com>2022-03-30 21:32:28 +0300
committerJoseph Eagar <joeedh@gmail.com>2022-03-30 21:32:28 +0300
commit2e3fdeed94f32e100921e610c7c99e5d1a5bf727 (patch)
tree073046140af7353737b70601f176cd0148510d0f /source/blender/makesrna/intern
parent4e794686a934cc5245bee652246ac3af2bd72cac (diff)
parent84fde382e43cff6407bfa3587fec9bd570cf9123 (diff)
Merge remote-tracking branch 'origin/master' into temp-sculpt-colors
Diffstat (limited to 'source/blender/makesrna/intern')
-rw-r--r--source/blender/makesrna/intern/rna_ID.c25
-rw-r--r--source/blender/makesrna/intern/rna_access.c44
-rw-r--r--source/blender/makesrna/intern/rna_gpencil.c4
-rw-r--r--source/blender/makesrna/intern/rna_gpencil_modifier.c47
-rw-r--r--source/blender/makesrna/intern/rna_modifier.c1
-rw-r--r--source/blender/makesrna/intern/rna_object.c9
6 files changed, 103 insertions, 27 deletions
diff --git a/source/blender/makesrna/intern/rna_ID.c b/source/blender/makesrna/intern/rna_ID.c
index 82d90a5c54b..d3b7e380afa 100644
--- a/source/blender/makesrna/intern/rna_ID.c
+++ b/source/blender/makesrna/intern/rna_ID.c
@@ -762,7 +762,8 @@ static void rna_ID_override_library_reset(ID *id,
IDOverrideLibrary *UNUSED(override_library),
Main *bmain,
ReportList *reports,
- bool do_hierarchy)
+ bool do_hierarchy,
+ bool set_system_override)
{
if (!ID_IS_OVERRIDE_LIBRARY_REAL(id)) {
BKE_reportf(reports, RPT_ERROR, "ID '%s' isn't an override", id->name);
@@ -770,10 +771,10 @@ static void rna_ID_override_library_reset(ID *id,
}
if (do_hierarchy) {
- BKE_lib_override_library_id_hierarchy_reset(bmain, id);
+ BKE_lib_override_library_id_hierarchy_reset(bmain, id, set_system_override);
}
else {
- BKE_lib_override_library_id_reset(bmain, id);
+ BKE_lib_override_library_id_reset(bmain, id, set_system_override);
}
WM_main_add_notifier(NC_WM | ND_LIB_OVERRIDE_CHANGED, NULL);
@@ -1832,6 +1833,17 @@ static void rna_def_ID_override_library(BlenderRNA *brna)
"hierarchy, or as a single, isolated and autonomous override");
RNA_def_property_update(prop, NC_WM | ND_LIB_OVERRIDE_CHANGED, NULL);
RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", IDOVERRIDE_LIBRARY_FLAG_NO_HIERARCHY);
+ RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
+
+ prop = RNA_def_boolean(srna,
+ "is_system_override",
+ false,
+ "Is System Override",
+ "Whether this library override exists only for the override hierarchy, "
+ "or if it is actually editable by the user");
+ RNA_def_property_update(prop, NC_WM | ND_LIB_OVERRIDE_CHANGED, NULL);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", IDOVERRIDE_LIBRARY_FLAG_SYSTEM_DEFINED);
+ RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
prop = RNA_def_collection(srna,
"properties",
@@ -1858,6 +1870,11 @@ static void rna_def_ID_override_library(BlenderRNA *brna)
true,
"",
"Also reset all the dependencies of this override to match their reference linked IDs");
+ RNA_def_boolean(func,
+ "set_system_override",
+ false,
+ "",
+ "Reset all user-editable overrides as (non-editable) system overrides");
func = RNA_def_function(srna, "destroy", "rna_ID_override_library_destroy");
RNA_def_function_ui_description(
@@ -1987,6 +2004,8 @@ static void rna_def_ID(BlenderRNA *brna)
prop = RNA_def_pointer(
srna, "override_library", "IDOverrideLibrary", "Library Override", "Library override data");
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_override_flag(prop,
+ PROPOVERRIDE_NO_COMPARISON | PROPOVERRIDE_OVERRIDABLE_LIBRARY);
prop = RNA_def_pointer(srna,
"preview",
diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c
index b4617321f44..5690d864a75 100644
--- a/source/blender/makesrna/intern/rna_access.c
+++ b/source/blender/makesrna/intern/rna_access.c
@@ -32,8 +32,10 @@
#include "BKE_collection.h"
#include "BKE_context.h"
#include "BKE_fcurve.h"
+#include "BKE_global.h"
#include "BKE_idprop.h"
#include "BKE_idtype.h"
+#include "BKE_lib_override.h"
#include "BKE_main.h"
#include "BKE_node.h"
#include "BKE_report.h"
@@ -1930,17 +1932,29 @@ static bool rna_property_editable_do(PointerRNA *ptr,
/* Handle linked or liboverride ID cases. */
const bool is_linked_prop_exception = (prop->flag & PROP_LIB_EXCEPTION) != 0;
- if (ID_IS_LINKED(id) && !is_linked_prop_exception) {
+ if (ID_IS_LINKED(id)) {
+ if (is_linked_prop_exception) {
+ return true;
+ }
if (r_info != NULL && (*r_info)[0] == '\0') {
*r_info = N_("Can't edit this property from a linked data-block");
}
return false;
}
- if (ID_IS_OVERRIDE_LIBRARY(id) && !RNA_property_overridable_get(ptr, prop_orig)) {
- if (r_info != NULL && (*r_info)[0] == '\0') {
- *r_info = N_("Can't edit this property from an override data-block");
+ if (ID_IS_OVERRIDE_LIBRARY(id)) {
+ const bool is_liboverride_system = BKE_lib_override_library_is_system_defined(G_MAIN, id);
+ if (!RNA_property_overridable_get(ptr, prop_orig)) {
+ if (r_info != NULL && (*r_info)[0] == '\0') {
+ *r_info = N_("Can't edit this property from an override data-block");
+ }
+ return false;
+ }
+ if (is_liboverride_system && !is_linked_prop_exception) {
+ if (r_info != NULL && (*r_info)[0] == '\0') {
+ *r_info = N_("Can't edit this property from a system override data-block");
+ }
+ return false;
}
- return false;
}
/* At this point, property is owned by a local ID and therefore fully editable. */
@@ -6012,13 +6026,29 @@ char *RNA_path_struct_property_py(PointerRNA *ptr, PropertyRNA *prop, int index)
char *RNA_path_property_py(const PointerRNA *UNUSED(ptr), PropertyRNA *prop, int index)
{
+ const bool is_rna = (prop->magic == RNA_MAGIC);
+ const char *propname = RNA_property_identifier(prop);
char *ret;
if ((index == -1) || (RNA_property_array_check(prop) == false)) {
- ret = BLI_sprintfN("%s", RNA_property_identifier(prop));
+ if (is_rna) {
+ ret = BLI_strdup(propname);
+ }
+ else {
+ char propname_esc[MAX_IDPROP_NAME * 2];
+ BLI_str_escape(propname_esc, propname, sizeof(propname_esc));
+ ret = BLI_sprintfN("[\"%s\"]", propname_esc);
+ }
}
else {
- ret = BLI_sprintfN("%s[%d]", RNA_property_identifier(prop), index);
+ if (is_rna) {
+ ret = BLI_sprintfN("%s[%d]", propname, index);
+ }
+ else {
+ char propname_esc[MAX_IDPROP_NAME * 2];
+ BLI_str_escape(propname_esc, propname, sizeof(propname_esc));
+ ret = BLI_sprintfN("[\"%s\"][%d]", propname_esc, index);
+ }
}
return ret;
diff --git a/source/blender/makesrna/intern/rna_gpencil.c b/source/blender/makesrna/intern/rna_gpencil.c
index ba94fbe88e5..9a9b6d582e5 100644
--- a/source/blender/makesrna/intern/rna_gpencil.c
+++ b/source/blender/makesrna/intern/rna_gpencil.c
@@ -848,10 +848,6 @@ static float rna_GPencilStrokePoints_weight_get(bGPDstroke *stroke,
}
MDeformVert *pt_dvert = stroke->dvert + point_index;
- if ((pt_dvert) && (pt_dvert->totweight <= vertex_group_index || vertex_group_index < 0)) {
- BKE_report(reports, RPT_ERROR, "Groups: index out of range");
- return -1.0f;
- }
MDeformWeight *dw = BKE_defvert_find_index(pt_dvert, vertex_group_index);
if (dw) {
diff --git a/source/blender/makesrna/intern/rna_gpencil_modifier.c b/source/blender/makesrna/intern/rna_gpencil_modifier.c
index 81103f4fe49..b09d8a4738d 100644
--- a/source/blender/makesrna/intern/rna_gpencil_modifier.c
+++ b/source/blender/makesrna/intern/rna_gpencil_modifier.c
@@ -382,6 +382,7 @@ RNA_GP_MOD_VGROUP_NAME_SET(WeightAngle, vgname);
RNA_GP_MOD_VGROUP_NAME_SET(Lineart, vgname);
RNA_GP_MOD_VGROUP_NAME_SET(Shrinkwrap, vgname);
RNA_GP_MOD_VGROUP_NAME_SET(Envelope, vgname);
+RNA_GP_MOD_VGROUP_NAME_SET(Build, target_vgname);
# undef RNA_GP_MOD_VGROUP_NAME_SET
@@ -416,6 +417,7 @@ RNA_GP_MOD_OBJECT_SET(Mirror, object, OB_EMPTY);
RNA_GP_MOD_OBJECT_SET(WeightProx, object, OB_EMPTY);
RNA_GP_MOD_OBJECT_SET(Shrinkwrap, target, OB_MESH);
RNA_GP_MOD_OBJECT_SET(Shrinkwrap, aux_target, OB_MESH);
+RNA_GP_MOD_OBJECT_SET(Build, object, OB_EMPTY);
# undef RNA_GP_MOD_OBJECT_SET
@@ -2133,10 +2135,10 @@ static void rna_def_modifier_gpencilbuild(BlenderRNA *brna)
"Shrink",
"Hide points from the end of each stroke to the start "
"(e.g. for animating lines being erased)"},
- {GP_BUILD_TRANSITION_FADE,
- "FADE",
+ {GP_BUILD_TRANSITION_VANISH,
+ "FADE", /* "Fade" is the original id string kept for compatibility purpose. */
0,
- "Fade",
+ "Vanish",
"Hide points in the order they occur in each stroke "
"(e.g. for animating ink fading or vanishing after getting drawn)"},
{0, NULL, 0, NULL, NULL},
@@ -2242,6 +2244,43 @@ static void rna_def_modifier_gpencilbuild(BlenderRNA *brna)
RNA_def_property_range(prop, MINAFRAMEF, MAXFRAMEF);
RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+ prop = RNA_def_property(srna, "use_fading", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_BUILD_USE_FADING);
+ RNA_def_property_ui_text(prop, "Use Fading", "Fade out strokes instead of directly cutting off");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "fade_factor", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "fade_fac");
+ RNA_def_property_ui_text(prop, "Fade Factor", "Defines how much of the stroke is fading in/out");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "target_vertex_group", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "target_vgname");
+ RNA_def_property_ui_text(prop, "Vertex Group", "Output Vertex group");
+ RNA_def_property_string_funcs(prop, NULL, NULL, "rna_BuildGpencilModifier_target_vgname_set");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "fade_opacity_strength", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "fade_opacity_strength");
+ RNA_def_property_ui_text(
+ prop, "Opacity Strength", "How much strength fading applies on top of stroke opacity");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "fade_thickness_strength", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "fade_thickness_strength");
+ RNA_def_property_ui_text(
+ prop, "Thickness Strength", "How much strength fading applies on top of stroke thickness");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
+ RNA_def_property_ui_text(prop, "Object", "Object used as build starting position");
+ RNA_def_property_pointer_funcs(prop, NULL, "rna_BuildGpencilModifier_object_set", NULL, NULL);
+ RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_dependency_update");
+
/* Filters - Layer */
prop = RNA_def_property(srna, "layer", PROP_STRING, PROP_NONE);
RNA_def_property_string_sdna(prop, NULL, "layername");
@@ -3745,7 +3784,7 @@ static void rna_def_modifier_gpencildash(BlenderRNA *brna)
prop = RNA_def_property(srna, "use_cyclic", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_DASH_USE_CYCLIC);
- RNA_def_property_ui_text(prop, "Use Cyclic", "Enable cyclic on individual stroke dashes");
+ RNA_def_property_ui_text(prop, "Cyclic", "Enable cyclic on individual stroke dashes");
RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
srna = RNA_def_struct(brna, "DashGpencilModifierData", "GpencilModifier");
diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c
index bd5960ce7d8..c0470109b04 100644
--- a/source/blender/makesrna/intern/rna_modifier.c
+++ b/source/blender/makesrna/intern/rna_modifier.c
@@ -4111,6 +4111,7 @@ static void rna_def_modifier_bevel(BlenderRNA *brna)
prop = RNA_def_property(srna, "segments", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "res");
RNA_def_property_range(prop, 1, 1000);
+ RNA_def_property_ui_range(prop, 1, 100, 1, -1);
RNA_def_property_ui_text(prop, "Segments", "Number of segments for round edges/verts");
RNA_def_property_update(prop, 0, "rna_BevelModifier_update_segments");
diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c
index 7164f24c2f7..0b39c8e27c7 100644
--- a/source/blender/makesrna/intern/rna_object.c
+++ b/source/blender/makesrna/intern/rna_object.c
@@ -200,12 +200,6 @@ static EnumPropertyItem instance_items_nogroup[] = {
{0, NULL, 0, NULL, NULL},
};
-static EnumPropertyItem instance_items_pointcloud[] = {
- {0, "NONE", 0, "None", ""},
- {OB_DUPLIVERTS, "POINTS", 0, "Points", "Instantiate child objects on all points"},
- {0, NULL, 0, NULL, NULL},
-};
-
static EnumPropertyItem instance_items_empty[] = {
{0, "NONE", 0, "None", ""},
INSTANCE_ITEM_COLLECTION,
@@ -760,9 +754,6 @@ static const EnumPropertyItem *rna_Object_instance_type_itemf(bContext *UNUSED(C
if (ob->type == OB_EMPTY) {
item = instance_items_empty;
}
- else if (ob->type == OB_POINTCLOUD) {
- item = instance_items_pointcloud;
- }
else if (ob->type == OB_FONT) {
item = instance_items_font;
}