OLD | NEW |
1 //-***************************************************************************** | 1 //-***************************************************************************** |
2 // | 2 // |
3 // Copyright (c) 2009-2010, | 3 // Copyright (c) 2009-2010, |
4 // Sony Pictures Imageworks, Inc. and | 4 // Sony Pictures Imageworks, Inc. and |
5 // Industrial Light & Magic, a division of Lucasfilm Entertainment Company Ltd. | 5 // Industrial Light & Magic, a division of Lucasfilm Entertainment Company Ltd. |
6 // | 6 // |
7 // All rights reserved. | 7 // All rights reserved. |
8 // | 8 // |
9 // Redistribution and use in source and binary forms, with or without | 9 // Redistribution and use in source and binary forms, with or without |
10 // modification, are permitted provided that the following conditions are | 10 // modification, are permitted provided that the following conditions are |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 } | 70 } |
71 | 71 |
72 if ( ! m_hasBeenRead ) | 72 if ( ! m_hasBeenRead ) |
73 { | 73 { |
74 ABCA_ASSERT( m_setWithOpStack == 0 || m_setWithOpStack == 1, | 74 ABCA_ASSERT( m_setWithOpStack == 0 || m_setWithOpStack == 1, |
75 "Cannot mix addOp() and set<Foo>() methods." ); | 75 "Cannot mix addOp() and set<Foo>() methods." ); |
76 | 76 |
77 m_setWithOpStack = 1; | 77 m_setWithOpStack = 1; |
78 | 78 |
79 m_ops.push_back( iOp ); | 79 m_ops.push_back( iOp ); |
80 m_opsArray.push_back( iOp.getOpEncoding() ); | |
81 | 80 |
82 return m_ops.size() - 1; | 81 return m_ops.size() - 1; |
83 } | 82 } |
84 else | 83 else |
85 { | 84 { |
86 std::size_t ret = m_opIndex; | 85 std::size_t ret = m_opIndex; |
87 | 86 |
88 ABCA_ASSERT( m_setWithOpStack == 1, | 87 ABCA_ASSERT( m_setWithOpStack == 1, |
89 "Cannot mix addOp() and set<Foo>() methods." ); | 88 "Cannot mix addOp() and set<Foo>() methods." ); |
90 | 89 |
(...skipping 20 matching lines...) Expand all Loading... |
111 iOp.setChannelValue( 3, iAngleInDegrees ); | 110 iOp.setChannelValue( 3, iAngleInDegrees ); |
112 | 111 |
113 if ( ! m_hasBeenRead ) | 112 if ( ! m_hasBeenRead ) |
114 { | 113 { |
115 ABCA_ASSERT( m_setWithOpStack == 0 || m_setWithOpStack == 1, | 114 ABCA_ASSERT( m_setWithOpStack == 0 || m_setWithOpStack == 1, |
116 "Cannot mix addOp() and set<Foo>() methods." ); | 115 "Cannot mix addOp() and set<Foo>() methods." ); |
117 | 116 |
118 m_setWithOpStack = 1; | 117 m_setWithOpStack = 1; |
119 | 118 |
120 m_ops.push_back( iOp ); | 119 m_ops.push_back( iOp ); |
121 m_opsArray.push_back( iOp.getOpEncoding() ); | |
122 | 120 |
123 return m_ops.size() - 1; | 121 return m_ops.size() - 1; |
124 } | 122 } |
125 else | 123 else |
126 { | 124 { |
127 std::size_t ret = m_opIndex; | 125 std::size_t ret = m_opIndex; |
128 | 126 |
129 ABCA_ASSERT( iOp.getType() == m_ops[ret].getType(), | 127 ABCA_ASSERT( iOp.getType() == m_ops[ret].getType(), |
130 "Cannot update mismatched op-type in already-setted " | 128 "Cannot update mismatched op-type in already-setted " |
131 << "XformSample!" ); | 129 << "XformSample!" ); |
(...skipping 16 matching lines...) Expand all Loading... |
148 iOp.setChannelValue( 0, iSingleAxisRotationInDegrees ); | 146 iOp.setChannelValue( 0, iSingleAxisRotationInDegrees ); |
149 | 147 |
150 if ( ! m_hasBeenRead ) | 148 if ( ! m_hasBeenRead ) |
151 { | 149 { |
152 ABCA_ASSERT( m_setWithOpStack == 0 || m_setWithOpStack == 1, | 150 ABCA_ASSERT( m_setWithOpStack == 0 || m_setWithOpStack == 1, |
153 "Cannot mix addOp() and set<Foo>() methods." ); | 151 "Cannot mix addOp() and set<Foo>() methods." ); |
154 | 152 |
155 m_setWithOpStack = 1; | 153 m_setWithOpStack = 1; |
156 | 154 |
157 m_ops.push_back( iOp ); | 155 m_ops.push_back( iOp ); |
158 m_opsArray.push_back( iOp.getOpEncoding() ); | |
159 | 156 |
160 return m_ops.size() - 1; | 157 return m_ops.size() - 1; |
161 } | 158 } |
162 else | 159 else |
163 { | 160 { |
164 std::size_t ret = m_opIndex; | 161 std::size_t ret = m_opIndex; |
165 | 162 |
166 ABCA_ASSERT( iOp.getType() == m_ops[ret].getType(), | 163 ABCA_ASSERT( iOp.getType() == m_ops[ret].getType(), |
167 "Cannot update mismatched op-type in already-setted " | 164 "Cannot update mismatched op-type in already-setted " |
168 << "XformSample!" ); | 165 << "XformSample!" ); |
(...skipping 20 matching lines...) Expand all Loading... |
189 } | 186 } |
190 | 187 |
191 if ( ! m_hasBeenRead ) | 188 if ( ! m_hasBeenRead ) |
192 { | 189 { |
193 ABCA_ASSERT( m_setWithOpStack == 0 || m_setWithOpStack == 1, | 190 ABCA_ASSERT( m_setWithOpStack == 0 || m_setWithOpStack == 1, |
194 "Cannot mix addOp() and set<Foo>() methods." ); | 191 "Cannot mix addOp() and set<Foo>() methods." ); |
195 | 192 |
196 m_setWithOpStack = 1; | 193 m_setWithOpStack = 1; |
197 | 194 |
198 m_ops.push_back( iOp ); | 195 m_ops.push_back( iOp ); |
199 m_opsArray.push_back( iOp.getOpEncoding() ); | |
200 | 196 |
201 return m_ops.size() - 1; | 197 return m_ops.size() - 1; |
202 } | 198 } |
203 else | 199 else |
204 { | 200 { |
205 std::size_t ret = m_opIndex; | 201 std::size_t ret = m_opIndex; |
206 | 202 |
207 ABCA_ASSERT( iOp.getType() == m_ops[ret].getType(), | 203 ABCA_ASSERT( iOp.getType() == m_ops[ret].getType(), |
208 "Cannot update mismatched op-type in already-setted " | 204 "Cannot update mismatched op-type in already-setted " |
209 << "XformSample!" ); | 205 << "XformSample!" ); |
(...skipping 12 matching lines...) Expand all Loading... |
222 std::size_t XformSample::addOp( const XformOp &iOp ) | 218 std::size_t XformSample::addOp( const XformOp &iOp ) |
223 { | 219 { |
224 if ( ! m_hasBeenRead ) | 220 if ( ! m_hasBeenRead ) |
225 { | 221 { |
226 ABCA_ASSERT( m_setWithOpStack == 0 || m_setWithOpStack == 1, | 222 ABCA_ASSERT( m_setWithOpStack == 0 || m_setWithOpStack == 1, |
227 "Cannot mix addOp() and set<Foo>() methods." ); | 223 "Cannot mix addOp() and set<Foo>() methods." ); |
228 | 224 |
229 m_setWithOpStack = 1; | 225 m_setWithOpStack = 1; |
230 | 226 |
231 m_ops.push_back( iOp ); | 227 m_ops.push_back( iOp ); |
232 m_opsArray.push_back( iOp.getOpEncoding() ); | |
233 | 228 |
234 return m_ops.size() - 1; | 229 return m_ops.size() - 1; |
235 } | 230 } |
236 else | 231 else |
237 { | 232 { |
238 std::size_t ret = m_opIndex; | 233 std::size_t ret = m_opIndex; |
239 | 234 |
240 ABCA_ASSERT( iOp.getType() == m_ops[ret].getType(), | 235 ABCA_ASSERT( iOp.getType() == m_ops[ret].getType(), |
241 "Cannot update mismatched op-type in already-setted " | 236 "Cannot update mismatched op-type in already-setted " |
242 << "XformSample!" ); | 237 << "XformSample!" ); |
(...skipping 20 matching lines...) Expand all Loading... |
263 return m_ops[iIndex]; | 258 return m_ops[iIndex]; |
264 } | 259 } |
265 | 260 |
266 //-***************************************************************************** | 261 //-***************************************************************************** |
267 const XformOp &XformSample::operator[]( const std::size_t &iIndex ) const | 262 const XformOp &XformSample::operator[]( const std::size_t &iIndex ) const |
268 { | 263 { |
269 return m_ops[iIndex]; | 264 return m_ops[iIndex]; |
270 } | 265 } |
271 | 266 |
272 //-***************************************************************************** | 267 //-***************************************************************************** |
273 const std::vector<Alembic::Util::uint8_t> &XformSample::getOpsArray() const | |
274 { | |
275 return m_opsArray; | |
276 } | |
277 | |
278 //-***************************************************************************** | |
279 std::size_t XformSample::getNumOps() const | 268 std::size_t XformSample::getNumOps() const |
280 { | 269 { |
281 return m_opsArray.size(); | 270 return m_ops.size(); |
282 } | 271 } |
283 | 272 |
284 //-***************************************************************************** | 273 //-***************************************************************************** |
285 std::size_t XformSample::getNumOpChannels() const | 274 std::size_t XformSample::getNumOpChannels() const |
286 { | 275 { |
287 std::size_t ret = 0; | 276 std::size_t ret = 0; |
288 for ( size_t i = 0 ; i < m_ops.size() ; ++i ) | 277 for ( size_t i = 0 ; i < m_ops.size() ; ++i ) |
289 { | 278 { |
290 ret += m_ops[i].getNumChannels(); | 279 ret += m_ops[i].getNumChannels(); |
291 } | 280 } |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
328 } | 317 } |
329 | 318 |
330 if ( ! m_hasBeenRead ) | 319 if ( ! m_hasBeenRead ) |
331 { | 320 { |
332 ABCA_ASSERT( m_setWithOpStack == 0 || m_setWithOpStack == 2, | 321 ABCA_ASSERT( m_setWithOpStack == 0 || m_setWithOpStack == 2, |
333 "Cannot mix addOp() and set<Foo>() methods." ); | 322 "Cannot mix addOp() and set<Foo>() methods." ); |
334 | 323 |
335 m_setWithOpStack = 2; | 324 m_setWithOpStack = 2; |
336 | 325 |
337 m_ops.push_back( op ); | 326 m_ops.push_back( op ); |
338 m_opsArray.push_back( op.getOpEncoding() ); | |
339 } | 327 } |
340 else | 328 else |
341 { | 329 { |
342 std::size_t ret = m_opIndex; | 330 std::size_t ret = m_opIndex; |
343 | 331 |
344 ABCA_ASSERT( m_setWithOpStack == 2, | 332 ABCA_ASSERT( m_setWithOpStack == 2, |
345 "Cannot mix addOp() and set<Foo>() methods." ); | 333 "Cannot mix addOp() and set<Foo>() methods." ); |
346 | 334 |
347 ABCA_ASSERT( op.getType() == m_ops[ret].getType(), | 335 ABCA_ASSERT( op.getType() == m_ops[ret].getType(), |
348 "Cannot update mismatched op-type in already-setted " | 336 "Cannot update mismatched op-type in already-setted " |
(...skipping 17 matching lines...) Expand all Loading... |
366 op.setChannelValue( 3, iAngleInDegrees ); | 354 op.setChannelValue( 3, iAngleInDegrees ); |
367 | 355 |
368 if ( ! m_hasBeenRead ) | 356 if ( ! m_hasBeenRead ) |
369 { | 357 { |
370 ABCA_ASSERT( m_setWithOpStack == 0 || m_setWithOpStack == 2, | 358 ABCA_ASSERT( m_setWithOpStack == 0 || m_setWithOpStack == 2, |
371 "Cannot mix addOp() and set<Foo>() methods." ); | 359 "Cannot mix addOp() and set<Foo>() methods." ); |
372 | 360 |
373 m_setWithOpStack = 2; | 361 m_setWithOpStack = 2; |
374 | 362 |
375 m_ops.push_back( op ); | 363 m_ops.push_back( op ); |
376 m_opsArray.push_back( op.getOpEncoding() ); | |
377 } | 364 } |
378 else | 365 else |
379 { | 366 { |
380 std::size_t ret = m_opIndex; | 367 std::size_t ret = m_opIndex; |
381 | 368 |
382 ABCA_ASSERT( m_setWithOpStack == 2, | 369 ABCA_ASSERT( m_setWithOpStack == 2, |
383 "Cannot mix addOp() and set<Foo>() methods." ); | 370 "Cannot mix addOp() and set<Foo>() methods." ); |
384 | 371 |
385 ABCA_ASSERT( op.getType() == m_ops[ret].getType(), | 372 ABCA_ASSERT( op.getType() == m_ops[ret].getType(), |
386 "Cannot update mismatched op-type in already-setted " | 373 "Cannot update mismatched op-type in already-setted " |
387 << "XformSample!" ); | 374 << "XformSample!" ); |
388 | 375 |
389 m_ops[ret] = op; | 376 m_ops[ret] = op; |
390 m_opIndex = ++m_opIndex % m_ops.size(); | 377 m_opIndex = ++m_opIndex % m_ops.size(); |
391 } | 378 } |
392 } | 379 } |
393 | 380 |
394 //-***************************************************************************** | 381 //-***************************************************************************** |
395 void XformSample::setScale( const Abc::V3d &iScale ) | 382 void XformSample::setScale( const Abc::V3d &iScale ) |
396 { | 383 { |
397 XformOp op( kScaleOperation, kSingleRotateHint ); | 384 XformOp op( kScaleOperation, kScaleHint ); |
398 | 385 |
399 for ( size_t i = 0 ; i < 3 ; ++i ) | 386 for ( size_t i = 0 ; i < 3 ; ++i ) |
400 { | 387 { |
401 op.setChannelValue( i, iScale[i] ); | 388 op.setChannelValue( i, iScale[i] ); |
402 } | 389 } |
403 | 390 |
404 if ( ! m_hasBeenRead ) | 391 if ( ! m_hasBeenRead ) |
405 { | 392 { |
406 ABCA_ASSERT( m_setWithOpStack == 0 || m_setWithOpStack == 2, | 393 ABCA_ASSERT( m_setWithOpStack == 0 || m_setWithOpStack == 2, |
407 "Cannot mix addOp() and set<Foo>() methods." ); | 394 "Cannot mix addOp() and set<Foo>() methods." ); |
408 | 395 |
409 m_setWithOpStack = 2; | 396 m_setWithOpStack = 2; |
410 | 397 |
411 m_ops.push_back( op ); | 398 m_ops.push_back( op ); |
412 m_opsArray.push_back( op.getOpEncoding() ); | |
413 } | 399 } |
414 else | 400 else |
415 { | 401 { |
416 std::size_t ret = m_opIndex; | 402 std::size_t ret = m_opIndex; |
417 | 403 |
418 ABCA_ASSERT( m_setWithOpStack == 2, | 404 ABCA_ASSERT( m_setWithOpStack == 2, |
419 "Cannot mix addOp() and set<Foo>() methods." ); | 405 "Cannot mix addOp() and set<Foo>() methods." ); |
420 | 406 |
421 ABCA_ASSERT( op.getType() == m_ops[ret].getType(), | 407 ABCA_ASSERT( op.getType() == m_ops[ret].getType(), |
422 "Cannot update mismatched op-type in already-setted " | 408 "Cannot update mismatched op-type in already-setted " |
423 << "XformSample!" ); | 409 << "XformSample!" ); |
424 | 410 |
425 m_ops[ret] = op; | 411 m_ops[ret] = op; |
426 m_opIndex = ++m_opIndex % m_ops.size(); | 412 m_opIndex = ++m_opIndex % m_ops.size(); |
427 } | 413 } |
428 } | 414 } |
429 | 415 |
430 //-***************************************************************************** | 416 //-***************************************************************************** |
431 void XformSample::setXRotation( const double iAngleInDegrees ) | 417 void XformSample::setXRotation( const double iAngleInDegrees ) |
432 { | 418 { |
433 XformOp op( kRotateXOperation, kSingleRotateHint ); | 419 XformOp op( kRotateXOperation, kRotateHint ); |
434 | 420 |
435 op.setChannelValue( 0, iAngleInDegrees ); | 421 op.setChannelValue( 0, iAngleInDegrees ); |
436 | 422 |
437 if ( ! m_hasBeenRead ) | 423 if ( ! m_hasBeenRead ) |
438 { | 424 { |
439 ABCA_ASSERT( m_setWithOpStack == 0 || m_setWithOpStack == 2, | 425 ABCA_ASSERT( m_setWithOpStack == 0 || m_setWithOpStack == 2, |
440 "Cannot mix addOp() and set<Foo>() methods." ); | 426 "Cannot mix addOp() and set<Foo>() methods." ); |
441 | 427 |
442 m_setWithOpStack = 2; | 428 m_setWithOpStack = 2; |
443 | 429 |
444 m_ops.push_back( op ); | 430 m_ops.push_back( op ); |
445 m_opsArray.push_back( op.getOpEncoding() ); | |
446 } | 431 } |
447 else | 432 else |
448 { | 433 { |
449 std::size_t ret = m_opIndex; | 434 std::size_t ret = m_opIndex; |
450 | 435 |
451 ABCA_ASSERT( m_setWithOpStack == 2, | 436 ABCA_ASSERT( m_setWithOpStack == 2, |
452 "Cannot mix addOp() and set<Foo>() methods." ); | 437 "Cannot mix addOp() and set<Foo>() methods." ); |
453 | 438 |
454 ABCA_ASSERT( op.getType() == m_ops[ret].getType(), | 439 ABCA_ASSERT( op.getType() == m_ops[ret].getType(), |
455 "Cannot update mismatched op-type in already-setted " | 440 "Cannot update mismatched op-type in already-setted " |
456 << "XformSample!" ); | 441 << "XformSample!" ); |
457 | 442 |
458 m_ops[ret] = op; | 443 m_ops[ret] = op; |
459 m_opIndex = ++m_opIndex % m_ops.size(); | 444 m_opIndex = ++m_opIndex % m_ops.size(); |
460 } | 445 } |
461 } | 446 } |
462 | 447 |
463 //-***************************************************************************** | 448 //-***************************************************************************** |
464 void XformSample::setYRotation( const double iAngleInDegrees ) | 449 void XformSample::setYRotation( const double iAngleInDegrees ) |
465 { | 450 { |
466 XformOp op( kRotateYOperation, kSingleRotateHint ); | 451 XformOp op( kRotateYOperation, kRotateHint ); |
467 | 452 |
468 op.setChannelValue( 0, iAngleInDegrees ); | 453 op.setChannelValue( 0, iAngleInDegrees ); |
469 | 454 |
470 if ( ! m_hasBeenRead ) | 455 if ( ! m_hasBeenRead ) |
471 { | 456 { |
472 ABCA_ASSERT( m_setWithOpStack == 0 || m_setWithOpStack == 2, | 457 ABCA_ASSERT( m_setWithOpStack == 0 || m_setWithOpStack == 2, |
473 "Cannot mix addOp() and set<Foo>() methods." ); | 458 "Cannot mix addOp() and set<Foo>() methods." ); |
474 | 459 |
475 m_setWithOpStack = 2; | 460 m_setWithOpStack = 2; |
476 | 461 |
477 m_ops.push_back( op ); | 462 m_ops.push_back( op ); |
478 m_opsArray.push_back( op.getOpEncoding() ); | |
479 } | 463 } |
480 else | 464 else |
481 { | 465 { |
482 std::size_t ret = m_opIndex; | 466 std::size_t ret = m_opIndex; |
483 | 467 |
484 ABCA_ASSERT( m_setWithOpStack == 2, | 468 ABCA_ASSERT( m_setWithOpStack == 2, |
485 "Cannot mix addOp() and set<Foo>() methods." ); | 469 "Cannot mix addOp() and set<Foo>() methods." ); |
486 | 470 |
487 ABCA_ASSERT( op.getType() == m_ops[ret].getType(), | 471 ABCA_ASSERT( op.getType() == m_ops[ret].getType(), |
488 "Cannot update mismatched op-type in already-setted " | 472 "Cannot update mismatched op-type in already-setted " |
489 << "XformSample!" ); | 473 << "XformSample!" ); |
490 | 474 |
491 m_ops[ret] = op; | 475 m_ops[ret] = op; |
492 m_opIndex = ++m_opIndex % m_ops.size(); | 476 m_opIndex = ++m_opIndex % m_ops.size(); |
493 } | 477 } |
494 } | 478 } |
495 | 479 |
496 //-***************************************************************************** | 480 //-***************************************************************************** |
497 void XformSample::setZRotation( const double iAngleInDegrees ) | 481 void XformSample::setZRotation( const double iAngleInDegrees ) |
498 { | 482 { |
499 XformOp op( kRotateZOperation, kSingleRotateHint ); | 483 XformOp op( kRotateZOperation, kRotateHint ); |
500 | 484 |
501 op.setChannelValue( 0, iAngleInDegrees ); | 485 op.setChannelValue( 0, iAngleInDegrees ); |
502 | 486 |
503 if ( ! m_hasBeenRead ) | 487 if ( ! m_hasBeenRead ) |
504 { | 488 { |
505 ABCA_ASSERT( m_setWithOpStack == 0 || m_setWithOpStack == 2, | 489 ABCA_ASSERT( m_setWithOpStack == 0 || m_setWithOpStack == 2, |
506 "Cannot mix addOp() and set<Foo>() methods." ); | 490 "Cannot mix addOp() and set<Foo>() methods." ); |
507 | 491 |
508 m_setWithOpStack = 2; | 492 m_setWithOpStack = 2; |
509 | 493 |
510 m_ops.push_back( op ); | 494 m_ops.push_back( op ); |
511 m_opsArray.push_back( op.getOpEncoding() ); | |
512 } | 495 } |
513 else | 496 else |
514 { | 497 { |
515 std::size_t ret = m_opIndex; | 498 std::size_t ret = m_opIndex; |
516 | 499 |
517 ABCA_ASSERT( m_setWithOpStack == 2, | 500 ABCA_ASSERT( m_setWithOpStack == 2, |
518 "Cannot mix addOp() and set<Foo>() methods." ); | 501 "Cannot mix addOp() and set<Foo>() methods." ); |
519 | 502 |
520 ABCA_ASSERT( op.getType() == m_ops[ret].getType(), | 503 ABCA_ASSERT( op.getType() == m_ops[ret].getType(), |
521 "Cannot update mismatched op-type in already-setted " | 504 "Cannot update mismatched op-type in already-setted " |
(...skipping 18 matching lines...) Expand all Loading... |
540 } | 523 } |
541 | 524 |
542 if ( ! m_hasBeenRead ) | 525 if ( ! m_hasBeenRead ) |
543 { | 526 { |
544 ABCA_ASSERT( m_setWithOpStack == 0 || m_setWithOpStack == 2, | 527 ABCA_ASSERT( m_setWithOpStack == 0 || m_setWithOpStack == 2, |
545 "Cannot mix addOp() and set<Foo>() methods." ); | 528 "Cannot mix addOp() and set<Foo>() methods." ); |
546 | 529 |
547 m_setWithOpStack = 2; | 530 m_setWithOpStack = 2; |
548 | 531 |
549 m_ops.push_back( op ); | 532 m_ops.push_back( op ); |
550 m_opsArray.push_back( op.getOpEncoding() ); | |
551 } | 533 } |
552 else | 534 else |
553 { | 535 { |
554 std::size_t ret = m_opIndex; | 536 std::size_t ret = m_opIndex; |
555 | 537 |
556 ABCA_ASSERT( m_setWithOpStack == 2, | 538 ABCA_ASSERT( m_setWithOpStack == 2, |
557 "Cannot mix addOp() and set<Foo>() methods." ); | 539 "Cannot mix addOp() and set<Foo>() methods." ); |
558 | 540 |
559 ABCA_ASSERT( op.getType() == m_ops[ret].getType(), | 541 ABCA_ASSERT( op.getType() == m_ops[ret].getType(), |
560 "Cannot update mismatched op-type in already-setted " | 542 "Cannot update mismatched op-type in already-setted " |
(...skipping 22 matching lines...) Expand all Loading... |
583 if ( otype == kMatrixOperation ) | 565 if ( otype == kMatrixOperation ) |
584 { | 566 { |
585 for ( std::size_t j = 0 ; j < 4 ; ++j ) | 567 for ( std::size_t j = 0 ; j < 4 ; ++j ) |
586 { | 568 { |
587 for ( std::size_t k = 0 ; k < 4 ; ++k ) | 569 for ( std::size_t k = 0 ; k < 4 ; ++k ) |
588 { | 570 { |
589 m.x[j][k] = op.getChannelValue( ( 4 * j ) + k ); | 571 m.x[j][k] = op.getChannelValue( ( 4 * j ) + k ); |
590 } | 572 } |
591 } | 573 } |
592 } | 574 } |
| 575 else if ( otype == kRotateXOperation ) |
| 576 { |
| 577 m.setAxisAngle( Abc::V3d( 1.0, 0.0, 0.0 ), |
| 578 DegreesToRadians( op.getChannelValue( 0 ) ) ); |
| 579 } |
| 580 else if ( otype == kRotateYOperation ) |
| 581 { |
| 582 m.setAxisAngle( Abc::V3d( 0.0, 1.0, 0.0 ), |
| 583 DegreesToRadians( op.getChannelValue( 0 ) ) ); |
| 584 } |
| 585 else if ( otype == kRotateZOperation ) |
| 586 { |
| 587 m.setAxisAngle( Abc::V3d( 0.0, 0.0, 1.0 ), |
| 588 DegreesToRadians( op.getChannelValue( 0 ) ) ); |
| 589 } |
593 else | 590 else |
594 { | 591 { |
595 Abc::V3d vec( op.getChannelValue( 0 ), | 592 Abc::V3d vec( op.getChannelValue( 0 ), |
596 op.getChannelValue( 1 ), | 593 op.getChannelValue( 1 ), |
597 op.getChannelValue( 2 ) ); | 594 op.getChannelValue( 2 ) ); |
598 | 595 |
599 if ( otype == kScaleOperation ) | 596 if ( otype == kScaleOperation ) |
600 { | 597 { |
601 m.setScale( vec ); | 598 m.setScale( vec ); |
602 } | 599 } |
603 else if ( otype == kTranslateOperation ) | 600 else if ( otype == kTranslateOperation ) |
604 { | 601 { |
605 m.setTranslation( vec ); | 602 m.setTranslation( vec ); |
606 } | 603 } |
607 else if ( otype == kRotateOperation ) | 604 else if ( otype == kRotateOperation ) |
608 { | 605 { |
609 m.setAxisAngle( vec, | 606 m.setAxisAngle( vec, |
610 DegreesToRadians( op.getChannelValue( 3 ) ) ); | 607 DegreesToRadians( op.getChannelValue( 3 ) ) ); |
611 } | 608 } |
612 else if ( otype == kRotateXOperation ) | 609 |
613 { | |
614 m.setAxisAngle( Abc::V3d( 1.0, 0.0, 0.0 ), | |
615 DegreesToRadians( op.getChannelValue( 0 ) ) ); | |
616 } | |
617 else if ( otype == kRotateYOperation ) | |
618 { | |
619 m.setAxisAngle( Abc::V3d( 0.0, 1.0, 0.0 ), | |
620 DegreesToRadians( op.getChannelValue( 0 ) ) ); | |
621 } | |
622 else if ( otype == kRotateZOperation ) | |
623 { | |
624 m.setAxisAngle( Abc::V3d( 0.0, 0.0, 1.0 ), | |
625 DegreesToRadians( op.getChannelValue( 0 ) ) ); | |
626 } | |
627 } | 610 } |
628 ret = m * ret; | 611 ret = m * ret; |
629 } | 612 } |
630 | 613 |
631 return ret; | 614 return ret; |
632 } | 615 } |
633 | 616 |
634 //-***************************************************************************** | 617 //-***************************************************************************** |
635 Abc::V3d XformSample::getTranslation() const | 618 Abc::V3d XformSample::getTranslation() const |
636 { | 619 { |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
703 m_setWithOpStack = 0; | 686 m_setWithOpStack = 0; |
704 m_opIndex = 0; | 687 m_opIndex = 0; |
705 m_inherits = true; | 688 m_inherits = true; |
706 m_childBounds.makeEmpty(); | 689 m_childBounds.makeEmpty(); |
707 } | 690 } |
708 | 691 |
709 //-***************************************************************************** | 692 //-***************************************************************************** |
710 void XformSample::reset() | 693 void XformSample::reset() |
711 { | 694 { |
712 this->clear(); | 695 this->clear(); |
713 m_opsArray.clear(); | |
714 m_opsArray.resize( 0 ); | |
715 } | 696 } |
716 | 697 |
| 698 //-***************************************************************************** |
| 699 bool XformSample::isTopologyEqual( const XformSample & iSample ) |
| 700 { |
| 701 if (getNumOps() != iSample.getNumOps()) |
| 702 { |
| 703 return false; |
| 704 } |
717 | 705 |
| 706 std::vector<XformOp>::const_iterator opA, opB; |
| 707 for ( opA = m_ops.begin(), opB = iSample.m_ops.begin(); opA != m_ops.end(); |
| 708 ++opA, ++opB ) |
| 709 { |
| 710 if ( opA->getType() != opB->getType() ) |
| 711 { |
| 712 return false; |
| 713 } |
| 714 } |
| 715 |
| 716 return true; |
| 717 } |
718 | 718 |
719 } // End namespace AbcGeom | 719 } // End namespace AbcGeom |
720 } // End namespace Alembic | 720 } // End namespace Alembic |
OLD | NEW |