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:
authorHans Goudey <h.goudey@me.com>2020-10-08 00:18:31 +0300
committerHans Goudey <h.goudey@me.com>2020-10-08 00:18:37 +0300
commit7c977ae4c91250a2577b1413c38b869df73529ec (patch)
treea2ed45e6f88e549dc0cc1305bbad3aeda51b667a /source/blender/makesrna
parent9e55344d890ba0bcc6fe972758e01c43c9f843eb (diff)
parentfec5c12ac86b5a318f8cc064cbc2860fe14331d5 (diff)
Merge branch 'master' into fcurve-modifier-panels
Diffstat (limited to 'source/blender/makesrna')
-rw-r--r--source/blender/makesrna/RNA_access.h23
-rw-r--r--source/blender/makesrna/RNA_define.h3
-rw-r--r--source/blender/makesrna/RNA_enum_types.h7
-rw-r--r--source/blender/makesrna/RNA_types.h4
-rw-r--r--source/blender/makesrna/intern/CMakeLists.txt11
-rw-r--r--source/blender/makesrna/intern/makesrna.c20
-rw-r--r--source/blender/makesrna/intern/rna_ID.c12
-rw-r--r--source/blender/makesrna/intern/rna_access.c121
-rw-r--r--source/blender/makesrna/intern/rna_access_compare_override.c42
-rw-r--r--source/blender/makesrna/intern/rna_animation.c9
-rw-r--r--source/blender/makesrna/intern/rna_armature.c12
-rw-r--r--source/blender/makesrna/intern/rna_attribute.c680
-rw-r--r--source/blender/makesrna/intern/rna_brush.c66
-rw-r--r--source/blender/makesrna/intern/rna_cloth.c2
-rw-r--r--source/blender/makesrna/intern/rna_collection.c26
-rw-r--r--source/blender/makesrna/intern/rna_constraint.c15
-rw-r--r--source/blender/makesrna/intern/rna_curve.c123
-rw-r--r--source/blender/makesrna/intern/rna_define.c21
-rw-r--r--source/blender/makesrna/intern/rna_depsgraph.c19
-rw-r--r--source/blender/makesrna/intern/rna_fcurve.c37
-rw-r--r--source/blender/makesrna/intern/rna_fluid.c353
-rw-r--r--source/blender/makesrna/intern/rna_gpencil.c2
-rw-r--r--source/blender/makesrna/intern/rna_gpencil_modifier.c15
-rw-r--r--source/blender/makesrna/intern/rna_hair.c4
-rw-r--r--source/blender/makesrna/intern/rna_image_api.c2
-rw-r--r--source/blender/makesrna/intern/rna_internal.h8
-rw-r--r--source/blender/makesrna/intern/rna_main_api.c58
-rw-r--r--source/blender/makesrna/intern/rna_material.c12
-rw-r--r--source/blender/makesrna/intern/rna_mesh.c45
-rw-r--r--source/blender/makesrna/intern/rna_modifier.c407
-rw-r--r--source/blender/makesrna/intern/rna_nodetree.c4
-rw-r--r--source/blender/makesrna/intern/rna_object.c63
-rw-r--r--source/blender/makesrna/intern/rna_object_api.c3
-rw-r--r--source/blender/makesrna/intern/rna_object_force.c14
-rw-r--r--source/blender/makesrna/intern/rna_particle.c132
-rw-r--r--source/blender/makesrna/intern/rna_pointcloud.c2
-rw-r--r--source/blender/makesrna/intern/rna_render.c2
-rw-r--r--source/blender/makesrna/intern/rna_rigidbody.c2
-rw-r--r--source/blender/makesrna/intern/rna_rna.c143
-rw-r--r--source/blender/makesrna/intern/rna_scene.c47
-rw-r--r--source/blender/makesrna/intern/rna_scene_api.c2
-rw-r--r--source/blender/makesrna/intern/rna_sculpt_paint.c9
-rw-r--r--source/blender/makesrna/intern/rna_sequencer.c2
-rw-r--r--source/blender/makesrna/intern/rna_space.c265
-rw-r--r--source/blender/makesrna/intern/rna_test.c4
-rw-r--r--source/blender/makesrna/intern/rna_timeline.c14
-rw-r--r--source/blender/makesrna/intern/rna_tracking.c46
-rw-r--r--source/blender/makesrna/intern/rna_ui.c4
-rw-r--r--source/blender/makesrna/intern/rna_ui_api.c14
-rw-r--r--source/blender/makesrna/intern/rna_userdef.c82
-rw-r--r--source/blender/makesrna/intern/rna_volume.c52
-rw-r--r--source/blender/makesrna/intern/rna_wm.c43
-rw-r--r--source/blender/makesrna/intern/rna_wm_api.c14
-rw-r--r--source/blender/makesrna/intern/rna_wm_gizmo.c10
-rwxr-xr-xsource/blender/makesrna/rna_cleanup/rna_cleaner.py7
-rwxr-xr-xsource/blender/makesrna/rna_cleanup/rna_cleaner_merge.py5
56 files changed, 2485 insertions, 659 deletions
diff --git a/source/blender/makesrna/RNA_access.h b/source/blender/makesrna/RNA_access.h
index 6acd9d16f80..0b882742839 100644
--- a/source/blender/makesrna/RNA_access.h
+++ b/source/blender/makesrna/RNA_access.h
@@ -67,6 +67,8 @@ extern StructRNA RNA_ArmatureGpencilModifier;
extern StructRNA RNA_ArmatureModifier;
extern StructRNA RNA_ArrayGpencilModifier;
extern StructRNA RNA_ArrayModifier;
+extern StructRNA RNA_Attribute;
+extern StructRNA RNA_AttributeGroup;
extern StructRNA RNA_BackgroundImage;
extern StructRNA RNA_BevelModifier;
extern StructRNA RNA_BezierSplinePoint;
@@ -93,6 +95,8 @@ extern StructRNA RNA_BrushCapabilitiesVertexPaint;
extern StructRNA RNA_BrushTextureSlot;
extern StructRNA RNA_BuildGpencilModifier;
extern StructRNA RNA_BuildModifier;
+extern StructRNA RNA_ByteColorAttribute;
+extern StructRNA RNA_ByteColorAttributeValue;
extern StructRNA RNA_CacheFile;
extern StructRNA RNA_Camera;
extern StructRNA RNA_CameraDOFSettings;
@@ -247,6 +251,10 @@ extern StructRNA RNA_FaceMap;
extern StructRNA RNA_FieldSettings;
extern StructRNA RNA_FileBrowserFSMenuEntry;
extern StructRNA RNA_FileSelectParams;
+extern StructRNA RNA_FloatAttribute;
+extern StructRNA RNA_FloatAttributeValue;
+extern StructRNA RNA_FloatColorAttribute;
+extern StructRNA RNA_FloatColorAttributeValue;
extern StructRNA RNA_FloatProperty;
extern StructRNA RNA_FloorConstraint;
extern StructRNA RNA_FluidDomainSettings;
@@ -292,6 +300,8 @@ extern StructRNA RNA_ImagePreview;
extern StructRNA RNA_ImageSequence;
extern StructRNA RNA_ImageTexture;
extern StructRNA RNA_ImageUser;
+extern StructRNA RNA_IntAttribute;
+extern StructRNA RNA_IntAttributeValue;
extern StructRNA RNA_IntProperty;
extern StructRNA RNA_Itasc;
extern StructRNA RNA_Key;
@@ -379,6 +389,7 @@ extern StructRNA RNA_MaterialSlot;
extern StructRNA RNA_Menu;
extern StructRNA RNA_Mesh;
extern StructRNA RNA_MeshCacheModifier;
+extern StructRNA RNA_MeshToVolumeModifier;
extern StructRNA RNA_MeshColor;
extern StructRNA RNA_MeshDeformModifier;
extern StructRNA RNA_MeshEdge;
@@ -481,6 +492,7 @@ extern StructRNA RNA_PropertyGroup;
extern StructRNA RNA_PropertyGroupItem;
extern StructRNA RNA_PythonConstraint;
extern StructRNA RNA_Region;
+extern StructRNA RNA_RemeshModifier;
extern StructRNA RNA_RenderEngine;
extern StructRNA RNA_RenderLayer;
extern StructRNA RNA_RenderPass;
@@ -553,6 +565,9 @@ extern StructRNA RNA_ShrinkwrapModifier;
extern StructRNA RNA_SimpleDeformModifier;
extern StructRNA RNA_SimplifyGpencilModifier;
extern StructRNA RNA_Simulation;
+#ifdef WITH_PARTICLE_NODES
+extern StructRNA RNA_SimulationModifier;
+#endif
extern StructRNA RNA_SimulationNode;
extern StructRNA RNA_SimulationNodeTree;
extern StructRNA RNA_SkinModifier;
@@ -570,6 +585,7 @@ extern StructRNA RNA_SpaceDopeSheetEditor;
extern StructRNA RNA_SpaceFileBrowser;
extern StructRNA RNA_SpaceGraphEditor;
extern StructRNA RNA_SpaceImageEditor;
+extern StructRNA RNA_SpaceImageOverlay;
extern StructRNA RNA_SpaceInfo;
extern StructRNA RNA_SpaceNLA;
extern StructRNA RNA_SpaceNodeEditor;
@@ -588,6 +604,8 @@ extern StructRNA RNA_SplinePoint;
extern StructRNA RNA_SpotLight;
extern StructRNA RNA_Stereo3dDisplay;
extern StructRNA RNA_StretchToConstraint;
+extern StructRNA RNA_StringAttribute;
+extern StructRNA RNA_StringAttributeValue;
extern StructRNA RNA_StringProperty;
extern StructRNA RNA_Struct;
extern StructRNA RNA_StucciTexture;
@@ -633,6 +651,7 @@ extern StructRNA RNA_TextureNodeViewer;
extern StructRNA RNA_TextureSlot;
extern StructRNA RNA_Theme;
extern StructRNA RNA_ThemeBoneColorSet;
+extern StructRNA RNA_ThemeCollectionColor;
extern StructRNA RNA_ThemeConsole;
extern StructRNA RNA_ThemeDopeSheet;
extern StructRNA RNA_ThemeFileBrowser;
@@ -665,6 +684,7 @@ extern StructRNA RNA_TrackToConstraint;
extern StructRNA RNA_TransformConstraint;
extern StructRNA RNA_TransformOrientationSlot;
extern StructRNA RNA_TransformSequence;
+extern StructRNA RNA_TriangulateModifier;
extern StructRNA RNA_UILayout;
extern StructRNA RNA_UIList;
extern StructRNA RNA_UIPieMenu;
@@ -689,6 +709,7 @@ extern StructRNA RNA_View3DShading;
extern StructRNA RNA_ViewLayer;
extern StructRNA RNA_ViewLayerEEVEE;
extern StructRNA RNA_Volume;
+extern StructRNA RNA_VolumeDisplaceModifier;
extern StructRNA RNA_VoronoiTexture;
extern StructRNA RNA_WalkNavigation;
extern StructRNA RNA_WarpModifier;
@@ -1016,6 +1037,8 @@ int RNA_property_collection_lookup_string(PointerRNA *ptr,
PropertyRNA *prop,
const char *key,
PointerRNA *r_ptr);
+int RNA_property_collection_lookup_string_index(
+ PointerRNA *ptr, PropertyRNA *prop, const char *key, PointerRNA *r_ptr, int *r_index);
int RNA_property_collection_assign_int(PointerRNA *ptr,
PropertyRNA *prop,
const int key,
diff --git a/source/blender/makesrna/RNA_define.h b/source/blender/makesrna/RNA_define.h
index ee1a3fdd539..de8e13875a6 100644
--- a/source/blender/makesrna/RNA_define.h
+++ b/source/blender/makesrna/RNA_define.h
@@ -509,7 +509,8 @@ int RNA_def_property_free_identifier(StructOrFunctionRNA *cont_, const char *ide
const char *RNA_property_typename(PropertyType type);
#define IS_DNATYPE_FLOAT_COMPAT(_str) (strcmp(_str, "float") == 0 || strcmp(_str, "double") == 0)
#define IS_DNATYPE_INT_COMPAT(_str) \
- (strcmp(_str, "int") == 0 || strcmp(_str, "short") == 0 || strcmp(_str, "char") == 0)
+ (strcmp(_str, "int") == 0 || strcmp(_str, "short") == 0 || strcmp(_str, "char") == 0 || \
+ strcmp(_str, "uchar") == 0 || strcmp(_str, "ushort") == 0)
#define IS_DNATYPE_BOOLEAN_COMPAT(_str) \
(IS_DNATYPE_INT_COMPAT(_str) || strcmp(_str, "int64_t") == 0 || strcmp(_str, "uint64_t") == 0)
diff --git a/source/blender/makesrna/RNA_enum_types.h b/source/blender/makesrna/RNA_enum_types.h
index 08442a36c87..831e8dc424d 100644
--- a/source/blender/makesrna/RNA_enum_types.h
+++ b/source/blender/makesrna/RNA_enum_types.h
@@ -26,6 +26,7 @@
extern "C" {
#endif
+struct ID;
struct bNodeSocketType;
struct bNodeTreeType;
struct bNodeType;
@@ -231,6 +232,12 @@ extern const EnumPropertyItem rna_enum_context_mode_items[];
extern const EnumPropertyItem rna_enum_curveprofile_preset_items[];
extern const EnumPropertyItem rna_enum_preference_section_items[];
+extern const EnumPropertyItem rna_enum_attribute_type_items[];
+extern const EnumPropertyItem rna_enum_attribute_domain_items[];
+extern const EnumPropertyItem *rna_enum_attribute_domain_itemf(struct ID *id, bool *r_free);
+
+extern const EnumPropertyItem rna_enum_collection_color_items[];
+
/* API calls */
int rna_node_tree_type_to_enum(struct bNodeTreeType *typeinfo);
int rna_node_tree_idname_to_enum(const char *idname);
diff --git a/source/blender/makesrna/RNA_types.h b/source/blender/makesrna/RNA_types.h
index ee7c045ebf9..1c488b2cac1 100644
--- a/source/blender/makesrna/RNA_types.h
+++ b/source/blender/makesrna/RNA_types.h
@@ -91,6 +91,7 @@ typedef enum PropertyUnit {
PROP_UNIT_ACCELERATION = (8 << 16), /* m/(s^2) */
PROP_UNIT_CAMERA = (9 << 16), /* mm */
PROP_UNIT_POWER = (10 << 16), /* W */
+ PROP_UNIT_TEMPERATURE = (11 << 16), /* C */
} PropertyUnit;
#define RNA_SUBTYPE_UNIT(subtype) ((subtype)&0x00FF0000)
@@ -156,6 +157,9 @@ typedef enum PropertySubType {
/** Light */
PROP_POWER = 42 | PROP_UNIT_POWER,
+
+ /* temperature */
+ PROP_TEMPERATURE = 43 | PROP_UNIT_TEMPERATURE,
} PropertySubType;
/* Make sure enums are updated with these */
diff --git a/source/blender/makesrna/intern/CMakeLists.txt b/source/blender/makesrna/intern/CMakeLists.txt
index 303005a0f9e..f2d4859977f 100644
--- a/source/blender/makesrna/intern/CMakeLists.txt
+++ b/source/blender/makesrna/intern/CMakeLists.txt
@@ -30,6 +30,7 @@ set(DEFSRC
rna_animation.c
rna_animviz.c
rna_armature.c
+ rna_attribute.c
rna_boid.c
rna_brush.c
rna_cachefile.c
@@ -100,9 +101,9 @@ if(WITH_EXPERIMENTAL_FEATURES)
add_definitions(-DWITH_PARTICLE_NODES)
add_definitions(-DWITH_HAIR_NODES)
list(APPEND DEFSRC
+ rna_hair.c
rna_pointcloud.c
rna_simulation.c
- rna_hair.c
)
endif()
@@ -372,6 +373,7 @@ blender_include_dirs(
../../imbuf
../../makesdna
../../nodes/
+ ../../sequencer
../../simulation
../../windowmanager
../../editors/include
@@ -384,14 +386,10 @@ blender_include_dirs(
../../../../intern/mantaflow/extern
)
-blender_include_dirs_sys(
- "${GLEW_INCLUDE_PATH}"
-)
-
add_cc_flags_custom_test(makesrna)
-setup_platform_linker_flags()
add_executable(makesrna ${SRC} ${SRC_RNA_INC} ${SRC_DNA_INC})
+setup_platform_linker_flags(makesrna)
target_link_libraries(makesrna bf_dna)
target_link_libraries(makesrna bf_dna_blenlib)
@@ -442,7 +440,6 @@ set(LIB
bf_editor_undo
)
-add_definitions(${GL_DEFINITIONS})
blender_add_lib(bf_rna "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
diff --git a/source/blender/makesrna/intern/makesrna.c b/source/blender/makesrna/intern/makesrna.c
index 2b1e5b3c702..269db1990b8 100644
--- a/source/blender/makesrna/intern/makesrna.c
+++ b/source/blender/makesrna/intern/makesrna.c
@@ -3199,6 +3199,8 @@ static const char *rna_property_subtypename(PropertySubType type)
return "PROP_PASSWORD";
case PROP_POWER:
return "PROP_POWER";
+ case PROP_TEMPERATURE:
+ return "PROP_TEMPERATURE";
default: {
/* in case we don't have a type preset that includes the subtype */
if (RNA_SUBTYPE_UNIT(type)) {
@@ -3236,6 +3238,8 @@ static const char *rna_property_subtype_unit(PropertySubType type)
return "PROP_UNIT_CAMERA";
case PROP_UNIT_POWER:
return "PROP_UNIT_POWER";
+ case PROP_UNIT_TEMPERATURE:
+ return "PROP_UNIT_TEMPERATURE";
default:
return "PROP_UNIT_UNKNOWN";
}
@@ -4272,6 +4276,7 @@ static RNAProcessItem PROCESS_ITEMS[] = {
{"rna_animation.c", "rna_animation_api.c", RNA_def_animation},
{"rna_animviz.c", NULL, RNA_def_animviz},
{"rna_armature.c", "rna_armature_api.c", RNA_def_armature},
+ {"rna_attribute.c", NULL, RNA_def_attribute},
{"rna_boid.c", NULL, RNA_def_boid},
{"rna_brush.c", NULL, RNA_def_brush},
{"rna_cachefile.c", NULL, RNA_def_cachefile},
@@ -4624,8 +4629,9 @@ static const char *cpp_classes =
" ++i; \\\n"
" } \\\n"
" sname##_##identifier##_end(&iter); \\\n"
- " if (!found) \\\n"
+ " if (!found) { \\\n"
" memset(r_ptr, 0, sizeof(*r_ptr)); \\\n"
+ " } \\\n"
" return found; \\\n"
" } \n"
"#define COLLECTION_PROPERTY_LOOKUP_INT_true(sname, identifier) \\\n"
@@ -4633,8 +4639,9 @@ static const char *cpp_classes =
"PointerRNA *r_ptr) \\\n"
" { \\\n"
" int found = sname##_##identifier##_lookup_int(ptr, key, r_ptr); \\\n"
- " if (!found) \\\n"
+ " if (!found) { \\\n"
" memset(r_ptr, 0, sizeof(*r_ptr)); \\\n"
+ " } \\\n"
" return found; \\\n"
" } \n"
"#define COLLECTION_PROPERTY_LOOKUP_STRING_false(sname, identifier) \\\n"
@@ -4655,13 +4662,15 @@ static const char *cpp_classes =
" *r_ptr = iter.ptr; \\\n"
" found = 1; \\\n"
" } \\\n"
- " if (name_fixed != name) \\\n"
+ " if (name_fixed != name) { \\\n"
" MEM_freeN((void *) name); \\\n"
+ " } \\\n"
" sname##_##identifier##_next(&iter); \\\n"
" } \\\n"
" sname##_##identifier##_end(&iter); \\\n"
- " if (!found) \\\n"
+ " if (!found) { \\\n"
" memset(r_ptr, 0, sizeof(*r_ptr)); \\\n"
+ " } \\\n"
" return found; \\\n"
" } \n"
"#define COLLECTION_PROPERTY_LOOKUP_STRING_true(sname, identifier) \\\n"
@@ -4669,8 +4678,9 @@ static const char *cpp_classes =
"*key, PointerRNA *r_ptr) \\\n"
" { \\\n"
" int found = sname##_##identifier##_lookup_string(ptr, key, r_ptr); \\\n"
- " if (!found) \\\n"
+ " if (!found) { \\\n"
" memset(r_ptr, 0, sizeof(*r_ptr)); \\\n"
+ " } \\\n"
" return found; \\\n"
" } \n"
"#define COLLECTION_PROPERTY(collection_funcs, type, sname, identifier, has_length, "
diff --git a/source/blender/makesrna/intern/rna_ID.c b/source/blender/makesrna/intern/rna_ID.c
index f1c125fcbb9..320476c22b1 100644
--- a/source/blender/makesrna/intern/rna_ID.c
+++ b/source/blender/makesrna/intern/rna_ID.c
@@ -523,16 +523,12 @@ static ID *rna_ID_evaluated_get(ID *id, struct Depsgraph *depsgraph)
static ID *rna_ID_copy(ID *id, Main *bmain)
{
- ID *newid;
+ ID *newid = BKE_id_copy(bmain, id);
- if (BKE_id_copy(bmain, id, &newid)) {
- if (newid != NULL) {
- id_us_min(newid);
- }
- return newid;
+ if (newid != NULL) {
+ id_us_min(newid);
}
-
- return NULL;
+ return newid;
}
static ID *rna_ID_override_create(ID *id, Main *bmain, bool remap_local_usages)
diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c
index 793552c5c34..f9490bd69c5 100644
--- a/source/blender/makesrna/intern/rna_access.c
+++ b/source/blender/makesrna/intern/rna_access.c
@@ -3988,18 +3988,67 @@ int RNA_property_collection_length(PointerRNA *ptr, PropertyRNA *prop)
}
}
+/* This helper checks whether given collection property itself is editable (we only currently
+ * support a limited set of operations, insertion of new items, and re-ordering of those new items
+ * exclusively). */
+static bool property_collection_liboverride_editable(PointerRNA *ptr,
+ PropertyRNA *prop,
+ bool *r_is_liboverride)
+{
+ ID *id = ptr->owner_id;
+ if (id == NULL) {
+ *r_is_liboverride = false;
+ return true;
+ }
+
+ const bool is_liboverride = *r_is_liboverride = ID_IS_OVERRIDE_LIBRARY(id);
+
+ if (!is_liboverride) {
+ /* We return True also for linked data, as it allows tricks like py scripts 'overriding' data
+ * of those.*/
+ return true;
+ }
+
+ if (!RNA_property_overridable_get(ptr, prop)) {
+ return false;
+ }
+
+ if (prop->magic != RNA_MAGIC || (prop->flag & PROP_IDPROPERTY) == 0) {
+ /* Insertion and such not supported for pure IDProperties for now, nor for pure RNA/DNA ones.
+ */
+ return false;
+ }
+ if ((prop->flag_override & PROPOVERRIDE_LIBRARY_INSERTION) == 0) {
+ return false;
+ }
+
+ /* No more checks to do, this collections is overridable. */
+ return true;
+}
+
void RNA_property_collection_add(PointerRNA *ptr, PropertyRNA *prop, PointerRNA *r_ptr)
{
IDProperty *idprop;
- /* CollectionPropertyRNA *cprop = (CollectionPropertyRNA *)prop; */
+ /* CollectionPropertyRNA *cprop = (CollectionPropertyRNA *)prop; */
BLI_assert(RNA_property_type(prop) == PROP_COLLECTION);
+ bool is_liboverride;
+ if (!property_collection_liboverride_editable(ptr, prop, &is_liboverride)) {
+ if (r_ptr) {
+ memset(r_ptr, 0, sizeof(*r_ptr));
+ }
+ return;
+ }
+
if ((idprop = rna_idproperty_check(&prop, ptr))) {
IDPropertyTemplate val = {0};
IDProperty *item;
item = IDP_New(IDP_GROUP, &val, "");
+ if (is_liboverride) {
+ item->flag |= IDP_FLAG_OVERRIDELIBRARY_LOCAL;
+ }
IDP_AppendArray(idprop, item);
/* IDP_AppendArray does a shallow copy (memcpy), only free memory */
/* IDP_FreePropertyContent(item); */
@@ -4016,6 +4065,9 @@ void RNA_property_collection_add(PointerRNA *ptr, PropertyRNA *prop, PointerRNA
IDP_AddToGroup(group, idprop);
item = IDP_New(IDP_GROUP, &val, "");
+ if (is_liboverride) {
+ item->flag |= IDP_FLAG_OVERRIDELIBRARY_LOCAL;
+ }
IDP_AppendArray(idprop, item);
/* IDP_AppendArray does a shallow copy (memcpy), only free memory */
/* IDP_FreePropertyContent(item); */
@@ -4064,6 +4116,11 @@ bool RNA_property_collection_remove(PointerRNA *ptr, PropertyRNA *prop, int key)
BLI_assert(RNA_property_type(prop) == PROP_COLLECTION);
+ bool is_liboverride;
+ if (!property_collection_liboverride_editable(ptr, prop, &is_liboverride)) {
+ return false;
+ }
+
if ((idprop = rna_idproperty_check(&prop, ptr))) {
IDProperty tmp, *array;
int len;
@@ -4072,6 +4129,11 @@ bool RNA_property_collection_remove(PointerRNA *ptr, PropertyRNA *prop, int key)
array = IDP_IDPArray(idprop);
if (key >= 0 && key < len) {
+ if (is_liboverride && (array[key].flag & IDP_FLAG_OVERRIDELIBRARY_LOCAL) == 0) {
+ /* We can only remove items that we actually inserted in the local override. */
+ return false;
+ }
+
if (key + 1 < len) {
/* move element to be removed to the back */
memcpy(&tmp, &array[key], sizeof(IDProperty));
@@ -4118,6 +4180,11 @@ bool RNA_property_collection_move(PointerRNA *ptr, PropertyRNA *prop, int key, i
BLI_assert(RNA_property_type(prop) == PROP_COLLECTION);
+ bool is_liboverride;
+ if (!property_collection_liboverride_editable(ptr, prop, &is_liboverride)) {
+ return false;
+ }
+
if ((idprop = rna_idproperty_check(&prop, ptr))) {
IDProperty tmp, *array;
int len;
@@ -4126,6 +4193,11 @@ bool RNA_property_collection_move(PointerRNA *ptr, PropertyRNA *prop, int key, i
array = IDP_IDPArray(idprop);
if (key >= 0 && key < len && pos >= 0 && pos < len && key != pos) {
+ if (is_liboverride && (array[key].flag & IDP_FLAG_OVERRIDELIBRARY_LOCAL) == 0) {
+ /* We can only move items that we actually inserted in the local override. */
+ return false;
+ }
+
memcpy(&tmp, &array[key], sizeof(IDProperty));
if (pos < key) {
memmove(array + pos + 1, array + pos, sizeof(IDProperty) * (key - pos));
@@ -4151,8 +4223,29 @@ void RNA_property_collection_clear(PointerRNA *ptr, PropertyRNA *prop)
BLI_assert(RNA_property_type(prop) == PROP_COLLECTION);
+ bool is_liboverride;
+ if (!property_collection_liboverride_editable(ptr, prop, &is_liboverride)) {
+ return;
+ }
+
if ((idprop = rna_idproperty_check(&prop, ptr))) {
- IDP_ResizeIDPArray(idprop, 0);
+ if (is_liboverride) {
+ /* We can only move items that we actually inserted in the local override. */
+ int len = idprop->len;
+ IDProperty tmp, *array = IDP_IDPArray(idprop);
+ for (int i = 0; i < len; i++) {
+ if ((array[i].flag & IDP_FLAG_OVERRIDELIBRARY_LOCAL) != 0) {
+ memcpy(&tmp, &array[i], sizeof(IDProperty));
+ memmove(array + i, array + i + 1, sizeof(IDProperty) * (len - (i + 1)));
+ memcpy(&array[len - 1], &tmp, sizeof(IDProperty));
+ IDP_ResizeIDPArray(idprop, --len);
+ i--;
+ }
+ }
+ }
+ else {
+ IDP_ResizeIDPArray(idprop, 0);
+ }
rna_idproperty_touch(idprop);
}
}
@@ -4216,10 +4309,8 @@ int RNA_property_collection_lookup_int(PointerRNA *ptr,
}
}
-int RNA_property_collection_lookup_string(PointerRNA *ptr,
- PropertyRNA *prop,
- const char *key,
- PointerRNA *r_ptr)
+int RNA_property_collection_lookup_string_index(
+ PointerRNA *ptr, PropertyRNA *prop, const char *key, PointerRNA *r_ptr, int *r_index)
{
CollectionPropertyRNA *cprop = (CollectionPropertyRNA *)rna_ensure_property(prop);
@@ -4237,9 +4328,10 @@ int RNA_property_collection_lookup_string(PointerRNA *ptr,
int found = 0;
int keylen = strlen(key);
int namelen;
+ int index = 0;
RNA_property_collection_begin(ptr, prop, &iter);
- for (; iter.valid; RNA_property_collection_next(&iter)) {
+ for (; iter.valid; RNA_property_collection_next(&iter), index++) {
if (iter.ptr.data && iter.ptr.type->nameproperty) {
nameprop = iter.ptr.type->nameproperty;
@@ -4263,12 +4355,25 @@ int RNA_property_collection_lookup_string(PointerRNA *ptr,
if (!iter.valid) {
memset(r_ptr, 0, sizeof(*r_ptr));
+ *r_index = -1;
+ }
+ else {
+ *r_index = index;
}
return iter.valid;
}
}
+int RNA_property_collection_lookup_string(PointerRNA *ptr,
+ PropertyRNA *prop,
+ const char *key,
+ PointerRNA *r_ptr)
+{
+ int index;
+ return RNA_property_collection_lookup_string_index(ptr, prop, key, r_ptr, &index);
+}
+
/* zero return is an assignment error */
int RNA_property_collection_assign_int(PointerRNA *ptr,
PropertyRNA *prop,
@@ -7299,7 +7404,7 @@ ParameterList *RNA_parameter_list_create(ParameterList *parms,
case PROP_STRING: {
const char *defvalue = ((StringPropertyRNA *)parm)->defaultvalue;
if (defvalue && defvalue[0]) {
- /* causes bug [#29988], possibly this is only correct for thick wrapped
+ /* causes bug T29988, possibly this is only correct for thick wrapped
* need to look further into it - campbell */
#if 0
BLI_strncpy(data, defvalue, size);
diff --git a/source/blender/makesrna/intern/rna_access_compare_override.c b/source/blender/makesrna/intern/rna_access_compare_override.c
index ac4553349cc..098854513a4 100644
--- a/source/blender/makesrna/intern/rna_access_compare_override.c
+++ b/source/blender/makesrna/intern/rna_access_compare_override.c
@@ -146,7 +146,7 @@ bool RNA_property_copy(
PropertyRNA *prop_src = prop;
/* Ensure we get real property data,
- * be it an actual RNA property, or an IDProperty in disguise. */
+ * be it an actual RNA property, or an #IDProperty in disguise. */
prop_dst = rna_ensure_property_realdata(&prop_dst, ptr);
prop_src = rna_ensure_property_realdata(&prop_src, fromptr);
@@ -886,9 +886,11 @@ static void rna_property_override_apply_ex(Main *bmain,
if (!do_insert != !ELEM(opop->operation,
IDOVERRIDE_LIBRARY_OP_INSERT_AFTER,
IDOVERRIDE_LIBRARY_OP_INSERT_BEFORE)) {
+#ifndef NDEBUG
if (!do_insert) {
printf("Skipping insert override operations in first pass (%s)!\n", op->rna_path);
}
+#endif
continue;
}
@@ -908,9 +910,18 @@ static void rna_property_override_apply_ex(Main *bmain,
if (opop->subitem_local_name != NULL) {
RNA_property_collection_lookup_string(
ptr_src, prop_src, opop->subitem_local_name, &private_ptr_item_src);
- if (opop->subitem_reference_name != NULL) {
- RNA_property_collection_lookup_string(
- ptr_dst, prop_dst, opop->subitem_reference_name, &private_ptr_item_dst);
+ if (opop->subitem_reference_name != NULL &&
+ RNA_property_collection_lookup_string(
+ ptr_dst, prop_dst, opop->subitem_reference_name, &private_ptr_item_dst)) {
+ /* This is rather fragile, but the fact that local override IDs may have a different name
+ * than their linked reference makes it necessary.
+ * Basically, here we are considering that if we cannot find the original linked ID in
+ * the local override we are (re-)applying the operations, then it may be because some of
+ * those operations have already been applied, and we may already have the local ID
+ * pointer we want to set.
+ * This happens e.g. during re-sync of an override, since we have already remapped all ID
+ * pointers to their expected values.
+ * In that case we simply try to get the property from the local expected name. */
}
else {
RNA_property_collection_lookup_string(
@@ -962,6 +973,23 @@ static void rna_property_override_apply_ex(Main *bmain,
ptr_item_dst = &private_ptr_item_dst;
ptr_item_src = &private_ptr_item_src;
ptr_item_storage = &private_ptr_item_storage;
+
+#ifndef NDEBUG
+ if (ptr_item_dst->type == NULL) {
+ printf("Failed to find destination sub-item '%s' (%d) of '%s' in new override data '%s'\n",
+ opop->subitem_reference_name,
+ opop->subitem_reference_index,
+ op->rna_path,
+ ptr_dst->owner_id->name);
+ }
+ if (ptr_item_src->type == NULL) {
+ printf("Failed to find source sub-item '%s' (%d) of '%s' in old override data '%s'\n",
+ opop->subitem_local_name,
+ opop->subitem_local_index,
+ op->rna_path,
+ ptr_src->owner_id->name);
+ }
+#endif
}
if (!rna_property_override_operation_apply(bmain,
@@ -975,9 +1003,9 @@ static void rna_property_override_apply_ex(Main *bmain,
ptr_item_src,
ptr_item_storage,
opop)) {
- /* TODO No assert here, would be much much better to just report as warning,
- * failing override applications will probably be fairly common! */
- BLI_assert(0);
+ printf("Failed to apply '%s' override operation on %s\n",
+ op->rna_path,
+ ptr_src->owner_id->name);
}
}
}
diff --git a/source/blender/makesrna/intern/rna_animation.c b/source/blender/makesrna/intern/rna_animation.c
index 823446a9d3b..a50d27a726b 100644
--- a/source/blender/makesrna/intern/rna_animation.c
+++ b/source/blender/makesrna/intern/rna_animation.c
@@ -144,14 +144,7 @@ static void rna_AnimData_dependency_update(Main *bmain, Scene *scene, PointerRNA
static int rna_AnimData_action_editable(PointerRNA *ptr, const char **UNUSED(r_info))
{
AnimData *adt = (AnimData *)ptr->data;
-
- /* active action is only editable when it is not a tweaking strip */
- if ((adt->flag & ADT_NLA_EDIT_ON) || (adt->actstrip) || (adt->tmpact)) {
- return 0;
- }
- else {
- return PROP_EDITABLE;
- }
+ return BKE_animdata_action_editable(adt) ? PROP_EDITABLE : 0;
}
static void rna_AnimData_action_set(PointerRNA *ptr,
diff --git a/source/blender/makesrna/intern/rna_armature.c b/source/blender/makesrna/intern/rna_armature.c
index 155943b3b8d..c0a46c65969 100644
--- a/source/blender/makesrna/intern/rna_armature.c
+++ b/source/blender/makesrna/intern/rna_armature.c
@@ -886,6 +886,8 @@ static void rna_def_bone_common(StructRNA *srna, int editbone)
}
RNA_def_property_update(prop, 0, "rna_Bone_update_renamed");
+ RNA_define_lib_overridable(true);
+
/* flags */
prop = RNA_def_property(srna, "layers", PROP_BOOLEAN, PROP_LAYER_MEMBER);
RNA_def_property_boolean_sdna(prop, NULL, "layer", 1);
@@ -1116,6 +1118,8 @@ static void rna_def_bone_common(StructRNA *srna, int editbone)
RNA_def_property_flag(prop, PROP_EDITABLE | PROP_PTR_NO_OWNERSHIP);
RNA_def_property_ui_text(
prop, "B-Bone End Handle", "Bone that serves as the end handle for the B-Bone curve");
+
+ RNA_define_lib_overridable(false);
}
/* err... bones should not be directly edited (only editbones should be...) */
@@ -1149,6 +1153,8 @@ static void rna_def_bone(BlenderRNA *brna)
rna_def_bone_common(srna, 0);
rna_def_bone_curved_common(srna, false, false);
+ RNA_define_lib_overridable(true);
+
/* XXX should we define this in PoseChannel wrapping code instead?
* But PoseChannels directly get some of their flags from here... */
prop = RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE);
@@ -1231,6 +1237,8 @@ static void rna_def_bone(BlenderRNA *brna)
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_ui_text(prop, "Length", "Length of the bone");
+ RNA_define_lib_overridable(false);
+
RNA_api_bone(srna);
}
@@ -1461,6 +1469,8 @@ static void rna_def_armature(BlenderRNA *brna)
/* Animation Data */
rna_def_animdata_common(srna);
+ RNA_define_lib_overridable(true);
+
/* Collections */
prop = RNA_def_property(srna, "bones", PROP_COLLECTION, PROP_NONE);
RNA_def_property_collection_sdna(prop, NULL, "bonebase", NULL);
@@ -1554,6 +1564,8 @@ static void rna_def_armature(BlenderRNA *brna)
RNA_def_property_boolean_funcs(prop, "rna_Armature_is_editmode_get", NULL);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_ui_text(prop, "Is Editmode", "True when used in editmode");
+
+ RNA_define_lib_overridable(false);
}
void RNA_def_armature(BlenderRNA *brna)
diff --git a/source/blender/makesrna/intern/rna_attribute.c b/source/blender/makesrna/intern/rna_attribute.c
new file mode 100644
index 00000000000..9e9575344c5
--- /dev/null
+++ b/source/blender/makesrna/intern/rna_attribute.c
@@ -0,0 +1,680 @@
+/*
+ * 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
+ * \ingroup RNA
+ */
+
+#include <stdlib.h>
+
+#include "RNA_access.h"
+#include "RNA_define.h"
+#include "RNA_enum_types.h"
+
+#include "rna_internal.h"
+
+#include "DNA_customdata_types.h"
+#include "DNA_hair_types.h"
+#include "DNA_mesh_types.h"
+#include "DNA_meshdata_types.h"
+#include "DNA_pointcloud_types.h"
+
+#include "BKE_attribute.h"
+#include "BKE_customdata.h"
+
+#include "WM_types.h"
+
+const EnumPropertyItem rna_enum_attribute_type_items[] = {
+ {CD_PROP_FLOAT, "FLOAT", 0, "Float", "Floating point value"},
+ {CD_PROP_INT32, "INT", 0, "Integer", "32 bit integer"},
+ {CD_PROP_FLOAT3, "FLOAT_VECTOR", 0, "Vector", "3D vector with floating point values"},
+ {CD_PROP_COLOR, "FLOAT_COLOR", 0, "Float Color", "RGBA color with floating point precisions"},
+ {CD_MLOOPCOL, "BYTE_COLOR", 0, "Byte Color", "RGBA color with 8-bit precision"},
+ {CD_PROP_STRING, "STRING", 0, "String", "Text string"},
+ {0, NULL, 0, NULL, NULL},
+};
+
+const EnumPropertyItem rna_enum_attribute_domain_items[] = {
+ /* Not implement yet
+ {ATTR_DOMAIN_GEOMETRY, "GEOMETRY", 0, "Geometry", "Attribute on (whole) geometry"}, */
+ {ATTR_DOMAIN_VERTEX, "VERTEX", 0, "Vertex", "Attribute on mesh vertex"},
+ {ATTR_DOMAIN_EDGE, "EDGE", 0, "Edge", "Attribute on mesh edge"},
+ {ATTR_DOMAIN_CORNER, "CORNER", 0, "Corner", "Attribute on mesh polygon corner"},
+ {ATTR_DOMAIN_POLYGON, "POLYGON", 0, "Polygon", "Attribute on mesh polygons"},
+ /* Not implement yet
+ {ATTR_DOMAIN_GRIDS, "GRIDS", 0, "Grids", "Attribute on mesh multires grids"}, */
+ {ATTR_DOMAIN_POINT, "POINT", 0, "Point", "Attribute on point"},
+ {ATTR_DOMAIN_CURVE, "CURVE", 0, "Curve", "Attribute on hair curve"},
+ {0, NULL, 0, NULL, NULL},
+};
+
+#ifdef RNA_RUNTIME
+
+# include "BLI_math.h"
+
+# include "DEG_depsgraph.h"
+
+# include "BLT_translation.h"
+
+# include "WM_api.h"
+
+/* Attribute */
+
+static char *rna_Attribute_path(PointerRNA *ptr)
+{
+ CustomDataLayer *layer = ptr->data;
+ return BLI_sprintfN("attributes['%s']", layer->name);
+}
+
+static void rna_Attribute_name_set(PointerRNA *ptr, const char *value)
+{
+ BKE_id_attribute_rename(ptr->owner_id, ptr->data, value, NULL);
+}
+
+static int rna_Attribute_name_editable(PointerRNA *ptr, const char **r_info)
+{
+ CustomDataLayer *layer = ptr->data;
+ if (BKE_id_attribute_required(ptr->owner_id, layer)) {
+ *r_info = N_("Can't modify name of required geometry attribute");
+ return false;
+ }
+
+ return true;
+}
+
+static int rna_Attribute_type_get(PointerRNA *ptr)
+{
+ CustomDataLayer *layer = ptr->data;
+ return layer->type;
+}
+
+const EnumPropertyItem *rna_enum_attribute_domain_itemf(ID *id, bool *r_free)
+{
+ EnumPropertyItem *item = NULL;
+ const EnumPropertyItem *domain_item = NULL;
+ const ID_Type id_type = GS(id->name);
+ int totitem = 0, a;
+
+ for (a = 0; rna_enum_attribute_domain_items[a].identifier; a++) {
+ domain_item = &rna_enum_attribute_domain_items[a];
+
+ if (id_type == ID_PT && !ELEM(domain_item->value, ATTR_DOMAIN_POINT)) {
+ continue;
+ }
+ if (id_type == ID_HA && !ELEM(domain_item->value, ATTR_DOMAIN_POINT, ATTR_DOMAIN_CURVE)) {
+ continue;
+ }
+ if (id_type == ID_ME && ELEM(domain_item->value, ATTR_DOMAIN_POINT, ATTR_DOMAIN_CURVE)) {
+ continue;
+ }
+
+ RNA_enum_item_add(&item, &totitem, domain_item);
+ }
+ RNA_enum_item_end(&item, &totitem);
+
+ *r_free = true;
+ return item;
+}
+
+static const EnumPropertyItem *rna_Attribute_domain_itemf(bContext *UNUSED(C),
+ PointerRNA *ptr,
+ PropertyRNA *UNUSED(prop),
+ bool *r_free)
+{
+ return rna_enum_attribute_domain_itemf(ptr->owner_id, r_free);
+}
+
+static int rna_Attribute_domain_get(PointerRNA *ptr)
+{
+ return BKE_id_attribute_domain(ptr->owner_id, ptr->data);
+}
+
+static void rna_Attribute_data_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
+{
+ ID *id = ptr->owner_id;
+ CustomDataLayer *layer = (CustomDataLayer *)ptr->data;
+
+ int length = BKE_id_attribute_data_length(id, layer);
+ size_t struct_size;
+
+ switch (layer->type) {
+ case CD_PROP_FLOAT:
+ struct_size = sizeof(MFloatProperty);
+ break;
+ case CD_PROP_INT32:
+ struct_size = sizeof(MIntProperty);
+ break;
+ case CD_PROP_FLOAT3:
+ struct_size = sizeof(float[3]);
+ break;
+ case CD_PROP_COLOR:
+ struct_size = sizeof(MPropCol);
+ break;
+ case CD_MLOOPCOL:
+ struct_size = sizeof(MLoopCol);
+ break;
+ case CD_PROP_STRING:
+ struct_size = sizeof(MStringProperty);
+ break;
+ default:
+ struct_size = 0;
+ length = 0;
+ break;
+ }
+
+ rna_iterator_array_begin(iter, layer->data, struct_size, length, 0, NULL);
+}
+
+static int rna_Attribute_data_length(PointerRNA *ptr)
+{
+ ID *id = ptr->owner_id;
+ CustomDataLayer *layer = (CustomDataLayer *)ptr->data;
+ return BKE_id_attribute_data_length(id, layer);
+}
+
+static void rna_Attribute_update_data(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
+{
+ ID *id = ptr->owner_id;
+
+ /* cheating way for importers to avoid slow updates */
+ if (id->us > 0) {
+ DEG_id_tag_update(id, 0);
+ WM_main_add_notifier(NC_GEOM | ND_DATA, id);
+ }
+}
+
+/* Color Attribute */
+
+static void rna_ByteColorAttributeValue_color_get(PointerRNA *ptr, float *values)
+{
+ MLoopCol *mlcol = (MLoopCol *)ptr->data;
+ srgb_to_linearrgb_uchar4(values, &mlcol->r);
+}
+
+static void rna_ByteColorAttributeValue_color_set(PointerRNA *ptr, const float *values)
+{
+ MLoopCol *mlcol = (MLoopCol *)ptr->data;
+ linearrgb_to_srgb_uchar4(&mlcol->r, values);
+}
+
+/* Attribute Group */
+
+static PointerRNA rna_AttributeGroup_new(
+ ID *id, ReportList *reports, const char *name, const int type, const int domain)
+{
+ CustomDataLayer *layer = BKE_id_attribute_new(id, name, type, domain, reports);
+ DEG_id_tag_update(id, ID_RECALC_GEOMETRY);
+ WM_main_add_notifier(NC_GEOM | ND_DATA, id);
+
+ PointerRNA ptr;
+ RNA_pointer_create(id, &RNA_Attribute, layer, &ptr);
+ return ptr;
+}
+
+static void rna_AttributeGroup_remove(ID *id, ReportList *reports, PointerRNA *attribute_ptr)
+{
+ CustomDataLayer *layer = (CustomDataLayer *)attribute_ptr->data;
+ BKE_id_attribute_remove(id, layer, reports);
+ RNA_POINTER_INVALIDATE(attribute_ptr);
+
+ DEG_id_tag_update(id, ID_RECALC_GEOMETRY);
+ WM_main_add_notifier(NC_GEOM | ND_DATA, id);
+}
+
+static int rna_Attributes_layer_skip(CollectionPropertyIterator *UNUSED(iter), void *data)
+{
+ CustomDataLayer *layer = (CustomDataLayer *)data;
+ return !(CD_TYPE_AS_MASK(layer->type) & CD_MASK_PROP_ALL);
+}
+
+/* Attributes are spread over multiple domains in separate CustomData, we use repeated
+ * array iterators to loop over all. */
+static void rna_AttributeGroup_next_domain(ID *id,
+ CollectionPropertyIterator *iter,
+ int(skip)(CollectionPropertyIterator *iter, void *data))
+{
+ do {
+ CustomDataLayer *prev_layers = (CustomDataLayer *)iter->internal.array.endptr -
+ iter->internal.array.length;
+ CustomData *customdata = BKE_id_attributes_iterator_next_domain(id, prev_layers);
+ if (customdata == NULL) {
+ return;
+ }
+ rna_iterator_array_begin(
+ iter, customdata->layers, sizeof(CustomDataLayer), customdata->totlayer, false, skip);
+ } while (!iter->valid);
+}
+
+void rna_AttributeGroup_iterator_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
+{
+ memset(&iter->internal.array, 0, sizeof(iter->internal.array));
+ rna_AttributeGroup_next_domain(ptr->owner_id, iter, rna_Attributes_layer_skip);
+}
+
+void rna_AttributeGroup_iterator_next(CollectionPropertyIterator *iter)
+{
+ rna_iterator_array_next(iter);
+
+ if (!iter->valid) {
+ ID *id = iter->parent.owner_id;
+ rna_AttributeGroup_next_domain(id, iter, rna_Attributes_layer_skip);
+ }
+}
+
+PointerRNA rna_AttributeGroup_iterator_get(CollectionPropertyIterator *iter)
+{
+ /* refine to the proper type */
+ StructRNA *type;
+ CustomDataLayer *layer = rna_iterator_array_get(iter);
+
+ switch (layer->type) {
+ case CD_PROP_FLOAT:
+ type = &RNA_FloatAttribute;
+ break;
+ case CD_PROP_INT32:
+ type = &RNA_IntAttribute;
+ break;
+ case CD_PROP_FLOAT3:
+ type = &RNA_FloatVectorAttribute;
+ break;
+ case CD_PROP_COLOR:
+ type = &RNA_FloatColorAttribute;
+ break;
+ case CD_MLOOPCOL:
+ type = &RNA_ByteColorAttribute;
+ break;
+ case CD_PROP_STRING:
+ type = &RNA_StringAttribute;
+ break;
+ default:
+ return PointerRNA_NULL;
+ }
+
+ return rna_pointer_inherit_refine(&iter->parent, type, layer);
+}
+
+int rna_AttributeGroup_length(PointerRNA *ptr)
+{
+ return BKE_id_attributes_length(ptr->owner_id, CD_MASK_PROP_ALL);
+}
+
+static int rna_AttributeGroup_active_index_get(PointerRNA *ptr)
+{
+ return *BKE_id_attributes_active_index_p(ptr->owner_id);
+}
+
+static PointerRNA rna_AttributeGroup_active_get(PointerRNA *ptr)
+{
+ ID *id = ptr->owner_id;
+ CustomDataLayer *layer = BKE_id_attributes_active_get(id);
+
+ PointerRNA attribute_ptr;
+ RNA_pointer_create(id, &RNA_Attribute, layer, &attribute_ptr);
+ return attribute_ptr;
+}
+
+static void rna_AttributeGroup_active_set(PointerRNA *ptr,
+ PointerRNA attribute_ptr,
+ ReportList *UNUSED(reports))
+{
+ ID *id = ptr->owner_id;
+ CustomDataLayer *layer = attribute_ptr.data;
+ BKE_id_attributes_active_set(id, layer);
+}
+
+static void rna_AttributeGroup_active_index_set(PointerRNA *ptr, int value)
+{
+ *BKE_id_attributes_active_index_p(ptr->owner_id) = value;
+}
+
+static void rna_AttributeGroup_active_index_range(
+ PointerRNA *ptr, int *min, int *max, int *softmin, int *softmax)
+{
+ *min = 0;
+ *max = BKE_id_attributes_length(ptr->owner_id, CD_MASK_PROP_ALL);
+
+ *softmin = *min;
+ *softmax = *max;
+}
+
+static void rna_AttributeGroup_update_active(Main *bmain, Scene *scene, PointerRNA *ptr)
+{
+ rna_Attribute_update_data(bmain, scene, ptr);
+}
+
+#else
+
+static void rna_def_attribute_float(BlenderRNA *brna)
+{
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "FloatAttribute", "Attribute");
+ RNA_def_struct_sdna(srna, "CustomDataLayer");
+ RNA_def_struct_ui_text(srna, "Float Attribute", "Geometry attribute with floating point values");
+
+ prop = RNA_def_property(srna, "data", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_struct_type(prop, "FloatAttributeValue");
+ RNA_def_property_collection_funcs(prop,
+ "rna_Attribute_data_begin",
+ "rna_iterator_array_next",
+ "rna_iterator_array_end",
+ "rna_iterator_array_get",
+ "rna_Attribute_data_length",
+ NULL,
+ NULL,
+ NULL);
+
+ srna = RNA_def_struct(brna, "FloatAttributeValue", NULL);
+ RNA_def_struct_sdna(srna, "MFloatProperty");
+ RNA_def_struct_ui_text(
+ srna, "Float Attribute Value", "Floating point value in geometry attribute");
+ prop = RNA_def_property(srna, "value", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "f");
+ RNA_def_property_update(prop, 0, "rna_Attribute_update_data");
+}
+
+static void rna_def_attribute_float_vector(BlenderRNA *brna)
+{
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ /* Float Vector Attribute */
+ srna = RNA_def_struct(brna, "FloatVectorAttribute", "Attribute");
+ RNA_def_struct_sdna(srna, "CustomDataLayer");
+ RNA_def_struct_ui_text(
+ srna, "Float Vector Attribute", "Vector geometry attribute, with floating point precision");
+
+ prop = RNA_def_property(srna, "data", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_struct_type(prop, "FloatVectorAttributeValue");
+ RNA_def_property_collection_funcs(prop,
+ "rna_Attribute_data_begin",
+ "rna_iterator_array_next",
+ "rna_iterator_array_end",
+ "rna_iterator_array_get",
+ "rna_Attribute_data_length",
+ NULL,
+ NULL,
+ NULL);
+
+ /* Float Vector Attribute Value */
+ srna = RNA_def_struct(brna, "FloatVectorAttributeValue", NULL);
+ RNA_def_struct_sdna(srna, "vec3f");
+ RNA_def_struct_ui_text(
+ srna, "Float Vector Attribute Value", "Vector value in geometry attribute");
+
+ prop = RNA_def_property(srna, "vector", PROP_FLOAT, PROP_DIRECTION);
+ RNA_def_property_ui_text(prop, "Vector", "3D vector");
+ RNA_def_property_float_sdna(prop, NULL, "x");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_update(prop, 0, "rna_Attribute_update_data");
+}
+
+static void rna_def_attribute_float_color(BlenderRNA *brna)
+{
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ /* Float Color Attribute */
+ srna = RNA_def_struct(brna, "FloatColorAttribute", "Attribute");
+ RNA_def_struct_sdna(srna, "CustomDataLayer");
+ RNA_def_struct_ui_text(
+ srna, "Float Color Attribute", "Color geometry attribute, with floating point precision");
+
+ prop = RNA_def_property(srna, "data", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_struct_type(prop, "FloatColorAttributeValue");
+ RNA_def_property_collection_funcs(prop,
+ "rna_Attribute_data_begin",
+ "rna_iterator_array_next",
+ "rna_iterator_array_end",
+ "rna_iterator_array_get",
+ "rna_Attribute_data_length",
+ NULL,
+ NULL,
+ NULL);
+
+ /* Float Color Attribute Value */
+ srna = RNA_def_struct(brna, "FloatColorAttributeValue", NULL);
+ RNA_def_struct_sdna(srna, "MPropCol");
+ RNA_def_struct_ui_text(srna, "Float Color Attribute Value", "Color value in geometry attribute");
+
+ prop = RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR);
+ RNA_def_property_ui_text(prop, "Color", "RGBA color in scene linear color space");
+ RNA_def_property_float_sdna(prop, NULL, "color");
+ RNA_def_property_array(prop, 4);
+ RNA_def_property_update(prop, 0, "rna_Attribute_update_data");
+}
+
+static void rna_def_attribute_byte_color(BlenderRNA *brna)
+{
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ /* Byte Color Attribute */
+ srna = RNA_def_struct(brna, "ByteColorAttribute", "Attribute");
+ RNA_def_struct_sdna(srna, "CustomDataLayer");
+ RNA_def_struct_ui_text(
+ srna, "Byte Color Attribute", "Color geometry attribute, with 8-bit precision");
+
+ prop = RNA_def_property(srna, "data", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_struct_type(prop, "ByteColorAttributeValue");
+ RNA_def_property_collection_funcs(prop,
+ "rna_Attribute_data_begin",
+ "rna_iterator_array_next",
+ "rna_iterator_array_end",
+ "rna_iterator_array_get",
+ "rna_Attribute_data_length",
+ NULL,
+ NULL,
+ NULL);
+
+ /* Byte Color Attribute Value */
+ srna = RNA_def_struct(brna, "ByteColorAttributeValue", NULL);
+ RNA_def_struct_sdna(srna, "MLoopCol");
+ RNA_def_struct_ui_text(srna, "Byte Color Attribute Value", "Color value in geometry attribute");
+
+ prop = RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR);
+ RNA_def_property_array(prop, 4);
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_float_funcs(prop,
+ "rna_ByteColorAttributeValue_color_get",
+ "rna_ByteColorAttributeValue_color_set",
+ NULL);
+ RNA_def_property_ui_text(prop, "Color", "RGBA color in scene linear color space");
+ RNA_def_property_update(prop, 0, "rna_Attribute_update_data");
+}
+
+static void rna_def_attribute_int(BlenderRNA *brna)
+{
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "IntAttribute", "Attribute");
+ RNA_def_struct_sdna(srna, "CustomDataLayer");
+ RNA_def_struct_ui_text(srna, "Int Attribute", "Integer geometry attribute");
+
+ prop = RNA_def_property(srna, "data", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_struct_type(prop, "IntAttributeValue");
+ RNA_def_property_collection_funcs(prop,
+ "rna_Attribute_data_begin",
+ "rna_iterator_array_next",
+ "rna_iterator_array_end",
+ "rna_iterator_array_get",
+ "rna_Attribute_data_length",
+ NULL,
+ NULL,
+ NULL);
+
+ srna = RNA_def_struct(brna, "IntAttributeValue", NULL);
+ RNA_def_struct_sdna(srna, "MIntProperty");
+ RNA_def_struct_ui_text(srna, "Integer Attribute Value", "Integer value in geometry attribute");
+ prop = RNA_def_property(srna, "value", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "i");
+ RNA_def_property_update(prop, 0, "rna_Attribute_update_data");
+}
+
+static void rna_def_attribute_string(BlenderRNA *brna)
+{
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "StringAttribute", "Attribute");
+ RNA_def_struct_sdna(srna, "CustomDataLayer");
+ RNA_def_struct_ui_text(srna, "String Attribute", "String geometry attribute");
+
+ prop = RNA_def_property(srna, "data", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_struct_type(prop, "StringAttributeValue");
+ RNA_def_property_collection_funcs(prop,
+ "rna_Attribute_data_begin",
+ "rna_iterator_array_next",
+ "rna_iterator_array_end",
+ "rna_iterator_array_get",
+ "rna_Attribute_data_length",
+ NULL,
+ NULL,
+ NULL);
+
+ srna = RNA_def_struct(brna, "StringAttributeValue", NULL);
+ RNA_def_struct_sdna(srna, "MStringProperty");
+ RNA_def_struct_ui_text(srna, "String Attribute Value", "String value in geometry attribute");
+ prop = RNA_def_property(srna, "value", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "s");
+ RNA_def_property_update(prop, 0, "rna_Attribute_update_data");
+}
+
+static void rna_def_attribute(BlenderRNA *brna)
+{
+ PropertyRNA *prop;
+ StructRNA *srna;
+
+ srna = RNA_def_struct(brna, "Attribute", NULL);
+ RNA_def_struct_sdna(srna, "CustomDataLayer");
+ RNA_def_struct_ui_text(srna, "Attribute", "Geometry attribute");
+ RNA_def_struct_path_func(srna, "rna_Attribute_path");
+
+ prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
+ RNA_def_struct_name_property(srna, prop);
+ RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Attribute_name_set");
+ RNA_def_property_editable_func(prop, "rna_Attribute_name_editable");
+ RNA_def_property_ui_text(prop, "Name", "Name of the Attribute");
+ RNA_def_struct_name_property(srna, prop);
+
+ prop = RNA_def_property(srna, "data_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "type");
+ RNA_def_property_enum_items(prop, rna_enum_attribute_type_items);
+ RNA_def_property_enum_funcs(prop, "rna_Attribute_type_get", NULL, NULL);
+ RNA_def_property_ui_text(prop, "Data Type", "Type of data stored in attribute");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+
+ prop = RNA_def_property(srna, "domain", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, rna_enum_attribute_domain_items);
+ RNA_def_property_enum_funcs(
+ prop, "rna_Attribute_domain_get", NULL, "rna_Attribute_domain_itemf");
+ RNA_def_property_ui_text(prop, "Domain", "Domain of the Attribute");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+
+ /* types */
+ rna_def_attribute_float(brna);
+ rna_def_attribute_float_vector(brna);
+ rna_def_attribute_float_color(brna);
+ rna_def_attribute_byte_color(brna);
+ rna_def_attribute_int(brna);
+ rna_def_attribute_string(brna);
+}
+
+/* Mesh/PointCloud/Hair.attributes */
+static void rna_def_attribute_group(BlenderRNA *brna)
+{
+ StructRNA *srna;
+ PropertyRNA *prop;
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ srna = RNA_def_struct(brna, "AttributeGroup", NULL);
+ RNA_def_struct_ui_text(srna, "Attribute Group", "Group of geometry attributes");
+ RNA_def_struct_sdna(srna, "ID");
+
+ /* API */
+ func = RNA_def_function(srna, "new", "rna_AttributeGroup_new");
+ RNA_def_function_ui_description(func, "Add an attribute");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ parm = RNA_def_string(func, "name", "Attribute", 0, "", "Attribute name");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_enum(
+ func, "type", rna_enum_attribute_type_items, CD_PROP_FLOAT, "Type", "Attribute type");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_enum(func,
+ "domain",
+ rna_enum_attribute_domain_items,
+ ATTR_DOMAIN_VERTEX,
+ "Domain",
+ "Type of element that attribute is stored on");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_pointer(func, "attribute", "Attribute", "", "New geometry attribute");
+ RNA_def_parameter_flags(parm, 0, PARM_RNAPTR);
+ RNA_def_function_return(func, parm);
+
+ func = RNA_def_function(srna, "remove", "rna_AttributeGroup_remove");
+ RNA_def_function_ui_description(func, "Remove an attribute");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ parm = RNA_def_pointer(func, "attribute", "Attribute", "", "Geometry Attribute");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
+ RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
+
+ /* Active */
+ prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "Attribute");
+ RNA_def_property_pointer_funcs(
+ prop, "rna_AttributeGroup_active_get", "rna_AttributeGroup_active_set", NULL, NULL);
+ RNA_def_property_flag(prop, PROP_EDITABLE | PROP_NEVER_UNLINK);
+ RNA_def_property_ui_text(prop, "Active Attribute", "Active attribute");
+ RNA_def_property_update(prop, 0, "rna_AttributeGroup_update_active");
+
+ prop = RNA_def_property(srna, "active_index", PROP_INT, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_int_funcs(prop,
+ "rna_AttributeGroup_active_index_get",
+ "rna_AttributeGroup_active_index_set",
+ "rna_AttributeGroup_active_index_range");
+ RNA_def_property_update(prop, 0, "rna_AttributeGroup_update_active");
+}
+
+void rna_def_attributes_common(StructRNA *srna)
+{
+ PropertyRNA *prop;
+
+ /* Attributes */
+ prop = RNA_def_property(srna, "attributes", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_funcs(prop,
+ "rna_AttributeGroup_iterator_begin",
+ "rna_AttributeGroup_iterator_next",
+ "rna_iterator_array_end",
+ "rna_AttributeGroup_iterator_get",
+ "rna_AttributeGroup_length",
+ NULL,
+ NULL,
+ NULL);
+ RNA_def_property_struct_type(prop, "Attribute");
+ RNA_def_property_ui_text(prop, "Attributes", "Geometry attributes");
+ RNA_def_property_srna(prop, "AttributeGroup");
+}
+
+void RNA_def_attribute(BlenderRNA *brna)
+{
+ rna_def_attribute(brna);
+ rna_def_attribute_group(brna);
+}
+#endif
diff --git a/source/blender/makesrna/intern/rna_brush.c b/source/blender/makesrna/intern/rna_brush.c
index 0b923eb5635..35f5c4c37bc 100644
--- a/source/blender/makesrna/intern/rna_brush.c
+++ b/source/blender/makesrna/intern/rna_brush.c
@@ -18,7 +18,6 @@
* \ingroup RNA
*/
-#include <assert.h>
#include <stdlib.h>
#include "DNA_brush_types.h"
@@ -971,6 +970,38 @@ static bool rna_BrushGpencilSettings_material_poll(PointerRNA *UNUSED(ptr), Poin
return (ma->gp_style != NULL);
}
+static bool rna_GPencilBrush_pin_mode_get(PointerRNA *ptr)
+{
+ Brush *brush = (Brush *)ptr->owner_id;
+ if ((brush != NULL) && (brush->gpencil_settings != NULL)) {
+ return (brush->gpencil_settings->brush_draw_mode != GP_BRUSH_MODE_ACTIVE);
+ }
+ return false;
+}
+
+static void rna_GPencilBrush_pin_mode_set(PointerRNA *UNUSED(ptr), bool UNUSED(value))
+{
+ /* All data is set in update. Keep this function only to avoid RNA compilation errors. */
+ return;
+}
+
+static void rna_GPencilBrush_pin_mode_update(bContext *C, PointerRNA *ptr)
+{
+ Brush *brush = (Brush *)ptr->owner_id;
+ if ((brush != NULL) && (brush->gpencil_settings != NULL)) {
+ if (brush->gpencil_settings->brush_draw_mode != GP_BRUSH_MODE_ACTIVE) {
+ /* If not active, means that must be set to off. */
+ brush->gpencil_settings->brush_draw_mode = GP_BRUSH_MODE_ACTIVE;
+ }
+ else {
+ ToolSettings *ts = CTX_data_tool_settings(C);
+ brush->gpencil_settings->brush_draw_mode = GPENCIL_USE_VERTEX_COLOR(ts) ?
+ GP_BRUSH_MODE_VERTEXCOLOR :
+ GP_BRUSH_MODE_MATERIAL;
+ }
+ }
+}
+
#else
static void rna_def_brush_texture_slot(BlenderRNA *brna)
@@ -1689,13 +1720,22 @@ static void rna_def_gpencil_options(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Direction", "Direction of the fill");
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ prop = RNA_def_property(srna, "pin_draw_mode", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_funcs(
+ prop, "rna_GPencilBrush_pin_mode_get", "rna_GPencilBrush_pin_mode_set");
+ RNA_def_property_ui_icon(prop, ICON_UNPINNED, 1);
+ RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencilBrush_pin_mode_update");
+ RNA_def_property_ui_text(prop, "Pin Mode", "Pin the mode to the brush");
+
prop = RNA_def_property(srna, "brush_draw_mode", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "brush_draw_mode");
RNA_def_property_enum_items(prop, rna_enum_gpencil_brush_modes_items);
RNA_def_property_ui_text(prop, "Mode", "Preselected mode when using this brush");
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- prop = RNA_def_property(srna, "trim", PROP_BOOLEAN, PROP_NONE);
+ prop = RNA_def_property(srna, "use_trim", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_BRUSH_TRIM_STROKE);
RNA_def_property_boolean_default(prop, false);
RNA_def_property_ui_text(prop, "Trim Stroke Ends", "Trim intersecting stroke ends");
@@ -2036,7 +2076,7 @@ static void rna_def_brush(BlenderRNA *brna)
"RADIUS",
0,
"Brush Radius",
- "Applies the deformation in a localiced area limited by the brush radius"},
+ "Applies the deformation in a localized area limited by the brush radius"},
{BRUSH_BOUNDARY_FALLOFF_LOOP,
"LOOP",
0,
@@ -2046,8 +2086,8 @@ static void rna_def_brush(BlenderRNA *brna)
"LOOP_INVERT",
0,
"Loop and Invert",
- "Applies the fallof radius in a loop pattern, inverting the displacement direction in each "
- "pattern repetition"},
+ "Applies the falloff radius in a loop pattern, inverting the displacement direction in "
+ "each pattern repetition"},
{0, NULL, 0, NULL, NULL},
};
@@ -2056,8 +2096,13 @@ static void rna_def_brush(BlenderRNA *brna)
"LOCAL",
0,
"Local",
- "Simulates only a specific area arround the brush limited by a fixed radius"},
+ "Simulates only a specific area around the brush limited by a fixed radius"},
{BRUSH_CLOTH_SIMULATION_AREA_GLOBAL, "GLOBAL", 0, "Global", "Simulates the entire mesh"},
+ {BRUSH_CLOTH_SIMULATION_AREA_DYNAMIC,
+ "DYNAMIC",
+ 0,
+ "Dynamic",
+ "The active simulation area moves with the brush"},
{0, NULL, 0, NULL, NULL},
};
@@ -2941,7 +2986,7 @@ static void rna_def_brush(BlenderRNA *brna)
prop,
"Pin Simulation Boundary",
"Lock the position of the vertices in the simulation falloff area to avoid artifacts and "
- "create a softer transitionwith with unnafected areas");
+ "create a softer transition with unaffected areas");
RNA_def_property_update(prop, 0, "rna_Brush_update");
prop = RNA_def_property(srna, "use_cloth_collision", PROP_BOOLEAN, PROP_NONE);
@@ -2971,6 +3016,13 @@ static void rna_def_brush(BlenderRNA *brna)
prop, "Plane Offset Pressure", "Enable tablet pressure sensitivity for offset");
RNA_def_property_update(prop, 0, "rna_Brush_update");
+ prop = RNA_def_property(srna, "use_pressure_area_radius", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag2", BRUSH_AREA_RADIUS_PRESSURE);
+ RNA_def_property_ui_icon(prop, ICON_STYLUS_PRESSURE, 0);
+ RNA_def_property_ui_text(
+ prop, "Area Radius Pressure", "Enable tablet pressure sensitivity for area radius");
+ RNA_def_property_update(prop, 0, "rna_Brush_update");
+
prop = RNA_def_property(srna, "use_pressure_size", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_SIZE_PRESSURE);
RNA_def_property_ui_icon(prop, ICON_STYLUS_PRESSURE, 0);
diff --git a/source/blender/makesrna/intern/rna_cloth.c b/source/blender/makesrna/intern/rna_cloth.c
index e99bd531c65..27318494428 100644
--- a/source/blender/makesrna/intern/rna_cloth.c
+++ b/source/blender/makesrna/intern/rna_cloth.c
@@ -711,7 +711,6 @@ static void rna_def_cloth_sim_settings(BlenderRNA *brna)
prop = RNA_def_property(srna, "voxel_cell_size", PROP_FLOAT, PROP_UNSIGNED);
RNA_def_property_float_sdna(prop, NULL, "voxel_cell_size");
RNA_def_property_range(prop, 0.0001f, 10000.0f);
- RNA_def_property_float_default(prop, 0.1f);
RNA_def_property_ui_text(
prop, "Voxel Grid Cell Size", "Size of the voxel grid cells for interaction effects");
RNA_def_property_update(prop, 0, "rna_cloth_update");
@@ -1005,7 +1004,6 @@ static void rna_def_cloth_sim_settings(BlenderRNA *brna)
prop = RNA_def_property(srna, "pressure_factor", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "pressure_factor");
RNA_def_property_range(prop, 0.0f, 10000.0f);
- RNA_def_property_float_default(prop, 1.0f);
RNA_def_property_ui_text(prop,
"Pressure Scale",
"Ambient pressure (kPa) that balances out between the inside and "
diff --git a/source/blender/makesrna/intern/rna_collection.c b/source/blender/makesrna/intern/rna_collection.c
index 9c6c95f2819..df1d7abd6b1 100644
--- a/source/blender/makesrna/intern/rna_collection.c
+++ b/source/blender/makesrna/intern/rna_collection.c
@@ -25,11 +25,25 @@
#include "BLI_utildefines.h"
#include "RNA_define.h"
+#include "RNA_enum_types.h"
#include "rna_internal.h"
#include "WM_types.h"
+const EnumPropertyItem rna_enum_collection_color_items[] = {
+ {COLLECTION_COLOR_NONE, "NONE", ICON_X, "None", "Assign no color tag to the collection"},
+ {COLLECTION_COLOR_01, "COLOR_01", ICON_COLLECTION_COLOR_01, "Color 01", ""},
+ {COLLECTION_COLOR_02, "COLOR_02", ICON_COLLECTION_COLOR_02, "Color 02", ""},
+ {COLLECTION_COLOR_03, "COLOR_03", ICON_COLLECTION_COLOR_03, "Color 03", ""},
+ {COLLECTION_COLOR_04, "COLOR_04", ICON_COLLECTION_COLOR_04, "Color 04", ""},
+ {COLLECTION_COLOR_05, "COLOR_05", ICON_COLLECTION_COLOR_05, "Color 05", ""},
+ {COLLECTION_COLOR_06, "COLOR_06", ICON_COLLECTION_COLOR_06, "Color 06", ""},
+ {COLLECTION_COLOR_07, "COLOR_07", ICON_COLLECTION_COLOR_07, "Color 07", ""},
+ {COLLECTION_COLOR_08, "COLOR_08", ICON_COLLECTION_COLOR_08, "Color 08", ""},
+ {0, NULL, 0, NULL, NULL},
+};
+
#ifdef RNA_RUNTIME
# include "DNA_object_types.h"
@@ -154,13 +168,17 @@ static bool rna_Collection_objects_override_apply(Main *bmain,
Collection *coll_dst = (Collection *)ptr_dst->owner_id;
if (ptr_item_dst->type == NULL || ptr_item_src->type == NULL) {
- BLI_assert(0 && "invalid source or destination object.");
+ // BLI_assert(0 && "invalid source or destination object.");
return false;
}
Object *ob_dst = ptr_item_dst->data;
Object *ob_src = ptr_item_src->data;
+ if (ob_src == ob_dst) {
+ return true;
+ }
+
CollectionObject *cob_dst = BLI_findptr(
&coll_dst->gobject, ob_dst, offsetof(CollectionObject, ob));
@@ -474,6 +492,12 @@ void RNA_def_collections(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Disable in Renders", "Globally disable in renders");
RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_Collection_flag_update");
+ prop = RNA_def_property(srna, "color_tag", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "color_tag");
+ RNA_def_property_enum_items(prop, rna_enum_collection_color_items);
+ RNA_def_property_ui_text(prop, "Collection Color", "Color tag for a collection");
+ RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, NULL);
+
RNA_define_lib_overridable(false);
}
diff --git a/source/blender/makesrna/intern/rna_constraint.c b/source/blender/makesrna/intern/rna_constraint.c
index d9dd35c4280..653056e4dc1 100644
--- a/source/blender/makesrna/intern/rna_constraint.c
+++ b/source/blender/makesrna/intern/rna_constraint.c
@@ -1790,6 +1790,21 @@ static void rna_def_constraint_action(BlenderRNA *brna)
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
RNA_def_property_float_funcs(prop, NULL, NULL, "rna_ActionConstraint_minmax_range");
+ prop = RNA_def_property(srna, "eval_time", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "eval_time");
+ RNA_def_property_range(prop, 0.f, 1.f);
+ RNA_def_property_ui_text(
+ prop, "Evaluation Time", "Interpolates between Action Start and End frames");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+
+ prop = RNA_def_property(srna, "use_eval_time", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", ACTCON_USE_EVAL_TIME);
+ RNA_def_property_ui_text(prop,
+ "Use Evaluation Time",
+ "Interpolate between Action Start and End frames, with the Evaluation "
+ "Time slider instead of the Target object/bone");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+
RNA_define_lib_overridable(false);
}
diff --git a/source/blender/makesrna/intern/rna_curve.c b/source/blender/makesrna/intern/rna_curve.c
index 1768d79fe8f..2d6bf2897e0 100644
--- a/source/blender/makesrna/intern/rna_curve.c
+++ b/source/blender/makesrna/intern/rna_curve.c
@@ -167,6 +167,7 @@ static const EnumPropertyItem curve2d_fill_mode_items[] = {
# include "DNA_object_types.h"
# include "BKE_curve.h"
+# include "BKE_curveprofile.h"
# include "BKE_main.h"
# include "DEG_depsgraph.h"
@@ -463,6 +464,35 @@ static void rna_Curve_bevelObject_set(PointerRNA *ptr,
}
}
+/**
+ * Special update function for setting the number of segments of the curve
+ * that also resamples the segments in the custom profile.
+ */
+static void rna_Curve_bevel_resolution_update(Main *bmain, Scene *scene, PointerRNA *ptr)
+{
+ Curve *cu = (Curve *)ptr->data;
+
+ if (cu->bevel_mode == CU_BEV_MODE_CURVE_PROFILE) {
+ BKE_curveprofile_init(cu->bevel_profile, cu->bevresol + 1);
+ }
+
+ rna_Curve_update_data(bmain, scene, ptr);
+}
+
+static void rna_Curve_bevel_mode_set(PointerRNA *ptr, int value)
+{
+ Curve *cu = (Curve *)ptr->owner_id;
+
+ if (value == CU_BEV_MODE_CURVE_PROFILE) {
+ if (cu->bevel_profile == NULL) {
+ cu->bevel_profile = BKE_curveprofile_add(PROF_PRESET_LINE);
+ BKE_curveprofile_init(cu->bevel_profile, cu->bevresol + 1);
+ }
+ }
+
+ cu->bevel_mode = value;
+}
+
static bool rna_Curve_otherObject_poll(PointerRNA *ptr, PointerRNA value)
{
Curve *cu = (Curve *)ptr->owner_id;
@@ -901,17 +931,17 @@ static void rna_def_beztriple(BlenderRNA *brna)
/* Boolean values */
prop = RNA_def_property(srna, "select_left_handle", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "f1", 0);
+ RNA_def_property_boolean_sdna(prop, NULL, "f1", SELECT);
RNA_def_property_ui_text(prop, "Handle 1 selected", "Handle 1 selection status");
RNA_def_property_update(prop, 0, "rna_Curve_update_data");
prop = RNA_def_property(srna, "select_right_handle", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "f3", 0);
+ RNA_def_property_boolean_sdna(prop, NULL, "f3", SELECT);
RNA_def_property_ui_text(prop, "Handle 2 selected", "Handle 2 selection status");
RNA_def_property_update(prop, 0, "rna_Curve_update_data");
prop = RNA_def_property(srna, "select_control_point", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "f2", 0);
+ RNA_def_property_boolean_sdna(prop, NULL, "f2", SELECT);
RNA_def_property_ui_text(prop, "Control Point selected", "Control point selection status");
RNA_def_property_update(prop, 0, "rna_Curve_update_data");
@@ -1512,18 +1542,37 @@ static void rna_def_curve(BlenderRNA *brna)
"RESOLUTION",
0,
"Resolution",
- "Map the bevel factor to the number of subdivisions of a spline (U resolution)"},
+ "Map the geometry factor to the number of subdivisions of a spline (U resolution)"},
{CU_BEVFAC_MAP_SEGMENT,
"SEGMENTS",
0,
"Segments",
- "Map the bevel factor to the length of a segment and to the number of subdivisions of a "
+ "Map the geometry factor to the length of a segment and to the number of subdivisions of a "
"segment"},
{CU_BEVFAC_MAP_SPLINE,
"SPLINE",
0,
"Spline",
- "Map the bevel factor to the length of a spline"},
+ "Map the geometry factor to the length of a spline"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem bevel_mode_items[] = {
+ {CU_BEV_MODE_ROUND,
+ "ROUND",
+ 0,
+ "Round",
+ "Use circle for the section of the curve's bevel geometry"},
+ {CU_BEV_MODE_OBJECT,
+ "OBJECT",
+ 0,
+ "Object",
+ "Use an object for the section of the curve's bevel geometry segment"},
+ {CU_BEV_MODE_CURVE_PROFILE,
+ "PROFILE",
+ 0,
+ "Profile",
+ "Use a custom profile for each quarter of curve's bevel geometry"},
{0, NULL, 0, NULL, NULL},
};
@@ -1559,36 +1608,53 @@ static void rna_def_curve(BlenderRNA *brna)
rna_def_path(brna, srna);
+ prop = RNA_def_property(srna, "bevel_mode", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "bevel_mode");
+ RNA_def_property_enum_items(prop, bevel_mode_items);
+ RNA_def_property_ui_text(
+ prop, "Bevel Mode", "Determine how to build the curve's bevel geometry");
+ RNA_def_property_enum_funcs(prop, NULL, "rna_Curve_bevel_mode_set", NULL);
+ /* Use this update function so the curve profile is properly initialized when
+ * switching back to "Profile" mode after changing the resolution. */
+ RNA_def_property_update(prop, 0, "rna_Curve_bevel_resolution_update");
+
+ prop = RNA_def_property(srna, "bevel_profile", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "CurveProfile");
+ RNA_def_property_pointer_sdna(prop, NULL, "bevel_profile");
+ RNA_def_property_ui_text(prop, "Custom Profile Path", "The path for the curve's custom profile");
+ RNA_def_property_update(prop, 0, "rna_Curve_update_data");
+
/* Number values */
prop = RNA_def_property(srna, "bevel_resolution", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "bevresol");
RNA_def_property_range(prop, 0, 32);
RNA_def_property_ui_range(prop, 0, 32, 1.0, -1);
RNA_def_property_ui_text(
- prop,
- "Bevel Resolution",
- "Bevel resolution when depth is non-zero and no specific bevel object has been defined");
- RNA_def_property_update(prop, 0, "rna_Curve_update_data");
+ prop, "Bevel Resolution", "The number of segments in each quarter-circle of the bevel");
+ RNA_def_property_update(prop, 0, "rna_Curve_bevel_resolution_update");
prop = RNA_def_property(srna, "offset", PROP_FLOAT, PROP_NONE | PROP_UNIT_LENGTH);
RNA_def_property_float_sdna(prop, NULL, "width");
RNA_def_property_ui_range(prop, -1.0, 1.0, 0.1, 3);
RNA_def_property_float_funcs(prop, "rna_Curve_offset_get", "rna_Curve_offset_set", NULL);
- RNA_def_property_ui_text(prop, "Offset", "Offset the curve to adjust the width of a text");
+ RNA_def_property_ui_text(prop, "Offset", "Distance to move the curve parallel to its normals");
RNA_def_property_update(prop, 0, "rna_Curve_update_data");
prop = RNA_def_property(srna, "extrude", PROP_FLOAT, PROP_NONE | PROP_UNIT_LENGTH);
RNA_def_property_float_sdna(prop, NULL, "ext1");
RNA_def_property_ui_range(prop, 0, 100.0, 0.1, 3);
RNA_def_property_range(prop, 0.0, FLT_MAX);
- RNA_def_property_ui_text(
- prop, "Extrude", "Amount of curve extrusion when not using a bevel object");
+ RNA_def_property_ui_text(prop,
+ "Extrude",
+ "Length of the depth added in the local Z direction along the curve, "
+ "perpendicular to its normals");
RNA_def_property_update(prop, 0, "rna_Curve_update_data");
prop = RNA_def_property(srna, "bevel_depth", PROP_FLOAT, PROP_NONE | PROP_UNIT_LENGTH);
RNA_def_property_float_sdna(prop, NULL, "ext2");
RNA_def_property_ui_range(prop, 0, 100.0, 0.1, 3);
- RNA_def_property_ui_text(prop, "Bevel Depth", "Bevel depth when not using a bevel object");
+ RNA_def_property_ui_text(
+ prop, "Bevel Depth", "Radius of the bevel geometry, not including extrusion");
RNA_def_property_update(prop, 0, "rna_Curve_update_data");
prop = RNA_def_property(srna, "resolution_u", PROP_INT, PROP_NONE);
@@ -1596,7 +1662,10 @@ static void rna_def_curve(BlenderRNA *brna)
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_range(prop, 1, 1024);
RNA_def_property_ui_range(prop, 1, 64, 1, -1);
- RNA_def_property_ui_text(prop, "Resolution U", "Surface resolution in U direction");
+ RNA_def_property_ui_text(
+ prop,
+ "Resolution U",
+ "Number of computed points in the U direction between every pair of control points");
RNA_def_property_update(prop, 0, "rna_Curve_resolution_u_update_data");
prop = RNA_def_property(srna, "resolution_v", PROP_INT, PROP_NONE);
@@ -1604,7 +1673,10 @@ static void rna_def_curve(BlenderRNA *brna)
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_ui_range(prop, 1, 64, 1, -1);
RNA_def_property_range(prop, 1, 1024);
- RNA_def_property_ui_text(prop, "Resolution V", "Surface resolution in V direction");
+ RNA_def_property_ui_text(
+ prop,
+ "Resolution V",
+ "The number of computed points in the V direction between every pair of control points");
RNA_def_property_update(prop, 0, "rna_Curve_resolution_v_update_data");
prop = RNA_def_property(srna, "render_resolution_u", PROP_INT, PROP_NONE);
@@ -1640,7 +1712,8 @@ static void rna_def_curve(BlenderRNA *brna)
RNA_def_property_pointer_sdna(prop, NULL, "bevobj");
RNA_def_property_flag(prop, PROP_EDITABLE);
RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
- RNA_def_property_ui_text(prop, "Bevel Object", "Curve object name that defines the bevel shape");
+ RNA_def_property_ui_text(
+ prop, "Bevel Object", "The name of the Curve object that defines the bevel shape");
RNA_def_property_update(prop, 0, "rna_Curve_update_deps");
RNA_def_property_pointer_funcs(prop,
"rna_Curve_bevelObject_get",
@@ -1688,14 +1761,14 @@ static void rna_def_curve(BlenderRNA *brna)
RNA_def_property_enum_sdna(prop, NULL, "bevfac1_mapping");
RNA_def_property_enum_items(prop, bevfac_mapping_items);
RNA_def_property_ui_text(
- prop, "Start Mapping Type", "Determines how the start bevel factor is mapped to a spline");
+ prop, "Start Mapping Type", "Determine how the geometry start factor is mapped to a spline");
RNA_def_property_update(prop, 0, "rna_Curve_update_data");
prop = RNA_def_property(srna, "bevel_factor_mapping_end", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "bevfac2_mapping");
RNA_def_property_enum_items(prop, bevfac_mapping_items);
RNA_def_property_ui_text(
- prop, "End Mapping Type", "Determines how the end bevel factor is mapped to a spline");
+ prop, "End Mapping Type", "Determine how the geometry end factor is mapped to a spline");
RNA_def_property_update(prop, 0, "rna_Curve_update_data");
/* XXX - would be nice to have a better way to do this, only add for testing. */
@@ -1762,18 +1835,18 @@ static void rna_def_curve(BlenderRNA *brna)
RNA_def_property_float_sdna(prop, NULL, "bevfac1");
RNA_def_property_range(prop, 0, 1.0);
RNA_def_property_ui_text(prop,
- "Start Bevel Factor",
- "Factor that defines from where beveling of spline happens (0=from the "
- "very beginning, 1=from the very end)");
+ "Geometry Start Factor",
+ "Define where along the spline the curve geometry starts (0 for the "
+ "beginning, 1 for the end)");
RNA_def_property_update(prop, 0, "rna_Curve_update_data");
prop = RNA_def_property(srna, "bevel_factor_end", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_float_sdna(prop, NULL, "bevfac2");
RNA_def_property_range(prop, 0, 1.0);
RNA_def_property_ui_text(prop,
- "End Bevel Factor",
- "Factor that defines to where beveling of spline happens (0=to the "
- "very beginning, 1=to the very end)");
+ "Geometry End Factor",
+ "Define where along the spline the curve geometry ends (0 for the "
+ "beginning, 1 for the end)");
RNA_def_property_update(prop, 0, "rna_Curve_update_data");
prop = RNA_def_property(srna, "is_editmode", PROP_BOOLEAN, PROP_NONE);
diff --git a/source/blender/makesrna/intern/rna_define.c b/source/blender/makesrna/intern/rna_define.c
index e94dad59176..875c5398488 100644
--- a/source/blender/makesrna/intern/rna_define.c
+++ b/source/blender/makesrna/intern/rna_define.c
@@ -457,8 +457,7 @@ static int rna_find_sdna_member(SDNA *sdna,
int *offset)
{
const char *dnaname;
- const short *sp;
- int a, b, structnr, totmember, cmp;
+ int b, structnr, cmp;
if (!DefRNA.preprocess) {
CLOG_ERROR(&LOG, "only during preprocessing.");
@@ -474,17 +473,15 @@ static int rna_find_sdna_member(SDNA *sdna,
return 0;
}
- sp = sdna->structs[structnr];
- totmember = sp[1];
- sp += 2;
-
- for (a = 0; a < totmember; a++, sp += 2) {
- const int size = DNA_elem_size_nr(sdna, sp[0], sp[1]);
- dnaname = sdna->alias.names[sp[1]];
+ const SDNA_Struct *struct_info = sdna->structs[structnr];
+ for (int a = 0; a < struct_info->members_len; a++) {
+ const SDNA_StructMember *member = &struct_info->members[a];
+ const int size = DNA_elem_size_nr(sdna, member->type, member->name);
+ dnaname = sdna->alias.names[member->name];
cmp = rna_member_cmp(dnaname, membername);
if (cmp == 1) {
- smember->type = sdna->alias.types[sp[0]];
+ smember->type = sdna->alias.types[member->type];
smember->name = dnaname;
smember->offset = *offset;
smember->size = size;
@@ -512,7 +509,7 @@ static int rna_find_sdna_member(SDNA *sdna,
smember->arraylength = 0;
membername = strstr(membername, ".") + strlen(".");
- rna_find_sdna_member(sdna, sdna->alias.types[sp[0]], membername, smember, offset);
+ rna_find_sdna_member(sdna, sdna->alias.types[member->type], membername, smember, offset);
return 1;
}
@@ -528,7 +525,7 @@ static int rna_find_sdna_member(SDNA *sdna,
*offset = -1;
}
membername = strstr(membername, "->") + strlen("->");
- rna_find_sdna_member(sdna, sdna->alias.types[sp[0]], membername, smember, offset);
+ rna_find_sdna_member(sdna, sdna->alias.types[member->type], membername, smember, offset);
return 1;
}
diff --git a/source/blender/makesrna/intern/rna_depsgraph.c b/source/blender/makesrna/intern/rna_depsgraph.c
index da1ed166eb2..ed0fe3f7765 100644
--- a/source/blender/makesrna/intern/rna_depsgraph.c
+++ b/source/blender/makesrna/intern/rna_depsgraph.c
@@ -43,6 +43,8 @@
# include "BLI_iterator.h"
# include "BLI_math.h"
+# include "RNA_access.h"
+
# include "BKE_duplilist.h"
# include "BKE_object.h"
# include "BKE_scene.h"
@@ -461,14 +463,19 @@ static PointerRNA rna_Depsgraph_scene_get(PointerRNA *ptr)
{
Depsgraph *depsgraph = (Depsgraph *)ptr->data;
Scene *scene = DEG_get_input_scene(depsgraph);
- return rna_pointer_inherit_refine(ptr, &RNA_Scene, scene);
+ PointerRNA newptr;
+ RNA_pointer_create(&scene->id, &RNA_Scene, scene, &newptr);
+ return newptr;
}
static PointerRNA rna_Depsgraph_view_layer_get(PointerRNA *ptr)
{
Depsgraph *depsgraph = (Depsgraph *)ptr->data;
+ Scene *scene = DEG_get_input_scene(depsgraph);
ViewLayer *view_layer = DEG_get_input_view_layer(depsgraph);
- return rna_pointer_inherit_refine(ptr, &RNA_ViewLayer, view_layer);
+ PointerRNA newptr;
+ RNA_pointer_create(&scene->id, &RNA_ViewLayer, view_layer, &newptr);
+ return newptr;
}
static PointerRNA rna_Depsgraph_scene_eval_get(PointerRNA *ptr)
@@ -476,13 +483,19 @@ static PointerRNA rna_Depsgraph_scene_eval_get(PointerRNA *ptr)
Depsgraph *depsgraph = (Depsgraph *)ptr->data;
Scene *scene_eval = DEG_get_evaluated_scene(depsgraph);
return rna_pointer_inherit_refine(ptr, &RNA_Scene, scene_eval);
+ PointerRNA newptr;
+ RNA_pointer_create(&scene_eval->id, &RNA_Scene, scene_eval, &newptr);
+ return newptr;
}
static PointerRNA rna_Depsgraph_view_layer_eval_get(PointerRNA *ptr)
{
Depsgraph *depsgraph = (Depsgraph *)ptr->data;
+ Scene *scene_eval = DEG_get_evaluated_scene(depsgraph);
ViewLayer *view_layer_eval = DEG_get_evaluated_view_layer(depsgraph);
- return rna_pointer_inherit_refine(ptr, &RNA_ViewLayer, view_layer_eval);
+ PointerRNA newptr;
+ RNA_pointer_create(&scene_eval->id, &RNA_ViewLayer, view_layer_eval, &newptr);
+ return newptr;
}
#else
diff --git a/source/blender/makesrna/intern/rna_fcurve.c b/source/blender/makesrna/intern/rna_fcurve.c
index b704a4b06a5..7dc109ee009 100644
--- a/source/blender/makesrna/intern/rna_fcurve.c
+++ b/source/blender/makesrna/intern/rna_fcurve.c
@@ -588,15 +588,13 @@ static bool rna_FCurve_is_empty_get(PointerRNA *ptr)
return BKE_fcurve_is_empty(fcu);
}
-static void rna_tag_animation_update(Main *bmain, ID *id, bool flush)
+static void rna_tag_animation_update(Main *bmain, ID *id)
{
- /* Actually recalculate object properties, or just update COW. */
- int tags = flush ? ID_RECALC_ANIMATION : ID_RECALC_ANIMATION_NO_FLUSH;
-
+ const int tags = ID_RECALC_ANIMATION;
AnimData *adt = BKE_animdata_from_id(id);
if (adt && adt->action) {
- /* action is separate datablock, needs separate tag */
+ /* Action is separate datablock, needs separate tag. */
DEG_id_tag_update_ex(bmain, &adt->action->id, tags);
}
@@ -609,7 +607,7 @@ static void rna_FCurve_update_data_ex(ID *id, FCurve *fcu, Main *bmain)
sort_time_fcurve(fcu);
calchandles_fcurve(fcu);
- rna_tag_animation_update(bmain, id, true);
+ rna_tag_animation_update(bmain, id);
}
/* RNA update callback for F-Curves after curve shape changes */
@@ -631,7 +629,7 @@ static void rna_FCurve_update_data_relations(Main *bmain,
*/
static void rna_FCurve_update_eval(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
{
- rna_tag_animation_update(bmain, ptr->owner_id, true);
+ rna_tag_animation_update(bmain, ptr->owner_id);
}
static PointerRNA rna_FCurve_active_modifier_get(PointerRNA *ptr)
@@ -709,7 +707,7 @@ static void rna_FModifier_start_frame_range(PointerRNA *UNUSED(ptr),
// FModifier *fcm = (FModifier *)ptr->data;
/* Technically, "sfra <= efra" must hold; however, we can't strictly enforce that,
- * or else it becomes tricky to adjust the range... [#36844]
+ * or else it becomes tricky to adjust the range, see: T36844.
*
* NOTE: we do not set soft-limits on lower bounds, as it's too confusing when you
* can't easily use the slider to set things here
@@ -724,8 +722,7 @@ static void rna_FModifier_end_frame_range(
FModifier *fcm = (FModifier *)ptr->data;
/* Technically, "sfra <= efra" must hold; however, we can't strictly enforce that,
- * or else it becomes tricky to adjust the range... [#36844]
- */
+ * or else it becomes tricky to adjust the range, see: T36844. */
*min = MINAFRAMEF;
*softmin = (fcm->flag & FMODIFIER_FLAG_RANGERESTRICT) ? fcm->sfra : MINAFRAMEF;
@@ -751,7 +748,7 @@ static void rna_FModifier_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *
calchandles_fcurve(fcm->curve);
}
- rna_tag_animation_update(bmain, id, true);
+ rna_tag_animation_update(bmain, id);
}
static void rna_FModifier_verify_data_update(Main *bmain, Scene *scene, PointerRNA *ptr)
@@ -977,7 +974,7 @@ static BezTriple *rna_FKeyframe_points_insert(
fcu, frame, value, (char)keyframe_type, flag | INSERTKEY_NO_USERPREF);
if ((fcu->bezt) && (index >= 0)) {
- rna_tag_animation_update(bmain, id, true);
+ rna_tag_animation_update(bmain, id);
return fcu->bezt + index;
}
@@ -1003,7 +1000,7 @@ static void rna_FKeyframe_points_add(ID *id, FCurve *fcu, Main *bmain, int tot)
bezt++;
}
- rna_tag_animation_update(bmain, id, true);
+ rna_tag_animation_update(bmain, id);
}
}
@@ -1020,7 +1017,7 @@ static void rna_FKeyframe_points_remove(
delete_fcurve_key(fcu, index, !do_fast);
RNA_POINTER_INVALIDATE(bezt_ptr);
- rna_tag_animation_update(bmain, id, true);
+ rna_tag_animation_update(bmain, id);
}
static FCM_EnvelopeData *rna_FModifierEnvelope_points_add(
@@ -1030,7 +1027,7 @@ static FCM_EnvelopeData *rna_FModifierEnvelope_points_add(
FMod_Envelope *env = (FMod_Envelope *)fmod->data;
int i;
- rna_tag_animation_update(bmain, id, true);
+ rna_tag_animation_update(bmain, id);
/* init template data */
fed.min = -1.0f;
@@ -1082,7 +1079,7 @@ static void rna_FModifierEnvelope_points_remove(
return;
}
- rna_tag_animation_update(bmain, id, true);
+ rna_tag_animation_update(bmain, id);
if (env->totvert > 1) {
/* move data after the removed point */
@@ -1109,7 +1106,7 @@ static void rna_FModifierEnvelope_points_remove(
static void rna_Keyframe_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
{
- rna_tag_animation_update(bmain, ptr->owner_id, true);
+ rna_tag_animation_update(bmain, ptr->owner_id);
}
static void rna_FModifier_show_expanded_set(PointerRNA *ptr, bool value)
@@ -2024,17 +2021,17 @@ static void rna_def_fkeyframe(BlenderRNA *brna)
/* Boolean values */
prop = RNA_def_property(srna, "select_left_handle", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "f1", 0);
+ RNA_def_property_boolean_sdna(prop, NULL, "f1", SELECT);
RNA_def_property_ui_text(prop, "Handle 1 selected", "Left handle selection status");
RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_SELECTED, NULL);
prop = RNA_def_property(srna, "select_right_handle", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "f3", 0);
+ RNA_def_property_boolean_sdna(prop, NULL, "f3", SELECT);
RNA_def_property_ui_text(prop, "Handle 2 selected", "Right handle selection status");
RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_SELECTED, NULL);
prop = RNA_def_property(srna, "select_control_point", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "f2", 0);
+ RNA_def_property_boolean_sdna(prop, NULL, "f2", SELECT);
RNA_def_property_ui_text(prop, "Select", "Control point selection status");
RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_SELECTED, NULL);
diff --git a/source/blender/makesrna/intern/rna_fluid.c b/source/blender/makesrna/intern/rna_fluid.c
index 0a58f8af593..cb64d81533f 100644
--- a/source/blender/makesrna/intern/rna_fluid.c
+++ b/source/blender/makesrna/intern/rna_fluid.c
@@ -660,8 +660,8 @@ static void rna_Fluid_cache_directory_set(struct PointerRNA *ptr, const char *va
BLI_strncpy(settings->cache_directory, value, sizeof(settings->cache_directory));
- /* TODO (sebbas): Read cache state in order to set cache bake flags and cache pause frames
- * correctly */
+ /* TODO(sebbas): Read cache state in order to set cache bake flags and cache pause frames
+ * correctly. */
// settings->cache_flag = 0;
}
@@ -670,6 +670,7 @@ static void rna_Fluid_domaintype_set(struct PointerRNA *ptr, int value)
FluidDomainSettings *settings = (FluidDomainSettings *)ptr->data;
Object *ob = (Object *)ptr->owner_id;
BKE_fluid_domain_type_set(ob, settings, value);
+ BKE_fluid_coba_field_sanitize(settings);
}
static char *rna_FluidDomainSettings_path(PointerRNA *ptr)
@@ -1041,6 +1042,159 @@ static void rna_Fluid_flowtype_set(struct PointerRNA *ptr, int value)
}
}
+static const EnumPropertyItem *rna_Fluid_cobafield_itemf(bContext *UNUSED(C),
+ PointerRNA *ptr,
+ PropertyRNA *UNUSED(prop),
+ bool *r_free)
+{
+ FluidDomainSettings *settings = (FluidDomainSettings *)ptr->data;
+
+ EnumPropertyItem *item = NULL;
+ EnumPropertyItem tmp = {0, "", 0, "", ""};
+ int totitem = 0;
+
+ tmp.value = FLUID_DOMAIN_FIELD_FLAGS;
+ tmp.identifier = "FLAGS";
+ tmp.icon = 0;
+ tmp.name = "Flags";
+ tmp.description = "Flag grid of the fluid domain";
+ RNA_enum_item_add(&item, &totitem, &tmp);
+
+ tmp.value = FLUID_DOMAIN_FIELD_PRESSURE;
+ tmp.identifier = "PRESSURE";
+ tmp.icon = 0;
+ tmp.name = "Pressure";
+ tmp.description = "Pressure field of the fluid domain";
+ RNA_enum_item_add(&item, &totitem, &tmp);
+
+ tmp.value = FLUID_DOMAIN_FIELD_VELOCITY_X;
+ tmp.identifier = "VELOCITY_X";
+ tmp.icon = 0;
+ tmp.name = "X Velocity";
+ tmp.description = "X component of the velocity field";
+ RNA_enum_item_add(&item, &totitem, &tmp);
+
+ tmp.value = FLUID_DOMAIN_FIELD_VELOCITY_Y;
+ tmp.identifier = "VELOCITY_Y";
+ tmp.icon = 0;
+ tmp.name = "Y Velocity";
+ tmp.description = "Y component of the velocity field";
+ RNA_enum_item_add(&item, &totitem, &tmp);
+
+ tmp.value = FLUID_DOMAIN_FIELD_VELOCITY_Z;
+ tmp.identifier = "VELOCITY_Z";
+ tmp.icon = 0;
+ tmp.name = "Z Velocity";
+ tmp.description = "Z component of the velocity field";
+ RNA_enum_item_add(&item, &totitem, &tmp);
+
+ tmp.value = FLUID_DOMAIN_FIELD_FORCE_X;
+ tmp.identifier = "FORCE_X";
+ tmp.icon = 0;
+ tmp.name = "X Force";
+ tmp.description = "X component of the force field";
+ RNA_enum_item_add(&item, &totitem, &tmp);
+
+ tmp.value = FLUID_DOMAIN_FIELD_FORCE_Y;
+ tmp.identifier = "FORCE_Y";
+ tmp.icon = 0;
+ tmp.name = "Y Force";
+ tmp.description = "Y component of the force field";
+ RNA_enum_item_add(&item, &totitem, &tmp);
+
+ tmp.value = FLUID_DOMAIN_FIELD_FORCE_Z;
+ tmp.identifier = "FORCE_Z";
+ tmp.icon = 0;
+ tmp.name = "Z Force";
+ tmp.description = "Z component of the force field";
+ RNA_enum_item_add(&item, &totitem, &tmp);
+
+ if (settings->type == FLUID_DOMAIN_TYPE_GAS) {
+ tmp.value = FLUID_DOMAIN_FIELD_COLOR_R;
+ tmp.identifier = "COLOR_R";
+ tmp.icon = 0;
+ tmp.name = "Red";
+ tmp.description = "Red component of the color field";
+ RNA_enum_item_add(&item, &totitem, &tmp);
+
+ tmp.value = FLUID_DOMAIN_FIELD_COLOR_G;
+ tmp.identifier = "COLOR_G";
+ tmp.icon = 0;
+ tmp.name = "Green";
+ tmp.description = "Green component of the color field";
+ RNA_enum_item_add(&item, &totitem, &tmp);
+
+ tmp.value = FLUID_DOMAIN_FIELD_COLOR_B;
+ tmp.identifier = "COLOR_B";
+ tmp.icon = 0;
+ tmp.name = "Blue";
+ tmp.description = "Blue component of the color field";
+ RNA_enum_item_add(&item, &totitem, &tmp);
+
+ tmp.value = FLUID_DOMAIN_FIELD_DENSITY;
+ tmp.identifier = "DENSITY";
+ tmp.icon = 0;
+ tmp.name = "Density";
+ tmp.description = "Quantity of soot in the fluid";
+ RNA_enum_item_add(&item, &totitem, &tmp);
+
+ tmp.value = FLUID_DOMAIN_FIELD_FLAME;
+ tmp.identifier = "FLAME";
+ tmp.icon = 0;
+ tmp.name = "Flame";
+ tmp.description = "Flame field";
+ RNA_enum_item_add(&item, &totitem, &tmp);
+
+ tmp.value = FLUID_DOMAIN_FIELD_FUEL;
+ tmp.identifier = "FUEL";
+ tmp.icon = 0;
+ tmp.name = "Fuel";
+ tmp.description = "Fuel field";
+ RNA_enum_item_add(&item, &totitem, &tmp);
+
+ tmp.value = FLUID_DOMAIN_FIELD_HEAT;
+ tmp.identifier = "HEAT";
+ tmp.icon = 0;
+ tmp.name = "Heat";
+ tmp.description = "Temperature of the fluid";
+ RNA_enum_item_add(&item, &totitem, &tmp);
+ }
+ else if (settings->type == FLUID_DOMAIN_TYPE_LIQUID) {
+ tmp.value = FLUID_DOMAIN_FIELD_PHI;
+ tmp.identifier = "PHI";
+ tmp.icon = 0;
+ tmp.name = "Fluid Levelset";
+ tmp.description = "Levelset representation of the fluid";
+ RNA_enum_item_add(&item, &totitem, &tmp);
+
+ tmp.value = FLUID_DOMAIN_FIELD_PHI_IN;
+ tmp.identifier = "PHI_IN";
+ tmp.icon = 0;
+ tmp.name = "Inflow Levelset";
+ tmp.description = "Levelset representation of the inflow";
+ RNA_enum_item_add(&item, &totitem, &tmp);
+
+ tmp.value = FLUID_DOMAIN_FIELD_PHI_OUT;
+ tmp.identifier = "PHI_OUT";
+ tmp.icon = 0;
+ tmp.name = "Outflow Levelset";
+ tmp.description = "Levelset representation of the outflow";
+ RNA_enum_item_add(&item, &totitem, &tmp);
+
+ tmp.value = FLUID_DOMAIN_FIELD_PHI_OBSTACLE;
+ tmp.identifier = "PHI_OBSTACLE";
+ tmp.icon = 0;
+ tmp.name = "Obstacle Levelset";
+ tmp.description = "Levelset representation of the obstacles";
+ RNA_enum_item_add(&item, &totitem, &tmp);
+ }
+
+ RNA_enum_item_end(&item, &totitem);
+ *r_free = true;
+
+ return item;
+}
+
#else
static void rna_def_fluid_mesh_vertices(BlenderRNA *brna)
@@ -1152,33 +1306,14 @@ static void rna_def_fluid_domain_settings(BlenderRNA *brna)
{0, NULL, 0, NULL, NULL},
};
- static const EnumPropertyItem view_items[] = {
- {FLUID_DOMAIN_SLICE_VIEW_ALIGNED,
- "VIEW_ALIGNED",
- 0,
- "View",
- "Slice volume parallel to the view plane"},
- {FLUID_DOMAIN_SLICE_AXIS_ALIGNED,
- "AXIS_ALIGNED",
- 0,
- "Axis",
- "Slice volume parallel to the major axis"},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem axis_slice_method_items[] = {
- {AXIS_SLICE_FULL, "FULL", 0, "Full", "Slice the whole domain object"},
- {AXIS_SLICE_SINGLE, "SINGLE", 0, "Single", "Perform a single slice of the domain object"},
- {0, NULL, 0, NULL, NULL},
- };
-
static const EnumPropertyItem interp_method_item[] = {
- {VOLUME_INTERP_LINEAR, "LINEAR", 0, "Linear", "Good smoothness and speed"},
- {VOLUME_INTERP_CUBIC,
+ {FLUID_DISPLAY_INTERP_LINEAR, "LINEAR", 0, "Linear", "Good smoothness and speed"},
+ {FLUID_DISPLAY_INTERP_CUBIC,
"CUBIC",
0,
"Cubic",
"Smoothed high quality interpolation, but slower"},
+ {FLUID_DISPLAY_INTERP_CLOSEST, "CLOSEST", 0, "Closest", "No interpolation"},
{0, NULL, 0, NULL, NULL},
};
@@ -1197,6 +1332,51 @@ static void rna_def_fluid_domain_settings(BlenderRNA *brna)
static const EnumPropertyItem vector_draw_items[] = {
{VECTOR_DRAW_NEEDLE, "NEEDLE", 0, "Needle", "Display vectors as needles"},
{VECTOR_DRAW_STREAMLINE, "STREAMLINE", 0, "Streamlines", "Display vectors as streamlines"},
+ {VECTOR_DRAW_MAC, "MAC", 0, "MAC Grid", "Display vector field as MAC grid"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem vector_field_items[] = {
+ {FLUID_DOMAIN_VECTOR_FIELD_VELOCITY,
+ "FLUID_VELOCITY",
+ 0,
+ "Fluid Velocity",
+ "Velocity field of the fluid domain"},
+ {FLUID_DOMAIN_VECTOR_FIELD_GUIDE_VELOCITY,
+ "GUIDE_VELOCITY",
+ 0,
+ "Guide Velocity",
+ "Guide velocity field of the fluid domain"},
+ {FLUID_DOMAIN_VECTOR_FIELD_FORCE, "FORCE", 0, "Force", "Force field of the fluid domain"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem gridlines_color_field_items[] = {
+ {0, "NONE", 0, "None", "None"},
+ {FLUID_GRIDLINE_COLOR_TYPE_FLAGS, "FLAGS", 0, "Flags", "Flag grid of the fluid domain"},
+ {FLUID_GRIDLINE_COLOR_TYPE_RANGE,
+ "RANGE",
+ 0,
+ "Highlight Range",
+ "Highlight the voxels with values of the color mapped field within the range"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem gridlines_cell_filter_items[] = {
+ {FLUID_CELL_TYPE_NONE, "NONE", 0, "None", "Highlight the cells regardless of their type"},
+ {FLUID_CELL_TYPE_FLUID, "FLUID", 0, "Fluid", "Highlight only the cells of type Fluid"},
+ {FLUID_CELL_TYPE_OBSTACLE,
+ "OBSTACLE",
+ 0,
+ "Obstacle",
+ "Highlight only the cells of type Obstacle"},
+ {FLUID_CELL_TYPE_EMPTY, "EMPTY", 0, "Empty", "Highlight only the cells of type Empty"},
+ {FLUID_CELL_TYPE_INFLOW, "INFLOW", 0, "Inflow", "Highlight only the cells of type Inflow"},
+ {FLUID_CELL_TYPE_OUTFLOW,
+ "OUTFLOW",
+ 0,
+ "Outflow",
+ "Highlight only the cells of type Outflow"},
{0, NULL, 0, NULL, NULL},
};
@@ -2253,16 +2433,9 @@ static void rna_def_fluid_domain_settings(BlenderRNA *brna)
/* display settings */
- prop = RNA_def_property(srna, "slice_method", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "slice_method");
- RNA_def_property_enum_items(prop, view_items);
- RNA_def_property_ui_text(prop, "View Method", "How to slice the volume for viewport rendering");
- RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
-
- prop = RNA_def_property(srna, "axis_slice_method", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "axis_slice_method");
- RNA_def_property_enum_items(prop, axis_slice_method_items);
- RNA_def_property_ui_text(prop, "Method", "");
+ prop = RNA_def_property(srna, "use_slice", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "axis_slice_method", AXIS_SLICE_SINGLE);
+ RNA_def_property_ui_text(prop, "Slice", "Perform a single slice of the domain object");
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
prop = RNA_def_property(srna, "slice_axis", PROP_ENUM, PROP_NONE);
@@ -2300,10 +2473,14 @@ static void rna_def_fluid_domain_settings(BlenderRNA *brna)
prop, "Interpolation", "Interpolation method to use for smoke/fire volumes in solid mode");
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
+ prop = RNA_def_property(srna, "show_gridlines", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "show_gridlines", 0);
+ RNA_def_property_ui_text(prop, "Gridlines", "Show gridlines");
+ RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
+
prop = RNA_def_property(srna, "show_velocity", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "draw_velocity", 0);
- RNA_def_property_ui_text(
- prop, "Display Velocity", "Toggle visualization of the velocity field as needles");
+ RNA_def_property_ui_text(prop, "Vector Display", "Visualize vector fields");
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
prop = RNA_def_property(srna, "vector_display_type", PROP_ENUM, PROP_NONE);
@@ -2312,6 +2489,32 @@ static void rna_def_fluid_domain_settings(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Display Type", "");
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
+ prop = RNA_def_property(srna, "vector_field", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "vector_field");
+ RNA_def_property_enum_items(prop, vector_field_items);
+ RNA_def_property_ui_text(prop, "Field", "Vector field to be represented by the display vectors");
+ RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
+
+ prop = RNA_def_property(srna, "vector_scale_with_magnitude", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "vector_scale_with_magnitude", 0);
+ RNA_def_property_ui_text(prop, "Magnitude", "Scale vectors with their magnitudes");
+ RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
+
+ prop = RNA_def_property(srna, "vector_show_mac_x", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "vector_draw_mac_components", VECTOR_DRAW_MAC_X);
+ RNA_def_property_ui_text(prop, "X", "Show X-component of MAC Grid");
+ RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
+
+ prop = RNA_def_property(srna, "vector_show_mac_y", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "vector_draw_mac_components", VECTOR_DRAW_MAC_Y);
+ RNA_def_property_ui_text(prop, "Y", "Show Y-component of MAC Grid");
+ RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
+
+ prop = RNA_def_property(srna, "vector_show_mac_z", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "vector_draw_mac_components", VECTOR_DRAW_MAC_Z);
+ RNA_def_property_ui_text(prop, "Z", "Show Z-component of MAC Grid");
+ RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
+
prop = RNA_def_property(srna, "vector_scale", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "vector_scale");
RNA_def_property_range(prop, 0.0, 1000.0);
@@ -2324,44 +2527,33 @@ static void rna_def_fluid_domain_settings(BlenderRNA *brna)
prop = RNA_def_property(srna, "use_color_ramp", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "use_coba", 0);
RNA_def_property_boolean_funcs(prop, NULL, "rna_Fluid_use_color_ramp_set");
- RNA_def_property_ui_text(
- prop,
- "Use Color Ramp",
- "Render a simulation field while mapping its voxels values to the colors of a ramp");
+ RNA_def_property_ui_text(prop,
+ "Grid Display",
+ "Render a simulation field while mapping its voxels values to the "
+ "colors of a ramp or using a predefined color code");
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
+ /* Coba field items - generated dynamically based on domain type */
static const EnumPropertyItem coba_field_items[] = {
- {FLUID_DOMAIN_FIELD_COLOR_R, "COLOR_R", 0, "Red", "Red component of the color field"},
- {FLUID_DOMAIN_FIELD_COLOR_G, "COLOR_G", 0, "Green", "Green component of the color field"},
- {FLUID_DOMAIN_FIELD_COLOR_B, "COLOR_B", 0, "Blue", "Blue component of the color field"},
- {FLUID_DOMAIN_FIELD_DENSITY, "DENSITY", 0, "Density", "Quantity of soot in the fluid"},
- {FLUID_DOMAIN_FIELD_FLAME, "FLAME", 0, "Flame", "Flame field"},
- {FLUID_DOMAIN_FIELD_FUEL, "FUEL", 0, "Fuel", "Fuel field"},
- {FLUID_DOMAIN_FIELD_HEAT, "HEAT", 0, "Heat", "Temperature of the fluid"},
- {FLUID_DOMAIN_FIELD_VELOCITY_X,
- "VELOCITY_X",
- 0,
- "X Velocity",
- "X component of the velocity field"},
- {FLUID_DOMAIN_FIELD_VELOCITY_Y,
- "VELOCITY_Y",
- 0,
- "Y Velocity",
- "Y component of the velocity field"},
- {FLUID_DOMAIN_FIELD_VELOCITY_Z,
- "VELOCITY_Z",
- 0,
- "Z Velocity",
- "Z component of the velocity field"},
+ {0, "NONE", 0, "", ""},
{0, NULL, 0, NULL, NULL},
};
- prop = RNA_def_property(srna, "coba_field", PROP_ENUM, PROP_NONE);
+ prop = RNA_def_property(srna, "color_ramp_field", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "coba_field");
RNA_def_property_enum_items(prop, coba_field_items);
+ RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Fluid_cobafield_itemf");
RNA_def_property_ui_text(prop, "Field", "Simulation field to color map");
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
+ prop = RNA_def_property(srna, "color_ramp_field_scale", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "grid_scale");
+ RNA_def_property_range(prop, 0.001, 100000.0);
+ RNA_def_property_ui_range(prop, 0.001, 1000.0, 0.1, 3);
+ RNA_def_property_ui_text(
+ prop, "Scale", "Multiplier for scaling the selected field to color map");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, NULL);
+
prop = RNA_def_property(srna, "color_ramp", PROP_POINTER, PROP_NEVER_NULL);
RNA_def_property_pointer_sdna(prop, NULL, "coba");
RNA_def_property_struct_type(prop, "ColorRamp");
@@ -2378,6 +2570,39 @@ static void rna_def_fluid_domain_settings(BlenderRNA *brna)
"Value under which voxels are considered empty space to optimize rendering");
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, NULL);
+ prop = RNA_def_property(srna, "gridlines_color_field", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "gridlines_color_field");
+ RNA_def_property_enum_items(prop, gridlines_color_field_items);
+ RNA_def_property_ui_text(
+ prop, "Color Gridlines", "Simulation field to color map onto gridlines");
+ RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
+
+ prop = RNA_def_property(srna, "gridlines_lower_bound", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "gridlines_lower_bound");
+ RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
+ RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 0.1, 6);
+ RNA_def_property_ui_text(prop, "Lower Bound", "Lower bound of the highlighting range");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, NULL);
+
+ prop = RNA_def_property(srna, "gridlines_upper_bound", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "gridlines_upper_bound");
+ RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
+ RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 0.1, 6);
+ RNA_def_property_ui_text(prop, "Upper Bound", "Upper bound of the highlighting range");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, NULL);
+
+ prop = RNA_def_property(srna, "gridlines_range_color", PROP_FLOAT, PROP_COLOR);
+ RNA_def_property_float_sdna(prop, NULL, "gridlines_range_color");
+ RNA_def_property_array(prop, 4);
+ RNA_def_property_ui_text(prop, "Color", "Color used to highlight the range");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, NULL);
+
+ prop = RNA_def_property(srna, "gridlines_cell_filter", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "gridlines_cell_filter");
+ RNA_def_property_enum_items(prop, gridlines_cell_filter_items);
+ RNA_def_property_ui_text(prop, "Cell Type", "Cell type to be highlighted");
+ RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
+
/* -- Deprecated / unsed options (below)-- */
/* pointcache options */
@@ -2582,7 +2807,7 @@ static void rna_def_fluid_flow_settings(BlenderRNA *brna)
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_flow_reset");
prop = RNA_def_property(srna, "particle_size", PROP_FLOAT, PROP_NONE);
- RNA_def_property_range(prop, 0.1, 20.0);
+ RNA_def_property_range(prop, 0.1, FLT_MAX);
RNA_def_property_ui_range(prop, 0.5, 5.0, 0.05, 5);
RNA_def_property_ui_text(prop, "Size", "Particle size in simulation cells");
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_flow_reset");
diff --git a/source/blender/makesrna/intern/rna_gpencil.c b/source/blender/makesrna/intern/rna_gpencil.c
index 9bcf2b81557..f8bc5c06963 100644
--- a/source/blender/makesrna/intern/rna_gpencil.c
+++ b/source/blender/makesrna/intern/rna_gpencil.c
@@ -1200,7 +1200,7 @@ static void rna_def_gpencil_stroke(BlenderRNA *brna)
RNA_def_property_update(prop, 0, "rna_GPencil_update");
/* Cyclic: Draw a line from end to start point */
- prop = RNA_def_property(srna, "draw_cyclic", PROP_BOOLEAN, PROP_NONE);
+ prop = RNA_def_property(srna, "use_cyclic", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_STROKE_CYCLIC);
RNA_def_property_ui_text(prop, "Cyclic", "Enable cyclic drawing, closing the stroke");
RNA_def_property_update(prop, 0, "rna_GPencil_update");
diff --git a/source/blender/makesrna/intern/rna_gpencil_modifier.c b/source/blender/makesrna/intern/rna_gpencil_modifier.c
index 9519e3e1433..9e3f8bb8183 100644
--- a/source/blender/makesrna/intern/rna_gpencil_modifier.c
+++ b/source/blender/makesrna/intern/rna_gpencil_modifier.c
@@ -310,6 +310,7 @@ RNA_GP_MOD_VGROUP_NAME_SET(Hook, vgname);
RNA_GP_MOD_VGROUP_NAME_SET(Offset, vgname);
RNA_GP_MOD_VGROUP_NAME_SET(Armature, vgname);
RNA_GP_MOD_VGROUP_NAME_SET(Texture, vgname);
+RNA_GP_MOD_VGROUP_NAME_SET(Tint, vgname);
# undef RNA_GP_MOD_VGROUP_NAME_SET
@@ -1066,7 +1067,7 @@ static void rna_def_modifier_gpenciltint(BlenderRNA *brna)
prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
RNA_def_property_string_sdna(prop, NULL, "vgname");
RNA_def_property_ui_text(prop, "Vertex Group", "Vertex group name for modulating the deform");
- RNA_def_property_string_funcs(prop, NULL, NULL, "rna_HookGpencilModifier_vgname_set");
+ RNA_def_property_string_funcs(prop, NULL, NULL, "rna_TintGpencilModifier_vgname_set");
RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
prop = RNA_def_property(srna, "pass_index", PROP_INT, PROP_NONE);
@@ -1876,19 +1877,19 @@ static void rna_def_modifier_gpencilmirror(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Clip", "Clip points");
RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
- prop = RNA_def_property(srna, "x_axis", PROP_BOOLEAN, PROP_NONE);
+ prop = RNA_def_property(srna, "use_axis_x", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_MIRROR_AXIS_X);
- RNA_def_property_ui_text(prop, "X", "Mirror this axis");
+ RNA_def_property_ui_text(prop, "X", "Mirror the X axis");
RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
- prop = RNA_def_property(srna, "y_axis", PROP_BOOLEAN, PROP_NONE);
+ prop = RNA_def_property(srna, "use_axis_y", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_MIRROR_AXIS_Y);
- RNA_def_property_ui_text(prop, "Y", "Mirror this axis");
+ RNA_def_property_ui_text(prop, "Y", "Mirror the Y axis");
RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
- prop = RNA_def_property(srna, "z_axis", PROP_BOOLEAN, PROP_NONE);
+ prop = RNA_def_property(srna, "use_axis_z", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_MIRROR_AXIS_Z);
- RNA_def_property_ui_text(prop, "Z", "Mirror this axis");
+ RNA_def_property_ui_text(prop, "Z", "Mirror the Z axis");
RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
}
diff --git a/source/blender/makesrna/intern/rna_hair.c b/source/blender/makesrna/intern/rna_hair.c
index f6dc93323fe..4ca66c6b583 100644
--- a/source/blender/makesrna/intern/rna_hair.c
+++ b/source/blender/makesrna/intern/rna_hair.c
@@ -34,6 +34,7 @@
# include "BLI_math_vector.h"
+# include "BKE_attribute.h"
# include "BKE_hair.h"
# include "DEG_depsgraph.h"
@@ -224,6 +225,9 @@ static void rna_def_hair(BlenderRNA *brna)
RNA_def_property_collection_funcs(
prop, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "rna_IDMaterials_assign_int");
+ /* attributes */
+ rna_def_attributes_common(srna);
+
/* common */
rna_def_animdata_common(srna);
}
diff --git a/source/blender/makesrna/intern/rna_image_api.c b/source/blender/makesrna/intern/rna_image_api.c
index 6f876923e52..5bd544ece41 100644
--- a/source/blender/makesrna/intern/rna_image_api.c
+++ b/source/blender/makesrna/intern/rna_image_api.c
@@ -224,7 +224,7 @@ static int rna_Image_gl_load(Image *image, ReportList *reports, int frame)
if (tex == NULL) {
BKE_reportf(reports, RPT_ERROR, "Failed to load image texture '%s'", image->id.name + 2);
- /* TODO(fclem) this error code makes no sense for vulkan. */
+ /* TODO(fclem): this error code makes no sense for vulkan. */
return 0x0502; /* GL_INVALID_OPERATION */
}
diff --git a/source/blender/makesrna/intern/rna_internal.h b/source/blender/makesrna/intern/rna_internal.h
index ad43202d850..eaf4e8866f9 100644
--- a/source/blender/makesrna/intern/rna_internal.h
+++ b/source/blender/makesrna/intern/rna_internal.h
@@ -151,6 +151,7 @@ void RNA_def_action(struct BlenderRNA *brna);
void RNA_def_animation(struct BlenderRNA *brna);
void RNA_def_animviz(struct BlenderRNA *brna);
void RNA_def_armature(struct BlenderRNA *brna);
+void RNA_def_attribute(struct BlenderRNA *brna);
void RNA_def_boid(struct BlenderRNA *brna);
void RNA_def_brush(struct BlenderRNA *brna);
void RNA_def_cachefile(struct BlenderRNA *brna);
@@ -221,6 +222,13 @@ void RNA_def_xr(struct BlenderRNA *brna);
/* Common Define functions */
+void rna_def_attributes_common(struct StructRNA *srna);
+
+void rna_AttributeGroup_iterator_begin(CollectionPropertyIterator *iter, PointerRNA *ptr);
+void rna_AttributeGroup_iterator_next(CollectionPropertyIterator *iter);
+PointerRNA rna_AttributeGroup_iterator_get(CollectionPropertyIterator *iter);
+int rna_AttributeGroup_length(PointerRNA *ptr);
+
void rna_def_animdata_common(struct StructRNA *srna);
bool rna_AnimaData_override_apply(struct Main *bmain,
diff --git a/source/blender/makesrna/intern/rna_main_api.c b/source/blender/makesrna/intern/rna_main_api.c
index 7c941ddb524..8a34bf0245b 100644
--- a/source/blender/makesrna/intern/rna_main_api.c
+++ b/source/blender/makesrna/intern/rna_main_api.c
@@ -228,57 +228,17 @@ static Object *rna_Main_objects_new(Main *bmain, ReportList *reports, const char
Object *ob;
int type = OB_EMPTY;
+
if (data) {
- /* keep in sync with OB_DATA_SUPPORT_ID() macro */
- switch (GS(data->name)) {
- case ID_ME:
- type = OB_MESH;
- break;
- case ID_CU:
- type = BKE_curve_type_get((Curve *)data);
- break;
- case ID_MB:
- type = OB_MBALL;
- break;
- case ID_LA:
- type = OB_LAMP;
- break;
- case ID_SPK:
- type = OB_SPEAKER;
- break;
- case ID_CA:
- type = OB_CAMERA;
- break;
- case ID_LT:
- type = OB_LATTICE;
- break;
- case ID_GD:
- type = OB_GPENCIL;
- break;
- case ID_AR:
- type = OB_ARMATURE;
- break;
- case ID_LP:
- type = OB_LIGHTPROBE;
- break;
- case ID_HA:
- type = OB_HAIR;
- break;
- case ID_PT:
- type = OB_POINTCLOUD;
- break;
- case ID_VO:
- type = OB_VOLUME;
- break;
- default: {
- const char *idname;
- if (RNA_enum_id_from_value(rna_enum_id_type_items, GS(data->name), &idname) == 0) {
- idname = "UNKNOWN";
- }
-
- BKE_reportf(reports, RPT_ERROR, "ID type '%s' is not valid for an object", idname);
- return NULL;
+ type = BKE_object_obdata_to_type(data);
+ if (type == -1) {
+ const char *idname;
+ if (RNA_enum_id_from_value(rna_enum_id_type_items, GS(data->name), &idname) == 0) {
+ idname = "UNKNOWN";
}
+
+ BKE_reportf(reports, RPT_ERROR, "ID type '%s' is not valid for an object", idname);
+ return NULL;
}
id_us_plus(data);
diff --git a/source/blender/makesrna/intern/rna_material.c b/source/blender/makesrna/intern/rna_material.c
index 1004fc94d16..5e16f1187fb 100644
--- a/source/blender/makesrna/intern/rna_material.c
+++ b/source/blender/makesrna/intern/rna_material.c
@@ -564,6 +564,18 @@ static void rna_def_material_greasepencil(BlenderRNA *brna)
prop, "Self Overlap", "Disable stencil and overlap self intersections with alpha materials");
RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update");
+ prop = RNA_def_property(srna, "use_stroke_holdout", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_MATERIAL_IS_STROKE_HOLDOUT);
+ RNA_def_property_ui_text(
+ prop, "Holdout", "Remove the color from underneath this stroke by using it as a mask");
+ RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update");
+
+ prop = RNA_def_property(srna, "use_fill_holdout", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_MATERIAL_IS_FILL_HOLDOUT);
+ RNA_def_property_ui_text(
+ prop, "Holdout", "Remove the color from underneath this stroke by using it as a mask");
+ RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update");
+
prop = RNA_def_property(srna, "show_stroke", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_MATERIAL_STROKE_SHOW);
RNA_def_property_ui_text(prop, "Show Stroke", "Show stroke lines of this material");
diff --git a/source/blender/makesrna/intern/rna_mesh.c b/source/blender/makesrna/intern/rna_mesh.c
index bb5ec0d6835..4afb17fe0b9 100644
--- a/source/blender/makesrna/intern/rna_mesh.c
+++ b/source/blender/makesrna/intern/rna_mesh.c
@@ -157,8 +157,10 @@ static CustomData *rna_cd_from_layer(PointerRNA *ptr, CustomDataLayer *cdl)
/* rely on negative values wrapping */
# define TEST_CDL(cmd) \
- if ((void)(cd = cmd(me)), ARRAY_HAS_ITEM(cdl, cd->layers, cd->totlayer)) \
- return cd
+ if ((void)(cd = cmd(me)), ARRAY_HAS_ITEM(cdl, cd->layers, cd->totlayer)) { \
+ return cd; \
+ } \
+ ((void)0)
TEST_CDL(rna_mesh_vdata_helper);
TEST_CDL(rna_mesh_edata_helper);
@@ -3200,6 +3202,9 @@ static void rna_def_mesh(BlenderRNA *brna)
rna_def_paint_mask(brna, prop);
/* End paint mask */
+ /* Attributes */
+ rna_def_attributes_common(srna);
+
/* Remesh */
prop = RNA_def_property(srna, "remesh_voxel_size", PROP_FLOAT, PROP_DISTANCE);
RNA_def_property_float_sdna(prop, NULL, "remesh_voxel_size");
@@ -3268,6 +3273,29 @@ static void rna_def_mesh(BlenderRNA *brna)
/* End remesh */
+ /* Symmetry */
+ prop = RNA_def_property(srna, "use_mirror_x", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "symmetry", ME_SYMMETRY_X);
+ RNA_def_property_ui_text(prop, "X", "Enable symmetry in the X axis");
+ RNA_def_property_update(prop, 0, "rna_Mesh_update_draw");
+
+ prop = RNA_def_property(srna, "use_mirror_y", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "symmetry", ME_SYMMETRY_Y);
+ RNA_def_property_ui_text(prop, "Y", "Enable symmetry in the Y axis");
+ RNA_def_property_update(prop, 0, "rna_Mesh_update_draw");
+
+ prop = RNA_def_property(srna, "use_mirror_z", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "symmetry", ME_SYMMETRY_Z);
+ RNA_def_property_ui_text(prop, "Z", "Enable symmetry in the Z axis");
+ RNA_def_property_update(prop, 0, "rna_Mesh_update_draw");
+
+ prop = RNA_def_property(srna, "use_mirror_vertex_group_x", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "editflag", ME_EDIT_VERTEX_GROUPS_X_SYMMETRY);
+ RNA_def_property_ui_text(
+ prop, "Vertex Groups X Symmetry", "Mirror the left/right vertex groups when painting");
+ RNA_def_property_update(prop, 0, "rna_Mesh_update_draw");
+ /* End Symmetry */
+
prop = RNA_def_property(srna, "use_auto_smooth", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", ME_AUTOSMOOTH);
RNA_def_property_ui_text(
@@ -3328,19 +3356,6 @@ static void rna_def_mesh(BlenderRNA *brna)
# endif
/* editflag */
- prop = RNA_def_property(srna, "use_mirror_x", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "editflag", ME_EDIT_MIRROR_X);
- RNA_def_property_ui_text(prop, "X Mirror", "X Axis mirror editing");
- RNA_def_property_update(prop, 0, "rna_Mesh_update_draw");
-
- prop = RNA_def_property(srna, "use_mirror_y", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "editflag", ME_EDIT_MIRROR_Y);
- RNA_def_property_ui_text(prop, "Y Mirror", "Y Axis mirror editing");
-
- prop = RNA_def_property(srna, "use_mirror_z", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "editflag", ME_EDIT_MIRROR_Z);
- RNA_def_property_ui_text(prop, "Z Mirror", "Z Axis mirror editing");
-
prop = RNA_def_property(srna, "use_mirror_topology", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "editflag", ME_EDIT_MIRROR_TOPO);
RNA_def_property_ui_text(prop,
diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c
index d9e151e5f73..766497d53c1 100644
--- a/source/blender/makesrna/intern/rna_modifier.c
+++ b/source/blender/makesrna/intern/rna_modifier.c
@@ -193,6 +193,11 @@ const EnumPropertyItem rna_enum_object_modifier_type_items[] = {
ICON_MOD_WIREFRAME,
"Wireframe",
"Convert faces into thickened edges"},
+ {eModifierType_MeshToVolume,
+ "MESH_TO_VOLUME",
+ ICON_VOLUME_DATA,
+ "Mesh to Volume",
+ ""}, /* TODO: Use correct icon. */
{0, "", 0, N_("Deform"), ""},
{eModifierType_Armature,
"ARMATURE",
@@ -267,6 +272,11 @@ const EnumPropertyItem rna_enum_object_modifier_type_items[] = {
ICON_MOD_WAVE,
"Wave",
"Adds a ripple-like motion to an object’s geometry"},
+ {eModifierType_VolumeDisplace,
+ "VOLUME_DISPLACE",
+ ICON_VOLUME_DATA,
+ "Volume Displace",
+ "Deform volume based on noise or other vector fields"}, /* TODO: Use correct icon. */
{0, "", 0, N_("Physics"), ""},
{eModifierType_Cloth, "CLOTH", ICON_MOD_CLOTH, "Cloth", ""},
{eModifierType_Collision, "COLLISION", ICON_MOD_PHYSICS, "Collision", ""},
@@ -614,126 +624,10 @@ static void rna_UVProject_projectors_begin(CollectionPropertyIterator *iter, Poi
static StructRNA *rna_Modifier_refine(struct PointerRNA *ptr)
{
ModifierData *md = (ModifierData *)ptr->data;
-
- switch ((ModifierType)md->type) {
- case eModifierType_Subsurf:
- return &RNA_SubsurfModifier;
- case eModifierType_Lattice:
- return &RNA_LatticeModifier;
- case eModifierType_Curve:
- return &RNA_CurveModifier;
- case eModifierType_Build:
- return &RNA_BuildModifier;
- case eModifierType_Mirror:
- return &RNA_MirrorModifier;
- case eModifierType_Decimate:
- return &RNA_DecimateModifier;
- case eModifierType_Wave:
- return &RNA_WaveModifier;
- case eModifierType_Armature:
- return &RNA_ArmatureModifier;
- case eModifierType_Hook:
- return &RNA_HookModifier;
- case eModifierType_Softbody:
- return &RNA_SoftBodyModifier;
- case eModifierType_Boolean:
- return &RNA_BooleanModifier;
- case eModifierType_Array:
- return &RNA_ArrayModifier;
- case eModifierType_EdgeSplit:
- return &RNA_EdgeSplitModifier;
- case eModifierType_Displace:
- return &RNA_DisplaceModifier;
- case eModifierType_UVProject:
- return &RNA_UVProjectModifier;
- case eModifierType_Smooth:
- return &RNA_SmoothModifier;
- case eModifierType_Cast:
- return &RNA_CastModifier;
- case eModifierType_MeshDeform:
- return &RNA_MeshDeformModifier;
- case eModifierType_ParticleSystem:
- return &RNA_ParticleSystemModifier;
- case eModifierType_ParticleInstance:
- return &RNA_ParticleInstanceModifier;
- case eModifierType_Explode:
- return &RNA_ExplodeModifier;
- case eModifierType_Cloth:
- return &RNA_ClothModifier;
- case eModifierType_Collision:
- return &RNA_CollisionModifier;
- case eModifierType_Bevel:
- return &RNA_BevelModifier;
- case eModifierType_Shrinkwrap:
- return &RNA_ShrinkwrapModifier;
- case eModifierType_Mask:
- return &RNA_MaskModifier;
- case eModifierType_SimpleDeform:
- return &RNA_SimpleDeformModifier;
- case eModifierType_Multires:
- return &RNA_MultiresModifier;
- case eModifierType_Surface:
- return &RNA_SurfaceModifier;
- case eModifierType_Fluid:
- return &RNA_FluidModifier;
- case eModifierType_Solidify:
- return &RNA_SolidifyModifier;
- case eModifierType_Screw:
- return &RNA_ScrewModifier;
- case eModifierType_Ocean:
- return &RNA_OceanModifier;
- case eModifierType_Warp:
- return &RNA_WarpModifier;
- case eModifierType_WeightVGEdit:
- return &RNA_VertexWeightEditModifier;
- case eModifierType_WeightVGMix:
- return &RNA_VertexWeightMixModifier;
- case eModifierType_WeightVGProximity:
- return &RNA_VertexWeightProximityModifier;
- case eModifierType_DynamicPaint:
- return &RNA_DynamicPaintModifier;
- case eModifierType_Remesh:
- return &RNA_RemeshModifier;
- case eModifierType_Skin:
- return &RNA_SkinModifier;
- case eModifierType_LaplacianSmooth:
- return &RNA_LaplacianSmoothModifier;
- case eModifierType_Triangulate:
- return &RNA_TriangulateModifier;
- case eModifierType_UVWarp:
- return &RNA_UVWarpModifier;
- case eModifierType_MeshCache:
- return &RNA_MeshCacheModifier;
- case eModifierType_LaplacianDeform:
- return &RNA_LaplacianDeformModifier;
- case eModifierType_Weld:
- return &RNA_WeldModifier;
- case eModifierType_Wireframe:
- return &RNA_WireframeModifier;
- case eModifierType_DataTransfer:
- return &RNA_DataTransferModifier;
- case eModifierType_NormalEdit:
- return &RNA_NormalEditModifier;
- case eModifierType_CorrectiveSmooth:
- return &RNA_CorrectiveSmoothModifier;
- case eModifierType_MeshSequenceCache:
- return &RNA_MeshSequenceCacheModifier;
- case eModifierType_SurfaceDeform:
- return &RNA_SurfaceDeformModifier;
- case eModifierType_WeightedNormal:
- return &RNA_WeightedNormalModifier;
- case eModifierType_Simulation:
-# ifdef WITH_PARTICLE_NODES
- return &RNA_SimulationModifier;
-# endif
- /* Default */
- case eModifierType_Fluidsim: /* deprecated */
- case eModifierType_None:
- case eModifierType_ShapeKey:
- case NUM_MODIFIER_TYPES:
- return &RNA_Modifier;
+ const ModifierTypeInfo *modifier_type = BKE_modifier_get_info(md->type);
+ if (modifier_type != NULL) {
+ return modifier_type->srna;
}
-
return &RNA_Modifier;
}
@@ -1760,15 +1654,11 @@ static PropertyRNA *rna_def_property_subdivision_common(StructRNA *srna, const c
};
static const EnumPropertyItem prop_uv_smooth_items[] = {
- {SUBSURF_UV_SMOOTH_NONE,
- "NONE",
- 0,
- "Sharp",
- "UVs are not smoothed, boundaries are kept sharp"},
+ {SUBSURF_UV_SMOOTH_NONE, "NONE", 0, "None", "UVs are not smoothed, boundaries are kept sharp"},
{SUBSURF_UV_SMOOTH_PRESERVE_CORNERS,
"PRESERVE_CORNERS",
0,
- "Smooth, keep corners",
+ "Keep Corners",
"UVs are smoothed, corners on discontinuous boundary are kept sharp"},
# if 0
{SUBSURF_UV_SMOOTH_PRESERVE_CORNERS_AND_JUNCTIONS,
@@ -1788,15 +1678,21 @@ static PropertyRNA *rna_def_property_subdivision_common(StructRNA *srna, const c
0,
"Smooth, keep corners",
"UVs are smoothed, boundaries are kept sharp"},
- {SUBSURF_UV_SMOOTH_ALL,
- "PRESERVE_BOUNDARIES",
- 0,
- "Smooth all",
- "UVs and boundaries are smoothed"},
# endif
+ {SUBSURF_UV_SMOOTH_ALL, "PRESERVE_BOUNDARIES", 0, "All", "UVs and boundaries are smoothed"},
{0, NULL, 0, NULL, NULL},
};
+ static const EnumPropertyItem prop_boundary_smooth_items[] = {
+ {SUBSURF_BOUNDARY_SMOOTH_PRESERVE_CORNERS,
+ "PRESERVE_CORNERS",
+ 0,
+ "Keep Corners",
+ "Smooth boundaries, but corners are kept sharp"},
+ {SUBSURF_BOUNDARY_SMOOTH_ALL, "ALL", 0, "All", "Smooth boundaries, including corners"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
PropertyRNA *prop;
RNA_define_lib_overridable(true);
@@ -1815,6 +1711,12 @@ static PropertyRNA *rna_def_property_subdivision_common(StructRNA *srna, const c
prop, "Quality", "Accuracy of vertex positions, lower value is faster but less precise");
RNA_def_property_update(prop, 0, "rna_Modifier_update");
+ prop = RNA_def_property(srna, "boundary_smooth", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "boundary_smooth");
+ RNA_def_property_enum_items(prop, prop_boundary_smooth_items);
+ RNA_def_property_ui_text(prop, "Boundary Smooth", "Controls how open boundaries are smoothed");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
prop = RNA_def_property(srna, "subdivision_type", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, type);
RNA_def_property_enum_items(prop, prop_subdivision_type_items);
@@ -1873,6 +1775,15 @@ static void rna_def_modifier_subsurf(BlenderRNA *brna)
prop, "Use Custom Normals", "Interpolates existing custom normals to resulting mesh");
RNA_def_property_update(prop, 0, "rna_Modifier_update");
+ prop = RNA_def_property(srna, "use_limit_surface", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(
+ prop, NULL, "flags", eSubsurfModifierFlag_UseRecursiveSubdivision);
+ RNA_def_property_ui_text(prop,
+ "Use Limit Surface",
+ "Place vertices at the surface that would be produced with infinite "
+ "levels of subdivision (smoothest possible shape)");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
RNA_define_lib_overridable(false);
}
@@ -2804,18 +2715,32 @@ static void rna_def_modifier_boolean(BlenderRNA *brna)
StructRNA *srna;
PropertyRNA *prop;
+ static const EnumPropertyItem prop_operand_items[] = {
+ {eBooleanModifierFlag_Object,
+ "OBJECT",
+ 0,
+ "Object",
+ "Use a mesh object as the operand for the Boolean operation"},
+ {eBooleanModifierFlag_Collection,
+ "COLLECTION",
+ 0,
+ "Collection",
+ "Use a collection of mesh objects as the operand for the Boolean operation"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
static const EnumPropertyItem prop_operation_items[] = {
{eBooleanModifierOp_Intersect,
"INTERSECT",
0,
"Intersect",
- "Keep the part of the mesh that intersects with the other selected object"},
- {eBooleanModifierOp_Union, "UNION", 0, "Union", "Combine two meshes in an additive way"},
+ "Keep the part of the mesh that is common between all operands"},
+ {eBooleanModifierOp_Union, "UNION", 0, "Union", "Combine meshes in an additive way"},
{eBooleanModifierOp_Difference,
"DIFFERENCE",
0,
"Difference",
- "Combine two meshes in a subtractive way"},
+ "Combine meshes in a subtractive way"},
{0, NULL, 0, NULL, NULL},
};
@@ -2843,12 +2768,26 @@ static void rna_def_modifier_boolean(BlenderRNA *brna)
RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
+ prop = RNA_def_property(srna, "collection", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "collection");
+ RNA_def_property_struct_type(prop, "Collection");
+ RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_REFCOUNT);
+ RNA_def_property_ui_text(
+ prop, "Collection", "Use mesh objects in this collection for Boolean operation");
+ RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
+
prop = RNA_def_property(srna, "operation", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_items(prop, prop_operation_items);
RNA_def_property_enum_default(prop, eBooleanModifierOp_Difference);
RNA_def_property_ui_text(prop, "Operation", "");
RNA_def_property_update(prop, 0, "rna_Modifier_update");
+ prop = RNA_def_property(srna, "operand_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag");
+ RNA_def_property_enum_items(prop, prop_operand_items);
+ RNA_def_property_ui_text(prop, "Operand Type", "");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
prop = RNA_def_property(srna, "double_threshold", PROP_FLOAT, PROP_DISTANCE);
RNA_def_property_float_sdna(prop, NULL, "double_threshold");
RNA_def_property_range(prop, 0, 1.0f);
@@ -2863,6 +2802,11 @@ static void rna_def_modifier_boolean(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Solver", "Method for calculating booleans");
RNA_def_property_update(prop, 0, "rna_Modifier_update");
+ prop = RNA_def_property(srna, "use_self", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", eBooleanModifierFlag_Self);
+ RNA_def_property_ui_text(prop, "Self", "Allow self-intersection in operands");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
/* BMesh debugging options, only used when G_DEBUG is set */
/* BMesh intersection options */
@@ -3803,7 +3747,6 @@ static void rna_def_modifier_particleinstance(BlenderRNA *brna)
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");
- RNA_def_property_float_default(prop, 1.0f);
RNA_def_property_update(prop, 0, "rna_Modifier_update");
prop = RNA_def_property(srna, "particle_offset", PROP_FLOAT, PROP_FACTOR);
@@ -3812,7 +3755,6 @@ static void rna_def_modifier_particleinstance(BlenderRNA *brna)
"Particle Offset",
"Relative offset of particles to use for instancing, to avoid overlap "
"of multiple instances");
- RNA_def_property_float_default(prop, 0.0f);
RNA_def_property_update(prop, 0, "rna_Modifier_update");
prop = RNA_def_property(srna, "index_layer_name", PROP_STRING, PROP_NONE);
@@ -4576,7 +4518,6 @@ static void rna_def_modifier_simpledeform(BlenderRNA *brna)
prop = RNA_def_property(srna, "angle", PROP_FLOAT, PROP_ANGLE);
RNA_def_property_float_sdna(prop, NULL, "factor");
RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
- RNA_def_property_float_default(prop, DEG2RADF(45.0f));
RNA_def_property_ui_range(prop, DEG2RAD(-360.0), DEG2RAD(360.0), 10.0, 3);
RNA_def_property_ui_text(prop, "Angle", "Angle of deformation");
RNA_def_property_update(prop, 0, "rna_Modifier_update");
@@ -5727,11 +5668,13 @@ static void rna_def_modifier_ocean(BlenderRNA *brna)
prop = RNA_def_property(srna, "invert_spray", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_OCEAN_INVERT_SPRAY);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_ui_text(prop, "Invert Spray", "Invert the spray direction map");
RNA_def_property_update(prop, 0, "rna_OceanModifier_init_update");
prop = RNA_def_property(srna, "spray_layer_name", PROP_STRING, PROP_NONE);
RNA_def_property_string_sdna(prop, NULL, "spraylayername");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_ui_text(
prop, "Spray Map", "Name of the vertex color layer used for the spray direction map");
RNA_def_property_update(prop, 0, "rna_OceanModifier_init_update");
@@ -5766,6 +5709,7 @@ static void rna_def_modifier_ocean(BlenderRNA *brna)
prop = RNA_def_property(srna, "wind_velocity", PROP_FLOAT, PROP_VELOCITY);
RNA_def_property_float_sdna(prop, NULL, "wind_velocity");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_ui_text(prop, "Wind Velocity", "Wind speed");
RNA_def_property_update(prop, 0, "rna_OceanModifier_init_update");
@@ -5785,6 +5729,7 @@ static void rna_def_modifier_ocean(BlenderRNA *brna)
prop = RNA_def_property(srna, "wave_alignment", PROP_FLOAT, PROP_UNSIGNED);
RNA_def_property_float_sdna(prop, NULL, "wave_alignment");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_range(prop, 0.0, 1.0);
RNA_def_property_ui_text(prop, "Wave Alignment", "How much the waves are aligned to each other");
RNA_def_property_update(prop, 0, "rna_OceanModifier_init_update");
@@ -5845,12 +5790,14 @@ static void rna_def_modifier_ocean(BlenderRNA *brna)
prop = RNA_def_property(srna, "spectrum", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "spectrum");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_enum_items(prop, spectrum_items);
RNA_def_property_ui_text(prop, "Spectrum", "Spectrum to use");
RNA_def_property_update(prop, 0, "rna_OceanModifier_init_update");
prop = RNA_def_property(srna, "fetch_jonswap", PROP_FLOAT, PROP_UNSIGNED);
RNA_def_property_float_sdna(prop, NULL, "fetch_jonswap");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_range(prop, 0.0, FLT_MAX);
RNA_def_property_ui_text(
prop,
@@ -5862,6 +5809,7 @@ static void rna_def_modifier_ocean(BlenderRNA *brna)
prop = RNA_def_property(srna, "sharpen_peak_jonswap", PROP_FLOAT, PROP_UNSIGNED);
RNA_def_property_float_sdna(prop, NULL, "sharpen_peak_jonswap");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_range(prop, 0.0, 1.0);
RNA_def_property_ui_text(prop, "Sharpen peak", "Peak sharpening for 'JONSWAP' and 'TMA' models");
RNA_def_property_update(prop, 0, "rna_OceanModifier_init_update");
@@ -6205,7 +6153,12 @@ static void rna_def_modifier_meshseqcache(BlenderRNA *brna)
RNA_def_property_enum_sdna(prop, NULL, "read_flag");
RNA_def_property_enum_items(prop, read_flag_items);
RNA_def_property_ui_text(prop, "Read Data", "Data to read from the cache");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+ prop = RNA_def_property(srna, "use_vertex_interpolation", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "read_flag", MOD_MESHSEQ_INTERPOLATE_VERTICES);
+ RNA_def_property_ui_text(
+ prop, "Vertex Interpolation", "Allow interpolation of vertex positions");
RNA_def_property_update(prop, 0, "rna_Modifier_update");
prop = RNA_def_property(srna, "velocity_scale", PROP_FLOAT, PROP_NONE);
@@ -6299,15 +6252,6 @@ static void rna_def_modifier_weld(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Merge Distance", "Limit below which to merge vertices");
RNA_def_property_update(prop, 0, "rna_Modifier_update");
- prop = RNA_def_property(srna, "max_interactions", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_int_sdna(prop, NULL, "max_interactions");
- RNA_def_property_ui_text(
- prop,
- "Duplicate Limit",
- "For a better performance, limits the number of elements found per vertex. "
- "(0 makes it infinite)");
- RNA_def_property_update(prop, 0, "rna_Modifier_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(
@@ -6743,7 +6687,7 @@ static void rna_def_modifier_datatransfer(BlenderRNA *brna)
prop = RNA_def_float_factor(
srna,
"mix_factor",
- 1.0f,
+ 0.0f,
0.0f,
1.0f,
"Mix Factor",
@@ -6833,27 +6777,15 @@ static void rna_def_modifier_normaledit(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Mix Mode", "How to mix generated normals with existing ones");
RNA_def_property_update(prop, 0, "rna_Modifier_update");
- prop = RNA_def_float(srna,
- "mix_factor",
- 1.0f,
- 0.0f,
- 1.0f,
- "Mix Factor",
- "How much of generated normals to mix with exiting ones",
- 0.0f,
- 1.0f);
+ prop = RNA_def_property(srna, "mix_factor", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_range(prop, 0.0, 1.0);
+ RNA_def_property_ui_text(
+ prop, "Mix Factor", "How much of generated normals to mix with exiting ones");
RNA_def_property_update(prop, 0, "rna_Modifier_update");
- prop = RNA_def_float(srna,
- "mix_limit",
- 1.0f,
- 0.0f,
- DEG2RADF(180.0f),
- "Max Angle",
- "Maximum angle between old and new normals",
- 0.0f,
- DEG2RADF(180.0f));
- RNA_def_property_subtype(prop, PROP_ANGLE);
+ prop = RNA_def_property(srna, "mix_limit", PROP_FLOAT, PROP_ANGLE);
+ RNA_def_property_range(prop, 0.0, DEG2RADF(180.0f));
+ RNA_def_property_ui_text(prop, "Max Angle", "Maximum angle between old and new normals");
RNA_def_property_update(prop, 0, "rna_Modifier_update");
prop = RNA_def_property(srna, "no_polynors_fix", PROP_BOOLEAN, PROP_NONE);
@@ -7019,7 +6951,7 @@ static void rna_def_modifier_weightednormal(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Invert", "Invert vertex group influence");
RNA_def_property_update(prop, 0, "rna_Modifier_update");
- prop = RNA_def_property(srna, "face_influence", PROP_BOOLEAN, PROP_NONE);
+ prop = RNA_def_property(srna, "use_face_influence", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_WEIGHTEDNORMAL_FACE_INFLUENCE);
RNA_def_property_ui_text(prop, "Face Influence", "Use influence of face for weighting");
RNA_def_property_update(prop, 0, "rna_Modifier_update");
@@ -7058,6 +6990,147 @@ static void rna_def_modifier_simulation(BlenderRNA *brna)
}
# endif
+static void rna_def_modifier_mesh_to_volume(BlenderRNA *brna)
+{
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ static EnumPropertyItem resolution_mode_items[] = {
+ {MESH_TO_VOLUME_RESOLUTION_MODE_VOXEL_AMOUNT,
+ "VOXEL_AMOUNT",
+ 0,
+ "Voxel Amount",
+ "Desired number of voxels along one axis"},
+ {MESH_TO_VOLUME_RESOLUTION_MODE_VOXEL_SIZE,
+ "VOXEL_SIZE",
+ 0,
+ "Voxel Size",
+ "Desired voxel side length"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ srna = RNA_def_struct(brna, "MeshToVolumeModifier", "Modifier");
+ RNA_def_struct_ui_text(srna, "Mesh to Volume Modifier", "");
+ RNA_def_struct_sdna(srna, "MeshToVolumeModifierData");
+ RNA_def_struct_ui_icon(srna, ICON_VOLUME_DATA); /* TODO: Use correct icon. */
+
+ RNA_define_lib_overridable(true);
+
+ prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
+ RNA_def_property_ui_text(prop, "Object", "Object");
+ RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
+ RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
+
+ prop = RNA_def_property(srna, "resolution_mode", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, resolution_mode_items);
+ RNA_def_property_ui_text(
+ prop, "Resolution Mode", "Mode for how the desired voxel size is specified");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "voxel_size", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_ui_text(
+ prop, "Voxel Size", "Smaller values result in a higher resolution output");
+ RNA_def_property_range(prop, 0.1, FLT_MAX);
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "voxel_amount", PROP_INT, PROP_NONE);
+ RNA_def_property_ui_text(prop, "Voxel Amount", "Approximate number of voxels along one axis");
+ RNA_def_property_range(prop, 0, INT_MAX);
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "use_fill_volume", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "fill_volume", 1);
+ RNA_def_property_ui_text(
+ prop, "Fill Volume", "Initialize the density grid in every cell inside the enclosed volume");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "interior_band_width", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_ui_text(prop, "Interior Band Width", "Width of the volume inside of the mesh");
+ RNA_def_property_range(prop, 0.0, FLT_MAX);
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "exterior_band_width", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_ui_text(prop, "Exterior Band Width", "Width of the volume outside of the mesh");
+ RNA_def_property_range(prop, 0.0, FLT_MAX);
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "density", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_ui_text(prop, "Density", "Density of the new volume");
+ RNA_def_property_range(prop, 0.0, FLT_MAX);
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ RNA_define_lib_overridable(false);
+}
+
+static void rna_def_modifier_volume_displace(BlenderRNA *brna)
+{
+ static const EnumPropertyItem prop_texture_map_mode_items[] = {
+ {MOD_VOLUME_DISPLACE_MAP_LOCAL,
+ "LOCAL",
+ 0,
+ "Local",
+ "Use the local coordinate system for the texture coordinates"},
+ {MOD_VOLUME_DISPLACE_MAP_GLOBAL,
+ "GLOBAL",
+ 0,
+ "Global",
+ "Use the global coordinate system for the texture coordinates"},
+ {MOD_VOLUME_DISPLACE_MAP_OBJECT,
+ "OBJECT",
+ 0,
+ "Object",
+ "Use the linked object's local coordinate system for the texture coordinates"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "VolumeDisplaceModifier", "Modifier");
+ RNA_def_struct_ui_text(srna, "Volume Displace Modifier", "");
+ RNA_def_struct_sdna(srna, "VolumeDisplaceModifierData");
+ RNA_def_struct_ui_icon(srna, ICON_VOLUME_DATA); /* TODO: Use correct icon. */
+
+ RNA_define_lib_overridable(true);
+
+ prop = RNA_def_property(srna, "strength", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_ui_text(prop, "Strength", "Strength of the displacement");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "texture", PROP_POINTER, PROP_NONE);
+ RNA_def_property_ui_text(prop, "Texture", "");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
+
+ prop = RNA_def_property(srna, "texture_map_mode", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, prop_texture_map_mode_items);
+ RNA_def_property_ui_text(prop, "Texture Mapping Mode", "");
+ RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
+
+ prop = RNA_def_property(srna, "texture_map_object", PROP_POINTER, PROP_NONE);
+ RNA_def_property_ui_text(prop, "Object", "Object to use for texture mapping");
+ RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
+ RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
+
+ prop = RNA_def_property(srna, "texture_mid_level", PROP_FLOAT, PROP_XYZ);
+ RNA_def_property_ui_text(
+ prop, "Texture Mid Level", "Subtracted from the texture color to get a displacement vector");
+ RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
+ RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1f, 5);
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "texture_sample_radius", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_ui_text(
+ prop,
+ "Texture Sample Radius",
+ "Smaller values result in better performance but might cut off the volume");
+ RNA_def_property_range(prop, 0.0f, FLT_MAX);
+ RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1f, 5);
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ RNA_define_lib_overridable(false);
+}
+
void RNA_def_modifier(BlenderRNA *brna)
{
StructRNA *srna;
@@ -7189,6 +7262,8 @@ void RNA_def_modifier(BlenderRNA *brna)
# ifdef WITH_PARTICLE_NODES
rna_def_modifier_simulation(brna);
# endif
+ rna_def_modifier_mesh_to_volume(brna);
+ rna_def_modifier_volume_displace(brna);
}
#endif
diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c
index 3237f33835e..8c99a4cc1a1 100644
--- a/source/blender/makesrna/intern/rna_nodetree.c
+++ b/source/blender/makesrna/intern/rna_nodetree.c
@@ -3244,7 +3244,7 @@ static const EnumPropertyItem *renderresult_layers_add_enum(RenderLayer *rl)
while (rl) {
tmp.identifier = rl->name;
/* Little trick: using space char instead empty string
- * makes the item selectable in the dropdown. */
+ * makes the item selectable in the drop-down. */
if (rl->name[0] == '\0') {
tmp.name = " ";
}
@@ -3320,7 +3320,7 @@ static const EnumPropertyItem *renderresult_views_add_enum(RenderView *rv)
while (rv) {
tmp.identifier = rv->name;
/* Little trick: using space char instead empty string
- * makes the item selectable in the dropdown. */
+ * makes the item selectable in the drop-down. */
if (rv->name[0] == '\0') {
tmp.name = " ";
}
diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c
index 39e1f17d33d..91f1bbc03d7 100644
--- a/source/blender/makesrna/intern/rna_object.c
+++ b/source/blender/makesrna/intern/rna_object.c
@@ -223,36 +223,39 @@ const EnumPropertyItem rna_enum_lightprobes_type_items[] = {
/* used for 2 enums */
#define OBTYPE_CU_CURVE \
{ \
- OB_CURVE, "CURVE", 0, "Curve", "" \
+ OB_CURVE, "CURVE", ICON_OUTLINER_OB_CURVE, "Curve", "" \
}
#define OBTYPE_CU_SURF \
{ \
- OB_SURF, "SURFACE", 0, "Surface", "" \
+ OB_SURF, "SURFACE", ICON_OUTLINER_OB_SURFACE, "Surface", "" \
}
#define OBTYPE_CU_FONT \
{ \
- OB_FONT, "FONT", 0, "Font", "" \
+ OB_FONT, "FONT", ICON_OUTLINER_OB_FONT, "Text", "" \
}
const EnumPropertyItem rna_enum_object_type_items[] = {
- {OB_MESH, "MESH", 0, "Mesh", ""},
+ {OB_MESH, "MESH", ICON_OUTLINER_OB_MESH, "Mesh", ""},
OBTYPE_CU_CURVE,
OBTYPE_CU_SURF,
- {OB_MBALL, "META", 0, "Meta", ""},
+ {OB_MBALL, "META", ICON_OUTLINER_OB_META, "Metaball", ""},
OBTYPE_CU_FONT,
- {OB_HAIR, "HAIR", 0, "Hair", ""},
- {OB_POINTCLOUD, "POINTCLOUD", 0, "PointCloud", ""},
- {OB_VOLUME, "VOLUME", 0, "Volume", ""},
+ {OB_HAIR, "HAIR", ICON_OUTLINER_OB_HAIR, "Hair", ""},
+ {OB_POINTCLOUD, "POINTCLOUD", ICON_OUTLINER_OB_POINTCLOUD, "Point Cloud", ""},
+ {OB_VOLUME, "VOLUME", ICON_OUTLINER_OB_VOLUME, "Volume", ""},
+ {OB_GPENCIL, "GPENCIL", ICON_OUTLINER_OB_GREASEPENCIL, "Grease Pencil", ""},
{0, "", 0, NULL, NULL},
- {OB_ARMATURE, "ARMATURE", 0, "Armature", ""},
- {OB_LATTICE, "LATTICE", 0, "Lattice", ""},
- {OB_EMPTY, "EMPTY", 0, "Empty", ""},
- {OB_GPENCIL, "GPENCIL", 0, "GPencil", ""},
+ {OB_ARMATURE, "ARMATURE", ICON_OUTLINER_OB_ARMATURE, "Armature", ""},
+ {OB_LATTICE, "LATTICE", ICON_OUTLINER_OB_LATTICE, "Lattice", ""},
{0, "", 0, NULL, NULL},
- {OB_CAMERA, "CAMERA", 0, "Camera", ""},
- {OB_LAMP, "LIGHT", 0, "Light", ""},
- {OB_SPEAKER, "SPEAKER", 0, "Speaker", ""},
- {OB_LIGHTPROBE, "LIGHT_PROBE", 0, "Probe", ""},
+ {OB_EMPTY, "EMPTY", ICON_OUTLINER_OB_EMPTY, "Empty", ""},
+ {0, "", 0, NULL, NULL},
+ {OB_LAMP, "LIGHT", ICON_OUTLINER_OB_LIGHT, "Light", ""},
+ {OB_LIGHTPROBE, "LIGHT_PROBE", ICON_OUTLINER_OB_LIGHTPROBE, "Light Probe", ""},
+ {0, "", 0, NULL, NULL},
+ {OB_CAMERA, "CAMERA", ICON_OUTLINER_OB_CAMERA, "Camera", ""},
+ {0, "", 0, NULL, NULL},
+ {OB_SPEAKER, "SPEAKER", ICON_OUTLINER_OB_SPEAKER, "Speaker", ""},
{0, NULL, 0, NULL, NULL},
};
@@ -403,7 +406,7 @@ static void rna_Object_matrix_local_set(PointerRNA *ptr, const float values[16])
copy_m4_m4(local_mat, (float(*)[4])values);
}
- /* Don't use compat so we get predictable rotation, and do not use parenting either,
+ /* Don't use compatible so we get predictable rotation, and do not use parenting either,
* because it's a local matrix! */
BKE_object_apply_mat4(ob, local_mat, false, false);
}
@@ -738,9 +741,8 @@ static void rna_Object_dup_collection_set(PointerRNA *ptr,
Object *ob = (Object *)ptr->data;
Collection *grp = (Collection *)value.data;
- /* must not let this be set if the object belongs in this group already,
- * thus causing a cycle/infinite-recursion leading to crashes on load [#25298]
- */
+ /* Must not let this be set if the object belongs in this group already,
+ * thus causing a cycle/infinite-recursion leading to crashes on load T25298. */
if (BKE_collection_has_object_recursive(grp, ob) == 0) {
if (ob->type == OB_EMPTY) {
id_us_min(&ob->instance_collection->id);
@@ -1825,8 +1827,19 @@ static void rna_Object_boundbox_get(PointerRNA *ptr, float *values)
}
}
-static bDeformGroup *rna_Object_vgroup_new(Object *ob, Main *bmain, const char *name)
+static bDeformGroup *rna_Object_vgroup_new(Object *ob,
+ Main *bmain,
+ ReportList *reports,
+ const char *name)
{
+ if (!OB_TYPE_SUPPORT_VGROUP(ob->type)) {
+ const char *ob_type_name = "Unknown";
+ RNA_enum_name_from_value(rna_enum_object_type_items, ob->type, &ob_type_name);
+ BKE_reportf(
+ reports, RPT_ERROR, "VertexGroups.new(): is not supported for '%s' objects", ob_type_name);
+ return NULL;
+ }
+
bDeformGroup *defgroup = BKE_object_defgroup_add_name(ob, name);
DEG_relations_tag_update(bmain);
@@ -2052,14 +2065,14 @@ static void rna_def_vertex_group(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Name", "Vertex group name");
RNA_def_struct_name_property(srna, prop);
RNA_def_property_string_funcs(prop, NULL, NULL, "rna_VertexGroup_name_set");
- /* update data because modifiers may use [#24761] */
+ /* update data because modifiers may use T24761. */
RNA_def_property_update(
prop, NC_GEOM | ND_DATA | NA_RENAME, "rna_Object_internal_update_data_dependency");
prop = RNA_def_property(srna, "lock_weight", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_ui_text(prop, "", "Maintain the relative weights for the group");
RNA_def_property_boolean_sdna(prop, NULL, "flag", 0);
- /* update data because modifiers may use [#24761] */
+ /* update data because modifiers may use T24761. */
RNA_def_property_update(prop, NC_GEOM | ND_DATA | NA_RENAME, "rna_Object_internal_update_data");
prop = RNA_def_property(srna, "index", PROP_INT, PROP_UNSIGNED);
@@ -2112,7 +2125,7 @@ static void rna_def_face_map(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Name", "Face map name");
RNA_def_struct_name_property(srna, prop);
RNA_def_property_string_funcs(prop, NULL, NULL, "rna_FaceMap_name_set");
- /* update data because modifiers may use [#24761] */
+ /* update data because modifiers may use T24761. */
RNA_def_property_update(prop, NC_GEOM | ND_DATA | NA_RENAME, "rna_Object_internal_update_data");
prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
@@ -2486,7 +2499,7 @@ static void rna_def_object_vertex_groups(BlenderRNA *brna, PropertyRNA *cprop)
/* vertex groups */ /* add_vertex_group */
func = RNA_def_function(srna, "new", "rna_Object_vgroup_new");
- RNA_def_function_flag(func, FUNC_USE_MAIN);
+ RNA_def_function_flag(func, FUNC_USE_MAIN | FUNC_USE_REPORTS);
RNA_def_function_ui_description(func, "Add vertex group to object");
RNA_def_string(func, "name", "Group", 0, "", "Vertex group name"); /* optional */
parm = RNA_def_pointer(func, "group", "VertexGroup", "", "New vertex group");
diff --git a/source/blender/makesrna/intern/rna_object_api.c b/source/blender/makesrna/intern/rna_object_api.c
index ab6b60603c7..a04ad28f9c3 100644
--- a/source/blender/makesrna/intern/rna_object_api.c
+++ b/source/blender/makesrna/intern/rna_object_api.c
@@ -397,6 +397,9 @@ static PointerRNA rna_Object_shape_key_add(
RNA_pointer_create((ID *)BKE_key_from_object(ob), &RNA_ShapeKey, kb, &keyptr);
WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob);
+ DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY);
+ DEG_relations_tag_update(bmain);
+
return keyptr;
}
else {
diff --git a/source/blender/makesrna/intern/rna_object_force.c b/source/blender/makesrna/intern/rna_object_force.c
index 4c22890887a..2c740533dcd 100644
--- a/source/blender/makesrna/intern/rna_object_force.c
+++ b/source/blender/makesrna/intern/rna_object_force.c
@@ -26,6 +26,7 @@
#include "DNA_object_types.h"
#include "DNA_particle_types.h"
#include "DNA_pointcache_types.h"
+#include "DNA_rigidbody_types.h"
#include "DNA_scene_types.h"
#include "RNA_define.h"
@@ -777,7 +778,18 @@ static char *rna_EffectorWeight_path(PointerRNA *ptr)
}
}
else {
- Object *ob = (Object *)ptr->owner_id;
+ ID *id = ptr->owner_id;
+
+ if (id && GS(id->name) == ID_SCE) {
+ const Scene *scene = (Scene *)id;
+ const RigidBodyWorld *rbw = scene->rigidbody_world;
+
+ if (rbw->effector_weights == ew) {
+ return BLI_strdup("rigidbody_world.effector_weights");
+ }
+ }
+
+ Object *ob = (Object *)id;
ModifierData *md;
/* check softbody modifier */
diff --git a/source/blender/makesrna/intern/rna_particle.c b/source/blender/makesrna/intern/rna_particle.c
index 3067a5a9453..13b068c2be5 100644
--- a/source/blender/makesrna/intern/rna_particle.c
+++ b/source/blender/makesrna/intern/rna_particle.c
@@ -243,35 +243,87 @@ static void rna_ParticleHairKey_location_object_get(PointerRNA *ptr, float *valu
}
}
+/* Helper function which returns index of the given hair_key in particle which owns it.
+ * Works with cases when hair_key is coming from the particle which was passed here, and from the
+ * original particle of the given one.
+ *
+ * Such trickery is needed to allow modification of hair keys in the original object using
+ * evaluated particle and object to access proper hair matrix. */
+static int hair_key_index_get(/*const*/ HairKey *hair_key,
+ /*const*/ ParticleSystemModifierData *modifier,
+ /*const*/ ParticleData *particle)
+{
+ if (ARRAY_HAS_ITEM(hair_key, particle->hair, particle->totkey)) {
+ return hair_key - particle->hair;
+ }
+
+ const ParticleSystem *particle_system = modifier->psys;
+ const int particle_index = particle - particle_system->particles;
+
+ const ParticleSystemModifierData *original_modifier = (ParticleSystemModifierData *)
+ BKE_modifier_get_original(&modifier->modifier);
+ const ParticleSystem *original_particle_system = original_modifier->psys;
+ const ParticleData *original_particle = &original_particle_system->particles[particle_index];
+
+ if (ARRAY_HAS_ITEM(hair_key, original_particle->hair, original_particle->totkey)) {
+ return hair_key - original_particle->hair;
+ }
+
+ return -1;
+}
+
+/* Set hair_key->co to the given coordinate in object space (the given coordinate will be
+ * converted to the proper space).
+ *
+ * The hair_key can be coming from both original and evaluated object. Object, modifier and
+ * particle are to be from evaluated object, so that all the data needed for hair matrix is
+ * present. */
+static void hair_key_location_object_set(HairKey *hair_key,
+ Object *object,
+ ParticleSystemModifierData *modifier,
+ ParticleData *particle,
+ const float src_co[3])
+{
+ Mesh *hair_mesh = (modifier->psys->flag & PSYS_HAIR_DYNAMICS) ? modifier->psys->hair_out_mesh :
+ NULL;
+
+ if (hair_mesh != NULL) {
+ const int hair_key_index = hair_key_index_get(hair_key, modifier, particle);
+ if (hair_key_index == -1) {
+ return;
+ }
+
+ MVert *mvert = &hair_mesh->mvert[particle->hair_index + (hair_key_index)];
+ copy_v3_v3(mvert->co, src_co);
+ return;
+ }
+
+ float hairmat[4][4];
+ psys_mat_hair_to_object(
+ object, modifier->mesh_final, modifier->psys->part->from, particle, hairmat);
+
+ float imat[4][4];
+ invert_m4_m4(imat, hairmat);
+
+ copy_v3_v3(hair_key->co, src_co);
+ mul_m4_v3(imat, hair_key->co);
+}
+
static void rna_ParticleHairKey_location_object_set(PointerRNA *ptr, const float *values)
{
HairKey *hkey = (HairKey *)ptr->data;
Object *ob = (Object *)ptr->owner_id;
+
ParticleSystemModifierData *psmd;
ParticleData *pa;
-
rna_ParticleHairKey_location_object_info(ptr, &psmd, &pa);
- if (pa) {
- Mesh *hair_mesh = (psmd->psys->flag & PSYS_HAIR_DYNAMICS) ? psmd->psys->hair_out_mesh : NULL;
-
- if (hair_mesh) {
- MVert *mvert = &hair_mesh->mvert[pa->hair_index + (hkey - pa->hair)];
- copy_v3_v3(mvert->co, values);
- }
- else {
- float hairmat[4][4];
- float imat[4][4];
-
- psys_mat_hair_to_object(ob, psmd->mesh_final, psmd->psys->part->from, pa, hairmat);
- invert_m4_m4(imat, hairmat);
- copy_v3_v3(hkey->co, values);
- mul_m4_v3(imat, hkey->co);
- }
- }
- else {
+ if (pa == NULL) {
zero_v3(hkey->co);
+ return;
}
+
+ hair_key_location_object_set(hkey, ob, psmd, pa, values);
}
static void rna_ParticleHairKey_co_object(HairKey *hairkey,
@@ -301,6 +353,31 @@ static void rna_ParticleHairKey_co_object(HairKey *hairkey,
}
}
+static void rna_ParticleHairKey_co_object_set(ID *id,
+ HairKey *hair_key,
+ Object *object,
+ ParticleSystemModifierData *modifier,
+ ParticleData *particle,
+ float co[3])
+{
+
+ if (particle == NULL) {
+ return;
+ }
+
+ /* Mark particle system as edited, so then particle_system_update() does not reset the hair
+ * keys from path. This behavior is similar to how particle edit mode sets flags. */
+ ParticleSystemModifierData *orig_modifier = (ParticleSystemModifierData *)
+ modifier->modifier.orig_modifier_data;
+ orig_modifier->psys->flag |= PSYS_EDITED;
+
+ hair_key_location_object_set(hair_key, object, modifier, particle, co);
+
+ /* Tag similar to brushes in particle edit mode, so the modifier stack is properly evaluated
+ * with the same particle system recalc flags as during combing. */
+ DEG_id_tag_update(id, ID_RECALC_GEOMETRY | ID_RECALC_PSYS_REDO);
+}
+
static void rna_Particle_uv_on_emitter(ParticleData *particle,
ReportList *reports,
ParticleSystemModifierData *modifier,
@@ -1651,6 +1728,19 @@ static void rna_def_particle_hair_key(BlenderRNA *brna)
func, "co", 3, NULL, -FLT_MAX, FLT_MAX, "Co", "Exported hairkey location", -1e4, 1e4);
RNA_def_parameter_flags(parm, PROP_THICK_WRAP, 0);
RNA_def_function_output(func, parm);
+
+ func = RNA_def_function(srna, "co_object_set", "rna_ParticleHairKey_co_object_set");
+ RNA_def_function_flag(func, FUNC_USE_SELF_ID);
+ RNA_def_function_ui_description(func, "Set hairkey location with particle and modifier data");
+ parm = RNA_def_pointer(func, "object", "Object", "", "Object");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
+ parm = RNA_def_pointer(func, "modifier", "ParticleSystemModifier", "", "Particle modifier");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
+ parm = RNA_def_pointer(func, "particle", "Particle", "", "hair particle");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
+ parm = RNA_def_float_vector(
+ func, "co", 3, NULL, -FLT_MAX, FLT_MAX, "Co", "Specified hairkey location", -1e4, 1e4);
+ RNA_def_parameter_flags(parm, PROP_THICK_WRAP, PARM_REQUIRED);
}
static void rna_def_particle_key(BlenderRNA *brna)
@@ -3019,7 +3109,7 @@ static void rna_def_particle_settings(BlenderRNA *brna)
/* physical properties */
prop = RNA_def_property(srna, "mass", PROP_FLOAT, PROP_UNIT_MASS);
RNA_def_property_range(prop, 0.00000001f, 100000.0f);
- RNA_def_property_ui_range(prop, 0.01, 100, 1, 3);
+ RNA_def_property_ui_range(prop, 0.01, 100, 1, 4);
RNA_def_property_ui_text(prop, "Mass", "Mass of the particles");
RNA_def_property_update(prop, 0, "rna_Particle_reset");
@@ -3349,7 +3439,7 @@ static void rna_def_particle_settings(BlenderRNA *brna)
prop = RNA_def_property(srna, "keyed_loops", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "keyed_loops");
RNA_def_property_range(prop, 1.0f, 10000.0f);
- RNA_def_property_ui_range(prop, 1.0f, 100.0f, 0.1, 3);
+ RNA_def_property_ui_range(prop, 1.0f, 100.0f, 1, 3);
RNA_def_property_ui_text(prop, "Loop Count", "Number of times the keys are looped");
RNA_def_property_update(prop, 0, "rna_Particle_redo");
diff --git a/source/blender/makesrna/intern/rna_pointcloud.c b/source/blender/makesrna/intern/rna_pointcloud.c
index 4e3243ae80f..90ff69b2a8a 100644
--- a/source/blender/makesrna/intern/rna_pointcloud.c
+++ b/source/blender/makesrna/intern/rna_pointcloud.c
@@ -156,6 +156,8 @@ static void rna_def_pointcloud(BlenderRNA *brna)
RNA_def_property_collection_funcs(
prop, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "rna_IDMaterials_assign_int");
+ rna_def_attributes_common(srna);
+
/* common */
rna_def_animdata_common(srna);
}
diff --git a/source/blender/makesrna/intern/rna_render.c b/source/blender/makesrna/intern/rna_render.c
index 5b77632be79..35563ad143e 100644
--- a/source/blender/makesrna/intern/rna_render.c
+++ b/source/blender/makesrna/intern/rna_render.c
@@ -100,7 +100,7 @@ const EnumPropertyItem rna_enum_bake_pass_type_items[] = {
# include "BKE_context.h"
# include "BKE_report.h"
-# include "GPU_extensions.h"
+# include "GPU_capabilities.h"
# include "GPU_shader.h"
# include "IMB_colormanagement.h"
diff --git a/source/blender/makesrna/intern/rna_rigidbody.c b/source/blender/makesrna/intern/rna_rigidbody.c
index 6c8b8e6859d..d4d30d0c09a 100644
--- a/source/blender/makesrna/intern/rna_rigidbody.c
+++ b/source/blender/makesrna/intern/rna_rigidbody.c
@@ -81,7 +81,7 @@ const EnumPropertyItem rna_enum_rigidbody_object_shape_items[] = {
"COMPOUND",
ICON_MESH_DATA,
"Compound Parent",
- "Combines all of its direct rigid body children into one rigid object."},
+ "Combines all of its direct rigid body children into one rigid object"},
{0, NULL, 0, NULL, NULL},
};
diff --git a/source/blender/makesrna/intern/rna_rna.c b/source/blender/makesrna/intern/rna_rna.c
index 9f5440be9f8..2f98c751f26 100644
--- a/source/blender/makesrna/intern/rna_rna.c
+++ b/source/blender/makesrna/intern/rna_rna.c
@@ -117,6 +117,7 @@ const EnumPropertyItem rna_enum_property_unit_items[] = {
{PROP_UNIT_MASS, "MASS", 0, "Mass", ""},
{PROP_UNIT_CAMERA, "CAMERA", 0, "Camera", ""},
{PROP_UNIT_POWER, "POWER", 0, "Power", ""},
+ {PROP_UNIT_TEMPERATURE, "TEMPERATURE", 0, "Temperature", ""},
{0, NULL, 0, NULL, NULL},
};
@@ -127,6 +128,7 @@ const EnumPropertyItem rna_enum_property_unit_items[] = {
# include "BLI_string.h"
# include "MEM_guardedalloc.h"
+# include "BKE_idprop.h"
# include "BKE_lib_override.h"
/* Struct */
@@ -1187,9 +1189,12 @@ static bool rna_property_override_diff_propptr_validate_diffing(PointerRNA *prop
* This helps a lot in library override case, especially to detect inserted items in collections.
*/
if (!no_prop_name && (is_valid_for_diffing || do_force_name)) {
- PropertyRNA *nameprop_a = RNA_struct_name_property(propptr_a->type);
- PropertyRNA *nameprop_b = (propptr_b != NULL) ? RNA_struct_name_property(propptr_b->type) :
- NULL;
+ PropertyRNA *nameprop_a = (propptr_a->type != NULL) ?
+ RNA_struct_name_property(propptr_a->type) :
+ NULL;
+ PropertyRNA *nameprop_b = (propptr_b != NULL && propptr_b->type != NULL) ?
+ RNA_struct_name_property(propptr_b->type) :
+ NULL;
int propname_a_len = 0, propname_b_len = 0;
char *propname_a = NULL;
@@ -1301,8 +1306,6 @@ static int rna_property_override_diff_propptr(Main *bmain,
/* If not yet overridden, or if we are handling sub-items (inside a collection)... */
if (op != NULL) {
- BKE_lib_override_library_operations_tag(op, IDOVERRIDE_LIBRARY_TAG_UNUSED, false);
-
if (created || op->rna_prop_type == 0) {
op->rna_prop_type = property_type;
}
@@ -1312,19 +1315,27 @@ static int rna_property_override_diff_propptr(Main *bmain,
if (created || rna_itemname_a != NULL || rna_itemname_b != NULL ||
rna_itemindex_a != -1 || rna_itemindex_b != -1) {
- BKE_lib_override_library_property_operation_get(op,
- IDOVERRIDE_LIBRARY_OP_REPLACE,
- rna_itemname_b,
- rna_itemname_a,
- rna_itemindex_b,
- rna_itemindex_a,
- true,
- NULL,
- &created);
+ IDOverrideLibraryPropertyOperation *opop;
+ opop = BKE_lib_override_library_property_operation_get(op,
+ IDOVERRIDE_LIBRARY_OP_REPLACE,
+ rna_itemname_b,
+ rna_itemname_a,
+ rna_itemindex_b,
+ rna_itemindex_a,
+ true,
+ NULL,
+ &created);
+ /* Do not use BKE_lib_override_library_operations_tag here, we do not want to validate
+ * as used all of its operations. */
+ op->tag &= ~IDOVERRIDE_LIBRARY_TAG_UNUSED;
+ opop->tag &= ~IDOVERRIDE_LIBRARY_TAG_UNUSED;
if (r_override_changed) {
*r_override_changed = created;
}
}
+ else {
+ BKE_lib_override_library_operations_tag(op, IDOVERRIDE_LIBRARY_TAG_UNUSED, false);
+ }
}
}
@@ -1752,7 +1763,6 @@ int rna_property_override_diff_default(Main *bmain,
case PROP_COLLECTION: {
bool equals = true;
bool abort = false;
- bool is_first_insert = true;
int idx_a = 0;
int idx_b = 0;
@@ -1767,6 +1777,22 @@ int rna_property_override_diff_default(Main *bmain,
char *prev_propname_a = buff_prev_a;
char *propname_b = NULL;
+ if (use_collection_insertion) {
+ /* We need to clean up all possible existing insertion operations, and then re-generate
+ * them, otherwise we'd end up with a mess of opop's every time something changes. */
+ op = BKE_lib_override_library_property_find(override, rna_path);
+ if (op != NULL) {
+ LISTBASE_FOREACH_MUTABLE (IDOverrideLibraryPropertyOperation *, opop, &op->operations) {
+ if (ELEM(opop->operation,
+ IDOVERRIDE_LIBRARY_OP_INSERT_AFTER,
+ IDOVERRIDE_LIBRARY_OP_INSERT_BEFORE)) {
+ BKE_lib_override_library_property_operation_delete(op, opop);
+ }
+ }
+ op = NULL;
+ }
+ }
+
for (; iter_a.valid && !abort;) {
bool is_valid_for_diffing;
bool is_valid_for_insertion;
@@ -1849,22 +1875,6 @@ int rna_property_override_diff_default(Main *bmain,
if (is_valid_for_insertion && use_collection_insertion) {
op = BKE_lib_override_library_property_get(override, rna_path, &created);
- if (is_first_insert) {
- /* We need to clean up all possible existing insertion operations,
- * otherwise we'd end up with a mess of ops everytime something changes. */
- for (IDOverrideLibraryPropertyOperation *opop = op->operations.first;
- opop != NULL;) {
- IDOverrideLibraryPropertyOperation *opop_next = opop->next;
- if (ELEM(opop->operation,
- IDOVERRIDE_LIBRARY_OP_INSERT_AFTER,
- IDOVERRIDE_LIBRARY_OP_INSERT_BEFORE)) {
- BKE_lib_override_library_property_operation_delete(op, opop);
- }
- opop = opop_next;
- }
- is_first_insert = false;
- }
-
BKE_lib_override_library_property_operation_get(op,
IDOVERRIDE_LIBRARY_OP_INSERT_AFTER,
NULL,
@@ -2524,8 +2534,75 @@ bool rna_property_override_apply_default(Main *UNUSED(bmain),
return true;
}
case PROP_COLLECTION: {
- BLI_assert(!"You need to define a specific override apply callback for enums.");
- return false;
+ /* We only support IDProperty-based collection insertion here. */
+ const bool is_src_idprop = (prop_src->magic != RNA_MAGIC) ||
+ (prop_src->flag & PROP_IDPROPERTY) != 0;
+ const bool is_dst_idprop = (prop_dst->magic != RNA_MAGIC) ||
+ (prop_dst->flag & PROP_IDPROPERTY) != 0;
+ if (!(is_src_idprop && is_dst_idprop)) {
+ BLI_assert(0 && "You need to define a specific override apply callback for collections");
+ return false;
+ }
+
+ switch (override_op) {
+ case IDOVERRIDE_LIBRARY_OP_INSERT_AFTER: {
+ PointerRNA item_ptr_src, item_ptr_ref, item_ptr_dst;
+ int item_index_dst;
+ bool is_valid = false;
+ if (opop->subitem_local_name != NULL && opop->subitem_local_name[0] != '\0') {
+ /* Find from name. */
+ int item_index_src, item_index_ref;
+ if (RNA_property_collection_lookup_string_index(
+ ptr_src, prop_src, opop->subitem_local_name, &item_ptr_src, &item_index_src) &&
+ RNA_property_collection_lookup_int(
+ ptr_src, prop_src, item_index_src + 1, &item_ptr_src) &&
+ RNA_property_collection_lookup_string_index(
+ ptr_dst, prop_dst, opop->subitem_local_name, &item_ptr_ref, &item_index_ref)) {
+ is_valid = true;
+ item_index_dst = item_index_ref + 1;
+ }
+ }
+ if (!is_valid && opop->subitem_local_index >= 0) {
+ /* Find from index. */
+ if (RNA_property_collection_lookup_int(
+ ptr_src, prop_src, opop->subitem_local_index + 1, &item_ptr_src) &&
+ RNA_property_collection_lookup_int(
+ ptr_dst, prop_dst, opop->subitem_local_index, &item_ptr_ref)) {
+ item_index_dst = opop->subitem_local_index + 1;
+ is_valid = true;
+ }
+ }
+ if (!is_valid) {
+ /* Assume it is inserted in first position. */
+ if (RNA_property_collection_lookup_int(ptr_src, prop_src, 0, &item_ptr_src)) {
+ item_index_dst = 0;
+ is_valid = true;
+ }
+ }
+ if (!is_valid) {
+ return false;
+ }
+
+ RNA_property_collection_add(ptr_dst, prop_dst, &item_ptr_dst);
+ const int item_index_added = RNA_property_collection_length(ptr_dst, prop_dst) - 1;
+ BLI_assert(item_index_added >= 0);
+
+ /* This is the section of code that makes it specific to IDProperties (the rest could be
+ * used with some regular RNA/DNA data too, if `RNA_property_collection_add` where
+ * actually implemented for those).
+ * Currently it is close to impossible to copy arbitrary 'real' RNA data between
+ * Collection items. */
+ IDProperty *item_idprop_src = item_ptr_src.data;
+ IDProperty *item_idprop_dst = item_ptr_dst.data;
+ IDP_CopyPropertyContent(item_idprop_dst, item_idprop_src);
+
+ return RNA_property_collection_move(ptr_dst, prop_dst, item_index_added, item_index_dst);
+ break;
+ }
+ default:
+ BLI_assert(0 && "Unsupported RNA override operation on collection");
+ return false;
+ }
}
default:
BLI_assert(0);
diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c
index e470a8ddb85..8e09de86529 100644
--- a/source/blender/makesrna/intern/rna_scene.c
+++ b/source/blender/makesrna/intern/rna_scene.c
@@ -44,6 +44,7 @@
#include "BKE_armature.h"
#include "BKE_editmesh.h"
#include "BKE_paint.h"
+#include "BKE_volume.h"
#include "ED_gpencil.h"
#include "ED_object.h"
@@ -1888,6 +1889,10 @@ static void object_simplify_update(Object *ob)
}
FOREACH_COLLECTION_OBJECT_RECURSIVE_END;
}
+
+ if (ob->type == OB_VOLUME) {
+ DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY);
+ }
}
static void rna_Scene_use_simplify_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
@@ -2514,7 +2519,7 @@ static const EnumPropertyItem *rna_UnitSettings_itemf_wrapper(const int system,
{
const void *usys;
int len;
- bUnit_GetSystem(system, type, &usys, &len);
+ BKE_unit_system_get(system, type, &usys, &len);
EnumPropertyItem *items = NULL;
int totitem = 0;
@@ -2526,10 +2531,10 @@ static const EnumPropertyItem *rna_UnitSettings_itemf_wrapper(const int system,
RNA_enum_item_add(&items, &totitem, &adaptive);
for (int i = 0; i < len; i++) {
- if (!bUnit_IsSuppressed(usys, i)) {
+ if (!BKE_unit_is_suppressed(usys, i)) {
EnumPropertyItem tmp = {0};
- tmp.identifier = bUnit_GetIdentifier(usys, i);
- tmp.name = bUnit_GetNameDisplay(usys, i);
+ tmp.identifier = BKE_unit_identifier_get(usys, i);
+ tmp.name = BKE_unit_display_name_get(usys, i);
tmp.value = i;
RNA_enum_item_add(&items, &totitem, &tmp);
}
@@ -2568,6 +2573,15 @@ const EnumPropertyItem *rna_UnitSettings_time_unit_itemf(bContext *UNUSED(C),
return rna_UnitSettings_itemf_wrapper(units->system, B_UNIT_TIME, r_free);
}
+const EnumPropertyItem *rna_UnitSettings_temperature_unit_itemf(bContext *UNUSED(C),
+ PointerRNA *ptr,
+ PropertyRNA *UNUSED(prop),
+ bool *r_free)
+{
+ UnitSettings *units = ptr->data;
+ return rna_UnitSettings_itemf_wrapper(units->system, B_UNIT_TEMPERATURE, r_free);
+}
+
static void rna_UnitSettings_system_update(Main *UNUSED(bmain),
Scene *scene,
PointerRNA *UNUSED(ptr))
@@ -2578,8 +2592,8 @@ static void rna_UnitSettings_system_update(Main *UNUSED(bmain),
unit->mass_unit = USER_UNIT_ADAPTIVE;
}
else {
- unit->length_unit = bUnit_GetBaseUnitOfType(unit->system, B_UNIT_LENGTH);
- unit->mass_unit = bUnit_GetBaseUnitOfType(unit->system, B_UNIT_MASS);
+ unit->length_unit = BKE_unit_base_of_type_get(unit->system, B_UNIT_LENGTH);
+ unit->mass_unit = BKE_unit_base_of_type_get(unit->system, B_UNIT_MASS);
}
}
@@ -2631,6 +2645,12 @@ static void rna_def_gpencil_interpolate(BlenderRNA *brna)
prop, "Type", "Interpolation method to use the next time 'Interpolate Sequence' is run");
RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
+ prop = RNA_def_property(srna, "step", PROP_INT, PROP_NONE);
+ RNA_def_property_range(prop, 1, MAXFRAME);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(prop, "Step", "Number of frames between generated interpolated frames");
+ RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
+
/* easing */
prop = RNA_def_property(srna, "easing", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "easing");
@@ -3474,7 +3494,7 @@ static void rna_def_tool_settings(BlenderRNA *brna)
prop = RNA_def_property(srna, "use_edge_path_live_unwrap", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "edge_mode_live_unwrap", 1);
- RNA_def_property_ui_text(prop, "Live Unwrap", "Changing edges seam recalculates UV unwrap");
+ RNA_def_property_ui_text(prop, "Live Unwrap", "Changing edge seams recalculates UV unwrap");
prop = RNA_def_property(srna, "normal_vector", PROP_FLOAT, PROP_XYZ);
RNA_def_property_ui_text(prop, "Normal Vector", "Normal Vector used to copy, add or multiply");
@@ -3900,6 +3920,13 @@ static void rna_def_unit_settings(BlenderRNA *brna)
RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_UnitSettings_time_unit_itemf");
RNA_def_property_ui_text(prop, "Time Unit", "Unit that will be used to display time values");
RNA_def_property_update(prop, NC_WINDOW, NULL);
+
+ prop = RNA_def_property(srna, "temperature_unit", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, DummyRNA_DEFAULT_items);
+ RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_UnitSettings_temperature_unit_itemf");
+ RNA_def_property_ui_text(
+ prop, "Temperature Unit", "Unit that will be used to display temperature values");
+ RNA_def_property_update(prop, NC_WINDOW, NULL);
}
static void rna_def_view_layer_eevee(BlenderRNA *brna)
@@ -6451,6 +6478,12 @@ static void rna_def_scene_render_data(BlenderRNA *brna)
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_volumes", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_range(prop, 0.0, 1.0f);
+ RNA_def_property_ui_text(
+ prop, "Simplify Volumes", "Resolution percentage of volume objects in viewport");
+ RNA_def_property_update(prop, 0, "rna_Scene_simplify_update");
+
/* Grease Pencil - Simplify Options */
prop = RNA_def_property(srna, "simplify_gpencil", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "simplify_gpencil", SIMPLIFY_GPENCIL_ENABLE);
diff --git a/source/blender/makesrna/intern/rna_scene_api.c b/source/blender/makesrna/intern/rna_scene_api.c
index ff887e53965..10deceb0fec 100644
--- a/source/blender/makesrna/intern/rna_scene_api.c
+++ b/source/blender/makesrna/intern/rna_scene_api.c
@@ -90,7 +90,7 @@ static void rna_Scene_frame_set(Scene *scene, Main *bmain, int frame, float subf
* redrawing while the data is being modified for render */
if (!G.is_rendering) {
/* cant use NC_SCENE|ND_FRAME because this causes wm_event_do_notifiers to call
- * BKE_scene_graph_update_for_newframe which will loose any un-keyed changes [#24690] */
+ * BKE_scene_graph_update_for_newframe which will loose any un-keyed changes T24690. */
/* WM_main_add_notifier(NC_SCENE|ND_FRAME, scene); */
/* instead just redraw the views */
diff --git a/source/blender/makesrna/intern/rna_sculpt_paint.c b/source/blender/makesrna/intern/rna_sculpt_paint.c
index 8532bf9afab..c7bdf7a2dd6 100644
--- a/source/blender/makesrna/intern/rna_sculpt_paint.c
+++ b/source/blender/makesrna/intern/rna_sculpt_paint.c
@@ -124,6 +124,7 @@ const EnumPropertyItem rna_enum_symmetrize_direction_items[] = {
# include "DEG_depsgraph.h"
# include "ED_gpencil.h"
+# include "ED_paint.h"
# include "ED_particle.h"
static void rna_GPencil_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *UNUSED(ptr))
@@ -228,7 +229,7 @@ static const EnumPropertyItem *rna_ParticleEdit_tool_itemf(bContext *C,
# else
/* use this rather than PE_get_current() - because the editing cache is
* dependent on the cache being updated which can happen after this UI
- * draws causing a glitch [#28883] */
+ * draws causing a glitch T28883. */
ParticleSystem *psys = psys_get_current(ob);
# endif
@@ -483,7 +484,7 @@ static void rna_ImaPaint_mode_update(bContext *C, PointerRNA *UNUSED(ptr))
/* We assume that changing the current mode will invalidate the uv layers
* so we need to refresh display. */
- BKE_paint_proj_mesh_data_check(scene, ob, NULL, NULL, NULL, NULL);
+ ED_paint_proj_mesh_data_check(scene, ob, NULL, NULL, NULL, NULL);
WM_main_add_notifier(NC_OBJECT | ND_DRAW, NULL);
}
}
@@ -495,7 +496,7 @@ static void rna_ImaPaint_stencil_update(bContext *C, PointerRNA *UNUSED(ptr))
Object *ob = OBACT(view_layer);
if (ob && ob->type == OB_MESH) {
- BKE_paint_proj_mesh_data_check(scene, ob, NULL, NULL, NULL, NULL);
+ ED_paint_proj_mesh_data_check(scene, ob, NULL, NULL, NULL, NULL);
WM_main_add_notifier(NC_OBJECT | ND_DRAW, NULL);
}
}
@@ -527,7 +528,7 @@ static void rna_ImaPaint_canvas_update(bContext *C, PointerRNA *UNUSED(ptr))
}
if (ob && ob->type == OB_MESH) {
- BKE_paint_proj_mesh_data_check(scene, ob, NULL, NULL, NULL, NULL);
+ ED_paint_proj_mesh_data_check(scene, ob, NULL, NULL, NULL, NULL);
WM_main_add_notifier(NC_OBJECT | ND_DRAW, NULL);
}
}
diff --git a/source/blender/makesrna/intern/rna_sequencer.c b/source/blender/makesrna/intern/rna_sequencer.c
index 629dc104ab5..53cbd8522fe 100644
--- a/source/blender/makesrna/intern/rna_sequencer.c
+++ b/source/blender/makesrna/intern/rna_sequencer.c
@@ -2819,7 +2819,7 @@ static void rna_def_speed_control(StructRNA *srna)
prop, "Scale to Length", "Scale values from 0.0 to 1.0 to target sequence length");
RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_invalidate_raw_update");
- prop = RNA_def_property(srna, "frame_interpolation_mode", PROP_BOOLEAN, PROP_NONE);
+ prop = RNA_def_property(srna, "use_frame_interpolate", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flags", SEQ_SPEED_USE_INTERPOLATION);
RNA_def_property_ui_text(
prop, "Frame interpolation", "Do crossfade blending between current and next frame");
diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c
index b30a8e4bbdc..2a4bc6bae06 100644
--- a/source/blender/makesrna/intern/rna_space.c
+++ b/source/blender/makesrna/intern/rna_space.c
@@ -464,22 +464,18 @@ static const EnumPropertyItem fileselectparams_recursion_level_items[] = {
};
const EnumPropertyItem rna_enum_file_sort_items[] = {
- {FILE_SORT_ALPHA,
- "FILE_SORT_ALPHA",
- ICON_SORTALPHA,
- "Name",
- "Sort the file list alphabetically"},
+ {FILE_SORT_ALPHA, "FILE_SORT_ALPHA", ICON_NONE, "Name", "Sort the file list alphabetically"},
{FILE_SORT_EXTENSION,
"FILE_SORT_EXTENSION",
- ICON_SORTBYEXT,
+ ICON_NONE,
"Extension",
"Sort the file list by extension/type"},
{FILE_SORT_TIME,
"FILE_SORT_TIME",
- ICON_SORTTIME,
+ ICON_NONE,
"Modified Date",
"Sort files by modification time"},
- {FILE_SORT_SIZE, "FILE_SORT_SIZE", ICON_SORTSIZE, "Size", "Sort files by size"},
+ {FILE_SORT_SIZE, "FILE_SORT_SIZE", ICON_NONE, "Size", "Sort files by size"},
{0, NULL, 0, NULL, NULL},
};
@@ -1401,6 +1397,16 @@ static char *rna_View3DOverlay_path(PointerRNA *UNUSED(ptr))
/* Space Image Editor */
+static PointerRNA rna_SpaceImage_overlay_get(PointerRNA *ptr)
+{
+ return rna_pointer_inherit_refine(ptr, &RNA_SpaceImageOverlay, ptr->data);
+}
+
+static char *rna_SpaceImageOverlay_path(PointerRNA *UNUSED(ptr))
+{
+ return BLI_strdup("overlay");
+}
+
static char *rna_SpaceUVEditor_path(PointerRNA *UNUSED(ptr))
{
return BLI_strdup("uv_editor");
@@ -1781,11 +1787,9 @@ static const EnumPropertyItem *rna_SpaceProperties_context_itemf(bContext *UNUSE
SpaceProperties *sbuts = (SpaceProperties *)(ptr->data);
EnumPropertyItem *item = NULL;
- /* We use 32 tabs maximum here so a flag for each can fit into a 32 bit integer flag.
- * A theoretical maximum would be BCONTEXT_TOT * 2, with every tab displayed and a spacer
- * in every other item. But this size is currently limited by the size of integer
- * supported by RNA enums. */
- int context_tabs_array[32];
+ /* Although it would never reach this amount, a theoretical maximum number of tabs
+ * is BCONTEXT_TOT * 2, with every tab displayed and a spacer in every other item. */
+ short context_tabs_array[BCONTEXT_TOT * 2];
int totitem = ED_buttons_tabs_list(sbuts, context_tabs_array);
BLI_assert(totitem <= ARRAY_SIZE(context_tabs_array));
@@ -1821,6 +1825,18 @@ static void rna_SpaceProperties_context_update(Main *UNUSED(bmain),
}
}
+static void rna_SpaceProperties_search_filter_update(Main *UNUSED(bmain),
+ Scene *UNUSED(scene),
+ PointerRNA *ptr)
+{
+ ScrArea *area = rna_area_from_space(ptr);
+
+ /* Update the search filter flag for the main region with the panels. */
+ ARegion *main_region = BKE_area_find_region_type(area, RGN_TYPE_WINDOW);
+ BLI_assert(main_region != NULL);
+ ED_region_search_filter_update(area, main_region);
+}
+
/* Space Console */
static void rna_ConsoleLine_body_get(PointerRNA *ptr, char *value)
{
@@ -1914,78 +1930,73 @@ static void rna_SpaceDopeSheetEditor_action_update(bContext *C, PointerRNA *ptr)
SpaceAction *saction = (SpaceAction *)(ptr->data);
ViewLayer *view_layer = CTX_data_view_layer(C);
Main *bmain = CTX_data_main(C);
- Object *obact = OBACT(view_layer);
- /* we must set this action to be the one used by active object (if not pinned) */
- if (obact /* && saction->pin == 0*/) {
- AnimData *adt = NULL;
+ Object *obact = OBACT(view_layer);
+ if (obact == NULL) {
+ return;
+ }
- if (saction->mode == SACTCONT_ACTION) {
+ AnimData *adt = NULL;
+ ID *id = NULL;
+ switch (saction->mode) {
+ case SACTCONT_ACTION:
/* TODO: context selector could help decide this with more control? */
- adt = BKE_animdata_add_id(&obact->id); /* this only adds if non-existent */
- }
- else if (saction->mode == SACTCONT_SHAPEKEY) {
+ adt = BKE_animdata_add_id(&obact->id);
+ id = &obact->id;
+ break;
+ case SACTCONT_SHAPEKEY: {
Key *key = BKE_key_from_object(obact);
- if (key) {
- adt = BKE_animdata_add_id(&key->id); /* this only adds if non-existent */
+ if (key == NULL) {
+ return;
}
+ adt = BKE_animdata_add_id(&key->id);
+ id = &key->id;
+ break;
}
+ case SACTCONT_GPENCIL:
+ case SACTCONT_DOPESHEET:
+ case SACTCONT_MASK:
+ case SACTCONT_CACHEFILE:
+ case SACTCONT_TIMELINE:
+ return;
+ }
- /* set action */
- // FIXME: this overlaps a lot with the BKE_animdata_set_action() API method
- if (adt) {
- /* 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 signaling 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);
- }
- }
+ if (adt == NULL) {
+ /* No animdata was added, so the depsgraph also doesn't need tagging. */
+ return;
+ }
- /* Force update of animdata */
- DEG_id_tag_update(&obact->id, ID_RECALC_ANIMATION);
- }
+ /* Don't do anything if old and new actions are the same... */
+ if (adt->action == saction->action) {
+ return;
+ }
- /* force depsgraph flush too */
- DEG_id_tag_update(&obact->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY);
- /* Update relations as well, so new time source dependency is added. */
- DEG_relations_tag_update(bmain);
+ /* Exit editmode first - we cannot change actions while in tweakmode. */
+ BKE_nla_tweakmode_exit(adt);
+
+ /* 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 signaling 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 != NULL && 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);
}
+
+ BKE_animdata_set_action(NULL, id, saction->action);
+
+ DEG_id_tag_update(&obact->id, ID_RECALC_ANIMATION | ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY);
+
+ /* Update relations as well, so new time source dependency is added. */
+ DEG_relations_tag_update(bmain);
}
static void rna_SpaceDopeSheetEditor_mode_update(bContext *C, PointerRNA *ptr)
@@ -2006,12 +2017,6 @@ static void rna_SpaceDopeSheetEditor_mode_update(bContext *C, PointerRNA *ptr)
else {
saction->action = NULL;
}
-
- /* 2) enable 'show sliders' by default, since one of the main
- * points of the ShapeKey Editor is to provide a one-stop shop
- * for controlling the shapekeys, whose main control is the value
- */
- saction->flag |= SACTION_SLIDERS;
}
/* make sure action stored is valid */
else if (saction->mode == SACTCONT_ACTION) {
@@ -2610,9 +2615,10 @@ static void rna_FileBrowser_FSMenu_active_range(PointerRNA *UNUSED(ptr),
*max = *softmax = ED_fsmenu_get_nentries(fsmenu, category) - 1;
}
-static void rna_FileBrowser_FSMenu_active_update(struct bContext *C, PointerRNA *UNUSED(ptr))
+static void rna_FileBrowser_FSMenu_active_update(struct bContext *C, PointerRNA *ptr)
{
- ED_file_change_dir(C);
+ ScrArea *area = rna_area_from_space(ptr);
+ ED_file_change_dir_ex(C, (bScreen *)ptr->owner_id, area);
}
static int rna_FileBrowser_FSMenuSystem_active_get(PointerRNA *ptr)
@@ -2832,7 +2838,7 @@ static void rna_def_space_image_uv(BlenderRNA *brna)
"SHARED_VERTEX",
ICON_STICKY_UVS_VERT,
"Shared Vertex",
- "Select UVs that share mesh vertex, irrespective if they are in the same location"},
+ "Select UVs that share a mesh vertex, whether or not they are at the same location"},
{0, NULL, 0, NULL, NULL},
};
@@ -2860,9 +2866,7 @@ static void rna_def_space_image_uv(BlenderRNA *brna)
RNA_def_property_enum_sdna(prop, NULL, "sticky");
RNA_def_property_enum_items(prop, sticky_mode_items);
RNA_def_property_ui_text(
- prop,
- "Sticky Selection Mode",
- "Automatically select also UVs sharing the same vertex as the ones being selected");
+ prop, "Sticky Selection Mode", "Method for extending UV vertex selection");
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL);
/* drawing */
@@ -2974,7 +2978,11 @@ static void rna_def_space_outliner(BlenderRNA *brna)
ICON_RENDER_RESULT,
"View Layer",
"Display collections and objects in the view layer"},
- {SO_SEQUENCE, "SEQUENCE", ICON_SEQUENCE, "Sequence", "Display sequence data-blocks"},
+ {SO_SEQUENCE,
+ "SEQUENCE",
+ ICON_SEQUENCE,
+ "Video Sequencer",
+ "Display data belonging to the Video Sequencer"},
{SO_LIBRARIES,
"LIBRARIES",
ICON_FILE_BLEND,
@@ -3041,6 +3049,12 @@ static void rna_def_space_outliner(BlenderRNA *brna)
prop, "Sync Outliner Selection", "Sync outliner selection with other editors");
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_OUTLINER, NULL);
+ prop = RNA_def_property(srna, "show_mode_column", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SO_MODE_COLUMN);
+ RNA_def_property_ui_text(
+ prop, "Show Mode Column", "Show the mode column for mode toggle and activation");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_OUTLINER, NULL);
+
/* Granular restriction column option. */
prop = RNA_def_property(srna, "show_restrict_column_enable", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "show_restrict_flags", SO_RESTRICT_ENABLE);
@@ -3326,6 +3340,15 @@ static void rna_def_space_view3d_shading(BlenderRNA *brna)
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D | NS_VIEW3D_SHADING, NULL);
+ prop = RNA_def_property(srna, "use_studiolight_view_rotation", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(
+ prop, NULL, "flag", V3D_SHADING_STUDIOLIGHT_VIEW_ROTATION);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_boolean_default(prop, false);
+ RNA_def_property_ui_text(
+ prop, "World Space Lighting", "Make the HDR rotation fixed and not follow the camera");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D | NS_VIEW3D_SHADING, NULL);
+
prop = RNA_def_property(srna, "color_type", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "color_type");
RNA_def_property_enum_items(prop, rna_enum_shading_color_type_items);
@@ -3587,6 +3610,20 @@ static void rna_def_space_view3d_overlay(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Face Orientation", "Show the Face Orientation Overlay");
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+ prop = RNA_def_property(srna, "show_fade_inactive", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "overlay.flag", V3D_OVERLAY_FADE_INACTIVE);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(
+ prop, "Fade Inactive Objects", "Fade inactive geometry using the viewport background color");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ prop = RNA_def_property(srna, "fade_inactive_alpha", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "overlay.fade_alpha");
+ RNA_def_property_ui_text(prop, "Opacity", "Strength of the fade effect");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, "rna_GPencil_update");
+
prop = RNA_def_property(srna, "show_xray_bone", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "overlay.flag", V3D_OVERLAY_BONE_SELECT);
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
@@ -4475,6 +4512,31 @@ static void rna_def_space_properties(BlenderRNA *brna)
prop = RNA_def_property(srna, "use_pin_id", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", SB_PIN_CONTEXT);
RNA_def_property_ui_text(prop, "Pin ID", "Use the pinned context");
+
+ /* Property search. */
+ prop = RNA_def_property(srna, "search_filter", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "runtime->search_string");
+ RNA_def_property_ui_text(prop, "Display Filter", "Live search filtering string");
+ RNA_def_property_flag(prop, PROP_TEXTEDIT_UPDATE);
+ RNA_def_property_update(
+ prop, NC_SPACE | ND_SPACE_PROPERTIES, "rna_SpaceProperties_search_filter_update");
+}
+
+static void rna_def_space_image_overlay(BlenderRNA *brna)
+{
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "SpaceImageOverlay", NULL);
+ RNA_def_struct_sdna(srna, "SpaceImage");
+ RNA_def_struct_nested(brna, srna, "SpaceImageEditor");
+ RNA_def_struct_path_func(srna, "rna_SpaceImageOverlay_path");
+ RNA_def_struct_ui_text(
+ srna, "Overlay Settings", "Settings for display of overlays in the UV/Image editor");
+
+ prop = RNA_def_property(srna, "show_overlays", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "overlay.flag", SI_OVERLAY_SHOW_OVERLAYS);
+ RNA_def_property_ui_text(prop, "Show Overlays", "Display overlays like UV Maps and Metadata");
}
static void rna_def_space_image(BlenderRNA *brna)
@@ -4640,7 +4702,16 @@ static void rna_def_space_image(BlenderRNA *brna)
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_ui_text(prop, "Show Mask Editor", "Show Mask editing related properties");
+ /* Overlays */
+ prop = RNA_def_property(srna, "overlay", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_struct_type(prop, "SpaceImageOverlay");
+ RNA_def_property_pointer_funcs(prop, "rna_SpaceImage_overlay_get", NULL, NULL, NULL);
+ RNA_def_property_ui_text(
+ prop, "Overlay Settings", "Settings for display of overlays in the UV/Image editor");
+
rna_def_space_image_uv(brna);
+ rna_def_space_image_overlay(brna);
/* mask */
rna_def_space_mask_info(srna, NC_SPACE | ND_SPACE_IMAGE, "rna_SpaceImageEditor_mask_set");
@@ -4660,13 +4731,13 @@ static void rna_def_space_sequencer(BlenderRNA *brna)
};
static const EnumPropertyItem proxy_render_size_items[] = {
- {SEQ_PROXY_RENDER_SIZE_NONE, "NONE", 0, "No display", ""},
- {SEQ_PROXY_RENDER_SIZE_SCENE, "SCENE", 0, "Scene render size", ""},
- {SEQ_PROXY_RENDER_SIZE_25, "PROXY_25", 0, "Proxy size 25%", ""},
- {SEQ_PROXY_RENDER_SIZE_50, "PROXY_50", 0, "Proxy size 50%", ""},
- {SEQ_PROXY_RENDER_SIZE_75, "PROXY_75", 0, "Proxy size 75%", ""},
- {SEQ_PROXY_RENDER_SIZE_100, "PROXY_100", 0, "Proxy size 100%", ""},
- {SEQ_PROXY_RENDER_SIZE_FULL, "FULL", 0, "No proxy, full render", ""},
+ {SEQ_RENDER_SIZE_NONE, "NONE", 0, "No display", ""},
+ {SEQ_RENDER_SIZE_SCENE, "SCENE", 0, "Scene render size", ""},
+ {SEQ_RENDER_SIZE_PROXY_25, "PROXY_25", 0, "Proxy size 25%", ""},
+ {SEQ_RENDER_SIZE_PROXY_50, "PROXY_50", 0, "Proxy size 50%", ""},
+ {SEQ_RENDER_SIZE_PROXY_75, "PROXY_75", 0, "Proxy size 75%", ""},
+ {SEQ_RENDER_SIZE_PROXY_100, "PROXY_100", 0, "Proxy size 100%", ""},
+ {SEQ_RENDER_SIZE_FULL, "FULL", 0, "No proxy, full render", ""},
{0, NULL, 0, NULL, NULL},
};
@@ -5575,13 +5646,13 @@ static void rna_def_fileselect_idfilter(BlenderRNA *brna)
ICON_IMAGE_DATA,
"Images & Sounds",
"Show images, movie clips, sounds and masks"},
- {FILTER_ID_CA | FILTER_ID_LA | FILTER_ID_LP | FILTER_ID_SPK | FILTER_ID_WO | FILTER_ID_WS,
+ {FILTER_ID_CA | FILTER_ID_LA | FILTER_ID_LP | FILTER_ID_SPK | FILTER_ID_WO,
"category_environment",
ICON_WORLD_DATA,
"Environment",
"Show worlds, lights, cameras and speakers"},
{FILTER_ID_BR | FILTER_ID_GD | FILTER_ID_PA | FILTER_ID_PAL | FILTER_ID_PC | FILTER_ID_TXT |
- FILTER_ID_VF | FILTER_ID_CF,
+ FILTER_ID_VF | FILTER_ID_CF | FILTER_ID_WS,
"category_misc",
ICON_GREASEPENCIL,
"Miscellaneous",
diff --git a/source/blender/makesrna/intern/rna_test.c b/source/blender/makesrna/intern/rna_test.c
index f7b9779279d..39c1623352d 100644
--- a/source/blender/makesrna/intern/rna_test.c
+++ b/source/blender/makesrna/intern/rna_test.c
@@ -73,9 +73,9 @@
\
static int rna_Test_##arr##_set_length(PointerRNA *ptr, int length) \
{ \
- if (length > max) \
+ if (length > max) { \
return 0; \
-\
+ } \
arr##_len = length; \
\
return 1; \
diff --git a/source/blender/makesrna/intern/rna_timeline.c b/source/blender/makesrna/intern/rna_timeline.c
index ed17a509fc2..c0bd9fd92a2 100644
--- a/source/blender/makesrna/intern/rna_timeline.c
+++ b/source/blender/makesrna/intern/rna_timeline.c
@@ -30,8 +30,21 @@
#ifdef RNA_RUNTIME
+# include "BKE_idprop.h"
# include "WM_api.h"
+static IDProperty *rna_TimelineMarker_idprops(PointerRNA *ptr, bool create)
+{
+ TimeMarker *marker = ptr->data;
+
+ if (create && marker->prop == NULL) {
+ IDPropertyTemplate val = {0};
+ marker->prop = IDP_New(IDP_GROUP, &val, "Marker ID properties");
+ }
+
+ return marker->prop;
+}
+
static void rna_TimelineMarker_update(Main *UNUSED(bmain),
Scene *UNUSED(scene),
PointerRNA *UNUSED(ptr))
@@ -50,6 +63,7 @@ static void rna_def_timeline_marker(BlenderRNA *brna)
srna = RNA_def_struct(brna, "TimelineMarker", NULL);
RNA_def_struct_sdna(srna, "TimeMarker");
RNA_def_struct_ui_text(srna, "Marker", "Marker for noting points in the timeline");
+ RNA_def_struct_idprops_func(srna, "rna_TimelineMarker_idprops");
/* String values */
prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
diff --git a/source/blender/makesrna/intern/rna_tracking.c b/source/blender/makesrna/intern/rna_tracking.c
index b8500264e12..6d90a76a2c0 100644
--- a/source/blender/makesrna/intern/rna_tracking.c
+++ b/source/blender/makesrna/intern/rna_tracking.c
@@ -1148,6 +1148,7 @@ static void rna_def_trackingCamera(BlenderRNA *brna)
"Division distortion model which "
"better represents wide-angle cameras"},
{TRACKING_DISTORTION_MODEL_NUKE, "NUKE", 0, "Nuke", "Nuke distortion model"},
+ {TRACKING_DISTORTION_MODEL_BROWN, "BROWN", 0, "Brown", "Brown-Conrady distortion model"},
{0, NULL, 0, NULL, NULL},
};
@@ -1247,7 +1248,7 @@ static void rna_def_trackingCamera(BlenderRNA *brna)
prop = RNA_def_property(srna, "division_k2", PROP_FLOAT, PROP_NONE);
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_ui_range(prop, -10, 10, 0.1, 3);
- RNA_def_property_ui_text(prop, "K2", "First coefficient of second order division distortion");
+ RNA_def_property_ui_text(prop, "K2", "Second coefficient of second order division distortion");
RNA_def_property_update(prop, NC_MOVIECLIP | NA_EDITED, "rna_tracking_flushUpdate");
/* Nuke distortion parameters */
@@ -1263,6 +1264,49 @@ static void rna_def_trackingCamera(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "K2", "Second coefficient of second order Nuke distortion");
RNA_def_property_update(prop, NC_MOVIECLIP | NA_EDITED, "rna_tracking_flushUpdate");
+ /* Brown-Conrady distortion parameters */
+ prop = RNA_def_property(srna, "brown_k1", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_range(prop, -10, 10, 0.1, 3);
+ RNA_def_property_ui_text(
+ prop, "K1", "First coefficient of fourth order Brown-Conrady radial distortion");
+ RNA_def_property_update(prop, NC_MOVIECLIP | NA_EDITED, "rna_tracking_flushUpdate");
+
+ prop = RNA_def_property(srna, "brown_k2", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_range(prop, -10, 10, 0.1, 3);
+ RNA_def_property_ui_text(
+ prop, "K2", "Second coefficient of fourth order Brown-Conrady radial distortion");
+ RNA_def_property_update(prop, NC_MOVIECLIP | NA_EDITED, "rna_tracking_flushUpdate");
+
+ prop = RNA_def_property(srna, "brown_k3", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_range(prop, -10, 10, 0.1, 3);
+ RNA_def_property_ui_text(
+ prop, "K3", "Third coefficient of fourth order Brown-Conrady radial distortion");
+ RNA_def_property_update(prop, NC_MOVIECLIP | NA_EDITED, "rna_tracking_flushUpdate");
+
+ prop = RNA_def_property(srna, "brown_k4", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_range(prop, -10, 10, 0.1, 3);
+ RNA_def_property_ui_text(
+ prop, "K4", "Fourth coefficient of fourth order Brown-Conrady radial distortion");
+ RNA_def_property_update(prop, NC_MOVIECLIP | NA_EDITED, "rna_tracking_flushUpdate");
+
+ prop = RNA_def_property(srna, "brown_p1", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_range(prop, -10, 10, 0.1, 3);
+ RNA_def_property_ui_text(
+ prop, "P1", "First coefficient of second order Brown-Conrady tangential distortion");
+ RNA_def_property_update(prop, NC_MOVIECLIP | NA_EDITED, "rna_tracking_flushUpdate");
+
+ prop = RNA_def_property(srna, "brown_p2", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_range(prop, -10, 10, 0.1, 3);
+ RNA_def_property_ui_text(
+ prop, "P2", "Second coefficient of second order Brown-Conrady tangential distortion");
+ RNA_def_property_update(prop, NC_MOVIECLIP | NA_EDITED, "rna_tracking_flushUpdate");
+
/* pixel aspect */
prop = RNA_def_property(srna, "pixel_aspect", PROP_FLOAT, PROP_XYZ);
RNA_def_property_float_sdna(prop, NULL, "pixel_aspect");
diff --git a/source/blender/makesrna/intern/rna_ui.c b/source/blender/makesrna/intern/rna_ui.c
index 8ce6ab957b8..d637e011777 100644
--- a/source/blender/makesrna/intern/rna_ui.c
+++ b/source/blender/makesrna/intern/rna_ui.c
@@ -65,8 +65,6 @@ const EnumPropertyItem rna_enum_uilist_layout_type_items[] = {
#ifdef RNA_RUNTIME
-# include <assert.h>
-
# include "MEM_guardedalloc.h"
# include "RNA_access.h"
@@ -993,7 +991,7 @@ static void rna_Menu_bl_description_set(PointerRNA *ptr, const char *value)
BLI_strncpy(str, value, RNA_DYN_DESCR_MAX); /* utf8 already ensured */
}
else {
- assert(!"setting the bl_description on a non-builtin menu");
+ BLI_assert(!"setting the bl_description on a non-builtin menu");
}
}
diff --git a/source/blender/makesrna/intern/rna_ui_api.c b/source/blender/makesrna/intern/rna_ui_api.c
index 8dfa54b95da..47d9e3e146a 100644
--- a/source/blender/makesrna/intern/rna_ui_api.c
+++ b/source/blender/makesrna/intern/rna_ui_api.c
@@ -346,6 +346,15 @@ static PointerRNA rna_uiItemOMenuHold(uiLayout *layout,
return opptr;
}
+static void rna_uiItemsEnumO(uiLayout *layout,
+ const char *opname,
+ const char *propname,
+ const bool icon_only)
+{
+ int flag = icon_only ? UI_ITEM_R_ICON_ONLY : 0;
+ uiItemsFullEnumO(layout, opname, propname, NULL, uiLayoutGetOperatorContext(layout), flag);
+}
+
static void rna_uiItemMenuEnumO(uiLayout *layout,
bContext *C,
const char *opname,
@@ -548,7 +557,7 @@ static uiLayout *rna_uiLayoutColumnWithHeading(
static int rna_ui_get_rnaptr_icon(bContext *C, PointerRNA *ptr_icon)
{
- return UI_rnaptr_icon_get(C, ptr_icon, RNA_struct_ui_icon(ptr_icon->type), false);
+ return UI_icon_from_rnaptr(C, ptr_icon, RNA_struct_ui_icon(ptr_icon->type), false);
}
static const char *rna_ui_get_enum_name(bContext *C,
@@ -972,11 +981,12 @@ void RNA_api_ui_layout(StructRNA *srna)
"Item. Places a button into the layout to call an Operator");
}
- func = RNA_def_function(srna, "operator_enum", "uiItemsEnumO");
+ func = RNA_def_function(srna, "operator_enum", "rna_uiItemsEnumO");
parm = RNA_def_string(func, "operator", NULL, 0, "", "Identifier of the operator");
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
parm = RNA_def_string(func, "property", NULL, 0, "", "Identifier of property in operator");
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ RNA_def_boolean(func, "icon_only", false, "", "Draw only icons in buttons, no text");
func = RNA_def_function(srna, "operator_menu_enum", "rna_uiItemMenuEnumO");
RNA_def_function_flag(func, FUNC_USE_CONTEXT);
diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c
index 699e08302e7..8d36b7dc08f 100644
--- a/source/blender/makesrna/intern/rna_userdef.c
+++ b/source/blender/makesrna/intern/rna_userdef.c
@@ -188,7 +188,7 @@ static const EnumPropertyItem rna_enum_userdef_viewport_aa_items[] = {
# include "DEG_depsgraph.h"
-# include "GPU_extensions.h"
+# include "GPU_capabilities.h"
# include "GPU_select.h"
# include "GPU_texture.h"
@@ -364,8 +364,7 @@ static void rna_userdef_load_ui_update(Main *UNUSED(bmain), Scene *UNUSED(scene)
static void rna_userdef_anisotropic_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
- GPU_samplers_free();
- GPU_samplers_init();
+ GPU_samplers_update();
rna_userdef_update(bmain, scene, ptr);
}
@@ -583,8 +582,8 @@ static void rna_UserDef_weight_color_update(Main *bmain, Scene *scene, PointerRN
static void rna_UserDef_viewport_lights_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
- /* if all lights are off gpu_draw resets them all, [#27627]
- * so disallow them all to be disabled */
+ /* If all lights are off gpu_draw resets them all, see: T27627,
+ * so disallow them all to be disabled. */
if (U.light_param[0].flag == 0 && U.light_param[1].flag == 0 && U.light_param[2].flag == 0 &&
U.light_param[3].flag == 0) {
SolidLight *light = ptr->data;
@@ -1118,8 +1117,8 @@ static void rna_def_userdef_theme_ui_font_style(BlenderRNA *brna)
RNA_def_struct_ui_text(srna, "Font Style", "Theme settings for Font");
prop = RNA_def_property(srna, "points", PROP_INT, PROP_NONE);
- RNA_def_property_range(prop, 6, 48);
- RNA_def_property_ui_text(prop, "Points", "");
+ RNA_def_property_range(prop, 6, 24);
+ RNA_def_property_ui_text(prop, "Points", "Font size in points");
RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "font_kerning_style", PROP_ENUM, PROP_NONE);
@@ -1896,6 +1895,11 @@ static void rna_def_userdef_theme_spaces_vertex(StructRNA *srna)
RNA_def_property_ui_text(prop, "Vertex Select", "");
RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+ prop = RNA_def_property(srna, "vertex_active", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Active Vertex", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
prop = RNA_def_property(srna, "vertex_size", PROP_INT, PROP_PIXEL);
RNA_def_property_range(prop, 1, 32);
RNA_def_property_ui_text(prop, "Vertex Size", "");
@@ -2796,6 +2800,11 @@ static void rna_def_userdef_theme_space_node(BlenderRNA *brna)
rna_def_userdef_theme_spaces_main(srna);
rna_def_userdef_theme_spaces_list_main(srna);
+ prop = RNA_def_property(srna, "grid", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Grid", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
prop = RNA_def_property(srna, "node_selected", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "select");
RNA_def_property_array(prop, 3);
@@ -2953,7 +2962,7 @@ static void rna_def_userdef_theme_space_node(BlenderRNA *brna)
static void rna_def_userdef_theme_space_buts(BlenderRNA *brna)
{
StructRNA *srna;
- // PropertyRNA *prop;
+ PropertyRNA *prop;
/* space_buts */
@@ -2962,6 +2971,11 @@ static void rna_def_userdef_theme_space_buts(BlenderRNA *brna)
RNA_def_struct_clear_flag(srna, STRUCT_UNDO);
RNA_def_struct_ui_text(srna, "Theme Properties", "Theme settings for the Properties");
+ prop = RNA_def_property(srna, "match", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Search Match", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
rna_def_userdef_theme_spaces_main(srna);
}
@@ -2978,6 +2992,12 @@ static void rna_def_userdef_theme_space_image(BlenderRNA *brna)
RNA_def_struct_ui_text(srna, "Theme Image Editor", "Theme settings for the Image Editor");
rna_def_userdef_theme_spaces_main(srna);
+
+ prop = RNA_def_property(srna, "grid", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_array(prop, 4);
+ RNA_def_property_ui_text(prop, "Grid", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
rna_def_userdef_theme_spaces_vertex(srna);
rna_def_userdef_theme_spaces_face(srna);
@@ -3614,6 +3634,23 @@ static void rna_def_userdef_theme_colorset(BlenderRNA *brna)
RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
}
+static void rna_def_userdef_theme_collection_color(BlenderRNA *brna)
+{
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "ThemeCollectionColor", NULL);
+ RNA_def_struct_sdna(srna, "ThemeCollectionColor");
+ RNA_def_struct_clear_flag(srna, STRUCT_UNDO);
+ RNA_def_struct_ui_text(srna, "Theme Collection Color", "Theme settings for collection colors");
+
+ prop = RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "color");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Color", "Collection Color Tag");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+}
+
static void rna_def_userdef_theme_space_clip(BlenderRNA *brna)
{
StructRNA *srna;
@@ -3630,7 +3667,7 @@ static void rna_def_userdef_theme_space_clip(BlenderRNA *brna)
rna_def_userdef_theme_spaces_list_main(srna);
prop = RNA_def_property(srna, "grid", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_array(prop, 3);
+ RNA_def_property_array(prop, 4);
RNA_def_property_ui_text(prop, "Grid", "");
RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
@@ -3930,6 +3967,12 @@ static void rna_def_userdef_themes(BlenderRNA *brna)
RNA_def_property_collection_sdna(prop, NULL, "tarm", "");
RNA_def_property_struct_type(prop, "ThemeBoneColorSet");
RNA_def_property_ui_text(prop, "Bone Color Sets", "");
+
+ prop = RNA_def_property(srna, "collection_color", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_collection_sdna(prop, NULL, "collection_color", "");
+ RNA_def_property_struct_type(prop, "ThemeCollectionColor");
+ RNA_def_property_ui_text(prop, "Collection Color", "");
}
static void rna_def_userdef_addon(BlenderRNA *brna)
@@ -4171,6 +4214,7 @@ static void rna_def_userdef_dothemes(BlenderRNA *brna)
rna_def_userdef_theme_space_topbar(brna);
rna_def_userdef_theme_space_statusbar(brna);
rna_def_userdef_theme_colorset(brna);
+ rna_def_userdef_theme_collection_color(brna);
rna_def_userdef_themes(brna);
}
@@ -5740,8 +5784,10 @@ static void rna_def_userdef_input(BlenderRNA *brna)
prop = RNA_def_property(srna, "tablet_api", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_items(prop, tablet_api);
- RNA_def_property_ui_text(
- prop, "Tablet API", "Select the tablet API to use for pressure sensitivity");
+ RNA_def_property_ui_text(prop,
+ "Tablet API",
+ "Select the tablet API to use for pressure sensitivity (restart "
+ "Blender for changes to take effect)");
RNA_def_property_update(prop, 0, "rna_userdef_tablet_api_update");
# ifdef WITH_INPUT_NDOF
@@ -6118,6 +6164,20 @@ static void rna_def_userdef_experimental(BlenderRNA *brna)
prop = RNA_def_property(srna, "use_sculpt_vertex_colors", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "use_sculpt_vertex_colors", 1);
RNA_def_property_ui_text(prop, "Sculpt Vertex Colors", "Use the new Vertex Painting system");
+
+ prop = RNA_def_property(srna, "use_switch_object_operator", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "use_switch_object_operator", 1);
+ RNA_def_property_ui_text(
+ prop, "Switch Object Operator", "Enable the operator to switch objects by pressing D");
+
+ prop = RNA_def_property(srna, "use_image_editor_legacy_drawing", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "use_image_editor_legacy_drawing", 1);
+ RNA_def_property_ui_text(
+ prop, "Image Editor Legacy Drawing", "Use legacy UV/Image editor drawing");
+
+ prop = RNA_def_property(srna, "use_tools_missing_icons", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "use_tools_missing_icons", 1);
+ RNA_def_property_ui_text(prop, "Tools with Missing Icons", "Show tools with missing icons");
}
static void rna_def_userdef_addon_collection(BlenderRNA *brna, PropertyRNA *cprop)
diff --git a/source/blender/makesrna/intern/rna_volume.c b/source/blender/makesrna/intern/rna_volume.c
index b03d6082cea..7f3941e29b8 100644
--- a/source/blender/makesrna/intern/rna_volume.c
+++ b/source/blender/makesrna/intern/rna_volume.c
@@ -343,6 +343,14 @@ static void rna_def_volume_grids(BlenderRNA *brna, PropertyRNA *cprop)
func = RNA_def_function(srna, "unload", "BKE_volume_unload");
RNA_def_function_ui_description(func, "Unload all grid and voxel data from memory");
+
+ func = RNA_def_function(srna, "save", "BKE_volume_save");
+ RNA_def_function_ui_description(func, "Save grids and metadata to file");
+ RNA_def_function_flag(func, FUNC_USE_MAIN | FUNC_USE_REPORTS);
+ parm = RNA_def_string_file_path(func, "filepath", NULL, 0, "", "File path to save to");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_boolean(func, "success", 0, "", "True if grid list was successfully loaded");
+ RNA_def_function_return(func, parm);
}
static void rna_def_volume_display(BlenderRNA *brna)
@@ -395,6 +403,29 @@ static void rna_def_volume_display(BlenderRNA *brna)
{0, NULL, 0, NULL, NULL},
};
+ static const EnumPropertyItem interpolation_method_items[] = {
+ {VOLUME_DISPLAY_INTERP_LINEAR, "LINEAR", 0, "Linear", "Good smoothness and speed"},
+ {VOLUME_DISPLAY_INTERP_CUBIC,
+ "CUBIC",
+ 0,
+ "Cubic",
+ "Smoothed high quality interpolation, but slower"},
+ {VOLUME_DISPLAY_INTERP_CLOSEST, "CLOSEST", 0, "Closest", "No interpolation"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem axis_slice_position_items[] = {
+ {VOLUME_SLICE_AXIS_AUTO,
+ "AUTO",
+ 0,
+ "Auto",
+ "Adjust slice direction according to the view direction"},
+ {VOLUME_SLICE_AXIS_X, "X", 0, "X", "Slice along the X axis"},
+ {VOLUME_SLICE_AXIS_Y, "Y", 0, "Y", "Slice along the Y axis"},
+ {VOLUME_SLICE_AXIS_Z, "Z", 0, "Z", "Slice along the Z axis"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
prop = RNA_def_property(srna, "wireframe_type", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_items(prop, wireframe_type_items);
RNA_def_property_ui_text(prop, "Wireframe", "Type of wireframe display");
@@ -404,6 +435,27 @@ static void rna_def_volume_display(BlenderRNA *brna)
RNA_def_property_enum_items(prop, wireframe_detail_items);
RNA_def_property_ui_text(prop, "Wireframe Detail", "Amount of detail for wireframe display");
RNA_def_property_update(prop, 0, "rna_Volume_update_display");
+
+ prop = RNA_def_property(srna, "interpolation_method", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, interpolation_method_items);
+ RNA_def_property_ui_text(
+ prop, "Interpolation", "Interpolation method to use for volumes in solid mode");
+ RNA_def_property_update(prop, 0, "rna_Volume_update_display");
+
+ prop = RNA_def_property(srna, "use_slice", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "axis_slice_method", VOLUME_AXIS_SLICE_SINGLE);
+ RNA_def_property_ui_text(prop, "Slice", "Perform a single slice of the domain object");
+ RNA_def_property_update(prop, 0, "rna_Volume_update_display");
+
+ prop = RNA_def_property(srna, "slice_axis", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, axis_slice_position_items);
+ RNA_def_property_ui_text(prop, "Axis", "");
+
+ prop = RNA_def_property(srna, "slice_depth", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_range(prop, 0.0, 1.0);
+ RNA_def_property_ui_range(prop, 0.0, 1.0, 0.1, 3);
+ RNA_def_property_ui_text(prop, "Position", "Position of the slice");
+ RNA_def_property_update(prop, 0, "rna_Volume_update_display");
}
static void rna_def_volume_render(BlenderRNA *brna)
diff --git a/source/blender/makesrna/intern/rna_wm.c b/source/blender/makesrna/intern/rna_wm.c
index f248764eab9..f3438aaa835 100644
--- a/source/blender/makesrna/intern/rna_wm.c
+++ b/source/blender/makesrna/intern/rna_wm.c
@@ -512,8 +512,6 @@ const EnumPropertyItem rna_enum_wm_report_items[] = {
#ifdef RNA_RUNTIME
-# include <assert.h>
-
# include "BLI_string_utils.h"
# include "WM_api.h"
@@ -737,7 +735,8 @@ static void rna_Window_scene_update(bContext *C, PointerRNA *ptr)
BPy_END_ALLOW_THREADS;
# endif
- WM_event_add_notifier(C, NC_SCENE | ND_SCENEBROWSE, win->new_scene);
+ wmWindowManager *wm = CTX_wm_manager(C);
+ WM_event_add_notifier_ex(wm, win, NC_SCENE | ND_SCENEBROWSE, win->new_scene);
if (G.debug & G_DEBUG) {
printf("scene set %p\n", win->new_scene);
@@ -780,7 +779,8 @@ static void rna_Window_workspace_update(bContext *C, PointerRNA *ptr)
/* exception: can't set screens inside of area/region handlers,
* and must use context so notifier gets to the right window */
if (new_workspace) {
- WM_event_add_notifier(C, NC_SCREEN | ND_WORKSPACE_SET, new_workspace);
+ wmWindowManager *wm = CTX_wm_manager(C);
+ WM_event_add_notifier_ex(wm, win, NC_SCREEN | ND_WORKSPACE_SET, new_workspace);
win->workspace_hook->temp_workspace_store = NULL;
}
}
@@ -828,7 +828,8 @@ static void rna_workspace_screen_update(bContext *C, PointerRNA *ptr)
/* exception: can't set screens inside of area/region handlers,
* and must use context so notifier gets to the right window */
if (layout_new) {
- WM_event_add_notifier(C, NC_SCREEN | ND_LAYOUTBROWSE, layout_new);
+ wmWindowManager *wm = CTX_wm_manager(C);
+ WM_event_add_notifier_ex(wm, win, NC_SCREEN | ND_LAYOUTBROWSE, layout_new);
win->workspace_hook->temp_layout_store = NULL;
}
}
@@ -1485,9 +1486,7 @@ static StructRNA *rna_Operator_register(Main *bmain,
/* clear in case they are left unset */
temp_buffers.idname[0] = temp_buffers.name[0] = temp_buffers.description[0] =
- temp_buffers.undo_group[0] = '\0';
- /* We have to set default op context! */
- strcpy(temp_buffers.translation_context, BLT_I18NCONTEXT_OPERATOR_DEFAULT);
+ temp_buffers.undo_group[0] = temp_buffers.translation_context[0] = '\0';
/* validate the python class */
if (validate(&dummyotr, data, have_function) != 0) {
@@ -1513,6 +1512,11 @@ static StructRNA *rna_Operator_register(Main *bmain,
return NULL;
}
+ /* We have to set default context if the class doesn't define it. */
+ if (temp_buffers.translation_context[0] == '\0') {
+ STRNCPY(temp_buffers.translation_context, BLT_I18NCONTEXT_OPERATOR_DEFAULT);
+ }
+
/* Convert foo.bar to FOO_OT_bar
* allocate all strings at once. */
{
@@ -1535,7 +1539,7 @@ static StructRNA *rna_Operator_register(Main *bmain,
BLI_assert(ARRAY_SIZE(strings) == 5);
}
- /* XXX, this doubles up with the operator name [#29666]
+ /* XXX, this doubles up with the operator name T29666.
* for now just remove from dir(bpy.types) */
/* create a new operator type */
@@ -1636,9 +1640,7 @@ static StructRNA *rna_MacroOperator_register(Main *bmain,
/* clear in case they are left unset */
temp_buffers.idname[0] = temp_buffers.name[0] = temp_buffers.description[0] =
- temp_buffers.undo_group[0] = '\0';
- /* We have to set default op context! */
- strcpy(temp_buffers.translation_context, BLT_I18NCONTEXT_OPERATOR_DEFAULT);
+ temp_buffers.undo_group[0] = temp_buffers.translation_context[0] = '\0';
/* validate the python class */
if (validate(&dummyotr, data, have_function) != 0) {
@@ -1673,6 +1675,11 @@ static StructRNA *rna_MacroOperator_register(Main *bmain,
return NULL;
}
+ /* We have to set default context if the class doesn't define it. */
+ if (temp_buffers.translation_context[0] == '\0') {
+ STRNCPY(temp_buffers.translation_context, BLT_I18NCONTEXT_OPERATOR_DEFAULT);
+ }
+
/* Convert foo.bar to FOO_OT_bar
* allocate all strings at once. */
{
@@ -1695,7 +1702,7 @@ static StructRNA *rna_MacroOperator_register(Main *bmain,
BLI_assert(ARRAY_SIZE(strings) == 5);
}
- /* XXX, this doubles up with the operator name [#29666]
+ /* XXX, this doubles up with the operator name T29666.
* for now just remove from dir(bpy.types) */
/* create a new operator type */
@@ -1738,7 +1745,7 @@ static void rna_Operator_bl_idname_set(PointerRNA *ptr, const char *value)
BLI_strncpy(str, value, OP_MAX_TYPENAME); /* utf8 already ensured */
}
else {
- assert(!"setting the bl_idname on a non-builtin operator");
+ BLI_assert(!"setting the bl_idname on a non-builtin operator");
}
}
@@ -1750,7 +1757,7 @@ static void rna_Operator_bl_label_set(PointerRNA *ptr, const char *value)
BLI_strncpy(str, value, OP_MAX_TYPENAME); /* utf8 already ensured */
}
else {
- assert(!"setting the bl_label on a non-builtin operator");
+ BLI_assert(!"setting the bl_label on a non-builtin operator");
}
}
@@ -1762,7 +1769,7 @@ static void rna_Operator_bl_translation_context_set(PointerRNA *ptr, const char
BLI_strncpy(str, value, RNA_DYN_DESCR_MAX); /* utf8 already ensured */
}
else {
- assert(!"setting the bl_translation_context on a non-builtin operator");
+ BLI_assert(!"setting the bl_translation_context on a non-builtin operator");
}
}
@@ -1774,7 +1781,7 @@ static void rna_Operator_bl_description_set(PointerRNA *ptr, const char *value)
BLI_strncpy(str, value, RNA_DYN_DESCR_MAX); /* utf8 already ensured */
}
else {
- assert(!"setting the bl_description on a non-builtin operator");
+ BLI_assert(!"setting the bl_description on a non-builtin operator");
}
}
@@ -1786,7 +1793,7 @@ static void rna_Operator_bl_undo_group_set(PointerRNA *ptr, const char *value)
BLI_strncpy(str, value, OP_MAX_TYPENAME); /* utf8 already ensured */
}
else {
- assert(!"setting the bl_undo_group on a non-builtin operator");
+ BLI_assert(!"setting the bl_undo_group on a non-builtin operator");
}
}
diff --git a/source/blender/makesrna/intern/rna_wm_api.c b/source/blender/makesrna/intern/rna_wm_api.c
index ee7ff472c12..47d5e9b6313 100644
--- a/source/blender/makesrna/intern/rna_wm_api.c
+++ b/source/blender/makesrna/intern/rna_wm_api.c
@@ -261,7 +261,7 @@ static wmKeyMapItem *rna_KeyMap_item_new(wmKeyMap *km,
kmi->flag |= KMI_REPEAT_IGNORE;
}
- /* [#32437] allow scripts to define hotkeys that get added to start of keymap
+ /* T32437 allow scripts to define hotkeys that get added to start of keymap
* so that they stand a chance against catch-all defines later on
*/
if (head) {
@@ -558,6 +558,12 @@ static void rna_WindowManager_print_undo_steps(wmWindowManager *wm)
BKE_undosys_print(wm->undo_stack);
}
+static void rna_WindowManager_tag_script_reload(void)
+{
+ WM_script_tag_reload();
+ WM_main_add_notifier(NC_WINDOW, NULL);
+}
+
static PointerRNA rna_WindoManager_operator_properties_last(const char *idname)
{
wmOperatorType *ot = WM_operatortype_find(idname, true);
@@ -913,6 +919,12 @@ void RNA_api_wm(StructRNA *srna)
RNA_def_function(srna, "print_undo_steps", "rna_WindowManager_print_undo_steps");
+ /* Used by (#SCRIPT_OT_reload). */
+ func = RNA_def_function(srna, "tag_script_reload", "rna_WindowManager_tag_script_reload");
+ RNA_def_function_ui_description(
+ func, "Tag for refreshing the interface after scripts have been reloaded");
+ RNA_def_function_flag(func, FUNC_NO_SELF);
+
parm = RNA_def_property(srna, "is_interface_locked", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_ui_text(
parm,
diff --git a/source/blender/makesrna/intern/rna_wm_gizmo.c b/source/blender/makesrna/intern/rna_wm_gizmo.c
index 742d3da27ac..971991869e2 100644
--- a/source/blender/makesrna/intern/rna_wm_gizmo.c
+++ b/source/blender/makesrna/intern/rna_wm_gizmo.c
@@ -45,8 +45,6 @@
#ifdef RNA_RUNTIME
-# include <assert.h>
-
# include "BLI_string_utils.h"
# include "WM_api.h"
@@ -240,7 +238,7 @@ static void rna_Gizmo_bl_idname_set(PointerRNA *ptr, const char *value)
BLI_strncpy(str, value, MAX_NAME); /* utf8 already ensured */
}
else {
- assert(!"setting the bl_idname on a non-builtin operator");
+ BLI_assert(!"setting the bl_idname on a non-builtin operator");
}
}
@@ -398,7 +396,7 @@ RNA_GIZMO_GENERIC_FLAG_RW_DEF(flag_use_draw_hover, flag, WM_GIZMO_DRAW_HOVER);
RNA_GIZMO_GENERIC_FLAG_RW_DEF(flag_use_draw_modal, flag, WM_GIZMO_DRAW_MODAL);
RNA_GIZMO_GENERIC_FLAG_RW_DEF(flag_use_draw_value, flag, WM_GIZMO_DRAW_VALUE);
RNA_GIZMO_GENERIC_FLAG_RW_DEF(flag_use_draw_offset_scale, flag, WM_GIZMO_DRAW_OFFSET_SCALE);
-RNA_GIZMO_GENERIC_FLAG_NEG_RW_DEF(flag_use_draw_scale, flag, WM_GIZMO_DRAW_OFFSET_SCALE);
+RNA_GIZMO_GENERIC_FLAG_NEG_RW_DEF(flag_use_draw_scale, flag, WM_GIZMO_DRAW_NO_SCALE);
RNA_GIZMO_GENERIC_FLAG_RW_DEF(flag_hide, flag, WM_GIZMO_HIDDEN);
RNA_GIZMO_GENERIC_FLAG_RW_DEF(flag_hide_select, flag, WM_GIZMO_HIDDEN_SELECT);
RNA_GIZMO_GENERIC_FLAG_RW_DEF(flag_hide_keymap, flag, WM_GIZMO_HIDDEN_KEYMAP);
@@ -632,7 +630,7 @@ static void rna_GizmoGroup_bl_idname_set(PointerRNA *ptr, const char *value)
BLI_strncpy(str, value, MAX_NAME); /* utf8 already ensured */
}
else {
- assert(!"setting the bl_idname on a non-builtin operator");
+ BLI_assert(!"setting the bl_idname on a non-builtin operator");
}
}
@@ -644,7 +642,7 @@ static void rna_GizmoGroup_bl_label_set(PointerRNA *ptr, const char *value)
BLI_strncpy(str, value, MAX_NAME); /* utf8 already ensured */
}
else {
- assert(!"setting the bl_label on a non-builtin operator");
+ BLI_assert(!"setting the bl_label on a non-builtin operator");
}
}
diff --git a/source/blender/makesrna/rna_cleanup/rna_cleaner.py b/source/blender/makesrna/rna_cleanup/rna_cleaner.py
index a936e6499bc..eaeca562e47 100755
--- a/source/blender/makesrna/rna_cleanup/rna_cleaner.py
+++ b/source/blender/makesrna/rna_cleanup/rna_cleaner.py
@@ -277,7 +277,8 @@ def write_files(basename, props_list, props_length_max):
indent = '# '
else:
indent = ' '
- rna += indent + '("%s", "%s", "%s", "%s", "%s"),\n' % tuple(props[2:5] + props[6:]) # description is already string formatted
+ # Description is already string formatted.
+ rna += indent + '("%s", "%s", "%s", "%s", "%s"),\n' % tuple(props[2:5] + props[6:])
# py
blanks = [' ' * (x[0] - x[1]) for x in zip(props_length_max, list(map(len, props)))]
props = [('"%s"%s' if props[-1] != x[0] else "%s%s") % (x[0], x[1]) for x in zip(props, blanks)]
@@ -321,7 +322,7 @@ def main():
if __name__ == '__main__':
import sys
- if not sys.version.startswith("3"):
- print("Incorrect python version, use python 3!")
+ if sys.version_info.major < 3:
+ print("Incorrect python version, use Python 3 or newer!")
else:
main()
diff --git a/source/blender/makesrna/rna_cleanup/rna_cleaner_merge.py b/source/blender/makesrna/rna_cleanup/rna_cleaner_merge.py
index 236313f1f5c..8d1ec0b324b 100755
--- a/source/blender/makesrna/rna_cleanup/rna_cleaner_merge.py
+++ b/source/blender/makesrna/rna_cleanup/rna_cleaner_merge.py
@@ -56,7 +56,10 @@ def main():
if mod_from_dict:
file_path = sys.argv[-2][:-3] + "_lost.py"
write_work_file(file_path, list(mod_from_dict.values()))
- print("Warning '%s' contains lost %d items from module %s.py" % (file_path, len(mod_from_dict), mod_from.__name__))
+ print(
+ "Warning '%s' contains lost %d items from module %s.py" %
+ (file_path, len(mod_from_dict), mod_from.__name__)
+ )
if __name__ == "__main__":