refactor: cleanup

This commit is contained in:
Swann
2020-03-27 18:18:36 +01:00
parent ef9e9dbae8
commit 289a49251e
3 changed files with 10 additions and 11 deletions
+6 -5
View File
@@ -19,14 +19,12 @@
import bpy
import mathutils
import copy
import logging
import numpy as np
from enum import Enum
from .. import utils
from .bl_datablock import BlDatablock
logger = logging.getLogger(__name__)
ENUM_EASING_TYPE = [
'AUTO',
@@ -34,6 +32,7 @@ ENUM_EASING_TYPE = [
'EASE_OUT',
'EASE_IN_OUT']
ENUM_HANDLE_TYPE = [
'FREE',
'ALIGNED',
@@ -41,6 +40,7 @@ ENUM_HANDLE_TYPE = [
'AUTO',
'AUTO_CLAMPED']
ENUM_INTERPOLATION_TYPE = [
'CONSTANT',
'LINEAR',
@@ -56,6 +56,7 @@ ENUM_INTERPOLATION_TYPE = [
'BOUNCE',
'ELASTIC']
ENUM_KEY_TYPE = [
'KEYFRAME',
'BREAKDOWN',
@@ -63,8 +64,10 @@ ENUM_KEY_TYPE = [
'EXTREME',
'JITTER']
#TODO: Automatic enum and numpy dump and loading
def dump_fcurve(fcurve, use_numpy=True):
""" Dump a sigle curve to a dict
@@ -218,7 +221,6 @@ class BlAction(BlDatablock):
target.id_root = data['id_root']
def _dump(self, pointer=None):
start = utils.current_milli_time()
assert(pointer)
dumper = utils.dump_anything.Dumper()
dumper.exclude_filter = [
@@ -241,7 +243,6 @@ class BlAction(BlDatablock):
for fcurve in self.pointer.fcurves:
data["fcurves"].append(dump_fcurve(fcurve, use_numpy=True))
logger.error(
f"{self.pointer.name} dumping time: {utils.current_milli_time()-start} ms")
return data
-2
View File
@@ -23,8 +23,6 @@ from .. import utils
from .. import presence, operators
from .bl_datablock import BlDatablock
# WIP
class BlArmature(BlDatablock):
bl_id = "armatures"
+4 -4
View File
@@ -33,16 +33,16 @@ class BlLightprobe(BlDatablock):
bl_automatic_push = True
bl_icon = 'LIGHTPROBE_GRID'
def load_implementation(self, data, target):
utils.dump_anything.load(target, data)
def _construct(self, data):
type = 'CUBE' if data['type'] == 'CUBEMAP' else data['type']
# See https://developer.blender.org/D6396
if bpy.app.version[1] >= 83:
return bpy.data.lightprobes.new(data["name"], type)
else:
logger.warning("Lightprobe replication only supported since 2.83. See https://developer.blender.org/D6396")
logger.warning("Lightprobe replication only supported since 2.83. See https://developer.blender.org/D6396")
def load_implementation(self, data, target):
utils.dump_anything.load(target, data)
def dump_implementation(self, data, pointer=None):
assert(pointer)