Persistant Objects
by Ricky Taylor · in Torque Game Builder · 05/13/2006 (12:56 pm) · 3 replies
Persistant objects dont work, shall I fix them for ye?
Pressing save just removes them all... =(
Bits in bold no work. =(
Pressing save just removes them all... =(
function saveLevel( %callback )
{
// Make sure we're on selection tool (deactivate active tool so it cleans up)
LevelBuilderToolManager::setTool( LevelEditorSelectionTool );
if ($currentLevelFile $= "")
{
saveLevelAs( %callback );
return;
}
// Open the Current SceneGraph, if any.
%lastWindow = ToolManager.getLastWindow();
if( !isObject( %lastWindow ) || !isObject( %lastWindow.getScenegraph() ) )
{
error("SaveGraphGroup - No Valid SceneGraph Found!");
return;
}
%sceneGraph = %lastWindow.getScenegraph();
[b]%count = $persistentObjectSet.getCount();
for (%i = 0; %i < %count; %i++)
%scenegraph.removeFromScene($persistentObjectSet.getObject(%i));[/b]
%fo = new FileObject();
%fo.openForWrite($currentLevelFile);
%fo.writeObject(%scenegraph, "%levelContent = ");
%fo.close();
%fo.delete();
[b]for (%i = 0; %i < %count; %i++)
%scenegraph.addToScene($persistentObjectSet.getObject(%i));[/b]
$levelEditor::LastLevel[$currentProject] = $currentLevelFile;
// Clear Dirty Flags and Undo's
LevelBuilderUndoManager.clearAll();
// Level was saved.
if( %callback !$= "" )
eval( %callback @ "();" );
}Bits in bold no work. =(
#2
05/16/2006 (7:45 am)
Bummer- Persistent objects were working in the level builder in Beta 2 right?
Torque Owner Ricky Taylor
Im trying to write a breakout thing for the TGB bounty.... ...
I will have to hack up my entry.... Until this is fixed....