[Bf-blender-cvs] [673323251c9] soc-2019-outliner: Outliner: Basic outliner walk scrolling implementation
Commit: 673323251c98b926a168cdfaef890efad0d38d53 Author: Nathan Craddock Date: Tue Jul 30 22:38:53 2019 -0600 Branches: soc-2019-outliner https://developer.blender.org/rB673323251c98b926a168cdfaef890efad0d38d53 Outliner: Basic outliner walk scrolling implementation A staring point for outliner walk navigation scrolling. This will scroll the outliner to keep the walk element in focus. === M source/blender/editors/space_outliner/outliner_select.c === diff --git a/source/blender/editors/space_outliner/outliner_select.c b/source/blender/editors/space_outliner/outliner_select.c index 652254a1df1..102aae1b367 100644 --- a/source/blender/editors/space_outliner/outliner_select.c +++ b/source/blender/editors/space_outliner/outliner_select.c @@ -1690,11 +1690,11 @@ static TreeElement *outliner_walk_right(SpaceOutliner *soops, return walk_element; } -static void do_outliner_select_walk(SpaceOutliner *soops, -TreeElement *walk_element, -const int direction, -const bool extend, -const bool toggle_all) +static TreeElement *do_outliner_select_walk(SpaceOutliner *soops, +TreeElement *walk_element, +const int direction, +const bool extend, +const bool toggle_all) { TreeStoreElem *tselem = TREESTORE(walk_element); @@ -1728,6 +1728,8 @@ static void do_outliner_select_walk(SpaceOutliner *soops, } tselem_new->flag |= TSE_SELECTED | TSE_WALK; + + return walk_element; } /* Find walk select element, or set it if it does not exist. @@ -1766,12 +1768,32 @@ static TreeElement *find_walk_select_start_element(SpaceOutliner *soops, bool *c return walk_element; } +static void outliner_walk_scroll(ARegion *ar, TreeElement *te, short direction) +{ + int y_max = ar->v2d.cur.ymax - (UI_UNIT_Y * 2); + int y_min = ar->v2d.cur.ymin + UI_UNIT_Y; + int offset = UI_HEADER_OFFSET; + printf("ymax: %d, ymin: %d, te->ys: %d\n", y_max, y_min, te->ys); + + int delta_y; + if (te->ys > y_max && direction == OUTLINER_SELECT_WALK_UP) { +delta_y = MAX2(y_max - te->ys, UI_UNIT_Y); +ar->v2d.cur.ymax += delta_y; +ar->v2d.cur.ymin += delta_y; + } + else if (te->ys < y_min && direction == OUTLINER_SELECT_WALK_DOWN) { +delta_y = MAX2((te->ys + UI_UNIT_Y), UI_UNIT_Y); +ar->v2d.cur.ymax -= delta_y; +ar->v2d.cur.ymin -= delta_y; + } +} + static int outliner_walk_select_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event)) { SpaceOutliner *soops = CTX_wm_space_outliner(C); ARegion *ar = CTX_wm_region(C); - const int direction = RNA_enum_get(op->ptr, "direction"); + const short direction = RNA_enum_get(op->ptr, "direction"); const bool extend = RNA_boolean_get(op->ptr, "extend"); const bool toggle_all = RNA_boolean_get(op->ptr, "toggle_all"); @@ -1780,12 +1802,15 @@ static int outliner_walk_select_invoke(bContext *C, wmOperator *op, const wmEven /* If finding the starting walk select element did not move the element, proceed to walk */ if (!changed) { -do_outliner_select_walk(soops, walk_element, direction, extend, toggle_all); +walk_element = do_outliner_select_walk(soops, walk_element, direction, extend, toggle_all); } else { TREESTORE(walk_element)->flag |= TSE_SELECTED | TSE_WALK; } + /* Scroll outliner to focus on walk element */ + outliner_walk_scroll(ar, walk_element, direction); + if (soops->flag & SO_SYNC_SELECTION) { outliner_select_sync(C, soops); } ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [18ac5447add] soc-2019-outliner: Outliner: Fix icons drawing over rename box
Commit: 18ac5447addc60815e73709839f98c1fd8cab08b Author: Nathan Craddock Date: Tue Jul 30 22:10:56 2019 -0600 Branches: soc-2019-outliner https://developer.blender.org/rB18ac5447addc60815e73709839f98c1fd8cab08b Outliner: Fix icons drawing over rename box The iconrow icons were drawing as buttons, placing them above the textbutton for item renaming. This reverts an older change which broke the expected behavior. === M source/blender/editors/space_outliner/outliner_draw.c === diff --git a/source/blender/editors/space_outliner/outliner_draw.c b/source/blender/editors/space_outliner/outliner_draw.c index 9ef1a6705f5..8f44be7f377 100644 --- a/source/blender/editors/space_outliner/outliner_draw.c +++ b/source/blender/editors/space_outliner/outliner_draw.c @@ -2618,7 +2618,8 @@ static void tselem_draw_icon(uiBlock *block, float y, TreeStoreElem *tselem, TreeElement *te, - float alpha) + float alpha, + const bool is_clickable) { TreeElementIcon data = tree_element_get_icon(tselem, te); @@ -2627,7 +2628,7 @@ static void tselem_draw_icon(uiBlock *block, } /* Icon is covered by restrict buttons */ - if (x >= xmax) { + if (!is_clickable || x >= xmax) { /* Reduce alpha to match icon buttons */ alpha *= 0.8f; @@ -2765,7 +2766,7 @@ static void outliner_draw_iconrow_doit(uiBlock *block, if (tselem->flag & TSE_HIGHLIGHTED) { alpha_fac += 0.5; } - tselem_draw_icon(block, xmax, (float)*offsx, (float)ys, tselem, te, alpha_fac); + tselem_draw_icon(block, xmax, (float)*offsx, (float)ys, tselem, te, alpha_fac, false); te->xs = *offsx; te->ys = ys; te->xend = (short)*offsx + UI_UNIT_X; @@ -3087,7 +3088,8 @@ static void outliner_draw_tree_element(bContext *C, /* datatype icon */ if (!(ELEM(tselem->type, TSE_RNA_PROPERTY, TSE_RNA_ARRAY_ELEM, TSE_ID_BASE))) { - tselem_draw_icon(block, xmax, (float)startx + offsx, (float)*starty, tselem, te, alpha_fac); + tselem_draw_icon( + block, xmax, (float)startx + offsx, (float)*starty, tselem, te, alpha_fac, true); offsx += UI_UNIT_X + 4 * ufac; } else { ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [3cbf9956e44] soc-2019-outliner: Outliner: small cleanup for show active
Commit: 3cbf9956e440a3f21b54d92bcd53a271eb1c2408 Author: Nathan Craddock Date: Tue Jul 30 19:23:27 2019 -0600 Branches: soc-2019-outliner https://developer.blender.org/rB3cbf9956e440a3f21b54d92bcd53a271eb1c2408 Outliner: small cleanup for show active === M source/blender/editors/space_outliner/outliner_edit.c === diff --git a/source/blender/editors/space_outliner/outliner_edit.c b/source/blender/editors/space_outliner/outliner_edit.c index 4efdd81c161..965d7168d00 100644 --- a/source/blender/editors/space_outliner/outliner_edit.c +++ b/source/blender/editors/space_outliner/outliner_edit.c @@ -1325,7 +1325,7 @@ static int outliner_show_active_exec(bContext *C, wmOperator *UNUSED(op)) /* Center view on first element found */ int size_y = BLI_rcti_size_y(>mask) + 1; -int y_min = MIN2(ar->v2d.tot.ymin, v2d->cur.ymin); +int y_min = MIN2(v2d->tot.ymin, v2d->cur.ymin); int ytop = active_element->ys + size_y / 2; /* make te->ys center of view keeping element within scroll limits */ ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [22966f4d358] soc-2019-openxr: Address changes in OpenXR 1.0 to get rendering to work again
Commit: 22966f4d358d525c098bf9bba6417a818b27d8b8 Author: Julian Eisel Date: Wed Jul 31 02:19:35 2019 +0200 Branches: soc-2019-openxr https://developer.blender.org/rB22966f4d358d525c098bf9bba6417a818b27d8b8 Address changes in OpenXR 1.0 to get rendering to work again === M intern/ghost/intern/GHOST_XrSession.cpp M intern/ghost/intern/GHOST_XrSession.h === diff --git a/intern/ghost/intern/GHOST_XrSession.cpp b/intern/ghost/intern/GHOST_XrSession.cpp index 9407a5381da..2cfeed3d9a6 100644 --- a/intern/ghost/intern/GHOST_XrSession.cpp +++ b/intern/ghost/intern/GHOST_XrSession.cpp @@ -383,7 +383,7 @@ void GHOST_XrSession::draw(void *draw_customdata) beginFrameDrawing(); - if (isVisible()) { + if (m_draw_info->frame_state.shouldRender) { proj_layer = drawLayer(projection_layer_views, draw_customdata); layers.push_back(reinterpret_cast(_layer)); } @@ -469,6 +469,7 @@ XrCompositionLayerProjection GHOST_XrSession::drawLayer( XrCompositionLayerProjection layer{XR_TYPE_COMPOSITION_LAYER_PROJECTION}; uint32_t view_count; + viewloc_info.viewConfigurationType = m_oxr->view_type; viewloc_info.displayTime = m_draw_info->frame_state.predictedDisplayTime; viewloc_info.space = m_oxr->reference_space; @@ -510,6 +511,7 @@ bool GHOST_XrSession::isRunning() const return false; } switch (m_oxr->session_state) { +case XR_SESSION_STATE_READY: case XR_SESSION_STATE_SYNCHRONIZED: case XR_SESSION_STATE_VISIBLE: case XR_SESSION_STATE_FOCUSED: @@ -518,19 +520,6 @@ bool GHOST_XrSession::isRunning() const return false; } } -bool GHOST_XrSession::isVisible() const -{ - if (m_oxr->session == XR_NULL_HANDLE) { -return false; - } - switch (m_oxr->session_state) { -case XR_SESSION_STATE_VISIBLE: -case XR_SESSION_STATE_FOCUSED: - return true; -default: - return false; - } -} /** \} */ /* State Queries */ diff --git a/intern/ghost/intern/GHOST_XrSession.h b/intern/ghost/intern/GHOST_XrSession.h index ad5a54b80cc..7b75bdbae56 100644 --- a/intern/ghost/intern/GHOST_XrSession.h +++ b/intern/ghost/intern/GHOST_XrSession.h @@ -40,7 +40,6 @@ class GHOST_XrSession { eLifeExpectancy handleStateChangeEvent(const struct XrEventDataSessionStateChanged *lifecycle); bool isRunning() const; - bool isVisible() const; void unbindGraphicsContext(); /* public so context can ensure it's unbound as needed. */ ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [e8f66ff0606] soc-2019-openxr: Update OpenXR to version 1.0
Commit: e8f66ff0606fea7cdaee1ab63563cbe9f6053960 Author: Julian Eisel Date: Wed Jul 31 00:34:46 2019 +0200 Branches: soc-2019-openxr https://developer.blender.org/rBe8f66ff0606fea7cdaee1ab63563cbe9f6053960 Update OpenXR to version 1.0 Only tested on Windows. Updates loader sources from the OpenXR SDK to latest 1.0 SDK and updates requiremed version to 1.0. The compile time generation of files is a thing of the past now (although you can still force it). 1.0 got released yesterday. Only one line needed fixing in our OpenXR code to get it to compile. Rendering is black though. For now I tried to keep edits to CMakeList.txt files minimal. So now there are OpenXR CMake options exposed (with bad names), CMake prints, etc. === M build_files/cmake/Modules/xr_platform_defines.cmake M extern/openxr/CMakeLists.txt D extern/openxr/common/filesystem_utils.cpp D extern/openxr/common/gfxwrapper_opengl.c D extern/openxr/common/gfxwrapper_opengl.h D extern/openxr/common/platform_utils.hpp A extern/openxr/include/CMakeLists.txt A extern/openxr/include/openxr/CMakeLists.txt M extern/openxr/include/openxr/openxr.h M extern/openxr/include/openxr/openxr_platform.h M extern/openxr/include/openxr/openxr_platform_defines.h A extern/openxr/include/openxr/openxr_reflection.h D extern/openxr/loader/CMakeLists.txt D extern/openxr/loader/api_layer_interface.cpp D extern/openxr/loader/loader_core.cpp D extern/openxr/loader/loader_instance.cpp D extern/openxr/loader/loader_instance.hpp D extern/openxr/loader/loader_logger.cpp D extern/openxr/loader/manifest_file.cpp D extern/openxr/loader/runtime_interface.cpp D extern/openxr/loader/xr_generated_loader.cpp A extern/openxr/src/CMakeLists.txt A extern/openxr/src/cmake/FindVulkanHeaders.cmake A extern/openxr/src/cmake/cmake_uninstall.cmake.in A extern/openxr/src/cmake/presentation.cmake A extern/openxr/src/common/extra_algorithms.h A extern/openxr/src/common/filesystem_utils.cpp R100extern/openxr/common/filesystem_utils.hpp extern/openxr/src/common/filesystem_utils.hpp A extern/openxr/src/common/hex_and_handles.cpp A extern/openxr/src/common/hex_and_handles.h R098extern/openxr/common/loader_interfaces.h extern/openxr/src/common/loader_interfaces.h A extern/openxr/src/common/platform_utils.hpp R078extern/openxr/common/xr_dependencies.h extern/openxr/src/common/xr_dependencies.h R074extern/openxr/common/xr_linear.h extern/openxr/src/common/xr_linear.h R057extern/openxr/common_cmake_config.h.in extern/openxr/src/common_cmake_config.h.in A extern/openxr/src/loader/CMakeLists.txt A extern/openxr/src/loader/api_layer_interface.cpp R093extern/openxr/loader/api_layer_interface.hpp extern/openxr/src/loader/api_layer_interface.hpp A extern/openxr/src/loader/exception_handling.hpp R100extern/openxr/loader/loader.rc extern/openxr/src/loader/loader.rc A extern/openxr/src/loader/loader_core.cpp A extern/openxr/src/loader/loader_instance.cpp A extern/openxr/src/loader/loader_instance.hpp A extern/openxr/src/loader/loader_logger.cpp R064extern/openxr/loader/loader_logger.hpp extern/openxr/src/loader/loader_logger.hpp A extern/openxr/src/loader/loader_logger_recorders.cpp A extern/openxr/src/loader/loader_logger_recorders.hpp R069extern/openxr/loader/loader_platform.hpp extern/openxr/src/loader/loader_platform.hpp A extern/openxr/src/loader/manifest_file.cpp R084extern/openxr/loader/manifest_file.hpp extern/openxr/src/loader/manifest_file.hpp R100extern/openxr/loader/openxr.pc.in extern/openxr/src/loader/openxr.pc.in A extern/openxr/src/loader/runtime_interface.cpp R090extern/openxr/loader/runtime_interface.hpp extern/openxr/src/loader/runtime_interface.hpp A extern/openxr/src/loader/xr_generated_loader.cpp R089extern/openxr/loader/xr_generated_loader.hpp extern/openxr/src/loader/xr_generated_loader.hpp A extern/openxr/src/version.cmake R093extern/openxr/xr_generated_dispatch_table.c extern/openxr/src/xr_generated_dispatch_table.c R093extern/openxr/xr_generated_dispatch_table.h extern/openxr/src/xr_generated_dispatch_table.h R086extern/openxr/xr_generated_utilities.c extern/openxr/src/xr_generated_utilities.c R091extern/openxr/xr_generated_utilities.h extern/openxr/src/xr_generated_utilities.h M intern/ghost/CMakeLists.txt M intern/ghost/intern/GHOST_XrSession.cpp === diff --git a/build_files/cmake/Modules/xr_platform_defines.cmake b/build_files/cmake/Modules/xr_platform_defines.cmake index 728ca1dcbb0..cb1740a993d 100644 ---
[Bf-blender-cvs] [af4dcc6073f] master: DRW manager: select engine: create generic draw_select_id_mesh
Commit: af4dcc6073fa1a04edbfb69e591f9aac9f452f17 Author: mano-wii Date: Tue Jul 30 18:26:35 2019 -0300 Branches: master https://developer.blender.org/rBaf4dcc6073fa1a04edbfb69e591f9aac9f452f17 DRW manager: select engine: create generic draw_select_id_mesh === M source/blender/draw/engines/select/select_draw_utils.c === diff --git a/source/blender/draw/engines/select/select_draw_utils.c b/source/blender/draw/engines/select/select_draw_utils.c index 1816d63e64a..08c6c2ac865 100644 --- a/source/blender/draw/engines/select/select_draw_utils.c +++ b/source/blender/draw/engines/select/select_draw_utils.c @@ -68,30 +68,17 @@ static void draw_select_id_edit_mesh(SELECTID_StorageList *stl, { Mesh *me = ob->data; BMEditMesh *em = me->edit_mesh; - const bool use_faceselect = (select_mode & SCE_SELECT_FACE) != 0; - - DRW_mesh_batch_cache_validate(me); BM_mesh_elem_table_ensure(em->bm, BM_VERT | BM_EDGE | BM_FACE); - struct GPUBatch *geom_faces, *geom_edges, *geom_verts, *geom_facedots; - geom_faces = DRW_mesh_batch_cache_get_triangles_with_select_id(me); - if (select_mode & SCE_SELECT_EDGE) { -geom_edges = DRW_mesh_batch_cache_get_edges_with_select_id(me); - } - if (select_mode & SCE_SELECT_VERTEX) { -geom_verts = DRW_mesh_batch_cache_get_verts_with_select_id(me); - } - if (use_faceselect && draw_facedot) { -geom_facedots = DRW_mesh_batch_cache_get_facedots_with_select_id(me); - } - + struct GPUBatch *geom_faces = DRW_mesh_batch_cache_get_triangles_with_select_id(me); DRWShadingGroup *face_shgrp; - if (use_faceselect) { + if (select_mode & SCE_SELECT_FACE) { face_shgrp = DRW_shgroup_create_sub(stl->g_data->shgrp_face_flat); DRW_shgroup_uniform_int_copy(face_shgrp, "offset", *(int *)_offset); if (draw_facedot) { + struct GPUBatch *geom_facedots = DRW_mesh_batch_cache_get_facedots_with_select_id(me); DRW_shgroup_call(face_shgrp, geom_facedots, ob); } *r_face_offset = initial_offset + em->bm->totface; @@ -106,6 +93,7 @@ static void draw_select_id_edit_mesh(SELECTID_StorageList *stl, /* Unlike faces, only draw edges if edge select mode. */ if (select_mode & SCE_SELECT_EDGE) { +struct GPUBatch *geom_edges = DRW_mesh_batch_cache_get_edges_with_select_id(me); DRWShadingGroup *edge_shgrp = DRW_shgroup_create_sub(stl->g_data->shgrp_edge); DRW_shgroup_uniform_int_copy(edge_shgrp, "offset", *(int *)r_face_offset); DRW_shgroup_call(edge_shgrp, geom_edges, ob); @@ -119,6 +107,7 @@ static void draw_select_id_edit_mesh(SELECTID_StorageList *stl, /* Unlike faces, only verts if vert select mode. */ if (select_mode & SCE_SELECT_VERTEX) { +struct GPUBatch *geom_verts = DRW_mesh_batch_cache_get_verts_with_select_id(me); DRWShadingGroup *vert_shgrp = DRW_shgroup_create_sub(stl->g_data->shgrp_vert); DRW_shgroup_uniform_int_copy(vert_shgrp, "offset", *(int *)r_edge_offset); DRW_shgroup_call(vert_shgrp, geom_verts, ob); @@ -129,42 +118,48 @@ static void draw_select_id_edit_mesh(SELECTID_StorageList *stl, } } -static void draw_select_id_paint_mesh(SELECTID_StorageList *stl, - Object *ob, - uint initial_offset, - uint *r_vert_offset, - uint *r_edge_offset, - uint *r_face_offset) +static void draw_select_id_mesh(SELECTID_StorageList *stl, +Object *ob, +short select_mode, +uint initial_offset, +uint *r_vert_offset, +uint *r_edge_offset, +uint *r_face_offset) { - Mesh *me_orig = DEG_get_original_object(ob)->data; - Mesh *me_eval = ob->data; - - struct GPUBatch *geom_faces = DRW_mesh_batch_cache_get_triangles_with_select_id(me_eval); - if ((me_orig->editflag & ME_EDIT_PAINT_VERT_SEL) && - /* Currently vertex select supports weight paint and vertex paint. */ - ((ob->mode & OB_MODE_WEIGHT_PAINT) || (ob->mode & OB_MODE_VERTEX_PAINT))) { - -struct GPUBatch *geom_verts = DRW_mesh_batch_cache_get_verts_with_select_id(me_eval); + Mesh *me = ob->data; + struct GPUBatch *geom_faces = DRW_mesh_batch_cache_get_triangles_with_select_id(me); + DRWShadingGroup *face_shgrp; + if (select_mode & SCE_SELECT_FACE) { +face_shgrp = DRW_shgroup_create_sub(stl->g_data->shgrp_face_flat); +DRW_shgroup_uniform_int_copy(face_shgrp, "offset", *(int *)_offset); +*r_face_offset = initial_offset + me->totpoly; + } + else { /* Only draw faces to mask out verts, we don't want their selection ID's. */ -DRWShadingGroup *face_shgrp =
[Bf-blender-cvs] [43ec8d7ae96] master: Cleanup: Rearrange Select Engine into multiple files
Commit: 43ec8d7ae96ffe321a7a9ab6385b4daaad79e4e4 Author: mano-wii Date: Tue Jul 30 17:55:20 2019 -0300 Branches: master https://developer.blender.org/rB43ec8d7ae96ffe321a7a9ab6385b4daaad79e4e4 Cleanup: Rearrange Select Engine into multiple files === M source/blender/draw/CMakeLists.txt A source/blender/draw/engines/select/select_draw_utils.c M source/blender/draw/engines/select/select_engine.c A source/blender/draw/engines/select/select_private.h === diff --git a/source/blender/draw/CMakeLists.txt b/source/blender/draw/CMakeLists.txt index 664484d9a57..016cd628969 100644 --- a/source/blender/draw/CMakeLists.txt +++ b/source/blender/draw/CMakeLists.txt @@ -127,6 +127,7 @@ set(SRC engines/gpencil/gpencil_render.c engines/gpencil/gpencil_shader_fx.c engines/select/select_engine.c + engines/select/select_draw_utils.c DRW_engine.h intern/DRW_render.h @@ -152,6 +153,7 @@ set(SRC engines/workbench/workbench_engine.h engines/workbench/workbench_private.h engines/select/select_engine.h + engines/select/select_private.h ) set(LIB diff --git a/source/blender/draw/engines/select/select_draw_utils.c b/source/blender/draw/engines/select/select_draw_utils.c new file mode 100644 index 000..1816d63e64a --- /dev/null +++ b/source/blender/draw/engines/select/select_draw_utils.c @@ -0,0 +1,210 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * Copyright 2019, Blender Foundation. + */ + +/** \file + * \ingroup draw_engine + * + * Engine for drawing a selection map where the pixels indicate the selection indices. + */ + +#include "BKE_editmesh.h" + +#include "DNA_mesh_types.h" +#include "DNA_scene_types.h" + +#include "ED_view3d.h" + +#include "DEG_depsgraph.h" +#include "DEG_depsgraph_query.h" + +#include "draw_cache_impl.h" + +#include "select_private.h" + +/* */ +/** \name Draw Utilities + * \{ */ + +static bool check_ob_drawface_dot(short select_mode, const View3D *v3d, char dt) +{ + if (select_mode & SCE_SELECT_FACE) { +if ((dt < OB_SOLID) || XRAY_FLAG_ENABLED(v3d)) { + return true; +} +if (v3d->overlay.edit_flag & V3D_OVERLAY_EDIT_FACE_DOT) { + return true; +} +if ((v3d->overlay.edit_flag & V3D_OVERLAY_EDIT_EDGES) == 0) { + /* Since we can't deduce face selection when edges aren't visible - show dots. */ + return true; +} + } + return false; +} + +static void draw_select_id_edit_mesh(SELECTID_StorageList *stl, + Object *ob, + short select_mode, + bool draw_facedot, + uint initial_offset, + uint *r_vert_offset, + uint *r_edge_offset, + uint *r_face_offset) +{ + Mesh *me = ob->data; + BMEditMesh *em = me->edit_mesh; + const bool use_faceselect = (select_mode & SCE_SELECT_FACE) != 0; + + DRW_mesh_batch_cache_validate(me); + + BM_mesh_elem_table_ensure(em->bm, BM_VERT | BM_EDGE | BM_FACE); + + struct GPUBatch *geom_faces, *geom_edges, *geom_verts, *geom_facedots; + geom_faces = DRW_mesh_batch_cache_get_triangles_with_select_id(me); + if (select_mode & SCE_SELECT_EDGE) { +geom_edges = DRW_mesh_batch_cache_get_edges_with_select_id(me); + } + if (select_mode & SCE_SELECT_VERTEX) { +geom_verts = DRW_mesh_batch_cache_get_verts_with_select_id(me); + } + if (use_faceselect && draw_facedot) { +geom_facedots = DRW_mesh_batch_cache_get_facedots_with_select_id(me); + } + + DRWShadingGroup *face_shgrp; + if (use_faceselect) { +face_shgrp = DRW_shgroup_create_sub(stl->g_data->shgrp_face_flat); +DRW_shgroup_uniform_int_copy(face_shgrp, "offset", *(int *)_offset); + +if (draw_facedot) { + DRW_shgroup_call(face_shgrp, geom_facedots, ob); +} +*r_face_offset = initial_offset + em->bm->totface; + } + else { +face_shgrp = DRW_shgroup_create_sub(stl->g_data->shgrp_face_unif); +DRW_shgroup_uniform_int_copy(face_shgrp, "id", 0); + +
[Bf-blender-cvs] [c4a4ba004a2] soc-2019-outliner: Outliner: Improvements to outliner parenting
Commit: c4a4ba004a26fbd377ac23e5fa38257616714f1c Author: Nathan Craddock Date: Tue Jul 30 17:35:27 2019 -0600 Branches: soc-2019-outliner https://developer.blender.org/rBc4a4ba004a26fbd377ac23e5fa38257616714f1c Outliner: Improvements to outliner parenting Cleaned up the code for parenting to armatures, lattices, and curves. The only downside of this method is the operator reports will not function from the menu. === M source/blender/editors/space_outliner/outliner_dragdrop.c === diff --git a/source/blender/editors/space_outliner/outliner_dragdrop.c b/source/blender/editors/space_outliner/outliner_dragdrop.c index 6bd47da7be2..b58a0f34703 100644 --- a/source/blender/editors/space_outliner/outliner_dragdrop.c +++ b/source/blender/editors/space_outliner/outliner_dragdrop.c @@ -327,7 +327,7 @@ static bool parent_drop_poll(bContext *C, } static void parent_drop_set_parents( -bContext *C, wmOperator *op, wmDragID *drag, Object *parent, short parent_type) +bContext *C, ReportList *reports, wmDragID *drag, Object *parent, short parent_type) { Main *bmain = CTX_data_main(C); SpaceOutliner *soops = CTX_wm_space_outliner(C); @@ -351,12 +351,12 @@ static void parent_drop_set_parents( /* Do nothing to linked data */ if (ID_IS_LINKED(object)) { -puts("Can't edit library linked object"); -// BKE_report(op->reports, RPT_INFO, "Can't edit library linked object"); +BKE_report(reports, RPT_INFO, "Can't edit library linked object"); continue; } - if (ED_object_parent_set(NULL, C, scene, object, parent, parent_type, false, false, NULL)) { + if (ED_object_parent_set( + reports, C, scene, object, parent, parent_type, false, false, NULL)) { parent_set = true; } } @@ -370,7 +370,6 @@ static void parent_drop_set_parents( } typedef struct ParentDropData { - wmOperator *op; Object *parent; ListBase *drag_items; short type; @@ -381,7 +380,7 @@ static void parent_drop_menu_callback(bContext *C, void *data, int event) ParentDropData *drag_data = (ParentDropData *)data; wmDragID *drag = drag_data->drag_items->first; - parent_drop_set_parents(C, drag_data->op, drag, drag_data->parent, event); + parent_drop_set_parents(C, NULL, drag, drag_data->parent, event); BLI_freelistN(drag_data->drag_items); MEM_freeN(drag_data->drag_items); @@ -592,10 +591,6 @@ static int parent_drop_invoke(bContext *C, wmOperator *op, const wmEvent *event) if (ob == par) { return OPERATOR_CANCELLED; } - if (ID_IS_LINKED(ob)) { -BKE_report(op->reports, RPT_INFO, "Can't edit library linked object"); -return OPERATOR_CANCELLED; - } if (event->custom != EVT_DATA_DRAGDROP) { return OPERATOR_CANCELLED; @@ -605,11 +600,10 @@ static int parent_drop_invoke(bContext *C, wmOperator *op, const wmEvent *event) wmDrag *drag = lb->first; if (par->type != OB_ARMATURE && par->type != OB_CURVE && par->type != OB_LATTICE) { -parent_drop_set_parents(C, op, drag->ids.first, par, PAR_OBJECT); +parent_drop_set_parents(C, op->reports, drag->ids.first, par, PAR_OBJECT); } else { ParentDropData *data = MEM_callocN(sizeof(ParentDropData), "parent_drop_data"); -data->op = op; data->parent = par; data->type = par->type; ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [e76d9647462] soc-2019-bevel-profiles: Bevel Custom Profile: 4-way pipe case vertex mesh working.
Commit: e76d96474625b627a46eec9cfa112438e7899da2 Author: Hans Goudey Date: Tue Jul 30 14:48:18 2019 -0400 Branches: soc-2019-bevel-profiles https://developer.blender.org/rBe76d96474625b627a46eec9cfa112438e7899da2 Bevel Custom Profile: 4-way pipe case vertex mesh working. === M source/blender/bmesh/tools/bmesh_bevel.c === diff --git a/source/blender/bmesh/tools/bmesh_bevel.c b/source/blender/bmesh/tools/bmesh_bevel.c index 5711fde3aaa..aed6c0ce3f9 100644 --- a/source/blender/bmesh/tools/bmesh_bevel.c +++ b/source/blender/bmesh/tools/bmesh_bevel.c @@ -61,7 +61,7 @@ #define DEBUG_CUSTOM_PROFILE_ORIGINAL 0 #define DEBUG_CUSTOM_PROFILE_WELD 0 #define DEBUG_CUSTOM_PROFILE_ADJ 0 -#define DEBUG_CUSTOM_PROFILE_PIPE 0 +#define DEBUG_CUSTOM_PROFILE_PIPE 1 #define DEBUG_CUSTOM_PROFILE_ORIENTATION 0 #define DEBUG_CUSTOM_PROFILE_ORIENTATION_DRAW DEBUG_CUSTOM_PROFILE_ORIENTATION | 0 #define DEBUG_CUSTOM_PROFILE_CUTOFF 0 @@ -2432,10 +2432,9 @@ static void build_boundary_terminal_edge(BevelParams *bp, } /* For the edges not adjacent to the beveled edge, slide the bevel amount along. */ d = efirst->offset_l_spec; -if (bp->use_custom_profile) { +if (bp->use_custom_profile || bp->profile < 0.25f) { /* HANS-TODO: Even this doesn't give enough room to the profile when the adjacent edges - * aren't square so the profile is rotated sideways. There are already issues with this when - * the non-custom profile parameter is small though */ + * aren't square so the profile is rotated sideways. */ d *= sqrtf(2.0f); /* Need to go further down the edge to make room for full profile area */ } for (e = e->next; e->next != efirst; e = e->next) { @@ -4328,8 +4327,6 @@ static VMesh *tri_corner_adj_vmesh(BevelParams *bp, BevVert *bv) } /* Makes the mesh that replaces the original vertex, bounded by the profiles on the sides */ -/* HANS-TODO: Decide whether to disable the process of using fullness to find the initial center - * point for the start mesh */ static VMesh *adj_vmesh(BevelParams *bp, BevVert *bv) { #if DEBUG_CUSTOM_PROFILE_ADJ | DEBUG_CUSTOM_PROFILE_CUTOFF @@ -4337,7 +4334,7 @@ static VMesh *adj_vmesh(BevelParams *bp, BevVert *bv) #endif int n_bndv, nseg, i; VMesh *vm0, *vm1; - float boundverts_center[3], original_vertex[3], fullest[3], center_direction[3]; + float boundverts_center[3], original_vertex[3], negative_fullest[3], center_direction[3]; BoundVert *bndv; MemArena *mem_arena = bp->mem_arena; float r, p, fullness; @@ -4381,14 +4378,14 @@ static VMesh *adj_vmesh(BevelParams *bp, BevVert *bv) /* To place the center vertex: * coa is original vertex * co is centroid of boundary corners - * cob is reflection of coa in across co. - * 'fullness' is the fraction of the way - * from co to coa (if positive) or to cob (if negative). + * 'negative_fullest' is the reflection of the original vertex across the boundverts' center. + * 'fullness' is the fraction of the way from the boundvert's centroid to to the + * original vertex(if positive) or to negative_fullest (if negative). */ copy_v3_v3(original_vertex, bv->v->co); mul_v3_fl(boundverts_center, 1.0f / (float)n_bndv); - sub_v3_v3v3(fullest, boundverts_center, original_vertex); - add_v3_v3(fullest, boundverts_center); + sub_v3_v3v3(negative_fullest, boundverts_center, original_vertex); + add_v3_v3(negative_fullest, boundverts_center); /* An offline optimization process found fullness that let to closest fit to sphere as * a function of r and ns (for case of cube corner) */ @@ -4480,13 +4477,14 @@ static VMesh *pipe_adj_vmesh(BevelParams *bp, BevVert *bv, BoundVert *vpipe) printf("PIPE ADJ VMESH\n"); float green[4] = {0.0f, 1.0f, 0.0f, 1.0f}; float blue[4] = {0.0f, 0.0f, 1.0f, 1.0f}; - float new_profile_normal_end[3]; + float red[4] = {1.0f, 0.0f, 0.0f, 1.0f}; + float white[4] = {1.0f, 1.0f, 1.0f, 1.0f}; + float *color; #endif - int ipipe, i, j, k, n_bndv, ns, half_ns, ipipe1, ipipe2; + int i, j, k, n_bndv, ns, half_ns, ipipe1, ipipe2; VMesh *vm; bool even, midline; -// Profile *pipe_profile; - float new_profile_plane_co[3], new_profile_plane_no[3], new_profile_plane[4], new_vert[3]; + float *pipe1_profile_point, *pipe2_profile_point, f; /* HANS-TODO: We shouldn't need to go through the subdivision process with a custom profile. * Try just using "new_adj_vmesh" in that case. */ @@ -4501,93 +4499,93 @@ static VMesh *pipe_adj_vmesh(BevelParams *bp, BevVert *bv, BoundVert *vpipe) ipipe2 = vpipe->next->next->index; #if DEBUG_CUSTOM_PROFILE_PIPE -/* Draw the locations of all the vertices before the "snapping" process */ -for (i = 0; i < n_bndv; i++) { - for (j = 1; j <= half_ns; j++) { -for (k = 1; k <= ns; k++) { - if
[Bf-blender-cvs] [8586a2eae41] opengl_snap: DRW manager: select engine: create generic draw_select_id_mesh
Commit: 8586a2eae41b48ee02dd9a9b1a5ebbac164e6077 Author: mano-wii Date: Tue Jul 30 18:26:35 2019 -0300 Branches: opengl_snap https://developer.blender.org/rB8586a2eae41b48ee02dd9a9b1a5ebbac164e6077 DRW manager: select engine: create generic draw_select_id_mesh === M source/blender/draw/engines/select/select_draw_utils.c === diff --git a/source/blender/draw/engines/select/select_draw_utils.c b/source/blender/draw/engines/select/select_draw_utils.c index 1816d63e64a..08c6c2ac865 100644 --- a/source/blender/draw/engines/select/select_draw_utils.c +++ b/source/blender/draw/engines/select/select_draw_utils.c @@ -68,30 +68,17 @@ static void draw_select_id_edit_mesh(SELECTID_StorageList *stl, { Mesh *me = ob->data; BMEditMesh *em = me->edit_mesh; - const bool use_faceselect = (select_mode & SCE_SELECT_FACE) != 0; - - DRW_mesh_batch_cache_validate(me); BM_mesh_elem_table_ensure(em->bm, BM_VERT | BM_EDGE | BM_FACE); - struct GPUBatch *geom_faces, *geom_edges, *geom_verts, *geom_facedots; - geom_faces = DRW_mesh_batch_cache_get_triangles_with_select_id(me); - if (select_mode & SCE_SELECT_EDGE) { -geom_edges = DRW_mesh_batch_cache_get_edges_with_select_id(me); - } - if (select_mode & SCE_SELECT_VERTEX) { -geom_verts = DRW_mesh_batch_cache_get_verts_with_select_id(me); - } - if (use_faceselect && draw_facedot) { -geom_facedots = DRW_mesh_batch_cache_get_facedots_with_select_id(me); - } - + struct GPUBatch *geom_faces = DRW_mesh_batch_cache_get_triangles_with_select_id(me); DRWShadingGroup *face_shgrp; - if (use_faceselect) { + if (select_mode & SCE_SELECT_FACE) { face_shgrp = DRW_shgroup_create_sub(stl->g_data->shgrp_face_flat); DRW_shgroup_uniform_int_copy(face_shgrp, "offset", *(int *)_offset); if (draw_facedot) { + struct GPUBatch *geom_facedots = DRW_mesh_batch_cache_get_facedots_with_select_id(me); DRW_shgroup_call(face_shgrp, geom_facedots, ob); } *r_face_offset = initial_offset + em->bm->totface; @@ -106,6 +93,7 @@ static void draw_select_id_edit_mesh(SELECTID_StorageList *stl, /* Unlike faces, only draw edges if edge select mode. */ if (select_mode & SCE_SELECT_EDGE) { +struct GPUBatch *geom_edges = DRW_mesh_batch_cache_get_edges_with_select_id(me); DRWShadingGroup *edge_shgrp = DRW_shgroup_create_sub(stl->g_data->shgrp_edge); DRW_shgroup_uniform_int_copy(edge_shgrp, "offset", *(int *)r_face_offset); DRW_shgroup_call(edge_shgrp, geom_edges, ob); @@ -119,6 +107,7 @@ static void draw_select_id_edit_mesh(SELECTID_StorageList *stl, /* Unlike faces, only verts if vert select mode. */ if (select_mode & SCE_SELECT_VERTEX) { +struct GPUBatch *geom_verts = DRW_mesh_batch_cache_get_verts_with_select_id(me); DRWShadingGroup *vert_shgrp = DRW_shgroup_create_sub(stl->g_data->shgrp_vert); DRW_shgroup_uniform_int_copy(vert_shgrp, "offset", *(int *)r_edge_offset); DRW_shgroup_call(vert_shgrp, geom_verts, ob); @@ -129,42 +118,48 @@ static void draw_select_id_edit_mesh(SELECTID_StorageList *stl, } } -static void draw_select_id_paint_mesh(SELECTID_StorageList *stl, - Object *ob, - uint initial_offset, - uint *r_vert_offset, - uint *r_edge_offset, - uint *r_face_offset) +static void draw_select_id_mesh(SELECTID_StorageList *stl, +Object *ob, +short select_mode, +uint initial_offset, +uint *r_vert_offset, +uint *r_edge_offset, +uint *r_face_offset) { - Mesh *me_orig = DEG_get_original_object(ob)->data; - Mesh *me_eval = ob->data; - - struct GPUBatch *geom_faces = DRW_mesh_batch_cache_get_triangles_with_select_id(me_eval); - if ((me_orig->editflag & ME_EDIT_PAINT_VERT_SEL) && - /* Currently vertex select supports weight paint and vertex paint. */ - ((ob->mode & OB_MODE_WEIGHT_PAINT) || (ob->mode & OB_MODE_VERTEX_PAINT))) { - -struct GPUBatch *geom_verts = DRW_mesh_batch_cache_get_verts_with_select_id(me_eval); + Mesh *me = ob->data; + struct GPUBatch *geom_faces = DRW_mesh_batch_cache_get_triangles_with_select_id(me); + DRWShadingGroup *face_shgrp; + if (select_mode & SCE_SELECT_FACE) { +face_shgrp = DRW_shgroup_create_sub(stl->g_data->shgrp_face_flat); +DRW_shgroup_uniform_int_copy(face_shgrp, "offset", *(int *)_offset); +*r_face_offset = initial_offset + me->totpoly; + } + else { /* Only draw faces to mask out verts, we don't want their selection ID's. */ -DRWShadingGroup *face_shgrp =
[Bf-blender-cvs] [72092b7eba3] opengl_snap: Cleanup: Rearrange Select Engine into multiple files
Commit: 72092b7eba305a4d902dee62f35ae2ac048564bb Author: mano-wii Date: Tue Jul 30 17:55:20 2019 -0300 Branches: opengl_snap https://developer.blender.org/rB72092b7eba305a4d902dee62f35ae2ac048564bb Cleanup: Rearrange Select Engine into multiple files === M source/blender/draw/CMakeLists.txt A source/blender/draw/engines/select/select_draw_utils.c M source/blender/draw/engines/select/select_engine.c A source/blender/draw/engines/select/select_private.h === diff --git a/source/blender/draw/CMakeLists.txt b/source/blender/draw/CMakeLists.txt index 664484d9a57..016cd628969 100644 --- a/source/blender/draw/CMakeLists.txt +++ b/source/blender/draw/CMakeLists.txt @@ -127,6 +127,7 @@ set(SRC engines/gpencil/gpencil_render.c engines/gpencil/gpencil_shader_fx.c engines/select/select_engine.c + engines/select/select_draw_utils.c DRW_engine.h intern/DRW_render.h @@ -152,6 +153,7 @@ set(SRC engines/workbench/workbench_engine.h engines/workbench/workbench_private.h engines/select/select_engine.h + engines/select/select_private.h ) set(LIB diff --git a/source/blender/draw/engines/select/select_draw_utils.c b/source/blender/draw/engines/select/select_draw_utils.c new file mode 100644 index 000..1816d63e64a --- /dev/null +++ b/source/blender/draw/engines/select/select_draw_utils.c @@ -0,0 +1,210 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * Copyright 2019, Blender Foundation. + */ + +/** \file + * \ingroup draw_engine + * + * Engine for drawing a selection map where the pixels indicate the selection indices. + */ + +#include "BKE_editmesh.h" + +#include "DNA_mesh_types.h" +#include "DNA_scene_types.h" + +#include "ED_view3d.h" + +#include "DEG_depsgraph.h" +#include "DEG_depsgraph_query.h" + +#include "draw_cache_impl.h" + +#include "select_private.h" + +/* */ +/** \name Draw Utilities + * \{ */ + +static bool check_ob_drawface_dot(short select_mode, const View3D *v3d, char dt) +{ + if (select_mode & SCE_SELECT_FACE) { +if ((dt < OB_SOLID) || XRAY_FLAG_ENABLED(v3d)) { + return true; +} +if (v3d->overlay.edit_flag & V3D_OVERLAY_EDIT_FACE_DOT) { + return true; +} +if ((v3d->overlay.edit_flag & V3D_OVERLAY_EDIT_EDGES) == 0) { + /* Since we can't deduce face selection when edges aren't visible - show dots. */ + return true; +} + } + return false; +} + +static void draw_select_id_edit_mesh(SELECTID_StorageList *stl, + Object *ob, + short select_mode, + bool draw_facedot, + uint initial_offset, + uint *r_vert_offset, + uint *r_edge_offset, + uint *r_face_offset) +{ + Mesh *me = ob->data; + BMEditMesh *em = me->edit_mesh; + const bool use_faceselect = (select_mode & SCE_SELECT_FACE) != 0; + + DRW_mesh_batch_cache_validate(me); + + BM_mesh_elem_table_ensure(em->bm, BM_VERT | BM_EDGE | BM_FACE); + + struct GPUBatch *geom_faces, *geom_edges, *geom_verts, *geom_facedots; + geom_faces = DRW_mesh_batch_cache_get_triangles_with_select_id(me); + if (select_mode & SCE_SELECT_EDGE) { +geom_edges = DRW_mesh_batch_cache_get_edges_with_select_id(me); + } + if (select_mode & SCE_SELECT_VERTEX) { +geom_verts = DRW_mesh_batch_cache_get_verts_with_select_id(me); + } + if (use_faceselect && draw_facedot) { +geom_facedots = DRW_mesh_batch_cache_get_facedots_with_select_id(me); + } + + DRWShadingGroup *face_shgrp; + if (use_faceselect) { +face_shgrp = DRW_shgroup_create_sub(stl->g_data->shgrp_face_flat); +DRW_shgroup_uniform_int_copy(face_shgrp, "offset", *(int *)_offset); + +if (draw_facedot) { + DRW_shgroup_call(face_shgrp, geom_facedots, ob); +} +*r_face_offset = initial_offset + em->bm->totface; + } + else { +face_shgrp = DRW_shgroup_create_sub(stl->g_data->shgrp_face_unif); +DRW_shgroup_uniform_int_copy(face_shgrp, "id", 0); + +
[Bf-blender-cvs] [5359b7a0330] master: cleanup: Fix typo in last commit
Commit: 5359b7a033078848cc8928cdc63322874bb8d40e Author: Lazydodo Date: Tue Jul 30 14:50:53 2019 -0600 Branches: master https://developer.blender.org/rB5359b7a033078848cc8928cdc63322874bb8d40e cleanup: Fix typo in last commit Accidentally took the C flags as a base. === M build_files/cmake/platform/platform_win32.cmake === diff --git a/build_files/cmake/platform/platform_win32.cmake b/build_files/cmake/platform/platform_win32.cmake index 536f9c2a074..fa757b2a1c5 100644 --- a/build_files/cmake/platform/platform_win32.cmake +++ b/build_files/cmake/platform/platform_win32.cmake @@ -146,7 +146,7 @@ set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} /MT") #JMC is available on msvc 15.8 (1915) and up if(MSVC_VERSION GREATER 1914 AND NOT MSVC_CLANG) - set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /JMC") + set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /JMC") endif() set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} /SUBSYSTEM:CONSOLE /STACK:2097152 /INCREMENTAL:NO ") ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [19b72f50d70] master: CMake/Windows: Enable JMC on compilers that support it.
Commit: 19b72f50d704eb4061ae77a87bf7e8751e04a3ae Author: Lazydodo Date: Tue Jul 30 14:40:05 2019 -0600 Branches: master https://developer.blender.org/rB19b72f50d704eb4061ae77a87bf7e8751e04a3ae CMake/Windows: Enable JMC on compilers that support it. JMC [1] enables more productive debugging of C++ code in visual studio this change enables it on debug builds for builds with visual studio 15.8 or higher. [1] https://devblogs.microsoft.com/cppblog/announcing-jmc-stepping-in-visual-studio/ === M build_files/cmake/platform/platform_win32.cmake === diff --git a/build_files/cmake/platform/platform_win32.cmake b/build_files/cmake/platform/platform_win32.cmake index 3fc0d20fb46..536f9c2a074 100644 --- a/build_files/cmake/platform/platform_win32.cmake +++ b/build_files/cmake/platform/platform_win32.cmake @@ -144,6 +144,11 @@ set(CMAKE_C_FLAGS_MINSIZEREL "${CMAKE_C_FLAGS_MINSIZEREL} /MT") set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} /MT") set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} /MT") +#JMC is available on msvc 15.8 (1915) and up +if(MSVC_VERSION GREATER 1914 AND NOT MSVC_CLANG) + set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /JMC") +endif() + set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} /SUBSYSTEM:CONSOLE /STACK:2097152 /INCREMENTAL:NO ") set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} /NODEFAULTLIB:msvcrt.lib /NODEFAULTLIB:msvcmrt.lib /NODEFAULTLIB:msvcurt.lib /NODEFAULTLIB:msvcrtd.lib ") ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [8d3f4a1df35] temp-vr-draw-thread: Merge branch 'soc-2019-openxr' into temp-vr-draw-thread
Commit: 8d3f4a1df35d48d273612ee2a0821fcb6fffebc5 Author: Julian Eisel Date: Tue Jul 30 22:26:37 2019 +0200 Branches: temp-vr-draw-thread https://developer.blender.org/rB8d3f4a1df35d48d273612ee2a0821fcb6fffebc5 Merge branch 'soc-2019-openxr' into temp-vr-draw-thread === === ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [9ac33e56a16] soc-2019-openxr: Merge branch 'master' into soc-2019-openxr
Commit: 9ac33e56a16e933cc8a1c16e8c477f843d452f21 Author: Julian Eisel Date: Tue Jul 30 22:19:41 2019 +0200 Branches: soc-2019-openxr https://developer.blender.org/rB9ac33e56a16e933cc8a1c16e8c477f843d452f21 Merge branch 'master' into soc-2019-openxr === === ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [6267d647ae0] soc-2019-outliner: Keymap: Support F2 for rename in the outliner
Commit: 6267d647ae0bc66b2b50c1c0a4352230e181fa74 Author: Nathan Craddock Date: Tue Jul 30 13:38:08 2019 -0600 Branches: soc-2019-outliner https://developer.blender.org/rB6267d647ae0bc66b2b50c1c0a4352230e181fa74 Keymap: Support F2 for rename in the outliner Rather than use the F2 rename active object popup when in the outliner, rename the active element. This allows renaming object data, collection, and other non-object elements within the outiner. === M release/scripts/presets/keyconfig/keymap_data/blender_default.py M source/blender/editors/space_outliner/outliner_edit.c === diff --git a/release/scripts/presets/keyconfig/keymap_data/blender_default.py b/release/scripts/presets/keyconfig/keymap_data/blender_default.py index 1cb2f899cc9..bdf93795c7a 100644 --- a/release/scripts/presets/keyconfig/keymap_data/blender_default.py +++ b/release/scripts/presets/keyconfig/keymap_data/blender_default.py @@ -700,6 +700,7 @@ def km_outliner(params): items.extend([ ("outliner.highlight_update", {"type": 'MOUSEMOVE', "value": 'ANY', "any": True}, None), ("outliner.item_rename", {"type": 'LEFTMOUSE', "value": 'DOUBLE_CLICK'}, None), +("outliner.item_rename", {"type": 'F2', "value": 'PRESS'}, None), ("outliner.item_activate", {"type": 'LEFTMOUSE', "value": 'CLICK'}, {"properties": [("extend", False), ("deselect_all", not params.legacy)]}), ("outliner.item_activate", {"type": 'LEFTMOUSE', "value": 'CLICK', "ctrl": True}, diff --git a/source/blender/editors/space_outliner/outliner_edit.c b/source/blender/editors/space_outliner/outliner_edit.c index 00636e374be..4efdd81c161 100644 --- a/source/blender/editors/space_outliner/outliner_edit.c +++ b/source/blender/editors/space_outliner/outliner_edit.c @@ -398,10 +398,10 @@ void item_rename_cb(bContext *C, do_item_rename(ar, te, tselem, reports); } -static int do_outliner_item_rename(ReportList *reports, - ARegion *ar, - TreeElement *te, - const float mval[2]) +static void do_outliner_item_rename(ReportList *reports, +ARegion *ar, +TreeElement *te, +const float mval[2]) { if (mval[1] > te->ys && mval[1] < te->ys + UI_UNIT_Y) { TreeStoreElem *tselem = TREESTORE(te); @@ -409,17 +409,12 @@ static int do_outliner_item_rename(ReportList *reports, /* click on name */ if (mval[0] > te->xs + UI_UNIT_X * 2 && mval[0] < te->xend) { do_item_rename(ar, te, tselem, reports); - return 1; } -return 0; } for (te = te->subtree.first; te; te = te->next) { -if (do_outliner_item_rename(reports, ar, te, mval)) { - return 1; -} +do_outliner_item_rename(reports, ar, te, mval); } - return 0; } static int outliner_item_rename(bContext *C, wmOperator *op, const wmEvent *event) @@ -428,25 +423,34 @@ static int outliner_item_rename(bContext *C, wmOperator *op, const wmEvent *even SpaceOutliner *soops = CTX_wm_space_outliner(C); TreeElement *te; float fmval[2]; - bool changed = false; - UI_view2d_region_to_view(>v2d, event->mval[0], event->mval[1], [0], [1]); + /* Rename active element if key pressed, otherwise rename element at cursor coordinates */ + if (event->val == KM_PRESS) { +TreeElement *active_element = outliner_find_element_with_flag(>tree, TSE_ACTIVE); - for (te = soops->tree.first; te; te = te->next) { -if (do_outliner_item_rename(op->reports, ar, te, fmval)) { - changed = true; - break; +if (active_element) { + do_item_rename(ar, active_element, TREESTORE(active_element), op->reports); +} +else { + BKE_report(op->reports, RPT_WARNING, "No active item to rename"); } } + else { +UI_view2d_region_to_view(>v2d, event->mval[0], event->mval[1], [0], [1]); - return changed ? OPERATOR_FINISHED : OPERATOR_PASS_THROUGH; +for (te = soops->tree.first; te; te = te->next) { + do_outliner_item_rename(op->reports, ar, te, fmval); +} + } + + return OPERATOR_FINISHED; } void OUTLINER_OT_item_rename(wmOperatorType *ot) { ot->name = "Rename"; ot->idname = "OUTLINER_OT_item_rename"; - ot->description = "Rename item under cursor"; + ot->description = "Rename the active element"; ot->invoke = outliner_item_rename; ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [fe03e522277] soc-2019-outliner: Merge branch 'master' into soc-2019-outliner
Commit: fe03e522277f2785c666228f3c11f925909ca435 Author: Nathan Craddock Date: Tue Jul 30 11:37:29 2019 -0600 Branches: soc-2019-outliner https://developer.blender.org/rBfe03e522277f2785c666228f3c11f925909ca435 Merge branch 'master' into soc-2019-outliner === === ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [fe47c7bf843] master: DRW manager: select engine: remove redundant calls
Commit: fe47c7bf8435afee164896547067ee6092b4673a Author: mano-wii Date: Tue Jul 30 16:32:08 2019 -0300 Branches: master https://developer.blender.org/rBfe47c7bf8435afee164896547067ee6092b4673a DRW manager: select engine: remove redundant calls === M source/blender/draw/engines/select/select_engine.c === diff --git a/source/blender/draw/engines/select/select_engine.c b/source/blender/draw/engines/select/select_engine.c index f1fc9cbc0d6..260fe8793e6 100644 --- a/source/blender/draw/engines/select/select_engine.c +++ b/source/blender/draw/engines/select/select_engine.c @@ -196,7 +196,6 @@ static void draw_select_id_object(void *vedata, if (use_faceselect && draw_facedot) { geom_facedots = DRW_mesh_batch_cache_get_facedots_with_select_id(me); } -DRW_mesh_batch_cache_create_requested(ob, me, NULL, false, true); DRWShadingGroup *face_shgrp; if (use_faceselect) { @@ -244,14 +243,12 @@ static void draw_select_id_object(void *vedata, Mesh *me_orig = DEG_get_original_object(ob)->data; Mesh *me_eval = ob->data; -DRW_mesh_batch_cache_validate(me_eval); struct GPUBatch *geom_faces = DRW_mesh_batch_cache_get_triangles_with_select_id(me_eval); if ((me_orig->editflag & ME_EDIT_PAINT_VERT_SEL) && /* Currently vertex select supports weight paint and vertex paint. */ ((ob->mode & OB_MODE_WEIGHT_PAINT) || (ob->mode & OB_MODE_VERTEX_PAINT))) { struct GPUBatch *geom_verts = DRW_mesh_batch_cache_get_verts_with_select_id(me_eval); - DRW_mesh_batch_cache_create_requested(ob, me_eval, NULL, false, true); /* Only draw faces to mask out verts, we don't want their selection ID's. */ DRWShadingGroup *face_shgrp = DRW_shgroup_create_sub(stl->g_data->shgrp_face_unif); @@ -266,9 +263,6 @@ static void draw_select_id_object(void *vedata, *r_vert_offset = me_eval->totvert + 1; } else { - const bool use_hide = (me_orig->editflag & ME_EDIT_PAINT_FACE_SEL); - DRW_mesh_batch_cache_create_requested(ob, me_eval, NULL, false, use_hide); - DRWShadingGroup *face_shgrp = DRW_shgroup_create_sub(stl->g_data->shgrp_face_flat); DRW_shgroup_uniform_int_copy(face_shgrp, "offset", *(int *)_offset); DRW_shgroup_call(face_shgrp, geom_faces, ob); ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [34b3a9583ac] master: Cmake/windows: Fix vcpkg bypassing our libs folder.
Commit: 34b3a9583ac2433dd8d223d2bd098adc30bc72bd Author: Lazydodo Date: Tue Jul 30 11:13:33 2019 -0600 Branches: master https://developer.blender.org/rB34b3a9583ac2433dd8d223d2bd098adc30bc72bd Cmake/windows: Fix vcpkg bypassing our libs folder. Occasionally we get reports of people that build blender and end up with either build errors or end up with builds that do not run on other systems. The root cause is when you install vpckg and integrate it into the build system it puts the search path for its includes and libraries before anything else. previously we told people to either uninstall vcpkg or remove the conflicting packages, which was not great. this change opts out of the use of vcpkg for blender only, so people can keep using it for other work without issues. === M source/creator/CMakeLists.txt === diff --git a/source/creator/CMakeLists.txt b/source/creator/CMakeLists.txt index 77877ff3cca..e911a591881 100644 --- a/source/creator/CMakeLists.txt +++ b/source/creator/CMakeLists.txt @@ -1050,6 +1050,12 @@ unset(LIB) setup_liblinks(blender) +# vcpkg substitutes our libs with theirs, which will cause issues when you +# you run these builds on other systems due to missing dlls. So we opt out +# the use of vcpkg +if (WIN32) + set_target_properties(blender PROPERTIES VS_GLOBAL_VcpkgEnabled "false") +endif() # - # Setup launcher ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [ec65713282d] soc-2019-bevel-profiles: ProfileWidget / Bevel Modifier: Resolved issue where dragging points in the widget didn't cause the modifier to recalculate.
Commit: ec65713282d7be1a97dd376d7ac5051c3059f05c Author: Hans Goudey Date: Tue Jul 30 09:42:57 2019 -0400 Branches: soc-2019-bevel-profiles https://developer.blender.org/rBec65713282d7be1a97dd376d7ac5051c3059f05c ProfileWidget / Bevel Modifier: Resolved issue where dragging points in the widget didn't cause the modifier to recalculate. === M source/blender/editors/interface/interface_handlers.c M source/blender/editors/interface/interface_templates.c === diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index e2b28bf749b..9e31e1665db 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -6744,7 +6744,6 @@ static int ui_do_but_CURVE( } /* Same as ui_numedit_but_CURVE with some smaller changes */ -/* HANS-TODO: Dragging control point doesn't update modifier */ static bool ui_numedit_but_PROFILE(uiBlock *block, uiBut *but, uiHandleButtonData *data, diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index 4090d1cb6c0..5e6e90f8a57 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -4354,7 +4354,7 @@ static uiBlock *profilewidget_buttons_presets(bContext *C, ARegion *ar, void *pr return profilewidget_presets_func(C, ar, (ProfileWidget *)prwdgt_v); } -/* only for profilewidget tools block */ +/* Only for profilewidget tools block */ enum { UIPROFILE_FUNC_RESET, UIPROFILE_FUNC_RESET_VIEW, @@ -4547,8 +4547,8 @@ static void profilewidget_buttons_layout(uiLayout *layout, PointerRNA *ptr, RNAU /* HANS-QUESTION: I'm guessing this is the newer way to do this. I'd be happy to switch * everythingn here to this method, as it seems simpler, more elegant, and more linked to the RNA - * system anyway, but this doesn't redraw the widget */ - uiItemR(layout, ptr, "preset", 0, "Preset", ICON_NONE); + * system anyway, but this doesn't redraw the widget + uiItemR(layout, ptr, "preset", 0, "Preset", ICON_NONE); */ row = uiLayoutRow(layout, false); @@ -4586,6 +4586,8 @@ static void profilewidget_buttons_layout(uiLayout *layout, PointerRNA *ptr, RNAU 0.0, TIP_("Toggle Profile Clipping")); UI_but_funcN_set(bt, profilewidget_clipping_toggle, MEM_dupallocN(cb), prwdgt); + UI_block_funcN_set(block, rna_update_cb, MEM_dupallocN(cb), NULL); + /* The path itself */ path_width = max_ii(uiLayoutGetWidth(layout), UI_UNIT_X); path_width = min_ii(path_width, (int)(16.0f * UI_UNIT_X)); @@ -4625,24 +4627,25 @@ static void profilewidget_buttons_layout(uiLayout *layout, PointerRNA *ptr, RNAU 0.0, 0.0, 0.0, 0.0, TIP_("Set the point's handle type to sharp.")); UI_but_funcN_set(bt, profilewidget_buttons_setcurved, MEM_dupallocN(cb), prwdgt); -/* Position */ + UI_block_funcN_set(block, profilewidget_buttons_update, MEM_dupallocN(cb), prwdgt); -/* HANS-QUESTION: I haven't been able to find out how to just disable these buttons instead of +/* HANS-QUESTION: I haven't been able to find out how to disable these buttons instead of * not drawing them. */ if (!point_last_or_first) { + + /* Position */ bt = uiDefButF(block, UI_BTYPE_NUM, 0, "X:", 0, 2 * UI_UNIT_Y, UI_UNIT_X * 10, UI_UNIT_Y, >x, bounds.xmin, bounds.xmax, 1, 5, ""); uiDefButF(block, UI_BTYPE_NUM, 0, "Y:", 0, 1 * UI_UNIT_Y, UI_UNIT_X * 10, UI_UNIT_Y, >y, bounds.ymin, bounds.ymax, 1, 5, ""); -} -/* Delete points */ -bt = uiDefIconBut(block, UI_BTYPE_BUT, 0, ICON_X, 0, 0, UI_UNIT_X, UI_UNIT_X, NULL, 0.0, 0.0, - 0.0, 0.0, TIP_("Delete points")); -UI_but_funcN_set(bt, profilewidget_buttons_delete, MEM_dupallocN(cb), prwdgt); + /* Delete points */ + bt = uiDefIconBut(block, UI_BTYPE_BUT, 0, ICON_X, 0, 0, UI_UNIT_X, UI_UNIT_X, NULL, 0.0, 0.0, +0.0, 0.0, TIP_("Delete points")); + UI_but_funcN_set(bt, profilewidget_buttons_delete, MEM_dupallocN(cb), prwdgt); +} -UI_block_funcN_set(block, rna_update_cb, MEM_dupallocN(cb), NULL); } uiItemR(layout, ptr, "sample_straight_edges", 0, NULL, ICON_NONE); ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [9d7a03ab117] master: Fix T67939: GPencil Noise modifier step is ignored in render
Commit: 9d7a03ab1177f7227653ec691e10ce328771a4eb Author: Antonio Vazquez Date: Tue Jul 30 19:42:43 2019 +0200 Branches: master https://developer.blender.org/rB9d7a03ab1177f7227653ec691e10ce328771a4eb Fix T67939: GPencil Noise modifier step is ignored in render The value of the step was calculated using a variable that was removed when the render frame change. Now, the step is calculated using the modulus of the current frame and recalculate noise only if the remainder that results from performing integer division is equal to 0. To calculate current frame, the first used frame is calculated to adjust real frame range. This approach is more stable in viewport and render. === M source/blender/gpencil_modifiers/intern/MOD_gpencilnoise.c M source/blender/makesdna/DNA_gpencil_modifier_types.h === diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencilnoise.c b/source/blender/gpencil_modifiers/intern/MOD_gpencilnoise.c index 54218da9eb5..e0139eac6b2 100644 --- a/source/blender/gpencil_modifiers/intern/MOD_gpencilnoise.c +++ b/source/blender/gpencil_modifiers/intern/MOD_gpencilnoise.c @@ -85,6 +85,21 @@ static bool dependsOnTime(GpencilModifierData *md) return (mmd->flag & GP_NOISE_USE_RANDOM) != 0; } +/* Get the lower number of frame for all layers. */ +static int get_lower_frame(bGPdata *gpd) +{ + int init = 9; + for (bGPDlayer *gpl = gpd->layers.first; gpl; gpl = gpl->next) { +if (gpl->frames.first) { + bGPDframe *gpf = gpl->frames.first; + if (gpf->framenum < init) { +init = gpf->framenum; + } +} + } + return init; +} + /* aply noise effect based on stroke direction */ static void deformStroke( GpencilModifierData *md, Depsgraph *depsgraph, Object *ob, bGPDlayer *gpl, bGPDstroke *gps) @@ -103,6 +118,7 @@ static void deformStroke( Object *object_eval = DEG_get_evaluated_object(depsgraph, ob); GpencilModifierData *md_eval = BKE_gpencil_modifiers_findByName(object_eval, md->name); NoiseGpencilModifierData *mmd_eval = (NoiseGpencilModifierData *)md_eval; + bGPdata *gpd = (bGPdata *)ob->data; /* Random generator, only init once. (it uses eval to get same value in render) */ if (mmd_eval->rng == NULL) { @@ -110,6 +126,9 @@ static void deformStroke( rng_seed ^= POINTER_AS_UINT(mmd); mmd_eval->rng = BLI_rng_new(rng_seed); mmd->rng = mmd_eval->rng; +/* Get lower frame number */ +mmd_eval->scene_frame = get_lower_frame(gpd); +mmd->scene_frame = mmd_eval->scene_frame; } if (!is_stroke_affected_by_modifier(ob, @@ -176,19 +195,17 @@ static void deformStroke( sub_v3_v3v3(vec1, >x, >x); } vran = len_v3(vec1); -/* vector orthogonal to normal */ +/* Vector orthogonal to normal. */ cross_v3_v3v3(vec2, vec1, normal); normalize_v3(vec2); -/* use random noise */ +/* Use random noise */ if (mmd->flag & GP_NOISE_USE_RANDOM) { - sc_diff = abs(mmd->scene_frame - sc_frame); - /* only recalc if the gp frame change or the number of scene frames is bigger than step */ - if ((!gpl->actframe) || (mmd->gp_frame != gpl->actframe->framenum) || - (sc_diff >= mmd->step)) { + sc_diff = abs(sc_frame - mmd->scene_frame) % mmd->step; + /* Only recalc if the gp frame change or is a step. */ + if ((mmd->gp_frame != sc_frame) && (sc_diff == 0)) { vran = mmd->vrand1 = BLI_rng_get_float(mmd->rng); vdir = mmd->vrand2 = BLI_rng_get_float(mmd->rng); -mmd->gp_frame = gpl->actframe->framenum; -mmd->scene_frame = sc_frame; +mmd->gp_frame = sc_frame; } else { vran = mmd->vrand1; diff --git a/source/blender/makesdna/DNA_gpencil_modifier_types.h b/source/blender/makesdna/DNA_gpencil_modifier_types.h index 8b756ff2937..c2a9d3cf296 100644 --- a/source/blender/makesdna/DNA_gpencil_modifier_types.h +++ b/source/blender/makesdna/DNA_gpencil_modifier_types.h @@ -92,7 +92,7 @@ typedef struct NoiseGpencilModifierData { int step; /** Last gp frame used. */ int gp_frame; - /** Last scene frame used. */ + /** First scene frame used. */ int scene_frame; /** Random values. */ float vrand1, vrand2; ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [7acf1dbdedd] bitmap_visibility_gpu: Initial Commit: Use GPU to test the visibility of vertices.
Commit: 7acf1dbdeddc63d991dc563f534409eb9b60be4d Author: mano-wii Date: Tue Jul 30 14:33:33 2019 -0300 Branches: bitmap_visibility_gpu https://developer.blender.org/rB7acf1dbdeddc63d991dc563f534409eb9b60be4d Initial Commit: Use GPU to test the visibility of vertices. === M source/blender/draw/CMakeLists.txt M source/blender/draw/engines/select/select_engine.c A source/blender/draw/engines/select/shaders/selection_id_3D_bitmap_vert.glsl A source/blender/draw/engines/select/shaders/selection_id_bitmap_frag.glsl === diff --git a/source/blender/draw/CMakeLists.txt b/source/blender/draw/CMakeLists.txt index 664484d9a57..edc20039375 100644 --- a/source/blender/draw/CMakeLists.txt +++ b/source/blender/draw/CMakeLists.txt @@ -365,7 +365,9 @@ data_to_c_simple(engines/gpencil/shaders/fx/gpencil_fx_shadow_resolve_frag.glsl data_to_c_simple(engines/gpencil/shaders/fx/gpencil_fx_swirl_frag.glsl SRC) data_to_c_simple(engines/gpencil/shaders/fx/gpencil_fx_wave_frag.glsl SRC) +data_to_c_simple(engines/select/shaders/selection_id_3D_bitmap_vert.glsl SRC) data_to_c_simple(engines/select/shaders/selection_id_3D_vert.glsl SRC) +data_to_c_simple(engines/select/shaders/selection_id_bitmap_frag.glsl SRC) data_to_c_simple(engines/select/shaders/selection_id_frag.glsl SRC) diff --git a/source/blender/draw/engines/select/select_engine.c b/source/blender/draw/engines/select/select_engine.c index f1fc9cbc0d6..714c3456752 100644 --- a/source/blender/draw/engines/select/select_engine.c +++ b/source/blender/draw/engines/select/select_engine.c @@ -22,6 +22,9 @@ * Engine for drawing a selection map where the pixels indicate the selection indices. */ +#include "MEM_guardedalloc.h" + +#include "BLI_bitmap.h" #include "BLI_rect.h" #include "BKE_editmesh.h" @@ -61,6 +64,8 @@ typedef struct SELECTID_PassList { struct DRWPass *select_id_face_pass; struct DRWPass *select_id_edge_pass; struct DRWPass *select_id_vert_pass; + + struct DRWPass *visibility_vert_pass; } SELECTID_PassList; typedef struct SELECTID_Data { @@ -75,6 +80,7 @@ typedef struct SELECTID_Shaders { /* Depth Pre Pass */ struct GPUShader *select_id_flat; struct GPUShader *select_id_uniform; + struct GPUShader *select_id_bitmap; } SELECTID_Shaders; /* *** STATIC *** */ @@ -94,6 +100,8 @@ static struct { struct Depsgraph *depsgraph; short select_mode; + +BLI_bitmap *vert_visibility_mask; } context; } e_data = {{{NULL}}}; /* Engine data */ @@ -103,6 +111,8 @@ typedef struct SELECTID_PrivateData { DRWShadingGroup *shgrp_edge; DRWShadingGroup *shgrp_vert; + DRWShadingGroup *shgrp_visibly_vert; + DRWView *view_faces; DRWView *view_edges; DRWView *view_verts; @@ -129,6 +139,8 @@ struct BaseOffset { extern char datatoc_common_view_lib_glsl[]; extern char datatoc_selection_id_3D_vert_glsl[]; extern char datatoc_selection_id_frag_glsl[]; +extern char datatoc_selection_id_3D_bitmap_vert_glsl[]; +extern char datatoc_selection_id_bitmap_frag_glsl[]; /* */ /** \name Selection Utilities @@ -327,6 +339,7 @@ static void select_engine_init(void *vedata) .defs = (const char *[]){sh_cfg_data->def, NULL}, }); } + if (!sh_data->select_id_uniform) { const GPUShaderConfigData *sh_cfg_data = _shader_cfg_data[sh_cfg]; sh_data->select_id_uniform = GPU_shader_create_from_arrays({ @@ -339,6 +352,19 @@ static void select_engine_init(void *vedata) }); } + /* TODO: Create on demand */ + if (!sh_data->select_id_bitmap) { +const GPUShaderConfigData *sh_cfg_data = _shader_cfg_data[sh_cfg]; +sh_data->select_id_bitmap = GPU_shader_create_from_arrays({ +.vert = (const char *[]){sh_cfg_data->lib, + datatoc_common_view_lib_glsl, + datatoc_selection_id_3D_bitmap_vert_glsl, + NULL}, +.frag = (const char *[]){datatoc_selection_id_bitmap_frag_glsl, NULL}, +.defs = (const char *[]){sh_cfg_data->def, NULL}, +}); + } + if (!stl->g_data) { /* Alloc transient pointers */ stl->g_data = MEM_mallocN(sizeof(*stl->g_data), __func__); @@ -379,11 +405,18 @@ static void select_cache_init(void *vedata) DRW_shgroup_uniform_float_copy(stl->g_data->shgrp_vert, "sizeVertex", G_draw.block.sizeVertex); +psl->visibility_vert_pass = DRW_pass_create("Vert Visibility Pass", +DRW_STATE_WRITE_COLOR | DRW_STATE_BLEND_ADD_FULL); + +stl->g_data->shgrp_visibly_vert = DRW_shgroup_create(sh_data->select_id_bitmap, + psl->visibility_vert_pass); + if (draw_ctx->sh_cfg == GPU_SHADER_CFG_CLIPPED) {
[Bf-blender-cvs] [1bdadef21ce] sculpt-mode-features: Change neighbour array default size
Commit: 1bdadef21ce262799eecf4be0eaa1a910ccc610d Author: Pablo Dobarro Date: Tue Jul 30 18:16:27 2019 +0200 Branches: sculpt-mode-features https://developer.blender.org/rB1bdadef21ce262799eecf4be0eaa1a910ccc610d Change neighbour array default size === M source/blender/editors/sculpt_paint/sculpt.c === diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index e448fe89d7f..25ef711aecd 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -215,7 +215,7 @@ typedef struct SculptVertexNeighbourIter { int i; } SculptVertexNeighbourIter; -#define SCULPT_VERTEX_NEIGHBOUR_MAX 3 +#define SCULPT_VERTEX_NEIGHBOUR_MAX 256 void sculpt_vertex_neighbour_add(SculptVertexNeighbourIter *iter, int neighbour_index) { ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [28bd15cdf01] master: Fix snap package to work with 2.80 version number
Commit: 28bd15cdf01f1a0ad14a320bfe91a16d3f039ba4 Author: Brecht Van Lommel Date: Tue Jul 30 13:56:08 2019 +0200 Branches: master https://developer.blender.org/rB28bd15cdf01f1a0ad14a320bfe91a16d3f039ba4 Fix snap package to work with 2.80 version number Without this it rounds to 2.8. === M release/freedesktop/snap/snapcraft.yaml.in === diff --git a/release/freedesktop/snap/snapcraft.yaml.in b/release/freedesktop/snap/snapcraft.yaml.in index 12fff16d528..a79d9ccc0a2 100644 --- a/release/freedesktop/snap/snapcraft.yaml.in +++ b/release/freedesktop/snap/snapcraft.yaml.in @@ -27,7 +27,7 @@ apps: command: ./blender desktop: ./blender.desktop -version: @VERSION@ +version: '@VERSION@' grade: @GRADE@ parts: ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [10b2c9051d1] sculpt-mode-features: Sculpt mesh API: replace gsets with static arrays
Commit: 10b2c9051d1f36b6c254b2d512c655226947b61a Author: Pablo Dobarro Date: Tue Jul 30 18:12:46 2019 +0200 Branches: sculpt-mode-features https://developer.blender.org/rB10b2c9051d1f36b6c254b2d512c655226947b61a Sculpt mesh API: replace gsets with static arrays === M source/blender/editors/sculpt_paint/sculpt.c === diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index 327fe2c2638..e448fe89d7f 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -136,7 +136,7 @@ void sculpt_vertex_normal_get(SculptSession *ss, VertexHandle index, float no[3] } } -float *sculpt_vertex_co_get(SculptSession *ss, int index) +float *sculpt_vertex_co_get(SculptSession *ss, VertexHandle index) { switch (BKE_pbvh_type(ss->pbvh)) { case PBVH_FACES: @@ -215,6 +215,28 @@ typedef struct SculptVertexNeighbourIter { int i; } SculptVertexNeighbourIter; +#define SCULPT_VERTEX_NEIGHBOUR_MAX 3 + +void sculpt_vertex_neighbour_add(SculptVertexNeighbourIter *iter, int neighbour_index) +{ + if (iter->count >= SCULPT_VERTEX_NEIGHBOUR_MAX) { +iter->neighbours = MEM_reallocN_id(iter->neighbours, + (iter->count + SCULPT_VERTEX_NEIGHBOUR_MAX) * + sizeof(VertexHandle), + "neighbour array"); + } + + for (int i = 0; i < iter->count; i++) { +if (iter->neighbours[i] == neighbour_index) { + return; +} + } + + iter->neighbours[iter->count] = neighbour_index; + iter->count++; + return; +} + void sculpt_vertex_neighbours_get_bmesh(SculptSession *ss, VertexHandle index, SculptVertexNeighbourIter *iter) @@ -222,41 +244,30 @@ void sculpt_vertex_neighbours_get_bmesh(SculptSession *ss, BMVert *v = BM_vert_at_index(ss->bm, index); BMIter liter; BMLoop *l; - GSet *n_set; - n_set = BLI_gset_new(BLI_ghashutil_uinthash, BLI_ghashutil_intcmp, "neighbour set"); + iter->count = 0; + iter->neighbours = MEM_mallocN(SCULPT_VERTEX_NEIGHBOUR_MAX * sizeof(VertexHandle), + "neighbour array"); int i = 0; BM_ITER_ELEM (l, , v, BM_LOOPS_OF_VERT) { const BMVert *adj_v[2] = {l->prev->v, l->next->v}; for (i = 0; i < ARRAY_SIZE(adj_v); i++) { const BMVert *v_other = adj_v[i]; if (BM_elem_index_get(v_other) != (int)index) { -BLI_gset_add(n_set, BM_elem_index_get(v_other)); +sculpt_vertex_neighbour_add(iter, BM_elem_index_get(v_other)); } } } - - iter->count = BLI_gset_len(n_set); - iter->neighbours = MEM_mallocN(BLI_gset_len(n_set) * sizeof(int), "neighbour array"); - - int c_index = 0; - GSetIterator *gsi = BLI_gsetIterator_new(n_set); - for (BLI_gsetIterator_init(gsi, n_set); !BLI_gsetIterator_done(gsi); - BLI_gsetIterator_step(gsi)) { -iter->neighbours[c_index] = BLI_gsetIterator_getKey(gsi); -c_index++; - } - BLI_gsetIterator_free(gsi); - BLI_gset_free(n_set, NULL); } void sculpt_vertex_neighbours_get_faces(SculptSession *ss, VertexHandle index, SculptVertexNeighbourIter *iter) { - GSet *n_set; int i; MeshElemMap *vert_map = >pmap[(int)index]; - n_set = BLI_gset_new(BLI_ghashutil_uinthash, BLI_ghashutil_intcmp, "neighbour set"); + iter->count = 0; + iter->neighbours = MEM_mallocN(SCULPT_VERTEX_NEIGHBOUR_MAX * sizeof(VertexHandle), + "neighbour array"); for (i = 0; i < ss->pmap[(int)index].count; i++) { const MPoly *p = >mpoly[vert_map->indices[i]]; unsigned f_adj_v[2]; @@ -265,25 +276,12 @@ void sculpt_vertex_neighbours_get_faces(SculptSession *ss, for (j = 0; j < ARRAY_SIZE(f_adj_v); j += 1) { if (vert_map->count != 2 || ss->pmap[f_adj_v[j]].count <= 2) { if (f_adj_v[j] != (int)index) { -BLI_gset_add(n_set, f_adj_v[j]); +sculpt_vertex_neighbour_add(iter, f_adj_v[j]); } } } } } - - iter->count = BLI_gset_len(n_set); - iter->neighbours = MEM_mallocN(BLI_gset_len(n_set) * sizeof(int), "neighbour array"); - - int c_index = 0; - GSetIterator *gsi = BLI_gsetIterator_new(n_set); - for (BLI_gsetIterator_init(gsi, n_set); !BLI_gsetIterator_done(gsi); - BLI_gsetIterator_step(gsi)) { -iter->neighbours[c_index] = BLI_gsetIterator_getKey(gsi); -c_index++; - } - BLI_gsetIterator_free(gsi); - BLI_gset_free(n_set, NULL); } void sculpt_vertex_neighbours_get(SculptSession *ss, ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org
[Bf-blender-cvs] [7f29fc7415a] master: Fix T65691: GPencil Drawing long strokes turn invisible
Commit: 7f29fc7415a49d5688efbe10fa0a81b174d49435 Author: Antonioya Date: Sat Jul 20 23:01:19 2019 +0200 Branches: master https://developer.blender.org/rB7f29fc7415a49d5688efbe10fa0a81b174d49435 Fix T65691: GPencil Drawing long strokes turn invisible There was a fixed limit to the number of points available in a buffer stroke. Now, the array is expanded as needed using a predefined number of points for each expansion, instead to add one by one. This is done to reduce the number of times the memory allocation is required. As part of the fix, some variables have been renamed to reflect better their use. === M source/blender/blenloader/intern/readfile.c M source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c M source/blender/draw/engines/gpencil/gpencil_draw_utils.c M source/blender/draw/engines/gpencil/gpencil_engine.c M source/blender/editors/gpencil/annotate_draw.c M source/blender/editors/gpencil/annotate_paint.c M source/blender/editors/gpencil/gpencil_edit.c M source/blender/editors/gpencil/gpencil_fill.c M source/blender/editors/gpencil/gpencil_intern.h M source/blender/editors/gpencil/gpencil_paint.c M source/blender/editors/gpencil/gpencil_primitive.c M source/blender/editors/gpencil/gpencil_utils.c M source/blender/editors/include/ED_gpencil.h M source/blender/makesdna/DNA_gpencil_types.h === diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 88d878ac019..a4979cc470c 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -7039,6 +7039,7 @@ static void direct_link_gpencil(FileData *fd, bGPdata *gpd) /* init stroke buffer */ gpd->runtime.sbuffer = NULL; + gpd->runtime.sbuffer_used = 0; gpd->runtime.sbuffer_size = 0; gpd->runtime.tot_cp_points = 0; diff --git a/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c b/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c index 18950f00823..d5f8d062593 100644 --- a/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c +++ b/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c @@ -375,7 +375,7 @@ GPUBatch *gpencil_get_buffer_stroke_geom(bGPdata *gpd, short thickness) Object *ob = draw_ctx->obact; tGPspoint *points = gpd->runtime.sbuffer; - int totpoints = gpd->runtime.sbuffer_size; + int totpoints = gpd->runtime.sbuffer_used; /* if cyclic needs more vertex */ int cyclic_add = (gpd->runtime.sbuffer_sflag & GP_STROKE_CYCLIC) ? 1 : 0; int totvertex = totpoints + cyclic_add + 2; @@ -477,7 +477,7 @@ GPUBatch *gpencil_get_buffer_point_geom(bGPdata *gpd, short thickness) Object *ob = draw_ctx->obact; tGPspoint *points = gpd->runtime.sbuffer; - int totpoints = gpd->runtime.sbuffer_size; + int totpoints = gpd->runtime.sbuffer_used; static GPUVertFormat format = {0}; static uint pos_id, color_id, thickness_id, uvdata_id, prev_pos_id; @@ -621,7 +621,7 @@ GPUBatch *gpencil_get_buffer_fill_geom(bGPdata *gpd) } const tGPspoint *points = gpd->runtime.sbuffer; - int totpoints = gpd->runtime.sbuffer_size; + int totpoints = gpd->runtime.sbuffer_used; if (totpoints < 3) { return NULL; } diff --git a/source/blender/draw/engines/gpencil/gpencil_draw_utils.c b/source/blender/draw/engines/gpencil/gpencil_draw_utils.c index 181d2efbabb..9b755217946 100644 --- a/source/blender/draw/engines/gpencil/gpencil_draw_utils.c +++ b/source/blender/draw/engines/gpencil/gpencil_draw_utils.c @@ -1493,7 +1493,7 @@ void gpencil_populate_buffer_strokes(GPENCIL_e_data *e_data, /* Check if may need to draw the active stroke cache, only if this layer is the active layer * that is being edited. (Stroke buffer is currently stored in gp-data) */ - if (gpd->runtime.sbuffer_size > 0) { + if (gpd->runtime.sbuffer_used > 0) { if ((gpd->runtime.sbuffer_sflag & GP_STROKE_ERASER) == 0) { /* It should also be noted that sbuffer contains temporary point types * i.e. tGPspoints NOT bGPDspoints @@ -1506,7 +1506,7 @@ void gpencil_populate_buffer_strokes(GPENCIL_e_data *e_data, stl->storage->alignment_mode = (gp_style) ? gp_style->alignment_mode : GP_STYLE_FOLLOW_PATH; /* if only one point, don't need to draw buffer because the user has no time to see it */ - if (gpd->runtime.sbuffer_size > 1) { + if (gpd->runtime.sbuffer_used > 1) { if ((gp_style) && (gp_style->mode == GP_STYLE_MODE_LINE)) { stl->g_data->shgrps_drawing_stroke = gpencil_shgroup_stroke_create( vedata, @@ -1562,7 +1562,7 @@ void gpencil_populate_buffer_strokes(GPENCIL_e_data *e_data, DRW_shgroup_call( stl->g_data->shgrps_drawing_stroke, stl->g_data->batch_buffer_stroke, NULL);
[Bf-blender-cvs] [e9c149d911c] master: Alembic import: load face-varying normals
Commit: e9c149d911c2ec52e02e266767797f09ba088f91 Author: Sybren A. Stüvel Date: Fri Jul 5 12:36:30 2019 +0200 Branches: master https://developer.blender.org/rBe9c149d911c2ec52e02e266767797f09ba088f91 Alembic import: load face-varying normals Loop normals are called 'Face-varying normals' in Alembic. Before this commit, the existence of such normals was used to enable smooth shading. This is incorrect, as the normals could encode flat faces just as well. This commit adds the loading of these normals as custom loop normals. It then also enables Auto-Smoothing on the mesh (which is a bit of a misnomer and indicates to Blender that the custom normals should be used). Fixes the glitching described in T65959. Differential Revision: https://developer.blender.org/D5191 === M source/blender/alembic/intern/abc_mesh.cc === diff --git a/source/blender/alembic/intern/abc_mesh.cc b/source/blender/alembic/intern/abc_mesh.cc index e4431bde2f6..1b5ae0b7adc 100644 --- a/source/blender/alembic/intern/abc_mesh.cc +++ b/source/blender/alembic/intern/abc_mesh.cc @@ -46,6 +46,8 @@ extern "C" { #include "BKE_modifier.h" #include "BKE_object.h" +#include "MEM_guardedalloc.h" + #include "WM_api.h" #include "WM_types.h" @@ -758,7 +760,8 @@ struct AbcMeshData { P3fArraySamplePtr ceil_positions; N3fArraySamplePtr vertex_normals; - N3fArraySamplePtr face_normals; + N3fArraySamplePtr loop_normals; + bool poly_flag_smooth; V2fArraySamplePtr uvs; UInt32ArraySamplePtr uvs_indices; @@ -832,7 +835,6 @@ static void read_mpolys(CDStreamConfig , const AbcMeshData _data) const size_t uvs_size = uvs == nullptr ? 0 : uvs->size(); const UInt32ArraySamplePtr _indices = mesh_data.uvs_indices; - const N3fArraySamplePtr = mesh_data.face_normals; const bool do_uvs = (mloopuvs && uvs && uvs_indices) && (uvs_indices->size() == face_indices->size()); @@ -847,9 +849,12 @@ static void read_mpolys(CDStreamConfig , const AbcMeshData _data) poly.loopstart = loop_index; poly.totloop = face_size; -if (normals != NULL) { +if (mesh_data.poly_flag_smooth) { poly.flag |= ME_SMOOTH; } +else { + poly.flag &= ~ME_SMOOTH; +} /* NOTE: Alembic data is stored in the reverse order. */ rev_loop_index = loop_index + (face_size - 1); @@ -873,6 +878,40 @@ static void read_mpolys(CDStreamConfig , const AbcMeshData _data) } } } + + BKE_mesh_calc_edges(config.mesh, false, false); +} + +static void process_normals(CDStreamConfig , const AbcMeshData _data) +{ + Mesh *mesh = config.mesh; + + if (!mesh_data.loop_normals) { +BKE_mesh_calc_normals(config.mesh); +config.mesh->flag &= ~ME_AUTOSMOOTH; +return; + } + + config.mesh->flag |= ME_AUTOSMOOTH; + + const Alembic::AbcGeom::N3fArraySample _normals = *mesh_data.loop_normals; + long int loop_count = loop_normals.size(); + + float(*lnors)[3] = static_cast( + MEM_malloc_arrayN(loop_count, sizeof(float[3]), "ABC::FaceNormals")); + + MPoly *mpoly = mesh->mpoly; + int abc_index = 0; + for (int i = 0, e = mesh->totpoly; i < e; ++i, ++mpoly) { +/* As usual, ABC orders the loops in reverse. */ +for (int j = mpoly->totloop - 1; j >= 0; --j, ++abc_index) { + int blender_index = mpoly->loopstart + j; + copy_zup_from_yup(lnors[blender_index], loop_normals[abc_index].getValue()); +} + } + BKE_mesh_set_custom_normals(config.mesh, lnors); + + MEM_freeN(lnors); } ABC_INLINE void read_uvs_params(CDStreamConfig , @@ -905,10 +944,6 @@ ABC_INLINE void read_uvs_params(CDStreamConfig , } } -/* TODO(kevin): normals from Alembic files are not read in anymore, this is due - * to the fact that there are many issues that are not so easy to solve, mainly - * regarding the way normals are handled in Blender (MPoly.flag vs loop normals). - */ ABC_INLINE void read_normals_params(AbcMeshData _data, const IN3fGeomParam , const ISampleSelector ) @@ -922,10 +957,12 @@ ABC_INLINE void read_normals_params(AbcMeshData _data, Alembic::AbcGeom::GeometryScope scope = normals.getScope(); switch (scope) { case Alembic::AbcGeom::kFacevaryingScope: - abc_data.face_normals = normsamp.getVals(); + abc_data.loop_normals = normsamp.getVals(); break; case Alembic::AbcGeom::kVertexScope: case Alembic::AbcGeom::kVaryingScope: + /* Vertex normals from ABC aren't handled for now. */ + abc_data.poly_flag_smooth = true; abc_data.vertex_normals = N3fArraySamplePtr(); break; case Alembic::AbcGeom::kConstantScope: @@ -935,31 +972,6 @@ ABC_INLINE void read_normals_params(AbcMeshData _data, } } -static bool check_smooth_poly_flag(Mesh *mesh) -{ - MPoly *mpolys = mesh->mpoly; - - for (int i = 0, e =
[Bf-blender-cvs] [dde978d1491] master: Cleanup: Alembic: renamed 'smooth_normals' to 'export_loop_normals'
Commit: dde978d1491b1ff5a5c01eb29eb6cf46446738f8 Author: Sybren A. Stüvel Date: Wed Jul 10 10:35:39 2019 +0200 Branches: master https://developer.blender.org/rBdde978d1491b1ff5a5c01eb29eb6cf46446738f8 Cleanup: Alembic: renamed 'smooth_normals' to 'export_loop_normals' The name now indicates what happens when the variable is set to true. No functional changes. === M source/blender/alembic/intern/abc_mesh.cc === diff --git a/source/blender/alembic/intern/abc_mesh.cc b/source/blender/alembic/intern/abc_mesh.cc index 13cc670b7dc..e4431bde2f6 100644 --- a/source/blender/alembic/intern/abc_mesh.cc +++ b/source/blender/alembic/intern/abc_mesh.cc @@ -122,7 +122,7 @@ static void get_vertices(struct Mesh *mesh, std::vector ) static void get_topology(struct Mesh *mesh, std::vector _verts, std::vector _counts, - bool _smooth_normal) + bool _export_loop_normals) { const int num_poly = mesh->totpoly; const int num_loops = mesh->totloop; @@ -139,7 +139,7 @@ static void get_topology(struct Mesh *mesh, MPoly = mpoly[i]; loop_counts.push_back(poly.totloop); -r_smooth_normal |= ((poly.flag & ME_SMOOTH) != 0); +r_export_loop_normals |= (poly.flag & ME_SMOOTH) != 0; MLoop *loop = mloop + poly.loopstart + (poly.totloop - 1); @@ -411,10 +411,10 @@ void AbcGenericMeshWriter::writeMesh(struct Mesh *mesh) std::vector poly_verts, loop_counts; std::vector velocities; - bool smooth_normal = false; + bool export_loop_normals = false; get_vertices(mesh, points); - get_topology(mesh, poly_verts, loop_counts, smooth_normal); + get_topology(mesh, poly_verts, loop_counts, export_loop_normals); if (m_first_frame && m_settings.export_face_sets) { writeFaceSets(mesh, m_mesh_schema); @@ -442,7 +442,7 @@ void AbcGenericMeshWriter::writeMesh(struct Mesh *mesh) } if (m_settings.export_normals) { -if (smooth_normal) { +if (export_loop_normals) { get_loop_normals(mesh, normals); } else { @@ -451,7 +451,7 @@ void AbcGenericMeshWriter::writeMesh(struct Mesh *mesh) ON3fGeomParam::Sample normals_sample; if (!normals.empty()) { - normals_sample.setScope((smooth_normal) ? kFacevaryingScope : kVertexScope); + normals_sample.setScope(export_loop_normals ? kFacevaryingScope : kVertexScope); normals_sample.setVals(V3fArraySample(normals)); } @@ -477,10 +477,10 @@ void AbcGenericMeshWriter::writeSubD(struct Mesh *mesh) std::vector poly_verts, loop_counts; std::vector crease_indices, crease_lengths; - bool smooth_normal = false; + bool export_loop_normals = false; get_vertices(mesh, points); - get_topology(mesh, poly_verts, loop_counts, smooth_normal); + get_topology(mesh, poly_verts, loop_counts, export_loop_normals); get_creases(mesh, crease_indices, crease_lengths, crease_sharpness); if (m_first_frame && m_settings.export_face_sets) { ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [f69e57a53fa] master: Alembic export: fix exporting of loop normals
Commit: f69e57a53fab92d549a90a0198b86ff766ba0da2 Author: Sybren A. Stüvel Date: Tue Jul 30 17:05:37 2019 +0200 Branches: master https://developer.blender.org/rBf69e57a53fab92d549a90a0198b86ff766ba0da2 Alembic export: fix exporting of loop normals When the mesh is using custom normals, those should always be exported, regardless of the `ME_SMOOTH` flag on the invidivual polys. Also replaced the loop normal writing with the same logic as we use for reading (less pointer arithmetic, more normal counting). === M source/blender/alembic/intern/abc_mesh.cc === diff --git a/source/blender/alembic/intern/abc_mesh.cc b/source/blender/alembic/intern/abc_mesh.cc index 1b5ae0b7adc..9e6f2dd6b52 100644 --- a/source/blender/alembic/intern/abc_mesh.cc +++ b/source/blender/alembic/intern/abc_mesh.cc @@ -205,17 +205,14 @@ static void get_loop_normals(struct Mesh *mesh, std::vector normals.clear(); normals.resize(mesh->totloop); - unsigned loop_index = 0; - /* NOTE: data needs to be written in the reverse order. */ + int abc_index = 0; if (lnors) { for (int i = 0, e = mesh->totpoly; i < e; ++i, ++mp) { - ml = mloop + mp->loopstart + (mp->totloop - 1); - - for (int j = 0; j < mp->totloop; --ml, ++j, ++loop_index) { -const int index = ml->v; -copy_yup_from_zup(normals[loop_index].getValue(), lnors[index]); + for (int j = mp->totloop - 1; j >= 0; --j, ++abc_index) { +int blender_index = mp->loopstart + j; +copy_yup_from_zup(normals[abc_index].getValue(), lnors[blender_index]); } } } @@ -229,15 +226,15 @@ static void get_loop_normals(struct Mesh *mesh, std::vector if ((mp->flag & ME_SMOOTH) == 0) { BKE_mesh_calc_poly_normal(mp, ml - (mp->totloop - 1), verts, no); -for (int j = 0; j < mp->totloop; --ml, ++j, ++loop_index) { - copy_yup_from_zup(normals[loop_index].getValue(), no); +for (int j = 0; j < mp->totloop; --ml, ++j, ++abc_index) { + copy_yup_from_zup(normals[abc_index].getValue(), no); } } else { /* Smooth shaded, use individual vert normals. */ -for (int j = 0; j < mp->totloop; --ml, ++j, ++loop_index) { +for (int j = 0; j < mp->totloop; --ml, ++j, ++abc_index) { normal_short_to_float_v3(no, verts[ml->v].no); - copy_yup_from_zup(normals[loop_index].getValue(), no); + copy_yup_from_zup(normals[abc_index].getValue(), no); } } } @@ -413,7 +410,7 @@ void AbcGenericMeshWriter::writeMesh(struct Mesh *mesh) std::vector poly_verts, loop_counts; std::vector velocities; - bool export_loop_normals = false; + bool export_loop_normals = (mesh->flag & ME_AUTOSMOOTH) != 0; get_vertices(mesh, points); get_topology(mesh, poly_verts, loop_counts, export_loop_normals); ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [e74847e6bb5] master: Alembic: changed 'void *user_data' to 'Mesh *mesh'
Commit: e74847e6bb5cea24def9e544a3fb2bc90150aeaf Author: Sybren A. Stüvel Date: Thu Jul 4 12:04:39 2019 +0200 Branches: master https://developer.blender.org/rBe74847e6bb5cea24def9e544a3fb2bc90150aeaf Alembic: changed 'void *user_data' to 'Mesh *mesh' The only thing that is stored in this pointer is a `Mesh*`, and casting it from/to `void*` is unnecessary and confusing. Maybe the entire CDStreamConfig class could/should be removed at some point. No functional changes. === M source/blender/alembic/intern/abc_customdata.cc M source/blender/alembic/intern/abc_customdata.h M source/blender/alembic/intern/abc_mesh.cc === diff --git a/source/blender/alembic/intern/abc_customdata.cc b/source/blender/alembic/intern/abc_customdata.cc index 20ca659d32f..63887d36381 100644 --- a/source/blender/alembic/intern/abc_customdata.cc +++ b/source/blender/alembic/intern/abc_customdata.cc @@ -353,7 +353,7 @@ static void read_custom_data_mcols(const std::string _full_name, /* Read the vertex colors */ void *cd_data = config.add_customdata_cb( - config.user_data, prop_header.getName().c_str(), CD_MLOOPCOL); + config.mesh, prop_header.getName().c_str(), CD_MLOOPCOL); MCol *cfaces = static_cast(cd_data); MPoly *mpolys = config.mpoly; MLoop *mloops = config.mloop; @@ -437,8 +437,7 @@ static void read_custom_data_uvs(const ICompoundProperty , return; } - void *cd_data = config.add_customdata_cb( - config.user_data, prop_header.getName().c_str(), CD_MLOOPUV); + void *cd_data = config.add_customdata_cb(config.mesh, prop_header.getName().c_str(), CD_MLOOPUV); read_uvs(config, cd_data, sample.getVals(), sample.getIndices()); } diff --git a/source/blender/alembic/intern/abc_customdata.h b/source/blender/alembic/intern/abc_customdata.h index c36029d5116..0ffafa8848e 100644 --- a/source/blender/alembic/intern/abc_customdata.h +++ b/source/blender/alembic/intern/abc_customdata.h @@ -28,6 +28,7 @@ #include struct CustomData; +struct Mesh; struct MLoop; struct MLoopUV; struct MPoly; @@ -60,8 +61,8 @@ struct CDStreamConfig { /* TODO(kevin): might need a better way to handle adding and/or updating * custom datas such that it updates the custom data holder and its pointers * properly. */ - void *user_data; - void *(*add_customdata_cb)(void *user_data, const char *name, int data_type); + Mesh *mesh; + void *(*add_customdata_cb)(Mesh *mesh, const char *name, int data_type); float weight; float time; @@ -75,7 +76,7 @@ struct CDStreamConfig { totpoly(0), totvert(0), pack_uvs(false), -user_data(NULL), +mesh(NULL), add_customdata_cb(NULL), weight(0.0f), time(0.0f), diff --git a/source/blender/alembic/intern/abc_mesh.cc b/source/blender/alembic/intern/abc_mesh.cc index 1903b5149c5..13cc670b7dc 100644 --- a/source/blender/alembic/intern/abc_mesh.cc +++ b/source/blender/alembic/intern/abc_mesh.cc @@ -900,7 +900,7 @@ ABC_INLINE void read_uvs_params(CDStreamConfig , name = uv.getName(); } -void *cd_ptr = config.add_customdata_cb(config.user_data, name.c_str(), CD_MLOOPUV); +void *cd_ptr = config.add_customdata_cb(config.mesh, name.c_str(), CD_MLOOPUV); config.mloopuv = static_cast(cd_ptr); } } @@ -960,9 +960,8 @@ static void set_smooth_poly_flag(Mesh *mesh) } } -static void *add_customdata_cb(void *user_data, const char *name, int data_type) +static void *add_customdata_cb(Mesh *mesh, const char *name, int data_type) { - Mesh *mesh = static_cast(user_data); CustomDataType cd_data_type = static_cast(data_type); void *cd_ptr; CustomData *loopdata; @@ -1047,7 +1046,7 @@ CDStreamConfig get_config(Mesh *mesh) BLI_assert(mesh->mvert || mesh->totvert == 0); - config.user_data = mesh; + config.mesh = mesh; config.mvert = mesh->mvert; config.mloop = mesh->mloop; config.mpoly = mesh->mpoly; ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [3568d56bccc] master: Alembic: transformed chain-of-ifs into switch statement
Commit: 3568d56bccc556e04c61d8f6ac3f005b0ff838b7 Author: Sybren A. Stüvel Date: Thu Jul 4 11:53:17 2019 +0200 Branches: master https://developer.blender.org/rB3568d56bccc556e04c61d8f6ac3f005b0ff838b7 Alembic: transformed chain-of-ifs into switch statement By having a switch statement that lists all the values of the enum, it is clear which cases we're not handling, and it also allows for warnings in the future when the enum expands. No functional changes. === M source/blender/alembic/intern/abc_mesh.cc === diff --git a/source/blender/alembic/intern/abc_mesh.cc b/source/blender/alembic/intern/abc_mesh.cc index 39d9f9d768e..1903b5149c5 100644 --- a/source/blender/alembic/intern/abc_mesh.cc +++ b/source/blender/alembic/intern/abc_mesh.cc @@ -919,11 +919,19 @@ ABC_INLINE void read_normals_params(AbcMeshData _data, IN3fGeomParam::Sample normsamp = normals.getExpandedValue(selector); - if (normals.getScope() == kFacevaryingScope) { -abc_data.face_normals = normsamp.getVals(); - } - else if ((normals.getScope() == kVertexScope) || (normals.getScope() == kVaryingScope)) { -abc_data.vertex_normals = N3fArraySamplePtr(); + Alembic::AbcGeom::GeometryScope scope = normals.getScope(); + switch (scope) { +case Alembic::AbcGeom::kFacevaryingScope: + abc_data.face_normals = normsamp.getVals(); + break; +case Alembic::AbcGeom::kVertexScope: +case Alembic::AbcGeom::kVaryingScope: + abc_data.vertex_normals = N3fArraySamplePtr(); + break; +case Alembic::AbcGeom::kConstantScope: +case Alembic::AbcGeom::kUniformScope: +case Alembic::AbcGeom::kUnknownScope: + break; } } ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [d65a4b5990c] master: Alembic: use `r_` prefix for return variables
Commit: d65a4b5990c28365e89ac0495a31cac4e042704f Author: Sybren A. Stüvel Date: Thu Jul 4 11:51:13 2019 +0200 Branches: master https://developer.blender.org/rBd65a4b5990c28365e89ac0495a31cac4e042704f Alembic: use `r_` prefix for return variables No functional changes. === M source/blender/alembic/intern/abc_mesh.cc === diff --git a/source/blender/alembic/intern/abc_mesh.cc b/source/blender/alembic/intern/abc_mesh.cc index b5d5057a8d1..39d9f9d768e 100644 --- a/source/blender/alembic/intern/abc_mesh.cc +++ b/source/blender/alembic/intern/abc_mesh.cc @@ -122,7 +122,7 @@ static void get_vertices(struct Mesh *mesh, std::vector ) static void get_topology(struct Mesh *mesh, std::vector _verts, std::vector _counts, - bool _normal) + bool _smooth_normal) { const int num_poly = mesh->totpoly; const int num_loops = mesh->totloop; @@ -139,7 +139,7 @@ static void get_topology(struct Mesh *mesh, MPoly = mpoly[i]; loop_counts.push_back(poly.totloop); -smooth_normal |= ((poly.flag & ME_SMOOTH) != 0); +r_smooth_normal |= ((poly.flag & ME_SMOOTH) != 0); MLoop *loop = mloop + poly.loopstart + (poly.totloop - 1); @@ -995,7 +995,7 @@ static void read_mesh_sample(const std::string _full_name, const IPolyMeshSchema , const ISampleSelector , CDStreamConfig , - bool _normals) + bool _do_normals) { const IPolyMeshSchema::Sample sample = schema.getValue(selector); @@ -1006,7 +1006,7 @@ static void read_mesh_sample(const std::string _full_name, read_normals_params(abc_mesh_data, schema.getNormalsParam(), selector); - do_normals = (abc_mesh_data.face_normals != NULL); + r_do_normals = (abc_mesh_data.face_normals != NULL); get_weight_and_index(config, schema.getTimeSampling(), schema.getNumSamples()); ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [7f552be7d1b] master: Alembic: removal of always-zero parameter
Commit: 7f552be7d1bd4076263521c76c2aa3cab9b383c1 Author: Sybren A. Stüvel Date: Thu Jul 4 11:50:08 2019 +0200 Branches: master https://developer.blender.org/rB7f552be7d1bd4076263521c76c2aa3cab9b383c1 Alembic: removal of always-zero parameter The `poly_start` parameter was always 0, so adding it to a poly index from Alembic is a no-op. No functional changes. === M source/blender/alembic/intern/abc_mesh.cc M source/blender/alembic/intern/abc_mesh.h === diff --git a/source/blender/alembic/intern/abc_mesh.cc b/source/blender/alembic/intern/abc_mesh.cc index b0129a358ec..b5d5057a8d1 100644 --- a/source/blender/alembic/intern/abc_mesh.cc +++ b/source/blender/alembic/intern/abc_mesh.cc @@ -1085,7 +1085,7 @@ void AbcMeshReader::readObjectData(Main *bmain, const Alembic::Abc::ISampleSelec BKE_mesh_validate(mesh, false, false); } - readFaceSetsSample(bmain, mesh, 0, sample_sel); + readFaceSetsSample(bmain, mesh, sample_sel); if (has_animations(m_schema, m_settings)) { addCacheModifier(); @@ -1189,7 +1189,7 @@ Mesh *AbcMeshReader::read_mesh(Mesh *existing_mesh, size_t num_polys = new_mesh->totpoly; if (num_polys > 0) { std::map mat_map; - assign_facesets_to_mpoly(sample_sel, 0, new_mesh->mpoly, num_polys, mat_map); + assign_facesets_to_mpoly(sample_sel, new_mesh->mpoly, num_polys, mat_map); } return new_mesh; @@ -1203,7 +1203,6 @@ Mesh *AbcMeshReader::read_mesh(Mesh *existing_mesh, } void AbcMeshReader::assign_facesets_to_mpoly(const ISampleSelector _sel, - size_t poly_start, MPoly *mpoly, int totpoly, std::map _mat_map) @@ -1239,7 +1238,7 @@ void AbcMeshReader::assign_facesets_to_mpoly(const ISampleSelector _sel, const size_t num_group_faces = group_faces->size(); for (size_t l = 0; l < num_group_faces; l++) { - size_t pos = (*group_faces)[l] + poly_start; + size_t pos = (*group_faces)[l]; if (pos >= totpoly) { std::cerr << "Faceset overflow on " << faceset.getName() << '\n'; @@ -1252,13 +1251,10 @@ void AbcMeshReader::assign_facesets_to_mpoly(const ISampleSelector _sel, } } -void AbcMeshReader::readFaceSetsSample(Main *bmain, - Mesh *mesh, - size_t poly_start, - const ISampleSelector _sel) +void AbcMeshReader::readFaceSetsSample(Main *bmain, Mesh *mesh, const ISampleSelector _sel) { std::map mat_map; - assign_facesets_to_mpoly(sample_sel, poly_start, mesh->mpoly, mesh->totpoly, mat_map); + assign_facesets_to_mpoly(sample_sel, mesh->mpoly, mesh->totpoly, mat_map); utils::assign_materials(bmain, m_object, mat_map); } diff --git a/source/blender/alembic/intern/abc_mesh.h b/source/blender/alembic/intern/abc_mesh.h index 6cbaeea6536..859ab121eb6 100644 --- a/source/blender/alembic/intern/abc_mesh.h +++ b/source/blender/alembic/intern/abc_mesh.h @@ -114,11 +114,9 @@ class AbcMeshReader : public AbcObjectReader { private: void readFaceSetsSample(Main *bmain, Mesh *mesh, - size_t poly_start, const Alembic::AbcGeom::ISampleSelector _sel); void assign_facesets_to_mpoly(const Alembic::Abc::ISampleSelector _sel, -size_t poly_start, MPoly *mpoly, int totpoly, std::map _mat_map); ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [0dece50667f] master: Fix T65717: Alembic (camera - also mesh) import scale issue
Commit: 0dece50667f1c8bc4d2a1fb73f3d4eaa287922df Author: Sybren A. Stüvel Date: Thu Jul 18 15:39:50 2019 +0200 Branches: master https://developer.blender.org/rB0dece50667f1c8bc4d2a1fb73f3d4eaa287922df Fix T65717: Alembic (camera - also mesh) import scale issue The w-component of the translation column of the scaled matrix wasn't set to 1.0, which, apart from being incorrect, caused drawing problems. Reviewed By: brecht Differential Revision: https://developer.blender.org/D5290 === M source/blender/alembic/intern/abc_object.cc === diff --git a/source/blender/alembic/intern/abc_object.cc b/source/blender/alembic/intern/abc_object.cc index 54450ce1cb2..7b0d94a2305 100644 --- a/source/blender/alembic/intern/abc_object.cc +++ b/source/blender/alembic/intern/abc_object.cc @@ -343,8 +343,7 @@ void AbcObjectReader::read_matrix(float r_mat[4][4], /* Only apply scaling to root objects, parenting will propagate it. */ float scale_mat[4][4]; scale_m4_fl(scale_mat, scale); -scale_mat[3][3] = scale; /* scale translations too */ -mul_m4_m4m4(r_mat, r_mat, scale_mat); +mul_m4_m4m4(r_mat, scale_mat, r_mat); } is_constant = schema.isConstant(); ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [3e0fd90605b] functions: use another strategy to create functions for unlinked inputs
Commit: 3e0fd90605b4fca50bf789ef0b2364054742bcd7 Author: Jacques Lucke Date: Tue Jul 30 16:13:44 2019 +0200 Branches: functions https://developer.blender.org/rB3e0fd90605b4fca50bf789ef0b2364054742bcd7 use another strategy to create functions for unlinked inputs === M source/blender/functions/core/data_flow_graph_builder.hpp M source/blender/functions/frontends/data_flow_nodes/builder.cpp M source/blender/functions/frontends/data_flow_nodes/builder.hpp M source/blender/functions/frontends/data_flow_nodes/graph_generation.cpp M source/blender/functions/frontends/data_flow_nodes/graph_generation.hpp M source/blender/functions/frontends/data_flow_nodes/inserters.cpp M source/blender/functions/frontends/data_flow_nodes/inserters.hpp === diff --git a/source/blender/functions/core/data_flow_graph_builder.hpp b/source/blender/functions/core/data_flow_graph_builder.hpp index 31a77fe0878..2c0eda027aa 100644 --- a/source/blender/functions/core/data_flow_graph_builder.hpp +++ b/source/blender/functions/core/data_flow_graph_builder.hpp @@ -24,6 +24,8 @@ class DataFlowGraph; class DFGB_Socket { public: + DFGB_Socket() = default; + DFGB_Socket(DFGB_Node *node, bool is_output, uint index) : m_node(node), m_is_output(is_output), m_index(index) { diff --git a/source/blender/functions/frontends/data_flow_nodes/builder.cpp b/source/blender/functions/frontends/data_flow_nodes/builder.cpp index f0b8ec2229d..97d3e58cdf7 100644 --- a/source/blender/functions/frontends/data_flow_nodes/builder.cpp +++ b/source/blender/functions/frontends/data_flow_nodes/builder.cpp @@ -100,6 +100,14 @@ void BTreeGraphBuilder::insert_link(DFGB_Socket a, DFGB_Socket b) m_graph.insert_link(a, b); } +void BTreeGraphBuilder::insert_links(ArrayRef a, ArrayRef b) +{ + BLI_assert(a.size() == b.size()); + for (uint i = 0; i < a.size(); i++) { +this->insert_link(a[i], b[i]); + } +} + void BTreeGraphBuilder::map_socket(DFGB_Socket socket, VirtualSocket *vsocket) { BLI_assert(this->is_data_socket(vsocket) ? socket.type() == this->query_socket_type(vsocket) : diff --git a/source/blender/functions/frontends/data_flow_nodes/builder.hpp b/source/blender/functions/frontends/data_flow_nodes/builder.hpp index a6c3f8dbb8e..8b0ddd750bd 100644 --- a/source/blender/functions/frontends/data_flow_nodes/builder.hpp +++ b/source/blender/functions/frontends/data_flow_nodes/builder.hpp @@ -34,6 +34,7 @@ class BTreeGraphBuilder { /* Insert Link */ void insert_link(DFGB_Socket a, DFGB_Socket b); + void insert_links(ArrayRef a, ArrayRef b); /* Socket Mapping */ void map_socket(DFGB_Socket socket, VirtualSocket *vsocket); diff --git a/source/blender/functions/frontends/data_flow_nodes/graph_generation.cpp b/source/blender/functions/frontends/data_flow_nodes/graph_generation.cpp index 7307e16a1dd..d68b2e063dc 100644 --- a/source/blender/functions/frontends/data_flow_nodes/graph_generation.cpp +++ b/source/blender/functions/frontends/data_flow_nodes/graph_generation.cpp @@ -64,29 +64,26 @@ static bool insert_links(BTreeGraphBuilder , GraphInserters ) static void insert_unlinked_inputs(BTreeGraphBuilder , UnlinkedInputsHandler _inputs_handler) { - Vector unlinked_inputs; - Vector sockets_in_builder; for (VirtualNode *vnode : builder.vtree().nodes()) { +Vector vsockets; +Vector sockets; + for (VirtualSocket *vsocket : vnode->inputs()) { if (builder.is_data_socket(vsocket)) { DFGB_Socket socket = builder.lookup_socket(vsocket); if (!socket.is_linked()) { - unlinked_inputs.append(vsocket); - sockets_in_builder.append(socket); + vsockets.append(vsocket); + sockets.append(socket); } } } - } - - Vector inserted_data_origins; - inserted_data_origins.reserve(unlinked_inputs.size()); - unlinked_inputs_handler.insert(builder, unlinked_inputs, inserted_data_origins); - BLI_assert(unlinked_inputs.size() == inserted_data_origins.size()); - - for (uint i = 0; i < unlinked_inputs.size(); i++) { -builder.insert_link(inserted_data_origins[i], sockets_in_builder[i]); +if (vsockets.size() > 0) { + Vector new_origins(vsockets.size()); + unlinked_inputs_handler.insert(builder, vsockets, new_origins); + builder.insert_links(new_origins, sockets); + } } } @@ -114,9 +111,9 @@ class BasicUnlinkedInputsHandler : public UnlinkedInputsHandler { void insert(BTreeGraphBuilder , ArrayRef unlinked_inputs, - Vector _inserted_data_origins) override + ArrayRef r_new_origins) override { -r_inserted_data_origins = std::move(m_inserters.insert_sockets(builder, unlinked_inputs)); +m_inserters.insert_sockets(builder, unlinked_inputs, r_new_origins);
[Bf-blender-cvs] [406e9603271] master: Fix T67904: GPencil clone brush doesn't copy the right color and layer
Commit: 406e960327191b548f736382571ed55cff91bc2c Author: Antonio Vazquez Date: Tue Jul 30 16:51:18 2019 +0200 Branches: master https://developer.blender.org/rB406e960327191b548f736382571ed55cff91bc2c Fix T67904: GPencil clone brush doesn't copy the right color and layer When using the clone brush, the first time the brush worked, but the next time no. The reasons were two: 1) The strokes were copied to the active layer, but if there were more than one layer, the stroke must be copied to the original layer. 2) The materials were not assigned properly and the materials were set as the first slot in the list always. Now, the original layer name is used to try to find the same layer in destination. If the layer is missing, the active layer is used. For materials, the bug in the hash lookup is fixed and the material is assigned to the right slot. === M source/blender/editors/gpencil/gpencil_brush.c === diff --git a/source/blender/editors/gpencil/gpencil_brush.c b/source/blender/editors/gpencil/gpencil_brush.c index c183091dbb1..d97207baed8 100644 --- a/source/blender/editors/gpencil/gpencil_brush.c +++ b/source/blender/editors/gpencil/gpencil_brush.c @@ -1050,10 +1050,8 @@ static void gp_brush_clone_add(bContext *C, tGP_BrushEditData *gso) tGPSB_CloneBrushData *data = gso->customdata; Object *ob = CTX_data_active_object(C); - bGPDlayer *gpl = CTX_data_active_gpencil_layer(C); + bGPdata *gpd = (bGPdata *)ob->data; Scene *scene = CTX_data_scene(C); - - bGPDframe *gpf = BKE_gpencil_layer_getframe(gpl, CFRA, GP_GETFRAME_ADD_NEW); bGPDstroke *gps; float delta[3]; @@ -1072,6 +1070,18 @@ static void gp_brush_clone_add(bContext *C, tGP_BrushEditData *gso) bGPDspoint *pt; int i; + bGPDlayer *gpl = NULL; + /* Try to use original layer. */ + if (gps->runtime.tmp_layerinfo != NULL) { +gpl = BLI_findstring(>layers, gps->runtime.tmp_layerinfo, offsetof(bGPDlayer, info)); + } + + /* if not available, use active layer. */ + if (gpl == NULL) { +gpl = CTX_data_active_gpencil_layer(C); + } + bGPDframe *gpf = BKE_gpencil_layer_getframe(gpl, CFRA, GP_GETFRAME_ADD_NEW); + /* Make a new stroke */ new_stroke = MEM_dupallocN(gps); @@ -1086,10 +1096,10 @@ static void gp_brush_clone_add(bContext *C, tGP_BrushEditData *gso) BLI_addtail(>strokes, new_stroke); /* Fix color references */ - Material *ma = BLI_ghash_lookup(data->new_colors, _stroke->mat_nr); - gps->mat_nr = BKE_gpencil_object_material_get_index(ob, ma); - if (!ma || gps->mat_nr) { -gps->mat_nr = 0; + Material *ma = BLI_ghash_lookup(data->new_colors, POINTER_FROM_INT(new_stroke->mat_nr)); + new_stroke->mat_nr = BKE_gpencil_object_material_get_index(ob, ma); + if (!ma || new_stroke->mat_nr < 0) { +new_stroke->mat_nr = 0; } /* Adjust all the stroke's points, so that the strokes * get pasted relative to where the cursor is now ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [77cc69d66ff] master: Fix T67460: Vertex painting: Sampling color opens empty options window in viewport
Commit: 77cc69d66ff0a3cd0cd05c8818b7977418054046 Author: Sebastian Parborg Date: Tue Jul 30 16:00:41 2019 +0200 Branches: master https://developer.blender.org/rB77cc69d66ff0a3cd0cd05c8818b7977418054046 Fix T67460: Vertex painting: Sampling color opens empty options window in viewport The issue was that the redo panel area would call with region type HUD (not WINDOW). Now we make sure that the redo panel always polls the operator in the original area type context. Reviewed By: Brecht Differential Revision: http://developer.blender.org/D5361 === M source/blender/editors/interface/interface_region_hud.c === diff --git a/source/blender/editors/interface/interface_region_hud.c b/source/blender/editors/interface/interface_region_hud.c index 43afdc534ad..bba5103bc03 100644 --- a/source/blender/editors/interface/interface_region_hud.c +++ b/source/blender/editors/interface/interface_region_hud.c @@ -57,16 +57,32 @@ /* */ /** \name Utilities * \{ */ +struct HudRegionData { + short regionid; +}; -static bool last_redo_poll(const bContext *C) +static bool last_redo_poll(const bContext *C, short region_type) { wmOperator *op = WM_operator_last_redo(C); if (op == NULL) { return false; } + bool success = false; - if (WM_operator_repeat_check(C, op) && WM_operator_check_ui_empty(op->type) == false) { -success = WM_operator_poll((bContext *)C, op->type); + { +/* Make sure that we are using the same region type as the originial + * operator call. Otherwise we would be polling the operator with the + * wrong context. + */ +ScrArea *sa = CTX_wm_area(C); +ARegion *ar_op = (region_type != -1) ? BKE_area_find_region_type(sa, region_type) : NULL; +ARegion *ar_prev = CTX_wm_region(C); +CTX_wm_region_set((bContext *)C, ar_op); + +if (WM_operator_repeat_check(C, op) && WM_operator_check_ui_empty(op->type) == false) { + success = WM_operator_poll((bContext *)C, op->type); +} +CTX_wm_region_set((bContext *)C, ar_prev); } return success; } @@ -87,7 +103,15 @@ static void hud_region_hide(ARegion *ar) static bool hud_panel_operator_redo_poll(const bContext *C, PanelType *UNUSED(pt)) { - return last_redo_poll(C); + ScrArea *sa = CTX_wm_area(C); + ARegion *ar = BKE_area_find_region_type(sa, RGN_TYPE_HUD); + if (ar != NULL) { +struct HudRegionData *hrd = ar->regiondata; +if (hrd != NULL) { + return last_redo_poll(C, hrd->regionid); +} + } + return false; } static void hud_panel_operator_redo_draw_header(const bContext *C, Panel *pa) @@ -132,10 +156,6 @@ static void hud_panels_register(ARegionType *art, int space_type, int region_typ /** \name Callbacks for Floating Region * \{ */ -struct HudRegionData { - short regionid; -}; - static void hud_region_init(wmWindowManager *wm, ARegion *ar) { ED_region_panels_init(wm, ar); @@ -150,21 +170,8 @@ static void hud_region_free(ARegion *ar) static void hud_region_layout(const bContext *C, ARegion *ar) { - bool ok = false; - - { -struct HudRegionData *hrd = ar->regiondata; -if (hrd != NULL) { - ScrArea *sa = CTX_wm_area(C); - ARegion *ar_op = (hrd->regionid != -1) ? BKE_area_find_region_type(sa, hrd->regionid) : NULL; - ARegion *ar_prev = CTX_wm_region(C); - CTX_wm_region_set((bContext *)C, ar_op); - ok = last_redo_poll(C); - CTX_wm_region_set((bContext *)C, ar_prev); -} - } - - if (!ok) { + struct HudRegionData *hrd = ar->regiondata; + if (hrd == NULL || !last_redo_poll(C, hrd->regionid)) { ED_region_tag_redraw(ar); hud_region_hide(ar); return; @@ -301,7 +308,9 @@ void ED_area_type_hud_ensure(bContext *C, ScrArea *sa) bool init = false; bool was_hidden = ar == NULL || ar->visible == false; - if (!last_redo_poll(C)) { + ARegion *ar_op = CTX_wm_region(C); + BLI_assert((ar_op == NULL) || (ar_op->regiontype != RGN_TYPE_HUD)); + if (!last_redo_poll(C, ar_op ? ar_op->regiontype : -1)) { if (ar) { ED_region_tag_redraw(ar); hud_region_hide(ar); @@ -328,8 +337,6 @@ void ED_area_type_hud_ensure(bContext *C, ScrArea *sa) } { -ARegion *ar_op = CTX_wm_region(C); -BLI_assert((ar_op == NULL) || (ar_op->regiontype != RGN_TYPE_HUD)); struct HudRegionData *hrd = ar->regiondata; if (hrd == NULL) { hrd = MEM_callocN(sizeof(*hrd), __func__); ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [d87fb0356a3] master: Make 3d projpaint iteration lockless.
Commit: d87fb0356a320206e418c6e0885a759fc7a16b06 Author: Bastien Montagne Date: Tue Jul 30 15:39:11 2019 +0200 Branches: master https://developer.blender.org/rBd87fb0356a320206e418c6e0885a759fc7a16b06 Make 3d projpaint iteration lockless. While speedup is hard to detect (highly fluctuent), it seems to be around 5% on average on my 8 threads machine... It also remove usage of a 'global' thread lock, which is always good. Note that I also tried to use proper foreach threaded iterator construct (see D5372), but that proved to be relatively slower (presumably due to the very high dissymmetry between tasks, usually during a paint stroke only a few chunks will require most of the computing effort, overhead of threaded foreach management is then noticeable). This concludes (for now) the work on T51133 Bad performance with texture painting depending on multi-thread settings. === M source/blender/editors/sculpt_paint/CMakeLists.txt M source/blender/editors/sculpt_paint/paint_image_proj.c === diff --git a/source/blender/editors/sculpt_paint/CMakeLists.txt b/source/blender/editors/sculpt_paint/CMakeLists.txt index 23617e687ea..2a8ff9d4f78 100644 --- a/source/blender/editors/sculpt_paint/CMakeLists.txt +++ b/source/blender/editors/sculpt_paint/CMakeLists.txt @@ -29,6 +29,7 @@ set(INC ../../makesrna ../../render/extern/include ../../windowmanager + ../../../../intern/atomic ../../../../intern/glew-mx ../../../../intern/guardedalloc ) diff --git a/source/blender/editors/sculpt_paint/paint_image_proj.c b/source/blender/editors/sculpt_paint/paint_image_proj.c index 1220b071a17..f768a66a41c 100644 --- a/source/blender/editors/sculpt_paint/paint_image_proj.c +++ b/source/blender/editors/sculpt_paint/paint_image_proj.c @@ -44,6 +44,8 @@ #include "BLI_threads.h" #include "BLI_utildefines.h" +#include "atomic_ops.h" + #include "BLT_translation.h" #include "IMB_imbuf.h" @@ -366,7 +368,7 @@ typedef struct ProjPaintState { int bucketMin[2]; int bucketMax[2]; /** must lock threads while accessing these. */ - int context_bucket_x, context_bucket_y; + int context_bucket_index; struct CurveMapping *cavity_curve; BlurKernel *blurkernel; @@ -4712,11 +4714,8 @@ static bool project_bucket_iter_init(ProjPaintState *ps, const float mval_f[2]) /* mouse outside the model areas? */ if (ps->bucketMin[0] == ps->bucketMax[0] || ps->bucketMin[1] == ps->bucketMax[1]) { - return 0; + return false; } - -ps->context_bucket_x = ps->bucketMin[0]; -ps->context_bucket_y = ps->bucketMin[1]; } else { /* reproject: PROJ_SRC_* */ ps->bucketMin[0] = 0; @@ -4724,11 +4723,10 @@ static bool project_bucket_iter_init(ProjPaintState *ps, const float mval_f[2]) ps->bucketMax[0] = ps->buckets_x; ps->bucketMax[1] = ps->buckets_y; - -ps->context_bucket_x = 0; -ps->context_bucket_y = 0; } - return 1; + + ps->context_bucket_index = ps->bucketMin[0] + ps->bucketMin[1] * ps->buckets_x; + return true; } static bool project_bucket_iter_next(ProjPaintState *ps, @@ -4738,37 +4736,28 @@ static bool project_bucket_iter_next(ProjPaintState *ps, { const int diameter = 2 * ps->brush_size; - if (ps->thread_tot > 1) { -BLI_thread_lock(LOCK_CUSTOM1); - } - - // printf("%d %d\n", ps->context_bucket_x, ps->context_bucket_y); + const int max_bucket_idx = ps->bucketMax[0] + (ps->bucketMax[1] - 1) * ps->buckets_x; - for (; ps->context_bucket_y < ps->bucketMax[1]; ps->context_bucket_y++) { -for (; ps->context_bucket_x < ps->bucketMax[0]; ps->context_bucket_x++) { + for (int bidx = atomic_fetch_and_add_int32(>context_bucket_index, 1); bidx < max_bucket_idx; + bidx = atomic_fetch_and_add_int32(>context_bucket_index, 1)) { +const int bucket_y = bidx / ps->buckets_x; +const int bucket_x = bidx - (bucket_y * ps->buckets_x); +BLI_assert(bucket_y >= ps->bucketMin[1] && bucket_y < ps->bucketMax[1]); +if (bucket_x >= ps->bucketMin[0] && bucket_x < ps->bucketMax[0]) { /* use bucket_bounds for project_bucket_isect_circle and project_bucket_init*/ - project_bucket_bounds(ps, ps->context_bucket_x, ps->context_bucket_y, bucket_bounds); + project_bucket_bounds(ps, bucket_x, bucket_y, bucket_bounds); if ((ps->source != PROJ_SRC_VIEW) || project_bucket_isect_circle(mval, (float)(diameter * diameter), bucket_bounds)) { -*bucket_index = ps->context_bucket_x + (ps->context_bucket_y * ps->buckets_x); -ps->context_bucket_x++; - -if (ps->thread_tot > 1) { - BLI_thread_unlock(LOCK_CUSTOM1); -} +*bucket_index = bidx; -return 1; +return true; } } -ps->context_bucket_x = ps->bucketMin[0]; } - if (ps->thread_tot > 1) { -BLI_thread_unlock(LOCK_CUSTOM1); - } - return
[Bf-blender-cvs] [363dd97ae80] master: Fix T67370 Normal Tools(Alt +N), copy and paste not work
Commit: 363dd97ae80a4d097d92398b1769c1dca09c0ad9 Author: Sebastian Parborg Date: Tue Jul 30 15:37:27 2019 +0200 Branches: master https://developer.blender.org/rB363dd97ae80a4d097d92398b1769c1dca09c0ad9 Fix T67370 Normal Tools(Alt +N), copy and paste not work The copy operator requried at least a vert AND a face to be selected. It should only require that a vert OR a face is selected. === M source/blender/editors/mesh/editmesh_tools.c === diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c index 34c83263cac..3b5c8e9f101 100644 --- a/source/blender/editors/mesh/editmesh_tools.c +++ b/source/blender/editors/mesh/editmesh_tools.c @@ -8616,7 +8616,7 @@ static int edbm_normals_tools_exec(bContext *C, wmOperator *op) switch (mode) { case EDBM_CLNOR_TOOLS_COPY: -if (bm->totfacesel == 0 || bm->totvertsel == 0) { +if (bm->totfacesel == 0 && bm->totvertsel == 0) { BM_loop_normal_editdata_array_free(lnors_ed_arr); continue; } ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [b961b3f0c91] temp-vr-draw-thread: Initial, mostly broken VR viewport drawing on own thread
Commit: b961b3f0c91ac091f0d74b24f75f48f62b039f11 Author: Julian Eisel Date: Tue Jul 30 13:28:20 2019 +0200 Branches: temp-vr-draw-thread https://developer.blender.org/rBb961b3f0c91ac091f0d74b24f75f48f62b039f11 Initial, mostly broken VR viewport drawing on own thread Spawns a separate thread to do any VR session drawing on. There are four reasons for this: * VR session doesn't need the usual main loop procedure for drawing. With the drawing on a separate thread, the session doesn't have the overhead of the other parts of the main loop. * OpenXR performs thread blocking operations to synchronize rendering with the device refresh rate. This would conflict with the rest of Blender, causing lags on event handling, drawing, etc. * With an own thread, we can keep a single OpenGL context alive, avoiding expensive context switches. This should improve performance significantly. * With a bit more work, viewports can draw entirely in parallel (at least the CPU side of it), pushing performance even further. Drawing the viewport on a separate thread shouldn't be much of an issue. The draw-manager is already thread safe (mutex guarded). Not much seems needed to get it entirely concurrent, allowing viewport drawing from separate threads without any synchronization (i.e. only one at a time). I had to create an own depsgraph for the VR draw thread so the viewport gets its own buffers for its own OpenGL context. Right now this is utterly broken, but at least an empty viewport is drawn for the VR session in a separate thread. Issues are: * VR viewport doesn't draw any objects, just background + overlays (apparently the VR session depsgraph isn't built correctly). * OpenGL context of the main thread seems messed up when drawing the VR view. Result is drawing glitches and eventually Blender crashes. * Exiting the VR session causes failed assertions and memory leaks. === M intern/ghost/GHOST_C-api.h M intern/ghost/GHOST_IXrContext.h M intern/ghost/intern/GHOST_C-api.cpp M intern/ghost/intern/GHOST_XrContext.cpp M intern/ghost/intern/GHOST_XrContext.h M source/blender/draw/intern/draw_manager.c M source/blender/gpu/intern/gpu_viewport.c M source/blender/windowmanager/intern/wm_draw.c M source/blender/windowmanager/intern/wm_surface.c M source/blender/windowmanager/intern/wm_xr.c === diff --git a/intern/ghost/GHOST_C-api.h b/intern/ghost/GHOST_C-api.h index 84bad87e654..e9fb3373a4b 100644 --- a/intern/ghost/GHOST_C-api.h +++ b/intern/ghost/GHOST_C-api.h @@ -998,10 +998,11 @@ void GHOST_XrGraphicsContextBindFuncs(GHOST_XrContextHandle xr_context, void GHOST_XrDrawViewFunc(GHOST_XrContextHandle xr_context, GHOST_XrDrawViewFn draw_view_fn); /* sessions */ -int GHOST_XrSessionIsRunning(const GHOST_XrContextHandle xr_context); void GHOST_XrSessionStart(GHOST_XrContextHandle xr_context, const GHOST_XrSessionBeginInfo *begin_info); void GHOST_XrSessionEnd(GHOST_XrContextHandle xr_context); +int GHOST_XrHasSession(const GHOST_XrContextHandle xr_contexthandle); +int GHOST_XrSessionIsRunning(const GHOST_XrContextHandle xr_context); void GHOST_XrSessionDrawViews(GHOST_XrContextHandle xr_context, void *customdata); /* events */ diff --git a/intern/ghost/GHOST_IXrContext.h b/intern/ghost/GHOST_IXrContext.h index 362bc923ee8..3b8455e6e86 100644 --- a/intern/ghost/GHOST_IXrContext.h +++ b/intern/ghost/GHOST_IXrContext.h @@ -29,6 +29,7 @@ class GHOST_IXrContext { virtual void startSession(const GHOST_XrSessionBeginInfo *begin_info) = 0; virtual void endSession() = 0; + virtual bool hasSession() const = 0; virtual bool isSessionRunning() const = 0; virtual void drawSessionViews(void *draw_customdata) = 0; diff --git a/intern/ghost/intern/GHOST_C-api.cpp b/intern/ghost/intern/GHOST_C-api.cpp index caa88f46ff9..c188cc8e819 100644 --- a/intern/ghost/intern/GHOST_C-api.cpp +++ b/intern/ghost/intern/GHOST_C-api.cpp @@ -937,6 +937,13 @@ void GHOST_XrSessionEnd(GHOST_XrContextHandle xr_contexthandle) GHOST_XR_CAPI_CALL(xr_context->endSession(), xr_context); } +int GHOST_XrHasSession(const GHOST_XrContextHandle xr_contexthandle) +{ + const GHOST_IXrContext *xr_context = (GHOST_IXrContext *)xr_contexthandle; + GHOST_XR_CAPI_CALL_RET(xr_context->hasSession(), xr_context); + return 0; // Only reached if exception is thrown. +} + int GHOST_XrSessionIsRunning(const GHOST_XrContextHandle xr_contexthandle) { const GHOST_IXrContext *xr_context = (GHOST_IXrContext *)xr_contexthandle; diff --git a/intern/ghost/intern/GHOST_XrContext.cpp b/intern/ghost/intern/GHOST_XrContext.cpp index 03c3fed3b9e..51b39bcc193 100644 --- a/intern/ghost/intern/GHOST_XrContext.cpp +++ b/intern/ghost/intern/GHOST_XrContext.cpp @@ -441,6 +441,11 @@ void GHOST_XrContext::endSession() m_session =
[Bf-blender-cvs] [5f405728bb4] master: BLI_task: Cleanup: rename some structs to make them more generic.
Commit: 5f405728bb4a6c32308371905955e87db851e5aa Author: Bastien Montagne Date: Tue Jul 30 14:56:47 2019 +0200 Branches: master https://developer.blender.org/rB5f405728bb4a6c32308371905955e87db851e5aa BLI_task: Cleanup: rename some structs to make them more generic. TLS and Settings can be used by other types of parallel 'for loops', so removing 'Range' from their names. No functional changes expected here. === M source/blender/blenkernel/intern/CCGSubSurf_legacy.c M source/blender/blenkernel/intern/armature.c M source/blender/blenkernel/intern/collision.c M source/blender/blenkernel/intern/colortools.c M source/blender/blenkernel/intern/dynamicpaint.c M source/blender/blenkernel/intern/lattice.c M source/blender/blenkernel/intern/mask_rasterize.c M source/blender/blenkernel/intern/mesh_evaluate.c M source/blender/blenkernel/intern/multires.c M source/blender/blenkernel/intern/multires_reshape.c M source/blender/blenkernel/intern/ocean.c M source/blender/blenkernel/intern/particle.c M source/blender/blenkernel/intern/particle_system.c M source/blender/blenkernel/intern/pbvh.c M source/blender/blenkernel/intern/shrinkwrap.c M source/blender/blenkernel/intern/smoke.c M source/blender/blenkernel/intern/subdiv_ccg.c M source/blender/blenkernel/intern/subdiv_foreach.c M source/blender/blenkernel/intern/subsurf_ccg.c M source/blender/blenkernel/intern/tracking_auto.c M source/blender/blenkernel/intern/tracking_stabilize.c M source/blender/blenlib/BLI_task.h M source/blender/blenlib/intern/BLI_kdopbvh.c M source/blender/blenlib/intern/math_statistics.c M source/blender/blenlib/intern/task.c M source/blender/bmesh/intern/bmesh_interp.c M source/blender/depsgraph/intern/depsgraph_tag.cc M source/blender/depsgraph/intern/eval/deg_eval.cc M source/blender/depsgraph/intern/eval/deg_eval_flush.cc M source/blender/editors/physics/particle_edit.c M source/blender/editors/sculpt_paint/paint_cursor.c M source/blender/editors/sculpt_paint/paint_image_2d.c M source/blender/editors/sculpt_paint/paint_mask.c M source/blender/editors/sculpt_paint/paint_vertex.c M source/blender/editors/sculpt_paint/sculpt.c M source/blender/editors/sculpt_paint/sculpt_undo.c M source/blender/editors/space_sequencer/sequencer_scopes.c M source/blender/modifiers/intern/MOD_displace.c M source/blender/modifiers/intern/MOD_meshdeform.c M source/blender/modifiers/intern/MOD_ocean.c M source/blender/modifiers/intern/MOD_surfacedeform.c M source/blender/modifiers/intern/MOD_uvwarp.c M source/blender/modifiers/intern/MOD_weightvgproximity.c M source/blender/render/intern/source/pointdensity.c === diff --git a/source/blender/blenkernel/intern/CCGSubSurf_legacy.c b/source/blender/blenkernel/intern/CCGSubSurf_legacy.c index 720c828664a..d8b30c9d4ef 100644 --- a/source/blender/blenkernel/intern/CCGSubSurf_legacy.c +++ b/source/blender/blenkernel/intern/CCGSubSurf_legacy.c @@ -135,7 +135,7 @@ typedef struct CCGSubSurfCalcSubdivData { } CCGSubSurfCalcSubdivData; static void ccgSubSurf__calcVertNormals_faces_accumulate_cb( -void *__restrict userdata, const int ptrIdx, const ParallelRangeTLS *__restrict UNUSED(tls)) +void *__restrict userdata, const int ptrIdx, const TaskParallelTLS *__restrict UNUSED(tls)) { CCGSubSurfCalcSubdivData *data = userdata; @@ -234,7 +234,7 @@ static void ccgSubSurf__calcVertNormals_faces_accumulate_cb( } static void ccgSubSurf__calcVertNormals_faces_finalize_cb( -void *__restrict userdata, const int ptrIdx, const ParallelRangeTLS *__restrict UNUSED(tls)) +void *__restrict userdata, const int ptrIdx, const TaskParallelTLS *__restrict UNUSED(tls)) { CCGSubSurfCalcSubdivData *data = userdata; @@ -273,7 +273,7 @@ static void ccgSubSurf__calcVertNormals_faces_finalize_cb( } static void ccgSubSurf__calcVertNormals_edges_accumulate_cb( -void *__restrict userdata, const int ptrIdx, const ParallelRangeTLS *__restrict UNUSED(tls)) +void *__restrict userdata, const int ptrIdx, const TaskParallelTLS *__restrict UNUSED(tls)) { CCGSubSurfCalcSubdivData *data = userdata; @@ -347,7 +347,7 @@ static void ccgSubSurf__calcVertNormals(CCGSubSurf *ss, }; { -ParallelRangeSettings settings; +TaskParallelSettings settings; BLI_parallel_range_settings_defaults(); settings.min_iter_per_thread = CCG_TASK_LIMIT; BLI_task_parallel_range( @@ -379,7 +379,7 @@ static void ccgSubSurf__calcVertNormals(CCGSubSurf *ss, } { -ParallelRangeSettings settings; +TaskParallelSettings settings; BLI_parallel_range_settings_defaults(); settings.min_iter_per_thread =
[Bf-blender-cvs] [b9c257019fe] master: BLI_task: tweak default chunk size for `BLI_task_parallel_range()`.
Commit: b9c257019fe256af6c2978b94b4948d18a6cd4eb Author: Bastien Montagne Date: Tue Jul 30 14:36:59 2019 +0200 Branches: master https://developer.blender.org/rBb9c257019fe256af6c2978b94b4948d18a6cd4eb BLI_task: tweak default chunk size for `BLI_task_parallel_range()`. Previously we were setting it to 1 (aka no 'chunking'), to follow previous behavior. However, this is far from optimal, especially with CPUs that can have tens of threads nowadays. Now taking an heuristic approach (inspired from the one already existing for `BLI_task_parallel_listbase()`, which tries to guesstimate best chunk sizes based on several factors (amount of threads/parallel tasks, total number of items, ...). Think this is a reasonable base ground, more optimization here would of course be possible. Note that code that was already explicitely settings some value here won't be affected at all by that change. === M source/blender/blenlib/BLI_task.h M source/blender/blenlib/intern/task.c === diff --git a/source/blender/blenlib/BLI_task.h b/source/blender/blenlib/BLI_task.h index d11ba15a7e0..85680d8aae8 100644 --- a/source/blender/blenlib/BLI_task.h +++ b/source/blender/blenlib/BLI_task.h @@ -216,11 +216,8 @@ BLI_INLINE void BLI_parallel_range_settings_defaults(ParallelRangeSettings *sett memset(settings, 0, sizeof(*settings)); settings->use_threading = true; settings->scheduling_mode = TASK_SCHEDULING_STATIC; - /* NOTE: Current value mimics old behavior, but it's not ideal by any - * means. Would be cool to find a common value which will work good enough - * for both static and dynamic scheduling. - */ - settings->min_iter_per_thread = 1; + /* Use default heuristic to define actual chunk size. */ + settings->min_iter_per_thread = 0; } #ifdef __cplusplus diff --git a/source/blender/blenlib/intern/task.c b/source/blender/blenlib/intern/task.c index 85d39f2f98e..cc54fb6bd38 100644 --- a/source/blender/blenlib/intern/task.c +++ b/source/blender/blenlib/intern/task.c @@ -1054,6 +1054,49 @@ typedef struct ParallelRangeState { int chunk_size; } ParallelRangeState; +BLI_INLINE void task_parallel_range_calc_chunk_size(const ParallelRangeSettings *settings, +const int num_tasks, +ParallelRangeState *state) +{ + const int tot_items = state->stop - state->start; + int chunk_size = 0; + + if (settings->min_iter_per_thread > 0) { +/* Already set by user, no need to do anything here. */ +chunk_size = settings->min_iter_per_thread; + } + else { +/* Basic heuristic to avoid threading on low amount of items. We could make that limit + * configurable in settings too... */ +if (tot_items > 0 && tot_items < 256) { + chunk_size = tot_items; +} +/* NOTE: The idea here is to compensate for rather measurable threading + * overhead caused by fetching tasks. With too many CPU threads we are starting + * to spend too much time in those overheads. */ +else if (num_tasks > 32) { + chunk_size = 128; +} +else if (num_tasks > 16) { + chunk_size = 64; +} +else { + chunk_size = 32; +} + } + + BLI_assert(chunk_size > 0); + + switch (settings->scheduling_mode) { +case TASK_SCHEDULING_STATIC: + state->chunk_size = max_ii(chunk_size, tot_items / (num_tasks)); + break; +case TASK_SCHEDULING_DYNAMIC: + state->chunk_size = chunk_size; + break; + } +} + BLI_INLINE bool parallel_range_next_iter_get(ParallelRangeState *__restrict state, int *__restrict iter, int *__restrict count) @@ -1162,16 +1205,8 @@ void BLI_task_parallel_range(const int start, state.userdata = userdata; state.func = func; state.iter = start; - switch (settings->scheduling_mode) { -case TASK_SCHEDULING_STATIC: - state.chunk_size = max_ii(settings->min_iter_per_thread, (stop - start) / (num_tasks)); - break; -case TASK_SCHEDULING_DYNAMIC: - /* TODO(sergey): Make it configurable from min_iter_per_thread. */ - state.chunk_size = 32; - break; - } + task_parallel_range_calc_chunk_size(settings, num_tasks, ); num_tasks = min_ii(num_tasks, max_ii(1, (stop - start) / state.chunk_size)); if (num_tasks == 1) { ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [760e0847918] functions: show node search in menu
Commit: 760e084791837c7ae9d818d6a3056ced29cb210a Author: Jacques Lucke Date: Tue Jul 30 14:54:52 2019 +0200 Branches: functions https://developer.blender.org/rB760e084791837c7ae9d818d6a3056ced29cb210a show node search in menu === M release/scripts/startup/nodes/menu.py === diff --git a/release/scripts/startup/nodes/menu.py b/release/scripts/startup/nodes/menu.py index 3cb6012b589..eb08670f747 100644 --- a/release/scripts/startup/nodes/menu.py +++ b/release/scripts/startup/nodes/menu.py @@ -8,8 +8,10 @@ def draw_menu(self, context): return layout = self.layout -self.operator_context = "INVOKE_DEFAULT" +layout.operator_context = 'INVOKE_DEFAULT' +layout.operator("fn.node_search", text="Search", icon='VIEWZOOM') +layout.separator() insert_node(layout, "fn_FunctionInputNode", "Function Input") insert_node(layout, "fn_FunctionOutputNode", "Function Output") layout.separator() ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [5841005187b] functions: add buttons to create particle type nodes
Commit: 5841005187b0f7a2ee4c1678285136da227aaf25 Author: Jacques Lucke Date: Tue Jul 30 14:28:27 2019 +0200 Branches: functions https://developer.blender.org/rB5841005187b0f7a2ee4c1678285136da227aaf25 add buttons to create particle type nodes === M release/scripts/startup/nodes/base.py M release/scripts/startup/nodes/bparticle_nodes/explode_particle.py M release/scripts/startup/nodes/bparticle_nodes/trails.py === diff --git a/release/scripts/startup/nodes/base.py b/release/scripts/startup/nodes/base.py index 310e165287e..a8b2adb8aa4 100644 --- a/release/scripts/startup/nodes/base.py +++ b/release/scripts/startup/nodes/base.py @@ -211,7 +211,23 @@ class FunctionNode(BaseNode): pass class BParticlesNode(BaseNode): -pass +def invoke_particle_type_creation(self, layout, function_name, text, *, icon='NONE'): +self.invoke_function(layout, "create_particle_type", text, icon=icon, settings=(function_name,)) + +def create_particle_type(self, function_name): +for node in self.tree.nodes: +node.select = False + +new_node = self.tree.nodes.new("bp_ParticleTypeNode") +new_node.select = True +self.tree.nodes.active = new_node +new_node.location = self.location +new_node.location.x += 10 +new_node.location.y += 10 + +callback = getattr(self, function_name) +callback(new_node) +bpy.ops.node.translate_attach('INVOKE_DEFAULT') class DataSocket(BaseSocket): def draw_self(self, layout, node, text): diff --git a/release/scripts/startup/nodes/bparticle_nodes/explode_particle.py b/release/scripts/startup/nodes/bparticle_nodes/explode_particle.py index ece49099d67..c8238b7bc98 100644 --- a/release/scripts/startup/nodes/bparticle_nodes/explode_particle.py +++ b/release/scripts/startup/nodes/bparticle_nodes/explode_particle.py @@ -16,4 +16,10 @@ class ExplodeParticleNode(bpy.types.Node, BParticlesNode): builder.control_flow_output("control_out", "(Out)") def draw(self, layout): -layout.prop(self, "particle_type_name", text="", icon="MOD_PARTICLES") +row = layout.row(align=True) +row.prop(self, "particle_type_name", text="", icon="MOD_PARTICLES") +self.invoke_particle_type_creation(row, "on_type_created", "", icon='ADD') + +def on_type_created(self, new_node): +new_node.name = "Exploded" +self.particle_type_name = new_node.name diff --git a/release/scripts/startup/nodes/bparticle_nodes/trails.py b/release/scripts/startup/nodes/bparticle_nodes/trails.py index 510bc20e250..dafada599e1 100644 --- a/release/scripts/startup/nodes/bparticle_nodes/trails.py +++ b/release/scripts/startup/nodes/bparticle_nodes/trails.py @@ -7,11 +7,17 @@ class ParticleTrailsNode(bpy.types.Node, BParticlesNode): bl_idname = "bp_ParticleTrailsNode" bl_label = "Particle Trails" -particle_type_name: StringProperty() +particle_type_name: StringProperty(maxlen=64) def declaration(self, builder: NodeBuilder): -builder.fixed_input("rate", "Rate", "Float", default=10) +builder.fixed_input("rate", "Rate", "Float", default=20) builder.particle_effector_output("effect", "Effect") def draw(self, layout): -layout.prop(self, "particle_type_name", text="", icon="MOD_PARTICLES") +row = layout.row(align=True) +row.prop(self, "particle_type_name", text="", icon="MOD_PARTICLES") +self.invoke_particle_type_creation(row, "on_type_created", "", icon='ADD') + +def on_type_created(self, new_node): +new_node.name = "Trails" +self.particle_type_name = new_node.name ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [e54acfa2ff2] functions: rename
Commit: e54acfa2ff21f827553a922b31da6acddb016841 Author: Jacques Lucke Date: Tue Jul 30 14:29:47 2019 +0200 Branches: functions https://developer.blender.org/rBe54acfa2ff21f827553a922b31da6acddb016841 rename === M release/scripts/startup/nodes/base.py M release/scripts/startup/nodes/sync.py === diff --git a/release/scripts/startup/nodes/base.py b/release/scripts/startup/nodes/base.py index a8b2adb8aa4..a1f94330b17 100644 --- a/release/scripts/startup/nodes/base.py +++ b/release/scripts/startup/nodes/base.py @@ -44,7 +44,7 @@ class BaseNode: def init(self, context): from . sync import skip_syncing with skip_syncing(): -builder = self.get_socket_builder() +builder = self.get_node_builder() builder.initialize_decls() builder.build() builder.init_defaults() @@ -74,7 +74,7 @@ class BaseNode: def rebuild_fast(self): from . sync import skip_syncing with skip_syncing(): -builder = self.get_socket_builder() +builder = self.get_node_builder() builder.build() _decl_map_per_node[self] = builder.get_sockets_decl_map() @@ -82,7 +82,7 @@ class BaseNode: def tree(self): return self.id_data -def get_socket_builder(self): +def get_node_builder(self): from . node_builder import NodeBuilder builder = NodeBuilder(self) self.declaration(builder) @@ -164,7 +164,7 @@ class BaseNode: @property def decl_map(self): if self not in _decl_map_per_node: -builder = self.get_socket_builder() +builder = self.get_node_builder() _decl_map_per_node[self] = builder.get_sockets_decl_map() return _decl_map_per_node[self] diff --git a/release/scripts/startup/nodes/sync.py b/release/scripts/startup/nodes/sync.py index 3d4da4bd383..0eec6b4e04b 100644 --- a/release/scripts/startup/nodes/sync.py +++ b/release/scripts/startup/nodes/sync.py @@ -100,7 +100,7 @@ def iter_nodes_with_outdated_sockets(tree): def node_matches_current_declaration(node): from . node_builder import NodeBuilder -builder = node.get_socket_builder() +builder = node.get_node_builder() return builder.matches_sockets() ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [042cc17babd] functions: clang-format
Commit: 042cc17babd00389a2649d5a3cba8594aa7d9acd Author: Jacques Lucke Date: Tue Jul 30 15:06:22 2019 +0200 Branches: functions https://developer.blender.org/rB042cc17babd00389a2649d5a3cba8594aa7d9acd clang-format === M source/blender/simulations/bparticles/forces.cpp M source/blender/simulations/bparticles/forces.hpp === diff --git a/source/blender/simulations/bparticles/forces.cpp b/source/blender/simulations/bparticles/forces.cpp index e6d251fd82e..b2818a4e1f7 100644 --- a/source/blender/simulations/bparticles/forces.cpp +++ b/source/blender/simulations/bparticles/forces.cpp @@ -56,12 +56,12 @@ void PointForce::add_force(ForceInterface ) if (gravitation) { if (distance < FLT_EPSILON) { - strength = 0.0f; - } +strength = 0.0f; + } else { strength *= powf(distance, -2.0f); - } - } + } +} direction *= (strength * falloff); diff --git a/source/blender/simulations/bparticles/forces.hpp b/source/blender/simulations/bparticles/forces.hpp index 0e36a981176..961e0a8ac20 100644 --- a/source/blender/simulations/bparticles/forces.hpp +++ b/source/blender/simulations/bparticles/forces.hpp @@ -39,10 +39,10 @@ class TurbulenceForce : public Force { }; class PointForce : public Force { - private: + private: std::unique_ptr m_compute_inputs; - public: + public: PointForce(std::unique_ptr compute_inputs) : m_compute_inputs(std::move(compute_inputs)) { ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [9d3a92d3e34] functions: use background color for particle type node
Commit: 9d3a92d3e343891be9611d8d973bf093d125dc7e Author: Jacques Lucke Date: Tue Jul 30 14:45:28 2019 +0200 Branches: functions https://developer.blender.org/rB9d3a92d3e343891be9611d8d973bf093d125dc7e use background color for particle type node === M release/scripts/startup/nodes/bparticle_nodes/particle_type.py M release/scripts/startup/nodes/node_builder.py === diff --git a/release/scripts/startup/nodes/bparticle_nodes/particle_type.py b/release/scripts/startup/nodes/bparticle_nodes/particle_type.py index 7cb1c697295..054199e1c81 100644 --- a/release/scripts/startup/nodes/bparticle_nodes/particle_type.py +++ b/release/scripts/startup/nodes/bparticle_nodes/particle_type.py @@ -7,6 +7,8 @@ class ParticleTypeNode(bpy.types.Node, BParticlesNode): bl_label = "Particle Type" def declaration(self, builder: NodeBuilder): +builder.background_color((0.8, 0.5, 0.4)) + builder.emitter_input("emitters", "Emitters") builder.particle_effector_input("effectors", "Effectors") builder.event_output("events", "Events") diff --git a/release/scripts/startup/nodes/node_builder.py b/release/scripts/startup/nodes/node_builder.py index 98153e92f49..57b767a4b9f 100644 --- a/release/scripts/startup/nodes/node_builder.py +++ b/release/scripts/startup/nodes/node_builder.py @@ -19,6 +19,7 @@ class NodeBuilder: self.node = node self.input_declarations = [] self.output_declarations = [] +self._background_color = None def _add_input(self, decl): self.input_declarations.append(decl) @@ -47,6 +48,10 @@ class NodeBuilder: sockets = decl.build(self.node.outputs) assert len(sockets) == decl.amount() +if self._background_color is not None: +self.node.use_custom_color = True +self.node.color = self._background_color + def init_defaults(self): for decl, sockets in self.get_sockets_decl_map().iter_decl_with_sockets(): decl.init_default(sockets) @@ -76,8 +81,15 @@ class NodeBuilder: return False return True +# General Node Properties +### + +def background_color(self, color): +assert len(color) == 3 +self._background_color = color + -# Fixed +# Fixed Data Types ### def fixed_input(self, identifier, name, data_type, *, default=NoDefaultValue): ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [4f5093f4038] functions: renamed particle_modifier_output to particle_effector_output
Commit: 4f5093f40382b122fb0f9d13a9e5ae72aae603ef Author: Martin Felke Date: Tue Jul 30 14:53:26 2019 +0200 Branches: functions https://developer.blender.org/rB4f5093f40382b122fb0f9d13a9e5ae72aae603ef renamed particle_modifier_output to particle_effector_output === M release/scripts/startup/nodes/bparticle_nodes/point_force.py === diff --git a/release/scripts/startup/nodes/bparticle_nodes/point_force.py b/release/scripts/startup/nodes/bparticle_nodes/point_force.py index 8ed7d4f7a17..cc009355dab 100644 --- a/release/scripts/startup/nodes/bparticle_nodes/point_force.py +++ b/release/scripts/startup/nodes/bparticle_nodes/point_force.py @@ -13,4 +13,4 @@ class PointForceNode(bpy.types.Node, BParticlesNode): builder.fixed_input("falloff", "Falloff", "Float", default = 1.0) builder.fixed_input("distance", "Distance", "Float", default = 1.0) builder.fixed_input("gravitation", "Gravitation", "Boolean", default=False) -builder.particle_modifier_output("force", "Force") +builder.particle_effector_output("force", "Force") ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [26d0bbffa89] functions: added point force node for particle nodes
Commit: 26d0bbffa89e364ca430407a0f59b16a15cf2785 Author: Martin Felke Date: Tue Jul 30 14:39:25 2019 +0200 Branches: functions https://developer.blender.org/rB26d0bbffa89e364ca430407a0f59b16a15cf2785 added point force node for particle nodes === A release/scripts/startup/nodes/bparticle_nodes/point_force.py M source/blender/simulations/bparticles/forces.cpp M source/blender/simulations/bparticles/forces.hpp M source/blender/simulations/bparticles/inserters.cpp === diff --git a/release/scripts/startup/nodes/bparticle_nodes/point_force.py b/release/scripts/startup/nodes/bparticle_nodes/point_force.py new file mode 100644 index 000..8ed7d4f7a17 --- /dev/null +++ b/release/scripts/startup/nodes/bparticle_nodes/point_force.py @@ -0,0 +1,16 @@ +import bpy +from bpy.props import * +from .. base import BParticlesNode +from .. node_builder import NodeBuilder + +class PointForceNode(bpy.types.Node, BParticlesNode): +bl_idname = "bp_PointForceNode" +bl_label = "Point Force" + +def declaration(self, builder : NodeBuilder): +builder.fixed_input("direction", "Direction", "Vector", default=(0, 0, -1)) +builder.fixed_input("strength", "Strength", "Float", default = 1.0) +builder.fixed_input("falloff", "Falloff", "Float", default = 1.0) +builder.fixed_input("distance", "Distance", "Float", default = 1.0) +builder.fixed_input("gravitation", "Gravitation", "Boolean", default=False) +builder.particle_modifier_output("force", "Force") diff --git a/source/blender/simulations/bparticles/forces.cpp b/source/blender/simulations/bparticles/forces.cpp index 8c2a7db7feb..e6d251fd82e 100644 --- a/source/blender/simulations/bparticles/forces.cpp +++ b/source/blender/simulations/bparticles/forces.cpp @@ -40,4 +40,33 @@ void TurbulenceForce::add_force(ForceInterface ) } } +void PointForce::add_force(ForceInterface ) +{ + ParticlesBlock = interface.block(); + ArrayRef destination = interface.combined_destination(); + + auto inputs = m_compute_inputs->compute(interface); + + for (uint pindex = 0; pindex < block.active_amount(); pindex++) { +float3 direction = inputs->get("Direction", 0, pindex); +float strength = inputs->get("Strength", 1, pindex); +float falloff = inputs->get("Falloff", 2, pindex); +float distance = inputs->get("Distance", 3, pindex); +bool gravitation = inputs->get("Gravitation", 4, pindex); + +if (gravitation) { + if (distance < FLT_EPSILON) { + strength = 0.0f; + } + else { +strength *= powf(distance, -2.0f); + } + } + +direction *= (strength * falloff); + +destination[pindex] += direction; + } +} + } // namespace BParticles diff --git a/source/blender/simulations/bparticles/forces.hpp b/source/blender/simulations/bparticles/forces.hpp index 1806713752d..0e36a981176 100644 --- a/source/blender/simulations/bparticles/forces.hpp +++ b/source/blender/simulations/bparticles/forces.hpp @@ -38,4 +38,17 @@ class TurbulenceForce : public Force { void add_force(ForceInterface ) override; }; +class PointForce : public Force { + private: + std::unique_ptr m_compute_inputs; + + public: + PointForce(std::unique_ptr compute_inputs) + : m_compute_inputs(std::move(compute_inputs)) + { + } + + void add_force(ForceInterface ) override; +}; + } // namespace BParticles diff --git a/source/blender/simulations/bparticles/inserters.cpp b/source/blender/simulations/bparticles/inserters.cpp index 53420bf16fb..fecd1f11adc 100644 --- a/source/blender/simulations/bparticles/inserters.cpp +++ b/source/blender/simulations/bparticles/inserters.cpp @@ -186,6 +186,14 @@ static std::unique_ptr BUILD_FORCE_turbulence( return std::unique_ptr(new TurbulenceForce(std::move(compute_inputs_fn))); } +static std::unique_ptr BUILD_FORCE_point( +BuildContext (ctx), +VirtualNode *UNUSED(vnode), +std::unique_ptr compute_inputs_fn) +{ + return std::unique_ptr(new PointForce(std::move(compute_inputs_fn))); +} + static std::unique_ptr BUILD_EVENT_mesh_collision( BuildContext , VirtualNode *vnode, std::unique_ptr compute_inputs_fn) { @@ -426,6 +434,7 @@ BLI_LAZY_INIT(StringMap, get_force_builders) StringMap map; map.add_new("bp_GravityForceNode", BUILD_FORCE_gravity); map.add_new("bp_TurbulenceForceNode", BUILD_FORCE_turbulence); + map.add_new("bp_PointForceNode", BUILD_FORCE_point); return map; } ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [ae7db537448] master: Fix T66629: Library override - fails when armature and mesh are in separate collections.
Commit: ae7db53744845897154c9d2b54390850d3615093 Author: Bastien Montagne Date: Tue Jul 30 13:04:00 2019 +0200 Branches: master https://developer.blender.org/rBae7db53744845897154c9d2b54390850d3615093 Fix T66629: Library override - fails when armature and mesh are in separate collections. Some ugly very low-level collection code was using the generic LIB_TAG_DOIT tag... should never happen, that one is for rather high-level code to use, core process shall use own tags. === M source/blender/blenkernel/intern/collection.c M source/blender/blenloader/intern/readfile.c M source/blender/makesdna/DNA_collection_types.h === diff --git a/source/blender/blenkernel/intern/collection.c b/source/blender/blenkernel/intern/collection.c index 965f6e4bc51..25f2797915a 100644 --- a/source/blender/blenkernel/intern/collection.c +++ b/source/blender/blenkernel/intern/collection.c @@ -1100,7 +1100,7 @@ void BKE_collection_parent_relations_rebuild(Collection *collection) static void collection_parents_rebuild_recursive(Collection *collection) { BKE_collection_parent_relations_rebuild(collection); - collection->id.tag &= ~LIB_TAG_DOIT; + collection->tag &= ~COLLECTION_TAG_RELATION_REBUILD; for (CollectionChild *child = collection->children.first; child != NULL; child = child->next) { collection_parents_rebuild_recursive(child->collection); @@ -1109,8 +1109,6 @@ static void collection_parents_rebuild_recursive(Collection *collection) /** * Rebuild parent relationships from child ones, for all collections in given \a bmain. - * - * \note Uses LIB_TAG_DOIT internally... */ void BKE_main_collections_parent_relations_rebuild(Main *bmain) { @@ -1119,7 +1117,7 @@ void BKE_main_collections_parent_relations_rebuild(Main *bmain) collection = collection->id.next) { BLI_freelistN(>parents); -collection->id.tag |= LIB_TAG_DOIT; +collection->tag |= COLLECTION_TAG_RELATION_REBUILD; } /* Scene's master collections will be 'root' parent of most of our collections, so start with @@ -1132,7 +1130,7 @@ void BKE_main_collections_parent_relations_rebuild(Main *bmain) * lib_link_collection_data() seems to assume that, so do the same here. */ for (Collection *collection = bmain->collections.first; collection != NULL; collection = collection->id.next) { -if (collection->id.tag & LIB_TAG_DOIT) { +if (collection->tag & COLLECTION_TAG_RELATION_REBUILD) { /* Note: we do not have easy access to 'which collections is root' info in that case, which * means test for cycles in collection relationships may fail here. I don't think that is an * issue in practice here, but worth keeping in mind... */ diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index acca42b6562..88d878ac019 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -6220,6 +6220,7 @@ static void direct_link_collection(FileData *fd, Collection *collection) collection->preview = direct_link_preview_image(fd, collection->preview); collection->flag &= ~COLLECTION_HAS_OBJECT_CACHE; + collection->tag = 0; BLI_listbase_clear(>object_cache); BLI_listbase_clear(>parents); diff --git a/source/blender/makesdna/DNA_collection_types.h b/source/blender/makesdna/DNA_collection_types.h index c7f3ef4156d..af543864536 100644 --- a/source/blender/makesdna/DNA_collection_types.h +++ b/source/blender/makesdna/DNA_collection_types.h @@ -57,7 +57,9 @@ typedef struct Collection { float instance_offset[3]; short flag; - char _pad[6]; + /* Runtime-only, always cleared on file load. */ + short tag; + char _pad[4]; /* Runtime. Cache of objects in this collection and all its * children. This is created on demand when e.g. some physics @@ -84,4 +86,12 @@ enum { COLLECTION_IS_MASTER = (1 << 5), /* Is master collection embedded in the scene. */ }; +/* Collection->tag */ +enum { + /* That code (BKE_main_collections_parent_relations_rebuild and the like) + * is called from very low-level places, like e.g ID remapping... + * Using a generic tag like LIB_TAG_DOIT for this is just impossible, we need our very own. */ + COLLECTION_TAG_RELATION_REBUILD = (1 << 0), +}; + #endif /* __DNA_COLLECTION_TYPES_H__ */ ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [cee484a4c51] master: Fix T67067: Wrong rotation input values when using shortcuts on keyboard like rx720.
Commit: cee484a4c51a3d207e42b2d0486846da6db386cf Author: Bastien Montagne Date: Tue Jul 30 13:00:48 2019 +0200 Branches: master https://developer.blender.org/rBcee484a4c51a3d207e42b2d0486846da6db386cf Fix T67067: Wrong rotation input values when using shortcuts on keyboard like rx720. This allows to type in numinput 720 and indeed get a rotation of 720°, not 0°... This patch basically applies 'big rotations' in steps < 180°, such that compatible rotation works as expected. This implies resetting current rotation to initial one first, otherwise we'd end up applying much more turns than expected when that code is called more than once. It also makes things somewhat slower for big rotations (millions of degrees), Hence we clamp to 1000 turns max. And since that's a case that cannot happen with regular tool/widget-driven rotation, it's only enabled when numinput is used for now. Review task: https://developer.blender.org/D5289 === M source/blender/editors/transform/transform.c === diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index 6add395361e..d8dd6aa97b5 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -4583,17 +4583,42 @@ static void ElementRotation( ElementRotation_ex(t, tc, td, mat, center); } -static void applyRotationValue(TransInfo *t, float angle, float axis[3]) +static float large_rotation_limit(float angle) +{ + /* Limit rotation to 1001 turns max + * (otherwise iterative handling of 'large' rotations would become too slow). */ + const float angle_max = (float)(M_PI * 2000.0); + if (fabsf(angle) > angle_max) { +const float angle_sign = angle < 0.0f ? -1.0f : 1.0f; +angle = angle_sign * (fmodf(fabsf(angle), (float)(M_PI * 2.0)) + angle_max); + } + return angle; +} + +static void applyRotationValue(TransInfo *t, + float angle, + float axis[3], + const bool is_large_rotation) { float mat[3][3]; int i; + const float angle_sign = angle < 0.0f ? -1.0f : 1.0f; + /* We cannot use something too close to 180°, or 'continuous' rotation may fail + * due to computing error... */ + const float angle_step = angle_sign * (float)(0.9 * M_PI); + + if (is_large_rotation) { +/* Just in case, calling code should have already done that in practice + * (for UI feedback reasons). */ +angle = large_rotation_limit(angle); + } + axis_angle_normalized_to_mat3(mat, axis, angle); FOREACH_TRANS_DATA_CONTAINER (t, tc) { TransData *td = tc->data; for (i = 0; i < tc->data_len; i++, td++) { - if (td->flag & TD_NOACTION) { break; } @@ -4602,14 +4627,32 @@ static void applyRotationValue(TransInfo *t, float angle, float axis[3]) continue; } + float angle_final = angle; if (t->con.applyRot) { t->con.applyRot(t, tc, td, axis, NULL); -axis_angle_normalized_to_mat3(mat, axis, angle * td->factor); +angle_final = angle * td->factor; } else if (t->flag & T_PROP_EDIT) { -axis_angle_normalized_to_mat3(mat, axis, angle * td->factor); +angle_final = angle * td->factor; } + /* Rotation is very likely to be above 180°, we need to do rotation by steps. + * Note that this is only needed when doing 'absolute' rotation + * (i.e. from initial rotation again, typically when using numinput). + * regular incremental rotation (from mouse/widget/...) will be called often enough, + * hence steps are small enough to be properly handled without that complicated trick. */ + if (is_large_rotation) { +copy_v3_v3(td->ext->rot, td->ext->irot); +for (float angle_progress = angle_step; fabsf(angle_progress) < fabsf(angle_final); + angle_progress += angle_step) { + axis_angle_normalized_to_mat3(mat, axis, angle_progress); + ElementRotation(t, tc, td, mat, t->around); +} +axis_angle_normalized_to_mat3(mat, axis, angle_final); + } + else if (angle_final != angle) { +axis_angle_normalized_to_mat3(mat, axis, angle_final); + } ElementRotation(t, tc, td, mat, t->around); } } @@ -4634,15 +4677,18 @@ static void applyRotation(TransInfo *t, const int UNUSED(mval[2])) applySnapping(t, ); - /* Used to clamp final result in [-PI, PI[ range, no idea why, - * inheritance from 2.4x area, see T48998. */ - applyNumInput(>num, ); + if (applyNumInput(>num, )) { +/* We have to limit the amount of turns to a reasonable number here, + * to avoid things getting *very* slow, see how applyRotationValue() handles those... */ +final = large_rotation_limit(final); + } t->values[0] = final;
[Bf-blender-cvs] [773b6bbd421] functions: rename modifier to effector in some places
Commit: 773b6bbd421a4195591223f208c2ca2c97ce045e Author: Jacques Lucke Date: Tue Jul 30 13:58:17 2019 +0200 Branches: functions https://developer.blender.org/rB773b6bbd421a4195591223f208c2ca2c97ce045e rename modifier to effector in some places That was missing in a previous commit. === M release/scripts/startup/nodes/bparticle_nodes/gravity_force.py M release/scripts/startup/nodes/bparticle_nodes/particle_type.py M release/scripts/startup/nodes/bparticle_nodes/trails.py M release/scripts/startup/nodes/bparticle_nodes/turbulence_force.py M release/scripts/startup/nodes/declaration/__init__.py M release/scripts/startup/nodes/declaration/bparticles.py M release/scripts/startup/nodes/node_builder.py M release/scripts/startup/nodes/sockets.py === diff --git a/release/scripts/startup/nodes/bparticle_nodes/gravity_force.py b/release/scripts/startup/nodes/bparticle_nodes/gravity_force.py index b23c3c1bd91..8a0691f0061 100644 --- a/release/scripts/startup/nodes/bparticle_nodes/gravity_force.py +++ b/release/scripts/startup/nodes/bparticle_nodes/gravity_force.py @@ -9,4 +9,4 @@ class GravityForceNode(bpy.types.Node, BParticlesNode): def declaration(self, builder: NodeBuilder): builder.fixed_input("direction", "Direction", "Vector", default=(0, 0, -1)) -builder.particle_modifier_output("force", "Force") +builder.particle_effector_output("force", "Force") diff --git a/release/scripts/startup/nodes/bparticle_nodes/particle_type.py b/release/scripts/startup/nodes/bparticle_nodes/particle_type.py index 127342f5a7f..7cb1c697295 100644 --- a/release/scripts/startup/nodes/bparticle_nodes/particle_type.py +++ b/release/scripts/startup/nodes/bparticle_nodes/particle_type.py @@ -8,7 +8,7 @@ class ParticleTypeNode(bpy.types.Node, BParticlesNode): def declaration(self, builder: NodeBuilder): builder.emitter_input("emitters", "Emitters") -builder.particle_modifier_input("effectors", "Effectors") +builder.particle_effector_input("effectors", "Effectors") builder.event_output("events", "Events") def draw(self, layout): diff --git a/release/scripts/startup/nodes/bparticle_nodes/trails.py b/release/scripts/startup/nodes/bparticle_nodes/trails.py index fa61dd1764d..510bc20e250 100644 --- a/release/scripts/startup/nodes/bparticle_nodes/trails.py +++ b/release/scripts/startup/nodes/bparticle_nodes/trails.py @@ -11,7 +11,7 @@ class ParticleTrailsNode(bpy.types.Node, BParticlesNode): def declaration(self, builder: NodeBuilder): builder.fixed_input("rate", "Rate", "Float", default=10) -builder.particle_modifier_output("effect", "Effect") +builder.particle_effector_output("effect", "Effect") def draw(self, layout): layout.prop(self, "particle_type_name", text="", icon="MOD_PARTICLES") diff --git a/release/scripts/startup/nodes/bparticle_nodes/turbulence_force.py b/release/scripts/startup/nodes/bparticle_nodes/turbulence_force.py index aa365b7e268..14530165c07 100644 --- a/release/scripts/startup/nodes/bparticle_nodes/turbulence_force.py +++ b/release/scripts/startup/nodes/bparticle_nodes/turbulence_force.py @@ -9,4 +9,4 @@ class TurbulenceForceNode(bpy.types.Node, BParticlesNode): def declaration(self, builder: NodeBuilder): builder.fixed_input("strength", "Strength", "Vector", default=(1, 1, 1)) -builder.particle_modifier_output("force", "Force") +builder.particle_effector_output("force", "Force") diff --git a/release/scripts/startup/nodes/declaration/__init__.py b/release/scripts/startup/nodes/declaration/__init__.py index b05590784f2..b37d1770832 100644 --- a/release/scripts/startup/nodes/declaration/__init__.py +++ b/release/scripts/startup/nodes/declaration/__init__.py @@ -9,5 +9,5 @@ from . bparticles import ( EmitterSocketDecl, EventSocketDecl, ControlFlowSocketDecl, -ParticleModifierSocketDecl, +ParticleEffectorSocketDecl, ) diff --git a/release/scripts/startup/nodes/declaration/bparticles.py b/release/scripts/startup/nodes/declaration/bparticles.py index 85b1b70fe3e..9731a3f8e30 100644 --- a/release/scripts/startup/nodes/declaration/bparticles.py +++ b/release/scripts/startup/nodes/declaration/bparticles.py @@ -86,14 +86,14 @@ class ControlFlowSocketDecl(SocketDeclBase): def amount(self): return 1 -class ParticleModifierSocketDecl(SocketDeclBase): +class ParticleEffectorSocketDecl(SocketDeclBase): def __init__(self, node, identifier: str, display_name: str): self.node = node self.identifier = identifier self.display_name = display_name def build(self, node_sockets): -socket = node_sockets.new("bp_ParticleModifierSocket", self.display_name, identifier=self.identifier) +socket =
[Bf-blender-cvs] [b9718299ea5] master: Fix crash clicking in the 3D view on startup
Commit: b9718299ea509df2a3d563f0ac2639f01cad39ab Author: Campbell Barton Date: Tue Jul 30 21:40:42 2019 +1000 Branches: master https://developer.blender.org/rBb9718299ea509df2a3d563f0ac2639f01cad39ab Fix crash clicking in the 3D view on startup Setting the 3D view cursor on startup could crash because the viewport hasn't been assigned to the region. === M source/blender/draw/DRW_engine.h M source/blender/draw/intern/draw_manager.c M source/blender/editors/space_view3d/view3d_draw.c M source/blender/windowmanager/WM_api.h M source/blender/windowmanager/intern/wm_draw.c === diff --git a/source/blender/draw/DRW_engine.h b/source/blender/draw/DRW_engine.h index 64a02f3931b..e31200ae82f 100644 --- a/source/blender/draw/DRW_engine.h +++ b/source/blender/draw/DRW_engine.h @@ -129,7 +129,8 @@ void DRW_draw_select_loop(struct Depsgraph *depsgraph, void DRW_draw_depth_loop(struct Depsgraph *depsgraph, struct ARegion *ar, struct View3D *v3d, - struct GPUViewport *viewport); + struct GPUViewport *viewport, + bool use_opengl_context); void DRW_draw_depth_loop_gpencil(struct Depsgraph *depsgraph, struct ARegion *ar, struct View3D *v3d, diff --git a/source/blender/draw/intern/draw_manager.c b/source/blender/draw/intern/draw_manager.c index 320a6f6..af61063335b 100644 --- a/source/blender/draw/intern/draw_manager.c +++ b/source/blender/draw/intern/draw_manager.c @@ -2452,14 +2452,17 @@ static void drw_draw_depth_loop_imp(void) void DRW_draw_depth_loop(struct Depsgraph *depsgraph, ARegion *ar, View3D *v3d, - GPUViewport *viewport) + GPUViewport *viewport, + bool use_opengl_context) { Scene *scene = DEG_get_evaluated_scene(depsgraph); RenderEngineType *engine_type = ED_view3d_engine_type(scene, v3d->shading.type); ViewLayer *view_layer = DEG_get_evaluated_view_layer(depsgraph); RegionView3D *rv3d = ar->regiondata; - DRW_opengl_context_enable(); + if (use_opengl_context) { +DRW_opengl_context_enable(); + } /* Reset before using it. */ drw_state_prepare_clean_for_draw(); @@ -2498,7 +2501,9 @@ void DRW_draw_depth_loop(struct Depsgraph *depsgraph, #endif /* Changin context */ - DRW_opengl_context_disable(); + if (use_opengl_context) { +DRW_opengl_context_disable(); + } } /** diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c index eef36dae86a..9bbfee9f771 100644 --- a/source/blender/editors/space_view3d/view3d_draw.c +++ b/source/blender/editors/space_view3d/view3d_draw.c @@ -803,13 +803,19 @@ void ED_view3d_draw_depth(Depsgraph *depsgraph, ARegion *ar, View3D *v3d, bool a GPU_depth_test(true); + /* Needed in cases the view-port isn't already setup. */ + WM_draw_region_viewport_ensure(ar, SPACE_VIEW3D); + WM_draw_region_viewport_bind(ar); + GPUViewport *viewport = WM_draw_region_get_viewport(ar, 0); /* When Blender is starting, a click event can trigger a depth test while the viewport is not * yet available. */ if (viewport != NULL) { -DRW_draw_depth_loop(depsgraph, ar, v3d, viewport); +DRW_draw_depth_loop(depsgraph, ar, v3d, viewport, false); } + WM_draw_region_viewport_unbind(ar); + if (rv3d->rflag & RV3D_CLIPPING) { ED_view3d_clipping_disable(); } diff --git a/source/blender/windowmanager/WM_api.h b/source/blender/windowmanager/WM_api.h index 04e3f7e88dc..fdf65d857fc 100644 --- a/source/blender/windowmanager/WM_api.h +++ b/source/blender/windowmanager/WM_api.h @@ -741,6 +741,10 @@ void *WM_draw_cb_activate(struct wmWindow *win, void WM_draw_cb_exit(struct wmWindow *win, void *handle); void WM_redraw_windows(struct bContext *C); +void WM_draw_region_viewport_ensure(struct ARegion *ar, short space_type); +void WM_draw_region_viewport_bind(struct ARegion *ar); +void WM_draw_region_viewport_unbind(struct ARegion *ar); + /* Region drawing */ void WM_draw_region_free(struct ARegion *ar); struct GPUViewport *WM_draw_region_get_viewport(struct ARegion *ar, int view); diff --git a/source/blender/windowmanager/intern/wm_draw.c b/source/blender/windowmanager/intern/wm_draw.c index fc669c9543e..3bcb955c2b2 100644 --- a/source/blender/windowmanager/intern/wm_draw.c +++ b/source/blender/windowmanager/intern/wm_draw.c @@ -239,9 +239,14 @@ static void wm_region_test_render_do_draw(const Scene *scene, } } +static bool wm_region_use_viewport_by_type(short space_type, short region_type) +{ + return (ELEM(space_type, SPACE_VIEW3D, SPACE_IMAGE) && region_type == RGN_TYPE_WINDOW); +} +
[Bf-blender-cvs] [c2e63d660b7] functions: add color attribute type
Commit: c2e63d660b7df00b0576920029b473556b019215 Author: Jacques Lucke Date: Tue Jul 30 13:44:39 2019 +0200 Branches: functions https://developer.blender.org/rBc2e63d660b7df00b0576920029b473556b019215 add color attribute type === M source/blender/simulations/bparticles/actions.cpp M source/blender/simulations/bparticles/attributes.hpp M source/blender/simulations/bparticles/c_wrapper.cpp M source/blender/simulations/bparticles/node_frontend.cpp M source/blender/simulations/bparticles/particles_container.cpp M source/blender/simulations/bparticles/particles_container.hpp === diff --git a/source/blender/simulations/bparticles/actions.cpp b/source/blender/simulations/bparticles/actions.cpp index 6734e46b159..a898f50cf96 100644 --- a/source/blender/simulations/bparticles/actions.cpp +++ b/source/blender/simulations/bparticles/actions.cpp @@ -38,14 +38,12 @@ void ChangeDirectionAction::execute(ActionInterface ) void ChangeColorAction::execute(ActionInterface ) { ParticleSet particles = interface.particles(); - auto colors = particles.attributes().get("Color"); + auto colors = particles.attributes().get("Color"); auto inputs = m_compute_inputs->compute(interface); for (uint pindex : particles.pindices()) { rgba_f color = inputs->get("Color", 0, pindex); -colors[pindex].x = color.r; -colors[pindex].y = color.g; -colors[pindex].z = color.b; +colors[pindex] = color; } m_post_action->execute(interface); diff --git a/source/blender/simulations/bparticles/attributes.hpp b/source/blender/simulations/bparticles/attributes.hpp index 9ea8b6fcb60..1cbd2c6332c 100644 --- a/source/blender/simulations/bparticles/attributes.hpp +++ b/source/blender/simulations/bparticles/attributes.hpp @@ -18,6 +18,7 @@ using BLI::ArrayRef; using BLI::float3; using BLI::Optional; using BLI::Range; +using BLI::rgba_f; using BLI::SetVector; using BLI::StringRef; using BLI::StringRefNull; @@ -32,6 +33,7 @@ enum AttributeType { Integer, Float, Float3, + RGBA_f, }; template struct attribute_type_by_type { @@ -46,6 +48,7 @@ ATTRIBUTE_TYPE_BY_TYPE(uint8_t, Byte); ATTRIBUTE_TYPE_BY_TYPE(int32_t, Integer); ATTRIBUTE_TYPE_BY_TYPE(float, Float); ATTRIBUTE_TYPE_BY_TYPE(float3, Float3); +ATTRIBUTE_TYPE_BY_TYPE(rgba_f, RGBA_f); #undef ATTRIBUTE_TYPE_BY_TYPE @@ -65,13 +68,15 @@ inline uint size_of_attribute_type(AttributeType type) return sizeof(float); case AttributeType::Float3: return sizeof(float3); +case AttributeType::RGBA_f: + return sizeof(rgba_f); default: BLI_assert(false); return 0; }; } -#define MAX_ATTRIBUTE_SIZE sizeof(float3) +#define MAX_ATTRIBUTE_SIZE sizeof(rgba_f) struct AnyAttributeValue { char storage[MAX_ATTRIBUTE_SIZE]; diff --git a/source/blender/simulations/bparticles/c_wrapper.cpp b/source/blender/simulations/bparticles/c_wrapper.cpp index dfb3962a55c..26e082912f4 100644 --- a/source/blender/simulations/bparticles/c_wrapper.cpp +++ b/source/blender/simulations/bparticles/c_wrapper.cpp @@ -35,8 +35,8 @@ using BKE::IndexedNodeTree; using BKE::SocketWithNode; using BLI::ArrayRef; using BLI::float3; -using BLI::Vector; using BLI::StringRef; +using BLI::Vector; WRAPPERS(ParticlesState *, BParticlesState); @@ -138,7 +138,7 @@ static void distribute_tetrahedons_range(Mesh *mesh, Range range, ArrayRef centers, ArrayRef scales, - ArrayRef colors) + ArrayRef colors) { for (uint instance : range) { uint vertex_offset = instance * ARRAY_SIZE(tetrahedon_vertices); @@ -157,9 +157,9 @@ static void distribute_tetrahedons_range(Mesh *mesh, mesh->mpoly[face_offset + i].totloop = tetrahedon_loop_lengths[i]; } -float3 color_f = colors[instance]; +rgba_f color_f = colors[instance]; MLoopCol color_b = { -(uchar)(color_f.x * 255.0f), (uchar)(color_f.y * 255.0f), (uchar)(color_f.z * 255.0f)}; +(uchar)(color_f.r * 255.0f), (uchar)(color_f.g * 255.0f), (uchar)(color_f.b * 255.0f)}; for (uint i = 0; i < ARRAY_SIZE(tetrahedon_loop_vertices); i++) { mesh->mloop[loop_offset + i].v = vertex_offset + tetrahedon_loop_vertices[i]; loop_colors[loop_offset + i] = color_b; @@ -174,7 +174,7 @@ static void distribute_tetrahedons_range(Mesh *mesh, static Mesh *distribute_tetrahedons(ArrayRef centers, ArrayRef scales, -ArrayRef colors) +ArrayRef colors) { SCOPED_TIMER(__func__); @@ -237,7 +237,7 @@ Mesh *BParticles_modifier_point_mesh_from_state(BParticlesState state_c)
[Bf-blender-cvs] [4bbee4acf27] functions: new Change Particle Color node
Commit: 4bbee4acf27a1bb6948d271ef26e6949d6268571 Author: Jacques Lucke Date: Tue Jul 30 12:14:42 2019 +0200 Branches: functions https://developer.blender.org/rB4bbee4acf27a1bb6948d271ef26e6949d6268571 new Change Particle Color node === A release/scripts/startup/nodes/bparticle_nodes/change_color.py M source/blender/simulations/bparticles/actions.cpp M source/blender/simulations/bparticles/actions.hpp M source/blender/simulations/bparticles/inserters.cpp === diff --git a/release/scripts/startup/nodes/bparticle_nodes/change_color.py b/release/scripts/startup/nodes/bparticle_nodes/change_color.py new file mode 100644 index 000..2e29f85a333 --- /dev/null +++ b/release/scripts/startup/nodes/bparticle_nodes/change_color.py @@ -0,0 +1,13 @@ +import bpy +from bpy.props import * +from .. base import BParticlesNode +from .. node_builder import NodeBuilder + +class ChangeParticleColorNode(bpy.types.Node, BParticlesNode): +bl_idname = "bp_ChangeParticleColorNode" +bl_label = "Change Particle Color" + +def declaration(self, builder: NodeBuilder): +builder.control_flow_input("control_in", "(In)") +builder.fixed_input("color", "Color", "Color") +builder.control_flow_output("control_out", "(Out)") diff --git a/source/blender/simulations/bparticles/actions.cpp b/source/blender/simulations/bparticles/actions.cpp index fc2d6729ac9..6734e46b159 100644 --- a/source/blender/simulations/bparticles/actions.cpp +++ b/source/blender/simulations/bparticles/actions.cpp @@ -4,6 +4,8 @@ namespace BParticles { +using BLI::rgba_f; + void NoneAction::execute(ActionInterface (interface)) { } @@ -33,6 +35,22 @@ void ChangeDirectionAction::execute(ActionInterface ) m_post_action->execute(interface); } +void ChangeColorAction::execute(ActionInterface ) +{ + ParticleSet particles = interface.particles(); + auto colors = particles.attributes().get("Color"); + + auto inputs = m_compute_inputs->compute(interface); + for (uint pindex : particles.pindices()) { +rgba_f color = inputs->get("Color", 0, pindex); +colors[pindex].x = color.r; +colors[pindex].y = color.g; +colors[pindex].z = color.b; + } + + m_post_action->execute(interface); +} + void KillAction::execute(ActionInterface ) { interface.kill(interface.particles().pindices()); diff --git a/source/blender/simulations/bparticles/actions.hpp b/source/blender/simulations/bparticles/actions.hpp index 40656929120..8ac5081915f 100644 --- a/source/blender/simulations/bparticles/actions.hpp +++ b/source/blender/simulations/bparticles/actions.hpp @@ -28,6 +28,21 @@ class ChangeDirectionAction : public Action { void execute(ActionInterface ) override; }; +class ChangeColorAction : public Action { + private: + std::unique_ptr m_compute_inputs; + std::unique_ptr m_post_action; + + public: + ChangeColorAction(std::unique_ptr compute_inputs, +std::unique_ptr post_action) + : m_compute_inputs(std::move(compute_inputs)), m_post_action(std::move(post_action)) + { + } + + void execute(ActionInterface ) override; +}; + class ExplodeAction : public Action { private: std::string m_new_particle_name; diff --git a/source/blender/simulations/bparticles/inserters.cpp b/source/blender/simulations/bparticles/inserters.cpp index 39a1cfd509d..53420bf16fb 100644 --- a/source/blender/simulations/bparticles/inserters.cpp +++ b/source/blender/simulations/bparticles/inserters.cpp @@ -74,6 +74,19 @@ static std::unique_ptr BUILD_ACTION_change_direction( new ChangeDirectionAction(std::move(compute_inputs_fn), std::move(post_action))); } +static std::unique_ptr BUILD_ACTION_change_color( +BuildContext , +VirtualSocket *start, +VirtualSocket *trigger, +std::unique_ptr compute_inputs_fn) +{ + VirtualNode *vnode = start->vnode(); + auto post_action = build_action(ctx, vnode->output(0), trigger); + + return std::unique_ptr( + new ChangeColorAction(std::move(compute_inputs_fn), std::move(post_action))); +} + static std::unique_ptr BUILD_ACTION_explode( BuildContext , VirtualSocket *start, @@ -118,6 +131,7 @@ BLI_LAZY_INIT_STATIC(StringMap, get_action_builders) map.add_new("bp_ChangeParticleDirectionNode", BUILD_ACTION_change_direction); map.add_new("bp_ExplodeParticleNode", BUILD_ACTION_explode); map.add_new("bp_ParticleConditionNode", BUILD_ACTION_condition); + map.add_new("bp_ChangeParticleColorNode", BUILD_ACTION_change_color); return map; } ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [093583620c7] functions: new color socket type
Commit: 093583620c7500112bbee9fec1ced5ebe5c5e940 Author: Jacques Lucke Date: Tue Jul 30 12:01:00 2019 +0200 Branches: functions https://developer.blender.org/rB093583620c7500112bbee9fec1ced5ebe5c5e940 new color socket type === M release/scripts/startup/nodes/sockets.py M release/scripts/startup/nodes/types.py M source/blender/blenlib/BLI_math.hpp M source/blender/functions/frontends/data_flow_nodes/inserters/conversions.cpp M source/blender/functions/frontends/data_flow_nodes/inserters/sockets.cpp M source/blender/functions/frontends/data_flow_nodes/type_mappings.cpp M source/blender/functions/functions/lists.cpp M source/blender/functions/types/numeric.cpp M source/blender/functions/types/numeric.hpp M source/blender/functions/types/numeric_lists.cpp M source/blender/functions/types/numeric_lists.hpp === diff --git a/release/scripts/startup/nodes/sockets.py b/release/scripts/startup/nodes/sockets.py index 63886d7a6be..dee55128b56 100644 --- a/release/scripts/startup/nodes/sockets.py +++ b/release/scripts/startup/nodes/sockets.py @@ -101,6 +101,30 @@ class ObjectSocket(bpy.types.NodeSocket, DataSocket): type=bpy.types.Object, ) +def draw_property(self, layout, node, text): +layout.prop(self, "value", text=text) + +def get_state(self): +return tuple(self.value) + +def restore_state(self, state): +self.value = state + +class ColorSocket(bpy.types.NodeSocket, DataSocket): +bl_idname = "fn_ColorSocket" +bl_label = "Color Socket" +data_type = "Color" +color = (0.8, 0.8, 0.2, 1) + +value: FloatVectorProperty( +name="Value", +size=4, +default=(0.8, 0.8, 0.8, 1.0), +subtype='COLOR', +soft_min=0.0, +soft_max=0.0, +) + def draw_property(self, layout, node, text): layout.prop(self, "value", text=text) @@ -129,6 +153,8 @@ BooleanListSocket = create_simple_data_socket( "fn_BooleanListSocket", "Boolean List", (0.3, 0.3, 0.3, 0.5)) ObjectListSocket = create_simple_data_socket( "fn_ObjectListSocket", "Object List", (0, 0, 0, 0.5)) +ColorListSocket = create_simple_data_socket( +"fn_ColorListSocket", "Color List", (0.8, 0.8, 0.2, 0.5)) class EmitterSocket(bpy.types.NodeSocket, BaseSocket): bl_idname = "bp_EmitterSocket" diff --git a/release/scripts/startup/nodes/types.py b/release/scripts/startup/nodes/types.py index 9b5f52caa56..00046dbd598 100644 --- a/release/scripts/startup/nodes/types.py +++ b/release/scripts/startup/nodes/types.py @@ -8,5 +8,6 @@ type_infos.insert_data_type(s.VectorSocket, s.VectorListSocket) type_infos.insert_data_type(s.IntegerSocket, s.IntegerListSocket) type_infos.insert_data_type(s.BooleanSocket, s.BooleanListSocket) type_infos.insert_data_type(s.ObjectSocket, s.ObjectListSocket) +type_infos.insert_data_type(s.ColorSocket, s.ColorListSocket) type_infos.insert_conversion_group(["Boolean", "Integer", "Float"]) diff --git a/source/blender/blenlib/BLI_math.hpp b/source/blender/blenlib/BLI_math.hpp index acab14b5680..b2e6243cf48 100644 --- a/source/blender/blenlib/BLI_math.hpp +++ b/source/blender/blenlib/BLI_math.hpp @@ -1,5 +1,7 @@ #pragma once +#include + #include "BLI_math_vector.h" #include "BLI_math_matrix.h" @@ -36,6 +38,11 @@ struct float3 { return (float *)this; } + operator std::array() + { +return {x, y, z}; + } + float normalize_and_get_length() { return normalize_v3(*this); @@ -214,4 +221,24 @@ struct float4x4 { } }; +struct rgba_f { + float r, g, b, a; + + rgba_f() = default; + + rgba_f(float r, float g, float b, float a) : r(r), g(g), b(b), a(a) + { + } + + operator float *() + { +return + } + + operator std::array() + { +return {r, g, b, a}; + } +}; + } // namespace BLI diff --git a/source/blender/functions/frontends/data_flow_nodes/inserters/conversions.cpp b/source/blender/functions/frontends/data_flow_nodes/inserters/conversions.cpp index 06db3453b25..6bf147d4952 100644 --- a/source/blender/functions/frontends/data_flow_nodes/inserters/conversions.cpp +++ b/source/blender/functions/frontends/data_flow_nodes/inserters/conversions.cpp @@ -41,6 +41,7 @@ void register_conversion_inserters(GraphInserters ) inserters.reg_conversion_inserter("Integer", "Integer List", INSERT_base_to_list); inserters.reg_conversion_inserter("Boolean", "Boolean List", INSERT_base_to_list); inserters.reg_conversion_inserter("Object", "Object List", INSERT_base_to_list); + inserters.reg_conversion_inserter("Color", "Color List", INSERT_base_to_list); } } // namespace DataFlowNodes diff --git a/source/blender/functions/frontends/data_flow_nodes/inserters/sockets.cpp b/source/blender/functions/frontends/data_flow_nodes/inserters/sockets.cpp index
[Bf-blender-cvs] [33c29f35b82] functions: simplify the way attribute information is stored
Commit: 33c29f35b827477e4375110d0acbb7bd746d168a Author: Jacques Lucke Date: Tue Jul 30 13:27:37 2019 +0200 Branches: functions https://developer.blender.org/rB33c29f35b827477e4375110d0acbb7bd746d168a simplify the way attribute information is stored === M source/blender/simulations/bparticles/attributes.cpp M source/blender/simulations/bparticles/attributes.hpp M source/blender/simulations/bparticles/events.cpp M source/blender/simulations/bparticles/integrator.cpp M source/blender/simulations/bparticles/node_frontend.cpp M source/blender/simulations/bparticles/particles_container.cpp M source/blender/simulations/bparticles/simulate.cpp === diff --git a/source/blender/simulations/bparticles/attributes.cpp b/source/blender/simulations/bparticles/attributes.cpp index dfa8e53f467..c55c197d5ea 100644 --- a/source/blender/simulations/bparticles/attributes.cpp +++ b/source/blender/simulations/bparticles/attributes.cpp @@ -4,101 +4,27 @@ namespace BParticles { void AttributesDeclaration::join(AttributesDeclaration ) { - for (uint i = 0; i < other.m_byte_names.size(); i++) { -if (m_byte_names.add(other.m_byte_names[i])) { - m_byte_defaults.append(other.m_byte_defaults[i]); -} - } - for (uint i = 0; i < other.m_integer_names.size(); i++) { -if (m_integer_names.add(other.m_integer_names[i])) { - m_integer_defaults.append(other.m_integer_defaults[i]); -} - } - for (uint i = 0; i < other.m_float_names.size(); i++) { -if (m_float_names.add(other.m_float_names[i])) { - m_float_defaults.append(other.m_float_defaults[i]); -} - } - for (uint i = 0; i < other.m_float3_names.size(); i++) { -if (m_float3_names.add(other.m_float3_names[i])) { - m_float3_defaults.append(other.m_float3_defaults[i]); + for (uint i = 0; i < other.size(); i++) { +if (m_names.add(other.m_names[i])) { + m_types.append(other.m_types[i]); + m_defaults.append(other.m_defaults[i]); } } } void AttributesDeclaration::join(AttributesInfo ) { - for (uint i : other.byte_attributes()) { -if (m_byte_names.add(other.name_of(i).to_std_string())) { - m_byte_defaults.append(*(uint8_t *)other.default_value_ptr(i)); -} - } - for (uint i : other.integer_attributes()) { -if (m_integer_names.add(other.name_of(i).to_std_string())) { - m_integer_defaults.append(*(uint8_t *)other.default_value_ptr(i)); -} - } - for (uint i : other.float_attributes()) { -if (m_float_names.add(other.name_of(i).to_std_string())) { - m_float_defaults.append(*(float *)other.default_value_ptr(i)); -} - } - for (uint i : other.float3_attributes()) { -if (m_float3_names.add(other.name_of(i).to_std_string())) { - m_float3_defaults.append(*(float3 *)other.default_value_ptr(i)); + for (uint i = 0; i < other.size(); i++) { +if (m_names.add(other.m_names[i])) { + m_types.append(other.m_types[i]); + m_defaults.append(other.m_defaults[i]); } } } AttributesInfo::AttributesInfo(AttributesDeclaration ) -: AttributesInfo(builder.m_byte_names, - builder.m_integer_names, - builder.m_float_names, - builder.m_float3_names, - builder.m_byte_defaults, - builder.m_integer_defaults, - builder.m_float_defaults, - builder.m_float3_defaults) -{ -} - -AttributesInfo::AttributesInfo(ArrayRef byte_names, - ArrayRef integer_names, - ArrayRef float_names, - ArrayRef float3_names, - ArrayRef byte_defaults, - ArrayRef integer_defaults, - ArrayRef float_defaults, - ArrayRef float3_defaults) +: m_names(builder.m_names), m_types(builder.m_types), m_defaults(builder.m_defaults) { - BLI_assert(byte_names.size() == byte_defaults.size()); - BLI_assert(integer_names.size() == integer_defaults.size()); - BLI_assert(float_names.size() == float_defaults.size()); - BLI_assert(float3_names.size() == float3_defaults.size()); - - m_indices = {}; - m_indices.add_multiple_new(byte_names); - m_indices.add_multiple_new(integer_names); - m_indices.add_multiple_new(float_names); - m_indices.add_multiple_new(float3_names); - BLI_assert(m_indices.size() == - byte_names.size() + integer_names.size() + float_names.size() + float3_names.size()); - - m_byte_attributes = Range(0, byte_names.size()); - m_integer_attributes = m_byte_attributes.after(integer_names.size()); - m_float_attributes = m_integer_attributes.after(float_names.size()); - m_float3_attributes = m_float_attributes.after(float3_names.size()); - - m_types = {}; -
[Bf-blender-cvs] [99e5f16d4a5] functions: new Separate Color node
Commit: 99e5f16d4a57220c557cbcbb38cf9190ddfa84e9 Author: Jacques Lucke Date: Tue Jul 30 12:01:33 2019 +0200 Branches: functions https://developer.blender.org/rB99e5f16d4a57220c557cbcbb38cf9190ddfa84e9 new Separate Color node === A release/scripts/startup/nodes/function_nodes/separate_color.py M source/blender/functions/CMakeLists.txt M source/blender/functions/FN_functions.hpp M source/blender/functions/frontends/data_flow_nodes/inserters/nodes.cpp A source/blender/functions/functions/color.cpp A source/blender/functions/functions/color.hpp A source/blender/functions/functions/constants.cpp A source/blender/functions/functions/constants.hpp M source/blender/functions/functions/scalar_math.cpp M source/blender/functions/functions/scalar_math.hpp M source/blender/functions/functions/vectors.cpp M source/blender/functions/functions/vectors.hpp === diff --git a/release/scripts/startup/nodes/function_nodes/separate_color.py b/release/scripts/startup/nodes/function_nodes/separate_color.py new file mode 100644 index 000..4fa675eaf99 --- /dev/null +++ b/release/scripts/startup/nodes/function_nodes/separate_color.py @@ -0,0 +1,27 @@ +import bpy +from .. base import FunctionNode +from .. node_builder import NodeBuilder + +class SeparateColorNode(bpy.types.Node, FunctionNode): +bl_idname = "fn_SeparateColorNode" +bl_label = "Separate Color" + +use_list__color: NodeBuilder.VectorizedProperty() + +def declaration(self, builder: NodeBuilder): +builder.vectorized_input( +"color", "use_list__color", +"Color", "Colors", "Color") + +builder.vectorized_output( +"red", ["use_list__color"], +"Red", "Red", "Float") +builder.vectorized_output( +"green", ["use_list__color"], +"Green", "Green", "Float") +builder.vectorized_output( +"blue", ["use_list__color"], +"Blue", "Blue", "Float") +builder.vectorized_output( +"alpha", ["use_list__color"], +"Alpha", "Alpha", "Float") diff --git a/source/blender/functions/CMakeLists.txt b/source/blender/functions/CMakeLists.txt index b97a6677060..2378765dfc1 100644 --- a/source/blender/functions/CMakeLists.txt +++ b/source/blender/functions/CMakeLists.txt @@ -132,6 +132,10 @@ set(SRC functions/ranges.cpp functions/comparisons.hpp functions/comparisons.cpp + functions/constants.hpp + functions/constants.cpp + functions/color.hpp + functions/color.cpp frontends/data_flow_nodes/builder.hpp frontends/data_flow_nodes/builder.cpp diff --git a/source/blender/functions/FN_functions.hpp b/source/blender/functions/FN_functions.hpp index 6efb2675d94..35c5cce64e8 100644 --- a/source/blender/functions/FN_functions.hpp +++ b/source/blender/functions/FN_functions.hpp @@ -10,3 +10,5 @@ #include "functions/auto_vectorization.hpp" #include "functions/ranges.hpp" #include "functions/comparisons.hpp" +#include "functions/constants.hpp" +#include "functions/color.hpp" diff --git a/source/blender/functions/frontends/data_flow_nodes/inserters/nodes.cpp b/source/blender/functions/frontends/data_flow_nodes/inserters/nodes.cpp index a62d0950049..3a3d7ea1904 100644 --- a/source/blender/functions/frontends/data_flow_nodes/inserters/nodes.cpp +++ b/source/blender/functions/frontends/data_flow_nodes/inserters/nodes.cpp @@ -260,6 +260,16 @@ static void INSERT_separate_vector(BTreeGraphBuilder , VirtualNode *vnod builder.insert_matching_function(fn, vnode); } +static void INSERT_separate_color(BTreeGraphBuilder , VirtualNode *vnode) +{ + PointerRNA rna = vnode->rna(); + SharedFunction fn = get_vectorized_function( + Functions::GET_FN_separate_color(), + rna, + {{"use_list__color", Functions::GET_FN_output_magenta()}}); + builder.insert_matching_function(fn, vnode); +} + static SharedFunction _compare_function(int operation) { switch (operation) { @@ -303,6 +313,7 @@ void register_node_inserters(GraphInserters ) inserters.reg_node_inserter("fn_SwitchNode", INSERT_switch); inserters.reg_node_inserter("fn_ListLengthNode", INSERT_list_length); inserters.reg_node_inserter("fn_CompareNode", INSERT_compare); + inserters.reg_node_inserter("fn_SeparateColorNode", INSERT_separate_color); } } // namespace DataFlowNodes diff --git a/source/blender/functions/functions/color.cpp b/source/blender/functions/functions/color.cpp new file mode 100644 index 000..4ab223fd5a6 --- /dev/null +++ b/source/blender/functions/functions/color.cpp @@ -0,0 +1,38 @@ +#include "FN_tuple_call.hpp" +#include "FN_types.hpp" +#include "BLI_lazy_init.hpp" + +#include "color.hpp" + +namespace FN { +namespace Functions { + +using namespace Types; + +class SeparateColor : public TupleCallBody { +
[Bf-blender-cvs] [937dde60602] functions: fix wrong element size due to alignment
Commit: 937dde6060280f0728765e41a26ce7c29fcc191b Author: Jacques Lucke Date: Tue Jul 30 10:59:34 2019 +0200 Branches: functions https://developer.blender.org/rB937dde6060280f0728765e41a26ce7c29fcc191b fix wrong element size due to alignment === M source/blender/functions/backends/tuple/tuple.cpp M source/blender/functions/backends/tuple/tuple.hpp === diff --git a/source/blender/functions/backends/tuple/tuple.cpp b/source/blender/functions/backends/tuple/tuple.cpp index 509684c8cc5..63f925042b8 100644 --- a/source/blender/functions/backends/tuple/tuple.cpp +++ b/source/blender/functions/backends/tuple/tuple.cpp @@ -8,16 +8,19 @@ TupleMeta::TupleMeta(ArrayRef types) : m_types(types) m_size__data = 0; for (const SharedType : types) { CPPTypeInfo = type->extension(); +uint size = info.size(); uint alignment = info.alignment(); + m_size__data = pad_up(m_size__data, alignment); m_offsets.append(m_size__data); m_type_info.append(); -m_size__data += info.size(); +m_sizes.append(size); +m_size__data += size; + if (!info.trivially_destructible()) { m_all_trivially_destructible = false; } } - m_offsets.append(m_size__data); m_size__data_and_init = m_size__data + this->element_amount(); } diff --git a/source/blender/functions/backends/tuple/tuple.hpp b/source/blender/functions/backends/tuple/tuple.hpp index da4968ead5b..4e5fdd91e45 100644 --- a/source/blender/functions/backends/tuple/tuple.hpp +++ b/source/blender/functions/backends/tuple/tuple.hpp @@ -40,6 +40,7 @@ class TupleMeta : public RefCountedBase { Vector m_types; Vector m_type_info; Vector m_offsets; + Vector m_sizes; uint m_size__data; uint m_size__data_and_init; bool m_all_trivially_destructible; @@ -110,7 +111,7 @@ class TupleMeta : public RefCountedBase { */ uint element_size(uint index) const { -return m_offsets[index + 1] - m_offsets[index]; +return m_sizes[index]; } /** ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [d29052a5142] functions: make object an input in mesh collision event
Commit: d29052a51420c8bd56e6384d0951db29a894ed02 Author: Jacques Lucke Date: Tue Jul 30 10:59:51 2019 +0200 Branches: functions https://developer.blender.org/rBd29052a51420c8bd56e6384d0951db29a894ed02 make object an input in mesh collision event === M release/scripts/startup/nodes/bparticle_nodes/mesh_collision_event.py M source/blender/simulations/bparticles/inserters.cpp === diff --git a/release/scripts/startup/nodes/bparticle_nodes/mesh_collision_event.py b/release/scripts/startup/nodes/bparticle_nodes/mesh_collision_event.py index f79bc3fce33..d815638952e 100644 --- a/release/scripts/startup/nodes/bparticle_nodes/mesh_collision_event.py +++ b/release/scripts/startup/nodes/bparticle_nodes/mesh_collision_event.py @@ -7,14 +7,7 @@ class MeshCollisionEventNode(bpy.types.Node, BParticlesNode): bl_idname = "bp_MeshCollisionEventNode" bl_label = "Mesh Collision Event" -object: PointerProperty( -name="Object", -type=bpy.types.Object, -) - def declaration(self, builder: NodeBuilder): builder.event_input("event", "Event") +builder.fixed_input("object", "Object", "Object") builder.control_flow_output("on_event", "On event") - -def draw(self, layout): -layout.prop(self, "object", text="") diff --git a/source/blender/simulations/bparticles/inserters.cpp b/source/blender/simulations/bparticles/inserters.cpp index 8f8ffda95ee..39a1cfd509d 100644 --- a/source/blender/simulations/bparticles/inserters.cpp +++ b/source/blender/simulations/bparticles/inserters.cpp @@ -173,12 +173,18 @@ static std::unique_ptr BUILD_FORCE_turbulence( } static std::unique_ptr BUILD_EVENT_mesh_collision( -BuildContext , -VirtualNode *vnode, -std::unique_ptr UNUSED(compute_inputs_fn)) +BuildContext , VirtualNode *vnode, std::unique_ptr compute_inputs_fn) { - PointerRNA rna = vnode->rna(); - Object *object = (Object *)RNA_pointer_get(, "object").id.data; + if (compute_inputs_fn->parameter_depends_on_particle("Object", 0)) { +return {}; + } + + SharedFunction = compute_inputs_fn->function_no_deps(); + TupleCallBody = fn->body(); + FN_TUPLE_CALL_ALLOC_TUPLES(body, fn_in, fn_out); + body.call__setup_execution_context(fn_in, fn_out); + + Object *object = body.get_output(fn_out, 0, "Object"); if (object == nullptr || object->type != OB_MESH) { return {}; } ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [e41084f94ad] functions: cleanup style
Commit: e41084f94ad88d694a956242cd96503a77bca698 Author: Jacques Lucke Date: Tue Jul 30 10:20:40 2019 +0200 Branches: functions https://developer.blender.org/rBe41084f94ad88d694a956242cd96503a77bca698 cleanup style === M release/scripts/startup/nodes/bparticle_nodes/age_reached_event.py M release/scripts/startup/nodes/bparticle_nodes/change_direction.py M release/scripts/startup/nodes/bparticle_nodes/close_by_points.py M release/scripts/startup/nodes/bparticle_nodes/collision_info.py M release/scripts/startup/nodes/bparticle_nodes/condition.py M release/scripts/startup/nodes/bparticle_nodes/explode_particle.py M release/scripts/startup/nodes/bparticle_nodes/gravity_force.py M release/scripts/startup/nodes/bparticle_nodes/initial_grid_emitter.py M release/scripts/startup/nodes/bparticle_nodes/kill_particle.py M release/scripts/startup/nodes/bparticle_nodes/mesh_collision_event.py M release/scripts/startup/nodes/bparticle_nodes/mesh_emitter.py M release/scripts/startup/nodes/bparticle_nodes/particle_info.py M release/scripts/startup/nodes/bparticle_nodes/particle_type.py M release/scripts/startup/nodes/bparticle_nodes/point_emitter.py M release/scripts/startup/nodes/bparticle_nodes/trails.py M release/scripts/startup/nodes/bparticle_nodes/turbulence_force.py === diff --git a/release/scripts/startup/nodes/bparticle_nodes/age_reached_event.py b/release/scripts/startup/nodes/bparticle_nodes/age_reached_event.py index 300523a55fa..9ef2b4414a7 100644 --- a/release/scripts/startup/nodes/bparticle_nodes/age_reached_event.py +++ b/release/scripts/startup/nodes/bparticle_nodes/age_reached_event.py @@ -7,7 +7,7 @@ class AgeReachedEventNode(bpy.types.Node, BParticlesNode): bl_idname = "bp_AgeReachedEventNode" bl_label = "Age Reached Event" -def declaration(self, builder : NodeBuilder): +def declaration(self, builder: NodeBuilder): builder.event_input("event", "Event") builder.fixed_input("age", "Age", "Float", default=3) builder.control_flow_output("on_event", "On Event") diff --git a/release/scripts/startup/nodes/bparticle_nodes/change_direction.py b/release/scripts/startup/nodes/bparticle_nodes/change_direction.py index ba7be1ebaeb..aeb061c253b 100644 --- a/release/scripts/startup/nodes/bparticle_nodes/change_direction.py +++ b/release/scripts/startup/nodes/bparticle_nodes/change_direction.py @@ -7,7 +7,7 @@ class ChangeParticleDirectionNode(bpy.types.Node, BParticlesNode): bl_idname = "bp_ChangeParticleDirectionNode" bl_label = "Change Particle Direction" -def declaration(self, builder : NodeBuilder): +def declaration(self, builder: NodeBuilder): builder.control_flow_input("control_in", "(In)") builder.fixed_input("direction", "Direction", "Vector") builder.control_flow_output("control_out", "(Out)") diff --git a/release/scripts/startup/nodes/bparticle_nodes/close_by_points.py b/release/scripts/startup/nodes/bparticle_nodes/close_by_points.py index f592b7677c0..88c8637a86b 100644 --- a/release/scripts/startup/nodes/bparticle_nodes/close_by_points.py +++ b/release/scripts/startup/nodes/bparticle_nodes/close_by_points.py @@ -7,7 +7,7 @@ class CloseByPointsEventNode(bpy.types.Node, BParticlesNode): bl_idname = "bp_CloseByPointsEventNode" bl_label = "Close By Points Event" -def declaration(self, builder : NodeBuilder): +def declaration(self, builder: NodeBuilder): builder.event_input("event", "Event") builder.fixed_input("points", "Points", "Vector List") builder.fixed_input("distance", "Distance", "Float", default=1) diff --git a/release/scripts/startup/nodes/bparticle_nodes/collision_info.py b/release/scripts/startup/nodes/bparticle_nodes/collision_info.py index e59abe38014..d48ead22af1 100644 --- a/release/scripts/startup/nodes/bparticle_nodes/collision_info.py +++ b/release/scripts/startup/nodes/bparticle_nodes/collision_info.py @@ -7,5 +7,5 @@ class CollisionInfoNode(bpy.types.Node, BParticlesNode): bl_idname = "bp_CollisionInfoNode" bl_label = "Collision Info" -def declaration(self, builder : NodeBuilder): +def declaration(self, builder: NodeBuilder): builder.fixed_output("normal", "Normal", "Vector") diff --git a/release/scripts/startup/nodes/bparticle_nodes/condition.py b/release/scripts/startup/nodes/bparticle_nodes/condition.py index 87bdb64a7dd..a0fbb3af203 100644 --- a/release/scripts/startup/nodes/bparticle_nodes/condition.py +++ b/release/scripts/startup/nodes/bparticle_nodes/condition.py @@ -7,7 +7,7 @@ class ParticleConditionNode(bpy.types.Node, BParticlesNode): bl_idname = "bp_ParticleConditionNode" bl_label = "Particle Condition" -def declaration(self, builder : NodeBuilder): +def
[Bf-blender-cvs] [51be0a765e4] master: Tracking: Fix wrong usage of draw buffers
Commit: 51be0a765e44512dbc2b89ff9c3f8b225f7b7565 Author: Sergey Sharybin Date: Tue Jul 30 13:00:22 2019 +0200 Branches: master https://developer.blender.org/rB51be0a765e44512dbc2b89ff9c3f8b225f7b7565 Tracking: Fix wrong usage of draw buffers Curve drawing was attempting to draw reprojection error curve when it was not visible. Worst thing is that the imm was not informed about vertices, so the code was causing an assert in debug mode. Probably, it is also what have caused random crashes after recent changes. === M source/blender/editors/space_clip/clip_graph_draw.c === diff --git a/source/blender/editors/space_clip/clip_graph_draw.c b/source/blender/editors/space_clip/clip_graph_draw.c index f9c72741979..3f705aad89a 100644 --- a/source/blender/editors/space_clip/clip_graph_draw.c +++ b/source/blender/editors/space_clip/clip_graph_draw.c @@ -58,12 +58,16 @@ typedef struct TrackMotionCurveUserData { static void tracking_segment_point_cb(void *userdata, MovieTrackingTrack *UNUSED(track), MovieTrackingMarker *UNUSED(marker), - eClipCurveValueSource UNUSED(value_source), + eClipCurveValueSource value_source, int scene_framenr, float val) { TrackMotionCurveUserData *data = (TrackMotionCurveUserData *)userdata; + if (!clip_graph_value_visible(data->sc, value_source)) { +return; + } + immVertex2f(data->pos, scene_framenr, val); } ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [205125bc3d3] sybren-usd: Merge remote-tracking branch 'origin/master' into sybren-usd
Commit: 205125bc3d38286ac601a1824e3414a129310b97 Author: Sybren A. Stüvel Date: Tue Jul 30 12:35:31 2019 +0200 Branches: sybren-usd https://developer.blender.org/rB205125bc3d38286ac601a1824e3414a129310b97 Merge remote-tracking branch 'origin/master' into sybren-usd === === ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [edb3b7a323a] master: Fix T67274: Graph Editor Normalization broken by Keyframe that uses Easing or Dynamic interpolation
Commit: edb3b7a323a1808da9e9ab7c8b268cafc1671207 Author: Sebastian Parborg Date: Tue Jul 30 12:24:11 2019 +0200 Branches: master https://developer.blender.org/rBedb3b7a323a1808da9e9ab7c8b268cafc1671207 Fix T67274: Graph Editor Normalization broken by Keyframe that uses Easing or Dynamic interpolation We didn't include and of the newer interpolation types in the normalization function. Besides taking into account these newer types, we now also only evaluate the curves when needed. If the values between the control points won't exceed the control point values, we only use the start/end values for our normalization Reviewed By: Brecht Differential Revision: http://developer.blender.org/D5365 === M source/blender/editors/animation/anim_draw.c === diff --git a/source/blender/editors/animation/anim_draw.c b/source/blender/editors/animation/anim_draw.c index 61bf7f95340..7ab50afe3a1 100644 --- a/source/blender/editors/animation/anim_draw.c +++ b/source/blender/editors/animation/anim_draw.c @@ -422,23 +422,16 @@ static float normalization_factor_get(Scene *scene, FCurve *fcu, short flag, flo } else { const BezTriple *prev_bezt = bezt - 1; -if (prev_bezt->ipo == BEZT_IPO_CONST) { - /* Constant interpolation: previous CV value is used up - * to the current keyframe. - */ - max_coord = max_ff(max_coord, bezt->vec[1][1]); - min_coord = min_ff(min_coord, bezt->vec[1][1]); -} -else if (prev_bezt->ipo == BEZT_IPO_LIN) { - /* Linear interpolation: min/max using both previous and - * and current CV. +if (!ELEM(prev_bezt->ipo, BEZT_IPO_BEZ, BEZT_IPO_BACK, BEZT_IPO_ELASTIC)) { + /* The points on the curve will lie inside the start and end points. + * Calculate min/max using both previous and current CV. */ max_coord = max_ff(max_coord, bezt->vec[1][1]); min_coord = min_ff(min_coord, bezt->vec[1][1]); max_coord = max_ff(max_coord, prev_bezt->vec[1][1]); min_coord = min_ff(min_coord, prev_bezt->vec[1][1]); } -else if (prev_bezt->ipo == BEZT_IPO_BEZ) { +else { const int resol = fcu->driver ? 32 : min_ii((int)(5.0f * len_v2v2(bezt->vec[1], prev_bezt->vec[1])), @@ -448,30 +441,12 @@ static float normalization_factor_get(Scene *scene, FCurve *fcu, short flag, flo min_coord = min_ff(min_coord, prev_bezt->vec[1][1]); } else { -float data[120]; -float v1[2], v2[2], v3[2], v4[2]; - -v1[0] = prev_bezt->vec[1][0]; -v1[1] = prev_bezt->vec[1][1]; -v2[0] = prev_bezt->vec[2][0]; -v2[1] = prev_bezt->vec[2][1]; - -v3[0] = bezt->vec[0][0]; -v3[1] = bezt->vec[0][1]; -v4[0] = bezt->vec[1][0]; -v4[1] = bezt->vec[1][1]; - -correct_bezpart(v1, v2, v3, v4); - -BKE_curve_forward_diff_bezier( -v1[0], v2[0], v3[0], v4[0], data, resol, sizeof(float) * 3); -BKE_curve_forward_diff_bezier( -v1[1], v2[1], v3[1], v4[1], data + 1, resol, sizeof(float) * 3); - +float step_size = (bezt->vec[1][0] - prev_bezt->vec[1][0]) / resol; for (int j = 0; j <= resol; ++j) { - const float *fp = [j * 3]; - max_coord = max_ff(max_coord, fp[1]); - min_coord = min_ff(min_coord, fp[1]); + float eval_time = prev_bezt->vec[1][0] + step_size * j; + float eval_value = evaluate_fcurve_only_curve(fcu, eval_time); + max_coord = max_ff(max_coord, eval_value); + min_coord = min_ff(min_coord, eval_value); } } } ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [5662a5969b6] master: Particle: Fix incorrect access to evaluated mesh
Commit: 5662a5969b6f21f52690ce926f6b905a2757577a Author: Sergey Sharybin Date: Tue Jul 30 11:55:41 2019 +0200 Branches: master https://developer.blender.org/rB5662a5969b6f21f52690ce926f6b905a2757577a Particle: Fix incorrect access to evaluated mesh Mesh can not be requested from original object, and it can not be copied into evaluated modifier because there is no such a thing yet. It can not be done this way now, because getting evaluated object will force it to re-calculate, which kind of defeats idea of this code to preserve un-baked particles. === M source/blender/editors/physics/particle_object.c === diff --git a/source/blender/editors/physics/particle_object.c b/source/blender/editors/physics/particle_object.c index b03ec56c7e4..fcee2cde5b1 100644 --- a/source/blender/editors/physics/particle_object.c +++ b/source/blender/editors/physics/particle_object.c @@ -1090,7 +1090,6 @@ static bool copy_particle_systems_to_object(const bContext *C, ModifierData *md; ParticleSystem *psys_start = NULL, *psys, *psys_from; ParticleSystem **tmp_psys; - Mesh *final_mesh; CustomData_MeshMasks cdmask = {0}; int i, totpsys; @@ -1132,9 +1131,6 @@ static bool copy_particle_systems_to_object(const bContext *C, */ psys_start = totpsys > 0 ? tmp_psys[0] : NULL; - /* Get the evaluated mesh (psys and their modifiers have not been appended yet) */ - final_mesh = mesh_get_eval_final(depsgraph, scene, ob_to, ); - /* now append psys to the object and make modifiers */ for (i = 0, psys_from = PSYS_FROM_FIRST; i < totpsys; ++i, psys_from = PSYS_FROM_NEXT(psys_from)) { @@ -1155,10 +1151,6 @@ static bool copy_particle_systems_to_object(const bContext *C, modifier_unique_name(_to->modifiers, (ModifierData *)psmd); psmd->psys = psys; -BKE_id_copy_ex(NULL, _mesh->id, (ID **)>mesh_final, LIB_ID_COPY_LOCALIZE); - -BKE_mesh_calc_normals(psmd->mesh_final); -BKE_mesh_tessface_ensure(psmd->mesh_final); if (psys_from->edit) { copy_particle_edit(depsgraph, scene, ob_to, psys, psys_from); ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [651d8bfd98d] master: 3D View: Move selection API to a Selection engine.
Commit: 651d8bfd98db11eb58018412cc030cfe2705c519 Author: mano-wii Date: Tue Jul 30 06:46:59 2019 -0300 Branches: master https://developer.blender.org/rB651d8bfd98db11eb58018412cc030cfe2705c519 3D View: Move selection API to a Selection engine. This commit moves the API of selecting faces, vertices and edges to a DRW manager engine. Reviewers: campbellbarton, fclem Subscribers: jbakker, brecht Differential Revision: https://developer.blender.org/D5090 === M source/blender/draw/CMakeLists.txt M source/blender/draw/DRW_engine.h A source/blender/draw/engines/select/select_engine.c A source/blender/draw/engines/select/select_engine.h A source/blender/draw/engines/select/shaders/selection_id_3D_vert.glsl R061source/blender/gpu/shaders/gpu_shader_selection_id_frag.glsl source/blender/draw/engines/select/shaders/selection_id_frag.glsl M source/blender/draw/intern/draw_manager.c M source/blender/editors/include/ED_view3d.h M source/blender/editors/mesh/CMakeLists.txt M source/blender/editors/mesh/editmesh_select.c M source/blender/editors/space_view3d/view3d_draw_legacy.c M source/blender/editors/space_view3d/view3d_select.c M source/blender/gpu/CMakeLists.txt M source/blender/gpu/GPU_shader.h M source/blender/gpu/intern/gpu_shader.c D source/blender/gpu/shaders/gpu_shader_3D_selection_id_vert.glsl === diff --git a/source/blender/draw/CMakeLists.txt b/source/blender/draw/CMakeLists.txt index 8631a9f556b..664484d9a57 100644 --- a/source/blender/draw/CMakeLists.txt +++ b/source/blender/draw/CMakeLists.txt @@ -126,6 +126,7 @@ set(SRC engines/gpencil/gpencil_engine.h engines/gpencil/gpencil_render.c engines/gpencil/gpencil_shader_fx.c + engines/select/select_engine.c DRW_engine.h intern/DRW_render.h @@ -150,6 +151,7 @@ set(SRC engines/external/external_engine.h engines/workbench/workbench_engine.h engines/workbench/workbench_private.h + engines/select/select_engine.h ) set(LIB @@ -363,6 +365,9 @@ data_to_c_simple(engines/gpencil/shaders/fx/gpencil_fx_shadow_resolve_frag.glsl data_to_c_simple(engines/gpencil/shaders/fx/gpencil_fx_swirl_frag.glsl SRC) data_to_c_simple(engines/gpencil/shaders/fx/gpencil_fx_wave_frag.glsl SRC) +data_to_c_simple(engines/select/shaders/selection_id_3D_vert.glsl SRC) +data_to_c_simple(engines/select/shaders/selection_id_frag.glsl SRC) + list(APPEND INC ) diff --git a/source/blender/draw/DRW_engine.h b/source/blender/draw/DRW_engine.h index 5919e100ddd..64a02f3931b 100644 --- a/source/blender/draw/DRW_engine.h +++ b/source/blender/draw/DRW_engine.h @@ -26,6 +26,7 @@ #include "BLI_sys_types.h" /* for bool */ struct ARegion; +struct Base; struct DRWInstanceDataList; struct DRWPass; struct Depsgraph; @@ -136,19 +137,12 @@ void DRW_draw_depth_loop_gpencil(struct Depsgraph *depsgraph, void DRW_draw_depth_object(struct ARegion *ar, struct GPUViewport *viewport, struct Object *object); -void DRW_draw_select_id_object(struct Scene *scene, - struct RegionView3D *rv3d, - struct Object *ob, - short select_mode, - bool draw_facedot, - uint initial_offset, - uint *r_vert_offset, - uint *r_edge_offset, - uint *r_face_offset); - -void DRW_framebuffer_select_id_setup(struct ARegion *ar, const bool clear); -void DRW_framebuffer_select_id_release(struct ARegion *ar); -void DRW_framebuffer_select_id_read(const struct rcti *rect, uint *r_buf); +void DRW_draw_select_id(struct Depsgraph *depsgraph, +struct ARegion *ar, +struct View3D *v3d, +struct Base **bases, +const uint bases_len, +short select_mode); /* grease pencil render */ bool DRW_render_check_grease_pencil(struct Depsgraph *depsgraph); @@ -181,4 +175,20 @@ void DRW_deferred_shader_remove(struct GPUMaterial *mat); struct DrawDataList *DRW_drawdatalist_from_id(struct ID *id); void DRW_drawdata_free(struct ID *id); +/* select_engine.c */ +void DRW_select_context_create(struct Depsgraph *depsgraph, + struct Base **bases, + const uint bases_len, + short select_mode); +bool DRW_select_elem_get(const uint sel_id, uint *r_elem, uint *r_base_index, char *r_elem_type); +uint DRW_select_context_offset_for_object_elem(const uint base_index, char elem_type); +uint DRW_select_context_elem_len(void); +void DRW_framebuffer_select_id_read(const struct rcti *rect, uint *r_buf);
[Bf-blender-cvs] [a85963bed86] master: Fix T67906: empty menus for hooks if non-hook modifiers are present
Commit: a85963bed86bb25b29a70f893cc9e9279a0b9d15 Author: Philipp Oeser Date: Tue Jul 30 11:22:57 2019 +0200 Branches: master https://developer.blender.org/rBa85963bed86bb25b29a70f893cc9e9279a0b9d15 Fix T67906: empty menus for hooks if non-hook modifiers are present === 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 a94635c86f3..40e4f97a395 100644 --- a/release/scripts/startup/bl_ui/space_view3d.py +++ b/release/scripts/startup/bl_ui/space_view3d.py @@ -2746,7 +2746,7 @@ class VIEW3D_MT_hook(Menu): layout.operator("object.hook_add_selob").use_bone = False layout.operator("object.hook_add_selob", text="Hook to Selected Object Bone").use_bone = True -if [mod.type == 'HOOK' for mod in context.active_object.modifiers]: +if any([mod.type == 'HOOK' for mod in context.active_object.modifiers]): layout.separator() layout.operator_menu_enum("object.hook_assign", "modifier") ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [db0782e9460] master: Py node shader wrapper: Add clamping to official min/max values.
Commit: db0782e9460ef66a688ccb856484554da2e1e9a7 Author: Bastien Montagne Date: Tue Jul 30 11:17:01 2019 +0200 Branches: master https://developer.blender.org/rBdb0782e9460ef66a688ccb856484554da2e1e9a7 Py node shader wrapper: Add clamping to official min/max values. Taking values from relevant node definition C file... Related to T67889. === M release/scripts/modules/bpy_extras/node_shader_utils.py === diff --git a/release/scripts/modules/bpy_extras/node_shader_utils.py b/release/scripts/modules/bpy_extras/node_shader_utils.py index 01ccd51aada..0eac9794930 100644 --- a/release/scripts/modules/bpy_extras/node_shader_utils.py +++ b/release/scripts/modules/bpy_extras/node_shader_utils.py @@ -42,6 +42,13 @@ def rgb_to_rgba(rgb): def rgba_to_rgb(rgba): return Color((rgba[0], rgba[1], rgba[2])) +# All clamping value shall follow Blender's defined min/max (check relevant node definition .c file). +def values_clamp(val, minv, maxv): +if hasattr(val, "__iter__"): +return tuple(max(minv, min(maxv, v)) for v in val) +else: +return max(minv, min(maxv, val)) + class ShaderWrapper(): """ @@ -267,6 +274,7 @@ class PrincipledBSDFWrapper(ShaderWrapper): @_set_check def base_color_set(self, color): +color = values_clamp(color, 0.0, 1.0) color = rgb_to_rgba(color) self.material.diffuse_color = color if self.use_nodes and self.node_principled_bsdf is not None: @@ -297,6 +305,7 @@ class PrincipledBSDFWrapper(ShaderWrapper): @_set_check def specular_set(self, value): +value = values_clamp(value, 0.0, 1.0) self.material.specular_intensity = value if self.use_nodes and self.node_principled_bsdf is not None: self.node_principled_bsdf.inputs["Specular"].default_value = value @@ -311,6 +320,7 @@ class PrincipledBSDFWrapper(ShaderWrapper): @_set_check def specular_tint_set(self, value): +value = values_clamp(value, 0.0, 1.0) if self.use_nodes and self.node_principled_bsdf is not None: self.node_principled_bsdf.inputs["Specular Tint"].default_value = value @@ -341,6 +351,7 @@ class PrincipledBSDFWrapper(ShaderWrapper): @_set_check def roughness_set(self, value): +value = values_clamp(value, 0.0, 1.0) self.material.roughness = value if self.use_nodes and self.node_principled_bsdf is not None: self.node_principled_bsdf.inputs["Roughness"].default_value = value @@ -371,6 +382,7 @@ class PrincipledBSDFWrapper(ShaderWrapper): @_set_check def metallic_set(self, value): +value = values_clamp(value, 0.0, 1.0) self.material.metallic = value if self.use_nodes and self.node_principled_bsdf is not None: self.node_principled_bsdf.inputs["Metallic"].default_value = value @@ -401,6 +413,7 @@ class PrincipledBSDFWrapper(ShaderWrapper): @_set_check def ior_set(self, value): +value = values_clamp(value, 0.0, 1000.0) if self.use_nodes and self.node_principled_bsdf is not None: self.node_principled_bsdf.inputs["IOR"].default_value = value @@ -427,6 +440,7 @@ class PrincipledBSDFWrapper(ShaderWrapper): @_set_check def transmission_set(self, value): +value = values_clamp(value, 0.0, 1.0) if self.use_nodes and self.node_principled_bsdf is not None: self.node_principled_bsdf.inputs["Transmission"].default_value = value @@ -453,6 +467,7 @@ class PrincipledBSDFWrapper(ShaderWrapper): @_set_check def alpha_set(self, value): +value = values_clamp(value, 0.0, 1.0) if self.use_nodes and self.node_principled_bsdf is not None: self.node_principled_bsdf.inputs["Alpha"].default_value = value @@ -483,6 +498,7 @@ class PrincipledBSDFWrapper(ShaderWrapper): @_set_check def normalmap_strength_set(self, value): +value = values_clamp(value, 0.0, 10.0) if self.use_nodes and self.node_normalmap is not None: self.node_normalmap.inputs["Strength"].default_value = value ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [286c921c255] master: Tracking: Fix crash happening after removing object
Commit: 286c921c2558256ba4dc81d80bf8e693e6574217 Author: Sergey Sharybin Date: Tue Jul 30 11:11:54 2019 +0200 Branches: master https://developer.blender.org/rB286c921c2558256ba4dc81d80bf8e693e6574217 Tracking: Fix crash happening after removing object === M source/blender/editors/space_clip/tracking_ops.c === diff --git a/source/blender/editors/space_clip/tracking_ops.c b/source/blender/editors/space_clip/tracking_ops.c index d8d50ba72b5..1375b99bdaa 100644 --- a/source/blender/editors/space_clip/tracking_ops.c +++ b/source/blender/editors/space_clip/tracking_ops.c @@ -1894,6 +1894,7 @@ static int tracking_object_new_exec(bContext *C, wmOperator *UNUSED(op)) BKE_tracking_object_add(tracking, "Object"); + DEG_id_tag_update(>id, ID_RECALC_COPY_ON_WRITE); WM_event_add_notifier(C, NC_MOVIECLIP | NA_EDITED, clip); return OPERATOR_FINISHED; @@ -1932,6 +1933,7 @@ static int tracking_object_remove_exec(bContext *C, wmOperator *op) BKE_tracking_object_delete(tracking, object); + DEG_id_tag_update(>id, ID_RECALC_COPY_ON_WRITE); WM_event_add_notifier(C, NC_MOVIECLIP | NA_EDITED, clip); return OPERATOR_FINISHED; ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [58b554c7a4f] master: Fix T66591: GPencil layer visibility control via driver doesn't work
Commit: 58b554c7a4f80f57fc70b470ae793c337e4ba39e Author: Sergey Sharybin Date: Tue Jul 30 10:27:13 2019 +0200 Branches: master https://developer.blender.org/rB58b554c7a4f80f57fc70b470ae793c337e4ba39e Fix T66591: GPencil layer visibility control via driver doesn't work === M source/blender/depsgraph/intern/builder/deg_builder_rna.cc === diff --git a/source/blender/depsgraph/intern/builder/deg_builder_rna.cc b/source/blender/depsgraph/intern/builder/deg_builder_rna.cc index 5bb3ebf40c4..be494104522 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_rna.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_rna.cc @@ -279,7 +279,8 @@ RNANodeIdentifier RNANodeQuery::construct_node_identifier(const PointerRNA *ptr, } else if (RNA_struct_is_a(ptr->type, _Mesh) || RNA_struct_is_a(ptr->type, _Modifier) || RNA_struct_is_a(ptr->type, _GpencilModifier) || - RNA_struct_is_a(ptr->type, _Spline) || RNA_struct_is_a(ptr->type, _TextBox)) { + RNA_struct_is_a(ptr->type, _Spline) || RNA_struct_is_a(ptr->type, _TextBox) || + RNA_struct_is_a(ptr->type, _GPencilLayer)) { /* When modifier is used as FROM operation this is likely referencing to * the property (for example, modifier's influence). * But when it's used as TO operation, this is geometry component. */ ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [40b3c50837b] functions: Merge branch 'master' into functions
Commit: 40b3c50837bbb8795d98f7a381d864a3737e3579 Author: Jacques Lucke Date: Tue Jul 30 10:08:15 2019 +0200 Branches: functions https://developer.blender.org/rB40b3c50837bbb8795d98f7a381d864a3737e3579 Merge branch 'master' into functions === === ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [6fa47f656ef] master: Fix T67882: buttons are interrupt drag actions
Commit: 6fa47f656ef57b5ac4e14614a9225090304a329d Author: Campbell Barton Date: Tue Jul 30 17:38:18 2019 +1000 Branches: master https://developer.blender.org/rB6fa47f656ef57b5ac4e14614a9225090304a329d Fix T67882: buttons are interrupt drag actions === M source/blender/editors/interface/interface_handlers.c === diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index a7fc0cfec25..d4e8b7548bc 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -10124,7 +10124,7 @@ static int ui_handler_region_menu(bContext *C, const wmEvent *event, void *UNUSE ui_region_winrct_get_no_margin(ar_temp, ); - if (BLI_rcti_isect_pt_v(, >x)) { + if (BLI_rcti_isect_pt_v(, >x) || ui_region_find_active_but(ar_temp)) { BLI_assert(ar_temp->type->regionid == RGN_TYPE_TEMPORARY); is_inside_menu = true; ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs