[Bf-extensions-cvs] [9086b0b3] master: Cleanup: remove unused code

Brecht Van Lommel noreply at git.blender.org
Wed May 22 11:33:13 CEST 2019


Commit: 9086b0b3aa8b874b455ab32ded882fb772e42831
Author: Brecht Van Lommel
Date:   Wed May 22 11:32:39 2019 +0200
Branches: master
https://developer.blender.org/rBAC9086b0b3aa8b874b455ab32ded882fb772e42831

Cleanup: remove unused code

===================================================================

D	cacharanth/util.py
M	data_overrides/util.py

===================================================================

diff --git a/cacharanth/util.py b/cacharanth/util.py
deleted file mode 100644
index 541c6c3c..00000000
--- a/cacharanth/util.py
+++ /dev/null
@@ -1,71 +0,0 @@
-### BEGIN GPL LICENSE BLOCK #####
-#
-#  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.
-#
-# ##### END GPL LICENSE BLOCK #####
-
-# <pep8 compliant>
-
-import bpy, time, sys
-from math import *
-
-def ifloor(x):
-    return int(x) if x >= 0.0 else int(x) - 1
-
-def iceil(x):
-    return int(x) + 1 if x >= 0.0 else int(x)
-
-# based on http://code.activestate.com/recipes/578114-round-number-to-specified-number-of-significant-di/
-def round_sigfigs(num, sig_figs):
-    if num != 0:
-        return round(num, -int(floor(log10(abs(num))) - (sig_figs - 1)))
-    else:
-        return 0  # Can't take the log of 0
-
-class OperatorCallContext():
-    def __enter__(self):
-        prefs = bpy.context.preferences
-        view_layer = bpy.context.view_layer
-
-        # store active/selected state to restore it after operator execution
-        self.curact = view_layer.objects.active
-        self.cursel = { ob : ob.select_get() for ob in scene.objects }
-
-        # undo can store files a lot when running operators internally,
-        # disable since we only need one undo step after main operators anyway
-        self.use_global_undo = prefs.edit.use_global_undo
-        prefs.edit.use_global_undo = False
-
-        return (self.curact, self.cursel)
-
-    def __exit__(self, exc_type, exc_value, traceback):
-        scene = bpy.context.scene
-        prefs = bpy.context.preferences
-        view_layer = bpy.context.view_layer
-
-        # restore active/selected state
-        view_layer.objects.active = self.curact
-        for ob in scene.objects:
-            ob.select_set(self.cursel.get(ob, False))
-
-        prefs.edit.use_global_undo = self.use_global_undo
-
-def select_single_object(ob):
-    scene = bpy.context.scene
-    view_layer = bpy.context.view_layer
-
-    view_layer.objects.active = ob
-    for tob in scene.objects:
-        tob.select_set((tob == ob))
diff --git a/data_overrides/util.py b/data_overrides/util.py
index e09a1628..0c89995a 100644
--- a/data_overrides/util.py
+++ b/data_overrides/util.py
@@ -22,20 +22,6 @@ import bpy, time, sys, hashlib
 from bpy.types import UILayout
 from math import *
 
-def ifloor(x):
-    return int(x) if x >= 0.0 else int(x) - 1
-
-def iceil(x):
-    return int(x) + 1 if x >= 0.0 else int(x)
-
-# based on http://code.activestate.com/recipes/578114-round-number-to-specified-number-of-significant-di/
-def round_sigfigs(num, sig_figs):
-    if num != 0:
-        return round(num, -int(floor(log10(abs(num))) - (sig_figs - 1)))
-    else:
-        return 0  # Can't take the log of 0
-
-
 def data_uuid(id_data, path=""):
     identifier = id_data.name.encode(encoding="utf-8")
     if id_data.library:
@@ -74,41 +60,3 @@ def id_data_enum_item(id_data):
     number = id_data.as_pointer() % 0xFFFFFFFF
     identifier = str(id_data.as_pointer())
     return (identifier, id_data.name, "", UILayout.icon(id_data), number)
-
-
-class OperatorCallContext():
-    def __enter__(self):
-        scene = bpy.context.scene
-        prefs = bpy.context.preferences
-        view_layer = bpy.context.view_layer
-
-        # store active/selected state to restore it after operator execution
-        self.curact = view_layer.objects.active
-        self.cursel = { ob : ob.select_get() for ob in scene.objects }
-
-        # undo can store files a lot when running operators internally,
-        # disable since we only need one undo step after main operators anyway
-        self.use_global_undo = prefs.edit.use_global_undo
-        prefs.edit.use_global_undo = False
-
-        return (self.curact, self.cursel)
-
-    def __exit__(self, exc_type, exc_value, traceback):
-        scene = bpy.context.scene
-        prefs = bpy.context.preferences
-        view_layer = bpy.context.view_layer
-
-        # restore active/selected state
-        view_layer.objects.active = self.curact
-        for ob in scene.objects:
-            ob.select_set(self.cursel.get(ob, False))
-
-        prefs.edit.use_global_undo = self.use_global_undo
-
-def select_single_object(ob):
-    scene = bpy.context.scene
-    view_layer = bpy.context.view_layer
-
-    view_layer.objects.active = ob
-    for tob in scene.objects:
-        tob.select.set((tob == ob))



More information about the Bf-extensions-cvs mailing list