Blender Exporter update

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • pwillard
    3000 Post Veteran



    • Nov 1999
    • 3070
    • Cumming Ga
    • ORTS

    #1

    Blender Exporter update

    So, I noticed that the Blender 4 API changed regarding the Principled BSDF shader related to the "specular" setting. This created an annoying glitch that would break node connections for the MSTS Material handling and not perform a reconnection (what it was supposed to do) because there was no longer a "specular" connection point. This section of code was merely adjusting the way things are seen "while in Blender," but the "leaving nodes disconnected" is unsuitable for users of the latest versions of Blender. Blender API now calls this connection point "IOR" for "Incidence of Refraction," so the code needed some API version-related updating.

    TLDR;

    I fixed it. You can get it here:

    http://www.railsimstuff.com
    Just Blender now, 3DCrafter only when I have to.
    Formerly The Keystone Works (All Permissions Granted)
    Things I work on: https://github.com/pwillard
  • scottb613
    2500 Post Veteran


    • Apr 2003
    • 2848
    • Downeast Maine (soon)
    • ORTS

    #2
    Hi Pete,

    Noticed the issue - THANKS for the fix.

    Regards,
    Scott
    <a href=https://www.trainsim.com/forums/filedata/fetch?filedataid=80663&type=full title=thumb_80663.png >thumb_80663.png</a>​ My Blender Models

    Comment

    • EldoradoRailroad
      Senior Member

      • May 2010
      • 212

      #3
      Pete,

      Just to be absolutely clear....this exporter is for Blender 4.xx only, right?

      Thanks,
      Steve

      Comment

      • pwillard
        3000 Post Veteran



        • Nov 1999
        • 3070
        • Cumming Ga
        • ORTS

        #4
        Negative.

        I'm trying to keep the exporter compatible with Blender 2.8 through 4.x.

        I'm using Blender's version detection to redirect to appropriate code sections so it doesn't break for people using older releases.

        Remember, though, that I do minimal regression testing currently and only test against 4.3.2 and 3.6.10.
        http://www.railsimstuff.com
        Just Blender now, 3DCrafter only when I have to.
        Formerly The Keystone Works (All Permissions Granted)
        Things I work on: https://github.com/pwillard

        Comment

        • wacampbell
          Senior Member
          • Jun 2002
          • 492
          • BC, Canada

          #5
          Thanks for the fix. I noticed Blender version 4.0.2 was exhibiting the issue, so I adjusted line 341 to read:

          Code:
          if BlenderVersion < (4, 0, 0):
          Much appreciated.

          Wayne

          Comment

          • pwillard
            3000 Post Veteran



            • Nov 1999
            • 3070
            • Cumming Ga
            • ORTS

            #6
            Ah, good catch, that fix is in place now
            Last edited by pwillard; 01-20-2025, 13:06.
            http://www.railsimstuff.com
            Just Blender now, 3DCrafter only when I have to.
            Formerly The Keystone Works (All Permissions Granted)
            Things I work on: https://github.com/pwillard

            Comment

            • pwillard
              3000 Post Veteran



              • Nov 1999
              • 3070
              • Cumming Ga
              • ORTS

              #7
              The exporter has been updated to work better with release 4.5 LTS of Blender. https://github.com/pwillard/Blender_MSTS_ORTS_Exporter
              http://www.railsimstuff.com
              Just Blender now, 3DCrafter only when I have to.
              Formerly The Keystone Works (All Permissions Granted)
              Things I work on: https://github.com/pwillard

              Comment

              • wacampbell
                Senior Member
                • Jun 2002
                • 492
                • BC, Canada

                #8
                Thanks for the update!

                Comment

                • eric
                  9500 Post Veteran and Administrator



                  • Dec 2002
                  • 9583
                  • NS MP245.4 CNO&TP South District
                  • English, SQL
                  • General

                  #9
                  Thanks for keeping it version sensitive.
                  If you like what you see here at Trainsim.com, be it the discussions and knowledge in the forums, or items available in our library, I hope you'll consider a paid membership to help support keeping the site operating.... Thanks!

                  Comment

                  • pwillard
                    3000 Post Veteran



                    • Nov 1999
                    • 3070
                    • Cumming Ga
                    • ORTS

                    #10
                    Well, I don't like leaving people out in the cold if they use an older version they are comfortable with.

                    To be honest, I'm kind of nervous about Blender 5.0 release.
                    http://www.railsimstuff.com
                    Just Blender now, 3DCrafter only when I have to.
                    Formerly The Keystone Works (All Permissions Granted)
                    Things I work on: https://github.com/pwillard

                    Comment

                    • pwillard
                      3000 Post Veteran



                      • Nov 1999
                      • 3070
                      • Cumming Ga
                      • ORTS

                      #11
                      I thought I understood what I read in the Blender change documents... but I guess I didn't.

                      Note: I'm still working on some bits and pieces of the Exporter so it works reliably on Blender version 5. For now, I would recommend sticking with Blender 4.5 LTS and Exporter Version 4.8, which works as intended. I'm still having some concerns with Version 4.81 and Blender 5.0 regarding materials/textures.

                      Blender 5 made some changes to how Principled BSDF identifiers are called, which is messing things up, and I need to figure out "what to do" to fix it.

                      It's looking like changes to the code need to be far more extensive... <sigh>

                      Hmmm. It changed how temporary mesh objects get cleaned up and that seems to be a big part of the problems. (immediate removal instead of "hang around until I'm done with you")
                      Last edited by pwillard; 01-01-2026, 08:45.
                      http://www.railsimstuff.com
                      Just Blender now, 3DCrafter only when I have to.
                      Formerly The Keystone Works (All Permissions Granted)
                      Things I work on: https://github.com/pwillard

                      Comment

                      • pwillard
                        3000 Post Veteran



                        • Nov 1999
                        • 3070
                        • Cumming Ga
                        • ORTS

                        #12
                        Just an update to say that the Blender S-File exporter add-on's latest release has been "lightly" tested with the recent Blender 5.2 LTS release with no obvious issues.

                        Blender Export Add-on for Exporting of S-File format for use with MSTS or ORTS rail simulators - Releases · pwillard/Blender_MSTS_ORTS_Exporter
                        http://www.railsimstuff.com
                        Just Blender now, 3DCrafter only when I have to.
                        Formerly The Keystone Works (All Permissions Granted)
                        Things I work on: https://github.com/pwillard

                        Comment

                        • scfe_fan
                          1000 Post Veteran


                          • Oct 2006
                          • 1207
                          • Griffith, Indiana, USA

                          #13
                          Hey Pete, I have the newest version of the exporter and the newest version of blender after I just built a new PC system and I'm running into export issues with locomotives. I can export scenery objects just fine but I get this message when trying to export a locomotive.

                          BlenderError.jpg
                          Don't tell me the sky's the limit, when there's footsteps on the moon..

                          --Josh--

                          Comment

                          • pwillard
                            3000 Post Veteran



                            • Nov 1999
                            • 3070
                            • Cumming Ga
                            • ORTS

                            #14
                            Well, lightly tested does leave room for error. I'll look into it. I might have messed up Animations handling.

                            Yup, Blender 5 handles it differently, so I needed to code a way to process it the new way and have compatibility with the old way. I thought I had already coded a fix for this (in fact, I documented it in my notebook), but I might have lost the actual update during a hard drive rebuild from recent backups and not realized the impact on what I uploaded. I'll prepare an update and upload it later. (Makes me wonder what else I lost)
                            Last edited by pwillard; 08-02-2026, 09:07.
                            http://www.railsimstuff.com
                            Just Blender now, 3DCrafter only when I have to.
                            Formerly The Keystone Works (All Permissions Granted)
                            Things I work on: https://github.com/pwillard

                            Comment

                            • scfe_fan
                              1000 Post Veteran


                              • Oct 2006
                              • 1207
                              • Griffith, Indiana, USA

                              #15
                              Originally posted by pwillard
                              Well, lightly tested does leave room for error. I'll look into it. I might have messed up Animations handling.

                              Yup, Blender 5 handles it differently, so I needed to code a way to process it the new way and have compatibility with the old way. I thought I had already coded a fix for this (in fact, I documented it in my notebook), but I might have lost the actual update during a hard drive rebuild from recent backups and not realized the impact on what I uploaded. I'll prepare an update and upload it later. (Makes me wonder what else I lost)
                              Awesome thank you! I wasn't sure if it was something on my end since I'm still getting my new system setup how I want it and all my old programs reinstalled, so I decided to start with the easiest question first.
                              Don't tell me the sky's the limit, when there's footsteps on the moon..

                              --Josh--

                              Comment

                              Working...