[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [3364] contrib/py/scripts/addons/ space_view3d_paint_bprojection.py: BProjection: now applyimage is a function not and operation anymore it make the addon faster
geo kgeo
kgeogeo at hotmail.com
Fri May 11 22:39:50 CEST 2012
Revision: 3364
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=3364
Author: kgeogeo
Date: 2012-05-11 20:39:49 +0000 (Fri, 11 May 2012)
Log Message:
-----------
BProjection: now applyimage is a function not and operation anymore it make the addon faster
Modified Paths:
--------------
contrib/py/scripts/addons/space_view3d_paint_bprojection.py
Modified: contrib/py/scripts/addons/space_view3d_paint_bprojection.py
===================================================================
--- contrib/py/scripts/addons/space_view3d_paint_bprojection.py 2012-05-11 20:19:39 UTC (rev 3363)
+++ contrib/py/scripts/addons/space_view3d_paint_bprojection.py 2012-05-11 20:39:49 UTC (rev 3364)
@@ -62,6 +62,22 @@
v = em.location - pos_cur
sd.cursor_location = v
+def applyimage(context):
+ img = bpy.data.textures['Texture for BProjection'].image
+ em = bpy.data.objects['Empty for BProjection']
+ ob = context.object
+
+ face = ob.data.polygons
+ uvdata = ob.data.uv_textures.active.data
+
+ for f,d in zip(face,uvdata):
+ if f.select:
+ d.image = img
+
+ align_to_view(context)
+ print(len(uvdata))
+ ob.data.update()
+
# Function to update the properties
def update_Location(self, context):
align_to_view(context)
@@ -105,7 +121,7 @@
em.custom_old_scaleuv = s
- bpy.ops.object.applyimage()
+ applyimage(context)
def update_PropUVScale(self, context):
em = bpy.data.objects['Empty for BProjection']
@@ -133,7 +149,7 @@
d.uv = [d.uv[0] - oo[0]/10 + o[0]/10, d.uv[1] - oo[1]/10 + o[1]/10]
em.custom_old_offsetuv = o
- bpy.ops.object.applyimage()
+ applyimage(context)
# Function to update the flip horizontal
def update_FlipUVX(self, context):
@@ -144,7 +160,7 @@
x = d.uv.x
d.uv.x = 1 - x
- bpy.ops.object.applyimage()
+ applyimage(context)
# Function to update the flip vertical
def update_FlipUVY(self, context):
@@ -155,7 +171,7 @@
y = d.uv[1]
d.uv[1] = 1 - y
- bpy.ops.object.applyimage()
+ applyimage(context)
# Function to update
def update_Rotation(self, context):
@@ -415,7 +431,7 @@
if prop.custom_image != '':
if bpy.data.textures['Texture for BProjection'].image.name != prop.custom_image:
bpy.data.textures['Texture for BProjection'].image = bpy.data.images[prop.custom_image]
- bpy.ops.object.applyimage()
+ applyimage(context)
if em.custom_flipuvx != prop.custom_flipuvx:
em.custom_flipuvx = prop.custom_flipuvx
if em.custom_flipuvy != prop.custom_flipuvy:
@@ -589,18 +605,7 @@
bl_label = "Apply image"
def execute(self, context):
- img = bpy.data.textures['Texture for BProjection'].image
- em = bpy.data.objects['Empty for BProjection']
- ob = context.object
-
- face = ob.data.polygons
- uvdata = ob.data.uv_textures.active.data
-
- for f,d in zip(face,uvdata):
- if f.select:
- d.image = img
-
- align_to_view(context)
+ applyimage(context)
return {'FINISHED'}
More information about the Bf-extensions-cvs
mailing list