Browse Source

fix normal map texture hint,
support uv coord node,
remove material resource name,
redo normal test scene,
add vertex color gamma correction,

Jason0214 6 năm trước cách đây
mục cha
commit
9234e96821

+ 7 - 0
io_scene_godot/__init__.py

@@ -112,6 +112,13 @@ class ExportGodot(bpy.types.Operator, ExportHelper):
                     "animation and place into AnimationPlayer",
                     "animation and place into AnimationPlayer",
         default=True,
         default=True,
     )
     )
+    generate_external_material = BoolProperty(
+        name="Generate External Material",
+        description="If turned on, materials in the exported scene would "
+                    "generate external .material files when imported to "
+                    "godot,  thus make it easy for material reusing",
+        default=False,
+    )
     animation_modes = EnumProperty(
     animation_modes = EnumProperty(
         name="Animation Modes",
         name="Animation Modes",
         description="Configuration of how blender animation data being "
         description="Configuration of how blender animation data being "

+ 10 - 3
io_scene_godot/converters/material.py

@@ -64,8 +64,15 @@ def generate_material_resource(escn_file, export_settings, material):
     engine = bpy.context.scene.render.engine
     engine = bpy.context.scene.render.engine
     mat = None
     mat = None
 
 
+    if export_settings['generate_external_material']:
+        material_rsc_name = material.name
+    else:
+        # leave material_name as empty, prevent godot
+        # to convert material to external file
+        material_rsc_name = ''
+
     if engine == 'CYCLES' and material.node_tree is not None:
     if engine == 'CYCLES' and material.node_tree is not None:
-        mat = InternalResource("ShaderMaterial", material.name)
+        mat = InternalResource("ShaderMaterial", material_rsc_name)
         try:
         try:
             export_node_tree(
             export_node_tree(
                 escn_file, export_settings, material, mat
                 escn_file, export_settings, material, mat
@@ -73,11 +80,11 @@ def generate_material_resource(escn_file, export_settings, material):
         except ValidationError as exception:
         except ValidationError as exception:
             mat = None  # revert to SpatialMaterial
             mat = None  # revert to SpatialMaterial
             logging.error(
             logging.error(
-                str(exception) + ", in material '{}'".format(material.name)
+                "%s, in material '%s'", str(exception), material.name
             )
             )
 
 
     if mat is None:
     if mat is None:
-        mat = InternalResource("SpatialMaterial", material.name)
+        mat = InternalResource("SpatialMaterial", material_rsc_name)
 
 
         mat['flags_unshaded'] = material.use_shadeless
         mat['flags_unshaded'] = material.use_shadeless
         mat['flags_vertex_lighting'] = material.use_vertex_color_light
         mat['flags_vertex_lighting'] = material.use_vertex_color_light

+ 50 - 3
io_scene_godot/converters/material_node_tree/node_vistors.py

@@ -1,5 +1,6 @@
 """A set of node visitor functions to convert material node to shader script"""
 """A set of node visitor functions to convert material node to shader script"""
 import logging
 import logging
+from collections import deque
 import mathutils
 import mathutils
 from .shaders import (FragmentShader, VertexShader,
 from .shaders import (FragmentShader, VertexShader,
                       Value, Variable, FragmentBSDFContainer)
                       Value, Variable, FragmentBSDFContainer)
@@ -7,6 +8,24 @@ from .shader_functions import find_node_function
 from ...structures import ValidationError
 from ...structures import ValidationError
 
 
 
 
+def _is_normal_texture(image_texture_node):
+    assert image_texture_node.bl_idname == 'ShaderNodeTexImage'
+    node_queue = deque()
+    for link in image_texture_node.outputs['Color'].links:
+        node_queue.append((link.to_node, link.to_socket))
+
+    while node_queue:
+        node, socket = node_queue.popleft()
+        if (socket.name == 'Color' and
+                node.bl_idname == 'ShaderNodeNormalMap'):
+            return True
+        for sock in node.outputs:
+            for link in sock.links:
+                node_queue.append((link.to_node, link.to_socket))
+
+    return False
+
+
 def visit_add_shader_node(shader, node):
 def visit_add_shader_node(shader, node):
     """apply addition to albedo and it may have HDR, alpha is added with
     """apply addition to albedo and it may have HDR, alpha is added with
     its complementary, other attributes are averaged"""
     its complementary, other attributes are averaged"""
@@ -372,9 +391,15 @@ def visit_image_texture_node(shader, node):
         )
         )
 
 
     if node.image is None or node.image not in shader.global_ref.textures:
     if node.image is None or node.image not in shader.global_ref.textures:
-        tex_image_var = shader.global_ref.define_uniform(
-            "sampler2D", node.name + "texture_image"
-        )
+        if _is_normal_texture(node):
+            tex_image_var = shader.global_ref.define_uniform(
+                "sampler2D", node.name + "texture_image", hint='hint_normal'
+            )
+        else:
+            tex_image_var = shader.global_ref.define_uniform(
+                "sampler2D", node.name + "texture_image",
+            )
+
         shader.global_ref.add_image_texture(
         shader.global_ref.add_image_texture(
             tex_image_var, node.image
             tex_image_var, node.image
         )
         )
@@ -493,6 +518,27 @@ def visit_tangent_node(shader, node):
     )
     )
 
 
 
 
+def visit_uvmap_node(shader, node):
+    """Visit UV Map node"""
+    if node.from_dupli:
+        raise ValidationError(
+            "'{}' from_dupli not supported, at '{}'".format(
+                node.bl_idname,
+                node.name
+            )
+        )
+
+    shader.assign_variable_to_socket(
+        node.outputs['UV'],
+        Value("vec3", ('UV', 0.0)),
+    )
+
+    logging.warning(
+        "'%s' use the active UV map, make sure the correct "
+        "one is selected, at'%s", node.bl_idname, node.name
+    )
+
+
 NODE_VISITOR_FUNCTIONS = {
 NODE_VISITOR_FUNCTIONS = {
     'ShaderNodeMapping': visit_mapping_node,
     'ShaderNodeMapping': visit_mapping_node,
     'ShaderNodeTexImage': visit_image_texture_node,
     'ShaderNodeTexImage': visit_image_texture_node,
@@ -504,6 +550,7 @@ NODE_VISITOR_FUNCTIONS = {
     'ShaderNodeMixShader': visit_mix_shader_node,
     'ShaderNodeMixShader': visit_mix_shader_node,
     'ShaderNodeAddShader': visit_add_shader_node,
     'ShaderNodeAddShader': visit_add_shader_node,
     'ShaderNodeTangent': visit_tangent_node,
     'ShaderNodeTangent': visit_tangent_node,
+    'ShaderNodeUVMap': visit_uvmap_node,
 }
 }
 
 
 
 

+ 28 - 13
io_scene_godot/converters/material_node_tree/shader_functions.py

@@ -1,4 +1,6 @@
-"""Prewritten shader scripts for node in material node tree"""
+"""Prewritten shader scripts for node in material node tree,
+reference: https://developer.blender.org/diffusion/B/browse/
+blender2.8/source/blender/gpu/shaders/gpu_shader_material.glsl"""
 import re
 import re
 from ...structures import ValidationError
 from ...structures import ValidationError
 
 
@@ -61,7 +63,6 @@ class BsdfShaderFunction(ShaderFunction):
 #   e.g. Blender node 'ShaderNodeMath' with `operation` set as 'ADD',
 #   e.g. Blender node 'ShaderNodeMath' with `operation` set as 'ADD',
 #     `clamp` not checked. It's function name is 'node_math_add_no_clamp'.
 #     `clamp` not checked. It's function name is 'node_math_add_no_clamp'.
 
 
-
 FUNCTION_LIBS = [
 FUNCTION_LIBS = [
     # bsdf shader node functions
     # bsdf shader node functions
     BsdfShaderFunction(
     BsdfShaderFunction(
@@ -268,31 +269,30 @@ void node_bump(float strength, float dist, float height, vec3 normal,
     ShaderFunction(code="""
     ShaderFunction(code="""
 void node_normal_map_tangent(float strength, vec4 color, vec3 normal,
 void node_normal_map_tangent(float strength, vec4 color, vec3 normal,
         vec3 tangent, vec3 binormal, out vec3 out_normal) {
         vec3 tangent, vec3 binormal, out vec3 out_normal) {
-    vec3 signed_color = 2.0 * (color.xyz - vec3(0.5, 0.5, 0.5));
-    out_normal = signed_color.x * tangent +
-                 signed_color.y * binormal +
-                 signed_color.z * normal;
-    // XXX: TBN are no longer orthogonal, does it bring some problem?
-    out_normal = strength * out_normal + (1.0 - strength) * normal;
+    vec3 signed_color = vec3(2.0, -2.0, 2.0) * (color.xzy - vec3(0.5));
+    vec3 tex_normal = signed_color.x * tangent +
+                      signed_color.y * binormal +
+                      signed_color.z * normal;
+    out_normal = strength * tex_normal + (1.0 - strength) * normal;
 }
 }
 """),
 """),
 
 
     ShaderFunction(code="""
     ShaderFunction(code="""
 void node_normal_map_world(float strength, vec4 color, vec3 view_normal,
 void node_normal_map_world(float strength, vec4 color, vec3 view_normal,
         mat4 inv_view_mat, out vec3 out_normal) {
         mat4 inv_view_mat, out vec3 out_normal) {
-    vec3 signed_color = 2.0 * (color.xyz - vec3(0.5, 0.5, 0.5));
+    vec3 tex_normal = vec3(2.0, -2.0, -2.0) * (color.xzy - vec3(0.5));
     vec3 world_normal = (inv_view_mat * vec4(view_normal, 0.0)).xyz;
     vec3 world_normal = (inv_view_mat * vec4(view_normal, 0.0)).xyz;
-    out_normal = strength * signed_color + (1.0 - strength) * world_normal;
+    out_normal = strength * tex_normal + (1.0 - strength) * world_normal;
 }
 }
 """),
 """),
 
 
     ShaderFunction(code="""
     ShaderFunction(code="""
 void node_normal_map_object(float strength, vec4 color, vec3 view_normal,
 void node_normal_map_object(float strength, vec4 color, vec3 view_normal,
         mat4 inv_view_mat, mat4 model_mat, out vec3 out_normal) {
         mat4 inv_view_mat, mat4 model_mat, out vec3 out_normal) {
-    vec3 signed_color = 2.0 * (color.xyz - vec3(0.5, 0.5, 0.5));
+    vec3 signed_color = vec3(2.0, -2.0, -2.0) * (color.xzy - vec3(0.5));
+    vec3 tex_normal = (model_mat * vec4(signed_color, 0.0)).xyz;
     vec3 world_normal = (inv_view_mat * vec4(view_normal, 0.0)).xyz;
     vec3 world_normal = (inv_view_mat * vec4(view_normal, 0.0)).xyz;
-    out_normal = (model_mat * vec4(signed_color, 0.0)).xyz;
-    out_normal = strength * signed_color + (1.0 - strength) * world_normal;
+    out_normal = strength * tex_normal + (1.0 - strength) * world_normal;
 }
 }
 """),
 """),
 
 
@@ -301,6 +301,21 @@ void node_tex_image(vec3 co, sampler2D ima, out vec4 color, out float alpha) {
     color = texture(ima, co.xy);
     color = texture(ima, co.xy);
     alpha = color.a;
     alpha = color.a;
 }
 }
+"""),
+
+    ShaderFunction(code="""
+void node_gamma(vec4 color, float gamma, out vec4 out_color) {
+    out_color = color
+    if (out_color.r > 0.0) {
+        out_color.r = pow(color.r, gamma);
+    }
+    if (out_color.g > 0.0) {
+        out_color.g = pow(color.g, gamma);
+    }
+    if (out_color.b > 0.0) {
+        out_color.b = pow(color.b, gamma);
+    }
+}
 """),
 """),
 
 
     ShaderFunction(code="""
     ShaderFunction(code="""

+ 5 - 2
io_scene_godot/converters/material_node_tree/shaders.py

@@ -551,7 +551,7 @@ class ShaderGlobals:
             self.function_name_set.add(function.name)
             self.function_name_set.add(function.name)
             self.function_codes.append(function.code)
             self.function_codes.append(function.code)
 
 
-    def define_uniform(self, uni_type, uni_base_name):
+    def define_uniform(self, uni_type, uni_base_name, hint=None):
         """Define an uniform variable"""
         """Define an uniform variable"""
         self._uniform_var_count += 1
         self._uniform_var_count += 1
         raw_var_name = 'uni{}_{}'.format(
         raw_var_name = 'uni{}_{}'.format(
@@ -560,7 +560,10 @@ class ShaderGlobals:
         )
         )
         var_name = re.sub(r'\W', '', raw_var_name)
         var_name = re.sub(r'\W', '', raw_var_name)
         new_var = Variable(uni_type, var_name)
         new_var = Variable(uni_type, var_name)
-        def_str = 'uniform {} {};'.format(uni_type, var_name)
+        if hint is not None:
+            def_str = 'uniform {} {} : {};'.format(uni_type, var_name, hint)
+        else:
+            def_str = 'uniform {} {};'.format(uni_type, var_name)
         self.uniform_codes.append(def_str)
         self.uniform_codes.append(def_str)
         return new_var
         return new_var
 
 

+ 2 - 2
io_scene_godot/converters/mesh.py

@@ -6,7 +6,7 @@ import mathutils
 
 
 from .material import export_material
 from .material import export_material
 from ..structures import (Array, NodeTemplate, InternalResource, NodePath,
 from ..structures import (Array, NodeTemplate, InternalResource, NodePath,
-                          Map)
+                          Map, gamma_correct)
 from . import physics
 from . import physics
 from . import armature
 from . import armature
 from . import animation
 from . import animation
@@ -634,7 +634,7 @@ class Vertex:
 
 
         if mesh.vertex_colors:
         if mesh.vertex_colors:
             new_vert.color = mathutils.Vector(
             new_vert.color = mathutils.Vector(
-                mesh.vertex_colors[0].data[loop_index].color)
+                gamma_correct(mesh.vertex_colors[0].data[loop_index].color))
 
 
         new_vert.normal = fix_vertex(loop.normal)
         new_vert.normal = fix_vertex(loop.normal)
 
 

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 1 - 12
tests/reference_exports/action_animation/physics_animation.escn


+ 4 - 4
tests/reference_exports/material/object_link_material.escn

@@ -2,7 +2,7 @@
 
 
 [sub_resource id=1 type="SpatialMaterial"]
 [sub_resource id=1 type="SpatialMaterial"]
 
 
-resource_name = "Material001"
+resource_name = ""
 flags_unshaded = false
 flags_unshaded = false
 flags_vertex_lighting = false
 flags_vertex_lighting = false
 flags_transparent = false
 flags_transparent = false
@@ -12,7 +12,7 @@ subsurf_scatter_enabled = false
 
 
 [sub_resource id=2 type="SpatialMaterial"]
 [sub_resource id=2 type="SpatialMaterial"]
 
 
-resource_name = "Material"
+resource_name = ""
 flags_unshaded = false
 flags_unshaded = false
 flags_vertex_lighting = false
 flags_vertex_lighting = false
 flags_transparent = false
 flags_transparent = false
@@ -58,7 +58,7 @@ surfaces/1 = {
 
 
 [sub_resource id=4 type="SpatialMaterial"]
 [sub_resource id=4 type="SpatialMaterial"]
 
 
-resource_name = "Material002"
+resource_name = ""
 flags_unshaded = false
 flags_unshaded = false
 flags_vertex_lighting = false
 flags_vertex_lighting = false
 flags_transparent = false
 flags_transparent = false
@@ -68,7 +68,7 @@ subsurf_scatter_enabled = false
 
 
 [sub_resource id=5 type="SpatialMaterial"]
 [sub_resource id=5 type="SpatialMaterial"]
 
 
-resource_name = "Material003"
+resource_name = ""
 flags_unshaded = false
 flags_unshaded = false
 flags_vertex_lighting = false
 flags_vertex_lighting = false
 flags_transparent = false
 flags_transparent = false

+ 2 - 2
tests/reference_exports/material/simple_materials.escn

@@ -2,7 +2,7 @@
 
 
 [sub_resource id=1 type="SpatialMaterial"]
 [sub_resource id=1 type="SpatialMaterial"]
 
 
-resource_name = "Material"
+resource_name = ""
 flags_unshaded = false
 flags_unshaded = false
 flags_vertex_lighting = false
 flags_vertex_lighting = false
 flags_transparent = false
 flags_transparent = false
@@ -12,7 +12,7 @@ subsurf_scatter_enabled = false
 
 
 [sub_resource id=2 type="SpatialMaterial"]
 [sub_resource id=2 type="SpatialMaterial"]
 
 
-resource_name = "Other"
+resource_name = ""
 flags_unshaded = false
 flags_unshaded = false
 flags_vertex_lighting = false
 flags_vertex_lighting = false
 flags_transparent = false
 flags_transparent = false

BIN
tests/reference_exports/material_cycle/Normal_OGL.png


BIN
tests/reference_exports/material_cycle/brick_4_bump_1k.jpg.jpeg


BIN
tests/reference_exports/material_cycle/brick_floor_nor_1k.jpg.jpeg


BIN
tests/reference_exports/material_cycle/bump.png


+ 2 - 2
tests/reference_exports/material_cycle/material_anistropy.escn

@@ -92,7 +92,7 @@ void fragment() {
 
 
 [sub_resource id=2 type="ShaderMaterial"]
 [sub_resource id=2 type="ShaderMaterial"]
 
 
-resource_name = "Material001"
+resource_name = ""
 shader = SubResource(1)
 shader = SubResource(1)
 
 
 [sub_resource id=3 type="ArrayMesh"]
 [sub_resource id=3 type="ArrayMesh"]
@@ -215,7 +215,7 @@ void fragment() {
 
 
 [sub_resource id=5 type="ShaderMaterial"]
 [sub_resource id=5 type="ShaderMaterial"]
 
 
-resource_name = "Material002"
+resource_name = ""
 shader = SubResource(4)
 shader = SubResource(4)
 
 
 [sub_resource id=6 type="ArrayMesh"]
 [sub_resource id=6 type="ArrayMesh"]

+ 18 - 18
tests/reference_exports/material_cycle/material_cycle.escn

@@ -39,7 +39,7 @@ void fragment() {
 
 
 [sub_resource id=2 type="ShaderMaterial"]
 [sub_resource id=2 type="ShaderMaterial"]
 
 
-resource_name = "Test Material"
+resource_name = ""
 shader = SubResource(1)
 shader = SubResource(1)
 
 
 [sub_resource id=3 type="ArrayMesh"]
 [sub_resource id=3 type="ArrayMesh"]
@@ -142,7 +142,7 @@ void fragment() {
 
 
 [sub_resource id=5 type="ShaderMaterial"]
 [sub_resource id=5 type="ShaderMaterial"]
 
 
-resource_name = "VariableMaterial"
+resource_name = ""
 shader = SubResource(4)
 shader = SubResource(4)
 
 
 [sub_resource id=6 type="Shader"]
 [sub_resource id=6 type="Shader"]
@@ -184,7 +184,7 @@ void fragment() {
 
 
 [sub_resource id=7 type="ShaderMaterial"]
 [sub_resource id=7 type="ShaderMaterial"]
 
 
-resource_name = "X-Gray160"
+resource_name = ""
 shader = SubResource(6)
 shader = SubResource(6)
 
 
 [sub_resource id=8 type="ArrayMesh"]
 [sub_resource id=8 type="ArrayMesh"]
@@ -267,7 +267,7 @@ void fragment() {
 
 
 [sub_resource id=10 type="ShaderMaterial"]
 [sub_resource id=10 type="ShaderMaterial"]
 
 
-resource_name = "Socket"
+resource_name = ""
 shader = SubResource(9)
 shader = SubResource(9)
 
 
 [sub_resource id=11 type="ArrayMesh"]
 [sub_resource id=11 type="ArrayMesh"]
@@ -329,7 +329,7 @@ void fragment() {
 
 
 [sub_resource id=13 type="ShaderMaterial"]
 [sub_resource id=13 type="ShaderMaterial"]
 
 
-resource_name = "Blender"
+resource_name = ""
 shader = SubResource(12)
 shader = SubResource(12)
 
 
 [sub_resource id=14 type="ArrayMesh"]
 [sub_resource id=14 type="ArrayMesh"]
@@ -411,7 +411,7 @@ void fragment() {
 
 
 [sub_resource id=17 type="ShaderMaterial"]
 [sub_resource id=17 type="ShaderMaterial"]
 
 
-resource_name = "Material004"
+resource_name = ""
 shader = SubResource(16)
 shader = SubResource(16)
 
 
 [sub_resource id=18 type="Shader"]
 [sub_resource id=18 type="Shader"]
@@ -514,7 +514,7 @@ void fragment() {
 
 
 [sub_resource id=19 type="ShaderMaterial"]
 [sub_resource id=19 type="ShaderMaterial"]
 
 
-resource_name = "Material003"
+resource_name = ""
 shader = SubResource(18)
 shader = SubResource(18)
 
 
 [sub_resource id=20 type="Shader"]
 [sub_resource id=20 type="Shader"]
@@ -556,7 +556,7 @@ void fragment() {
 
 
 [sub_resource id=21 type="ShaderMaterial"]
 [sub_resource id=21 type="ShaderMaterial"]
 
 
-resource_name = "Material002"
+resource_name = ""
 shader = SubResource(20)
 shader = SubResource(20)
 
 
 [sub_resource id=22 type="Shader"]
 [sub_resource id=22 type="Shader"]
@@ -598,7 +598,7 @@ void fragment() {
 
 
 [sub_resource id=23 type="ShaderMaterial"]
 [sub_resource id=23 type="ShaderMaterial"]
 
 
-resource_name = "Material005"
+resource_name = ""
 shader = SubResource(22)
 shader = SubResource(22)
 
 
 [sub_resource id=24 type="Shader"]
 [sub_resource id=24 type="Shader"]
@@ -643,7 +643,7 @@ void fragment() {
 
 
 [sub_resource id=25 type="ShaderMaterial"]
 [sub_resource id=25 type="ShaderMaterial"]
 
 
-resource_name = "Material006"
+resource_name = ""
 shader = SubResource(24)
 shader = SubResource(24)
 
 
 [sub_resource id=26 type="Shader"]
 [sub_resource id=26 type="Shader"]
@@ -693,7 +693,7 @@ void fragment() {
 
 
 [sub_resource id=27 type="ShaderMaterial"]
 [sub_resource id=27 type="ShaderMaterial"]
 
 
-resource_name = "Material007"
+resource_name = ""
 shader = SubResource(26)
 shader = SubResource(26)
 
 
 [sub_resource id=28 type="Shader"]
 [sub_resource id=28 type="Shader"]
@@ -777,7 +777,7 @@ void fragment() {
 
 
 [sub_resource id=29 type="ShaderMaterial"]
 [sub_resource id=29 type="ShaderMaterial"]
 
 
-resource_name = "Material008"
+resource_name = ""
 shader = SubResource(28)
 shader = SubResource(28)
 
 
 [sub_resource id=30 type="Shader"]
 [sub_resource id=30 type="Shader"]
@@ -840,7 +840,7 @@ void fragment() {
 
 
 [sub_resource id=31 type="ShaderMaterial"]
 [sub_resource id=31 type="ShaderMaterial"]
 
 
-resource_name = "Material012"
+resource_name = ""
 shader = SubResource(30)
 shader = SubResource(30)
 
 
 [sub_resource id=32 type="Shader"]
 [sub_resource id=32 type="Shader"]
@@ -884,7 +884,7 @@ void fragment() {
 
 
 [sub_resource id=33 type="ShaderMaterial"]
 [sub_resource id=33 type="ShaderMaterial"]
 
 
-resource_name = "Material011"
+resource_name = ""
 shader = SubResource(32)
 shader = SubResource(32)
 
 
 [sub_resource id=34 type="Shader"]
 [sub_resource id=34 type="Shader"]
@@ -940,7 +940,7 @@ void fragment() {
 
 
 [sub_resource id=35 type="ShaderMaterial"]
 [sub_resource id=35 type="ShaderMaterial"]
 
 
-resource_name = "Material010"
+resource_name = ""
 shader = SubResource(34)
 shader = SubResource(34)
 
 
 [sub_resource id=36 type="Shader"]
 [sub_resource id=36 type="Shader"]
@@ -982,7 +982,7 @@ void fragment() {
 
 
 [sub_resource id=37 type="ShaderMaterial"]
 [sub_resource id=37 type="ShaderMaterial"]
 
 
-resource_name = "Material001"
+resource_name = ""
 shader = SubResource(36)
 shader = SubResource(36)
 
 
 [sub_resource id=38 type="ArrayMesh"]
 [sub_resource id=38 type="ArrayMesh"]
@@ -1007,7 +1007,7 @@ surfaces/0 = {
 
 
 [sub_resource id=39 type="SpatialMaterial"]
 [sub_resource id=39 type="SpatialMaterial"]
 
 
-resource_name = "X-Gray191001"
+resource_name = ""
 flags_unshaded = false
 flags_unshaded = false
 flags_vertex_lighting = false
 flags_vertex_lighting = false
 flags_transparent = false
 flags_transparent = false
@@ -1164,7 +1164,7 @@ void fragment() {
 
 
 [sub_resource id=43 type="ShaderMaterial"]
 [sub_resource id=43 type="ShaderMaterial"]
 
 
-resource_name = "Material009"
+resource_name = ""
 shader = SubResource(42)
 shader = SubResource(42)
 [node type="Spatial" name="Scene"]
 [node type="Spatial" name="Scene"]
 
 

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 98 - 7
tests/reference_exports/material_cycle/material_normal.escn


+ 1 - 1
tests/reference_exports/material_cycle/material_unpack_texture.escn

@@ -47,7 +47,7 @@ void fragment() {
 
 
 [sub_resource id=2 type="ShaderMaterial"]
 [sub_resource id=2 type="ShaderMaterial"]
 
 
-resource_name = "Material"
+resource_name = ""
 shader = SubResource(1)
 shader = SubResource(1)
 shader_param/uni1_ImageTexturetexture_image = ExtResource(1)
 shader_param/uni1_ImageTexturetexture_image = ExtResource(1)
 
 

+ 1 - 1
tests/reference_exports/mesh/vertex_color.escn

@@ -9,7 +9,7 @@ surfaces/0 = {
 		Vector3Array(2.0, 0.0, -1.33333, 1.33333, 0.0, -2.0, 1.33333, 0.0, -1.33333, -1.33333, 0.0, -1.33333, -2.0, 0.0, -2.0, -2.0, 0.0, -1.33333, -0.666667, 0.0, -1.33333, -1.33333, 0.0, -2.0, -3.97364e-08, 0.0, -1.33333, -0.666667, 0.0, -2.0, 0.666667, 0.0, -1.33333, -5.96046e-08, 0.0, -2.0, 0.666667, 0.0, -2.0, -1.33333, 0.0, 2.0, -2.0, 0.0, 1.33333, -2.0, 0.0, 2.0, -1.33333, 0.0, 1.33333, -2.0, 0.0, 0.666667, -1.33333, 0.0, 0.666667, -2.0, 0.0, 5.96046e-08, -2.0, 0.0, 0.666667, -1.33333, 0.0, -5.96046e-08, -2.0, 0.0, -0.666667, -1.33333, 0.0, -0.666667, -2.0, 0.0, -0.666667, -0.666667, 0.0, 2.0, -0.666667, 0.0, 1.33333, -1.33333, 0.0, 0.666667, -0.666667, 0.0, 0.666667, -1.33333, 0.0, -5.96046e-08, -0.666667, 0.0, -5.96046e-08, -0.666667, 0.0, -0.666667, 5.96046e-08, 0.0, 2.0, 3.97364e-08, 0.0, 1.33333, 1.98682e-08, 0.0, 0.666667, -1.77636e-15, 0.0, -5.96046e-08, -1.98682e-08, 0.0, -0.666667, 0.666667, 0.0, 2.0, 3.97364e-08, 0.0, 1.33333, 5.96046e-08, 0.0, 2.0, 0.666667, 0.0, 1.33333, 1.98682e-08, 0.0, 0.666667, 0.666667, 0.0, 0.666667, 0.666667, 0.0, -5.96046e-08, 0.666667, 0.0, -0.666667, 1.33333, 0.0, 2.0, 0.666667, 0.0, 1.33333, 0.666667, 0.0, 2.0, 1.33333, 0.0, 1.33333, 1.33333, 0.0, 0.666667, 1.33333, 0.0, -5.96046e-08, 1.33333, 0.0, -0.666667, 2.0, 0.0, 2.0, 2.0, 0.0, 1.33333, 2.0, 0.0, 0.666667, 2.0, 0.0, -5.96046e-08, 2.0, 0.0, -0.666667, 2.0, 0.0, -2.0, -1.33333, 0.0, -0.666667, -1.77636e-15, 0.0, -5.96046e-08, -1.98682e-08, 0.0, -0.666667, -0.666667, 0.0, -0.666667, 0.666667, 0.0, 0.666667, 1.33333, 0.0, 1.33333, 1.33333, 0.0, 0.666667, 1.33333, 0.0, -5.96046e-08, 0.666667, 0.0, -5.96046e-08, 1.33333, 0.0, -0.666667, 0.666667, 0.0, -0.666667),
 		Vector3Array(2.0, 0.0, -1.33333, 1.33333, 0.0, -2.0, 1.33333, 0.0, -1.33333, -1.33333, 0.0, -1.33333, -2.0, 0.0, -2.0, -2.0, 0.0, -1.33333, -0.666667, 0.0, -1.33333, -1.33333, 0.0, -2.0, -3.97364e-08, 0.0, -1.33333, -0.666667, 0.0, -2.0, 0.666667, 0.0, -1.33333, -5.96046e-08, 0.0, -2.0, 0.666667, 0.0, -2.0, -1.33333, 0.0, 2.0, -2.0, 0.0, 1.33333, -2.0, 0.0, 2.0, -1.33333, 0.0, 1.33333, -2.0, 0.0, 0.666667, -1.33333, 0.0, 0.666667, -2.0, 0.0, 5.96046e-08, -2.0, 0.0, 0.666667, -1.33333, 0.0, -5.96046e-08, -2.0, 0.0, -0.666667, -1.33333, 0.0, -0.666667, -2.0, 0.0, -0.666667, -0.666667, 0.0, 2.0, -0.666667, 0.0, 1.33333, -1.33333, 0.0, 0.666667, -0.666667, 0.0, 0.666667, -1.33333, 0.0, -5.96046e-08, -0.666667, 0.0, -5.96046e-08, -0.666667, 0.0, -0.666667, 5.96046e-08, 0.0, 2.0, 3.97364e-08, 0.0, 1.33333, 1.98682e-08, 0.0, 0.666667, -1.77636e-15, 0.0, -5.96046e-08, -1.98682e-08, 0.0, -0.666667, 0.666667, 0.0, 2.0, 3.97364e-08, 0.0, 1.33333, 5.96046e-08, 0.0, 2.0, 0.666667, 0.0, 1.33333, 1.98682e-08, 0.0, 0.666667, 0.666667, 0.0, 0.666667, 0.666667, 0.0, -5.96046e-08, 0.666667, 0.0, -0.666667, 1.33333, 0.0, 2.0, 0.666667, 0.0, 1.33333, 0.666667, 0.0, 2.0, 1.33333, 0.0, 1.33333, 1.33333, 0.0, 0.666667, 1.33333, 0.0, -5.96046e-08, 1.33333, 0.0, -0.666667, 2.0, 0.0, 2.0, 2.0, 0.0, 1.33333, 2.0, 0.0, 0.666667, 2.0, 0.0, -5.96046e-08, 2.0, 0.0, -0.666667, 2.0, 0.0, -2.0, -1.33333, 0.0, -0.666667, -1.77636e-15, 0.0, -5.96046e-08, -1.98682e-08, 0.0, -0.666667, -0.666667, 0.0, -0.666667, 0.666667, 0.0, 0.666667, 1.33333, 0.0, 1.33333, 1.33333, 0.0, 0.666667, 1.33333, 0.0, -5.96046e-08, 0.666667, 0.0, -5.96046e-08, 1.33333, 0.0, -0.666667, 0.666667, 0.0, -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 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 0.167429, 1.0, 0.167429, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 0.341576, 0.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 0.341576, 0.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 0.341576, 0.0, 1.0, 1.0, 0.341576, 0.0, 1.0, 1.0, 0.394777, 0.229437, 1.0, 1.0, 0.354232, 0.132737, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 0.167429, 1.0, 0.167429, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 0.341576, 0.0, 1.0, 1.0, 0.341576, 0.0, 1.0, 1.0, 0.394777, 0.229437, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 0.354232, 0.132737, 1.0, 1.0, 1.0, 1.0, 1.0),
 		null, ; No UV1,
 		null, ; No UV1,
 		null, ; No UV2,
 		null, ; No UV2,
 		null, ; No Bones,
 		null, ; No Bones,

+ 2 - 2
tests/reference_exports/shape_key/shapekey_with_multi_surface.escn

@@ -2,7 +2,7 @@
 
 
 [sub_resource id=1 type="SpatialMaterial"]
 [sub_resource id=1 type="SpatialMaterial"]
 
 
-resource_name = "Material001"
+resource_name = ""
 flags_unshaded = false
 flags_unshaded = false
 flags_vertex_lighting = false
 flags_vertex_lighting = false
 flags_transparent = false
 flags_transparent = false
@@ -12,7 +12,7 @@ subsurf_scatter_enabled = false
 
 
 [sub_resource id=2 type="SpatialMaterial"]
 [sub_resource id=2 type="SpatialMaterial"]
 
 
-resource_name = "Material002"
+resource_name = ""
 flags_unshaded = false
 flags_unshaded = false
 flags_vertex_lighting = false
 flags_vertex_lighting = false
 flags_transparent = false
 flags_transparent = false

BIN
tests/test_scenes/action_animation/physics_animation.blend


BIN
tests/test_scenes/material_cycle/material_normal.blend


Một số tệp đã không được hiển thị bởi vì quá nhiều tập tin thay đổi trong này khác