[Bf-committers] [PATCH] archimap.py: pack all selected objects
on *one* texture
Campbell Barton
cbarton at metavr.com
Wed Jul 12 12:41:01 CEST 2006
Hi, Melchior, I had a look at your patch. its for the archimap and its
from blender 2.41
This functionality is useful, since there is no precedent for this,
(Blenders internal unwrapper does this 1 at a time) and since I have
needed to to work the way its currently working Id prefer this be added
as an option.
In any case, you can join the objects for unwrapping most of the time
without much trouble.
- Will investigate after 2.42 release.
if you want, see if you can add an option in the PupBlock for this and
use the script from the CVS with Blender RC3.
thanks
Cam
Melchior FRANZ wrote:
> Hi,
>
> currently, the archimap unwrapper packs each of the selected objects
> on a separate texture square. My phantasy is too limited to imagine
> in which cases this might be useful. :-} What I (and several other
> people) really, really need is the ability to pack all selected objects
> on the *same* texture square. The attached patch modifies archimap.py
> to achieve that. It's quite simple: don't call packLinkedUvs() once
> per object, but collect all object data and call it only once per
> script run.
>
> m.
>
> ------------------------------------------------------------------------
>
> Index: archimap.py
> ===================================================================
> RCS file: /cvsroot/bf-blender/blender/release/scripts/archimap.py,v
> retrieving revision 1.6
> diff -u -p -r1.6 archimap.py
> --- archimap.py 8 Jul 2006 06:14:45 -0000 1.6
> +++ archimap.py 12 Jul 2006 08:08:58 -0000
> @@ -638,7 +638,7 @@ def mergeUvIslands(islandList, islandLis
>
>
> # Takes groups of faces. assumes face groups are UV groups.
> -def packLinkedUvs(faceGroups, faceGroupsArea, me):
> +def packLinkedUvs(faceGroups, faceGroupsArea, numverts):
> islandList = []
> islandListArea = []
>
> @@ -654,8 +654,8 @@ def packLinkedUvs(faceGroups, faceGroups
> facesArea = faceGroupsArea[faceGroupIdx]
> # print '.',
>
> - faceUsers = [[] for i in xrange(len(me.verts)) ]
> - faceUsersArea = [[] for i in xrange(len(me.verts)) ]
> + faceUsers = [[] for i in xrange(numverts) ]
> + faceUsersArea = [[] for i in xrange(numverts) ]
> # Do the first face
> fIdx = len(faces)
> while fIdx:
> @@ -919,6 +919,9 @@ def main():
> USER_PROJECTION_LIMIT_CONVERTED = cos(USER_PROJECTION_LIMIT * DEG_TO_RAD)
> USER_PROJECTION_LIMIT_HALF_CONVERTED = cos((USER_PROJECTION_LIMIT/2) * DEG_TO_RAD)
>
> + globalFaceProjectionGroupList = []
> + globalFaceProjectionGroupListArea = []
> + globalNumVerts = 0
>
> # Toggle Edit mode
> is_editmode = Window.EditMode()
> @@ -1103,14 +1106,20 @@ def main():
> # Get the faces UV's from the projected vertex.
> for f in faceProjectionGroupList[i]:
> f.uv = [MatProj * v.co for v in f.v]
> +
> + for i in faceProjectionGroupList:
> + globalFaceProjectionGroupList.append(i)
> + for i in faceProjectionGroupListArea:
> + globalFaceProjectionGroupListArea.append(i)
> + globalNumVerts += len(me.verts)
>
> - packLinkedUvs(faceProjectionGroupList, faceProjectionGroupListArea, me)
> -
> - print "ArchiMap time: %.2f" % (sys.time() - time1)
> - Window.DrawProgressBar(0.9, "ArchiMap Done, time: %.2f sec." % (sys.time() - time1))
> + packLinkedUvs(globalFaceProjectionGroupList, globalFaceProjectionGroupListArea, globalNumVerts)
> +
> + print "ArchiMap time: %.2f" % (sys.time() - time1)
> + Window.DrawProgressBar(0.9, "ArchiMap Done, time: %.2f sec." % (sys.time() - time1))
>
> - # Update and dont mess with edge data.
> - # OLD NMESH # me.update(0, (me.edges != []), 0)
> + # Update and dont mess with edge data.
> + # OLD NMESH # me.update(0, (me.edges != []), 0)
>
> Window.DrawProgressBar(1.0, "")
> Window.WaitCursor(0)
> @@ -1124,4 +1133,4 @@ if __name__ == '__main__':
> print '\nUser Canceled.'
> Draw.PupMenu('user canceled execution, unwrap aborted.')
> Window.DrawProgressBar(1.0, "")
> - Window.WaitCursor(0)
> \ No newline at end of file
> + Window.WaitCursor(0)
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Bf-committers mailing list
> Bf-committers at projects.blender.org
> http://projects.blender.org/mailman/listinfo/bf-committers
>
--
Campbell J Barton
133 Hope Street
Geelong West, Victoria 3218 Australia
URL: http://www.metavr.com
e-mail: cbarton at metavr.com
phone: AU (03) 5229 0241
More information about the Bf-committers
mailing list