sketchucation logo sketchucation
    • 登入
    Oops, your profile's looking a bit empty! To help us tailor your experience, please fill in key details like your SketchUp version, skill level, operating system, and more. Update and save your info on your profile page today!
    🔌 Smart Spline | Fluid way to handle splines for furniture design and complex structures. Download

    [REQ] Lock texture coordinates

    已排程 已置頂 已鎖定 已移動 Plugins
    28 貼文 7 Posters 4.0k 瀏覽 7 Watching
    正在載入更多貼文
    • 從舊到新
    • 從新到舊
    • 最多點贊
    回覆
    • 在新貼文中回覆
    登入後回覆
    此主題已被刪除。只有擁有主題管理權限的使用者可以查看。
    • Chris FullmerC 離線
      Chris Fullmer
      最後由 編輯

      Interesting, thats something I'll look into the next release of shape bender.

      Chris

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

      1 條回覆 最後回覆 回覆 引用 0
      • GaieusG 離線
        Gaieus
        最後由 編輯

        I'm listening guys, I'm listening... 😳

        (BTW Thom; this is one aspect I mentioned before)

        Gai...

        1 條回覆 最後回覆 回覆 引用 0
        • D 離線
          dacad
          最後由 編輯

          Thanks for the explanation thomthom and Chris Fullmer.

          I was hoping it would be possible but that's too bad...😞. Even if it were updated manually as thom said it would still be great because i think most people would just want the textured model for the final image and not while modeling, posing or whatever, it wouldn't work just for animations.

          I'm starting to see ruby as a way for sketchup developers don't work to much...

          1 條回覆 最後回覆 回覆 引用 0
          • thomthomT 離線
            thomthom
            最後由 編輯

            I might be possible. It's just not very easy to do. At least not automatically. UV mapping is one of the areas in SU scripting that currently feel like a bit of black magic.

            @unknownuser said:

            I'm starting to see ruby as a way for sketchup developers don't work to much...

            ❓

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

            1 條回覆 最後回覆 回覆 引用 0
            • D 離線
              dacad
              最後由 編輯

              I mean that since ruby was introduced it was at the beggining a great way to add specific functions and automatize some actions, and then turn into part of sketchup develpment itself (every "new" stuff that it's presented it's a ruby plugin like DCs and sandbox, and this brings a dated engine to his knees) and the only hope to solve bugs and limitations of the software (we need a plugin to work as follow me was supost to, or just to draw a basic curve shape...) without google having to do nothing (the users work for advance features and solving bugs in the tools instead of the developers).

              Keep in mind that we don't have any new modeling tool, animation tool or mapping/texture tool since follow me and sandbox in sketchup 4-5...but i believe that this develpment path was more a marketing decision then a development one, but still a (very) bad marketing decision

              1 條回覆 最後回覆 回覆 引用 0
              • D 離線
                dacad
                最後由 編輯

                But back to topic, maybe the best way for this need is to export the mesh to other 3d package texture it there and import it again to set up the final scene, but the big problem here is that importers have big problems with keeping the textures in place with uvwarping or big meshs...But is there any better way to do this??

                1 條回覆 最後回覆 回覆 引用 0
                • D 離線
                  dacad
                  最後由 編輯

                  thanks thomthom.
                  That's what i suspected. with so many software i use to each task, i'm starting to mix up shortcuts keys lolol.

                  1 條回覆 最後回覆 回覆 引用 0
                  • thomthomT 離線
                    thomthom
                    最後由 編輯

                    A different application might be the way to go at the moment. SU isn't very ideal for rigging. And I'm a believer of using the right tool for the right job. I think that SU might not be the right tool for this.

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

                    1 條回覆 最後回覆 回覆 引用 0
                    • W 離線
                      Whaat
                      最後由 編輯

                      Here are some methods to load and save UV sets. If someone wants to use them to create a 'lock texture' plugin, that's fine with me. 😄

                      def store_uvs(ents,uvset)
                      
                      face=0
                      case uvset
                      	when 0
                      		key="uv0"
                      	when 1
                      		key="uv1"
                      	when 2
                      		key="uv2"
                      	when 3
                      		key="uv3"
                      end
                      
                      Sketchup.active_model.start_operation "Save UV set"
                      
                      for e in ents
                      	
                      	if (e.valid?) and (e.class==Sketchup;;Face)
                      		
                      		polymesh=e.mesh 5
                      		uvs=polymesh.uvs 5
                      		for i in (0..uvs.length-1)
                      			uvs[i]=uvs[i].to_a  #converts the Point 3D objects to arrays so they won't be transformed
                      		end
                      		e.set_attribute 'uvs',key,uvs
                      	
                      	face=face+1
                      	Sketchup.set_status_text("Stored uvs for #{face} faces.")
                      	end
                      		
                      end
                      
                      UI.messagebox "UVs saved for #{face} faces."
                      
                      Sketchup.active_model.commit_operation
                      
                      end #function
                      
                      ###################position a texture on a material from a stored UV set
                      def position_map(entities,set)
                      
                      face=0
                      failed=0
                      return if set=="SU"  
                      key="uv"+set.to_s
                      p "positioning map"
                      p entities
                      for e in entities
                      	p e
                      	if (e.valid?) and (e.class==Sketchup;;Face)
                      		
                      		uvs=e.get_attribute 'uvs',key    #gets the stored array of uv coordinates for this face for the given uv set
                      		p uvs
                      		if uvs
                      			pos=[]
                      			polymesh=e.mesh 5   #get a polygon mesh representation of the face
                      			polygons=polymesh.polygons  
                      			poly_index=0
                      			begin
                      				for p in polygons[poly_index]
                      					point=polymesh.point_at(p.abs)
                      					if point
                      						pos.push(point) 
                      						pos.push(uvs[p.abs-1])
                      					end
                      				end
                      
                      				e.position_material e.material, pos, true
                      				face=face+1
                      				Sketchup.set_status_text("Loaded uvs for #{face} faces")
                      			rescue  #this is required because SketchUp sometimes fails to position the texture properly
                      				poly_index=poly_index+1
                      				if polygons[poly_index]
                      					pos=[]
                      					retry  #try to postion texture again using next polygon in the face
                      				else
                      					failed=failed+1
                      				end
                      			end
                      	
                      			
                      		end
                      	end
                      end
                      
                      if failed>0
                      	stext="Unable to load
                      	UVs for #{failed} faces.  Loaded UVs for #{face} faces."
                      else
                      	stext="Loaded UVs for #{face} faces."
                      end
                      
                      #UI.messagebox (stext)
                      
                      
                      end  #end position map
                      

                      SketchUp Plugins for Professionals

                      1 條回覆 最後回覆 回覆 引用 0
                      • D 離線
                        dacad
                        最後由 編輯

                        WOW, thanks Whaat. Has always you're great!:)
                        My knowledge in ruby is very limited so can anyone help with this? (or change the name of this topic to "[Request]Lock texture coordinates")
                        Thanks in advance

                        1 條回覆 最後回覆 回覆 引用 0
                        • R 離線
                          remus
                          最後由 編輯

                          Unfortunately it isnt quite as easy as that. Ruby has it's own separate commands that dont necessarily match those that you see in the SU UI.

                          I suppose you could think of it as ruby seeing a different UI to what the user sees: sometimes the stuff we see matches up with what ruby sees, sometimes ruby sees extra stuff we dont see and sometimes we see stuff ruby doesnt see.

                          http://remusrendering.wordpress.com/

                          1 條回覆 最後回覆 回覆 引用 0
                          • J 離線
                            Jackson
                            最後由 編輯

                            I was going to post a request/enquiry regarding this precise issue when I found this post. What baffles me is that this can already be done per individual face via the left click texture position editor (Right click on face>Texture>Position>Enter) which is fine for cuboids, but is pretty much useless when working on large triangulated meshes.

                            As it's already possible on a per face basis in SU is it not relatively simple to write a ruby which simply repeats this action on all selected faces? Easy for me to say seeing as am and most likely always will be completely useless at programming, but Matthieu Noblet's "Components to Groups" script got me thinking. In principle it does almost exactly what we want- allows you to select geometry/groups/components, then performs a series of right click actions upon it/them. In that case it is:

                            Select Component>Explode>Group>Deselect>Select Next Component>Explode, Group,... etc.

                            Could the same principle (or even some of the same code) not be applied to this problem so you select a mesh, and the ruby then starts the sequence: Select Face>Texture (i.e. Open Texture Editor)> Position>Enter>Select Next Face,... etc?

                            I've had a look in Matthieu's C2G code, but like I said, even basic ruby is beyond me. Matthieu's a very generous guy who I'm sure if requested would be willing to allow someone to edit and redistribute parts of it for a good cause. This ability, combined with all the recent "organic" modelling ruby scripts would be incredibly useful for SU users like myself who would rather keep 3D Max and Rhino OUT of their workflow!

                            I understand of course (or at least I think I do) that SU has major UV mapping shortfalls- as I understand it, if you stretch/deform a face in SU elasticly, there's no way for SU to stretch the texture accordingly so edges still tile with adjacent faces (though that does make me wonder how Whaat's UV Spherical Mapping tool works?), but even an automation of the current Texture>Position>Enter would be of enormous benefit.

                            p.s. guess who just spent 2 days texturing a tree! 😢

                            Jackson

                            1 條回覆 最後回覆 回覆 引用 0
                            • thomthomT 離線
                              thomthom
                              最後由 編輯

                              @jackson said:

                              I was going to post a request/enquiry regarding this precise issue when I found this post. What baffles me is that this can already be done per individual face via the left click texture position editor (Right click on face>Texture>Position>Enter) which is fine for cuboids,

                              That doesn't lock anything. If you map a texture to a face (quad - or whatever - doesn't matter) and do the Position trick - then when you move an edge or vertex the texture doesn't stick with it.

                              I wonder if you're asking for something else..?

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

                              1 條回覆 最後回覆 回覆 引用 0
                              • J 離線
                                Jackson
                                最後由 編輯

                                Tom,

                                That's what I said at the end- it doesn't stick the texture to the vertices or edges, but it does stick the texture to the face. Once you've hit Enter you can move or rotate the unedited face about as much as you want and the texture will stay in place- i.e. SU seems to create a new UV coordinates plane which is fixed coplanar to the face. In this way the texture stays fixed until you edit the vertices or edges at which point the texture "moves" or rather the texture actually stays fixed on the face's UV plane while the faces geometry floats around on it. Like I said, it wouldn't be SU's answer to pelt or shrink mapping, but each face having its own UV coordinates plane would still be an enormous help in SU.

                                Jackson

                                1 條回覆 最後回覆 回覆 引用 0
                                • R 離線
                                  remus
                                  最後由 編輯

                                  Doesnt that happen anyway? i.e. without the right click->position texture thing.

                                  http://remusrendering.wordpress.com/

                                  1 條回覆 最後回覆 回覆 引用 0
                                  • GaieusG 離線
                                    Gaieus
                                    最後由 編輯

                                    If you don't position the texture on the face,it will be positioned to the world axes. If you start moving the face around, you can see the texture "move" relative to the face but "stick" absolute to the WAxes. This can be "fixed" by positioning the texture on the face but it won't get really stuck to it but as Jackson says, it will stick to another "plane" that is "positioned" to the face itself, not the WAxes.

                                    Still if you start editing any vertex (say just start moving an edge), the texture won't follow but remain on this "invisible plane".

                                    Hard to explain something hat only virtually exists 😮 and maybe is not even so just I make up these "synonyms" to explain what I experience. 😲

                                    Gai...

                                    1 條回覆 最後回覆 回覆 引用 0
                                    • R 離線
                                      remus
                                      最後由 編輯

                                      I see what you mean, i'd never noticed that before, for some reason 😕

                                      http://remusrendering.wordpress.com/

                                      1 條回覆 最後回覆 回覆 引用 0
                                      • GaieusG 離線
                                        Gaieus
                                        最後由 編輯

                                        Well, it's not apparent until you encounter a certain case...

                                        Gai...

                                        1 條回覆 最後回覆 回覆 引用 0
                                        • 1
                                        • 2
                                        • 1 / 2
                                        • 第一個貼文
                                          最後的貼文
                                        Buy SketchPlus
                                        Buy SUbD
                                        Buy WrapR
                                        Buy eBook
                                        Buy Modelur
                                        Buy Vertex Tools
                                        Buy SketchCuisine
                                        Buy FormFonts

                                        Advertisement