Just a thought...

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…

Take a look at Generic Properties for Blender Library Data

Mike

BINGO!!! That’s exactly what I’ve had on my mind! I hope that they will manage to include that in next release… Man, I’m excited :slight_smile:

It’s in CVS now and is basically working.

You can get CVS versions from graphicall.org, or for windows, the one I use is JMS’s build at
http://www.zoo-logique.org/3D.Blender/index.php3?zoo=com

Click on the “compilations” header in the left frame, then on the Win32xxxx link.

Mike

Big thanks Mike, I will try it. :slight_smile:

Edit:

I have tried and properties are not implemented where I need them :frowning: I would like to see this:


dir(someMesh.verts[0]) --&gt; ['co','index','no',<b>'properties',</b>'sel','uvco']
dir(someMesh.faces[0]) --&gt; ['append',...,'normal',<b>'properties'</b>,'sel',...,'v']

But hope still remains :slight_smile:

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’.