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
#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(): )
# 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
Give a better link to the total …
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)
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?
See my example, the link makes (I think so in 2.49) again visible … so does my example.
Is your ‘old’ script a secret???
No its not a secret but its so long that I didn’t want to post it here…
But if you really want it you can have it… export fbx.zip (28.5 KB)
The block I mensioned starts on line 1767.
But how does object.copy() link the mesh to the object? Am I missing something?
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!
AHH, you need it for XNA (whatever THAT is )?
I dont know what this block of code means, so I dont know how to translate it to 3.2.
Yes I need to export not only FBX, but to export bones and armatures, animations and rigged models, so the built-in script doen’t suit for my needs.
I have Blender 2.59.0
I still didnt get what object.link(me) means?
ps. i got the script from here