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:
Diffstat (limited to 'source/blender/makesrna')
-rw-r--r--source/blender/makesrna/intern/rna_access.c2
-rw-r--r--source/blender/makesrna/intern/rna_color.c40
-rw-r--r--source/blender/makesrna/intern/rna_modifier.c6
-rw-r--r--source/blender/makesrna/intern/rna_nodetree.c8
-rw-r--r--source/blender/makesrna/intern/rna_rna.c3
-rw-r--r--source/blender/makesrna/intern/rna_sequencer.c40
-rw-r--r--source/blender/makesrna/intern/rna_wm.c5
-rw-r--r--source/blender/makesrna/intern/rna_xr.c68
8 files changed, 102 insertions, 70 deletions
diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c
index 246446313d4..2d6d5408aa0 100644
--- a/source/blender/makesrna/intern/rna_access.c
+++ b/source/blender/makesrna/intern/rna_access.c
@@ -6000,7 +6000,7 @@ char *RNA_path_full_ID_py(Main *bmain, ID *id)
}
char lib_filepath_esc[(sizeof(id->lib->filepath) * 2) + 4];
- if (id->lib != NULL) {
+ if (ID_IS_LINKED(id)) {
int ofs = 0;
memcpy(lib_filepath_esc, ", \"", 3);
ofs += 3;
diff --git a/source/blender/makesrna/intern/rna_color.c b/source/blender/makesrna/intern/rna_color.c
index 5f198a8ed4c..1ac6dd021e9 100644
--- a/source/blender/makesrna/intern/rna_color.c
+++ b/source/blender/makesrna/intern/rna_color.c
@@ -597,6 +597,27 @@ static const EnumPropertyItem *rna_ColorManagedColorspaceSettings_colorspace_ite
return items;
}
+typedef struct Seq_colorspace_cb_data {
+ ColorManagedColorspaceSettings *colorspace_settings;
+ Sequence *r_seq;
+} Seq_colorspace_cb_data;
+
+static bool seq_find_colorspace_settings_cb(Sequence *seq, void *user_data)
+{
+ Seq_colorspace_cb_data *cd = (Seq_colorspace_cb_data *)user_data;
+ if (seq->strip && &seq->strip->colorspace_settings == cd->colorspace_settings) {
+ cd->r_seq = seq;
+ return false;
+ }
+ return true;
+}
+
+static bool seq_free_anim_cb(Sequence *seq, void *UNUSED(user_data))
+{
+ SEQ_relations_sequence_free_anim(seq);
+ return true;
+}
+
static void rna_ColorManagedColorspaceSettings_reload_update(Main *bmain,
Scene *UNUSED(scene),
PointerRNA *ptr)
@@ -629,20 +650,14 @@ static void rna_ColorManagedColorspaceSettings_reload_update(Main *bmain,
if (scene->ed) {
ColorManagedColorspaceSettings *colorspace_settings = (ColorManagedColorspaceSettings *)
ptr->data;
- Sequence *seq;
- bool seq_found = false;
+ Seq_colorspace_cb_data cb_data = {colorspace_settings, NULL};
if (&scene->sequencer_colorspace_settings != colorspace_settings) {
- SEQ_ALL_BEGIN (scene->ed, seq) {
- if (seq->strip && &seq->strip->colorspace_settings == colorspace_settings) {
- seq_found = true;
- break;
- }
- }
- SEQ_ALL_END;
+ SEQ_for_each_callback(&scene->ed->seqbase, seq_find_colorspace_settings_cb, &cb_data);
}
+ Sequence *seq = cb_data.r_seq;
- if (seq_found) {
+ if (seq) {
SEQ_relations_sequence_free_anim(seq);
if (seq->strip->proxy && seq->strip->proxy->anim) {
@@ -653,10 +668,7 @@ static void rna_ColorManagedColorspaceSettings_reload_update(Main *bmain,
SEQ_relations_invalidate_cache_raw(scene, seq);
}
else {
- SEQ_ALL_BEGIN (scene->ed, seq) {
- SEQ_relations_sequence_free_anim(seq);
- }
- SEQ_ALL_END;
+ SEQ_for_each_callback(&scene->ed->seqbase, seq_free_anim_cb, NULL);
}
WM_main_add_notifier(NC_SCENE | ND_SEQUENCER, NULL);
diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c
index 486d8d13564..f11d845c582 100644
--- a/source/blender/makesrna/intern/rna_modifier.c
+++ b/source/blender/makesrna/intern/rna_modifier.c
@@ -4431,6 +4431,12 @@ static void rna_def_modifier_mask(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Invert", "Use vertices that are not part of region defined");
RNA_def_property_update(prop, 0, "rna_Modifier_update");
+ prop = RNA_def_property(srna, "use_smooth", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_MASK_SMOOTH);
+ RNA_def_property_ui_text(
+ prop, "Smooth", "Use vertex group weights to cut faces at the weight contour");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
prop = RNA_def_property(srna, "threshold", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_float_sdna(prop, NULL, "threshold");
RNA_def_property_range(prop, 0.0, 1.0);
diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c
index d8ab7c7a61b..8d672e9b570 100644
--- a/source/blender/makesrna/intern/rna_nodetree.c
+++ b/source/blender/makesrna/intern/rna_nodetree.c
@@ -9853,17 +9853,17 @@ static void def_geo_collection_info(StructRNA *srna)
static void def_geo_attribute_proximity(StructRNA *srna)
{
static const EnumPropertyItem target_geometry_element[] = {
- {GEO_NODE_ATTRIBUTE_PROXIMITY_TARGET_GEOMETRY_ELEMENT_POINTS,
+ {GEO_NODE_PROXIMITY_TARGET_POINTS,
"POINTS",
ICON_NONE,
"Points",
"Calculate proximity to the target's points (usually faster than the other two modes)"},
- {GEO_NODE_ATTRIBUTE_PROXIMITY_TARGET_GEOMETRY_ELEMENT_EDGES,
+ {GEO_NODE_PROXIMITY_TARGET_EDGES,
"EDGES",
ICON_NONE,
"Edges",
"Calculate proximity to the target's edges"},
- {GEO_NODE_ATTRIBUTE_PROXIMITY_TARGET_GEOMETRY_ELEMENT_FACES,
+ {GEO_NODE_PROXIMITY_TARGET_FACES,
"FACES",
ICON_NONE,
"Faces",
@@ -9877,7 +9877,7 @@ static void def_geo_attribute_proximity(StructRNA *srna)
prop = RNA_def_property(srna, "target_geometry_element", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_items(prop, target_geometry_element);
- RNA_def_property_enum_default(prop, GEO_NODE_ATTRIBUTE_PROXIMITY_TARGET_GEOMETRY_ELEMENT_FACES);
+ RNA_def_property_enum_default(prop, GEO_NODE_PROXIMITY_TARGET_FACES);
RNA_def_property_ui_text(
prop, "Target Geometry", "Element of the target geometry to calculate the distance from");
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
diff --git a/source/blender/makesrna/intern/rna_rna.c b/source/blender/makesrna/intern/rna_rna.c
index f714987fc05..12fb7a40d13 100644
--- a/source/blender/makesrna/intern/rna_rna.c
+++ b/source/blender/makesrna/intern/rna_rna.c
@@ -123,7 +123,8 @@ const EnumPropertyItem rna_enum_property_unit_items[] = {
{PROP_UNIT_AREA, "AREA", 0, "Area", ""},
{PROP_UNIT_VOLUME, "VOLUME", 0, "Volume", ""},
{PROP_UNIT_ROTATION, "ROTATION", 0, "Rotation", ""},
- {PROP_UNIT_TIME, "TIME", 0, "Time", ""},
+ {PROP_UNIT_TIME, "TIME", 0, "Time (Scene Relative)", ""},
+ {PROP_UNIT_TIME_ABSOLUTE, "TIME_ABSOLUTE", 0, "Time (Absolute)", ""},
{PROP_UNIT_VELOCITY, "VELOCITY", 0, "Velocity", ""},
{PROP_UNIT_ACCELERATION, "ACCELERATION", 0, "Acceleration", ""},
{PROP_UNIT_MASS, "MASS", 0, "Mass", ""},
diff --git a/source/blender/makesrna/intern/rna_sequencer.c b/source/blender/makesrna/intern/rna_sequencer.c
index dad77b4aad5..9dee7bc841c 100644
--- a/source/blender/makesrna/intern/rna_sequencer.c
+++ b/source/blender/makesrna/intern/rna_sequencer.c
@@ -495,15 +495,15 @@ static void rna_Sequence_use_proxy_set(PointerRNA *ptr, bool value)
SEQ_proxy_set(seq, value != 0);
}
-static int transform_seq_cmp_fn(Sequence *seq, void *arg_pt)
+static bool transform_seq_cmp_fn(Sequence *seq, void *arg_pt)
{
SequenceSearchData *data = arg_pt;
if (seq->strip && seq->strip->transform == data->data) {
data->seq = seq;
- return -1; /* done so bail out */
+ return false; /* done so bail out */
}
- return 1;
+ return true;
}
static Sequence *sequence_get_by_transform(Editing *ed, StripTransform *transform)
@@ -514,7 +514,7 @@ static Sequence *sequence_get_by_transform(Editing *ed, StripTransform *transfor
data.data = transform;
/* irritating we need to search for our sequence! */
- SEQ_seqbase_recursive_apply(&ed->seqbase, transform_seq_cmp_fn, &data);
+ SEQ_for_each_callback(&ed->seqbase, transform_seq_cmp_fn, &data);
return data.seq;
}
@@ -547,15 +547,15 @@ static void rna_SequenceTransform_update(Main *UNUSED(bmain),
SEQ_relations_invalidate_cache_preprocessed(scene, seq);
}
-static int crop_seq_cmp_fn(Sequence *seq, void *arg_pt)
+static bool crop_seq_cmp_fn(Sequence *seq, void *arg_pt)
{
SequenceSearchData *data = arg_pt;
if (seq->strip && seq->strip->crop == data->data) {
data->seq = seq;
- return -1; /* done so bail out */
+ return false; /* done so bail out */
}
- return 1;
+ return true;
}
static Sequence *sequence_get_by_crop(Editing *ed, StripCrop *crop)
@@ -566,7 +566,7 @@ static Sequence *sequence_get_by_crop(Editing *ed, StripCrop *crop)
data.data = crop;
/* irritating we need to search for our sequence! */
- SEQ_seqbase_recursive_apply(&ed->seqbase, crop_seq_cmp_fn, &data);
+ SEQ_for_each_callback(&ed->seqbase, crop_seq_cmp_fn, &data);
return data.seq;
}
@@ -935,15 +935,15 @@ static void rna_Sequence_sound_update(Main *bmain, Scene *scene, PointerRNA *UNU
DEG_relations_tag_update(bmain);
}
-static int seqproxy_seq_cmp_fn(Sequence *seq, void *arg_pt)
+static bool seqproxy_seq_cmp_fn(Sequence *seq, void *arg_pt)
{
SequenceSearchData *data = arg_pt;
if (seq->strip && seq->strip->proxy == data->data) {
data->seq = seq;
- return -1; /* done so bail out */
+ return false; /* done so bail out */
}
- return 1;
+ return true;
}
static Sequence *sequence_get_by_proxy(Editing *ed, StripProxy *proxy)
@@ -953,7 +953,7 @@ static Sequence *sequence_get_by_proxy(Editing *ed, StripProxy *proxy)
data.seq = NULL;
data.data = proxy;
- SEQ_seqbase_recursive_apply(&ed->seqbase, seqproxy_seq_cmp_fn, &data);
+ SEQ_for_each_callback(&ed->seqbase, seqproxy_seq_cmp_fn, &data);
return data.seq;
}
@@ -988,7 +988,7 @@ static void rna_Sequence_opacity_set(PointerRNA *ptr, float value)
seq->blend_opacity = value * 100.0f;
}
-static int colbalance_seq_cmp_fn(Sequence *seq, void *arg_pt)
+static bool colbalance_seq_cmp_fn(Sequence *seq, void *arg_pt)
{
SequenceSearchData *data = arg_pt;
@@ -999,12 +999,12 @@ static int colbalance_seq_cmp_fn(Sequence *seq, void *arg_pt)
if (&cbmd->color_balance == data->data) {
data->seq = seq;
data->smd = smd;
- return -1; /* done so bail out */
+ return false; /* done so bail out */
}
}
}
- return 1;
+ return true;
}
static Sequence *sequence_get_by_colorbalance(Editing *ed,
@@ -1018,7 +1018,7 @@ static Sequence *sequence_get_by_colorbalance(Editing *ed,
data.data = cb;
/* irritating we need to search for our sequence! */
- SEQ_seqbase_recursive_apply(&ed->seqbase, colbalance_seq_cmp_fn, &data);
+ SEQ_for_each_callback(&ed->seqbase, colbalance_seq_cmp_fn, &data);
*r_smd = data.smd;
@@ -1122,16 +1122,16 @@ static void rna_SequenceEditor_overlay_frame_set(PointerRNA *ptr, int value)
}
}
-static int modifier_seq_cmp_fn(Sequence *seq, void *arg_pt)
+static bool modifier_seq_cmp_fn(Sequence *seq, void *arg_pt)
{
SequenceSearchData *data = arg_pt;
if (BLI_findindex(&seq->modifiers, data->data) != -1) {
data->seq = seq;
- return -1; /* done so bail out */
+ return false; /* done so bail out */
}
- return 1;
+ return true;
}
static Sequence *sequence_get_by_modifier(Editing *ed, SequenceModifierData *smd)
@@ -1142,7 +1142,7 @@ static Sequence *sequence_get_by_modifier(Editing *ed, SequenceModifierData *smd
data.data = smd;
/* irritating we need to search for our sequence! */
- SEQ_seqbase_recursive_apply(&ed->seqbase, modifier_seq_cmp_fn, &data);
+ SEQ_for_each_callback(&ed->seqbase, modifier_seq_cmp_fn, &data);
return data.seq;
}
diff --git a/source/blender/makesrna/intern/rna_wm.c b/source/blender/makesrna/intern/rna_wm.c
index b910648495b..21a3c087197 100644
--- a/source/blender/makesrna/intern/rna_wm.c
+++ b/source/blender/makesrna/intern/rna_wm.c
@@ -649,10 +649,9 @@ static void rna_Event_unicode_get(PointerRNA *ptr, char *value)
size_t len = 0;
if (event->utf8_buf[0]) {
- BLI_str_utf8_as_unicode_and_size(event->utf8_buf, &len);
- if (len > 0) {
+ if (BLI_str_utf8_as_unicode_step_or_error(event->utf8_buf, sizeof(event->utf8_buf), &len) !=
+ BLI_UTF8_ERR)
memcpy(value, event->utf8_buf, len);
- }
}
value[len] = '\0';
diff --git a/source/blender/makesrna/intern/rna_xr.c b/source/blender/makesrna/intern/rna_xr.c
index 4cab92ad878..f24d28d1209 100644
--- a/source/blender/makesrna/intern/rna_xr.c
+++ b/source/blender/makesrna/intern/rna_xr.c
@@ -40,6 +40,23 @@
# include "WM_api.h"
/* -------------------------------------------------------------------- */
+
+# ifdef WITH_XR_OPENXR
+static wmXrData *rna_XrSession_wm_xr_data_get(PointerRNA *ptr)
+{
+ /* Callers could also get XrSessionState pointer through ptr->data, but prefer if we just
+ * consistently pass wmXrData pointers to the WM_xr_xxx() API. */
+
+ BLI_assert((ptr->type == &RNA_XrSessionSettings) || (ptr->type == &RNA_XrSessionState));
+
+ wmWindowManager *wm = (wmWindowManager *)ptr->owner_id;
+ BLI_assert(wm && (GS(wm->id.name) == ID_WM));
+
+ return &wm->xr;
+}
+# endif
+
+/* -------------------------------------------------------------------- */
/** \name XR Action Map
* \{ */
@@ -420,29 +437,32 @@ static void rna_XrActionMapItem_update(Main *UNUSED(bmain), Scene *UNUSED(scene)
# endif
}
-static XrActionMap *rna_XrActionMap_new(wmXrData *xr, const char *name, bool replace_existing)
+static XrActionMap *rna_XrActionMap_new(PointerRNA *ptr, const char *name, bool replace_existing)
{
# ifdef WITH_XR_OPENXR
+ wmXrData *xr = rna_XrSession_wm_xr_data_get(ptr);
return WM_xr_actionmap_new(xr->runtime, name, replace_existing);
# else
- UNUSED_VARS(xr, name, replace_existing);
+ UNUSED_VARS(ptr, name, replace_existing);
return NULL;
# endif
}
-static XrActionMap *rna_XrActionMap_new_from_actionmap(wmXrData *xr, XrActionMap *am_src)
+static XrActionMap *rna_XrActionMap_new_from_actionmap(PointerRNA *ptr, XrActionMap *am_src)
{
# ifdef WITH_XR_OPENXR
+ wmXrData *xr = rna_XrSession_wm_xr_data_get(ptr);
return WM_xr_actionmap_add_copy(xr->runtime, am_src);
# else
- UNUSED_VARS(xr, am_src);
+ UNUSED_VARS(ptr, am_src);
return NULL;
# endif
}
-static void rna_XrActionMap_remove(wmXrData *xr, ReportList *reports, PointerRNA *actionmap_ptr)
+static void rna_XrActionMap_remove(ReportList *reports, PointerRNA *ptr, PointerRNA *actionmap_ptr)
{
# ifdef WITH_XR_OPENXR
+ wmXrData *xr = rna_XrSession_wm_xr_data_get(ptr);
XrActionMap *actionmap = actionmap_ptr->data;
if (WM_xr_actionmap_remove(xr->runtime, actionmap) == false) {
BKE_reportf(reports, RPT_ERROR, "ActionMap '%s' cannot be removed", actionmap->name);
@@ -450,16 +470,17 @@ static void rna_XrActionMap_remove(wmXrData *xr, ReportList *reports, PointerRNA
}
RNA_POINTER_INVALIDATE(actionmap_ptr);
# else
- UNUSED_VARS(xr, reports, actionmap_ptr);
+ UNUSED_VARS(ptr, reports, actionmap_ptr);
# endif
}
-static XrActionMap *rna_XrActionMap_find(wmXrData *xr, const char *name)
+static XrActionMap *rna_XrActionMap_find(PointerRNA *ptr, const char *name)
{
# ifdef WITH_XR_OPENXR
+ wmXrData *xr = rna_XrSession_wm_xr_data_get(ptr);
return WM_xr_actionmap_find(xr->runtime, name);
# else
- UNUSED_VARS(xr, name);
+ UNUSED_VARS(ptr, name);
return NULL;
# endif
}
@@ -480,23 +501,6 @@ static void rna_XrActionMap_name_update(Main *bmain, Scene *UNUSED(scene), Point
/** \} */
/* -------------------------------------------------------------------- */
-
-# ifdef WITH_XR_OPENXR
-static wmXrData *rna_XrSession_wm_xr_data_get(PointerRNA *ptr)
-{
- /* Callers could also get XrSessionState pointer through ptr->data, but prefer if we just
- * consistently pass wmXrData pointers to the WM_xr_xxx() API. */
-
- BLI_assert((ptr->type == &RNA_XrSessionSettings) || (ptr->type == &RNA_XrSessionState));
-
- wmWindowManager *wm = (wmWindowManager *)ptr->owner_id;
- BLI_assert(wm && (GS(wm->id.name) == ID_WM));
-
- return &wm->xr;
-}
-# endif
-
-/* -------------------------------------------------------------------- */
/** \name XR Session Settings
* \{ */
@@ -1136,10 +1140,12 @@ static void rna_def_xr_actionmaps(BlenderRNA *brna, PropertyRNA *cprop)
RNA_def_property_srna(cprop, "XrActionMaps");
srna = RNA_def_struct(brna, "XrActionMaps", NULL);
- RNA_def_struct_sdna(srna, "wmXrData");
RNA_def_struct_ui_text(srna, "XR Action Maps", "Collection of XR action maps");
func = RNA_def_function(srna, "new", "rna_XrActionMap_new");
+ RNA_def_function_flag(func, FUNC_NO_SELF);
+ parm = RNA_def_pointer(func, "xr_session_state", "XrSessionState", "XR Session State", "");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
parm = RNA_def_string(func, "name", NULL, MAX_NAME, "Name", "");
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
parm = RNA_def_boolean(func,
@@ -1152,6 +1158,9 @@ static void rna_def_xr_actionmaps(BlenderRNA *brna, PropertyRNA *cprop)
RNA_def_function_return(func, parm);
func = RNA_def_function(srna, "new_from_actionmap", "rna_XrActionMap_new_from_actionmap");
+ RNA_def_function_flag(func, FUNC_NO_SELF);
+ parm = RNA_def_pointer(func, "xr_session_state", "XrSessionState", "XR Session State", "");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
parm = RNA_def_pointer(
func, "actionmap", "XrActionMap", "Action Map", "Action map to use as a reference");
RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
@@ -1159,12 +1168,17 @@ static void rna_def_xr_actionmaps(BlenderRNA *brna, PropertyRNA *cprop)
RNA_def_function_return(func, parm);
func = RNA_def_function(srna, "remove", "rna_XrActionMap_remove");
- RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_USE_REPORTS);
+ parm = RNA_def_pointer(func, "xr_session_state", "XrSessionState", "XR Session State", "");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
parm = RNA_def_pointer(func, "actionmap", "XrActionMap", "Action Map", "Removed action map");
RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
func = RNA_def_function(srna, "find", "rna_XrActionMap_find");
+ RNA_def_function_flag(func, FUNC_NO_SELF);
+ parm = RNA_def_pointer(func, "xr_session_state", "XrSessionState", "XR Session State", "");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
parm = RNA_def_string(func, "name", NULL, MAX_NAME, "Name", "");
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
parm = RNA_def_pointer(