1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065 |
- //-----------------------------------------------------------------------------
- // Copyright (c) 2013 GarageGames, LLC
- //
- // Permission is hereby granted, free of charge, to any person obtaining a copy
- // of this software and associated documentation files (the "Software"), to
- // deal in the Software without restriction, including without limitation the
- // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
- // sell copies of the Software, and to permit persons to whom the Software is
- // furnished to do so, subject to the following conditions:
- //
- // The above copyright notice and this permission notice shall be included in
- // all copies or substantial portions of the Software.
- //
- // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
- // IN THE SOFTWARE.
- //-----------------------------------------------------------------------------
- #ifndef _CONSOLE_H_
- #include "console/console.h"
- #endif
- #ifndef _CONSOLEINTERNAL_H_
- #include "console/consoleInternal.h"
- #endif
- #ifndef _CONSOLETYPES_H_
- #include "console/consoleTypes.h"
- #endif
- #ifndef _PLATFORM_H_
- #include "platform/platform.h"
- #endif
- #ifndef _GBITMAP_H_
- #include "graphics/gBitmap.h"
- #endif
- #ifndef _UTILITY_H_
- #include "2d/core/Utility.h"
- #endif
- #ifndef _SCENE_OBJECT_H_
- #include "2d/sceneobject/SceneObject.h"
- #endif
- #ifndef _IMAGE_ASSET_H_
- #include "2d/assets/ImageAsset.h"
- #endif
- // Script bindings.
- #include "ImageAsset_ScriptBinding.h"
- // Debug Profiling.
- #include "debug/profiler.h"
- //------------------------------------------------------------------------------
- ImageAsset::FrameArea BadFrameArea(0, 0, 0, 0, 0.0f, 0.0f);
- //------------------------------------------------------------------------------
- ConsoleType( imageAssetPtr, TypeImageAssetPtr, sizeof(AssetPtr<ImageAsset>), ASSET_ID_FIELD_PREFIX )
- //-----------------------------------------------------------------------------
- ConsoleGetType( TypeImageAssetPtr )
- {
- // Fetch asset Id.
- return (*((AssetPtr<ImageAsset>*)dptr)).getAssetId();
- }
- //-----------------------------------------------------------------------------
- ConsoleSetType( TypeImageAssetPtr )
- {
- // Was a single argument specified?
- if( argc == 1 )
- {
- // Yes, so fetch field value.
- const char* pFieldValue = argv[0];
- // Fetch asset pointer.
- AssetPtr<ImageAsset>* pAssetPtr = dynamic_cast<AssetPtr<ImageAsset>*>((AssetPtrBase*)(dptr));
- // Is the asset pointer the correct type?
- if ( pAssetPtr == NULL )
- {
- // No, so fail.
- Con::warnf( "(TypeImageAssetPtr) - Failed to set asset Id '%d'.", pFieldValue );
- return;
- }
- // Set asset.
- pAssetPtr->setAssetId( pFieldValue );
- return;
- }
- // Warn.
- Con::warnf( "(TypeImageAssetPtr) - Cannot set multiple args to a single asset." );
- }
- //------------------------------------------------------------------------------
- static StringTableEntry cellCustomNodeCellsName = StringTable->insert( "Cells" );
- static StringTableEntry cellNodeName = StringTable->insert( "Cell" );
- static StringTableEntry cellRegionName = StringTable->insert( "RegionName" );
- static StringTableEntry cellOffsetName = StringTable->insert( "Offset" );
- static StringTableEntry cellOffsetXName = StringTable->insert( "OffsetX" );
- static StringTableEntry cellOffsetYName = StringTable->insert( "OffsetY" );
- static StringTableEntry cellWidthName = StringTable->insert( "Width" );
- static StringTableEntry cellHeightName = StringTable->insert( "Height" );
- static StringTableEntry cellNameEntryName = StringTable->insert( "Name" );
- static StringTableEntry imageLayerCustomNodeName = StringTable->insert("ImageLayers");
- static StringTableEntry layerNodeName = StringTable->insert("ImageLayer");
- static StringTableEntry layerImageFile = StringTable->insert("ImageFile");
- static StringTableEntry layerPositionName = StringTable->insert("Position");
- static StringTableEntry layerBlendColorName = StringTable->insert("BlendColor");
- //------------------------------------------------------------------------------
- static EnumTable::Enums textureFilterLookup[] =
- {
- { ImageAsset::FILTER_NEAREST, "NEAREST" },
- { ImageAsset::FILTER_BILINEAR, "BILINEAR" },
- { ImageAsset::FILTER_INVALID, "DEFAULT" }
- };
- EnumTable textureFilterTable(sizeof(textureFilterLookup) / sizeof(EnumTable::Enums), &textureFilterLookup[0]);
- //------------------------------------------------------------------------------
- ImageAsset::TextureFilterMode ImageAsset::getFilterModeEnum(const char* label)
- {
- // Search for Mnemonic.
- for(U32 i = 0; i < (sizeof(textureFilterLookup) / sizeof(EnumTable::Enums)); i++)
- if( dStricmp(textureFilterLookup[i].label, label) == 0)
- return((ImageAsset::TextureFilterMode)textureFilterLookup[i].index);
- // Warn.
- Con::warnf( "ImageAsset::getFilterModeEnum() - Invalid filter-mode '%s'", label );
- return ImageAsset::FILTER_INVALID;
- }
- //------------------------------------------------------------------------------
- const char* ImageAsset::getFilterModeDescription( ImageAsset::TextureFilterMode filterMode )
- {
- // Search for Mode.
- for(U32 i = 0; i < (sizeof(textureFilterLookup) / sizeof(EnumTable::Enums)); i++)
- if( textureFilterLookup[i].index == filterMode )
- return textureFilterLookup[i].label;
- // Warn.
- Con::warnf( "ImageAsset::getFilterModeDescription() - Invalid filter-mode." );
- return StringTable->EmptyString;
- }
- //------------------------------------------------------------------------------
- ImageAsset::ImageAsset() : mImageFile(StringTable->EmptyString),
- mForce16Bit(false),
- mLocalFilterMode(FILTER_INVALID),
- mExplicitMode(false),
- mCellRowOrder(true),
- mCellOffsetX(0),
- mCellOffsetY(0),
- mCellStrideX(0),
- mCellStrideY(0),
- mCellCountX(0),
- mCellCountY(0),
- mCellWidth(0),
- mCellHeight(0),
- mBlendColor(1.0f, 1.0f, 1.0f),
- mImageTextureHandle(NULL)
- {
- // Set Vector Associations.
- VECTOR_SET_ASSOCIATION( mFrames );
- VECTOR_SET_ASSOCIATION( mExplicitFrames );
- VECTOR_SET_ASSOCIATION(mImageLayers);
- }
- //------------------------------------------------------------------------------
- ImageAsset::~ImageAsset()
- {
- }
- //------------------------------------------------------------------------------
- void ImageAsset::initPersistFields()
- {
- // Call parent.
- Parent::initPersistFields();
- // Fields.
- addGroup("Image Fields");
- addProtectedField("ImageFile", TypeAssetLooseFilePath, Offset(mImageFile, ImageAsset), &setImageFile, &getImageFile, &defaultProtectedWriteFn, "");
- addProtectedField("Force16bit", TypeBool, Offset(mForce16Bit, ImageAsset), &setForce16Bit, &defaultProtectedGetFn, &writeForce16Bit, "Forces the image into 16 bit mode.");
- addProtectedField("FilterMode", TypeEnum, Offset(mLocalFilterMode, ImageAsset), &setFilterMode, &defaultProtectedGetFn, &writeFilterMode, 1, &textureFilterTable);
- addProtectedField("ExplicitMode", TypeBool, Offset(mExplicitMode, ImageAsset), &setExplicitMode, &defaultProtectedGetFn, &writeExplicitMode, "");
- addProtectedField("CellRowOrder", TypeBool, Offset(mCellRowOrder, ImageAsset), &setCellRowOrder, &defaultProtectedGetFn, &writeCellRowOrder, "If true, cell number are applied left-to-right, top-to-bottom.");
- addProtectedField("BlendColor", TypeColorF, Offset(mBlendColor, ImageAsset), &setBlendColor, &defaultProtectedGetFn, &writeBlendColor, "Changes the base color of the texture. You should only use this if you are using layers.");
- endGroup("Image Fields");
- addGroup("X Values");
- addProtectedField("CellWidth", TypeS32, Offset(mCellWidth, ImageAsset), &setCellWidth, &defaultProtectedGetFn, &writeCellWidth, "The width of each cell.");
- addProtectedField("CellCountX", TypeS32, Offset(mCellCountX, ImageAsset), &setCellCountX, &defaultProtectedGetFn, &writeCellCountX, "The number of cells in the X direction.");
- addProtectedField("CellOffsetX", TypeS32, Offset(mCellOffsetX, ImageAsset), &setCellOffsetX, &defaultProtectedGetFn, &writeCellOffsetX, "The distance from the left edge of the image to the left edge of the first cell.");
- addProtectedField("CellStrideX", TypeS32, Offset(mCellStrideX, ImageAsset), &setCellStrideX, &defaultProtectedGetFn, &writeCellStrideX, "The distance from the left edge of a cell to the left edge of the next adjacent cell. Set to 0 to match the cell width.");
- endGroup("X Values");
- addGroup("Y Values");
- addProtectedField("CellHeight", TypeS32, Offset(mCellHeight, ImageAsset), &setCellHeight, &defaultProtectedGetFn, &writeCellHeight, "The height of each cell.");
- addProtectedField("CellCountY", TypeS32, Offset(mCellCountY, ImageAsset), &setCellCountY, &defaultProtectedGetFn, &writeCellCountY, "The number of cells in the Y direction.");
- addProtectedField("CellOffsetY", TypeS32, Offset(mCellOffsetY, ImageAsset), &setCellOffsetY, &defaultProtectedGetFn, &writeCellOffsetY, "The distance from the top edge of the image to the top edge of the first cell.");
- addProtectedField("CellStrideY", TypeS32, Offset(mCellStrideY, ImageAsset), &setCellStrideY, &defaultProtectedGetFn, &writeCellStrideY, "The distance from the top edge of a cell to the top edge of the next cell below. Set to 0 to match the cell height.");
- endGroup("Y Values");
- }
- //------------------------------------------------------------------------------
- bool ImageAsset::onAdd()
- {
- // Call Parent.
- if (!Parent::onAdd())
- return false;
- return true;
- }
- //------------------------------------------------------------------------------
- void ImageAsset::onRemove()
- {
- // Call Parent.
- Parent::onRemove();
- }
- //------------------------------------------------------------------------------
- void ImageAsset::setImageFile( const char* pImageFile )
- {
- // Sanity!
- AssertFatal( pImageFile != NULL, "Cannot use a NULL image file." );
- // Fetch image file.
- pImageFile = StringTable->insert( pImageFile );
- // Ignore no change,
- if ( pImageFile == mImageFile )
- return;
- // Update.
- mImageFile = getOwned() ? expandAssetFilePath( pImageFile ) : StringTable->insert( pImageFile );
- // Refresh the asset.
- refreshAsset();
- }
- //------------------------------------------------------------------------------
- void ImageAsset::copyTo(SimObject* object)
- {
- // Call to parent.
- Parent::copyTo(object);
- // Cast to asset.
- ImageAsset* pAsset = static_cast<ImageAsset*>(object);
- // Sanity!
- AssertFatal(pAsset != NULL, "ImageAsset::copyTo() - Object is not the correct type.");
- // Copy state.
- pAsset->setImageFile( getImageFile() );
- pAsset->setForce16Bit( getForce16Bit() );
- pAsset->setFilterMode( getFilterMode() );
- pAsset->setExplicitMode( getExplicitMode() );
- pAsset->setCellRowOrder( getCellRowOrder() );
- pAsset->setCellOffsetX( getCellCountX() );
- pAsset->setCellOffsetY( getCellCountY() );
- pAsset->setCellStrideX( getCellStrideX() );
- pAsset->setCellStrideY( getCellStrideY() );
- pAsset->setCellCountX( getCellCountX() );
- pAsset->setCellCountY( getCellCountY() );
- pAsset->setCellWidth( getCellWidth() );
- pAsset->setCellHeight( getCellHeight() );
- // Finish if not in explicit mode.
- if ( !getExplicitMode() )
- return;
- // Fetch the explicit cell count.
- const S32 explicitCellCount = getExplicitCellCount();
- // Finish if no explicit cells exist.
- if ( explicitCellCount == 0 )
- return;
- // Copy explicit cells.
- pAsset->clearExplicitCells();
- for( S32 index = 0; index < explicitCellCount; ++index )
- {
- // Fetch the cell pixel area.
- const FrameArea::PixelArea& pixelArea = getImageFrameArea( index ).mPixelArea;
- // Add the explicit cell.
- pAsset->addExplicitCell( pixelArea.mPixelOffset.x, pixelArea.mPixelOffset.y, pixelArea.mPixelWidth, pixelArea.mPixelHeight, pixelArea.mRegionName );
- }
- }
- //------------------------------------------------------------------------------
- void ImageAsset::setForce16Bit( const bool force16Bit )
- {
- // Ignore no change,
- if ( force16Bit == mForce16Bit )
- return;
- // Update.
- mForce16Bit = force16Bit;
- // Refresh the asset.
- refreshAsset();
- }
- //------------------------------------------------------------------------------
- void ImageAsset::setFilterMode( const ImageAsset::TextureFilterMode filterMode )
- {
- // Ignore no change,
- if ( filterMode == mLocalFilterMode )
- return;
- // Update.
- mLocalFilterMode = filterMode;
- // Refresh the asset.
- refreshAsset();
- }
- //------------------------------------------------------------------------------
- void ImageAsset::setExplicitMode( const bool explicitMode )
- {
- // Ignore no change,
- if ( explicitMode == mExplicitMode )
- return;
- // Update.
- mExplicitMode = explicitMode;
- // Refresh the asset.
- refreshAsset();
- }
- //------------------------------------------------------------------------------
- void ImageAsset::setCellRowOrder( const bool cellRowOrder )
- {
- // Ignore no change.
- if ( cellRowOrder == mCellRowOrder )
- return;
- // Update.
- mCellRowOrder = cellRowOrder;
- // Refresh the asset.
- refreshAsset();
- }
- //------------------------------------------------------------------------------
- void ImageAsset::setCellOffsetX( const S32 cellOffsetX )
- {
- // Ignore no change.
- if ( cellOffsetX == mCellOffsetX )
- return;
- // Valid?
- if ( cellOffsetX < 0 )
- {
- // No, so warn.
- Con::warnf( "Invalid CELL offset X '%d'.", cellOffsetX );
- return;
- }
- // Update.
- mCellOffsetX = cellOffsetX;
- // Refresh the asset.
- refreshAsset();
- }
- //------------------------------------------------------------------------------
- void ImageAsset::setCellOffsetY( const S32 cellOffsetY )
- {
- // Ignore no change.
- if ( cellOffsetY == mCellOffsetY )
- return;
- // Valid?
- if ( cellOffsetY < 0 )
- {
- // No, so warn.
- Con::warnf( "Invalid CELL offset Y '%d'.", cellOffsetY );
- return;
- }
- // Update.
- mCellOffsetY = cellOffsetY;
- // Refresh the asset.
- refreshAsset();
- }
- //------------------------------------------------------------------------------
- void ImageAsset::setCellStrideX( const S32 cellStrideX )
- {
- // Ignore no change.
- if ( cellStrideX == mCellStrideX )
- return;
- // Valid?
- if ( cellStrideX < 0 )
- {
- // No, so warn.
- Con::warnf( "Invalid CELL stride X '%d'.", cellStrideX );
- return;
- }
- // Update.
- mCellStrideX = cellStrideX;
- // Refresh the asset.
- refreshAsset();
- }
- //------------------------------------------------------------------------------
- void ImageAsset::setCellStrideY( const S32 cellStrideY )
- {
- // Ignore no change.
- if ( cellStrideY == mCellStrideY )
- return;
- // Valid?
- if ( cellStrideY < 0 )
- {
- // No, so warn.
- Con::warnf( "Invalid CELL stride Y '%d'.", cellStrideY );
- return;
- }
- // Update.
- mCellStrideY = cellStrideY;
- // Refresh the asset.
- refreshAsset();
- }
- //------------------------------------------------------------------------------
- void ImageAsset::setCellCountX( const S32 cellCountX )
- {
- // Ignore no change.
- if ( cellCountX == mCellCountX )
- return;
- // Valid?
- if ( cellCountX < 0 )
- {
- // No, so warn.
- Con::warnf( "Invalid CELL count X '%d'.", cellCountX );
- return;
- }
- // Update.
- mCellCountX = cellCountX;
- // Refresh the asset.
- refreshAsset();
- }
- //------------------------------------------------------------------------------
- void ImageAsset::setCellCountY( const S32 cellCountY )
- {
- // Ignore no change.
- if ( cellCountY == mCellCountY )
- return;
- // Valid?
- if ( cellCountY < 0 )
- {
- // No, so warn.
- Con::warnf( "Invalid CELL count Y '%d'.", cellCountY );
- return;
- }
- // Update.
- mCellCountY = cellCountY;
- // Refresh the asset.
- refreshAsset();
- }
- //------------------------------------------------------------------------------
- void ImageAsset::setCellWidth( const S32 cellWidth )
- {
- // Ignore no change.
- if ( cellWidth == mCellWidth )
- return;
- // Valid?
- if ( cellWidth < 0 )
- {
- // No, so warn.
- Con::warnf( "Invalid CELL width '%d'.", cellWidth );
- return;
- }
- // Update.
- mCellWidth = cellWidth;
- // Refresh the asset.
- refreshAsset();
- }
- //------------------------------------------------------------------------------
- void ImageAsset::setCellHeight( const S32 cellheight )
- {
- // Ignore no change.
- if ( cellheight == mCellHeight )
- return;
- // Valid?
- if ( cellheight < 0 )
- {
- // No, so warn.
- Con::warnf( "Invalid CELL height '%d'.", cellheight );
- return;
- }
- // Update.
- mCellHeight = cellheight;
- // Refresh the asset.
- refreshAsset();
- }
- //------------------------------------------------------------------------------
- Vector2 ImageAsset::getExplicitCellOffset(const S32 cellIndex)
- {
- if ( !getExplicitMode() )
- {
- // No, so warn.
- Con::warnf( "ImageAsset() - Cannot perform explicit cell operation when not in explicit mode." );
- return NULL;
- }
-
- ImageAsset::FrameArea::PixelArea thisCell = mExplicitFrames.at(cellIndex);
- return(thisCell.mPixelOffset);
- }
- //------------------------------------------------------------------------------
- S32 ImageAsset::getExplicitCellWidth(const S32 cellIndex)
- {
- if ( !getExplicitMode() )
- {
- // No, so warn.
- Con::warnf( "ImageAsset() - Cannot perform explicit cell operation when not in explicit mode." );
- return (0);
- }
-
- ImageAsset::FrameArea::PixelArea thisCell = mExplicitFrames.at(cellIndex);
- return(thisCell.mPixelWidth);
- }
- //------------------------------------------------------------------------------
- S32 ImageAsset::getExplicitCellHeight(const S32 cellIndex)
- {
- if ( !getExplicitMode() )
- {
- // No, so warn.
- Con::warnf( "ImageAsset() - Cannot perform explicit cell operation when not in explicit mode." );
- return (0);
- }
-
- ImageAsset::FrameArea::PixelArea thisCell = mExplicitFrames.at(cellIndex);
- return(thisCell.mPixelHeight);
- }
- //------------------------------------------------------------------------------
- StringTableEntry ImageAsset::getExplicitCellName(const S32 cellIndex)
- {
- if ( !getExplicitMode() )
- {
- // No, so warn.
- Con::warnf( "ImageAsset() - Cannot perform explicit cell operation when not in explicit mode." );
- return NULL;
- }
-
- ImageAsset::FrameArea::PixelArea thisCell = mExplicitFrames.at(cellIndex);
- return(thisCell.mRegionName);
- }
- //------------------------------------------------------------------------------
- S32 ImageAsset::getExplicitCellIndex(const char* regionName)
- {
- if ( !getExplicitMode() )
- {
- // No, so warn.
- Con::warnf( "ImageAsset() - Cannot perform explicit cell operation when not in explicit mode." );
- return -1;
- }
-
- // Set up a frame counter
- S32 frameCounter = 0;
-
- // Interate through the vector
- for( typeExplicitFrameAreaVector::iterator frameItr = mExplicitFrames.begin(); frameItr != mExplicitFrames.end(); ++frameItr )
- {
- // Grab the current pixelArea
- const FrameArea::PixelArea& pixelArea = *frameItr;
-
- // Check to see if the name matches the argument
- if (!dStrcmp(pixelArea.mRegionName, regionName))
- {
- // Found it, so return the frame
- return frameCounter;
- }
- else
- {
- ++frameCounter;
- }
- }
-
- // Didn't find it, so return -1
- return -1;
-
- }
- //------------------------------------------------------------------------------
- bool ImageAsset::containsNamedRegion(const char* regionName)
- {
- for( typeFrameAreaVector::iterator frameItr = mFrames.begin(); frameItr != mFrames.end(); ++frameItr )
- {
- // Grab the current pixelArea
- const FrameArea::PixelArea& pixelArea = frameItr->mPixelArea;
-
- // Check to see if the name matches the argument
- if (!dStrcmp(pixelArea.mRegionName, regionName))
- {
- // Found it, so erase it and return success
- return true;
- }
- }
-
- return false;
- }
- //------------------------------------------------------------------------------
- bool ImageAsset::clearExplicitCells( void )
- {
- // Are we in explicit mode?
- if ( !getExplicitMode() )
- {
- // No, so warn.
- Con::warnf( "ImageAsset() - Cannot perform explicit cell operation when not in explicit mode." );
- return false;
- }
- // Clear explicit frames.
- mExplicitFrames.clear();
- // Refresh the asset.
- refreshAsset();
- return true;
- }
- //------------------------------------------------------------------------------
- bool ImageAsset::addExplicitCell( const S32 cellOffsetX, const S32 cellOffsetY, const S32 cellWidth, const S32 cellHeight, const char* regionName )
- {
- // Are we in explicit mode?
- if ( !getExplicitMode() )
- {
- // No, so warn.
- Con::warnf( "ImageAsset::addExplicitCell() - Cannot perform explicit cell operation when not in explicit mode." );
- return false;
- }
- // Fetch the original image dimensions.
- const S32 imageWidth = getImageWidth();
- const S32 imageHeight = getImageHeight();
-
- // The region name cannot be empty
- if ( regionName == StringTable->EmptyString )
- {
- Con::warnf( "ImageAsset::addExplicitCell() - Cell name of '%s' is invalid or was not set.", regionName );
- U32 currentIndex = mExplicitFrames.size();
- Con::warnf( "- Setting to the next index in the frame list: '%i'", currentIndex );
- dSscanf(regionName, "%i", currentIndex);
- }
- // The Cell Offset X needs to be within the image.
- if ( cellOffsetX < 0 || cellOffsetX >= imageWidth )
- {
- // Warn.
- Con::warnf( "ImageAsset::addExplicitCell() - Invalid Cell OffsetX of %d.", cellOffsetX );
- return false;
- }
- // The Cell Offset Y needs to be within the image.
- if ( cellOffsetY < 0 || cellOffsetY >= imageHeight )
- {
- // Warn.
- Con::warnf( "ImageAsset::addExplicitCell() - Invalid Cell OffsetY of %d.", cellOffsetY );
- return false;
- }
- // The Cell Width needs to be within the image.
- if ( cellWidth <= 0 || (cellOffsetX+cellWidth) > imageWidth )
- {
- // Warn.
- Con::warnf( "ImageAsset::addExplicitCell() - Invalid Cell Width of %d.", cellWidth );
- return false;
- }
- // The Cell Height needs to be within the image.
- if ( cellHeight <= 0 || (cellOffsetY+cellHeight) > imageHeight )
- {
- // Warn.
- Con::warnf( "ImageAsset::addExplicitCell() - Invalid Cell Width of %d.", cellHeight );
- return false;
- }
- // Store frame.
- FrameArea::PixelArea pixelArea( cellOffsetX, cellOffsetY, cellWidth, cellHeight, regionName );
- mExplicitFrames.push_back( pixelArea );
- // Refresh the asset.
- refreshAsset();
- return true;
- }
- //------------------------------------------------------------------------------
- bool ImageAsset::insertExplicitCell( const S32 cellIndex, const S32 cellOffsetX, const S32 cellOffsetY, const S32 cellWidth, const S32 cellHeight, const char* regionName )
- {
- // Are we in explicit mode?
- if ( !getExplicitMode() )
- {
- // No, so warn.
- Con::warnf( "ImageAsset::insertExplicitCell() - Cannot perform explicit cell operation when not in explicit mode." );
- return false;
- }
- // Fetch the original image dimensions.
- const S32 imageWidth = getImageWidth();
- const S32 imageHeight = getImageHeight();
- // Fetch the explicit frame count.
- const S32 explicitFramelCount = mExplicitFrames.size();
-
- // Region cannot be empty
- if ( regionName == StringTable->EmptyString )
- {
- Con::warnf( "ImageAsset::insertExplicitCell() - Cell name of '%s' is invalid or was not set.", regionName );
- Con::warnf( "- Setting to the next index in the frame list: '%i'", explicitFramelCount );
- dSscanf(regionName, "%i", explicitFramelCount);
- }
- // The cell index needs to be in range.
- if ( cellIndex < 0 )
- {
- // Warn.
- Con::warnf( "ImageAsset::insertExplicitCell() - Invalid Cell Index of %d.", cellIndex );
- return false;
- }
- // The Cell Offset X needs to be within the image.
- if ( cellOffsetX < 0 || cellOffsetX >= imageWidth )
- {
- // Warn.
- Con::warnf( "ImageAsset::insertExplicitCell() - Invalid Cell OffsetX of %d.", cellOffsetX );
- return false;
- }
- // The Cell Offset Y needs to be within the image.
- if ( cellOffsetY < 0 || cellOffsetY >= imageHeight )
- {
- // Warn.
- Con::warnf( "ImageAsset::insertExplicitCell() - Invalid Cell OffsetY of %d.", cellOffsetY );
- return false;
- }
- // The Cell Width needs to be within the image.
- if ( cellWidth <= 0 || (cellOffsetX+cellWidth) > imageWidth )
- {
- // Warn.
- Con::warnf( "ImageAsset::insertExplicitCell() - Invalid Cell Width of %d.", cellWidth );
- return false;
- }
- // The Cell Height needs to be within the image.
- if ( cellHeight <= 0 || (cellOffsetY+cellHeight) > imageHeight )
- {
- // Warn.
- Con::warnf( "ImageAsset::insertExplicitCell() - Invalid Cell Width of %d.", cellHeight );
- return false;
- }
- // Configure frame.
- FrameArea::PixelArea pixelArea( cellOffsetX, cellOffsetY, cellWidth, cellHeight, regionName );
- // Insert frame appropriately.
- if ( cellIndex >= explicitFramelCount )
- {
- mExplicitFrames.push_back( pixelArea );
- }
- else
- {
- mExplicitFrames.insert( cellIndex );
- mExplicitFrames[cellIndex] = pixelArea;
- }
- // Refresh the asset.
- refreshAsset();
- return true;
- }
- //------------------------------------------------------------------------------
- bool ImageAsset::setExplicitCell( const S32 cellIndex, const S32 cellOffsetX, const S32 cellOffsetY, const S32 cellWidth, const S32 cellHeight, const char* regionName )
- {
- // Are we in explicit mode?
- if ( !getExplicitMode() )
- {
- // No, so warn.
- Con::warnf( "ImageAsset::setExplicitCell() - Cannot perform explicit cell operation when not in explicit mode." );
- return false;
- }
- // Fetch the original image dimensions.
- const S32 imageWidth = getImageWidth();
- const S32 imageHeight = getImageHeight();
- // Fetch the explicit frame count.
- const S32 explicitFrameCount = mExplicitFrames.size();
-
- // Region cannot be empty
- if ( regionName == StringTable->EmptyString )
- {
- Con::warnf( "ImageAsset::setExplicitCell() - Cell name of '%s' is invalid or was not set.", regionName );
- Con::warnf( "- Setting to the next index in the frame list: '%i'", explicitFrameCount );
- dSscanf(regionName, "%i", explicitFrameCount);
- }
- // The cell index needs to be in range.
- if ( cellIndex < 0 || cellIndex >= explicitFrameCount )
- {
- // Warn.
- Con::warnf( "ImageAsset::setExplicitCell() - Invalid Cell Index of %d.", cellIndex );
- return false;
- }
- // The Cell Offset X needs to be within the image.
- if ( cellOffsetX < 0 || cellOffsetX >= imageWidth )
- {
- // Warn.
- Con::warnf( "ImageAsset::setExplicitCell() - Invalid Cell OffsetX of %d.", cellOffsetX );
- return false;
- }
- // The Cell Offset Y needs to be within the image.
- if ( cellOffsetY < 0 || cellOffsetY >= imageHeight )
- {
- // Warn.
- Con::warnf( "ImageAsset::setExplicitCell() - Invalid Cell OffsetY of %d.", cellOffsetY );
- return false;
- }
- // The Cell Width needs to be within the image.
- if ( cellWidth <= 0 || (cellOffsetX+cellWidth) > imageWidth )
- {
- // Warn.
- Con::warnf( "ImageAsset::setExplicitCell() - Invalid Cell Width of %d.", cellWidth );
- return false;
- }
- // The Cell Height needs to be within the image.
- if ( cellHeight <= 0 || (cellOffsetY+cellHeight) > imageHeight )
- {
- // Warn.
- Con::warnf( "ImageAsset::setExplicitCell() - Invalid Cell Width of %d.", cellHeight );
- return false;
- }
- // Configure frame.
- FrameArea::PixelArea pixelArea( cellOffsetX, cellOffsetY, cellWidth, cellHeight, regionName );
- // Set cell.
- mExplicitFrames[cellIndex] = pixelArea;
- // Refresh the asset.
- refreshAsset();
- return true;
- }
- //------------------------------------------------------------------------------
- bool ImageAsset::removeExplicitCell( const S32 cellIndex )
- {
- // Are we in explicit mode?
- if ( !getExplicitMode() )
- {
- // No, so warn.
- Con::warnf( "ImageAsset::removeExplicitCell() - Cannot perform explicit cell operation when not in explicit mode." );
- return false;
- }
- // Fetch the explicit frame count.
- const S32 explicitFrameCount = mExplicitFrames.size();
- // The cell index needs to be in range.
- if ( cellIndex < 0 || cellIndex >= explicitFrameCount )
- {
- // Warn.
- Con::warnf( "ImageAsset::removeExplicitCell() - Invalid Cell Index of %d.", cellIndex );
- return false;
- }
- // Remove cell.
- mExplicitFrames.erase(cellIndex);
- // Refresh the asset.
- refreshAsset();
- return true;
- }
- //------------------------------------------------------------------------------
- bool ImageAsset::removeExplicitCell( const char* regionName )
- {
- // Are we in explicit mode?
- if ( !getExplicitMode() )
- {
- // No, so warn.
- Con::warnf( "ImageAsset::removeExplicitCell() - Cannot perform explicit cell operation when not in explicit mode." );
- return false;
- }
- // Interate through the vector
- for( typeExplicitFrameAreaVector::iterator frameItr = mExplicitFrames.begin(); frameItr != mExplicitFrames.end(); ++frameItr )
- {
- // Grab the current pixelArea
- const FrameArea::PixelArea& pixelArea = *frameItr;
-
- // Check to see if the name matches the argument
- if (!dStrcmp(pixelArea.mRegionName, regionName))
- {
- // Found it, so erase it and return success
- mExplicitFrames.erase(frameItr);
- return true;
- }
- }
- // Didn't find it, so warn
- Con::warnf( "ImageAsset::removeExplicitCell() - Cannot find %s cell to remove.", regionName );
- return false;
- }
- //------------------------------------------------------------------------------
- ImageAsset::FrameArea& ImageAsset::getCellByName( const char* cellName)
- {
- // If the cellName was empty
- if (cellName == StringTable->EmptyString)
- {
- // Warn and return a bad frame
- Con::warnf( "ImageAsset::getCellByName() - Empty cell name was passed." );
- return BadFrameArea;
- }
-
- for( typeFrameAreaVector::iterator frameItr = mFrames.begin(); frameItr != mFrames.end(); ++frameItr )
- {
- // Grab the current pixelArea
- const FrameArea::PixelArea& pixelArea = frameItr->mPixelArea;
-
- // Check to see if the name matches the argument
- if (!dStrcmp(pixelArea.mRegionName, cellName))
- {
- // Found it, so erase it and return success
- return *frameItr;
- }
- }
- // Didn't find it, so warn and return a bad frame
- Con::warnf( "ImageAsset::getCellByName() - Cannot find %s cell.", cellName );
- return BadFrameArea;
- }
- //------------------------------------------------------------------------------
- void ImageAsset::setTextureFilter( const TextureFilterMode filterMode )
- {
- // Finish if no texture.
- if ( mImageTextureHandle.IsNull() )
- return;
- // Select Hardware Filter Mode.
- GLint glFilterMode;
- switch( filterMode )
- {
- // Nearest ("none").
- case FILTER_NEAREST:
- {
- glFilterMode = GL_NEAREST;
- } break;
- // Bilinear ("smooth").
- case FILTER_BILINEAR:
- {
- glFilterMode = GL_LINEAR;
- } break;
- // Huh?
- default:
- // Oh well...
- glFilterMode = GL_LINEAR;
- };
- // Set the texture objects filter mode.
- mImageTextureHandle.setFilter( glFilterMode );
- }
- //------------------------------------------------------------------------------
- void ImageAsset::initializeAsset( void )
- {
- // Call parent.
- Parent::initializeAsset();
- // Ensure the image-file is expanded.
- mImageFile = expandAssetFilePath( mImageFile );
- // Time to load the layer files too.
- for (auto& layer : mImageLayers)
- {
- const char* path = expandAssetFilePath(layer.mImageFile);
- layer.LoadImage(path);
- }
- // Calculate the image.
- calculateImage();
- // Redraw the image.
- redrawImage();
- }
- //------------------------------------------------------------------------------
- void ImageAsset::onAssetRefresh( void )
- {
- // Ignore if not yet added to the sim.
- if ( !isProperlyAdded() )
- return;
- // Call parent.
- Parent::onAssetRefresh();
-
- // Compile image.
- calculateImage();
- // Redraw the image.
- redrawImage();
- }
- //-----------------------------------------------------------------------------
- void ImageAsset::onTamlPreWrite( void )
- {
- // Call parent.
- Parent::onTamlPreWrite();
- // Ensure the image-file is collapsed.
- mImageFile = collapseAssetFilePath( mImageFile );
- }
- //-----------------------------------------------------------------------------
- void ImageAsset::onTamlPostWrite( void )
- {
- // Call parent.
- Parent::onTamlPostWrite();
- // Ensure the image-file is expanded.
- mImageFile = expandAssetFilePath( mImageFile );
- }
- //------------------------------------------------------------------------------
- void ImageAsset::calculateImage( void )
- {
- // Debug Profiling.
- PROFILE_SCOPE(ImageAsset_CalculateImage);
- // Clear frames.
- mFrames.clear();
- // If we have an existing texture and we're setting to the same bitmap then force the texture manager
- // to refresh the texture itself.
- if ( !mImageTextureHandle.IsNull() && dStricmp(mImageTextureHandle.getTextureKey(), mImageFile) == 0 )
- TextureManager::refresh( mImageFile );
- // Get image texture.
- mImageTextureHandle.set( mImageFile, mImageLayers.size() > 0 ? TextureHandle::BitmapKeepTexture : TextureHandle::BitmapTexture, true, getForce16Bit() );
- // Is the texture valid?
- if ( mImageTextureHandle.IsNull() )
- {
- // No, so warn.
- Con::warnf( "Image '%s' could not load texture '%s'.", getAssetId(), mImageFile );
- return;
- }
- // Is the local filter mode specified?
- if ( mLocalFilterMode != FILTER_INVALID )
- {
- // Yes, so set filter mode.
- setTextureFilter( mLocalFilterMode );
- }
- else
- {
- TextureFilterMode filterMode = FILTER_NEAREST;
- // No, so fetch the global filter.
- const char* pGlobalFilter = Con::getVariable( "$pref::T2D::imageAssetGlobalFilterMode" );
- // Fetch the global filter mode.
- if ( pGlobalFilter != NULL && dStrlen(pGlobalFilter) > 0 )
- filterMode = getFilterModeEnum( pGlobalFilter );
- // If global filter mode is invalid then use local filter mode.
- if ( filterMode == FILTER_INVALID )
- filterMode = FILTER_NEAREST;
- // Set filter mode.
- setTextureFilter( filterMode );
- }
- // Calculate according to mode.
- if ( mExplicitMode )
- {
- calculateExplicitMode();
- }
- else
- {
- calculateImplicitMode();
- }
- }
- //------------------------------------------------------------------------------
- void ImageAsset::calculateImplicitMode( void )
- {
- // Debug Profiling.
- PROFILE_SCOPE(ImageAsset_CalculateImplicitMode);
- // Sanity!
- AssertFatal( !mExplicitMode, "Cannot calculate implicit cells when in explicit mode." );
- // Fetch the texture object.
- TextureObject* pTextureObject = ((TextureObject*)mImageTextureHandle);
-
- // Calculate texel scales.
- const F32 texelWidthScale = 1.0f / (F32)pTextureObject->getTextureWidth();
- const F32 texelHeightScale = 1.0f / (F32)pTextureObject->getTextureHeight();
- // Fetch the original image dimensions.
- const S32 imageWidth = getImageWidth();
- const S32 imageHeight = getImageHeight();
- // Set full-frame as default.
- FrameArea frameArea( 0, 0, imageWidth, imageHeight, texelWidthScale, texelHeightScale );
- mFrames.push_back( frameArea );
- // Finish if no cell counts are specified. This is how we default to full-frame mode.
- if ( mCellCountX < 1 || mCellCountY < 1 )
- return;
- // The cell width needs to be at maximum the image width!
- if ( mCellWidth < 1 || mCellWidth > imageWidth )
- {
- // Warn.
- Con::warnf( "ImageAsset::calculateImage() - Invalid Cell Width of %d.", mCellWidth );
- return;
- }
- // The cell height needs to be at maximum the image height!
- if ( mCellHeight < 1 || mCellHeight > imageHeight )
- {
- // Warn.
- Con::warnf( "ImageAsset::calculateImage() - Invalid Cell Height of %d.", mCellHeight );
- return;
- }
- // The Cell Offset X needs to be within the image.
- if ( mCellOffsetX < 0 || mCellOffsetX >= imageWidth )
- {
- // Warn.
- Con::warnf( "ImageAsset::calculateImage() - Invalid Cell OffsetX of %d.", mCellOffsetX );
- return;
- }
- // The Cell Offset Y needs to be within the image.
- if ( mCellOffsetY < 0 || mCellOffsetY >= imageHeight )
- {
- // Warn.
- Con::warnf( "ImageAsset::calculateImage() - Invalid Cell OffsetY of %d.", mCellOffsetY );
- return;
- }
- // Are we using Cell-StrideX?
- S32 cellStepX;
- if ( mCellStrideX != 0 )
- {
- // Yes, so set stepX to be StrideX.
- cellStepX = mCellStrideX;
- }
- else
- {
- // No, so set stepY to be Cell Width.
- cellStepX = mCellWidth;
- }
- // Are we using Cell-StrideY?
- S32 cellStepY;
- if ( mCellStrideY != 0 )
- {
- // Yes, so set stepY to be StrideY.
- cellStepY = mCellStrideY;
- }
- else
- {
- // No, so set stepY to be Cell Height.
- cellStepY = mCellHeight;
- }
- // Calculate Final Cell Position X.
- S32 cellFinalPositionX = mCellOffsetX + ((mCellCountX-((cellStepX<0)?1:0))*cellStepX);
- // Off Left?
- if ( cellFinalPositionX < 0 )
- {
- // Warn.
- Con::warnf( "ImageAsset::calculateImage() - Invalid Cell OffsetX(%d)/Width(%d)/CountX(%d); off image left-hand-side.", mCellOffsetX, mCellWidth, mCellCountX );
- return;
- }
- // Off Right?
- else if ( cellFinalPositionX > imageWidth )
- {
- // Warn.
- Con::warnf( "ImageAsset::calculateImage() - Invalid Cell OffsetX(%d)/Width(%d)/CountX(%d); off image right-hand-side.", mCellOffsetX, mCellWidth, mCellCountX );
- return;
- }
- // Calculate Final Cell Position Y.
- S32 cellFinalPositionY = mCellOffsetY + ((mCellCountY-((cellStepY<0)?1:0))*cellStepY);
- // Off Top?
- if ( cellFinalPositionY < 0 )
- {
- // Warn.
- Con::warnf( "ImageAsset::calculateImage() - Invalid Cell OffsetY(%d)/Height(%d)/CountY(%d); off image top-side.", mCellOffsetY, mCellHeight, mCellCountY );
- return;
- }
- // Off Bottom?
- else if ( cellFinalPositionY > imageHeight )
- {
- // Warn.
- Con::warnf( "ImageAsset::calculateImage() - Invalid Cell OffsetY(%d)/Height(%d)/CountY(%d); off image bottom-side.", mCellOffsetY, mCellHeight, mCellCountY );
- return;
- }
- // Clear default frame.
- mFrames.clear();
- // Cell Row Order?
- if ( mCellRowOrder )
- {
- // Yes, so RowRow Order.
- for ( S32 y = 0, cellPositionY = mCellOffsetY; y < mCellCountY; y++, cellPositionY+=cellStepY )
- {
- for ( S32 x = 0, cellPositionX = mCellOffsetX; x < mCellCountX; x++, cellPositionX+=cellStepX )
- {
- // Set frame area.
- frameArea.setArea( cellPositionX, cellPositionY, mCellWidth, mCellHeight, texelWidthScale, texelHeightScale );
- // Store fame.
- mFrames.push_back( frameArea );
- }
- }
- return;
- }
- // No, so Column Order.
- for ( S32 x = 0, cellPositionX = mCellOffsetX; x < mCellCountX; x++, cellPositionX+=cellStepX )
- {
- for ( S32 y = 0, cellPositionY = mCellOffsetY; y < mCellCountY; y++, cellPositionY+=cellStepY )
- {
- // Set frame area.
- frameArea.setArea( cellPositionX, cellPositionY, mCellWidth, mCellHeight, texelWidthScale, texelHeightScale );
- // Store fame.
- mFrames.push_back( frameArea );
- }
- }
- }
- //------------------------------------------------------------------------------
- void ImageAsset::calculateExplicitMode( void )
- {
- // Debug Profiling.
- PROFILE_SCOPE(ImageAsset_CalculateExplicitMode);
- // Sanity!
- AssertFatal( mExplicitMode, "Cannot calculate explicit cells when not in explicit mode." );
- // Fetch the texture object.
- TextureObject* pTextureObject = ((TextureObject*)mImageTextureHandle);
-
- // Calculate texel scales.
- const F32 texelWidthScale = 1.0f / (F32)pTextureObject->getTextureWidth();
- const F32 texelHeightScale = 1.0f / (F32)pTextureObject->getTextureHeight();
- // Fetch the original image dimensions.
- const S32 imageWidth = getImageWidth();
- const S32 imageHeight = getImageHeight();
- // Clear default frame.
- mFrames.clear();
- // Are any explicit frames set.
- if ( mExplicitFrames.size() == 0 )
- {
- // No, so set full-frame as default.
- FrameArea frameArea( 0, 0, imageWidth, imageHeight, texelWidthScale, texelHeightScale );
- mFrames.push_back( frameArea );
- return;
- }
- // Iterate explicit frames.
- for( typeExplicitFrameAreaVector::iterator frameItr = mExplicitFrames.begin(); frameItr != mExplicitFrames.end(); ++frameItr )
- {
- // Fetch pixel area.
- const FrameArea::PixelArea& pixelArea = *frameItr;
- // Set frame area.
- FrameArea frameArea( pixelArea.mPixelOffset.x, pixelArea.mPixelOffset.y, pixelArea.mPixelWidth, pixelArea.mPixelHeight, texelWidthScale, texelHeightScale, pixelArea.mRegionName );
- // Store frame.
- mFrames.push_back( frameArea );
- }
- }
- void ImageAsset::completeLayerChange(const bool doRedraw)
- {
- if (doRedraw)
- {
- redrawImage();
- if (getOwned())
- {
- refreshAsset();
- }
- }
- }
- void ImageAsset::redrawImage()
- {
- if (mImageLayers.size() > 0)
- {
- GBitmap* map = mImageTextureHandle.getBitmap();
- if (map == nullptr)
- {
- // This should reload the texture and keep it in memory
- mImageTextureHandle.set(mImageFile, TextureHandle::BitmapKeepTexture, true, getForce16Bit());
- map = mImageTextureHandle.getBitmap();
- if (map == nullptr)
- {
- // We still can't come up with a bitmap, so warn and return
- Con::warnf("ImageAsset::redrawImage() - Unable to load bitmap for image '%s'.", mImageFile);
- return;
- }
- mImageLayers[0].LoadImage(mImageLayers[0].mImageFile);
- }
- map->clearImage(mBlendColor);
- for (auto &layer : mImageLayers)
- {
- map->mergeLayer(layer.mPosition, layer.mBitmap, layer.mBlendColor);
- }
- mImageTextureHandle.refresh();
- }
- }
- //------------------------------------------------------------------------------
- bool ImageAsset::setFilterMode( void* obj, const char* data )
- {
- static_cast<ImageAsset*>(obj)->setFilterMode(getFilterModeEnum(data));
- return false;
- }
- void ImageAsset::addLayer(const char* imagePath, const Point2I position, const ColorF blendColor, const bool doRedraw)
- {
- insertLayer(mImageLayers.size(), imagePath, position, blendColor, doRedraw);
- }
- void ImageAsset::insertLayer(const U32 index, const char* imagePath, const Point2I position, const ColorF blendColor, const bool doRedraw)
- {
- if (mImageLayers.size() == 0)
- {
- Point2I p(0, 0);
- ImageLayer baseLayer(mImageFile, p, mBlendColor);
- mImageLayers.push_back(baseLayer);
- if (getOwned())
- {
- baseLayer.LoadImage(mImageFile);
- }
- }
- ImageLayer layer(imagePath, position, blendColor);
- if (getOwned())
- {
- const char* path = expandAssetFilePath(layer.mImageFile);
- layer.LoadImage(path);
- }
- if (index == 0 || index >= mImageLayers.size())
- {
- mImageLayers.push_back(layer);
- }
- else
- {
- typeImageLayerVector::iterator iter = mImageLayers.begin() + index;
- mImageLayers.insert(iter, layer);
- }
- completeLayerChange(doRedraw);
- }
- void ImageAsset::removeLayer(const U32 index, const bool doRedraw)
- {
- if (index < 1 || index >= mImageLayers.size())
- {
- Con::warnf("ImageAsset::removeLayer() - Invalid Index of %d.", index);
- return;
- }
- mImageLayers.erase(index);
- if (mImageLayers.size() == 1)
- {
- mImageLayers.clear();
- }
- completeLayerChange(doRedraw);
- }
- void ImageAsset::moveLayerForward(const U32 index, const bool doRedraw)
- {
- if (index < 1 || index >= mImageLayers.size())
- {
- Con::warnf("ImageAsset::moveLayerForward() - Invalid Index of %d.", index);
- return;
- }
- if (index == mImageLayers.size() - 1)
- {
- return;
- }
- ImageLayer layer = mImageLayers[index];
- mImageLayers.erase(index);
- mImageLayers.insert(mImageLayers.begin() + index + 1, layer);
- completeLayerChange(doRedraw);
- }
- void ImageAsset::moveLayerBackward(const U32 index, const bool doRedraw)
- {
- if (index < 1 || index >= mImageLayers.size())
- {
- Con::warnf("ImageAsset::moveLayerBackward() - Invalid Index of %d.", index);
- return;
- }
- if (index == 1)
- {
- return;
- }
- moveLayerForward(index - 1, doRedraw);
- }
- void ImageAsset::moveLayerToFront(const U32 index, const bool doRedraw)
- {
- if (index < 1 || index >= mImageLayers.size())
- {
- Con::warnf("ImageAsset::moveLayerToFront() - Invalid Index of %d.", index);
- return;
- }
- if (index == mImageLayers.size() - 1)
- {
- return;
- }
- ImageLayer layer = mImageLayers[index];
- mImageLayers.erase(index);
- mImageLayers.push_back(layer);//The back of the array is the front of the image
- completeLayerChange(doRedraw);
- }
- void ImageAsset::moveLayerToBack(const U32 index, const bool doRedraw)
- {
- if (index < 1 || index >= mImageLayers.size())
- {
- Con::warnf("ImageAsset::moveLayerToBack() - Invalid Index of %d.", index);
- return;
- }
- if (index == 1)
- {
- return;
- }
- ImageLayer layer = mImageLayers[index];
- mImageLayers.erase(index);
- mImageLayers.insert(mImageLayers.begin() + 1, layer);//The front of the array is the back of the image
- completeLayerChange(doRedraw);
- }
- void ImageAsset::setLayerImage(const U32 index, const char* imagePath, const bool doRedraw)
- {
- if (index < 1 || index >= mImageLayers.size())
- {
- Con::warnf("ImageAsset::setLayerImage() - Invalid Index of %d.", index);
- return;
- }
- if (getOwned())
- {
- const char* path = expandAssetFilePath(imagePath);
- mImageLayers[index].mImageFile = StringTable->insert(imagePath);
- mImageLayers[index].LoadImage(path);
- }
- else
- {
- mImageLayers[index].mImageFile = StringTable->insert(imagePath);
- }
- completeLayerChange(doRedraw);
- }
- void ImageAsset::setLayerPosition(const U32 index, const Point2I position, const bool doRedraw)
- {
- if (index < 1 || index >= mImageLayers.size())
- {
- Con::warnf("ImageAsset::setLayerPosition() - Invalid Index of %d.", index);
- return;
- }
- mImageLayers[index].mPosition.set(position.x, position.y);
- completeLayerChange(doRedraw);
- }
- void ImageAsset::setLayerBlendColor(const U32 index, const ColorF blendColor, const bool doRedraw)
- {
- if (index < 1 || index >= mImageLayers.size())
- {
- Con::warnf("ImageAsset::setLayerBlendColor() - Invalid Index of %d.", index);
- return;
- }
- mImageLayers[index].mBlendColor.set(blendColor.red, blendColor.green, blendColor.blue, blendColor.alpha);
- completeLayerChange(doRedraw);
- }
- const char* ImageAsset::getLayerImage(const U32 index)
- {
- if (index < 1 || index >= mImageLayers.size())
- {
- Con::warnf("ImageAsset::getLayerImage() - Invalid Index of %d.", index);
- return StringTable->EmptyString;
- }
- return mImageLayers[index].mImageFile;
- }
- const Point2I ImageAsset::getLayerPosition(const U32 index)
- {
- if (index < 1 || index >= mImageLayers.size())
- {
- Con::warnf("ImageAsset::getLayerPosition() - Invalid Index of %d.", index);
- return Point2I();
- }
- return mImageLayers[index].mPosition;
- }
- const ColorF ImageAsset::getLayerBlendColor(const U32 index)
- {
- if (index < 1 || index >= mImageLayers.size())
- {
- Con::warnf("ImageAsset::getLayerBlendColor() - Invalid Index of %d.", index);
- return ColorF();
- }
- return mImageLayers[index].mBlendColor;
- }
- void ImageAsset::setBlendColor(const ColorF color, const bool doRedraw)
- {
- mBlendColor.set(color.red, color.green, color.blue, color.alpha);
- if (mImageLayers.size() == 0)
- {
- Con::warnf("ImageAsset::setBlendColor() - The ImageAsset blend color will not be applied if layers are not being used.");
- return;
- }
-
- mImageLayers[0].mBlendColor.set(color.red, color.green, color.blue, color.alpha);
- completeLayerChange(doRedraw);
- }
- const ColorF ImageAsset::getBlendColor()
- {
- return mBlendColor;
- }
- //------------------------------------------------------------------------------
- void ImageAsset::onTamlCustomWrite( TamlCustomNodes& customNodes )
- {
- // Debug Profiling.
- PROFILE_SCOPE(ImageAsset_OnTamlCustomWrite);
- // Call parent.
- Parent::onTamlCustomWrite( customNodes );
- if (mExplicitMode && mExplicitFrames.size() > 0)
- {
- // Add cell custom node.
- TamlCustomNode* pCustomCellNodes = customNodes.addNode( cellCustomNodeCellsName );
- // Iterate explicit frames.
- for( typeExplicitFrameAreaVector::iterator frameItr = mExplicitFrames.begin(); frameItr != mExplicitFrames.end(); ++frameItr )
- {
- // Fetch pixel area.
- const FrameArea::PixelArea& pixelArea = *frameItr;
- // Add cell alias.
- TamlCustomNode* pCellNode = pCustomCellNodes->addNode( cellNodeName );
- // Add cell properties.
- pCellNode->addField( cellRegionName, pixelArea.mRegionName );
- pCellNode->addField( cellOffsetName, pixelArea.mPixelOffset );
- pCellNode->addField( cellWidthName, pixelArea.mPixelWidth );
- pCellNode->addField( cellHeightName, pixelArea.mPixelHeight );
- }
- }
- if (mImageLayers.size() > 0)
- {
- TamlCustomNode* pCustomLayerNodes = customNodes.addNode(imageLayerCustomNodeName);
- for (typeImageLayerVector::iterator frameItr = mImageLayers.begin() + 1; frameItr != mImageLayers.end(); ++frameItr)
- {
- const ImageLayer& layer = *frameItr;
- TamlCustomNode* pLayerNode = pCustomLayerNodes->addNode(layerNodeName);
- pLayerNode->addField(layerImageFile, layer.mImageFile);
- pLayerNode->addField(layerPositionName, layer.mPosition);
- pLayerNode->addField(layerBlendColorName, layer.mBlendColor);
- }
- }
- }
- //-----------------------------------------------------------------------------
- void ImageAsset::onTamlCustomRead(const TamlCustomNodes& customNodes)
- {
- // Debug Profiling.
- PROFILE_SCOPE(ImageAsset_OnTamlCustomRead);
- // Call parent.
- Parent::onTamlCustomRead(customNodes);
- // Load the explicit cells
- loadTamlExplicitCells(customNodes);
- // Load image layers
- loadTamlImageLayers(customNodes);
- }
- void ImageAsset::loadTamlExplicitCells(const TamlCustomNodes& customNodes)
- {
- // Find cell custom node.
- const TamlCustomNode* pCustomCellNodes = customNodes.findNode( cellCustomNodeCellsName );
-
- // Continue if we have explicit cells.
- if ( pCustomCellNodes != NULL )
- {
- // Set explicit mode.
- mExplicitMode = true;
-
- // Fetch children cell nodes.
- const TamlCustomNodeVector& cellNodes = pCustomCellNodes->getChildren();
-
- // Iterate cells.
- for( TamlCustomNodeVector::const_iterator cellNodeItr = cellNodes.begin(); cellNodeItr != cellNodes.end(); ++cellNodeItr )
- {
- // Fetch cell node.
- TamlCustomNode* pCellNode = *cellNodeItr;
-
- // Fetch node name.
- StringTableEntry nodeName = pCellNode->getNodeName();
-
- // Is this a valid alias?
- if ( nodeName != cellNodeName )
- {
- // No, so warn.
- Con::warnf( "ImageAsset::onTamlCustomRead() - Encountered an unknown custom name of '%s'. Only '%s' is valid.", nodeName, cellNodeName );
- continue;
- }
-
- Point2I cellOffset(-1, -1);
- S32 cellWidth = 0;
- S32 cellHeight = 0;
- const char* regionName = StringTable->EmptyString;
-
- // Fetch fields.
- const TamlCustomFieldVector& fields = pCellNode->getFields();
-
- // Iterate property fields.
- for ( TamlCustomFieldVector::const_iterator fieldItr = fields.begin(); fieldItr != fields.end(); ++fieldItr )
- {
- // Fetch field.
- const TamlCustomField* pField = *fieldItr;
-
- // Fetch field name.
- StringTableEntry fieldName = pField->getFieldName();
-
- // Check common fields.
- if ( fieldName == cellRegionName )
- {
- regionName = pField->getFieldValue();
- }
- else if ( fieldName == cellOffsetName )
- {
- pField->getFieldValue( cellOffset );
- }
- else if ( fieldName == cellOffsetXName )
- {
- pField->getFieldValue( cellOffset.x );
- }
- else if ( fieldName == cellOffsetYName )
- {
- pField->getFieldValue( cellOffset.y );
- }
- else if ( fieldName == cellWidthName )
- {
- pField->getFieldValue( cellWidth );
- }
- else if ( fieldName == cellHeightName )
- {
- pField->getFieldValue( cellHeight );
- }
- else
- {
- // Unknown name so warn.
- Con::warnf( "ImageAsset::onTamlCustomRead() - Encountered an unknown custom field name of '%s'.", fieldName );
- continue;
- }
- }
-
- // Does the region have a name
- if ( regionName == StringTable->EmptyString )
- {
- // No, so warn and set it to the next index
- Con::warnf( "ImageAsset::onTamlCustomRead() - Cell name of '%s' is invalid or was not set.", regionName );
-
- U32 currentIndex = mExplicitFrames.size();
- Con::warnf( "- Setting to the next index in the frame list: '%i'", currentIndex );
-
- dSscanf(regionName, "%i", currentIndex);
- }
-
- // Is cell offset valid?
- if ( cellOffset.x < 0 || cellOffset.y < 0 )
- {
- // No, so warn.
- Con::warnf( "ImageAsset::onTamlCustomRead() - Cell offset of '(%d,%d)' is invalid or was not set.", cellOffset.x, cellOffset.y );
- continue;
- }
-
- // Is cell width valid?
- if ( cellWidth <= 0 )
- {
- // No, so warn.
- Con::warnf( "ImageAsset::onTamlCustomRead() - Cell width of '%d' is invalid or was not set.", cellWidth );
- continue;
- }
-
- // Is cell height valid?
- if ( cellHeight <= 0 )
- {
- // No, so warn.
- Con::warnf( "ImageAsset::onTamlCustomRead() - Cell height of '%d' is invalid or was not set.", cellHeight );
- continue;
- }
-
- // Add explicit frame.
- FrameArea::PixelArea pixelArea( cellOffset.x, cellOffset.y, cellWidth, cellHeight, regionName );
- mExplicitFrames.push_back( pixelArea );
- }
- }
- }
- void ImageAsset::loadTamlImageLayers(const TamlCustomNodes& customNodes)
- {
- // Find layer custom node.
- const TamlCustomNode* pCustomLayerNodes = customNodes.findNode(imageLayerCustomNodeName);
- // Continue if we have explicit layers.
- if (pCustomLayerNodes != NULL)
- {
- // Fetch children layer nodes.
- const TamlCustomNodeVector& layerNodes = pCustomLayerNodes->getChildren();
- // Iterate layers.
- for (TamlCustomNodeVector::const_iterator layerNodeItr = layerNodes.begin(); layerNodeItr != layerNodes.end(); ++layerNodeItr)
- {
- // Fetch layer node.
- TamlCustomNode* pLayerNode = *layerNodeItr;
- // Fetch node name.
- StringTableEntry nodeName = pLayerNode->getNodeName();
- // Is this a valid alias?
- if (nodeName != layerNodeName)
- {
- // No, so warn.
- Con::warnf("ImageAsset::onTamlCustomRead() - Encountered an unknown custom name of '%s'. Only '%s' is valid.", nodeName, layerNodeName);
- continue;
- }
- Point2I layerPosition(0, 0);
- const char* imagePath = StringTable->EmptyString;
- ColorF blendColor = ColorF(1, 1, 1, 1);
- // Fetch fields.
- const TamlCustomFieldVector& fields = pLayerNode->getFields();
- // Iterate property fields.
- for (TamlCustomFieldVector::const_iterator fieldItr = fields.begin(); fieldItr != fields.end(); ++fieldItr)
- {
- // Fetch field.
- const TamlCustomField* pField = *fieldItr;
- // Fetch field name.
- StringTableEntry fieldName = pField->getFieldName();
- // Check common fields.
- if (fieldName == layerImageFile)
- {
- imagePath = pField->getFieldValue();
- }
- else if (fieldName == layerPositionName)
- {
- pField->getFieldValue(layerPosition);
- }
- else if (fieldName == layerBlendColorName)
- {
- pField->getFieldValue(blendColor);
- }
- else
- {
- // Unknown name so warn.
- Con::warnf("ImageAsset::onTamlCustomRead() - Encountered an unknown custom field name of '%s'.", fieldName);
- continue;
- }
- }
- // Is the image name valid?
- if (imagePath == StringTable->EmptyString)
- {
- // No, so warn
- Con::warnf("ImageAsset::onTamlCustomRead() - Image File of '%s' is invalid or was not set.", imagePath);
- }
- // Add image layer.
- addLayer(imagePath, layerPosition, blendColor, false);
- }
- }
- }
- //-----------------------------------------------------------------------------
- static void WriteCustomTamlSchema( const AbstractClassRep* pClassRep, TiXmlElement* pParentElement )
- {
- // Sanity!
- AssertFatal( pClassRep != NULL, "ImageAsset::WriteCustomTamlSchema() - ClassRep cannot be NULL." );
- AssertFatal( pParentElement != NULL, "ImageAsset::WriteCustomTamlSchema() - Parent Element cannot be NULL." );
- char buffer[1024];
- //---Cells---
- // Create ImageAsset node element.
- TiXmlElement* pImageAssetNodeElement = new TiXmlElement( "xs:element" );
- dSprintf( buffer, sizeof(buffer), "%s.%s", pClassRep->getClassName(), cellCustomNodeCellsName );
- pImageAssetNodeElement->SetAttribute( "name", buffer );
- pImageAssetNodeElement->SetAttribute( "minOccurs", 0 );
- pImageAssetNodeElement->SetAttribute( "maxOccurs", 1 );
- pParentElement->LinkEndChild( pImageAssetNodeElement );
- // Create complex type.
- TiXmlElement* pImageAssetNodeComplexTypeElement = new TiXmlElement( "xs:complexType" );
- pImageAssetNodeElement->LinkEndChild( pImageAssetNodeComplexTypeElement );
-
- // Create choice element.
- TiXmlElement* pImageAssetNodeChoiceElement = new TiXmlElement( "xs:choice" );
- pImageAssetNodeChoiceElement->SetAttribute( "minOccurs", 0 );
- pImageAssetNodeChoiceElement->SetAttribute( "maxOccurs", "unbounded" );
- pImageAssetNodeComplexTypeElement->LinkEndChild( pImageAssetNodeChoiceElement );
- // Create ImageAsset element.
- TiXmlElement* pImageAssetElement = new TiXmlElement( "xs:element" );
- pImageAssetElement->SetAttribute( "name", cellNodeName );
- pImageAssetElement->SetAttribute( "minOccurs", 0 );
- pImageAssetElement->SetAttribute( "maxOccurs", 1 );
- pImageAssetNodeChoiceElement->LinkEndChild( pImageAssetElement );
- // Create complex type Element.
- TiXmlElement* pImageAssetComplexTypeElement = new TiXmlElement( "xs:complexType" );
- pImageAssetElement->LinkEndChild( pImageAssetComplexTypeElement );
- // Create "RegionName" attribute.
- TiXmlElement* pImageRegionName = new TiXmlElement( "xs:attribute" );
- pImageRegionName->SetAttribute( "name", cellRegionName );
- pImageRegionName->SetAttribute( "type", "xs:string" );
- pImageAssetComplexTypeElement->LinkEndChild( pImageRegionName );
-
- // Create "Offset" attribute.
- TiXmlElement* pImageAssetOffset = new TiXmlElement( "xs:attribute" );
- pImageAssetOffset->SetAttribute( "name", cellOffsetName );
- pImageAssetOffset->SetAttribute( "type", "Point2I_ConsoleType" );
- pImageAssetComplexTypeElement->LinkEndChild( pImageAssetOffset );
- // Create "Width" attribute.
- TiXmlElement* pImageAssetWidth = new TiXmlElement( "xs:attribute" );
- pImageAssetWidth->SetAttribute( "name", cellWidthName );
- pImageAssetWidth->SetAttribute( "type", "xs:unsignedInt" );
- pImageAssetComplexTypeElement->LinkEndChild( pImageAssetWidth );
- // Create "Height" attribute.
- TiXmlElement* pImageAssetHeight = new TiXmlElement( "xs:attribute" );
- pImageAssetHeight->SetAttribute( "name", cellHeightName );
- pImageAssetHeight->SetAttribute( "type", "xs:unsignedInt" );
- pImageAssetComplexTypeElement->LinkEndChild( pImageAssetHeight );
- //---Layers---
- char buffer2[1024];
- // Create ImageAsset node element.
- TiXmlElement* pImageAssetNodeElementL = new TiXmlElement("xs:element");
- dSprintf(buffer, sizeof(buffer2), "%s.%s", pClassRep->getClassName(), imageLayerCustomNodeName);
- pImageAssetNodeElementL->SetAttribute("name", buffer2);
- pImageAssetNodeElementL->SetAttribute("minOccurs", 0);
- pImageAssetNodeElementL->SetAttribute("maxOccurs", 1);
- pParentElement->LinkEndChild(pImageAssetNodeElementL);
- // Create complex type.
- TiXmlElement* pImageAssetNodeComplexTypeElementL = new TiXmlElement("xs:complexType");
- pImageAssetNodeElementL->LinkEndChild(pImageAssetNodeComplexTypeElementL);
- // Create choice element.
- TiXmlElement* pImageAssetNodeChoiceElementL = new TiXmlElement("xs:choice");
- pImageAssetNodeChoiceElementL->SetAttribute("minOccurs", 0);
- pImageAssetNodeChoiceElementL->SetAttribute("maxOccurs", "unbounded");
- pImageAssetNodeComplexTypeElementL->LinkEndChild(pImageAssetNodeChoiceElementL);
- // Create ImageAsset element.
- TiXmlElement* pImageAssetElementL = new TiXmlElement("xs:element");
- pImageAssetElementL->SetAttribute("name", layerNodeName);
- pImageAssetElementL->SetAttribute("minOccurs", 0);
- pImageAssetElementL->SetAttribute("maxOccurs", 1);
- pImageAssetNodeChoiceElementL->LinkEndChild(pImageAssetElementL);
- // Create complex type Element.
- TiXmlElement* pImageAssetComplexTypeElementL = new TiXmlElement("xs:complexType");
- pImageAssetElementL->LinkEndChild(pImageAssetComplexTypeElementL);
- // Create "ImageFile" attribute.
- TiXmlElement* pLayerImageFile = new TiXmlElement("xs:attribute");
- pLayerImageFile->SetAttribute("name", layerImageFile);
- pLayerImageFile->SetAttribute("type", "xs:string");
- pImageAssetComplexTypeElementL->LinkEndChild(pLayerImageFile);
- // Create "Position" attribute.
- TiXmlElement* pLayerPosition = new TiXmlElement("xs:attribute");
- pLayerPosition->SetAttribute("name", layerPositionName);
- pLayerPosition->SetAttribute("type", "Point2I_ConsoleType");
- pImageAssetComplexTypeElementL->LinkEndChild(pLayerPosition);
- // Create "BlendColor" attribute.
- TiXmlElement* pLayerBlendColor = new TiXmlElement("xs:attribute");
- pLayerBlendColor->SetAttribute("name", layerBlendColorName);
- pLayerBlendColor->SetAttribute("type", "ColorF_ConsoleType");
- pImageAssetComplexTypeElementL->LinkEndChild(pLayerBlendColor);
- }
- //------------------------------------------------------------------------------
- IMPLEMENT_CONOBJECT_SCHEMA(ImageAsset, WriteCustomTamlSchema);
|