[Bf-blender-cvs] [2a2261d7e19] master: Cleanup: Remove the OSL workaround
Commit: 2a2261d7e1933a1f5cfe478dbf109888c91697e8 Author: Jesse Yurkovich Date: Fri May 6 21:41:31 2022 -0700 Branches: master https://developer.blender.org/rB2a2261d7e1933a1f5cfe478dbf109888c91697e8 Cleanup: Remove the OSL workaround Partially reverts rB46ae0831134 now that we have a new version of OSL/OIIO that supports directly. Differential Revision: https://developer.blender.org/D14851 === M intern/cycles/scene/shader_nodes.cpp === diff --git a/intern/cycles/scene/shader_nodes.cpp b/intern/cycles/scene/shader_nodes.cpp index 06a2052d4cb..9a61a8a753b 100644 --- a/intern/cycles/scene/shader_nodes.cpp +++ b/intern/cycles/scene/shader_nodes.cpp @@ -19,7 +19,6 @@ #include "util/color.h" #include "util/foreach.h" #include "util/log.h" -#include "util/string.h" #include "util/transform.h" #include "kernel/tables.h" @@ -450,12 +449,8 @@ void ImageTextureNode::compile(OSLCompiler ) const ustring known_colorspace = metadata.colorspace; if (handle.svm_slot() == -1) { -/* OIIO currently does not support substitutions natively. Replace with a format they - * understand. */ -std::string osl_filename = filename.string(); -string_replace(osl_filename, "", "_"); compiler.parameter_texture( -"filename", ustring(osl_filename), compress_as_srgb ? u_colorspace_raw : known_colorspace); +"filename", filename, compress_as_srgb ? u_colorspace_raw : known_colorspace); } else { compiler.parameter_texture("filename", handle.svm_slot()); ___ 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] [23be3294ff5] master: XR: Expose the OpenXR user paths in the event data for XR events
Commit: 23be3294ff50b9a1f9eebfbde71b44252520c51f Author: Shashank Shekhar Date: Sat May 7 11:39:17 2022 +0900 Branches: master https://developer.blender.org/rB23be3294ff50b9a1f9eebfbde71b44252520c51f XR: Expose the OpenXR user paths in the event data for XR events The use-case is to allow an event handler (in C or a plugin) to distinguish which hand produced the XR event. The alternative is to register separate actions for each hand (e.g. "trigger_left" and "trigger_right"), and duplicate the device bindings (Oculus, HTC Vive, etc) for each action. Other than the problem of code duplication, this isn't conceptually efficient since "trigger_left" and "trigger_right" both represent the same event "trigger", and the identity of the hand that produced that event is just a property of that event. Adds two string fields to the XrEventData called user_path and user_path_other. The user_path_other field will be populated if the event is a bimanual one (i.e. two-handed). This follows the pattern used by the rest of the XrEventData struct for bimanual events (e.g. state, state_other). Reviewed By: muxed-reality === M source/blender/makesrna/intern/rna_xr.c M source/blender/windowmanager/WM_types.h M source/blender/windowmanager/xr/intern/wm_xr_session.c === diff --git a/source/blender/makesrna/intern/rna_xr.c b/source/blender/makesrna/intern/rna_xr.c index a04b29b8815..696d2d0f31d 100644 --- a/source/blender/makesrna/intern/rna_xr.c +++ b/source/blender/makesrna/intern/rna_xr.c @@ -1196,6 +1196,50 @@ static int rna_XrEventData_action_length(PointerRNA *ptr) # endif } +static void rna_XrEventData_user_path_get(PointerRNA *ptr, char *r_value) +{ +# ifdef WITH_XR_OPENXR + const wmXrActionData *data = ptr->data; + strcpy(r_value, data->user_path); +# else + UNUSED_VARS(ptr); + r_value[0] = '\0'; +# endif +} + +static int rna_XrEventData_user_path_length(PointerRNA *ptr) +{ +# ifdef WITH_XR_OPENXR + const wmXrActionData *data = ptr->data; + return strlen(data->user_path); +# else + UNUSED_VARS(ptr); + return 0; +# endif +} + +static void rna_XrEventData_user_path_other_get(PointerRNA *ptr, char *r_value) +{ +# ifdef WITH_XR_OPENXR + const wmXrActionData *data = ptr->data; + strcpy(r_value, data->user_path_other); +# else + UNUSED_VARS(ptr); + r_value[0] = '\0'; +# endif +} + +static int rna_XrEventData_user_path_other_length(PointerRNA *ptr) +{ +# ifdef WITH_XR_OPENXR + const wmXrActionData *data = ptr->data; + return strlen(data->user_path_other); +# else + UNUSED_VARS(ptr); + return 0; +# endif +} + static int rna_XrEventData_type_get(PointerRNA *ptr) { # ifdef WITH_XR_OPENXR @@ -2402,6 +2446,19 @@ static void rna_def_xr_eventdata(BlenderRNA *brna) prop, "rna_XrEventData_action_get", "rna_XrEventData_action_length", NULL); RNA_def_property_ui_text(prop, "Action", "XR action name"); + prop = RNA_def_property(srna, "user_path", PROP_STRING, PROP_NONE); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_string_funcs( + prop, "rna_XrEventData_user_path_get", "rna_XrEventData_user_path_length", NULL); + RNA_def_property_ui_text(prop, "User Path", "User path of the action. E.g. \"/user/hand/left\""); + + prop = RNA_def_property(srna, "user_path_other", PROP_STRING, PROP_NONE); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_string_funcs( + prop, "rna_XrEventData_user_path_other_get", "rna_XrEventData_user_path_other_length", NULL); + RNA_def_property_ui_text( + prop, "User Path Other", "Other user path, for bimanual actions. E.g. \"/user/hand/right\""); + prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE); RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_enum_items(prop, rna_enum_xr_action_types); diff --git a/source/blender/windowmanager/WM_types.h b/source/blender/windowmanager/WM_types.h index 3ee5c85c031..9e9f195c430 100644 --- a/source/blender/windowmanager/WM_types.h +++ b/source/blender/windowmanager/WM_types.h @@ -812,6 +812,10 @@ typedef struct wmXrActionData { char action_set[64]; /** Action name. */ char action[64]; + /** User path. E.g. "/user/hand/left" */ + char user_path[64]; + /** Other user path, for bimanual actions. E.g. "/user/hand/right" */ + char user_path_other[64]; /** Type. */ eXrActionType type; /** State. Set appropriately based on type. */ diff --git a/source/blender/windowmanager/xr/intern/wm_xr_session.c b/source/blender/windowmanager/xr/intern/wm_xr_session.c index 0a76fd0a25f..2a829e274d9 100644 --- a/source/blender/windowmanager/xr/intern/wm_xr_session.c +++ b/source/blender/windowmanager/xr/intern/wm_xr_session.c @@ -1025,6 +1025,10 @@ static wmXrActionData *wm_xr_session_event_create(const char *action_set_name, wmXrActionData *data =
[Bf-blender-cvs] [17c7f2e41bd] temp-pbvh-split: Merge remote-tracking branch 'origin/master' into temp-pbvh-split
Commit: 17c7f2e41bd12f40b30a6f6db34785b7c9e51594 Author: Joseph Eagar Date: Fri May 6 16:12:59 2022 -0700 Branches: temp-pbvh-split https://developer.blender.org/rB17c7f2e41bd12f40b30a6f6db34785b7c9e51594 Merge remote-tracking branch 'origin/master' into temp-pbvh-split === === ___ 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] [d2fa1daea64] temp-pbvh-split: temp-pbvh-split: PBVH texpaint node splitting
Commit: d2fa1daea64f605fe6660675e293a1f09f885559 Author: Joseph Eagar Date: Fri May 6 16:08:20 2022 -0700 Branches: temp-pbvh-split https://developer.blender.org/rBd2fa1daea64f605fe6660675e293a1f09f885559 temp-pbvh-split: PBVH texpaint node splitting * Texture paint now has its own special PBVH nodes leaf node flag, PBVH_TexLeaf. * There is a new version of BKE_pbvh_search_gather (BKE_pbvh_search_gather_ex) that takes the leaf test flag as an extra argument. === M source/blender/blenkernel/BKE_pbvh.h M source/blender/blenkernel/intern/pbvh.c M source/blender/blenkernel/intern/pbvh_intern.h M source/blender/blenkernel/intern/pbvh_pixels.cc M source/blender/draw/intern/draw_manager_data.c M source/blender/editors/sculpt_paint/sculpt.c M source/blender/editors/sculpt_paint/sculpt_intern.h M source/blender/editors/sculpt_paint/sculpt_paint_color.c M source/blender/editors/sculpt_paint/sculpt_paint_image.cc === diff --git a/source/blender/blenkernel/BKE_pbvh.h b/source/blender/blenkernel/BKE_pbvh.h index 291b9b6b778..857c5c994c5 100644 --- a/source/blender/blenkernel/BKE_pbvh.h +++ b/source/blender/blenkernel/BKE_pbvh.h @@ -79,7 +79,7 @@ typedef enum { PBVH_UpdateTopology = 1 << 13, PBVH_UpdateColor = 1 << 14, PBVH_RebuildPixels = 1 << 15, - + PBVH_TexLeaf = 1 << 16, } PBVHNodeFlags; typedef struct PBVHFrustumPlanes { @@ -160,7 +160,12 @@ void BKE_pbvh_search_callback(PBVH *pbvh, void BKE_pbvh_search_gather( PBVH *pbvh, BKE_pbvh_SearchCallback scb, void *search_data, PBVHNode ***array, int *tot); - +void BKE_pbvh_search_gather_ex(PBVH *pbvh, + BKE_pbvh_SearchCallback scb, + void *search_data, + PBVHNode ***r_array, + int *r_tot, + PBVHNodeFlags leaf_flag); /* Ray-cast * the hit callback is called for all leaf nodes intersecting the ray; * it's up to the callback to find the primitive within the leaves that is diff --git a/source/blender/blenkernel/intern/pbvh.c b/source/blender/blenkernel/intern/pbvh.c index e1ab4ccfb0a..db6ab27f62a 100644 --- a/source/blender/blenkernel/intern/pbvh.c +++ b/source/blender/blenkernel/intern/pbvh.c @@ -759,7 +759,7 @@ static void pbvh_stack_push(PBVHIter *iter, PBVHNode *node, bool revisiting) iter->stacksize++; } -static PBVHNode *pbvh_iter_next(PBVHIter *iter) +static PBVHNode *pbvh_iter_next(PBVHIter *iter, PBVHNodeFlags leaf_flag) { /* purpose here is to traverse tree, visiting child nodes before their * parents, this order is necessary for e.g. computing bounding boxes */ @@ -786,7 +786,7 @@ static PBVHNode *pbvh_iter_next(PBVHIter *iter) continue; /* don't traverse, outside of search zone */ } -if (node->flag & PBVH_Leaf) { +if (node->flag & leaf_flag) { /* immediately hit leaf node */ return node; } @@ -831,8 +831,12 @@ static PBVHNode *pbvh_iter_next_occluded(PBVHIter *iter) return NULL; } -void BKE_pbvh_search_gather( -PBVH *pbvh, BKE_pbvh_SearchCallback scb, void *search_data, PBVHNode ***r_array, int *r_tot) +void BKE_pbvh_search_gather_ex(PBVH *pbvh, + BKE_pbvh_SearchCallback scb, + void *search_data, + PBVHNode ***r_array, + int *r_tot, + PBVHNodeFlags leaf_flag) { PBVHIter iter; PBVHNode **array = NULL, *node; @@ -840,8 +844,8 @@ void BKE_pbvh_search_gather( pbvh_iter_begin(, pbvh, scb, search_data); - while ((node = pbvh_iter_next())) { -if (node->flag & PBVH_Leaf) { + while ((node = pbvh_iter_next(, leaf_flag))) { +if (node->flag & leaf_flag) { if (UNLIKELY(tot == space)) { /* resize array if needed */ space = (tot == 0) ? 32 : space * 2; @@ -864,6 +868,12 @@ void BKE_pbvh_search_gather( *r_tot = tot; } +void BKE_pbvh_search_gather( +PBVH *pbvh, BKE_pbvh_SearchCallback scb, void *search_data, PBVHNode ***r_array, int *r_tot) +{ + BKE_pbvh_search_gather_ex(pbvh, scb, search_data, r_array, r_tot, PBVH_Leaf); +} + void BKE_pbvh_search_callback(PBVH *pbvh, BKE_pbvh_SearchCallback scb, void *search_data, @@ -875,7 +885,7 @@ void BKE_pbvh_search_callback(PBVH *pbvh, pbvh_iter_begin(, pbvh, scb, search_data); - while ((node = pbvh_iter_next())) { + while ((node = pbvh_iter_next(, PBVH_Leaf))) { if (node->flag & PBVH_Leaf) { hcb(node, hit_data); } @@ -1648,7 +1658,7 @@ void BKE_pbvh_redraw_BB(PBVH *pbvh, float bb_min[3], float bb_max[3]) pbvh_iter_begin(, pbvh, NULL, NULL); - while ((node = pbvh_iter_next())) { + while ((node =
[Bf-blender-cvs] [1c77f259fd3] temp-pbvh-split: temp-pbvh-split: Support pbvh debug node box drawing outside of pbvh draw mode
Commit: 1c77f259fd3b5f1768dd37eb2c06f67e67004999 Author: Joseph Eagar Date: Wed May 4 20:58:20 2022 -0700 Branches: temp-pbvh-split https://developer.blender.org/rB1c77f259fd3b5f1768dd37eb2c06f67e67004999 temp-pbvh-split: Support pbvh debug node box drawing outside of pbvh draw mode === M release/datafiles/locale M release/scripts/addons M source/blender/draw/engines/basic/basic_engine.c M source/blender/draw/engines/eevee/eevee_materials.c M source/blender/draw/intern/DRW_render.h M source/blender/draw/intern/draw_manager_data.c === diff --git a/release/datafiles/locale b/release/datafiles/locale index 2e715d54178..44cf4b4bf74 16 --- a/release/datafiles/locale +++ b/release/datafiles/locale @@ -1 +1 @@ -Subproject commit 2e715d54178e24ea463c7bc0cdeb27c682c39ecf +Subproject commit 44cf4b4bf74f22fff55941e39cebeacec68a5a80 diff --git a/release/scripts/addons b/release/scripts/addons index 599a8db33c4..05f16d812d6 16 --- a/release/scripts/addons +++ b/release/scripts/addons @@ -1 +1 @@ -Subproject commit 599a8db33c45c2ad94f8d482f01b281252799770 +Subproject commit 05f16d812d6989e3a700ec29492220292267000d diff --git a/source/blender/draw/engines/basic/basic_engine.c b/source/blender/draw/engines/basic/basic_engine.c index 04a3c27959d..63f5be928dd 100644 --- a/source/blender/draw/engines/basic/basic_engine.c +++ b/source/blender/draw/engines/basic/basic_engine.c @@ -10,9 +10,11 @@ #include "DRW_render.h" +#include "BKE_global.h" #include "BKE_object.h" #include "BKE_paint.h" #include "BKE_particle.h" +#include "BKE_pbvh.h" #include "BLI_alloca.h" @@ -214,6 +216,16 @@ static void basic_cache_populate(void *vedata, Object *ob) DRW_shgroup_call(shgrp, geom, ob); } } + +if (G.debug_value == 889 && ob->sculpt && ob->sculpt->pbvh) { + int debug_node_nr = 0; + DRW_debug_modelmat(ob->obmat); + BKE_pbvh_draw_debug_cb( + ob->sculpt->pbvh, + (void (*)(void *d, const float min[3], const float max[3], PBVHNodeFlags f)) + DRW_sculpt_debug_cb, + _node_nr); +} } } diff --git a/source/blender/draw/engines/eevee/eevee_materials.c b/source/blender/draw/engines/eevee/eevee_materials.c index a81d3e56673..cb19c70c375 100644 --- a/source/blender/draw/engines/eevee/eevee_materials.c +++ b/source/blender/draw/engines/eevee/eevee_materials.c @@ -15,6 +15,7 @@ #include "BLI_rand.h" #include "BLI_string_utils.h" +#include "BKE_global.h" #include "BKE_paint.h" #include "BKE_particle.h" @@ -853,6 +854,16 @@ void EEVEE_materials_cache_populate(EEVEE_Data *vedata, *cast_shadow = *cast_shadow || (matcache[i].shadow_grp != NULL); } } + +if (G.debug_value == 889 && ob->sculpt && ob->sculpt->pbvh) { + int debug_node_nr = 0; + DRW_debug_modelmat(ob->obmat); + BKE_pbvh_draw_debug_cb( + ob->sculpt->pbvh, + (void (*)(void *d, const float min[3], const float max[3], PBVHNodeFlags f)) + DRW_sculpt_debug_cb, + _node_nr); +} } /* Motion Blur Vectors. */ diff --git a/source/blender/draw/intern/DRW_render.h b/source/blender/draw/intern/DRW_render.h index 712118e8282..6b40c1b08c4 100644 --- a/source/blender/draw/intern/DRW_render.h +++ b/source/blender/draw/intern/DRW_render.h @@ -18,6 +18,7 @@ #include "BKE_layer.h" #include "BKE_material.h" #include "BKE_scene.h" +#include "BKE_pbvh.h" #include "BLT_translation.h" @@ -470,6 +471,10 @@ void DRW_shgroup_call_instances_with_attrs(DRWShadingGroup *shgroup, void DRW_shgroup_call_sculpt(DRWShadingGroup *sh, Object *ob, bool wire, bool mask); void DRW_shgroup_call_sculpt_with_materials(DRWShadingGroup **sh, int num_sh, Object *ob); +void DRW_sculpt_debug_cb(void *user_data, + const float bmin[3], + const float bmax[3], + PBVHNodeFlags flag); DRWCallBuffer *DRW_shgroup_call_buffer(DRWShadingGroup *shgroup, struct GPUVertFormat *format, diff --git a/source/blender/draw/intern/draw_manager_data.c b/source/blender/draw/intern/draw_manager_data.c index b5432da0957..df911fd5f2c 100644 --- a/source/blender/draw/intern/draw_manager_data.c +++ b/source/blender/draw/intern/draw_manager_data.c @@ -1112,10 +1112,10 @@ static void sculpt_draw_cb(DRWSculptCallbackData *scd, GPU_PBVH_Buffers *buffers } } -static void sculpt_debug_cb(void *user_data, -const float bmin[3], -const float bmax[3], -PBVHNodeFlags flag) +void DRW_sculpt_debug_cb(void *user_data, + const float bmin[3], + const float bmax[3], + PBVHNodeFlags
[Bf-blender-cvs] [98a04ed4524] master: UI: Increase bitfield size for button flags
Commit: 98a04ed4524234b1840dc039c2f356db5ac57f26 Author: Julian Eisel Date: Fri May 6 23:48:51 2022 +0200 Branches: master https://developer.blender.org/rB98a04ed4524234b1840dc039c2f356db5ac57f26 UI: Increase bitfield size for button flags We were running out of bits :) Only one was left (which D14880 proposes to use). === M source/blender/editors/interface/interface_intern.h === diff --git a/source/blender/editors/interface/interface_intern.h b/source/blender/editors/interface/interface_intern.h index c09ff68bbca..88e00cc5bec 100644 --- a/source/blender/editors/interface/interface_intern.h +++ b/source/blender/editors/interface/interface_intern.h @@ -147,7 +147,8 @@ struct uiBut { /** Pointer back to the layout item holding this button. */ uiLayout *layout; - int flag, drawflag; + uint64_t flag; + int drawflag; eButType type; eButPointerType pointype; short bit, bitnr, retval, strwidth, alignnr; ___ 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] [5e40c342ae9] master: UI: Remove weird looking right aligned text in texture properties
Commit: 5e40c342ae99d3c5de1911698ee447c3cf7384a1 Author: Julian Eisel Date: Fri May 6 23:35:24 2022 +0200 Branches: master https://developer.blender.org/rB5e40c342ae99d3c5de1911698ee447c3cf7384a1 UI: Remove weird looking right aligned text in texture properties The text would start somewhere in the middle of the line, and just look placed wrong. Plus it would seem like it's cut off (esp. since we don't add a period). === M release/scripts/startup/bl_ui/properties_texture.py === diff --git a/release/scripts/startup/bl_ui/properties_texture.py b/release/scripts/startup/bl_ui/properties_texture.py index 5ceaf8fc644..1f9362f02b5 100644 --- a/release/scripts/startup/bl_ui/properties_texture.py +++ b/release/scripts/startup/bl_ui/properties_texture.py @@ -840,7 +840,6 @@ class TEXTURE_PT_colors_ramp(TextureButtonsPanel, TextureColorsPoll, Panel): if is_active: layout.template_color_ramp(tex, "color_ramp", expand=True) else: -layout.alignment = 'RIGHT' layout.label(text="Enable the Color Ramp first") ___ 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] [aee8e490314] blender-v3.2-release: Fix T97751: New OBJ IO - File Browser doesn't filter by .obj/.mtl
Commit: aee8e49031464215998a71b05dd4b20fb57959d8 Author: Julian Eisel Date: Fri May 6 23:03:36 2022 +0200 Branches: blender-v3.2-release https://developer.blender.org/rBaee8e49031464215998a71b05dd4b20fb57959d8 Fix T97751: New OBJ IO - File Browser doesn't filter by .obj/.mtl Makes the File Browser filter by .obj and .mtl files by default again. Note that this commit focuses on fixing this specific bug, further refactors/tweaks/fixes are planned (see D14863). Differential Revision: https://developer.blender.org/D14862 Reviewed by: Aras Pranckevicius === M source/blender/editors/io/io_obj.c M source/blender/editors/space_file/filelist.c === diff --git a/source/blender/editors/io/io_obj.c b/source/blender/editors/io/io_obj.c index 3345d422bd1..9156ff15ded 100644 --- a/source/blender/editors/io/io_obj.c +++ b/source/blender/editors/io/io_obj.c @@ -231,6 +231,8 @@ static bool wm_obj_export_check(bContext *C, wmOperator *op) void WM_OT_obj_export(struct wmOperatorType *ot) { + PropertyRNA *prop; + ot->name = "Export Wavefront OBJ"; ot->description = "Save the scene to a Wavefront OBJ file"; ot->idname = "WM_OT_obj_export"; @@ -244,7 +246,7 @@ void WM_OT_obj_export(struct wmOperatorType *ot) ot->flag |= OPTYPE_PRESET; WM_operator_properties_filesel(ot, - FILE_TYPE_FOLDER | FILE_TYPE_OBJECT_IO, + FILE_TYPE_FOLDER, FILE_BLENDER, FILE_SAVE, WM_FILESEL_FILEPATH | WM_FILESEL_SHOW_PROPS, @@ -358,6 +360,10 @@ void WM_OT_obj_export(struct wmOperatorType *ot) "Every smooth-shaded face is assigned group \"1\" and every flat-shaded face \"off\""); RNA_def_boolean( ot->srna, "smooth_group_bitflags", false, "Generate Bitflags for Smooth Groups", ""); + + /* Only show .obj or .mtl files by default. */ + prop = RNA_def_string(ot->srna, "filter_glob", "*.obj;*.mtl", 0, "Extension Filter", ""); + RNA_def_property_flag(prop, PROP_HIDDEN); } static int wm_obj_import_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event)) @@ -415,6 +421,8 @@ static void wm_obj_import_draw(bContext *C, wmOperator *op) void WM_OT_obj_import(struct wmOperatorType *ot) { + PropertyRNA *prop; + ot->name = "Import Wavefront OBJ"; ot->description = "Load a Wavefront OBJ scene"; ot->idname = "WM_OT_obj_import"; @@ -425,7 +433,7 @@ void WM_OT_obj_import(struct wmOperatorType *ot) ot->ui = wm_obj_import_draw; WM_operator_properties_filesel(ot, - FILE_TYPE_FOLDER | FILE_TYPE_OBJECT_IO, + FILE_TYPE_FOLDER, FILE_BLENDER, FILE_OPENFILE, WM_FILESEL_FILEPATH | WM_FILESEL_SHOW_PROPS, @@ -453,4 +461,8 @@ void WM_OT_obj_import(struct wmOperatorType *ot) false, "Validate Meshes", "Check imported mesh objects for invalid data (slow)"); + + /* Only show .obj or .mtl files by default. */ + prop = RNA_def_string(ot->srna, "filter_glob", "*.obj;*.mtl", 0, "Extension Filter", ""); + RNA_def_property_flag(prop, PROP_HIDDEN); } diff --git a/source/blender/editors/space_file/filelist.c b/source/blender/editors/space_file/filelist.c index 9f71d6f77c7..59ecef7d4c6 100644 --- a/source/blender/editors/space_file/filelist.c +++ b/source/blender/editors/space_file/filelist.c @@ -2802,7 +2802,8 @@ int ED_path_extension_type(const char *path) if (BLI_path_extension_check(path, ".zip")) { return FILE_TYPE_ARCHIVE; } - if (BLI_path_extension_check_n(path, ".obj", ".3ds", ".fbx", ".glb", ".gltf", ".svg", NULL)) { + if (BLI_path_extension_check_n( + path, ".obj", ".mtl", ".3ds", ".fbx", ".glb", ".gltf", ".svg", NULL)) { return FILE_TYPE_OBJECT_IO; } if (BLI_path_extension_check_array(path, imb_ext_image)) { ___ 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] [aae2ff49f5b] master: Fix T97751: New OBJ IO - File Browser doesn't filter by .obj/.mtl
Commit: aae2ff49f5b8bd7aeb219f1505d415c5744133c1 Author: Julian Eisel Date: Fri May 6 23:03:36 2022 +0200 Branches: master https://developer.blender.org/rBaae2ff49f5b8bd7aeb219f1505d415c5744133c1 Fix T97751: New OBJ IO - File Browser doesn't filter by .obj/.mtl Makes the File Browser filter by .obj and .mtl files by default again. Note that this commit focuses on fixing this specific bug, further refactors/tweaks/fixes are planned (see D14863). Differential Revision: https://developer.blender.org/D14862 Reviewed by: Aras Pranckevicius === M source/blender/editors/io/io_obj.c M source/blender/editors/space_file/filelist.c === diff --git a/source/blender/editors/io/io_obj.c b/source/blender/editors/io/io_obj.c index 3345d422bd1..9156ff15ded 100644 --- a/source/blender/editors/io/io_obj.c +++ b/source/blender/editors/io/io_obj.c @@ -231,6 +231,8 @@ static bool wm_obj_export_check(bContext *C, wmOperator *op) void WM_OT_obj_export(struct wmOperatorType *ot) { + PropertyRNA *prop; + ot->name = "Export Wavefront OBJ"; ot->description = "Save the scene to a Wavefront OBJ file"; ot->idname = "WM_OT_obj_export"; @@ -244,7 +246,7 @@ void WM_OT_obj_export(struct wmOperatorType *ot) ot->flag |= OPTYPE_PRESET; WM_operator_properties_filesel(ot, - FILE_TYPE_FOLDER | FILE_TYPE_OBJECT_IO, + FILE_TYPE_FOLDER, FILE_BLENDER, FILE_SAVE, WM_FILESEL_FILEPATH | WM_FILESEL_SHOW_PROPS, @@ -358,6 +360,10 @@ void WM_OT_obj_export(struct wmOperatorType *ot) "Every smooth-shaded face is assigned group \"1\" and every flat-shaded face \"off\""); RNA_def_boolean( ot->srna, "smooth_group_bitflags", false, "Generate Bitflags for Smooth Groups", ""); + + /* Only show .obj or .mtl files by default. */ + prop = RNA_def_string(ot->srna, "filter_glob", "*.obj;*.mtl", 0, "Extension Filter", ""); + RNA_def_property_flag(prop, PROP_HIDDEN); } static int wm_obj_import_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event)) @@ -415,6 +421,8 @@ static void wm_obj_import_draw(bContext *C, wmOperator *op) void WM_OT_obj_import(struct wmOperatorType *ot) { + PropertyRNA *prop; + ot->name = "Import Wavefront OBJ"; ot->description = "Load a Wavefront OBJ scene"; ot->idname = "WM_OT_obj_import"; @@ -425,7 +433,7 @@ void WM_OT_obj_import(struct wmOperatorType *ot) ot->ui = wm_obj_import_draw; WM_operator_properties_filesel(ot, - FILE_TYPE_FOLDER | FILE_TYPE_OBJECT_IO, + FILE_TYPE_FOLDER, FILE_BLENDER, FILE_OPENFILE, WM_FILESEL_FILEPATH | WM_FILESEL_SHOW_PROPS, @@ -453,4 +461,8 @@ void WM_OT_obj_import(struct wmOperatorType *ot) false, "Validate Meshes", "Check imported mesh objects for invalid data (slow)"); + + /* Only show .obj or .mtl files by default. */ + prop = RNA_def_string(ot->srna, "filter_glob", "*.obj;*.mtl", 0, "Extension Filter", ""); + RNA_def_property_flag(prop, PROP_HIDDEN); } diff --git a/source/blender/editors/space_file/filelist.c b/source/blender/editors/space_file/filelist.c index 9f71d6f77c7..59ecef7d4c6 100644 --- a/source/blender/editors/space_file/filelist.c +++ b/source/blender/editors/space_file/filelist.c @@ -2802,7 +2802,8 @@ int ED_path_extension_type(const char *path) if (BLI_path_extension_check(path, ".zip")) { return FILE_TYPE_ARCHIVE; } - if (BLI_path_extension_check_n(path, ".obj", ".3ds", ".fbx", ".glb", ".gltf", ".svg", NULL)) { + if (BLI_path_extension_check_n( + path, ".obj", ".mtl", ".3ds", ".fbx", ".glb", ".gltf", ".svg", NULL)) { return FILE_TYPE_OBJECT_IO; } if (BLI_path_extension_check_array(path, imb_ext_image)) { ___ 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] [92d0ed30008] master: Merge branch 'blender-v3.2-release'
Commit: 92d0ed30008440c9e4766769e8248b0e0befecae Author: Sergey Sharybin Date: Fri May 6 16:44:18 2022 +0200 Branches: master https://developer.blender.org/rB92d0ed30008440c9e4766769e8248b0e0befecae Merge branch 'blender-v3.2-release' === === ___ 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] [26d375467b9] master: bpy_extras: Add utilities for getting ID references
Commit: 26d375467b955f5fb4376c221e659ac8c14ece69 Author: Demeter Dzadik Date: Fri May 6 16:42:47 2022 +0200 Branches: master https://developer.blender.org/rB26d375467b955f5fb4376c221e659ac8c14ece69 bpy_extras: Add utilities for getting ID references An alternate to D14839, implemented in Python and relying on bpy.data.user_map(). That function gives us a mapping of what ID is referenced by what set of IDs. The inverse of this would also be useful, which is now available from bpy_extras.id_map_utils.get_id_reference_map(). From there, we can use get_all_referenced_ids() to get a set of all IDs referenced by a given ID either directly or indirectly. To get only the direct references, we can simply pass the ID of interest as a key to the dictionary returned from get_id_reference_map(). Reviewed By: mont29 Differential Revision: https://developer.blender.org/D14843 === M release/scripts/modules/bpy_extras/__init__.py A release/scripts/modules/bpy_extras/id_map_utils.py === diff --git a/release/scripts/modules/bpy_extras/__init__.py b/release/scripts/modules/bpy_extras/__init__.py index 1af9048ebfd..15a8d00cddc 100644 --- a/release/scripts/modules/bpy_extras/__init__.py +++ b/release/scripts/modules/bpy_extras/__init__.py @@ -16,4 +16,5 @@ __all__ = ( "mesh_utils", "node_utils", "view3d_utils", +"id_map_utils", ) diff --git a/release/scripts/modules/bpy_extras/id_map_utils.py b/release/scripts/modules/bpy_extras/id_map_utils.py new file mode 100644 index 000..cf39f2185c6 --- /dev/null +++ b/release/scripts/modules/bpy_extras/id_map_utils.py @@ -0,0 +1,49 @@ +# SPDX-License-Identifier: GPL-2.0-or-later + +# + +from typing import Dict, Set +import bpy +from bpy.types import ID + + +__all__ = ( +"get_id_reference_map", +"get_all_referenced_ids", +) + + +def get_id_reference_map() -> Dict[ID, Set[ID]]: +"""Return a dictionary of direct datablock references for every datablock in the blend file.""" +inv_map = {} +for key, values in bpy.data.user_map().items(): +for value in values: +if value == key: +# So an object is not considered to be referencing itself. +continue +inv_map.setdefault(value, set()).add(key) +return inv_map + + +def recursive_get_referenced_ids( +ref_map: Dict[ID, Set[ID]], id: ID, referenced_ids: Set, visited: Set +): +"""Recursively populate referenced_ids with IDs referenced by id.""" +if id in visited: +# Avoid infinite recursion from circular references. +return +visited.add(id) +for ref in ref_map.get(id, []): +referenced_ids.add(ref) +recursive_get_referenced_ids( +ref_map=ref_map, id=ref, referenced_ids=referenced_ids, visited=visited +) + + +def get_all_referenced_ids(id: ID, ref_map: Dict[ID, Set[ID]]) -> Set[ID]: +"""Return a set of IDs directly or indirectly referenced by id.""" +referenced_ids = set() +recursive_get_referenced_ids( +ref_map=ref_map, id=id, referenced_ids=referenced_ids, visited=set() +) +return referenced_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] [0825869c82d] temp-T97907-compositor-meta-data: Store metadata in image buffer.
Commit: 0825869c82d89f1f4ce6711735abf9245053deef Author: Jeroen Bakker Date: Fri May 6 16:33:40 2022 +0200 Branches: temp-T97907-compositor-meta-data https://developer.blender.org/rB0825869c82d89f1f4ce6711735abf9245053deef Store metadata in image buffer. === M source/blender/compositor/operations/COM_ViewerOperation.cc === diff --git a/source/blender/compositor/operations/COM_ViewerOperation.cc b/source/blender/compositor/operations/COM_ViewerOperation.cc index 8892f628466..74b6c3493fb 100644 --- a/source/blender/compositor/operations/COM_ViewerOperation.cc +++ b/source/blender/compositor/operations/COM_ViewerOperation.cc @@ -202,6 +202,9 @@ void ViewerOperation::update_image(const rcti *rect) rect->ymax); std::unique_ptr metadata = image_input_->get_meta_data(); + if (metadata.has_value()) { +// TODO:metadata.add_to_id_prop. + } /* This could be improved to use partial updates. For now disabled as the full frame compositor * would not use partial frames anymore and the image engine requires more testing. */ ___ 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] [7aec4a8a456] temp-T97907-compositor-meta-data: Use file meta data in composior.
Commit: 7aec4a8a456f46c35af88df79a6e89ef06a8be56 Author: Jeroen Bakker Date: Fri May 6 16:13:32 2022 +0200 Branches: temp-T97907-compositor-meta-data https://developer.blender.org/rB7aec4a8a456f46c35af88df79a6e89ef06a8be56 Use file meta data in composior. === M source/blender/compositor/intern/COM_MetaData.cc M source/blender/compositor/intern/COM_MetaData.h M source/blender/compositor/operations/COM_ImageOperation.cc M source/blender/compositor/operations/COM_ImageOperation.h M source/blender/compositor/operations/COM_ViewerOperation.cc === diff --git a/source/blender/compositor/intern/COM_MetaData.cc b/source/blender/compositor/intern/COM_MetaData.cc index 9ee3d7e5c22..0b64b353101 100644 --- a/source/blender/compositor/intern/COM_MetaData.cc +++ b/source/blender/compositor/intern/COM_MetaData.cc @@ -3,6 +3,7 @@ #include "COM_MetaData.h" +#include "BKE_idprop.h" #include "BKE_image.h" #include "RE_pipeline.h" @@ -14,6 +15,17 @@ void MetaData::add(const blender::StringRef key, const blender::StringRef value) entries_.add(key, value); } +static void add_property(IDProperty *id_prop, void *user_data) +{ + MetaData *meta_data = static_cast(user_data); + meta_data->add(id_prop->name, IDP_String(id_prop)); +} + +void MetaData::add(IDProperty *id_prop) +{ + IDP_foreach_property(id_prop, IDP_TYPE_FILTER_STRING, add_property, this); +} + void MetaData::add_cryptomatte_entry(const blender::StringRef layer_name, const blender::StringRefNull key, const blender::StringRef value) diff --git a/source/blender/compositor/intern/COM_MetaData.h b/source/blender/compositor/intern/COM_MetaData.h index de09d9995db..c1474ac16b7 100644 --- a/source/blender/compositor/intern/COM_MetaData.h +++ b/source/blender/compositor/intern/COM_MetaData.h @@ -43,6 +43,8 @@ class MetaData { */ void replace_hash_neutral_cryptomatte_keys(const blender::StringRef layer_name); void add_to_render_result(RenderResult *render_result) const; + void add(IDProperty *properties); + #ifdef WITH_CXX_GUARDEDALLOC MEM_CXX_CLASS_ALLOC_FUNCS("COM:MetaData") #endif diff --git a/source/blender/compositor/operations/COM_ImageOperation.cc b/source/blender/compositor/operations/COM_ImageOperation.cc index a9ab414670f..3e0dd4f6971 100644 --- a/source/blender/compositor/operations/COM_ImageOperation.cc +++ b/source/blender/compositor/operations/COM_ImageOperation.cc @@ -215,4 +215,13 @@ void ImageDepthOperation::update_memory_buffer_partial(MemoryBuffer *output, } } +std::unique_ptr ImageOperation::get_meta_data() +{ + std::unique_ptr meta_data = std::unique_ptr(); + if (buffer_->metadata != nullptr) { +meta_data->add(buffer_->metadata); + } + return meta_data; +} + } // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_ImageOperation.h b/source/blender/compositor/operations/COM_ImageOperation.h index 1eaa828fe2a..d10d283697d 100644 --- a/source/blender/compositor/operations/COM_ImageOperation.h +++ b/source/blender/compositor/operations/COM_ImageOperation.h @@ -78,6 +78,7 @@ class ImageOperation : public BaseImageOperation { void update_memory_buffer_partial(MemoryBuffer *output, const rcti , Span inputs) override; + std::unique_ptr get_meta_data() override; }; class ImageAlphaOperation : public BaseImageOperation { public: diff --git a/source/blender/compositor/operations/COM_ViewerOperation.cc b/source/blender/compositor/operations/COM_ViewerOperation.cc index 58392b8a638..8892f628466 100644 --- a/source/blender/compositor/operations/COM_ViewerOperation.cc +++ b/source/blender/compositor/operations/COM_ViewerOperation.cc @@ -201,6 +201,8 @@ void ViewerOperation::update_image(const rcti *rect) rect->xmax, rect->ymax); + std::unique_ptr metadata = image_input_->get_meta_data(); + /* This could be improved to use partial updates. For now disabled as the full frame compositor * would not use partial frames anymore and the image engine requires more testing. */ BKE_image_partial_update_mark_full_update(image_); ___ 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] [cc66340c7e8] temp-T97907-compositor-meta-data: Fix allocation metadata for image files.
Commit: cc66340c7e829a41450347fbc043ac8e8d029f07 Author: Jeroen Bakker Date: Fri May 6 16:29:26 2022 +0200 Branches: temp-T97907-compositor-meta-data https://developer.blender.org/rBcc66340c7e829a41450347fbc043ac8e8d029f07 Fix allocation metadata for image files. === M source/blender/compositor/operations/COM_ImageOperation.cc === diff --git a/source/blender/compositor/operations/COM_ImageOperation.cc b/source/blender/compositor/operations/COM_ImageOperation.cc index 3e0dd4f6971..d0a8c3be7c8 100644 --- a/source/blender/compositor/operations/COM_ImageOperation.cc +++ b/source/blender/compositor/operations/COM_ImageOperation.cc @@ -217,11 +217,11 @@ void ImageDepthOperation::update_memory_buffer_partial(MemoryBuffer *output, std::unique_ptr ImageOperation::get_meta_data() { - std::unique_ptr meta_data = std::unique_ptr(); + MetaData meta_data; if (buffer_->metadata != nullptr) { -meta_data->add(buffer_->metadata); +meta_data.add(buffer_->metadata); } - return meta_data; + return std::make_unique(meta_data); } } // namespace blender::compositor ___ 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] [a7417ba8452] blender-v3.2-release: DrawManager: Make instance data persistent.
Commit: a7417ba84527d57391599d26a1872c035c5e2c48 Author: Jeroen Bakker Date: Fri May 6 16:13:57 2022 +0200 Branches: blender-v3.2-release https://developer.blender.org/rBa7417ba84527d57391599d26a1872c035c5e2c48 DrawManager: Make instance data persistent. When resizing a viewport all engine instance data was cleared. This wasn't the intended design and lead to performance regressions in the image engine. This patch makes sure that the instance data isn't cleared when the viewport size changes. When using instance data, draw engines are responsible to update the textures accordingly. This could also reduce flickering/stalling when resizing the viewport in eevee-next. Fixes T95428. Reviewed By: fclem Maniphest Tasks: T95428 Differential Revision: https://developer.blender.org/D14874 === M source/blender/draw/engines/image/image_instance_data.hh M source/blender/draw/engines/image/image_texture_info.hh M source/blender/draw/intern/draw_view_data.cc === diff --git a/source/blender/draw/engines/image/image_instance_data.hh b/source/blender/draw/engines/image/image_instance_data.hh index cb84c7f14ad..358e6fd3bd9 100644 --- a/source/blender/draw/engines/image/image_instance_data.hh +++ b/source/blender/draw/engines/image/image_instance_data.hh @@ -75,8 +75,10 @@ struct IMAGE_InstanceData { TextureInfo = texture_infos[i]; const bool is_allocated = info.texture != nullptr; const bool is_visible = info.visible; - const bool should_be_freed = !is_visible && is_allocated; - const bool should_be_created = is_visible && !is_allocated; + const bool resolution_changed = assign_if_different(info.last_viewport_size, + float2(DRW_viewport_size_get())); + const bool should_be_freed = is_allocated && (!is_visible || resolution_changed); + const bool should_be_created = is_visible && (!is_allocated || resolution_changed); if (should_be_freed) { GPU_texture_free(info.texture); diff --git a/source/blender/draw/engines/image/image_texture_info.hh b/source/blender/draw/engines/image/image_texture_info.hh index cd51cdaff3c..9a75941c533 100644 --- a/source/blender/draw/engines/image/image_texture_info.hh +++ b/source/blender/draw/engines/image/image_texture_info.hh @@ -46,6 +46,8 @@ struct TextureInfo { */ GPUTexture *texture; + float2 last_viewport_size = float2(0.0f, 0.0f); + ~TextureInfo() { if (batch != nullptr) { diff --git a/source/blender/draw/intern/draw_view_data.cc b/source/blender/draw/intern/draw_view_data.cc index 0e55d28f6df..3dc28dc9a9a 100644 --- a/source/blender/draw/intern/draw_view_data.cc +++ b/source/blender/draw/intern/draw_view_data.cc @@ -88,7 +88,7 @@ void DRW_view_data_default_lists_from_viewport(DRWViewData *view_data, GPUViewpo }); } -static void draw_viewport_engines_data_clear(ViewportEngineData *data) +static void draw_viewport_engines_data_clear(ViewportEngineData *data, bool clear_instance_data) { DrawEngineType *engine_type = data->engine_type->draw_engine; const DrawEngineDataSize *data_size = engine_type->vedata_size; @@ -103,7 +103,7 @@ static void draw_viewport_engines_data_clear(ViewportEngineData *data) MEM_SAFE_FREE(data->stl->storage[i]); } - if (data->instance_data) { + if (clear_instance_data && data->instance_data) { BLI_assert(engine_type->instance_free != nullptr); engine_type->instance_free(data->instance_data); data->instance_data = nullptr; @@ -120,7 +120,7 @@ static void draw_viewport_engines_data_clear(ViewportEngineData *data) } } -static void draw_view_data_clear(DRWViewData *view_data) +static void draw_view_data_clear(DRWViewData *view_data, bool free_instance_data) { GPU_FRAMEBUFFER_FREE_SAFE(view_data->dfbl.default_fb); GPU_FRAMEBUFFER_FREE_SAFE(view_data->dfbl.overlay_fb); @@ -137,23 +137,20 @@ static void draw_view_data_clear(DRWViewData *view_data) GPU_TEXTURE_FREE_SAFE(view_data->dtxl.depth_in_front); for (ViewportEngineData : view_data->engines) { -draw_viewport_engines_data_clear(); +draw_viewport_engines_data_clear(, free_instance_data); } - - view_data->texture_list_size[0] = view_data->texture_list_size[1] = 0; - view_data->cache_time = 0.0f; } void DRW_view_data_free(DRWViewData *view_data) { - draw_view_data_clear(view_data); + draw_view_data_clear(view_data, true); delete view_data; } void DRW_view_data_texture_list_size_validate(DRWViewData *view_data, const int size[2]) { if (!equals_v2v2_int(view_data->texture_list_size, size)) { -draw_view_data_clear(view_data); +draw_view_data_clear(view_data, false); copy_v2_v2_int(view_data->texture_list_size, size); } } @@ -195,7 +192,7 @@ void
[Bf-blender-cvs] [a0a99fb2528] master: Fix T97872: Annotation lines lost AA
Commit: a0a99fb252843c11521d3c6ba14ffb26b3009598 Author: Germano Cavalcante Date: Fri May 6 10:59:47 2022 -0300 Branches: master https://developer.blender.org/rBa0a99fb252843c11521d3c6ba14ffb26b3009598 Fix T97872: Annotation lines lost AA Since rB2a7a01b339ad, `lineSmooth` has lost its default value of true. So set the value when creating the shader. Differential Revision: https://developer.blender.org/D14876 === M source/blender/gpu/intern/gpu_shader_builtin.c === diff --git a/source/blender/gpu/intern/gpu_shader_builtin.c b/source/blender/gpu/intern/gpu_shader_builtin.c index 13238a03688..1100272b712 100644 --- a/source/blender/gpu/intern/gpu_shader_builtin.c +++ b/source/blender/gpu/intern/gpu_shader_builtin.c @@ -367,6 +367,16 @@ GPUShader *GPU_shader_get_builtin_shader_with_config(eGPUBuiltinShader shader, if (sh_cfg == GPU_SHADER_CFG_DEFAULT) { if (stages->create_info != NULL) { *sh_p = GPU_shader_create_from_info_name(stages->create_info); +if (ELEM(shader, + GPU_SHADER_3D_POLYLINE_CLIPPED_UNIFORM_COLOR, + GPU_SHADER_3D_POLYLINE_UNIFORM_COLOR, + GPU_SHADER_3D_POLYLINE_FLAT_COLOR, + GPU_SHADER_3D_POLYLINE_SMOOTH_COLOR)) { + /* Set a default value for `lineSmooth`. + * Ideally this value should be set by the caller. */ + GPU_shader_bind(*sh_p); + GPU_shader_uniform_1i(*sh_p, "lineSmooth", 1); +} } else { *sh_p = GPU_shader_create_from_arrays_named( ___ 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] [dd2df5ceb0b] master: Fix: Comments in clang-tidy checks list is not allowed
Commit: dd2df5ceb0bfe5db7d6ee2c4865310672d7d9c9c Author: Sebastian Parborg Date: Fri May 6 14:41:58 2022 +0200 Branches: master https://developer.blender.org/rBdd2df5ceb0bfe5db7d6ee2c4865310672d7d9c9c Fix: Comments in clang-tidy checks list is not allowed Clang-tidy will not parse any options after the comment. === M .clang-tidy === diff --git a/.clang-tidy b/.clang-tidy index 1cc0e6e7f4a..bbd51291918 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -1,6 +1,8 @@ # The warnings below are disabled because they are too pedantic and not worth fixing. # Some of them will be enabled as part of the Clang-Tidy task, see T78535. +# NOTE: No comments in the list below is allowed. Clang-tidy will ignore items after comments in the lists flag list. +# This is because the comment is not a valid list item and it will stop parsing flags if a list item is a comment. Checks: > -*, readability-*, @@ -42,8 +44,6 @@ Checks: > -modernize-use-nodiscard, -modernize-loop-convert, -modernize-pass-by-value, - # Cannot be enabled yet, because using raw string literals in tests breaks - # the windows compiler currently. -modernize-raw-string-literal, -modernize-return-braced-init-list ___ 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] [f23f831e914] master: Clang-tidy: Don't warn about unrecognized compiler flags
Commit: f23f831e91424afe564573ef00b31984bcde6ec3 Author: Sebastian Parborg Date: Fri May 6 15:21:54 2022 +0200 Branches: master https://developer.blender.org/rBf23f831e91424afe564573ef00b31984bcde6ec3 Clang-tidy: Don't warn about unrecognized compiler flags When using GCC, clang-tidy will still use clang under the hood but GCC flags will still be passed. Therefore we will ignore any warnings about unrecognized flags as we don't care about this when running clang-tidy. === M source/CMakeLists.txt === diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index ffc4d37f622..d0592e9a405 100644 --- a/source/CMakeLists.txt +++ b/source/CMakeLists.txt @@ -15,8 +15,9 @@ if(WITH_CLANG_TIDY AND NOT MSVC) endif() find_package(ClangTidy REQUIRED) - set(CMAKE_C_CLANG_TIDY ${CLANG_TIDY_EXECUTABLE}) - set(CMAKE_CXX_CLANG_TIDY ${CLANG_TIDY_EXECUTABLE}) + set(CMAKE_C_CLANG_TIDY +${CLANG_TIDY_EXECUTABLE};--extra-arg=-Wno-error=unknown-warning-option) + set(CMAKE_CXX_CLANG_TIDY ${CLANG_TIDY_EXECUTABLE};--extra-arg=-Wno-error=unknown-warning-option) endif() add_subdirectory(blender) ___ 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] [763b8f14237] master: Clang-tidy: Ignore variable name length and .c/.cc include warnings
Commit: 763b8f14237fd534fc9ebd3a8ed82c57ca8b5463 Author: Sebastian Parborg Date: Fri May 6 14:47:45 2022 +0200 Branches: master https://developer.blender.org/rB763b8f14237fd534fc9ebd3a8ed82c57ca8b5463 Clang-tidy: Ignore variable name length and .c/.cc include warnings After some internal discussion it was decided that we should ignore name variable length tidy warnings. Otherwise we would have warnings for every variable that is under three characters long. Additionally we will also ignore any warnings when including non header files as the Unity library in our build system uses this excessively === M .clang-tidy === diff --git a/.clang-tidy b/.clang-tidy index bbd51291918..42ce52d58ca 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -16,10 +16,9 @@ Checks: > -readability-make-member-function-const, -readability-suspicious-call-argument, -readability-redundant-member-init, - -readability-misleading-indentation, - -readability-use-anyofallof, + -readability-identifier-length, -readability-function-cognitive-complexity, @@ -37,6 +36,8 @@ Checks: > -bugprone-redundant-branch-condition, + -bugprone-suspicious-include, + modernize-*, -modernize-use-auto, -modernize-use-trailing-return-type, ___ 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] [562fd83b915] temp-viewport-compositor-merge: Merge branch 'master' into temp-viewport-compositor-merge
Commit: 562fd83b9156a67e9d4930d194cbff843b8216b7 Author: Omar Emara Date: Fri May 6 15:13:47 2022 +0200 Branches: temp-viewport-compositor-merge https://developer.blender.org/rB562fd83b9156a67e9d4930d194cbff843b8216b7 Merge branch 'master' into temp-viewport-compositor-merge === === diff --cc source/blender/gpu/CMakeLists.txt index 3eea33d2906,5fee9167362..80cc2ac3013 --- a/source/blender/gpu/CMakeLists.txt +++ b/source/blender/gpu/CMakeLists.txt @@@ -308,47 -308,9 +308,47 @@@ set(GLSL_SR shaders/common/gpu_shader_common_curves.glsl shaders/common/gpu_shader_common_hash.glsl shaders/common/gpu_shader_common_math.glsl - shaders/common/gpu_shader_common_math_utilities.glsl + shaders/common/gpu_shader_common_math_utils.glsl shaders/common/gpu_shader_common_mix_rgb.glsl + shaders/compositor/compositor_alpha_crop.glsl + shaders/compositor/compositor_blur.glsl + shaders/compositor/compositor_convert.glsl + shaders/compositor/compositor_filter.glsl + shaders/compositor/compositor_flip.glsl + shaders/compositor/compositor_image_crop.glsl + shaders/compositor/compositor_projector_lens_distortion.glsl + shaders/compositor/compositor_realize_on_domain.glsl + shaders/compositor/compositor_screen_lens_distortion.glsl + shaders/compositor/compositor_split_viewer.glsl + + shaders/compositor/library/gpu_shader_compositor_alpha_over.glsl + shaders/compositor/library/gpu_shader_compositor_bright_contrast.glsl + shaders/compositor/library/gpu_shader_compositor_channel_matte.glsl + shaders/compositor/library/gpu_shader_compositor_chroma_matte.glsl + shaders/compositor/library/gpu_shader_compositor_color_balance.glsl + shaders/compositor/library/gpu_shader_compositor_color_correction.glsl + shaders/compositor/library/gpu_shader_compositor_color_matte.glsl + shaders/compositor/library/gpu_shader_compositor_color_spill.glsl + shaders/compositor/library/gpu_shader_compositor_color_to_luminance.glsl + shaders/compositor/library/gpu_shader_compositor_difference_matte.glsl + shaders/compositor/library/gpu_shader_compositor_distance_matte.glsl + shaders/compositor/library/gpu_shader_compositor_exposure.glsl + shaders/compositor/library/gpu_shader_compositor_gamma.glsl + shaders/compositor/library/gpu_shader_compositor_hue_correct.glsl + shaders/compositor/library/gpu_shader_compositor_hue_saturation_value.glsl + shaders/compositor/library/gpu_shader_compositor_invert.glsl + shaders/compositor/library/gpu_shader_compositor_load_input.glsl + shaders/compositor/library/gpu_shader_compositor_luminance_matte.glsl + shaders/compositor/library/gpu_shader_compositor_map_value.glsl + shaders/compositor/library/gpu_shader_compositor_normal.glsl + shaders/compositor/library/gpu_shader_compositor_posterize.glsl + shaders/compositor/library/gpu_shader_compositor_separate_combine.glsl + shaders/compositor/library/gpu_shader_compositor_set_alpha.glsl + shaders/compositor/library/gpu_shader_compositor_store_output.glsl + shaders/compositor/library/gpu_shader_compositor_texture_utilities.glsl + shaders/compositor/library/gpu_shader_compositor_type_conversion.glsl + shaders/material/gpu_shader_material_add_shader.glsl shaders/material/gpu_shader_material_ambient_occlusion.glsl shaders/material/gpu_shader_material_anisotropic.glsl diff --cc source/blender/gpu/shaders/common/gpu_shader_common_math_utils.glsl index 582027a652a,124654963fd..1ba22b4c5da --- a/source/blender/gpu/shaders/common/gpu_shader_common_math_utils.glsl +++ b/source/blender/gpu/shaders/common/gpu_shader_common_math_utils.glsl @@@ -124,24 -109,13 +120,29 @@@ void vector_normalize(vec3 normal, out outnormal = normalize(normal); } + void vector_copy(vec3 normal, out vec3 outnormal) + { + outnormal = normal; + } + +vec3 fallback_pow(vec3 a, float b, vec3 fallback) +{ + return vec3(fallback_pow(a.x, b, fallback.x), + fallback_pow(a.y, b, fallback.y), + fallback_pow(a.z, b, fallback.z)); +} + /* Matirx Math */ +/* Return a 2D rotation matrix with the angle that the input 2D vector makes with the x axis. */ +mat2 vector_to_rotation_matrix(vec2 vector) +{ + vec2 normalized_vector = normalize(vector); + float cos_angle = normalized_vector.x; + float sin_angle = normalized_vector.y; + return mat2(cos_angle, sin_angle, -sin_angle, cos_angle); +} + mat3 euler_to_mat3(vec3 euler) { float cx = cos(euler.x); diff --cc source/blender/gpu/shaders/compositor/library/gpu_shader_compositor_bright_contrast.glsl index ba52465b66c,000..ce71b4fd8a4 mode 100644,00..100644 --- a/source/blender/gpu/shaders/compositor/library/gpu_shader_compositor_bright_contrast.glsl +++ b/source/blender/gpu/shaders/compositor/library/gpu_shader_compositor_bright_contrast.glsl @@@ -1,38 -1,0 +1,38
[Bf-blender-cvs] [2ba081f59bc] master: Curves: disable Empty Hair operator when there is no active mesh
Commit: 2ba081f59bc62f1fc7f59a6391c001c5a9281c53 Author: Jacques Lucke Date: Fri May 6 15:17:44 2022 +0200 Branches: master https://developer.blender.org/rB2ba081f59bc62f1fc7f59a6391c001c5a9281c53 Curves: disable Empty Hair operator when there is no active mesh === M source/blender/editors/object/object_add.cc === diff --git a/source/blender/editors/object/object_add.cc b/source/blender/editors/object/object_add.cc index 4b838297b7b..820f500d172 100644 --- a/source/blender/editors/object/object_add.cc +++ b/source/blender/editors/object/object_add.cc @@ -2116,6 +2116,21 @@ static int object_curves_empty_hair_add_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } +static bool object_curves_empty_hair_add_poll(bContext *C) +{ + if (!U.experimental.use_new_curves_type) { +return false; + } + if (!ED_operator_objectmode(C)) { +return false; + } + Object *ob = CTX_data_active_object(C); + if (ob == nullptr || ob->type != OB_MESH) { +return false; + } + return true; +} + void OBJECT_OT_curves_empty_hair_add(wmOperatorType *ot) { ot->name = "Add Empty Curves"; @@ -2123,7 +2138,7 @@ void OBJECT_OT_curves_empty_hair_add(wmOperatorType *ot) ot->idname = "OBJECT_OT_curves_empty_hair_add"; ot->exec = object_curves_empty_hair_add_exec; - ot->poll = object_curves_add_poll; + ot->poll = object_curves_empty_hair_add_poll; ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; ___ 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] [cdd2c8bd07d] master: Merge branch 'blender-v3.2-release'
Commit: cdd2c8bd07d1a37f7a8382a1d216f6660dcbc441 Author: Bastien Montagne Date: Fri May 6 15:07:00 2022 +0200 Branches: master https://developer.blender.org/rBcdd2c8bd07d1a37f7a8382a1d216f6660dcbc441 Merge branch 'blender-v3.2-release' === === ___ 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] [acafc7327ec] blender-v3.2-release: Fix T97466: Assert when pack sound in blender DEBUG.
Commit: acafc7327ec94358d7b9599a153c509989b809ed Author: Bastien Montagne Date: Fri May 6 15:05:26 2022 +0200 Branches: blender-v3.2-release https://developer.blender.org/rBacafc7327ec94358d7b9599a153c509989b809ed Fix T97466: Assert when pack sound in blender DEBUG. This was very old code from 2008, totaly invalid with new depgraph & evaluation system, now we just need to tag the Sound ID for update. === M source/blender/editors/sound/sound_ops.c === diff --git a/source/blender/editors/sound/sound_ops.c b/source/blender/editors/sound/sound_ops.c index a63ed142ed8..2a8a2be8b65 100644 --- a/source/blender/editors/sound/sound_ops.c +++ b/source/blender/editors/sound/sound_ops.c @@ -761,7 +761,8 @@ static int sound_pack_exec(bContext *C, wmOperator *op) sound->packedfile = BKE_packedfile_new( op->reports, sound->filepath, ID_BLEND_PATH(bmain, >id)); - BKE_sound_load(bmain, sound); + + DEG_id_tag_update_ex(bmain, >id, ID_RECALC_AUDIO); return OPERATOR_FINISHED; } ___ 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] [edc92f779ec] master: Curves: support converting legacy curves to new curves object
Commit: edc92f779ec1024664178e09d114e4ac85875058 Author: Jacques Lucke Date: Fri May 6 14:39:36 2022 +0200 Branches: master https://developer.blender.org/rBedc92f779ec1024664178e09d114e4ac85875058 Curves: support converting legacy curves to new curves object This extends the existing object type conversion operator. Currently, it is limited to converting to curves when the evaluated source mesh actually has curves. This might not be the case when it is converted to a mesh by some modifier during evaluation. Differential Revision: https://developer.blender.org/D14872 === M source/blender/editors/object/object_add.cc === diff --git a/source/blender/editors/object/object_add.cc b/source/blender/editors/object/object_add.cc index db8860efdd8..4b838297b7b 100644 --- a/source/blender/editors/object/object_add.cc +++ b/source/blender/editors/object/object_add.cc @@ -2762,9 +2762,32 @@ static const EnumPropertyItem convert_target_items[] = { "Point Cloud", "Point Cloud from Mesh objects"}, #endif +{OB_CURVES, "CURVES", ICON_OUTLINER_OB_CURVES, "Curves", "Curves from evaluated curve data"}, {0, nullptr, 0, nullptr, nullptr}, }; +static const EnumPropertyItem *convert_target_items_fn(bContext *UNUSED(C), + PointerRNA *UNUSED(ptr), + PropertyRNA *UNUSED(prop), + bool *r_free) +{ + EnumPropertyItem *items = nullptr; + int items_num = 0; + for (const EnumPropertyItem *item = convert_target_items; item->identifier != nullptr; item++) { +if (item->value == OB_CURVES) { + if (U.experimental.use_new_curves_type) { +RNA_enum_item_add(, _num, item); + } +} +else { + RNA_enum_item_add(, _num, item); +} + } + RNA_enum_item_end(, _num); + *r_free = true; + return items; +} + static void object_data_convert_ensure_curve_cache(Depsgraph *depsgraph, Scene *scene, Object *ob) { if (ob->runtime.curve_cache == nullptr) { @@ -3065,6 +3088,50 @@ static int object_convert_exec(bContext *C, wmOperator *op) } ob_gpencil->actcol = actcol; } +else if (target == OB_CURVES) { + ob->flag |= OB_DONE; + + Object *ob_eval = DEG_get_evaluated_object(depsgraph, ob); + GeometrySet geometry; + if (ob_eval->runtime.geometry_set_eval != nullptr) { +geometry = *ob_eval->runtime.geometry_set_eval; + } + + if (geometry.has_curves()) { +if (keep_original) { + basen = duplibase_for_convert(bmain, depsgraph, scene, view_layer, base, nullptr); + newob = basen->object; + + /* Decrement original curve's usage count. */ + Curve *legacy_curve = static_cast(newob->data); + id_us_min(_curve->id); + + /* Make a copy of the curve. */ + newob->data = BKE_id_copy(bmain, _curve->id); +} +else { + newob = ob; +} + +const CurveComponent _component = *geometry.get_component_for_read(); +const Curves *curves_eval = curve_component.get_for_read(); +Curves *new_curves = static_cast(BKE_id_new(bmain, ID_CV, newob->id.name + 2)); + +newob->data = new_curves; +newob->type = OB_CURVES; + +blender::bke::CurvesGeometry::wrap( +new_curves->geometry) = blender::bke::CurvesGeometry::wrap(curves_eval->geometry); +BKE_object_material_from_eval_data(bmain, newob, _eval->id); + +BKE_object_free_derived_caches(newob); +BKE_object_free_modifiers(newob, 0); + } + else { +BKE_reportf( +op->reports, RPT_WARNING, "Object '%s' has no evaluated curves data", ob->id.name + 2); + } +} else if (ob->type == OB_MESH && target == OB_POINTCLOUD) { ob->flag |= OB_DONE; @@ -3480,6 +3547,7 @@ void OBJECT_OT_convert(wmOperatorType *ot) /* properties */ ot->prop = RNA_def_enum( ot->srna, "target", convert_target_items, OB_MESH, "Target", "Type of object to convert to"); + RNA_def_enum_funcs(ot->prop, convert_target_items_fn); RNA_def_boolean(ot->srna, "keep_original", false, ___ 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] [c7bffc8fa27] master: obj: move parsing utilities out of io_common, since they are fairly obj specific
Commit: c7bffc8fa27b4ae2c92e018dc5f8f79e0dfff9b9 Author: Aras Pranckevicius Date: Fri May 6 14:53:56 2022 +0300 Branches: master https://developer.blender.org/rBc7bffc8fa27b4ae2c92e018dc5f8f79e0dfff9b9 obj: move parsing utilities out of io_common, since they are fairly obj specific As pointed out in https://developer.blender.org/rB213cd39b6db387bd88f12589fd50ff0e6563cf56#341113, the utilities are quite OBJ specific due to treating backslash as a line continuation character. It's unlikely that other formats need that. No functionality changes, just pure code move (and renamed tests so that their names reflect obj). Reviewed By: Campbell Barton Differential Revision: https://developer.blender.org/D14871 === M source/blender/io/common/CMakeLists.txt M source/blender/io/wavefront_obj/CMakeLists.txt M source/blender/io/wavefront_obj/importer/obj_import_file_reader.cc M source/blender/io/wavefront_obj/importer/obj_import_mtl.cc R095source/blender/io/common/intern/string_utils.cc source/blender/io/wavefront_obj/importer/obj_import_string_utils.cc R085source/blender/io/common/IO_string_utils.hh source/blender/io/wavefront_obj/importer/obj_import_string_utils.hh R089source/blender/io/common/intern/string_utils_test.cc source/blender/io/wavefront_obj/tests/obj_import_string_utils_tests.cc === diff --git a/source/blender/io/common/CMakeLists.txt b/source/blender/io/common/CMakeLists.txt index b1add38bf01..02bd5b2b81f 100644 --- a/source/blender/io/common/CMakeLists.txt +++ b/source/blender/io/common/CMakeLists.txt @@ -7,8 +7,6 @@ set(INC ../../blenlib ../../depsgraph ../../makesdna - ../../../../intern/guardedalloc - ../../../../extern/fast_float ) set(INC_SYS @@ -19,11 +17,9 @@ set(SRC intern/dupli_parent_finder.cc intern/dupli_persistent_id.cc intern/object_identifier.cc - intern/string_utils.cc IO_abstract_hierarchy_iterator.h IO_dupli_persistent_id.hh - IO_string_utils.hh IO_types.h intern/dupli_parent_finder.hh ) @@ -42,7 +38,6 @@ if(WITH_GTESTS) intern/abstract_hierarchy_iterator_test.cc intern/hierarchy_context_order_test.cc intern/object_identifier_test.cc -intern/string_utils_test.cc ) set(TEST_INC ../../blenloader diff --git a/source/blender/io/wavefront_obj/CMakeLists.txt b/source/blender/io/wavefront_obj/CMakeLists.txt index e0fe7ed4992..a7c4253f4d3 100644 --- a/source/blender/io/wavefront_obj/CMakeLists.txt +++ b/source/blender/io/wavefront_obj/CMakeLists.txt @@ -4,7 +4,6 @@ set(INC . ./exporter ./importer - ../common ../../blenkernel ../../blenlib ../../bmesh @@ -15,6 +14,7 @@ set(INC ../../makesrna ../../nodes ../../windowmanager + ../../../../extern/fast_float ../../../../extern/fmtlib/include ../../../../intern/guardedalloc ) @@ -35,6 +35,7 @@ set(SRC importer/obj_import_mesh.cc importer/obj_import_mtl.cc importer/obj_import_nurbs.cc + importer/obj_import_string_utils.cc importer/obj_importer.cc IO_wavefront_obj.h @@ -50,12 +51,12 @@ set(SRC importer/obj_import_mtl.hh importer/obj_import_nurbs.hh importer/obj_import_objects.hh + importer/obj_import_string_utils.hh importer/obj_importer.hh ) set(LIB bf_blenkernel - bf_io_common ) if(WITH_TBB) @@ -69,6 +70,7 @@ blender_add_lib(bf_wavefront_obj "${SRC}" "${INC}" "${INC_SYS}" "${LIB}") if(WITH_GTESTS) set(TEST_SRC tests/obj_exporter_tests.cc +tests/obj_import_string_utils_tests.cc tests/obj_importer_tests.cc tests/obj_mtl_parser_tests.cc diff --git a/source/blender/io/wavefront_obj/importer/obj_import_file_reader.cc b/source/blender/io/wavefront_obj/importer/obj_import_file_reader.cc index be322f49840..fa89b49b605 100644 --- a/source/blender/io/wavefront_obj/importer/obj_import_file_reader.cc +++ b/source/blender/io/wavefront_obj/importer/obj_import_file_reader.cc @@ -8,9 +8,8 @@ #include "BLI_string_ref.hh" #include "BLI_vector.hh" -#include "IO_string_utils.hh" - #include "obj_import_file_reader.hh" +#include "obj_import_string_utils.hh" namespace blender::io::obj { diff --git a/source/blender/io/wavefront_obj/importer/obj_import_mtl.cc b/source/blender/io/wavefront_obj/importer/obj_import_mtl.cc index c2ecd8a37de..f39def0a4af 100644 --- a/source/blender/io/wavefront_obj/importer/obj_import_mtl.cc +++ b/source/blender/io/wavefront_obj/importer/obj_import_mtl.cc @@ -13,13 +13,12 @@ #include "DNA_material_types.h" #include "DNA_node_types.h" -#include "IO_string_utils.hh" - #include "NOD_shader.h" /* TODO: move eMTLSyntaxElement out of following file into a more neutral place */ #include "obj_export_io.hh" #include "obj_import_mtl.hh" +#include "obj_import_string_utils.hh" namespace blender::io::obj { diff --git a/source/blender/io/common/intern/string_utils.cc
[Bf-blender-cvs] [bdfee6d8318] master: EEVEE: Refactor curve nodes
Commit: bdfee6d8318b6dd261adbb08ea2323784f088140 Author: Omar Emara Date: Fri May 6 13:33:23 2022 +0200 Branches: master https://developer.blender.org/rBbdfee6d8318b6dd261adbb08ea2323784f088140 EEVEE: Refactor curve nodes This patches rewrites the GPU shaders of curve nodes for easier future development. This is a non-functional change. The new code avoids code duplication by moving common code into BKE curve mapping functions. It also avoids ambiguous data embedding into the gradient vectors that are passed to vectors and reduces the size of uniforms uploaded to the shader by avoiding redundancies. This is needed in preparation for the viewport compositor, which will utilize and extend this implementation. Reviewed By: fclem Differential Revision: https://developer.blender.org/D14689 === M source/blender/blenkernel/BKE_colortools.h M source/blender/blenkernel/intern/colortools.c M source/blender/gpu/CMakeLists.txt A source/blender/gpu/shaders/common/gpu_shader_common_curves.glsl D source/blender/gpu/shaders/material/gpu_shader_material_float_curve.glsl D source/blender/gpu/shaders/material/gpu_shader_material_rgb_curves.glsl D source/blender/gpu/shaders/material/gpu_shader_material_vector_curves.glsl M source/blender/nodes/shader/nodes/node_shader_curves.cc === diff --git a/source/blender/blenkernel/BKE_colortools.h b/source/blender/blenkernel/BKE_colortools.h index 0d4560207ea..d52fd91ccdd 100644 --- a/source/blender/blenkernel/BKE_colortools.h +++ b/source/blender/blenkernel/BKE_colortools.h @@ -129,6 +129,36 @@ bool BKE_curvemapping_RGBA_does_something(const struct CurveMapping *cumap); void BKE_curvemapping_table_F(const struct CurveMapping *cumap, float **array, int *size); void BKE_curvemapping_table_RGBA(const struct CurveMapping *cumap, float **array, int *size); +/** Get the minimum x value of each curve map table. */ +void BKE_curvemapping_get_range_minimums(const struct CurveMapping *curve_mapping, + float minimums[4]); + +/** Get the reciprocal of the difference between the maximum and the minimum x value of each curve + * map table. Evaluation parameters can be multiplied by this value to be normalized. If the + * difference is zero, 1^8 is returned. */ +void BKE_curvemapping_compute_range_dividers(const struct CurveMapping *curve_mapping, + float dividers[4]); + +/** Compute the slopes at the start and end points of each curve map. The slopes are multiplied by + * the range of the curve map to compensate for parameter normalization. If the slope is vertical, + * 1^8 is returned. */ +void BKE_curvemapping_compute_slopes(const struct CurveMapping *curve_mapping, + float start_slopes[4], + float end_slopes[4]); + +/** Check if the curve map at the index is identity, that is, does nothing. A curve map is said to + * be identity if: + * - The curve mapping uses extrapolation. + * - Its range is 1. + * - The slope at its start point is 1. + * - The slope at its end point is 1. + * - The number of points is 2. + * - The start point is at (0, 0). + * - The end point is at (1, 1). + * Note that this could return false even if the curve map is identity, this happens in the case + * when more than 2 points exist in the curve map but all points are collinear. */ +bool BKE_curvemapping_is_map_identity(const struct CurveMapping *curve_mapping, int index); + /** * Call when you do images etc, needs restore too. also verifies tables. * non-const (these modify the curve). diff --git a/source/blender/blenkernel/intern/colortools.c b/source/blender/blenkernel/intern/colortools.c index c3d66d4463d..e4c46703f8a 100644 --- a/source/blender/blenkernel/intern/colortools.c +++ b/source/blender/blenkernel/intern/colortools.c @@ -1158,6 +1158,80 @@ bool BKE_curvemapping_RGBA_does_something(const CurveMapping *cumap) return false; } +void BKE_curvemapping_get_range_minimums(const CurveMapping *curve_mapping, float minimums[CM_TOT]) +{ + for (int i = 0; i < CM_TOT; i++) { +minimums[i] = curve_mapping->cm[i].mintable; + } +} + +void BKE_curvemapping_compute_range_dividers(const CurveMapping *curve_mapping, + float dividers[CM_TOT]) +{ + for (int i = 0; i < CM_TOT; i++) { +const CurveMap *curve_map = _mapping->cm[i]; +dividers[i] = 1.0f / max_ff(1e-8f, curve_map->maxtable - curve_map->mintable); + } +} + +void BKE_curvemapping_compute_slopes(const CurveMapping *curve_mapping, + float start_slopes[CM_TOT], + float end_slopes[CM_TOT]) +{ + float range_dividers[CM_TOT]; +
[Bf-blender-cvs] [8f6f28a0dc0] master: GPU: Move common shaders into a common directory
Commit: 8f6f28a0dc0ad7697863e4dcd78e85f87f9fb8db Author: Omar Emara Date: Fri May 6 12:58:14 2022 +0200 Branches: master https://developer.blender.org/rB8f6f28a0dc0ad7697863e4dcd78e85f87f9fb8db GPU: Move common shaders into a common directory This patch moves some of the utility library shaders into a common directory and makes the necessary renames across shaders. Additionally, material-specific transform functions were moved outside of math utils into a separate transform_utils.glsl file. This is needed in preparation for the viewport compositor, which will make use of some of those utilities and will require all material specific bit to be removed out of those files. Reviewed By: fclem Differential Revision: https://developer.blender.org/D14688 === M source/blender/gpu/CMakeLists.txt M source/blender/gpu/intern/gpu_shader_dependency.cc R100source/blender/gpu/shaders/material/gpu_shader_material_color_ramp.glsl source/blender/gpu/shaders/common/gpu_shader_common_color_ramp.glsl R100source/blender/gpu/shaders/material/gpu_shader_material_color_util.glsl source/blender/gpu/shaders/common/gpu_shader_common_color_utils.glsl R100source/blender/gpu/shaders/material/gpu_shader_material_hash.glsl source/blender/gpu/shaders/common/gpu_shader_common_hash.glsl R098source/blender/gpu/shaders/material/gpu_shader_material_math.glsl source/blender/gpu/shaders/common/gpu_shader_common_math.glsl R061source/blender/gpu/shaders/material/gpu_shader_material_math_util.glsl source/blender/gpu/shaders/common/gpu_shader_common_math_utils.glsl R098source/blender/gpu/shaders/material/gpu_shader_material_mix_rgb.glsl source/blender/gpu/shaders/common/gpu_shader_common_mix_rgb.glsl M source/blender/gpu/shaders/material/gpu_shader_material_combine_color.glsl M source/blender/gpu/shaders/material/gpu_shader_material_combine_hsv.glsl M source/blender/gpu/shaders/material/gpu_shader_material_fractal_noise.glsl M source/blender/gpu/shaders/material/gpu_shader_material_gamma.glsl M source/blender/gpu/shaders/material/gpu_shader_material_hair_info.glsl M source/blender/gpu/shaders/material/gpu_shader_material_hue_sat_val.glsl M source/blender/gpu/shaders/material/gpu_shader_material_map_range.glsl M source/blender/gpu/shaders/material/gpu_shader_material_mapping.glsl M source/blender/gpu/shaders/material/gpu_shader_material_noise.glsl M source/blender/gpu/shaders/material/gpu_shader_material_point_info.glsl M source/blender/gpu/shaders/material/gpu_shader_material_separate_color.glsl M source/blender/gpu/shaders/material/gpu_shader_material_separate_hsv.glsl M source/blender/gpu/shaders/material/gpu_shader_material_tex_brick.glsl M source/blender/gpu/shaders/material/gpu_shader_material_tex_environment.glsl M source/blender/gpu/shaders/material/gpu_shader_material_tex_musgrave.glsl M source/blender/gpu/shaders/material/gpu_shader_material_tex_noise.glsl M source/blender/gpu/shaders/material/gpu_shader_material_tex_voronoi.glsl M source/blender/gpu/shaders/material/gpu_shader_material_tex_wave.glsl M source/blender/gpu/shaders/material/gpu_shader_material_tex_white_noise.glsl A source/blender/gpu/shaders/material/gpu_shader_material_transform_utils.glsl M source/blender/gpu/shaders/material/gpu_shader_material_vector_math.glsl M source/blender/gpu/shaders/material/gpu_shader_material_vector_rotate.glsl === diff --git a/source/blender/gpu/CMakeLists.txt b/source/blender/gpu/CMakeLists.txt index 1e54d5fb7ee..dc542411596 100644 --- a/source/blender/gpu/CMakeLists.txt +++ b/source/blender/gpu/CMakeLists.txt @@ -303,6 +303,13 @@ set(GLSL_SRC shaders/gpu_shader_geometry.glsl + shaders/common/gpu_shader_common_color_ramp.glsl + shaders/common/gpu_shader_common_color_utils.glsl + shaders/common/gpu_shader_common_hash.glsl + shaders/common/gpu_shader_common_math.glsl + shaders/common/gpu_shader_common_math_utils.glsl + shaders/common/gpu_shader_common_mix_rgb.glsl + shaders/material/gpu_shader_material_add_shader.glsl shaders/material/gpu_shader_material_ambient_occlusion.glsl shaders/material/gpu_shader_material_anisotropic.glsl @@ -315,8 +322,6 @@ set(GLSL_SRC shaders/material/gpu_shader_material_bump.glsl shaders/material/gpu_shader_material_camera.glsl shaders/material/gpu_shader_material_clamp.glsl - shaders/material/gpu_shader_material_color_ramp.glsl - shaders/material/gpu_shader_material_color_util.glsl shaders/material/gpu_shader_material_combine_color.glsl shaders/material/gpu_shader_material_combine_hsv.glsl shaders/material/gpu_shader_material_combine_rgb.glsl @@ -334,7 +339,6 @@ set(GLSL_SRC shaders/material/gpu_shader_material_glossy.glsl
[Bf-blender-cvs] [f5428736a76] master: Cleanup: Trailing white-space
Commit: f5428736a76add4bce46da452aed6bd04ee8e71b Author: Dalai Felinto Date: Fri May 6 12:32:11 2022 +0200 Branches: master https://developer.blender.org/rBf5428736a76add4bce46da452aed6bd04ee8e71b Cleanup: Trailing white-space === M release/scripts/startup/bl_ui/space_view3d.py === diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py index b5bbf33b6bc..60a28fb1ebf 100644 --- a/release/scripts/startup/bl_ui/space_view3d.py +++ b/release/scripts/startup/bl_ui/space_view3d.py @@ -2057,7 +2057,7 @@ class VIEW3D_MT_curve_add(Menu): layout.operator("curve.primitive_nurbs_circle_add", text="Nurbs Circle", icon='CURVE_NCIRCLE') layout.operator("curve.primitive_nurbs_path_add", text="Path", icon='CURVE_PATH') -experimental = context.preferences.experimental +experimental = context.preferences.experimental if experimental.use_new_curves_type: layout.separator() ___ 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] [d02b8c1c3b8] master: UI: Expand the Snap Curves to Surface operator
Commit: d02b8c1c3b8b5b3abe3728581126ffea7b4f4996 Author: Dalai Felinto Date: Fri May 6 12:15:31 2022 +0200 Branches: master https://developer.blender.org/rBd02b8c1c3b8b5b3abe3728581126ffea7b4f4996 UI: Expand the Snap Curves to Surface operator The different methods are too different. It is worth having them as individual choices by the users. Differential Revision: https://developer.blender.org/D14873 === M release/scripts/startup/bl_ui/space_view3d.py === diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py index 660e7b2322b..b5bbf33b6bc 100644 --- a/release/scripts/startup/bl_ui/space_view3d.py +++ b/release/scripts/startup/bl_ui/space_view3d.py @@ -3149,7 +3149,9 @@ class VIEW3D_MT_sculpt_curves(Menu): def draw(self, _context): layout = self.layout -layout.operator("curves.snap_curves_to_surface") +layout.operator("curves.snap_curves_to_surface", text="Snap to Deformed Surface").attach_mode = 'DEFORM' +layout.operator("curves.snap_curves_to_surface", text="Snap to Nearest Surface").attach_mode = 'NEAREST' +layout.separator() layout.operator("curves.convert_to_particle_system", text="Convert to Particle System") ___ 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] [90042b7d796] blender-v3.2-release: Switch viewport shading for color tools in solid mode
Commit: 90042b7d796608cf680620041785bfa432975d48 Author: Ramil Roosileht Date: Fri May 6 12:29:51 2022 +0200 Branches: blender-v3.2-release https://developer.blender.org/rB90042b7d796608cf680620041785bfa432975d48 Switch viewport shading for color tools in solid mode This patch implements T97613, switching viewport shading when using Color Filter and Mask By Color ALSO, this patch makes it so viewport shading color switches only when SOLID mode is chosen, to prevent color switching when using other shading modes, without user noticing it. {F13049889} Reviewed By: JulienKaspar, joeedh, jbakker Maniphest Tasks: T97613 Differential Revision: https://developer.blender.org/D14765 === M source/blender/editors/sculpt_paint/sculpt.c M source/blender/editors/sculpt_paint/sculpt_filter_color.c M source/blender/editors/sculpt_paint/sculpt_ops.c === diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index 32b7047c2b0..85ea5d5bfc6 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -5281,7 +5281,7 @@ static bool sculpt_stroke_test_start(bContext *C, struct wmOperator *op, const f * canvas it is painting on. (ref. use_sculpt_texture_paint). */ if (brush && SCULPT_TOOL_NEEDS_COLOR(brush->sculpt_tool)) { View3D *v3d = CTX_wm_view3d(C); - if (v3d) { + if (v3d->shading.type == OB_SOLID) { v3d->shading.color_type = V3D_SHADING_VERTEX_COLOR; } } diff --git a/source/blender/editors/sculpt_paint/sculpt_filter_color.c b/source/blender/editors/sculpt_paint/sculpt_filter_color.c index 09f13ff110d..c0db587f69a 100644 --- a/source/blender/editors/sculpt_paint/sculpt_filter_color.c +++ b/source/blender/editors/sculpt_paint/sculpt_filter_color.c @@ -328,8 +328,12 @@ static int sculpt_color_filter_invoke(bContext *C, wmOperator *op, const wmEvent { Object *ob = CTX_data_active_object(C); Sculpt *sd = CTX_data_tool_settings(C)->sculpt; + View3D *v3d = CTX_wm_view3d(C); SculptSession *ss = ob->sculpt; PBVH *pbvh = ob->sculpt->pbvh; + if (v3d->shading.type == OB_SOLID) { +v3d->shading.color_type = V3D_SHADING_VERTEX_COLOR; + } const bool use_automasking = SCULPT_is_automasking_enabled(sd, ss, NULL); if (use_automasking) { diff --git a/source/blender/editors/sculpt_paint/sculpt_ops.c b/source/blender/editors/sculpt_paint/sculpt_ops.c index 2b5a20205bd..5aa1dbef74c 100644 --- a/source/blender/editors/sculpt_paint/sculpt_ops.c +++ b/source/blender/editors/sculpt_paint/sculpt_ops.c @@ -1043,6 +1043,10 @@ static int sculpt_mask_by_color_invoke(bContext *C, wmOperator *op, const wmEven Depsgraph *depsgraph = CTX_data_depsgraph_pointer(C); Object *ob = CTX_data_active_object(C); SculptSession *ss = ob->sculpt; + View3D *v3d = CTX_wm_view3d(C); + if (v3d->shading.type == OB_SOLID) { +v3d->shading.color_type = V3D_SHADING_VERTEX_COLOR; + } BKE_sculpt_update_object_for_edit(depsgraph, ob, true, true, false); ___ 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] [b1517e26e28] master: Curves: use old Add > Curve menu for new curves object
Commit: b1517e26e288bfb2a1718fc7a7cf3221edbbc8c9 Author: Jacques Lucke Date: Fri May 6 12:06:57 2022 +0200 Branches: master https://developer.blender.org/rBb1517e26e288bfb2a1718fc7a7cf3221edbbc8c9 Curves: use old Add > Curve menu for new curves object * Removes the `Curves` menu (leaving only `Curve`). * The `Curve > Random` option is still useful for testing, but it's under the second experimental flag so that it is turned off when only the "master ready" features are enabled. Differential Revision: https://developer.blender.org/D14861 === M release/scripts/startup/bl_ui/space_view3d.py === diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py index b65079c0f36..660e7b2322b 100644 --- a/release/scripts/startup/bl_ui/space_view3d.py +++ b/release/scripts/startup/bl_ui/space_view3d.py @@ -2043,7 +2043,7 @@ class VIEW3D_MT_curve_add(Menu): bl_idname = "VIEW3D_MT_curve_add" bl_label = "Curve" -def draw(self, _context): +def draw(self, context): layout = self.layout layout.operator_context = 'INVOKE_REGION_WIN' @@ -2057,18 +2057,14 @@ class VIEW3D_MT_curve_add(Menu): layout.operator("curve.primitive_nurbs_circle_add", text="Nurbs Circle", icon='CURVE_NCIRCLE') layout.operator("curve.primitive_nurbs_path_add", text="Path", icon='CURVE_PATH') +experimental = context.preferences.experimental +if experimental.use_new_curves_type: +layout.separator() -class VIEW3D_MT_curves_add(Menu): -bl_idname = "VIEW3D_MT_curves_add" -bl_label = "Curves" - -def draw(self, _context): -layout = self.layout - -layout.operator_context = 'INVOKE_REGION_WIN' +layout.operator("object.curves_empty_hair_add", text="Empty Hair", icon='CURVES_DATA') -layout.operator("object.curves_empty_hair_add", text="Empty Hair", icon='CURVES_DATA') -layout.operator("object.curves_random_add", text="Random", icon='CURVES_DATA') +if experimental.use_new_curves_tools: +layout.operator("object.curves_random_add", text="Random", icon='CURVES_DATA') class VIEW3D_MT_surface_add(Menu): @@ -2223,8 +2219,6 @@ class VIEW3D_MT_add(Menu): # layout.operator_menu_enum("object.curve_add", "type", text="Curve", icon='OUTLINER_OB_CURVE') layout.menu("VIEW3D_MT_curve_add", icon='OUTLINER_OB_CURVE') -if context.preferences.experimental.use_new_curves_type: -layout.menu("VIEW3D_MT_curves_add", icon='OUTLINER_OB_CURVES') # layout.operator_menu_enum("object.surface_add", "type", text="Surface", icon='OUTLINER_OB_SURFACE') layout.menu("VIEW3D_MT_surface_add", icon='OUTLINER_OB_SURFACE') layout.menu("VIEW3D_MT_metaball_add", text="Metaball", icon='OUTLINER_OB_META') @@ -7662,7 +7656,6 @@ classes = ( VIEW3D_MT_angle_control, VIEW3D_MT_mesh_add, VIEW3D_MT_curve_add, -VIEW3D_MT_curves_add, VIEW3D_MT_surface_add, VIEW3D_MT_edit_metaball_context_menu, VIEW3D_MT_metaball_add, ___ 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] [ce3dd12371f] master: USD: add volume/VDB export
Commit: ce3dd12371f5bd02eb64488712d8c529ffe62f6b Author: Piotr Makal Date: Fri May 6 11:36:27 2022 +0200 Branches: master https://developer.blender.org/rBce3dd12371f5bd02eb64488712d8c529ffe62f6b USD: add volume/VDB export Add support for volume (OpenVDB) USD export: - Allows to export both static and animated volumes. - Supports volumes that have OpenVDB data from files or are generated in Blender with 'Mesh to Volume' modifier. - For volumes that have generated data in Blender it also exports corresponding .vdb files. Those files are saved in a new folder named "volumes". - Slightly changes the USD export UI panel. "Relative Texture Paths" becomes "Relative Paths" (and has separate UI box) as the functionality will now apply to both textures and volumes. Disabling of this option due to "Materials" checkbox being turned off has been removed. Reviewed By: sybren, makowalski Differential Revision: https://developer.blender.org/D14193 Manifest Task: T95407 === M source/blender/editors/io/io_usd.c M source/blender/io/alembic/exporter/abc_export_capi.cc M source/blender/io/alembic/exporter/abc_hierarchy_iterator.cc M source/blender/io/alembic/exporter/abc_hierarchy_iterator.h M source/blender/io/common/IO_abstract_hierarchy_iterator.h M source/blender/io/common/intern/abstract_hierarchy_iterator.cc M source/blender/io/common/intern/abstract_hierarchy_iterator_test.cc M source/blender/io/usd/CMakeLists.txt M source/blender/io/usd/intern/usd_capi_export.cc M source/blender/io/usd/intern/usd_exporter_context.h M source/blender/io/usd/intern/usd_hierarchy_iterator.cc M source/blender/io/usd/intern/usd_hierarchy_iterator.h M source/blender/io/usd/intern/usd_writer_abstract.cc M source/blender/io/usd/intern/usd_writer_abstract.h M source/blender/io/usd/intern/usd_writer_material.cc A source/blender/io/usd/intern/usd_writer_volume.cc A source/blender/io/usd/intern/usd_writer_volume.h M source/blender/io/usd/usd.h === diff --git a/source/blender/editors/io/io_usd.c b/source/blender/editors/io/io_usd.c index e0616a0cec3..97ca9b026ec 100644 --- a/source/blender/editors/io/io_usd.c +++ b/source/blender/editors/io/io_usd.c @@ -118,7 +118,7 @@ static int wm_usd_export_exec(bContext *C, wmOperator *op) const bool generate_preview_surface = RNA_boolean_get(op->ptr, "generate_preview_surface"); const bool export_textures = RNA_boolean_get(op->ptr, "export_textures"); const bool overwrite_textures = RNA_boolean_get(op->ptr, "overwrite_textures"); - const bool relative_texture_paths = RNA_boolean_get(op->ptr, "relative_texture_paths"); + const bool relative_paths = RNA_boolean_get(op->ptr, "relative_paths"); struct USDExportParams params = { export_animation, @@ -133,7 +133,7 @@ static int wm_usd_export_exec(bContext *C, wmOperator *op) generate_preview_surface, export_textures, overwrite_textures, - relative_texture_paths, + relative_paths, }; bool ok = USD_export(C, filename, , as_background_job); @@ -181,9 +181,9 @@ static void wm_usd_export_draw(bContext *UNUSED(C), wmOperator *op) const bool export_tex = RNA_boolean_get(ptr, "export_textures"); uiLayoutSetActive(row, export_mtl && preview && export_tex); - row = uiLayoutRow(col, true); - uiItemR(row, ptr, "relative_texture_paths", 0, NULL, ICON_NONE); - uiLayoutSetActive(row, export_mtl && preview); + box = uiLayoutBox(layout); + col = uiLayoutColumnWithHeading(box, true, IFACE_("File References")); + uiItemR(col, ptr, "relative_paths", 0, NULL, ICON_NONE); box = uiLayoutBox(layout); uiItemL(box, IFACE_("Experimental"), ICON_NONE); @@ -282,10 +282,11 @@ void WM_OT_usd_export(struct wmOperatorType *ot) "Allow overwriting existing texture files when exporting textures"); RNA_def_boolean(ot->srna, - "relative_texture_paths", + "relative_paths", true, - "Relative Texture Paths", - "Make texture asset paths relative to the USD file"); + "Relative Paths", + "Use relative paths to reference external files (i.e. textures, volumes) in " + "USD, otherwise use absolute paths"); } /* == USD Import == */ diff --git a/source/blender/io/alembic/exporter/abc_export_capi.cc b/source/blender/io/alembic/exporter/abc_export_capi.cc index c1ff7df0c37..edaf53b3efa 100644 --- a/source/blender/io/alembic/exporter/abc_export_capi.cc +++ b/source/blender/io/alembic/exporter/abc_export_capi.cc @@ -115,7 +115,7 @@ static void export_startjob(void *customdata, return; } - ABCHierarchyIterator iter(data->depsgraph, abc_archive.get(), data->params); + ABCHierarchyIterator
[Bf-blender-cvs] [f3b56246d1e] master: Cleanup: improve const correctness in material API
Commit: f3b56246d1ef113a434cc647c6865f91631bc18d Author: Jacques Lucke Date: Fri May 6 11:37:22 2022 +0200 Branches: master https://developer.blender.org/rBf3b56246d1ef113a434cc647c6865f91631bc18d Cleanup: improve const correctness in material API === M source/blender/blenkernel/BKE_material.h M source/blender/blenkernel/intern/material.c === diff --git a/source/blender/blenkernel/BKE_material.h b/source/blender/blenkernel/BKE_material.h index f38f6afff7e..05e502f06c2 100644 --- a/source/blender/blenkernel/BKE_material.h +++ b/source/blender/blenkernel/BKE_material.h @@ -52,7 +52,7 @@ void BKE_object_material_remap_calc(struct Object *ob_dst, */ void BKE_object_material_from_eval_data(struct Main *bmain, struct Object *ob_orig, -struct ID *data_eval); +const struct ID *data_eval); struct Material *BKE_material_add(struct Main *bmain, const char *name); struct Material *BKE_gpencil_material_add(struct Main *bmain, const char *name); void BKE_gpencil_material_attr_init(struct Material *ma); diff --git a/source/blender/blenkernel/intern/material.c b/source/blender/blenkernel/intern/material.c index 002b496393f..1fbe4f768ff 100644 --- a/source/blender/blenkernel/intern/material.c +++ b/source/blender/blenkernel/intern/material.c @@ -1123,15 +1123,16 @@ void BKE_object_material_remap_calc(Object *ob_dst, Object *ob_src, short *remap BLI_ghash_free(gh_mat_map, NULL, NULL); } -void BKE_object_material_from_eval_data(Main *bmain, Object *ob_orig, ID *data_eval) +void BKE_object_material_from_eval_data(Main *bmain, Object *ob_orig, const ID *data_eval) { ID *data_orig = ob_orig->data; short *orig_totcol = BKE_id_material_len_p(data_orig); Material ***orig_mat = BKE_id_material_array_p(data_orig); - short *eval_totcol = BKE_id_material_len_p(data_eval); - Material ***eval_mat = BKE_id_material_array_p(data_eval); + /* Can cast away const, because the data is not changed. */ + const short *eval_totcol = BKE_id_material_len_p((ID *)data_eval); + Material ***eval_mat = BKE_id_material_array_p((ID *)data_eval); if (ELEM(NULL, orig_totcol, orig_mat, eval_totcol, eval_mat)) { return; ___ 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] [612555121c6] temp-image-engine-float-cache: Merge branch 'blender-v3.2-release' into temp-image-engine-float-cache
Commit: 612555121c605c07c5319e4de74821e63dba6fef Author: Jeroen Bakker Date: Fri May 6 09:06:52 2022 +0200 Branches: temp-image-engine-float-cache https://developer.blender.org/rB612555121c605c07c5319e4de74821e63dba6fef Merge branch 'blender-v3.2-release' into temp-image-engine-float-cache === === diff --cc source/blender/draw/engines/image/image_drawing_mode.hh index ad0d5cd16ca,a1cd110e1d8..3a3af0f138e --- a/source/blender/draw/engines/image/image_drawing_mode.hh +++ b/source/blender/draw/engines/image/image_drawing_mode.hh @@@ -154,16 -154,15 +154,15 @@@ template class * bug or a feature. For now we just acquire to determine if there is a texture. */ void *lock; ImBuf *tile_buffer = BKE_image_acquire_ibuf(image, _user, ); - if (tile_buffer == nullptr) { - continue; + if (tile_buffer != nullptr) { - instance_data.float_buffers.mark_used(tile_buffer); ++ IMAGE_buffer_cache_mark_used(tile_buffer); + + DRWShadingGroup *shsub = DRW_shgroup_create_sub(shgrp); + float4 min_max_uv(tile_x, tile_y, tile_x + 1, tile_y + 1); + DRW_shgroup_uniform_vec4_copy(shsub, "min_max_uv", min_max_uv); + DRW_shgroup_call_obmat(shsub, info.batch, image_mat); } - IMAGE_buffer_cache_mark_used(tile_buffer); BKE_image_release_ibuf(image, tile_buffer, lock); - - DRWShadingGroup *shsub = DRW_shgroup_create_sub(shgrp); - float4 min_max_uv(tile_x, tile_y, tile_x + 1, tile_y + 1); - DRW_shgroup_uniform_vec4_copy(shsub, "min_max_uv", min_max_uv); - DRW_shgroup_call_obmat(shsub, info.batch, image_mat); } } } ___ 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] [6c3eb8193d1] temp-image-engine-float-cache: CLang format.
Commit: 6c3eb8193d162a8e72dc964327f904758f8ead94 Author: Jeroen Bakker Date: Fri May 6 09:25:31 2022 +0200 Branches: temp-image-engine-float-cache https://developer.blender.org/rB6c3eb8193d162a8e72dc964327f904758f8ead94 CLang format. === M source/blender/draw/engines/image/image_engine.cc === diff --git a/source/blender/draw/engines/image/image_engine.cc b/source/blender/draw/engines/image/image_engine.cc index 9d4031a1ae7..6fc8f4da0b9 100644 --- a/source/blender/draw/engines/image/image_engine.cc +++ b/source/blender/draw/engines/image/image_engine.cc @@ -165,7 +165,7 @@ static void IMAGE_draw_scene(void *vedata) static void IMAGE_engine_free() { -IMAGE_buffer_cache_free(); + IMAGE_buffer_cache_free(); IMAGE_shader_free(); } ___ 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] [eac403b6e15] master: BLI: Add float3x3
Commit: eac403b6e1533a96cf6fbefda5065ae1931176a4 Author: Omar Emara Date: Fri May 6 11:22:10 2022 +0200 Branches: master https://developer.blender.org/rBeac403b6e1533a96cf6fbefda5065ae1931176a4 BLI: Add float3x3 This patch adds a float3x3 class that represents a 3x3 matrix. The class can be used to represent a 2D affine transformation stored in a 3x3 matrix in column major order. The class provides various constructors and processing methods, which utilizes the existing mat3 utilities in BLI. Corresponding tests were also added. This is needed by the upcoming viewport compositor to represent domain transformations. Reviewed By: fclem Differential Revision: https://developer.blender.org/D14687 === A source/blender/blenlib/BLI_float3x3.hh M source/blender/blenlib/CMakeLists.txt A source/blender/blenlib/tests/BLI_float3x3_test.cc === diff --git a/source/blender/blenlib/BLI_float3x3.hh b/source/blender/blenlib/BLI_float3x3.hh new file mode 100644 index 000..62478556d9b --- /dev/null +++ b/source/blender/blenlib/BLI_float3x3.hh @@ -0,0 +1,192 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +#pragma once + +#include +#include + +#include "BLI_assert.h" +#include "BLI_math_base.h" +#include "BLI_math_matrix.h" +#include "BLI_math_vec_types.hh" +#include "BLI_math_vector.h" + +namespace blender { + +struct float3x3 { + /* A 3x3 matrix in column major order. */ + float values[3][3]; + + float3x3() = default; + + float3x3(const float *matrix) + { +memcpy(values, matrix, sizeof(float) * 3 * 3); + } + + float3x3(const float matrix[3][3]) : float3x3(static_cast(matrix[0])) + { + } + + static float3x3 zero() + { +float3x3 result; +zero_m3(result.values); +return result; + } + + static float3x3 identity() + { +float3x3 result; +unit_m3(result.values); +return result; + } + + static float3x3 from_translation(const float2 translation) + { +float3x3 result = identity(); +result.values[2][0] = translation.x; +result.values[2][1] = translation.y; +return result; + } + + static float3x3 from_rotation(float rotation) + { +float3x3 result = zero(); +const float cosine = std::cos(rotation); +const float sine = std::sin(rotation); +result.values[0][0] = cosine; +result.values[0][1] = sine; +result.values[1][0] = -sine; +result.values[1][1] = cosine; +result.values[2][2] = 1.0f; +return result; + } + + static float3x3 from_translation_rotation_scale(const float2 translation, + float rotation, + const float2 scale) + { +float3x3 result; +const float cosine = std::cos(rotation); +const float sine = std::sin(rotation); +result.values[0][0] = scale.x * cosine; +result.values[0][1] = scale.x * sine; +result.values[0][2] = 0.0f; +result.values[1][0] = scale.y * -sine; +result.values[1][1] = scale.y * cosine; +result.values[1][2] = 0.0f; +result.values[2][0] = translation.x; +result.values[2][1] = translation.y; +result.values[2][2] = 1.0f; +return result; + } + + static float3x3 from_normalized_axes(const float2 translation, + const float2 horizontal, + const float2 vertical) + { +BLI_ASSERT_UNIT_V2(horizontal); +BLI_ASSERT_UNIT_V2(vertical); + +float3x3 result; +result.values[0][0] = horizontal.x; +result.values[0][1] = horizontal.y; +result.values[0][2] = 0.0f; +result.values[1][0] = vertical.x; +result.values[1][1] = vertical.y; +result.values[1][2] = 0.0f; +result.values[2][0] = translation.x; +result.values[2][1] = translation.y; +result.values[2][2] = 1.0f; +return result; + } + + /* Construct a transformation that is pivoted around the given origin point. So for instance, + * from_origin_transformation(from_rotation(M_PI_2), float2(0.0f, 2.0f)) + * will construct a transformation representing a 90 degree rotation around the point (0, 2). */ + static float3x3 from_origin_transformation(const float3x3 , const float2 origin) + { +return from_translation(origin) * transformation * from_translation(-origin); + } + + operator float *() + { +return [0][0]; + } + + operator const float *() const + { +return [0][0]; + } + + float *operator[](const int64_t index) + { +BLI_assert(index >= 0); +BLI_assert(index < 3); +return [index][0]; + } + + const float *operator[](const int64_t index) const + { +BLI_assert(index >= 0); +BLI_assert(index < 3); +return [index][0]; + } + + using c_style_float3x3 = float[3][3]; + c_style_float3x3 () + { +return values; + } + + const c_style_float3x3 () const + { +return values; + } + +
[Bf-blender-cvs] [908976b09a7] master: Merge branch 'blender-v3.2-release'
Commit: 908976b09a733e750dc54c3f329f2a0c70e5b057 Author: Bastien Montagne Date: Fri May 6 11:12:58 2022 +0200 Branches: master https://developer.blender.org/rB908976b09a733e750dc54c3f329f2a0c70e5b057 Merge branch 'blender-v3.2-release' === === ___ 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] [84756b68e68] blender-v3.2-release: Add documentation about Image/ImBuf to python/RNA API.
Commit: 84756b68e68c8a25b820a8c3dda01ec7f0a59353 Author: Bastien Montagne Date: Fri May 6 11:08:10 2022 +0200 Branches: blender-v3.2-release https://developer.blender.org/rB84756b68e68c8a25b820a8c3dda01ec7f0a59353 Add documentation about Image/ImBuf to python/RNA API. Related to T95616, the relationship between Image ID and ImBuf 'cached' buffers can be fairly confusing when using the RNA API. Reviewed By: campbellbarton, jbakker Differential Revision: https://developer.blender.org/D14833 === A doc/python_api/examples/bpy.types.Image.py M source/blender/makesrna/intern/rna_image.c M source/blender/makesrna/intern/rna_image_api.c M source/blender/python/generic/imbuf_py_api.c === diff --git a/doc/python_api/examples/bpy.types.Image.py b/doc/python_api/examples/bpy.types.Image.py new file mode 100644 index 000..715623f6f76 --- /dev/null +++ b/doc/python_api/examples/bpy.types.Image.py @@ -0,0 +1,47 @@ +""" +Image Data +++ + +The Image data-block is a shallow wrapper around image or video file(s) +(on disk, as packed data, or generated). + +All actual data like the pixel buffer, size, resolution etc. is +cached in an :class:`imbuf.types.ImBuf` image buffer (or several buffers +in some cases, like UDIM textures, multi-views, animations...). + +Several properties and functions of the Image data-block are then actually +using/modifying its image buffer, and not the Image data-block itself. + +.. warning:: + + One key limitation is that image buffers are not shared between different + Image data-blocks, and they are not duplicated when copying an image. + + So until a modified image buffer is saved on disk, duplicating its Image + data-block will not propagate the underlying buffer changes to the new Image. + + +This example script generates an Image data-block with a given size, +change its first pixel, rescale it, and duplicates the image. + +The duplicated image still has the same size and colors as the original image +at its creation, all editing in the original image's buffer is 'lost' in its copy. +""" + +import bpy + +image_src = bpy.data.images.new('src', 1024, 102) +print(image_src.size) +print(image_src.pixels[0:4]) + +image_src.scale(1024, 720) +image_src.pixels[0:4] = (0.5, 0.5, 0.5, 0.5) +image_src.update() +print(image_src.size) +print(image_src.pixels[0:4]) + +image_dest = image_src.copy() +image_dest.update() +print(image_dest.size) +print(image_dest.pixels[0:4]) + diff --git a/source/blender/makesrna/intern/rna_image.c b/source/blender/makesrna/intern/rna_image.c index 3a93a44e0d1..bd3b03add95 100644 --- a/source/blender/makesrna/intern/rna_image.c +++ b/source/blender/makesrna/intern/rna_image.c @@ -1073,22 +1073,31 @@ static void rna_def_image(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Depth", "Image bit depth"); RNA_def_property_clear_flag(prop, PROP_EDITABLE); - prop = RNA_def_int_vector(srna, -"size", -2, -NULL, -0, -0, -"Size", -"Width and height in pixels, zero when image data can't be loaded", -0, -0); + prop = RNA_def_int_vector( + srna, + "size", + 2, + NULL, + 0, + 0, + "Size", + "Width and height of the image buffer in pixels, zero when image data can't be loaded", + 0, + 0); RNA_def_property_subtype(prop, PROP_PIXEL); RNA_def_property_int_funcs(prop, "rna_Image_size_get", NULL, NULL); RNA_def_property_clear_flag(prop, PROP_EDITABLE); - prop = RNA_def_float_vector( - srna, "resolution", 2, NULL, 0, 0, "Resolution", "X/Y pixels per meter", 0, 0); + prop = RNA_def_float_vector(srna, + "resolution", + 2, + NULL, + 0, + 0, + "Resolution", + "X/Y pixels per meter, for the image buffer", + 0, + 0); RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_float_funcs(prop, "rna_Image_resolution_get", "rna_Image_resolution_set", NULL); @@ -1105,7 +1114,7 @@ static void rna_def_image(BlenderRNA *brna) prop = RNA_def_property(srna, "pixels", PROP_FLOAT, PROP_NONE); RNA_def_property_flag(prop, PROP_DYNAMIC); RNA_def_property_multi_array(prop, 1, NULL); - RNA_def_property_ui_text(prop, "Pixels", "Image pixels in floating-point values"); + RNA_def_property_ui_text(prop, "Pixels", "Image buffer pixels in floating-point values");
[Bf-blender-cvs] [477066adeee] master: Fix: Handle default better in curves type count cache
Commit: 477066adeee17697757cfb7eb779488dcc7e2eea Author: Hans Goudey Date: Fri May 6 10:58:54 2022 +0200 Branches: master https://developer.blender.org/rB477066adeee17697757cfb7eb779488dcc7e2eea Fix: Handle default better in curves type count cache When the curve types array isn't allocated, the default type is Catmull Rom. Because the type counts are calculated eagerly, they must be in a valid state. === M source/blender/blenkernel/intern/curves_geometry.cc === diff --git a/source/blender/blenkernel/intern/curves_geometry.cc b/source/blender/blenkernel/intern/curves_geometry.cc index e7337d5c012..4dd0fad57d4 100644 --- a/source/blender/blenkernel/intern/curves_geometry.cc +++ b/source/blender/blenkernel/intern/curves_geometry.cc @@ -65,6 +65,8 @@ CurvesGeometry::CurvesGeometry(const int point_size, const int curve_size) this->update_customdata_pointers(); this->runtime = MEM_new(__func__); + /* Fill the type counts with the default so they're in a valid state. */ + this->runtime->type_counts[CURVE_TYPE_CATMULL_ROM] = curve_size; } /** @@ -541,7 +543,11 @@ IndexMask CurvesGeometry::indices_for_curve_type(const CurveType type, if (this->curve_type_counts()[type] == this->curves_num()) { return selection; } - Span types_span = this->curve_types().get_internal_span(); + const VArray types = this->curve_types(); + if (types.is_single()) { +return types.get_internal_single() == type ? IndexMask(this->curves_num()) : IndexMask(0); + } + Span types_span = types.get_internal_span(); return index_mask_ops::find_indices_based_on_predicate( selection, 1024, r_indices, [&](const int index) { return types_span[index] == type; }); } ___ 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] [12a1fa9cf4c] master: Cleanup: format
Commit: 12a1fa9cf4c544de8449cd563ce16b22eddba0b1 Author: Campbell Barton Date: Fri May 6 18:27:44 2022 +1000 Branches: master https://developer.blender.org/rB12a1fa9cf4c544de8449cd563ce16b22eddba0b1 Cleanup: format === M intern/cycles/device/optix/device_impl.cpp M source/blender/python/bmesh/bmesh_py_types.c === diff --git a/intern/cycles/device/optix/device_impl.cpp b/intern/cycles/device/optix/device_impl.cpp index 6329144131e..9fc265bc327 100644 --- a/intern/cycles/device/optix/device_impl.cpp +++ b/intern/cycles/device/optix/device_impl.cpp @@ -226,7 +226,8 @@ static void execute_optix_task(TaskPool , OptixTask task, OptixResult const OptixResult result = optixTaskExecute(task, additional_tasks, 16, _additional_tasks); if (result == OPTIX_SUCCESS) { for (unsigned int i = 0; i < num_additional_tasks; ++i) { - pool.push(function_bind(_optix_task, std::ref(pool), additional_tasks[i], std::ref(failure_reason))); + pool.push(function_bind( + _optix_task, std::ref(pool), additional_tasks[i], std::ref(failure_reason))); } } else { diff --git a/source/blender/python/bmesh/bmesh_py_types.c b/source/blender/python/bmesh/bmesh_py_types.c index 64cd59ea635..972a782d650 100644 --- a/source/blender/python/bmesh/bmesh_py_types.c +++ b/source/blender/python/bmesh/bmesh_py_types.c @@ -1259,14 +1259,15 @@ static PyObject *bpy_bmesh_select_flush(BPy_BMesh *self, PyObject *value) Py_RETURN_NONE; } -PyDoc_STRVAR(bpy_bmesh_normal_update_doc, - ".. method:: normal_update()\n" - "\n" - " Update normals of mesh faces and verts.\n" - "\n" - " .. note::\n" - "\n" - " The normal of any vertex where :attr:`is_wire` is True will be a zero vector.\n"); +PyDoc_STRVAR( +bpy_bmesh_normal_update_doc, +".. method:: normal_update()\n" +"\n" +" Update normals of mesh faces and verts.\n" +"\n" +" .. note::\n" +"\n" +" The normal of any vertex where :attr:`is_wire` is True will be a zero vector.\n"); static PyObject *bpy_bmesh_normal_update(BPy_BMesh *self) { @@ -1783,14 +1784,15 @@ static PyObject *bpy_bmedge_other_vert(BPy_BMEdge *self, BPy_BMVert *value) Py_RETURN_NONE; } -PyDoc_STRVAR(bpy_bmedge_normal_update_doc, - ".. method:: normal_update()\n" - "\n" - " Update normals of all connected faces and the edge verts.\n" - "\n" - " .. note::\n" - "\n" - " The normal of edge vertex will be a zero vector if vertex :attr:`is_wire` is True.\n"); +PyDoc_STRVAR( +bpy_bmedge_normal_update_doc, +".. method:: normal_update()\n" +"\n" +" Update normals of all connected faces and the edge verts.\n" +"\n" +" .. note::\n" +"\n" +" The normal of edge vertex will be a zero vector if vertex :attr:`is_wire` is True.\n"); static PyObject *bpy_bmedge_normal_update(BPy_BMEdge *self) { BPY_BM_CHECK_OBJ(self); ___ 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] [e9ce424492b] temp-viewport-compositor-merge: Viewport Compositor: Fix and refactor reference counting
Commit: e9ce424492b0c09cfe203457a3dc70e4bcd8961b Author: Omar Emara Date: Fri May 6 10:12:41 2022 +0200 Branches: temp-viewport-compositor-merge https://developer.blender.org/rBe9ce424492b0c09cfe203457a3dc70e4bcd8961b Viewport Compositor: Fix and refactor reference counting After using eager evaluation and retaining results, reference counting no longer worked. This patch refactors the reference counting system to make it work again. === M source/blender/nodes/composite/nodes/node_composite_image.cc M source/blender/nodes/composite/nodes/node_composite_movieclip.cc M source/blender/viewport_compositor/VPC_compile_state.hh M source/blender/viewport_compositor/VPC_gpu_material_operation.hh M source/blender/viewport_compositor/VPC_node_operation.hh M source/blender/viewport_compositor/VPC_operation.hh M source/blender/viewport_compositor/VPC_processor_operation.hh M source/blender/viewport_compositor/VPC_result.hh M source/blender/viewport_compositor/VPC_utilities.hh M source/blender/viewport_compositor/intern/compile_state.cc M source/blender/viewport_compositor/intern/evaluator.cc M source/blender/viewport_compositor/intern/gpu_material_operation.cc M source/blender/viewport_compositor/intern/input_single_value_operation.cc M source/blender/viewport_compositor/intern/node_operation.cc M source/blender/viewport_compositor/intern/operation.cc M source/blender/viewport_compositor/intern/processor_operation.cc M source/blender/viewport_compositor/intern/result.cc M source/blender/viewport_compositor/intern/unsupported_node_operation.cc M source/blender/viewport_compositor/intern/utilities.cc === diff --git a/source/blender/nodes/composite/nodes/node_composite_image.cc b/source/blender/nodes/composite/nodes/node_composite_image.cc index 7d358cc9096..ce38dfe25ad 100644 --- a/source/blender/nodes/composite/nodes/node_composite_image.cc +++ b/source/blender/nodes/composite/nodes/node_composite_image.cc @@ -490,7 +490,7 @@ class ImageOperation : public NodeOperation { void allocate_invalid() { for (const OutputSocketRef *output : node()->outputs()) { - if (!is_output_needed(output->identifier())) { + if (!should_compute_output(output->identifier())) { continue; } @@ -508,7 +508,7 @@ class ImageOperation : public NodeOperation { void compute_output(StringRef identifier) { -if (!is_output_needed(identifier)) { +if (!should_compute_output(identifier)) { return; } diff --git a/source/blender/nodes/composite/nodes/node_composite_movieclip.cc b/source/blender/nodes/composite/nodes/node_composite_movieclip.cc index eb171f5829c..b31a7e49b8e 100644 --- a/source/blender/nodes/composite/nodes/node_composite_movieclip.cc +++ b/source/blender/nodes/composite/nodes/node_composite_movieclip.cc @@ -108,7 +108,7 @@ class MovieClipOperation : public NodeOperation { void compute_image(GPUTexture *movie_clip_texture) { -if (!is_output_needed("Image")) { +if (!should_compute_output("Image")) { return; } @@ -141,7 +141,7 @@ class MovieClipOperation : public NodeOperation { void compute_alpha(GPUTexture *movie_clip_texture) { -if (!is_output_needed("Alpha")) { +if (!should_compute_output("Alpha")) { return; } @@ -177,22 +177,22 @@ class MovieClipOperation : public NodeOperation { { /* The movie clip texture is invalid or missing, set appropriate fallback values. */ if (!movie_clip_texture) { - if (is_output_needed("Offset X")) { + if (should_compute_output("Offset X")) { Result = get_result("Offset X"); result.allocate_single_value(); result.set_float_value(0.0f); } - if (is_output_needed("Offset Y")) { + if (should_compute_output("Offset Y")) { Result = get_result("Offset Y"); result.allocate_single_value(); result.set_float_value(0.0f); } - if (is_output_needed("Scale")) { + if (should_compute_output("Scale")) { Result = get_result("Scale"); result.allocate_single_value(); result.set_float_value(1.0f); } - if (is_output_needed("Angle")) { + if (should_compute_output("Angle")) { Result = get_result("Angle"); result.allocate_single_value(); result.set_float_value(0.0f); @@ -213,22 +213,22 @@ class MovieClipOperation : public NodeOperation { BKE_tracking_stabilization_data_get( movie_clip, frame_number, width, height, offset, , ); -if (is_output_needed("Offset X")) { +if (should_compute_output("Offset X")) { Result = get_result("Offset X"); result.allocate_single_value(); result.set_float_value(offset.x); } -if
[Bf-blender-cvs] [ae9ef281265] master: Merge branch 'blender-v3.2-release'
Commit: ae9ef281265a4dc2d1fc77783a012211895bc8d0 Author: Campbell Barton Date: Fri May 6 17:49:29 2022 +1000 Branches: master https://developer.blender.org/rBae9ef281265a4dc2d1fc77783a012211895bc8d0 Merge branch 'blender-v3.2-release' === === ___ 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] [2c75857f9fc] master: Cleanup: spelling in comments, use doxygen comments
Commit: 2c75857f9fc0dc5d524e4a0407e0a68856e5906e Author: Campbell Barton Date: Fri May 6 17:56:59 2022 +1000 Branches: master https://developer.blender.org/rB2c75857f9fc0dc5d524e4a0407e0a68856e5906e Cleanup: spelling in comments, use doxygen comments === M intern/ghost/intern/GHOST_TrackpadWin32.cpp M source/blender/blenfont/intern/blf_font.c M source/blender/blenfont/intern/blf_internal_types.h M source/blender/draw/engines/eevee/eevee_lookdev.c M source/blender/draw/intern/shaders/common_globals_lib.glsl M source/blender/editors/include/UI_interface_icons.h M source/blender/editors/interface/interface_style.cc M source/blender/editors/space_node/node_intern.hh M source/blender/editors/space_node/space_node.cc M source/blender/editors/space_text/text_draw.c M source/blender/editors/transform/transform_convert_node.c M source/blender/gpu/GPU_texture.h M source/blender/makesdna/DNA_space_types.h M source/blender/makesdna/DNA_userdef_types.h M source/blender/python/generic/blf_py_api.c === diff --git a/intern/ghost/intern/GHOST_TrackpadWin32.cpp b/intern/ghost/intern/GHOST_TrackpadWin32.cpp index 69b590ee8de..d5317f0f780 100644 --- a/intern/ghost/intern/GHOST_TrackpadWin32.cpp +++ b/intern/ghost/intern/GHOST_TrackpadWin32.cpp @@ -308,7 +308,7 @@ HRESULT GHOST_DirectManipulationViewportEventHandler::OnContentUpdated( } /* This state machine is used here because: - * 1. Pinch and pan gestures must be differentiated and cannot be proccessed at the same time + * 1. Pinch and pan gestures must be differentiated and cannot be processed at the same time * because XY transform values become nonsensical during pinch gesture. * 2. GHOST requires delta values for events while DM provides transformation matrix of the * current gesture. diff --git a/source/blender/blenfont/intern/blf_font.c b/source/blender/blenfont/intern/blf_font.c index f93cb8b2d64..a170f27d247 100644 --- a/source/blender/blenfont/intern/blf_font.c +++ b/source/blender/blenfont/intern/blf_font.c @@ -1374,7 +1374,7 @@ bool blf_font_size(FontBLF *font, float size, unsigned int dpi) font->dpi = dpi; } else { - printf("The current font does not support the size, %f and dpi, %u\n", size, dpi); + printf("The current font does not support the size, %f and DPI, %u\n", size, dpi); return false; } } diff --git a/source/blender/blenfont/intern/blf_internal_types.h b/source/blender/blenfont/intern/blf_internal_types.h index 62bce36dda0..9dfcb1a4ad6 100644 --- a/source/blender/blenfont/intern/blf_internal_types.h +++ b/source/blender/blenfont/intern/blf_internal_types.h @@ -123,7 +123,7 @@ typedef struct GlyphCacheBLF { /* font size. */ float size; - /* and dpi. */ + /* and DPI. */ unsigned int dpi; bool bold; @@ -264,7 +264,7 @@ typedef struct FontBLF { /* the width to wrap the text, see BLF_WORD_WRAP */ int wrap_width; - /* font dpi (default 72). */ + /* Font DPI (default 72). */ unsigned int dpi; /* font size. */ @@ -276,7 +276,8 @@ typedef struct FontBLF { /* font options. */ int flags; - /* List of glyph caches (GlyphCacheBLF) for this font for size, dpi, bold, italic. + /** + * List of glyph caches (#GlyphCacheBLF) for this font for size, DPI, bold, italic. * Use blf_glyph_cache_acquire(font) and blf_glyph_cache_release(font) to access cache! */ ListBase cache; diff --git a/source/blender/draw/engines/eevee/eevee_lookdev.c b/source/blender/draw/engines/eevee/eevee_lookdev.c index e6c33feeeb9..79b84bfba4c 100644 --- a/source/blender/draw/engines/eevee/eevee_lookdev.c +++ b/source/blender/draw/engines/eevee/eevee_lookdev.c @@ -112,7 +112,7 @@ void EEVEE_lookdev_init(EEVEE_Data *vedata) if (sphere_size != effects->sphere_size || rect->xmax != effects->anchor[0] || rect->ymin != effects->anchor[1]) { - /* Make sphere resolution adaptive to viewport_scale, dpi and lookdev_sphere_size */ + /* Make sphere resolution adaptive to viewport_scale, DPI and #U.lookdev_sphere_size. */ float res_scale = clamp_f( (U.lookdev_sphere_size / 400.0f) * viewport_scale * U.dpi_fac, 0.1f, 1.0f); diff --git a/source/blender/draw/intern/shaders/common_globals_lib.glsl b/source/blender/draw/intern/shaders/common_globals_lib.glsl index 0460ba56e4c..a8931292064 100644 --- a/source/blender/draw/intern/shaders/common_globals_lib.glsl +++ b/source/blender/draw/intern/shaders/common_globals_lib.glsl @@ -110,7 +110,7 @@ layout(std140) uniform globalsBlock vec4 screenVecs[2]; vec4 sizeViewport; /* Inverted size in zw. */ - float sizePixel; /* This one is for dpi scaling */ + float sizePixel; /* This one is for DPI scaling. */ float pixelFac; /* To use with
[Bf-blender-cvs] [62450e8485d] blender-v3.2-release: WM: suppress assertion when switching tools
Commit: 62450e8485ded339889e292e41453398dad5adcc Author: Campbell Barton Date: Fri May 6 17:44:32 2022 +1000 Branches: blender-v3.2-release https://developer.blender.org/rB62450e8485ded339889e292e41453398dad5adcc WM: suppress assertion when switching tools Changing the object mode outside the 3D view would trigger this assertion. This was harmless, only assert for space types that define the tools mode. === M source/blender/windowmanager/WM_toolsystem.h M source/blender/windowmanager/intern/wm_toolsystem.c === diff --git a/source/blender/windowmanager/WM_toolsystem.h b/source/blender/windowmanager/WM_toolsystem.h index a9e1495d9bf..96094e9e7ef 100644 --- a/source/blender/windowmanager/WM_toolsystem.h +++ b/source/blender/windowmanager/WM_toolsystem.h @@ -28,6 +28,11 @@ struct wmOperatorType; #define WM_TOOLSYSTEM_SPACE_MASK \ ((1 << SPACE_IMAGE) | (1 << SPACE_NODE) | (1 << SPACE_VIEW3D) | (1 << SPACE_SEQ)) +/** + * Space-types that define their own "mode" (as returned by #WM_toolsystem_mode_from_spacetype). + */ +#define WM_TOOLSYSTEM_SPACE_MASK_MODE_FROM_SPACE ((1 << SPACE_IMAGE) | (1 << SPACE_SEQ)) + /* Values that define a category of active tool. */ typedef struct bToolKey { int space_type; diff --git a/source/blender/windowmanager/intern/wm_toolsystem.c b/source/blender/windowmanager/intern/wm_toolsystem.c index 8c7cf86d050..984a8ef41d0 100644 --- a/source/blender/windowmanager/intern/wm_toolsystem.c +++ b/source/blender/windowmanager/intern/wm_toolsystem.c @@ -636,7 +636,8 @@ bToolRef *WM_toolsystem_ref_set_by_id_ex( /* Some contexts use the current space type (image editor for e.g.), * ensure this is set correctly or there is no area. */ #ifndef NDEBUG - { + /* Exclude this check for some space types where the space type isn't used. */ + if ((1 << tkey->space_type) & WM_TOOLSYSTEM_SPACE_MASK_MODE_FROM_SPACE) { ScrArea *area = CTX_wm_area(C); BLI_assert(area == NULL || area->spacetype == tkey->space_type); } ___ 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] [e58b18888c0] master: GHOST: Add support for precision touchpad gestures on Windows
Commit: e58b1c0e76a9ab8b0eeb16cdad9d9d9962cf Author: Andrii Symkin Date: Wed Apr 6 18:17:33 2022 -0700 Branches: master https://developer.blender.org/rBe58b1c0e76a9ab8b0eeb16cdad9d9d9962cf GHOST: Add support for precision touchpad gestures on Windows This patch adds support for precision touchpad gestures on Windows 8.1 and newer using Direct Manipulation API. Gestures work exactly like on macOS, with full support for pan/pinch and inertia. This works by creating a viewport with a fake scrollable which is reset after every gesture and converts any changes to the content's transform into GHOST trackpad events (as explained [here](https://bugzilla.mozilla.org/show_bug.cgi?id=890878)). The code is based on the implementation from the [Chromium project](https://chromium.googlesource.com/chromium/src/+/refs/heads/master/content/browser/renderer_host/direct_manipulation_helper_win.cc). Tested on Windows 10. Fixes {T70754}, {T69264}. Demo:{F8520272} Reviewed By: nicholas_rishel Differential Revision: https://developer.blender.org/D7660 === M intern/ghost/CMakeLists.txt M intern/ghost/intern/GHOST_SystemWin32.cpp M intern/ghost/intern/GHOST_SystemWin32.h A intern/ghost/intern/GHOST_TrackpadWin32.cpp A intern/ghost/intern/GHOST_TrackpadWin32.h M intern/ghost/intern/GHOST_WindowWin32.cpp M intern/ghost/intern/GHOST_WindowWin32.h === diff --git a/intern/ghost/CMakeLists.txt b/intern/ghost/CMakeLists.txt index 9421edecf12..dceb9ced803 100644 --- a/intern/ghost/CMakeLists.txt +++ b/intern/ghost/CMakeLists.txt @@ -376,6 +376,7 @@ elseif(WIN32) intern/GHOST_DisplayManagerWin32.cpp intern/GHOST_DropTargetWin32.cpp intern/GHOST_SystemWin32.cpp +intern/GHOST_TrackpadWin32.cpp intern/GHOST_WindowWin32.cpp intern/GHOST_Wintab.cpp @@ -384,6 +385,7 @@ elseif(WIN32) intern/GHOST_DropTargetWin32.h intern/GHOST_SystemWin32.h intern/GHOST_TaskbarWin32.h +intern/GHOST_TrackpadWin32.h intern/GHOST_WindowWin32.h intern/GHOST_Wintab.h ) diff --git a/intern/ghost/intern/GHOST_SystemWin32.cpp b/intern/ghost/intern/GHOST_SystemWin32.cpp index ca4bfa634c1..8e07bf4ea3d 100644 --- a/intern/ghost/intern/GHOST_SystemWin32.cpp +++ b/intern/ghost/intern/GHOST_SystemWin32.cpp @@ -8,6 +8,7 @@ #include "GHOST_SystemWin32.h" #include "GHOST_ContextD3D.h" #include "GHOST_EventDragnDrop.h" +#include "GHOST_EventTrackpad.h" #ifndef _WIN32_IE # define _WIN32_IE 0x0501 /* shipped before XP, so doesn't impose additional requirements */ @@ -415,6 +416,8 @@ bool GHOST_SystemWin32::processEvents(bool waitForEvent) hasEventHandled = true; } +driveTrackpad(); + // Process all the events waiting for us while (::PeekMessageW(, NULL, 0, 0, PM_REMOVE) != 0) { // TranslateMessage doesn't alter the message, and doesn't change our raw keyboard data. @@ -424,6 +427,8 @@ bool GHOST_SystemWin32::processEvents(bool waitForEvent) hasEventHandled = true; } +processTrackpad(); + /* PeekMessage above is allowed to dispatch messages to the wndproc without us * noticing, so we need to check the event manager here to see if there are * events waiting in the queue. @@ -1417,6 +1422,52 @@ bool GHOST_SystemWin32::processNDOF(RAWINPUT const ) } #endif // WITH_INPUT_NDOF +void GHOST_SystemWin32::driveTrackpad() +{ + GHOST_WindowWin32 *active_window = static_cast( + getWindowManager()->getActiveWindow()); + if (active_window) { +active_window->updateDirectManipulation(); + } +} + +void GHOST_SystemWin32::processTrackpad() +{ + GHOST_WindowWin32 *active_window = static_cast( + getWindowManager()->getActiveWindow()); + + if (!active_window) { +return; + } + + GHOST_TTrackpadInfo trackpad_info = active_window->getTrackpadInfo(); + GHOST_SystemWin32 *system = (GHOST_SystemWin32 *)getSystem(); + + int32_t cursor_x, cursor_y; + system->getCursorPosition(cursor_x, cursor_y); + + if (trackpad_info.x != 0 || trackpad_info.y != 0) { +system->pushEvent(new GHOST_EventTrackpad(system->getMilliSeconds(), + active_window, + GHOST_kTrackpadEventScroll, + cursor_x, + cursor_y, + trackpad_info.x, + trackpad_info.y, + trackpad_info.isScrollDirectionInverted)); + } + if (trackpad_info.scale != 0) { +system->pushEvent(new GHOST_EventTrackpad(system->getMilliSeconds(), + active_window, + GHOST_kTrackpadEventMagnify, +
[Bf-blender-cvs] [4a4f0a70ebb] master: Merge branch 'blender-v3.2-release'
Commit: 4a4f0a70ebbb2d4dda821bc69a51566746c42dee Author: Campbell Barton Date: Fri May 6 16:22:58 2022 +1000 Branches: master https://developer.blender.org/rB4a4f0a70ebbb2d4dda821bc69a51566746c42dee Merge branch 'blender-v3.2-release' === === ___ 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] [693aa573db4] blender-v3.2-release: Fix T96585: Intersect(Knife) tool is selecting wrong edges
Commit: 693aa573db4068f5c8c30f0958cb8850c806a285 Author: Campbell Barton Date: Fri May 6 16:08:33 2022 +1000 Branches: blender-v3.2-release https://developer.blender.org/rB693aa573db4068f5c8c30f0958cb8850c806a285 Fix T96585: Intersect(Knife) tool is selecting wrong edges Regression caused by [0] which flushed selection from vertices -> edges, causing additional edges to be selected. Now selected is flushed based on the mode, instead of all elements. Note that these function names could be improved to make it clearer how these flushing functions are different. Also skip flushing unless selection is performed. [0]: 55c82d8380ea3fd37a9d966fad10f42cc5b365d5 === M source/blender/editors/mesh/editmesh_intersect.c === diff --git a/source/blender/editors/mesh/editmesh_intersect.c b/source/blender/editors/mesh/editmesh_intersect.c index 2642a613e92..166eb40a7db 100644 --- a/source/blender/editors/mesh/editmesh_intersect.c +++ b/source/blender/editors/mesh/editmesh_intersect.c @@ -99,8 +99,8 @@ static void edbm_intersect_select(BMEditMesh *em, struct Mesh *me, bool do_selec BM_edge_select_set(em->bm, e, true); } } + EDBM_selectmode_flush(em); } -EDBM_select_flush(em); } EDBM_update(me, ___ 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