* rna: memory leak fix for RNA_property_enum_value()

* rigify: generate root-most bones before children, this makes parenting to dynamically created bones work.
This commit is contained in:
Campbell Barton
2009-12-13 12:26:19 +00:00
parent 646575f8d9
commit c1bfd014bd
4 changed files with 9 additions and 9 deletions

View File

@@ -211,7 +211,7 @@ def generate_rig(context, obj_orig, prefix="ORG-", META_DEF=True):
# sort bones, not needed but gives more pradictable execution which may be useful in rare cases
bones_sorted = obj.pose.bones.values()
bones_sorted.sort(key=lambda pbone: pbone.name) # first sort by names
bones_sorted.sort(key=lambda pbone: - len(pbone.parent_recursive)) # children before parents
bones_sorted.sort(key=lambda pbone: len(pbone.parent_recursive)) # parents before children
# now we have all the info about bones we can start operating on them
# for pbone in obj.pose.bones:

View File

@@ -94,7 +94,7 @@ def metarig_definition(obj, orig_bone_name):
def ik(obj, definitions, base_names, options):
print(options)
arm = obj.data
mt = bone_class_instance(obj, METARIG_NAMES)

View File

@@ -225,7 +225,7 @@ def main(obj, bone_definition, base_names, options):
rel_vec = child_pbone_01.head - child_pbone_02.head
x_vec = child_pbone_01.matrix.rotationPart() * Vector(1.0, 0.0, 0.0)
print(rel_vec, x_vec)
return degrees(AngleBetweenVecs(rel_vec, x_vec)) > 90.0
if x_direction(): # flip

View File

@@ -946,22 +946,22 @@ void RNA_property_enum_items(bContext *C, PointerRNA *ptr, PropertyRNA *prop, En
int RNA_property_enum_value(bContext *C, PointerRNA *ptr, PropertyRNA *prop, const char *identifier, int *value)
{
EnumPropertyItem *item;
EnumPropertyItem *item, *item_array;
int free;
RNA_property_enum_items(C, ptr, prop, &item, NULL, &free);
RNA_property_enum_items(C, ptr, prop, &item_array, NULL, &free);
for(; item->identifier; item++) {
for(item= item_array; item->identifier; item++) {
if(item->identifier[0] && strcmp(item->identifier, identifier)==0) {
*value = item->value;
return 1;
break;
}
}
if(free)
MEM_freeN(item);
MEM_freeN(item_array);
return 0;
return (item->identifier) ? 1:0;
}
int RNA_enum_identifier(EnumPropertyItem *item, const int value, const char **identifier)