[Bf-blender-cvs] [6aa29549e88] master: Fix T103887: Line Art Vertex Weight Transfer to target group broken
Commit: 6aa29549e889679112fd55f8d4a867c860646387 Author: Philipp Oeser Date: Fri Jan 20 11:51:43 2023 +0100 Branches: master https://developer.blender.org/rB6aa29549e889679112fd55f8d4a867c860646387 Fix T103887: Line Art Vertex Weight Transfer to target group broken Caused by {rB841df831e89d} and {rB3558bb8eae75}. These commits moved flags from `eLineArtGPencilModifierFlags` to `eLineartMainFlags`, but later on in code, these were still evaluated from the modifiers `flags` (instead of `calculation_flags`). This resulted in a false condition (`match_output` was assumed true but it wasnt), leading to a wrong codepath taken. This is now corrected (`calculation_flags` need to be passed around for this as well). Maniphest Tasks: T103887 Differential Revision: https://developer.blender.org/D17062 === M source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c M source/blender/gpencil_modifiers/intern/lineart/MOD_lineart.h M source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.cc M source/blender/gpencil_modifiers/intern/lineart/lineart_ops.c === diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c b/source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c index 88c7ab9d96c..995dc268123 100644 --- a/source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c +++ b/source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c @@ -89,7 +89,8 @@ static void generate_strokes_actual( lmd->silhouette_selection, lmd->source_vertex_group, lmd->vgname, - lmd->flags); + lmd->flags, + lmd->calculation_flags); } static bool isModifierDisabled(GpencilModifierData *md) diff --git a/source/blender/gpencil_modifiers/intern/lineart/MOD_lineart.h b/source/blender/gpencil_modifiers/intern/lineart/MOD_lineart.h index 9cd88e2d523..8909e9c8ccb 100644 --- a/source/blender/gpencil_modifiers/intern/lineart/MOD_lineart.h +++ b/source/blender/gpencil_modifiers/intern/lineart/MOD_lineart.h @@ -923,7 +923,8 @@ void MOD_lineart_gpencil_generate(LineartCache *cache, uint8_t silhouette_mode, const char *source_vgname, const char *vgname, - int modifier_flags); + int modifier_flags, + int modifier_calculation_flags); /** * Length is in image space. diff --git a/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.cc b/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.cc index 4361ec0f86d..fe8621bb9fe 100644 --- a/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.cc +++ b/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.cc @@ -5156,7 +5156,8 @@ static void lineart_gpencil_generate(LineartCache *cache, uchar silhouette_mode, const char *source_vgname, const char *vgname, - int modifier_flags) + int modifier_flags, + int modifier_calculation_flags) { if (cache == nullptr) { if (G.debug_value == 4000) { @@ -5182,8 +5183,8 @@ static void lineart_gpencil_generate(LineartCache *cache, /* (!orig_col && !orig_ob) means the whole scene is selected. */ int enabled_types = cache->all_enabled_edge_types; - bool invert_input = modifier_flags & LRT_GPENCIL_INVERT_SOURCE_VGROUP; - bool match_output = modifier_flags & LRT_GPENCIL_MATCH_OUTPUT_VGROUP; + bool invert_input = modifier_calculation_flags & LRT_GPENCIL_INVERT_SOURCE_VGROUP; + bool match_output = modifier_calculation_flags & LRT_GPENCIL_MATCH_OUTPUT_VGROUP; bool inverse_silhouette = modifier_flags & LRT_GPENCIL_INVERT_SILHOUETTE_FILTER; LISTBASE_FOREACH (LineartEdgeChain *, ec, >chains) { @@ -5381,7 +5382,8 @@ void MOD_lineart_gpencil_generate(LineartCache *cache, uchar silhouette_mode, const char *source_vgname, const char *vgname, - int modifier_flags) + int modifier_flags, + int modifier_calculation_flags) { if (!gpl || !gpf || !ob) { @@ -5427,5 +5429,6 @@ void MOD_lineart_gpencil_generate(LineartCache *cache, silhouette_mode, source_vgname, vgname, - modifier_flags); + modifier_flags, + modifier_calculation_flags); } diff --git a/source/blender/gpencil_modifiers/intern/lineart/lineart_ops.c
[Bf-blender-cvs] [b5bb38400f6] master: Python API: Set defaults for Denoise Node
Commit: b5bb38400f6663563ab348857b95fe9b7e1d7d92 Author: Aaron Carlisle Date: Fri Jan 20 21:42:24 2023 -0500 Branches: master https://developer.blender.org/rBb5bb38400f6663563ab348857b95fe9b7e1d7d92 Python API: Set defaults for Denoise Node Fixes T103898 === M source/blender/makesrna/intern/rna_nodetree.c === diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c index eeb88be0fe2..e007457297e 100644 --- a/source/blender/makesrna/intern/rna_nodetree.c +++ b/source/blender/makesrna/intern/rna_nodetree.c @@ -9197,11 +9197,13 @@ static void def_cmp_denoise(StructRNA *srna) prop = RNA_def_property(srna, "use_hdr", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "hdr", 0); + RNA_def_property_boolean_default(prop, true); RNA_def_property_ui_text(prop, "HDR", "Process HDR images"); RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update"); prop = RNA_def_property(srna, "prefilter", PROP_ENUM, PROP_NONE); RNA_def_property_enum_items(prop, prefilter_items); + RNA_def_property_enum_default(prop, CMP_NODE_DENOISE_PREFILTER_ACCURATE); RNA_def_property_ui_text(prop, "", "Denoising prefilter"); RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update"); } ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org List details, subscription details or unsubscribe: https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [25864d3dfc6] master: Cleanup: Use ampersand instead of "and" for labels
Commit: 25864d3dfc6be77b9b0f3757a648b90620776091 Author: Aaron Carlisle Date: Mon Jan 9 00:19:26 2023 -0500 Branches: master https://developer.blender.org/rB25864d3dfc6be77b9b0f3757a648b90620776091 Cleanup: Use ampersand instead of "and" for labels UI guideline is use '&' for labels, use "and" for descriptions. === M source/blender/draw/intern/draw_color_management.cc M source/blender/makesrna/intern/rna_space.c === diff --git a/source/blender/draw/intern/draw_color_management.cc b/source/blender/draw/intern/draw_color_management.cc index eab86226be5..a5d73f93780 100644 --- a/source/blender/draw/intern/draw_color_management.cc +++ b/source/blender/draw/intern/draw_color_management.cc @@ -62,7 +62,7 @@ static eDRWColorManagementType drw_color_management_type_for_space_image(const S { Image *image = sima.image; - /* Use inverse logic as there isn't a setting for `Color And Alpha`. */ + /* Use inverse logic as there isn't a setting for `Color & Alpha`. */ const eSpaceImage_Flag display_channels_mode = static_cast(sima.flag); const bool display_color_channel = (display_channels_mode & (SI_SHOW_ALPHA | SI_SHOW_ZBUF)) == 0; diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index 15ed20ce354..a5f2f4a0892 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -371,7 +371,7 @@ static const EnumPropertyItem display_channels_items[] = { {SI_USE_ALPHA, "COLOR_ALPHA", ICON_IMAGE_RGB_ALPHA, - "Color and Alpha", + "Color & Alpha", "Display image with RGB colors and alpha transparency"}, {0, "COLOR", ICON_IMAGE_RGB, "Color", "Display image with RGB colors"}, {SI_SHOW_ALPHA, "ALPHA", ICON_IMAGE_ALPHA, "Alpha", "Display alpha transparency channel"}, @@ -5773,7 +5773,7 @@ static void rna_def_space_sequencer(BlenderRNA *brna) {SEQ_USE_ALPHA, "COLOR_ALPHA", ICON_IMAGE_RGB_ALPHA, - "Color and Alpha", + "Color & Alpha", "Display image with RGB colors and alpha transparency"}, {0, "COLOR", ICON_IMAGE_RGB, "Color", "Display image with RGB colors"}, {0, NULL, 0, NULL, NULL}, @@ -7363,7 +7363,7 @@ static void rna_def_space_node(BlenderRNA *brna) {SNODE_USE_ALPHA, "COLOR_ALPHA", ICON_IMAGE_RGB_ALPHA, - "Color and Alpha", + "Color & Alpha", "Display image with RGB colors and alpha transparency"}, {0, "COLOR", ICON_IMAGE_RGB, "Color", "Display image with RGB colors"}, {SNODE_SHOW_ALPHA, "ALPHA", ICON_IMAGE_ALPHA, "Alpha", "Display alpha transparency channel"}, ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org List details, subscription details or unsubscribe: https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [2ea47e0def6] master: Geometry Nodes: Use checkbox for exposed boolean sockets
Commit: 2ea47e0def6a1d572879cdfcc1af66f926a1e5cf Author: Hans Goudey Date: Fri Jan 20 17:36:07 2023 -0600 Branches: master https://developer.blender.org/rB2ea47e0def6a1d572879cdfcc1af66f926a1e5cf Geometry Nodes: Use checkbox for exposed boolean sockets This uses the changes from ef68a37e5d55e17adf4c to create IDProperties for exposed boolean sockets with a boolean type instead of an integer with a [0,1] range. Existing properties and values are converted automatically. For forward compatibility, the properties are switched to the integer type for saving. Otherwise older versions crash immediately when opening a newer file. The "Use Attribute" IDProperties aren't changed here, since that wouldn't have a visible benefit. Differential Revision: https://developer.blender.org/D12816 === M source/blender/blenkernel/BKE_idprop.hh M source/blender/blenkernel/intern/idprop_create.cc M source/blender/modifiers/intern/MOD_nodes.cc === diff --git a/source/blender/blenkernel/BKE_idprop.hh b/source/blender/blenkernel/BKE_idprop.hh index ce11a56ad5f..10110517402 100644 --- a/source/blender/blenkernel/BKE_idprop.hh +++ b/source/blender/blenkernel/BKE_idprop.hh @@ -32,6 +32,9 @@ class IDPropertyDeleter { } }; +/** \brief Allocate a new IDProperty of type IDP_BOOLEAN, set its name and value. */ +std::unique_ptr create_bool(StringRefNull prop_name, bool value); + /** \brief Allocate a new IDProperty of type IDP_INT, set its name and value. */ std::unique_ptr create(StringRefNull prop_name, int32_t value); diff --git a/source/blender/blenkernel/intern/idprop_create.cc b/source/blender/blenkernel/intern/idprop_create.cc index 8a6e5cdcc50..cac4f736c69 100644 --- a/source/blender/blenkernel/intern/idprop_create.cc +++ b/source/blender/blenkernel/intern/idprop_create.cc @@ -21,6 +21,15 @@ std::unique_ptr create(const StringRefNull prop_n return std::unique_ptr(property); } +std::unique_ptr create_bool(const StringRefNull prop_name, + bool value) +{ + IDPropertyTemplate prop_template{0}; + prop_template.i = value; + IDProperty *property = IDP_New(IDP_BOOLEAN, _template, prop_name.c_str()); + return std::unique_ptr(property); +} + std::unique_ptr create(const StringRefNull prop_name, float value) { IDPropertyTemplate prop_template{0}; diff --git a/source/blender/modifiers/intern/MOD_nodes.cc b/source/blender/modifiers/intern/MOD_nodes.cc index 1261cf56b26..9c63ee7ce15 100644 --- a/source/blender/modifiers/intern/MOD_nodes.cc +++ b/source/blender/modifiers/intern/MOD_nodes.cc @@ -496,10 +496,8 @@ id_property_create_from_socket(const bNodeSocket ) case SOCK_BOOLEAN: { const bNodeSocketValueBoolean *value = static_cast( socket.default_value); - auto property = bke::idprop::create(socket.identifier, int(value->value)); - IDPropertyUIDataInt *ui_data = (IDPropertyUIDataInt *)IDP_ui_data_ensure(property.get()); - ui_data->min = ui_data->soft_min = 0; - ui_data->max = ui_data->soft_max = 1; + auto property = bke::idprop::create_bool(socket.identifier, value->value); + IDPropertyUIDataBool *ui_data = (IDPropertyUIDataBool *)IDP_ui_data_ensure(property.get()); ui_data->default_value = value->value != 0; return property; } @@ -553,7 +551,7 @@ static bool id_property_type_matches_socket(const bNodeSocket , const IDP case SOCK_RGBA: return property.type == IDP_ARRAY && property.subtype == IDP_FLOAT && property.len == 4; case SOCK_BOOLEAN: - return property.type == IDP_INT; + return property.type == IDP_BOOLEAN; case SOCK_STRING: return property.type == IDP_STRING; case SOCK_OBJECT: @@ -601,7 +599,7 @@ static void init_socket_cpp_value_from_property(const IDProperty , break; } case SOCK_BOOLEAN: { - bool value = IDP_Int() != 0; + const bool value = IDP_Bool(); new (r_value) ValueOrField(value); break; } @@ -682,16 +680,23 @@ void MOD_nodes_update_interface(Object *object, NodesModifierData *nmd) if (old_properties != nullptr) { IDProperty *old_prop = IDP_GetPropertyFromGroup(old_properties, socket->identifier); - if (old_prop != nullptr && id_property_type_matches_socket(*socket, *old_prop)) { -/* #IDP_CopyPropertyContent replaces the UI data as well, which we don't (we only - * want to replace the values). So release it temporarily and replace it after. */ -IDPropertyUIData *ui_data = new_prop->ui_data; -new_prop->ui_data = nullptr; -IDP_CopyPropertyContent(new_prop, old_prop); -if (new_prop->ui_data != nullptr) { - IDP_ui_data_free(new_prop); + if (old_prop != nullptr) { +if (id_property_type_matches_socket(*socket, *old_prop)) { +
[Bf-blender-cvs] [68625431d5d] master: Geometry Nodes: Adjust modifier UI to put field toggles on the right
Commit: 68625431d5d0b2e178df506fc0fabe81e9b44fcb Author: Leon Schittek Date: Fri Jan 20 17:41:34 2023 -0600 Branches: master https://developer.blender.org/rB68625431d5d0b2e178df506fc0fabe81e9b44fcb Geometry Nodes: Adjust modifier UI to put field toggles on the right This also fixes the layout of boolean properties with the field toggle visible. This was discussed in the most recent geometry nodes submodule meeting. === M source/blender/modifiers/intern/MOD_nodes.cc === diff --git a/source/blender/modifiers/intern/MOD_nodes.cc b/source/blender/modifiers/intern/MOD_nodes.cc index 9c63ee7ce15..e487abc4248 100644 --- a/source/blender/modifiers/intern/MOD_nodes.cc +++ b/source/blender/modifiers/intern/MOD_nodes.cc @@ -1580,7 +1580,9 @@ static void add_attribute_search_or_value_buttons(const bContext , uiLayout *split = uiLayoutSplit(layout, 0.4f, false); uiLayout *name_row = uiLayoutRow(split, false); uiLayoutSetAlignment(name_row, UI_LAYOUT_ALIGN_RIGHT); - if (socket.type == SOCK_BOOLEAN) { + + const int use_attribute = RNA_int_get(md_ptr, rna_path_use_attribute.c_str()) != 0; + if (socket.type == SOCK_BOOLEAN && !use_attribute) { uiItemL(name_row, "", ICON_NONE); } else { @@ -1589,7 +1591,18 @@ static void add_attribute_search_or_value_buttons(const bContext , uiLayout *prop_row = uiLayoutRow(split, true); if (socket.type == SOCK_BOOLEAN) { -uiLayoutSetAlignment(prop_row, UI_LAYOUT_ALIGN_LEFT); +uiLayoutSetPropSep(prop_row, false); +uiLayoutSetAlignment(prop_row, UI_LAYOUT_ALIGN_EXPAND); + } + + if (use_attribute) { +add_attribute_search_button(C, prop_row, nmd, md_ptr, rna_path_attribute_name, socket, false); +uiItemL(layout, "", ICON_BLANK1); + } + else { +const char *name = socket.type == SOCK_BOOLEAN ? socket.name : ""; +uiItemR(prop_row, md_ptr, rna_path.c_str(), 0, name, ICON_NONE); +uiItemDecoratorR(layout, md_ptr, rna_path.c_str(), -1); } PointerRNA props; @@ -1603,16 +1616,6 @@ static void add_attribute_search_or_value_buttons(const bContext , ); RNA_string_set(, "modifier_name", nmd.modifier.name); RNA_string_set(, "prop_path", rna_path_use_attribute.c_str()); - - const int use_attribute = RNA_int_get(md_ptr, rna_path_use_attribute.c_str()) != 0; - if (use_attribute) { -add_attribute_search_button(C, prop_row, nmd, md_ptr, rna_path_attribute_name, socket, false); - } - else { -const char *name = socket.type == SOCK_BOOLEAN ? socket.name : ""; -uiItemR(prop_row, md_ptr, rna_path.c_str(), 0, name, ICON_NONE); -uiItemDecoratorR(layout, md_ptr, rna_path.c_str(), -1); - } } /* Drawing the properties manually with #uiItemR instead of #uiDefAutoButsRNA allows using @@ -1678,6 +1681,9 @@ static void draw_property_for_socket(const bContext , } } } + if (!input_has_attribute_toggle(*nmd->node_group, socket_index)) { +uiItemL(row, "", ICON_BLANK1); + } } static void draw_property_for_output_socket(const bContext , ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org List details, subscription details or unsubscribe: https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [6a22230db4e] master: Fix : accidentally committed typo, roo many closing brackets.
Commit: 6a22230db4eee17d36af676f3c8828b8a9316a7e Author: Martijn Versteegh Date: Sat Jan 21 00:22:17 2023 +0100 Branches: master https://developer.blender.org/rB6a22230db4eee17d36af676f3c8828b8a9316a7e Fix : accidentally committed typo, roo many closing brackets. Ooops === M source/blender/makesrna/intern/rna_mesh.c === diff --git a/source/blender/makesrna/intern/rna_mesh.c b/source/blender/makesrna/intern/rna_mesh.c index 18f89636f1b..5ab36c1aa7d 100644 --- a/source/blender/makesrna/intern/rna_mesh.c +++ b/source/blender/makesrna/intern/rna_mesh.c @@ -2915,7 +2915,7 @@ static void rna_def_mloopuv(BlenderRNA *brna) prop = RNA_def_property(srna, "uv", PROP_COLLECTION, PROP_NONE); RNA_def_property_struct_type(prop, "Float2AttributeValue"); - RNA_def_property_ui_text(prop, "UV", "UV coordinates on face corners")); + RNA_def_property_ui_text(prop, "UV", "UV coordinates on face corners"); RNA_def_property_collection_funcs(prop, "rna_MeshUVLoopLayer_uv_begin", "rna_iterator_array_next", ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org List details, subscription details or unsubscribe: https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [a82c12ae32d] master: Add collection properties to MeshUVLoopLayer to access UV and the associated bool attributes (Python API).
Commit: a82c12ae32d94e2ec15a5ad81012ab9f93ab2b33 Author: Martijn Versteegh Date: Sat Jan 21 00:03:42 2023 +0100 Branches: master https://developer.blender.org/rBa82c12ae32d94e2ec15a5ad81012ab9f93ab2b33 Add collection properties to MeshUVLoopLayer to access UV and the associated bool attributes (Python API). This adds 4 collection properties to MeshUVLoopLayer to eventually replace the (MeshUVLoop) .data property. The added properties are: .uv .vertex_selection .edge_selection .pin The direct access to the separate arrays is much more efficient than the access via MeshUVLoop. Differential Revision: https://developer.blender.org/D16998 === M source/blender/makesrna/intern/rna_mesh.c === diff --git a/source/blender/makesrna/intern/rna_mesh.c b/source/blender/makesrna/intern/rna_mesh.c index 7c8e7431652..18f89636f1b 100644 --- a/source/blender/makesrna/intern/rna_mesh.c +++ b/source/blender/makesrna/intern/rna_mesh.c @@ -986,16 +986,128 @@ static char *rna_MeshUVLoopLayer_path(const PointerRNA *ptr) static void rna_MeshUVLoopLayer_data_begin(CollectionPropertyIterator *iter, PointerRNA *ptr) { - Mesh *me = rna_mesh(ptr); + Mesh *mesh = rna_mesh(ptr); CustomDataLayer *layer = (CustomDataLayer *)ptr->data; rna_iterator_array_begin( - iter, layer->data, sizeof(float[2]), (me->edit_mesh) ? 0 : me->totloop, 0, NULL); + iter, layer->data, sizeof(float[2]), (mesh->edit_mesh) ? 0 : mesh->totloop, 0, NULL); } static int rna_MeshUVLoopLayer_data_length(PointerRNA *ptr) +{ + Mesh *mesh = rna_mesh(ptr); + return (mesh->edit_mesh) ? 0 : mesh->totloop; +} + +static MBoolProperty *MeshUVLoopLayer_get_bool_layer(Mesh *mesh, char const *name) +{ + void *layer = CustomData_get_layer_named_for_write( + >ldata, CD_PROP_BOOL, name, mesh->totloop); + if (layer == NULL) { +layer = CustomData_add_layer_named( +>ldata, CD_PROP_BOOL, CD_SET_DEFAULT, NULL, mesh->totloop, name); + } + + BLI_assert(layer); + + return (MBoolProperty *)layer; +} + +static void bool_layer_begin(CollectionPropertyIterator *iter, + PointerRNA *ptr, + const char *(*layername_func)(const char *uv_name, char *name)) +{ + char bool_layer_name[MAX_CUSTOMDATA_LAYER_NAME]; + Mesh *mesh = rna_mesh(ptr); + CustomDataLayer *layer = (CustomDataLayer *)ptr->data; + layername_func(layer->name, bool_layer_name); + + rna_iterator_array_begin(iter, + MeshUVLoopLayer_get_bool_layer(mesh, bool_layer_name), + sizeof(MBoolProperty), + (mesh->edit_mesh) ? 0 : mesh->totloop, + 0, + NULL); +} + +static int bool_layer_lookup_int(PointerRNA *ptr, + int index, + PointerRNA *r_ptr, + const char *(*layername_func)(const char *uv_name, char *name)) +{ + char bool_layer_name[MAX_CUSTOMDATA_LAYER_NAME]; + Mesh *mesh = rna_mesh(ptr); + if (mesh->edit_mesh || index < 0 || index >= mesh->totloop) { +return 0; + } + CustomDataLayer *layer = (CustomDataLayer *)ptr->data; + layername_func(layer->name, bool_layer_name); + + r_ptr->owner_id = >id; + r_ptr->type = _BoolAttributeValue; + r_ptr->data = MeshUVLoopLayer_get_bool_layer(mesh, bool_layer_name) + index; + return 1; +} + +/* Collection accessors for vert_select. */ +static void rna_MeshUVLoopLayer_vert_select_begin(CollectionPropertyIterator *iter, + PointerRNA *ptr) +{ + bool_layer_begin(iter, ptr, BKE_uv_map_vert_select_name_get); +} + +static int rna_MeshUVLoopLayer_vert_select_lookup_int(PointerRNA *ptr, + int index, + PointerRNA *r_ptr) +{ + return bool_layer_lookup_int(ptr, index, r_ptr, BKE_uv_map_vert_select_name_get); +} + +/* Collection accessors for edge_select. */ +static void rna_MeshUVLoopLayer_edge_select_begin(CollectionPropertyIterator *iter, + PointerRNA *ptr) +{ + bool_layer_begin(iter, ptr, BKE_uv_map_edge_select_name_get); +} + +static int rna_MeshUVLoopLayer_edge_select_lookup_int(PointerRNA *ptr, + int index, + PointerRNA *r_ptr) +{ + return bool_layer_lookup_int(ptr, index, r_ptr, BKE_uv_map_edge_select_name_get); +} + +/* Collection accessors for pin. */ +static void rna_MeshUVLoopLayer_pin_begin(CollectionPropertyIterator *iter, PointerRNA *ptr) +{ + bool_layer_begin(iter, ptr, BKE_uv_map_pin_name_get); +} + +static int rna_MeshUVLoopLayer_pin_lookup_int(PointerRNA *ptr, int index, PointerRNA *r_ptr)
[Bf-blender-cvs] [453724894ea] master: Fix T103704: Particle hair doesn't fall back to active UV
Commit: 453724894ea5c0f02ffd90ff3a9508477259e73b Author: Hans Goudey Date: Fri Jan 20 15:34:13 2023 -0600 Branches: master https://developer.blender.org/rB453724894ea5c0f02ffd90ff3a9508477259e73b Fix T103704: Particle hair doesn't fall back to active UV Caused by 05952aa94d33eeb504fa, which removed the use of the active tessface UV pointer on meshes but didn't replace it properly with the equivalend custom data API function. === M source/blender/blenkernel/intern/particle.cc === diff --git a/source/blender/blenkernel/intern/particle.cc b/source/blender/blenkernel/intern/particle.cc index 99dfd7fe138..514accf098b 100644 --- a/source/blender/blenkernel/intern/particle.cc +++ b/source/blender/blenkernel/intern/particle.cc @@ -4216,7 +4216,9 @@ static int get_particle_uv(Mesh *mesh, int i; tf = static_cast(CustomData_get_layer_named(>fdata, CD_MTFACE, name)); - + if (tf == nullptr) { +tf = static_cast(CustomData_get_layer(>fdata, CD_MTFACE)); + } if (tf == nullptr) { return 0; } ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org List details, subscription details or unsubscribe: https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [244c87dd680] master: Geometry Nodes: avoid geometry copy if nothing is selected in Set Position node
Commit: 244c87dd680c4f5b5acfcd088aaae0e04298c4f5 Author: Jacques Lucke Date: Fri Jan 20 21:27:13 2023 +0100 Branches: master https://developer.blender.org/rB244c87dd680c4f5b5acfcd088aaae0e04298c4f5 Geometry Nodes: avoid geometry copy if nothing is selected in Set Position node This improves performance in cases where the Set Position node is "turned off" by passing `false` into the selection input. It's possible that the node still takes some time in this case currently, because it is destructing the input fields which may reference geometries that need to be destructed as well. We could potentially change this node (and others) so that the field inputs are only requested when the selection is not a constant `false`. === M source/blender/nodes/geometry/nodes/node_geo_set_position.cc === diff --git a/source/blender/nodes/geometry/nodes/node_geo_set_position.cc b/source/blender/nodes/geometry/nodes/node_geo_set_position.cc index 2ad126567d1..4f6a256620a 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_set_position.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_set_position.cc @@ -116,19 +116,22 @@ static void set_computed_position_and_offset(GeometryComponent , } } -static void set_position_in_component(GeometryComponent , +static void set_position_in_component(GeometrySet , + GeometryComponentType component_type, const Field _field, const Field _field, const Field _field) { - eAttrDomain domain = component.type() == GEO_COMPONENT_TYPE_INSTANCES ? ATTR_DOMAIN_INSTANCE : - ATTR_DOMAIN_POINT; - bke::GeometryFieldContext field_context{component, domain}; + const GeometryComponent = *geometry.get_component_for_read(component_type); + const eAttrDomain domain = component.type() == GEO_COMPONENT_TYPE_INSTANCES ? + ATTR_DOMAIN_INSTANCE : + ATTR_DOMAIN_POINT; const int domain_size = component.attribute_domain_size(domain); if (domain_size == 0) { return; } + bke::GeometryFieldContext field_context{component, domain}; fn::FieldEvaluator evaluator{field_context, domain_size}; evaluator.set_selection(selection_field); evaluator.add(position_field); @@ -136,10 +139,14 @@ static void set_position_in_component(GeometryComponent , evaluator.evaluate(); const IndexMask selection = evaluator.get_evaluated_selection_as_mask(); + if (selection.is_empty()) { +return; + } + GeometryComponent _component = geometry.get_component_for_write(component_type); const VArray positions_input = evaluator.get_evaluated(0); const VArray offsets_input = evaluator.get_evaluated(1); - set_computed_position_and_offset(component, positions_input, offsets_input, selection); + set_computed_position_and_offset(mutable_component, positions_input, offsets_input, selection); } static void node_geo_exec(GeoNodeExecParams params) @@ -154,8 +161,7 @@ static void node_geo_exec(GeoNodeExecParams params) GEO_COMPONENT_TYPE_CURVE, GEO_COMPONENT_TYPE_INSTANCES}) { if (geometry.has(type)) { - set_position_in_component( - geometry.get_component_for_write(type), selection_field, position_field, offset_field); + set_position_in_component(geometry, type, selection_field, position_field, offset_field); } } ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org List details, subscription details or unsubscribe: https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [37dfce550f1] master: Fix Cycles CUDA compiler warning with if constexpr
Commit: 37dfce550f10462b4d2e5bf8185d21ea01a1eb9f Author: Brecht Van Lommel Date: Fri Jan 20 20:15:31 2023 +0100 Branches: master https://developer.blender.org/rB37dfce550f10462b4d2e5bf8185d21ea01a1eb9f Fix Cycles CUDA compiler warning with if constexpr This is a C++17 feature, compiler should be able to figure this out without the hint. === M intern/cycles/kernel/closure/bsdf_microfacet.h === diff --git a/intern/cycles/kernel/closure/bsdf_microfacet.h b/intern/cycles/kernel/closure/bsdf_microfacet.h index 83051f08f40..80c47bc9542 100644 --- a/intern/cycles/kernel/closure/bsdf_microfacet.h +++ b/intern/cycles/kernel/closure/bsdf_microfacet.h @@ -210,7 +210,7 @@ ccl_device_forceinline float3 microfacet_sample_stretched(KernelGlobals kg, /* 2. sample P22_{wi}(x_slope, y_slope, 1, 1) */ float slope_x, slope_y; - if constexpr (m_type == MicrofacetType::BECKMANN) { + if (m_type == MicrofacetType::BECKMANN) { microfacet_beckmann_sample_slopes( kg, costheta_, sintheta_, randu, randv, _x, _y, G1i); } @@ -275,13 +275,14 @@ ccl_device_forceinline float bsdf_clearcoat_D(float alpha2, float cos_NH) template ccl_device_inline float bsdf_G1_from_sqr_alpha_tan_n(float sqr_alpha_tan_n) { - if constexpr (m_type == MicrofacetType::GGX) { + if (m_type == MicrofacetType::GGX) { return 2.0f / (1.0f + sqrtf(1.0f + sqr_alpha_tan_n)); } - - /* m_type == MicrofacetType::BECKMANN */ - const float a = inversesqrtf(sqr_alpha_tan_n); - return (a > 1.6f) ? 1.0f : ((2.181f * a + 3.535f) * a) / ((2.577f * a + 2.276f) * a + 1.0f); + else { +/* m_type == MicrofacetType::BECKMANN */ +const float a = inversesqrtf(sqr_alpha_tan_n); +return (a > 1.6f) ? 1.0f : ((2.181f * a + 3.535f) * a) / ((2.577f * a + 2.276f) * a + 1.0f); + } } template ccl_device_inline float bsdf_G1(float alpha2, float cos_N) @@ -308,12 +309,13 @@ template ccl_device_inline float bsdf_D(float alpha2, flo { const float cos_NH2 = sqr(cos_NH); - if constexpr (m_type == MicrofacetType::BECKMANN) { + if (m_type == MicrofacetType::BECKMANN) { return expf((1.0f - 1.0f / cos_NH2) / alpha2) / (M_PI_F * alpha2 * sqr(cos_NH2)); } - - /* m_type == MicrofacetType::GGX */ - return alpha2 / (M_PI_F * sqr(1.0f + (alpha2 - 1.0f) * cos_NH2)); + else { +/* m_type == MicrofacetType::GGX */ +return alpha2 / (M_PI_F * sqr(1.0f + (alpha2 - 1.0f) * cos_NH2)); + } } template @@ -324,12 +326,13 @@ ccl_device_inline float bsdf_aniso_D(float alpha_x, float alpha_y, float3 H) const float cos_NH2 = sqr(H.z); const float alpha2 = alpha_x * alpha_y; - if constexpr (m_type == MicrofacetType::BECKMANN) { + if (m_type == MicrofacetType::BECKMANN) { return expf(-(sqr(H.x) + sqr(H.y)) / cos_NH2) / (M_PI_F * alpha2 * sqr(cos_NH2)); } - - /* m_type == MicrofacetType::GGX */ - return M_1_PI_F / (alpha2 * sqr(len_squared(H))); + else { +/* m_type == MicrofacetType::GGX */ +return M_1_PI_F / (alpha2 * sqr(len_squared(H))); + } } ccl_device_forceinline void bsdf_microfacet_fresnel_color(ccl_private const ShaderData *sd, ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org List details, subscription details or unsubscribe: https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [2da005902f4] tmp-worbench-rewrite2-optimizations: Draw: Cleanup the GLSL intersection code
Commit: 2da005902f434b6d4301516e280c899129384b95 Author: Miguel Pozo Date: Fri Jan 13 17:51:54 2023 +0100 Branches: tmp-worbench-rewrite2-optimizations https://developer.blender.org/rB2da005902f434b6d4301516e280c899129384b95 Draw: Cleanup the GLSL intersection code === M source/blender/draw/intern/shaders/common_intersect_lib.glsl M source/blender/draw/intern/shaders/common_math_geom_lib.glsl === diff --git a/source/blender/draw/intern/shaders/common_intersect_lib.glsl b/source/blender/draw/intern/shaders/common_intersect_lib.glsl index d1416e220a4..080771ca49b 100644 --- a/source/blender/draw/intern/shaders/common_intersect_lib.glsl +++ b/source/blender/draw/intern/shaders/common_intersect_lib.glsl @@ -124,311 +124,137 @@ IsectFrustum isect_data_setup(Frustum shape) /** \} */ /* -- */ -/** \name View Intersection functions. +/** \name Shape vs. Shape Intersection functions. * \{ */ -bool intersect_view(Pyramid pyramid) +bool intersect(IsectPyramid i_pyramid, IsectBox i_box) { - bool intersects = true; - - /* Do Pyramid vertices vs Frustum planes. */ - for (int p = 0; p < 6; ++p) { -bool is_any_vertex_on_positive_side = false; -for (int v = 0; v < 5; ++v) { - float test = dot(drw_view_culling.planes[p], vec4(pyramid.corners[v], 1.0)); - if (test > 0.0) { -is_any_vertex_on_positive_side = true; -break; - } -} -bool all_vertex_on_negative_side = !is_any_vertex_on_positive_side; -if (all_vertex_on_negative_side) { - intersects = false; - break; -} - } - - if (!intersects) { -return intersects; - } - - /* Now do Frustum vertices vs Pyramid planes. */ - IsectPyramid i_pyramid = isect_data_setup(pyramid); + /* Do Box vertices vs Pyramid planes. */ for (int p = 0; p < 5; ++p) { -bool is_any_vertex_on_positive_side = false; -for (int v = 0; v < 8; ++v) { - float test = dot(i_pyramid.planes[p], vec4(drw_view_culling.corners[v].xyz, 1.0)); - if (test > 0.0) { -is_any_vertex_on_positive_side = true; -break; - } -} -bool all_vertex_on_negative_side = !is_any_vertex_on_positive_side; -if (all_vertex_on_negative_side) { - intersects = false; - break; -} - } - return intersects; -} - -bool intersect_view(Box box) -{ - bool intersects = true; - - /* Do Box vertices vs Frustum planes. */ - for (int p = 0; p < 6; ++p) { -bool is_any_vertex_on_positive_side = false; -for (int v = 0; v < 8; ++v) { - float test = dot(drw_view_culling.planes[p], vec4(box.corners[v], 1.0)); - if (test > 0.0) { -is_any_vertex_on_positive_side = true; -break; - } -} -bool all_vertex_on_negative_side = !is_any_vertex_on_positive_side; -if (all_vertex_on_negative_side) { - intersects = false; - break; -} - } - - if (!intersects) { -return intersects; - } - - /* Now do Frustum vertices vs Box planes. */ - IsectBox i_box = isect_data_setup(box); - for (int p = 0; p < 6; ++p) { -bool is_any_vertex_on_positive_side = false; -for (int v = 0; v < 8; ++v) { - float test = dot(i_box.planes[p], vec4(drw_view_culling.corners[v].xyz, 1.0)); - if (test > 0.0) { -is_any_vertex_on_positive_side = true; -break; - } -} -bool all_vertex_on_negative_side = !is_any_vertex_on_positive_side; -if (all_vertex_on_negative_side) { - intersects = false; - break; -} - } - - return intersects; -} - -bool intersect_view(IsectBox i_box) -{ - bool intersects = true; - - /* Do Box vertices vs Frustum planes. */ - for (int p = 0; p < 6; ++p) { -bool is_any_vertex_on_positive_side = false; +bool separating_axis = true; for (int v = 0; v < 8; ++v) { - float test = dot(drw_view_culling.planes[p], vec4(i_box.corners[v], 1.0)); - if (test > 0.0) { -is_any_vertex_on_positive_side = true; + float signed_distance = point_plane_projection_dist(i_box.corners[v], i_pyramid.planes[p]); + if (signed_distance <= 0.0) { +separating_axis = false; break; } } -bool all_vertex_on_negative_side = !is_any_vertex_on_positive_side; -if (all_vertex_on_negative_side) { - intersects = false; - break; +if (separating_axis) { + return false; } } - if (!intersects) { -return intersects; - } - + /* Now do Pyramid vertices vs Box planes. */ for (int p = 0; p < 6; ++p) { -bool is_any_vertex_on_positive_side = false; -for (int v = 0; v < 8; ++v) { - float test = dot(i_box.planes[p], vec4(drw_view_culling.corners[v].xyz, 1.0)); - if (test > 0.0) { -is_any_vertex_on_positive_side = true; +bool separating_axis = true; +for (int v = 0; v < 5; ++v) { +
[Bf-blender-cvs] [693dffb7b7c] tmp-worbench-rewrite2-optimizations: Use smaller ObjectBounds
Commit: 693dffb7b7c1039c2165b83b1b81fa39256d6ef8 Author: Miguel Pozo Date: Fri Jan 20 18:01:18 2023 +0100 Branches: tmp-worbench-rewrite2-optimizations https://developer.blender.org/rB693dffb7b7c1039c2165b83b1b81fa39256d6ef8 Use smaller ObjectBounds Only store center and size. Skip resource finalize computation. === M source/blender/draw/engines/workbench/workbench_private.hh M source/blender/draw/engines/workbench/workbench_shadow.cc M source/blender/draw/intern/draw_manager.cc M source/blender/draw/intern/draw_resource.hh M source/blender/draw/intern/draw_shader_shared.h M source/blender/draw/intern/draw_view.cc M source/blender/draw/intern/draw_view.hh M source/blender/draw/intern/shaders/draw_resource_finalize_comp.glsl M source/blender/draw/intern/shaders/draw_view_info.hh M source/blender/draw/intern/shaders/draw_visibility_comp.glsl === diff --git a/source/blender/draw/engines/workbench/workbench_private.hh b/source/blender/draw/engines/workbench/workbench_private.hh index 086553ca5c1..2022fb69945 100644 --- a/source/blender/draw/engines/workbench/workbench_private.hh +++ b/source/blender/draw/engines/workbench/workbench_private.hh @@ -269,7 +269,10 @@ class ShadowPass { ShadowView(); protected: -virtual void compute_visibility(ObjectBoundsBuf , uint resource_len, bool debug_freeze); +virtual void compute_visibility(ObjectMatricesBuf , +ObjectBoundsBuf , +uint resource_len, +bool debug_freeze); virtual VisibilityBuf _visibility_buffer(); } view_ = {}; diff --git a/source/blender/draw/engines/workbench/workbench_shadow.cc b/source/blender/draw/engines/workbench/workbench_shadow.cc index 22c7b663220..909edd63667 100644 --- a/source/blender/draw/engines/workbench/workbench_shadow.cc +++ b/source/blender/draw/engines/workbench/workbench_shadow.cc @@ -201,7 +201,8 @@ void ShadowPass::ShadowView::set_mode(ShadowPass::PassType type) current_pass_type_ = type; } -void ShadowPass::ShadowView::compute_visibility(ObjectBoundsBuf , +void ShadowPass::ShadowView::compute_visibility(ObjectMatricesBuf , +ObjectBoundsBuf , uint resource_len, bool debug_freeze) { @@ -231,6 +232,8 @@ void ShadowPass::ShadowView::compute_visibility(ObjectBoundsBuf , GPU_storagebuf_clear(visibility_buf_, GPU_R32UI, GPU_DATA_UINT, ); } + /* TODO(Miguel Pozo): Disabled in the optimization branch */ + do_visibility_ = false; if (do_visibility_) { /* TODO(Miguel Pozo): Use regular culling for the caps pass */ @@ -249,6 +252,7 @@ void ShadowPass::ShadowView::compute_visibility(ObjectBoundsBuf , GPU_shader_uniform_3fv(shader, "shadow_direction", light_direction_); GPU_uniformbuf_bind(extruded_frustum_, GPU_shader_get_uniform_block(shader, "extruded_frustum")); +GPU_storagebuf_bind(matrices, GPU_shader_get_ssbo(shader, "matrix_buf")); GPU_storagebuf_bind(bounds, GPU_shader_get_ssbo(shader, "bounds_buf")); if (current_pass_type_ == ShadowPass::FORCED_FAIL) { GPU_storagebuf_bind(visibility_buf_, GPU_shader_get_ssbo(shader, "visibility_buf")); diff --git a/source/blender/draw/intern/draw_manager.cc b/source/blender/draw/intern/draw_manager.cc index d1a60c1af1f..540e1900424 100644 --- a/source/blender/draw/intern/draw_manager.cc +++ b/source/blender/draw/intern/draw_manager.cc @@ -166,7 +166,7 @@ void Manager::submit(PassMain , View ) bool freeze_culling = (U.experimental.use_viewport_debug && DST.draw_ctx.v3d && (DST.draw_ctx.v3d->debug_flag & V3D_DEBUG_FREEZE_CULLING) != 0); - view.compute_visibility(bounds_buf, resource_len_, freeze_culling); + view.compute_visibility(matrix_buf, bounds_buf, resource_len_, freeze_culling); command::RecordingState state; state.inverted_view = view.is_inverted(); diff --git a/source/blender/draw/intern/draw_resource.hh b/source/blender/draw/intern/draw_resource.hh index edc023c5703..09744d6403c 100644 --- a/source/blender/draw/intern/draw_resource.hh +++ b/source/blender/draw/intern/draw_resource.hh @@ -147,56 +147,54 @@ inline std::ostream <<(std::ostream , const ObjectInfos ) inline void ObjectBounds::sync() { - bounding_sphere.w = -1.0f; /* Disable test. */ + test_enabled = false; } inline void ObjectBounds::sync(Object ) { - BoundBox _bbox; - const BoundBox *bbox = &_bbox; + float3 min, max; + INIT_MINMAX(min, max); if (ob.type == OB_MESH) { /* Optimization: Retrieve the mesh cached min max directly. * Avoids allocating a BoundBox on every sample for each DupliObject
[Bf-blender-cvs] [a9d716fa0fe] tmp-worbench-rewrite2-optimizations: Optimization: Draw: Avoid runtime.bb allocation for DupliObjects
Commit: a9d716fa0fe3f0d250de3438e0ac8af22514178a Author: Miguel Pozo Date: Wed Jan 18 15:17:47 2023 +0100 Branches: tmp-worbench-rewrite2-optimizations https://developer.blender.org/rBa9d716fa0fe3f0d250de3438e0ac8af22514178a Optimization: Draw: Avoid runtime.bb allocation for DupliObjects === M source/blender/draw/intern/draw_manager_data.cc M source/blender/draw/intern/draw_resource.hh === diff --git a/source/blender/draw/intern/draw_manager_data.cc b/source/blender/draw/intern/draw_manager_data.cc index 5b4e0792577..125029b79e1 100644 --- a/source/blender/draw/intern/draw_manager_data.cc +++ b/source/blender/draw/intern/draw_manager_data.cc @@ -16,6 +16,7 @@ #include "BKE_global.h" #include "BKE_image.h" #include "BKE_mesh.h" +#include "BKE_mesh_wrapper.h" #include "BKE_object.h" #include "BKE_paint.h" #include "BKE_pbvh.h" @@ -695,7 +696,7 @@ static void drw_call_obinfos_init(DRWObjectInfos *ob_infos, Object *ob) drw_call_calc_orco(ob, ob_infos->orcotexfac); /* Random float value. */ uint random = (DST.dupli_source) ? - DST.dupli_source->random_id : +DST.dupli_source->random_id : /* TODO(fclem): this is rather costly to do at runtime. Maybe we can * put it in ob->runtime and make depsgraph ensure it is up to date. */ BLI_hash_int_2d(BLI_hash_string(ob->id.name + 2), 0); @@ -719,26 +720,41 @@ static void drw_call_obinfos_init(DRWObjectInfos *ob_infos, Object *ob) static void drw_call_culling_init(DRWCullingState *cull, Object *ob) { - const BoundBox *bbox; - if (ob != nullptr && (bbox = BKE_object_boundbox_get(ob))) { -float corner[3]; -/* Get BoundSphere center and radius from the BoundBox. */ -mid_v3_v3v3(cull->bsphere.center, bbox->vec[0], bbox->vec[6]); -mul_v3_m4v3(corner, ob->object_to_world, bbox->vec[0]); -mul_m4_v3(ob->object_to_world, cull->bsphere.center); -cull->bsphere.radius = len_v3v3(cull->bsphere.center, corner); + /* Bypass test */ + cull->bsphere.radius = -1.0f; + /* Reset user data */ + cull->user_data = nullptr; + + if (ob != nullptr) { +if (ob->type == OB_MESH) { + /* Optimization: Retrieve the mesh cached min max directly. + * Avoids allocating a BoundBox on every sample for each DupliObject instance. + * TODO(Miguel Pozo): Remove once T92963 or T96968 are done */ + float3 min, max; + INIT_MINMAX(min, max); + BKE_mesh_wrapper_minmax(static_cast(ob->data), min, max); + + /* Get BoundSphere center and radius from min/max. */ + float3 min_world = float4x4(ob->object_to_world) * min; + float3 max_world = float4x4(ob->object_to_world) * max; + + mid_v3_v3v3(cull->bsphere.center, min_world, max_world); + cull->bsphere.radius = len_v3v3(cull->bsphere.center, max_world); +} +else if (const BoundBox *bbox = BKE_object_boundbox_get(ob)) { + float corner[3]; + /* Get BoundSphere center and radius from the BoundBox. */ + mid_v3_v3v3(cull->bsphere.center, bbox->vec[0], bbox->vec[6]); + mul_v3_m4v3(corner, ob->object_to_world, bbox->vec[0]); + mul_m4_v3(ob->object_to_world, cull->bsphere.center); + cull->bsphere.radius = len_v3v3(cull->bsphere.center, corner); +} /* Bypass test for very large objects (see T67319). */ if (UNLIKELY(cull->bsphere.radius > 1e12)) { cull->bsphere.radius = -1.0f; } } - else { -/* Bypass test. */ -cull->bsphere.radius = -1.0f; - } - /* Reset user data */ - cull->user_data = nullptr; } static DRWResourceHandle drw_resource_handle_new(float (*obmat)[4], Object *ob) diff --git a/source/blender/draw/intern/draw_resource.hh b/source/blender/draw/intern/draw_resource.hh index a2de084b900..edc023c5703 100644 --- a/source/blender/draw/intern/draw_resource.hh +++ b/source/blender/draw/intern/draw_resource.hh @@ -13,6 +13,7 @@ #include "BKE_curve.h" #include "BKE_duplilist.h" #include "BKE_mesh.h" +#include "BKE_mesh_wrapper.h" #include "BKE_object.h" #include "BKE_volume.h" #include "BLI_hash.h" @@ -151,11 +152,25 @@ inline void ObjectBounds::sync() inline void ObjectBounds::sync(Object ) { - const BoundBox *bbox = BKE_object_boundbox_get(); - if (bbox == nullptr) { -bounding_sphere.w = -1.0f; /* Disable test. */ -return; + BoundBox _bbox; + const BoundBox *bbox = &_bbox; + + if (ob.type == OB_MESH) { +/* Optimization: Retrieve the mesh cached min max directly. + * Avoids allocating a BoundBox on every sample for each DupliObject instance. + * TODO(Miguel Pozo): Remove once T92963 or T96968 are done */ +float3 min, max; +BKE_mesh_wrapper_minmax(static_cast(ob.data), min, max); +BKE_boundbox_init_from_minmax(&_bbox, min, max); + } + else { +bbox = BKE_object_boundbox_get(); +
[Bf-blender-cvs] [aef43d1461a] tmp-worbench-rewrite2-optimizations: Merge branch 'tmp-workbench-rewrite2' into tmp-worbench-rewrite2-optimizations
Commit: aef43d1461acb61b38afe5a90c181bd167a8abd9 Author: Miguel Pozo Date: Fri Jan 20 17:50:21 2023 +0100 Branches: tmp-worbench-rewrite2-optimizations https://developer.blender.org/rBaef43d1461acb61b38afe5a90c181bd167a8abd9 Merge branch 'tmp-workbench-rewrite2' into tmp-worbench-rewrite2-optimizations === === ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org List details, subscription details or unsubscribe: https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [33ff1ce7b25] microfacet_hair: Merge code for circular and elliptical cross-sections
Commit: 33ff1ce7b25f2429c0b6c5769268733880cfab1f Author: Weizhen Huang Date: Fri Jan 20 20:11:30 2023 +0100 Branches: microfacet_hair https://developer.blender.org/rB33ff1ce7b25f2429c0b6c5769268733880cfab1f Merge code for circular and elliptical cross-sections === M intern/cycles/blender/shader.cpp M intern/cycles/kernel/closure/bsdf_hair_microfacet.h M intern/cycles/kernel/osl/closures_setup.h M intern/cycles/kernel/osl/closures_template.h M intern/cycles/kernel/osl/shaders/node_microfacet_hair_bsdf.osl M intern/cycles/kernel/osl/shaders/stdcycles.h M intern/cycles/kernel/svm/closure.h M intern/cycles/kernel/svm/types.h M intern/cycles/scene/shader_nodes.cpp M intern/cycles/scene/shader_nodes.h M source/blender/makesdna/DNA_node_types.h M source/blender/makesrna/intern/rna_nodetree.c M source/blender/nodes/shader/nodes/node_shader_bsdf_hair_microfacet.cc === diff --git a/intern/cycles/blender/shader.cpp b/intern/cycles/blender/shader.cpp index 266a5900837..015bdee59fb 100644 --- a/intern/cycles/blender/shader.cpp +++ b/intern/cycles/blender/shader.cpp @@ -668,11 +668,7 @@ static ShaderNode *add_node(Scene *scene, "parametrization", NODE_MICROFACET_HAIR_NUM, NODE_MICROFACET_HAIR_REFLECTANCE)); -microfacet_hair->set_cross_section( - (NodeMicrofacetHairCrossSectionType)get_enum(b_microfacet_hair_node.ptr, - "cross_section", - NODE_MICROFACET_HAIR_CROSS_SECTION_NUM, - NODE_MICROFACET_HAIR_CIRCULAR)); + microfacet_hair->set_distribution_type( (NodeMicrofacetHairDistributionType)get_enum(b_microfacet_hair_node.ptr, "distribution_type", diff --git a/intern/cycles/kernel/closure/bsdf_hair_microfacet.h b/intern/cycles/kernel/closure/bsdf_hair_microfacet.h index d9d9df942e6..d8e79739ffb 100644 --- a/intern/cycles/kernel/closure/bsdf_hair_microfacet.h +++ b/intern/cycles/kernel/closure/bsdf_hair_microfacet.h @@ -36,9 +36,6 @@ typedef struct MicrofacetHairBSDF { /* GGX/Beckmann. */ int distribution_type; - /* Circular/Elliptical */ - int cross_section; - /* The ratio of the minor axis to the major axis. */ float aspect_ratio; @@ -74,7 +71,7 @@ ccl_device int bsdf_microfacet_hair_setup(ccl_private ShaderData *sd, kernel_assert(isfinite_safe(X)); kernel_assert(isfinite_safe(h)); - if (bsdf->cross_section == NODE_MICROFACET_HAIR_ELLIPTIC) { + if (bsdf->aspect_ratio != 1.0f) { if (bsdf->aspect_ratio > 1.0f) { bsdf->aspect_ratio = 1.0f / bsdf->aspect_ratio; @@ -154,53 +151,67 @@ ccl_device_inline float2 dir_sph(const float3 w) return make_float2(dir_theta(w), dir_phi(w)); } -/* Compute the vector direction given spherical coordinates. */ -ccl_device_inline float3 sph_dir(float theta, float phi) -{ - float sin_theta, cos_theta, sin_phi, cos_phi; - fast_sincosf(theta, _theta, _theta); - fast_sincosf(phi, _phi, _phi); - return make_float3(sin_phi * cos_theta, sin_theta, cos_phi * cos_theta); -} - -/* Utility functions for elliptical cross-sections. */ - /* Conversion between gamma and phi. Notations see Figure 5 in the paper. */ -ccl_device float to_phi(float gamma, float a, float b) +ccl_device_inline float to_phi(float gamma, float b) { + if (b == 1.0f) { +return gamma; + } float sin_gamma, cos_gamma; fast_sincosf(gamma, _gamma, _gamma); - return atan2f(b * sin_gamma, a * cos_gamma); + return atan2f(b * sin_gamma, cos_gamma); } -ccl_device float to_gamma(float phi, float a, float b) +ccl_device_inline float to_gamma(float phi, float b) { + if (b == 1.0f) { +return phi; + } float sin_phi, cos_phi; fast_sincosf(phi, _phi, _phi); - return atan2f(a * sin_phi, b * cos_phi); + return atan2f(sin_phi, b * cos_phi); } -/* Compute the coordinate on the ellipse, given gamma, the semi-major and semi-minor axes. */ -ccl_device float2 to_point(float gamma, float a, float b) +/* Compute the coordinate on the ellipse, given gamma and the aspect ratio between the minor axis + * and the major axis. */ +ccl_device_inline float2 to_point(float gamma, float b) { float sin_gamma, cos_gamma; fast_sincosf(gamma, _gamma, _gamma); - return make_float2(a * sin_gamma, b * cos_gamma); + return make_float2(sin_gamma, b * cos_gamma); } /* Compute the vector direction given by theta and gamma. */ -ccl_device float3 sphg_dir(float theta, float gamma, float a, float b) +ccl_device_inline float3 sphg_dir(float theta, float gamma, float b) { - float
[Bf-blender-cvs] [fc73e757793] refactor-mesh-corners-generic: Cleanup: Use C++ accessor functions
Commit: fc73e7577931b8879c2166ecce0fdebe5fb20829 Author: Hans Goudey Date: Fri Jan 20 13:01:00 2023 -0600 Branches: refactor-mesh-corners-generic https://developer.blender.org/rBfc73e7577931b8879c2166ecce0fdebe5fb20829 Cleanup: Use C++ accessor functions === M source/blender/blenkernel/intern/multires_reshape_subdivide.cc M source/blender/blenkernel/intern/multires_reshape_util.cc M source/blender/blenkernel/intern/multires_unsubdivide.cc M source/blender/blenkernel/intern/subdiv_converter_mesh.cc M source/blender/blenkernel/intern/subdiv_eval.cc M source/blender/blenkernel/intern/subdiv_foreach.cc M source/blender/editors/sculpt_paint/paint_mask.cc M source/blender/editors/sculpt_paint/paint_vertex_weight_ops.cc M source/blender/editors/sculpt_paint/sculpt_expand.cc M source/blender/editors/sculpt_paint/sculpt_geodesic.cc === diff --git a/source/blender/blenkernel/intern/multires_reshape_subdivide.cc b/source/blender/blenkernel/intern/multires_reshape_subdivide.cc index d502466e4d1..8ea6feedff6 100644 --- a/source/blender/blenkernel/intern/multires_reshape_subdivide.cc +++ b/source/blender/blenkernel/intern/multires_reshape_subdivide.cc @@ -30,7 +30,7 @@ static void multires_subdivide_create_object_space_linear_grids(Mesh *mesh) { const float(*positions)[3] = BKE_mesh_vert_positions(mesh); const MPoly *polys = BKE_mesh_polys(mesh); - const int *corner_verts = BKE_mesh_corner_verts(mesh); + const blender::Span corner_verts = mesh->corner_verts(); MDisps *mdisps = static_cast( CustomData_get_layer_for_write(>ldata, CD_MDISPS, mesh->totloop)); diff --git a/source/blender/blenkernel/intern/multires_reshape_util.cc b/source/blender/blenkernel/intern/multires_reshape_util.cc index 460446f52bf..0578d50db51 100644 --- a/source/blender/blenkernel/intern/multires_reshape_util.cc +++ b/source/blender/blenkernel/intern/multires_reshape_util.cc @@ -158,8 +158,8 @@ bool multires_reshape_context_create_from_base_mesh(MultiresReshapeContext *resh reshape_context->base_positions = BKE_mesh_vert_positions(base_mesh); reshape_context->base_edges = BKE_mesh_edges(base_mesh); reshape_context->base_polys = BKE_mesh_polys(base_mesh); - reshape_context->base_corner_verts = BKE_mesh_corner_verts(base_mesh); - reshape_context->base_corner_edges = BKE_mesh_corner_edges(base_mesh); + reshape_context->base_corner_verts = base_mesh->corner_verts().data(); + reshape_context->base_corner_edges = base_mesh->corner_edges().data(); reshape_context->subdiv = multires_reshape_create_subdiv(nullptr, object, mmd); reshape_context->need_free_subdiv = true; @@ -196,8 +196,8 @@ bool multires_reshape_context_create_from_object(MultiresReshapeContext *reshape reshape_context->base_positions = BKE_mesh_vert_positions(base_mesh); reshape_context->base_edges = BKE_mesh_edges(base_mesh); reshape_context->base_polys = BKE_mesh_polys(base_mesh); - reshape_context->base_corner_verts = BKE_mesh_corner_verts(base_mesh); - reshape_context->base_corner_edges = BKE_mesh_corner_edges(base_mesh); + reshape_context->base_corner_verts = base_mesh->corner_verts().data(); + reshape_context->base_corner_edges = base_mesh->corner_edges().data(); reshape_context->subdiv = multires_reshape_create_subdiv(depsgraph, object, mmd); reshape_context->need_free_subdiv = true; @@ -231,8 +231,8 @@ bool multires_reshape_context_create_from_ccg(MultiresReshapeContext *reshape_co reshape_context->base_positions = BKE_mesh_vert_positions(base_mesh); reshape_context->base_edges = BKE_mesh_edges(base_mesh); reshape_context->base_polys = BKE_mesh_polys(base_mesh); - reshape_context->base_corner_verts = BKE_mesh_corner_verts(base_mesh); - reshape_context->base_corner_edges = BKE_mesh_corner_edges(base_mesh); + reshape_context->base_corner_verts = base_mesh->corner_verts().data(); + reshape_context->base_corner_edges = base_mesh->corner_edges().data(); reshape_context->subdiv = subdiv_ccg->subdiv; reshape_context->need_free_subdiv = false; @@ -279,8 +279,8 @@ bool multires_reshape_context_create_from_subdiv(MultiresReshapeContext *reshape reshape_context->base_positions = BKE_mesh_vert_positions(base_mesh); reshape_context->base_edges = BKE_mesh_edges(base_mesh); reshape_context->base_polys = BKE_mesh_polys(base_mesh); - reshape_context->base_corner_verts = BKE_mesh_corner_verts(base_mesh); - reshape_context->base_corner_edges = BKE_mesh_corner_edges(base_mesh); + reshape_context->base_corner_verts = base_mesh->corner_verts().data(); + reshape_context->base_corner_edges = base_mesh->corner_edges().data(); reshape_context->cd_vertex_crease = (const float *)CustomData_get_layer(_mesh->edata, CD_CREASE); diff
[Bf-blender-cvs] [7172a11018d] refactor-mesh-corners-generic: Merge branch 'master' into refactor-mesh-corners-generic
Commit: 7172a11018d17886b0a715a0f5641903867f755e Author: Hans Goudey Date: Fri Jan 20 12:49:31 2023 -0600 Branches: refactor-mesh-corners-generic https://developer.blender.org/rB7172a11018d17886b0a715a0f5641903867f755e Merge branch 'master' into refactor-mesh-corners-generic === === diff --cc source/blender/blenkernel/intern/multires_reshape_apply_base.cc index f4add2491bf,d491f30a1ad..8f7ca2142b4 --- a/source/blender/blenkernel/intern/multires_reshape_apply_base.cc +++ b/source/blender/blenkernel/intern/multires_reshape_apply_base.cc @@@ -119,13 -120,15 +118,14 @@@ void multires_reshape_apply_base_refit_ /* Set up poly, loops, and coords in order to call BKE_mesh_calc_poly_normal(). */ fake_poly.totloop = p->totloop; fake_poly.loopstart = 0; - int *poly_verts = MEM_malloc_arrayN(p->totloop, sizeof(int), __func__); - fake_co = MEM_malloc_arrayN(p->totloop, sizeof(float[3]), "fake_co"); - MLoop *fake_loops = static_cast( - MEM_malloc_arrayN(p->totloop, sizeof(MLoop), __func__)); ++ int *poly_verts = static_cast(MEM_malloc_arrayN(p->totloop, sizeof(int), __func__)); + float(*fake_co)[3] = static_cast( + MEM_malloc_arrayN(p->totloop, sizeof(float[3]), __func__)); for (int k = 0; k < p->totloop; k++) { -const int vndx = reshape_context->base_loops[p->loopstart + k].v; +const int vndx = reshape_context->base_corner_verts[p->loopstart + k]; -fake_loops[k].v = k; +poly_verts[k] = k; if (vndx == i) { copy_v3_v3(fake_co[k], center); diff --cc source/blender/blenkernel/intern/multires_reshape_subdivide.cc index 2b72103a31c,c65b78cb160..d502466e4d1 --- a/source/blender/blenkernel/intern/multires_reshape_subdivide.cc +++ b/source/blender/blenkernel/intern/multires_reshape_subdivide.cc @@@ -30,9 -30,10 +30,10 @@@ static void multires_subdivide_create_o { const float(*positions)[3] = BKE_mesh_vert_positions(mesh); const MPoly *polys = BKE_mesh_polys(mesh); - const MLoop *loops = BKE_mesh_loops(mesh); + const int *corner_verts = BKE_mesh_corner_verts(mesh); - MDisps *mdisps = CustomData_get_layer_for_write(>ldata, CD_MDISPS, mesh->totloop); + MDisps *mdisps = static_cast( + CustomData_get_layer_for_write(>ldata, CD_MDISPS, mesh->totloop)); const int totpoly = mesh->totpoly; for (int p = 0; p < totpoly; p++) { const MPoly *poly = [p]; diff --cc source/blender/blenkernel/intern/multires_reshape_util.cc index ce5bed1cecf,aa0fcbb7147..460446f52bf --- a/source/blender/blenkernel/intern/multires_reshape_util.cc +++ b/source/blender/blenkernel/intern/multires_reshape_util.cc @@@ -157,10 -158,9 +158,10 @@@ bool multires_reshape_context_create_fr reshape_context->base_positions = BKE_mesh_vert_positions(base_mesh); reshape_context->base_edges = BKE_mesh_edges(base_mesh); reshape_context->base_polys = BKE_mesh_polys(base_mesh); - reshape_context->base_loops = BKE_mesh_loops(base_mesh); + reshape_context->base_corner_verts = BKE_mesh_corner_verts(base_mesh); + reshape_context->base_corner_edges = BKE_mesh_corner_edges(base_mesh); - reshape_context->subdiv = multires_reshape_create_subdiv(NULL, object, mmd); + reshape_context->subdiv = multires_reshape_create_subdiv(nullptr, object, mmd); reshape_context->need_free_subdiv = true; reshape_context->reshape.level = multires_get_level( diff --cc source/blender/blenkernel/intern/pbvh_pixels.cc index 39301d43eea,b1d635f566e..14a169c84ee --- a/source/blender/blenkernel/intern/pbvh_pixels.cc +++ b/source/blender/blenkernel/intern/pbvh_pixels.cc @@@ -366,7 -366,11 +366,11 @@@ static void update_pixels(PBVH *pbvh, M const VArraySpan uv_map = attributes.lookup(active_uv_name, ATTR_DOMAIN_CORNER); uv_islands::MeshData mesh_data( - {pbvh->looptri, pbvh->totprim}, {pbvh->corner_verts, mesh->totloop}, pbvh->totvert, uv_map); + {pbvh->looptri, pbvh->totprim}, - {pbvh->mloop, mesh->totloop}, ++ {pbvh->corner_verts, mesh->totloop}, + pbvh->totvert, + uv_map, + {static_cast(static_cast(pbvh->vert_positions)), pbvh->totvert}); uv_islands::UVIslands islands(mesh_data); uv_islands::UVIslandsMask uv_masks; diff --cc source/blender/blenkernel/intern/pbvh_uv_islands.cc index 7374631c2ff,16091b32917..bf40bdbd475 --- a/source/blender/blenkernel/intern/pbvh_uv_islands.cc +++ b/source/blender/blenkernel/intern/pbvh_uv_islands.cc @@@ -208,13 -208,15 +208,15 @@@ static void mesh_data_init(MeshData } MeshData::MeshData(const Span looptris, - const Span loops, + const Span corner_verts, const int verts_num, -const Span uv_map) +const Span uv_map, +const Span
[Bf-blender-cvs] [60ea01aa30d] master: Cleanup: Move four sculpt/paint files to C++
Commit: 60ea01aa30d36a5bb81649142d38786d00fa3481 Author: Hans Goudey Date: Fri Jan 20 11:55:43 2023 -0600 Branches: master https://developer.blender.org/rB60ea01aa30d36a5bb81649142d38786d00fa3481 Cleanup: Move four sculpt/paint files to C++ For continued refactoring of the Mesh data structure. See T103343. === M source/blender/editors/sculpt_paint/CMakeLists.txt R088source/blender/editors/sculpt_paint/paint_mask.c source/blender/editors/sculpt_paint/paint_mask.cc R087source/blender/editors/sculpt_paint/paint_vertex_weight_ops.c source/blender/editors/sculpt_paint/paint_vertex_weight_ops.cc R094source/blender/editors/sculpt_paint/sculpt_expand.c source/blender/editors/sculpt_paint/sculpt_expand.cc R096source/blender/editors/sculpt_paint/sculpt_geodesic.c source/blender/editors/sculpt_paint/sculpt_geodesic.cc === diff --git a/source/blender/editors/sculpt_paint/CMakeLists.txt b/source/blender/editors/sculpt_paint/CMakeLists.txt index 62a07310106..35fc4ba705e 100644 --- a/source/blender/editors/sculpt_paint/CMakeLists.txt +++ b/source/blender/editors/sculpt_paint/CMakeLists.txt @@ -51,14 +51,14 @@ set(SRC paint_image_2d_curve_mask.cc paint_image_ops_paint.cc paint_image_proj.cc - paint_mask.c + paint_mask.cc paint_ops.c paint_stroke.c paint_utils.c paint_vertex.cc paint_vertex_color_ops.cc paint_vertex_proj.c - paint_vertex_weight_ops.c + paint_vertex_weight_ops.cc paint_vertex_weight_utils.c sculpt.cc sculpt_automasking.cc @@ -67,12 +67,12 @@ set(SRC sculpt_cloth.c sculpt_detail.c sculpt_dyntopo.cc - sculpt_expand.c + sculpt_expand.cc sculpt_face_set.cc sculpt_filter_color.c sculpt_filter_mask.c sculpt_filter_mesh.c - sculpt_geodesic.c + sculpt_geodesic.cc sculpt_mask_expand.c sculpt_mask_init.c sculpt_multiplane_scrape.c diff --git a/source/blender/editors/sculpt_paint/paint_mask.c b/source/blender/editors/sculpt_paint/paint_mask.cc similarity index 88% rename from source/blender/editors/sculpt_paint/paint_mask.c rename to source/blender/editors/sculpt_paint/paint_mask.cc index 26d3b4fead9..c0f4ddf4218 100644 --- a/source/blender/editors/sculpt_paint/paint_mask.c +++ b/source/blender/editors/sculpt_paint/paint_mask.cc @@ -5,6 +5,8 @@ * \ingroup edsculpt */ +#include + #include "MEM_guardedalloc.h" #include "DNA_mesh_types.h" @@ -13,7 +15,6 @@ #include "DNA_object_types.h" #include "DNA_vec_types.h" -#include "BLI_alloca.h" #include "BLI_bitmap_draw_2d.h" #include "BLI_lasso_2d.h" #include "BLI_math_geom.h" @@ -53,8 +54,6 @@ /* For undo push. */ #include "sculpt_intern.h" -#include - static const EnumPropertyItem mode_items[] = { {PAINT_MASK_FLOOD_VALUE, "VALUE", @@ -84,7 +83,7 @@ static void mask_flood_fill_set_elem(float *elem, PaintMaskFloodMode mode, float } } -typedef struct MaskTaskData { +struct MaskTaskData { Object *ob; PBVH *pbvh; PBVHNode **nodes; @@ -96,13 +95,13 @@ typedef struct MaskTaskData { bool front_faces_only; float view_normal[3]; -} MaskTaskData; +}; static void mask_flood_fill_task_cb(void *__restrict userdata, const int i, -const TaskParallelTLS *__restrict UNUSED(tls)) +const TaskParallelTLS *__restrict /*tls*/) { - MaskTaskData *data = userdata; + MaskTaskData *data = static_cast(userdata); PBVHNode *node = data->nodes[i]; @@ -136,15 +135,13 @@ static int mask_flood_fill_exec(bContext *C, wmOperator *op) const Scene *scene = CTX_data_scene(C); Object *ob = CTX_data_active_object(C); Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C); - PaintMaskFloodMode mode; - float value; PBVH *pbvh; PBVHNode **nodes; int totnode; bool multires; - mode = RNA_enum_get(op->ptr, "mode"); - value = RNA_float_get(op->ptr, "value"); + PaintMaskFloodMode mode = PaintMaskFloodMode(RNA_enum_get(op->ptr, "mode")); + float value = RNA_float_get(op->ptr, "value"); MultiresModifierData *mmd = BKE_sculpt_multires_active(scene, ob); BKE_sculpt_mask_layers_ensure(depsgraph, CTX_data_main(C), ob, mmd); @@ -153,18 +150,17 @@ static int mask_flood_fill_exec(bContext *C, wmOperator *op) pbvh = ob->sculpt->pbvh; multires = (BKE_pbvh_type(pbvh) == PBVH_GRIDS); - BKE_pbvh_search_gather(pbvh, NULL, NULL, , ); + BKE_pbvh_search_gather(pbvh, nullptr, nullptr, , ); SCULPT_undo_push_begin(ob, op); - MaskTaskData data = { - .ob = ob, - .pbvh = pbvh, - .nodes = nodes, - .multires = multires, - .mode = mode, - .value = value, - }; + MaskTaskData data{}; + data.ob = ob; + data.pbvh = pbvh; + data.nodes = nodes; + data.multires = multires; + data.mode = mode; + data.value = value;
[Bf-blender-cvs] [f31f7e3ef0b] master: Cleanup: Remove unused light_sample_is_light() function.
Commit: f31f7e3ef0bd0a079182328eef5458fcef38f7b0 Author: Thomas Dinges Date: Fri Jan 20 17:36:48 2023 +0100 Branches: master https://developer.blender.org/rBf31f7e3ef0bd0a079182328eef5458fcef38f7b0 Cleanup: Remove unused light_sample_is_light() function. This also fixes compile warnings on MSVC. === M intern/cycles/kernel/integrator/shade_surface.h M intern/cycles/kernel/integrator/shade_volume.h M intern/cycles/kernel/light/sample.h === diff --git a/intern/cycles/kernel/integrator/shade_surface.h b/intern/cycles/kernel/integrator/shade_surface.h index 09433caa063..dbeb5f91ce7 100644 --- a/intern/cycles/kernel/integrator/shade_surface.h +++ b/intern/cycles/kernel/integrator/shade_surface.h @@ -235,8 +235,6 @@ ccl_device_forceinline void integrate_surface_direct_light(KernelGlobals kg, light_sample_to_surface_shadow_ray(kg, sd, , ); } - const bool is_light = light_sample_is_light(); - /* Branch off shadow kernel. */ IntegratorShadowState shadow_state = integrator_shadow_path_init( kg, state, DEVICE_KERNEL_INTEGRATOR_INTERSECT_SHADOW, false); diff --git a/intern/cycles/kernel/integrator/shade_volume.h b/intern/cycles/kernel/integrator/shade_volume.h index 98dc5603a78..5b460a2fe7a 100644 --- a/intern/cycles/kernel/integrator/shade_volume.h +++ b/intern/cycles/kernel/integrator/shade_volume.h @@ -821,7 +821,6 @@ ccl_device_forceinline void integrate_volume_direct_light( /* Create shadow ray. */ Ray ray ccl_optional_struct_init; light_sample_to_volume_shadow_ray(kg, sd, , P, ); - const bool is_light = light_sample_is_light(); /* Branch off shadow kernel. */ IntegratorShadowState shadow_state = integrator_shadow_path_init( diff --git a/intern/cycles/kernel/light/sample.h b/intern/cycles/kernel/light/sample.h index 423024c6b3d..f56ca19e968 100644 --- a/intern/cycles/kernel/light/sample.h +++ b/intern/cycles/kernel/light/sample.h @@ -88,13 +88,6 @@ light_sample_shader_eval(KernelGlobals kg, return eval; } -/* Test if light sample is from a light or emission from geometry. */ -ccl_device_inline bool light_sample_is_light(ccl_private const LightSample *ccl_restrict ls) -{ - /* return if it's a lamp for shadow pass */ - return (ls->prim == PRIM_NONE && ls->type != LIGHT_BACKGROUND); -} - /* Early path termination of shadow rays. */ ccl_device_inline bool light_sample_terminate(KernelGlobals kg, ccl_private const LightSample *ccl_restrict ls, ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org List details, subscription details or unsubscribe: https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [70ca15670d9] master: Curves: Edit mode selection operators
Commit: 70ca15670d9f6d7179d1fe150939582c91174c29 Author: Falk David Date: Fri Jan 20 16:40:51 2023 +0100 Branches: master https://developer.blender.org/rB70ca15670d9f6d7179d1fe150939582c91174c29 Curves: Edit mode selection operators This adds the following operators to edit mode: - `select_all` - `select_random` - `select_end` Differential Revision: https://developer.blender.org/D17047 === M release/scripts/modules/bl_keymap_utils/keymap_hierarchy.py M release/scripts/presets/keyconfig/keymap_data/blender_default.py M release/scripts/startup/bl_ui/space_view3d.py M source/blender/editors/curves/intern/curves_ops.cc M source/blender/editors/curves/intern/curves_selection.cc M source/blender/editors/include/ED_curves.h M source/blender/editors/sculpt_paint/curves_sculpt_ops.cc M source/blender/editors/space_api/spacetypes.c M source/blender/editors/space_view3d/space_view3d.cc === diff --git a/release/scripts/modules/bl_keymap_utils/keymap_hierarchy.py b/release/scripts/modules/bl_keymap_utils/keymap_hierarchy.py index 7172d7809f2..f183877749c 100644 --- a/release/scripts/modules/bl_keymap_utils/keymap_hierarchy.py +++ b/release/scripts/modules/bl_keymap_utils/keymap_hierarchy.py @@ -55,6 +55,7 @@ _km_hierarchy = [ ('Curve', 'EMPTY', 'WINDOW', [ _km_expand_from_toolsystem('VIEW_3D', 'EDIT_CURVE'), ]), +('Curves', 'EMPTY', 'WINDOW', []), ('Armature', 'EMPTY', 'WINDOW', [ _km_expand_from_toolsystem('VIEW_3D', 'EDIT_ARMATURE'), ]), diff --git a/release/scripts/presets/keyconfig/keymap_data/blender_default.py b/release/scripts/presets/keyconfig/keymap_data/blender_default.py index 19093e51ec5..4149377581c 100644 --- a/release/scripts/presets/keyconfig/keymap_data/blender_default.py +++ b/release/scripts/presets/keyconfig/keymap_data/blender_default.py @@ -5615,6 +5615,14 @@ def km_curves(params): {"items": items}, ) +items.extend([ +("curves.set_selection_domain", {"type": 'ONE', "value": 'PRESS'}, {"properties": [("domain", 'POINT')]}), +("curves.set_selection_domain", {"type": 'TWO', "value": 'PRESS'}, {"properties": [("domain", 'CURVE')]}), +("curves.disable_selection", {"type": 'ONE', "value": 'PRESS', "alt": True}, None), +("curves.disable_selection", {"type": 'TWO', "value": 'PRESS', "alt": True}, None), +*_template_items_select_actions(params, "curves.select_all"), +]) + return keymap diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py index 3bb009dd2ad..938399485d3 100644 --- a/release/scripts/startup/bl_ui/space_view3d.py +++ b/release/scripts/startup/bl_ui/space_view3d.py @@ -718,7 +718,7 @@ class VIEW3D_HT_header(Header): if object_mode == 'PARTICLE_EDIT': row = layout.row() row.prop(tool_settings.particle_edit, "select_mode", text="", expand=True) -elif object_mode == 'SCULPT_CURVES' and obj.type == 'CURVES': +elif object_mode in {'EDIT', 'SCULPT_CURVES'} and obj.type == 'CURVES': curves = obj.data row = layout.row(align=True) @@ -2044,7 +2044,13 @@ class VIEW3D_MT_select_edit_curves(Menu): bl_label = "Select" def draw(self, _context): -pass +layout = self.layout + +layout.operator("curves.select_all", text="All").action = 'SELECT' +layout.operator("curves.select_all", text="None").action = 'DESELECT' +layout.operator("curves.select_all", text="Invert").action = 'INVERT' +layout.operator("curves.select_random", text="Random") +layout.operator("curves.select_end", text="Endpoints") class VIEW3D_MT_select_sculpt_curves(Menu): @@ -2057,7 +2063,7 @@ class VIEW3D_MT_select_sculpt_curves(Menu): layout.operator("curves.select_all", text="None").action = 'DESELECT' layout.operator("curves.select_all", text="Invert").action = 'INVERT' layout.operator("sculpt_curves.select_random", text="Random") -layout.operator("sculpt_curves.select_end", text="Endpoints") +layout.operator("curves.select_end", text="Endpoints") layout.operator("sculpt_curves.select_grow", text="Grow") diff --git a/source/blender/editors/curves/intern/curves_ops.cc b/source/blender/editors/curves/intern/curves_ops.cc index 24aa362b973..d0a68774c71 100644 --- a/source/blender/editors/curves/intern/curves_ops.cc +++ b/source/blender/editors/curves/intern/curves_ops.cc @@ -7,7 +7,10 @@ #include #include "BLI_array_utils.hh" +#include "BLI_devirtualize_parameters.hh" #include "BLI_index_mask_ops.hh" +#include "BLI_kdtree.h" +#include "BLI_rand.hh" #include "BLI_utildefines.h" #include "BLI_vector_set.hh" @@
[Bf-blender-cvs] [d650162ecd4] master: Curves: Add initial undo system
Commit: d650162ecd47d6c12e1d66ffbd413e4f3acb120d Author: Falk David Date: Fri Jan 20 16:32:25 2023 +0100 Branches: master https://developer.blender.org/rBd650162ecd47d6c12e1d66ffbd413e4f3acb120d Curves: Add initial undo system This adds an `UndoType` for the `Curves` object, for edit mode. For now, this will only store the `CurvesGeometry` at every step. Other properties such as the `selection_domain` or the `surface` object will have to be dealt with in subsequent commits. Differential Revision: https://developer.blender.org/D16979 === M source/blender/editors/curves/CMakeLists.txt M source/blender/editors/curves/intern/curves_ops.cc A source/blender/editors/curves/intern/curves_undo.cc M source/blender/editors/include/ED_curves.h M source/blender/editors/undo/CMakeLists.txt M source/blender/editors/undo/undo_system_types.c === diff --git a/source/blender/editors/curves/CMakeLists.txt b/source/blender/editors/curves/CMakeLists.txt index bba85f9c77a..873df89b40c 100644 --- a/source/blender/editors/curves/CMakeLists.txt +++ b/source/blender/editors/curves/CMakeLists.txt @@ -12,6 +12,7 @@ set(INC ../../makesdna ../../makesrna ../../windowmanager + ../../../../intern/clog ../../../../intern/guardedalloc ../../bmesh @@ -24,6 +25,7 @@ set(SRC intern/curves_data.cc intern/curves_ops.cc intern/curves_selection.cc + intern/curves_undo.cc ) set(LIB diff --git a/source/blender/editors/curves/intern/curves_ops.cc b/source/blender/editors/curves/intern/curves_ops.cc index d084317014d..24aa362b973 100644 --- a/source/blender/editors/curves/intern/curves_ops.cc +++ b/source/blender/editors/curves/intern/curves_ops.cc @@ -60,7 +60,7 @@ namespace blender::ed::curves { -static bool object_has_editable_curves(const Main , const Object ) +bool object_has_editable_curves(const Main , const Object ) { if (object.type != OB_CURVES) { return false; @@ -95,7 +95,10 @@ VectorSet get_unique_editable_curves(const bContext ) return unique_curves; } -static bool curves_poll_impl(bContext *C, const bool check_editable, const bool check_surface) +static bool curves_poll_impl(bContext *C, + const bool check_editable, + const bool check_surface, + const bool check_edit_mode) { Object *object = CTX_data_active_object(C); if (object == nullptr || object->type != OB_CURVES) { @@ -113,27 +116,37 @@ static bool curves_poll_impl(bContext *C, const bool check_editable, const bool return false; } } + if (check_edit_mode) { +if ((object->mode & OB_MODE_EDIT) == 0) { + return false; +} + } return true; } +bool editable_curves_in_edit_mode_poll(bContext *C) +{ + return curves_poll_impl(C, true, false, true); +} + bool editable_curves_with_surface_poll(bContext *C) { - return curves_poll_impl(C, true, true); + return curves_poll_impl(C, true, true, false); } bool curves_with_surface_poll(bContext *C) { - return curves_poll_impl(C, false, true); + return curves_poll_impl(C, false, true, false); } bool editable_curves_poll(bContext *C) { - return curves_poll_impl(C, false, false); + return curves_poll_impl(C, false, false, false); } bool curves_poll(bContext *C) { - return curves_poll_impl(C, false, false); + return curves_poll_impl(C, false, false, false); } using bke::CurvesGeometry; diff --git a/source/blender/editors/curves/intern/curves_undo.cc b/source/blender/editors/curves/intern/curves_undo.cc new file mode 100644 index 000..551fbadfefc --- /dev/null +++ b/source/blender/editors/curves/intern/curves_undo.cc @@ -0,0 +1,141 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +/** \file + * \ingroup edcurves + */ + +#include "BKE_context.h" +#include "BKE_curves.hh" +#include "BKE_main.h" +#include "BKE_object.h" +#include "BKE_undo_system.h" + +#include "CLG_log.h" + +#include "DEG_depsgraph.h" + +#include "ED_curves.h" +#include "ED_undo.h" + +#include "MEM_guardedalloc.h" + +#include "WM_api.h" +#include "WM_types.h" + +static CLG_LogRef LOG = {"ed.undo.curves"}; + +namespace blender::ed::curves::undo { + +/* */ +/** \name Implements ED Undo System + * + * \note This is similar for all edit-mode types. + * \{ */ + +struct StepObject { + UndoRefID_Object obedit_ref = {}; + bke::CurvesGeometry geometry = {}; +}; + +struct CurvesUndoStep { + UndoStep step; + Array objects; +}; + +static bool step_encode(bContext *C, Main *bmain, UndoStep *us_p) +{ + CurvesUndoStep *us = reinterpret_cast(us_p); + + const Scene *scene = CTX_data_scene(C); + ViewLayer *view_layer = CTX_data_view_layer(C); + uint objects_num = 0; + Object **objects = ED_undo_editmode_objects_from_view_layer(scene,
[Bf-blender-cvs] [c07fdad03de] master: Cleanup: Move multires files to C++
Commit: c07fdad03deb2d86d7c5b43028f5f2f8190ee5da Author: Hans Goudey Date: Fri Jan 20 07:59:38 2023 -0600 Branches: master https://developer.blender.org/rBc07fdad03deb2d86d7c5b43028f5f2f8190ee5da Cleanup: Move multires files to C++ For continued refactoring of the Mesh data structure. See T103343. === M source/blender/blenkernel/BKE_multires.h M source/blender/blenkernel/CMakeLists.txt R083source/blender/blenkernel/intern/multires_reshape.c source/blender/blenkernel/intern/multires_reshape.cc R090source/blender/blenkernel/intern/multires_reshape_apply_base.c source/blender/blenkernel/intern/multires_reshape_apply_base.cc R086source/blender/blenkernel/intern/multires_reshape_ccg.c source/blender/blenkernel/intern/multires_reshape_ccg.cc R083source/blender/blenkernel/intern/multires_reshape_smooth.c source/blender/blenkernel/intern/multires_reshape_smooth.cc R091source/blender/blenkernel/intern/multires_reshape_subdivide.c source/blender/blenkernel/intern/multires_reshape_subdivide.cc R084source/blender/blenkernel/intern/multires_reshape_util.c source/blender/blenkernel/intern/multires_reshape_util.cc R071source/blender/blenkernel/intern/multires_reshape_vertcos.c source/blender/blenkernel/intern/multires_reshape_vertcos.cc R100source/blender/blenkernel/intern/multires_subdiv.c source/blender/blenkernel/intern/multires_subdiv.cc R092source/blender/blenkernel/intern/multires_unsubdivide.c source/blender/blenkernel/intern/multires_unsubdivide.cc R081source/blender/blenkernel/intern/multires_versioning.c source/blender/blenkernel/intern/multires_versioning.cc M source/blender/blenkernel/intern/subdiv_converter.h === diff --git a/source/blender/blenkernel/BKE_multires.h b/source/blender/blenkernel/BKE_multires.h index 7c8c13ac8b2..5faafbe957c 100644 --- a/source/blender/blenkernel/BKE_multires.h +++ b/source/blender/blenkernel/BKE_multires.h @@ -156,7 +156,7 @@ void old_mdisps_bilinear(float out[3], float (*disps)[3], int st, float u, float int mdisp_rot_face_to_crn( struct MPoly *mpoly, int face_side, float u, float v, float *x, float *y); -/* Reshaping, define in multires_reshape.c */ +/* Reshaping, define in multires_reshape.cc */ bool multiresModifier_reshapeFromVertcos(struct Depsgraph *depsgraph, struct Object *object, @@ -204,7 +204,7 @@ void multiresModifier_subdivide_to_level(struct Object *object, int top_level, eMultiresSubdivideModeType mode); -/* Subdivision integration, defined in multires_subdiv.c */ +/* Subdivision integration, defined in multires_subdiv.cc */ struct SubdivSettings; struct SubdivToMeshSettings; diff --git a/source/blender/blenkernel/CMakeLists.txt b/source/blender/blenkernel/CMakeLists.txt index 77c16b6924c..bfef13649e3 100644 --- a/source/blender/blenkernel/CMakeLists.txt +++ b/source/blender/blenkernel/CMakeLists.txt @@ -216,16 +216,16 @@ set(SRC intern/modifier.cc intern/movieclip.c intern/multires.cc - intern/multires_reshape.c - intern/multires_reshape_apply_base.c - intern/multires_reshape_ccg.c - intern/multires_reshape_smooth.c - intern/multires_reshape_subdivide.c - intern/multires_reshape_util.c - intern/multires_reshape_vertcos.c - intern/multires_subdiv.c - intern/multires_unsubdivide.c - intern/multires_versioning.c + intern/multires_reshape.cc + intern/multires_reshape_apply_base.cc + intern/multires_reshape_ccg.cc + intern/multires_reshape_smooth.cc + intern/multires_reshape_subdivide.cc + intern/multires_reshape_util.cc + intern/multires_reshape_vertcos.cc + intern/multires_subdiv.cc + intern/multires_unsubdivide.cc + intern/multires_versioning.cc intern/nla.c intern/node.cc intern/node_runtime.cc diff --git a/source/blender/blenkernel/intern/multires_reshape.c b/source/blender/blenkernel/intern/multires_reshape.cc similarity index 83% rename from source/blender/blenkernel/intern/multires_reshape.c rename to source/blender/blenkernel/intern/multires_reshape.cc index 17e4860ab1b..522e7632b94 100644 --- a/source/blender/blenkernel/intern/multires_reshape.c +++ b/source/blender/blenkernel/intern/multires_reshape.cc @@ -30,9 +30,9 @@ /** \name Reshape from object * \{ */ -bool multiresModifier_reshapeFromVertcos(struct Depsgraph *depsgraph, - struct Object *object, - struct MultiresModifierData *mmd, +bool multiresModifier_reshapeFromVertcos(Depsgraph *depsgraph, + Object *object, + MultiresModifierData *mmd, const float (*vert_coords)[3],
[Bf-blender-cvs] [99e5f4000c5] tmp-workbench-rewrite2: Add texture usage flags
Commit: 99e5f4000c5d6dcca44fe4018c87d37f1a833ea3 Author: Miguel Pozo Date: Thu Jan 19 16:58:51 2023 +0100 Branches: tmp-workbench-rewrite2 https://developer.blender.org/rB99e5f4000c5d6dcca44fe4018c87d37f1a833ea3 Add texture usage flags === M source/blender/draw/engines/workbench/workbench_effect_antialiasing.cc M source/blender/draw/engines/workbench/workbench_effect_dof.cc M source/blender/draw/engines/workbench/workbench_engine.cc M source/blender/draw/engines/workbench/workbench_mesh_passes.cc M source/blender/draw/engines/workbench/workbench_resources.cc === diff --git a/source/blender/draw/engines/workbench/workbench_effect_antialiasing.cc b/source/blender/draw/engines/workbench/workbench_effect_antialiasing.cc index 39b46c7ac1e..6b0b2e75c27 100644 --- a/source/blender/draw/engines/workbench/workbench_effect_antialiasing.cc +++ b/source/blender/draw/engines/workbench/workbench_effect_antialiasing.cc @@ -112,11 +112,12 @@ AntiAliasingPass::AntiAliasingPass() smaa_aa_weight_sh_ = GPU_shader_create_from_info_name("workbench_smaa_stage_1"); smaa_resolve_sh_ = GPU_shader_create_from_info_name("workbench_smaa_stage_2"); - smaa_search_tx_.ensure_2d(GPU_R8, {SEARCHTEX_WIDTH, SEARCHTEX_HEIGHT}); + smaa_search_tx_.ensure_2d( + GPU_R8, {SEARCHTEX_WIDTH, SEARCHTEX_HEIGHT}, GPU_TEXTURE_USAGE_SHADER_READ); GPU_texture_update(smaa_search_tx_, GPU_DATA_UBYTE, searchTexBytes); GPU_texture_filter_mode(smaa_search_tx_, true); - smaa_area_tx_.ensure_2d(GPU_RG8, {AREATEX_WIDTH, AREATEX_HEIGHT}); + smaa_area_tx_.ensure_2d(GPU_RG8, {AREATEX_WIDTH, AREATEX_HEIGHT}, GPU_TEXTURE_USAGE_SHADER_READ); GPU_texture_update(smaa_area_tx_, GPU_DATA_UBYTE, areaTexBytes); GPU_texture_filter_mode(smaa_area_tx_, true); } @@ -144,8 +145,11 @@ void AntiAliasingPass::sync(SceneResources , int2 resolution) return; } - taa_accumulation_tx_.ensure_2d(GPU_RGBA16F, resolution); - sample0_depth_tx_.ensure_2d(GPU_DEPTH24_STENCIL8, resolution); + taa_accumulation_tx_.ensure_2d( + GPU_RGBA16F, resolution, GPU_TEXTURE_USAGE_SHADER_READ | GPU_TEXTURE_USAGE_ATTACHMENT); + sample0_depth_tx_.ensure_2d(GPU_DEPTH24_STENCIL8, + resolution, + GPU_TEXTURE_USAGE_SHADER_READ | GPU_TEXTURE_USAGE_ATTACHMENT); taa_accumulation_ps_.init(); taa_accumulation_ps_.state_set(sample_ == 0 ? DRW_STATE_WRITE_COLOR : @@ -279,13 +283,15 @@ void AntiAliasingPass::draw(Manager , } if (!DRW_state_is_image_render() || last_sample) { -smaa_weight_tx_.acquire(resolution, GPU_RGBA8); +smaa_weight_tx_.acquire( +resolution, GPU_RGBA8, GPU_TEXTURE_USAGE_SHADER_READ | GPU_TEXTURE_USAGE_ATTACHMENT); smaa_mix_factor_ = 1.0f - clamp_f(sample_ / 4.0f, 0.0f, 1.0f); smaa_viewport_metrics_ = float4(float2(1.0f / float2(resolution)), resolution); /* After a certain point SMAA is no longer necessary. */ if (smaa_mix_factor_ > 0.0f) { - smaa_edge_tx_.acquire(resolution, GPU_RG8); + smaa_edge_tx_.acquire( + resolution, GPU_RG8, GPU_TEXTURE_USAGE_SHADER_READ | GPU_TEXTURE_USAGE_ATTACHMENT); smaa_edge_fb_.ensure(GPU_ATTACHMENT_NONE, GPU_ATTACHMENT_TEXTURE(smaa_edge_tx_)); smaa_edge_fb_.bind(); manager.submit(smaa_edge_detect_ps_, view); diff --git a/source/blender/draw/engines/workbench/workbench_effect_dof.cc b/source/blender/draw/engines/workbench/workbench_effect_dof.cc index 582adeb4ed9..7d46703ad35 100644 --- a/source/blender/draw/engines/workbench/workbench_effect_dof.cc +++ b/source/blender/draw/engines/workbench/workbench_effect_dof.cc @@ -222,7 +222,8 @@ void DofPass::draw(Manager , View , SceneResources , int2 DRW_stats_group_start("Depth Of Field"); int2 half_res = {max_ii(resolution.x / 2, 1), max_ii(resolution.y / 2, 1)}; - blur_tx_.acquire(half_res, GPU_RGBA16F); + blur_tx_.acquire( + half_res, GPU_RGBA16F, GPU_TEXTURE_USAGE_SHADER_READ | GPU_TEXTURE_USAGE_ATTACHMENT); downsample_fb_.ensure(GPU_ATTACHMENT_NONE, GPU_ATTACHMENT_TEXTURE(source_tx_), diff --git a/source/blender/draw/engines/workbench/workbench_engine.cc b/source/blender/draw/engines/workbench/workbench_engine.cc index e917aa1e81e..a1167c75708 100644 --- a/source/blender/draw/engines/workbench/workbench_engine.cc +++ b/source/blender/draw/engines/workbench/workbench_engine.cc @@ -62,7 +62,10 @@ class Instance { { const float2 viewport_size = DRW_viewport_size_get(); const int2 resolution = {int(viewport_size.x), int(viewport_size.y)}; -resources.depth_tx.ensure_2d(GPU_DEPTH24_STENCIL8, resolution); +resources.depth_tx.ensure_2d(GPU_DEPTH24_STENCIL8, + resolution, + GPU_TEXTURE_USAGE_SHADER_READ |
[Bf-blender-cvs] [2c432baad0b] tmp-workbench-rewrite2: Add texture mirror extension type support (see D16432)
Commit: 2c432baad0b4e21c8173d5c66ec07b81c290e16f Author: Miguel Pozo Date: Thu Jan 19 17:07:19 2023 +0100 Branches: tmp-workbench-rewrite2 https://developer.blender.org/rB2c432baad0b4e21c8173d5c66ec07b81c290e16f Add texture mirror extension type support (see D16432) === M source/blender/draw/engines/workbench/workbench_materials_next.cc === diff --git a/source/blender/draw/engines/workbench/workbench_materials_next.cc b/source/blender/draw/engines/workbench/workbench_materials_next.cc index ec42c696ccc..74622882e52 100644 --- a/source/blender/draw/engines/workbench/workbench_materials_next.cc +++ b/source/blender/draw/engines/workbench/workbench_materials_next.cc @@ -69,17 +69,19 @@ void get_material_image(Object *ob, if (node && image) { switch (node->type) { case SH_NODE_TEX_IMAGE: { -NodeTexImage *storage = static_cast(node->storage); +const NodeTexImage *storage = static_cast(node->storage); const bool use_filter = (storage->interpolation != SHD_INTERP_CLOSEST); -const bool use_repeat = (storage->extension == SHD_IMAGE_EXTENSION_REPEAT); +const bool use_mirror = (storage->extension == SHD_IMAGE_EXTENSION_MIRROR); +const bool use_repeat = use_mirror || (storage->extension == SHD_IMAGE_EXTENSION_REPEAT); const bool use_clip = (storage->extension == SHD_IMAGE_EXTENSION_CLIP); SET_FLAG_FROM_TEST(sampler_state, use_filter, GPU_SAMPLER_FILTER); SET_FLAG_FROM_TEST(sampler_state, use_repeat, GPU_SAMPLER_REPEAT); SET_FLAG_FROM_TEST(sampler_state, use_clip, GPU_SAMPLER_CLAMP_BORDER); +SET_FLAG_FROM_TEST(sampler_state, use_mirror, GPU_SAMPLER_MIRROR_REPEAT); break; } case SH_NODE_TEX_ENVIRONMENT: { -NodeTexEnvironment *storage = static_cast(node->storage); +const NodeTexEnvironment *storage = static_cast(node->storage); const bool use_filter = (storage->interpolation != SHD_INTERP_CLOSEST); SET_FLAG_FROM_TEST(sampler_state, use_filter, GPU_SAMPLER_FILTER); break; ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org List details, subscription details or unsubscribe: https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [1b5a594a052] tmp-workbench-rewrite2: Fix textures after D14365
Commit: 1b5a594a0529bf696caa419f26ac34712b5caeb0 Author: Miguel Pozo Date: Thu Jan 19 16:11:09 2023 +0100 Branches: tmp-workbench-rewrite2 https://developer.blender.org/rB1b5a594a0529bf696caa419f26ac34712b5caeb0 Fix textures after D14365 UVs are now stored as generic attributes. === M source/blender/draw/engines/workbench/workbench_state.cc === diff --git a/source/blender/draw/engines/workbench/workbench_state.cc b/source/blender/draw/engines/workbench/workbench_state.cc index 5e0699d0192..8dd20684e71 100644 --- a/source/blender/draw/engines/workbench/workbench_state.cc +++ b/source/blender/draw/engines/workbench/workbench_state.cc @@ -257,8 +257,10 @@ ObjectState::ObjectState(const SceneState _state, Object *ob) CustomData_has_layer(cd_ldata, CD_PROP_COLOR) || CustomData_has_layer(cd_ldata, CD_PROP_BYTE_COLOR)); +bool has_uv = CustomData_has_layer(cd_ldata, CD_PROP_FLOAT2); + if (color_type == V3D_SHADING_TEXTURE_COLOR) { - if (ob->dt < OB_TEXTURE || !CustomData_has_layer(cd_ldata, CD_MLOOPUV)) { + if (ob->dt < OB_TEXTURE || !has_uv) { color_type = V3D_SHADING_MATERIAL_COLOR; } } @@ -275,7 +277,7 @@ ObjectState::ObjectState(const SceneState _state, Object *ob) if (is_vertpaint_mode && has_color) { color_type = V3D_SHADING_VERTEX_COLOR; } - else if (is_texpaint_mode && CustomData_has_layer(cd_ldata, CD_MLOOPUV)) { + else if (is_texpaint_mode && has_uv) { color_type = V3D_SHADING_TEXTURE_COLOR; texture_paint_mode = true; ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org List details, subscription details or unsubscribe: https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [46bc834a3dd] microfacet_hair: Merge branch 'master' into microfacet_hair
Commit: 46bc834a3ddf39ef53ebfd221697ac26ad5c15d5 Author: Weizhen Huang Date: Fri Jan 20 15:18:29 2023 +0100 Branches: microfacet_hair https://developer.blender.org/rB46bc834a3ddf39ef53ebfd221697ac26ad5c15d5 Merge branch 'master' into microfacet_hair === === diff --cc intern/cycles/blender/curves.cpp index ce8a35fb61b,6158ed78598..0b06ab22bbc --- a/intern/cycles/blender/curves.cpp +++ b/intern/cycles/blender/curves.cpp @@@ -895,9 -885,6 +894,14 @@@ static void export_hair_curves(Scene *s float *attr_length = NULL; float *attr_random = NULL; + if (hair->need_attribute(scene, ATTR_STD_VERTEX_NORMAL)) { - attr_normal = hair->attributes.add(ATTR_STD_VERTEX_NORMAL)->data_float3(); ++/* Compute geometry normals. */ ++float3 *attr_normal = hair->attributes.add(ATTR_STD_VERTEX_NORMAL)->data_float3(); ++int i = 0; ++for (BL::FloatVectorValueReadOnly : b_curves.normals) { ++ attr_normal[i++] = get_float3(normal.vector()); ++} + } if (hair->need_attribute(scene, ATTR_STD_CURVE_INTERCEPT)) { attr_intercept = hair->attributes.add(ATTR_STD_CURVE_INTERCEPT)->data_float(); } diff --cc intern/cycles/kernel/closure/bsdf.h index cb797e284a4,2f53454d7dd..8ca750945ff --- a/intern/cycles/kernel/closure/bsdf.h +++ b/intern/cycles/kernel/closure/bsdf.h @@@ -242,14 -220,10 +221,14 @@@ ccl_device_inline int bsdf_sample(Kerne break; case CLOSURE_BSDF_HAIR_PRINCIPLED_ID: label = bsdf_principled_hair_sample( - kg, sc, sd, randu, randv, eval, omega_in, pdf, sampled_roughness, eta); + kg, sc, sd, randu, randv, eval, wo, pdf, sampled_roughness, eta); break; +case CLOSURE_BSDF_HAIR_MICROFACET_ID: + label = bsdf_microfacet_hair_sample( - kg, sc, sd, randu, randv, eval, omega_in, pdf, sampled_roughness, eta); ++ kg, sc, sd, randu, randv, eval, wo, pdf, sampled_roughness, eta); + break; case CLOSURE_BSDF_PRINCIPLED_DIFFUSE_ID: - label = bsdf_principled_diffuse_sample(sc, Ng, sd->I, randu, randv, eval, omega_in, pdf); + label = bsdf_principled_diffuse_sample(sc, Ng, sd->wi, randu, randv, eval, wo, pdf); *sampled_roughness = one_float2(); *eta = 1.0f; break; @@@ -514,8 -483,7 +493,8 @@@ ccl_device_inline int bsdf_label(const label = LABEL_TRANSMIT | LABEL_GLOSSY; break; case CLOSURE_BSDF_HAIR_PRINCIPLED_ID: +case CLOSURE_BSDF_HAIR_MICROFACET_ID: - if (bsdf_is_transmission(sc, omega_in)) + if (bsdf_is_transmission(sc, wo)) label = LABEL_TRANSMIT | LABEL_GLOSSY; else label = LABEL_REFLECT | LABEL_GLOSSY; @@@ -603,37 -571,34 +582,37 @@@ ccl_device_inlin break; case CLOSURE_BSDF_MICROFACET_BECKMANN_ID: case CLOSURE_BSDF_MICROFACET_BECKMANN_REFRACTION_ID: - eval = bsdf_microfacet_beckmann_eval(sc, sd->N, sd->I, omega_in, pdf); + eval = bsdf_microfacet_beckmann_eval(sc, sd->N, sd->wi, wo, pdf); break; case CLOSURE_BSDF_ASHIKHMIN_SHIRLEY_ID: - eval = bsdf_ashikhmin_shirley_eval(sc, sd->N, sd->I, omega_in, pdf); + eval = bsdf_ashikhmin_shirley_eval(sc, sd->N, sd->wi, wo, pdf); break; case CLOSURE_BSDF_ASHIKHMIN_VELVET_ID: - eval = bsdf_ashikhmin_velvet_eval(sc, sd->I, omega_in, pdf); + eval = bsdf_ashikhmin_velvet_eval(sc, sd->wi, wo, pdf); break; case CLOSURE_BSDF_DIFFUSE_TOON_ID: - eval = bsdf_diffuse_toon_eval(sc, sd->I, omega_in, pdf); + eval = bsdf_diffuse_toon_eval(sc, sd->wi, wo, pdf); break; case CLOSURE_BSDF_GLOSSY_TOON_ID: - eval = bsdf_glossy_toon_eval(sc, sd->I, omega_in, pdf); + eval = bsdf_glossy_toon_eval(sc, sd->wi, wo, pdf); break; case CLOSURE_BSDF_HAIR_PRINCIPLED_ID: - eval = bsdf_principled_hair_eval(kg, sd, sc, omega_in, pdf); + eval = bsdf_principled_hair_eval(kg, sd, sc, wo, pdf); break; +case CLOSURE_BSDF_HAIR_MICROFACET_ID: - eval = bsdf_microfacet_hair_eval(kg, sd, sc, omega_in, pdf); ++ eval = bsdf_microfacet_hair_eval(kg, sd, sc, wo, pdf); + break; case CLOSURE_BSDF_HAIR_REFLECTION_ID: - eval = bsdf_hair_reflection_eval(sc, sd->I, omega_in, pdf); + eval = bsdf_hair_reflection_eval(sc, sd->wi, wo, pdf); break; case CLOSURE_BSDF_HAIR_TRANSMISSION_ID: - eval = bsdf_hair_transmission_eval(sc, sd->I, omega_in, pdf); + eval = bsdf_hair_transmission_eval(sc, sd->wi, wo, pdf); break; case CLOSURE_BSDF_PRINCIPLED_DIFFUSE_ID: - eval = bsdf_principled_diffuse_eval(sc, sd->I, omega_in, pdf); + eval = bsdf_principled_diffuse_eval(sc, sd->wi, wo, pdf); break; case CLOSURE_BSDF_PRINCIPLED_SHEEN_ID: - eval = bsdf_principled_sheen_eval(sc, sd->I, omega_in, pdf); + eval
[Bf-blender-cvs] [c8a10c43b13] master: Geometry Nodes: show number of curve points in socket inspection tooltip
Commit: c8a10c43b13e109ec1bd78eedeea318be2c22980 Author: Jacques Lucke Date: Fri Jan 20 14:44:37 2023 +0100 Branches: master https://developer.blender.org/rBc8a10c43b13e109ec1bd78eedeea318be2c22980 Geometry Nodes: show number of curve points in socket inspection tooltip This was not done originally, because one had to iterate over all curves to get the number of points which had some overhead. Now the number of points is stored all the time anyway. === M source/blender/editors/space_node/node_draw.cc M source/blender/nodes/NOD_geometry_nodes_log.hh M source/blender/nodes/intern/geometry_nodes_log.cc === diff --git a/source/blender/editors/space_node/node_draw.cc b/source/blender/editors/space_node/node_draw.cc index bc4b6d416c1..53a86e23ce1 100644 --- a/source/blender/editors/space_node/node_draw.cc +++ b/source/blender/editors/space_node/node_draw.cc @@ -945,7 +945,8 @@ static void create_inspection_string_for_geometry_info(const geo_log::GeometryIn char line[256]; BLI_snprintf(line, sizeof(line), - TIP_("\u2022 Curve: %s splines"), + TIP_("\u2022 Curve: %s points, %s splines"), + to_string(curve_info.points_num).c_str(), to_string(curve_info.splines_num).c_str()); ss << line; break; diff --git a/source/blender/nodes/NOD_geometry_nodes_log.hh b/source/blender/nodes/NOD_geometry_nodes_log.hh index 3d453de4b78..9f28bad1630 100644 --- a/source/blender/nodes/NOD_geometry_nodes_log.hh +++ b/source/blender/nodes/NOD_geometry_nodes_log.hh @@ -126,6 +126,7 @@ class GeometryInfoLog : public ValueLog { int verts_num, edges_num, faces_num; }; struct CurveInfo { +int points_num; int splines_num; }; struct PointCloudInfo { diff --git a/source/blender/nodes/intern/geometry_nodes_log.cc b/source/blender/nodes/intern/geometry_nodes_log.cc index 66ccab2f77f..919159a31de 100644 --- a/source/blender/nodes/intern/geometry_nodes_log.cc +++ b/source/blender/nodes/intern/geometry_nodes_log.cc @@ -89,6 +89,7 @@ GeometryInfoLog::GeometryInfoLog(const GeometrySet _set) case GEO_COMPONENT_TYPE_CURVE: { const CurveComponent _component = *(const CurveComponent *)component; CurveInfo = this->curve_info.emplace(); +info.points_num = curve_component.attribute_domain_size(ATTR_DOMAIN_POINT); info.splines_num = curve_component.attribute_domain_size(ATTR_DOMAIN_CURVE); break; } ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org List details, subscription details or unsubscribe: https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [c006ba83e0b] master: Fix: execution graph for geometry nodes contained cycles leading to crash
Commit: c006ba83e0b296983b53d924cfbd0c69aad12de6 Author: Jacques Lucke Date: Fri Jan 20 14:38:09 2023 +0100 Branches: master https://developer.blender.org/rBc006ba83e0b296983b53d924cfbd0c69aad12de6 Fix: execution graph for geometry nodes contained cycles leading to crash The `fix_link_cycles` function added in rB2ffd08e95249df2a068dd did not handle the case correctly when there are multiple cycles going through the same socket. === M source/blender/nodes/intern/geometry_nodes_lazy_function.cc === diff --git a/source/blender/nodes/intern/geometry_nodes_lazy_function.cc b/source/blender/nodes/intern/geometry_nodes_lazy_function.cc index 54f8c3c912d..64551249e29 100644 --- a/source/blender/nodes/intern/geometry_nodes_lazy_function.cc +++ b/source/blender/nodes/intern/geometry_nodes_lazy_function.cc @@ -2571,28 +2571,31 @@ struct GeometryNodesLazyFunctionGraphBuilder { Array socket_states(sockets_num); -Stack lf_sockets_to_check; +Vector lf_sockets_to_check; for (lf::Node *lf_node : lf_graph_->nodes()) { if (lf_node->is_function()) { for (lf::OutputSocket *lf_socket : lf_node->outputs()) { if (lf_socket->targets().is_empty()) { -lf_sockets_to_check.push(lf_socket); +lf_sockets_to_check.append(lf_socket); } } } if (lf_node->outputs().is_empty()) { for (lf::InputSocket *lf_socket : lf_node->inputs()) { - lf_sockets_to_check.push(lf_socket); + lf_sockets_to_check.append(lf_socket); } } } Vector lf_socket_stack; while (!lf_sockets_to_check.is_empty()) { - lf::Socket *lf_inout_socket = lf_sockets_to_check.peek(); + lf::Socket *lf_inout_socket = lf_sockets_to_check.last(); lf::Node _node = lf_inout_socket->node(); SocketState = socket_states[lf_inout_socket->index_in_graph()]; - lf_socket_stack.append(lf_inout_socket); - state.in_stack = true; + + if (!state.in_stack) { +lf_socket_stack.append(lf_inout_socket); +state.in_stack = true; + } Vector lf_origin_sockets; if (lf_inout_socket->is_input()) { @@ -2616,10 +2619,24 @@ struct GeometryNodesLazyFunctionGraphBuilder { } bool pushed_socket = false; + bool detected_cycle = false; for (lf::Socket *lf_origin_socket : lf_origin_sockets) { if (socket_states[lf_origin_socket->index_in_graph()].in_stack) { + /* A cycle has been detected. The cycle is broken by removing a link and replacing it + * with a constant "true" input. This can only affect inputs which determine whether a + * specific value is used. Therefore, setting it to a constant true can result in more + * computation later, but does not change correctness. + * + * After the cycle is broken, the cycle-detection is "rolled back" to the socket where + * the first socket of the cycle was found. This is necessary in case another cycle goes + * through this socket. */ + + detected_cycle = true; + const int index_in_socket_stack = lf_socket_stack.first_index_of(lf_origin_socket); + const int index_in_sockets_to_check = lf_sockets_to_check.first_index_of( + lf_origin_socket); const Span cycle = lf_socket_stack.as_span().drop_front( - lf_socket_stack.first_index_of(lf_origin_socket)); + index_in_socket_stack); bool broke_cycle = false; for (lf::Socket *lf_cycle_socket : cycle) { @@ -2631,23 +2648,35 @@ struct GeometryNodesLazyFunctionGraphBuilder { lf_cycle_input_socket.set_default_value(_true); broke_cycle = true; } +/* This is actually removed from the stack when it is resized below. */ +SocketState _cycle_socket_state = socket_states[lf_cycle_socket->index_in_graph()]; +lf_cycle_socket_state.in_stack = false; } if (!broke_cycle) { BLI_assert_unreachable(); } + /* Roll back algorithm by removing the sockets that corresponded to the cycle from the + * stacks. */ + lf_socket_stack.resize(index_in_socket_stack); + /* The +1 is there so that the socket itself is not removed. */ + lf_sockets_to_check.resize(index_in_sockets_to_check + 1); + break; } else if (!socket_states[lf_origin_socket->index_in_graph()].done) { - lf_sockets_to_check.push(lf_origin_socket); + lf_sockets_to_check.append(lf_origin_socket); pushed_socket = true; } } + if (detected_cycle) { +continue; + } if (pushed_socket) { continue; } state.done = true;
[Bf-blender-cvs] [d79abb5d4f5] master: Fix: missing clamping in single mode in Sample Index node
Commit: d79abb5d4f559fad4d2e057c7d163334ac9c30d8 Author: Jacques Lucke Date: Fri Jan 20 14:33:06 2023 +0100 Branches: master https://developer.blender.org/rBd79abb5d4f559fad4d2e057c7d163334ac9c30d8 Fix: missing clamping in single mode in Sample Index node === M source/blender/nodes/geometry/nodes/node_geo_sample_index.cc === diff --git a/source/blender/nodes/geometry/nodes/node_geo_sample_index.cc b/source/blender/nodes/geometry/nodes/node_geo_sample_index.cc index 2ac19b02f9c..b6267d2439a 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_sample_index.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_sample_index.cc @@ -298,6 +298,7 @@ static void node_geo_exec(GeoNodeExecParams params) const NodeGeometrySampleIndex = node_storage(params.node()); const eCustomDataType data_type = eCustomDataType(storage.data_type); const eAttrDomain domain = eAttrDomain(storage.domain); + const bool use_clamp = bool(storage.clamp); GField value_field = get_input_attribute_field(params, data_type); ValueOrField index_value_or_field = params.extract_input>("Index"); @@ -307,24 +308,33 @@ static void node_geo_exec(GeoNodeExecParams params) if (index_value_or_field.is_field()) { /* If the index is a field, the output has to be a field that still depends on the input. */ auto fn = std::make_shared( -std::move(geometry), std::move(value_field), domain, bool(storage.clamp)); +std::move(geometry), std::move(value_field), domain, use_clamp); auto op = FieldOperation::Create(std::move(fn), {index_value_or_field.as_field()}); output_field = GField(std::move(op)); } else if (const GeometryComponent *component = find_source_component(geometry, domain)) { /* Optimization for the case when the index is a single value. Here only that one index has to * be evaluated. */ -const int index = index_value_or_field.as_value(); -const IndexMask mask = IndexRange(index, 1); -bke::GeometryFieldContext geometry_context(*component, domain); -FieldEvaluator evaluator(geometry_context, ); -evaluator.add(value_field); -evaluator.evaluate(); -const GVArray = evaluator.get_evaluated(0); -BUFFER_FOR_CPP_TYPE_VALUE(cpp_type, buffer); -data.get_to_uninitialized(index, buffer); -output_field = fn::make_constant_field(cpp_type, buffer); -cpp_type.destruct(buffer); +const int domain_size = component->attribute_domain_size(domain); +int index = index_value_or_field.as_value(); +if (use_clamp) { + index = std::clamp(index, 0, domain_size - 1); +} +if (index >= 0 && index < domain_size) { + const IndexMask mask = IndexRange(index, 1); + bke::GeometryFieldContext geometry_context(*component, domain); + FieldEvaluator evaluator(geometry_context, ); + evaluator.add(value_field); + evaluator.evaluate(); + const GVArray = evaluator.get_evaluated(0); + BUFFER_FOR_CPP_TYPE_VALUE(cpp_type, buffer); + data.get_to_uninitialized(index, buffer); + output_field = fn::make_constant_field(cpp_type, buffer); + cpp_type.destruct(buffer); +} +else { + output_field = fn::make_constant_field(cpp_type, cpp_type.default_value()); +} } else { /* Output default value if there is no geometry. */ ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org List details, subscription details or unsubscribe: https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [b6278c5a967] master: Fix: crash when subdividing curves
Commit: b6278c5a9670a550051b9e51f81541392ab16e4a Author: Jacques Lucke Date: Fri Jan 20 14:15:22 2023 +0100 Branches: master https://developer.blender.org/rBb6278c5a9670a550051b9e51f81541392ab16e4a Fix: crash when subdividing curves This was an error in rB38a45e46bc910c68ae3. === M source/blender/geometry/intern/subdivide_curves.cc === diff --git a/source/blender/geometry/intern/subdivide_curves.cc b/source/blender/geometry/intern/subdivide_curves.cc index 99a20b1122d..f062f720366 100644 --- a/source/blender/geometry/intern/subdivide_curves.cc +++ b/source/blender/geometry/intern/subdivide_curves.cc @@ -85,7 +85,7 @@ static void subdivide_attribute_linear(const bke::CurvesGeometry _curves, threading::parallel_for(curve_src.index_range().drop_back(1), 1024, [&](IndexRange range) { for (const int i : range) { - const IndexRange segment_points = curve_offsets[src_segments[i]]; + const IndexRange segment_points = curve_offsets[i]; linear_interpolation(curve_src[i], curve_src[i + 1], curve_dst.slice(segment_points)); } }); ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org List details, subscription details or unsubscribe: https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [31a505d1a5e] master: Functions: add debug utility for lazy function graphs
Commit: 31a505d1a5ead4522460aaaef595ad1dea8841f6 Author: Jacques Lucke Date: Fri Jan 20 13:39:10 2023 +0100 Branches: master https://developer.blender.org/rB31a505d1a5ead4522460aaaef595ad1dea8841f6 Functions: add debug utility for lazy function graphs This makes it easier to print information about a socket. Just the socket name is sometimes not enough information to know where it is in the graph. === M source/blender/functions/FN_lazy_function_graph.hh M source/blender/functions/intern/lazy_function_graph.cc === diff --git a/source/blender/functions/FN_lazy_function_graph.hh b/source/blender/functions/FN_lazy_function_graph.hh index 6d66afafe82..a532f0dc7c3 100644 --- a/source/blender/functions/FN_lazy_function_graph.hh +++ b/source/blender/functions/FN_lazy_function_graph.hh @@ -78,6 +78,7 @@ class Socket : NonCopyable, NonMovable { const CPPType () const; std::string name() const; + std::string detailed_name() const; }; class InputSocket : public Socket { diff --git a/source/blender/functions/intern/lazy_function_graph.cc b/source/blender/functions/intern/lazy_function_graph.cc index e07cce7204b..0047359ed26 100644 --- a/source/blender/functions/intern/lazy_function_graph.cc +++ b/source/blender/functions/intern/lazy_function_graph.cc @@ -147,6 +147,14 @@ std::string Socket::name() const return fallback_name; } +std::string Socket::detailed_name() const +{ + std::stringstream ss; + ss << node_->name() << ":" << (is_input_ ? "IN" : "OUT") << ":" << index_in_node_ << ":" + << this->name(); + return ss.str(); +} + std::string Node::name() const { if (this->is_function()) { ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org List details, subscription details or unsubscribe: https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [1cbdadb7225] cycles_path_guiding: Merge branch 'master' into cycles-path-guiding-main
Commit: 1cbdadb722543a67bc9f2a82ebbb1378527f74da Author: Sebastian Herholz Date: Fri Jan 20 13:28:57 2023 +0100 Branches: cycles_path_guiding https://developer.blender.org/rB1cbdadb722543a67bc9f2a82ebbb1378527f74da Merge branch 'master' into cycles-path-guiding-main === === ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org List details, subscription details or unsubscribe: https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [5218391701b] master: Fix assertion in UV path select
Commit: 5218391701b7a49f24c93078994aa44d82e1c1c2 Author: Campbell Barton Date: Fri Jan 20 22:29:07 2023 +1100 Branches: master https://developer.blender.org/rB5218391701b7a49f24c93078994aa44d82e1c1c2 Fix assertion in UV path select Existing path selection & new path picking included without UV's. Now limit objects to those with UV's. Also remove use of CTX_wm_view3d(C) in the UV editor it would be NULL, but it doesn't makes sense to use the 3D viewport for UV operations even if it was available. === M source/blender/editors/uvedit/uvedit_path.c === diff --git a/source/blender/editors/uvedit/uvedit_path.c b/source/blender/editors/uvedit/uvedit_path.c index e8ba3b0cffd..00d86fef831 100644 --- a/source/blender/editors/uvedit/uvedit_path.c +++ b/source/blender/editors/uvedit/uvedit_path.c @@ -562,8 +562,8 @@ static int uv_shortest_path_pick_invoke(bContext *C, wmOperator *op, const wmEve Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C); ViewLayer *view_layer = CTX_data_view_layer(C); uint objects_len = 0; - Object **objects = BKE_view_layer_array_from_objects_in_edit_mode_unique_data( - scene, view_layer, CTX_wm_view3d(C), _len); + Object **objects = BKE_view_layer_array_from_objects_in_edit_mode_unique_data_with_uvs( + scene, view_layer, NULL, _len); float co[2]; @@ -796,8 +796,8 @@ static int uv_shortest_path_select_exec(bContext *C, wmOperator *op) ViewLayer *view_layer = CTX_data_view_layer(C); uint objects_len = 0; - Object **objects = BKE_view_layer_array_from_objects_in_edit_mode_unique_data( - scene, view_layer, CTX_wm_view3d(C), _len); + Object **objects = BKE_view_layer_array_from_objects_in_edit_mode_unique_data_with_uvs( + scene, view_layer, NULL, _len); for (uint ob_index = 0; ob_index < objects_len; ob_index++) { Object *obedit = objects[ob_index]; BMEditMesh *em = BKE_editmesh_from_object(obedit); ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org List details, subscription details or unsubscribe: https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [453e47eb423] master: Cleanup: suppress clang-tidy warning
Commit: 453e47eb423306af5f6929ad79e7e6d17c7c656d Author: Campbell Barton Date: Fri Jan 20 22:30:25 2023 +1100 Branches: master https://developer.blender.org/rB453e47eb423306af5f6929ad79e7e6d17c7c656d Cleanup: suppress clang-tidy warning === M source/blender/editors/uvedit/uvedit_path.c === diff --git a/source/blender/editors/uvedit/uvedit_path.c b/source/blender/editors/uvedit/uvedit_path.c index 00d86fef831..274196f79a4 100644 --- a/source/blender/editors/uvedit/uvedit_path.c +++ b/source/blender/editors/uvedit/uvedit_path.c @@ -709,6 +709,7 @@ static int uv_shortest_path_pick_exec(bContext *C, wmOperator *op) BMElem *ele_src, *ele_dst; + /* NOLINTBEGIN: bugprone-assignment-in-if-condition */ if (uv_selectmode & UV_SELECT_FACE) { if (index < 0 || index >= bm->totface) { return OPERATOR_CANCELLED; @@ -736,6 +737,7 @@ static int uv_shortest_path_pick_exec(bContext *C, wmOperator *op) return OPERATOR_CANCELLED; } } + /* NOLINTEND: bugprone-assignment-in-if-condition */ /* Always use the active object, not `obedit` as the active defines the UV display. */ const float aspect_y = ED_uvedit_get_aspect_y(CTX_data_edit_object(C)); ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org List details, subscription details or unsubscribe: https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [127eb2e328b] master: Fix: wrong identifier int for interpolate curves node
Commit: 127eb2e328af089176c73ad4e50f54a3600d Author: Jacques Lucke Date: Fri Jan 20 12:16:49 2023 +0100 Branches: master https://developer.blender.org/rB127eb2e328af089176c73ad4e50f54a3600d Fix: wrong identifier int for interpolate curves node This does not break existing files, because the idname is the ground truth. === M source/blender/blenkernel/BKE_node.h === diff --git a/source/blender/blenkernel/BKE_node.h b/source/blender/blenkernel/BKE_node.h index 386fe7fc77f..d57857bfdf3 100644 --- a/source/blender/blenkernel/BKE_node.h +++ b/source/blender/blenkernel/BKE_node.h @@ -1533,6 +1533,7 @@ void BKE_nodetree_remove_layer_n(struct bNodeTree *ntree, struct Scene *scene, i #define GEO_NODE_IMAGE_INFO 1189 #define GEO_NODE_BLUR_ATTRIBUTE 1190 #define GEO_NODE_IMAGE 1191 +#define GEO_NODE_INTERPOLATE_CURVES 1192 /** \} */ @@ -1562,8 +1563,6 @@ void BKE_nodetree_remove_layer_n(struct bNodeTree *ntree, struct Scene *scene, i /** \} */ -#define GEO_NODE_INTERPOLATE_CURVES 2000 - void BKE_node_system_init(void); void BKE_node_system_exit(void); ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org List details, subscription details or unsubscribe: https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [85908e9edf3] master: Geometry Nodes: new Interpolate Curves node
Commit: 85908e9edf3dfefdc36714f07a554f480ff5d230 Author: Jacques Lucke Date: Fri Jan 20 12:09:29 2023 +0100 Branches: master https://developer.blender.org/rB85908e9edf3dfefdc36714f07a554f480ff5d230 Geometry Nodes: new Interpolate Curves node This adds a new `Interpolate Curves` node. It allows generating new curves between a set of existing guide curves. This is essential for procedural hair. Usage: - One has to provide a set of guide curves and a set of root positions for the generated curves. New curves are created starting from these root positions. The N closest guide curves are used for the interpolation. - An additional up vector can be provided for every guide curve and root position. This is typically a surface normal or nothing. This allows generating child curves that are properly oriented based on the surface orientation. - Sometimes a point should only be interpolated using a subset of the guides. This can be achieved using the `Guide Group ID` and `Point Group ID` inputs. The curve generated at a specific point will only take the guides with the same id into account. This allows e.g. for hair parting. - The `Max Neighbors` input limits how many guide curves are taken into account for every interpolated curve. Differential Revision: https://developer.blender.org/D16642 === M release/scripts/startup/bl_ui/node_add_menu_geometry.py M source/blender/blenkernel/BKE_node.h M source/blender/blenlib/BLI_length_parameterize.hh M source/blender/blenlib/BLI_task.hh M source/blender/blenlib/intern/offset_indices.cc M source/blender/nodes/NOD_static_types.h M source/blender/nodes/geometry/CMakeLists.txt M source/blender/nodes/geometry/node_geometry_register.cc M source/blender/nodes/geometry/node_geometry_register.hh A source/blender/nodes/geometry/nodes/node_geo_interpolate_curves.cc M tests/python/CMakeLists.txt === diff --git a/release/scripts/startup/bl_ui/node_add_menu_geometry.py b/release/scripts/startup/bl_ui/node_add_menu_geometry.py index 2554734d903..cdbd05b74a3 100644 --- a/release/scripts/startup/bl_ui/node_add_menu_geometry.py +++ b/release/scripts/startup/bl_ui/node_add_menu_geometry.py @@ -101,6 +101,7 @@ class NODE_MT_geometry_node_GEO_CURVE_OPERATIONS(Menu): node_add_menu.add_node_type(layout, "GeometryNodeDeformCurvesOnSurface") node_add_menu.add_node_type(layout, "GeometryNodeFillCurve") node_add_menu.add_node_type(layout, "GeometryNodeFilletCurve") +node_add_menu.add_node_type(layout, "GeometryNodeInterpolateCurves") node_add_menu.add_node_type(layout, "GeometryNodeResampleCurve") node_add_menu.add_node_type(layout, "GeometryNodeReverseCurve") node_add_menu.add_node_type(layout, "GeometryNodeSampleCurve") diff --git a/source/blender/blenkernel/BKE_node.h b/source/blender/blenkernel/BKE_node.h index 915ca87621a..386fe7fc77f 100644 --- a/source/blender/blenkernel/BKE_node.h +++ b/source/blender/blenkernel/BKE_node.h @@ -1562,6 +1562,8 @@ void BKE_nodetree_remove_layer_n(struct bNodeTree *ntree, struct Scene *scene, i /** \} */ +#define GEO_NODE_INTERPOLATE_CURVES 2000 + void BKE_node_system_init(void); void BKE_node_system_exit(void); diff --git a/source/blender/blenlib/BLI_length_parameterize.hh b/source/blender/blenlib/BLI_length_parameterize.hh index d81bcbe1e7a..df00e004060 100644 --- a/source/blender/blenlib/BLI_length_parameterize.hh +++ b/source/blender/blenlib/BLI_length_parameterize.hh @@ -105,7 +105,7 @@ inline void sample_at_length(const Span accumulated_segment_lengths, BLI_assert(lengths.size() > 0); BLI_assert(sample_length >= 0.0f); - BLI_assert(sample_length <= lengths.last()); + BLI_assert(sample_length <= lengths.last() + 0.1f); if (hint != nullptr && hint->segment_index >= 0) { const float length_in_segment = sample_length - hint->segment_start; diff --git a/source/blender/blenlib/BLI_task.hh b/source/blender/blenlib/BLI_task.hh index e7d9a21439a..c726691ad46 100644 --- a/source/blender/blenlib/BLI_task.hh +++ b/source/blender/blenlib/BLI_task.hh @@ -37,7 +37,7 @@ namespace blender::threading { template -void parallel_for_each(Range , const Function ) +void parallel_for_each(Range &, const Function ) { #ifdef WITH_TBB tbb::parallel_for_each(range, function); diff --git a/source/blender/blenlib/intern/offset_indices.cc b/source/blender/blenlib/intern/offset_indices.cc index fee57e32ffa..2ac11fe631e 100644 --- a/source/blender/blenlib/intern/offset_indices.cc +++ b/source/blender/blenlib/intern/offset_indices.cc @@ -9,7 +9,7 @@ void accumulate_counts_to_offsets(MutableSpan counts_to_offsets, const int int offset = start_offset; for (const int i : counts_to_offsets.index_range().drop_back(1)) { const int count =
[Bf-blender-cvs] [d072764809c] master: Add RNA path functions to AssetMetaData and AssetTag structures.
Commit: d072764809cb29d357073cbd9d187436fe328ec1 Author: Bastien Montagne Date: Fri Jan 20 11:55:56 2023 +0100 Branches: master https://developer.blender.org/rBd072764809cb29d357073cbd9d187436fe328ec1 Add RNA path functions to AssetMetaData and AssetTag structures. === M source/blender/makesrna/intern/rna_asset.c === diff --git a/source/blender/makesrna/intern/rna_asset.c b/source/blender/makesrna/intern/rna_asset.c index 76751f1d9f1..b95800fe934 100644 --- a/source/blender/makesrna/intern/rna_asset.c +++ b/source/blender/makesrna/intern/rna_asset.c @@ -31,6 +31,11 @@ # include "RNA_access.h" +static char *rna_AssetMetaData_path(const PointerRNA *UNUSED(ptr)) +{ + return BLI_strdup("asset_data"); +} + static bool rna_AssetMetaData_editable_from_owner_id(const ID *owner_id, const AssetMetaData *asset_data, const char **r_info) @@ -56,6 +61,12 @@ int rna_AssetMetaData_editable(PointerRNA *ptr, const char **r_info) 0; } +static char *rna_AssetTag_path(const PointerRNA *ptr) +{ + const AssetTag *asset_tag = ptr->data; + return BLI_sprintfN("asset_data.tags['%s']", asset_tag->name); +} + static int rna_AssetTag_editable(PointerRNA *ptr, const char **r_info) { AssetTag *asset_tag = ptr->data; @@ -310,6 +321,7 @@ static void rna_def_asset_tag(BlenderRNA *brna) PropertyRNA *prop; srna = RNA_def_struct(brna, "AssetTag", NULL); + RNA_def_struct_path_func(srna, "rna_AssetTag_path"); RNA_def_struct_ui_text(srna, "Asset Tag", "User defined tag (name token)"); prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE); @@ -361,6 +373,7 @@ static void rna_def_asset_data(BlenderRNA *brna) PropertyRNA *prop; srna = RNA_def_struct(brna, "AssetMetaData", NULL); + RNA_def_struct_path_func(srna, "rna_AssetMetaData_path"); RNA_def_struct_ui_text(srna, "Asset Data", "Additional data stored for an asset data-block"); // RNA_def_struct_ui_icon(srna, ICON_ASSET); /* TODO: Icon doesn't exist! */ /* The struct has custom properties, but no pointer properties to other IDs! */ ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org List details, subscription details or unsubscribe: https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [244522d6cb6] master: 3D Texturing: Remove actual invocation of print_debug.
Commit: 244522d6cb61ccafda8a70227e698d884e58b75d Author: Jeroen Bakker Date: Fri Jan 20 11:15:37 2023 +0100 Branches: master https://developer.blender.org/rB244522d6cb61ccafda8a70227e698d884e58b75d 3D Texturing: Remove actual invocation of print_debug. Was a mistake as only the function should have landed in master. === M source/blender/blenkernel/intern/pbvh_uv_islands.cc === diff --git a/source/blender/blenkernel/intern/pbvh_uv_islands.cc b/source/blender/blenkernel/intern/pbvh_uv_islands.cc index 0c00f57c49f..16091b32917 100644 --- a/source/blender/blenkernel/intern/pbvh_uv_islands.cc +++ b/source/blender/blenkernel/intern/pbvh_uv_islands.cc @@ -1348,7 +1348,6 @@ void UVIslands::extend_borders(const MeshData _data, const UVIslandsMask ushort index = 0; for (UVIsland : islands) { island.extend_border(mesh_data, islands_mask, index++); -island.print_debug(mesh_data); } } ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org List details, subscription details or unsubscribe: https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [884e14ac938] master: 3D Texturing: Adding print_debug for visually inspecting the generated geometry.
Commit: 884e14ac93855ae107ee0fff52354d85cfc33515 Author: Jeroen Bakker Date: Fri Jan 20 10:28:58 2023 +0100 Branches: master https://developer.blender.org/rB884e14ac93855ae107ee0fff52354d85cfc33515 3D Texturing: Adding print_debug for visually inspecting the generated geometry. During 3D texturing the uv islands are extended in order to fix seam bleeding for manifold parts of the input mesh. This patch adds a `print_debug` method on UVIsland that generates a python script. This script can be copy-past into the Python Console to show the generated geometry. This script can be extended to show the extracted border and use face colors for showing internal decisions. === M source/blender/blenkernel/intern/pbvh_pixels.cc M source/blender/blenkernel/intern/pbvh_uv_islands.cc M source/blender/blenkernel/intern/pbvh_uv_islands.hh === diff --git a/source/blender/blenkernel/intern/pbvh_pixels.cc b/source/blender/blenkernel/intern/pbvh_pixels.cc index 39651349ae9..b1d635f566e 100644 --- a/source/blender/blenkernel/intern/pbvh_pixels.cc +++ b/source/blender/blenkernel/intern/pbvh_pixels.cc @@ -366,7 +366,11 @@ static void update_pixels(PBVH *pbvh, Mesh *mesh, Image *image, ImageUser *image const VArraySpan uv_map = attributes.lookup(active_uv_name, ATTR_DOMAIN_CORNER); uv_islands::MeshData mesh_data( - {pbvh->looptri, pbvh->totprim}, {pbvh->mloop, mesh->totloop}, pbvh->totvert, uv_map); + {pbvh->looptri, pbvh->totprim}, + {pbvh->mloop, mesh->totloop}, + pbvh->totvert, + uv_map, + {static_cast(static_cast(pbvh->vert_positions)), pbvh->totvert}); uv_islands::UVIslands islands(mesh_data); uv_islands::UVIslandsMask uv_masks; diff --git a/source/blender/blenkernel/intern/pbvh_uv_islands.cc b/source/blender/blenkernel/intern/pbvh_uv_islands.cc index 8554964fae9..0c00f57c49f 100644 --- a/source/blender/blenkernel/intern/pbvh_uv_islands.cc +++ b/source/blender/blenkernel/intern/pbvh_uv_islands.cc @@ -210,11 +210,13 @@ static void mesh_data_init(MeshData _data) MeshData::MeshData(const Span looptris, const Span loops, const int verts_num, - const Span uv_map) + const Span uv_map, + const Span vertex_positions) : looptris(looptris), verts_num(verts_num), loops(loops), uv_map(uv_map), + vertex_positions(vertex_positions), vert_to_edge_map(verts_num), edge_to_primitive_map(0), primitive_to_edge_map(looptris.size()) @@ -961,6 +963,63 @@ void UVIsland::extend_border(const MeshData _data, } } +void UVIsland::print_debug(const MeshData _data) const +{ + std::stringstream ss; + ss << " Start UVIsland \n"; + ss << "import bpy\n"; + ss << "import bpy_extras.object_utils\n"; + ss << "import mathutils\n"; + + ss << "uvisland_vertices = [\n"; + for (const float3 _position : mesh_data.vertex_positions) { +ss << " mathutils.Vector((" << vertex_position.x << ", " << vertex_position.y << ", " + << vertex_position.z << ")),\n"; + } + ss << "]\n"; + + ss << "uvisland_edges = []\n"; + + ss << "uvisland_faces = [\n"; + for (const VectorList::UsedVector : uv_primitives) { +for (const UVPrimitive : uvprimitives) { + ss << " [" << uvprimitive.edges[0]->vertices[0]->vertex << ", " + << uvprimitive.edges[0]->vertices[1]->vertex << ", " + << uvprimitive +.get_other_uv_vertex(uvprimitive.edges[0]->vertices[0], + uvprimitive.edges[0]->vertices[1]) +->vertex + << "],\n"; +} + } + ss << "]\n"; + + ss << "uvisland_uvs = [\n"; + for (const VectorList::UsedVector : uv_primitives) { +for (const UVPrimitive : uvprimitives) { + float2 uv = uvprimitive.edges[0]->vertices[0]->uv; + ss << " " << uv.x << ", " << uv.y << ",\n"; + uv = uvprimitive.edges[0]->vertices[1]->uv; + ss << " " << uv.x << ", " << uv.y << ",\n"; + uv = uvprimitive + .get_other_uv_vertex(uvprimitive.edges[0]->vertices[0], +uvprimitive.edges[0]->vertices[1]) + ->uv; + ss << " " << uv.x << ", " << uv.y << ",\n"; +} + } + ss << "]\n"; + + ss << "uvisland_mesh = bpy.data.meshes.new(name='UVIsland')\n"; + ss << "uvisland_mesh.from_pydata(uvisland_vertices, uvisland_edges, uvisland_faces)\n"; + ss << "uv_map = uvisland_mesh.attributes.new('UVMap', 'FLOAT2', 'CORNER')\n"; + ss << "uv_map.data.foreach_set('vector', uvisland_uvs)\n"; + ss << "bpy_extras.object_utils.object_data_add(bpy.context, uvisland_mesh)\n"; + ss << " End UVIsland \n\n\n"; + + std::cout << ss.str(); +} + /** \} */ /* */ @@ -1289,6 +1348,14 @@