Beginnings of the "pass everything using a native type wrapper" console code.

- ConsoleValue class is now the base value class.
- ConsoleValueRef is now used to supply function parameters. Values are disposable.
- Script functions return values instead of just strings where possible.
- Variables can be disposable strings
- Bytecode changed

Fix the issues with console method parameters and fields which prevented missions from loading.
This commit is contained in:
James Urquhart 2012-09-23 09:59:48 +01:00
parent 394d87cd54
commit 38c8e52c1d
68 changed files with 1511 additions and 529 deletions

View file

@ -169,5 +169,5 @@ void GuiMaterialCtrl::onRender( Point2I offset, const RectI &updateRect )
ConsoleMethod( GuiMaterialCtrl, setMaterial, bool, 3, 3, "( string materialName )"
"Set the material to be displayed in the control." )
{
return object->setMaterial( argv[2] );
return object->setMaterial( (const char*)argv[2] );
}

View file

@ -4928,7 +4928,7 @@ ConsoleMethod( GuiTreeViewCtrl, setItemTooltip, void, 4, 4, "( int id, string te
return;
}
item->mTooltip = argv[ 3 ];
item->mTooltip = (String)argv[ 3 ];
}
ConsoleMethod( GuiTreeViewCtrl, setItemImages, void, 5, 5, "( int id, int normalImage, int expandedImage ) - Sets the normal and expanded images to show for the given item." )

View file

@ -308,7 +308,7 @@ void GuiControl::initPersistFields()
//-----------------------------------------------------------------------------
bool GuiControl::processArguments(S32 argc, const char **argv)
bool GuiControl::processArguments(S32 argc, ConsoleValueRef *argv)
{
// argv[0] - The GuiGroup to add this control to when it's created.
// this is an optional parameter that may be specified at

View file

@ -330,7 +330,7 @@ class GuiControl : public SimGroup
GuiControl();
virtual ~GuiControl();
virtual bool processArguments(S32 argc, const char **argv);
virtual bool processArguments(S32 argc, ConsoleValueRef *argv);
static void initPersistFields();
static void consoleInit();

View file

@ -83,10 +83,9 @@ ConsoleMethod( GuiFilterCtrl, setValue, void, 3, 20, "(f1, f2, ...)"
{
Filter filter;
argc -= 2;
argv += 2;
StringStackWrapper args(argc - 2, argv + 2);
filter.set(argc, argv);
filter.set(args.count(), args);
object->set(filter);
}

View file

@ -63,5 +63,5 @@ void GuiVariableInspector::loadVars( String searchStr )
ConsoleMethod( GuiVariableInspector, loadVars, void, 3, 3, "loadVars( searchString )" )
{
object->loadVars( argv[2] );
object->loadVars( (const char*)argv[2] );
}

View file

@ -264,7 +264,7 @@ ConsoleMethod( CreatorTree, fileNameMatch, bool, 5, 5, "(string world, string ty
if(dToupper(argv[4][0]) != dToupper(argv[2][0]))
return(false);
return(!dStrnicmp(argv[4]+1, argv[3], typeLen));
return(!dStrnicmp(((const char*)argv[4])+1, argv[3], typeLen));
}
ConsoleMethod( CreatorTree, getSelected, S32, 2, 2, "Return a handle to the currently selected item.")

View file

@ -175,7 +175,7 @@ ConsoleStaticMethod( EditorIconRegistry, add, void, 3, 4, "( String className, S
if ( argc > 3 )
overwrite = dAtob( argv[3] );
gEditorIcons.add( argv[1], argv[2], overwrite );
gEditorIcons.add( (const char*)argv[1], (const char*)argv[2], overwrite );
}
ConsoleStaticMethod( EditorIconRegistry, loadFromPath, void, 2, 3, "( String imagePath [, bool overwrite = true] )"
@ -185,7 +185,7 @@ ConsoleStaticMethod( EditorIconRegistry, loadFromPath, void, 2, 3, "( String ima
if ( argc > 2 )
overwrite = dAtob( argv[2] );
gEditorIcons.loadFromPath( argv[1], overwrite );
gEditorIcons.loadFromPath( (const char*)argv[1], overwrite );
}
ConsoleStaticMethod( EditorIconRegistry, clear, void, 1, 1, ""

View file

@ -782,7 +782,7 @@ void GuiDecalEditorCtrl::setMode( String mode, bool sourceShortcut = false )
mMode = mode;
if( sourceShortcut )
Con::executef( this, "paletteSync", mMode );
Con::executef( this, "paletteSync", (const char*)mMode );
}
ConsoleMethod( GuiDecalEditorCtrl, deleteSelectedDecal, void, 2, 2, "deleteSelectedDecal()" )
@ -894,7 +894,7 @@ ConsoleMethod( GuiDecalEditorCtrl, getSelectionCount, S32, 2, 2, "" )
ConsoleMethod( GuiDecalEditorCtrl, retargetDecalDatablock, void, 4, 4, "" )
{
if( dStrcmp( argv[2], "" ) != 0 && dStrcmp( argv[3], "" ) != 0 )
object->retargetDecalDatablock( argv[2], argv[3] );
object->retargetDecalDatablock( (const char*)argv[2], (const char*)argv[3] );
}
void GuiDecalEditorCtrl::setGizmoFocus( DecalInstance * decalInstance )

View file

@ -2714,7 +2714,7 @@ ConsoleMethod(TerrainEditor, updateMaterial, bool, 4, 4,
if ( index >= terr->getMaterialCount() )
return false;
terr->updateMaterial( index, argv[3] );
terr->updateMaterial( index, (const char*)argv[3] );
object->setDirty();
@ -2729,7 +2729,7 @@ ConsoleMethod(TerrainEditor, addMaterial, S32, 3, 3,
if ( !terr )
return false;
terr->addMaterial( argv[2] );
terr->addMaterial( (const char*)argv[2] );
object->setDirty();

View file

@ -2758,7 +2758,7 @@ void WorldEditor::initPersistFields()
//------------------------------------------------------------------------------
// These methods are needed for the console interfaces.
void WorldEditor::ignoreObjClass( U32 argc, const char **argv )
void WorldEditor::ignoreObjClass( U32 argc, ConsoleValueRef *argv )
{
for(S32 i = 2; i < argc; i++)
{
@ -3542,7 +3542,7 @@ void WorldEditor::colladaExportSelection( const String &path )
ConsoleMethod( WorldEditor, colladaExportSelection, void, 3, 3,
"( String path ) - Export the combined geometry of all selected objects to the specified path in collada format." )
{
object->colladaExportSelection( argv[2] );
object->colladaExportSelection( (const char*)argv[2] );
}
void WorldEditor::makeSelectionPrefab( const char *filename )

View file

@ -76,7 +76,7 @@ class WorldEditor : public EditTSCtrl
Point3F p2;
};
void ignoreObjClass(U32 argc, const char** argv);
void ignoreObjClass(U32 argc, ConsoleValueRef* argv);
void clearIgnoreList();
static bool setObjectsUseBoxCenter( void *object, const char *index, const char *data ) { static_cast<WorldEditor*>(object)->setObjectsUseBoxCenter( dAtob( data ) ); return false; };