﻿<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ja">
	<id>https://wiki.blender.jp/index.php?action=history&amp;feed=atom&amp;title=%E5%88%A9%E7%94%A8%E8%80%85%3AKoilz%2F2.56_code_review_armature_modiier</id>
	<title>利用者:Koilz/2.56 code review armature modiier - 版の履歴</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.blender.jp/index.php?action=history&amp;feed=atom&amp;title=%E5%88%A9%E7%94%A8%E8%80%85%3AKoilz%2F2.56_code_review_armature_modiier"/>
	<link rel="alternate" type="text/html" href="https://wiki.blender.jp/index.php?title=%E5%88%A9%E7%94%A8%E8%80%85:Koilz/2.56_code_review_armature_modiier&amp;action=history"/>
	<updated>2026-09-03T18:51:02Z</updated>
	<subtitle>このウィキのこのページに関する変更履歴</subtitle>
	<generator>MediaWiki 1.31.0</generator>
	<entry>
		<id>https://wiki.blender.jp/index.php?title=%E5%88%A9%E7%94%A8%E8%80%85:Koilz/2.56_code_review_armature_modiier&amp;diff=140545&amp;oldid=prev</id>
		<title>Yamyam: 1版 をインポートしました</title>
		<link rel="alternate" type="text/html" href="https://wiki.blender.jp/index.php?title=%E5%88%A9%E7%94%A8%E8%80%85:Koilz/2.56_code_review_armature_modiier&amp;diff=140545&amp;oldid=prev"/>
		<updated>2018-06-28T20:53:20Z</updated>

		<summary type="html">&lt;p&gt;1版 をインポートしました&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;ja&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;← 古い版&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;2018年6月28日 (木) 20:53時点における版&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-notice&quot; lang=&quot;ja&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(相違点なし)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>Yamyam</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.blender.jp/index.php?title=%E5%88%A9%E7%94%A8%E8%80%85:Koilz/2.56_code_review_armature_modiier&amp;diff=140544&amp;oldid=prev</id>
		<title>wiki&gt;Koilz: Created page with &quot;just explaining how it works, as good as i can.    \source\blender\modifiers\intern\MOD_armature.c  ModifierTypeInfo modifierType_Armature = {  	/* name */              &quot;Armature...&quot;</title>
		<link rel="alternate" type="text/html" href="https://wiki.blender.jp/index.php?title=%E5%88%A9%E7%94%A8%E8%80%85:Koilz/2.56_code_review_armature_modiier&amp;diff=140544&amp;oldid=prev"/>
		<updated>2013-02-22T16:36:23Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;just explaining how it works, as good as i can.    \source\blender\modifiers\intern\MOD_armature.c  ModifierTypeInfo modifierType_Armature = {  	‎&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;name: &lt;/span&gt;              &amp;quot;Armature...&amp;quot;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;新規ページ&lt;/b&gt;&lt;/p&gt;&lt;div&gt;just explaining how it works, as good as i can. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
\source\blender\modifiers\intern\MOD_armature.c&lt;br /&gt;
 ModifierTypeInfo modifierType_Armature = {&lt;br /&gt;
 	/* name */              &amp;quot;Armature&amp;quot;,&lt;br /&gt;
 	/* structName */        &amp;quot;ArmatureModifierData&amp;quot;,&lt;br /&gt;
 	/* structSize */        sizeof(ArmatureModifierData),&lt;br /&gt;
 	/* type */              eModifierTypeType_OnlyDeform,&lt;br /&gt;
 	/* flags */             eModifierTypeFlag_AcceptsCVs&lt;br /&gt;
 							| eModifierTypeFlag_SupportsEditmode,&lt;br /&gt;
 &lt;br /&gt;
 	/* copyData */          copyData,                   // copy data&lt;br /&gt;
 	/* deformVerts */       deformVerts,                // deform vertices pose object mode&lt;br /&gt;
 	/* deformMatrices */    deformMatrices,             // deform matrices pose object mode&lt;br /&gt;
 	/* deformVertsEM */     deformVertsEM,              // deform vertices edit mode&lt;br /&gt;
 	/* deformMatricesEM */  deformMatricesEM,           // deform matrices edit mode&lt;br /&gt;
 	/* applyModifier */     NULL,&lt;br /&gt;
 	/* applyModifierEM */   NULL,&lt;br /&gt;
 	/* initData */          initData,                   // init code&lt;br /&gt;
 	/* requiredDataMask */  requiredDataMask,&lt;br /&gt;
 	/* freeData */          NULL,&lt;br /&gt;
 	/* isDisabled */        isDisabled,&lt;br /&gt;
 	/* updateDepgraph */    updateDepgraph,&lt;br /&gt;
 	/* dependsOnTime */     NULL,&lt;br /&gt;
 	/* dependsOnNormals */	NULL,&lt;br /&gt;
 	/* foreachObjectLink */ foreachObjectLink,&lt;br /&gt;
 	/* foreachIDLink */     NULL,&lt;br /&gt;
 };&lt;br /&gt;
This is the struct that sets the modifier, the main functions to carry out the process in MOD_armature.c are:&lt;br /&gt;
 deformVerts,                // deform vertices pose object mode&lt;br /&gt;
 deformMatrices,             // deform matrices pose object mode&lt;br /&gt;
 deformVertsEM,              // deform vertices edit mode&lt;br /&gt;
 deformMatricesEM,           // deform matrices edit mode&lt;br /&gt;
These functions work pritty much the same, then they all execute &amp;quot;armature_deform_verts()&amp;quot; in source\blender\blenkernel\intern\armature.c&lt;br /&gt;
&lt;br /&gt;
Most the code for the modifier is written in armature.c and some more armature code that other modifiers and other parts of blender use.&lt;br /&gt;
&lt;br /&gt;
More about &amp;quot;armature_deform_verts()&amp;quot; later, first the &amp;quot;pose solver&amp;quot; &amp;quot;pchan_to_mat4()&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
\source\blender\blenkernel\intern\armature.c&lt;br /&gt;
 /* ********************** THE POSE SOLVER ******************* */&lt;br /&gt;
 /* loc/rot/size to given mat4 */&lt;br /&gt;
 void pchan_to_mat4(bPoseChannel *pchan, float chan_mat[4][4])&lt;br /&gt;
 {&lt;br /&gt;
 	..&lt;br /&gt;
 }&lt;br /&gt;
This function takes the pose bone rotation (dependant on mode) and scale, it converts them into matrices, then it converts both of them into a final matrice &amp;quot;chan_mat[4][4]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;quot;chan_mat&amp;quot; channel matrice, is used later as a deformation matrice to deform mesh verts. Its later accessed via the pose bone, pchan-&amp;gt;chan_mat.&lt;br /&gt;
&lt;br /&gt;
Allot of cool pose bone data is in the bPoseChannel struct in \source\blender\makesdna\DNA_action_types.h&lt;br /&gt;
&lt;br /&gt;
Back to the &amp;quot;armature_deform_verts()&amp;quot; function, this function is a bit complex due to many features.&lt;br /&gt;
&lt;br /&gt;
In blender, say you setup an armature with 2 bones that deforms a mesh with 3 verts.&lt;br /&gt;
&lt;br /&gt;
This is the process, how the armature modifier deforms the verts.&lt;br /&gt;
 Loop verts&lt;br /&gt;
 	Loop bones/vertex_groups connected to the vert&lt;br /&gt;
 		execute pchan_bone_deform();&lt;br /&gt;
&lt;br /&gt;
 vert[0]&lt;br /&gt;
 	bone[0]	pchan_bone_deform();&lt;br /&gt;
 vert[1]&lt;br /&gt;
 	bone[0]	pchan_bone_deform();&lt;br /&gt;
 	bone[1]	pchan_bone_deform();&lt;br /&gt;
 vert[2]&lt;br /&gt;
 	bone[1]	pchan_bone_deform();&lt;br /&gt;
Thats how it works in a basic form, of course the code is more complicated.&lt;br /&gt;
&lt;br /&gt;
pchan_bone_deform() deforms the verts based on bone data, first it multiplys a copy of the mesh vert &amp;quot;cop[3]&amp;quot; by the pose matrice &amp;quot;chan_mat[4][4]&amp;quot;.&lt;br /&gt;
 mul_m4_v3(pchan-&amp;gt;chan_mat, cop);&lt;br /&gt;
Then it adds the deformed vert position onto the original vert position by the weight of the bone.&lt;br /&gt;
 vec[0]+=(cop[0]-co[0])*weight;&lt;br /&gt;
 vec[1]+=(cop[1]-co[1])*weight;&lt;br /&gt;
 vec[2]+=(cop[2]-co[2])*weight;&lt;br /&gt;
Vert origins in this instance &amp;quot;cop&amp;quot; and &amp;quot;co&amp;quot; (the zero position) are from the armatures objects origin.&lt;br /&gt;
&lt;br /&gt;
The armature modifier has alot more processess dependant on different setting you can use (envelopes, preserve volume, multi modifier).&lt;/div&gt;</summary>
		<author><name>wiki&gt;Koilz</name></author>
		
	</entry>
</feed>