diff options
author | Antonis Ryakiotakis <kalast@gmail.com> | 2022-02-07 21:37:15 +0300 |
---|---|---|
committer | Antonis Ryakiotakis <kalast@gmail.com> | 2022-02-07 21:37:15 +0300 |
commit | d8c05502272990173381bfd2590884bbc95aa5f5 (patch) | |
tree | 8bd65efacbe6484b838d4550597d0f4a54ddddd9 /source/blender/makesrna | |
parent | b64d551f3b2fa409b4eeefb641fc581eb6cd0bd6 (diff) | |
parent | fe1816f67fbc6aaf383ec77847d668367335d093 (diff) |
Merge branch 'master' into KTX_supportKTX_support
Diffstat (limited to 'source/blender/makesrna')
32 files changed, 695 insertions, 406 deletions
diff --git a/source/blender/makesrna/RNA_access.h b/source/blender/makesrna/RNA_access.h index 1ade964854d..47afa0f9a13 100644 --- a/source/blender/makesrna/RNA_access.h +++ b/source/blender/makesrna/RNA_access.h @@ -104,6 +104,8 @@ extern StructRNA RNA_BuildGpencilModifier; extern StructRNA RNA_BuildModifier; extern StructRNA RNA_ByteColorAttribute; extern StructRNA RNA_ByteColorAttributeValue; +extern StructRNA RNA_ByteIntAttribute; +extern StructRNA RNA_ByteIntAttributeValue; extern StructRNA RNA_CacheFile; extern StructRNA RNA_CacheFileLayer; extern StructRNA RNA_Camera; @@ -143,6 +145,7 @@ extern StructRNA RNA_CompositorNodeCombHSVA; extern StructRNA RNA_CompositorNodeCombRGBA; extern StructRNA RNA_CompositorNodeCombYCCA; extern StructRNA RNA_CompositorNodeCombYUVA; +extern StructRNA RNA_CompositorNodeCombineXYZ; extern StructRNA RNA_CompositorNodeComposite; extern StructRNA RNA_CompositorNodeCornerPin; extern StructRNA RNA_CompositorNodeCrop; @@ -187,6 +190,7 @@ extern StructRNA RNA_CompositorNodeRLayers; extern StructRNA RNA_CompositorNodeRotate; extern StructRNA RNA_CompositorNodeScale; extern StructRNA RNA_CompositorNodeSceneTime; +extern StructRNA RNA_CompositorNodeSeparateXYZ; extern StructRNA RNA_CompositorNodeSepHSVA; extern StructRNA RNA_CompositorNodeSepRGBA; extern StructRNA RNA_CompositorNodeSepYCCA; @@ -304,7 +308,7 @@ extern StructRNA RNA_GizmoProperties; extern StructRNA RNA_GlowSequence; extern StructRNA RNA_GpencilModifier; extern StructRNA RNA_GreasePencil; -extern StructRNA RNA_Hair; +extern StructRNA RNA_Curves; extern StructRNA RNA_Header; extern StructRNA RNA_Histogram; extern StructRNA RNA_HookGpencilModifier; @@ -1512,10 +1516,21 @@ void RNA_collection_clear(PointerRNA *ptr, const char *name); /** * Check if the #IDproperty exists, for operators. + * + * \param use_ghost: Internally an #IDProperty may exist, + * without the RNA considering it to be "set", see #IDP_FLAG_GHOST. + * This is used for operators, where executing an operator that has run previously + * will re-use the last value (unless #PROP_SKIP_SAVE property is set). + * In this case, the presence of the an existing value shouldn't prevent it being initialized + * from the context. Even though the this value will be returned if it's requested, + * it's not considered to be set (as it would if the menu item or key-map defined it's value). + * Set `use_ghost` to true for default behavior, otherwise false to check if there is a value + * exists internally and would be returned on request. */ bool RNA_property_is_set_ex(PointerRNA *ptr, PropertyRNA *prop, bool use_ghost); bool RNA_property_is_set(PointerRNA *ptr, PropertyRNA *prop); void RNA_property_unset(PointerRNA *ptr, PropertyRNA *prop); +/** See #RNA_property_is_set_ex documentation. */ bool RNA_struct_property_is_set_ex(PointerRNA *ptr, const char *identifier, bool use_ghost); bool RNA_struct_property_is_set(PointerRNA *ptr, const char *identifier); bool RNA_property_is_idprop(const PropertyRNA *prop); diff --git a/source/blender/makesrna/RNA_types.h b/source/blender/makesrna/RNA_types.h index c5581c01921..e37eb9f7188 100644 --- a/source/blender/makesrna/RNA_types.h +++ b/source/blender/makesrna/RNA_types.h @@ -322,7 +322,7 @@ typedef enum PropertyFlag { * FREE FLAGS: 2, 3, 4, 5, 6, 7, 8, 9, 12 and above. */ typedef enum PropertyOverrideFlag { - /** Means the property can be overridden by a local 'proxy' of some linked datablock. */ + /** Means that the property can be overridden by a local override of some linked datablock. */ PROPOVERRIDE_OVERRIDABLE_LIBRARY = (1 << 0), /** diff --git a/source/blender/makesrna/intern/CMakeLists.txt b/source/blender/makesrna/intern/CMakeLists.txt index ab141f01b13..71ada76fb76 100644 --- a/source/blender/makesrna/intern/CMakeLists.txt +++ b/source/blender/makesrna/intern/CMakeLists.txt @@ -70,6 +70,7 @@ set(DEFSRC rna_packedfile.c rna_palette.c rna_particle.c + rna_pointcloud.c rna_pose.c rna_render.c rna_rigidbody.c @@ -100,11 +101,9 @@ set(DEFSRC if(WITH_EXPERIMENTAL_FEATURES) add_definitions(-DWITH_SIMULATION_DATABLOCK) - add_definitions(-DWITH_POINT_CLOUD) - add_definitions(-DWITH_HAIR_NODES) + add_definitions(-DWITH_NEW_CURVES_TYPE) list(APPEND DEFSRC - rna_hair.c - rna_pointcloud.c + rna_curves.c rna_simulation.c ) endif() diff --git a/source/blender/makesrna/intern/makesrna.c b/source/blender/makesrna/intern/makesrna.c index a6732ca1760..0fadbda5a18 100644 --- a/source/blender/makesrna/intern/makesrna.c +++ b/source/blender/makesrna/intern/makesrna.c @@ -4376,8 +4376,8 @@ static RNAProcessItem PROCESS_ITEMS[] = { {"rna_dynamicpaint.c", NULL, RNA_def_dynamic_paint}, {"rna_fcurve.c", "rna_fcurve_api.c", RNA_def_fcurve}, {"rna_gpencil.c", NULL, RNA_def_gpencil}, -#ifdef WITH_HAIR_NODES - {"rna_hair.c", NULL, RNA_def_hair}, +#ifdef WITH_NEW_CURVES_TYPE + {"rna_curves.c", NULL, RNA_def_curves}, #endif {"rna_image.c", "rna_image_api.c", RNA_def_image}, {"rna_key.c", NULL, RNA_def_key}, @@ -4401,9 +4401,7 @@ static RNAProcessItem PROCESS_ITEMS[] = { {"rna_packedfile.c", NULL, RNA_def_packedfile}, {"rna_palette.c", NULL, RNA_def_palette}, {"rna_particle.c", NULL, RNA_def_particle}, -#ifdef WITH_POINT_CLOUD {"rna_pointcloud.c", NULL, RNA_def_pointcloud}, -#endif {"rna_pose.c", "rna_pose_api.c", RNA_def_pose}, {"rna_curveprofile.c", NULL, RNA_def_profile}, {"rna_lightprobe.c", NULL, RNA_def_lightprobe}, diff --git a/source/blender/makesrna/intern/rna_ID.c b/source/blender/makesrna/intern/rna_ID.c index b92123f445b..9bb78cb483d 100644 --- a/source/blender/makesrna/intern/rna_ID.c +++ b/source/blender/makesrna/intern/rna_ID.c @@ -76,7 +76,7 @@ const EnumPropertyItem rna_enum_id_type_items[] = { {ID_SPK, "SPEAKER", ICON_SPEAKER, "Speaker", ""}, {ID_TXT, "TEXT", ICON_TEXT, "Text", ""}, {ID_TE, "TEXTURE", ICON_TEXTURE_DATA, "Texture", ""}, - {ID_HA, "HAIR", ICON_HAIR_DATA, "Hair", ""}, + {ID_CV, "CURVES", ICON_CURVES_DATA, "Hair Curves", ""}, {ID_PT, "POINTCLOUD", ICON_POINTCLOUD_DATA, "Point Cloud", ""}, {ID_VO, "VOLUME", ICON_VOLUME_DATA, "Volume", ""}, {ID_WM, "WINDOWMANAGER", ICON_WINDOW, "Window Manager", ""}, @@ -151,7 +151,7 @@ const struct IDFilterEnumPropertyItem rna_enum_id_type_filter_items[] = { ICON_OUTLINER_COLLECTION, "Collections", "Show Collection data-blocks"}, - {FILTER_ID_HA, "filter_hair", ICON_HAIR_DATA, "Hairs", "Show/hide Hair data-blocks"}, + {FILTER_ID_CV, "filter_hair", ICON_CURVES_DATA, "Hairs", "Show/hide Hair data-blocks"}, {FILTER_ID_IM, "filter_image", ICON_IMAGE_DATA, "Images", "Show Image data-blocks"}, {FILTER_ID_LA, "filter_light", ICON_LIGHT_DATA, "Lights", "Show Light data-blocks"}, {FILTER_ID_LP, @@ -385,9 +385,9 @@ short RNA_type_to_ID_code(const StructRNA *type) if (base_type == &RNA_FreestyleLineStyle) { return ID_LS; } -# ifdef WITH_HAIR_NODES - if (base_type == &RNA_Hair) { - return ID_HA; +# ifdef WITH_NEW_CURVES_TYPE + if (base_type == &RNA_Curves) { + return ID_CV; } # endif if (base_type == &RNA_Lattice) { @@ -423,11 +423,9 @@ short RNA_type_to_ID_code(const StructRNA *type) if (base_type == &RNA_PaintCurve) { return ID_PC; } -# ifdef WITH_POINT_CLOUD if (base_type == &RNA_PointCloud) { return ID_PT; } -# endif if (base_type == &RNA_LightProbe) { return ID_LP; } @@ -494,9 +492,9 @@ StructRNA *ID_code_to_RNA_type(short idcode) return &RNA_GreasePencil; case ID_GR: return &RNA_Collection; - case ID_HA: -# ifdef WITH_HAIR_NODES - return &RNA_Hair; + case ID_CV: +# ifdef WITH_NEW_CURVES_TYPE + return &RNA_Curves; # else return &RNA_ID; # endif @@ -533,11 +531,7 @@ StructRNA *ID_code_to_RNA_type(short idcode) case ID_PC: return &RNA_PaintCurve; case ID_PT: -# ifdef WITH_POINT_CLOUD return &RNA_PointCloud; -# else - return &RNA_ID; -# endif case ID_LP: return &RNA_LightProbe; case ID_SCE: @@ -710,6 +704,7 @@ static ID *rna_ID_override_create(ID *id, Main *bmain, bool remap_local_usages) } WM_main_add_notifier(NC_ID | NA_ADDED, NULL); + WM_main_add_notifier(NC_WM | ND_LIB_OVERRIDE_CHANGED, NULL); return local_id; } @@ -724,9 +719,11 @@ static ID *rna_ID_override_hierarchy_create( BKE_main_id_tag_all(bmain, LIB_TAG_DOIT, false); ID *id_root_override = NULL; - BKE_lib_override_library_create(bmain, scene, view_layer, id, id_reference, &id_root_override); + BKE_lib_override_library_create( + bmain, scene, view_layer, NULL, id, id_reference, &id_root_override); WM_main_add_notifier(NC_ID | NA_ADDED, NULL); + WM_main_add_notifier(NC_WM | ND_LIB_OVERRIDE_CHANGED, NULL); return id_root_override; } @@ -747,6 +744,8 @@ static void rna_ID_override_template_create(ID *id, ReportList *reports) return; } BKE_lib_override_library_template_create(id); + + WM_main_add_notifier(NC_WM | ND_LIB_OVERRIDE_CHANGED, NULL); } static void rna_ID_override_library_operations_update(ID *id, @@ -760,6 +759,8 @@ static void rna_ID_override_library_operations_update(ID *id, } BKE_lib_override_library_operations_create(bmain, id); + + WM_main_add_notifier(NC_WM | ND_LIB_OVERRIDE_CHANGED, NULL); } static void rna_ID_override_library_reset(ID *id, @@ -779,6 +780,8 @@ static void rna_ID_override_library_reset(ID *id, else { BKE_lib_override_library_id_reset(bmain, id); } + + WM_main_add_notifier(NC_WM | ND_LIB_OVERRIDE_CHANGED, NULL); } static void rna_ID_override_library_destroy(ID *id, @@ -799,6 +802,8 @@ static void rna_ID_override_library_destroy(ID *id, BKE_libblock_remap(bmain, id, id->override_library->reference, ID_REMAP_SKIP_INDIRECT_USAGE); BKE_id_delete(bmain, id); } + + WM_main_add_notifier(NC_WM | ND_LIB_OVERRIDE_CHANGED, NULL); } static IDOverrideLibraryProperty *rna_ID_override_library_properties_add( @@ -812,6 +817,7 @@ static IDOverrideLibraryProperty *rna_ID_override_library_properties_add( BKE_report(reports, RPT_DEBUG, "No new override property created, property already exists"); } + WM_main_add_notifier(NC_WM | ND_LIB_OVERRIDE_CHANGED, NULL); return result; } @@ -825,6 +831,8 @@ static void rna_ID_override_library_properties_remove(IDOverrideLibrary *overrid } BKE_lib_override_library_property_delete(override_library, override_property); + + WM_main_add_notifier(NC_WM | ND_LIB_OVERRIDE_CHANGED, NULL); } static IDOverrideLibraryPropertyOperation *rna_ID_override_library_property_operations_add( @@ -851,6 +859,8 @@ static IDOverrideLibraryPropertyOperation *rna_ID_override_library_property_oper if (!created) { BKE_report(reports, RPT_DEBUG, "No new override operation created, operation already exists"); } + + WM_main_add_notifier(NC_WM | ND_LIB_OVERRIDE_CHANGED, NULL); return result; } @@ -865,6 +875,8 @@ static void rna_ID_override_library_property_operations_remove( } BKE_lib_override_library_property_operation_delete(override_property, override_operation); + + WM_main_add_notifier(NC_WM | ND_LIB_OVERRIDE_CHANGED, NULL); } static void rna_ID_update_tag(ID *id, Main *bmain, ReportList *reports, int flag) @@ -937,9 +949,9 @@ static void rna_ID_user_remap(ID *id, Main *bmain, ID *new_id) } } -static struct ID *rna_ID_make_local(struct ID *self, Main *bmain, bool clear_proxy) +static struct ID *rna_ID_make_local(struct ID *self, Main *bmain, bool UNUSED(clear_proxy)) { - BKE_lib_id_make_local(bmain, self, clear_proxy ? 0 : LIB_ID_MAKELOCAL_OBJECT_NO_PROXY_CLEARING); + BKE_lib_id_make_local(bmain, self, 0); ID *ret_id = self->newid ? self->newid : self; BKE_id_newptr_and_tag_clear(self); @@ -1753,6 +1765,7 @@ static void rna_def_ID_override_library_property(BlenderRNA *brna) "IDOverrideLibraryPropertyOperation", "Operations", "List of overriding operations for a property"); + RNA_def_property_update(prop, NC_WM | ND_LIB_OVERRIDE_CHANGED, NULL); rna_def_ID_override_library_property_operations(brna, prop); rna_def_ID_override_library_property_operation(brna); @@ -1805,8 +1818,9 @@ static void rna_def_ID_override_library(BlenderRNA *brna) RNA_def_struct_ui_text( srna, "ID Library Override", "Struct gathering all data needed by overridden linked IDs"); - RNA_def_pointer( + prop = RNA_def_pointer( srna, "reference", "ID", "Reference ID", "Linked ID used as reference by this override"); + RNA_def_property_update(prop, NC_WM | ND_LIB_OVERRIDE_CHANGED, NULL); prop = RNA_def_boolean(srna, "is_in_hierarchy", @@ -1814,6 +1828,7 @@ static void rna_def_ID_override_library(BlenderRNA *brna) "Is In Hierarchy", "Whether this library override is defined as part of a library " "hierarchy, or as a single, isolated and autonomous override"); + RNA_def_property_update(prop, NC_WM | ND_LIB_OVERRIDE_CHANGED, NULL); RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", IDOVERRIDE_LIBRARY_FLAG_NO_HIERARCHY); prop = RNA_def_collection(srna, @@ -1821,6 +1836,7 @@ static void rna_def_ID_override_library(BlenderRNA *brna) "IDOverrideLibraryProperty", "Properties", "List of overridden properties"); + RNA_def_property_update(prop, NC_WM | ND_LIB_OVERRIDE_CHANGED, NULL); rna_def_ID_override_library_properties(brna, prop); /* Update function. */ @@ -2073,13 +2089,7 @@ static void rna_def_ID(BlenderRNA *brna) "Make this datablock local, return local one " "(may be a copy of the original, in case it is also indirectly used)"); RNA_def_function_flag(func, FUNC_USE_MAIN); - parm = RNA_def_boolean( - func, - "clear_proxy", - true, - "", - "Whether to clear proxies (the default behavior, " - "note that if object has to be duplicated to be made local, proxies are always cleared)"); + parm = RNA_def_boolean(func, "clear_proxy", true, "", "Deprecated, has no effect"); parm = RNA_def_pointer(func, "id", "ID", "", "This ID, or the new ID if it was copied"); RNA_def_function_return(func, parm); diff --git a/source/blender/makesrna/intern/rna_action.c b/source/blender/makesrna/intern/rna_action.c index 6b134977c5a..f4236a860ab 100644 --- a/source/blender/makesrna/intern/rna_action.c +++ b/source/blender/makesrna/intern/rna_action.c @@ -625,11 +625,11 @@ static void rna_def_dopesheet(BlenderRNA *brna) RNA_def_property_ui_icon(prop, ICON_FILE, 0); RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL); - prop = RNA_def_property(srna, "show_hairs", PROP_BOOLEAN, PROP_NONE); + prop = RNA_def_property(srna, "show_hair_curves", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_negative_sdna(prop, NULL, "filterflag2", ADS_FILTER_NOHAIR); RNA_def_property_ui_text( prop, "Display Hair", "Include visualization of hair related animation data"); - RNA_def_property_ui_icon(prop, ICON_OUTLINER_OB_HAIR, 0); + RNA_def_property_ui_icon(prop, ICON_OUTLINER_OB_CURVES, 0); RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL); prop = RNA_def_property(srna, "show_pointclouds", PROP_BOOLEAN, PROP_NONE); diff --git a/source/blender/makesrna/intern/rna_armature.c b/source/blender/makesrna/intern/rna_armature.c index 28e50e80f32..b22d3654431 100644 --- a/source/blender/makesrna/intern/rna_armature.c +++ b/source/blender/makesrna/intern/rna_armature.c @@ -151,18 +151,9 @@ static void rna_Armature_edit_bone_remove(bArmature *arm, RNA_POINTER_INVALIDATE(ebone_ptr); } -static void rna_Armature_update_layers(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr) +static void rna_Armature_update_layers(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) { bArmature *arm = (bArmature *)ptr->owner_id; - Object *ob; - - /* proxy lib exception, store it here so we can restore layers on file - * load, since it would otherwise get lost due to being linked data */ - for (ob = bmain->objects.first; ob; ob = ob->id.next) { - if (ob->data == arm && ob->pose) { - ob->pose->proxy_layer = arm->layer; - } - } DEG_id_tag_update(&arm->id, ID_RECALC_COPY_ON_WRITE); WM_main_add_notifier(NC_GEOM | ND_DATA, arm); diff --git a/source/blender/makesrna/intern/rna_asset.c b/source/blender/makesrna/intern/rna_asset.c index e79cbc838d4..e80c8559020 100644 --- a/source/blender/makesrna/intern/rna_asset.c +++ b/source/blender/makesrna/intern/rna_asset.c @@ -237,7 +237,7 @@ static void rna_AssetMetaData_catalog_id_set(PointerRNA *ptr, const char *value) } if (!BLI_uuid_parse_string(&new_uuid, value)) { - // TODO(Sybren): raise ValueError exception once that's possible from an RNA setter. + /* TODO(@sybren): raise ValueError exception once that's possible from an RNA setter. */ printf("UUID %s not formatted correctly, ignoring new value\n", value); return; } diff --git a/source/blender/makesrna/intern/rna_attribute.c b/source/blender/makesrna/intern/rna_attribute.c index 35da353a043..dc0d00aaa77 100644 --- a/source/blender/makesrna/intern/rna_attribute.c +++ b/source/blender/makesrna/intern/rna_attribute.c @@ -26,8 +26,8 @@ #include "rna_internal.h" +#include "DNA_curves_types.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" @@ -46,6 +46,7 @@ const EnumPropertyItem rna_enum_attribute_type_items[] = { {CD_PROP_STRING, "STRING", 0, "String", "Text string"}, {CD_PROP_BOOL, "BOOLEAN", 0, "Boolean", "True or false"}, {CD_PROP_FLOAT2, "FLOAT2", 0, "2D Vector", "2D vector with floating-point values"}, + {CD_PROP_INT8, "INT8", 0, "8-Bit Integer", "Smaller integer with a range from -128 to 127"}, {0, NULL, 0, NULL, NULL}, }; @@ -59,6 +60,7 @@ const EnumPropertyItem rna_enum_attribute_type_with_auto_items[] = { {CD_PROP_STRING, "STRING", 0, "String", "Text string"}, {CD_PROP_BOOL, "BOOLEAN", 0, "Boolean", "True or false"}, {CD_PROP_FLOAT2, "FLOAT2", 0, "2D Vector", "2D vector with floating-point values"}, + {CD_PROP_INT8, "INT8", 0, "8-Bit Integer", "Smaller integer with a range from -128 to 127"}, {0, NULL, 0, NULL, NULL}, }; @@ -133,6 +135,8 @@ static StructRNA *srna_by_custom_data_layer_type(const CustomDataType type) return &RNA_BoolAttribute; case CD_PROP_FLOAT2: return &RNA_Float2Attribute; + case CD_PROP_INT8: + return &RNA_ByteIntAttribute; default: return NULL; } @@ -184,7 +188,7 @@ const EnumPropertyItem *rna_enum_attribute_domain_itemf(ID *id, 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)) { + if (id_type == ID_CV && !ELEM(domain_item->value, ATTR_DOMAIN_POINT, ATTR_DOMAIN_CURVE)) { continue; } if (id_type == ID_ME && ELEM(domain_item->value, ATTR_DOMAIN_CURVE)) { @@ -253,6 +257,9 @@ static void rna_Attribute_data_begin(CollectionPropertyIterator *iter, PointerRN case CD_PROP_FLOAT2: struct_size = sizeof(float[2]); break; + case CD_PROP_INT8: + struct_size = sizeof(int8_t); + break; default: struct_size = 0; length = 0; @@ -294,6 +301,28 @@ static void rna_ByteColorAttributeValue_color_set(PointerRNA *ptr, const float * linearrgb_to_srgb_uchar4(&mlcol->r, values); } +/* Int8 Attribute. */ + +static int rna_ByteIntAttributeValue_get(PointerRNA *ptr) +{ + int8_t *value = (int8_t *)ptr->data; + return (int)(*value); +} + +static void rna_ByteIntAttributeValue_set(PointerRNA *ptr, const int new_value) +{ + int8_t *value = (int8_t *)ptr->data; + if (new_value > INT8_MAX) { + *value = INT8_MAX; + } + else if (new_value < INT8_MIN) { + *value = INT8_MIN; + } + else { + *value = (int8_t)new_value; + } +} + /* Attribute Group */ static PointerRNA rna_AttributeGroup_new( @@ -648,6 +677,36 @@ static void rna_def_attribute_bool(BlenderRNA *brna) RNA_def_property_boolean_sdna(prop, NULL, "b", 0x01); } +static void rna_def_attribute_int8(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + + srna = RNA_def_struct(brna, "ByteIntAttribute", "Attribute"); + RNA_def_struct_sdna(srna, "CustomDataLayer"); + RNA_def_struct_ui_text(srna, "8-bit Int Attribute", "8-bit int geometry attribute"); + + prop = RNA_def_property(srna, "data", PROP_COLLECTION, PROP_NONE); + RNA_def_property_struct_type(prop, "ByteIntAttributeValue"); + 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, "ByteIntAttributeValue", NULL); + RNA_def_struct_sdna(srna, "MInt8Property"); + RNA_def_struct_ui_text( + srna, "8-bit Integer Attribute Value", "8-bit value in geometry attribute"); + prop = RNA_def_property(srna, "value", PROP_INT, PROP_NONE); + RNA_def_property_int_funcs( + prop, "rna_ByteIntAttributeValue_get", "rna_ByteIntAttributeValue_set", NULL); +} + static void rna_def_attribute_float2(BlenderRNA *brna) { StructRNA *srna; @@ -723,6 +782,7 @@ static void rna_def_attribute(BlenderRNA *brna) rna_def_attribute_string(brna); rna_def_attribute_bool(brna); rna_def_attribute_float2(brna); + rna_def_attribute_int8(brna); } /* Mesh/PointCloud/Hair.attributes */ diff --git a/source/blender/makesrna/intern/rna_constraint.c b/source/blender/makesrna/intern/rna_constraint.c index 0c993660f39..e3a06c44eee 100644 --- a/source/blender/makesrna/intern/rna_constraint.c +++ b/source/blender/makesrna/intern/rna_constraint.c @@ -3543,14 +3543,6 @@ void RNA_def_constraint(BlenderRNA *brna) RNA_def_property_boolean_sdna(prop, NULL, "flag", CONSTRAINT_ACTIVE); RNA_def_property_ui_text(prop, "Active", "Constraint is the one being edited"); - prop = RNA_def_property(srna, "is_proxy_local", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_clear_flag(prop, PROP_EDITABLE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", CONSTRAINT_PROXY_LOCAL); - RNA_def_property_ui_text( - prop, - "Proxy Local", - "Constraint was added in this proxy instance (i.e. did not belong to source Armature)"); - /* values */ prop = RNA_def_property(srna, "influence", PROP_FLOAT, PROP_FACTOR); RNA_def_property_float_sdna(prop, NULL, "enforce"); diff --git a/source/blender/makesrna/intern/rna_curves.c b/source/blender/makesrna/intern/rna_curves.c new file mode 100644 index 00000000000..faa067000bb --- /dev/null +++ b/source/blender/makesrna/intern/rna_curves.c @@ -0,0 +1,296 @@ +/* + * 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_define.h" +#include "RNA_enum_types.h" + +#include "rna_internal.h" + +#include "DNA_curves_types.h" + +#include "BLI_math_base.h" +#include "BLI_string.h" + +#ifdef RNA_RUNTIME + +# include "BLI_math_vector.h" + +# include "BKE_attribute.h" +# include "BKE_curves.h" + +# include "DEG_depsgraph.h" + +# include "WM_api.h" +# include "WM_types.h" + +static Curves *rna_curves(PointerRNA *ptr) +{ + return (Curves *)ptr->owner_id; +} + +static int rna_Curves_curve_offset_data_length(PointerRNA *ptr) +{ + const Curves *curves = rna_curves(ptr); + return curves->geometry.curve_size + 1; +} + +static void rna_Curves_curve_offset_data_begin(CollectionPropertyIterator *iter, PointerRNA *ptr) +{ + const Curves *curves = rna_curves(ptr); + rna_iterator_array_begin(iter, + (void *)curves->geometry.offsets, + sizeof(int), + curves->geometry.curve_size + 1, + false, + NULL); +} + +static int rna_CurvePoint_index_get(PointerRNA *ptr) +{ + const Curves *curves = rna_curves(ptr); + const float(*co)[3] = ptr->data; + return (int)(co - curves->geometry.position); +} + +static void rna_CurvePoint_location_get(PointerRNA *ptr, float value[3]) +{ + copy_v3_v3(value, (const float *)ptr->data); +} + +static void rna_CurvePoint_location_set(PointerRNA *ptr, const float value[3]) +{ + copy_v3_v3((float *)ptr->data, value); +} + +static float rna_CurvePoint_radius_get(PointerRNA *ptr) +{ + const Curves *curves = rna_curves(ptr); + if (curves->geometry.radius == NULL) { + return 0.0f; + } + const float(*co)[3] = ptr->data; + return curves->geometry.radius[co - curves->geometry.position]; +} + +static void rna_CurvePoint_radius_set(PointerRNA *ptr, float value) +{ + const Curves *curves = rna_curves(ptr); + if (curves->geometry.radius == NULL) { + return; + } + const float(*co)[3] = ptr->data; + curves->geometry.radius[co - curves->geometry.position] = value; +} + +static char *rna_CurvePoint_path(PointerRNA *ptr) +{ + return BLI_sprintfN("points[%d]", rna_CurvePoint_index_get(ptr)); +} + +static int rna_CurveSlice_index_get(PointerRNA *ptr) +{ + Curves *curves = rna_curves(ptr); + return (int)((int *)ptr->data - curves->geometry.offsets); +} + +static char *rna_CurveSlice_path(PointerRNA *ptr) +{ + return BLI_sprintfN("curves[%d]", rna_CurveSlice_index_get(ptr)); +} + +static void rna_CurveSlice_points_begin(CollectionPropertyIterator *iter, PointerRNA *ptr) +{ + Curves *curves = rna_curves(ptr); + const int *offset_ptr = (int *)ptr->data; + const int offset = *offset_ptr; + const int size = *(offset_ptr + 1) - offset; + float(*co)[3] = curves->geometry.position + *offset_ptr; + rna_iterator_array_begin(iter, co, sizeof(float[3]), size, 0, NULL); +} + +static int rna_CurveSlice_first_point_index_get(PointerRNA *ptr) +{ + const int *offset_ptr = (int *)ptr->data; + return *offset_ptr; +} + +static int rna_CurveSlice_points_length_get(PointerRNA *ptr) +{ + const int *offset_ptr = (int *)ptr->data; + const int offset = *offset_ptr; + return *(offset_ptr + 1) - offset; +} + +static void rna_Curves_update_data(struct Main *UNUSED(bmain), + struct 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); + } +} + +#else + +static void rna_def_curves_point(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + + srna = RNA_def_struct(brna, "CurvePoint", NULL); + RNA_def_struct_ui_text(srna, "Curve Point", "Curve curve control point"); + RNA_def_struct_path_func(srna, "rna_CurvePoint_path"); + + prop = RNA_def_property(srna, "position", PROP_FLOAT, PROP_TRANSLATION); + RNA_def_property_array(prop, 3); + RNA_def_property_float_funcs( + prop, "rna_CurvePoint_location_get", "rna_CurvePoint_location_set", NULL); + RNA_def_property_ui_text(prop, "Position", ""); + RNA_def_property_update(prop, 0, "rna_Curves_update_data"); + + prop = RNA_def_property(srna, "radius", PROP_FLOAT, PROP_DISTANCE); + RNA_def_property_float_funcs( + prop, "rna_CurvePoint_radius_get", "rna_CurvePoint_radius_set", NULL); + RNA_def_property_ui_text(prop, "Radius", ""); + RNA_def_property_update(prop, 0, "rna_Curves_update_data"); + + prop = RNA_def_property(srna, "index", PROP_INT, PROP_UNSIGNED); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_int_funcs(prop, "rna_CurvePoint_index_get", NULL, NULL); + RNA_def_property_ui_text(prop, "Index", "Index of this points"); +} + +static void rna_def_curves_curve(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + + srna = RNA_def_struct(brna, "CurveSlice", NULL); + RNA_def_struct_ui_text(srna, "Curve Slice", "A single curve from a curves data-block"); + RNA_def_struct_path_func(srna, "rna_CurveSlice_path"); + + prop = RNA_def_property(srna, "points", PROP_COLLECTION, PROP_NONE); + RNA_def_property_struct_type(prop, "CurvePoint"); + RNA_def_property_ui_text(prop, "Points", "Control points of the curve"); + RNA_def_property_collection_funcs(prop, + "rna_CurveSlice_points_begin", + "rna_iterator_array_next", + "rna_iterator_array_end", + "rna_iterator_array_get", + "rna_CurveSlice_points_length_get", + NULL, + NULL, + NULL); + + prop = RNA_def_property(srna, "first_point_index", PROP_INT, PROP_UNSIGNED); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_int_funcs(prop, "rna_CurveSlice_first_point_index_get", NULL, NULL); + RNA_def_property_ui_text( + prop, "First Point Index", "The index of this curve's first control point"); + + prop = RNA_def_property(srna, "points_length", PROP_INT, PROP_UNSIGNED); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_int_funcs(prop, "rna_CurveSlice_points_length_get", NULL, NULL); + RNA_def_property_ui_text(prop, "Number of Points", "Number of control points in the curve"); + + prop = RNA_def_property(srna, "index", PROP_INT, PROP_UNSIGNED); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_int_funcs(prop, "rna_CurveSlice_index_get", NULL, NULL); + RNA_def_property_ui_text(prop, "Index", "Index of this curve"); +} + +static void rna_def_curves(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + + srna = RNA_def_struct(brna, "Curves", "ID"); + RNA_def_struct_ui_text(srna, "Hair Curves", "Hair data-block for hair curves"); + RNA_def_struct_ui_icon(srna, ICON_CURVES_DATA); + + /* Point and Curve RNA API helpers. */ + + prop = RNA_def_property(srna, "curves", PROP_COLLECTION, PROP_NONE); + RNA_def_property_collection_sdna(prop, NULL, "geometry.offsets", "geometry.curve_size"); + RNA_def_property_struct_type(prop, "CurveSlice"); + RNA_def_property_ui_text(prop, "Curves", "All curves in the data-block"); + + /* TODO: better solution for (*co)[3] parsing issue. */ + + RNA_define_verify_sdna(0); + prop = RNA_def_property(srna, "points", PROP_COLLECTION, PROP_NONE); + RNA_def_property_collection_sdna(prop, NULL, "geometry.position", "geometry.point_size"); + RNA_def_property_struct_type(prop, "CurvePoint"); + RNA_def_property_ui_text(prop, "Points", "Control points of all curves"); + RNA_define_verify_sdna(1); + + /* Direct access to built-in attributes. */ + + RNA_define_verify_sdna(0); + prop = RNA_def_property(srna, "position_data", PROP_COLLECTION, PROP_NONE); + RNA_def_property_collection_sdna(prop, NULL, "geometry.position", "geometry.point_size"); + RNA_def_property_struct_type(prop, "FloatVectorAttributeValue"); + RNA_def_property_update(prop, 0, "rna_Curves_update_data"); + RNA_define_verify_sdna(1); + + prop = RNA_def_property(srna, "curve_offset_data", PROP_COLLECTION, PROP_NONE); + RNA_def_property_collection_sdna(prop, NULL, "geometry.offsets", NULL); + RNA_def_property_struct_type(prop, "IntAttributeValue"); + RNA_def_property_collection_funcs(prop, + "rna_Curves_curve_offset_data_begin", + "rna_iterator_array_next", + "rna_iterator_array_end", + "rna_iterator_array_get", + "rna_Curves_curve_offset_data_length", + NULL, + NULL, + NULL); + RNA_def_property_update(prop, 0, "rna_Curves_update_data"); + + /* materials */ + prop = RNA_def_property(srna, "materials", PROP_COLLECTION, PROP_NONE); + RNA_def_property_collection_sdna(prop, NULL, "mat", "totcol"); + RNA_def_property_struct_type(prop, "Material"); + RNA_def_property_ui_text(prop, "Materials", ""); + RNA_def_property_srna(prop, "IDMaterials"); /* see rna_ID.c */ + 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); +} + +void RNA_def_curves(BlenderRNA *brna) +{ + rna_def_curves_point(brna); + rna_def_curves_curve(brna); + rna_def_curves(brna); +} + +#endif diff --git a/source/blender/makesrna/intern/rna_gpencil.c b/source/blender/makesrna/intern/rna_gpencil.c index 3f380cd1830..7ef2f757cd8 100644 --- a/source/blender/makesrna/intern/rna_gpencil.c +++ b/source/blender/makesrna/intern/rna_gpencil.c @@ -2228,7 +2228,7 @@ static void rna_def_gpencil_layer(BlenderRNA *brna) prop = RNA_def_property(srna, "use_solo_mode", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_LAYER_SOLO_MODE); RNA_def_property_ui_text( - prop, "Solo Mode", "In Paint mode display only layers with keyframe in current frame"); + prop, "Solo Mode", "In Draw Mode only display layers with keyframe in current frame"); RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update"); /* Layer is used as Ruler. */ diff --git a/source/blender/makesrna/intern/rna_hair.c b/source/blender/makesrna/intern/rna_hair.c deleted file mode 100644 index 4ca66c6b583..00000000000 --- a/source/blender/makesrna/intern/rna_hair.c +++ /dev/null @@ -1,242 +0,0 @@ -/* - * 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_define.h" -#include "RNA_enum_types.h" - -#include "rna_internal.h" - -#include "DNA_hair_types.h" - -#include "BLI_math_base.h" -#include "BLI_string.h" - -#ifdef RNA_RUNTIME - -# include "BLI_math_vector.h" - -# include "BKE_attribute.h" -# include "BKE_hair.h" - -# include "DEG_depsgraph.h" - -# include "WM_api.h" -# include "WM_types.h" - -static Hair *rna_hair(PointerRNA *ptr) -{ - return (Hair *)ptr->owner_id; -} - -static int rna_HairPoint_index_get(PointerRNA *ptr) -{ - const Hair *hair = rna_hair(ptr); - const float(*co)[3] = ptr->data; - return (int)(co - hair->co); -} - -static void rna_HairPoint_location_get(PointerRNA *ptr, float value[3]) -{ - copy_v3_v3(value, (const float *)ptr->data); -} - -static void rna_HairPoint_location_set(PointerRNA *ptr, const float value[3]) -{ - copy_v3_v3((float *)ptr->data, value); -} - -static float rna_HairPoint_radius_get(PointerRNA *ptr) -{ - const Hair *hair = rna_hair(ptr); - if (hair->radius == NULL) { - return 0.0f; - } - const float(*co)[3] = ptr->data; - return hair->radius[co - hair->co]; -} - -static void rna_HairPoint_radius_set(PointerRNA *ptr, float value) -{ - const Hair *hair = rna_hair(ptr); - if (hair->radius == NULL) { - return; - } - const float(*co)[3] = ptr->data; - hair->radius[co - hair->co] = value; -} - -static char *rna_HairPoint_path(PointerRNA *ptr) -{ - return BLI_sprintfN("points[%d]", rna_HairPoint_index_get(ptr)); -} - -static int rna_HairCurve_index_get(PointerRNA *ptr) -{ - Hair *hair = rna_hair(ptr); - return (int)((HairCurve *)ptr->data - hair->curves); -} - -static char *rna_HairCurve_path(PointerRNA *ptr) -{ - return BLI_sprintfN("curves[%d]", rna_HairCurve_index_get(ptr)); -} - -static void rna_HairCurve_points_begin(CollectionPropertyIterator *iter, PointerRNA *ptr) -{ - Hair *hair = rna_hair(ptr); - HairCurve *curve = ptr->data; - float(*co)[3] = hair->co + curve->firstpoint; - rna_iterator_array_begin(iter, co, sizeof(float[3]), curve->numpoints, 0, NULL); -} - -static int rna_HairCurve_points_length(PointerRNA *ptr) -{ - HairCurve *curve = ptr->data; - return curve->numpoints; -} - -static void rna_Hair_update_data(struct Main *UNUSED(bmain), - struct 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); - } -} - -#else - -static void rna_def_hair_point(BlenderRNA *brna) -{ - StructRNA *srna; - PropertyRNA *prop; - - srna = RNA_def_struct(brna, "HairPoint", NULL); - RNA_def_struct_ui_text(srna, "Hair Point", "Hair curve control point"); - RNA_def_struct_path_func(srna, "rna_HairPoint_path"); - - prop = RNA_def_property(srna, "co", PROP_FLOAT, PROP_TRANSLATION); - RNA_def_property_array(prop, 3); - RNA_def_property_float_funcs( - prop, "rna_HairPoint_location_get", "rna_HairPoint_location_set", NULL); - RNA_def_property_ui_text(prop, "Location", ""); - RNA_def_property_update(prop, 0, "rna_Hair_update_data"); - - prop = RNA_def_property(srna, "radius", PROP_FLOAT, PROP_DISTANCE); - RNA_def_property_float_funcs(prop, "rna_HairPoint_radius_get", "rna_HairPoint_radius_set", NULL); - RNA_def_property_ui_text(prop, "Radius", ""); - RNA_def_property_update(prop, 0, "rna_Hair_update_data"); - - prop = RNA_def_property(srna, "index", PROP_INT, PROP_UNSIGNED); - RNA_def_property_clear_flag(prop, PROP_EDITABLE); - RNA_def_property_int_funcs(prop, "rna_HairPoint_index_get", NULL, NULL); - RNA_def_property_ui_text(prop, "Index", "Index of this points"); -} - -static void rna_def_hair_curve(BlenderRNA *brna) -{ - StructRNA *srna; - PropertyRNA *prop; - - srna = RNA_def_struct(brna, "HairCurve", NULL); - RNA_def_struct_ui_text(srna, "Hair Curve", "Hair curve"); - RNA_def_struct_path_func(srna, "rna_HairCurve_path"); - - prop = RNA_def_property(srna, "points", PROP_COLLECTION, PROP_NONE); - RNA_def_property_struct_type(prop, "HairPoint"); - RNA_def_property_ui_text(prop, "Points", "Control points of the curve"); - RNA_def_property_collection_funcs(prop, - "rna_HairCurve_points_begin", - "rna_iterator_array_next", - "rna_iterator_array_end", - "rna_iterator_array_get", - "rna_HairCurve_points_length", - NULL, - NULL, - NULL); - - /* TODO: naming consistency, editable? */ - prop = RNA_def_property(srna, "first_point_index", PROP_INT, PROP_UNSIGNED); - RNA_def_property_int_sdna(prop, NULL, "firstpoint"); - RNA_def_property_ui_text(prop, "First Point Index", "Index of the first loop of this polygon"); - - prop = RNA_def_property(srna, "num_points", PROP_INT, PROP_UNSIGNED); - RNA_def_property_int_sdna(prop, NULL, "numpoints"); - RNA_def_property_ui_text(prop, "Number of Points", "Number of loops used by this polygon"); - - prop = RNA_def_property(srna, "index", PROP_INT, PROP_UNSIGNED); - RNA_def_property_clear_flag(prop, PROP_EDITABLE); - RNA_def_property_int_funcs(prop, "rna_HairCurve_index_get", NULL, NULL); - RNA_def_property_ui_text(prop, "Index", "Index of this curve"); -} - -static void rna_def_hair(BlenderRNA *brna) -{ - StructRNA *srna; - PropertyRNA *prop; - - srna = RNA_def_struct(brna, "Hair", "ID"); - RNA_def_struct_ui_text(srna, "Hair", "Hair data-block for hair curves"); - RNA_def_struct_ui_icon(srna, ICON_HAIR_DATA); - - /* geometry */ - prop = RNA_def_property(srna, "curves", PROP_COLLECTION, PROP_NONE); - RNA_def_property_collection_sdna(prop, NULL, "curves", "totcurve"); - RNA_def_property_struct_type(prop, "HairCurve"); - RNA_def_property_ui_text(prop, "Curves", "All hair curves"); - - /* TODO: better solution for (*co)[3] parsing issue. */ - RNA_define_verify_sdna(0); - prop = RNA_def_property(srna, "points", PROP_COLLECTION, PROP_NONE); - RNA_def_property_collection_sdna(prop, NULL, "co", "totpoint"); - RNA_def_property_struct_type(prop, "HairPoint"); - RNA_def_property_ui_text(prop, "Points", "Control points of all hair curves"); - RNA_define_verify_sdna(1); - - /* materials */ - prop = RNA_def_property(srna, "materials", PROP_COLLECTION, PROP_NONE); - RNA_def_property_collection_sdna(prop, NULL, "mat", "totcol"); - RNA_def_property_struct_type(prop, "Material"); - RNA_def_property_ui_text(prop, "Materials", ""); - RNA_def_property_srna(prop, "IDMaterials"); /* see rna_ID.c */ - 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); -} - -void RNA_def_hair(BlenderRNA *brna) -{ - rna_def_hair_point(brna); - rna_def_hair_curve(brna); - rna_def_hair(brna); -} - -#endif diff --git a/source/blender/makesrna/intern/rna_image.c b/source/blender/makesrna/intern/rna_image.c index 0d86572357f..af13baad5a2 100644 --- a/source/blender/makesrna/intern/rna_image.c +++ b/source/blender/makesrna/intern/rna_image.c @@ -1107,7 +1107,7 @@ static void rna_def_image(BlenderRNA *brna) prop, "Duration", "Duration (in frames) of the image (1 when not a video/sequence)"); RNA_def_property_clear_flag(prop, PROP_EDITABLE); - /* NOTE about pixels/channels/is_float: + /* NOTE: About pixels/channels/is_float: * These properties describe how the image is stored internally (inside of ImBuf), * not how it was saved to disk or how it'll be saved on disk. */ diff --git a/source/blender/makesrna/intern/rna_internal.h b/source/blender/makesrna/intern/rna_internal.h index 95ad184c6b9..407f474ddab 100644 --- a/source/blender/makesrna/intern/rna_internal.h +++ b/source/blender/makesrna/intern/rna_internal.h @@ -170,7 +170,7 @@ void RNA_def_fcurve(struct BlenderRNA *brna); void RNA_def_gpencil(struct BlenderRNA *brna); void RNA_def_greasepencil_modifier(struct BlenderRNA *brna); void RNA_def_shader_fx(struct BlenderRNA *brna); -void RNA_def_hair(struct BlenderRNA *brna); +void RNA_def_curves(struct BlenderRNA *brna); void RNA_def_image(struct BlenderRNA *brna); void RNA_def_key(struct BlenderRNA *brna); void RNA_def_light(struct BlenderRNA *brna); @@ -369,6 +369,14 @@ void rna_ViewLayer_active_aov_index_range( PointerRNA *ptr, int *min, int *max, int *softmin, int *softmax); int rna_ViewLayer_active_aov_index_get(PointerRNA *ptr); void rna_ViewLayer_active_aov_index_set(PointerRNA *ptr, int value); +/** + * Set `r_rna_path` with the base view-layer path. + * `rna_path_buffer_size` should be at least `sizeof(ViewLayer.name) * 3`. + * \return actual length of the generated RNA path. + */ +size_t rna_ViewLayer_path_buffer_get(struct ViewLayer *view_layer, + char *r_rna_path, + const size_t rna_path_buffer_size); /* named internal so as not to conflict with obj.update() rna func */ void rna_Object_internal_update_data(struct Main *bmain, @@ -488,12 +496,10 @@ void RNA_def_main_cachefiles(BlenderRNA *brna, PropertyRNA *cprop); void RNA_def_main_paintcurves(BlenderRNA *brna, PropertyRNA *cprop); void RNA_def_main_workspaces(BlenderRNA *brna, PropertyRNA *cprop); void RNA_def_main_lightprobes(BlenderRNA *brna, PropertyRNA *cprop); -#ifdef WITH_HAIR_NODES -void RNA_def_main_hairs(BlenderRNA *brna, PropertyRNA *cprop); +#ifdef WITH_NEW_CURVES_TYPE +void RNA_def_main_hair_curves(BlenderRNA *brna, PropertyRNA *cprop); #endif -#ifdef WITH_POINT_CLOUD void RNA_def_main_pointclouds(BlenderRNA *brna, PropertyRNA *cprop); -#endif void RNA_def_main_volumes(BlenderRNA *brna, PropertyRNA *cprop); #ifdef WITH_SIMULATION_DATABLOCK void RNA_def_main_simulations(BlenderRNA *brna, PropertyRNA *cprop); diff --git a/source/blender/makesrna/intern/rna_layer.c b/source/blender/makesrna/intern/rna_layer.c index ab4cbc429ce..278d611cc41 100644 --- a/source/blender/makesrna/intern/rna_layer.c +++ b/source/blender/makesrna/intern/rna_layer.c @@ -53,6 +53,8 @@ # include "BKE_node.h" # include "BKE_scene.h" +# include "NOD_composite.h" + # include "BLI_listbase.h" # include "DEG_depsgraph_build.h" @@ -110,13 +112,24 @@ static void rna_LayerObjects_active_object_set(PointerRNA *ptr, } } +size_t rna_ViewLayer_path_buffer_get(ViewLayer *view_layer, + char *r_rna_path, + const size_t rna_path_buffer_size) +{ + char name_esc[sizeof(view_layer->name) * 2]; + BLI_str_escape(name_esc, view_layer->name, sizeof(name_esc)); + + return BLI_snprintf_rlen(r_rna_path, rna_path_buffer_size, "view_layers[\"%s\"]", name_esc); +} + static char *rna_ViewLayer_path(PointerRNA *ptr) { - ViewLayer *srl = (ViewLayer *)ptr->data; - char name_esc[sizeof(srl->name) * 2]; + ViewLayer *view_layer = (ViewLayer *)ptr->data; + char rna_path[sizeof(view_layer->name) * 3]; + + rna_ViewLayer_path_buffer_get(view_layer, rna_path, sizeof(rna_path)); - BLI_str_escape(name_esc, srl->name, sizeof(name_esc)); - return BLI_sprintfN("view_layers[\"%s\"]", name_esc); + return BLI_strdup(rna_path); } static IDProperty **rna_ViewLayer_idprops(PointerRNA *ptr) diff --git a/source/blender/makesrna/intern/rna_main.c b/source/blender/makesrna/intern/rna_main.c index a162aa26b78..230c04bfd9c 100644 --- a/source/blender/makesrna/intern/rna_main.c +++ b/source/blender/makesrna/intern/rna_main.c @@ -110,8 +110,8 @@ RNA_MAIN_LISTBASE_FUNCS_DEF(collections) RNA_MAIN_LISTBASE_FUNCS_DEF(curves) RNA_MAIN_LISTBASE_FUNCS_DEF(fonts) RNA_MAIN_LISTBASE_FUNCS_DEF(gpencils) -# ifdef WITH_HAIR_NODES -RNA_MAIN_LISTBASE_FUNCS_DEF(hairs) +# ifdef WITH_NEW_CURVES_TYPE +RNA_MAIN_LISTBASE_FUNCS_DEF(hair_curves) # endif RNA_MAIN_LISTBASE_FUNCS_DEF(images) RNA_MAIN_LISTBASE_FUNCS_DEF(lattices) @@ -129,9 +129,7 @@ RNA_MAIN_LISTBASE_FUNCS_DEF(objects) RNA_MAIN_LISTBASE_FUNCS_DEF(paintcurves) RNA_MAIN_LISTBASE_FUNCS_DEF(palettes) RNA_MAIN_LISTBASE_FUNCS_DEF(particles) -# ifdef WITH_POINT_CLOUD RNA_MAIN_LISTBASE_FUNCS_DEF(pointclouds) -# endif RNA_MAIN_LISTBASE_FUNCS_DEF(scenes) RNA_MAIN_LISTBASE_FUNCS_DEF(screens) RNA_MAIN_LISTBASE_FUNCS_DEF(shapekeys) @@ -391,17 +389,24 @@ void RNA_def_main(BlenderRNA *brna) "Light Probes", "Light Probe data-blocks", RNA_def_main_lightprobes}, -# ifdef WITH_HAIR_NODES - {"hairs", "Hair", "rna_Main_hairs_begin", "Hairs", "Hair data-blocks", RNA_def_main_hairs}, +# ifdef WITH_NEW_CURVES_TYPE + /** + * \note The name `hair_curves` is chosen to be different than `curves`, + * but they are generic curve data-blocks, not just for hair. + */ + {"hair_curves", + "Curves", + "rna_Main_hair_curves_begin", + "Hair Curves", + "Hair curve data-blocks", + RNA_def_main_hair_curves}, # endif -# ifdef WITH_POINT_CLOUD {"pointclouds", "PointCloud", "rna_Main_pointclouds_begin", "Point Clouds", "Point cloud data-blocks", RNA_def_main_pointclouds}, -# endif {"volumes", "Volume", "rna_Main_volumes_begin", diff --git a/source/blender/makesrna/intern/rna_main_api.c b/source/blender/makesrna/intern/rna_main_api.c index 0276c8a3f8a..f8d2d6524c2 100644 --- a/source/blender/makesrna/intern/rna_main_api.c +++ b/source/blender/makesrna/intern/rna_main_api.c @@ -46,9 +46,9 @@ # include "BKE_camera.h" # include "BKE_collection.h" # include "BKE_curve.h" +# include "BKE_curves.h" # include "BKE_displist.h" # include "BKE_gpencil.h" -# include "BKE_hair.h" # include "BKE_icons.h" # include "BKE_idtype.h" # include "BKE_image.h" @@ -86,8 +86,8 @@ # include "DNA_camera_types.h" # include "DNA_collection_types.h" # include "DNA_curve_types.h" +# include "DNA_curves_types.h" # include "DNA_gpencil_types.h" -# include "DNA_hair_types.h" # include "DNA_lattice_types.h" # include "DNA_light_types.h" # include "DNA_lightprobe_types.h" @@ -763,22 +763,21 @@ static bGPdata *rna_Main_gpencils_new(Main *bmain, const char *name) return gpd; } -# ifdef WITH_HAIR_NODES -static Hair *rna_Main_hairs_new(Main *bmain, const char *name) +# ifdef WITH_NEW_CURVES_TYPE +static Curves *rna_Main_hair_curves_new(Main *bmain, const char *name) { char safe_name[MAX_ID_NAME - 2]; rna_idname_validate(name, safe_name); - Hair *hair = BKE_hair_add(bmain, safe_name); - id_us_min(&hair->id); + Curves *curves = BKE_curves_add(bmain, safe_name); + id_us_min(&curves->id); WM_main_add_notifier(NC_ID | NA_ADDED, NULL); - return hair; + return curves; } # endif -# ifdef WITH_POINT_CLOUD static PointCloud *rna_Main_pointclouds_new(Main *bmain, const char *name) { char safe_name[MAX_ID_NAME - 2]; @@ -791,7 +790,6 @@ static PointCloud *rna_Main_pointclouds_new(Main *bmain, const char *name) return pointcloud; } -# endif static Volume *rna_Main_volumes_new(Main *bmain, const char *name) { @@ -863,12 +861,10 @@ RNA_MAIN_ID_TAG_FUNCS_DEF(cachefiles, cachefiles, ID_CF) RNA_MAIN_ID_TAG_FUNCS_DEF(paintcurves, paintcurves, ID_PC) RNA_MAIN_ID_TAG_FUNCS_DEF(workspaces, workspaces, ID_WS) RNA_MAIN_ID_TAG_FUNCS_DEF(lightprobes, lightprobes, ID_LP) -# ifdef WITH_HAIR_NODES -RNA_MAIN_ID_TAG_FUNCS_DEF(hairs, hairs, ID_HA) +# ifdef WITH_NEW_CURVES_TYPE +RNA_MAIN_ID_TAG_FUNCS_DEF(hair_curves, hair_curves, ID_CV) # endif -# ifdef WITH_POINT_CLOUD RNA_MAIN_ID_TAG_FUNCS_DEF(pointclouds, pointclouds, ID_PT) -# endif RNA_MAIN_ID_TAG_FUNCS_DEF(volumes, volumes, ID_VO) # ifdef WITH_SIMULATION_DATABLOCK RNA_MAIN_ID_TAG_FUNCS_DEF(simulations, simulations, ID_SIM) @@ -2273,53 +2269,52 @@ void RNA_def_main_lightprobes(BlenderRNA *brna, PropertyRNA *cprop) RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); } -# ifdef WITH_HAIR_NODES -void RNA_def_main_hairs(BlenderRNA *brna, PropertyRNA *cprop) +# ifdef WITH_NEW_CURVES_TYPE +void RNA_def_main_hair_curves(BlenderRNA *brna, PropertyRNA *cprop) { StructRNA *srna; FunctionRNA *func; PropertyRNA *parm; - RNA_def_property_srna(cprop, "BlendDataHairs"); - srna = RNA_def_struct(brna, "BlendDataHairs", NULL); + RNA_def_property_srna(cprop, "BlendDataHairCurves"); + srna = RNA_def_struct(brna, "BlendDataHairCurves", NULL); RNA_def_struct_sdna(srna, "Main"); - RNA_def_struct_ui_text(srna, "Main Hairs", "Collection of hairs"); + RNA_def_struct_ui_text(srna, "Main Hair Curves", "Collection of hair curves"); - func = RNA_def_function(srna, "new", "rna_Main_hairs_new"); + func = RNA_def_function(srna, "new", "rna_Main_hair_curves_new"); RNA_def_function_ui_description(func, "Add a new hair to the main database"); - parm = RNA_def_string(func, "name", "Hair", 0, "", "New name for the data-block"); + parm = RNA_def_string(func, "name", "Curves", 0, "", "New name for the data-block"); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); /* return type */ - parm = RNA_def_pointer(func, "hair", "Hair", "", "New hair data-block"); + parm = RNA_def_pointer(func, "curves", "Curves", "", "New curves data-block"); RNA_def_function_return(func, parm); func = RNA_def_function(srna, "remove", "rna_Main_ID_remove"); RNA_def_function_flag(func, FUNC_USE_REPORTS); - RNA_def_function_ui_description(func, "Remove a hair from the current blendfile"); - parm = RNA_def_pointer(func, "hair", "Hair", "", "Hair to remove"); + RNA_def_function_ui_description(func, "Remove a curves data-block from the current blendfile"); + parm = RNA_def_pointer(func, "curves", "Curves", "", "Curves data-block to remove"); RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR); RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0); RNA_def_boolean(func, "do_unlink", true, "", - "Unlink all usages of this hair before deleting it " - "(WARNING: will also delete objects instancing that hair data)"); + "Unlink all usages of this curves before deleting it " + "(WARNING: will also delete objects instancing that curves data)"); RNA_def_boolean(func, "do_id_user", true, "", - "Decrement user counter of all datablocks used by this hair data"); + "Decrement user counter of all datablocks used by this curves data"); RNA_def_boolean( - func, "do_ui_user", true, "", "Make sure interface does not reference this hair data"); + func, "do_ui_user", true, "", "Make sure interface does not reference this curves data"); - func = RNA_def_function(srna, "tag", "rna_Main_hairs_tag"); + func = RNA_def_function(srna, "tag", "rna_Main_hair_curves_tag"); parm = RNA_def_boolean(func, "value", 0, "Value", ""); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); } # endif -# ifdef WITH_POINT_CLOUD void RNA_def_main_pointclouds(BlenderRNA *brna, PropertyRNA *cprop) { StructRNA *srna; @@ -2366,7 +2361,6 @@ void RNA_def_main_pointclouds(BlenderRNA *brna, PropertyRNA *cprop) parm = RNA_def_boolean(func, "value", 0, "Value", ""); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); } -# endif void RNA_def_main_volumes(BlenderRNA *brna, PropertyRNA *cprop) { diff --git a/source/blender/makesrna/intern/rna_material.c b/source/blender/makesrna/intern/rna_material.c index 22a75c0d992..67943b290da 100644 --- a/source/blender/makesrna/intern/rna_material.c +++ b/source/blender/makesrna/intern/rna_material.c @@ -718,7 +718,7 @@ void RNA_def_material(BlenderRNA *brna) {MA_FLAT, "FLAT", ICON_MATPLANE, "Flat", "Flat XY plane"}, {MA_SPHERE, "SPHERE", ICON_MATSPHERE, "Sphere", "Sphere"}, {MA_CUBE, "CUBE", ICON_MATCUBE, "Cube", "Cube"}, - {MA_HAIR, "HAIR", ICON_HAIR, "Hair", "Hair strands"}, + {MA_HAIR, "HAIR", ICON_CURVES, "Hair", "Hair strands"}, {MA_SHADERBALL, "SHADERBALL", ICON_MATSHADERBALL, "Shader Ball", "Shader ball"}, {MA_CLOTH, "CLOTH", ICON_MATCLOTH, "Cloth", "Cloth"}, {MA_FLUID, "FLUID", ICON_MATFLUID, "Fluid", "Fluid"}, diff --git a/source/blender/makesrna/intern/rna_mesh.c b/source/blender/makesrna/intern/rna_mesh.c index b0acd30dc04..55b70fd1b41 100644 --- a/source/blender/makesrna/intern/rna_mesh.c +++ b/source/blender/makesrna/intern/rna_mesh.c @@ -3120,6 +3120,7 @@ static void rna_def_mesh(BlenderRNA *brna) prop = RNA_def_property(srna, "vertex_normals", PROP_COLLECTION, PROP_NONE); RNA_def_property_struct_type(prop, "MeshNormalValue"); + RNA_def_property_override_flag(prop, PROPOVERRIDE_IGNORE); RNA_def_property_ui_text(prop, "Vertex Normals", "The normal direction of each vertex, defined as the average of the " @@ -3136,6 +3137,7 @@ static void rna_def_mesh(BlenderRNA *brna) prop = RNA_def_property(srna, "polygon_normals", PROP_COLLECTION, PROP_NONE); RNA_def_property_struct_type(prop, "MeshNormalValue"); + RNA_def_property_override_flag(prop, PROPOVERRIDE_IGNORE); RNA_def_property_ui_text(prop, "Polygon Normals", "The normal direction of each polygon, defined by the winding order " @@ -3246,6 +3248,7 @@ static void rna_def_mesh(BlenderRNA *brna) NULL, NULL); RNA_def_property_struct_type(prop, "MeshVertColorLayer"); + RNA_def_property_override_flag(prop, PROPOVERRIDE_IGNORE); RNA_def_property_ui_text(prop, "Sculpt Vertex Colors", "All vertex colors"); rna_def_vert_colors(brna, prop); diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c index 4192a9975be..13c8444de1d 100644 --- a/source/blender/makesrna/intern/rna_nodetree.c +++ b/source/blender/makesrna/intern/rna_nodetree.c @@ -300,9 +300,33 @@ const EnumPropertyItem rna_enum_node_vec_math_items[] = { }; const EnumPropertyItem rna_enum_node_boolean_math_items[] = { - {NODE_BOOLEAN_MATH_AND, "AND", 0, "And", "Outputs true only when both inputs are true"}, - {NODE_BOOLEAN_MATH_OR, "OR", 0, "Or", "Outputs or when at least one of the inputs is true"}, - {NODE_BOOLEAN_MATH_NOT, "NOT", 0, "Not", "Outputs the opposite of the input"}, + {NODE_BOOLEAN_MATH_AND, "AND", 0, "And", "True when both inputs are true"}, + {NODE_BOOLEAN_MATH_OR, "OR", 0, "Or", "True when at least one input is true"}, + {NODE_BOOLEAN_MATH_NOT, "NOT", 0, "Not", "Opposite of the input"}, + {0, "", ICON_NONE, NULL, NULL}, + {NODE_BOOLEAN_MATH_NAND, "NAND", 0, "Not And", "True when at least one input is false"}, + {NODE_BOOLEAN_MATH_NOR, "NOR", 0, "Nor", "True when both inputs are false"}, + {NODE_BOOLEAN_MATH_XNOR, + "XNOR", + 0, + "Equal", + "True when both inputs are equal (exclusive nor)"}, + {NODE_BOOLEAN_MATH_XOR, + "XOR", + 0, + "Not Equal", + "True when both inputs are different (exclusive or)"}, + {0, "", ICON_NONE, NULL, NULL}, + {NODE_BOOLEAN_MATH_IMPLY, + "IMPLY", + 0, + "Imply", + "True unless the first input is true and the second is false"}, + {NODE_BOOLEAN_MATH_NIMPLY, + "NIMPLY", + 0, + "Subtract", + "True when the first input is true and the second is false (not imply)"}, {0, NULL, 0, NULL, NULL}, }; @@ -631,6 +655,7 @@ static const EnumPropertyItem rna_node_geometry_attribute_input_type_items_no_bo # include "NOD_geometry.h" # include "NOD_shader.h" # include "NOD_socket.h" +# include "NOD_texture.h" # include "RE_engine.h" # include "RE_pipeline.h" @@ -10499,7 +10524,7 @@ static void def_geo_object_info(StructRNA *srna) RNA_def_property_enum_items(prop, rna_node_geometry_object_info_transform_space_items); RNA_def_property_ui_text( prop, "Transform Space", "The transformation of the vector and geometry outputs"); - RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update"); + RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update_relations"); } static void def_geo_legacy_points_to_volume(StructRNA *srna) @@ -10583,7 +10608,7 @@ static void def_geo_collection_info(StructRNA *srna) prop = RNA_def_property(srna, "transform_space", PROP_ENUM, PROP_NONE); RNA_def_property_enum_items(prop, rna_node_geometry_collection_info_transform_space_items); RNA_def_property_ui_text(prop, "Transform Space", "The transformation of the geometry output"); - RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update"); + RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update_relations"); } static void def_geo_legacy_attribute_proximity(StructRNA *srna) @@ -11353,6 +11378,33 @@ static void def_geo_string_to_curves(StructRNA *srna) {0, NULL, 0, NULL, NULL}, }; + static const EnumPropertyItem rna_node_geometry_string_to_curves_pivot_mode[] = { + {GEO_NODE_STRING_TO_CURVES_PIVOT_MODE_MIDPOINT, "MIDPOINT", 0, "Midpoint", "Midpoint"}, + {GEO_NODE_STRING_TO_CURVES_PIVOT_MODE_TOP_LEFT, "TOP_LEFT", 0, "Top Left", "Top Left"}, + {GEO_NODE_STRING_TO_CURVES_PIVOT_MODE_TOP_CENTER, + "TOP_CENTER", + 0, + "Top Center", + "Top Center"}, + {GEO_NODE_STRING_TO_CURVES_PIVOT_MODE_TOP_RIGHT, "TOP_RIGHT", 0, "Top Right", "Top Right"}, + {GEO_NODE_STRING_TO_CURVES_PIVOT_MODE_BOTTOM_LEFT, + "BOTTOM_LEFT", + 0, + "Bottom Left", + "Bottom Left"}, + {GEO_NODE_STRING_TO_CURVES_PIVOT_MODE_BOTTOM_CENTER, + "BOTTOM_CENTER", + 0, + "Bottom Center", + "Bottom Center"}, + {GEO_NODE_STRING_TO_CURVES_PIVOT_MODE_BOTTOM_RIGHT, + "BOTTOM_RIGHT", + 0, + "Bottom Right", + "Bottom Right"}, + {0, NULL, 0, NULL, NULL}, + }; + PropertyRNA *prop; prop = RNA_def_property(srna, "font", PROP_POINTER, PROP_NONE); @@ -11385,6 +11437,13 @@ static void def_geo_string_to_curves(StructRNA *srna) RNA_def_property_enum_default(prop, GEO_NODE_STRING_TO_CURVES_ALIGN_Y_TOP_BASELINE); RNA_def_property_ui_text(prop, "Align Y", ""); RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update"); + + prop = RNA_def_property(srna, "pivot_mode", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "pivot_mode"); + RNA_def_property_enum_items(prop, rna_node_geometry_string_to_curves_pivot_mode); + RNA_def_property_enum_default(prop, GEO_NODE_STRING_TO_CURVES_PIVOT_MODE_BOTTOM_LEFT); + RNA_def_property_ui_text(prop, "Pivot Point", "Pivot point position relative to character"); + RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update"); } static void def_geo_separate_geometry(StructRNA *srna) diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c index 0cb132786cd..be37e574c9c 100644 --- a/source/blender/makesrna/intern/rna_object.c +++ b/source/blender/makesrna/intern/rna_object.c @@ -271,7 +271,7 @@ const EnumPropertyItem rna_enum_object_type_items[] = { OBTYPE_CU_SURF, {OB_MBALL, "META", ICON_OUTLINER_OB_META, "Metaball", ""}, OBTYPE_CU_FONT, - {OB_HAIR, "HAIR", ICON_OUTLINER_OB_HAIR, "Hair", ""}, + {OB_CURVES, "CURVES", ICON_OUTLINER_OB_CURVES, "Hair Curves", ""}, {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", ""}, @@ -613,18 +613,14 @@ static StructRNA *rna_Object_data_typef(PointerRNA *ptr) return &RNA_LightProbe; case OB_GPENCIL: return &RNA_GreasePencil; - case OB_HAIR: -# ifdef WITH_HAIR_NODES - return &RNA_Hair; + case OB_CURVES: +# ifdef WITH_NEW_CURVES_TYPE + return &RNA_Curves; # else return &RNA_ID; # endif case OB_POINTCLOUD: -# ifdef WITH_POINT_CLOUD return &RNA_PointCloud; -# else - return &RNA_ID; -# endif case OB_VOLUME: return &RNA_Volume; default: @@ -3154,19 +3150,6 @@ static void rna_def_object(BlenderRNA *brna) "Align to Vertex Normal is enabled)"); RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_internal_update"); - /* proxy */ - prop = RNA_def_property(srna, "proxy", PROP_POINTER, PROP_NONE); - RNA_def_property_override_flag(prop, PROPOVERRIDE_NO_COMPARISON); - RNA_def_property_override_clear_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); - RNA_def_property_ui_text(prop, "Proxy", "Library object this proxy object controls"); - - prop = RNA_def_property(srna, "proxy_collection", PROP_POINTER, PROP_NONE); - RNA_def_property_pointer_sdna(prop, NULL, "proxy_group"); - RNA_def_property_override_flag(prop, PROPOVERRIDE_NO_COMPARISON); - RNA_def_property_override_clear_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); - RNA_def_property_ui_text( - prop, "Proxy Collection", "Library collection duplicator object this proxy object controls"); - /* materials */ prop = RNA_def_property(srna, "material_slots", PROP_COLLECTION, PROP_NONE); RNA_def_property_struct_type(prop, "MaterialSlot"); diff --git a/source/blender/makesrna/intern/rna_object_api.c b/source/blender/makesrna/intern/rna_object_api.c index ec20fa54a44..dbf9b757728 100644 --- a/source/blender/makesrna/intern/rna_object_api.c +++ b/source/blender/makesrna/intern/rna_object_api.c @@ -68,6 +68,7 @@ static const EnumPropertyItem space_items[] = { # include "BKE_bvhutils.h" # include "BKE_constraint.h" # include "BKE_context.h" +# include "BKE_crazyspace.h" # include "BKE_customdata.h" # include "BKE_global.h" # include "BKE_layer.h" @@ -379,6 +380,39 @@ static void rna_Object_camera_fit_coords( depsgraph, (const float(*)[3])cos, num_cos / 3, ob, co_ret, scale_ret); } +static void rna_Object_crazyspace_eval(Object *object, + ReportList *reports, + Depsgraph *depsgraph, + Scene *scene) +{ + BKE_crazyspace_api_eval(depsgraph, scene, object, reports); +} + +static void rna_Object_crazyspace_displacement_to_deformed(Object *object, + ReportList *reports, + const int vertex_index, + float displacement[3], + float r_displacement_deformed[3]) +{ + BKE_crazyspace_api_displacement_to_deformed( + object, reports, vertex_index, displacement, r_displacement_deformed); +} + +static void rna_Object_crazyspace_displacement_to_original(Object *object, + ReportList *reports, + const int vertex_index, + float displacement_deformed[3], + float r_displacement[3]) +{ + BKE_crazyspace_api_displacement_to_original( + object, reports, vertex_index, displacement_deformed, r_displacement); +} + +static void rna_Object_crazyspace_eval_clear(Object *object) +{ + BKE_crazyspace_api_eval_clear(object); +} + /* copied from Mesh_getFromObject and adapted to RNA interface */ static Mesh *rna_Object_to_mesh(Object *object, ReportList *reports, @@ -978,6 +1012,52 @@ void RNA_api_object(StructRNA *srna) parm, "", "The ortho scale to aim to be able to see all given points (if relevant)"); RNA_def_parameter_flags(parm, 0, PARM_OUTPUT); + /* Crazy-space access. */ + + func = RNA_def_function(srna, "crazyspace_eval", "rna_Object_crazyspace_eval"); + RNA_def_function_ui_description( + func, + "Compute orientation mapping between vertices of an original object and object with shape " + "keys and deforming modifiers applied." + "The evaluation is to be freed with the crazyspace_eval_free function"); + RNA_def_function_flag(func, FUNC_USE_REPORTS); + parm = RNA_def_pointer( + func, "depsgraph", "Depsgraph", "Dependency Graph", "Evaluated dependency graph"); + RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); + parm = RNA_def_pointer(func, "scene", "Scene", "Scene", "Scene of the object"); + RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); + + func = RNA_def_function(srna, + "crazyspace_displacement_to_deformed", + "rna_Object_crazyspace_displacement_to_deformed"); + RNA_def_function_ui_description( + func, "Convert displacement vector from non-deformed object space to deformed object space"); + RNA_def_function_flag(func, FUNC_USE_REPORTS); + RNA_def_property(func, "vertex_index", PROP_INT, PROP_NONE); + RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); + parm = RNA_def_property(func, "displacement", PROP_FLOAT, PROP_XYZ); + RNA_def_property_array(parm, 3); + parm = RNA_def_property(func, "displacement_deformed", PROP_FLOAT, PROP_XYZ); + RNA_def_property_array(parm, 3); + RNA_def_function_output(func, parm); + + func = RNA_def_function(srna, + "crazyspace_displacement_to_original", + "rna_Object_crazyspace_displacement_to_original"); + RNA_def_function_ui_description( + func, "Convert displacement vector from deformed object space to non-deformed object space"); + RNA_def_function_flag(func, FUNC_USE_REPORTS); + RNA_def_property(func, "vertex_index", PROP_INT, PROP_NONE); + RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); + parm = RNA_def_property(func, "displacement", PROP_FLOAT, PROP_XYZ); + RNA_def_property_array(parm, 3); + parm = RNA_def_property(func, "displacement_original", PROP_FLOAT, PROP_XYZ); + RNA_def_property_array(parm, 3); + RNA_def_function_output(func, parm); + + RNA_def_function(srna, "crazyspace_eval_clear", "rna_Object_crazyspace_eval_clear"); + RNA_def_function_ui_description(func, "Free evaluated state of crazyspace"); + /* mesh */ func = RNA_def_function(srna, "to_mesh", "rna_Object_to_mesh"); RNA_def_function_ui_description( diff --git a/source/blender/makesrna/intern/rna_particle.c b/source/blender/makesrna/intern/rna_particle.c index fbc7625d815..23ec5148f00 100644 --- a/source/blender/makesrna/intern/rna_particle.c +++ b/source/blender/makesrna/intern/rna_particle.c @@ -249,7 +249,8 @@ static void rna_ParticleHairKey_location_object_get(PointerRNA *ptr, float *valu * * 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, +static int hair_key_index_get(const Object *object, + /*const*/ HairKey *hair_key, /*const*/ ParticleSystemModifierData *modifier, /*const*/ ParticleData *particle) { @@ -261,7 +262,7 @@ static int hair_key_index_get(/*const*/ HairKey *hair_key, const int particle_index = particle - particle_system->particles; const ParticleSystemModifierData *original_modifier = (ParticleSystemModifierData *) - BKE_modifier_get_original(&modifier->modifier); + BKE_modifier_get_original(object, &modifier->modifier); const ParticleSystem *original_particle_system = original_modifier->psys; const ParticleData *original_particle = &original_particle_system->particles[particle_index]; @@ -288,7 +289,7 @@ static void hair_key_location_object_set(HairKey *hair_key, NULL; if (hair_mesh != NULL) { - const int hair_key_index = hair_key_index_get(hair_key, modifier, particle); + const int hair_key_index = hair_key_index_get(object, hair_key, modifier, particle); if (hair_key_index == -1) { return; } @@ -368,7 +369,7 @@ static void rna_ParticleHairKey_co_object_set(ID *id, /* 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; + BKE_modifier_get_original(object, &modifier->modifier); orig_modifier->psys->flag |= PSYS_EDITED; hair_key_location_object_set(hair_key, object, modifier, particle, co); diff --git a/source/blender/makesrna/intern/rna_pose.c b/source/blender/makesrna/intern/rna_pose.c index 76bfea00a79..7714e4d1e59 100644 --- a/source/blender/makesrna/intern/rna_pose.c +++ b/source/blender/makesrna/intern/rna_pose.c @@ -140,7 +140,7 @@ static char *rna_PoseBone_path(PointerRNA *ptr) static bool rna_bone_group_poll(Object *ob, ReportList *reports) { - if ((ob->proxy != NULL) || (ob->proxy_group != NULL) || ID_IS_OVERRIDE_LIBRARY(ob)) { + if (ID_IS_OVERRIDE_LIBRARY(ob)) { BKE_report(reports, RPT_ERROR, "Cannot edit bone groups for proxies or library overrides"); return false; } @@ -717,7 +717,7 @@ static int rna_PoseChannel_proxy_editable(PointerRNA *ptr, const char **r_info) bArmature *arm = ob->data; bPoseChannel *pchan = (bPoseChannel *)ptr->data; - if (ob->proxy && pchan->bone && (pchan->bone->layer & arm->layer_protected)) { + if (false && pchan->bone && (pchan->bone->layer & arm->layer_protected)) { *r_info = "Can't edit property of a proxy on a protected layer"; return 0; } diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index d0e40af582c..3802f5ceaed 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -663,6 +663,8 @@ const EnumPropertyItem rna_enum_transform_orientation_items[] = { # include "BKE_screen.h" # include "BKE_unit.h" +# include "NOD_composite.h" + # include "ED_image.h" # include "ED_info.h" # include "ED_keyframing.h" @@ -1034,7 +1036,7 @@ static void rna_Scene_frame_update(Main *UNUSED(bmain), PointerRNA *ptr) { Scene *scene = (Scene *)ptr->owner_id; - DEG_id_tag_update(&scene->id, ID_RECALC_AUDIO_SEEK); + DEG_id_tag_update(&scene->id, ID_RECALC_FRAME_CHANGE); WM_main_add_notifier(NC_SCENE | ND_FRAME, scene); } @@ -1775,6 +1777,20 @@ void rna_ViewLayer_pass_update(Main *bmain, Scene *activescene, PointerRNA *ptr) rna_Scene_glsl_update(bmain, activescene, ptr); } +static char *rna_ViewLayerEEVEE_path(PointerRNA *ptr) +{ + ViewLayerEEVEE *view_layer_eevee = (ViewLayerEEVEE *)ptr->data; + ViewLayer *view_layer = (ViewLayer *)((uint8_t *)view_layer_eevee - offsetof(ViewLayer, eevee)); + char rna_path[sizeof(view_layer->name) * 3]; + + const size_t view_layer_path_len = rna_ViewLayer_path_buffer_get( + view_layer, rna_path, sizeof(rna_path)); + + BLI_strncpy(rna_path + view_layer_path_len, ".eevee", sizeof(rna_path) - view_layer_path_len); + + return BLI_strdup(rna_path); +} + static char *rna_SceneRenderView_path(PointerRNA *ptr) { SceneRenderView *srv = (SceneRenderView *)ptr->data; @@ -4025,6 +4041,7 @@ static void rna_def_view_layer_eevee(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; srna = RNA_def_struct(brna, "ViewLayerEEVEE", NULL); + RNA_def_struct_path_func(srna, "rna_ViewLayerEEVEE_path"); RNA_def_struct_ui_text(srna, "Eevee Settings", "View layer settings for Eevee"); prop = RNA_def_property(srna, "use_pass_volume_direct", PROP_BOOLEAN, PROP_NONE); diff --git a/source/blender/makesrna/intern/rna_sequencer.c b/source/blender/makesrna/intern/rna_sequencer.c index 6c3e3ab3058..9fee54ef38d 100644 --- a/source/blender/makesrna/intern/rna_sequencer.c +++ b/source/blender/makesrna/intern/rna_sequencer.c @@ -1456,6 +1456,12 @@ static void rna_def_strip_crop(BlenderRNA *brna) RNA_def_struct_path_func(srna, "rna_SequenceCrop_path"); } +static const EnumPropertyItem transform_filter_items[] = { + {SEQ_TRANSFORM_FILTER_NEAREST, "NEAREST", 0, "Nearest", ""}, + {SEQ_TRANSFORM_FILTER_BILINEAR, "BILINEAR", 0, "Bilinear", ""}, + {0, NULL, 0, NULL, NULL}, +}; + static void rna_def_strip_transform(BlenderRNA *brna) { StructRNA *srna; @@ -1502,6 +1508,13 @@ static void rna_def_strip_transform(BlenderRNA *brna) RNA_def_property_ui_range(prop, 0, 1, 1, 3); RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_SequenceTransform_update"); + prop = RNA_def_property(srna, "filter", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "filter"); + RNA_def_property_enum_items(prop, transform_filter_items); + RNA_def_property_enum_default(prop, SEQ_TRANSFORM_FILTER_BILINEAR); + RNA_def_property_ui_text(prop, "Filter", "Type of filter to use for image transformation"); + RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_SequenceTransform_update"); + RNA_def_struct_path_func(srna, "rna_SequenceTransform_path"); } diff --git a/source/blender/makesrna/intern/rna_sequencer_api.c b/source/blender/makesrna/intern/rna_sequencer_api.c index 7989c316c4c..e2e2bc2d5e8 100644 --- a/source/blender/makesrna/intern/rna_sequencer_api.c +++ b/source/blender/makesrna/intern/rna_sequencer_api.c @@ -328,8 +328,7 @@ static Sequence *rna_Sequences_new_movie(ID *id, SEQ_add_load_data_init(&load_data, name, file, frame_start, channel); load_data.fit_method = fit_method; load_data.allow_invalid_file = true; - double start_offset = -1; - Sequence *seq = SEQ_add_movie_strip(bmain, scene, seqbase, &load_data, &start_offset); + Sequence *seq = SEQ_add_movie_strip(bmain, scene, seqbase, &load_data); DEG_relations_tag_update(bmain); DEG_id_tag_update(&scene->id, ID_RECALC_SEQUENCER_STRIPS); @@ -378,7 +377,7 @@ static Sequence *rna_Sequences_new_sound(ID *id, SeqLoadData load_data; SEQ_add_load_data_init(&load_data, name, file, frame_start, channel); load_data.allow_invalid_file = true; - Sequence *seq = SEQ_add_sound_strip(bmain, scene, seqbase, &load_data, 0.0f); + Sequence *seq = SEQ_add_sound_strip(bmain, scene, seqbase, &load_data); if (seq == NULL) { BKE_report(reports, RPT_ERROR, "Sequences.new_sound: unable to open sound file"); diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index 05c1a645823..07521d39256 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -1861,6 +1861,9 @@ static void rna_SpaceTextEditor_text_set(PointerRNA *ptr, SpaceText *st = (SpaceText *)(ptr->data); st->text = value.data; + if (st->text != NULL) { + id_us_ensure_real((ID *)st->text); + } ScrArea *area = rna_area_from_space(ptr); if (area) { @@ -2337,7 +2340,8 @@ static void seq_build_proxy(bContext *C, PointerRNA *ptr) seq->strip->proxy->build_size_flags |= SEQ_rendersize_to_proxysize(sseq->render_size); /* Build proxy. */ - SEQ_proxy_rebuild_context(pj->main, pj->depsgraph, pj->scene, seq, file_list, &pj->queue); + SEQ_proxy_rebuild_context( + pj->main, pj->depsgraph, pj->scene, seq, file_list, &pj->queue, true); } BLI_gset_free(file_list, MEM_freeN); @@ -3273,7 +3277,7 @@ static struct IDFilterEnumPropertyItem rna_enum_space_file_id_filter_categories[ ICON_OUTLINER_COLLECTION, "Objects & Collections", "Show objects and collections"}, - {FILTER_ID_AR | FILTER_ID_CU | FILTER_ID_LT | FILTER_ID_MB | FILTER_ID_ME | FILTER_ID_HA | + {FILTER_ID_AR | FILTER_ID_CU | FILTER_ID_LT | FILTER_ID_MB | FILTER_ID_ME | FILTER_ID_CV | FILTER_ID_PT | FILTER_ID_VO, "category_geometry", ICON_NODETREE, @@ -4304,7 +4308,7 @@ static void rna_def_space_view3d_overlay(BlenderRNA *brna) prop = RNA_def_property(srna, "bone_wire_alpha", PROP_FLOAT, PROP_FACTOR); RNA_def_property_float_sdna(prop, NULL, "overlay.bone_wire_alpha"); RNA_def_property_ui_text( - prop, "Bone Wireframe Opacity", "Maximim opacity of bones in wireframe display mode"); + prop, "Bone Wireframe Opacity", "Maximum opacity of bones in wireframe display mode"); RNA_def_property_range(prop, 0.0f, FLT_MAX); RNA_def_property_ui_range(prop, 0.0f, 1.0f, 1, 2); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); @@ -5000,7 +5004,7 @@ static void rna_def_space_view3d(BlenderRNA *brna) {"Surface", (1 << OB_SURF), {"show_object_viewport_surf", "show_object_select_surf"}}, {"Meta", (1 << OB_MBALL), {"show_object_viewport_meta", "show_object_select_meta"}}, {"Font", (1 << OB_FONT), {"show_object_viewport_font", "show_object_select_font"}}, - {"Hair", (1 << OB_HAIR), {"show_object_viewport_hair", "show_object_select_hair"}}, + {"Hair", (1 << OB_CURVES), {"show_object_viewport_hair", "show_object_select_hair"}}, {"Point Cloud", (1 << OB_POINTCLOUD), {"show_object_viewport_pointcloud", "show_object_select_pointcloud"}}, diff --git a/source/blender/makesrna/intern/rna_texture_api.c b/source/blender/makesrna/intern/rna_texture_api.c index 0920fe6679a..2a4cdaebcee 100644 --- a/source/blender/makesrna/intern/rna_texture_api.c +++ b/source/blender/makesrna/intern/rna_texture_api.c @@ -32,6 +32,7 @@ # include "BKE_context.h" # include "BKE_global.h" +# include "BLI_math.h" # include "DNA_scene_types.h" # include "IMB_imbuf.h" # include "IMB_imbuf_types.h" @@ -40,14 +41,12 @@ static void texture_evaluate(struct Tex *tex, float value[3], float r_color[4]) { - TexResult texres = {0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0, NULL}; + TexResult texres = {0.0f}; /* TODO(sergey): always use color management now. */ multitex_ext(tex, value, NULL, NULL, 1, &texres, 0, NULL, true, false); - r_color[0] = texres.tr; - r_color[1] = texres.tg; - r_color[2] = texres.tb; + copy_v3_v3(r_color, texres.trgba); r_color[3] = texres.tin; } diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c index 4379b4ebe1d..53af3f5bed5 100644 --- a/source/blender/makesrna/intern/rna_userdef.c +++ b/source/blender/makesrna/intern/rna_userdef.c @@ -5293,7 +5293,7 @@ static void rna_def_userdef_edit(BlenderRNA *brna) prop, "Duplicate GPencil", "Causes grease pencil data to be duplicated with the object"); prop = RNA_def_property(srna, "use_duplicate_hair", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "dupflag", USER_DUP_HAIR); + RNA_def_property_boolean_sdna(prop, NULL, "dupflag", USER_DUP_CURVES); RNA_def_property_ui_text( prop, "Duplicate Hair", "Causes hair data to be duplicated with the object"); @@ -6386,13 +6386,6 @@ static void rna_def_userdef_experimental(BlenderRNA *brna) "Enable library overrides automatic resync detection and process on file load. Disable when " "dealing with older .blend files that need manual Resync (Enforce) handling"); - prop = RNA_def_property(srna, "proxy_to_override_auto_conversion", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_negative_sdna(prop, NULL, "no_proxy_to_override_conversion", 1); - RNA_def_property_ui_text( - prop, - "Proxy to Override Auto Conversion", - "Enable automatic conversion of proxies to library overrides on file load"); - prop = RNA_def_property(srna, "use_new_point_cloud_type", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "use_new_point_cloud_type", 1); RNA_def_property_ui_text( @@ -6406,9 +6399,9 @@ static void rna_def_userdef_experimental(BlenderRNA *brna) "reduces execution time and memory usage)"); RNA_def_property_update(prop, 0, "rna_userdef_update"); - prop = RNA_def_property(srna, "use_new_hair_type", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "use_new_hair_type", 1); - RNA_def_property_ui_text(prop, "New Hair Type", "Enable the new hair type in the ui"); + prop = RNA_def_property(srna, "use_new_curves_type", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "use_new_curves_type", 1); + RNA_def_property_ui_text(prop, "New Curves Type", "Enable the new curves data type in the UI"); prop = RNA_def_property(srna, "use_cycles_debug", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "use_cycles_debug", 1); diff --git a/source/blender/makesrna/intern/rna_wm.c b/source/blender/makesrna/intern/rna_wm.c index c64a47fc2ab..178a50c4d29 100644 --- a/source/blender/makesrna/intern/rna_wm.c +++ b/source/blender/makesrna/intern/rna_wm.c @@ -2175,7 +2175,8 @@ static void rna_def_event(BlenderRNA *brna) RNA_def_property_ui_text( prop, "Mouse Previous Y Position", "The window relative vertical location of the mouse"); - prop = RNA_def_property(srna, "pressure", PROP_FLOAT, PROP_NONE); + prop = RNA_def_property(srna, "pressure", PROP_FLOAT, PROP_FACTOR); + RNA_def_property_float_default(prop, 1.0f); RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_float_funcs(prop, "rna_Event_pressure_get", NULL, NULL); RNA_def_property_ui_text( |