2 * boolean information builder
4 * License : The MIT License
5 * Copyright(c) 2013 MikuToga Partners
8 package jp.sfjp.mikutoga.vmd.model.binio;
10 import java.util.List;
11 import jp.sfjp.mikutoga.bin.parser.MmdFormatException;
12 import jp.sfjp.mikutoga.bin.parser.ParseStage;
13 import jp.sfjp.mikutoga.vmd.model.IkSwitch;
14 import jp.sfjp.mikutoga.vmd.model.NumberedVmdFlag;
15 import jp.sfjp.mikutoga.vmd.model.VmdMotion;
16 import jp.sfjp.mikutoga.vmd.parser.VmdBoolHandler;
20 * <p>MikuMikuDance Ver7.40以降でサポート
22 class BoolLoader implements VmdBoolHandler{
24 private final List<NumberedVmdFlag> flagList;
26 private NumberedVmdFlag currentFlag = null;
27 private IkSwitch currentSwitch = null;
31 * @param vmdMotion モーションデータの格納先。
33 BoolLoader(VmdMotion vmdMotion){
35 this.flagList = vmdMotion.getNumberedFlagList();
42 * @param stage {@inheritDoc}
43 * @param loops {@inheritDoc}
44 * @throws MmdFormatException {@inheritDoc}
47 public void loopStart(ParseStage stage, int loops)
48 throws MmdFormatException{
49 if(stage == VmdBoolHandler.MODELSIGHT_LIST){
50 this.currentFlag = new NumberedVmdFlag();
51 }else if(stage == VmdBoolHandler.IKSW_LIST){
52 this.currentSwitch = new IkSwitch();
60 * @param stage {@inheritDoc}
61 * @throws MmdFormatException {@inheritDoc}
64 public void loopNext(ParseStage stage)
65 throws MmdFormatException{
66 if(stage == VmdBoolHandler.MODELSIGHT_LIST){
67 this.flagList.add(this.currentFlag);
68 this.currentFlag = new NumberedVmdFlag();
69 }else if(stage == VmdBoolHandler.IKSW_LIST){
70 List<IkSwitch> swList = this.currentFlag.getIkSwitchList();
71 swList.add(this.currentSwitch);
72 this.currentSwitch = new IkSwitch();
80 * @param stage {@inheritDoc}
81 * @throws MmdFormatException {@inheritDoc}
84 public void loopEnd(ParseStage stage)
85 throws MmdFormatException{
86 if(stage == VmdBoolHandler.MODELSIGHT_LIST){
87 this.currentFlag = null;
88 }else if(stage == VmdBoolHandler.IKSW_LIST){
89 this.currentSwitch = null;
97 * @param show {@inheritDoc}
98 * @param keyFrameNo {@inheritDoc}
99 * @throws MmdFormatException {@inheritDoc}
102 public void vmdModelSight(boolean show, int keyFrameNo)
103 throws MmdFormatException {
104 this.currentFlag.setModelShown(show);
105 this.currentFlag.setFrameNumber(keyFrameNo);
111 * @param boneName {@inheritDoc}
112 * @param validIk {@inheritDoc}
113 * @param keyFrameNo {@inheritDoc}
114 * @throws MmdFormatException {@inheritDoc}
117 public void vmdIkSwitch(String boneName,
120 throws MmdFormatException {
121 this.currentSwitch.setBoneName(boneName);
122 this.currentSwitch.setValid(validIk);