SU Ruby Bug? not returning all materials
-
I came across some oddity with and model where neither the API or the SU material editor lists all materials in the model.
I noticed this when I tried to render it with V-Ray. Some textures where missing. When I picked one of the materials not rendered in the SU viewport it shows me a material with the name of Image8. But the Material Editor doesn't list it. Nor does the ruby API.
i=0 0 Sketchup.active_model.materials.each {|m| puts 'Material' + m.name + ' - ' + (i+=1).to_s} MaterialUtenomshus - 1 Materialfasade_bw - 2 Materialoppriss nordre gt. 16 - 3 Materialoppriss th.angell 13 - 4 Materialoppriss jomfrugt. 5 - 5 Materialoppriss th.angell 15 - 6 Materialoppriss th.angell 17 - 7 Materialoppriss munkegt. 31 - 8 MaterialUtenomshus - Tak - 9 Materialoppriss th.angell 24 - 10 Materialoppriss th.angell 20 - 11 Materialoppriss nordre gt. 18-20 copy - 12 MaterialMunke27_corner - 13 Materialmunke30_corner - 14 MaterialNordregt 16 - fasade til veit - 15 MaterialDarkKhaki3 - 16 MaterialVegetasjon 03 - 17 MaterialVegetasjon 02 - 18 MaterialVegetasjon 01 - 19 MaterialBakke - 20 MaterialVegetation_Ivy_Hedera - 21 MaterialGlassTak Glass - 22 MaterialSøyle Hvit - 23 Materialsilver_matte - 24 MaterialMaterial1 - 25 #<Sketchup;;Materials;0x9316940> Sketchup.active_model.materials.length 33
See how it lists only 25, but still claims there is 33 materials. What gives?
Not sure if I should post this here or in the Sketchup Bugs section...
-
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.
-
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
-
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?
-
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.
-
Exported to SU6 and tried there. Same thing happens. So it's not something new to SU7.
-
Okay, I only gave blind shot.
-
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.
-
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
-
It only happens on this particular model. At least from what I've noticed.
-
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
-
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.
-
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.
-
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
Advertisement