ShapeAsset.cpp 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630
  1. //-----------------------------------------------------------------------------
  2. // Copyright (c) 2013 GarageGames, LLC
  3. //
  4. // Permission is hereby granted, free of charge, to any person obtaining a copy
  5. // of this software and associated documentation files (the "Software"), to
  6. // deal in the Software without restriction, including without limitation the
  7. // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
  8. // sell copies of the Software, and to permit persons to whom the Software is
  9. // furnished to do so, subject to the following conditions:
  10. //
  11. // The above copyright notice and this permission notice shall be included in
  12. // all copies or substantial portions of the Software.
  13. //
  14. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18. // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  19. // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
  20. // IN THE SOFTWARE.
  21. //-----------------------------------------------------------------------------
  22. #ifndef _SHAPE_ASSET_H_
  23. #include "ShapeAsset.h"
  24. #endif
  25. #ifndef _ASSET_MANAGER_H_
  26. #include "assets/assetManager.h"
  27. #endif
  28. #ifndef _CONSOLETYPES_H_
  29. #include "console/consoleTypes.h"
  30. #endif
  31. #ifndef _TAML_
  32. #include "persistence/taml/taml.h"
  33. #endif
  34. #ifndef _ASSET_PTR_H_
  35. #include "assets/assetPtr.h"
  36. #endif
  37. #include "core/resourceManager.h"
  38. // Debug Profiling.
  39. #include "platform/profiler.h"
  40. #include "T3D/assets/assetImporter.h"
  41. //-----------------------------------------------------------------------------
  42. IMPLEMENT_CONOBJECT(ShapeAsset);
  43. ConsoleType(assetIdString, TypeShapeAssetPtr, String, ASSET_ID_FIELD_PREFIX)
  44. ConsoleGetType(TypeShapeAssetPtr)
  45. {
  46. // Fetch asset Id.
  47. //return *((StringTableEntry*)dptr);
  48. return (*((AssetPtr<ShapeAsset>*)dptr)).getAssetId();
  49. }
  50. ConsoleSetType(TypeShapeAssetPtr)
  51. {
  52. // Was a single argument specified?
  53. if (argc == 1)
  54. {
  55. // Yes, so fetch field value.
  56. const char* pFieldValue = argv[0];
  57. // Fetch asset Id.
  58. StringTableEntry* assetId = (StringTableEntry*)(dptr);
  59. // Update asset value.
  60. *assetId = StringTable->insert(pFieldValue);
  61. return;
  62. }
  63. // Warn.
  64. Con::warnf("(TypeAssetId) - Cannot set multiple args to a single asset.");
  65. }
  66. //-----------------------------------------------------------------------------
  67. ConsoleType(assetIdString, TypeShapeAssetId, String, ASSET_ID_FIELD_PREFIX)
  68. ConsoleGetType(TypeShapeAssetId)
  69. {
  70. // Fetch asset Id.
  71. return *((const char**)(dptr));
  72. }
  73. ConsoleSetType(TypeShapeAssetId)
  74. {
  75. // Was a single argument specified?
  76. if (argc == 1)
  77. {
  78. // Yes, so fetch field value.
  79. const char* pFieldValue = argv[0];
  80. // Fetch asset Id.
  81. StringTableEntry* assetId = (StringTableEntry*)(dptr);
  82. // Update asset value.
  83. *assetId = StringTable->insert(pFieldValue);
  84. return;
  85. }
  86. // Warn.
  87. Con::warnf("(TypeAssetId) - Cannot set multiple args to a single asset.");
  88. }
  89. //-----------------------------------------------------------------------------
  90. const String ShapeAsset::mErrCodeStrings[] =
  91. {
  92. "TooManyVerts",
  93. "TooManyBones",
  94. "MissingAnimatons",
  95. "UnKnown"
  96. };
  97. //-----------------------------------------------------------------------------
  98. ShapeAsset::ShapeAsset()
  99. {
  100. mFileName = StringTable->EmptyString();
  101. mConstructorFileName = StringTable->EmptyString();
  102. mFilePath = StringTable->EmptyString();
  103. mConstructorFilePath = StringTable->EmptyString();
  104. mLoadedState = AssetErrCode::NotLoaded;
  105. }
  106. //-----------------------------------------------------------------------------
  107. ShapeAsset::~ShapeAsset()
  108. {
  109. }
  110. //-----------------------------------------------------------------------------
  111. void ShapeAsset::initPersistFields()
  112. {
  113. // Call parent.
  114. Parent::initPersistFields();
  115. addProtectedField("fileName", TypeAssetLooseFilePath, Offset(mFileName, ShapeAsset),
  116. &setShapeFile, &getShapeFile, "Path to the shape file we want to render");
  117. addProtectedField("constuctorFileName", TypeAssetLooseFilePath, Offset(mConstructorFileName, ShapeAsset),
  118. &setShapeConstructorFile, &getShapeConstructorFile, "Path to the shape file we want to render");
  119. }
  120. void ShapeAsset::setDataField(StringTableEntry slotName, const char *array, const char *value)
  121. {
  122. Parent::setDataField(slotName, array, value);
  123. //Now, if it's a material slot of some fashion, set it up
  124. StringTableEntry matSlotName = StringTable->insert("materialAsset");
  125. if (String(slotName).startsWith(matSlotName))
  126. {
  127. StringTableEntry matId = StringTable->insert(value);
  128. mMaterialAssetIds.push_back(matId);
  129. }
  130. }
  131. void ShapeAsset::initializeAsset()
  132. {
  133. // Call parent.
  134. Parent::initializeAsset();
  135. if (mFileName == StringTable->EmptyString())
  136. return;
  137. ResourceManager::get().getChangedSignal().notify(this, &ShapeAsset::_onResourceChanged);
  138. //Ensure our path is expando'd if it isn't already
  139. if (!Platform::isFullPath(mFilePath))
  140. mFilePath = getOwned() ? expandAssetFilePath(mFileName) : mFilePath;
  141. mConstructorFilePath = expandAssetFilePath(mConstructorFilePath);
  142. loadShape();
  143. }
  144. void ShapeAsset::setShapeFile(const char* pShapeFile)
  145. {
  146. // Sanity!
  147. AssertFatal(pShapeFile != NULL, "Cannot use a NULL shape file.");
  148. // Fetch image file.
  149. pShapeFile = StringTable->insert(pShapeFile);
  150. // Ignore no change,
  151. if (pShapeFile == mFileName)
  152. return;
  153. mFileName = pShapeFile;
  154. // Refresh the asset.
  155. refreshAsset();
  156. }
  157. void ShapeAsset::setShapeConstructorFile(const char* pShapeConstructorFile)
  158. {
  159. // Sanity!
  160. AssertFatal(pShapeConstructorFile != NULL, "Cannot use a NULL shape constructor file.");
  161. // Fetch image file.
  162. pShapeConstructorFile = StringTable->insert(pShapeConstructorFile);
  163. // Ignore no change,
  164. if (pShapeConstructorFile == mConstructorFileName)
  165. return;
  166. mConstructorFileName = pShapeConstructorFile;
  167. // Refresh the asset.
  168. refreshAsset();
  169. }
  170. void ShapeAsset::_onResourceChanged(const Torque::Path &path)
  171. {
  172. if (path != Torque::Path(mFilePath) )
  173. return;
  174. refreshAsset();
  175. loadShape();
  176. }
  177. bool ShapeAsset::loadShape()
  178. {
  179. mMaterialAssets.clear();
  180. mMaterialAssetIds.clear();
  181. //First, load any material, animation, etc assets we may be referencing in our asset
  182. // Find any asset dependencies.
  183. AssetManager::typeAssetDependsOnHash::Iterator assetDependenciesItr = mpOwningAssetManager->getDependedOnAssets()->find(mpAssetDefinition->mAssetId);
  184. // Does the asset have any dependencies?
  185. if (assetDependenciesItr != mpOwningAssetManager->getDependedOnAssets()->end())
  186. {
  187. // Iterate all dependencies.
  188. while (assetDependenciesItr != mpOwningAssetManager->getDependedOnAssets()->end() && assetDependenciesItr->key == mpAssetDefinition->mAssetId)
  189. {
  190. StringTableEntry assetType = mpOwningAssetManager->getAssetType(assetDependenciesItr->value);
  191. if (assetType == StringTable->insert("MaterialAsset"))
  192. {
  193. mMaterialAssetIds.push_front(assetDependenciesItr->value);
  194. //Force the asset to become initialized if it hasn't been already
  195. AssetPtr<MaterialAsset> matAsset = assetDependenciesItr->value;
  196. mMaterialAssets.push_front(matAsset);
  197. }
  198. else if (assetType == StringTable->insert("ShapeAnimationAsset"))
  199. {
  200. mAnimationAssetIds.push_back(assetDependenciesItr->value);
  201. //Force the asset to become initialized if it hasn't been already
  202. AssetPtr<ShapeAnimationAsset> animAsset = assetDependenciesItr->value;
  203. mAnimationAssets.push_back(animAsset);
  204. }
  205. // Next dependency.
  206. assetDependenciesItr++;
  207. }
  208. }
  209. mShape = ResourceManager::get().load(mFilePath);
  210. if (!mShape)
  211. {
  212. Con::errorf("ShapeAsset::loadShape : failed to load shape file!");
  213. mLoadedState = BadFileReference;
  214. return false; //if it failed to load, bail out
  215. }
  216. bool hasBlends = false;
  217. //Now that we've successfully loaded our shape and have any materials and animations loaded
  218. //we need to set up the animations we're using on our shape
  219. for (S32 i = mAnimationAssets.size()-1; i >= 0; --i)
  220. {
  221. String srcName = mAnimationAssets[i]->getAnimationName();
  222. String srcPath(mAnimationAssets[i]->getAnimationFilename());
  223. //SplitSequencePathAndName(srcPath, srcName);
  224. if (!mShape->addSequence(srcPath, srcName, srcName,
  225. mAnimationAssets[i]->getStartFrame(), mAnimationAssets[i]->getEndFrame(), mAnimationAssets[i]->getPadRotation(), mAnimationAssets[i]->getPadTransforms()))
  226. {
  227. mLoadedState = MissingAnimatons;
  228. return false;
  229. }
  230. if (mAnimationAssets[i]->isBlend())
  231. hasBlends = true;
  232. }
  233. //if any of our animations are blends, set those up now
  234. if (hasBlends)
  235. {
  236. for (U32 i=0; i < mAnimationAssets.size(); ++i)
  237. {
  238. if (mAnimationAssets[i]->isBlend() && mAnimationAssets[i]->getBlendAnimationName() != StringTable->EmptyString())
  239. {
  240. //gotta do a bit of logic here.
  241. //First, we need to make sure the anim asset we depend on for our blend is loaded
  242. AssetPtr<ShapeAnimationAsset> blendAnimAsset = mAnimationAssets[i]->getBlendAnimationName();
  243. if (blendAnimAsset.isNull())
  244. {
  245. Con::errorf("ShapeAsset::initializeAsset - Unable to acquire reference animation asset %s for asset %s to blend!", mAnimationAssets[i]->getBlendAnimationName(), mAnimationAssets[i]->getAssetName());
  246. {
  247. mLoadedState = MissingAnimatons;
  248. return false;
  249. }
  250. }
  251. String refAnimName = blendAnimAsset->getAnimationName();
  252. if (!mShape->setSequenceBlend(mAnimationAssets[i]->getAnimationName(), true, blendAnimAsset->getAnimationName(), mAnimationAssets[i]->getBlendFrame()))
  253. {
  254. Con::errorf("ShapeAnimationAsset::initializeAsset - Unable to set animation clip %s for asset %s to blend!", mAnimationAssets[i]->getAnimationName(), mAnimationAssets[i]->getAssetName());
  255. {
  256. mLoadedState = MissingAnimatons;
  257. return false;
  258. }
  259. }
  260. }
  261. }
  262. }
  263. mChangeSignal.trigger();
  264. mLoadedState = Ok;
  265. return true;
  266. }
  267. //------------------------------------------------------------------------------
  268. //Utility function to 'fill out' bindings and resources with a matching asset if one exists
  269. bool ShapeAsset::getAssetByFilename(StringTableEntry fileName, AssetPtr<ShapeAsset>* shapeAsset)
  270. {
  271. AssetQuery query;
  272. S32 foundAssetcount = AssetDatabase.findAssetLooseFile(&query, fileName);
  273. if (foundAssetcount == 0)
  274. {
  275. //Didn't find any assets
  276. //If possible, see if we can run an in-place import and the get the asset from that
  277. #if TORQUE_DEBUG
  278. Con::warnf("ShapeAsset::getAssetByFilename - Attempted to in-place import a shapefile(%s) that had no associated asset", fileName);
  279. #endif
  280. AssetImporter* autoAssetImporter;
  281. if (!Sim::findObject("autoAssetImporter", autoAssetImporter))
  282. {
  283. autoAssetImporter = new AssetImporter();
  284. autoAssetImporter->registerObject("autoAssetImporter");
  285. }
  286. StringTableEntry resultingAssetId = autoAssetImporter->autoImportFile(fileName);
  287. if (resultingAssetId != StringTable->EmptyString())
  288. {
  289. shapeAsset->setAssetId(resultingAssetId);
  290. if (!shapeAsset->isNull())
  291. return true;
  292. }
  293. //Didn't work, so have us fall back to a placeholder asset
  294. shapeAsset->setAssetId(StringTable->insert("Core_Rendering:noshape"));
  295. if (!shapeAsset->isNull())
  296. return true;
  297. //That didn't work, so fail out
  298. return false;
  299. }
  300. else
  301. {
  302. //acquire and bind the asset, and return it out
  303. shapeAsset->setAssetId(query.mAssetList[0]);
  304. return true;
  305. }
  306. }
  307. StringTableEntry ShapeAsset::getAssetIdByFilename(StringTableEntry fileName)
  308. {
  309. if (fileName == StringTable->EmptyString())
  310. return StringTable->EmptyString();
  311. StringTableEntry shapeAssetId = StringTable->EmptyString();
  312. AssetQuery query;
  313. S32 foundAssetcount = AssetDatabase.findAssetLooseFile(&query, fileName);
  314. if (foundAssetcount == 0)
  315. {
  316. //Didn't find any assets
  317. //If possible, see if we can run an in-place import and the get the asset from that
  318. #if TORQUE_DEBUG
  319. Con::warnf("ShapeAsset::getAssetByFilename - Attempted to in-place import a shapefile(%s) that had no associated asset", fileName);
  320. #endif
  321. AssetImporter* autoAssetImporter;
  322. if (!Sim::findObject("autoAssetImporter", autoAssetImporter))
  323. {
  324. autoAssetImporter = new AssetImporter();
  325. autoAssetImporter->registerObject("autoAssetImporter");
  326. }
  327. StringTableEntry resultingAssetId = autoAssetImporter->autoImportFile(fileName);
  328. if (resultingAssetId != StringTable->EmptyString())
  329. {
  330. shapeAssetId = resultingAssetId;
  331. return shapeAssetId;
  332. }
  333. //Didn't work, so have us fall back to a placeholder asset
  334. shapeAssetId = StringTable->insert("Core_Rendering:noshape");
  335. }
  336. else
  337. {
  338. //acquire and bind the asset, and return it out
  339. shapeAssetId = query.mAssetList[0];
  340. }
  341. return shapeAssetId;
  342. }
  343. U32 ShapeAsset::getAssetById(StringTableEntry assetId, AssetPtr<ShapeAsset>* shapeAsset)
  344. {
  345. (*shapeAsset) = assetId;
  346. if ((*shapeAsset))
  347. return (*shapeAsset)->mLoadedState;
  348. //Didn't work, so have us fall back to a placeholder asset
  349. StringTableEntry noShapeId = StringTable->insert("Core_Rendering:noshape");
  350. shapeAsset->setAssetId(noShapeId);
  351. if (shapeAsset->notNull())
  352. {
  353. (*shapeAsset)->mLoadedState = AssetErrCode::UsingFallback;
  354. return AssetErrCode::UsingFallback;
  355. }
  356. return AssetErrCode::Failed;
  357. }
  358. //------------------------------------------------------------------------------
  359. void ShapeAsset::copyTo(SimObject* object)
  360. {
  361. // Call to parent.
  362. Parent::copyTo(object);
  363. }
  364. void ShapeAsset::onAssetRefresh(void)
  365. {
  366. if (mFileName == StringTable->EmptyString())
  367. return;
  368. // Update.
  369. if(!Platform::isFullPath(mFileName))
  370. mFilePath = getOwned() ? expandAssetFilePath(mFileName) : mFilePath;
  371. loadShape();
  372. }
  373. void ShapeAsset::SplitSequencePathAndName(String& srcPath, String& srcName)
  374. {
  375. srcName = "";
  376. // Determine if there is a sequence name at the end of the source string, and
  377. // if so, split the filename from the sequence name
  378. S32 split = srcPath.find(' ', 0, String::Right);
  379. S32 split2 = srcPath.find('\t', 0, String::Right);
  380. if ((split == String::NPos) || (split2 > split))
  381. split = split2;
  382. if (split != String::NPos)
  383. {
  384. split2 = split + 1;
  385. while ((srcPath[split2] != '\0') && dIsspace(srcPath[split2]))
  386. split2++;
  387. // now 'split' is at the end of the path, and 'split2' is at the start of the sequence name
  388. srcName = srcPath.substr(split2);
  389. srcPath = srcPath.erase(split, srcPath.length() - split);
  390. }
  391. }
  392. ShapeAnimationAsset* ShapeAsset::getAnimation(S32 index)
  393. {
  394. if (index < mAnimationAssets.size())
  395. {
  396. return mAnimationAssets[index];
  397. }
  398. return nullptr;
  399. }
  400. DefineEngineMethod(ShapeAsset, getMaterialCount, S32, (), ,
  401. "Gets the number of materials for this shape asset.\n"
  402. "@return Material count.\n")
  403. {
  404. return object->getMaterialCount();
  405. }
  406. DefineEngineMethod(ShapeAsset, getAnimationCount, S32, (), ,
  407. "Gets the number of animations for this shape asset.\n"
  408. "@return Animation count.\n")
  409. {
  410. return object->getAnimationCount();
  411. }
  412. DefineEngineMethod(ShapeAsset, getAnimation, ShapeAnimationAsset*, (S32 index), (0),
  413. "Gets a particular shape animation asset for this shape.\n"
  414. "@param animation asset index.\n"
  415. "@return Shape Animation Asset.\n")
  416. {
  417. return object->getAnimation(index);
  418. }
  419. //-----------------------------------------------------------------------------
  420. // GuiInspectorTypeAssetId
  421. //-----------------------------------------------------------------------------
  422. #ifdef TORQUE_TOOLS
  423. IMPLEMENT_CONOBJECT(GuiInspectorTypeShapeAssetPtr);
  424. ConsoleDocClass(GuiInspectorTypeShapeAssetPtr,
  425. "@brief Inspector field type for Shapes\n\n"
  426. "Editor use only.\n\n"
  427. "@internal"
  428. );
  429. void GuiInspectorTypeShapeAssetPtr::consoleInit()
  430. {
  431. Parent::consoleInit();
  432. ConsoleBaseType::getType(TypeShapeAssetPtr)->setInspectorFieldType("GuiInspectorTypeShapeAssetPtr");
  433. }
  434. GuiControl* GuiInspectorTypeShapeAssetPtr::constructEditControl()
  435. {
  436. // Create base filename edit controls
  437. GuiControl *retCtrl = Parent::constructEditControl();
  438. if (retCtrl == NULL)
  439. return retCtrl;
  440. // Change filespec
  441. char szBuffer[512];
  442. dSprintf(szBuffer, sizeof(szBuffer), "AssetBrowser.showDialog(\"ShapeAsset\", \"AssetBrowser.changeAsset\", %s, %s);",
  443. mInspector->getInspectObject()->getIdString(), mCaption);
  444. mBrowseButton->setField("Command", szBuffer);
  445. const char* id = mInspector->getInspectObject()->getIdString();
  446. setDataField(StringTable->insert("targetObject"), NULL, mInspector->getInspectObject()->getIdString());
  447. // Create "Open in ShapeEditor" button
  448. mShapeEdButton = new GuiBitmapButtonCtrl();
  449. dSprintf(szBuffer, sizeof(szBuffer), "ShapeEditorPlugin.openShapeAssetId(%d.getText());", retCtrl->getId());
  450. mShapeEdButton->setField("Command", szBuffer);
  451. char bitmapName[512] = "tools/worldEditor/images/toolbar/shape-editor";
  452. mShapeEdButton->setBitmap(bitmapName);
  453. mShapeEdButton->setDataField(StringTable->insert("Profile"), NULL, "GuiButtonProfile");
  454. mShapeEdButton->setDataField(StringTable->insert("tooltipprofile"), NULL, "GuiToolTipProfile");
  455. mShapeEdButton->setDataField(StringTable->insert("hovertime"), NULL, "1000");
  456. mShapeEdButton->setDataField(StringTable->insert("tooltip"), NULL, "Open this file in the Shape Editor");
  457. mShapeEdButton->registerObject();
  458. addObject(mShapeEdButton);
  459. return retCtrl;
  460. }
  461. bool GuiInspectorTypeShapeAssetPtr::updateRects()
  462. {
  463. S32 dividerPos, dividerMargin;
  464. mInspector->getDivider(dividerPos, dividerMargin);
  465. Point2I fieldExtent = getExtent();
  466. Point2I fieldPos = getPosition();
  467. mCaptionRect.set(0, 0, fieldExtent.x - dividerPos - dividerMargin, fieldExtent.y);
  468. mEditCtrlRect.set(fieldExtent.x - dividerPos + dividerMargin, 1, dividerPos - dividerMargin - 34, fieldExtent.y);
  469. bool resized = mEdit->resize(mEditCtrlRect.point, mEditCtrlRect.extent);
  470. if (mBrowseButton != NULL)
  471. {
  472. mBrowseRect.set(fieldExtent.x - 32, 2, 14, fieldExtent.y - 4);
  473. resized |= mBrowseButton->resize(mBrowseRect.point, mBrowseRect.extent);
  474. }
  475. if (mShapeEdButton != NULL)
  476. {
  477. RectI shapeEdRect(fieldExtent.x - 16, 2, 14, fieldExtent.y - 4);
  478. resized |= mShapeEdButton->resize(shapeEdRect.point, shapeEdRect.extent);
  479. }
  480. return resized;
  481. }
  482. IMPLEMENT_CONOBJECT(GuiInspectorTypeShapeAssetId);
  483. ConsoleDocClass(GuiInspectorTypeShapeAssetId,
  484. "@brief Inspector field type for Shapes\n\n"
  485. "Editor use only.\n\n"
  486. "@internal"
  487. );
  488. void GuiInspectorTypeShapeAssetId::consoleInit()
  489. {
  490. Parent::consoleInit();
  491. ConsoleBaseType::getType(TypeShapeAssetId)->setInspectorFieldType("GuiInspectorTypeShapeAssetId");
  492. }
  493. #endif
  494. DefineEngineMethod(ShapeAsset, getShapeFile, const char*, (), ,
  495. "Creates a new script asset using the targetFilePath.\n"
  496. "@return The bool result of calling exec")
  497. {
  498. return object->getShapeFilePath();
  499. }