Armature.Bone - deformDist

Scripting in Blender with Python, and working on the API

Moderators: jesterKing, stiv

Post Reply
danyright
Posts: 0
Joined: Mon May 15, 2006 4:24 pm
Location: Switzerland

Armature.Bone - deformDist

Post by danyright »

Hi everybody,

First post and first question ;-)

I'm looking to get the size of the envelope of Envelope Bones :roll: (hum, sorry for my english...)

So, I saw that an 'Instance Variable Summary' 'deformDist' exists, but it doesn't work ! :(
I've got an error if I trie to use it :

Code: Select all

Traceback (most recent call last):
  File "BSMSv0.1.1.py", line 37, in ?
AttributeError: 'Bone' object has no attribute 'deformDist'
But deformDist would give me the deform distance of the bone, and I'd like to get the envelope size of the bone, that we can see (also in Object Mode). Do you understand what I mean ?

Because I'm trying to write a script that recreate a mesh who got the form of an Envelope Armature.

I hope you could help me !
Thanks ! :)
Whenever people agree with me I always feel I must be wrong.
Oscar Wilde

ascotan
Posts: 0
Joined: Thu May 29, 2003 10:32 pm
Location: Maryland, U.S.

Post by ascotan »

my guess is you'll need to do something like this:

print myArmature.bones['Bone.001'].deformDist

danyright
Posts: 0
Joined: Mon May 15, 2006 4:24 pm
Location: Switzerland

Post by danyright »

Oh, I used it like this :

Code: Select all

import Blender
from Blender import Armature as A

arm = A.Get()
	
for arm in arm.values():
	arm.drawType = A.ENVELOPE
	
	for bone in arm.bones.values():
		dist_deformation = bone.deformDist #bone.weight
(this isn't the hole code...)

And I tried with 'bone.weight' and it works good.
Do you have an idea of the matter ? :?:
Whenever people agree with me I always feel I must be wrong.
Oscar Wilde

ascotan
Posts: 0
Joined: Thu May 29, 2003 10:32 pm
Location: Maryland, U.S.

Post by ascotan »

The deform distance IS the envelope size. (Well its the distance all around the bone things will get deformed.

danyright
Posts: 0
Joined: Mon May 15, 2006 4:24 pm
Location: Switzerland

Post by danyright »

:wink: Yeah I know that the deform distance is the envelope size.

I didn't explain it well. I'd like to get the size of the bone himself.

Take a look at the picture, I think it will be more explicative.
Image

If I could get the real size of the bone (not the deform distance) It would be more 'WYSIWYG' :-). But I don't know if it is possible.

Anyway, the deformDist doesn't work.


:roll: thanks for your help :-)
Whenever people agree with me I always feel I must be wrong.
Oscar Wilde

ascotan
Posts: 0
Joined: Thu May 29, 2003 10:32 pm
Location: Maryland, U.S.

Post by ascotan »

I think I see.

The bones are drawn through the drawing code based on a type. This is not really a propery of the bone. The bone's properties are it's matrix and head and tail position and the draw type.

You could probably calculate the 3D geometry based on the draw type by looking at the armature drawing code.

draw_sphere_bone()
in blender/source/blender/src/drawarmature.c might be a good starting point

srjreid
Posts: 0
Joined: Thu Jul 27, 2006 3:02 pm

Post by srjreid »

Here is a possible solution. I am very very new to Blender. But, as I was playing around with Python scripting last night, I came across a topic about "deformDist". I found out that this value does not exist, but "deform_dist" does.

You can always get a list of members of Python objects by using the "dir" function. If you do a dir on your object, you would see the member "deform_dist" in the returned list.

Post Reply