assetFieldTypes.cpp
Engine/source/assets/assetFieldTypes.cpp
Public Variables
Public Functions
ConsoleGetType(TypeAssetLooseFilePath )
ConsoleSetType(TypeAssetLooseFilePath )
ConsoleType(assetLooseFilePath , TypeAssetLooseFilePath , String , ASSET_LOOSE_FILE_FIELD_PREFIX )
Detailed Description
Public Variables
StringTableEntry assetLooseFileSignature
StringTableEntry assetLooseIdSignature
String
TypeAssetId
Public Functions
ConsoleGetType(TypeAssetId )
ConsoleGetType(TypeAssetLooseFilePath )
ConsoleSetType(TypeAssetId )
ConsoleSetType(TypeAssetLooseFilePath )
ConsoleType(assetLooseFilePath , TypeAssetLooseFilePath , String , ASSET_LOOSE_FILE_FIELD_PREFIX )
1 2//----------------------------------------------------------------------------- 3// Copyright (c) 2013 GarageGames, LLC 4// 5// Permission is hereby granted, free of charge, to any person obtaining a copy 6// of this software and associated documentation files (the "Software"), to 7// deal in the Software without restriction, including without limitation the 8// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 9// sell copies of the Software, and to permit persons to whom the Software is 10// furnished to do so, subject to the following conditions: 11// 12// The above copyright notice and this permission notice shall be included in 13// all copies or substantial portions of the Software. 14// 15// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 20// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 21// IN THE SOFTWARE. 22//----------------------------------------------------------------------------- 23 24#ifndef _ASSET_FIELD_TYPES_H_ 25#include "assetFieldTypes.h" 26#endif 27 28#ifndef _ASSET_PTR_H_ 29#include "assetPtr.h" 30#endif 31 32#ifndef _ASSET_BASE_H_ 33#include "assetBase.h" 34#endif 35 36/*#ifndef _AUDIO_ASSET_H_ 37#include "audio/AudioAsset.h" 38#endif*/ 39 40#ifndef _STRINGUNIT_H_ 41#include "string/stringUnit.h" 42#endif 43 44//----------------------------------------------------------------------------- 45 46StringTableEntry assetLooseIdSignature = StringTable->insert( ASSET_ID_SIGNATURE ); 47StringTableEntry assetLooseFileSignature = StringTable->insert( ASSET_LOOSEFILE_SIGNATURE ); 48 49//----------------------------------------------------------------------------- 50 51ConsoleType( assetLooseFilePath, TypeAssetLooseFilePath, String, ASSET_LOOSE_FILE_FIELD_PREFIX ) 52ConsoleType(assetIdString, TypeAssetId, String, ASSET_ID_FIELD_PREFIX) 53 54//----------------------------------------------------------------------------- 55 56ConsoleGetType( TypeAssetLooseFilePath ) 57{ 58 // Fetch asset loose file-path. 59 return *((StringTableEntry*)dptr); 60} 61 62//----------------------------------------------------------------------------- 63 64ConsoleSetType( TypeAssetLooseFilePath ) 65{ 66 // Was a single argument specified? 67 if( argc == 1 ) 68 { 69 // Yes, so fetch field value. 70 const char* pFieldValue = argv[0]; 71 72 // Fetch asset loose file-path. 73 StringTableEntry* assetLooseFilePath = (StringTableEntry*)(dptr); 74 75 // Update asset loose file-path value. 76 *assetLooseFilePath = StringTable->insert(pFieldValue); 77 78 return; 79 } 80 81 // Warn. 82 Con::warnf( "(TypeAssetLooseFilePath) - Cannot set multiple args to a single asset loose-file." ); 83} 84 85//----------------------------------------------------------------------------- 86 87ConsoleGetType( TypeAssetId ) 88{ 89 // Fetch asset Id. 90 return *((StringTableEntry*)dptr); 91} 92 93//----------------------------------------------------------------------------- 94 95ConsoleSetType( TypeAssetId ) 96{ 97 // Was a single argument specified? 98 if( argc == 1 ) 99 { 100 // Yes, so fetch field value. 101 const char* pFieldValue = argv[0]; 102 103 // Fetch asset Id. 104 StringTableEntry* assetId = (StringTableEntry*)(dptr); 105 106 // Update asset value. 107 *assetId = StringTable->insert(pFieldValue); 108 109 return; 110 } 111 112 // Warn. 113 Con::warnf( "(TypeAssetId) - Cannot set multiple args to a single asset." ); 114} 115 116