Game Development Community

[Help Needed] 'GetSelected' in the editor??

by Nicolai Dutka · in Torque Game Engine Advanced · 10/06/2009 (1:35 pm) · 1 replies

I'd like to be able to do the following:

Bind a command to a keyboard button
Click on an object in the editor
Push my key bind to run the desired command on the selected object

I've got everything working except... I don't know how to tell the command which object to effect.


In my commands.cs I see a 'serverCmdSetSelectedObject', but I don't see anything for 'getSelectedObject'...

#1
10/06/2009 (1:44 pm)
Spoke too soon... Figured this one out on my own, but if anyone can see a problem with this (aside that it prolly won't work with multiple selections, IDK...):

Game/tools/missionEditor/scripts/editors/worldEditor.ed.cs

Line 83:
function WorldEditor::onClick( %this, %obj )
{
   Inspector.inspect( %obj );
   InspectorNameEdit.setValue( %obj.getName() );
   $selected = %obj;
}

Now I can run commands on "$selected". :)