I actually rememberd that I saw that, and did this edit, and got a huge error
dump after that… Apparently once it got through that problem, something else
happened…
I think this should not be difficult to fix. Maybe those two specific problems
can be taken care of by whoever’s working on the code? The incorrect node
should be replaced by a correct one, and maybe there’s a way to prevent the
creation of gTLF setting with “.00x” tails? That would be the best solution.
My manual fix of those 2 things is time-consuming when I have a large material
library. But it’s easy enough if this is done while converting specific
materials for the first time.
Thanks @RomanDesign for sharing your findings
on this. I had complained to Blender about this change. But… Its good to
know the Node still exists in their system and can still be used. I am going
to try this on my project and see if it exports. Bill LHC
This didnt fix my issue on exporting. It goes into a loop.
The process I described works for me with Blender 3.1.0. One other note that
the migration seems to be working OK and placing a correct node now. I think
what happened with most of my materials is that I initially installed Blender
3.3 and created my Asset Library using it, so I resaved my file. And migrating
materials with Blender 3.3 cause this wrong node issue. If migrating with 3.1
it doesn’t happen apparently. But the gTLF setting steel has to be watched and
changed if overwritten.
The issue steel keeps happening and this node is randomly being reset in my
objects when using asset library, resulting in ignored ORM maps in MSFS. The
library file in Blender now has everything set up correctly, but opening
recently done object files with buildings I see that about half of the
materials now have the red node again (instead of the correct blue one),
despite they all were created with the correct library. I’m not sure when it
happens, it may be after the material is dragged from the library. The other
issue is with the “gTLF Settings” node - often when dragged from the Asset
Browser, material has the “gTLF Settings” in this note replaced by “gTLF
Settings.001” or similar, which results with it not working. I have to go to
the drop down and manually select the first instance for it to work correctly.
I haven’t changed Exporter or Blender versions since discovering the original
bug. These 2 issues are bery annoying and time-consuming to solve in a complex
project, and require to remember to manually check every material in every
object every time it’s being used, resuilting in a lot of lost time, and
missed problems requiring going back and tracing those issues. @EPellissier
@FlyingRaccoon
Activity has restarted on the Blender exporter - Can you update your git issue
#170 on the ASOBO git for the Blender exporter so this can be reviewed and
prioritized?
I just did that. Hope that’s fixed soon. It’s extremely annoying and time-
consuming. And problems will slip by unnoticed, reducing the quality of the
scenery by many developers…
@lyonhaart001
@WombiiActual
@WombiiActual I have spent ~4 hours with
ChatGPT and finally got it to write a “fixer” script for this issue. I
literally spent hours on doing it manually already, and then my whole material
library file got the red nodes again somehow (from opening and saving in
another Blender version? Or just for no reason?). Those were a couple of
hundred materials and objects, so I decided to try ChatGPT instead of spending
hours on fixing it and then possibly losing it again. Also, I had this happen
in several other files, so this needed a more automated workaround. Execute
this in the file that has those nodes turned red with “Color” input and it
will convert them to proper “Separate RGB” nodes with “Image” input and will
reconnect it to the same places as the old ones. It will also automatically
remap extra “gITF Settings.00x” node groups to the default one and deletes
unused ones. I have to say ChatGPT is something else… It outputted a
reasonable code based on my description of the problem and fixed and improved
it based on my feedback until it was working fine. Took some time, but not
more than explaining it to a live programmer. I don’t have sufficient Python
and Blender knowledge to write such a script myself. Main functionality was
written in minutes, but the bulk of the time went into trying to fix the lack
of connections of the new node to the same places as the old node. The ways it
mapped it didn’t work again and again. Until I instructed it to target
specific nodes for connections, by names. Basically, I can run this script
once when my file is otherwise ready for export, and it will fix all the
materials and gITF settings that bugged out during the work with the file, in
one click. Now this makes it very easy. It would be still nice if this
workaround wasn’t needed in the first place, of course.
1. import bpy
2.
3.
4. # Initialize a counter for the number of instances found and replaced
5. count = 0
6.
7.
8. # Loop through all objects in the file
9. for obj in bpy.data.objects:
10. # Loop through all materials in the object
11. for slot in obj.material_slots:
12. if slot.material:
13. # Check if the material has a node tree
14. if slot.material.node_tree:
15. # Get the material node tree
16. tree = slot.material.node_tree
17. # Loop through all nodes in the tree
18. for node in tree.nodes:
19. # Check if the node name contains "SplitOcclMetalRough"
20. if "SplitOcclMetalRough" in node.name:
21. # Create a new Separate RGB node
22. sep_rgb = tree.nodes.new(type="ShaderNodeSeparateRGB")
23. # Set the location of the new node
24. sep_rgb.location = node.location
25. # Copy the input connections from the old node to the new node
26. for input in node.inputs:
27. if input.name in sep_rgb.inputs:
28. for link in input.links:
29. tree.links.new(link.from_node.outputs[0], sep_rgb.inputs[input.name])
30. else:
31. if input == node.inputs[0]:
32. if input.links:
33. tree.links.new(input.links[0].from_node.outputs[0], sep_rgb.inputs[0])
34. else:
35. if input.links:
36. tree.links.new(input.links[0].from_node.outputs[0], node.inputs[input.name])
37. # Create new output connections
38. for output in sep_rgb.outputs:
39. if output.name == "R":
40. occlusion_node = tree.nodes.get("Occlusion Multiplier")
41. if occlusion_node:
42. tree.links.new(output, occlusion_node.inputs[1])
43. elif output.name == "G":
44. roughness_node = tree.nodes.get("Roughness Multiplier")
45. if roughness_node:
46. tree.links.new(output, roughness_node.inputs[1])
47. elif output.name == "B":
48. metallic_node = tree.nodes.get("Metallic Multiplier")
49. if metallic_node:
50. tree.links.new(output, metallic_node.inputs[1])
51. # Remove the old node from the tree
52. tree.nodes.remove(node)
53. # Increment the counter
54. count += 1
55.
56.
57. # Output the number of instances found and replaced in the console
58. print("Found and replaced", count, "instances of SplitOcclMetalRough nodes.")
59.
60.
61. # Find all node groups with "glTF Settings.00" in their name
62. matching_groups = [group for group in bpy.data.node_groups if "glTF Settings.00" in group.name]
63.
64.
65. # Find the "glTF Settings" node group
66. new_group = bpy.data.node_groups.get("glTF Settings")
67.
68.
69. # Remap users of the matching node groups to the new group
70. count = 0
71. for obj in bpy.context.scene.objects:
72. if obj.type != 'MESH':
73. continue
74. for group in matching_groups:
75. if group.users:
76. group.user_remap(new_group)
77. count += 1
78.
79.
80. # Print the number of node groups renamed
81. print("Renamed {} node groups".format(count))
82.
83.
84. # Delete unused data blocks
85. bpy.ops.outliner.orphans_purge()
86.
@RomanDesign There is also a breaking change in
blender 3.3/3.4 There are breaking changes to the node for
ShaderNodeSeparateRGB has changed to ShaderNodeSeparateColor. Blender 3.4 has
breaking change with ShaderNodeMixRGB to ShaderNodeMix. Edit: the Code also
changes its input and output numbering. What was Color1, Color2 is A, B
inputs, but that will not work you must change input (1 and 2) to (6 and 7),
and then output “result” was 0 and will now be 2 Enjoy the Blender fun.
As I understand the blender exporter only supports Blender 3.3 LTS so Blender
3.4 is not a problem at this stage.
Unfortunately, it doesn’t work at all for me with Blender 3.3LTS. Does it work
for you? It throws an error, unless “custom properties” checkbox is
deselected. See the issue I opened on
GitHub