Game Development Community

How to access selected object in Editor?

by Josh Albrecht · in Torque Game Engine · 06/23/2003 (8:07 pm) · 3 replies

I want to call a function for the interior instance that I have selected in the editor. So I've created a function, bound a key to it, etc. However, I need to know how to actually get the selected object from the EditorGui. Some functions like

Creator::onAction(%this)

do exactly that, but I dont know how to when not in the Creator scope.

Does anyone have any ideas?

#1
06/24/2003 (11:05 am)
You can use the World Editor's getSelectionSize() and getSelectedObject() functions - for example:

function doSomethingToEachSelectedObject()
{
   for(%i = 0; %i < EWorldEditor.getSelectionSize(); %i++)
   {
      %obj = EWorldEditor.getSelectedObject(%i);
      %obj.doSomething();
   }
}
#2
06/24/2003 (7:38 pm)
Thank you very much Mr. Frohnmayer! :)
#3
06/24/2003 (8:17 pm)
@Josh: bah! you copy paste... his last name I mean. :P