Maybe I’m not the right place for this but I whas just working on my script and I’ve realised that would be a very nice feature when Blender Mesh and Nmesh would have aditional variable for user data. Hell, that would be very usefull for all types. For eg.
Me = Blender.Object.GetSelected()[0].getData() # Get NMesh
Me.UserData = 'This is a test mesh' # Put a comment
Or more usefull:
Me.verts[0].UserData = Me.verts[0].co # Store old coordinates
Me.verts[0].co[0] = 0 #
Me.verts[0].co[1] = 0 # Set new coordinates
Me.verts[0].co[2] = 0 #
Me.verts[0].co[0] = Me.verts[0].UserData[0] #
Me.verts[0].co[1] = Me.verts[0].UserData[1] # Restore old coordinates
Me.verts[0].co[2] = Me.verts[0].UserData[2] #
Anyhow, this is only my thougt. Sorry if it whas off topic.
the second part is not exactly that useful, I think. Unless you want to use it during model building (ie adding verts). If the vert count doesn’t change then you have Shape Keys to do precisely what you suggested.
That was only an eg. That variable could contain anything that user wants. And that variable could be in every type. eg NMesh.UserData, Mesh.UserData, Curve.UserData…
Maybe store a dict of index-property pairs in the object property so you can lookup/set vert properties by index? You could also use a plain list, but a dict might be more efficient.
Thanks for the tip. I was blind, I didn’t noticed properties in objecttype :o But I have played a bit with properties on materials but IMO coders are making things more complicated then it should be :rolleyes:
I don’t understand why properties isn’t a plain dict instead of struct. Please, don’t catch on my mistakes in naming things, I will show you what I mean in eg.
ob = Blender.Object.GetSelected()[0] # Get object
ob.properties['some_name'] = 'this_is_a_string' # Create ID Property
print ob.properties['some_name'].data # Print 'some_name' property
this_is_a_string
Well, actually, there’s nothing wrong with this workflow except that is not flexible, when you create ‘some_name’ property with a string in it, you cant assign any other type to ‘some_name’ except a string.
I think that this way would be much more flexible, that is if properties would be a plain dict:
ob = Blender.Object.GetSelected()[0] # Get object
ob.properties['some_name'] = 'this_is_a_string' # Create Property
print ob.properties # Print all properties
{'some_name':'this_is_a_string'}
print ob.properties['some_name'] # Print only 'some_name' property
this_is_a_string
And joining of two objects that are having the same ‘some_name’ property could create a new property, for instance called ‘some_name-joined_object_name’.