mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-01-20 04:34:48 +00:00
Added console method docs
Added more console method documentation and made parameter names more descriptive.
This commit is contained in:
parent
dd9b788ab4
commit
881f9abeb6
|
|
@ -771,14 +771,16 @@ void GuiInspector::sendInspectPostApply()
|
|||
// MARK: ---- Console Methods ----
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
DefineConsoleMethod( GuiInspector, inspect, void, (const char * className), , "Inspect(Object)")
|
||||
DefineEngineMethod( GuiInspector, inspect, void, (const char* simObject), (""),
|
||||
"Inspect the given object.\n"
|
||||
"@param simObject Object to inspect.")
|
||||
{
|
||||
SimObject * target = Sim::findObject(className);
|
||||
SimObject * target = Sim::findObject(simObject);
|
||||
if(!target)
|
||||
{
|
||||
if(dAtoi(className) > 0)
|
||||
Con::warnf("GuiInspector::inspect(): invalid object: %s", className);
|
||||
if(dAtoi(simObject) > 0)
|
||||
Con::warnf("%s::inspect(): invalid object: %s", object->getClassName(), simObject);
|
||||
|
||||
object->clearInspectObjects();
|
||||
return;
|
||||
}
|
||||
|
|
@ -788,12 +790,15 @@ DefineConsoleMethod( GuiInspector, inspect, void, (const char * className), , "I
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
DefineConsoleMethod( GuiInspector, addInspect, void, (const char * className, bool autoSync), (true), "( id object, (bool autoSync = true) ) - Add the object to the list of objects being inspected." )
|
||||
DefineEngineMethod( GuiInspector, addInspect, void, (const char* simObject, bool autoSync), (true),
|
||||
"Add the object to the list of objects being inspected.\n"
|
||||
"@param simObject Object to add to the inspection."
|
||||
"@param autoSync Auto sync the values when they change.")
|
||||
{
|
||||
SimObject* obj;
|
||||
if( !Sim::findObject( className, obj ) )
|
||||
if( !Sim::findObject( simObject, obj ) )
|
||||
{
|
||||
Con::errorf( "GuiInspector::addInspect(): invalid object: %s", className );
|
||||
Con::errorf( "%s::addInspect(): invalid object: %s", object->getClassName(), simObject );
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -802,15 +807,24 @@ DefineConsoleMethod( GuiInspector, addInspect, void, (const char * className, bo
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
DefineConsoleMethod( GuiInspector, removeInspect, void, (SimObject* obj), , "( id object ) - Remove the object from the list of objects being inspected." )
|
||||
DefineEngineMethod( GuiInspector, removeInspect, void, (const char* simObject), ,
|
||||
"Remove the object from the list of objects being inspected.\n"
|
||||
"@param simObject Object to remove from the inspection.")
|
||||
{
|
||||
if (obj)
|
||||
object->removeInspectObject( obj );
|
||||
SimObject* obj;
|
||||
if( !Sim::findObject( simObject, obj ) )
|
||||
{
|
||||
Con::errorf( "%s::removeInspect(): invalid object: %s", object->getClassName(), simObject );
|
||||
return;
|
||||
}
|
||||
|
||||
object->removeInspectObject( obj );
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
DefineConsoleMethod( GuiInspector, refresh, void, (), , "Reinspect the currently selected object." )
|
||||
DefineEngineMethod( GuiInspector, refresh, void, (), ,
|
||||
"Re-inspect the currently selected object.\n")
|
||||
{
|
||||
if ( object->getNumInspectObjects() == 0 )
|
||||
return;
|
||||
|
|
@ -822,10 +836,13 @@ DefineConsoleMethod( GuiInspector, refresh, void, (), , "Reinspect the currently
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
DefineConsoleMethod( GuiInspector, getInspectObject, const char*, (U32 index), (0), "getInspectObject( int index=0 ) - Returns currently inspected object" )
|
||||
DefineEngineMethod( GuiInspector, getInspectObject, const char*, (S32 index), (0),
|
||||
"Returns currently inspected object.\n"
|
||||
"@param index Index of object in inspection list you want to get."
|
||||
"@return object being inspected.")
|
||||
{
|
||||
|
||||
if( index >= object->getNumInspectObjects() )
|
||||
if( index < 0 || index >= object->getNumInspectObjects() )
|
||||
{
|
||||
Con::errorf( "GuiInspector::getInspectObject() - index out of range: %i", index );
|
||||
return "";
|
||||
|
|
@ -836,46 +853,54 @@ DefineConsoleMethod( GuiInspector, getInspectObject, const char*, (U32 index), (
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
DefineConsoleMethod( GuiInspector, getNumInspectObjects, S32, (), , "() - Return the number of objects currently being inspected." )
|
||||
DefineEngineMethod( GuiInspector, getNumInspectObjects, S32, (), ,
|
||||
"Return the number of objects currently being inspected.\n"
|
||||
"@return number of objects currently being inspected.")
|
||||
{
|
||||
return object->getNumInspectObjects();
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
DefineConsoleMethod( GuiInspector, setName, void, (const char * newObjectName), , "setName(NewObjectName)")
|
||||
DefineEngineMethod( GuiInspector, setName, void, (const char* newObjectName), ,
|
||||
"Rename the object being inspected (first object in inspect list).\n"
|
||||
"@param newObjectName new name for object being inspected.")
|
||||
{
|
||||
object->setName(newObjectName);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
DefineConsoleMethod( GuiInspector, apply, void, (), , "apply() - Force application of inspected object's attributes" )
|
||||
DefineEngineMethod( GuiInspector, apply, void, (), ,
|
||||
"Force application of inspected object's attributes.\n")
|
||||
{
|
||||
object->sendInspectPostApply();
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
DefineConsoleMethod( GuiInspector, setObjectField, void, (const char * fieldname, const char * data ), ,
|
||||
"setObjectField( fieldname, data ) - Set a named fields value on the inspected object if it exists. This triggers all the usual callbacks that would occur if the field had been changed through the gui." )
|
||||
DefineEngineMethod( GuiInspector, setObjectField, void, (const char* fieldname, const char* data ), ,
|
||||
"Set a named fields value on the inspected object if it exists. This triggers all the usual callbacks that would occur if the field had been changed through the gui..\n"
|
||||
"@param fieldname Field name on object we are inspecting we want to change."
|
||||
"@param data New Value for the given field.")
|
||||
{
|
||||
object->setObjectField( fieldname, data );
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
DefineConsoleStaticMethod( GuiInspector, findByObject, S32, (const char * className ), ,
|
||||
"findByObject( SimObject ) - returns the id of an awake inspector that is inspecting the passed object if one exists." )
|
||||
DefineEngineMethod( GuiInspector, findByObject, S32, (SimObject* object), ,
|
||||
"Returns the id of an awake inspector that is inspecting the passed object if one exists\n"
|
||||
"@param object Object to find away inspector for."
|
||||
"@return id of an awake inspector that is inspecting the passed object if one exists, else NULL or 0.")
|
||||
{
|
||||
SimObject *obj;
|
||||
if ( !Sim::findObject( className, obj ) )
|
||||
return NULL;
|
||||
|
||||
obj = GuiInspector::findByObject( obj );
|
||||
|
||||
if ( !obj )
|
||||
if ( !object )
|
||||
return NULL;
|
||||
|
||||
return obj->getId();
|
||||
SimObject *inspector = GuiInspector::findByObject( object );
|
||||
|
||||
if ( !inspector )
|
||||
return NULL;
|
||||
|
||||
return inspector->getId();
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue