4 * License : The MIT License
5 * Copyright(c) 2010 MikuToga Partners
8 package jp.sourceforge.mikutoga.pmd;
10 import jp.sourceforge.mikutoga.corelib.I18nText;
11 import jp.sourceforge.mikutoga.corelib.SerialNumbered;
16 public class BoneInfo implements SerialNumbered {
18 private final I18nText boneName = new I18nText();
19 private BoneType boneType;
21 private BoneInfo prevBone;
22 private BoneInfo nextBone;
23 private BoneInfo ikBone;
25 private final Pos3d position = new Pos3d();
27 private int rotationRatio;
29 private int serialNo = -1;
43 public I18nText getBoneName(){
50 * @throws NullPointerException 引数がnull
52 public void setBoneType(BoneType type) throws NullPointerException{
53 if(type == null) throw new NullPointerException();
62 public BoneType getBoneType(){
68 * @param prevBone 前ボーン。ない場合はnullを指定。
70 public void setPrevBone(BoneInfo prevBone){
71 this.prevBone = prevBone;
77 * @return 前ボーン。ない場合はnullを返す。
79 public BoneInfo getPrevBone(){
87 * @param nextBone 次ボーン。ない場合はnullを指定。
89 public void setNextBone(BoneInfo nextBone){
90 this.nextBone = nextBone;
98 * @return 次ボーン。ない場合はnullを返す。
100 public BoneInfo getNextBone(){
101 return this.nextBone;
105 * このボーンが影響を受けるIKボーンを設定する。
106 * @param ikBoneArg IKボーン。ない場合はnullを指定。
108 public void setIKBone(BoneInfo ikBoneArg){
109 this.ikBone = ikBoneArg;
114 * このボーンが影響を受けるIKボーンを返す。
115 * @return IKボーン。ない場合はnull
117 public BoneInfo getIKBone(){
125 public Pos3d getPosition(){
126 return this.position;
134 public int getRotationRatio(){
135 return this.rotationRatio;
141 * @param ratio 回転連動の影響度
143 public void setRotationRatio(int ratio){
144 this.rotationRatio = ratio;
149 * @param num {@inheritDoc}
152 public void setSerialNumber(int num){
159 * @return {@inheritDoc}
162 public int getSerialNumber(){
163 return this.serialNo;
168 * @return {@inheritDoc}
171 public String toString(){
172 StringBuilder result = new StringBuilder();
174 result.append("Bone")
175 .append(this.serialNo)
177 .append(this.boneName.getPrimaryText())
180 result.append(" type=")
181 .append(this.boneType);
183 result.append(" prev=");
184 if(this.prevBone != null) result.append(this.prevBone.getBoneName());
185 else result.append("NONE");
187 result.append(" next=");
188 if(this.nextBone != null) result.append(this.nextBone.getBoneName());
189 else result.append("NONE");
191 if(this.boneType == BoneType.LINKEDROT){
192 result.append(" rotraio=").append(this.rotationRatio);
194 result.append(" ik=");
195 if(this.ikBone != null) result.append(this.ikBone.getBoneName());
196 else result.append("NONE");
199 result.append(" ").append(this.position);
201 return result.toString();