sketchucation logo sketchucation
    • Login
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info

    SU Ruby Bug? not returning all materials

    Scheduled Pinned Locked Moved SketchUp Bug Reporting
    sketchup
    14 Posts 4 Posters 2.0k Views 4 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • thomthomT Offline
      thomthom
      last edited by

      Attaching an example file. One of the building from the model. It's the corner texture that's missing from renders, SU Material list and API list.

      
      i=0
      0
      Sketchup.active_model.materials.each {|m| puts 'Material' + m.name + ' - ' + (i+=1).to_s}
      MaterialUtenomshus - 1
      MaterialUtenomshus - Tak - 2
      Materialoppriss jomfrugt. 5 - 3
      #<Sketchup;;Materials;0x9300d28>
      Sketchup.active_model.materials.length
      4
      
      

      Should be four material. Four is actually seen. But only 3 is listed and accessible.


      Group#3.skp

      Thomas Thomassen — SketchUp Monkey & Coding addict
      List of my plugins and link to the CookieWare fund

      1 Reply Last reply Reply Quote 0
      • thomthomT Offline
        thomthom
        last edited by

        It can be accessed if I do a

        
        for i in 0..Sketchup.active_model.materials.length-1
           puts Sketchup.active_model.materials[i].name
        end
        
        

        but at the same time it won't list if you do

        
        Sketchup.active_model.materials.each
        
        

        Thomas Thomassen — SketchUp Monkey & Coding addict
        List of my plugins and link to the CookieWare fund

        1 Reply Last reply Reply Quote 0
        • GaieusG Offline
          Gaieus
          last edited by

          Tom,

          If you right click that face and go to the entity info box and click on the image to edit, it says (at the "Use texture image box) "Jomfrugt. 5 oppriss hjørne.jpg". Can this non standard character (or even the dot in the originalimage name) be the culprit?

          Gai...

          1 Reply Last reply Reply Quote 0
          • thomthomT Offline
            thomthom
            last edited by

            Haven't had any problems before.
            And I can create a brand new material with the same bitmap with no problems.

            All though, if I have the missing material as the current material and create a new one, that material is also missing.

            Thomas Thomassen — SketchUp Monkey & Coding addict
            List of my plugins and link to the CookieWare fund

            1 Reply Last reply Reply Quote 0
            • thomthomT Offline
              thomthom
              last edited by

              Exported to SU6 and tried there. Same thing happens. So it's not something new to SU7.

              Thomas Thomassen — SketchUp Monkey & Coding addict
              List of my plugins and link to the CookieWare fund

              1 Reply Last reply Reply Quote 0
              • GaieusG Offline
                Gaieus
                last edited by

                Okay, I only gave blind shot.

                Gai...

                1 Reply Last reply Reply Quote 0
                • thomthomT Offline
                  thomthom
                  last edited by

                  Thanks. It was worth a shot. Being a user of more letters than just A-Z I often come across applications that doesn't deal well with non-English characters. But I think SU is Unicode now and handles it well.

                  Since it's not just the API that return incorrect list of materials, but also Sketchup's material editor I think this post belongs to the Bug forum.

                  Thomas Thomassen — SketchUp Monkey & Coding addict
                  List of my plugins and link to the CookieWare fund

                  1 Reply Last reply Reply Quote 0
                  • A Offline
                    azuby
                    last edited by

                    Sketchup.active_model.materials.each { |mat| p mat }
                    

                    works fine. Result:

                    #<Sketchup;;Material;0xf2a5110>
                    #<Sketchup;;Material;0xf2a50e0>
                    #<Sketchup;;Material;0xf2a50b0>
                    #<Sketchup;;Material;0xf2a5080>
                    #<Sketchup;;Material;0xf2a5050>
                    #<Sketchup;;Material;0xf2a5020>
                    #<Sketchup;;Material;0xf2a4ff0>
                    #<Sketchup;;Material;0xf2a4fc0>
                    

                    azuby

                    *error initus :: Blocks | CurrentDate | d/Code | extensionmanager | FFlipper | HideEdges | MeasuredArea | ModelHistory | PluginsHelp | PronButton | SAWSO | SCP | SU²CATT

                    Bad English? PM me, correct me. :smile:**

                    1 Reply Last reply Reply Quote 0
                    • thomthomT Offline
                      thomthom
                      last edited by

                      It only happens on this particular model. At least from what I've noticed.

                      Thomas Thomassen — SketchUp Monkey & Coding addict
                      List of my plugins and link to the CookieWare fund

                      1 Reply Last reply Reply Quote 0
                      • A Offline
                        avariant
                        last edited by

                        If you check the texture.filename for the material that doesn't show up, it's a network path. Maybe that's why; maybe it times out looking for the path and so never shows up?

                        \Arc4063\fasademontasje th. angells gate\fasadefoto\montasjer jpg\Jomfrugt. 5 oppriss hjørne.jpg

                        1 Reply Last reply Reply Quote 0
                        • thomthomT Offline
                          thomthom
                          last edited by

                          It's not that either. I had other materials in the model with that network path. (Network path doesn't exist anymore as it's a very old model.)

                          And if I have picked one of the missing material with the Material Picker, then make a new material, the new material is also missing. But if I have any of the other materials, or the default materials selected when I make the new material, then everything works fine.

                          Thomas Thomassen — SketchUp Monkey & Coding addict
                          List of my plugins and link to the CookieWare fund

                          1 Reply Last reply Reply Quote 0
                          • A Offline
                            avariant
                            last edited by

                            Wow, that's a weird one. Deleting the texture doesn't make a difference, nor does changing the texture.
                            You said it's an old model? Maybe it's a "backwards-compatibility" bug, like somehow when they updated the material from it's previous version to SU6/7 (when you opened the file), something was missing that keeps it from being displayed. I'd say bug for sure.

                            The fact that creating new materials from it result in non-working materials somewhat supports the theory. They probably do a bitwise-copy of the existing material, making an exact duplicate, so whatever is corrupted in the original is messed up in the new ones.

                            1 Reply Last reply Reply Quote 0
                            • thomthomT Offline
                              thomthom
                              last edited by

                              Yea, this model could be SU4 or SU5 originally. The one I opened was SU6. Problem is, resaving doesn't work. The bug follows the model. But I need to use that model.

                              I got around it though by making a script that found the missing materials, and made fresh new copies of the materials, then iterate over the model and replace the old buggy materials with the new ones. That preserves the UV mapping that was done.

                              I guess this is one of the one timers kind-of bug.

                              I did have problems with the same model earlier. Due to the network paths. But only when I had V-Ray installed. V-Ray would try to access the original bitmap, but the path doesn't exist any more. So everything I did anything in SU, it'd freeze for 30secs. I sorted it by writing a script that'd export all textures of networked materials and reload them from a local path. Though, at that time I didn't notice I was missing some textures.

                              weird stuff. and I'm stuck with this model. ghnngh

                              Thomas Thomassen — SketchUp Monkey & Coding addict
                              List of my plugins and link to the CookieWare fund

                              1 Reply Last reply Reply Quote 0
                              • 1 / 1
                              • First post
                                Last post
                              Buy SketchPlus
                              Buy SUbD
                              Buy WrapR
                              Buy eBook
                              Buy Modelur
                              Buy Vertex Tools
                              Buy SketchCuisine
                              Buy FormFonts

                              Advertisement