Changeset View
Changeset View
Standalone View
Standalone View
source/blender/makesrna/intern/rna_pose_api.c
| Show First 20 Lines • Show All 57 Lines • ▼ Show 20 Lines | static void rna_PoseBone_bbone_segment_matrix(bPoseChannel *pchan, ReportList *reports, float mat_ret[16], int index, bool rest) | ||||
| if (!pchan->bone || pchan->bone->segments <= 1) { | if (!pchan->bone || pchan->bone->segments <= 1) { | ||||
| BKE_reportf(reports, RPT_ERROR, "Bone '%s' is not a B-Bone!", pchan->name); | BKE_reportf(reports, RPT_ERROR, "Bone '%s' is not a B-Bone!", pchan->name); | ||||
| return; | return; | ||||
| } | } | ||||
| if (pchan->runtime.bbone_segments != pchan->bone->segments) { | if (pchan->runtime.bbone_segments != pchan->bone->segments) { | ||||
| BKE_reportf(reports, RPT_ERROR, "Bone '%s' has out of date B-Bone segment data!", pchan->name); | BKE_reportf(reports, RPT_ERROR, "Bone '%s' has out of date B-Bone segment data!", pchan->name); | ||||
| return; | return; | ||||
| } | } | ||||
| if (index < 0 || index >= pchan->runtime.bbone_segments) { | if (index < 0 || index > pchan->runtime.bbone_segments) { | ||||
| BKE_reportf(reports, RPT_ERROR, "Invalid index %d for B-Bone segments of '%s'!", index, pchan->name); | BKE_reportf(reports, RPT_ERROR, "Invalid index %d for B-Bone segments of '%s'!", index, pchan->name); | ||||
| return; | return; | ||||
| } | } | ||||
| if (rest) { | if (rest) { | ||||
| copy_m4_m4((float (*)[4])mat_ret, pchan->runtime.bbone_rest_mats[index].mat); | copy_m4_m4((float (*)[4])mat_ret, pchan->runtime.bbone_rest_mats[index].mat); | ||||
| } | } | ||||
| else { | else { | ||||
| Show All 35 Lines | parm = RNA_def_float_vector_xyz(func, "point", 3, NULL, -FLT_MAX, FLT_MAX, "Point", | ||||
| "Position in 3d space to evaluate", -FLT_MAX, FLT_MAX); | "Position in 3d space to evaluate", -FLT_MAX, FLT_MAX); | ||||
| RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); | RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); | ||||
| /* return value */ | /* return value */ | ||||
| parm = RNA_def_float(func, "factor", 0, -FLT_MAX, FLT_MAX, "Factor", "Envelope factor", -FLT_MAX, FLT_MAX); | parm = RNA_def_float(func, "factor", 0, -FLT_MAX, FLT_MAX, "Factor", "Envelope factor", -FLT_MAX, FLT_MAX); | ||||
| RNA_def_function_return(func, parm); | RNA_def_function_return(func, parm); | ||||
| /* B-Bone segment matrices */ | /* B-Bone segment matrices */ | ||||
| func = RNA_def_function(srna, "bbone_segment_matrix", "rna_PoseBone_bbone_segment_matrix"); | func = RNA_def_function(srna, "bbone_segment_matrix", "rna_PoseBone_bbone_segment_matrix"); | ||||
| RNA_def_function_ui_description(func, "Retrieve the matrix of the B-Bone segment if available"); | RNA_def_function_ui_description(func, "Retrieve the matrix of the joint between B-Bone segments if available"); | ||||
| RNA_def_function_flag(func, FUNC_USE_REPORTS); | RNA_def_function_flag(func, FUNC_USE_REPORTS); | ||||
| parm = RNA_def_property(func, "matrix_return", PROP_FLOAT, PROP_MATRIX); | parm = RNA_def_property(func, "matrix_return", PROP_FLOAT, PROP_MATRIX); | ||||
| RNA_def_property_multi_array(parm, 2, rna_matrix_dimsize_4x4); | RNA_def_property_multi_array(parm, 2, rna_matrix_dimsize_4x4); | ||||
| RNA_def_property_ui_text(parm, "", "The resulting matrix in bone local space"); | RNA_def_property_ui_text(parm, "", "The resulting matrix in bone local space"); | ||||
| RNA_def_function_output(func, parm); | RNA_def_function_output(func, parm); | ||||
| parm = RNA_def_int(func, "index", 0, 0, INT_MAX, "", "Index of the segment", 0, 10000); | parm = RNA_def_int(func, "index", 0, 0, INT_MAX, "", "Index of the segment endpoint", 0, 10000); | ||||
| RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); | RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); | ||||
| parm = RNA_def_boolean(func, "rest", false, "", "Return the rest pose matrix"); | parm = RNA_def_boolean(func, "rest", false, "", "Return the rest pose matrix"); | ||||
| /* B-Bone custom handle positions */ | /* B-Bone custom handle positions */ | ||||
| func = RNA_def_function(srna, "compute_bbone_handles", "rna_PoseBone_compute_bbone_handles"); | func = RNA_def_function(srna, "compute_bbone_handles", "rna_PoseBone_compute_bbone_handles"); | ||||
| RNA_def_function_ui_description(func, "Retrieve the vectors and rolls coming from B-Bone custom handles"); | RNA_def_function_ui_description(func, "Retrieve the vectors and rolls coming from B-Bone custom handles"); | ||||
| RNA_def_function_flag(func, FUNC_USE_REPORTS); | RNA_def_function_flag(func, FUNC_USE_REPORTS); | ||||
| parm = RNA_def_property(func, "handle1", PROP_FLOAT, PROP_XYZ); | parm = RNA_def_property(func, "handle1", PROP_FLOAT, PROP_XYZ); | ||||
| Show All 18 Lines | |||||