Game Development Community

New Editor Tree cannot select simgroup and move objects

by Clint S. Brewer · in Torque Game Engine · 11/08/2006 (3:44 pm) · 11 replies

This was a pretty important feature we used with the old editor.

We group many things into a group. then we could select just the simgroup, which would in turn select all its children and let us move them around as a group.

this ability has been lost with the new EditorTree / GuiTreeViewCtrl

anyone else work on this yet?

is there another better way to do this that we should be doing?

Thanks

#1
11/08/2006 (3:55 pm)
In 1.5?

I'm not having issues.
#2
11/08/2006 (4:02 pm)
You can run the example..
click once on the SimGroup - PlayerDropPoints

and then you get an axis gizmo you can move around?

which moves the underlying drop points around?

I just downloaded 1.5 a couple days ago, built it, and that doesn't work for me.
#3
11/08/2006 (4:03 pm)
My description fo the problem is sort of confusing,

a rewording:

Select simgroup does not auto select its children for moving
#4
11/08/2006 (4:27 pm)
I don't recall it ever working like that.

Doesn't work like that in 1.4 or 1.5. So i don't know what to tell ya.
#5
11/08/2006 (4:33 pm)
You got it, the new EditorTree was added in 1.4

in 1.3 it worked the way I describe
#6
11/13/2006 (1:46 pm)
I see that it's a bit difficult now since simgroups can get selected themselves, but this is pretty important for me.

my plan is to add a function that will select everything except simgroups underneath a simgroup.
so you would select a simgroup
then hit a hotkey, or click the simgroup in a special way,
that would then expand all it's child groups and select everyobject underneath it for moving.

first step will be adding a function that will just expand all subtree from a given point, then it should be easy to select the items..
#7
11/13/2006 (2:53 pm)
New functions...
void expandChildren(Item * item);
      void expandAllChildren(S32 itemId); //expand all children so they are visible

void GuiTreeViewCtrl::expandChildren(Item * item)
{
   if ( !item )
      return;

   if(item->isParent())
   {
      item->setExpanded(true);//EXPAND MYSELF
      buildVisibleTree(); //build the tree so we know about our children.
   }

   if ( item->isParent() && item->mChild )
   {
      expandChildren(item->mChild); //CONTINUE EXPANDING MY CHILDREN
   }
   
   if( item->mNext ) //CONTINUE EXPANDING ALL MY SIBLINGS
      expandChildren(item->mNext);
}

void GuiTreeViewCtrl::expandAllChildren(S32 itemId)
{
   Item * item = getItem(itemId);

   if(item)
   {
      //FIRST EXPAND THIS ONE ITEM
      if(item->isParent() && !item->isExpanded())
      {
         item->setExpanded(true);
         buildVisibleTree(); //build the tree so we know about our children.
      }

      //NOW START THE COMPLETE RECURSIVE EXPANSE OF ITS CHILDREN
      if ( item->isParent() && item->mChild )
      {
         expandChildren(item->mChild);
      }

   }
}

ConsoleMethod(GuiTreeViewCtrl, expandAllChildren, void, 3, 3, "expandAllChildren(TreeItemId parent)")
{
   object->expandAllChildren(dAtoi(argv[2]));
}


then new script function
function ExpandSelectedInEditorTree()
{

   %id = EditorTree.getSelectedItem();
   if(%id != -1)
   {
      EditorTree.expandAllChildren(%id);
   }
   else
   {
      echo("nothing selected");
   }
}

calling that script function will recursively expand whatever branch you have selected..
now that I know how thats done, I can do the recursive selection.

side note, now I see that you cannot select a simgroup and change it's name...perhaps I am going about this the wrong way?

at least this expand function will be useful :)
#8
11/13/2006 (3:11 pm)
Ok about being able to select simgroups and change its name. the GuiTreeViewCtrl doesn't call onInspect for Parent items, which the simgroups are....
assuming that there is a good reason for this we can add our special behavior in the mission editor by modifying the EditorTree::onSelect function to look like this:

function EditorTree::onSelect(%this, %obj)
{
   if(%obj.isSimGroup())
   {
      //we can inspect these!
         Inspector.inspect(%obj);
         InspectorNameEdit.setValue(%obj.getName());
   }
   if($AIEdit)
      aiEdit.selectObject(%obj);
   else {
      EWorldEditor.selectObject(%obj);
   }

}

now we can inspect SimGroups again. (and rename them in the editor)
#9
11/14/2006 (4:03 am)
@Clint
Thats lovely.
I was really frustrated about that, i could only change the name if the simgroup was empty
in 1.4 , worked fine in 1.3.
Must try this out, good work !!

Thanks
#10
11/14/2006 (8:53 pm)
Very welcome Billy, should do the trick.

I'll post the select all children function here when I make it too. Then we should be able to deal with simgroups as easily as we could before.
#11
11/20/2006 (8:14 pm)
Nice! very helpfull shortcut there