component.cpp 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640
  1. //-----------------------------------------------------------------------------
  2. // Copyright (c) 2012 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. #include "platform/platform.h"
  23. #include "console/simBase.h"
  24. #include "console/consoleTypes.h"
  25. #include "T3D/components/component.h"
  26. #include "core/util/safeDelete.h"
  27. #include "core/resourceManager.h"
  28. #include "core/stream/fileStream.h"
  29. #include "core/stream/bitStream.h"
  30. #include "console/engineAPI.h"
  31. #include "sim/netConnection.h"
  32. #include "console/consoleInternal.h"
  33. #define DECLARE_NATIVE_COMPONENT( ComponentType ) \
  34. Component* staticComponentTemplate = new ComponentType; \
  35. Sim::gNativeComponentSet->addObject(staticComponentTemplate);
  36. //////////////////////////////////////////////////////////////////////////
  37. // Constructor/Destructor
  38. //////////////////////////////////////////////////////////////////////////
  39. Component::Component()
  40. {
  41. mFriendlyName = StringTable->lookup("");
  42. mFromResource = StringTable->lookup("");
  43. mComponentType = StringTable->lookup("");
  44. mComponentGroup = StringTable->lookup("");
  45. mNetworkType = StringTable->lookup("");
  46. mTemplateName = StringTable->lookup("");
  47. //mDependency = StringTable->lookup("");
  48. mNetworked = false;
  49. // [tom, 1/12/2007] We manage the memory for the description since it
  50. // could be loaded from a file and thus massive. This is accomplished with
  51. // protected fields, but since they still call Con::getData() the field
  52. // needs to always be valid. This is pretty lame.
  53. mDescription = new char[1];
  54. ((char *)mDescription)[0] = 0;
  55. mOwner = NULL;
  56. mCanSaveFieldDictionary = false;
  57. mNetFlags.set(Ghostable);
  58. }
  59. Component::~Component()
  60. {
  61. for (S32 i = 0; i < mFields.size(); ++i)
  62. {
  63. ComponentField &field = mFields[i];
  64. SAFE_DELETE_ARRAY(field.mFieldDescription);
  65. }
  66. SAFE_DELETE_ARRAY(mDescription);
  67. }
  68. IMPLEMENT_CO_NETOBJECT_V1(Component);
  69. //////////////////////////////////////////////////////////////////////////
  70. void Component::initPersistFields()
  71. {
  72. addGroup("Component");
  73. addField("componentType", TypeCaseString, Offset(mComponentType, Component), "The type of behavior.", AbstractClassRep::FieldFlags::FIELD_HideInInspectors);
  74. addField("networkType", TypeCaseString, Offset(mNetworkType, Component), "The type of behavior.", AbstractClassRep::FieldFlags::FIELD_HideInInspectors);
  75. addField("friendlyName", TypeCaseString, Offset(mFriendlyName, Component), "Human friendly name of this behavior", AbstractClassRep::FieldFlags::FIELD_HideInInspectors);
  76. addProtectedField("description", TypeCaseString, Offset(mDescription, Component), &setDescription, &getDescription,
  77. "The description of this behavior which can be set to a \"string\" or a fileName\n", AbstractClassRep::FieldFlags::FIELD_HideInInspectors);
  78. addField("networked", TypeBool, Offset(mNetworked, Component), "Is this behavior ghosted to clients?", AbstractClassRep::FieldFlags::FIELD_HideInInspectors);
  79. addProtectedField("Owner", TypeSimObjectPtr, Offset(mOwner, Component), &setOwner, &defaultProtectedGetFn, "", AbstractClassRep::FieldFlags::FIELD_HideInInspectors);
  80. //addField("hidden", TypeBool, Offset(mHidden, Component), "Flags if this behavior is shown in the editor or not", AbstractClassRep::FieldFlags::FIELD_HideInInspectors);
  81. addProtectedField("enabled", TypeBool, Offset(mEnabled, Component), &_setEnabled, &defaultProtectedGetFn, "");
  82. endGroup("Component");
  83. Parent::initPersistFields();
  84. //clear out irrelevent fields
  85. removeField("name");
  86. //removeField("internalName");
  87. removeField("parentGroup");
  88. //removeField("class");
  89. removeField("superClass");
  90. removeField("hidden");
  91. removeField("canSave");
  92. removeField("canSaveDynamicFields");
  93. removeField("persistentId");
  94. }
  95. bool Component::_setEnabled(void *object, const char *index, const char *data)
  96. {
  97. Component *c = static_cast<Component*>(object);
  98. c->mEnabled = dAtob(data);
  99. c->setMaskBits(EnableMask);
  100. return true;
  101. }
  102. //////////////////////////////////////////////////////////////////////////
  103. bool Component::setDescription(void *object, const char *index, const char *data)
  104. {
  105. Component *bT = static_cast<Component *>(object);
  106. SAFE_DELETE_ARRAY(bT->mDescription);
  107. bT->mDescription = bT->getDescriptionText(data);
  108. // We return false since we don't want the console to mess with the data
  109. return false;
  110. }
  111. const char * Component::getDescription(void* obj, const char* data)
  112. {
  113. Component *object = static_cast<Component *>(obj);
  114. return object->mDescription ? object->mDescription : "";
  115. }
  116. //////////////////////////////////////////////////////////////////////////
  117. bool Component::onAdd()
  118. {
  119. if (!Parent::onAdd())
  120. return false;
  121. setMaskBits(UpdateMask);
  122. return true;
  123. }
  124. void Component::onRemove()
  125. {
  126. onDataSet.removeAll();
  127. if (mOwner)
  128. {
  129. //notify our removal to the owner, so we have no loose ends
  130. mOwner->removeComponent(this, false);
  131. }
  132. Parent::onRemove();
  133. }
  134. void Component::onComponentAdd()
  135. {
  136. if (isServerObject())
  137. {
  138. if (isMethod("onAdd"))
  139. Con::executef(this, "onAdd");
  140. }
  141. mEnabled = true;
  142. }
  143. void Component::onComponentRemove()
  144. {
  145. mEnabled = false;
  146. if (isServerObject())
  147. {
  148. if (isMethod("onRemove"))
  149. Con::executef(this, "onRemove");
  150. }
  151. if (mOwner)
  152. {
  153. mOwner->onComponentAdded.remove(this, &Component::componentAddedToOwner);
  154. mOwner->onComponentRemoved.remove(this, &Component::componentRemovedFromOwner);
  155. mOwner->onTransformSet.remove(this, &Component::ownerTransformSet);
  156. }
  157. mOwner = NULL;
  158. setDataField("owner", NULL, "");
  159. }
  160. void Component::setOwner(Entity* owner)
  161. {
  162. //first, catch if we have an existing owner, and we're changing from it
  163. if (mOwner && mOwner != owner)
  164. {
  165. mOwner->onComponentAdded.remove(this, &Component::componentAddedToOwner);
  166. mOwner->onComponentRemoved.remove(this, &Component::componentRemovedFromOwner);
  167. mOwner->onTransformSet.remove(this, &Component::ownerTransformSet);
  168. mOwner->removeComponent(this, false);
  169. }
  170. mOwner = owner;
  171. if (mOwner != NULL)
  172. {
  173. mOwner->onComponentAdded.notify(this, &Component::componentAddedToOwner);
  174. mOwner->onComponentRemoved.notify(this, &Component::componentRemovedFromOwner);
  175. mOwner->onTransformSet.notify(this, &Component::ownerTransformSet);
  176. }
  177. if (isServerObject())
  178. setMaskBits(OwnerMask);
  179. }
  180. void Component::componentAddedToOwner(Component *comp)
  181. {
  182. return;
  183. }
  184. void Component::componentRemovedFromOwner(Component *comp)
  185. {
  186. return;
  187. }
  188. void Component::ownerTransformSet(MatrixF *mat)
  189. {
  190. return;
  191. }
  192. U32 Component::packUpdate(NetConnection *con, U32 mask, BitStream *stream)
  193. {
  194. U32 retMask = Parent::packUpdate(con, mask, stream);
  195. if (mask & OwnerMask)
  196. {
  197. if (mOwner != NULL)
  198. {
  199. S32 ghostIndex = con->getGhostIndex(mOwner);
  200. if (ghostIndex == -1)
  201. {
  202. stream->writeFlag(false);
  203. retMask |= OwnerMask;
  204. }
  205. else
  206. {
  207. stream->writeFlag(true);
  208. stream->writeFlag(true);
  209. stream->writeInt(ghostIndex, NetConnection::GhostIdBitSize);
  210. }
  211. }
  212. else
  213. {
  214. stream->writeFlag(true);
  215. stream->writeFlag(false);
  216. }
  217. }
  218. else
  219. stream->writeFlag(false);
  220. if (stream->writeFlag(mask & EnableMask))
  221. {
  222. stream->writeFlag(mEnabled);
  223. }
  224. return retMask;
  225. }
  226. void Component::unpackUpdate(NetConnection *con, BitStream *stream)
  227. {
  228. Parent::unpackUpdate(con, stream);
  229. if (stream->readFlag())
  230. {
  231. if (stream->readFlag())
  232. {
  233. //we have an owner object, so fetch it
  234. S32 gIndex = stream->readInt(NetConnection::GhostIdBitSize);
  235. Entity *e = dynamic_cast<Entity*>(con->resolveGhost(gIndex));
  236. if (e)
  237. e->addComponent(this);
  238. }
  239. else
  240. {
  241. //it's being nulled out
  242. setOwner(NULL);
  243. }
  244. }
  245. if (stream->readFlag())
  246. {
  247. mEnabled = stream->readFlag();
  248. }
  249. }
  250. void Component::packToStream(Stream &stream, U32 tabStop, S32 behaviorID, U32 flags /* = 0 */)
  251. {
  252. char buffer[1024];
  253. writeFields(stream, tabStop);
  254. // Write out the fields which the behavior template knows about
  255. for (int i = 0; i < getComponentFieldCount(); i++)
  256. {
  257. ComponentField *field = getComponentField(i);
  258. const char *objFieldValue = getDataField(field->mFieldName, NULL);
  259. // If the field holds the same value as the template's default value than it
  260. // will get initialized by the template, and so it won't be included just
  261. // to try to keep the object files looking as non-horrible as possible.
  262. if (dStrcmp(field->mDefaultValue, objFieldValue) != 0)
  263. {
  264. dSprintf(buffer, sizeof(buffer), "%s = \"%s\";\n", field->mFieldName, (dStrlen(objFieldValue) > 0 ? objFieldValue : "0"));
  265. stream.writeTabs(tabStop);
  266. stream.write(dStrlen(buffer), buffer);
  267. }
  268. }
  269. }
  270. void Component::processTick()
  271. {
  272. if (isServerObject() && mEnabled)
  273. {
  274. if (mOwner != NULL && isMethod("Update"))
  275. Con::executef(this, "Update");
  276. }
  277. }
  278. void Component::setDataField(StringTableEntry slotName, const char *array, const char *value)
  279. {
  280. Parent::setDataField(slotName, array, value);
  281. onDataSet.trigger(this, slotName, value);
  282. }
  283. //catch any behavior field updates
  284. void Component::onStaticModified(const char* slotName, const char* newValue)
  285. {
  286. Parent::onStaticModified(slotName, newValue);
  287. //If we don't have an owner yet, then this is probably the initial setup, so we don't need the console callbacks yet.
  288. if (!mOwner)
  289. return;
  290. onDataSet.trigger(this, slotName, newValue);
  291. checkComponentFieldModified(slotName, newValue);
  292. }
  293. void Component::onDynamicModified(const char* slotName, const char* newValue)
  294. {
  295. Parent::onDynamicModified(slotName, newValue);
  296. //If we don't have an owner yet, then this is probably the initial setup, so we don't need the console callbacks yet.
  297. if (!mOwner)
  298. return;
  299. checkComponentFieldModified(slotName, newValue);
  300. }
  301. void Component::checkComponentFieldModified(const char* slotName, const char* newValue)
  302. {
  303. StringTableEntry slotNameEntry = StringTable->insert(slotName);
  304. //find if it's a behavior field
  305. for (int i = 0; i < mFields.size(); i++)
  306. {
  307. ComponentField *field = getComponentField(i);
  308. if (field->mFieldName == slotNameEntry)
  309. {
  310. //we have a match, do the script callback that we updated a field
  311. if (isMethod("onInspectorUpdate"))
  312. Con::executef(this, "onInspectorUpdate", slotName);
  313. return;
  314. }
  315. }
  316. }
  317. //////////////////////////////////////////////////////////////////////////
  318. //////////////////////////////////////////////////////////////////////////
  319. void Component::addComponentField(const char *fieldName, const char *desc, const char *type, const char *defaultValue /* = NULL */, const char *userData /* = NULL */, /*const char* dependency /* = NULL *//*,*/ bool hidden /* = false */)
  320. {
  321. StringTableEntry stFieldName = StringTable->insert(fieldName);
  322. for (S32 i = 0; i < mFields.size(); ++i)
  323. {
  324. if (mFields[i].mFieldName == stFieldName)
  325. return;
  326. }
  327. ComponentField field;
  328. field.mFieldName = stFieldName;
  329. //find the field type
  330. S32 fieldTypeMask = -1;
  331. StringTableEntry fieldType = StringTable->insert(type);
  332. if (fieldType == StringTable->insert("int"))
  333. fieldTypeMask = TypeS32;
  334. else if (fieldType == StringTable->insert("float"))
  335. fieldTypeMask = TypeF32;
  336. else if (fieldType == StringTable->insert("vector"))
  337. fieldTypeMask = TypePoint3F;
  338. else if (fieldType == StringTable->insert("material"))
  339. fieldTypeMask = TypeMaterialName;
  340. else if (fieldType == StringTable->insert("image"))
  341. fieldTypeMask = TypeImageFilename;
  342. else if (fieldType == StringTable->insert("shape"))
  343. fieldTypeMask = TypeShapeFilename;
  344. else if (fieldType == StringTable->insert("bool"))
  345. fieldTypeMask = TypeBool;
  346. else if (fieldType == StringTable->insert("object"))
  347. fieldTypeMask = TypeSimObjectPtr;
  348. else
  349. fieldTypeMask = TypeString;
  350. field.mFieldType = fieldTypeMask;
  351. field.mUserData = StringTable->insert(userData ? userData : "");
  352. field.mDefaultValue = StringTable->insert(defaultValue ? defaultValue : "");
  353. field.mFieldDescription = getDescriptionText(desc);
  354. field.mGroup = mComponentGroup;
  355. field.mHidden = hidden;
  356. mFields.push_back(field);
  357. //Before we set this, we need to do a test to see if this field was already set, like from the mission file or a taml file
  358. const char* curFieldData = getDataField(field.mFieldName, NULL);
  359. if (dStrIsEmpty(curFieldData))
  360. setDataField(field.mFieldName, NULL, field.mDefaultValue);
  361. }
  362. ComponentField* Component::getComponentField(const char *fieldName)
  363. {
  364. StringTableEntry stFieldName = StringTable->insert(fieldName);
  365. for (S32 i = 0; i < mFields.size(); ++i)
  366. {
  367. if (mFields[i].mFieldName == stFieldName)
  368. return &mFields[i];
  369. }
  370. return NULL;
  371. }
  372. //////////////////////////////////////////////////////////////////////////
  373. const char * Component::getDescriptionText(const char *desc)
  374. {
  375. if (desc == NULL)
  376. return NULL;
  377. char *newDesc;
  378. // [tom, 1/12/2007] If it isn't a file, just do it the easy way
  379. if (!Platform::isFile(desc))
  380. {
  381. newDesc = new char[dStrlen(desc) + 1];
  382. dStrcpy(newDesc, desc);
  383. return newDesc;
  384. }
  385. FileStream str;
  386. str.open(desc, Torque::FS::File::Read);
  387. Stream *stream = &str;
  388. if (stream == NULL){
  389. str.close();
  390. return NULL;
  391. }
  392. U32 size = stream->getStreamSize();
  393. if (size > 0)
  394. {
  395. newDesc = new char[size + 1];
  396. if (stream->read(size, (void *)newDesc))
  397. newDesc[size] = 0;
  398. else
  399. {
  400. SAFE_DELETE_ARRAY(newDesc);
  401. }
  402. }
  403. str.close();
  404. delete stream;
  405. return newDesc;
  406. }
  407. //////////////////////////////////////////////////////////////////////////
  408. void Component::beginFieldGroup(const char* groupName)
  409. {
  410. if (dStrcmp(mComponentGroup, ""))
  411. {
  412. Con::errorf("Component: attempting to begin new field group with a group already begun!");
  413. return;
  414. }
  415. mComponentGroup = StringTable->insert(groupName);
  416. }
  417. void Component::endFieldGroup()
  418. {
  419. mComponentGroup = StringTable->insert("");
  420. }
  421. void Component::addDependency(StringTableEntry name)
  422. {
  423. mDependencies.push_back_unique(name);
  424. }
  425. //////////////////////////////////////////////////////////////////////////
  426. // Console Methods
  427. //////////////////////////////////////////////////////////////////////////
  428. ConsoleMethod(Component, beginGroup, void, 3, 3, "(groupName)\n"
  429. "Starts the grouping for following fields being added to be grouped into\n"
  430. "@param groupName The name of this group\n"
  431. "@param desc The Description of this field\n"
  432. "@param type The DataType for this field (default, int, float, Point2F, bool, enum, Object, keybind, color)\n"
  433. "@param defaultValue The Default value for this field\n"
  434. "@param userData An extra data field that can be used for custom data on a per-field basis<br>Usage for default types<br>"
  435. "-enum: a TAB separated list of possible values<br>"
  436. "-object: the T2D object type that are valid choices for the field. The object types observe inheritance, so if you have a t2dSceneObject field you will be able to choose t2dStaticSrpites, t2dAnimatedSprites, etc.\n"
  437. "@return Nothing\n")
  438. {
  439. object->beginFieldGroup(argv[2]);
  440. }
  441. ConsoleMethod(Component, endGroup, void, 2, 2, "()\n"
  442. "Ends the grouping for prior fields being added to be grouped into\n"
  443. "@param groupName The name of this group\n"
  444. "@param desc The Description of this field\n"
  445. "@param type The DataType for this field (default, int, float, Point2F, bool, enum, Object, keybind, color)\n"
  446. "@param defaultValue The Default value for this field\n"
  447. "@param userData An extra data field that can be used for custom data on a per-field basis<br>Usage for default types<br>"
  448. "-enum: a TAB separated list of possible values<br>"
  449. "-object: the T2D object type that are valid choices for the field. The object types observe inheritance, so if you have a t2dSceneObject field you will be able to choose t2dStaticSrpites, t2dAnimatedSprites, etc.\n"
  450. "@return Nothing\n")
  451. {
  452. object->endFieldGroup();
  453. }
  454. DefineConsoleMethod(Component, addComponentField, void, (String fieldName, String fieldDesc, String fieldType, String defValue, String userData, bool hidden),
  455. ("", "", "", "", "", false),
  456. "Get the number of static fields on the object.\n"
  457. "@return The number of static fields defined on the object.")
  458. {
  459. object->addComponentField(fieldName, fieldDesc, fieldType, defValue, userData, hidden);
  460. }
  461. ConsoleMethod(Component, getComponentFieldCount, S32, 2, 2, "() - Get the number of ComponentField's on this object\n"
  462. "@return Returns the number of BehaviorFields as a nonnegative integer\n")
  463. {
  464. return object->getComponentFieldCount();
  465. }
  466. // [tom, 1/12/2007] Field accessors split into multiple methods to allow space
  467. // for long descriptions and type data.
  468. ConsoleMethod(Component, getComponentField, const char *, 3, 3, "(int index) - Gets a Tab-Delimited list of information about a ComponentField specified by Index\n"
  469. "@param index The index of the behavior\n"
  470. "@return FieldName, FieldType and FieldDefaultValue, each separated by a TAB character.\n")
  471. {
  472. ComponentField *field = object->getComponentField(dAtoi(argv[2]));
  473. if (field == NULL)
  474. return "";
  475. char *buf = Con::getReturnBuffer(1024);
  476. dSprintf(buf, 1024, "%s\t%s\t%s\t%s", field->mFieldName, field->mFieldType, field->mDefaultValue, field->mGroup);
  477. return buf;
  478. }
  479. ConsoleMethod(Component, setComponentield, const char *, 3, 3, "(int index) - Gets a Tab-Delimited list of information about a ComponentField specified by Index\n"
  480. "@param index The index of the behavior\n"
  481. "@return FieldName, FieldType and FieldDefaultValue, each separated by a TAB character.\n")
  482. {
  483. ComponentField *field = object->getComponentField(dAtoi(argv[2]));
  484. if (field == NULL)
  485. return "";
  486. char *buf = Con::getReturnBuffer(1024);
  487. dSprintf(buf, 1024, "%s\t%s\t%s", field->mFieldName, field->mFieldType, field->mDefaultValue);
  488. return buf;
  489. }
  490. ConsoleMethod(Component, getBehaviorFieldUserData, const char *, 3, 3, "(int index) - Gets the UserData associated with a field by index in the field list\n"
  491. "@param index The index of the behavior\n"
  492. "@return Returns a string representing the user data of this field\n")
  493. {
  494. ComponentField *field = object->getComponentField(dAtoi(argv[2]));
  495. if (field == NULL)
  496. return "";
  497. return field->mUserData;
  498. }
  499. ConsoleMethod(Component, getComponentFieldDescription, const char *, 3, 3, "(int index) - Gets a field description by index\n"
  500. "@param index The index of the behavior\n"
  501. "@return Returns a string representing the description of this field\n")
  502. {
  503. ComponentField *field = object->getComponentField(dAtoi(argv[2]));
  504. if (field == NULL)
  505. return "";
  506. return field->mFieldDescription ? field->mFieldDescription : "";
  507. }
  508. ConsoleMethod(Component, addDependency, void, 3, 3, "(string behaviorName) - Gets a field description by index\n"
  509. "@param index The index of the behavior\n"
  510. "@return Returns a string representing the description of this field\n")
  511. {
  512. object->addDependency(argv[2]);
  513. }
  514. ConsoleMethod(Component, setDirty, void, 2, 2, "() - Gets a field description by index\n"
  515. "@param index The index of the behavior\n"
  516. "@return Returns a string representing the description of this field\n")
  517. {
  518. object->setMaskBits(Component::OwnerMask);
  519. }