Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2006-05-28 06:12:49 +0400
committerCampbell Barton <ideasman42@gmail.com>2006-05-28 06:12:49 +0400
commite47719d253c3be3217816a8dc83c64e0d3d9828d (patch)
tree1f3b1582c8c73d88b1e851779df8c8356c3b9000 /release
parent83105911bf7041d94f2c2e652efc53352e6e61be (diff)
comments on how edge weighting for collapsing works.
uv_auto_layout_tex now uses the recently fixed saveRenderedImage - I needed to make clean and make to get it working.
Diffstat (limited to 'release')
-rw-r--r--release/scripts/bpymodules/BPyMesh_redux.py10
-rw-r--r--release/scripts/uv_auto_layout_tex.py18
2 files changed, 16 insertions, 12 deletions
diff --git a/release/scripts/bpymodules/BPyMesh_redux.py b/release/scripts/bpymodules/BPyMesh_redux.py
index caf3e17788a..6fc9e0f890f 100644
--- a/release/scripts/bpymodules/BPyMesh_redux.py
+++ b/release/scripts/bpymodules/BPyMesh_redux.py
@@ -386,6 +386,16 @@ def redux(ob, REDUX=0.5, BOUNDRY_WEIGHT=2.0, REMOVE_DOUBLES=False, FACE_AREA_WEI
try:
# can use perim, but area looks better.
if FACE_AREA_WEIGHT:
+ # Psudo code for wrighting
+ # angle_diff= The before and after angle difference between the collapsed and un-collapsed face.
+ # ... devide by 180 so the value will be between 0 and 1.0
+ # ... add 1 so we can use it as a multiplyer and not make the area have no eefect (below)
+ # area_weight= The faces original area * the area weight
+ # ... add 1.0 so a small area face dosent make the angle_diff have no effect.
+ #
+ # Now multiply - (angle_diff * area_weight)
+ # ... The weight will be a minimum of 1.0 - we need to subtract this so more faces done give the collapse an uneven weighting.
+
angle_diff+= ((1+(Ang(cfa.normal, new_nos[ii])/180)) * (1+(cfa.area * FACE_AREA_WEIGHT))) -1 # 4 is how much to influence area
else:
angle_diff+= (Ang(cfa.normal), new_nos[ii])/180
diff --git a/release/scripts/uv_auto_layout_tex.py b/release/scripts/uv_auto_layout_tex.py
index 15e990c8b80..d2ef0da1d07 100644
--- a/release/scripts/uv_auto_layout_tex.py
+++ b/release/scripts/uv_auto_layout_tex.py
@@ -159,24 +159,19 @@ def auto_layout_tex(mesh_list, scn, PREF_IMAGE_PATH, PREF_IMAGE_SIZE, PREF_KEEP_
# Set the render context
- render_context= render_scn.getRenderingContext()
- render_context.currentFrame(1)
- PREF_IMAGE_PATH_EXPAND= B.sys.expandpath(PREF_IMAGE_PATH + '#') + '.png'
+
+ PREF_IMAGE_PATH_EXPAND= B.sys.expandpath(PREF_IMAGE_PATH) + '.png'
# TEST THE FILE WRITING.
try:
# Can we write to this file???
f= open(PREF_IMAGE_PATH_EXPAND, 'w')
- f.write('\n')
f.close()
except:
B.Draw.PupMenu('Error: Could not write to path|' + PREF_IMAGE_PATH_EXPAND)
- scn.makeCurrent()
- B.Scene.Unlink(render_scn)
return
-
- render_context.setRenderPath(PREF_IMAGE_PATH)
+ render_context= render_scn.getRenderingContext()
render_context.imageSizeX(PREF_IMAGE_SIZE)
render_context.imageSizeY(PREF_IMAGE_SIZE)
render_context.startFrame(1)
@@ -275,16 +270,15 @@ def auto_layout_tex(mesh_list, scn, PREF_IMAGE_PATH, PREF_IMAGE_SIZE, PREF_KEEP_
for c in target_face.col:
c.r= c.g= c.b= 255
- #render_context.render()
- #render_context.saveRenderedImage('/test.png') # BROKEN.
- render_context.renderAnim()
+ render_context.render()
+ render_context.saveRenderedImage(PREF_IMAGE_PATH_EXPAND)
#if not B.sys.exists(PREF_IMAGE_PATH):
# raise 'Error!!!'
Render.CloseRenderWindow()
# NOW APPLY THE SAVED IMAGE TO THE FACES!
- print PREF_IMAGE_PATH_EXPAND
+ #print PREF_IMAGE_PATH_EXPAND
target_image= B.Image.Load(PREF_IMAGE_PATH_EXPAND)
# Set to the 1 image.