glTF: remove 2.79 on upstream repository

Files are no more computed to remove 2.79 code here, so some little modification on files can be found
This commit is contained in:
Julien Duroure 2020-02-21 22:27:26 +01:00
parent 6d11965601
commit 1e5d8bd56d
75 changed files with 3 additions and 87 deletions

View File

@ -15,8 +15,8 @@
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, 20),
'blender': (2, 81, 6),
"version": (1, 2, 21),
'blender': (2, 82, 7),
'location': 'File > Import-Export',
'description': 'Import-Export as glTF 2.0',
'warning': '',
@ -480,13 +480,8 @@ class ExportGLTF2_Base:
return gltf2_blender_export.save(context, export_settings)
def draw(self, context):
pass
pass # Is needed to get panels available
class GLTF_PT_export_main(bpy.types.Panel):
@ -947,4 +942,3 @@ def unregister():
# remove from the export / import menu
bpy.types.TOPBAR_MT_file_export.remove(menu_func_export)
bpy.types.TOPBAR_MT_file_import.remove(menu_func_import)

View File

@ -60,4 +60,3 @@ def get_target(property):
"scale": "scale",
"value": "weights"
}.get(property)

View File

@ -36,4 +36,3 @@ def get_rotation_modes(target_property: str) -> str:
return True, ["AXIS_ANGLE"]
else:
return False, []

View File

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

View File

@ -35,4 +35,3 @@ def is_json_convertible(data):
return True
except:
return False

View File

@ -15,4 +15,3 @@
def get_gltf_node_name():
return "glTF Settings"

View File

@ -170,4 +170,3 @@ def transform_value(value: Vector, _: Matrix = Matrix.Identity(4)) -> Vector:
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

View File

@ -147,4 +147,3 @@ def __notify_end(context, elapsed):
print_console('INFO', 'Finished glTF 2.0 export in {} s'.format(elapsed))
context.window_manager.progress_end()
print_newline()

View File

@ -57,4 +57,3 @@ USE_NO_COLOR = 'gltf_use_no_color'
METALLIC_ROUGHNESS_IMAGE = "metallic_roughness_image"
GROUP_INDEX = 'group_index'

View File

@ -137,4 +137,3 @@ def __gather_extras(blender_object, export_settings):
if export_settings[gltf2_blender_export_keys.EXTRAS]:
return generate_extras(blender_object)
return None

View File

@ -45,4 +45,3 @@ def gather_accessor(buffer_view: gltf2_io_binary_data.BinaryData,
sparse=None,
type=type
)

View File

@ -119,4 +119,3 @@ def __gather_path(channels: typing.Tuple[bpy.types.FCurve],
raise RuntimeError("Cannot export an animation with {} target".format(target))
return path

View File

@ -370,4 +370,3 @@ def __gather_armature_object_channel_groups(blender_action: bpy.types.Action, bl
groups += list(p.values())
return map(tuple, groups)

View File

@ -388,4 +388,3 @@ def needs_baking(blender_object_if_armature: typing.Optional[bpy.types.Object],
return True
return False

View File

@ -410,4 +410,3 @@ def __gather_output(channels: typing.Tuple[bpy.types.FCurve],
sparse=None,
type=data_type
)

View File

@ -245,4 +245,3 @@ def __get_blender_actions(blender_object: bpy.types.Object,
blender_actions.sort(key = lambda a: a.name.lower())
return [(blender_action, blender_tracks[blender_action.name]) for blender_action in blender_actions]

View File

@ -139,4 +139,3 @@ def skdrivervalues(func):
else:
return func.__skdrivervalues[args[0].name][args[1]]
return wrapper_skdrivervalues

View File

@ -119,4 +119,3 @@ def __gather_type(blender_camera, export_settings):
elif blender_camera.type == 'ORTHO':
return "orthographic"
return None

View File

@ -71,4 +71,3 @@ def get_sk_driver_values(blender_object, frame, fcurves):
sk_values.append(blender_object.data.shape_keys.path_resolve(get_target_object_path(f.data_path)).value)
return tuple(sk_values)

View File

@ -240,4 +240,3 @@ def __get_texname_from_slot(sockets_or_slots, export_settings):
elif isinstance(sockets_or_slots[0], bpy.types.MaterialTextureSlot):
return sockets_or_slots[0].texture.image.name

View File

@ -81,4 +81,3 @@ def gather_joint(blender_bone, export_settings):
translation=translation,
weights=None
)

View File

@ -42,4 +42,3 @@ def __gather_inner_cone_angle(blender_lamp, _) -> Optional[float]:
def __gather_outer_cone_angle(blender_lamp, _) -> Optional[float]:
return blender_lamp.spot_size * 0.5

View File

@ -133,4 +133,3 @@ def __get_cycles_emission_node(blender_lamp) -> Optional[bpy.types.ShaderNodeEmi
continue
return result[0].shader_node
return None

View File

@ -145,4 +145,3 @@ def __get_tex_from_socket(socket):
if result[0].shader_node.image is None:
return None
return result[0]

View File

@ -135,4 +135,3 @@ def __get_tex_from_socket(socket):
if result[0].shader_node.image is None:
return None
return result[0]

View File

@ -217,4 +217,3 @@ def __has_image_node_from_socket(socket):
if not result:
return False
return True

View File

@ -173,4 +173,3 @@ def __has_image_node_from_socket(socket):
if not result:
return False
return True

View File

@ -158,4 +158,3 @@ def __gather_weights(blender_mesh: bpy.types.Mesh,
weights.append(blender_shape_key.value)
return weights

View File

@ -410,4 +410,3 @@ def __get_correction_node(blender_object, export_settings):
translation=None,
weights=None
)

View File

@ -223,4 +223,3 @@ def __gather_skins(blender_primitive, export_settings):
joint_id = 'JOINTS_' + str(bone_set_index)
weight_id = 'WEIGHTS_' + str(bone_set_index)
return attributes

View File

@ -232,4 +232,3 @@ def __gather_targets(blender_primitive, blender_mesh, modifiers, export_settings
morph_index += 1
return targets
return None

View File

@ -100,4 +100,3 @@ def gather_sampler_from_texture_slot(blender_texture: bpy.types.TextureSlot, exp
wrap_s=wrap,
wrap_t=wrap
)

View File

@ -189,4 +189,3 @@ def get_bone_tree(blender_dummy, blender_object):
list_ = list(set(bones))
root_ = list(set(root_bones))
return [blender_object.data.bones[b] for b in list_], children, [blender_object.pose.bones[b] for b in root_]

View File

@ -106,4 +106,3 @@ def __get_tex_from_socket(socket):
if not result:
return None
return result[0]

View File

@ -141,4 +141,3 @@ def __get_tex_from_socket(socket):
if result[0].shader_node.image is None:
return None
return result[0]

View File

@ -75,10 +75,6 @@ def get_socket_or_texture_slot(blender_material: bpy.types.Material, name: str):
inputs = sum([[input for input in node.inputs if input.name == name] for node in nodes], [])
if inputs:
return inputs[0]
else:
pass
return None
@ -222,4 +218,3 @@ def get_node(data_path):
return None
return node_name[:(index)]

View File

@ -328,4 +328,3 @@ def _path_to_uri(path):
path = os.path.normpath(path)
path = path.replace(os.sep, '/')
return urllib.parse.quote(path)

View File

@ -340,4 +340,3 @@ def _render_temp_scene(
with open(tmpfilename, "rb") as f:
return f.read()

View File

@ -99,4 +99,3 @@ def from_socket(start_socket: bpy.types.NodeSocket,
return []
return __search_from_socket(start_socket, shader_node_filter, [])

View File

@ -65,4 +65,3 @@ def min_components(l: list, data_type: gltf2_io_constants.DataType) -> list:
for i, c in enumerate(components):
result[i] = min(result[i], c)
return result

View File

@ -162,4 +162,3 @@ def copy_socket(mh, copy_from, copy_to):
copy_to.default_value = copy_from.default_value
for link in copy_from.links:
mh.node_tree.links.new(copy_to, link.from_socket)

View File

@ -53,4 +53,3 @@ def unlit(mh):
color_socket=emission_node.inputs['Color'],
alpha_socket=alpha_socket,
)

View File

@ -59,4 +59,3 @@ class BlenderAnimation():
for child in gltf.vnodes[vnode_id].children:
BlenderAnimation.restore_animation(gltf, child, animation_name)

View File

@ -197,4 +197,3 @@ class BlenderBoneAnim():
elif channel.target.path == "scale":
BlenderBoneAnim.parse_scale_channel(gltf, vnode, obj, bone, channel, animation)

View File

@ -112,4 +112,3 @@ class BlenderNodeAnim():
group_name=group_name,
interpolation=animation.samplers[channel.sampler].interpolation,
)

View File

@ -80,4 +80,3 @@ def make_fcurve(action, co, data_path, index=0, group_name=None, interpolation=N
fcurve.update() # force updating tangents (this may change when tangent will be managed)
return fcurve

View File

@ -88,4 +88,3 @@ class BlenderWeightAnim():
group_name="ShapeKeys",
interpolation=animation.samplers[channel.sampler].interpolation,
)

View File

@ -50,4 +50,3 @@ class BlenderCamera():
obj = bpy.data.objects.new(pycamera.name, cam)
return obj

View File

@ -191,4 +191,3 @@ class BlenderGlTF():
suffix = '.%03d' % cntr
cntr += 1

View File

@ -74,4 +74,3 @@ class BlenderImage():
def _uri_to_path(uri):
uri = urllib.parse.unquote(uri)
return normpath(uri)

View File

@ -90,4 +90,3 @@ class BlenderLight():
spot.spot_blend = 1.0
return obj

View File

@ -91,4 +91,3 @@ class BlenderMaterial():
color = pbr.base_color_factor or [1, 1, 1, 1]
mat.diffuse_color = color

View File

@ -157,4 +157,3 @@ class BlenderMesh():
custom_normals = [v.normal for v in bme.verts]
mesh.normals_split_custom_set_from_vertices(custom_normals)
mesh.use_auto_smooth = True

View File

@ -205,4 +205,3 @@ class BlenderNode():
BlenderMesh.set_mesh(gltf, gltf.data.meshes[pynode.mesh], obj)
return obj

View File

@ -487,4 +487,3 @@ def get_settings_group():
gltf_node_group_input = gltf_node_group.nodes.new('NodeGroupInput')
gltf_node_group_input.location = -200, 0
return gltf_node_group

View File

@ -350,4 +350,3 @@ class BlenderPrimitive():
raise Exception('primitive mode unimplemented: %d' % mode)
return es, fs

View File

@ -53,4 +53,3 @@ class BlenderSkin():
obj = vnode.blender_object
mod = obj.modifiers.new(name="Armature", type="ARMATURE")
mod.object = arma.blender_object

View File

@ -149,4 +149,3 @@ def wrap_name(wrap):
if wrap == TextureWrap.MirroredRepeat: return 'MIRRORED_REPEAT'
if wrap == TextureWrap.Repeat: return 'REPEAT'
return 'UNKNOWN (%s)' % wrap

View File

@ -358,4 +358,3 @@ def calc_bone_matrices(gltf):
# TODO: add pass to rotate/resize bones so they look pretty

View File

@ -13,4 +13,3 @@
# limitations under the License.
from .imp import *

View File

@ -1220,4 +1220,3 @@ def gltf_from_dict(s):
def gltf_to_dict(x):
return to_class(Gltf, x)

View File

@ -34,4 +34,3 @@ def color_linear_to_srgb(c):
return 0.0 if c < 0.0 else c * 12.92
else:
return 1.055 * pow(c, 1.0 / 2.4) - 0.055

View File

@ -144,4 +144,3 @@ GLTF_DATA_TYPE_VEC4 = "VEC4"
GLTF_DATA_TYPE_MAT2 = "MAT2"
GLTF_DATA_TYPE_MAT3 = "MAT3"
GLTF_DATA_TYPE_MAT4 = "MAT4"

View File

@ -124,4 +124,3 @@ class Log:
self.hdlr.setFormatter(formatter)
self.logger.addHandler(self.hdlr)
self.logger.setLevel(int(loglevel))

View File

@ -35,4 +35,3 @@ class ChildOfRootExtension(Extension):
"""
self.path = path
super().__init__(name, extension, required)

View File

@ -74,4 +74,3 @@ class Light:
self.extensions)
result["extras"] = self.extras
return result

View File

@ -39,4 +39,3 @@ class BinaryData:
@property
def byte_length(self):
return len(self.data)

View File

@ -58,4 +58,3 @@ class Buffer:
def clear(self):
self.__data = b""

View File

@ -343,4 +343,3 @@ def __compress_primitive(primitive, dll, export_settings):
dll.destroy_compressor(compressor)
return

View File

@ -117,4 +117,3 @@ def save_gltf(gltf, export_settings, encoder, glb_buffer):
file.close()
return True

View File

@ -53,4 +53,3 @@ class ImageData:
@property
def byte_length(self):
return len(self._data)

View File

@ -20,4 +20,3 @@ def export_user_extensions(hook_name, export_settings, gltf2_object, *args):
hook = getattr(extension, hook_name, None)
if hook is not None:
hook(gltf2_object, *args, export_settings)

View File

@ -13,4 +13,3 @@
# limitations under the License.
"""IO imp package."""

View File

@ -174,4 +174,3 @@ class BinaryData():
return data, image_name
return None, None

View File

@ -202,4 +202,3 @@ class glTFImporter():
except Exception:
self.log.error("Couldn't read file: " + path)
return None, None