| 369 | | /*********************************** Non-ptr code ********************************/ |
|---|
| 370 | | void ChunkMaterialBase::pushToSlots(const Int32& value) |
|---|
| 371 | | { |
|---|
| 372 | | editMField(SlotsFieldMask, _mfSlots); |
|---|
| 373 | | _mfSlots.push_back(value); |
|---|
| 374 | | } |
|---|
| 375 | | |
|---|
| 376 | | void ChunkMaterialBase::insertIntoSlots(UInt32 uiIndex, |
|---|
| 377 | | const Int32& value ) |
|---|
| 378 | | { |
|---|
| 379 | | editMField(SlotsFieldMask, _mfSlots); |
|---|
| 380 | | |
|---|
| 381 | | MFInt32::iterator fieldIt = _mfSlots.begin(); |
|---|
| 382 | | |
|---|
| 383 | | fieldIt += uiIndex; |
|---|
| 384 | | |
|---|
| 385 | | _mfSlots.insert(fieldIt, value); |
|---|
| 386 | | } |
|---|
| 387 | | |
|---|
| 388 | | void ChunkMaterialBase::replaceInSlots(UInt32 uiIndex, |
|---|
| 389 | | const Int32& value ) |
|---|
| 390 | | { |
|---|
| 391 | | if(uiIndex >= _mfSlots.size()) |
|---|
| 392 | | return; |
|---|
| 393 | | |
|---|
| 394 | | editMField(SlotsFieldMask, _mfSlots); |
|---|
| 395 | | |
|---|
| 396 | | _mfSlots[uiIndex] = value; |
|---|
| 397 | | } |
|---|
| 398 | | |
|---|
| 399 | | void ChunkMaterialBase::replaceInSlots(const Int32& pOldElem, |
|---|
| 400 | | const Int32& pNewElem) |
|---|
| 401 | | { |
|---|
| 402 | | Int32 elemIdx = _mfSlots.findIndex(pOldElem); |
|---|
| 403 | | |
|---|
| 404 | | if(elemIdx != -1) |
|---|
| 405 | | { |
|---|
| 406 | | editMField(SlotsFieldMask, _mfSlots); |
|---|
| 407 | | |
|---|
| 408 | | MFInt32::iterator fieldIt = _mfSlots.begin(); |
|---|
| 409 | | |
|---|
| 410 | | fieldIt += elemIdx; |
|---|
| 411 | | |
|---|
| 412 | | (*fieldIt) = pNewElem; |
|---|
| 413 | | } |
|---|
| 414 | | } |
|---|
| 415 | | |
|---|
| 416 | | void ChunkMaterialBase::removeFromSlots(UInt32 uiIndex) |
|---|
| 417 | | { |
|---|
| 418 | | if(uiIndex < _mfSlots.size()) |
|---|
| 419 | | { |
|---|
| 420 | | editMField(SlotsFieldMask, _mfSlots); |
|---|
| 421 | | |
|---|
| 422 | | MFInt32::iterator fieldIt = _mfSlots.begin(); |
|---|
| 423 | | |
|---|
| 424 | | fieldIt += uiIndex; |
|---|
| 425 | | _mfSlots.erase(fieldIt); |
|---|
| 426 | | } |
|---|
| 427 | | } |
|---|
| 428 | | |
|---|
| 429 | | void ChunkMaterialBase::removeFromSlots(const Int32& value) |
|---|
| 430 | | { |
|---|
| 431 | | Int32 iElemIdx = _mfSlots.findIndex(value); |
|---|
| 432 | | |
|---|
| 433 | | if(iElemIdx != -1) |
|---|
| 434 | | { |
|---|
| 435 | | editMField(SlotsFieldMask, _mfSlots); |
|---|
| 436 | | |
|---|
| 437 | | MFInt32::iterator fieldIt = _mfSlots.begin(); |
|---|
| 438 | | |
|---|
| 439 | | fieldIt += iElemIdx; |
|---|
| 440 | | |
|---|
| 441 | | _mfSlots.erase(fieldIt); |
|---|
| 442 | | } |
|---|
| 443 | | } |
|---|
| 444 | | |
|---|
| 445 | | void ChunkMaterialBase::clearSlots(void) |
|---|
| 446 | | { |
|---|
| 447 | | editMField(SlotsFieldMask, _mfSlots); |
|---|
| 448 | | |
|---|
| 449 | | _mfSlots.clear(); |
|---|
| 450 | | } |
|---|