4 * License : The MIT License
\r
5 * Copyright(c) 2010 MikuToga Partners
\r
8 package jp.sourceforge.mikutoga.pmd;
\r
10 import jp.sourceforge.mikutoga.corelib.I18nText;
\r
11 import jp.sourceforge.mikutoga.corelib.SerialNumbered;
\r
16 public class BoneInfo implements SerialNumbered {
\r
18 private final I18nText boneName = new I18nText();
\r
19 private BoneType boneType;
\r
21 private BoneInfo prevBone;
\r
22 private BoneInfo nextBone;
\r
23 private BoneInfo ikBone;
\r
25 private final Pos3d position = new Pos3d();
\r
27 private int rotationRatio;
\r
29 private int serialNo = -1;
\r
43 public I18nText getBoneName(){
\r
44 return this.boneName;
\r
50 * @throws NullPointerException 引数がnull
\r
52 public void setBoneType(BoneType type) throws NullPointerException{
\r
53 if(type == null) throw new NullPointerException();
\r
54 this.boneType = type;
\r
62 public BoneType getBoneType(){
\r
63 return this.boneType;
\r
68 * @param prevBone 前ボーン。ない場合はnullを指定。
\r
70 public void setPrevBone(BoneInfo prevBone){
\r
71 this.prevBone = prevBone;
\r
77 * @return 前ボーン。ない場合はnullを返す。
\r
79 public BoneInfo getPrevBone(){
\r
80 return this.prevBone;
\r
85 * 捩りボーンでは軸方向に位置するボーン、
\r
87 * @param nextBone 次ボーン。ない場合はnullを指定。
\r
89 public void setNextBone(BoneInfo nextBone){
\r
90 this.nextBone = nextBone;
\r
96 * 捩りボーンでは軸方向に位置するボーン、
\r
98 * @return 次ボーン。ない場合はnullを返す。
\r
100 public BoneInfo getNextBone(){
\r
101 return this.nextBone;
\r
105 * このボーンが影響を受けるIKボーンを設定する。
\r
106 * @param ikBoneArg IKボーン。ない場合はnullを指定。
\r
108 public void setIKBone(BoneInfo ikBoneArg){
\r
109 this.ikBone = ikBoneArg;
\r
114 * このボーンが影響を受けるIKボーンを返す。
\r
115 * @return IKボーン。ない場合はnull
\r
117 public BoneInfo getIKBone(){
\r
118 return this.ikBone;
\r
125 public Pos3d getPosition(){
\r
126 return this.position;
\r
134 public int getRotationRatio(){
\r
135 return this.rotationRatio;
\r
141 * @param ratio 回転連動の影響度
\r
143 public void setRotationRatio(int ratio){
\r
144 this.rotationRatio = ratio;
\r
149 * @param num {@inheritDoc}
\r
151 public void setSerialNumber(int num){
\r
152 this.serialNo = num;
\r
158 * @return {@inheritDoc}
\r
160 public int getSerialNumber(){
\r
161 return this.serialNo;
\r
166 * @return {@inheritDoc}
\r
169 public String toString(){
\r
170 StringBuilder result = new StringBuilder();
\r
172 result.append("Bone")
\r
173 .append(this.serialNo)
\r
175 .append(this.boneName.getPrimaryText())
\r
178 result.append(" type=")
\r
179 .append(this.boneType);
\r
181 result.append(" prev=");
\r
182 if(this.prevBone != null) result.append(this.prevBone.getBoneName());
\r
183 else result.append("NONE");
\r
185 result.append(" next=");
\r
186 if(this.nextBone != null) result.append(this.nextBone.getBoneName());
\r
187 else result.append("NONE");
\r
189 if(this.boneType == BoneType.LINKEDROT){
\r
190 result.append(" rotraio=").append(this.rotationRatio);
\r
192 result.append(" ik=");
\r
193 if(this.ikBone != null) result.append(this.ikBone.getBoneName());
\r
194 else result.append("NONE");
\r
197 result.append(" ").append(this.position);
\r
199 return result.toString();
\r