[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [4322] contrib/py/scripts/addons/ add_mesh_rocks/rockgen.py: Update potential fix for handling object-mesh name mis-matching.
Paul Marshall
portsidepaul at hotmail.com
Sun Feb 24 06:40:08 CET 2013
Revision: 4322
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=4322
Author: brikbot
Date: 2013-02-24 05:40:05 +0000 (Sun, 24 Feb 2013)
Log Message:
-----------
Update potential fix for handling object-mesh name mis-matching. If verified as working, old code (which has been commented out) will need to be removed.
Modified Paths:
--------------
contrib/py/scripts/addons/add_mesh_rocks/rockgen.py
Modified: contrib/py/scripts/addons/add_mesh_rocks/rockgen.py
===================================================================
--- contrib/py/scripts/addons/add_mesh_rocks/rockgen.py 2013-02-23 19:55:56 UTC (rev 4321)
+++ contrib/py/scripts/addons/add_mesh_rocks/rockgen.py 2013-02-24 05:40:05 UTC (rev 4322)
@@ -986,20 +986,19 @@
(x[6],-y[6],z[6]),(x[7],y[7],z[7])]
faces = [[0,1,3,2],[0,1,5,4],[0,4,6,2],[7,5,4,6],[7,3,2,6],[7,5,1,3]]
- name = "Rock." + str(base + shift).zfill(3)
+## name = "Rock." + str(base + shift).zfill(3)
+ name = "rock"
# Make object:
obj = createMeshObject(context, verts, [], faces, name)
if scaleDisplace:
- bpy.data.objects[name].scale = Vector((averageX, averageY, averageZ))
-
- print("RockGen Debug (generateObject.name): " + name)
- for m in bpy.data.meshes:
- print("RockGen Debug (generateObject): " + m.name)
+## bpy.data.objects[name].scale = Vector((averageX, averageY, averageZ))
+ obj.object.scale = Vector((averageX, averageY, averageZ))
# For a slight speed bump / Readability:
- mesh = bpy.data.meshes[name]
+## mesh = bpy.data.meshes[name]
+ mesh = obj.object.data
# Apply creasing:
if shape == 0:
@@ -1061,7 +1060,8 @@
else:
mesh.edges[i].crease = gauss(0.125, 0.025)
- return name
+ return obj.object
+## return name
# Artifically skews a normal (gaussian) distribution. This will not create
@@ -1248,13 +1248,12 @@
# *** todo completed 4/19/2011 ***
# *** Code is notably slower at high rock counts ***
- print("RockGen Debug (generateRocks): " + str(i + lastRock))
-
- name = generateObject(context, muX, sigmaX, scaleX, upperSkewX, muY,
+ rock = generateObject(context, muX, sigmaX, scaleX, upperSkewX, muY,
+## name = generateObject(context, muX, sigmaX, scaleX, upperSkewX, muY,
sigmaY, scaleY, upperSkewY, muZ, sigmaZ, scaleZ,
upperSkewZ, i, lastRock, scaleDisplace, scale_fac)
- rock = bpy.data.objects[name]
+## rock = bpy.data.objects[name]
# todo Map what the two new textures will be:
# This is not working. It works on paper so . . . ???
@@ -1334,7 +1333,8 @@
rock.modifiers[5].strength = gauss(rough, (1 / 3) * rough)
# Set mesh to be smooth and fix the normals:
- utils.smooth(bpy.data.meshes[name])
+ utils.smooth(rock.data)
+## utils.smooth(bpy.data.meshes[name])
bpy.ops.object.editmode_toggle()
bpy.ops.mesh.normals_make_consistent()
bpy.ops.object.editmode_toggle()
More information about the Bf-extensions-cvs
mailing list