| 130 | |
| 131 | |
| 132 | void LAppModel::SetupModel(ICubismModelSetting* setting) |
| 133 | { |
| 134 | _updating = true; |
| 135 | _initialized = false; |
| 136 | |
| 137 | _modelSetting = setting; |
| 138 | |
| 139 | csmByte* buffer; |
| 140 | csmSizeInt size; |
| 141 | |
| 142 | //Cubism Model |
| 143 | if (strcmp(_modelSetting->GetModelFileName(), "") != 0) |
| 144 | { |
| 145 | csmString path = _modelSetting->GetModelFileName(); |
| 146 | path = _modelHomeDir + path; |
| 147 | |
| 148 | if (_debugMode)LAppPal::PrintLog("[APP]create model: %s", setting->GetModelFileName()); |
| 149 | |
| 150 | buffer = CreateBuffer(path.GetRawString(), &size); |
| 151 | LoadModel(buffer, size); |
| 152 | DeleteBuffer(buffer, path.GetRawString()); |
| 153 | |
| 154 | } |
| 155 | |
| 156 | //Expression |
| 157 | if (_modelSetting->GetExpressionCount() > 0) |
| 158 | { |
| 159 | const csmInt32 count = _modelSetting->GetExpressionCount(); |
| 160 | for (csmInt32 i = 0; i < count; i++) |
| 161 | { |
| 162 | csmString name = _modelSetting->GetExpressionName(i); |
| 163 | csmString path = _modelSetting->GetExpressionFileName(i); |
| 164 | path = _modelHomeDir + path; |
| 165 | |
| 166 | buffer = CreateBuffer(path.GetRawString(), &size); |
| 167 | ACubismMotion* motion = LoadExpression(buffer, size, name.GetRawString()); |
| 168 | |
| 169 | if (_expressions[name] != NULL) |
| 170 | { |
| 171 | ACubismMotion::Delete(_expressions[name]); |
| 172 | _expressions[name] = NULL; |
| 173 | } |
| 174 | _expressions[name] = motion; |
| 175 | |
| 176 | DeleteBuffer(buffer, path.GetRawString()); |
| 177 | } |
| 178 | } |
| 179 | |
| 180 | //Physics |
| 181 | if (strcmp(_modelSetting->GetPhysicsFileName(), "") != 0) |
| 182 | { |
| 183 | csmString path = _modelSetting->GetPhysicsFileName(); |
| 184 | path = _modelHomeDir + path; |
| 185 | |
| 186 | buffer = CreateBuffer(path.GetRawString(), &size); |
| 187 | LoadPhysics(buffer, size); |
| 188 | DeleteBuffer(buffer, path.GetRawString()); |
| 189 | } |
nothing calls this directly
no test coverage detected