Hi,
I am developing at the moment a plugin for the editor and I think, I found a bug.
I added in the project tree an new Node (in: public Component(IAGSEditor editor))
_editor.GUIController.ProjectTree.AddTreeRoot(this, CONTROL_ID_ROOT_NODE, "FontEditor", "FontEditorIcon");
in the line after I try to add a leaf
_editor.GUIController.ProjectTree.AddTreeLeaf(this, "sdfh", "Test", "FontEditorIcon", false);
this doesn't work.
When I click on my node (in: void IEditorComponent.CommandClick(string controlID)) I try to add a leaf
_editor.GUIController.ProjectTree.AddTreeLeaf(this, "sdfh4", "Test4", "FontEditorIcon", false);
this doesn't work either. It shows unter Translations
And when i try to add my leaf when the editor opens a game (in: void IEditorComponent.RefreshDataFromGame())
_editor.GUIController.ProjectTree.AddTreeLeaf(this, "sdfh3", "Test3", "FontEditorIcon", false);
it shows under Scripts
I suppose the problem is in the following function:
public IProjectTreeItem AddTreeLeaf(IEditorComponent component, string id, string name, string iconKey, bool greyedOut)
…
if (_lastAddedNode != null)
{
{newNode = _lastAddedNode.Nodes.Add(id, name, iconKey, iconKey);
This is a very strage behaviour.
(Tested with 3.2.1 and the newest BETA 3.3.0.1132)
http://postimg.org/image/wa9mhyq83/
(http://s21.postimg.org/wa9mhyq83/Bild2.jpg) (http://postimg.org/image/wa9mhyq83/)
I never did this myself, but looking into the editor's interfaces I found this:
/// Sets the project tree's internal marker to the specified node.
/// Any AddTreeLeaf commands will add them as children of this node.
/// </summary>
void StartFromNode(IEditorComponent component, string id);
Maybe it should be called before adding leaves?
Otherwise, there's no other obvious way to tell it where to add leaves.
E: The implementation sets _lastAddedNode:
public void StartFromNode(IEditorComponent plugin, string id)
{
TreeNode[] results = _projectTree.Nodes.Find(id, true);
if (results.Length > 0)
{
_lastAddedNode = results[0];
}
Thanks,
this code helped. It was exactly, what I needed.