Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2009-11-24 02:03:04 +0300
committerCampbell Barton <ideasman42@gmail.com>2009-11-24 02:03:04 +0300
commitb7d717cead9000c4600d71ed15fc10ebc103c591 (patch)
treef59e5c37b13a57b16b279d1f08786405896f448b /source/blender/blenkernel/intern/action.c
parent9702ea753773664e4b322b14ae507944734ee31d (diff)
added a function to duplicate bPoseChannel's internal data - constraints, id-props etc.
duplicate_pose_channel_data(), the code to do this was inline in editarmature.c duplicating editbones now duplicates posebone id-props also removed an if test for &channew->constraints since it will always be true.
Diffstat (limited to 'source/blender/blenkernel/intern/action.c')
-rw-r--r--source/blender/blenkernel/intern/action.c42
1 files changed, 42 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/action.c b/source/blender/blenkernel/intern/action.c
index af3c4719e32..8fe80edabb9 100644
--- a/source/blender/blenkernel/intern/action.c
+++ b/source/blender/blenkernel/intern/action.c
@@ -640,6 +640,48 @@ static void copy_pose_channel_data(bPoseChannel *pchan, const bPoseChannel *chan
}
}
+/* makes copies of internal data, unlike copy_pose_channel_data which only
+ * copies the pose state.
+ * hint: use when copying bones in editmode (on returned value from verify_pose_channel) */
+void duplicate_pose_channel_data(bPoseChannel *pchan, const bPoseChannel *pchan_from)
+{
+ /* copy transform locks */
+ pchan->protectflag = pchan_from->protectflag;
+
+ /* copy rotation mode */
+ pchan->rotmode = pchan_from->rotmode;
+
+ /* copy bone group */
+ pchan->agrp_index= pchan_from->agrp_index;
+
+ /* ik (dof) settings */
+ pchan->ikflag = pchan_from->ikflag;
+ VECCOPY(pchan->limitmin, pchan_from->limitmin);
+ VECCOPY(pchan->limitmax, pchan_from->limitmax);
+ VECCOPY(pchan->stiffness, pchan_from->stiffness);
+ pchan->ikstretch= pchan_from->ikstretch;
+ pchan->ikrotweight= pchan_from->ikrotweight;
+ pchan->iklinweight= pchan_from->iklinweight;
+
+ /* constraints */
+ copy_constraints(&pchan->constraints, &pchan_from->constraints);
+
+ /* id-properties */
+ if(pchan->prop) {
+ /* unlikely but possible it exists */
+ IDP_FreeProperty(pchan->prop);
+ MEM_freeN(pchan->prop);
+ pchan->prop= NULL;
+ }
+ if(pchan_from->prop) {
+ pchan->prop= IDP_CopyProperty(pchan_from->prop);
+ }
+
+ /* custom shape */
+ pchan->custom= pchan_from->custom;
+}
+
+
/* checks for IK constraint, Spline IK, and also for Follow-Path constraint.
* can do more constraints flags later
*/