MAC SketchUp Materials browser does not delete materials list from Materials Folder: List -> Remove does not work

Yes, thanks John.
I tried the compress choice from Finder and it created brick1.zip
I then changed the name to newest_brick1.skm but when SketchUp opened it didn’t see it.

I vaguely remember an issue with compress, which is possibly why I switched to using Terminal for manual zipping…

sorry, but it’s a while since i did it manually…

john

If you’re using compress from Finder, be sure to select just the files from the unzipped .skm and not the parent folder. I just tried it and it works as expected for me.

Thanks @Barry. That did the trick. Rather a long workaround to change a name of an skm file but appears to be working. This issue of changing the name of the material was the most recent of several issues.

Can you please address the earlier items raised:

  1. Inability to delete user material collections using the materials window dropdown
    List>Remove.
    (problem is fully described above in beginning)

This was the second issue raised by @dvhart and also confirmed by me with a step by step description of the issue.

Zaz1

1 Like

To follow up on the above, the updated SketchUp Pro 2018 version doesn’t resolve the issue on Mojave (nor on High Sierra as reported by @zaz1). We appear at this point to have a well articulated bug report, as opposed to a usage question, related to the handling of the skm meta internal files and not removing files and directories when deleted. Is there a proper channel to report bugs to Trimble to get them worked on - as opposed to writing our own ruby plugins to workaround bugs in the underlying program?

Material panel bugs: we’re well aware. How to change a color? Unzip the skm and poke around (I edited document.xml, documentProperties.xml…look at the thumbnail), that’s what I do. I’m a bit short of time right now, so as all my college professors said: the rest is left as an exercise for the user.

Edit: couldn’t resist, I just edited the xml in document.xml, where it has colorRed, Green and Blue and gave it the values I wanted. Apologies in advance for posting blindly without reading the thread.

Appreciate the acknowledgement of the issues @Barry, thanks. Maybe my day job is bleeding through here a bit (long time software engineer, now run an engineering team) :slight_smile: . I’m looking for some kind of an issue tracker where we can watch for progress (or see target releases) and also to point others to who raise the same issue in the future. I didn’t know if such a thing existed for SketchUp - I’ll assume from your comment that it does not. I find these can go a long way toward reducing anxiety and letting users know the concern is acknowledged and being worked on. In the meantime, I’ll spend some time poking at the skm files manually to see if I can get the needed results.

Thanks for the additional update @Barry.
Looking at the issue identified by @dvhart and myself, when we try to change the material color using the SketchUp material window, the color changes are already reflected in the skm’s document.xml. The values of parameters colorRed, Green and Blue reflect the changes made using the materials window. However, when SketchUp is reopened the material window shows the original color for the material.

We have already spent the time to document and identify a deficiency which you are aware of.
For some of us, without the long history of using SketchUp, this appears to be new. So we can avoid spending more of our time on this issue, can you share with us the detailed steps for a known workaround ?

With regard to the Material Window, do you provide information in the form of a customer consumable (a wiki, FAQ, or application notes) that lists the known issues and known workarounds.?
It would help avoid spending my future time documenting known issues (either here on the forum or submitting a bug report thru https://help.sketchup.com/en/contact/technical-support).

Zaz1

You guys are right: we don’t have anything like radar.apple.com. We do have a beta user list and some developer stuff and github projects where things are public, but nothing to track something like this. Yes, the Materials feature, especially on Mac, needs a lot of TLC. It’s better than when I joined: one of the early bugs I found was if you saved a SketchUp material to the Chiclet panel, you’d crash OTHER applications when you opened the color panel. That was wild. We redid the code.

I don’t think you need to file anything. We’re well aware.

And my color persisted through restarts. I made a copy and changed it, though, unlike yours.

-b

it was quite odd what I needed to do to get a context click to make a new skm with the colorisation…

I had to create and re-load a new image file before it would re-place the ref image…

may be why SU fails as well…

@Barry, why would SU not do this automatically…

 module JcB
  module MacSkmFix
    model   = Sketchup.active_model
    sel     = model.selection
    mats    = model.materials
    # pre-create a folder name My Textures in Finder or from Materials Panel
    my_mats = File.join(Sketchup.find_support_file('Materials'), 'My Textures')

    # Right click on any textured face
    UI.add_context_menu_handler do |context_menu|
      ### added a catch for un-textured faces or back_faces...
      if sel[0].is_a?(Sketchup::Face) && (sel[0].material != nil || sel[0].back_material != nil)
        context_menu.add_item("Add to My Textures") {
          mat = sel[0].material
          mat = mat.nil? ? (sel[0].back_material) : mat
          tex = mat.texture
          name = mat.name
          tex_file = File.join(my_mats, name + '.png')
###########################################################
### I had to write out a file with colorise set to true...
###########################################################
          tex.write(tex_file, true)
###########################################################
### then re-assign it to the face...
###########################################################
          mat.texture = tex_file
          skm_file = tex_file.sub('png', 'skm')
          mat.save_as(skm_file)
          File.delete(tex_file)
        }
        context_menu.add_item("Remove from My Textures") {
          mat = sel[0].material
          name = mat.name
          skm_file = File.join(my_mats, name + '.skm')
          File.delete(skm_file)
        }
      end
    end
  end
end

EDIT: added a few catches…

@john_drivenupthewall
John,
Thanks for working on this and sharing your results.

I tried loading your code into a Ruby Console window.
After pasting it and hitting return I see a 5 at the end. Then after I select and right click Add to My Textures I see an error message. I never see the skm in the My Textures folder.
Hoping you can help get this to work for me as it looks very useful to resolve the colorizing issue.

Screen Shot 2018-12-05 at 2.36.07 PM.png

Zaz1

I added a catch for un_textured faces…

the menu should only appear when you can make a skm…

I’ll see if back faces fail here…

just copy paste the errors, select it and use the </> button to enclose the paste

john

I added code so you can sample either front or back faces…

even if you shouldn’t…

john

@john_drivenupthewall ,
You are the man!
Working well and can now colorize a texture and save it using Add to My Texture.

I have one extra complication in that I don’t normally store my SketchUp materials files at
~/Library/Application Support/SketchUp 2018/SketchUp/Materials.

They are located at
/Users/zzz1/SU FILES/local materials. I select this location using SketchUp Preferences file locations.

How would the code change to specify the location of My Textures in /Users/zzz1/SU FILES/local materials?
my_mats = File.join(Sketchup.find_support_file(‘Materials’), ‘My Textures’)

Zaz1

if you open ruby console and drag the folder in, it will format the path needed for ruby…

copy paste that to replace ’ my_mats = File.join(Sketchup.find_support_file(‘Materials’), ‘My Textures’)`
so it reads

my_mats = " <-the path you drag in goes between the double quotes-> ", you need the plain double quote to deal with spaces in file names, so if it fails turn off smart quotes via a right click >> Substitutions…

if it all works you can leave the save the file as a .rb and leave the script in the plugins folder, so it runs all the time…

post the path if you have issues and I’ll wrap it as a .rbz file…

john

@john_drivenupthewall,
Almost there. I changed one line so the path of my local materials folder is specified:

pre-create a folder name My Textures in Finder or from Materials Panel
my_mats = “/Users/zzz1/SU FILES/local materials/My Textures”

Now when I right right click the material and select Add to My Textures , the skm file shows up immediately in the My Textures folder by looking with Finder. However, inside SketchUp Materials Window, the material doesn’t appear in the My Textures collection.
When I close SketchUp and reopen it then view the My Textures collection the material is there.
Any advice as to how to correct this ?

Zaz1

you must have one with the same name in the SU Materials folder or a bad path…

try this, first…

~/SU FILES/local materials/My Textures

_______________________________________________________________________________________
reveal_in_finder
_______________________________________________________________________________________

if it opens the correct folder than the path in the ruby must differ or the path in SU Preferences is wrong…

in the script I used…

    my_mats = File.expand_path('~/SU FILES/local materials/My Textures')

in SU Prefs I used without a trailing ‘/’ or ‘My Textures’ folder…

/Users/johns_iMac/SU FILES/local materials

it all worked…

john

@john_drivenupthewall,
I did have a file in the SketchUp materials folder named SU_My Textures.
I thought the SU prefix would hide it but I guess not. I changed the name to something without My Textures and now its working. This is a very handy workaround to use until the Trimble team fixes the issue.

Once again, thank you John for all your help.

I have searched quite a bit many previous posts looking for workarounds to MAC Materials Window issues. I’m not sure if this colorize issue is new or old. Anyway, if I get a chance I may post on this topic with a table showing the known bugs (at least known to me) and the known workarounds. As I mentioned to @Barry previously, it would be good to be able to reference something like that in one place.

Zaz1

glad I could help…

quite a few of the ‘bugs’ and workarounds are on Sketchucation…

the problem is the goal posts move with every new version of OS X due to the old ‘universal’ code used in the color palette…

Names not being used is my latest annoyance…

the Pencil’s, etc… used to have names in SU now it’s Material, Material#1…

for others it’s , <auto#1>, …

john

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.