glTF: code cleanup - remove no more needed import

This commit is contained in:
Julien Duroure 2020-05-04 18:34:59 +02:00
parent b72a6c0579
commit 0372ff2ba7
25 changed files with 12 additions and 37 deletions

View File

@ -15,7 +15,7 @@
bl_info = {
'name': 'glTF 2.0 format',
'author': 'Julien Duroure, Norbert Nopper, Urs Hanselmann, Moritz Becher, Benjamin Schmithüsen, Jim Eckerlein, and many external contributors',
"version": (1, 2, 73),
"version": (1, 2, 74),
'blender': (2, 83, 9),
'location': 'File > Import-Export',
'description': 'Import-Export as glTF 2.0',

View File

@ -12,8 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from mathutils import Matrix, Quaternion
from math import sqrt, sin, cos
from math import sin, cos
def texture_transform_blender_to_gltf(mapping_transform):
"""

View File

@ -89,5 +89,5 @@ def set_extras(blender_element, extras, exclude=[]):
try:
blender_element[custom_property] = value
except TypeError as e:
except TypeError:
print('Error setting property %s to value of type %s' % (custom_property, type(value)))

View File

@ -12,7 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import bpy
import typing
import math
from mathutils import Matrix, Vector, Quaternion, Euler
@ -171,6 +170,7 @@ def round_if_near(value: float, target: float) -> float:
"""If value is very close to target, round to target."""
return value if abs(value - target) > 2.0e-6 else target
def scale_rot_swap_matrix(rot):
"""Returns a matrix m st. Scale[s] Rot[rot] = Rot[rot] Scale[m s].
If rot.to_matrix() is a signed permutation matrix, works for any s.
@ -183,6 +183,7 @@ def scale_rot_swap_matrix(rot):
m[i][j] = abs(m[i][j]) # discard sign
return m
def nearby_signed_perm_matrix(rot):
"""Returns a signed permutation matrix close to rot.to_matrix().
(A signed permutation matrix is like a permutation matrix, except

View File

@ -24,7 +24,6 @@ from . import gltf2_blender_export_keys
from ...io.com.gltf2_io_debug import print_console
from ...io.com.gltf2_io_color_management import color_srgb_to_scene_linear
from io_scene_gltf2.blender.exp import gltf2_blender_gather_skins
import bpy
#
# Globals

View File

@ -13,14 +13,10 @@
# limitations under the License.
import typing
import bpy
from io_scene_gltf2.blender.exp.gltf2_blender_gather_cache import cached
from io_scene_gltf2.io.com import gltf2_io
from io_scene_gltf2.io.com import gltf2_io_constants
from io_scene_gltf2.io.exp import gltf2_io_binary_data
from . import gltf2_blender_export_keys
@cached

View File

@ -19,7 +19,6 @@ import typing
from io_scene_gltf2.blender.exp.gltf2_blender_gather_cache import cached, bonecache
from io_scene_gltf2.blender.com import gltf2_blender_math
from io_scene_gltf2.blender.exp import gltf2_blender_get
from io_scene_gltf2.blender.exp import gltf2_blender_extract
from io_scene_gltf2.blender.exp.gltf2_blender_gather_drivers import get_sk_drivers, get_sk_driver_values
from . import gltf2_blender_export_keys
from io_scene_gltf2.io.com import gltf2_io_debug

View File

@ -12,7 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from . import gltf2_blender_export_keys
from io_scene_gltf2.blender.exp.gltf2_blender_gather_cache import cached
from ..com.gltf2_blender_extras import generate_extras
from io_scene_gltf2.io.com import gltf2_io

View File

@ -13,8 +13,6 @@
# limitations under the License.
from io_scene_gltf2.blender.exp import gltf2_blender_gather_nodes
from io_scene_gltf2.blender.com import gltf2_blender_conversion
from io_scene_gltf2.blender.exp.gltf2_blender_gather_cache import skdriverdiscovercache, skdrivervalues
from io_scene_gltf2.blender.com.gltf2_blender_data_path import get_target_object_path

View File

@ -11,12 +11,10 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import re
import bpy
import typing
import os
import numpy as np
from . import gltf2_blender_export_keys
from io_scene_gltf2.io.com import gltf2_io

View File

@ -17,7 +17,6 @@ import mathutils
from . import gltf2_blender_export_keys
from io_scene_gltf2.blender.exp.gltf2_blender_gather_cache import cached
from io_scene_gltf2.io.com import gltf2_io
from io_scene_gltf2.io.com import gltf2_io_debug
from io_scene_gltf2.blender.exp import gltf2_blender_extract
from io_scene_gltf2.blender.com import gltf2_blender_math
from io_scene_gltf2.blender.exp import gltf2_blender_gather_skins

View File

@ -18,7 +18,6 @@ from io_scene_gltf2.blender.exp.gltf2_blender_gather_cache import cached
from io_scene_gltf2.io.com import gltf2_io
from io_scene_gltf2.blender.exp import gltf2_blender_gather_texture
from io_scene_gltf2.blender.exp import gltf2_blender_search_node_tree
from io_scene_gltf2.blender.exp import gltf2_blender_export_keys
from io_scene_gltf2.blender.exp import gltf2_blender_get
from io_scene_gltf2.io.com.gltf2_io_extensions import Extension
from io_scene_gltf2.io.exp.gltf2_io_user_extensions import export_user_extensions

View File

@ -13,7 +13,6 @@
# limitations under the License.
import bpy
from mathutils import Color
from io_scene_gltf2.io.com import gltf2_io
from io_scene_gltf2.blender.exp import gltf2_blender_gather_texture_info, gltf2_blender_search_node_tree

View File

@ -12,7 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import bpy
from ...io.com.gltf2_io import TextureInfo
from .gltf2_blender_pbrMetallicRoughness import \
base_color, emission, normal, occlusion, make_output_nodes, make_settings_node

View File

@ -12,7 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import bpy
from .gltf2_blender_pbrMetallicRoughness import base_color, make_output_nodes

View File

@ -12,8 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import bpy
from .gltf2_blender_animation_node import BlenderNodeAnim
from .gltf2_blender_animation_weight import BlenderWeightAnim
from .gltf2_blender_animation_utils import simulate_stash, restore_animation_on_object

View File

@ -16,7 +16,7 @@ import json
import bpy
from ...io.imp.gltf2_io_binary import BinaryData
from .gltf2_blender_animation_utils import simulate_stash, make_fcurve
from .gltf2_blender_animation_utils import make_fcurve
class BlenderWeightAnim():

View File

@ -121,7 +121,7 @@ class BlenderGlTF():
# Dispatch animation
if gltf.data.animations:
for node_idx, node in enumerate(gltf.data.nodes):
for node in gltf.data.nodes:
node.animations = {}
track_names = set()

View File

@ -14,12 +14,10 @@
import bpy
import bmesh
from mathutils import Vector
from ..com.gltf2_blender_extras import set_extras
from .gltf2_blender_material import BlenderMaterial
from .gltf2_blender_primitive import BlenderPrimitive
from ...io.imp.gltf2_io_binary import BinaryData
class BlenderMesh():

View File

@ -15,7 +15,6 @@
import bpy
from mathutils import Vector, Matrix
from .gltf2_blender_material import BlenderMaterial
from ...io.imp.gltf2_io_binary import BinaryData
from ...io.com.gltf2_io_color_management import color_linear_to_srgb
from ...io.com import gltf2_io_debug

View File

@ -13,8 +13,7 @@
# limitations under the License.
import bpy
from math import sqrt
from mathutils import Quaternion
from .gltf2_blender_node import BlenderNode
from .gltf2_blender_animation import BlenderAnimation
from .gltf2_blender_vnode import VNode, compute_vnodes

View File

@ -13,10 +13,10 @@
# limitations under the License.
import bpy
from .gltf2_blender_image import BlenderImage
from ..com.gltf2_blender_conversion import texture_transform_gltf_to_blender
from io_scene_gltf2.io.com.gltf2_io import Sampler
from io_scene_gltf2.io.com.gltf2_io_debug import print_console
from io_scene_gltf2.io.com.gltf2_io_constants import TextureFilter, TextureWrap
def texture(

View File

@ -103,16 +103,14 @@ def save_gltf(gltf, export_settings, encoder, glb_buffer):
file.write(struct.pack("I", length_gltf))
file.write('JSON'.encode())
file.write(gltf_data)
for i in range(0, spaces_gltf):
file.write(' '.encode())
file.write(b' ' * spaces_gltf)
# Chunk 1 (BIN)
if length_bin > 0:
file.write(struct.pack("I", length_bin))
file.write('BIN\0'.encode())
file.write(binary)
for i in range(0, zeros_bin):
file.write('\0'.encode())
file.write(b'\0' * zeros_bin)
file.close()

View File

@ -13,7 +13,6 @@
# limitations under the License.
import struct
import base64
from ..com.gltf2_io import Accessor

View File

@ -18,7 +18,7 @@ import logging
import json
import struct
import base64
from os.path import dirname, join, isfile, basename
from os.path import dirname, join, isfile
from urllib.parse import unquote