SonyWWS / ATF

Authoring Tools Framework (ATF) is a set of C#/.NET components for making tools on Windows. ATF has been in continuous development in Sony Computer Entertainment's (SCE) Worldwide Studios central tools group since early 2005. ATF has been used by most SCE first party studios to make many custom tools such as Naughty Dog’s level editor and shader editor for The Last of Us, Guerrilla Games’ sequence editor for Killzone games (including the Killzone: Shadow Fall PS4 launch title), an animation blending tool at Santa Monica Studio, a level editor at Bend Studio, a visual state machine editor for Quantic Dream, sound editing tools, and many others.
Apache License 2.0
1.89k stars 262 forks source link

Get HWND for element #36

Closed galek closed 8 years ago

galek commented 9 years ago

Hi,how i can get HWND per element?

My sample based on MeshViewer: void IInitializable.Initialize() { ControlInfo cinfo = new ControlInfo("3D View", "3d viewer", StandardControlGroup.CenterPermanent); m_controlHostService.RegisterControl(m_designControl, cinfo, null); { this.engine = new EngineCLR.EngineCLR(cinfo.Control.Handle.ToInt32()); engine.EngineInit(); engine.Resize(1920, 1080); } } }

But it's not work

Ron2 commented 9 years ago

I think you mean ATF's ModelViewer sample app.

I don't know what EngineCLR is or what it is expecting, but if it needs a Windows handle, then m_designControl.Handle will be the Windows handle of the Control that OpenGL draws on. All handles in Windows are 32 bits, so that's OK to convert the IntPtr to an Int32. I suspect that you'll have to use the debugger inside EngineCLR to see what is going wrong.

galek commented 9 years ago

EngineCLR-it's my engine. HWND is needed for rendering in winforms element For standart winforms all is fine->so code is stable. Rephrase my question:how get HWND for sub-element in form?

Ron2 commented 9 years ago

By "sub-element", you mean "child Control", right? The DesignControl has no child Controls. The m_designControl.Controls property is always empty.

galek commented 9 years ago

By "sub-element", you mean "child Control", right? Yes

Ok,thanks for reply.So maybe I must give up the ATF

Edit: I'll wait for your answer until tomorrow and close the request

abeckus commented 9 years ago

Use m_designControl.Handle instead. The m_designControl variable is the rendering control but it is already used as an opengl context.

Please note that ModelViewer sample is design to use ATF OpenGL based scene graph. I suggest to create new ATF application that utilizes all the ATF services except rendering since you already have one.

As indicated above, the m_designControl is already used as an opengl context, so if you are creating new context or swap chain using same handle it will most likely cause problem.

Alan

galek commented 8 years ago

Thanks for reply, i'm not seen