﻿<?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=Dev%3ASource%2FConstraints</id>
	<title>Dev:Source/Constraints - 版の履歴</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.blender.jp/index.php?action=history&amp;feed=atom&amp;title=Dev%3ASource%2FConstraints"/>
	<link rel="alternate" type="text/html" href="https://wiki.blender.jp/index.php?title=Dev:Source/Constraints&amp;action=history"/>
	<updated>2026-06-02T03:19:05Z</updated>
	<subtitle>このウィキのこのページに関する変更履歴</subtitle>
	<generator>MediaWiki 1.31.0</generator>
	<entry>
		<id>https://wiki.blender.jp/index.php?title=Dev:Source/Constraints&amp;diff=47028&amp;oldid=prev</id>
		<title>Yamyam: 1版 をインポートしました</title>
		<link rel="alternate" type="text/html" href="https://wiki.blender.jp/index.php?title=Dev:Source/Constraints&amp;diff=47028&amp;oldid=prev"/>
		<updated>2018-06-28T17:47:34Z</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日 (木) 17:47時点における版&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=Dev:Source/Constraints&amp;diff=47027&amp;oldid=prev</id>
		<title>2010年4月3日 (土) 11:19にwiki&gt;Terrywallworkによる</title>
		<link rel="alternate" type="text/html" href="https://wiki.blender.jp/index.php?title=Dev:Source/Constraints&amp;diff=47027&amp;oldid=prev"/>
		<updated>2010-04-03T11:19:59Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;新規ページ&lt;/b&gt;&lt;/p&gt;&lt;div&gt;=Constraints API=&lt;br /&gt;
&lt;br /&gt;
==Purpose==&lt;br /&gt;
&lt;br /&gt;
The Constraints API was started but development stalled out, so this page is intended as a place to work out the details which the users need.&lt;br /&gt;
&lt;br /&gt;
==Overall Details of Constraints==&lt;br /&gt;
&lt;br /&gt;
* The following types of constraints are implemented: Null, Copy Location, Copy Rotation, Copy Size, Track To, Floor, Locked Track, Follow Path, Stretch To, IK Solver, Action&lt;br /&gt;
* Objects and Poses can have constraints&lt;br /&gt;
* Only Poses can have IK Solver and Action constraints&lt;br /&gt;
* Constraints are applied in a particular order&lt;br /&gt;
&lt;br /&gt;
For Armatures, Ton wrote a [http://www.blender.org/cms/How_Armatures_work.634.0.html nice description] of how armatures, poses and actions work together, which also describes constraints.  [http://www.blender.org/cms/Action_and_NLA_editor.706.0.html Another page] describes Actions and NLAs; actions now also work with some non-armature objects.&lt;br /&gt;
&lt;br /&gt;
==BPy Implementation Ideas==&lt;br /&gt;
&lt;br /&gt;
Some of the ideas here are borrowed from the Modifier API (added to the API in version 2.42).  If you aren't familiar with it, see [http://members.iinet.net.au/~cpbarton/ideasman/BPY_API/Modifier-module.html Cam's copy of the page]&lt;br /&gt;
&lt;br /&gt;
===={{literal|BPy_ConstraintSeq}} Type====&lt;br /&gt;
&lt;br /&gt;
Since an object or pose can have more than one constraint, we implement a sequence operator to access/manipulate the constraint stack.  It basically defines&lt;br /&gt;
* a {{literal|PySequenceMethods}} structure for the index operator [],&lt;br /&gt;
* a {{literal|PyMethodDef}} structure for some instance methods, and &lt;br /&gt;
* (optionally) a {{literal|PyGetSetDef}} structure for any general attributes.&lt;br /&gt;
&lt;br /&gt;
===={{literal|BPy_Constraint}} Type====&lt;br /&gt;
&lt;br /&gt;
The Constraint type allows access to the data for a particular constraint.  Since there are many types of constraints, we probably don't want to implement PyTypes for each.  As is done for BPy Objects, a read-only attribute {{literal|type}} is defined for each {{literal|BPy_Constraint}} instance which identifies the type of Constraint and also determines what type of data is wrapped by the BPy object. The type definition contains&lt;br /&gt;
* a {{literal|PyMappingMethods}} structure for the mapping operator [],&lt;br /&gt;
* a {{literal|PyMethodDef}} structure for some instance methods, and &lt;br /&gt;
* a {{literal|PyGetSetDef}} structure for any general attributes&lt;br /&gt;
As is the case for the {{literal|BPy_Modifier}} type, the mapping operator [] is used to access the data particular to the Constraint type.  For example, to access the &amp;quot;Offset&amp;quot; data for a {{literal|Floor}} constraint:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;from Blender import *&lt;br /&gt;
&lt;br /&gt;
ob = Object.Get('Cube')&lt;br /&gt;
if len(ob.constraints) &amp;gt; 0:&lt;br /&gt;
  const = ob.constraints[0]&lt;br /&gt;
  if const.type == Constraint.Type.FLOOR:&lt;br /&gt;
    offs = const[Constraint.Settings.OFFSET]&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Or to print all the constraints attached to each bone in a pose:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;from Blender import *&lt;br /&gt;
&lt;br /&gt;
ob = Object.Get('Armature')&lt;br /&gt;
pose = ob.getPose()&lt;br /&gt;
for bonename in pose.bones.keys():&lt;br /&gt;
  bone = pose.bones[bonename]&lt;br /&gt;
  for const in bone.constraints:&lt;br /&gt;
    print bone.name&lt;br /&gt;
    print '\t',const&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
======Object vs Pose Constriants======&lt;br /&gt;
&lt;br /&gt;
Pose are unique in two ways:&lt;br /&gt;
* they can also have the two constraint types IK Solver and Action&lt;br /&gt;
* internally their data is stored within the object's {{literal|pose}} data instead of the {{literal|constraints}}&lt;br /&gt;
So they can't be referenced the same way; for an object, there is a sequence of constraints, but for a pose there is a sequence (of {{literal|poses}}) of sequence of constraints&lt;br /&gt;
&lt;br /&gt;
[[Category:API's]]&lt;br /&gt;
[[Category:Development]]&lt;br /&gt;
[[Category:Script]]&lt;/div&gt;</summary>
		<author><name>wiki&gt;Terrywallwork</name></author>
		
	</entry>
</feed>