[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [1048] contrib/py/scripts/addons/ space_view3d_copy_attributes.py: api updates.

Brendon Murphy meta.androcto1 at gmail.com
Fri Sep 17 03:20:15 CEST 2010


Revision: 1048
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-extensions&revision=1048
Author:   meta-androcto
Date:     2010-09-17 03:20:13 +0200 (Fri, 17 Sep 2010)

Log Message:
-----------
api updates.
This script will be moved to Trunk soon !

Modified Paths:
--------------
    contrib/py/scripts/addons/space_view3d_copy_attributes.py

Modified: contrib/py/scripts/addons/space_view3d_copy_attributes.py
===================================================================
--- contrib/py/scripts/addons/space_view3d_copy_attributes.py	2010-09-17 00:44:58 UTC (rev 1047)
+++ contrib/py/scripts/addons/space_view3d_copy_attributes.py	2010-09-17 01:20:13 UTC (rev 1048)
@@ -23,7 +23,7 @@
     'author': 'Bassam Kurdali, Fabian Fricke',
     'version': (0, 39),
     'blender': (2, 5, 4),
-    'api': 31881,
+    'api': 31965,
     'location': 'View3D > Ctrl/C',
     'description': 'Copy Attributes Menu from Blender 2.4',
     'wiki_url': 'http://wiki.blender.org/index.php/Extensions:2.5/Py/'\
@@ -100,7 +100,7 @@
     '''
     data_bone = context.active_object.data.bones[bone.name]
     #all matrices are in armature space unless commented otherwise
-    otherloc = active.matrix #final 4x4 mat of target, location.
+    otherloc = active.matrix_world #final 4x4 mat of target, location.
     bonemat_local = Matrix(data_bone.matrix_local) #self rest matrix
     if data_bone.parent:
         parentposemat = Matrix(
@@ -299,14 +299,14 @@
 
 
 def obDrw(ob, active, context):
-    ob.max_draw_type = active.max_draw_type
-    ob.draw_axis = active.draw_axis
-    ob.draw_bounds = active.draw_bounds
+    ob.draw_type = active.draw_type
+    ob.show_axis = active.show_axis
+    ob.show_bounds = active.show_bounds
     ob.draw_bounds_type = active.draw_bounds_type
-    ob.draw_name = active.draw_name
-    ob.draw_texture_space = active.draw_texture_space
-    ob.draw_transparent = active.draw_transparent
-    ob.draw_wire = active.draw_wire
+    ob.show_name = active.show_name
+    ob.show_texture_space = active.show_texture_space
+    ob.show_transparent = active.show_transparent
+    ob.show_wire = active.show_wire
     ob.empty_draw_type = active.empty_draw_type
     ob.empty_draw_size = active.empty_draw_size
 
@@ -354,8 +354,8 @@
 
 
 def obTex(ob, active, context):
-    if 'texspace_loc' in dir(ob.data) and 'texspace_loc' in dir(active.data):
-        ob.data.texspace_loc[:] = active.data.texspace_loc[:]
+    if 'texspace_location' in dir(ob.data) and 'texspace_location' in dir(active.data):
+        ob.data.texspace_location[:] = active.data.texspace_location[:]
     if 'texspace_size' in dir(ob.data) and 'texspace_size' in dir(active.data):
         ob.data.texspace_size[:] = active.data.texspace_size[:]
     return('INFO', "texture space copied")
@@ -368,7 +368,7 @@
 
 def obMod(ob, active, context):
     for modifier in ob.modifiers.values():
-        ob.modifiers.remove(modifier) #remove existing before adding new
+        ob.modifiers.remove(ob.modifiers[modifier]) #remove existing before adding new
     for old_modifier in active.modifiers.values():
         new_modifier = ob.modifiers.new(name=old_modifier.name,
            type=old_modifier.type)
@@ -380,14 +380,14 @@
     me_source = active.data
     me_target = ob.data
     # sanity check: do source and target have the same amount of verts?
-    if len(me_source.verts) != len(me_target.verts):
+    if len(me_source.vertices) != len(me_target.vertices):
         return('ERROR', "objects have different vertex counts, doing nothing")
     vgroups_IndexName = {}
     for i in range(0, len(active.vertex_groups)):
         groups = active.vertex_groups[i]
         vgroups_IndexName[groups.index] = groups.name
     data = {} # vert_indices, [(vgroup_index, weights)]
-    for v in me_source.verts:
+    for v in me_source.vertices:
         vg = v.groups
         vi = v.index
         if len(vg) > 0:
@@ -406,9 +406,9 @@
                     already_present = 1
             # ... if not, then add
             if already_present == 0:
-                ob.add_vertex_group(name=vgroup_name)
+                ob.vertex_groups.new(name=vgroup_name)
         # write weights
-        for v in me_target.verts:
+        for v in me_target.vertices:
             for vi_source, vgroupIndex_weight in data.items():
                 if v.index == vi_source:
 
@@ -417,7 +417,7 @@
                         groups = ob.vertex_groups
                         for vgs in range(0, len(groups)):
                             if groups[vgs].name == groupName:
-                                ob.add_vertex_to_group(v.index, groups[vgs],
+                                ob.vertex_groups.assign(v.index, groups[vgs],
                                    vgroupIndex_weight[i][1], "REPLACE")
     return('INFO', "weights copied")
 




More information about the Bf-extensions-cvs mailing list