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

Layer Material Alpha - Not Possible in API?

Scheduled Pinned Locked Moved Developers' Forum
6 Posts 2 Posters 2.1k Views
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.
  • P Offline
    placidfury
    last edited by 31 Jan 2018, 18:00

    I've looked all over and can't find a way to accomplish this - is it not at all possible to set the alpha/transparency of a layer's material via the Ruby API?

    1 Reply Last reply Reply Quote 0
    • T Offline
      TIG Moderator
      last edited by 31 Jan 2018, 18:24

      You cannot set a layer's "material".
      You can set a layer's "color".
      That "color" can have an alpha setting, so it can be seen as transparent.
      Unfortunately this alpha setting is only accessible manually.
      Trying to set it through the API will always default it to 255, although the RGB values are accessible !

      TIG

      1 Reply Last reply Reply Quote 0
      • P Offline
        placidfury
        last edited by 31 Jan 2018, 18:37

        Yeah, from what I've read, under the hood the layer DOES have a true material, but the API only allows access to the color via the layer.color command for some reason - I tried setting the alpha on the layer.color and you're right, it only affects the color and not the true material, forcing you to have to use the mouse like a pleb in order to get transparency in Color By Layer mode. I really, really wish there was a true layer.material method... or even a hack via my own routine to do it, but apparently not.

        1 Reply Last reply Reply Quote 0
        • T Offline
          TIG Moderator
          last edited by 31 Jan 2018, 18:50

          It's not long ago that layer.color=... was introduced.
          But don't hold your breath for new methods...
          I think that 'they' have other fish to fry...

          TIG

          1 Reply Last reply Reply Quote 0
          • T Offline
            TIG Moderator
            last edited by 31 Jan 2018, 19:13

            You could make a set of your desired layers, with various transparent colors [even textures?] etc, and then save that model as a 'template'.
            Then if it's the default, when you open a new model it has those layers preset.
            You could also write a simple script to import the otherwise empty 'template' SKP [note that it perhaps needs a cpoint so it 'exists' for import-purposes ?] - then if one of the layers with a preset color is 'missing' - e.g. it's been purged - you reimport things...

            TIG

            1 Reply Last reply Reply Quote 0
            • P Offline
              placidfury
              last edited by 31 Jan 2018, 19:29

              I don't know - I may do something like that, but I probably won't. I have a new tool I made as part of my plugin and it creates a draw layer for different defined area types, and I just wanted it to have some level of transparency automatically so it didn't totally cover what may be underneath. But, I think I'll leave it alone for now. I just just figured I must have been missing something, as setting the layer appearance seems very... basic, to be a missing feature.

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

              Advertisement