Blender V2.61 - r43446

rna_armature.c

Go to the documentation of this file.
00001 /*
00002  * ***** BEGIN GPL LICENSE BLOCK *****
00003  *
00004  * This program is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU General Public License
00006  * as published by the Free Software Foundation; either version 2
00007  * of the License, or (at your option) any later version.
00008  *
00009  * This program is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  * GNU General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU General Public License
00015  * along with this program; if not, write to the Free Software Foundation,
00016  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00017  *
00018  * Contributor(s): Blender Foundation (2008), Joshua Leung
00019  *
00020  * ***** END GPL LICENSE BLOCK *****
00021  */
00022 
00028 #include <stdlib.h>
00029 
00030 #include "BLI_math.h"
00031 
00032 #include "RNA_define.h"
00033 
00034 #include "rna_internal.h"
00035 
00036 #include "DNA_armature_types.h"
00037 #include "DNA_object_types.h"
00038 #include "DNA_scene_types.h"
00039 
00040 #include "WM_api.h"
00041 #include "WM_types.h"
00042 
00043 #ifdef RNA_RUNTIME
00044 
00045 #include "BKE_context.h"
00046 #include "BKE_depsgraph.h"
00047 #include "BKE_idprop.h"
00048 #include "BKE_main.h"
00049 
00050 #include "ED_armature.h"
00051 #include "BKE_armature.h"
00052 
00053 static void rna_Armature_update_data(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
00054 {
00055     ID *id= ptr->id.data;
00056 
00057     DAG_id_tag_update(id, 0);
00058     WM_main_add_notifier(NC_GEOM|ND_DATA, id);
00059     //WM_main_add_notifier(NC_OBJECT|ND_POSE, NULL);
00060 }
00061 
00062 
00063 static void rna_Armature_act_bone_set(PointerRNA *ptr, PointerRNA value)
00064 {
00065     bArmature *arm= (bArmature*)ptr->data;
00066 
00067     if(value.id.data==NULL && value.data==NULL) {
00068         arm->act_bone= NULL;
00069     }
00070     else {
00071         if(value.id.data != arm) {
00072             Object *ob = (Object *)value.id.data;
00073             
00074             if(GS(ob->id.name)!=ID_OB || (ob->data != arm)) {
00075                 printf("ERROR: armature set active bone - new active doesn't come from this armature\n");
00076                 return;
00077             }
00078         }
00079         
00080         arm->act_bone= value.data;
00081         arm->act_bone->flag |= BONE_SELECTED;
00082     }
00083 }
00084 
00085 static void rna_Armature_act_edit_bone_set(PointerRNA *ptr, PointerRNA value)
00086 {
00087     bArmature *arm= (bArmature*)ptr->data;
00088 
00089     if(value.id.data==NULL && value.data==NULL) {
00090         arm->act_edbone= NULL;
00091     }
00092     else {
00093         if(value.id.data != arm) {
00094             /* raise an error! */
00095         }
00096         else {
00097             arm->act_edbone= value.data;
00098             ((EditBone *)arm->act_edbone)->flag |= BONE_SELECTED;
00099         }
00100     }
00101 }
00102 
00103 EditBone *rna_Armature_edit_bone_new(bArmature *arm, ReportList *reports, const char *name)
00104 {
00105     if(arm->edbo==NULL) {
00106         BKE_reportf(reports, RPT_ERROR, "Armature '%s' not in editmode, cant add an editbone", arm->id.name+2);
00107         return NULL;
00108     }
00109     return ED_armature_edit_bone_add(arm, name);
00110 }
00111 
00112 void rna_Armature_edit_bone_remove(bArmature *arm, ReportList *reports, EditBone *ebone)
00113 {
00114     if(arm->edbo==NULL) {
00115         BKE_reportf(reports, RPT_ERROR, "Armature '%s' not in editmode, cant remove an editbone", arm->id.name+2);
00116         return;
00117     }
00118 
00119     if(BLI_findindex(arm->edbo, ebone) == -1) {
00120         BKE_reportf(reports, RPT_ERROR, "Armature '%s' doesn't contain bone '%s'", arm->id.name+2, ebone->name);
00121         return;
00122     }
00123 
00124     ED_armature_edit_bone_remove(arm, ebone);
00125 }
00126 
00127 static void rna_Armature_update_layers(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
00128 {
00129     bArmature *arm= ptr->id.data;
00130     Object *ob;
00131 
00132     /* proxy lib exception, store it here so we can restore layers on file
00133        load, since it would otherwise get lost due to being linked data */
00134     for(ob = bmain->object.first; ob; ob=ob->id.next)
00135         if(ob->data == arm && ob->pose)
00136             ob->pose->proxy_layer = arm->layer;
00137 
00138     WM_main_add_notifier(NC_GEOM|ND_DATA, arm);
00139 }
00140 
00141 static void rna_Armature_redraw_data(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
00142 {
00143     ID *id= ptr->id.data;
00144 
00145     WM_main_add_notifier(NC_GEOM|ND_DATA, id);
00146 }
00147 
00148 static char *rna_Bone_path(PointerRNA *ptr)
00149 {
00150     Bone *bone = (Bone*)ptr->data;
00151     
00152     /* special exception for trying to get the path where ID-block is Object
00153      *  - this will be assumed to be from a Pose Bone...
00154      */
00155     if (ptr->id.data) {
00156         ID *id = (ID *)ptr->id.data;
00157         
00158         if (GS(id->name) == ID_OB)
00159             return BLI_sprintfN("pose.bones[\"%s\"].bone", bone->name);
00160     }
00161     
00162     /* from armature... */
00163     return BLI_sprintfN("bones[\"%s\"]", bone->name);
00164 }
00165 
00166 static IDProperty *rna_Bone_idprops(PointerRNA *ptr, int create)
00167 {
00168     Bone *bone= ptr->data;
00169 
00170     if(create && !bone->prop) {
00171         IDPropertyTemplate val = {0};
00172         bone->prop= IDP_New(IDP_GROUP, &val, "RNA_Bone ID properties");
00173     }
00174 
00175     return bone->prop;
00176 }
00177 
00178 static IDProperty *rna_EditBone_idprops(PointerRNA *ptr, int create)
00179 {
00180     EditBone *ebone= ptr->data;
00181 
00182     if(create && !ebone->prop) {
00183         IDPropertyTemplate val = {0};
00184         ebone->prop= IDP_New(IDP_GROUP, &val, "RNA_EditBone ID properties");
00185     }
00186 
00187     return ebone->prop;
00188 }
00189 
00190 static void rna_bone_layer_set(int *layer, const int *values)
00191 {
00192     int i, tot= 0;
00193 
00194     /* ensure we always have some layer selected */
00195     for(i=0; i<32; i++)
00196         if(values[i])
00197             tot++;
00198     
00199     if(tot==0)
00200         return;
00201 
00202     for(i=0; i<32; i++) {
00203         if(values[i]) *layer |= (1<<i);
00204         else *layer &= ~(1<<i);
00205     }
00206 }
00207 
00208 static void rna_Bone_layer_set(PointerRNA *ptr, const int *values)
00209 {
00210     Bone *bone= (Bone*)ptr->data;
00211     rna_bone_layer_set(&bone->layer, values);
00212 }
00213 
00214 static void rna_Armature_layer_set(PointerRNA *ptr, const int *values)
00215 {
00216     bArmature *arm= (bArmature*)ptr->data;
00217     int i, tot= 0;
00218 
00219     /* ensure we always have some layer selected */
00220     for(i=0; i<32; i++)
00221         if(values[i])
00222             tot++;
00223     
00224     if(tot==0)
00225         return;
00226 
00227     for(i=0; i<32; i++) {
00228         if(values[i]) arm->layer |= (1<<i);
00229         else arm->layer &= ~(1<<i);
00230     }
00231 }
00232 
00233 // XXX depreceated.... old armature only animviz
00234 static void rna_Armature_ghost_start_frame_set(PointerRNA *ptr, int value)
00235 {
00236     bArmature *data= (bArmature*)ptr->data;
00237     CLAMP(value, 1, data->ghostef);
00238     data->ghostsf= value;
00239 }
00240 
00241 static void rna_Armature_ghost_end_frame_set(PointerRNA *ptr, int value)
00242 {
00243     bArmature *data= (bArmature*)ptr->data;
00244     CLAMP(value, data->ghostsf, (int)(MAXFRAMEF/2));
00245     data->ghostef= value;
00246 }
00247 // XXX depreceated... old armature only animviz
00248 
00249 static void rna_EditBone_name_set(PointerRNA *ptr, const char *value)
00250 {
00251     bArmature *arm= (bArmature*)ptr->id.data;
00252     EditBone *ebone= (EditBone*)ptr->data;
00253     char oldname[sizeof(ebone->name)], newname[sizeof(ebone->name)];
00254     
00255     /* need to be on the stack */
00256     BLI_strncpy_utf8(newname, value, sizeof(ebone->name));
00257     BLI_strncpy(oldname, ebone->name, sizeof(ebone->name));
00258     
00259     ED_armature_bone_rename(arm, oldname, newname);
00260 }
00261 
00262 static void rna_Bone_name_set(PointerRNA *ptr, const char *value)
00263 {
00264     bArmature *arm= (bArmature*)ptr->id.data;
00265     Bone *bone= (Bone*)ptr->data;
00266     char oldname[sizeof(bone->name)], newname[sizeof(bone->name)];
00267     
00268     /* need to be on the stack */
00269     BLI_strncpy_utf8(newname, value, sizeof(bone->name));
00270     BLI_strncpy(oldname, bone->name, sizeof(bone->name));
00271 
00272     ED_armature_bone_rename(arm, oldname, newname);
00273 }
00274 
00275 static void rna_EditBone_layer_set(PointerRNA *ptr, const int values[])
00276 {
00277     EditBone *data= (EditBone*)(ptr->data);
00278     rna_bone_layer_set(&data->layer, values);
00279 }
00280 
00281 static void rna_EditBone_connected_check(EditBone *ebone)
00282 {
00283     if(ebone->parent) {
00284         if(ebone->flag & BONE_CONNECTED) {
00285             /* Attach this bone to its parent */
00286             copy_v3_v3(ebone->head, ebone->parent->tail);
00287 
00288             if(ebone->flag & BONE_ROOTSEL)
00289                 ebone->parent->flag |= BONE_TIPSEL;
00290         }
00291         else if(!(ebone->parent->flag & BONE_ROOTSEL)) {
00292             ebone->parent->flag &= ~BONE_TIPSEL;
00293         }
00294     }
00295 }
00296 
00297 static void rna_EditBone_connected_set(PointerRNA *ptr, int value)
00298 {
00299     EditBone *ebone= (EditBone*)(ptr->data);
00300 
00301     if(value) ebone->flag |= BONE_CONNECTED;
00302     else ebone->flag &= ~BONE_CONNECTED;
00303 
00304     rna_EditBone_connected_check(ebone);
00305 }
00306 
00307 static PointerRNA rna_EditBone_parent_get(PointerRNA *ptr)
00308 {
00309     EditBone *data= (EditBone*)(ptr->data);
00310     return rna_pointer_inherit_refine(ptr, &RNA_EditBone, data->parent);
00311 }
00312 
00313 static void rna_EditBone_parent_set(PointerRNA *ptr, PointerRNA value)
00314 {
00315     EditBone *ebone= (EditBone*)(ptr->data);
00316     EditBone *pbone, *parbone= (EditBone*)value.data;
00317 
00318     if(parbone == NULL) {
00319         if(ebone->parent && !(ebone->parent->flag & BONE_ROOTSEL))
00320             ebone->parent->flag &= ~BONE_TIPSEL;
00321 
00322         ebone->parent = NULL;
00323         ebone->flag &= ~BONE_CONNECTED;
00324     }
00325     else {
00326         /* within same armature */
00327         if(value.id.data != ptr->id.data)
00328             return;
00329 
00330         /* make sure this is a valid child */
00331         if(parbone == ebone)
00332             return;
00333             
00334         for(pbone= parbone->parent; pbone; pbone=pbone->parent)
00335             if(pbone == ebone)
00336                 return;
00337 
00338         ebone->parent = parbone;
00339         rna_EditBone_connected_check(ebone);
00340     }
00341 }
00342 
00343 static void rna_EditBone_matrix_get(PointerRNA *ptr, float *values)
00344 {
00345     EditBone *ebone= (EditBone*)(ptr->data);
00346 
00347     float   delta[3], tmat[3][3], mat[4][4];
00348 
00349     /* Find the current bone matrix */
00350     sub_v3_v3v3(delta, ebone->tail, ebone->head);
00351     vec_roll_to_mat3(delta, ebone->roll, tmat);
00352     copy_m4_m3(mat, tmat);
00353     copy_v3_v3(mat[3], ebone->head);
00354 
00355     memcpy(values, mat, 16 * sizeof(float));
00356 }
00357 
00358 static void rna_Armature_editbone_transform_update(Main *bmain, Scene *scene, PointerRNA *ptr)
00359 {
00360     bArmature *arm= (bArmature*)ptr->id.data;
00361     EditBone *ebone= (EditBone*)ptr->data;
00362     EditBone *child, *eboflip;
00363     
00364     /* update our parent */
00365     if(ebone->parent && ebone->flag & BONE_CONNECTED)
00366         copy_v3_v3(ebone->parent->tail, ebone->head);
00367 
00368     /* update our children if necessary */
00369     for(child = arm->edbo->first; child; child=child->next)
00370         if(child->parent == ebone && (child->flag & BONE_CONNECTED))
00371             copy_v3_v3(child->head, ebone->tail);
00372 
00373     if(arm->flag & ARM_MIRROR_EDIT) {
00374         eboflip= ED_armature_bone_get_mirrored(arm->edbo, ebone);
00375 
00376         if(eboflip) {
00377             eboflip->roll= -ebone->roll;
00378 
00379             eboflip->head[0]= -ebone->head[0];
00380             eboflip->tail[0]= -ebone->tail[0];
00381             
00382             /* update our parent */
00383             if(eboflip->parent && eboflip->flag & BONE_CONNECTED)
00384                 copy_v3_v3(eboflip->parent->tail, eboflip->head);
00385             
00386             /* update our children if necessary */
00387             for(child = arm->edbo->first; child; child=child->next)
00388                 if(child->parent == eboflip && (child->flag & BONE_CONNECTED))
00389                     copy_v3_v3 (child->head, eboflip->tail);
00390         }
00391     }
00392 
00393     rna_Armature_update_data(bmain, scene, ptr);
00394 }
00395 
00396 static void rna_Armature_bones_next(CollectionPropertyIterator *iter)
00397 {
00398     ListBaseIterator *internal= iter->internal;
00399     Bone *bone= (Bone*)internal->link;
00400 
00401     if(bone->childbase.first)
00402         internal->link= (Link*)bone->childbase.first;
00403     else if(bone->next)
00404         internal->link= (Link*)bone->next;
00405     else {
00406         internal->link= NULL;
00407 
00408         do {
00409             bone= bone->parent;
00410             if(bone && bone->next) {
00411                 internal->link= (Link*)bone->next;
00412                 break;
00413             }
00414         } while(bone);
00415     }
00416 
00417     iter->valid= (internal->link != NULL);
00418 }
00419 
00420 #else
00421 
00422 static int rna_matrix_dimsize_4x4[]= {4, 4};
00423 static int rna_matrix_dimsize_3x3[]= {3, 3};
00424 
00425 static void rna_def_bone_common(StructRNA *srna, int editbone)
00426 {
00427     PropertyRNA *prop;
00428 
00429     /* strings */
00430     prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
00431     RNA_def_property_string_sdna(prop, NULL, "name");
00432     RNA_def_property_ui_text(prop, "Name", "");
00433     RNA_def_struct_name_property(srna, prop);
00434     if(editbone) RNA_def_property_string_funcs(prop, NULL, NULL, "rna_EditBone_name_set");
00435     else RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Bone_name_set");
00436     RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
00437 
00438     /* flags */
00439     prop= RNA_def_property(srna, "layers", PROP_BOOLEAN, PROP_LAYER_MEMBER);
00440     RNA_def_property_boolean_sdna(prop, NULL, "layer", 1);
00441     RNA_def_property_array(prop, 32);
00442     if(editbone) RNA_def_property_boolean_funcs(prop, NULL, "rna_EditBone_layer_set");
00443     else RNA_def_property_boolean_funcs(prop, NULL, "rna_Bone_layer_set");
00444     RNA_def_property_ui_text(prop, "Layers", "Layers bone exists in");
00445     RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
00446 
00447     prop= RNA_def_property(srna, "use_connect", PROP_BOOLEAN, PROP_NONE);
00448     RNA_def_property_boolean_sdna(prop, NULL, "flag", BONE_CONNECTED);
00449     if(editbone) RNA_def_property_boolean_funcs(prop, NULL, "rna_EditBone_connected_set");
00450     else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
00451     RNA_def_property_ui_text(prop, "Connected", "When bone has a parent, bone's head is stuck to the parent's tail");
00452     RNA_def_property_update(prop, 0, "rna_Armature_update_data");
00453     
00454     prop= RNA_def_property(srna, "use_inherit_rotation", PROP_BOOLEAN, PROP_NONE);
00455     RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", BONE_HINGE);
00456     RNA_def_property_ui_text(prop, "Inherit Rotation", "Bone inherits rotation or scale from parent bone");
00457     RNA_def_property_update(prop, 0, "rna_Armature_update_data");
00458     
00459     prop= RNA_def_property(srna, "use_envelope_multiply", PROP_BOOLEAN, PROP_NONE);
00460     RNA_def_property_boolean_sdna(prop, NULL, "flag", BONE_MULT_VG_ENV);
00461     RNA_def_property_ui_text(prop, "Multiply Vertex Group with Envelope",
00462                              "When deforming bone, multiply effects of Vertex Group weights with Envelope influence");
00463     RNA_def_property_update(prop, 0, "rna_Armature_update_data");
00464     
00465     prop= RNA_def_property(srna, "use_deform", PROP_BOOLEAN, PROP_NONE);
00466     RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", BONE_NO_DEFORM);
00467     RNA_def_property_ui_text(prop, "Deform", "Bone does not deform any geometry");
00468     RNA_def_property_update(prop, 0, "rna_Armature_update_data");
00469     
00470     prop= RNA_def_property(srna, "use_inherit_scale", PROP_BOOLEAN, PROP_NONE);
00471     RNA_def_property_ui_text(prop, "Inherit Scale", "Bone inherits scaling from parent bone");
00472     RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", BONE_NO_SCALE);
00473     RNA_def_property_update(prop, 0, "rna_Armature_update_data");
00474 
00475     prop= RNA_def_property(srna, "use_local_location", PROP_BOOLEAN, PROP_NONE);
00476     RNA_def_property_ui_text(prop, "Local Location", "Bone location is set in local space");
00477     RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", BONE_NO_LOCAL_LOCATION);
00478     RNA_def_property_update(prop, 0, "rna_Armature_update_data");
00479     
00480     prop= RNA_def_property(srna, "show_wire", PROP_BOOLEAN, PROP_NONE);
00481     RNA_def_property_boolean_sdna(prop, NULL, "flag", BONE_DRAWWIRE);
00482     RNA_def_property_ui_text(prop, "Draw Wire",
00483                              "Bone is always drawn as Wireframe regardless of viewport draw mode "
00484                              "(useful for non-obstructive custom bone shapes)");
00485     RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
00486     
00487     prop= RNA_def_property(srna, "use_cyclic_offset", PROP_BOOLEAN, PROP_NONE);
00488     RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", BONE_NO_CYCLICOFFSET);
00489     RNA_def_property_ui_text(prop, "Cyclic Offset", "When bone doesn't have a parent, it receives cyclic offset effects");
00490     RNA_def_property_update(prop, 0, "rna_Armature_update_data");
00491     
00492     prop= RNA_def_property(srna, "hide_select", PROP_BOOLEAN, PROP_NONE);
00493     RNA_def_property_boolean_sdna(prop, NULL, "flag", BONE_UNSELECTABLE);
00494     RNA_def_property_ui_text(prop, "Selectable", "Bone is able to be selected");
00495     RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
00496 
00497     /* Number values */
00498         /* envelope deform settings */
00499     prop= RNA_def_property(srna, "envelope_distance", PROP_FLOAT, PROP_NONE);
00500     RNA_def_property_float_sdna(prop, NULL, "dist");
00501     RNA_def_property_range(prop, 0.0f, 1000.0f);
00502     RNA_def_property_ui_text(prop, "Envelope Deform Distance", "Bone deformation distance (for Envelope deform only)");
00503     RNA_def_property_update(prop, 0, "rna_Armature_update_data");
00504     
00505     prop= RNA_def_property(srna, "envelope_weight", PROP_FLOAT, PROP_NONE);
00506     RNA_def_property_float_sdna(prop, NULL, "weight");
00507     RNA_def_property_range(prop, 0.0f, 1000.0f);
00508     RNA_def_property_ui_text(prop, "Envelope Deform Weight", "Bone deformation weight (for Envelope deform only)");
00509     RNA_def_property_update(prop, 0, "rna_Armature_update_data");
00510     
00511     prop= RNA_def_property(srna, "head_radius", PROP_FLOAT, PROP_UNSIGNED);
00512     if(editbone) RNA_def_property_update(prop, 0, "rna_Armature_editbone_transform_update");
00513     else RNA_def_property_update(prop, 0, "rna_Armature_update_data");
00514     RNA_def_property_float_sdna(prop, NULL, "rad_head");
00515     //RNA_def_property_range(prop, 0, 1000);  // XXX range is 0 to lim, where lim= 10000.0f*MAX2(1.0, view3d->grid);
00516     RNA_def_property_ui_range(prop, 0.01, 100, 0.1, 3);
00517     RNA_def_property_ui_text(prop, "Envelope Head Radius", "Radius of head of bone (for Envelope deform only)");
00518     
00519     prop= RNA_def_property(srna, "tail_radius", PROP_FLOAT, PROP_UNSIGNED);
00520     if(editbone) RNA_def_property_update(prop, 0, "rna_Armature_editbone_transform_update");
00521     else RNA_def_property_update(prop, 0, "rna_Armature_update_data");
00522     RNA_def_property_float_sdna(prop, NULL, "rad_tail");
00523     //RNA_def_property_range(prop, 0, 1000);  // XXX range is 0 to lim, where lim= 10000.0f*MAX2(1.0, view3d->grid);
00524     RNA_def_property_ui_range(prop, 0.01, 100, 0.1, 3);
00525     RNA_def_property_ui_text(prop, "Envelope Tail Radius", "Radius of tail of bone (for Envelope deform only)");
00526     
00527         /* b-bones deform settings */
00528     prop= RNA_def_property(srna, "bbone_segments", PROP_INT, PROP_NONE);
00529     RNA_def_property_int_sdna(prop, NULL, "segments");
00530     RNA_def_property_range(prop, 1, 32);
00531     RNA_def_property_ui_text(prop, "B-Bone Segments", "Number of subdivisions of bone (for B-Bones only)");
00532     RNA_def_property_update(prop, 0, "rna_Armature_update_data");
00533     
00534     prop= RNA_def_property(srna, "bbone_in", PROP_FLOAT, PROP_NONE);
00535     RNA_def_property_float_sdna(prop, NULL, "ease1");
00536     RNA_def_property_range(prop, 0.0f, 2.0f);
00537     RNA_def_property_ui_text(prop, "B-Bone Ease In", "Length of first Bezier Handle (for B-Bones only)");
00538     RNA_def_property_update(prop, 0, "rna_Armature_update_data");
00539     
00540     prop= RNA_def_property(srna, "bbone_out", PROP_FLOAT, PROP_NONE);
00541     RNA_def_property_float_sdna(prop, NULL, "ease2");
00542     RNA_def_property_range(prop, 0.0f, 2.0f);
00543     RNA_def_property_ui_text(prop, "B-Bone Ease Out", "Length of second Bezier Handle (for B-Bones only)");
00544     RNA_def_property_update(prop, 0, "rna_Armature_update_data");
00545 
00546     prop= RNA_def_property(srna, "bbone_x", PROP_FLOAT, PROP_NONE);
00547     RNA_def_property_float_sdna(prop, NULL, "xwidth");
00548     RNA_def_property_range(prop, 0.0f, 1000.0f);
00549     RNA_def_property_ui_text(prop, "B-Bone Display X Width", "B-Bone X size");
00550     RNA_def_property_update(prop, 0, "rna_Armature_update_data");
00551     
00552     prop= RNA_def_property(srna, "bbone_z", PROP_FLOAT, PROP_NONE);
00553     RNA_def_property_float_sdna(prop, NULL, "zwidth");
00554     RNA_def_property_range(prop, 0.0f, 1000.0f);
00555     RNA_def_property_ui_text(prop, "B-Bone Display Z Width", "B-Bone Z size");
00556     RNA_def_property_update(prop, 0, "rna_Armature_update_data");
00557 }
00558 
00559 // err... bones should not be directly edited (only editbones should be...)
00560 static void rna_def_bone(BlenderRNA *brna)
00561 {
00562     StructRNA *srna;
00563     PropertyRNA *prop;
00564     
00565     srna= RNA_def_struct(brna, "Bone", NULL);
00566     RNA_def_struct_ui_text(srna, "Bone", "Bone in an Armature datablock");
00567     RNA_def_struct_ui_icon(srna, ICON_BONE_DATA);
00568     RNA_def_struct_path_func(srna, "rna_Bone_path");
00569     RNA_def_struct_idprops_func(srna, "rna_Bone_idprops");
00570     
00571     /* pointers/collections */
00572         /* parent (pointer) */
00573     prop= RNA_def_property(srna, "parent", PROP_POINTER, PROP_NONE);
00574     RNA_def_property_struct_type(prop, "Bone");
00575     RNA_def_property_pointer_sdna(prop, NULL, "parent");
00576     RNA_def_property_ui_text(prop, "Parent", "Parent bone (in same Armature)");
00577     RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
00578     
00579         /* children (collection) */
00580     prop= RNA_def_property(srna, "children", PROP_COLLECTION, PROP_NONE);
00581     RNA_def_property_collection_sdna(prop, NULL, "childbase", NULL);
00582     RNA_def_property_struct_type(prop, "Bone");
00583     RNA_def_property_ui_text(prop, "Children", "Bones which are children of this bone");
00584 
00585     rna_def_bone_common(srna, 0);
00586 
00587         // XXX should we define this in PoseChannel wrapping code instead? but PoseChannels directly get some of their flags from here...
00588     prop= RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE);
00589     RNA_def_property_boolean_sdna(prop, NULL, "flag", BONE_HIDDEN_P);
00590     RNA_def_property_ui_text(prop, "Hide", "Bone is not visible when it is not in Edit Mode (i.e. in Object or Pose Modes)");
00591     RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
00592 
00593     prop= RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
00594     RNA_def_property_boolean_sdna(prop, NULL, "flag", BONE_SELECTED);
00595     RNA_def_property_ui_text(prop, "Select", "");
00596     RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
00597     RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
00598     
00599     prop= RNA_def_property(srna, "select_head", PROP_BOOLEAN, PROP_NONE);
00600     RNA_def_property_boolean_sdna(prop, NULL, "flag", BONE_ROOTSEL);
00601     RNA_def_property_ui_text(prop, "Select Head", "");
00602     RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
00603     RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
00604     
00605     prop= RNA_def_property(srna, "select_tail", PROP_BOOLEAN, PROP_NONE);
00606     RNA_def_property_boolean_sdna(prop, NULL, "flag", BONE_TIPSEL);
00607     RNA_def_property_ui_text(prop, "Select Tail", "");
00608     RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
00609     RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
00610 
00611     /* XXX better matrix descriptions possible (Arystan) */
00612     prop= RNA_def_property(srna, "matrix", PROP_FLOAT, PROP_MATRIX);
00613     RNA_def_property_float_sdna(prop, NULL, "bone_mat");
00614     RNA_def_property_multi_array(prop, 2, rna_matrix_dimsize_3x3);
00615     RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
00616     RNA_def_property_ui_text(prop, "Bone Matrix", "3x3 bone matrix");
00617 
00618     prop= RNA_def_property(srna, "matrix_local", PROP_FLOAT, PROP_MATRIX);
00619     RNA_def_property_float_sdna(prop, NULL, "arm_mat");
00620     RNA_def_property_multi_array(prop, 2, rna_matrix_dimsize_4x4);
00621     RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
00622     RNA_def_property_ui_text(prop, "Bone Armature-Relative Matrix", "4x4 bone matrix relative to armature");
00623 
00624     prop= RNA_def_property(srna, "tail", PROP_FLOAT, PROP_TRANSLATION);
00625     RNA_def_property_float_sdna(prop, NULL, "tail");
00626     RNA_def_property_array(prop, 3);
00627     RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
00628     RNA_def_property_ui_text(prop, "Tail", "Location of tail end of the bone");
00629 
00630     prop= RNA_def_property(srna, "tail_local", PROP_FLOAT, PROP_TRANSLATION);
00631     RNA_def_property_float_sdna(prop, NULL, "arm_tail");
00632     RNA_def_property_array(prop, 3);
00633     RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
00634     RNA_def_property_ui_text(prop, "Armature-Relative Tail", "Location of tail end of the bone relative to armature");
00635 
00636     prop= RNA_def_property(srna, "head", PROP_FLOAT, PROP_TRANSLATION);
00637     RNA_def_property_float_sdna(prop, NULL, "head");
00638     RNA_def_property_array(prop, 3);
00639     RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
00640     RNA_def_property_ui_text(prop, "Head", "Location of head end of the bone relative to its parent");
00641 
00642     prop= RNA_def_property(srna, "head_local", PROP_FLOAT, PROP_TRANSLATION);
00643     RNA_def_property_float_sdna(prop, NULL, "arm_head");
00644     RNA_def_property_array(prop, 3);
00645     RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
00646     RNA_def_property_ui_text(prop, "Armature-Relative Head", "Location of head end of the bone relative to armature");
00647 
00648     RNA_api_bone(srna);
00649 }
00650 
00651 static void rna_def_edit_bone(BlenderRNA *brna)
00652 {
00653     StructRNA *srna;
00654     PropertyRNA *prop;
00655     
00656     srna= RNA_def_struct(brna, "EditBone", NULL);
00657     RNA_def_struct_sdna(srna, "EditBone");
00658     RNA_def_struct_idprops_func(srna, "rna_EditBone_idprops");
00659     RNA_def_struct_ui_text(srna, "Edit Bone", "Editmode bone in an Armature datablock");
00660     RNA_def_struct_ui_icon(srna, ICON_BONE_DATA);
00661     
00662     RNA_define_verify_sdna(0); // not in sdna
00663 
00664     prop= RNA_def_property(srna, "parent", PROP_POINTER, PROP_NONE);
00665     RNA_def_property_struct_type(prop, "EditBone");
00666     RNA_def_property_pointer_funcs(prop, "rna_EditBone_parent_get", "rna_EditBone_parent_set", NULL, NULL);
00667     RNA_def_property_flag(prop, PROP_EDITABLE);
00668     RNA_def_property_ui_text(prop, "Parent", "Parent edit bone (in same Armature)");
00669     RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
00670     
00671     prop= RNA_def_property(srna, "roll", PROP_FLOAT, PROP_ANGLE);
00672     RNA_def_property_float_sdna(prop, NULL, "roll");
00673     RNA_def_property_ui_range(prop, -M_PI * 2, M_PI * 2, 0.1, 2);
00674     RNA_def_property_ui_text(prop, "Roll", "Bone rotation around head-tail axis");
00675     RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
00676     RNA_def_property_update(prop, 0, "rna_Armature_editbone_transform_update");
00677 
00678     prop= RNA_def_property(srna, "head", PROP_FLOAT, PROP_TRANSLATION);
00679     RNA_def_property_float_sdna(prop, NULL, "head");
00680     RNA_def_property_array(prop, 3);
00681     RNA_def_property_ui_text(prop, "Head", "Location of head end of the bone");
00682     RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
00683     RNA_def_property_update(prop, 0, "rna_Armature_editbone_transform_update");
00684 
00685     prop= RNA_def_property(srna, "tail", PROP_FLOAT, PROP_TRANSLATION);
00686     RNA_def_property_float_sdna(prop, NULL, "tail");
00687     RNA_def_property_array(prop, 3);
00688     RNA_def_property_ui_text(prop, "Tail", "Location of tail end of the bone");
00689     RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
00690     RNA_def_property_update(prop, 0, "rna_Armature_editbone_transform_update");
00691 
00692     rna_def_bone_common(srna, 1);
00693 
00694     prop= RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE);
00695     RNA_def_property_boolean_sdna(prop, NULL, "flag", BONE_HIDDEN_A);
00696     RNA_def_property_ui_text(prop, "Hide", "Bone is not visible when in Edit Mode");
00697     RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
00698     RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
00699 
00700     prop= RNA_def_property(srna, "lock", PROP_BOOLEAN, PROP_NONE);
00701     RNA_def_property_boolean_sdna(prop, NULL, "flag", BONE_EDITMODE_LOCKED);
00702     RNA_def_property_ui_text(prop, "Lock", "Bone is not able to be transformed when in Edit Mode");
00703     RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
00704     RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
00705 
00706     prop= RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
00707     RNA_def_property_boolean_sdna(prop, NULL, "flag", BONE_SELECTED);
00708     RNA_def_property_ui_text(prop, "Select", "");
00709     RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
00710     RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
00711 
00712     prop= RNA_def_property(srna, "select_head", PROP_BOOLEAN, PROP_NONE);
00713     RNA_def_property_boolean_sdna(prop, NULL, "flag", BONE_ROOTSEL);
00714     RNA_def_property_ui_text(prop, "Head Select", "");
00715     RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
00716     RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
00717     
00718     prop= RNA_def_property(srna, "select_tail", PROP_BOOLEAN, PROP_NONE);
00719     RNA_def_property_boolean_sdna(prop, NULL, "flag", BONE_TIPSEL);
00720     RNA_def_property_ui_text(prop, "Tail Select", "");
00721     RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
00722     RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
00723 
00724     /* calculated and read only, not actual data access */
00725     prop= RNA_def_property(srna, "matrix", PROP_FLOAT, PROP_MATRIX);
00726     //RNA_def_property_float_sdna(prop, NULL, ""); // doesnt access any real data
00727     RNA_def_property_multi_array(prop, 2, rna_matrix_dimsize_4x4);
00728     RNA_def_property_clear_flag(prop, PROP_EDITABLE);
00729     RNA_def_property_flag(prop, PROP_THICK_WRAP); /* no reference to original data */
00730     RNA_def_property_ui_text(prop, "Editbone Matrix", "Read-only matrix calculated from the roll (armature space)");
00731     RNA_def_property_float_funcs(prop, "rna_EditBone_matrix_get", NULL, NULL); // TODO - this could be made writable also
00732 
00733     RNA_api_armature_edit_bone(srna);
00734 
00735     RNA_define_verify_sdna(1);
00736 }
00737 
00738 
00739 /* armature.bones.* */
00740 static void rna_def_armature_bones(BlenderRNA *brna, PropertyRNA *cprop)
00741 {
00742     StructRNA *srna;
00743     PropertyRNA *prop;
00744 
00745 //  FunctionRNA *func;
00746 //  PropertyRNA *parm;
00747 
00748     RNA_def_property_srna(cprop, "ArmatureBones");
00749     srna= RNA_def_struct(brna, "ArmatureBones", NULL);
00750     RNA_def_struct_sdna(srna, "bArmature");
00751     RNA_def_struct_ui_text(srna, "Armature Bones", "Collection of armature bones");
00752 
00753 
00754     prop= RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
00755     RNA_def_property_struct_type(prop, "Bone");
00756     RNA_def_property_pointer_sdna(prop, NULL, "act_bone");
00757     RNA_def_property_flag(prop, PROP_EDITABLE);
00758     RNA_def_property_ui_text(prop, "Active Bone", "Armature's active bone");
00759     RNA_def_property_pointer_funcs(prop, NULL, "rna_Armature_act_bone_set", NULL, NULL);
00760 
00761     /* todo, redraw */
00762 //      RNA_def_property_collection_active(prop, prop_act);
00763 }
00764 
00765 /* armature.bones.* */
00766 static void rna_def_armature_edit_bones(BlenderRNA *brna, PropertyRNA *cprop)
00767 {
00768     StructRNA *srna;
00769     PropertyRNA *prop;
00770 
00771     FunctionRNA *func;
00772     PropertyRNA *parm;
00773 
00774     RNA_def_property_srna(cprop, "ArmatureEditBones");
00775     srna= RNA_def_struct(brna, "ArmatureEditBones", NULL);
00776     RNA_def_struct_sdna(srna, "bArmature");
00777     RNA_def_struct_ui_text(srna, "Armature EditBones", "Collection of armature edit bones");
00778 
00779     prop= RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
00780     RNA_def_property_struct_type(prop, "EditBone");
00781     RNA_def_property_pointer_sdna(prop, NULL, "act_edbone");
00782     RNA_def_property_flag(prop, PROP_EDITABLE);
00783     RNA_def_property_ui_text(prop, "Active EditBone", "Armatures active edit bone");
00784     //RNA_def_property_update(prop, 0, "rna_Armature_act_editbone_update");
00785     RNA_def_property_pointer_funcs(prop, NULL, "rna_Armature_act_edit_bone_set", NULL, NULL);
00786 
00787     /* todo, redraw */
00788 //      RNA_def_property_collection_active(prop, prop_act);
00789 
00790     /* add target */
00791     func= RNA_def_function(srna, "new", "rna_Armature_edit_bone_new");
00792     RNA_def_function_flag(func, FUNC_USE_REPORTS);
00793     RNA_def_function_ui_description(func, "Add a new bone");
00794     parm= RNA_def_string(func, "name", "Object", 0, "", "New name for the bone");
00795     RNA_def_property_flag(parm, PROP_REQUIRED);
00796 
00797     /* return type */
00798     parm= RNA_def_pointer(func, "bone", "EditBone", "", "Newly created edit bone");
00799     RNA_def_function_return(func, parm);
00800 
00801     /* remove target */
00802     func= RNA_def_function(srna, "remove", "rna_Armature_edit_bone_remove");
00803     RNA_def_function_flag(func, FUNC_USE_REPORTS);
00804     RNA_def_function_ui_description(func, "Remove an existing bone from the armature");
00805     /* target to remove*/
00806     parm= RNA_def_pointer(func, "bone", "EditBone", "", "EditBone to remove");
00807     RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
00808 }
00809 
00810 static void rna_def_armature(BlenderRNA *brna)
00811 {
00812     StructRNA *srna;
00813     PropertyRNA *prop;
00814     
00815     static EnumPropertyItem prop_drawtype_items[] = {
00816         {ARM_OCTA, "OCTAHEDRAL", 0, "Octahedral", "Display bones as octahedral shape (default)"},
00817         {ARM_LINE, "STICK", 0, "Stick", "Display bones as simple 2D lines with dots"},
00818         {ARM_B_BONE, "BBONE", 0, "B-Bone", "Display bones as boxes, showing subdivision and B-Splines"},
00819         {ARM_ENVELOPE, "ENVELOPE", 0, "Envelope", "Display bones as extruded spheres, showing deformation influence volume"},
00820         {ARM_WIRE, "WIRE", 0, "Wire", "Display bones as thin wires, showing subdivision and B-Splines"},
00821         {0, NULL, 0, NULL, NULL}};
00822     static EnumPropertyItem prop_vdeformer[] = {
00823         {ARM_VDEF_BLENDER, "BLENDER", 0, "Blender", "Use Blender's armature vertex deformation"},
00824         {ARM_VDEF_BGE_CPU, "BGE_CPU", 0, "BGE", "Use vertex deformation code optimized for the BGE"},
00825         {0, NULL, 0, NULL, NULL}};
00826     static EnumPropertyItem prop_ghost_type_items[] = {
00827         {ARM_GHOST_CUR, "CURRENT_FRAME", 0, "Around Frame",
00828                         "Display Ghosts of poses within a fixed number of frames around the current frame"},
00829         {ARM_GHOST_RANGE, "RANGE", 0, "In Range", "Display Ghosts of poses within specified range"},
00830         {ARM_GHOST_KEYS, "KEYS", 0, "On Keyframes", "Display Ghosts of poses on Keyframes"},
00831         {0, NULL, 0, NULL, NULL}};
00832     static const EnumPropertyItem prop_pose_position_items[]= {
00833         {0, "POSE", 0, "Pose Position", "Show armature in posed state"},
00834         {ARM_RESTPOS, "REST", 0, "Rest Position", "Show Armature in binding pose state (no posing possible)"},
00835         {0, NULL, 0, NULL, NULL}};
00836     
00837     srna= RNA_def_struct(brna, "Armature", "ID");
00838     RNA_def_struct_ui_text(srna, "Armature",
00839                            "Armature datablock containing a hierarchy of bones, usually used for rigging characters");
00840     RNA_def_struct_ui_icon(srna, ICON_ARMATURE_DATA);
00841     RNA_def_struct_sdna(srna, "bArmature");
00842     
00843     /* Animation Data */
00844     rna_def_animdata_common(srna);
00845     
00846     /* Collections */
00847     prop= RNA_def_property(srna, "bones", PROP_COLLECTION, PROP_NONE);
00848     RNA_def_property_collection_sdna(prop, NULL, "bonebase", NULL);
00849     RNA_def_property_collection_funcs(prop, 0, "rna_Armature_bones_next", NULL, NULL, NULL, NULL, NULL, NULL);
00850     RNA_def_property_struct_type(prop, "Bone");
00851     RNA_def_property_ui_text(prop, "Bones", "");
00852     rna_def_armature_bones(brna, prop);
00853 
00854     prop= RNA_def_property(srna, "edit_bones", PROP_COLLECTION, PROP_NONE);
00855     RNA_def_property_collection_sdna(prop, NULL, "edbo", NULL);
00856     RNA_def_property_struct_type(prop, "EditBone");
00857     RNA_def_property_ui_text(prop, "Edit Bones", "");
00858     rna_def_armature_edit_bones(brna, prop);
00859 
00860     /* Enum values */
00861     prop= RNA_def_property(srna, "pose_position", PROP_ENUM, PROP_NONE);
00862     RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag");
00863     RNA_def_property_enum_items(prop, prop_pose_position_items);
00864     RNA_def_property_ui_text(prop, "Pose Position", "Show armature in binding pose or final posed state");
00865     RNA_def_property_update(prop, 0, "rna_Armature_update_data");
00866     RNA_def_property_flag(prop, PROP_LIB_EXCEPTION);
00867     
00868     prop= RNA_def_property(srna, "draw_type", PROP_ENUM, PROP_NONE);
00869     RNA_def_property_enum_sdna(prop, NULL, "drawtype");
00870     RNA_def_property_enum_items(prop, prop_drawtype_items);
00871     RNA_def_property_ui_text(prop, "Draw Type", "");
00872     RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
00873     RNA_def_property_flag(prop, PROP_LIB_EXCEPTION);
00874 
00875     prop= RNA_def_property(srna, "deform_method", PROP_ENUM, PROP_NONE);
00876     RNA_def_property_enum_sdna(prop, NULL, "gevertdeformer");
00877     RNA_def_property_enum_items(prop, prop_vdeformer);
00878     RNA_def_property_ui_text(prop, "Vertex Deformer", "");
00879     RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
00880     RNA_def_property_flag(prop, PROP_LIB_EXCEPTION);
00881     
00882 // XXX depreceated ....... old animviz for armatures only
00883     prop= RNA_def_property(srna, "ghost_type", PROP_ENUM, PROP_NONE);
00884     RNA_def_property_enum_sdna(prop, NULL, "ghosttype");
00885     RNA_def_property_enum_items(prop, prop_ghost_type_items);
00886     RNA_def_property_ui_text(prop, "Ghost Type", "Method of Onion-skinning for active Action");
00887     RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
00888     RNA_def_property_flag(prop, PROP_LIB_EXCEPTION);
00889 // XXX depreceated ....... old animviz for armatures only   
00890 
00891     /* Boolean values */
00892         /* layer */
00893     prop= RNA_def_property(srna, "layers", PROP_BOOLEAN, PROP_LAYER_MEMBER);
00894     RNA_def_property_boolean_sdna(prop, NULL, "layer", 1);
00895     RNA_def_property_array(prop, 32);
00896     RNA_def_property_ui_text(prop, "Visible Layers", "Armature layer visibility");
00897     RNA_def_property_boolean_funcs(prop, NULL, "rna_Armature_layer_set");
00898     RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Armature_update_layers");
00899     RNA_def_property_flag(prop, PROP_LIB_EXCEPTION);
00900     
00901         /* layer protection */
00902     prop= RNA_def_property(srna, "layers_protected", PROP_BOOLEAN, PROP_LAYER);
00903     RNA_def_property_boolean_sdna(prop, NULL, "layer_protected", 1);
00904     RNA_def_property_array(prop, 32);
00905     RNA_def_property_ui_text(prop, "Layer Proxy Protection",
00906                              "Protected layers in Proxy Instances are restored to Proxy settings on file reload and undo");
00907     RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
00908         
00909         /* flag */
00910     prop= RNA_def_property(srna, "show_axes", PROP_BOOLEAN, PROP_NONE);
00911     RNA_def_property_boolean_sdna(prop, NULL, "flag", ARM_DRAWAXES);
00912     RNA_def_property_ui_text(prop, "Draw Axes", "Draw bone axes");
00913     RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
00914     RNA_def_property_flag(prop, PROP_LIB_EXCEPTION);
00915     
00916     prop= RNA_def_property(srna, "show_names", PROP_BOOLEAN, PROP_NONE);
00917     RNA_def_property_boolean_sdna(prop, NULL, "flag", ARM_DRAWNAMES);
00918     RNA_def_property_ui_text(prop, "Draw Names", "Draw bone names");
00919     RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
00920     RNA_def_property_flag(prop, PROP_LIB_EXCEPTION);
00921     
00922     prop= RNA_def_property(srna, "use_deform_delay", PROP_BOOLEAN, PROP_NONE);
00923     RNA_def_property_boolean_sdna(prop, NULL, "flag", ARM_DELAYDEFORM);
00924     RNA_def_property_ui_text(prop, "Delay Deform", "Don't deform children when manipulating bones in Pose Mode");
00925     RNA_def_property_update(prop, 0, "rna_Armature_update_data");
00926     
00927     prop= RNA_def_property(srna, "use_mirror_x", PROP_BOOLEAN, PROP_NONE);
00928     RNA_def_property_boolean_sdna(prop, NULL, "flag", ARM_MIRROR_EDIT);
00929     RNA_def_property_ui_text(prop, "X-Axis Mirror", "Apply changes to matching bone on opposite side of X-Axis");
00930     RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
00931     RNA_def_property_flag(prop, PROP_LIB_EXCEPTION);
00932     
00933     prop= RNA_def_property(srna, "use_auto_ik", PROP_BOOLEAN, PROP_NONE);
00934     RNA_def_property_boolean_sdna(prop, NULL, "flag", ARM_AUTO_IK);
00935     RNA_def_property_ui_text(prop, "Auto IK", "Add temporaral IK constraints while grabbing bones in Pose Mode");
00936     RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
00937     RNA_def_property_flag(prop, PROP_LIB_EXCEPTION);
00938     
00939     prop= RNA_def_property(srna, "show_bone_custom_shapes", PROP_BOOLEAN, PROP_NONE);
00940     RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", ARM_NO_CUSTOM);
00941     RNA_def_property_ui_text(prop, "Draw Custom Bone Shapes", "Draw bones with their custom shapes");
00942     RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
00943     
00944     prop= RNA_def_property(srna, "show_group_colors", PROP_BOOLEAN, PROP_NONE);
00945     RNA_def_property_boolean_sdna(prop, NULL, "flag", ARM_COL_CUSTOM);
00946     RNA_def_property_ui_text(prop, "Draw Bone Group Colors", "Draw bone group colors");
00947     RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
00948     
00949 // XXX depreceated ....... old animviz for armatures only
00950     prop= RNA_def_property(srna, "show_only_ghost_selected", PROP_BOOLEAN, PROP_NONE);
00951     RNA_def_property_boolean_sdna(prop, NULL, "flag", ARM_GHOST_ONLYSEL);
00952     RNA_def_property_ui_text(prop, "Draw Ghosts on Selected Bones Only", "");
00953     RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
00954     RNA_def_property_flag(prop, PROP_LIB_EXCEPTION);
00955 // XXX depreceated ....... old animviz for armatures only
00956     
00957         /* deformflag */
00958     prop= RNA_def_property(srna, "use_deform_vertex_groups", PROP_BOOLEAN, PROP_NONE);
00959     RNA_def_property_boolean_sdna(prop, NULL, "deformflag", ARM_DEF_VGROUP);
00960     RNA_def_property_ui_text(prop, "Deform Vertex Groups", "Enable Vertex Groups when defining deform");
00961     RNA_def_property_update(prop, 0, "rna_Armature_update_data");
00962     
00963     prop= RNA_def_property(srna, "use_deform_envelopes", PROP_BOOLEAN, PROP_NONE);
00964     RNA_def_property_boolean_sdna(prop, NULL, "deformflag", ARM_DEF_ENVELOPE);
00965     RNA_def_property_ui_text(prop, "Deform Envelopes", "Enable Bone Envelopes when defining deform");
00966     RNA_def_property_update(prop, 0, "rna_Armature_update_data");
00967     
00968     prop= RNA_def_property(srna, "use_deform_preserve_volume", PROP_BOOLEAN, PROP_NONE);
00969     RNA_def_property_boolean_sdna(prop, NULL, "deformflag", ARM_DEF_QUATERNION);
00970     RNA_def_property_ui_text(prop, "Use Dual Quaternion Deformation", "Enable deform rotation with Quaternions");
00971     RNA_def_property_update(prop, 0, "rna_Armature_update_data");
00972     
00973     //prop= RNA_def_property(srna, "deform_invert_vertexgroups", PROP_BOOLEAN, PROP_NONE);
00974     //RNA_def_property_boolean_negative_sdna(prop, NULL, "deformflag", ARM_DEF_INVERT_VGROUP);
00975     //RNA_def_property_ui_text(prop, "Invert Vertex Group Influence", "Invert Vertex Group influence (only for Modifiers)");
00976     //RNA_def_property_update(prop, 0, "rna_Armature_update_data");
00977     
00978     /* Number fields */
00979 // XXX depreceated ....... old animviz for armatures only
00980         /* ghost/onionskining settings */
00981     prop= RNA_def_property(srna, "ghost_step", PROP_INT, PROP_NONE);
00982     RNA_def_property_int_sdna(prop, NULL, "ghostep");
00983     RNA_def_property_range(prop, 0, 30);
00984     RNA_def_property_ui_text(prop, "Ghosting Step",
00985                              "Number of frame steps on either side of current frame to show as ghosts "
00986                              "(only for 'Around Current Frame' Onion-skinning method)");
00987     RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
00988     RNA_def_property_flag(prop, PROP_LIB_EXCEPTION);
00989     
00990     prop= RNA_def_property(srna, "ghost_size", PROP_INT, PROP_NONE);
00991     RNA_def_property_int_sdna(prop, NULL, "ghostsize");
00992     RNA_def_property_range(prop, 1, 20);
00993     RNA_def_property_ui_text(prop, "Ghosting Frame Step",
00994                              "Frame step for Ghosts (not for 'On Keyframes' Onion-skinning method)");
00995     RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
00996     RNA_def_property_flag(prop, PROP_LIB_EXCEPTION);
00997     
00998     prop= RNA_def_property(srna, "ghost_frame_start", PROP_INT, PROP_TIME);
00999     RNA_def_property_int_sdna(prop, NULL, "ghostsf");
01000     RNA_def_property_int_funcs(prop, NULL, "rna_Armature_ghost_start_frame_set", NULL);
01001     RNA_def_property_ui_text(prop, "Ghosting Start Frame",
01002                              "Starting frame of range of Ghosts to display (not for "
01003                              "'Around Current Frame' Onion-skinning method)");
01004     RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
01005     RNA_def_property_flag(prop, PROP_LIB_EXCEPTION);
01006     
01007     prop= RNA_def_property(srna, "ghost_frame_end", PROP_INT, PROP_TIME);
01008     RNA_def_property_int_sdna(prop, NULL, "ghostef");
01009     RNA_def_property_int_funcs(prop, NULL, "rna_Armature_ghost_end_frame_set", NULL);
01010     RNA_def_property_ui_text(prop, "Ghosting End Frame",
01011                              "End frame of range of Ghosts to display (not for 'Around Current Frame' Onion-skinning method)");
01012     RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
01013     RNA_def_property_flag(prop, PROP_LIB_EXCEPTION);
01014 // XXX depreceated ....... old animviz for armatures only   
01015 }
01016 
01017 void RNA_def_armature(BlenderRNA *brna)
01018 {
01019     rna_def_armature(brna);
01020     rna_def_bone(brna);
01021     rna_def_edit_bone(brna);
01022 }
01023 
01024 #endif