Author Topic: New editor version for testing  (Read 10032 times)  Share 

tzachs

  • AGS Baker
  • Mittens Vassal
  • Parking Goat- games that goats like!
    • I can help with translating
    •  
  • tzachs worked on a game that was nominated for an AGS Award!
New editor version for testing
« on: 08 Jul 2012, 22:43 »
Please backup your game before using this version!!!!!!!!



Edit: replaced with a new version that also fixes the bug described here

Edit 2: replaced with a newer version that fixes a bug and implements a few suggestions, both described here

Edit 3: replaced with a newer version that fixes a crash when clicking "go to definition", described here

Edit 4 (18/7/12): More fixes described here!

Edit 5 (20/7/12): More fixes described here!

Edit 6 (21/7/12): More fixes & improvements described here!

Edit 7 (22/7/12): Fixed the crash described here!

Edit 8 (29/7/12): Committed the changes to the 3.2.2 branch.

Hi, I've added a few features for the editor.
Please test and/or provide feedback.
Once I see everything is well I'll commit to 3.2.2 development branch.

The features:

Folders:
Added folders for characrers, dialogs, inventory items, guis, rooms, scripts and views.
Added new menu items for all folders to move up/down,
and the ability to drag/drop files to be before other files.

For scripts:
- Script and header files are now combined into one and can be expanded/collapsed, similar to room settings & script.
- I removed the ability to move files up/down, this can now be done with normal drag/drop (and not only for scripts).
- Also removed the "exclude script" option, it made things a mess and I couldn't understand why it is needed.
If anybody knows, please tell me.
- The order of the scripts (for script dependencies) is the same as it was before, a script can use all the scripts
above it.

For rooms:
- The "Sort room by number" now sorts within folders. I actually don't understand why this feature is needed, if anyone
knows please tell me.


Find all usages:
Added a menu item to find all usages for characters, dialogs, views, inventory items and global variables.
It won't actually find scripts that use the character id (or dialog/view id), just scripts that use the actual
script name of that specific object.


An example of the folders and the "Find all usages" menu item

Navigate (in tree):
Added a menu item for almost all document tabs, to navigate to their node on the project tree
(can be useful for large projects).


An example of the "Navigate" feature.

Goto Line:
In script editor, pressing Ctrl+G will now open the "Goto line" dialog, you can select a line number and the
editor will jump to that line. Since "Ctrl+G" was already used as a shortcut to open the global script,
I replaced that shortcut with Ctrl+Shift+G (and also replaced the shortcut to open the global header
from Ctrl+H to Ctrl+Shift+H for consistency).


An example of the "Goto Line" feature

Mono:
I've refactored some code to make it more Mono-compatible, so that it could run properly when compiled with Mono
(cross platform implementation of .Net).
There's still a lot more work to be done (even without mentioning the native dll), but it's at least a step
in the right direction.

The changes I've done-
  • I replaced in tons of places the hard-coded "\" used as a directory separator with the directory separator of the OS,
    so that it'll also work on Linux machines.
  • I switched the code that detects Shift & Ctrl keyboard presses with a managed solution, that should be supported
    by MONO- this is used when selecting colors in the palette, for example.
  • I switched the code that detects when the Room Designer is focused (used when pressing the up/down arrows to pan
    the working area) to a managed solution, that should be supported by MONO.
  • I switched the code that copies arrays in memory to a managed solution (used when loading a sprite from file).
  • I partially disabled some features only when running with Mono, since I couldn't see a way to code them without the
    Win API:
       - Breaking in debug will not automatically set the editor to the foreground, the user might have to click on the window
       - Notifying the user on file changes externally if the editor is in focus will not happen. It will happen when
         the window is activated, so I hope it won't be too annoying.
« Last Edit: 29 Jul 2012, 21:12 by tzachs »

Re: New editor version for testing
« Reply #1 on: 08 Jul 2012, 23:32 »
Sounds like a lot of good contributions.

Speaking of the "Find all usages", would it be possible to use your code to also have a "Refactor > Rename" ability? Where it actually changes all instances in script of that old object name to the new name.

Crimson Wizard

  • Local Moderator
  • AGS Project Tracker Admins
    • Best Innovation Award Winner 2013, for spearheading the AGS 3.3.0 project
    •  
    • Lifetime Achievement Award Winner
    •  
Re: New editor version for testing
« Reply #2 on: 09 Jul 2012, 00:47 »
Looks really good.

For rooms:
- The "Sort room by number" now sorts within folders. I actually don't understand why this feature is needed, if anyone
knows please tell me.
"Sort room by number" is useful if you added rooms with lower number after rooms with higher number. But with folders it will be obviously easier to group them. Actually I hope one day it will be possible to reference rooms by script name, rather than number.

Re: New editor version for testing
« Reply #3 on: 09 Jul 2012, 03:30 »
In all honesty everything should be accessible via script names. Completely eliminating the hard-coded numbering.

tzachs

  • AGS Baker
  • Mittens Vassal
  • Parking Goat- games that goats like!
    • I can help with translating
    •  
  • tzachs worked on a game that was nominated for an AGS Award!
Re: New editor version for testing
« Reply #4 on: 09 Jul 2012, 08:03 »
Speaking of the "Find all usages", would it be possible to use your code to also have a "Refactor > Rename" ability? Where it actually changes all instances in script of that old object name to the new name.
Yes, this could be done. Feel free to add an issue to the new tracker...
I'm a bit concerned though, since the current implementation of "Find All Usages" is not as sophisticated as it should be and might cause undesired behaviors in some edge cases, so we probably should add a preview window that shows all changes with a check box list so you'd be able to uncheck unwanted changes.

"Sort room by number" is useful if you added rooms with lower number after rooms with higher number. But with folders it will be obviously easier to group them.

Ahh, thanks, I forgot about being able to create rooms with high numbers..

Snarky

  • Local Moderator
  • Mittens Earl
  • Private Insultant
    • I can help with proof reading
    •  
    • I can help with translating
    •  
Re: New editor version for testing
« Reply #5 on: 09 Jul 2012, 10:39 »
- Also removed the "exclude script" option, it made things a mess and I couldn't understand why it is needed.
If anybody knows, please tell me.

Wow, excellent work Tzachs!

I haven't used the exclude script option much in current AGS, but I can see it being very useful if (as I hope) the editor moves away from importing all resources into the project file, and instead just stores them as pointers to individual files that are kept in folders in the file system, like in most IDEs. Then you might often want to exclude a file from the project while keeping it in the folder (for example something you're working on that isn't ready yet, or the source files for the graphics).

Calin Leafshade

  • AGS Project Tracker Admins
  • Long live King Cat!
    • I can help with making music
    •  
    • I can help with voice acting
    •  
  • Calin Leafshade worked on a game that was nominated for an AGS Award!Calin Leafshade worked on a game that won an AGS Award!
Re: New editor version for testing
« Reply #6 on: 09 Jul 2012, 10:45 »
AGS has a cascading input catching system that is almost never used (dunno why, its awesome)

So, lets assume you have an android version of your game and a mouse based version.

You could have the android touch script higher in the list and when on_mouse_click() gets run you can catch the input (ClaimEvent()) and not let it progress down the scripts.

Now when you want to release your mouse version you can just exclude the android script from the project and the input will just pass through to the mouse script below.

Granted, the same behaviour can be handled with an if/else statement or a #define but why should it if you can keep the two pieces of code entirely separate.

tzachs

  • AGS Baker
  • Mittens Vassal
  • Parking Goat- games that goats like!
    • I can help with translating
    •  
  • tzachs worked on a game that was nominated for an AGS Award!
Re: New editor version for testing
« Reply #7 on: 09 Jul 2012, 18:17 »
Well, what both of you are saying would make sense if that feature was implemented in the same way it's implemented in visual studio, for example, where an excluded project is greyed out and not compiled, but you can always load it back in with a right click->reload...

But in AGS, the script is actually removed from the tree. As it is, I don't see it as useful at all, and if you really want it just copy the script file to a safe place and then delete the script, it's the same thing.
Maybe in the future we can implement it by greying it out and just not sending it to compile, shouldn't be too hard to do...

Hmmm, actually, I've just looked at the code again, and the feature was for rooms, not for scripts, which makes it even less useful, I think (unless someone will correct me).

Crimson Wizard

  • Local Moderator
  • AGS Project Tracker Admins
    • Best Innovation Award Winner 2013, for spearheading the AGS 3.3.0 project
    •  
    • Lifetime Achievement Award Winner
    •  
Re: New editor version for testing
« Reply #8 on: 09 Jul 2012, 19:01 »
AGS has a cascading input catching system that is almost never used (dunno why, its awesome)
Hah! Something I never knew about. I usually used straight opposite way to handle mouse click: called something like MyScript::OnMouseClick from global script.

Re: New editor version for testing
« Reply #9 on: 10 Jul 2012, 01:15 »
I'm glad your making it more MONO friendly.  This gives me hopes for a better linux build.

Re: New editor version for testing
« Reply #10 on: 10 Jul 2012, 22:09 »
Hi

shame you never included a template.

Will put one in to try later.


 8-)

I am not dead, I am only sleeping ;)

Crimson Wizard

  • Local Moderator
  • AGS Project Tracker Admins
    • Best Innovation Award Winner 2013, for spearheading the AGS 3.3.0 project
    •  
    • Lifetime Achievement Award Winner
    •  
Re: New editor version for testing
« Reply #11 on: 10 Jul 2012, 22:16 »
Hi

shame you never included a template.

Will put one in to try later.


 8-)



By the way, is it possible to make "Empty Game" template built-in?

tzachs

  • AGS Baker
  • Mittens Vassal
  • Parking Goat- games that goats like!
    • I can help with translating
    •  
  • tzachs worked on a game that was nominated for an AGS Award!
Re: New editor version for testing
« Reply #12 on: 11 Jul 2012, 09:24 »
Yes, when we'll incorporate NAnt or some other build tool, we'll be able to control what goes where and can copy the template on a post build event.
This will also come in handy for doing automatic daily builds and neat stuff like that.

On another note, I've replaced the version on the first post with a new one that also fixes the bug described here.

JJS

  • AGS Project Tracker Admins
    • Best Innovation Award Winner 2012, for his efforts in porting AGS to multiple platforms
    •  
Re: New editor version for testing
« Reply #13 on: 11 Jul 2012, 09:46 »
I have a bug:

Create a folder in "Inventory items". Double-click on the empty folder. It will give you an error message:

Code: Text
  1. Error: Die Eingabezeichenfolge hat das falsche Format.
  2. Version: AGS 3.2.2.112
  3.  
  4. System.FormatException: Die Eingabezeichenfolge hat das falsche Format.
  5.    bei System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal)
  6.    bei System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info)
  7.    bei System.Convert.ToInt32(String value)
  8.    bei AGS.Editor.Components.InventoryComponent.ItemCommandClick(String controlID)
  9.    bei AGS.Editor.Components.BaseComponentWithFolders`2.CommandClick(String controlID)
  10.    bei AGS.Editor.ProjectTree.ProcessClickOnNode(String nodeID, MouseButtons button)
  11.    bei AGS.Editor.ProjectTree.projectTree_NodeMouseDoubleClick(Object sender, TreeNodeMouseClickEventArgs e)
  12.    bei System.Windows.Forms.TreeView.OnNodeMouseDoubleClick(TreeNodeMouseClickEventArgs e)
  13.    bei System.Windows.Forms.TreeView.WndProc(Message& m)
  14.    bei System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
  15.    bei System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
  16.    bei System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
  17.  


Also a suggestion:

If you drag an item, I would expect the folder under the item to get highlighted if the item can be dropped there. Right now the first item that the mouse is dragged over gets highlighted and after that there is no feedback. It would be extra sweet if folders with subfolders would automatically expand when hovering over them while dragging so that the item can be dropped into a subfolder.
Ask me about AGS on PSP, Android and iOS! Source, Daily builds

Shane 'ProgZmax' Stevens

  • Mittens Serf
  • AGS Project Tracker Admins
  • GARBAAAAAGE DAAAAAAY!
    • I can help with animation
    •  
    • I can help with characters
    •  
    • Lifetime Achievement Award Winner
    •  
    • I can help with making music
    •  
    • I can help with proof reading
    •  
    • I can help with scripting
    •  
    • I can help with story design
    •  
  • Shane 'ProgZmax' Stevens worked on a game that was nominated for an AGS Award!Shane 'ProgZmax' Stevens worked on a game that won an AGS Award!
Re: New editor version for testing
« Reply #14 on: 12 Jul 2012, 01:30 »
Quote
Added folders for characrers, dialogs, inventory items, guis, rooms, scripts and views.
Added new menu items for all folders to move up/down,
and the ability to drag/drop files to be before other files.

Well, that's pretty much all the editor improvements I had wanted to make but never got around to so thanks for that!

tzachs

  • AGS Baker
  • Mittens Vassal
  • Parking Goat- games that goats like!
    • I can help with translating
    •  
  • tzachs worked on a game that was nominated for an AGS Award!
Re: New editor version for testing
« Reply #15 on: 12 Jul 2012, 19:14 »
Thanks guys!

JJS, nice catch on the bug.
I updated the version on the first post with a fix.

I also implemented both your suggestions: hovered nodes during dragging will be highlighted with a light gray, and a folder will be expanded during a drag if you hover over it for more than 0.5 seconds.
Let me know if that's what you had in mind.

Crimson Wizard

  • Local Moderator
  • AGS Project Tracker Admins
    • Best Innovation Award Winner 2013, for spearheading the AGS 3.3.0 project
    •  
    • Lifetime Achievement Award Winner
    •  
Re: New editor version for testing
« Reply #16 on: 12 Jul 2012, 20:59 »
I have a question regarding "Windows" menu.

If I have several pages open, for example a number of "Fonts", and I choose a page in "Windows", the order of pages in the menu will be resorted so that the selected one is always the first. Is it how it is supposed to be?

EDIT: Also, perhaps you will be able to implement this: http://www.adventuregamestudio.co.uk/yabb/index.php?topic=45623.msg624000#msg624000
« Last Edit: 12 Jul 2012, 21:16 by Crimson Wizard »

Joseph DiPerla

  • Joseph DiPerla, Adventure Game Creator Wannabe!
    • I can help with backgrounds
    •  
    • I can help with characters
    •  
    • I can help with play testing
    •  
    • I can help with story design
    •  
    • I can help with translating
    •  
    • I can help with voice acting
    •  
    • I can help with web design
    •  
Re: New editor version for testing
« Reply #17 on: 12 Jul 2012, 22:43 »
Nicely done Tzachs! Really like the changes you have done.
Joseph DiPerla--- http://www.adventurestockpile.com
Play my Star Wars MMORPG: http://sw-bfs.com
See my Fiverr page for translation and other services: https://www.fiverr.com/josephdiperla

JJS

  • AGS Project Tracker Admins
    • Best Innovation Award Winner 2012, for his efforts in porting AGS to multiple platforms
    •  
Re: New editor version for testing
« Reply #18 on: 13 Jul 2012, 07:32 »
Let me know if that's what you had in mind.
Nice! It works exactly as I had envisioned.

A couple more things:

When right-clicking a function/variable and selecting "Go to definition" I get this error message:

Code: Text
  1. Error: Der Objektverweis wurde nicht auf eine Objektinstanz festgelegt.
  2. Version: AGS 3.2.2.112
  3.  
  4. System.NullReferenceException: Der Objektverweis wurde nicht auf eine Objektinstanz festgelegt.
  5.    bei AGS.Editor.ScriptEditor.GoToDefinition(String structName, String memberName)
  6.    bei AGS.Editor.ScriptEditor.ContextMenuChooseOption(Object sender, EventArgs e)
  7.    bei System.Windows.Forms.ToolStripItem.RaiseEvent(Object key, EventArgs e)
  8.    bei System.Windows.Forms.ToolStripMenuItem.OnClick(EventArgs e)
  9.    bei System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e)
  10.    bei System.Windows.Forms.ToolStripItem.HandleMouseUp(MouseEventArgs e)
  11.    bei System.Windows.Forms.ToolStripItem.FireEventInteractive(EventArgs e, ToolStripItemEventType met)
  12.    bei System.Windows.Forms.ToolStripItem.FireEvent(EventArgs e, ToolStripItemEventType met)
  13.    bei System.Windows.Forms.ToolStrip.OnMouseUp(MouseEventArgs mea)
  14.    bei System.Windows.Forms.ToolStripDropDown.OnMouseUp(MouseEventArgs mea)
  15.    bei System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
  16.    bei System.Windows.Forms.Control.WndProc(Message& m)
  17.    bei System.Windows.Forms.ScrollableControl.WndProc(Message& m)
  18.    bei System.Windows.Forms.ToolStrip.WndProc(Message& m)
  19.    bei System.Windows.Forms.ToolStripDropDown.WndProc(Message& m)
  20.    bei System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
  21.    bei System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
  22.    bei System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)


Also I must admit that I haven't worked with the Editor in a long time, but I found these things about the translation system a bit weird:
- When you don't rename the translation from "New translation" you don't get the prompt to initialize the translation file and it stays just empty. I found this pretty irritating as I didn't care what it was named and just wanted to quickly test it out.
- When double-clicking a translation file, there is a message box that tells you to open the file externally. I think it should either give the option to open the file directly with the standard text editor ("AGS cannot open this file directly. Do you want to display it in the standard text editor instead? YES/NO") or the file should be displayed as a text file in the AGS editor. This should be possible as there is already a text editor for the scripts.

Well, I should probably have created issues tracker entries about these as they are not really related to this version...
Ask me about AGS on PSP, Android and iOS! Source, Daily builds

tzachs

  • AGS Baker
  • Mittens Vassal
  • Parking Goat- games that goats like!
    • I can help with translating
    •  
  • tzachs worked on a game that was nominated for an AGS Award!
Re: New editor version for testing
« Reply #19 on: 13 Jul 2012, 18:05 »
I put up a new version in the first post that fixes the crash when clicking on "go to definition", and also saw that using it on a global variable didn't do anything so I fixed that too (it will now open the global variables pane and select the variable).
I didn't implement any of the other suggested features, sorry guys!

I have a question regarding "Windows" menu.

If I have several pages open, for example a number of "Fonts", and I choose a page in "Windows", the order of pages in the menu will be resorted so that the selected one is always the first. Is it how it is supposed to be?
That's a rather philosophical question, isn't it?  ;)
Actually, I didn't even think about it when I implemented it, it was definitely not intentional, I just implemented it in the easiest way I could think of...
But now that you mentioned it, I took a look at Visual Studio 2008 to see how it's implemented there, and it's exactly the same!
So I'll claim it's a feature, and unless it really bothers people, I see no reason to change it.