本文整理汇总了C++中CTexture::copyTexture方法的典型用法代码示例。如果您正苦于以下问题:C++ CTexture::copyTexture方法的具体用法?C++ CTexture::copyTexture怎么用?C++ CTexture::copyTexture使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CTexture
的用法示例。
在下文中一共展示了CTexture::copyTexture方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CTexture
TextureModificationUS(TextureXPanel* tx_panel, CTexture* texture)
: tx_panel(tx_panel)
{
tex_copy = new CTexture();
tex_copy->copyTexture(texture);
tex_copy->setState(texture->getState());
index = tx_panel->txList().textureIndex(tex_copy->getName());
}
示例2: paste
/* TextureXPanel::paste
* Pastes any textures on the clipboard after the last selected
* texture
*******************************************************************/
void TextureXPanel::paste()
{
// Check there is anything on the clipboard
if (theClipboard->nItems() == 0)
return;
// Get last selected index
int selected = list_textures->getLastSelected();
if (selected == -1) selected = texturex.nTextures() - 1; // Add to end of the list if nothing selected
// Begin recording undo level
undo_manager->beginRecord("Paste Texture(s)");
// Go through clipboard items
for (unsigned a = 0; a < theClipboard->nItems(); a++)
{
// Skip if not a texture clipboard item
if (theClipboard->getItem(a)->getType() != CLIPBOARD_COMPOSITE_TEXTURE)
continue;
// Get texture item
TextureClipboardItem* item = (TextureClipboardItem*)(theClipboard->getItem(a));
// Add new texture after last selected item
CTexture* ntex = new CTexture((texturex.getFormat() == TXF_TEXTURES));
ntex->copyTexture(item->getTexture(), true);
ntex->setState(2);
texturex.addTexture(ntex, ++selected);
// Record undo step
undo_manager->recordUndoStep(new TextureCreateDeleteUS(this, ntex, true));
// Deal with patches
for (unsigned p = 0; p < ntex->nPatches(); p++)
{
CTPatch* patch = ntex->getPatch(p);
// Update patch table if necessary
if (texturex.getFormat() != TXF_TEXTURES)
tx_editor->patchTable().addPatch(patch->getName());
// Get the entry for this patch
ArchiveEntry* entry = patch->getPatchEntry(tx_editor->getArchive());
// If the entry wasn't found in any open archive, try copying it from the clipboard
// (the user may have closed the archive the original patch was in)
if (!entry)
{
entry = item->getPatchEntry(patch->getName());
// Copy the copied patch entry over to this archive
if (entry)
tx_editor->getArchive()->addEntry(entry, "patches", true);
}
// If the entry exists in the base resource archive or this archive, do nothing
else if (entry->getParent() == theArchiveManager->baseResourceArchive() ||
entry->getParent() == tx_editor->getArchive())
continue;
// Otherwise, copy the entry over to this archive
else
tx_editor->getArchive()->addEntry(entry, "patches", true);
}
}
// End recording undo level
undo_manager->endRecord(true);
// Refresh
list_textures->updateList();
// Update variables
modified = true;
}