0

For a dynamically sized object in Python (a cube resized into a rectangle, dimensions determined at run time), is it just too ambitious to create a script to do the unwrapping of the object? From what I can tell, unwrapping appears to be a very hands on process that might not be amenable to automation.

Just curious before I chase this down the python rabbit hole...

vndep
  • 713
  • 1
  • 9
  • 29
  • What would be the purpose of unwrapping? Seamless continuous coordinates or just non-stretched sides with uniform scale? You can just call Smart UV project from python after you've done creating and scaling the cuboid. An axis-aligned cuboid would be about the easiest shape to practice programming UV coordinates if you want to get your hands dirty. – kheetor Jul 31 '19 at 17:08
  • @kheetor The cube is resized into a very long rectangle, causing serious texture stretching. Unwrapping was prescribed as a solution. The problem is described here: https://blender.stackexchange.com/questions/146849/python-2-8-image-texture-stretch-versus-repeat – vndep Jul 31 '19 at 17:09
  • You should have kept this in your previous thread. The idea of using "Generated" texture coordinates is that you don't need to assign UV coordinates. You can negate stretching by not using generated (which are stretched to object bounds) and rather using something like Geometry -> Position instead for uniformly repeated texture. – kheetor Jul 31 '19 at 17:17
  • How would I do that in python? My code is here: https://blender.stackexchange.com/questions/146849/python-2-8-image-texture-stretch-versus-repeat – vndep Jul 31 '19 at 17:25
  • If you just switch from 'Generated' to 'Object' you'll get the object coordinates which aren't stretched. (unless you are scaling the mesh in object mode) But you aren't explaining what kind of texturing you are trying to achieve and what your meshes are like which makes giving you accurate advice difficult. – kheetor Jul 31 '19 at 17:31
  • Here a picture of the texture and the target object: https://blender.stackexchange.com/questions/146938/why-doesnt-the-image-in-the-uv-image-editor-appear-on-the-object-in-the-3d-view – vndep Jul 31 '19 at 17:52
  • Looking at that you have scaled it in object mode which means all your stretching issues are because of non-uniform object scale. You need to apply object scale and either redo unwrapping or use "Object" output of "Texture Coordinate" node. – kheetor Jul 31 '19 at 17:58
  • The scaling of the object (using python code) is (1,1,1) immediately before the texture is applied. After applying the texture there is no more rescaling – vndep Jul 31 '19 at 18:44
  • @kheetor Thanks for your help above. Would you mind taking a look at this question of mine? https://blender.stackexchange.com/questions/149322/python-2-8-transform-resize-uv-map-instead-of-object – vndep Aug 22 '19 at 00:46

0 Answers0