Minor clean-up
This commit is contained in:
@@ -1,4 +1,3 @@
|
|||||||
import datetime
|
|
||||||
import re
|
import re
|
||||||
import typing
|
import typing
|
||||||
from collections import Counter
|
from collections import Counter
|
||||||
@@ -9,24 +8,6 @@ import bpy.types
|
|||||||
from bpy.types import NlaStrip, Object, AnimData
|
from bpy.types import NlaStrip, Object, AnimData
|
||||||
|
|
||||||
|
|
||||||
class Timer:
|
|
||||||
def __enter__(self):
|
|
||||||
self.start = datetime.datetime.now()
|
|
||||||
self.interval = None
|
|
||||||
return self
|
|
||||||
|
|
||||||
def __exit__(self, *args):
|
|
||||||
self.end = datetime.datetime.now()
|
|
||||||
self.interval = self.end - self.start
|
|
||||||
|
|
||||||
@property
|
|
||||||
def duration(self):
|
|
||||||
if self.interval is not None:
|
|
||||||
return self.interval
|
|
||||||
else:
|
|
||||||
return datetime.datetime.now() - self.start
|
|
||||||
|
|
||||||
|
|
||||||
def rgb_to_srgb(c: float):
|
def rgb_to_srgb(c: float):
|
||||||
if c > 0.0031308:
|
if c > 0.0031308:
|
||||||
return 1.055 * (pow(c, (1.0 / 2.4))) - 0.055
|
return 1.055 * (pow(c, (1.0 / 2.4))) - 0.055
|
||||||
@@ -143,7 +124,7 @@ def get_export_bone_names(armature_object: Object, bone_filter_mode: str, bone_g
|
|||||||
|
|
||||||
# Split out the bone indices and the instigator bone names into separate lists.
|
# Split out the bone indices and the instigator bone names into separate lists.
|
||||||
# We use the bone names for the return values because the bone name is a more universal way of referencing them.
|
# We use the bone names for the return values because the bone name is a more universal way of referencing them.
|
||||||
# For example, users of this function may modify bone lists, which would invalidate the indices and require a
|
# For example, users of this function may modify bone lists, which would invalidate the indices and require an
|
||||||
# index mapping scheme to resolve it. Using strings is more comfy and results in less code downstream.
|
# index mapping scheme to resolve it. Using strings is more comfy and results in less code downstream.
|
||||||
instigator_bone_names = [bones[x[1]].name if x[1] is not None else None for x in bone_indices]
|
instigator_bone_names = [bones[x[1]].name if x[1] is not None else None for x in bone_indices]
|
||||||
bone_names = [bones[x[0]].name for x in bone_indices]
|
bone_names = [bones[x[0]].name for x in bone_indices]
|
||||||
|
|||||||
@@ -131,7 +131,7 @@ def import_psk(psk: Psk, context, options: PskImportOptions) -> PskImportResult:
|
|||||||
# Material already exists, just re-use it.
|
# Material already exists, just re-use it.
|
||||||
material = bpy.data.materials[material_name]
|
material = bpy.data.materials[material_name]
|
||||||
elif is_bdk_addon_loaded() and psk.has_material_references:
|
elif is_bdk_addon_loaded() and psk.has_material_references:
|
||||||
# Material does not yet exist and we have the BDK addon installed.
|
# Material does not yet exist, and we have the BDK addon installed.
|
||||||
# Attempt to load it using BDK addon's operator.
|
# Attempt to load it using BDK addon's operator.
|
||||||
material_reference = psk.material_references[material_index]
|
material_reference = psk.material_references[material_index]
|
||||||
if material_reference and bpy.ops.bdk.link_material(reference=material_reference) == {'FINISHED'}:
|
if material_reference and bpy.ops.bdk.link_material(reference=material_reference) == {'FINISHED'}:
|
||||||
|
|||||||
Reference in New Issue
Block a user