mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-12 15:14:35 +00:00
Eliminate unnecessary uses of ConsoleMethod
This commit is contained in:
parent
2bbc716db6
commit
0fff33869c
15 changed files with 155 additions and 190 deletions
|
|
@ -157,7 +157,7 @@ void MaterialAsset::copyTo(SimObject* object)
|
|||
Parent::copyTo(object);
|
||||
}
|
||||
|
||||
ConsoleMethod(MaterialAsset, compileShader, void, 2, 2, "() - Compiles the material's generated shader, if any. Not yet implemented\n")
|
||||
DefineEngineMethod(MaterialAsset, compileShader, void, (), , "Compiles the material's generated shader, if any. Not yet implemented\n")
|
||||
{
|
||||
object->compileShader();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,7 +24,8 @@
|
|||
#include "T3D/components/camera/cameraComponent.h"
|
||||
|
||||
//Basically, this only exists for backwards compatibility for parts of the editors
|
||||
ConsoleMethod(CameraComponent, getMode, const char*, 2, 2, "() - We get the first behavior of the requested type on our owner object.\n"
|
||||
DefineEngineMethod(CameraComponent, getMode, const char*, (),,
|
||||
"@brief We get the first behavior of the requested type on our owner object.\n"
|
||||
"@return (string name) The type of the behavior we're requesting")
|
||||
{
|
||||
return "fly";
|
||||
|
|
|
|||
|
|
@ -605,8 +605,8 @@ void Component::addDependency(StringTableEntry name)
|
|||
//////////////////////////////////////////////////////////////////////////
|
||||
// Console Methods
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
ConsoleMethod(Component, beginGroup, void, 3, 3, "(groupName)\n"
|
||||
"Starts the grouping for following fields being added to be grouped into\n"
|
||||
DefineEngineMethod(Component, beginGroup, void, (String groupName),,
|
||||
"@brief Starts the grouping for following fields being added to be grouped into\n"
|
||||
"@param groupName The name of this group\n"
|
||||
"@param desc The Description of this field\n"
|
||||
"@param type The DataType for this field (default, int, float, Point2F, bool, enum, Object, keybind, color)\n"
|
||||
|
|
@ -616,11 +616,11 @@ ConsoleMethod(Component, beginGroup, void, 3, 3, "(groupName)\n"
|
|||
"-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"
|
||||
"@return Nothing\n")
|
||||
{
|
||||
object->beginFieldGroup(argv[2]);
|
||||
object->beginFieldGroup(groupName);
|
||||
}
|
||||
|
||||
ConsoleMethod(Component, endGroup, void, 2, 2, "()\n"
|
||||
"Ends the grouping for prior fields being added to be grouped into\n"
|
||||
DefineEngineMethod(Component, endGroup, void, (),,
|
||||
"@brief Ends the grouping for prior fields being added to be grouped into\n"
|
||||
"@param groupName The name of this group\n"
|
||||
"@param desc The Description of this field\n"
|
||||
"@param type The DataType for this field (default, int, float, Point2F, bool, enum, Object, keybind, color)\n"
|
||||
|
|
@ -641,7 +641,8 @@ DefineEngineMethod(Component, addComponentField, void, (String fieldName, String
|
|||
object->addComponentField(fieldName, fieldDesc, fieldType, defValue, userData, hidden);
|
||||
}
|
||||
|
||||
ConsoleMethod(Component, getComponentFieldCount, S32, 2, 2, "() - Get the number of ComponentField's on this object\n"
|
||||
DefineEngineMethod(Component, getComponentFieldCount, S32, (),,
|
||||
"@brief Get the number of ComponentField's on this object\n"
|
||||
"@return Returns the number of BehaviorFields as a nonnegative integer\n")
|
||||
{
|
||||
return object->getComponentFieldCount();
|
||||
|
|
@ -650,11 +651,12 @@ ConsoleMethod(Component, getComponentFieldCount, S32, 2, 2, "() - Get the number
|
|||
// [tom, 1/12/2007] Field accessors split into multiple methods to allow space
|
||||
// for long descriptions and type data.
|
||||
|
||||
ConsoleMethod(Component, getComponentField, const char *, 3, 3, "(int index) - Gets a Tab-Delimited list of information about a ComponentField specified by Index\n"
|
||||
DefineEngineMethod(Component, getComponentField, const char *, (S32 index),,
|
||||
"@brief Gets a Tab-Delimited list of information about a ComponentField specified by Index\n"
|
||||
"@param index The index of the behavior\n"
|
||||
"@return FieldName, FieldType and FieldDefaultValue, each separated by a TAB character.\n")
|
||||
{
|
||||
ComponentField *field = object->getComponentField(dAtoi(argv[2]));
|
||||
ComponentField *field = object->getComponentField(index);
|
||||
if (field == NULL)
|
||||
return "";
|
||||
|
||||
|
|
@ -664,11 +666,12 @@ ConsoleMethod(Component, getComponentField, const char *, 3, 3, "(int index) - G
|
|||
return buf;
|
||||
}
|
||||
|
||||
ConsoleMethod(Component, setComponentield, const char *, 3, 3, "(int index) - Gets a Tab-Delimited list of information about a ComponentField specified by Index\n"
|
||||
DefineEngineMethod(Component, setComponentield, const char *, (S32 index),,
|
||||
"@brief Gets a Tab-Delimited list of information about a ComponentField specified by Index\n"
|
||||
"@param index The index of the behavior\n"
|
||||
"@return FieldName, FieldType and FieldDefaultValue, each separated by a TAB character.\n")
|
||||
{
|
||||
ComponentField *field = object->getComponentField(dAtoi(argv[2]));
|
||||
ComponentField *field = object->getComponentField(index);
|
||||
if (field == NULL)
|
||||
return "";
|
||||
|
||||
|
|
@ -689,36 +692,40 @@ DefineEngineMethod(Component, getComponentFieldType, const char *, (String field
|
|||
return field->mFieldTypeName;;
|
||||
}
|
||||
|
||||
ConsoleMethod(Component, getBehaviorFieldUserData, const char *, 3, 3, "(int index) - Gets the UserData associated with a field by index in the field list\n"
|
||||
DefineEngineMethod(Component, getBehaviorFieldUserData, const char *, (S32 index),,
|
||||
"@brief Gets the UserData associated with a field by index in the field list\n"
|
||||
"@param index The index of the behavior\n"
|
||||
"@return Returns a string representing the user data of this field\n")
|
||||
{
|
||||
ComponentField *field = object->getComponentField(dAtoi(argv[2]));
|
||||
ComponentField *field = object->getComponentField(index);
|
||||
if (field == NULL)
|
||||
return "";
|
||||
|
||||
return field->mUserData;
|
||||
}
|
||||
|
||||
ConsoleMethod(Component, getComponentFieldDescription, const char *, 3, 3, "(int index) - Gets a field description by index\n"
|
||||
DefineEngineMethod(Component, getComponentFieldDescription, const char *, (S32 index),,
|
||||
"@brief Gets a field description by index\n"
|
||||
"@param index The index of the behavior\n"
|
||||
"@return Returns a string representing the description of this field\n")
|
||||
{
|
||||
ComponentField *field = object->getComponentField(dAtoi(argv[2]));
|
||||
ComponentField *field = object->getComponentField(index);
|
||||
if (field == NULL)
|
||||
return "";
|
||||
|
||||
return field->mFieldDescription ? field->mFieldDescription : "";
|
||||
}
|
||||
|
||||
ConsoleMethod(Component, addDependency, void, 3, 3, "(string behaviorName) - Gets a field description by index\n"
|
||||
DefineEngineMethod(Component, addDependency, void, (String behaviorName),,
|
||||
"@brief Gets a field description by index\n"
|
||||
"@param index The index of the behavior\n"
|
||||
"@return Returns a string representing the description of this field\n")
|
||||
{
|
||||
object->addDependency(argv[2]);
|
||||
object->addDependency(behaviorName);
|
||||
}
|
||||
|
||||
ConsoleMethod(Component, setDirty, void, 2, 2, "() - Gets a field description by index\n"
|
||||
DefineEngineMethod(Component, setDirty, void, (),,
|
||||
"@brief Gets a field description by index\n"
|
||||
"@param index The index of the behavior\n"
|
||||
"@return Returns a string representing the description of this field\n")
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1823,12 +1823,11 @@ ConsoleMethod(Entity, addComponents, void, 2, 2, "() - Add all fielded behaviors
|
|||
object->addComponents();
|
||||
}*/
|
||||
|
||||
ConsoleMethod(Entity, addComponent, bool, 3, 3, "(ComponentInstance bi) - Add a behavior to the object\n"
|
||||
DefineEngineMethod(Entity, addComponent, bool, (Component* comp),,
|
||||
"@brief Add a behavior to the object\n"
|
||||
"@param bi The behavior instance to add"
|
||||
"@return (bool success) Whether or not the behavior was successfully added")
|
||||
{
|
||||
Component *comp = dynamic_cast<Component *>(Sim::findObject(argv[2]));
|
||||
|
||||
if (comp != NULL)
|
||||
{
|
||||
bool success = object->addComponent(comp);
|
||||
|
|
@ -1848,40 +1847,33 @@ ConsoleMethod(Entity, addComponent, bool, 3, 3, "(ComponentInstance bi) - Add a
|
|||
return false;
|
||||
}
|
||||
|
||||
ConsoleMethod(Entity, removeComponent, bool, 3, 4, "(ComponentInstance bi, [bool deleteBehavior = true])\n"
|
||||
DefineEngineMethod(Entity, removeComponent, bool, (Component* comp, bool deleteComponent), (true),
|
||||
"@param bi The behavior instance to remove\n"
|
||||
"@param deleteBehavior Whether or not to delete the behavior\n"
|
||||
"@return (bool success) Whether the behavior was successfully removed")
|
||||
{
|
||||
bool deleteComponent = true;
|
||||
if (argc > 3)
|
||||
deleteComponent = dAtob(argv[3]);
|
||||
|
||||
return object->removeComponent(dynamic_cast<Component *>(Sim::findObject(argv[2])), deleteComponent);
|
||||
return object->removeComponent(comp, deleteComponent);
|
||||
}
|
||||
|
||||
ConsoleMethod(Entity, clearComponents, void, 2, 2, "() - Clear all behavior instances\n"
|
||||
DefineEngineMethod(Entity, clearComponents, void, (),, "Clear all behavior instances\n"
|
||||
"@return No return value")
|
||||
{
|
||||
object->clearComponents();
|
||||
}
|
||||
|
||||
ConsoleMethod(Entity, getComponentByIndex, S32, 3, 3, "(int index) - Gets a particular behavior\n"
|
||||
DefineEngineMethod(Entity, getComponentByIndex, Component*, (S32 index),,
|
||||
"@brief Gets a particular behavior\n"
|
||||
"@param index The index of the behavior to get\n"
|
||||
"@return (ComponentInstance bi) The behavior instance you requested")
|
||||
{
|
||||
Component *comp = object->getComponent(dAtoi(argv[2]));
|
||||
|
||||
return (comp != NULL) ? comp->getId() : 0;
|
||||
return object->getComponent(index);
|
||||
}
|
||||
|
||||
DefineEngineMethod(Entity, getComponent, S32, (String componentName), (""),
|
||||
DefineEngineMethod(Entity, getComponent, Component*, (String componentName), (""),
|
||||
"Get the number of static fields on the object.\n"
|
||||
"@return The number of static fields defined on the object.")
|
||||
{
|
||||
Component *comp = object->getComponent(componentName);
|
||||
|
||||
return (comp != NULL) ? comp->getId() : 0;
|
||||
return object->getComponent(componentName);
|
||||
}
|
||||
|
||||
/*ConsoleMethod(Entity, getBehaviorByType, S32, 3, 3, "(string BehaviorTemplateName) - gets a behavior\n"
|
||||
|
|
@ -1910,7 +1902,8 @@ DefineEngineMethod(Entity, getComponent, S32, (String componentName), (""),
|
|||
return object->reOrder(inst, idx);
|
||||
}*/
|
||||
|
||||
ConsoleMethod(Entity, getComponentCount, S32, 2, 2, "() - Get the count of behaviors on an object\n"
|
||||
DefineEngineMethod(Entity, getComponentCount, S32, (),,
|
||||
"@brief Get the count of behaviors on an object\n"
|
||||
"@return (int count) The number of behaviors on an object")
|
||||
{
|
||||
return object->getComponentCount();
|
||||
|
|
|
|||
|
|
@ -2451,41 +2451,37 @@ DefineEngineMethod( GameConnection, getVisibleGhostDistance, F32, (),,
|
|||
// Object Selection in Torque by Dave Myers
|
||||
// http://www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=7335
|
||||
|
||||
ConsoleMethod(GameConnection, setSelectedObj, bool, 3, 4, "(object, [propagate_to_client])")
|
||||
DefineEngineMethod(GameConnection, setSelectedObj, bool, (SceneObject* obj, bool propagate_to_client), (false), "")
|
||||
{
|
||||
SceneObject* pending_selection;
|
||||
if (!Sim::findObject(argv[2], pending_selection))
|
||||
if (!obj)
|
||||
return false;
|
||||
|
||||
bool propagate_to_client = (argc > 3) ? dAtob(argv[3]) : false;
|
||||
object->setSelectedObj(pending_selection, propagate_to_client);
|
||||
object->setSelectedObj(obj, propagate_to_client);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
ConsoleMethod(GameConnection, getSelectedObj, S32, 2, 2, "()")
|
||||
DefineEngineMethod(GameConnection, getSelectedObj, SimObject*, (),, "")
|
||||
{
|
||||
SimObject* selected = object->getSelectedObj();
|
||||
return (selected) ? selected->getId(): -1;
|
||||
return object->getSelectedObj();
|
||||
}
|
||||
|
||||
ConsoleMethod(GameConnection, clearSelectedObj, void, 2, 3, "([propagate_to_client])")
|
||||
DefineEngineMethod(GameConnection, clearSelectedObj, void, (bool propagate_to_client), (false), "")
|
||||
{
|
||||
bool propagate_to_client = (argc > 2) ? dAtob(argv[2]) : false;
|
||||
object->setSelectedObj(NULL, propagate_to_client);
|
||||
}
|
||||
|
||||
ConsoleMethod(GameConnection, setPreSelectedObjFromRollover, void, 2, 2, "()")
|
||||
DefineEngineMethod(GameConnection, setPreSelectedObjFromRollover, void, (),, "")
|
||||
{
|
||||
object->setPreSelectedObjFromRollover();
|
||||
}
|
||||
|
||||
ConsoleMethod(GameConnection, clearPreSelectedObj, void, 2, 2, "()")
|
||||
DefineEngineMethod(GameConnection, clearPreSelectedObj, void, (),, "")
|
||||
{
|
||||
object->clearPreSelectedObj();
|
||||
}
|
||||
|
||||
ConsoleMethod(GameConnection, setSelectedObjFromPreSelected, void, 2, 2, "()")
|
||||
DefineEngineMethod(GameConnection, setSelectedObjFromPreSelected, void, (),, "")
|
||||
{
|
||||
object->setSelectedObjFromPreSelected();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7517,7 +7517,7 @@ U32 Player::lockAnimation()
|
|||
return last_anim_lock_tag;
|
||||
}
|
||||
|
||||
ConsoleMethod(Player, isAnimationLocked, bool, 2, 2, "isAnimationLocked()")
|
||||
DefineEngineMethod(Player, isAnimationLocked, bool, (),, "")
|
||||
{
|
||||
return object->isAnimationLocked();
|
||||
}
|
||||
|
|
@ -7533,14 +7533,13 @@ void Player::setLookAnimationOverride(bool flag)
|
|||
#endif
|
||||
}
|
||||
|
||||
ConsoleMethod(Player, setLookAnimationOverride, void, 3, 3, "setLookAnimationOverride(flag)")
|
||||
DefineEngineMethod(Player, setLookAnimationOverride, void, (bool flag),, "")
|
||||
{
|
||||
object->setLookAnimationOverride(dAtob(argv[2]));
|
||||
object->setLookAnimationOverride(flag);
|
||||
}
|
||||
|
||||
ConsoleMethod(Player, copyHeadRotation, void, 3, 3, "copyHeadRotation(other_player)")
|
||||
DefineEngineMethod(Player, copyHeadRotation, void, (Player* other_player),, "")
|
||||
{
|
||||
Player* other_player = dynamic_cast<Player*>(Sim::findObject(argv[2]));
|
||||
if (other_player)
|
||||
object->copyHeadRotation(other_player);
|
||||
}
|
||||
|
|
@ -7609,9 +7608,9 @@ void Player::restoreMovement(U32 tag)
|
|||
}
|
||||
}
|
||||
|
||||
ConsoleMethod(Player, setMovementSpeedBias, void, 3, 3, "setMovementSpeedBias(F32 bias)")
|
||||
DefineEngineMethod(Player, setMovementSpeedBias, void, (F32 bias),, "setMovementSpeedBias(F32 bias)")
|
||||
{
|
||||
object->setMovementSpeedBias(dAtof(argv[2]));
|
||||
object->setMovementSpeedBias(bias);
|
||||
}
|
||||
|
||||
void Player::overrideFootfallFX(bool decals, bool sounds, bool dust)
|
||||
|
|
@ -7642,12 +7641,11 @@ void Player::setControllers(Vector<OpenVRTrackedObject*> controllerList)
|
|||
mControllers[1] = controllerList.size() > 1 ? controllerList[1] : NULL;
|
||||
}
|
||||
|
||||
ConsoleMethod(Player, setVRControllers, void, 4, 4, "")
|
||||
DefineEngineMethod(Player, setVRControllers, void, (OpenVRTrackedObject* controllerL, OpenVRTrackedObject* controllerR,, "")
|
||||
{
|
||||
OpenVRTrackedObject *controllerL, *controllerR;
|
||||
Vector<OpenVRTrackedObject*> list;
|
||||
|
||||
if (Sim::findObject(argv[2], controllerL))
|
||||
if (controllerL)
|
||||
{
|
||||
list.push_back(controllerL);
|
||||
}
|
||||
|
|
@ -7656,7 +7654,7 @@ ConsoleMethod(Player, setVRControllers, void, 4, 4, "")
|
|||
list.push_back(NULL);
|
||||
}
|
||||
|
||||
if (Sim::findObject(argv[3], controllerR))
|
||||
if (controllerR)
|
||||
{
|
||||
list.push_back(controllerR);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue