From f25618f29a65277039a11c021981dab487b96966 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 21 Dec 2012 12:16:13 +0000 Subject: make Node.links return a tuple, this may you can't do socket.links.append() by mistake. removed RNAMeta mixin class since you cant register subclasses. also some minor code cleanup --- release/scripts/modules/bpy_types.py | 18 +++++++++--------- source/blender/blenkernel/intern/object.c | 2 +- source/blender/blenlib/BLI_array.h | 4 ++-- .../operations/COM_TrackPositionOperation.cpp | 2 +- source/blender/windowmanager/intern/wm_draw.c | 2 +- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/release/scripts/modules/bpy_types.py b/release/scripts/modules/bpy_types.py index a32feda5d0c..11e1115fa4c 100644 --- a/release/scripts/modules/bpy_types.py +++ b/release/scripts/modules/bpy_types.py @@ -484,6 +484,15 @@ class Text(bpy_types.ID): if cont.type == 'PYTHON'] ) +class NodeSocket(StructRNA): # , metaclass=RNAMeta + __slots__ = () + + @property + def links(self): + """List of node links from or to this socket""" + return tuple(link for link in self.id_data.links if link.from_socket == self or link.to_socket == self) + + # values are module: [(cls, path, line), ...] TypeMap = {} @@ -717,12 +726,3 @@ class Menu(StructRNA, _GenericUI, metaclass=RNAMeta): self.path_menu(bpy.utils.preset_paths(self.preset_subdir), self.preset_operator, filter_ext=lambda ext: ext.lower() in {".py", ".xml"}) - - -class NodeSocket(StructRNA, metaclass=RNAMeta): - __slots__ = () - - @property - def links(self): - """List of node links from or to this socket""" - return [link for link in self.id_data.links if link.from_socket == self or link.to_socket == self] diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index f9bbf0dcc53..8826f86d72a 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -1925,7 +1925,7 @@ static void give_parvert(Object *par, int nr, float vec[3]) } else if (ELEM(par->type, OB_CURVE, OB_SURF)) { Curve *cu = par->data; - ListBase *nurb = BKE_curve_nurbs_get(cu);; + ListBase *nurb = BKE_curve_nurbs_get(cu); BKE_nurbList_index_get_co(nurb, nr, vec); } diff --git a/source/blender/blenlib/BLI_array.h b/source/blender/blenlib/BLI_array.h index 6d34b0d48d5..7c8816cb58a 100644 --- a/source/blender/blenlib/BLI_array.h +++ b/source/blender/blenlib/BLI_array.h @@ -106,8 +106,8 @@ ((arr = (void *)_##arr##_static), (_##arr##_count += (num))) \ : \ /* use existing static array or allocate */ \ - ((BLI_array_totalsize(arr) >= _##arr##_count + num) ? \ - (_##arr##_count += num) : \ + (LIKELY(BLI_array_totalsize(arr) >= _##arr##_count + num) ? \ + (_##arr##_count += num) : /* UNLIKELY --> realloc */ \ ( \ (void) (_##arr##_tmp = MEM_callocN( \ sizeof(*arr) * (num < _##arr##_count ? \ diff --git a/source/blender/compositor/operations/COM_TrackPositionOperation.cpp b/source/blender/compositor/operations/COM_TrackPositionOperation.cpp index 8b5288321c1..e647ae975ff 100644 --- a/source/blender/compositor/operations/COM_TrackPositionOperation.cpp +++ b/source/blender/compositor/operations/COM_TrackPositionOperation.cpp @@ -42,7 +42,7 @@ TrackPositionOperation::TrackPositionOperation() : NodeOperation() this->m_trackingObjectName[0] = 0; this->m_trackName[0] = 0; this->m_axis = 0; - this->m_position = POSITION_ABSOLUTE;; + this->m_position = POSITION_ABSOLUTE; this->m_relativeFrame = 0; } diff --git a/source/blender/windowmanager/intern/wm_draw.c b/source/blender/windowmanager/intern/wm_draw.c index 11cf1088280..dbd722c80dd 100644 --- a/source/blender/windowmanager/intern/wm_draw.c +++ b/source/blender/windowmanager/intern/wm_draw.c @@ -796,7 +796,7 @@ void wm_draw_update(bContext *C) GPU_free_unused_buffers(); for (win = wm->windows.first; win; win = win->next) { - int state = GHOST_GetWindowState(win->ghostwin);; + int state = GHOST_GetWindowState(win->ghostwin); if (state == GHOST_kWindowStateMinimized) { /* do not update minimized windows, it gives issues on intel drivers (see [#33223]) -- cgit v1.2.3