| 255 | } |
| 256 | |
| 257 | bool VPathNode::fromString( const String &pString ) |
| 258 | { |
| 259 | // Split Data. |
| 260 | // {Position} {Rotation} {Weight} |
| 261 | const char *baseData = StringUnit::getUnit( pString.c_str(), 0, "\t" ); |
| 262 | |
| 263 | Point3F pos; |
| 264 | AngAxisF aa; |
| 265 | F32 weight; |
| 266 | |
| 267 | // Scan Base. |
| 268 | dSscanf( baseData, "%g %g %g %g %g %g %g %g", &pos.x, &pos.y, &pos.z, |
| 269 | &aa.axis.x, &aa.axis.y, &aa.axis.z, &aa.angle, |
| 270 | &weight ); |
| 271 | |
| 272 | // Apply Changes. |
| 273 | setLocalPosition( pos ); |
| 274 | setLocalRotation( QuatF( aa ) ); |
| 275 | setWeight( weight ); |
| 276 | |
| 277 | // Fetch Orientation Data. |
| 278 | String orientationData = StringUnit::getUnit( pString.c_str(), 1, "\t" ); |
| 279 | |
| 280 | // Fetch Orientation Type. |
| 281 | String orientationTypeString = orientationData; |
| 282 | if ( orientationData.find( " " ) ) |
| 283 | { |
| 284 | // Use First Word. |
| 285 | orientationTypeString = orientationData.substr( 0, orientationData.find( " " ) ); |
| 286 | } |
| 287 | |
| 288 | // Set Orientation Type. |
| 289 | const eOrientationType &orientationType = getOrientationTypeEnum( orientationTypeString.c_str() ); |
| 290 | switch( orientationType ) |
| 291 | { |
| 292 | case k_OrientationFree : |
| 293 | { |
| 294 | // Apply Mode. |
| 295 | setOrientationMode( orientationType ); |
| 296 | |
| 297 | } break; |
| 298 | |
| 299 | case k_OrientationToPoint: |
| 300 | { |
| 301 | // Fetch Point. |
| 302 | Point3F lookAtPoint; |
| 303 | // Buffer String. |
| 304 | dSscanf( orientationData.c_str(), "%*s %f %f %f", &lookAtPoint.x, &lookAtPoint.y, &lookAtPoint.z ); |
| 305 | |
| 306 | // Apply Mode. |
| 307 | setOrientationMode( orientationType, lookAtPoint ); |
| 308 | |
| 309 | } break; |
| 310 | } |
| 311 | |
| 312 | return true; |
| 313 | } |
| 314 | |