sketchucation logo sketchucation
    • Login
    🤑 SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now

    Material attributes in .SKM

    Scheduled Pinned Locked Moved SketchUp Bug Reporting
    sketchup
    1 Posts 1 Posters 644 Views 1 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.
    • A Offline
      avariant
      last edited by

      Material attributes, stored in a material's attribute dictionaries, are not loaded correctly from an .SKM file.

      When you apply attributes to a material, and save that material as an SKM, the attributes are saved correctly. If you rename the SKM as a zip and examine the document.xml, the attribute dictionaries are all listed, all correct.
      But when you load that material into a new scene and apply it to a face, the attribute dictionaries are not restored correctly.

      What I've observed is that the number of dictionaries is reported correctly, but each dictionary reports it's name and keys/values as those stored only in the first dictionary. That you get multiple dictionaries with the same name seems a bug straight off the bat. Shouldn't all attributes with the same dictionary name be stored in a single dictionary?

      To reproduce:

      1. Create a face.
      2. Apply any material to it (front face).
      3. Select that face.
      4. open ruby console
      5. in ruby console:
      
         mat = Sketchup.active_model.selection.first.material
         mat.set_attribute("Dict_A", "Prop_A", "AAA")
         mat.set_attribute("Dict_B", "Prop_B", "BBB")
      
      
      1. Open Materials Dialog
      2. Select "In Model" materials
      3. Select "Save Library As"; Save where convenient
      4. Close and reopen SU
      5. Create new scene. Create a face.
      6. Load the library saved above.
      7. Apply the previous material to the face
      8. select the face
      9. in ruby console:
      
          mat = Sketchup.active_model.selection.first.material
          mat.get_attribute("Dict_A", "Prop_A")
          mat.get_attribute("Dict_A", "Prop_A")
          array = mat.attribute_dictionaries.to_a
          array[0].name
          array[1].name
          array[0]["Prop_A"]
          array[1]["Prop_B"]
      
      

      The results of the above ruby commands will demonstrate that the attributes are not loaded. However, the documents.xml file in the .skm clearly shows that the attributes are stored, and correct. The bug is on loading.

      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