sketchucation logo sketchucation
    • Login
    1. Home
    2. joshb
    3. Posts
    ⚠️ Attention | Having issues with Sketchucation Tools 5? Report Here
    J
    Offline
    • Profile
    • Following 0
    • Followers 0
    • Topics 11
    • Posts 24
    • Groups 1

    Posts

    Recent Best Controversial
    • RE: Temporarility Changing Materials

      Thanks again Dan! Storing the material name works great.

      posted in Developers' Forum
      J
      joshb
    • Temporarility Changing Materials

      Hi,
      I've got an implementation question I was hoping I could get some guidance on.

      I'm implementing a custom view mode whereby I switch up the color and/or texture of specific entities based on attributes. The first part, being able to change to a new material was pretty straight forward, but I'm having trouble being able to restore the original material.

      My initial thought was to temporarily place the entities original material within its attribute dictionary, and then pull it out and restore it when the user exits the custom view mode. Right now, for some reason the material comes out of the attribute dictionary null. I'm thinking this maybe a ref count issue (the object on the dictionary gets deleted when replaced with a new one)... I've tried putting a clone and dup of the material on the attribute dictionary but neither of those methods work either.

      Is there a best-practice for doing this sort of material swap-out? Should I be able to store materials within the attribute dictionary? Is there a proper way to clone materials aside from the standard ruby methods?

      Thanks for the help,
      Josh

      posted in Developers' Forum
      J
      joshb
    • RE: Help with WebDialogs

      Thanks guys! Calling back to ruby from the onload did the trick. I'm obviously new to ruby and appreciate all the pointers.

      Thanks again for the help
      Josh

      posted in Developers' Forum
      J
      joshb
    • Help with WebDialogs

      Hi,
      I'm trying to follow the techniques outlined in the link below to interact between ruby and a web dialog
      http://sketchupapi.blogspot.com/2008/02/sharing-data-between-sketchup-ruby-and.html

      I've got the Javascript to Ruby callbacks working just fine but am running into some weirdness going the other way. My code is below. Whats happening is that as is, the javascript doesnt execute. If I uncomment the messagebox line, then it does. Are there any known quirks to be aware of? Or is the messagebox line doing something that is required and can be accomplished in some other way?

      I'm new to ruby and appreciate the help.
      Thanks,
      Josh

      def LaunchGenericEditor

      create a new web dialog

      editor = UI::WebDialog.new("Generic Editor", false, "Generic Editor", 275, 100, 50, 50, true)

      load the editor html and show the web dialog

      html_path = File.dirname(File.expand_path(FILE))
      html_path << "/GenericEditor.html"
      editor.set_file(html_path)

      editor.show

      strCommand = "addRowTest(5)"
      #UI.messagebox strCommand
      editor.execute_script(strCommand)
      end

      posted in Developers' Forum
      J
      joshb
    • 1 / 1