Blender  V2.59
rna_pose.c
Go to the documentation of this file.
00001 /*
00002  * $Id: rna_pose.c 38193 2011-07-07 16:09:57Z campbellbarton $
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), Roland Hess, Joshua Leung
00021  *
00022  * ***** END GPL LICENSE BLOCK *****
00023  */
00024 
00030 #include <stdlib.h>
00031 #include <string.h>
00032 
00033 #include "RNA_define.h"
00034 #include "RNA_enum_types.h"
00035 
00036 #include "rna_internal.h"
00037 
00038 #include "DNA_action_types.h"
00039 #include "DNA_armature_types.h"
00040 #include "DNA_constraint_types.h"
00041 #include "DNA_object_types.h"
00042 #include "DNA_scene_types.h"
00043 
00044 #include "BLI_math.h"
00045 
00046 #include "WM_types.h"
00047 
00048 #ifdef RNA_RUNTIME
00049 
00050 #include "BIK_api.h"
00051 #include "BKE_action.h"
00052 #include "BKE_armature.h"
00053 
00054 #include "DNA_userdef_types.h"
00055 
00056 #include "MEM_guardedalloc.h"
00057 
00058 #include "BLI_ghash.h"
00059 
00060 #include "BKE_context.h"
00061 #include "BKE_constraint.h"
00062 #include "BKE_depsgraph.h"
00063 #include "BKE_idprop.h"
00064 
00065 #include "ED_object.h"
00066 #include "ED_armature.h"
00067 
00068 #include "MEM_guardedalloc.h"
00069 
00070 #include "WM_api.h"
00071 
00072 #include "RNA_access.h"
00073 
00074 static void rna_Pose_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
00075 {
00076         // XXX when to use this? ob->pose->flag |= (POSE_LOCKED|POSE_DO_UNLOCK);
00077 
00078         DAG_id_tag_update(ptr->id.data, OB_RECALC_DATA);
00079 }
00080 
00081 static void rna_Pose_IK_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
00082 {
00083         // XXX when to use this? ob->pose->flag |= (POSE_LOCKED|POSE_DO_UNLOCK);
00084         Object *ob= ptr->id.data;
00085 
00086         DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
00087         BIK_clear_data(ob->pose);
00088 }
00089 
00090 static char *rna_PoseBone_path(PointerRNA *ptr)
00091 {
00092         return BLI_sprintfN("pose.bones[\"%s\"]", ((bPoseChannel*)ptr->data)->name);
00093 }
00094 
00095 static void rna_BoneGroup_color_set_set(PointerRNA *ptr, int value)
00096 {
00097         bActionGroup *grp= ptr->data;
00098         
00099         /* if valid value, set the new enum value, then copy the relevant colors? */
00100         if ((value >= -1) && (value < 21))
00101                 grp->customCol= value;
00102         else
00103                 return;
00104         
00105         /* only do color copying if using a custom color (i.e. not default color)  */
00106         if (grp->customCol) {
00107                 if (grp->customCol > 0) {
00108                         /* copy theme colors on-to group's custom color in case user tries to edit color */
00109                         bTheme *btheme= U.themes.first;
00110                         ThemeWireColor *col_set= &btheme->tarm[(grp->customCol - 1)];
00111                         
00112                         memcpy(&grp->cs, col_set, sizeof(ThemeWireColor));
00113                 }
00114                 else {
00115                         /* init custom colors with a generic multi-color rgb set, if not initialised already (for custom color set) */
00116                         if (grp->cs.solid[0] == 0) {
00117                                 /* define for setting colors in theme below */
00118                                 #define SETCOL(col, r, g, b, a)  col[0]=r; col[1]=g; col[2]= b; col[3]= a;
00119                                 
00120                                 SETCOL(grp->cs.solid, 0xff, 0x00, 0x00, 255);
00121                                 SETCOL(grp->cs.select, 0x81, 0xe6, 0x14, 255);
00122                                 SETCOL(grp->cs.active, 0x18, 0xb6, 0xe0, 255);
00123                                 
00124                                 #undef SETCOL
00125                         }
00126                 }
00127         }
00128 }
00129 
00130 static IDProperty *rna_PoseBone_idprops(PointerRNA *ptr, int create)
00131 {
00132         bPoseChannel *pchan= ptr->data;
00133 
00134         if(create && !pchan->prop) {
00135                 IDPropertyTemplate val = {0};
00136                 pchan->prop= IDP_New(IDP_GROUP, val, "RNA_PoseBone group");
00137         }
00138 
00139         return pchan->prop;
00140 }
00141 
00142 static void rna_Pose_ik_solver_set(struct PointerRNA *ptr, int value)
00143 {
00144         bPose *pose= (bPose*)ptr->data;
00145 
00146         if (pose->iksolver != value) {
00147                 // the solver has changed, must clean any temporary structures
00148                 BIK_clear_data(pose);
00149                 if (pose->ikparam) {
00150                         MEM_freeN(pose->ikparam);
00151                         pose->ikparam = NULL;
00152                 }
00153                 pose->iksolver = value;
00154                 init_pose_ikparam(pose);
00155         }
00156 }
00157 
00158 static void rna_Pose_ik_solver_update(Main *bmain, Scene *scene, PointerRNA *ptr)
00159 {
00160         Object *ob= ptr->id.data;
00161         bPose *pose = ptr->data;
00162 
00163         pose->flag |= POSE_RECALC;      // checks & sorts pose channels
00164         DAG_scene_sort(bmain, scene);
00165         
00166         update_pose_constraint_flags(pose);
00167         
00168         object_test_constraints(ob);
00169 
00170         DAG_id_tag_update(&ob->id, OB_RECALC_DATA|OB_RECALC_OB);
00171 }
00172 
00173 /* rotation - axis-angle */
00174 static void rna_PoseChannel_rotation_axis_angle_get(PointerRNA *ptr, float *value)
00175 {
00176         bPoseChannel *pchan= ptr->data;
00177         
00178         /* for now, assume that rotation mode is axis-angle */
00179         value[0]= pchan->rotAngle;
00180         copy_v3_v3(&value[1], pchan->rotAxis);
00181 }
00182 
00183 /* rotation - axis-angle */
00184 static void rna_PoseChannel_rotation_axis_angle_set(PointerRNA *ptr, const float *value)
00185 {
00186         bPoseChannel *pchan= ptr->data;
00187         
00188         /* for now, assume that rotation mode is axis-angle */
00189         pchan->rotAngle= value[0];
00190         copy_v3_v3(pchan->rotAxis, (float *)&value[1]);
00191         
00192         // TODO: validate axis?
00193 }
00194 
00195 static void rna_PoseChannel_rotation_mode_set(PointerRNA *ptr, int value)
00196 {
00197         bPoseChannel *pchan= ptr->data;
00198         
00199         /* use API Method for conversions... */
00200         BKE_rotMode_change_values(pchan->quat, pchan->eul, pchan->rotAxis, &pchan->rotAngle, pchan->rotmode, (short)value);
00201         
00202         /* finally, set the new rotation type */
00203         pchan->rotmode= value;
00204 }
00205 
00206 static void rna_PoseChannel_name_set(PointerRNA *ptr, const char *value)
00207 {
00208         Object *ob= (Object*)ptr->id.data;
00209         bPoseChannel *pchan= (bPoseChannel*)ptr->data;
00210         char oldname[sizeof(pchan->name)], newname[sizeof(pchan->name)];
00211 
00212         /* need to be on the stack */
00213         BLI_strncpy(newname, value, sizeof(pchan->name));
00214         BLI_strncpy(oldname, pchan->name, sizeof(pchan->name));
00215 
00216         ED_armature_bone_rename(ob->data, oldname, newname);
00217 }
00218 
00219 static int rna_PoseChannel_has_ik_get(PointerRNA *ptr)
00220 {
00221         Object *ob= (Object*)ptr->id.data;
00222         bPoseChannel *pchan= (bPoseChannel*)ptr->data;
00223 
00224         return ED_pose_channel_in_IK_chain(ob, pchan);
00225 }
00226 
00227 StructRNA *rna_IKParam_refine(PointerRNA *ptr)
00228 {
00229         bIKParam *param = (bIKParam *)ptr->data;
00230 
00231         switch (param->iksolver) {
00232         case IKSOLVER_ITASC:
00233                 return &RNA_Itasc;
00234         default:
00235                 return &RNA_IKParam;
00236         }
00237 }
00238 
00239 PointerRNA rna_Pose_ikparam_get(struct PointerRNA *ptr)
00240 {
00241         bPose *pose= (bPose*)ptr->data;
00242         return rna_pointer_inherit_refine(ptr, &RNA_IKParam, pose->ikparam);
00243 }
00244 
00245 static StructRNA *rna_Pose_ikparam_typef(PointerRNA *ptr)
00246 {
00247         bPose *pose= (bPose*)ptr->data;
00248 
00249         switch (pose->iksolver) {
00250         case IKSOLVER_ITASC:
00251                 return &RNA_Itasc;
00252         default:
00253                 return &RNA_IKParam;
00254         }
00255 }
00256 
00257 static void rna_Itasc_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
00258 {
00259         Object *ob = ptr->id.data;
00260         bItasc *itasc = ptr->data;
00261 
00262         /* verify values */
00263         if (itasc->precision < 0.0001f)
00264                 itasc->precision = 0.0001f;
00265         if (itasc->minstep < 0.001f)
00266                 itasc->minstep = 0.001f;
00267         if (itasc->maxstep < itasc->minstep)
00268                 itasc->maxstep = itasc->minstep;
00269         if (itasc->feedback < 0.01f)
00270                 itasc->feedback = 0.01f;
00271         if (itasc->feedback > 100.f)
00272                 itasc->feedback = 100.f;
00273         if (itasc->maxvel < 0.01f)
00274                 itasc->maxvel = 0.01f;
00275         if (itasc->maxvel > 100.f)
00276                 itasc->maxvel = 100.f;
00277         BIK_update_param(ob->pose);
00278 
00279         DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
00280 }
00281 
00282 static void rna_Itasc_update_rebuild(Main *bmain, Scene *scene, PointerRNA *ptr)
00283 {
00284         Object *ob= ptr->id.data;
00285         bPose *pose = ob->pose;
00286 
00287         pose->flag |= POSE_RECALC;      // checks & sorts pose channels
00288         rna_Itasc_update(bmain, scene, ptr);
00289 }
00290 
00291 static void rna_PoseChannel_bone_custom_set(PointerRNA *ptr, PointerRNA value)
00292 {
00293         bPoseChannel *pchan = (bPoseChannel*)ptr->data;
00294 
00295 
00296         if (pchan->custom) {
00297                 id_us_min(&pchan->custom->id);
00298                 pchan->custom = NULL;
00299         }
00300 
00301         pchan->custom = value.data;
00302 
00303         id_us_plus(&pchan->custom->id);
00304 }
00305 
00306 static PointerRNA rna_PoseChannel_bone_group_get(PointerRNA *ptr)
00307 {
00308         Object *ob= (Object*)ptr->id.data;
00309         bPose *pose= (ob) ? ob->pose : NULL;
00310         bPoseChannel *pchan= (bPoseChannel*)ptr->data;
00311         bActionGroup *grp;
00312         
00313         if (pose)
00314                 grp= BLI_findlink(&pose->agroups, pchan->agrp_index-1);
00315         else
00316                 grp= NULL;
00317         
00318         return rna_pointer_inherit_refine(ptr, &RNA_BoneGroup, grp);
00319 }
00320 
00321 static void rna_PoseChannel_bone_group_set(PointerRNA *ptr, PointerRNA value)
00322 {
00323         Object *ob= (Object*)ptr->id.data;
00324         bPose *pose= (ob) ? ob->pose : NULL;
00325         bPoseChannel *pchan= (bPoseChannel*)ptr->data;
00326         
00327         if (pose)
00328                 pchan->agrp_index= BLI_findindex(&pose->agroups, value.data) + 1;
00329         else
00330                 pchan->agrp_index= 0;
00331 }
00332 
00333 static int rna_PoseChannel_bone_group_index_get(PointerRNA *ptr)
00334 {
00335         bPoseChannel *pchan= (bPoseChannel*)ptr->data;
00336         return MAX2(pchan->agrp_index-1, 0);
00337 }
00338 
00339 static void rna_PoseChannel_bone_group_index_set(PointerRNA *ptr, int value)
00340 {
00341         bPoseChannel *pchan= (bPoseChannel*)ptr->data;
00342         pchan->agrp_index= value+1;
00343 }
00344 
00345 static void rna_PoseChannel_bone_group_index_range(PointerRNA *ptr, int *min, int *max)
00346 {
00347         Object *ob= (Object*)ptr->id.data;
00348         bPose *pose= (ob) ? ob->pose : NULL;
00349         
00350         *min= 0;
00351         
00352         if (pose) {
00353                 *max= BLI_countlist(&pose->agroups)-1;
00354                 *max= MAX2(0, *max);
00355         }
00356         else
00357                 *max= 0;
00358 }
00359 
00360 static PointerRNA rna_Pose_active_bone_group_get(PointerRNA *ptr)
00361 {
00362         bPose *pose= (bPose*)ptr->data;
00363         return rna_pointer_inherit_refine(ptr, &RNA_BoneGroup, BLI_findlink(&pose->agroups, pose->active_group-1));
00364 }
00365 
00366 static void rna_Pose_active_bone_group_set(PointerRNA *ptr, PointerRNA value)
00367 {
00368         bPose *pose= (bPose*)ptr->data;
00369         pose->active_group= BLI_findindex(&pose->agroups, value.data) + 1;
00370 }
00371 
00372 static int rna_Pose_active_bone_group_index_get(PointerRNA *ptr)
00373 {
00374         bPose *pose= (bPose*)ptr->data;
00375         return MAX2(pose->active_group-1, 0);
00376 }
00377 
00378 static void rna_Pose_active_bone_group_index_set(PointerRNA *ptr, int value)
00379 {
00380         bPose *pose= (bPose*)ptr->data;
00381         pose->active_group= value+1;
00382 }
00383 
00384 static void rna_Pose_active_bone_group_index_range(PointerRNA *ptr, int *min, int *max)
00385 {
00386         bPose *pose= (bPose*)ptr->data;
00387 
00388         *min= 0;
00389         *max= BLI_countlist(&pose->agroups)-1;
00390         *max= MAX2(0, *max);
00391 }
00392 
00393 #if 0
00394 static void rna_pose_bgroup_name_index_get(PointerRNA *ptr, char *value, int index)
00395 {
00396         bPose *pose= (bPose*)ptr->data;
00397         bActionGroup *grp;
00398 
00399         grp= BLI_findlink(&pose->agroups, index-1);
00400 
00401         if(grp) BLI_strncpy(value, grp->name, sizeof(grp->name));
00402         else BLI_strncpy(value, "", sizeof(grp->name)); // XXX if invalid pointer, won't this crash?
00403 }
00404 
00405 static int rna_pose_bgroup_name_index_length(PointerRNA *ptr, int index)
00406 {
00407         bPose *pose= (bPose*)ptr->data;
00408         bActionGroup *grp;
00409 
00410         grp= BLI_findlink(&pose->agroups, index-1);
00411         return (grp)? strlen(grp->name): 0;
00412 }
00413 
00414 static void rna_pose_bgroup_name_index_set(PointerRNA *ptr, const char *value, short *index)
00415 {
00416         bPose *pose= (bPose*)ptr->data;
00417         bActionGroup *grp;
00418         int a;
00419         
00420         for (a=1, grp=pose->agroups.first; grp; grp=grp->next, a++) {
00421                 if (strcmp(grp->name, value) == 0) {
00422                         *index= a;
00423                         return;
00424                 }
00425         }
00426         
00427         *index= 0;
00428 }
00429 
00430 static void rna_pose_pgroup_name_set(PointerRNA *ptr, const char *value, char *result, int maxlen)
00431 {
00432         bPose *pose= (bPose*)ptr->data;
00433         bActionGroup *grp;
00434         
00435         for (grp= pose->agroups.first; grp; grp= grp->next) {
00436                 if (strcmp(grp->name, value) == 0) {
00437                         BLI_strncpy(result, value, maxlen);
00438                         return;
00439                 }
00440         }
00441         
00442         BLI_strncpy(result, "", maxlen);
00443 }
00444 #endif
00445 
00446 static PointerRNA rna_PoseChannel_active_constraint_get(PointerRNA *ptr)
00447 {
00448         bPoseChannel *pchan= (bPoseChannel*)ptr->data;
00449         bConstraint *con= constraints_get_active(&pchan->constraints);
00450         return rna_pointer_inherit_refine(ptr, &RNA_Constraint, con);
00451 }
00452 
00453 static void rna_PoseChannel_active_constraint_set(PointerRNA *ptr, PointerRNA value)
00454 {
00455         bPoseChannel *pchan= (bPoseChannel*)ptr->data;
00456         constraints_set_active(&pchan->constraints, (bConstraint *)value.data);
00457 }
00458 
00459 static bConstraint *rna_PoseChannel_constraints_new(bPoseChannel *pchan, int type)
00460 {
00461         //WM_main_add_notifier(NC_OBJECT|ND_CONSTRAINT|NA_ADDED, object);
00462         // TODO, pass object also
00463         // TODO, new pose bones don't have updated draw flags
00464         return add_pose_constraint(NULL, pchan, NULL, type);
00465 }
00466 
00467 static void rna_PoseChannel_constraints_remove(ID *id, bPoseChannel *pchan, ReportList *reports, bConstraint *con)
00468 {
00469         if(BLI_findindex(&pchan->constraints, con) == -1) {
00470                 BKE_reportf(reports, RPT_ERROR, "Constraint '%s' not found in pose bone '%s'.", con->name, pchan->name);
00471                 return;
00472         }
00473         else {
00474                 Object *ob= (Object *)id;
00475                 const short is_ik= ELEM(con->type, CONSTRAINT_TYPE_KINEMATIC, CONSTRAINT_TYPE_SPLINEIK);
00476 
00477                 remove_constraint(&pchan->constraints, con);
00478                 ED_object_constraint_update(ob);
00479                 constraints_set_active(&pchan->constraints, NULL);
00480                 WM_main_add_notifier(NC_OBJECT|ND_CONSTRAINT|NA_REMOVED, id);
00481 
00482                 if (is_ik) {
00483                         BIK_clear_data(ob->pose);
00484                 }
00485         }
00486 }
00487 
00488 static int rna_PoseChannel_proxy_editable(PointerRNA *ptr)
00489 {
00490         Object *ob= (Object*)ptr->id.data;
00491         bArmature *arm= ob->data;
00492         bPoseChannel *pchan= (bPoseChannel*)ptr->data;
00493         
00494         return (ob->proxy && pchan->bone && (pchan->bone->layer & arm->layer_protected))? 0: PROP_EDITABLE;
00495 }
00496 
00497 static int rna_PoseChannel_location_editable(PointerRNA *ptr, int index)
00498 {
00499         bPoseChannel *pchan= (bPoseChannel*)ptr->data;
00500 
00501         /* only if the axis in question is locked, not editable... */
00502         if ((index == 0) && (pchan->protectflag & OB_LOCK_LOCX))
00503                 return 0;
00504         else if ((index == 1) && (pchan->protectflag & OB_LOCK_LOCY))
00505                 return 0;
00506         else if ((index == 2) && (pchan->protectflag & OB_LOCK_LOCZ))
00507                 return 0;
00508         else
00509                 return PROP_EDITABLE;
00510 }
00511 
00512 static int rna_PoseChannel_scale_editable(PointerRNA *ptr, int index)
00513 {
00514         bPoseChannel *pchan= (bPoseChannel*)ptr->data;
00515         
00516         /* only if the axis in question is locked, not editable... */
00517         if ((index == 0) && (pchan->protectflag & OB_LOCK_SCALEX))
00518                 return 0;
00519         else if ((index == 1) && (pchan->protectflag & OB_LOCK_SCALEY))
00520                 return 0;
00521         else if ((index == 2) && (pchan->protectflag & OB_LOCK_SCALEZ))
00522                 return 0;
00523         else
00524                 return PROP_EDITABLE;
00525 }
00526 
00527 static int rna_PoseChannel_rotation_euler_editable(PointerRNA *ptr, int index)
00528 {
00529         bPoseChannel *pchan= (bPoseChannel*)ptr->data;
00530         
00531         /* only if the axis in question is locked, not editable... */
00532         if ((index == 0) && (pchan->protectflag & OB_LOCK_ROTX))
00533                 return 0;
00534         else if ((index == 1) && (pchan->protectflag & OB_LOCK_ROTY))
00535                 return 0;
00536         else if ((index == 2) && (pchan->protectflag & OB_LOCK_ROTZ))
00537                 return 0;
00538         else
00539                 return PROP_EDITABLE;
00540 }
00541 
00542 static int rna_PoseChannel_rotation_4d_editable(PointerRNA *ptr, int index)
00543 {
00544         bPoseChannel *pchan= (bPoseChannel*)ptr->data;
00545         
00546         /* only consider locks if locking components individually... */
00547         if (pchan->protectflag & OB_LOCK_ROT4D) {
00548                 /* only if the axis in question is locked, not editable... */
00549                 if ((index == 0) && (pchan->protectflag & OB_LOCK_ROTW))
00550                         return 0;
00551                 else if ((index == 1) && (pchan->protectflag & OB_LOCK_ROTX))
00552                         return 0;
00553                 else if ((index == 2) && (pchan->protectflag & OB_LOCK_ROTY))
00554                         return 0;
00555                 else if ((index == 3) && (pchan->protectflag & OB_LOCK_ROTZ))
00556                         return 0;
00557         }
00558                 
00559         return PROP_EDITABLE;
00560 }
00561 
00562 /* not essential, but much faster then the default lookup function */
00563 int rna_PoseBones_lookup_string(PointerRNA *ptr, const char *key, PointerRNA *r_ptr)
00564 {
00565         bPose *pose= (bPose*)ptr->data;
00566         bPoseChannel *pchan= get_pose_channel(pose, key);
00567         if(pchan) {
00568                 RNA_pointer_create(ptr->id.data, &RNA_PoseBone, pchan, r_ptr);
00569                 return TRUE;
00570         }
00571         else {
00572                 return FALSE;
00573         }
00574 }
00575 
00576 static void rna_PoseChannel_matrix_basis_get(PointerRNA *ptr, float *values)
00577 {
00578         bPoseChannel *pchan= (bPoseChannel*)ptr->data;
00579         pchan_to_mat4(pchan, (float (*)[4])values);
00580 }
00581 
00582 static void rna_PoseChannel_matrix_basis_set(PointerRNA *ptr, const float *values)
00583 {
00584         bPoseChannel *pchan= (bPoseChannel*)ptr->data;
00585         pchan_apply_mat4(pchan, (float (*)[4])values, FALSE); /* no compat for predictable result */
00586 }
00587 
00588 static void rna_PoseChannel_matrix_set(PointerRNA *ptr, const float *values)
00589 {
00590         bPoseChannel *pchan= (bPoseChannel*)ptr->data;
00591         Object *ob= (Object*)ptr->id.data;
00592         float umat[4][4]= MAT4_UNITY;
00593         float tmat[4][4];
00594 
00595         /* recalculate pose matrix with only parent transformations,
00596          * bone loc/sca/rot is ignored, scene and frame are not used. */
00597         where_is_pose_bone(NULL, ob, pchan, 0.0f, FALSE);
00598 
00599         /* find the matrix, need to remove the bone transforms first so this is
00600          * calculated as a matrix to set rather then a difference ontop of whats
00601          * already there. */
00602         pchan_apply_mat4(pchan, umat, FALSE);
00603         armature_mat_pose_to_bone(pchan, (float (*)[4])values, tmat);
00604         pchan_apply_mat4(pchan, tmat, FALSE); /* no compat for predictable result */
00605 }
00606 
00607 #else
00608 
00609 static void rna_def_bone_group(BlenderRNA *brna)
00610 {
00611         static EnumPropertyItem prop_colorSets_items[] = {
00612                 {0, "DEFAULT", 0, "Default Colors", ""},
00613                 {1, "THEME01", 0, "01 - Theme Color Set", ""},
00614                 {2, "THEME02", 0, "02 - Theme Color Set", ""},
00615                 {3, "THEME03", 0, "03 - Theme Color Set", ""},
00616                 {4, "THEME04", 0, "04 - Theme Color Set", ""},
00617                 {5, "THEME05", 0, "05 - Theme Color Set", ""},
00618                 {6, "THEME06", 0, "06 - Theme Color Set", ""},
00619                 {7, "THEME07", 0, "07 - Theme Color Set", ""},
00620                 {8, "THEME08", 0, "08 - Theme Color Set", ""},
00621                 {9, "THEME09", 0, "09 - Theme Color Set", ""},
00622                 {10, "THEME10", 0, "10 - Theme Color Set", ""},
00623                 {11, "THEME11", 0, "11 - Theme Color Set", ""},
00624                 {12, "THEME12", 0, "12 - Theme Color Set", ""},
00625                 {13, "THEME13", 0, "13 - Theme Color Set", ""},
00626                 {14, "THEME14", 0, "14 - Theme Color Set", ""},
00627                 {15, "THEME15", 0, "15 - Theme Color Set", ""},
00628                 {16, "THEME16", 0, "16 - Theme Color Set", ""},
00629                 {17, "THEME17", 0, "17 - Theme Color Set", ""},
00630                 {18, "THEME18", 0, "18 - Theme Color Set", ""},
00631                 {19, "THEME19", 0, "19 - Theme Color Set", ""},
00632                 {20, "THEME20", 0, "20 - Theme Color Set", ""},
00633                 {-1, "CUSTOM", 0, "Custom Color Set", ""},
00634                 {0, NULL, 0, NULL, NULL}};
00635         
00636         StructRNA *srna;
00637         PropertyRNA *prop;
00638         
00639         /* struct */
00640         srna= RNA_def_struct(brna, "BoneGroup", NULL);
00641         RNA_def_struct_sdna(srna, "bActionGroup");
00642         RNA_def_struct_ui_text(srna, "Bone Group", "Groups of Pose Channels (Bones)");
00643         RNA_def_struct_ui_icon(srna, ICON_GROUP_BONE);
00644         
00645         /* name */
00646         prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
00647         RNA_def_property_ui_text(prop, "Name", "");
00648         RNA_def_struct_name_property(srna, prop);
00649         
00650         // TODO: add some runtime-collections stuff to access grouped bones 
00651         
00652         /* color set + colors */
00653         prop= RNA_def_property(srna, "color_set", PROP_ENUM, PROP_NONE);
00654         RNA_def_property_enum_sdna(prop, NULL, "customCol");
00655         RNA_def_property_enum_items(prop, prop_colorSets_items);
00656         RNA_def_property_enum_funcs(prop, NULL, "rna_BoneGroup_color_set_set", NULL);
00657         RNA_def_property_ui_text(prop, "Color Set", "Custom color set to use");
00658         RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_update");
00659         
00660                 // TODO: editing the colors for this should result in changes to the color type...
00661         prop= RNA_def_property(srna, "colors", PROP_POINTER, PROP_NONE);
00662         RNA_def_property_flag(prop, PROP_NEVER_NULL);
00663         RNA_def_property_struct_type(prop, "ThemeBoneColorSet");
00664         RNA_def_property_pointer_sdna(prop, NULL, "cs"); /* NOTE: the DNA data is not really a pointer, but this code works :) */
00665         RNA_def_property_ui_text(prop, "Colors", "Copy of the colors associated with the group's color set");
00666         RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_update");
00667 }
00668 
00669 static EnumPropertyItem prop_iksolver_items[] = {
00670         {IKSOLVER_LEGACY, "LEGACY", 0, "Legacy", "Original IK solver"},
00671         {IKSOLVER_ITASC, "ITASC", 0, "iTaSC", "Multi constraint, stateful IK solver"},
00672         {0, NULL, 0, NULL, NULL}};
00673 
00674 static EnumPropertyItem prop_solver_items[] = {
00675         {ITASC_SOLVER_SDLS, "SDLS", 0, "SDLS", "Selective Damped Least Square"},
00676         {ITASC_SOLVER_DLS, "DLS", 0, "DLS", "Damped Least Square with Numerical Filtering"},
00677         {0, NULL, 0, NULL, NULL}};
00678 
00679 
00680 static void rna_def_pose_channel_constraints(BlenderRNA *brna, PropertyRNA *cprop)
00681 {
00682         StructRNA *srna;
00683         PropertyRNA *prop;
00684 
00685         FunctionRNA *func;
00686         PropertyRNA *parm;
00687 
00688         RNA_def_property_srna(cprop, "PoseBoneConstraints");
00689         srna= RNA_def_struct(brna, "PoseBoneConstraints", NULL);
00690         RNA_def_struct_sdna(srna, "bPoseChannel");
00691         RNA_def_struct_ui_text(srna, "PoseBone Constraints", "Collection of pose bone constraints");
00692 
00693         /* Collection active property */
00694         prop= RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
00695         RNA_def_property_struct_type(prop, "Constraint");
00696         RNA_def_property_pointer_funcs(prop, "rna_PoseChannel_active_constraint_get", "rna_PoseChannel_active_constraint_set", NULL, NULL);
00697         RNA_def_property_flag(prop, PROP_EDITABLE);
00698         RNA_def_property_ui_text(prop, "Active Constraint", "Active PoseChannel constraint");
00699 
00700 
00701         /* Constraint collection */
00702         func= RNA_def_function(srna, "new", "rna_PoseChannel_constraints_new");
00703         RNA_def_function_ui_description(func, "Add a constraint to this object");
00704         /* return type */
00705         parm= RNA_def_pointer(func, "constraint", "Constraint", "", "New constraint.");
00706         RNA_def_function_return(func, parm);
00707         /* constraint to add */
00708         parm= RNA_def_enum(func, "type", constraint_type_items, 1, "", "Constraint type to add.");
00709         RNA_def_property_flag(parm, PROP_REQUIRED);
00710 
00711         func= RNA_def_function(srna, "remove", "rna_PoseChannel_constraints_remove");
00712         RNA_def_function_ui_description(func, "Remove a constraint from this object.");
00713         RNA_def_function_flag(func, FUNC_USE_REPORTS|FUNC_USE_SELF_ID); /* ID needed for refresh */
00714         /* constraint to remove */
00715         parm= RNA_def_pointer(func, "constraint", "Constraint", "", "Removed constraint.");
00716         RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
00717 }
00718 
00719 static void rna_def_pose_channel(BlenderRNA *brna)
00720 {
00721         // XXX: this RNA enum define is currently duplicated for objects, since there is some text here which is not applicable
00722         static EnumPropertyItem prop_rotmode_items[] = {
00723                 {ROT_MODE_QUAT, "QUATERNION", 0, "Quaternion (WXYZ)", "No Gimbal Lock (default)"},
00724                 {ROT_MODE_XYZ, "XYZ", 0, "XYZ Euler", "XYZ Rotation Order. Prone to Gimbal Lock"},
00725                 {ROT_MODE_XZY, "XZY", 0, "XZY Euler", "XZY Rotation Order. Prone to Gimbal Lock"},
00726                 {ROT_MODE_YXZ, "YXZ", 0, "YXZ Euler", "YXZ Rotation Order. Prone to Gimbal Lock"},
00727                 {ROT_MODE_YZX, "YZX", 0, "YZX Euler", "YZX Rotation Order. Prone to Gimbal Lock"},
00728                 {ROT_MODE_ZXY, "ZXY", 0, "ZXY Euler", "ZXY Rotation Order. Prone to Gimbal Lock"},
00729                 {ROT_MODE_ZYX, "ZYX", 0, "ZYX Euler", "ZYX Rotation Order. Prone to Gimbal Lock"},
00730                 {ROT_MODE_AXISANGLE, "AXIS_ANGLE", 0, "Axis Angle", "Axis Angle (W+XYZ). Defines a rotation around some axis defined by 3D-Vector"},
00731                 {0, NULL, 0, NULL, NULL}};
00732                 
00733         static float default_quat[4] = {1,0,0,0};       /* default quaternion values */
00734         static float default_axisAngle[4] = {0,0,1,0};  /* default axis-angle rotation values */
00735         static float default_scale[3] = {1,1,1}; /* default scale values */
00736         
00737         const int matrix_dimsize[]= {4, 4};
00738         
00739         StructRNA *srna;
00740         PropertyRNA *prop;
00741 
00742         srna= RNA_def_struct(brna, "PoseBone", NULL);
00743         RNA_def_struct_sdna(srna, "bPoseChannel");
00744         RNA_def_struct_ui_text(srna, "Pose Bone", "Channel defining pose data for a bone in a Pose");
00745         RNA_def_struct_path_func(srna, "rna_PoseBone_path");
00746         RNA_def_struct_idprops_func(srna, "rna_PoseBone_idprops");
00747         
00748         /* Bone Constraints */
00749         prop= RNA_def_property(srna, "constraints", PROP_COLLECTION, PROP_NONE);
00750         RNA_def_property_struct_type(prop, "Constraint");
00751         RNA_def_property_ui_text(prop, "Constraints", "Constraints that act on this PoseChannel");
00752 
00753         rna_def_pose_channel_constraints(brna, prop);
00754 
00755         /* Name + Selection Status */
00756         prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
00757         RNA_def_property_string_funcs(prop, NULL, NULL, "rna_PoseChannel_name_set");
00758         RNA_def_property_ui_text(prop, "Name", "");
00759         RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
00760         RNA_def_struct_name_property(srna, prop);
00761 
00762         /* Baked Bone Path cache data */
00763         rna_def_motionpath_common(srna);
00764         
00765         /* Relationships to other bones */
00766         prop= RNA_def_property(srna, "bone", PROP_POINTER, PROP_NONE);
00767         RNA_def_property_flag(prop, PROP_NEVER_NULL);
00768         RNA_def_property_struct_type(prop, "Bone");
00769         RNA_def_property_clear_flag(prop, PROP_EDITABLE);
00770         RNA_def_property_ui_text(prop, "Bone", "Bone associated with this PoseBone");
00771 
00772         prop= RNA_def_property(srna, "parent", PROP_POINTER, PROP_NONE);
00773         RNA_def_property_struct_type(prop, "PoseBone");
00774         RNA_def_property_clear_flag(prop, PROP_EDITABLE);
00775         RNA_def_property_ui_text(prop, "Parent", "Parent of this pose bone");
00776 
00777         prop= RNA_def_property(srna, "child", PROP_POINTER, PROP_NONE);
00778         RNA_def_property_struct_type(prop, "PoseBone");
00779         RNA_def_property_clear_flag(prop, PROP_EDITABLE);
00780         RNA_def_property_ui_text(prop, "Child", "Child of this pose bone");
00781         
00782         /* Transformation settings */
00783         prop= RNA_def_property(srna, "location", PROP_FLOAT, PROP_TRANSLATION);
00784         RNA_def_property_float_sdna(prop, NULL, "loc");
00785         RNA_def_property_editable_array_func(prop, "rna_PoseChannel_location_editable");
00786         RNA_def_property_ui_text(prop, "Location", "");
00787         RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable"); // XXX... disabled, since proxy-locked layers are currently used for ensuring proxy-syncing too
00788         RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_update");
00789 
00790         prop= RNA_def_property(srna, "scale", PROP_FLOAT, PROP_XYZ);
00791         RNA_def_property_float_sdna(prop, NULL, "size");
00792         RNA_def_property_editable_array_func(prop, "rna_PoseChannel_scale_editable");
00793         RNA_def_property_float_array_default(prop, default_scale);
00794         RNA_def_property_ui_text(prop, "Scale", "");
00795         RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable"); // XXX... disabled, since proxy-locked layers are currently used for ensuring proxy-syncing too
00796         RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_update");
00797 
00798         prop= RNA_def_property(srna, "rotation_quaternion", PROP_FLOAT, PROP_QUATERNION);
00799         RNA_def_property_float_sdna(prop, NULL, "quat");
00800         RNA_def_property_editable_array_func(prop, "rna_PoseChannel_rotation_4d_editable");
00801         RNA_def_property_float_array_default(prop, default_quat);
00802         RNA_def_property_ui_text(prop, "Quaternion Rotation", "Rotation in Quaternions");
00803         RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable"); // XXX... disabled, since proxy-locked layers are currently used for ensuring proxy-syncing too
00804         RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_update");
00805         
00806                 /* XXX: for axis-angle, it would have been nice to have 2 separate fields for UI purposes, but
00807                  * having a single one is better for Keyframing and other property-management situations...
00808                  */
00809         prop= RNA_def_property(srna, "rotation_axis_angle", PROP_FLOAT, PROP_AXISANGLE);
00810         RNA_def_property_array(prop, 4); // TODO: maybe we'll need to define the 'default value' getter too...
00811         RNA_def_property_float_funcs(prop, "rna_PoseChannel_rotation_axis_angle_get", "rna_PoseChannel_rotation_axis_angle_set", NULL);
00812         RNA_def_property_editable_array_func(prop, "rna_PoseChannel_rotation_4d_editable");
00813         RNA_def_property_float_array_default(prop, default_axisAngle);
00814         RNA_def_property_ui_text(prop, "Axis-Angle Rotation", "Angle of Rotation for Axis-Angle rotation representation");
00815         RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable"); // XXX... disabled, since proxy-locked layers are currently used for ensuring proxy-syncing too
00816         RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_update");
00817         
00818         prop= RNA_def_property(srna, "rotation_euler", PROP_FLOAT, PROP_EULER);
00819         RNA_def_property_float_sdna(prop, NULL, "eul");
00820         RNA_def_property_editable_array_func(prop, "rna_PoseChannel_rotation_euler_editable");
00821         RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable"); // XXX... disabled, since proxy-locked layers are currently used for ensuring proxy-syncing too
00822         RNA_def_property_ui_text(prop, "Euler Rotation", "Rotation in Eulers");
00823         RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_update");
00824         
00825         prop= RNA_def_property(srna, "rotation_mode", PROP_ENUM, PROP_NONE);
00826         RNA_def_property_enum_sdna(prop, NULL, "rotmode");
00827         RNA_def_property_enum_items(prop, prop_rotmode_items); // XXX move to using a single define of this someday
00828         RNA_def_property_enum_funcs(prop, NULL, "rna_PoseChannel_rotation_mode_set", NULL);
00829         RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable"); // XXX... disabled, since proxy-locked layers are currently used for ensuring proxy-syncing too
00830         RNA_def_property_ui_text(prop, "Rotation Mode", "");
00831         RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_update");
00832         
00833         /* transform matrices - should be read-only since these are set directly by AnimSys evaluation */
00834         prop= RNA_def_property(srna, "matrix_channel", PROP_FLOAT, PROP_MATRIX);
00835         RNA_def_property_float_sdna(prop, NULL, "chan_mat");
00836         RNA_def_property_multi_array(prop, 2, matrix_dimsize);
00837         RNA_def_property_clear_flag(prop, PROP_EDITABLE);
00838         RNA_def_property_ui_text(prop, "Channel Matrix", "4x4 matrix, before constraints");
00839 
00840         /* writable because it touches loc/scale/rot directly */
00841         prop= RNA_def_property(srna, "matrix_basis", PROP_FLOAT, PROP_MATRIX);
00842         RNA_def_property_multi_array(prop, 2, matrix_dimsize);
00843         RNA_def_property_ui_text(prop, "Basis Matrix", "Provides an alternative access to loc/scale/rotation relative to the parent and own rest bone.");
00844         RNA_def_property_float_funcs(prop, "rna_PoseChannel_matrix_basis_get", "rna_PoseChannel_matrix_basis_set", NULL);
00845         RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
00846         RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_update");
00847 
00848         /* final matrix */
00849         prop= RNA_def_property(srna, "matrix", PROP_FLOAT, PROP_MATRIX);
00850         RNA_def_property_float_sdna(prop, NULL, "pose_mat");
00851         RNA_def_property_multi_array(prop, 2, matrix_dimsize);
00852         RNA_def_property_float_funcs(prop, NULL, "rna_PoseChannel_matrix_set", NULL);
00853         RNA_def_property_ui_text(prop, "Pose Matrix", "Final 4x4 matrix after constraints and drivers are applied (object space)");
00854         RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_update");
00855 
00856         /* Head/Tail Coordinates (in Pose Space) - Automatically calculated... */
00857         prop= RNA_def_property(srna, "head", PROP_FLOAT, PROP_TRANSLATION);
00858         RNA_def_property_float_sdna(prop, NULL, "pose_head");
00859         RNA_def_property_clear_flag(prop, PROP_EDITABLE);
00860         RNA_def_property_ui_text(prop, "Pose Head Position", "Location of head of the channel's bone");
00861 
00862         prop= RNA_def_property(srna, "tail", PROP_FLOAT, PROP_TRANSLATION);
00863         RNA_def_property_float_sdna(prop, NULL, "pose_tail");
00864         RNA_def_property_clear_flag(prop, PROP_EDITABLE);
00865         RNA_def_property_ui_text(prop, "Pose Tail Position", "Location of tail of the channel's bone");
00866         
00867         /* IK Settings */
00868         prop= RNA_def_property(srna, "is_in_ik_chain", PROP_BOOLEAN, PROP_NONE);
00869         RNA_def_property_boolean_funcs(prop,  "rna_PoseChannel_has_ik_get", NULL);
00870         RNA_def_property_clear_flag(prop, PROP_EDITABLE);
00871         RNA_def_property_ui_text(prop, "Has IK", "Is part of an IK chain");
00872         RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_IK_update");
00873 
00874         prop= RNA_def_property(srna, "lock_ik_x", PROP_BOOLEAN, PROP_NONE);
00875         RNA_def_property_boolean_sdna(prop, NULL, "ikflag", BONE_IK_NO_XDOF);
00876         RNA_def_property_ui_text(prop, "IK X Lock", "Disallow movement around the X axis");
00877         RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
00878         RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_IK_update");
00879 
00880         prop= RNA_def_property(srna, "lock_ik_y", PROP_BOOLEAN, PROP_NONE);
00881         RNA_def_property_boolean_sdna(prop, NULL, "ikflag", BONE_IK_NO_YDOF);
00882         RNA_def_property_ui_text(prop, "IK Y Lock", "Disallow movement around the Y axis");
00883         RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
00884         RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_IK_update");
00885 
00886         prop= RNA_def_property(srna, "lock_ik_z", PROP_BOOLEAN, PROP_NONE);
00887         RNA_def_property_boolean_sdna(prop, NULL, "ikflag", BONE_IK_NO_ZDOF);
00888         RNA_def_property_ui_text(prop, "IK Z Lock", "Disallow movement around the Z axis");
00889         RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
00890         RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_IK_update");
00891 
00892         prop= RNA_def_property(srna, "use_ik_limit_x", PROP_BOOLEAN, PROP_NONE);
00893         RNA_def_property_boolean_sdna(prop, NULL, "ikflag", BONE_IK_XLIMIT);
00894         RNA_def_property_ui_text(prop, "IK X Limit", "Limit movement around the X axis");
00895         RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
00896         RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_IK_update");
00897 
00898         prop= RNA_def_property(srna, "use_ik_limit_y", PROP_BOOLEAN, PROP_NONE);
00899         RNA_def_property_boolean_sdna(prop, NULL, "ikflag", BONE_IK_YLIMIT);
00900         RNA_def_property_ui_text(prop, "IK Y Limit", "Limit movement around the Y axis");
00901         RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
00902         RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_IK_update");
00903 
00904         prop= RNA_def_property(srna, "use_ik_limit_z", PROP_BOOLEAN, PROP_NONE);
00905         RNA_def_property_boolean_sdna(prop, NULL, "ikflag", BONE_IK_ZLIMIT);
00906         RNA_def_property_ui_text(prop, "IK Z Limit", "Limit movement around the Z axis");
00907         RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
00908         RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_IK_update");
00909         
00910         prop= RNA_def_property(srna, "use_ik_rotation_control", PROP_BOOLEAN, PROP_NONE);
00911         RNA_def_property_boolean_sdna(prop, NULL, "ikflag", BONE_IK_ROTCTL);
00912         RNA_def_property_ui_text(prop, "IK rot control", "Apply channel rotation as IK constraint");
00913         RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
00914         RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_IK_update");
00915         
00916         prop= RNA_def_property(srna, "use_ik_linear_control", PROP_BOOLEAN, PROP_NONE);
00917         RNA_def_property_boolean_sdna(prop, NULL, "ikflag", BONE_IK_LINCTL);
00918         RNA_def_property_ui_text(prop, "IK rot control", "Apply channel size as IK constraint if stretching is enabled");
00919         RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
00920         RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_IK_update");
00921         
00922         prop= RNA_def_property(srna, "ik_min_x", PROP_FLOAT, PROP_ANGLE);
00923         RNA_def_property_float_sdna(prop, NULL, "limitmin[0]");
00924         RNA_def_property_range(prop, -M_PI, 0.0f);
00925         RNA_def_property_ui_text(prop, "IK X Minimum", "Minimum angles for IK Limit");
00926         RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
00927         RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_IK_update");
00928 
00929         prop= RNA_def_property(srna, "ik_max_x", PROP_FLOAT, PROP_ANGLE);
00930         RNA_def_property_float_sdna(prop, NULL, "limitmax[0]");
00931         RNA_def_property_range(prop, 0.0f, M_PI);
00932         RNA_def_property_ui_text(prop, "IK X Maximum", "Maximum angles for IK Limit");
00933         RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
00934         RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_IK_update");
00935 
00936         prop= RNA_def_property(srna, "ik_min_y", PROP_FLOAT, PROP_ANGLE);
00937         RNA_def_property_float_sdna(prop, NULL, "limitmin[1]");
00938         RNA_def_property_range(prop, -M_PI, 0.0f);
00939         RNA_def_property_ui_text(prop, "IK Y Minimum", "Minimum angles for IK Limit");
00940         RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
00941         RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_IK_update");
00942 
00943         prop= RNA_def_property(srna, "ik_max_y", PROP_FLOAT, PROP_ANGLE);
00944         RNA_def_property_float_sdna(prop, NULL, "limitmax[1]");
00945         RNA_def_property_range(prop, 0.0f, M_PI);
00946         RNA_def_property_ui_text(prop, "IK Y Maximum", "Maximum angles for IK Limit");
00947         RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
00948         RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_IK_update");
00949 
00950         prop= RNA_def_property(srna, "ik_min_z", PROP_FLOAT, PROP_ANGLE);
00951         RNA_def_property_float_sdna(prop, NULL, "limitmin[2]");
00952         RNA_def_property_range(prop, -M_PI, 0.0f);
00953         RNA_def_property_ui_text(prop, "IK Z Minimum", "Minimum angles for IK Limit");
00954         RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
00955         RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_IK_update");
00956 
00957         prop= RNA_def_property(srna, "ik_max_z", PROP_FLOAT, PROP_ANGLE);
00958         RNA_def_property_float_sdna(prop, NULL, "limitmax[2]");
00959         RNA_def_property_range(prop, 0.0f, M_PI);
00960         RNA_def_property_ui_text(prop, "IK Z Maximum", "Maximum angles for IK Limit");
00961         RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
00962         RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_IK_update");
00963 
00964         prop= RNA_def_property(srna, "ik_stiffness_x", PROP_FLOAT, PROP_NONE);
00965         RNA_def_property_float_sdna(prop, NULL, "stiffness[0]");
00966         RNA_def_property_range(prop, 0.0f, 0.99f);
00967         RNA_def_property_ui_text(prop, "IK X Stiffness", "IK stiffness around the X axis");
00968         RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
00969         RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_IK_update");
00970 
00971         prop= RNA_def_property(srna, "ik_stiffness_y", PROP_FLOAT, PROP_NONE);
00972         RNA_def_property_float_sdna(prop, NULL, "stiffness[1]");
00973         RNA_def_property_range(prop, 0.0f, 0.99f);
00974         RNA_def_property_ui_text(prop, "IK Y Stiffness", "IK stiffness around the Y axis");
00975         RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
00976         RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_IK_update");
00977 
00978         prop= RNA_def_property(srna, "ik_stiffness_z", PROP_FLOAT, PROP_NONE);
00979         RNA_def_property_float_sdna(prop, NULL, "stiffness[2]");
00980         RNA_def_property_range(prop, 0.0f, 0.99f);
00981         RNA_def_property_ui_text(prop, "IK Z Stiffness", "IK stiffness around the Z axis");
00982         RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
00983         RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_IK_update");
00984 
00985         prop= RNA_def_property(srna, "ik_stretch", PROP_FLOAT, PROP_NONE);
00986         RNA_def_property_float_sdna(prop, NULL, "ikstretch");
00987         RNA_def_property_range(prop, 0.0f,1.0f);
00988         RNA_def_property_ui_text(prop, "IK Stretch", "Allow scaling of the bone for IK");
00989         RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
00990         RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_IK_update");
00991         
00992         prop= RNA_def_property(srna, "ik_rotation_weight", PROP_FLOAT, PROP_NONE);
00993         RNA_def_property_float_sdna(prop, NULL, "ikrotweight");
00994         RNA_def_property_range(prop, 0.0f,1.0f);
00995         RNA_def_property_ui_text(prop, "IK Rot Weight", "Weight of rotation constraint for IK");
00996         RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
00997         RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_update");
00998         
00999         prop= RNA_def_property(srna, "ik_linear_weight", PROP_FLOAT, PROP_NONE);
01000         RNA_def_property_float_sdna(prop, NULL, "iklinweight");
01001         RNA_def_property_range(prop, 0.0f,1.0f);
01002         RNA_def_property_ui_text(prop, "IK Lin Weight", "Weight of scale constraint for IK");
01003         RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
01004         RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_update");
01005         
01006         /* custom bone shapes */
01007         prop= RNA_def_property(srna, "custom_shape", PROP_POINTER, PROP_NONE);
01008         RNA_def_property_pointer_sdna(prop, NULL, "custom");
01009         RNA_def_property_struct_type(prop, "Object");
01010         RNA_def_property_flag(prop, PROP_EDITABLE);
01011         RNA_def_property_pointer_funcs(prop, NULL, "rna_PoseChannel_bone_custom_set", NULL, NULL);
01012         RNA_def_property_ui_text(prop, "Custom Object", "Object that defines custom draw type for this bone");
01013         RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
01014         RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_update");
01015         
01016         prop= RNA_def_property(srna, "custom_shape_transform", PROP_POINTER, PROP_NONE);
01017         RNA_def_property_pointer_sdna(prop, NULL, "custom_tx");
01018         RNA_def_property_struct_type(prop, "PoseBone");
01019         RNA_def_property_flag(prop, PROP_EDITABLE);
01020         RNA_def_property_ui_text(prop, "Custom Shape Transform", "Bone that defines the display transform of this custom shape");
01021         RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
01022         RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_update");
01023         
01024         /* bone groups */
01025         prop= RNA_def_property(srna, "bone_group_index", PROP_INT, PROP_NONE);
01026         RNA_def_property_int_sdna(prop, NULL, "agrp_index");
01027         RNA_def_property_flag(prop, PROP_EDITABLE);
01028         RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
01029         RNA_def_property_int_funcs(prop, "rna_PoseChannel_bone_group_index_get", "rna_PoseChannel_bone_group_index_set", "rna_PoseChannel_bone_group_index_range");
01030         RNA_def_property_ui_text(prop, "Bone Group Index", "Bone Group this pose channel belongs to (0=no group)");
01031         RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
01032         RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_update");
01033         
01034         prop= RNA_def_property(srna, "bone_group", PROP_POINTER, PROP_NONE);
01035         RNA_def_property_struct_type(prop, "BoneGroup");
01036         RNA_def_property_flag(prop, PROP_EDITABLE);
01037         RNA_def_property_pointer_funcs(prop, "rna_PoseChannel_bone_group_get", "rna_PoseChannel_bone_group_set", NULL, NULL);
01038         RNA_def_property_ui_text(prop, "Bone Group", "Bone Group this pose channel belongs to");
01039         RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
01040         RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_update");
01041         
01042         /* transform locks */
01043         prop= RNA_def_property(srna, "lock_location", PROP_BOOLEAN, PROP_XYZ);
01044         RNA_def_property_boolean_sdna(prop, NULL, "protectflag", OB_LOCK_LOCX);
01045         RNA_def_property_array(prop, 3);
01046         RNA_def_property_ui_text(prop, "Lock Location", "Lock editing of location in the interface");
01047         RNA_def_property_ui_icon(prop, ICON_UNLOCKED, 1);
01048         RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
01049         RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_update");
01050 
01051         prop= RNA_def_property(srna, "lock_rotation", PROP_BOOLEAN, PROP_XYZ);
01052         RNA_def_property_boolean_sdna(prop, NULL, "protectflag", OB_LOCK_ROTX);
01053         RNA_def_property_array(prop, 3);
01054         RNA_def_property_ui_text(prop, "Lock Rotation", "Lock editing of rotation in the interface");
01055         RNA_def_property_ui_icon(prop, ICON_UNLOCKED, 1);
01056         RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
01057         RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_update");
01058         
01059                 // XXX this is sub-optimal - it really should be included above, but due to technical reasons we can't do this!
01060         prop= RNA_def_property(srna, "lock_rotation_w", PROP_BOOLEAN, PROP_NONE);
01061         RNA_def_property_boolean_sdna(prop, NULL, "protectflag", OB_LOCK_ROTW);
01062         RNA_def_property_ui_text(prop, "Lock Rotation (4D Angle)", "Lock editing of 'angle' component of four-component rotations in the interface");
01063         RNA_def_property_ui_icon(prop, ICON_UNLOCKED, 1);
01064         RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
01065         RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_update");
01066 
01067                 // XXX this needs a better name
01068         prop= RNA_def_property(srna, "lock_rotations_4d", PROP_BOOLEAN, PROP_NONE);
01069         RNA_def_property_boolean_sdna(prop, NULL, "protectflag", OB_LOCK_ROT4D);
01070         RNA_def_property_ui_text(prop, "Lock Rotations (4D)", "Lock editing of four component rotations by components (instead of as Eulers)");
01071         RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
01072         RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_update");
01073 
01074         prop= RNA_def_property(srna, "lock_scale", PROP_BOOLEAN, PROP_XYZ);
01075         RNA_def_property_boolean_sdna(prop, NULL, "protectflag", OB_LOCK_SCALEX);
01076         RNA_def_property_array(prop, 3);
01077         RNA_def_property_ui_text(prop, "Lock Scale", "Lock editing of scale in the interface");
01078         RNA_def_property_ui_icon(prop, ICON_UNLOCKED, 1);
01079         RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
01080         RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_update");
01081 
01082         RNA_api_pose_channel(srna);
01083 }
01084 
01085 static void rna_def_pose_itasc(BlenderRNA *brna)
01086 {
01087         static const EnumPropertyItem prop_itasc_mode_items[]= {
01088                 {0, "ANIMATION", 0, "Animation", "Stateless solver computing pose starting from current action and non-IK constraints"},
01089                 {ITASC_SIMULATION, "SIMULATION", 0, "Simulation", "Statefull solver running in real-time context and ignoring actions and non-IK constraints"},
01090                 {0, NULL, 0, NULL, NULL}};
01091         static const EnumPropertyItem prop_itasc_reiteration_items[]= {
01092                 {0, "NEVER", 0, "Never", "The solver does not reiterate, not even on first frame (starts from rest pose)"},
01093                 {ITASC_INITIAL_REITERATION, "INITIAL", 0, "Initial", "The solver reiterates (converges) on the first frame but not on subsequent frame"},
01094                 {ITASC_INITIAL_REITERATION|ITASC_REITERATION, "ALWAYS", 0, "Always", "The solver reiterates (converges) on all frames"},
01095                 {0, NULL, 0, NULL, NULL}};
01096 
01097         StructRNA *srna;
01098         PropertyRNA *prop;
01099 
01100         srna= RNA_def_struct(brna, "Itasc", "IKParam");
01101         RNA_def_struct_sdna(srna, "bItasc");
01102         RNA_def_struct_ui_text(srna, "bItasc", "Parameters for the iTaSC IK solver");
01103 
01104         prop= RNA_def_property(srna, "precision", PROP_FLOAT, PROP_NONE);
01105         RNA_def_property_float_sdna(prop, NULL, "precision");
01106         RNA_def_property_range(prop, 0.0f,0.1f);
01107         RNA_def_property_ui_text(prop, "Precision", "Precision of convergence in case of reiteration");
01108         RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Itasc_update");
01109 
01110         prop= RNA_def_property(srna, "iterations", PROP_INT, PROP_NONE);
01111         RNA_def_property_int_sdna(prop, NULL, "numiter");
01112         RNA_def_property_range(prop, 1.f,1000.f);
01113         RNA_def_property_ui_text(prop, "Iterations", "Maximum number of iterations for convergence in case of reiteration");
01114         RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Itasc_update");
01115 
01116         prop= RNA_def_property(srna, "step_count", PROP_INT, PROP_NONE);
01117         RNA_def_property_int_sdna(prop, NULL, "numstep");
01118         RNA_def_property_range(prop, 1.f, 50.f);
01119         RNA_def_property_ui_text(prop, "Num steps", "Divides the frame interval into this many steps");
01120         RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Itasc_update");
01121 
01122         prop= RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
01123         RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag");
01124         RNA_def_property_enum_items(prop, prop_itasc_mode_items);
01125         RNA_def_property_ui_text(prop, "Mode", NULL);
01126         RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Itasc_update_rebuild");
01127 
01128         prop= RNA_def_property(srna, "reiteration_method", PROP_ENUM, PROP_NONE);
01129         RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag");
01130         RNA_def_property_enum_items(prop, prop_itasc_reiteration_items);
01131         RNA_def_property_ui_text(prop, "Reiteration", "Defines if the solver is allowed to reiterate (converges until precision is met) on none, first or all frames");
01132         RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Itasc_update");
01133 
01134         prop= RNA_def_property(srna, "use_auto_step", PROP_BOOLEAN, PROP_NONE);
01135         RNA_def_property_boolean_sdna(prop, NULL, "flag", ITASC_AUTO_STEP);
01136         RNA_def_property_ui_text(prop, "Auto step", "Automatically determine the optimal number of steps for best performance/accuracy trade off");
01137         RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Itasc_update");
01138 
01139         prop= RNA_def_property(srna, "step_min", PROP_FLOAT, PROP_NONE);
01140         RNA_def_property_float_sdna(prop, NULL, "minstep");
01141         RNA_def_property_range(prop, 0.0f,0.1f);
01142         RNA_def_property_ui_text(prop, "Min step", "Lower bound for timestep in second in case of automatic substeps");
01143         RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Itasc_update");
01144 
01145         prop= RNA_def_property(srna, "step_max", PROP_FLOAT, PROP_NONE);
01146         RNA_def_property_float_sdna(prop, NULL, "maxstep");
01147         RNA_def_property_range(prop, 0.0f,1.0f);
01148         RNA_def_property_ui_text(prop, "Max step", "Higher bound for timestep in second in case of automatic substeps");
01149         RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Itasc_update");
01150 
01151         prop= RNA_def_property(srna, "feedback", PROP_FLOAT, PROP_NONE);
01152         RNA_def_property_float_sdna(prop, NULL, "feedback");
01153         RNA_def_property_range(prop, 0.0f,100.0f);
01154         RNA_def_property_ui_text(prop, "Feedback", "Feedback coefficient for error correction. Average response time=1/feedback. Default=20");
01155         RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Itasc_update");
01156 
01157         prop= RNA_def_property(srna, "velocity_max", PROP_FLOAT, PROP_NONE);
01158         RNA_def_property_float_sdna(prop, NULL, "maxvel");
01159         RNA_def_property_range(prop, 0.0f,100.0f);
01160         RNA_def_property_ui_text(prop, "Max Velocity", "Maximum joint velocity in rad/s. Default=50");
01161         RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Itasc_update");
01162 
01163         prop= RNA_def_property(srna, "solver", PROP_ENUM, PROP_NONE);
01164         RNA_def_property_enum_sdna(prop, NULL, "solver");
01165         RNA_def_property_enum_items(prop, prop_solver_items);
01166         RNA_def_property_ui_text(prop, "Solver", "Solving method selection: Automatic damping or manual damping");
01167         RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Itasc_update_rebuild");
01168 
01169         prop= RNA_def_property(srna, "damping_max", PROP_FLOAT, PROP_NONE);
01170         RNA_def_property_float_sdna(prop, NULL, "dampmax");
01171         RNA_def_property_range(prop, 0.0f,1.0f);
01172         RNA_def_property_ui_text(prop, "Damp", "Maximum damping coefficient when singular value is nearly 0. Higher values=more stability, less reactivity. Default=0.5");
01173         RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Itasc_update");
01174 
01175         prop= RNA_def_property(srna, "damping_epsilon", PROP_FLOAT, PROP_NONE);
01176         RNA_def_property_float_sdna(prop, NULL, "dampeps");
01177         RNA_def_property_range(prop, 0.0f,1.0f);
01178         RNA_def_property_ui_text(prop, "Epsilon", "Singular value under which damping is progressively applied. Higher values=more stability, less reactivity. Default=0.1");
01179         RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Itasc_update");
01180 }
01181 
01182 static void rna_def_pose_ikparam(BlenderRNA *brna)
01183 {
01184         StructRNA *srna;
01185         PropertyRNA *prop;
01186 
01187         srna= RNA_def_struct(brna, "IKParam", NULL);
01188         RNA_def_struct_sdna(srna, "bIKParam");
01189         RNA_def_struct_ui_text(srna, "IKParam", "Base type for IK solver parameters");
01190         RNA_def_struct_refine_func(srna, "rna_IKParam_refine");
01191 
01192         prop= RNA_def_property(srna, "ik_solver", PROP_ENUM, PROP_NONE);
01193         RNA_def_property_enum_sdna(prop, NULL, "iksolver");
01194         RNA_def_property_clear_flag(prop, PROP_EDITABLE);
01195         RNA_def_property_enum_items(prop, prop_iksolver_items);
01196         RNA_def_property_ui_text(prop, "IK Solver", "IK solver for which these parameters are defined, 0 for Legacy, 1 for iTaSC");
01197 }
01198 
01199 /* pose.bone_groups */
01200 static void rna_def_bone_groups(BlenderRNA *brna, PropertyRNA *cprop)
01201 {
01202         StructRNA *srna;
01203         PropertyRNA *prop;
01204 
01205 //      FunctionRNA *func;
01206 //      PropertyRNA *parm;
01207 
01208         RNA_def_property_srna(cprop, "BoneGroups");
01209         srna= RNA_def_struct(brna, "BoneGroups", NULL);
01210         RNA_def_struct_sdna(srna, "bPose");
01211         RNA_def_struct_ui_text(srna, "Bone Groups", "Collection of bone groups");
01212 
01213         prop= RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
01214         RNA_def_property_struct_type(prop, "BoneGroup");
01215         RNA_def_property_flag(prop, PROP_EDITABLE);
01216         RNA_def_property_pointer_funcs(prop, "rna_Pose_active_bone_group_get", "rna_Pose_active_bone_group_set", NULL, NULL);
01217         RNA_def_property_ui_text(prop, "Active Bone Group", "Active bone group for this pose");
01218         RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_update");
01219         
01220         prop= RNA_def_property(srna, "active_index", PROP_INT, PROP_NONE);
01221         RNA_def_property_int_sdna(prop, NULL, "active_group");
01222         RNA_def_property_int_funcs(prop, "rna_Pose_active_bone_group_index_get", "rna_Pose_active_bone_group_index_set", "rna_Pose_active_bone_group_index_range");
01223         RNA_def_property_ui_text(prop, "Active Bone Group Index", "Active index in bone groups array");
01224         RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_update");
01225 }
01226 
01227 static void rna_def_pose(BlenderRNA *brna)
01228 {
01229         StructRNA *srna;
01230         PropertyRNA *prop;
01231         
01232         /* struct definition */
01233         srna= RNA_def_struct(brna, "Pose", NULL);
01234         RNA_def_struct_sdna(srna, "bPose");
01235         RNA_def_struct_ui_text(srna, "Pose", "A collection of pose channels, including settings for animating bones");
01236 
01237         /* pose channels */
01238         prop= RNA_def_property(srna, "bones", PROP_COLLECTION, PROP_NONE);
01239         RNA_def_property_collection_sdna(prop, NULL, "chanbase", NULL);
01240         RNA_def_property_struct_type(prop, "PoseBone");
01241         RNA_def_property_ui_text(prop, "Pose Bones", "Individual pose bones for the armature");
01242         RNA_def_property_collection_funcs(prop, NULL, NULL, NULL, NULL, NULL, NULL, "rna_PoseBones_lookup_string"); /* can be removed, only for fast lookup */
01243         /* bone groups */
01244         prop= RNA_def_property(srna, "bone_groups", PROP_COLLECTION, PROP_NONE);
01245         RNA_def_property_collection_sdna(prop, NULL, "agroups", NULL);
01246         RNA_def_property_struct_type(prop, "BoneGroup");
01247         RNA_def_property_ui_text(prop, "Bone Groups", "Groups of the bones");
01248         rna_def_bone_groups(brna, prop);
01249         
01250         /* ik solvers */
01251         prop= RNA_def_property(srna, "ik_solver", PROP_ENUM, PROP_NONE);
01252         RNA_def_property_enum_sdna(prop, NULL, "iksolver");
01253         RNA_def_property_enum_funcs(prop, NULL, "rna_Pose_ik_solver_set", NULL);
01254         RNA_def_property_enum_items(prop, prop_iksolver_items);
01255         RNA_def_property_ui_text(prop, "IK Solver", "Selection of IK solver for IK chain, current choice is 0 for Legacy, 1 for iTaSC");
01256         RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_ik_solver_update");
01257 
01258         prop= RNA_def_property(srna, "ik_param", PROP_POINTER, PROP_NONE);
01259         RNA_def_property_struct_type(prop, "IKParam");
01260         RNA_def_property_pointer_funcs(prop, "rna_Pose_ikparam_get", NULL, "rna_Pose_ikparam_typef", NULL);
01261         RNA_def_property_clear_flag(prop, PROP_EDITABLE);
01262         RNA_def_property_ui_text(prop, "IK Param", "Parameters for IK solver");
01263         
01264         /* animviz */
01265         rna_def_animviz_common(srna);
01266         
01267         /* RNA_api_pose(srna); */
01268 }
01269 
01270 void RNA_def_pose(BlenderRNA *brna)
01271 {
01272         rna_def_pose(brna);
01273         rna_def_pose_channel(brna);
01274         rna_def_pose_ikparam(brna);
01275         rna_def_pose_itasc(brna);
01276         rna_def_bone_group(brna);
01277 }
01278 
01279 #endif