Game Development Community

Distorted World Editor

by Steve Lamperti · in Torque 3D Professional · 03/04/2015 (1:29 pm) · 6 replies

Hoping someone can shed some light on this question for me.

In our app, we have the T3D engine running in a window. Here's an image of how it looks:

www.dropbox.com/s/ryw5f95ensk6xvo/3D%20Window.jpg?dl=0

When I hit F11 to open the world editor, everything works fine, except it looks like the world editor is getting incorrect information about the height of the client area of the window, or the height of the window in general. Here's a picture of that:

www.dropbox.com/s/t674vr97yggfps1/World%20Editor.jpg?dl=0

As you can see in the image, there are a couple of symptoms, that I think are all symptoms of the same thing.
1) The yellow area on the bottom below the bottom of the editor.
2) Buttons and text on the controls on the editor are distorted, as if they were shrunk a bit top to bottom
3) Some tools are positioned incorrectly, like the Terrain Painter Material Preview in this image.

As I said I think that these are all symptoms of the same issue, which I think has something to do with the editor not filling the whole space top to bottom.

Now, I know that no one is going to be able to tell me exactly what is wrong, without looking at our code, but I was hoping someone would be able to recognize enough about what was happening to be able to point me in the right direction as to how to debug this. I've been trying for a while now, and not making much progress, so if anyone has any suggestions as what code to look at as a starting point I would appreciate it.

Thanks
-Steve Lamperti
-Imagine That, Inc.

#1
03/06/2015 (12:54 am)
here my thoughts:
1) maybe the FOV?
2-3) I think I know em. it happens when resolution/window size is low and controls "fold" into themselves. A quick fix for text would be setting the font size to something smaller. then for the editor I guess you'll hsve to manually tweak it in script and .gui...

I hope this helps!
#2
03/06/2015 (9:31 am)
@dOc,

I'm fairly sure that something is wrong with the size that the editor thinks that the window is, so I don't want to change the fonts on controls individually, but rather debug the transition process where the editor gets its size information. I didn't show it in my pictures, but if I set the resolution of the window to a different size, and change to the editor, it does exactly the same thing. I.e. the yellow area on the bottom is always the same height, and the editor is distorted. This implies to me, that the editor is resizing itself to the wrong height. So if I can debug this code, then I might be able to see what's wrong. Part of the problem is that I don't know where to look for this code.
#3
03/06/2015 (9:50 am)
In case anyone is curious, I think I've figured out where to start debugging. I'm currently stepping through guiCanvas.pushDialog as a starting point. I'll post here if I figure it out. If anyone more familiar with the engine then I knows where in pushDialog the new controls resize themselves, I'd appreciate a pointer.
#4
03/06/2015 (10:18 am)
Figured out what's happening, now as to why. The what is that the function setMenuBar in GuiCanvas is only ever called with a NULL, so the code that tries to adjust the size of the canvas for the size of the menubar is messed up. The height of my yellow area, and therefore my distortion too, I believe, is the height of the menubar.
#5
03/06/2015 (10:56 am)
Bit confusing. In GuiCanvas setContentControl, there is a call to setMenuBar, which should set the menu bar for the control, but the call passes in mMenuBarCtrl, which as far as I can see is only set within setMenuBar, so unless mMenuBarCtrl is set through some other mechanism, it will never be anything but NULL.

If anyone has any info that would help clear this up, feel free to post.
#6
03/12/2015 (9:21 am)
Got this working, so this is just a post in case anyone was following this topic. (Which was mostly me talking to myself.)

This problem didn't have much to do with the stuff I was talking about above. After tracing that code, it seemed to be working the same in our project as in the base engine. What the problem turned out to be, was that After all that code was executed, there was a windows WM_SIZE message being sent, which my code wasn't dealing with. When I figured out how to pass that WM_SIZE message on to the engines WinProc, things started working better.