sketchucation logo sketchucation
    • Login
    πŸ€‘ SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now

    Face Me Scaling bug?

    Scheduled Pinned Locked Moved Developers' Forum
    11 Posts 5 Posters 325 Views 5 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.
    • Chris FullmerC Offline
      Chris Fullmer
      last edited by

      I am not succesfully getting face me components to scale. Select a face me component, then run this line of code (yes, its a single line):

      Sketchup.active_model.selection[0].transform!( Geom;;Transformation.scaling(2.0))
      

      It makes them jump around. Are other people succesfully scaling face me components? Should I do it using the transform matrix instead? Any thoughts at all on this?

      Chris

      Lately you've been tan, suspicious for the winter.
      All my Plugins I've written

      1 Reply Last reply Reply Quote 0
      • M Offline
        MartinRinehart
        last edited by

        Sketchup.active_model.selection[0].transform!( Geom;;Transformation.scaling(2.0))
        

        I don't know the answer to your question, Chris. An observation, tho: You'll get a lot more mileage from your fingertips if you create some cheater classes:

        
        class GT < Geom;;Transformation
        end
        
        

        Author, Edges to Rubies - The Complete SketchUp Tutorial at http://www.MartinRinehart.com/models/tutorial.

        1 Reply Last reply Reply Quote 0
        • thomthomT Offline
          thomthom
          last edited by

          you even need to make a class? what about GT = Geom::Transformation ?

          Thomas Thomassen β€” SketchUp Monkey & Coding addict
          List of my plugins and link to the CookieWare fund

          1 Reply Last reply Reply Quote 0
          • TIGT Offline
            TIG Moderator
            last edited by

            Lateral thinking fix ?
            Test if the instance's defn has its 'face_me' behavior set as 'true',
            if so then remember that it was and then set the defn's 'face_me' behavior to 'false',
            scale the instance,
            if you have remembered the defn's 'face_me' property was 'true' before the scaling then reset it back to 'true' now.
            ???
            πŸ’­

            TIG

            1 Reply Last reply Reply Quote 0
            • Chris FullmerC Offline
              Chris Fullmer
              last edited by

              TIG!!! That might be it! I'll try to commit that to code shortly. I really like the idea, lets hope it works as nicely as it sounds,

              Chris

              Lately you've been tan, suspicious for the winter.
              All my Plugins I've written

              1 Reply Last reply Reply Quote 0
              • M Offline
                maxim1000
                last edited by

                @chris fullmer said:

                TIG!!! That might be it! I'll try to commit that to code shortly. I really like the idea, lets hope it works as nicely as it sounds,
                Chris

                Has anybody positive results with this technique?
                I've tried to make always_face_camera false, scale and then return back always_face_camera to true, but on the last step, model becomes shifted and has "jumping" behavior.

                1 Reply Last reply Reply Quote 0
                • thomthomT Offline
                  thomthom
                  last edited by

                  Instead of
                  t = Geom::Transformation.scaling(2.0)
                  use this variant:
                  t = Geom::Transformation.scaling(2.0, 2.0, 2.0)

                  Think that works.

                  Thomas Thomassen β€” SketchUp Monkey & Coding addict
                  List of my plugins and link to the CookieWare fund

                  1 Reply Last reply Reply Quote 0
                  • M Offline
                    maxim1000
                    last edited by

                    @thomthom said:

                    Instead of
                    t = Geom::Transformation.scaling(2.0)
                    use this variant:
                    t = Geom::Transformation.scaling(2.0, 2.0, 2.0)

                    Think that works.

                    Wow... Thanks.
                    Just curious: how did you find out this?

                    1 Reply Last reply Reply Quote 0
                    • thomthomT Offline
                      thomthom
                      last edited by

                      I didn't. Think Chris came across it trying to work it out.

                      t = Geom::Transformation.scaling(2.0) modifies the 16th value in the transformation matric that makes lots of things go wrong.

                      t = Geom::Transformation.scaling(2.0, 2.0, 2.0) ensures a proper transformation.

                      Go figure.

                      Thomas Thomassen β€” SketchUp Monkey & Coding addict
                      List of my plugins and link to the CookieWare fund

                      1 Reply Last reply Reply Quote 0
                      • Chris FullmerC Offline
                        Chris Fullmer
                        last edited by

                        Exactly. If you use the built in uniform scaling method, then SU cheats and just adjusts the 16 element of the matrix, which acts as a multiplier over the rest of the matrix. Previous versions of SketchUp recognized this odd behavior and worked with it. But 7.1, when they re-wrote the SU rendering engine, they did not acccount for this cheap scaling shortcut, so it does not display face-me components whose 16th value is anything other than 1 very well - hence the jumping and spinning.

                        BUT, if you instead use the scaling method that lets you modify each axis separately (like Thom showed with 3 parameters), and set them to all be the same - it acts just like a uniform scale, AND SU takes the time to write all the scale factors correctly into the matrix where they should be, and it leaves the 16 element at 1.

                        AND 3rd aprty renderers do not appreciate the 16th element of the matrix being anything other than 1 also. So they often freak out when they come across these face-me's that have been incorrectly scaled.

                        Yeah, this was a fun bug to track down πŸ‘Ώ

                        Lately you've been tan, suspicious for the winter.
                        All my Plugins I've written

                        1 Reply Last reply Reply Quote 0
                        • thomthomT Offline
                          thomthom
                          last edited by

                          @chris fullmer said:

                          AND 3rd aprty renderers do not appreciate the 16th element of the matrix being anything other than 1 also. So they often freak out when they come across these face-me's that have been incorrectly scaled.

                          Previous version of VfSU didn't like that type of transformation.
                          The new one seem to deal with it properly.

                          @chris fullmer said:

                          Yeah, this was a fun bug to track down πŸ‘Ώ

                          Obcurity - thy name is SketchUp!

                          Thomas Thomassen β€” SketchUp Monkey & Coding addict
                          List of my plugins and link to the CookieWare fund

                          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