[REL] Blender rFactor2 Export Scripts

Updated 18 August 2024. Link in first post. Update for use with Blender 4.2

Changes:
- Blender 4.2 slightly changed the Principled BSDF shader node. Made corrections to the node trees to match the changes.
- Blender 4.2 loop normals now account for sharp edges and such. Use of custom split normals removed, and values of loop normals used.
- Calculations of tangents and bitangents removed. Uses Blender tangent and bitangents.
 
Blender 5.0 has three changes that affected the scripts.

The biggest is node trees no longer have custom properties. So I had to move the rF2 shader info from node trees back to materials. This means that existing .blends will not have valid rF2 shaders when loaded in Blender 5.0. I've written a routine to move the properties. The routine is accesible via rFactor2 Menu/ Prep for Blend 5.0. If that appears in the rF2 Menu then run it then save your .blend. For safety, I recommend saving with a new name, indicating it is for 5.0. That .blend should load in Blender 5.0 with proper rF2 shader info in the Shader Editor panel.

The second change is the SeparateColorRGB node was changed to a generic SeparateColor, with the color format selected in the node. That affected one of the IBL shader node trees. I've corrected the code to generate that tree. No other action needed.

The third change is the Blender developers changed the bpy.ops command to join screen areas. This resulted in me finally being able to create the rFactor2 workspace as envisioned. Selecting rFactor2 Menu/ Update Scene will now create the rFactor2 workspace with it's own tab. There are four areas in the rF2 workspace: 3D View, Shader Editor, Outliner and Properties. The 3D View and Shader Editor N-panels are also opened.

The first post here will soon be updated with links to three versions of the scripts for Blender 3.6-4.1, 4.2 to 4.5 and 5.0. The first two will have the Prep for Blender 5.0 routine. Further script development will continue with Blender 5.0.

EDIT: First post updated.
 
Last edited:
@Traveller - I appreciate all you do with these scripts!

I feel like they update Blender too often these days, faster than I can keep up with them. It's been about every 2 years that a major version upgrade is released. Hopefully that will slow down.
 
Back
Top