Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2019-05-23 09:33:21 +0300
committerCampbell Barton <ideasman42@gmail.com>2019-05-23 09:33:21 +0300
commitad80dc1c89c61c2f091e41269ab195ccaa1e048f (patch)
tree4b7061b4cf370e9509cc4ef928d4da07cf639060 /source/blender/windowmanager/gizmo/intern/wm_gizmo_group.c
parenta521ad756848114b4e1be90f46b7c6799fb562f7 (diff)
Cleanup: replace the visible gizmo linked list with an array
Avoids an allocation per gizmo & simplifies limiting the lookup past the first intersecting 2D gizmo found.
Diffstat (limited to 'source/blender/windowmanager/gizmo/intern/wm_gizmo_group.c')
-rw-r--r--source/blender/windowmanager/gizmo/intern/wm_gizmo_group.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/source/blender/windowmanager/gizmo/intern/wm_gizmo_group.c b/source/blender/windowmanager/gizmo/intern/wm_gizmo_group.c
index 5aecab122a2..9f0793fc742 100644
--- a/source/blender/windowmanager/gizmo/intern/wm_gizmo_group.c
+++ b/source/blender/windowmanager/gizmo/intern/wm_gizmo_group.c
@@ -31,6 +31,7 @@
#include "MEM_guardedalloc.h"
+#include "BLI_buffer.h"
#include "BLI_listbase.h"
#include "BLI_string.h"
#include "BLI_math.h"
@@ -191,14 +192,15 @@ wmGizmo *wm_gizmogroup_find_intersected_gizmo(const wmGizmoGroup *gzgroup,
* Adds all gizmos of \a gzgroup that can be selected to the head of \a listbase.
* Added items need freeing!
*/
-void wm_gizmogroup_intersectable_gizmos_to_list(const wmGizmoGroup *gzgroup, ListBase *listbase)
+void wm_gizmogroup_intersectable_gizmos_to_list(const wmGizmoGroup *gzgroup,
+ BLI_Buffer *visible_gizmos)
{
for (wmGizmo *gz = gzgroup->gizmos.first; gz; gz = gz->next) {
if ((gz->flag & (WM_GIZMO_HIDDEN | WM_GIZMO_HIDDEN_SELECT)) == 0) {
if (((gzgroup->type->flag & WM_GIZMOGROUPTYPE_3D) &&
(gz->type->draw_select || gz->type->test_select)) ||
((gzgroup->type->flag & WM_GIZMOGROUPTYPE_3D) == 0 && gz->type->test_select)) {
- BLI_addhead(listbase, BLI_genericNodeN(gz));
+ BLI_buffer_append(visible_gizmos, wmGizmo *, gz);
}
}
}