Hello, I want to upgrade a old script to run on Blender 2.59. The problem is that I didn’t write the script I’m tyring to upgrade, so I dont know what this block of code does, and how to wirte that in python 3.2.
# so we keep the vert groups
if EXP_ARMATURE:
#3.2 support (prior ob.getData(mesh=1)) => what does mesh=1 mean?
orig_mesh = ob.data
if len(ob.vertex_groups) > 0:
#3.2 support (prior orig_mesh.getVertGroupNames(): )
ob.copy().link(me)
# If new mesh has no vgroups we can try add if verts are teh same
#3.2 support (prior not me.getVertGroupNames():
# vgroups were not kept by the modifier)
if len(me.vertex_groups) == 0:
#3.2 support (prior len(me.verts) == len(orig_mesh.verts):)
if len(me.vertices) == len(temp_obj22.vertices):
groupNames, vWeightDict = BPyMesh.meshWeight2Dict(orig_mesh)
BPyMesh.dict2MeshWeight(me, groupNames, vWeightDict)
Could you please help me? It always crashes on the line “ob.copy().link(me)”.
Also, I couldn’t find the BPyMesh in the docs, so I suppose it doesnt exist anymore. Is this really important or can I just comment it out?
Thanks in advance, Alex
but your problem about ob.copy().link(me)
is probably solved like this
Look at scripts/templates/addon_add_object.py to know what to import!
from the Python console:
>> o = C.active_object
>>> oc = o.copy()
>>> add_object_data(bpy.context, oc.data, operator=None)
bpy.data.scenes[‘Scene’]…ObjectBase
This gave an object copy in the 3DView
Maybe you work like this to get relevant info
vertices = [tuple(el.co) for el in oc.data.vertices]
oc is again a copy of an object.
Analog for faces and edges …?!
The problem isn’t ob.copy() but ob.link(me). Looking at the documentation I think there is no object.link anymore. How can I still keep this functionality?
oh … I tried object.copy() and a copy is made, one can access it, but one does not see it without further actions …
those extra action (at least it worked by me) is described above!
I will look at FBX … export is in my Blender in the Export … (import I have not seen)
The link says: export_fbx.py so probably NO import?
So get a latest Blender I am at build revision: 40592!