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