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