[Bf-blender-cvs] [f0f7282d9d9] master: Cleanup: spelling in comments
Commit: f0f7282d9d9bb5deb6216ac95e280b24f89eb239 Author: Campbell Barton Date: Mon Jul 5 12:47:46 2021 +1000 Branches: master https://developer.blender.org/rBf0f7282d9d9bb5deb6216ac95e280b24f89eb239 Cleanup: spelling in comments === M intern/ghost/intern/GHOST_SystemCocoa.h M intern/ghost/intern/GHOST_SystemCocoa.mm M source/blender/blenkernel/intern/cloth.c M source/blender/blenkernel/intern/colortools.c M source/blender/blenkernel/intern/dynamicpaint.c M source/blender/blenkernel/intern/mesh_convert.c M source/blender/blenkernel/intern/mesh_remap.c M source/blender/blenkernel/intern/multires_reshape_smooth.c M source/blender/blenkernel/intern/shrinkwrap.c M source/blender/blenkernel/intern/softbody.c M source/blender/blenlib/intern/BLI_filelist.c M source/blender/blenlib/intern/BLI_kdopbvh.c M source/blender/blenlib/intern/noise.c M source/blender/blenlib/intern/sort.c M source/blender/depsgraph/intern/node/deg_node_component.cc M source/blender/editors/animation/anim_motion_paths.c M source/blender/editors/armature/pose_edit.c M source/blender/editors/gpencil/gpencil_fill.c M source/blender/editors/gpencil/gpencil_sculpt_paint.c M source/blender/editors/include/UI_view2d.h M source/blender/editors/interface/interface.c M source/blender/editors/interface/interface_draw.c M source/blender/editors/interface/interface_handlers.c M source/blender/editors/interface/interface_intern.h M source/blender/editors/interface/interface_layout.c M source/blender/editors/interface/interface_ops.c M source/blender/editors/interface/interface_region_popover.c M source/blender/editors/interface/interface_region_popup.c M source/blender/editors/interface/interface_templates.c M source/blender/editors/interface/interface_widgets.c M source/blender/editors/render/render_internal.c M source/blender/editors/space_action/space_action.c M source/blender/editors/space_file/filelist.c M source/blender/editors/space_outliner/outliner_select.c M source/blender/editors/space_outliner/outliner_tree.c M source/blender/editors/space_view3d/view3d_edit.c M source/blender/editors/space_view3d/view3d_view.c M source/blender/freestyle/intern/scene_graph/NodeLight.h M source/blender/freestyle/intern/view_map/Silhouette.h M source/blender/imbuf/intern/targa.c M source/blender/makesdna/DNA_action_types.h M source/blender/makesdna/DNA_fileglobal_types.h M source/blender/makesdna/DNA_fluid_types.h M source/blender/makesdna/DNA_gpencil_types.h M source/blender/makesdna/DNA_mesh_types.h M source/blender/makesdna/DNA_meshdata_types.h M source/blender/makesdna/DNA_object_types.h M source/blender/makesdna/DNA_rigidbody_types.h M source/blender/makesdna/DNA_space_types.h M source/blender/makesdna/DNA_view3d_types.h M source/blender/makesdna/intern/makesdna.c M source/blender/makesrna/intern/makesrna.c M source/blender/makesrna/intern/rna_brush.c M source/blender/makesrna/intern/rna_fluid.c M source/blender/nodes/shader/node_shader_tree.c M source/blender/python/mathutils/mathutils_Vector.c M source/blender/render/intern/bake.c M source/blender/windowmanager/intern/wm_dragdrop.c M source/blender/windowmanager/intern/wm_event_system.c === diff --git a/intern/ghost/intern/GHOST_SystemCocoa.h b/intern/ghost/intern/GHOST_SystemCocoa.h index 8a209c9efaf..088a9213373 100644 --- a/intern/ghost/intern/GHOST_SystemCocoa.h +++ b/intern/ghost/intern/GHOST_SystemCocoa.h @@ -309,7 +309,7 @@ class GHOST_SystemCocoa : public GHOST_System { /** Temporarily ignore momentum scroll events */ bool m_ignoreMomentumScroll; - /** Is the scroll wheel event generated by a multitouch trackpad or mouse? */ + /** Is the scroll wheel event generated by a multi-touch track-pad or mouse? */ bool m_multiTouchScroll; /** To prevent multiple warp, we store the time of the last warp event * and ignore mouse moved events generated before that. */ diff --git a/intern/ghost/intern/GHOST_SystemCocoa.mm b/intern/ghost/intern/GHOST_SystemCocoa.mm index 97c5652f112..218c91d05a3 100644 --- a/intern/ghost/intern/GHOST_SystemCocoa.mm +++ b/intern/ghost/intern/GHOST_SystemCocoa.mm @@ -520,7 +520,7 @@ GHOST_SystemCocoa::GHOST_SystemCocoa() sysctl(mib, 2, &boottime, &len, NULL, 0); m_start_time = ((boottime.tv_sec * 1000) + (boottime.tv_usec / 1000)); - // Detect multitouch trackpad + /* Detect multi-touch track-pad. */ mib[0] = CTL_HW; mib[1] = HW_MODEL; sysctl(mib, 2, NULL, &len, NULL, 0); diff --git a/source/blender/blenkernel/intern/cloth.c b/source/blender/blenkernel/inter
[Bf-blender-cvs] [76f7b229890] master: Cleanup: minor improvements to BMesh dissolve faces
Commit: 76f7b229890dd5d23b6683d12f743347ac0a2eef Author: Campbell Barton Date: Mon Jul 5 13:52:53 2021 +1000 Branches: master https://developer.blender.org/rB76f7b229890dd5d23b6683d12f743347ac0a2eef Cleanup: minor improvements to BMesh dissolve faces - Only create arrays with groups of two or more faces. - Remove raising exception for zero length arrays. - Remove redundant exception check (assert there is no exception). - Use a struct for face array & it's length instead of a NULL terminated array (removes the need to count faces in a loop). === M source/blender/bmesh/operators/bmo_dissolve.c === diff --git a/source/blender/bmesh/operators/bmo_dissolve.c b/source/blender/bmesh/operators/bmo_dissolve.c index 30c80d43b9c..62eaa690077 100644 --- a/source/blender/bmesh/operators/bmo_dissolve.c +++ b/source/blender/bmesh/operators/bmo_dissolve.c @@ -128,7 +128,11 @@ void bmo_dissolve_faces_exec(BMesh *bm, BMOperator *op) { BMOIter oiter; BMFace *f; - BMFace ***regions = NULL; + /* List of face arrays, the first element in each array in the length. */ + struct { +BMFace **faces; +int faces_len; + } *regions = NULL, *region; BMFace **faces = NULL; BLI_array_declare(regions); BLI_array_declare(faces); @@ -158,9 +162,6 @@ void bmo_dissolve_faces_exec(BMesh *bm, BMOperator *op) continue; } -BLI_array_clear(faces); -faces = NULL; /* Forces different allocation. */ - BMW_init(®walker, bm, BMW_ISLAND_MANIFOLD, @@ -171,46 +172,53 @@ void bmo_dissolve_faces_exec(BMesh *bm, BMOperator *op) BMW_FLAG_NOP, BMW_NIL_LAY); -for (f_iter = BMW_begin(®walker, f); f_iter; f_iter = BMW_step(®walker)) { - BLI_array_append(faces, f_iter); -} -BMW_end(®walker); +/* Check there are at least two faces before creating the array. */ +BMFace *faces_init[2]; +if ((faces_init[0] = BMW_begin(®walker, f)) && (faces_init[1] = BMW_step(®walker))) { + + BLI_assert(BLI_array_len(faces) == 0); + + BLI_array_append(faces, faces_init[0]); + BLI_array_append(faces, faces_init[1]); + + while ((f_iter = BMW_step(®walker))) { +BLI_array_append(faces, f_iter); + } + + for (i = 0; i < BLI_array_len(faces); i++) { +f_iter = faces[i]; +BMO_face_flag_disable(bm, f_iter, FACE_TAG); +BMO_face_flag_enable(bm, f_iter, FACE_ORIG); + } -for (i = 0; i < BLI_array_len(faces); i++) { - f_iter = faces[i]; - BMO_face_flag_disable(bm, f_iter, FACE_TAG); - BMO_face_flag_enable(bm, f_iter, FACE_ORIG); + region = BLI_array_append_ret(regions); + region->faces = faces; + region->faces_len = BLI_array_len(faces); + + BLI_array_clear(faces); + /* Forces a new allocation. */ + faces = NULL; } -BLI_array_append(faces, NULL); -BLI_array_append(regions, faces); +BMW_end(®walker); } /* track how many faces we should end up with */ int totface_target = bm->totface; for (i = 0; i < BLI_array_len(regions); i++) { -BMFace *f_new; -int tot = 0; +region = ®ions[i]; -faces = regions[i]; -if (!faces[0]) { - BMO_error_raise(bm, op, "Could not find boundary of dissolve region"); - goto cleanup; -} +const int faces_len = region->faces_len; +faces = region->faces; -while (faces[tot]) { - tot++; -} - -f_new = BM_faces_join(bm, faces, tot, true); - -if (f_new) { +BMFace *f_new = BM_faces_join(bm, faces, faces_len, true); +if (f_new != NULL) { /* maintain active face */ if (act_face && bm->act_face == NULL) { bm->act_face = f_new; } - totface_target -= tot - 1; + totface_target -= faces_len - 1; } else { BMO_error_raise(bm, op, "Could not create merged face"); @@ -241,18 +249,14 @@ void bmo_dissolve_faces_exec(BMesh *bm, BMOperator *op) } } - if (BMO_error_occurred(bm)) { -goto cleanup; - } + BLI_assert(!BMO_error_occurred(bm)); BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "region.out", BM_FACE, FACE_NEW); cleanup: /* free/cleanup */ for (i = 0; i < BLI_array_len(regions); i++) { -if (regions[i]) { - MEM_freeN(regions[i]); -} +MEM_freeN(regions[i].faces); } BLI_array_free(regions); ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org List details, subscription details or unsubscribe: https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [dccadc9e78e] master: Cleanup: update comment formatting
Commit: dccadc9e78eb673bcc10db1550deaef3ec66760d Author: Campbell Barton Date: Mon Jul 5 13:47:49 2021 +1000 Branches: master https://developer.blender.org/rBdccadc9e78eb673bcc10db1550deaef3ec66760d Cleanup: update comment formatting - Replace '[mce]' with "Mike Erwin". - Remove references to turn-table author as it isn't useful information, the author was credited in the commit message. === M source/blender/editors/gpencil/annotate_paint.c M source/blender/editors/gpencil/gpencil_paint.c M source/blender/editors/space_view3d/view3d_edit.c === diff --git a/source/blender/editors/gpencil/annotate_paint.c b/source/blender/editors/gpencil/annotate_paint.c index 0e2b74fea9a..7bc4c307935 100644 --- a/source/blender/editors/gpencil/annotate_paint.c +++ b/source/blender/editors/gpencil/annotate_paint.c @@ -2478,18 +2478,15 @@ static int annotation_draw_modal(bContext *C, wmOperator *op, const wmEvent *eve /* default exit state - pass through to support MMB view nav, etc. */ int estate = OPERATOR_PASS_THROUGH; - /* if (event->type == NDOF_MOTION) - *return OPERATOR_PASS_THROUGH; - * --- - * [mce] Not quite what I was looking - * for, but a good start! GP continues to - * draw on the screen while the 3D mouse - * moves the viewpoint. Problem is that - * the stroke is converted to 3D only after - * it is finished. This approach should work - * better in tools that immediately apply - * in 3D space. - */ + /* NOTE(mike erwin): Not quite what I was looking for, but a good start! + * grease-pencil continues to draw on the screen while the 3D mouse moves the viewpoint. + * Problem is that the stroke is converted to 3D only after it is finished. + * This approach should work better in tools that immediately apply in 3D space. */ +#if 0 + if (event->type == NDOF_MOTION) { +return OPERATOR_PASS_THROUGH; + } +#endif if (p->status == GP_STATUS_IDLING) { ARegion *region = CTX_wm_region(C); diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c index b638a8b8e2c..55d090bcfda 100644 --- a/source/blender/editors/gpencil/gpencil_paint.c +++ b/source/blender/editors/gpencil/gpencil_paint.c @@ -3602,18 +3602,15 @@ static int gpencil_draw_modal(bContext *C, wmOperator *op, const wmEvent *event) /* default exit state - pass through to support MMB view nav, etc. */ int estate = OPERATOR_PASS_THROUGH; - /* if (event->type == NDOF_MOTION) - *return OPERATOR_PASS_THROUGH; - * --- - * [mce] Not quite what I was looking - * for, but a good start! GP continues to - * draw on the screen while the 3D mouse - * moves the viewpoint. Problem is that - * the stroke is converted to 3D only after - * it is finished. This approach should work - * better in tools that immediately apply - * in 3D space. - */ + /* NOTE(mike erwin): Not quite what I was looking for, but a good start! + * grease-pencil continues to draw on the screen while the 3D mouse moves the viewpoint. + * Problem is that the stroke is converted to 3D only after it is finished. + * This approach should work better in tools that immediately apply in 3D space. */ +#if 0 + if (event->type == NDOF_MOTION) { +return OPERATOR_PASS_THROUGH; + } +#endif if (p->status == GP_STATUS_IDLING) { ARegion *region = CTX_wm_region(C); diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c index 86568f9c184..651ae8a3000 100644 --- a/source/blender/editors/space_view3d/view3d_edit.c +++ b/source/blender/editors/space_view3d/view3d_edit.c @@ -813,7 +813,6 @@ static void viewrotate_apply(ViewOpsData *vod, const int event_xy[2]) viewrotate_apply_dyn_ofs(vod, vod->curr.viewquat); } else { -/* New turntable view code by John Aughey */ float quat_local_x[4], quat_global_z[4]; float m[3][3]; float m_inv[3][3]; @@ -1201,7 +1200,7 @@ static void view3d_ndof_orbit(const struct wmNDOFMotionData *ndof, if (U.ndof_flag & NDOF_TURNTABLE) { float rot[3]; -/* turntable view code by John Aughey, adapted for 3D mouse by [mce] */ +/* Turntable view code adapted for 3D mouse use. */ float angle, quat[4]; float xvec[3] = {1, 0, 0}; ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org List details, subscription details or unsubscribe: https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [2929cfe5ded] master: Cleanup: remove unused defines
Commit: 2929cfe5ded3c127d6d9d5996cd591878bb5cb58 Author: Campbell Barton Date: Mon Jul 5 12:49:04 2021 +1000 Branches: master https://developer.blender.org/rB2929cfe5ded3c127d6d9d5996cd591878bb5cb58 Cleanup: remove unused defines === M source/blender/editors/include/UI_interface.h M source/blender/makesdna/DNA_constraint_types.h === diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h index 0ba214e7bf3..7a8c14d0a35 100644 --- a/source/blender/editors/include/UI_interface.h +++ b/source/blender/editors/include/UI_interface.h @@ -129,12 +129,6 @@ enum { UI_DIR_ALL = UI_DIR_UP | UI_DIR_DOWN | UI_DIR_LEFT | UI_DIR_RIGHT, }; -#if 0 -/* uiBlock->autofill (not yet used) */ -# define UI_BLOCK_COLLUMNS 1 -# define UI_BLOCK_ROWS 2 -#endif - /** #uiBlock.flag (controls) */ enum { UI_BLOCK_LOOP = 1 << 0, diff --git a/source/blender/makesdna/DNA_constraint_types.h b/source/blender/makesdna/DNA_constraint_types.h index 6531933af23..34f50b23c77 100644 --- a/source/blender/makesdna/DNA_constraint_types.h +++ b/source/blender/makesdna/DNA_constraint_types.h @@ -1196,13 +1196,6 @@ typedef enum eStretchTo_Flags { STRETCHTOCON_USE_BULGE_MAX = (1 << 1), } eStretchTo_Flags; -/* important: these defines need to match up with PHY_DynamicTypes headerfile */ -#define CONSTRAINT_RB_BALL 1 -#define CONSTRAINT_RB_HINGE 2 -#define CONSTRAINT_RB_CONETWIST 4 -#define CONSTRAINT_RB_VEHICLE 11 -#define CONSTRAINT_RB_GENERIC6DOF 12 - #ifdef __cplusplus } #endif ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org List details, subscription details or unsubscribe: https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [5b2d2b23195] master: Cleanup: remove temporary header
Commit: 5b2d2b231959b4a3a6cf9a1f9fb315630755c73a Author: Campbell Barton Date: Mon Jul 5 13:36:34 2021 +1000 Branches: master https://developer.blender.org/rB5b2d2b231959b4a3a6cf9a1f9fb315630755c73a Cleanup: remove temporary header === M intern/ghost/intern/GHOST_EventManager.cpp === diff --git a/intern/ghost/intern/GHOST_EventManager.cpp b/intern/ghost/intern/GHOST_EventManager.cpp index f16d90899b9..72101d4610f 100644 --- a/intern/ghost/intern/GHOST_EventManager.cpp +++ b/intern/ghost/intern/GHOST_EventManager.cpp @@ -28,7 +28,6 @@ #include "GHOST_EventManager.h" #include "GHOST_Debug.h" #include -#include // [mce] temp debug GHOST_EventManager::GHOST_EventManager() { ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org List details, subscription details or unsubscribe: https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [86023928ba7] soc-2021-uv-editor-improvements: UV: Increment snapping based on new UV grid types
Commit: 86023928ba794606f2372ce9f52c86c2b881041f Author: Siddhartha Jejurkar Date: Sun Jul 4 22:51:34 2021 +0530 Branches: soc-2021-uv-editor-improvements https://developer.blender.org/rB86023928ba794606f2372ce9f52c86c2b881041f UV: Increment snapping based on new UV grid types Since the default UV editor grid has been replaced with a new subdividing grid and dynamic grid (T78389) has also been implemented, increment snapping value needs to change according to the grid configuration in use. This commit ensures that the increment snapping value is changed according to the grid dimensions currently in use. Example - For a NxN grid the increment value is set as 1/N === M source/blender/editors/include/ED_image.h M source/blender/editors/space_image/image_draw.c M source/blender/editors/transform/transform.c === diff --git a/source/blender/editors/include/ED_image.h b/source/blender/editors/include/ED_image.h index aa923bcf245..a0d64037ab9 100644 --- a/source/blender/editors/include/ED_image.h +++ b/source/blender/editors/include/ED_image.h @@ -43,11 +43,12 @@ struct wmOperator; struct wmWindowManager; struct View2D; -/* image_draw.c */ +/* image_draw.c (Utility functions - should probably be moved to a BKE header) */ float ED_space_image_zoom_level(const struct View2D *v2d, const int grid_dimension); void ED_space_image_grid_steps(const int grid_dimension, float grid_steps[8], const bool is_dynamic_grid); +float ED_space_image_increment_snap_value(const float grid_steps[8], const float zoom_factor); /* image_edit.c, exported for transform */ struct Image *ED_space_image(struct SpaceImage *sima); diff --git a/source/blender/editors/space_image/image_draw.c b/source/blender/editors/space_image/image_draw.c index 5b5ec236890..88db49aaf49 100644 --- a/source/blender/editors/space_image/image_draw.c +++ b/source/blender/editors/space_image/image_draw.c @@ -1078,4 +1078,41 @@ void ED_space_image_grid_steps(const int grid_dimension, grid_steps[step] = powf(grid_dimension, step) * (1.0f / (powf(grid_dimension, 8))); } } +} + +/* Calculate the increment snapping value for UV/image editor based on the zoom factor + * The code in here (except the offset part) is used in `grid_frag.glsl` (see `grid_res`) for + * drawing the grid overlay for the UV/Image editor */ +float ED_space_image_increment_snap_value(const float grid_steps[8], const float zoom_factor) +{ + /* Small offset on each grid_steps[] so that snapping value doesn't change until grid lines are + * significantly visible. + * Offset = 3/4 * (grid_steps[i] - grid_steps[i+1]) + * + * Refer grid_frag.glsl to find out when grid lines actually start + * appearing */ + if ((grid_steps[0] - ((9 * grid_steps[0]) / (4.0f * 4.0f))) > zoom_factor) { +return grid_steps[0]; + } + else if ((grid_steps[1] - ((9 * grid_steps[1]) / (4.0f * 4.0f))) > zoom_factor) { +return grid_steps[1]; + } + else if ((grid_steps[2] - ((9 * grid_steps[2]) / (4.0f * 4.0f))) > zoom_factor) { +return grid_steps[2]; + } + else if ((grid_steps[3] - ((9 * grid_steps[3]) / (4.0f * 4.0f))) > zoom_factor) { +return grid_steps[3]; + } + else if ((grid_steps[4] - ((9 * grid_steps[4]) / (4.0f * 4.0f))) > zoom_factor) { +return grid_steps[4]; + } + else if ((grid_steps[5] - ((9 * grid_steps[5]) / (4.0f * 4.0f))) > zoom_factor) { +return grid_steps[5]; + } + else if ((grid_steps[6] - ((9 * grid_steps[6]) / (4.0f * 4.0f))) > zoom_factor) { +return grid_steps[6]; + } + else { +return grid_steps[7]; + } } \ No newline at end of file diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index 88f91d477b5..7072c06f364 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -28,6 +28,7 @@ #include "DNA_gpencil_types.h" #include "DNA_mask_types.h" #include "DNA_mesh_types.h" +#include "DNA_screen_types.h" #include "BLI_math.h" #include "BLI_rect.h" @@ -1610,8 +1611,25 @@ static void initSnapSpatial(TransInfo *t, float r_snap[2]) } } else if (t->spacetype == SPACE_IMAGE) { -r_snap[0] = 0.0625f; -r_snap[1] = 0.03125f; +/* Change the default value of 0.0625 since the UV editor grid is now dynamically subdividing + */ +SpaceImage *sima = t->area->spacedata.first; +View2D *v2d = &t->region->v2d; +/* For a NxN grid. Keep in sync with value in overay_grid.c. Could be moved to View2D or + * SpaceImage to make it global indirectly */ +int N = 4; +float zoom_factor = ED_space_image_zoom_level(v2d, N); /* Use a better name */ +float grid_steps[8]; + +if (sima->flag & SI_DYNAMIC_GRID) { + ED_space_image_grid_steps(sima->dynamic_grid_s
[Bf-blender-cvs] [64dadc542f4] fixed_width_integers: Replace integer with bool in Ghost API when only used as boolean.
Commit: 64dadc542f4608f4e5ee74b09d846ab467262831 Author: Nicholas Rishel Date: Wed Jun 16 12:47:11 2021 -0700 Branches: fixed_width_integers https://developer.blender.org/rB64dadc542f4608f4e5ee74b09d846ab467262831 Replace integer with bool in Ghost API when only used as boolean. === M intern/ghost/GHOST_C-api.h M intern/ghost/GHOST_IWindow.h M intern/ghost/intern/GHOST_C-api.cpp M intern/ghost/intern/GHOST_Window.h M intern/ghost/intern/GHOST_WindowWin32.cpp M intern/ghost/intern/GHOST_WindowWin32.h === diff --git a/intern/ghost/GHOST_C-api.h b/intern/ghost/GHOST_C-api.h index 7076748bbeb..fd5ddebac6c 100644 --- a/intern/ghost/GHOST_C-api.h +++ b/intern/ghost/GHOST_C-api.h @@ -366,7 +366,7 @@ extern GHOST_TSuccess GHOST_SetCustomCursorShape(GHOST_WindowHandle windowhandle int sizey, int hotX, int hotY, - uint8_t canInvertColor); + bool canInvertColor); /** * Returns the visibility state of the cursor. @@ -467,7 +467,7 @@ extern void GHOST_setNDOFDeadZone(float deadzone); /** * Tells if the ongoing drag'n'drop object can be accepted upon mouse drop */ -extern void GHOST_setAcceptDragOperation(GHOST_WindowHandle windowhandle, int8_t canAccept); +extern void GHOST_setAcceptDragOperation(GHOST_WindowHandle windowhandle, bool canAccept); /** * Returns the event type. @@ -667,7 +667,7 @@ extern GHOST_TSuccess GHOST_SetWindowState(GHOST_WindowHandle windowhandle, * \return Indication of success. */ extern GHOST_TSuccess GHOST_SetWindowModifiedState(GHOST_WindowHandle windowhandle, - uint8_t isUnsavedChanges); + bool isUnsavedChanges); /** * Sets the order of the window (bottom, top). @@ -903,14 +903,14 @@ extern GHOST_TSuccess GHOST_ClipRectangle(GHOST_RectangleHandle rectanglehandle, * \param selection: Boolean to return the selection instead, X11 only feature. * \return clipboard data */ -extern char *GHOST_getClipboard(int selection); +extern char *GHOST_getClipboard(bool selection); /** * Put data to the Clipboard * \param buffer: the string buffer to set. * \param selection: Set the selection instead, X11 only feature. */ -extern void GHOST_putClipboard(char *buffer, int selection); +extern void GHOST_putClipboard(char *buffer, bool selection); /** * Toggles console @@ -961,7 +961,7 @@ extern void GHOST_BeginIME(GHOST_WindowHandle windowhandle, int32_t y, int32_t w, int32_t h, - int complete); + bool complete); /** * Disable the IME attached to the given window, i.e. prohibits any user-input * events from being dispatched to the IME. diff --git a/intern/ghost/GHOST_IWindow.h b/intern/ghost/GHOST_IWindow.h index 9ca39424f5e..64dc81b6afb 100644 --- a/intern/ghost/GHOST_IWindow.h +++ b/intern/ghost/GHOST_IWindow.h @@ -349,7 +349,7 @@ class GHOST_IWindow { * - false: Move the IME windows to the given position without finishing it. */ virtual void beginIME( - int32_t x, int32_t y, int32_t w, int32_t h, int completed) = 0; + int32_t x, int32_t y, int32_t w, int32_t h, bool completed) = 0; /** * Disable the IME attached to the given window, i.e. prohibits any user-input diff --git a/intern/ghost/intern/GHOST_C-api.cpp b/intern/ghost/intern/GHOST_C-api.cpp index c1041463d7c..7d273d3409a 100644 --- a/intern/ghost/intern/GHOST_C-api.cpp +++ b/intern/ghost/intern/GHOST_C-api.cpp @@ -323,7 +323,7 @@ GHOST_TSuccess GHOST_SetCustomCursorShape(GHOST_WindowHandle windowhandle, int sizey, int hotX, int hotY, - uint8_t canInvertColor) + bool canInvertColor) { GHOST_IWindow *window = (GHOST_IWindow *)windowhandle; @@ -420,7 +420,7 @@ void GHOST_setNDOFDeadZone(float deadzone) } #endif -void GHOST_setAcceptDragOperation(GHOST_WindowHandle windowhandle, int8_t canAccept) +void GHOST_setAcceptDragOperation(GHOST_WindowHandle windowhandle, bool canAccept) { GHOST_IWindow *window = (GHOST_IWindow *)windowhandle; @@ -615,7 +615,7 @@ GHOST_TSuccess GHOST_SetWindowState(GHOST_WindowHandle windowhandle, GHOST_TWind } GHOST_TSuccess GHOST_SetWindowModifiedState(GHOST_WindowHandle windowhandle, -uint8_t isUnsavedChanges) +
[Bf-blender-cvs] [cfec49c73db] fixed_width_integers: Replace uint8* with char* in Ghost API when variable is a string.
Commit: cfec49c73dba85a74832276aa6edb8251e2ebc14 Author: Nicholas Rishel Date: Tue Jun 15 18:44:25 2021 -0700 Branches: fixed_width_integers https://developer.blender.org/rBcfec49c73dba85a74832276aa6edb8251e2ebc14 Replace uint8* with char* in Ghost API when variable is a string. === M intern/ghost/GHOST_C-api.h M intern/ghost/GHOST_ISystem.h M intern/ghost/GHOST_ISystemPaths.h M intern/ghost/GHOST_Path-api.h M intern/ghost/intern/GHOST_C-api.cpp M intern/ghost/intern/GHOST_Path-api.cpp M intern/ghost/intern/GHOST_System.h M intern/ghost/intern/GHOST_SystemCocoa.h M intern/ghost/intern/GHOST_SystemCocoa.mm M intern/ghost/intern/GHOST_SystemNULL.h M intern/ghost/intern/GHOST_SystemPaths.h M intern/ghost/intern/GHOST_SystemPathsCocoa.h M intern/ghost/intern/GHOST_SystemPathsCocoa.mm M intern/ghost/intern/GHOST_SystemPathsUnix.cpp M intern/ghost/intern/GHOST_SystemPathsUnix.h M intern/ghost/intern/GHOST_SystemPathsWin32.cpp M intern/ghost/intern/GHOST_SystemPathsWin32.h M intern/ghost/intern/GHOST_SystemSDL.cpp M intern/ghost/intern/GHOST_SystemSDL.h M intern/ghost/intern/GHOST_SystemWayland.cpp M intern/ghost/intern/GHOST_SystemWayland.h M intern/ghost/intern/GHOST_SystemWin32.cpp M intern/ghost/intern/GHOST_SystemWin32.h M intern/ghost/intern/GHOST_SystemX11.cpp M intern/ghost/intern/GHOST_SystemX11.h M source/blender/blenkernel/intern/appdir.c M source/blender/windowmanager/intern/wm_window.c === diff --git a/intern/ghost/GHOST_C-api.h b/intern/ghost/GHOST_C-api.h index 34e32832afb..7076748bbeb 100644 --- a/intern/ghost/GHOST_C-api.h +++ b/intern/ghost/GHOST_C-api.h @@ -903,14 +903,14 @@ extern GHOST_TSuccess GHOST_ClipRectangle(GHOST_RectangleHandle rectanglehandle, * \param selection: Boolean to return the selection instead, X11 only feature. * \return clipboard data */ -extern uint8_t *GHOST_getClipboard(int selection); +extern char *GHOST_getClipboard(int selection); /** * Put data to the Clipboard * \param buffer: the string buffer to set. * \param selection: Set the selection instead, X11 only feature. */ -extern void GHOST_putClipboard(int8_t *buffer, int selection); +extern void GHOST_putClipboard(char *buffer, int selection); /** * Toggles console diff --git a/intern/ghost/GHOST_ISystem.h b/intern/ghost/GHOST_ISystem.h index 2bc6f6cf987..86737589e06 100644 --- a/intern/ghost/GHOST_ISystem.h +++ b/intern/ghost/GHOST_ISystem.h @@ -431,12 +431,12 @@ class GHOST_ISystem { * \return "unsigned char" from X11 XA_CUT_BUFFER0 buffer * */ - virtual uint8_t *getClipboard(bool selection) const = 0; + virtual char *getClipboard(bool selection) const = 0; /** * Put data to the Clipboard */ - virtual void putClipboard(int8_t *buffer, bool selection) const = 0; + virtual void putClipboard(char *buffer, bool selection) const = 0; /*** * System Message Box. diff --git a/intern/ghost/GHOST_ISystemPaths.h b/intern/ghost/GHOST_ISystemPaths.h index b568a2d07fe..8298f4b78e2 100644 --- a/intern/ghost/GHOST_ISystemPaths.h +++ b/intern/ghost/GHOST_ISystemPaths.h @@ -68,26 +68,26 @@ class GHOST_ISystemPaths { * "unpack and run" path, then look for properly installed path, including versioning. * \return Unsigned char string pointing to system dir (eg /usr/share/blender/). */ - virtual const uint8_t *getSystemDir(int version, const char *versionstr) const = 0; + virtual const char *getSystemDir(int version, const char *versionstr) const = 0; /** * Determine the base dir in which user configuration is stored, including versioning. * If needed, it will create the base directory. * \return Unsigned char string pointing to user dir (eg ~/.blender/). */ - virtual const uint8_t *getUserDir(int version, const char *versionstr) const = 0; + virtual const char *getUserDir(int version, const char *versionstr) const = 0; /** * Determine a special ("well known") and easy to reach user directory. * \return Unsigned char string pointing to user dir (eg `~/Documents/`). */ - virtual const uint8_t *getUserSpecialDir(GHOST_TUserSpecialDirTypes type) const = 0; + virtual const char *getUserSpecialDir(GHOST_TUserSpecialDirTypes type) const = 0; /** * Determine the directory of the current binary * \return Unsigned char string pointing to the binary dir */ - virtual const uint8_t *getBinaryDir() const = 0; + virtual const char *getBinaryDir() const = 0; /** * Add the file to the operating system most recently used files diff --git a/intern/ghost/GHOST_Path-api.h b/intern/ghost/GHOST_Path-api.h index aae27d0a3d3..81df2e
[Bf-blender-cvs] [9f56e98e357] fixed_width_integers: Replace Ghost integral types with standard fixed width integers.
Commit: 9f56e98e357148d57d51efe0eae5045d2d193be0 Author: Nicholas Rishel Date: Tue Jun 15 18:42:51 2021 -0700 Branches: fixed_width_integers https://developer.blender.org/rB9f56e98e357148d57d51efe0eae5045d2d193be0 Replace Ghost integral types with standard fixed width integers. === M intern/ghost/GHOST_C-api.h M intern/ghost/GHOST_IEvent.h M intern/ghost/GHOST_ISystem.h M intern/ghost/GHOST_ISystemPaths.h M intern/ghost/GHOST_IWindow.h M intern/ghost/GHOST_Path-api.h M intern/ghost/GHOST_Rect.h M intern/ghost/GHOST_Types.h M intern/ghost/intern/GHOST_Buttons.h M intern/ghost/intern/GHOST_C-api.cpp M intern/ghost/intern/GHOST_DisplayManager.cpp M intern/ghost/intern/GHOST_DisplayManager.h M intern/ghost/intern/GHOST_DisplayManagerCocoa.h M intern/ghost/intern/GHOST_DisplayManagerCocoa.mm M intern/ghost/intern/GHOST_DisplayManagerNULL.h M intern/ghost/intern/GHOST_DisplayManagerSDL.cpp M intern/ghost/intern/GHOST_DisplayManagerSDL.h M intern/ghost/intern/GHOST_DisplayManagerWin32.cpp M intern/ghost/intern/GHOST_DisplayManagerWin32.h M intern/ghost/intern/GHOST_DisplayManagerX11.cpp M intern/ghost/intern/GHOST_DisplayManagerX11.h M intern/ghost/intern/GHOST_DropTargetWin32.cpp M intern/ghost/intern/GHOST_DropTargetX11.cpp M intern/ghost/intern/GHOST_Event.h M intern/ghost/intern/GHOST_EventButton.h M intern/ghost/intern/GHOST_EventCursor.h M intern/ghost/intern/GHOST_EventDragnDrop.h M intern/ghost/intern/GHOST_EventKey.h M intern/ghost/intern/GHOST_EventManager.cpp M intern/ghost/intern/GHOST_EventManager.h M intern/ghost/intern/GHOST_EventNDOF.h M intern/ghost/intern/GHOST_EventPrinter.cpp M intern/ghost/intern/GHOST_EventString.h M intern/ghost/intern/GHOST_EventTrackpad.h M intern/ghost/intern/GHOST_EventWheel.h M intern/ghost/intern/GHOST_ImeWin32.h M intern/ghost/intern/GHOST_ModifierKeys.h M intern/ghost/intern/GHOST_NDOFManager.cpp M intern/ghost/intern/GHOST_NDOFManager.h M intern/ghost/intern/GHOST_NDOFManagerCocoa.mm M intern/ghost/intern/GHOST_NDOFManagerUnix.cpp M intern/ghost/intern/GHOST_Path-api.cpp M intern/ghost/intern/GHOST_Rect.cpp M intern/ghost/intern/GHOST_System.cpp M intern/ghost/intern/GHOST_System.h M intern/ghost/intern/GHOST_SystemCocoa.h M intern/ghost/intern/GHOST_SystemCocoa.mm M intern/ghost/intern/GHOST_SystemNULL.h M intern/ghost/intern/GHOST_SystemPaths.h M intern/ghost/intern/GHOST_SystemPathsCocoa.h M intern/ghost/intern/GHOST_SystemPathsCocoa.mm M intern/ghost/intern/GHOST_SystemPathsUnix.cpp M intern/ghost/intern/GHOST_SystemPathsUnix.h M intern/ghost/intern/GHOST_SystemPathsWin32.cpp M intern/ghost/intern/GHOST_SystemPathsWin32.h M intern/ghost/intern/GHOST_SystemSDL.cpp M intern/ghost/intern/GHOST_SystemSDL.h M intern/ghost/intern/GHOST_SystemWayland.cpp M intern/ghost/intern/GHOST_SystemWayland.h M intern/ghost/intern/GHOST_SystemWin32.cpp M intern/ghost/intern/GHOST_SystemWin32.h M intern/ghost/intern/GHOST_SystemX11.cpp M intern/ghost/intern/GHOST_SystemX11.h M intern/ghost/intern/GHOST_TimerManager.cpp M intern/ghost/intern/GHOST_TimerManager.h M intern/ghost/intern/GHOST_TimerTask.h M intern/ghost/intern/GHOST_Window.cpp M intern/ghost/intern/GHOST_Window.h M intern/ghost/intern/GHOST_WindowCocoa.h M intern/ghost/intern/GHOST_WindowCocoa.mm M intern/ghost/intern/GHOST_WindowNULL.h M intern/ghost/intern/GHOST_WindowSDL.cpp M intern/ghost/intern/GHOST_WindowSDL.h M intern/ghost/intern/GHOST_WindowWayland.cpp M intern/ghost/intern/GHOST_WindowWayland.h M intern/ghost/intern/GHOST_WindowWin32.cpp M intern/ghost/intern/GHOST_WindowWin32.h M intern/ghost/intern/GHOST_WindowX11.cpp M intern/ghost/intern/GHOST_WindowX11.h M intern/ghost/intern/GHOST_Wintab.h M intern/ghost/intern/GHOST_XrAction.cpp M intern/ghost/intern/GHOST_XrAction.h M intern/ghost/intern/GHOST_XrSession.cpp M intern/ghost/intern/GHOST_XrSession.h M intern/ghost/test/gears/GHOST_C-Test.c M intern/ghost/test/gears/GHOST_Test.cpp M intern/ghost/test/multitest/EventToBuf.c M intern/ghost/test/multitest/MultiTest.c M source/blender/windowmanager/intern/wm_cursors.c M source/blender/windowmanager/intern/wm_playanim.c M source/blender/windowmanager/intern/wm_window.c === diff --git a/intern/ghost/GHOST_C-api.h b/intern/ghost/GHOST_C-api.h index 6e22d4ca3a5..34e32832afb 100644 --- a/intern/ghost/GHOST_C-api.h +++ b/intern/ghost/GHOST_C-api.
[Bf-blender-cvs] [708f375f767] soc-2021-uv-editor-improvements: Cleanup: Refactor reusable code into functions
Commit: 708f375f767f25ed2a0ada54b652d2c776e415ea Author: Siddhartha Jejurkar Date: Sun Jul 4 20:19:58 2021 +0530 Branches: soc-2021-uv-editor-improvements https://developer.blender.org/rB708f375f767f25ed2a0ada54b652d2c776e415ea Cleanup: Refactor reusable code into functions New functions for : * Calculating current zoom factor used for determining the grid resolution in UV/Image editor * Calculating grid steps for determining the grid spacings in UV/Image editor === M source/blender/draw/engines/overlay/overlay_grid.c M source/blender/editors/include/ED_image.h M source/blender/editors/space_image/image_draw.c === diff --git a/source/blender/draw/engines/overlay/overlay_grid.c b/source/blender/draw/engines/overlay/overlay_grid.c index ca4065c72ad..3077ddd4ee3 100644 --- a/source/blender/draw/engines/overlay/overlay_grid.c +++ b/source/blender/draw/engines/overlay/overlay_grid.c @@ -70,29 +70,18 @@ void OVERLAY_grid_init(OVERLAY_Data *vedata) copy_v3_fl3( shd->grid_size, (float)sima->tile_grid_shape[0], (float)sima->tile_grid_shape[1], 1.0f); -/* For a NxN grid */ +/* For a NxN grid. Keep insync with value in initSnapSpatial() inside transform.c */ int N = 4; -float xzoom = (v2d->cur.xmax - v2d->cur.xmin) / ((float)(v2d->mask.xmax - v2d->mask.xmin)); -float yzoom = (v2d->cur.ymax - v2d->cur.ymin) / ((float)(v2d->mask.ymax - v2d->mask.ymin)); -/* Calculating average of xzoom and yzoom for accuracy. Using only xzoom or yzoom would have - * been sufficient */ -shd->zoom_factor = (xzoom + yzoom) / 2.0f; -/* grid begins to appear when the length of one grid unit is at least - * (N^2) pixels in the UV/Image editor */ -shd->zoom_factor *= (N * N); +shd->zoom_factor = ED_space_image_zoom_level(v2d, N); if (sima->flag & SI_DYNAMIC_GRID) { shd->grid_flag |= DYNAMIC_GRID; - for (int step = 0; step < 8; step++) { -/* Temporary fix : dynamic_grid_size is not using the default value (=1) assignd in RNA */ -sima->dynamic_grid_size = (sima->dynamic_grid_size == 0) ? 1 : sima->dynamic_grid_size; -shd->grid_steps[step] = powf(1, step) * (1.0f / ((float)sima->dynamic_grid_size)); - } + /* Temporary fix : dynamic_grid_size is not using the default value (=1) assignd in RNA */ + sima->dynamic_grid_size = (sima->dynamic_grid_size == 0) ? 1 : sima->dynamic_grid_size; + ED_space_image_grid_steps(sima->dynamic_grid_size, shd->grid_steps, true); } else { - for (int step = 0; step < 8; step++) { -shd->grid_steps[step] = powf(N, step) * (1.0f / (powf(N, 8))); - } + ED_space_image_grid_steps(N, shd->grid_steps, false); } return; } diff --git a/source/blender/editors/include/ED_image.h b/source/blender/editors/include/ED_image.h index ec525806b81..aa923bcf245 100644 --- a/source/blender/editors/include/ED_image.h +++ b/source/blender/editors/include/ED_image.h @@ -41,6 +41,13 @@ struct SpaceImage; struct bContext; struct wmOperator; struct wmWindowManager; +struct View2D; + +/* image_draw.c */ +float ED_space_image_zoom_level(const struct View2D *v2d, const int grid_dimension); +void ED_space_image_grid_steps(const int grid_dimension, + float grid_steps[8], + const bool is_dynamic_grid); /* image_edit.c, exported for transform */ struct Image *ED_space_image(struct SpaceImage *sima); diff --git a/source/blender/editors/space_image/image_draw.c b/source/blender/editors/space_image/image_draw.c index dc693b25107..5b5ec236890 100644 --- a/source/blender/editors/space_image/image_draw.c +++ b/source/blender/editors/space_image/image_draw.c @@ -34,6 +34,7 @@ #include "DNA_scene_types.h" #include "DNA_screen_types.h" #include "DNA_space_types.h" +#include "DNA_view2d_types.h" #include "PIL_time.h" @@ -1049,3 +1050,32 @@ void draw_image_cache(const bContext *C, ARegion *region) ED_mask_draw_frames(mask, region, cfra, sfra, efra); } } + +float ED_space_image_zoom_level(const View2D *v2d, const int grid_dimension) +{ + float xzoom = (v2d->cur.xmax - v2d->cur.xmin) / ((float)(v2d->mask.xmax - v2d->mask.xmin)); + float yzoom = (v2d->cur.ymax - v2d->cur.ymin) / ((float)(v2d->mask.ymax - v2d->mask.ymin)); + /* Calculating average of xzoom and yzoom for accuracy. Using only xzoom or yzoom would have + * been sufficient */ + float zoom_factor = (xzoom + yzoom) / 2.0f; + /* grid begins to appear when the length of one grid unit is at least (N^2) pixels in the + * UV/Image editor for a (NxN grid) */ + zoom_factor *= (grid_dimension * grid_dimension); + return zoom_factor; +} + +void ED_space_image_grid_steps(const int grid_dimension, + float grid_steps[8], +
[Bf-blender-cvs] [28c85e60cb9] soc-2021-uv-editor-improvements: Cleanup: Use struct pointer
Commit: 28c85e60cb92b7a61acafd0492c0e9b9e4b36c27 Author: Siddhartha Jejurkar Date: Sun Jul 4 15:29:24 2021 +0530 Branches: soc-2021-uv-editor-improvements https://developer.blender.org/rB28c85e60cb92b7a61acafd0492c0e9b9e4b36c27 Cleanup: Use struct pointer Replace struct variables to use pointers instead === M source/blender/draw/engines/overlay/overlay_grid.c === diff --git a/source/blender/draw/engines/overlay/overlay_grid.c b/source/blender/draw/engines/overlay/overlay_grid.c index 0431168700a..ca4065c72ad 100644 --- a/source/blender/draw/engines/overlay/overlay_grid.c +++ b/source/blender/draw/engines/overlay/overlay_grid.c @@ -63,7 +63,7 @@ void OVERLAY_grid_init(OVERLAY_Data *vedata) if (pd->space_type == SPACE_IMAGE) { SpaceImage *sima = (SpaceImage *)draw_ctx->space_data; -View2D v2d = draw_ctx->region->v2d; +View2D *v2d = &draw_ctx->region->v2d; shd->grid_flag = ED_space_image_has_buffer(sima) ? 0 : PLANE_IMAGE | SHOW_GRID; shd->grid_distance = 1.0f; @@ -72,8 +72,8 @@ void OVERLAY_grid_init(OVERLAY_Data *vedata) /* For a NxN grid */ int N = 4; -float xzoom = (v2d.cur.xmax - v2d.cur.xmin) / ((float)(v2d.mask.xmax - v2d.mask.xmin)); -float yzoom = (v2d.cur.ymax - v2d.cur.ymin) / ((float)(v2d.mask.ymax - v2d.mask.ymin)); +float xzoom = (v2d->cur.xmax - v2d->cur.xmin) / ((float)(v2d->mask.xmax - v2d->mask.xmin)); +float yzoom = (v2d->cur.ymax - v2d->cur.ymin) / ((float)(v2d->mask.ymax - v2d->mask.ymin)); /* Calculating average of xzoom and yzoom for accuracy. Using only xzoom or yzoom would have * been sufficient */ shd->zoom_factor = (xzoom + yzoom) / 2.0f; ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org List details, subscription details or unsubscribe: https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [bb7d07ea197] temp-lineart-contained: LineArt: Thread isec
Commit: bb7d07ea197f8f248f8f750ba9b468f2f6499603 Author: YimingWu Date: Sun Jul 4 17:31:41 2021 +0800 Branches: temp-lineart-contained https://developer.blender.org/rBbb7d07ea197f8f248f8f750ba9b468f2f6499603 LineArt: Thread isec === M source/blender/gpencil_modifiers/intern/lineart/MOD_lineart.h M source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c === diff --git a/source/blender/gpencil_modifiers/intern/lineart/MOD_lineart.h b/source/blender/gpencil_modifiers/intern/lineart/MOD_lineart.h index 5c84f7b11d7..8e241c500d0 100644 --- a/source/blender/gpencil_modifiers/intern/lineart/MOD_lineart.h +++ b/source/blender/gpencil_modifiers/intern/lineart/MOD_lineart.h @@ -233,6 +233,9 @@ typedef struct LineartRenderBuffer { struct LineartBoundingArea *initial_bounding_areas; unsigned int bounding_area_count; + /* Array of thread_count length for spatial locks. */ + SpinLock *lock_bounding_areas; + /* When splitting bounding areas, if there's an ortho camera placed at a straight angle, there * will be a lot of triangles aligned in line which can not be separated by continue subdividing * the tile. So we set a strict limit when using ortho camera. See eLineArtTileRecursiveLimit. */ @@ -453,6 +456,8 @@ typedef struct LineartBoundingArea { /** 1,2,3,4 quadrant */ struct LineartBoundingArea *child; + SpinLock *lock; + ListBase lp; ListBase rp; ListBase up; diff --git a/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c b/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c index 412f73abffa..bfc1b3de3e0 100644 --- a/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c +++ b/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c @@ -64,6 +64,35 @@ #include "lineart_intern.h" +typedef struct LineartIsecSingle { + float v1[3], v2[3]; + LineartTriangle *tri1, *tri2; +} LineartIsecSingle; +typedef struct LineartIsecThread { + /* Thread triangle data. */ + /* Used to roughly spread the load. */ + int count_pending; + /* An array of triangle element link nodes. */ + LineartElementLinkNode **pending_triangle_nodes; + /* Count of above array. */ + int current_pending; + int max_pending; + + /* Thread intersection result data. */ + LineartIsecSingle *array; + int current; + int max; + int count_test; + + /* For individual thread reference.*/ + LineartRenderBuffer *rb; +} LineartIsecThread; +typedef struct LineartIsecData { + LineartRenderBuffer *rb; + LineartIsecThread *threads; + int thread_count; +} LineartIsecData; + static LineartBoundingArea *lineart_edge_first_bounding_area(LineartRenderBuffer *rb, LineartEdge *e); @@ -94,7 +123,9 @@ static void lineart_bounding_area_link_triangle(LineartRenderBuffer *rb, double *LRUB, int recursive, int recursive_level, -bool do_intersection); +bool do_intersection, +bool do_lock, +LineartIsecThread *th); static bool lineart_triangle_edge_image_space_occlusion(SpinLock *spl, const LineartTriangle *tri, @@ -329,7 +360,7 @@ static void lineart_bounding_area_triangle_add(LineartRenderBuffer *rb, LineartTriangle *tri) { if (ba->triangle_count >= ba->max_triangle_count) { -LineartTriangle **new_array = lineart_mem_acquire( +LineartTriangle **new_array = lineart_mem_acquire_thread( &rb->render_data_pool, sizeof(LineartTriangle *) * ba->max_triangle_count * 2); memcpy(new_array, ba->linked_triangles, sizeof(LineartTriangle *) * ba->max_triangle_count); ba->max_triangle_count *= 2; @@ -2771,6 +2802,213 @@ static LineartVert *lineart_triangle_2v_intersection_test(LineartRenderBuffer *r return result; } +static bool lineart_triangle_2v_intersection_math(LineartVert *v1, + LineartVert *v2, + LineartTriangle *tri, + LineartTriangle *t2, + float *last, + float *rv) +{ + double Lv[3]; + double Rv[3]; + double dot_l, dot_r; + LineartVert *result; + double gloc[3]; + LineartVert *l = v1, *r = v2; + + sub_v3_v3v3_db(Lv, l->gloc, t2->v[0]->gloc); + sub_v3_v3v3_db(Rv, r->gloc, t2->v[0]->gloc); + + dot_l = dot_v3v3_db(Lv, t2->gn); + dot_r = dot_v3v3_db(Rv,
[Bf-blender-cvs] [f3eb0068f7f] temp-lineart-contained: LineArt: Intersection perf.
Commit: f3eb0068f7f5adcfab2504eb7dd9b661fde59dd7 Author: YimingWu Date: Sun Jul 4 17:21:11 2021 +0800 Branches: temp-lineart-contained https://developer.blender.org/rBf3eb0068f7f5adcfab2504eb7dd9b661fde59dd7 LineArt: Intersection perf. === M source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c === diff --git a/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c b/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c index 1759f309759..412f73abffa 100644 --- a/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c +++ b/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c @@ -3869,6 +3869,11 @@ static void lineart_main_add_triangles(LineartRenderBuffer *rb) int x1, x2, y1, y2; int r, co; + double t_start; + if (G.debug_value == 4000) { +t_start = PIL_check_seconds_timer(); + } + LISTBASE_FOREACH (LineartElementLinkNode *, eln, &rb->triangle_buffer_pointers) { tri = eln->pointer; lim = eln->element_count; @@ -3893,6 +3898,11 @@ static void lineart_main_add_triangles(LineartRenderBuffer *rb) tri = (void *)(((uchar *)tri) + rb->triangle_size); } } + + if (G.debug_value == 4000) { +double t_elapsed = PIL_check_seconds_timer() - t_start; +printf("Line art intersection time: %lf\n", t_elapsed); + } } /** ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org List details, subscription details or unsubscribe: https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [16cddb290e2] soc-2021-simulation-display: Physics: enabled drawing for convex hull collision shape and corrected scale of compound child shapes
Commit: 16cddb290e28cb1c14b52985207f38600f7b6f9d Author: soumya pochiraju Date: Sun Jul 4 12:16:58 2021 +0530 Branches: soc-2021-simulation-display https://developer.blender.org/rB16cddb290e28cb1c14b52985207f38600f7b6f9d Physics: enabled drawing for convex hull collision shape and corrected scale of compound child shapes === M intern/rigidbody/rb_bullet_api.cpp M release/datafiles/locale M release/scripts/addons M release/scripts/addons_contrib M source/blender/blenkernel/intern/rigidbody.c M source/blender/draw/engines/overlay/overlay_extra.c M source/blender/draw/engines/overlay/overlay_private.h M source/blender/draw/intern/draw_cache.c M source/blender/draw/intern/draw_cache.h M source/blender/makesdna/DNA_rigidbody_types.h M source/tools === diff --git a/intern/rigidbody/rb_bullet_api.cpp b/intern/rigidbody/rb_bullet_api.cpp index cf079653678..425f65b346d 100644 --- a/intern/rigidbody/rb_bullet_api.cpp +++ b/intern/rigidbody/rb_bullet_api.cpp @@ -240,7 +240,6 @@ void RB_dworld_get_impulse(rbDynamicsWorld *world, btManifoldPoint &pt = contactManifold->getContactPoint(j); if (pt.getAppliedImpulse() > 0.f || -pt.getAppliedImpulse() > 0.f) { num_impulse_points++; - printf("getApplied:%f\n",pt.getAppliedImpulse()); } } @@ -938,6 +937,10 @@ rbCollisionShape *RB_shape_new_gimpact_mesh(rbMeshData *mesh) return shape; } +void RB_mesh_collision_shape_draw_data(rbCollisionShape *shape) { + +} + /* Compound Shape */ rbCollisionShape *RB_shape_new_compound() diff --git a/release/datafiles/locale b/release/datafiles/locale index 5ab29b1331d..78591466c33 16 --- a/release/datafiles/locale +++ b/release/datafiles/locale @@ -1 +1 @@ -Subproject commit 5ab29b1331d2103dae634b987f121c4599459d7f +Subproject commit 78591466c335ab055e11729d8af814ce7ce6edc9 diff --git a/release/scripts/addons b/release/scripts/addons index 437ce51ab70..9fa75c889fb 16 --- a/release/scripts/addons +++ b/release/scripts/addons @@ -1 +1 @@ -Subproject commit 437ce51ab70d18668b699883299ff82d9ed5f4e7 +Subproject commit 9fa75c889fb54651c83c73563397dd8c8c828443 diff --git a/release/scripts/addons_contrib b/release/scripts/addons_contrib index 7d78c8a63f2..fd1bed98c9e 16 --- a/release/scripts/addons_contrib +++ b/release/scripts/addons_contrib @@ -1 +1 @@ -Subproject commit 7d78c8a63f2f4b146f9327ddc0d567a5921b94ea +Subproject commit fd1bed98c9e0a733451168eecc828cce460205d4 diff --git a/source/blender/blenkernel/intern/rigidbody.c b/source/blender/blenkernel/intern/rigidbody.c index 5f53d198201..d25a0667540 100644 --- a/source/blender/blenkernel/intern/rigidbody.c +++ b/source/blender/blenkernel/intern/rigidbody.c @@ -38,6 +38,7 @@ #ifdef WITH_BULLET # include "RBI_api.h" +# include "RBI_hull_api.h" #endif #include "DNA_ID.h" @@ -400,6 +401,67 @@ static rbCollisionShape *rigidbody_get_shape_convexhull_from_mesh(Object *ob, return shape; } +static void rigidbody_store_convex_hull_draw_data(Object *ob) { +Mesh *hull_draw_data; + +Mesh *mesh = NULL; +MVert *mvert = NULL; +int totvert = 0; + +if (ob->type == OB_MESH && ob->data) { + mesh = rigidbody_get_mesh(ob); + mvert = (mesh) ? mesh->mvert : NULL; + totvert = (mesh) ? mesh->totvert : 0; +} +else { + CLOG_ERROR(&LOG, "cannot make Convex Hull collision shape for non-Mesh object"); +} +float (*verts)[3] = MEM_malloc_arrayN(totvert, sizeof(float)*3, __func__); +for(int i=0; i= 0 && original_index < totvert) { + +copy_v3_v3(hull_draw_data->mvert[i].co, co); + } + else { +BLI_assert(!"Unexpected new vertex in hull output"); + } +} + +uint edge_index = 0; +for (int i=0; imedge[edge_index].v1 = v_from; +hull_draw_data->medge[edge_index].v2 = v_to; +hull_draw_data->medge[edge_index].flag = ME_EDGEDRAW | ME_EDGERENDER; +edge_index++; + } +} + +ob->rigidbody_object->col_shape_draw_data = hull_draw_data; + +} /* create collision shape of mesh - triangulated mesh * returns NULL if creation fails. */ @@ -565,6 +627,7 @@ static rbCollisionShape *rigidbody_validate_sim_shape_helper(RigidBodyWorld *rbw 0.04f : 0.0f; /* RB_TODO ideally we shouldn't directly change the margin here */ } + rigidbody_store_convex_hull_draw_data(ob); break; case RB_SHAPE_TRIMESH: new_shape = rigidbody_get_shape_trimesh_from_mesh(ob); @@ -1301,6 +1364,8 @@ RigidBodyOb *BKE_rigidbody_create_object(Scene *scene, Object *ob, short type) zero_v3(rbo->vel); + rbo->col_shape_draw_data = NULL; + /* use triangle meshes for passive objects * use convex hulls for active objects since dynamic trian