﻿<?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_draw_armature</id>
	<title>利用者:Koilz/2.56 code review draw armature - 版の履歴</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_draw_armature"/>
	<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_draw_armature&amp;action=history"/>
	<updated>2026-07-04T23:58:14Z</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_draw_armature&amp;diff=140547&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_draw_armature&amp;diff=140547&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_draw_armature&amp;diff=140546&amp;oldid=prev</id>
		<title>wiki&gt;Koilz: Created page with &quot;just explaining how it works, as good as i can.  source\blender\editors\space_view3d\drawarmature.c  int draw_armature(Scene *scene, View3D *v3d, ARegion *ar, Base *base, int dt,...&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_draw_armature&amp;diff=140546&amp;oldid=prev"/>
		<updated>2013-02-22T16:37:37Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;just explaining how it works, as good as i can.  source\blender\editors\space_view3d\drawarmature.c  int draw_armature(Scene *scene, View3D *v3d, ARegion *ar, Base *base, int dt,...&amp;quot;&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;
source\blender\editors\space_view3d\drawarmature.c&lt;br /&gt;
 int draw_armature(Scene *scene, View3D *v3d, ARegion *ar, Base *base, int dt, int flag)&lt;br /&gt;
 {&lt;br /&gt;
 	Object *ob= base-&amp;gt;object;&lt;br /&gt;
 	bArmature *arm= ob-&amp;gt;data;&lt;br /&gt;
 	int retval= 0;&lt;br /&gt;
 &lt;br /&gt;
 	/* dont know what this is, guess something todo with if program is rendering */&lt;br /&gt;
 	if(v3d-&amp;gt;flag2 &amp;amp; V3D_RENDER_OVERRIDE)&lt;br /&gt;
 		return 1;&lt;br /&gt;
 &lt;br /&gt;
 	if(dt&amp;gt;OB_WIRE &amp;amp;&amp;amp; arm-&amp;gt;drawtype!=ARM_LINE) {&lt;br /&gt;
 		glColorMaterial(GL_FRONT_AND_BACK, GL_SPECULAR);&lt;br /&gt;
 		glEnable(GL_COLOR_MATERIAL);&lt;br /&gt;
 		glColor3ub(255,0,255);&lt;br /&gt;
 		glDisable(GL_COLOR_MATERIAL);&lt;br /&gt;
 &lt;br /&gt;
 		glColorMaterial(GL_FRONT_AND_BACK, GL_DIFFUSE);&lt;br /&gt;
 		glFrontFace((ob-&amp;gt;transflag&amp;amp;OB_NEG_SCALE)?GL_CW:GL_CCW);&lt;br /&gt;
 	}&lt;br /&gt;
 &lt;br /&gt;
 	if(arm-&amp;gt;edbo) {&lt;br /&gt;
 		arm-&amp;gt;flag |= ARM_EDITMODE;&lt;br /&gt;
 		draw_ebones(v3d, ar, ob, dt);&lt;br /&gt;
 		arm-&amp;gt;flag &amp;amp;= ~ARM_EDITMODE;&lt;br /&gt;
 	}&lt;br /&gt;
 	else{&lt;br /&gt;
 		/* dont know why OB_FROMDUPLI, dont know what G_PICKSEL, dont know what DRAW_SCENESET, + few other things */&lt;br /&gt;
 		if(ob-&amp;gt;pose &amp;amp;&amp;amp; ob-&amp;gt;pose-&amp;gt;chanbase.first) {&lt;br /&gt;
 			if(!(base-&amp;gt;flag &amp;amp; OB_FROMDUPLI)) {&lt;br /&gt;
 				if(G.f &amp;amp; G_PICKSEL) {&lt;br /&gt;
 					if(OBACT &amp;amp;&amp;amp; (OBACT-&amp;gt;mode &amp;amp; OB_MODE_WEIGHT_PAINT)){&lt;br /&gt;
 						if(ob==modifiers_isDeformedByArmature(OBACT))&lt;br /&gt;
 							arm-&amp;gt;flag |= ARM_POSEMODE;&lt;br /&gt;
 					}&lt;br /&gt;
 					else if(ob-&amp;gt;mode &amp;amp; OB_MODE_POSE)&lt;br /&gt;
 						arm-&amp;gt;flag |= ARM_POSEMODE;&lt;br /&gt;
 				}&lt;br /&gt;
 				else if(ob-&amp;gt;mode &amp;amp; OB_MODE_POSE) {&lt;br /&gt;
 					if (arm-&amp;gt;ghosttype == ARM_GHOST_RANGE) {&lt;br /&gt;
 						draw_ghost_poses_range(scene, v3d, ar, base);&lt;br /&gt;
 					}&lt;br /&gt;
 					else if (arm-&amp;gt;ghosttype == ARM_GHOST_KEYS) {&lt;br /&gt;
 						draw_ghost_poses_keys(scene, v3d, ar, base);&lt;br /&gt;
 					}&lt;br /&gt;
 					else if (arm-&amp;gt;ghosttype == ARM_GHOST_CUR) {&lt;br /&gt;
 						if (arm-&amp;gt;ghostep)&lt;br /&gt;
 							draw_ghost_poses(scene, v3d, ar, base);&lt;br /&gt;
 					}&lt;br /&gt;
 					if ((flag &amp;amp; DRAW_SCENESET)==0) {&lt;br /&gt;
 						if(ob==OBACT)&lt;br /&gt;
 							arm-&amp;gt;flag |= ARM_POSEMODE;&lt;br /&gt;
 						else if(OBACT &amp;amp;&amp;amp; (OBACT-&amp;gt;mode &amp;amp; OB_MODE_WEIGHT_PAINT)) {&lt;br /&gt;
 							if(ob==modifiers_isDeformedByArmature(OBACT))&lt;br /&gt;
 								arm-&amp;gt;flag |= ARM_POSEMODE;&lt;br /&gt;
 						}&lt;br /&gt;
 						draw_pose_paths(scene, v3d, ar, ob);&lt;br /&gt;
 					}&lt;br /&gt;
 				}&lt;br /&gt;
 			}&lt;br /&gt;
 &lt;br /&gt;
 			draw_pose_bones(scene, v3d, ar, base, dt, FALSE);&lt;br /&gt;
 			arm-&amp;gt;flag &amp;amp;= ~ARM_POSEMODE;&lt;br /&gt;
 &lt;br /&gt;
 			if(ob-&amp;gt;mode &amp;amp; OB_MODE_POSE)&lt;br /&gt;
 				UI_ThemeColor(TH_WIRE);&lt;br /&gt;
 		}&lt;br /&gt;
 		else retval= 1;&lt;br /&gt;
 	}&lt;br /&gt;
 	glFrontFace(GL_CCW);&lt;br /&gt;
 &lt;br /&gt;
 	return retval;&lt;br /&gt;
 }&lt;br /&gt;
This function draws the armatures in the view 3d window. There is a function that loops through all objects then executed the right functions for the right objects. In this step, the programs looping through the armatures, and theve all got different settings.&lt;br /&gt;
&lt;br /&gt;
This function divides the main problem, which mode should the armature be drawn in, pose, edit, object. It also executes the extra draw functions, ghosting and pose paths.&lt;br /&gt;
 	if(arm-&amp;gt;edbo) {&lt;br /&gt;
This part, its using the arm-&amp;gt;edbo listbase, if there are any editable bones in the armatures list base edbo, it knows its in edit mode so, thats one way of checking.&lt;br /&gt;
 	if(arm-&amp;gt;edbo) {&lt;br /&gt;
 		arm-&amp;gt;flag |= ARM_EDITMODE;&lt;br /&gt;
 		draw_ebones(v3d, ar, ob, dt);&lt;br /&gt;
 		arm-&amp;gt;flag &amp;amp;= ~ARM_EDITMODE;&lt;br /&gt;
 	}&lt;br /&gt;
&lt;br /&gt;
 11010001&lt;br /&gt;
 11010101 OR 00000100 = 11010101&lt;br /&gt;
 11010101 AND 11111011 = 11010001&lt;br /&gt;
The arm-&amp;gt;flag sets the mode you want draw the armature in, here its OR'ing the arm-&amp;gt;flag with ARM_EDITMODE, so if any previous flags, they wont be removed. Then it executes draw_ebones(), then AND's the arm-&amp;gt;flag with ~ARM_EDITMODE which restors it to its previous state.&lt;br /&gt;
 	else{&lt;br /&gt;
This part draws the armature in object or pose mode. draw_pose_bones() draws both types, object mode bones and pose mode bones (custom bones too, i assume). To draw them differently the arm-&amp;gt;flag is used.&lt;br /&gt;
&lt;br /&gt;
Some current blender logic.&lt;br /&gt;
&lt;br /&gt;
An armature can only be in edit mode if it is the active object (selected one).&lt;br /&gt;
&lt;br /&gt;
An armature can only be in pose mode if it is the active object, or if it being used as an armature modifier by another active object.&lt;br /&gt;
&lt;br /&gt;
In any other cases, i think the armature gets drawn in object mode.&lt;br /&gt;
 			if(!(base-&amp;gt;flag &amp;amp; OB_FROMDUPLI)) {&lt;br /&gt;
Code after this part does checks on parts of the program and sets the arm-&amp;gt;flag draw mode to match the blender logic. It also draws the the ghosting an pose paths in the checks.&lt;br /&gt;
 draw_pose_bones(scene, v3d, ar, base, dt, FALSE);&lt;/div&gt;</summary>
		<author><name>wiki&gt;Koilz</name></author>
		
	</entry>
</feed>