Files
UnrealEngineUWP/Engine/Source/Programs/MemoryProfiler2/MainWindow.cs
Matt Kuhlenschmidt e2ba04378b Copying //UE4/Dev-Editor to //UE4/Dev-Main (Source: //UE4/Dev-Editor @ 3133954)
#lockdown Nick.Penwarden
#rb none

==========================
MAJOR FEATURES + CHANGES
==========================

Change 3077573 on 2016/08/04 by Nick.Darnell

	Removing some unused code, adding additional needed modules to editor tests.

	#rb none

Change 3077580 on 2016/08/04 by Nick.Darnell

	Removing the test plugins, going to be recreating them in EngineTest.

Change 3082659 on 2016/08/09 by Nick.Darnell

	Automation - Presets are now stored in json files stored in Config so they can be shared, and human readable.  Working on screenshot automation, getting it where it needs to be to permit us to have repeatable tests for comarison.  Removing the option to not take full size screenshots, that defeats the purpose of being able to compare them.

	#rb none

Change 3082766 on 2016/08/09 by Jamie.Dale

	Fixed crashes when dealing with code-points outside the BMP on platforms with UTF-32 FStrings

	ICU always deals with its offsets as UTF-16 (as it always uses UTF-16 internally with icu::UnicodeString), so there were a couple of places in code (break iteration, and bidi detection) where we needed to adjust those UTF-16 offsets to UTF-32 offsets in the case where FString is UTF-32.

	#jira UE-33971
	#rb James.Hopkin

Change 3083067 on 2016/08/09 by Nick.Darnell

	Automation - Working on screenshot support, system now allows a lot more customization in terms of how large the shot is.

	#rb none

Change 3084475 on 2016/08/10 by Richard.TalbotWatkin

	Fixed issue with ModelComponent replication in client/server PIE if BSP is rebuilt. ModelComponent now implements IsNameStableForNetworking and always returns true, as a level's model components will never be rebuilt during a game session. Brush poly normals are now only fixed up in Editor builds.
	#jira UE-34391 - No run animation on client that is not focused when running 2 player and dedicated server
	#codereview Matt.Kuhlenschmidt
	#rb none

Change 3084661 on 2016/08/10 by Matt.Kuhlenschmidt

	Added grayscale texture importing support

	#rb none

Change 3084774 on 2016/08/10 by Cody.Albert

	Adding controller support for ComboBox widget

	#jira UE-33826
	#rb nick.darnell

Change 3085716 on 2016/08/11 by Nick.Darnell

	UMG - Taking the Widget Component and Widget Interaction Components out of experimental.  Removed old importing support for upgrading ancient versions of widget components.  Removing parbola distortion, as users can now do whatever they want in their custom MID they can override the widget with.

	#rb none

Change 3085733 on 2016/08/11 by Nick.Darnell

	UMG - Documenting the meta parameters allowed on widgets, like we do for regular UObjects.  For binding widgets from blueprints you can now do BindWidget (unchanged), and to simplify binding widgets optionally, you can now just do (BindWidgetOptional), rather than the combination of BindWidget + OptionalWidget=true.  Made generating the Design time wrapper call a little more efficent, by optimizing it away by force inlining a noop.  Also added some additional checking when we forcefully set focus in UMG, to help people catch cases where they set focus, but didn't make the widget focusable.

	#rb none

Change 3085734 on 2016/08/11 by Nick.Darnell

	Texture - Making GetDefaultMipMapBias a bit more efficent in the common case.

	#rb none

Change 3085736 on 2016/08/11 by Nick.Darnell

	Static Lighting - Warning the user when they build lighting, but have bForceNoPrecomputedLighting set to true on the world settings.

	#rb none

Change 3085737 on 2016/08/11 by Nick.Darnell

	Editor - code organization.

	#rb none

Change 3085875 on 2016/08/11 by Nick.Darnell

	UMG - You can now use 'G' to toggle game mode on the designer so that you can disable and enable the dashed lines around containers.  The option in the settings is now used as the default when you startup a designer.

	#rb none

Change 3086209 on 2016/08/11 by Ben.Salem

	Make our automated test pass reporting more robust and pipe out to JSON in \saved\automation\logs\AutomationReport-{CL}-{Timestamp}.json format.
	#rb adric.worley, william.ewen

Change 3086515 on 2016/08/11 by Nick.Darnell

	Editor - Fixing a crash in the curve table customization.  If the row doesn't exist, it would crash, we now protect against that case.

	#rb Matt.Kuhlenschmidt

Change 3087216 on 2016/08/12 by Jamie.Dale

	Fixed an issue where re-scanning a package file may leave old assets in the asset registry

	We didn't used to clear out anything associated with the old package before scanning the file, which could result in old assets being left if they'd since been removed from the package.

	This also exposes a PackageDeleted function to allow people to manually clear anything associated with a package (if doing some custom asset work).

	#rb Andrew.Rodham

Change 3087219 on 2016/08/12 by Jamie.Dale

	Updated TextRenderComponent to support multiple font pages

	It used to use the correct UV data, but wouldn't set the correct texture page when rendering. It now creates MIDs for all of the texture pages used by the font, and will use these MIDs (which override the font page on the material) when rendering the text (batched on sequential index/vertex buffer data with the same texture page).

	#rb Matt.Kuhlenschmidt

Change 3087308 on 2016/08/12 by Alex.Delesky

	#jira UE-14727  - Support for editing TSet properties in the editor's Details panel has been added.

	#rb Matt.Kuhlenschmidt

Change 3089140 on 2016/08/15 by Jamie.Dale

	We now abort a directory watch if we lose access to the directory in question

	This prevents an infinite loop in the call to MsgWaitForMultipleObjectsEx if a watched directory is deleted.

	#jira UE-30172
	#rb Andrew.Rodham

Change 3089148 on 2016/08/15 by Alexis.Matte

	Allow fbx export of any actor type.
	#rb none
	#codereview dmitriy.dyomin

Change 3089211 on 2016/08/15 by Jamie.Dale

	Unified access to the parent window for external dialogs

	A lot of places used to ad-hoc use the MainFrame window, even when they had access to a widget that may be belong to a different window. This could cause issues where an external dialog could appear behind a modal UE4 window (as it would appear above the MainFrame), and be inaccessible.

	You can now use IMainFrameModule::GetBestParentWindowHandleForDialogs to get the best window handle to use for an external dialog. This will either be the parent window for the given widget (if known), or failing that, the MainFrame window.

	#rb Andrew.Rodham

Change 3089640 on 2016/08/15 by Jamie.Dale

	Wrapped UMaterialExpression::MenuCategories in WITH_EDITORONLY_DATA to avoid gathering it for game-only loc

	#rb none

Change 3089661 on 2016/08/15 by Nick.Darnell

	Editor - There's a new view option "Show C++ Classes" in the content browser.  Lets you hide all those C++ folders most folks probably don't care to see.

	#rb none

Change 3089667 on 2016/08/15 by Cody.Albert

	Updating RoutePointerUpEvent to call OnDrop for touch events when dragging

	#jira UE-34709
	#rb nick.darnell

Change 3089694 on 2016/08/15 by Jamie.Dale

	Applied a fix to the ExcludeClasses setting in the loc gather

	#rb none

Change 3089889 on 2016/08/15 by Nick.Darnell

	Automation - Continued work on the screenshot portion of the automation system.  Going to start using the adapter information in the screenshots taken, otherwise we can't accurately test a plethora of devices sharing the same OS, with different capabilities.

	#rb none

Change 3090256 on 2016/08/16 by Nick.Darnell

	Automation - working on screenshots.
	#rb none

Change 3090322 on 2016/08/16 by Nick.Darnell

	Automation - Adding modified screenshot function.

	#rb none

Change 3090335 on 2016/08/16 by Nick.Darnell

	Automation - The tests were determined to need to be shared afterall, but at least keeping them as plugins.  Moved to Engine plugins.

	#rb none

Change 3090881 on 2016/08/16 by Nick.Darnell

	Automation - Moving the content over and fixing up some code so that the AutoRimport tests work as expected.

	#rb none

Change 3090884 on 2016/08/16 by Nick.Darnell

	Plugins - There's now support for generating a Content Only plugin from the new plugin wizard.

	#rb none

Change 3090911 on 2016/08/16 by Nick.Darnell

	Feature Packs - If there's an error loading a manifest, it's now an error, not a warning.

	#rb none

Change 3090913 on 2016/08/16 by Jamie.Dale

	Optimization and usability improvements of the MemoryProfiler2 tool

	 - Optimized the processing of the Callgraph, Histogram, and Short lived allocations views.
	    - The callgraph view is now using a virtualized tree view mapped to our own internal tree. This allows us to amortize the cost of adding nodes to the TreeView as the user views the nodes in the tree. In my own test, this took callgraph generation from ~45 seconds to ~5 seconds.
	    - The Histogram view was vastly optimized via the use of a HashSet on the callstack filter, and the batch addition of unsorted callstacks that are sorted once at the end. In my own test, this took histogram generation from ~15 minutes to ~2 seconds.
	    - The Short lived allocations view was optimized by avoiding redundant sorting, including maintaining a sorted order while inserting items, and instead doing a final sort at the end. The column selection was also optimized by avoiding copying the entire dataset just to resort it. In my own test, this took short lived allocation generation from ~1 minute to ~3 seconds.

	 - Added a user-configurable list of allocator functions to trim (which now includes FMemory and operator new by default, and produces much cleaner callstacks).

	#jira UETOOL-948
	#jira UETOOL-949
	#rb James.Hopkin

Change 3090962 on 2016/08/16 by Jamie.Dale

	Fixed double assignment of filter functions

	#rb none

Change 3090989 on 2016/08/16 by Nick.Darnell

	Editor - Attempting to fix the build, non-unity issue I suspect.

	#rb none

Change 3091754 on 2016/08/17 by Nick.Darnell

	FbxAutomationTestBuilder is now a plugin.  Users won't see it unless they've enabled the plugin (so primarily internal QA).  Reorganized the automation tools and testing menu to be a bit lower in the main menu, and gave them a more test sounding name.  Additionally made some modifications to the workspace menu structure to allow generating just a subset of a workplace menu so that I could target where I wanted to insert all of the automation tool menu items, rather than just allowing the general placement of them under developer tools...etc.

	#rb none
	#codereview Alexis.Matte

Change 3091758 on 2016/08/17 by Nick.Darnell

	Slate / Editor - Trying to make the editor less focus greedy.  Now when there are notification popups and tabs attempt to grab your attention we now do a few activation ownership checks to ensure that it or a parent window actually owns activation.  Not doing this has the nasty side effect of things like notifications and message log errors that popup while playing the game (if the game is in new window PIE), causing the game to be hidden, and focus returned to the editor.  Ran into this a lot running the automation tests, the new PIE window that's launched to run tests is immediately hidden as soon as the tests log a warning or error or a notification about high res screenshots happens.

	#rb none

	#codereview Nick.Atamas,Matt.Kuhlenschmidt

Change 3091829 on 2016/08/17 by Nick.Darnell

	Build - Attempting to repair the build.

	#rb none

Change 3091920 on 2016/08/17 by Nick.Darnell

	Build - Another attempt at fixing the mac build.

	#rb none

Change 3093380 on 2016/08/18 by Matt.Kuhlenschmidt

	Ignore group actors when checking for references to other actors when deleting.  The check for references is designed for gameplay affecting references which groups are not.  Having this show up for groups is annoying

	#rb none

Change 3094474 on 2016/08/19 by Jamie.Dale

	Fixed PS4 error when building with USE_MALLOC_PROFILER, and optimized symbol name resolution for a build with USE_MALLOC_PROFILER enabled

	#jira UETOOL-951
	#rb James.Hopkin

Change 3094581 on 2016/08/19 by Jamie.Dale

	Added missing allocator filter needed by PS4 profiles

	#rb none

Change 3094681 on 2016/08/19 by Richard.TalbotWatkin

	Fixed issue where painting override vertex colors on a SpeedTree mesh would cause its wind animation to cease. The OverrideVertexColors vertex factory needed to be registered with the SpeedTree renderer.
	#jira UE-32762 - Custom VertexPaint on SpeedTrees interferes with wind animation
	#rb none

Change 3095163 on 2016/08/19 by Trung.Le

	#jira UE-20849: Added tooltips to the inputs of the Material final result node
	#rb matt.kuhlenschmidt

Change 3095285 on 2016/08/19 by Trung.Le

	#jira UE-20849 In SGraphNodeMaterialResult, renamed ToolTip to ToolTipWidget so we're not hiding class member
	#rb none

Change 3095344 on 2016/08/19 by Alexis.Matte

	#jira UE-34690 When using the optionnal matrix to change the scene root node, we have to flush the fbx evaluation engine.
	Add also a new option to allow the user to automatically convert the fbx scene to unreal unit (centimeter).

	#rb none
	#codereview matt.kuhlenschmidt

Change 3096162 on 2016/08/22 by Alexis.Matte

	#jira UE-34763 Remove offending no-action combo box entry when the json file is readonly. Also clean up other combo box menu.
	#rb none
	#codereview matt.kuhlenschmidt

Change 3096261 on 2016/08/22 by Alexis.Matte

	#jira UE-33121 Make sure re-import all and import all fix all the issue before starting the job. So it get not interrupt during the process.

	#rb lina.halper
	#codereview lina.halper

Change 3096344 on 2016/08/22 by Jamie.Dale

	NSString conversion fix for UTF-32 strings containing characters outside of the BMP

	#jira UE-33971
	#rb Peter.Sauerbrei, James.Hopkin

Change 3096605 on 2016/08/22 by Alex.Delesky

	#jira UE-34787 - Dropdown menus in standalone programs will now correctly display tooltips if they have any.

	#rb Matt.Kuhlenschmidt

Change 3096615 on 2016/08/22 by Alex.Delesky

	#jira UE-33334 - Scrolling up on the mouse wheel when using the orbit camera should no longer move away from the orbit point when the camera moves too close to the orbit origin.

	#rb Matt.Kuhlenschmidt

Change 3096619 on 2016/08/22 by Alex.Delesky

	#jira UE-34084 - Structs containing an enum with a value that contains a whitespace character will now serialize correctly when copied from the Details Panel.

	#rb Matt.Kuhlenschmidt

Change 3097644 on 2016/08/23 by Matt.Kuhlenschmidt

	PR #2729: Fix a typo in the comment (Contributed by adcentury)

	#rb none

Change 3097648 on 2016/08/23 by Matt.Kuhlenschmidt

	PR #2726: Undef unused macros (Contributed by shrimpy56)

	#rb none

Change 3097697 on 2016/08/23 by Matt.Kuhlenschmidt

	Guard against crash when details panels rebuild when their customizations have been torn down

	https://jira.ol.epicgames.net/browse/UE-35048

	#rb none

Change 3097757 on 2016/08/23 by Alex.Delesky

	#jira UE-14727  - Support for editing TMap properties in the editor's Details panel has been added. This change also removes the Duplicate option from TSet elements, and disallows entry of duplicates elements into a TSet or duplicate keys into a TMap

	#rb Matt.Kuhlenschmidt

Change 3098164 on 2016/08/23 by Alexis.Matte

	#jira UE-34686 Fbx importer bImportMeshesInBoneHierarchy is used also by the animation.
	#rb none
	#codereview matt.kuhlenschmidt

Change 3098502 on 2016/08/23 by Alexis.Matte

	#jira UE-30951 Fbx option dialog, we disable the option to bake pivot if transform vertex position is true
	#rb none
	#codereview matt.kuhlenschmidt

Change 3099986 on 2016/08/24 by Jamie.Dale

	Fixing non-editor builds

	#rb none

Change 3101138 on 2016/08/25 by Matt.Kuhlenschmidt

	Fixed viewport redraw callback not being called when certian property modifications occur in the details panel (reset to default, array size changes, etc)

	#rb none

Change 3101280 on 2016/08/25 by Jamie.Dale

	Fixed crash when counting memory over internationalization meta-data

	- The serialization code only used to handle loading or saving, now it handles loading or not loading.
	- The Type of the meta-data wasn't set by all constructors. For safety it has been removed and replaced with a virtual function that the derived types override.

	#rb James.Hopkin

Change 3101283 on 2016/08/25 by Jamie.Dale

	MProf2 platform and symbol parsing improvements

	 - Updated ISymbolParser to work with lazy symbol resolution (handled via the UI when looking at full callstacks).
	 - Added a PS4 symbol parser which handles performing full file/line resolution for symbols.
	 - Removed all the V3 file format support and legacy platform handling.
	 - Optimized FStreamInfo.GetNameIndex so it can be used by the lazy symbol fixup.

	#rb James.Hopkin

Change 3101586 on 2016/08/25 by Jamie.Dale

	Small code cleanup and path normalization

	#rb James.Hopkin

Change 3101837 on 2016/08/25 by Alexis.Matte

	#jira UE-35101 we now store the sourceanimationname to retrieve the correct animtrack when re-importing animations
	#rb none
	#codereview matt.kuhlenschmidt

Change 3102537 on 2016/08/26 by Jamie.Dale

	Fix for potential crash in FICUCamelCaseBreakIterator

	In platforms with UTF-32 strings, the index returned by FICUTextCharacterIterator may not be in the same range as FString, so we need to call InternalIndexToSourceIndex to ensure that it is.

	#rb James.Hopkin

Change 3102582 on 2016/08/26 by Matt.Kuhlenschmidt

	Log the freetype version when it starts up (for debugging purposes)

	#rb none

Change 3102657 on 2016/08/26 by Alexis.Matte

	#jira UE-29177 When re-importing a texture we want to notify materials using this texture so they can recompile the shader.
	#review-3101585 @uriel.doyon
	#rb matt.kuhlenschmidt

Change 3102704 on 2016/08/26 by Jamie.Dale

	Added symbol meta-data support to MProf2

	You can now define platform specific meta-data using FPlatformStackWalk::GetSymbolMetaData, which is then stored within the generated .mprof file.

	PS4 uses this meta-data to say where the original .self file can be found, so that MProf2 can usually automatically load the .self file without having to bother the user.

	#rb James.Hopkin

Change 3102878 on 2016/08/26 by Matt.Kuhlenschmidt

	Added support for outline fonts
	- An outline size (in slate units), optional material and optional fill color can be specified with each font info.
	- Outlines do not contribute to measurement directly so the text measuring and shaping methods have been modified to account for outlines
	- Fixed a bug where font materials do not work properly if part of the font's rendered glyphs were in a different atlas

	#rb jamie.dale

Change 3102879 on 2016/08/26 by Jamie.Dale

	Bumped the MProf2 version so we can tell which build of the tool can load v6 mprof files

	#rb none

Change 3102960 on 2016/08/26 by Alexis.Matte

	build fix
	#rb none

Change 3103032 on 2016/08/26 by Jamie.Dale

	Fixed SEditableText and SMultiLineEditableText not setting the correct foreground color when painting

	#jira UE-34936
	#rb Matt.Kuhlenschmidt

Change 3103278 on 2016/08/26 by Jamie.Dale

	Fixing Clang warnings

	#rb none

Change 3104211 on 2016/08/29 by Ben.Marsh

	Add build script for automated tests, and create settings file for Dev-Editor which adds an agent pool for running them.

	#rb none

Change 3104290 on 2016/08/29 by Alex.Delesky

	Adding additional documentation accessible from the editor for TSet and TMap properties, along with a quick clarification on container properties to let the user know what kind of container they're working with.

	#rb Matt.Kuhlenschmidt

Change 3104292 on 2016/08/29 by Alex.Delesky

	#jira UE-35039 - Command/Control user keybindings will no longer flip-flop when the editor is opened on Mac.

	#rb Matt.Kuhlenschmidt

Change 3104294 on 2016/08/29 by Alex.Delesky

	#jira UE-34952 - The user will no longer encounter an ensure when setting the value of Period equal to or less than 0 on the circular throbber widget

	#rb Matt.Kuhlenschmidt

Change 3104295 on 2016/08/29 by Matt.Kuhlenschmidt

	PR #2682: Remove unused bUseDesktopResolutionForFullscreen (Contributed by stfx)

	#rb none

Change 3104296 on 2016/08/29 by Alex.Delesky

	#jira UE-35160 - The Auto Distance Error for LOD meshes can now be set to any value larger than zero.

	#rb Matt.Kuhlenschmidt

Change 3104348 on 2016/08/29 by Matt.Kuhlenschmidt

	Added the ability to clear the preview mesh on a material instance.  Previously there was no way to null it out.

	#rb none

Change 3104355 on 2016/08/29 by Matt.Kuhlenschmidt

	Guard against crash with invalid path to the default physical material.  Just create a new one if it doesnt exist and warn about it.

	#rb none
	#jira UE-31865

Change 3104396 on 2016/08/29 by Ben.Marsh

	Fix incrorrect agent names for running automated tests

Change 3104610 on 2016/08/29 by Alex.Delesky

	Fix for AutomationTool compile editor from changes introduced today.

	#rb None

Change 3104611 on 2016/08/29 by Michael.Dupuis

	#jira UETOOL-253
	#rb Alexis.Matte

Change 3105826 on 2016/08/30 by Gareth.Martin

	Added console variables to discard grass and/or scalable foliage data on load
	#jira UE-35086
	#rb Benn

Change 3106126 on 2016/08/30 by Matt.Kuhlenschmidt

	Eliminated bad code duplication between retainer widgets and element batcher

	#rb none
	#codereview nick.darnell

Change 3106449 on 2016/08/30 by Michael.Dupuis

	#jira UETOOL-229 Added generic command icons used in Edit Menu (including contextual menu)
	#rb Alexis.Matte

Change 3106966 on 2016/08/30 by Jamie.Dale

	Fixed FApp::IsAuthorizedUser not considering the SessionOwner override

	#rb Max.Preussner

Change 3107687 on 2016/08/31 by Michael.Dupuis

	Checkout/Make Writable on proper config file

	#rb Matt Kuhlenschmidt

Change 3107736 on 2016/08/31 by Matt.Kuhlenschmidt

	Fixed mode typos in the lerp instruction

	#rb none

Change 3107830 on 2016/08/31 by Matt.Kuhlenschmidt

	Logging and guard against UEditorEngine::TeardownPlaySession crash.

	#rb none
	https://jira.ol.epicgames.net/browse/UE-35325

Change 3107912 on 2016/08/31 by Alex.Delesky

	#jira UE-35181 - Normalizing paths when retrieving absolute filenames for source control operations.

	#rb Matt.Kuhlenschmidt

Change 3107986 on 2016/08/31 by Matt.Kuhlenschmidt

	Removed PropertyTestObject.h out of UnrealEd.h so you dont have to compile the entire editor when changing this one file.

	#rb none

Change 3108027 on 2016/08/31 by Chris.Wood

	Re-added lost doc comment for analytics event "Engine.AbnormalShutdown".

	#rb none - just a comment in a cpp file
	#codereview wes.hunt

Change 3108580 on 2016/08/31 by Mike.Fricker

	Deleted the "Live Editor" plugins from UE4
	- These were undocumented, buggy and never finished, and we have no plans to complete them
	- Both the "LiveEditor" and "LiveEditorListenServer" plugins were deleted, along with related icon files

	#codereview matt.kuhlenschmidt
	#rb matt.kuhlenschmidt

Change 3108604 on 2016/08/31 by Mike.Fricker

	Added new "MIDI Device" plugin (disabled by default)

	- This is a simple MIDI interface that allows you to receive MIDI events from devices connected to your computer

	- Currently only input is supported.  In the future we might allow for output, as well.

	- In Blueprints, here's how to use it:
	        - Look for "MIDI Device Manager" in the Blueprint RMB menu
	        - Call "Find MIDI Devices" to choose your favorite device.  Break the "Found MIDI Device" struct to see what's available.
	        - Then call "Create MIDI Device Controller" for the device you want.  Store that in a variable.
	        - On your MIDI Device Controller, bind your own Event to the "On MIDI Event" event.  This will be called every game Tick when there is at least one new MIDI event to receive.
	        - Process the data passed into the Event to make your project do stuff!

	- This plugin makes use of the "PortMidi" third party library (which already existed in UE4 -- it was used by the now-deprecated 'LiveEditor' plugin)

	#codereview matt.kuhlenschmidt
	#rb none

Change 3108760 on 2016/08/31 by Alexis.Matte

	#jira UE-25840 Fbx export collision mesh, we now export collision: box, sphere, capsule and convex mesh. There is an option in the editor preference to enable the export of collisions, default value is false.
	#rb none
	#codereview matt.kuhlenschmidt

Change 3109006 on 2016/08/31 by Alex.Delesky

	#ignore Source Control rename test - initial commit

Change 3109044 on 2016/08/31 by Alex.Delesky

	#ignore Testing asset rename from P4 to observe correct behavior.

	#rb none

Change 3109048 on 2016/08/31 by Alex.Delesky

	#ignore Testing P4 rename to identify correct behavior

	#rb none

Change 3110044 on 2016/09/01 by Gareth.Martin

	Fixed painting foliage on blocking "query" actors not working
	#jira UE-33852
	#rb Allan.Bentham

Change 3110133 on 2016/09/01 by Alexis.Matte

	Fix crash in function GetForceRecompileTextureIdsHash
	#rb none
	#codereview jamie.dale

Change 3111848 on 2016/09/02 by Mike.Fricker

	MIDI Device plugin: Fixed compilation error on Clang compilers (Mac, Linux)
	- Fixed bad enum cast
	#rb none

Change 3111995 on 2016/09/02 by Michael.Dupuis

	#jira UE-35263

	Do not try selecting the actor if the actor is in the blueprint
	Properly Refresh the ToopTip & Hyper Link to take into account blueprint recreation process

	#rb Alexis Matte

Change 3112280 on 2016/09/02 by Michael.Dupuis

	Call MakeWritable if source control fail

	#rb Alexis Matte

Change 3112335 on 2016/09/02 by Cody.Albert

	Updating cursor hiding logic to not improperly hide cursor when left clicking in ortho mode

	#jira UE-35306
	#rb none

Change 3112478 on 2016/09/02 by Alexis.Matte

	#jira UE-20059 Use a base material to import fbx material.
	#rb uriel.doyon
	#codereview matt.kuhlenschmidt
	#1468 Github pull request number

Change 3113912 on 2016/09/06 by Michael.Dupuis

	#jira UE-32288 Fixed Console params display
	#rb Alexis Matte

Change 3114026 on 2016/09/06 by Alex.Delesky

	#jira UE-35123 - The Details panel in a Texture editor or Simple Asset editor window will no longer disappear when the inspected asset is imported again.

	#rb Matt.Kuhlenschmidt

Change 3114032 on 2016/09/06 by Alex.Delesky

	PR #2733: Improved the project launcher progress page (Contributed by projectgheist)

	#jira UE-34027
	#rb Matt.Kuhlenschmidt

Change 3114034 on 2016/09/06 by Alex.Delesky

	#jira UE-35265 - Copying a comment node from a Material Function and pasting it inside a Material will no longer render the Material unsaveable

	#rb Matt.Kuhlenschmidt

Change 3114071 on 2016/09/06 by Nick.Darnell

	[AUTOMATED TEST] Automatic checkin, testing functionality.

Change 3114109 on 2016/09/06 by Nick.Darnell

	[AUTOMATED TEST] Automatic checkin, testing functionality.

Change 3114562 on 2016/09/06 by Nick.Darnell

	Adding LevelEditor to the FbxAutomationTestBuilder to fix a compiler issue.

	#rb none

Change 3114701 on 2016/09/06 by Michael.Dupuis

	#jira UE-31988 add const to all usage of TArray<ItemType>* as it was done in SListView
	#rb Alexis Matte

Change 3114861 on 2016/09/06 by Matt.Kuhlenschmidt

	Prevent non-thread safe slate code from running on the slate loading thread

	#rb none

Change 3115698 on 2016/09/07 by Nick.Darnell

	Make sure the commands are available - during functional testing that was found to not always be the case.

	#rb none

Change 3115719 on 2016/09/07 by Nick.Darnell

	Adding an IsRegistered command to commands.

	#rb none

Change 3115721 on 2016/09/07 by Nick.Darnell

	Adding a new built VirtualReality feature pack, this new one contains the update manifest that will parse correctly.

	#rb none

Change 3115722 on 2016/09/07 by Nick.Darnell

	IsBindWidgetProperty now returns false if the property passed in is null.

	#rb none

Change 3115734 on 2016/09/07 by Alexis.Matte

	#jira UE-30166 Support fbx sdk 2017
	#rb none

Change 3115737 on 2016/09/07 by Nick.Darnell

	Adding an image comparer for screenshots.  Removing some content from EngineTest.

	#rb none

Change 3115743 on 2016/09/07 by Nick.Darnell

	Checkpointing a bunch of progress towards a screenshot comparison workflow that allows us to diff screenshots taken on various platforms and hardware.  Disabling many tests that are not passing.  Updating a few tests to log better errors, and fixed a few tests with easy bugs in them so they would start passing again.  All editor tests currently passing!

	#rb none

Change 3115748 on 2016/09/07 by Nick.Darnell

	Making the RuntimeTests plugin a Developer module, so that it doesn't get included in shipping builds.

	#rb none

Change 3115789 on 2016/09/07 by Jamie.Dale

	We now favor Traditional Chinese for Hong Kong and Macau

	#rb James.Hopkin

Change 3115799 on 2016/09/07 by Jamie.Dale

	Removed validity check on source cultures when remapping, as platforms may use invalid cultures that need to be remapped

	#rb James.Hopkin

Change 3115826 on 2016/09/07 by Nick.Darnell

	Adding missing files.

	#rb none

Change 3115838 on 2016/09/07 by Nick.Darnell

	Back out revision 6 from //UE4/Dev-Editor/Engine/Source/Runtime/UMG/Public/Components/WidgetInteractionComponent.h

	#rb none

Change 3116007 on 2016/09/07 by Alexis.Matte

	build fix
	#rb none

Change 3116057 on 2016/09/07 by Jamie.Dale

	Fixed widget snapshot messages so they appear in the message debugger

	#rb none

Change 3116112 on 2016/09/07 by Nick.Darnell

	Removing the FbxAutomationBuilder file that go recreated on a merge from main.

	#rb none

Change 3116365 on 2016/09/07 by Michael.Dupuis

	#jira UE-20765 Added missing class flag to test (CLASS_CONFIG) and change a bit how the checkout/make writable work.
	#codereview Matt.Kuhlenschmidt
	#rb Alexis.Matte

Change 3116622 on 2016/09/07 by Alexis.Matte

	#jira UE-35608 Use the same naming convention when trying to retrieve uv channel by name.
	#rb matt.kuhlenschmidt

Change 3116638 on 2016/09/07 by Jamie.Dale

	Ensured that manifests and archives don't try and load data that they can't parse

	#rb none

Change 3117397 on 2016/09/08 by Gareth.Martin

	Added rotate and blend support to the landscape mirror tool
	#jira UE-34829
	#rb Jack.Porter

Change 3117459 on 2016/09/08 by Gareth.Martin

	Fixed crash saving a hidden landscape level with an offset (cloned from 4.13.1)
	#jira UE-35301
	#rb Jack.Porter

Change 3117462 on 2016/09/08 by Gareth.Martin

	Fixed invisible landscape components and crashes when tessellation is enabled (cloned from 4.13.1)
	#jira UE-35494
	#rb Benn.Gallagher

Change 3117583 on 2016/09/08 by Nick.Darnell

	Continued work on automation support for screenshot comparison, stubbing in a commandlet that can be run after automation tests that would perform the diffing.  Need to finish rigging it up so that deltas and results can be dumped out somewhere and consumed by a tool to approve shots.

	#rb none

Change 3117595 on 2016/09/08 by Nick.Darnell

	Updating the build script for AutomatedTests, going to see if this works!

	#rb none

Change 3117808 on 2016/09/08 by Nick.Darnell

	Adding header includes for async.

	#rb none

Change 3117812 on 2016/09/08 by Matt.Kuhlenschmidt

	Partially taken from Pr 2381

	Fixed Array Properties to handle duplicates properly and fixed Material Parameter Collection duplicate Guid problem.

	#rb none

Change 3117851 on 2016/09/08 by Jamie.Dale

	Silenced some redundant P4 errors that could be generated when running a stat update on a file

	Some of the options produced errors when working with newly added files. These errors are now downgraded to infos like they are for the main stat command.

	#rb Ben.Marsh
	#codereview Thomas.Sarkanen

Change 3117853 on 2016/09/08 by Gareth.Martin

	Clean up landscape includes and PCH
	#rb steve.robb

Change 3117859 on 2016/09/08 by Alex.Delesky

	#jira UE-35321 - Minimized windows will no longer act like they are visible when determining what widgets are currently underneath the mouse.

	#rb Nick.Darnell

Change 3117997 on 2016/09/08 by Nick.Darnell

	Updating the automation tests build script to use Editor-Cmd

	#rb none

Change 3118005 on 2016/09/08 by Matt.Kuhlenschmidt

	Properly reference graph node on material expressions so they are not GC'd while an expression still uses them

	#jira UE-35362
	#rb none

Change 3118043 on 2016/09/08 by Alex.Delesky

	#jira UE-30649 - Removed unnecessary returns from UWidget API.

	PR #2377: fix widget bug. (Contributed by dorgonman)

	#rb none

Change 3118045 on 2016/09/08 by Matt.Kuhlenschmidt

	Guard against crash saving config during level editor shutdown

	#rb none
	#jira UE-35605

Change 3118074 on 2016/09/08 by Matt.Kuhlenschmidt

	PR #2783: Removed #pragme once from CPP files (Contributed by projectgheist)

	#rb none

Change 3118078 on 2016/09/08 by Michael.Dupuis

	#jira UE-32065 Removed the -windows that was added as a default option and add it simply if fullscreen is not specified
	#rb Alexis.Matte

Change 3118080 on 2016/09/08 by Michael.Dupuis

	#jira UE-31131 Do not show a contextual menu if the menu is empty
	#rb Alexis.Matte

Change 3118087 on 2016/09/08 by Matt.Kuhlenschmidt

	Constify this method

	#rb none

Change 3118166 on 2016/09/08 by Nick.Darnell

	Trying additional command options for the build machine for automation.

	#rb none

Change 3118222 on 2016/09/08 by Matt.Kuhlenschmidt

	Fix actor delete during mesh paint not working during undo

	#rb none
	#jira UE-35684

Change 3118298 on 2016/09/08 by Alexis.Matte

	#jira UE-35302 Export all LODs for static mesh when there is no force LOD
	#rb uriel.doyon

Change 3118325 on 2016/09/08 by Matt.Kuhlenschmidt

	Fixed reset to default not appearing for slate brushes

	#rb none
	#jira UE-34958

Change 3119321 on 2016/09/09 by Matt.Kuhlenschmidt

	Guard against crash with an invalid world trying to be opened from the content browser

	#rb none
	https://jira.ol.epicgames.net/browse/UE-35712

Change 3119433 on 2016/09/09 by Nick.Darnell

	Removing a hack added by Paragon that prevents applications from resizing in real time as the user drags the size of the window around.

	#rb Matt.Kuklenschmidt
	#jira UE-35789

Change 3119448 on 2016/09/09 by Alex.Delesky

	When simulating touch events using the mouse, clicking the mouse will no longer let a drag operation continue. This should also allow the finger that started a drag to continue dragging items until it is released from the surface.

	#rb Nick.Darnell

Change 3119522 on 2016/09/09 by Jamie.Dale

	Fixed FDetailCategoryImpl::ShouldBeExpanded not honoring bShouldBeInitiallyCollapsed when bRestoreExpansionState was true

	#rb Matt.Kuhlenschmidt

Change 3119528 on 2016/09/09 by Jamie.Dale

	Some UI re-work to the localization dashboard

	This makes a better use of the available space, and will make it easier to make some other planned changes in the future.

	#rb James.Hopkin

Change 3119861 on 2016/09/09 by Michael.Dupuis

	#jira UE-9284 Added the Play/Stop button on the thumbnail
	#rb Alexis.Matte

Change 3120027 on 2016/09/09 by Alexis.Matte

	incorporate some fixes from licensee for LOD group re-import workflow
	#jira UE-32268
	#rb uriel.doyon
	#codereview matt.kuhlenschmidt

Change 3120845 on 2016/09/12 by Gareth.Martin

	Fixed crash in landscape editor when "Early Z" is enabled (cloned from 4.13.1)
	#jira UE-35850
	#rb Allan.Bentham

Change 3120980 on 2016/09/12 by Nick.Darnell

	Adding a commandlet that is runnable for comparing screenshots.  Adding comparing and exporting capability to the screenshot manager.

	#rb none

Change 3120992 on 2016/09/12 by Alex.Delesky

	#jira UE-35575 - TScriptInterface UProperties now have asset picker support.

	#rb Matt.Kuhlenschmidt

Change 3121074 on 2016/09/12 by Michael.Dupuis

	#jira UE-30092
	Added path length in error message when typing
	Added display of current filepath lenght for cooking

	#rb Alexis.Matte

Change 3121113 on 2016/09/12 by Nick.Darnell

	Adding some placeholder examples to show people how to author tests in EngineTest.

	#rb none

Change 3121152 on 2016/09/12 by Gareth.Martin

	Added TElementType, TIsContiguousContainer traits
	Added GetData(), GetNum() generic functions
	#rb Steve.Robb

Change 3121702 on 2016/09/12 by Jamie.Dale

	Optimized a loop over a sorted list to instead use a binary search

	This speeds up the short-lived allocation view generation.

	We also now dump the exception information to the Trace log when in a non-debug build.

	#rb James.Hopkin

Change 3121721 on 2016/09/12 by Jamie.Dale

	We now set the window mode first when resizing the game viewport to ensure that the work area is correct

	Fullscreen windows can affect the available work area size, which can break centering when moving between fullscreen and windowed mode.

	#jira UE-32842
	#rb Matt.Kuhlenschmidt

Change 3122578 on 2016/09/13 by Jamie.Dale

	Small code clean up

	Removed a use of the placement new style array addition.

	#rb none

Change 3122634 on 2016/09/13 by Jamie.Dale

	We now immediately update DefaultConfigCheckOutNeeded when checking out/making writable the config file, rather than wait for the text tick

	#jira UE-34865
	#rb James.Hopkin

Change 3122656 on 2016/09/13 by Jamie.Dale

	Fixed array combo button not focusing its contents, which prevented the menu closing correctly

	#jira UE-33667
	#rb none

Change 3122661 on 2016/09/13 by Nick.Darnell

	Checkpointing additional work on the screenshot compare dialog, moving some Directory path picker widget into a more common area.  Moving some "Find the best top level window handle for this widget for dialogs' code out of the main frame module and into Slate Application where it probably belongs.

	#rb none

Change 3122678 on 2016/09/13 by Jamie.Dale

	Fixing CIS error on Clang

	CoreUObject needs to be included before USTRUCT can be used.

	#rb none

Change 3122686 on 2016/09/13 by Jamie.Dale

	Fixing CIS error on Clang

	CoreUObject needs to be included before UCLASS can be used.

	#rb none

Change 3122728 on 2016/09/13 by Nick.Darnell

	UMG - Exposing a trace channel for the WIC, defaults to Visibility.  Improving how the WIC handles the cursor moving off the widget, it now maintains the last hit location rather than 0,0 which would cause things like dragged Sliders to reset to the left.  Ideally - the WIC would know the underlying widget has capture and continue to fake collision against an imaginary plane to simulate a continuous surface.

	#jira UE-35167
	#rb none

Change 3122775 on 2016/09/13 by Nick.Darnell

	Automation - Fixing an error with the ScreenshotTools plugin, needed to add an the include for Engine.h to the PCH.

	#rb none

Change 3122779 on 2016/09/13 by Nick.Darnell

	Widgetnimation - Exposing more of the class to C++.

	#rb none

Change 3122793 on 2016/09/13 by Nick.Darnell

	Fixing a crash in UWidgetComponent::UpdateRenderTarget updating a null material instance.

	#jira UE-35796
	#rb none

Change 3122834 on 2016/09/13 by Matt.Kuhlenschmidt

	Fixed crash undoing moves after bsp creation

	https://jira.ol.epicgames.net/browse/UE-35880

	#rb none

Change 3122835 on 2016/09/13 by Nick.Darnell

	Reverting changes to WIdgetAnimation

	#rb none

Change 3122897 on 2016/09/13 by Matt.Kuhlenschmidt

	Fixed non-editor compile error
	#rb none

Change 3122988 on 2016/09/13 by Alexis.Matte

	Material workflow refactor
	#jira UETOOL-774
	#rb matt.kuhlenschmidt

Change 3123006 on 2016/09/13 by Jamie.Dale

	Fixed dynamic collections not returning anything

	#jira UE-35869
	#rb James.Hopkin

Change 3123145 on 2016/09/13 by Alexis.Matte

	Fix fbx automation test. The test found a regression cause by CL: 3120027. In the case where we dont have a LODGroup we dont want to add LODs before the build.
	#jira UE-32268
	#rb none
	#codereview matt.kuhlenschmidt

Change 3123148 on 2016/09/13 by Matt.Kuhlenschmidt

	Fix fortnite compile error

	#rb alexis.matte

Change 3123208 on 2016/09/13 by Jamie.Dale

	The 'find culprit' dialog now honors the user choice

	#rb RichTW

Change 3123545 on 2016/09/13 by Nick.Darnell

	Slate - Adjusting the window dialog host finding code to do a better job of searching for slate windows and excluding popups and non-regular windows.

	#rb none

Change 3124494 on 2016/09/14 by Jamie.Dale

	Added ~ to the list of invalid characters for object/package names

	#jira UE-12908
	#rb Matt.Kuhlenschmidt

Change 3124513 on 2016/09/14 by Gareth.Martin

	Implemented filter to allow painting foliage on other foliage
	- Altered foliage filters so it will no longer paint on object types which don't have a filter, e.g. skeletal meshes
	#rb Allan.Bentham
	#2472

Change 3124523 on 2016/09/14 by Jamie.Dale

	PR #2724: Fix ScrollBox right mouse/touch grab scrolling functionality (Contributed by aarmbruster)

	#jira UE-34811
	#jira UE-32082
	#rb none

Change 3124607 on 2016/09/14 by Nick.Darnell

	UMG - Adding BoundsScale support to the WidgetComponent's CalcBounds function.

	#jira UE-35667
	#rb none

Change 3124785 on 2016/09/14 by Gareth.Martin

	Made some foliage functions editor-only to fix non-editor build
	#rb none

Change 3124795 on 2016/09/14 by Gareth.Martin

	Saved/loaded the new foliage filter
	#rb Allan.Bentham
	#2472

Change 3124915 on 2016/09/14 by Michael.Dupuis

	#jira UE-19511
	Add support for Add to source control on DefaultEditorPerProjectUserSettings file
	Remove CheckoutNotice when not editing a DefaultXXXX.ini file
	Edit proper config file either we're modifying settings from a Default file or Local user file
	#codereview Matt.Kuhlenschmidt Max.Preussner
	#rb Alexis.Matte

Change 3125266 on 2016/09/14 by Jamie.Dale

	Fixed ULocalizationTarget::DeleteFiles not deleting cultures, and using SCC wrong

	#rb none

Change 3125385 on 2016/09/14 by Matt.Kuhlenschmidt

	Fix crash when using SaveAs to save over top of an existing level

	#rb none
	https://jira.ol.epicgames.net/browse/UE-35919
	https://jira.ol.epicgames.net/browse/UE-35921

Change 3125487 on 2016/09/14 by Alexis.Matte

	Fix cook content, regression induce by the material workflow refactor
	#rb matt.kuhlenschmidt

Change 3126217 on 2016/09/15 by Gareth.Martin

	Unset bHasPerInstanceHitProxies on landscape grass components, as they don't have individually editable instances
	#rb Allan.Bentham

Change 3126311 on 2016/09/15 by Jamie.Dale

	Placement mode fixes

	 - The display name is now cached correctly on construction, and the FPlaceableItem instance used with SPlacementAssetEntry is now const.
	 - Ensured that the ID used by FPlaceableItem could never overflow.
	 - Fixed some types being missing from the "All Classes" list.
	 - Fixed the escape key not cancelling the search.

	#jira UE-35972
	#rb James.Hopkin

Change 3126325 on 2016/09/15 by Jamie.Dale

	Made sure that UWorld::GetAssetRegistryTags called its Super function so that properties tagged as AssetRegistrySearchable will be added.

	#rb Andrew.Rodham

Change 3126403 on 2016/09/15 by Gareth.Martin

	Added Find and Contains functions to TBitArray
	#rb Steve.Robb

Change 3126405 on 2016/09/15 by Gareth.Martin

	Allowed instances of Hierarchical Instanced Mesh Components to be moved around with the transform widget in the blueprint editor
	- Just like regular instanced mesh components!
	Also fixed not being able to move instances of an instanced mesh component when it is the root component
	Also also fixed Hierarchical Instanced Mesh Components not flushing their async tree build on saving (this was causing log spam from PostLoad when dragging instances around as the blueprint would constantly reinstance the component before the async tree build had finished)
	#jira UE-29357
	#rb Allan.Bentham

Change 3126444 on 2016/09/15 by Jamie.Dale

	Fixed the loc dashboard configs not working with SCC

	This isn't a great solution, but the whole way the loc dashboard manages its config data is in need of an overhaul.

	#rb none

Change 3126446 on 2016/09/15 by Jamie.Dale

	Fixed loc dashboard game and engine targets sharing the same expansion settting

	#rb none

Change 3126555 on 2016/09/15 by Chris.Wood

	Removed WER from Windows crash handling. Crashes saved to log folder and passed to CRC with explicit path.
	[UE-34470] - Investigate WER settings and if they can conflict with CRC on Windows

	#rb Steve.Robb

Change 3126586 on 2016/09/15 by Gareth.Martin

	Fixed missing landscape components when using a LODBias (cloned from 4.13.1)
	#jira UE-35873
	#rb Jack.Porter

Change 3126610 on 2016/09/15 by Jamie.Dale

	Stopped PS4 from always staging all ICU data files

	#rb Marcus.Wassmer

Change 3126779 on 2016/09/15 by Michael.Dupuis

	#jira UE-32914 Improve the help text to provide usage examples and params
	#rb Alexis.Matte

Change 3126849 on 2016/09/15 by Matt.Kuhlenschmidt

	Fix font material and outline font material not being animatable in sequencer

	#rb frank.fella

Change 3126858 on 2016/09/15 by Matt.Kuhlenschmidt

	File not saved
	#rb none

Change 3127001 on 2016/09/15 by Matt.Kuhlenschmidt

	Fixed reset to default state still not appearing in all cases after changing a property.

	#rb none

Change 3127038 on 2016/09/15 by Nick.Darnell

	UMG - Improving focus setting for users on widgets.  If we're unable to set the focus immediately, possibly because the user is setting focus in the Construct callback before the widget is in the tree, we now update the SlateOperations FReply on LocalPlayer to set focus next frame when it's more likely the widget will become focusable.

	#rb none

Change 3127061 on 2016/09/15 by Nick.Darnell

	Slate - We now have a reentrancy guard in TPanelChildren to avoid the broad cases where users might attempt to remove children while all children are being removed.  Which is an easy case to engineer if you've got widgets spawning children managed by another widget, that all go away at the same time, thus causing the parent to attempt to cleanup children.  The end result is a delete while deleting.  So now TPanelChildren prevents adds/removes while emptying the list of children.

	#jira UE-35726
	#rb Matt.Kuchlenschmidt

Change 3127205 on 2016/09/15 by Alex.Delesky

	#jira UE-18013 - Users can now add Textures, Materials, or Sprites to a Widget Blueprint directly from the content browser. This also fixes a few issues with adding Widget Blueprints to another Widget BP from the content browser, such as adding a widget to itself or creating a circular dependency.

	#rb Nick.Darnell

Change 3127971 on 2016/09/16 by Matt.Kuhlenschmidt

	Fix crash in scene outliner if actors become invalid

	#rb none

	https://jira.ol.epicgames.net/browse/UE-35932

Change 3128011 on 2016/09/16 by Matt.Kuhlenschmidt

	Added guards for crashes accessing slate resources for deleted uobjects

	#rb nick.darnell

Change 3128067 on 2016/09/16 by Michael.Dupuis

	#jira UE-34158 Add an option to auto expand advanced details
	#rb Alexis.Matte

Change 3128073 on 2016/09/16 by Michael.Dupuis

	#jira UE-1145
	Set Save As to Ctrl + Alt + S
	Set Save All to Ctrl + Shift + S
	Set Save Current to Ctrl + S

	#rb Alexis.Matte

Change 3128117 on 2016/09/16 by Jamie.Dale

	Updated the pin-type filter combo to filter on both the localized and source type descriptions

	#jira UE-36081
	#rb none

Change 3128177 on 2016/09/16 by Alexis.Matte

	#jira UE-35946 Remove unnecessary GetReadValue call with bad parameter. The read value call is cache so subsequent call was returning the bad cache value.

	#rb michael.dupuis
	#codereview matt.kuhlenschmidt

Change 3128387 on 2016/09/16 by Gareth.Martin

	Fixed location and rotation of arrow widget in the landscape mirror tool when using one of the new "Rotate" modes
	#jira UE-36093
	#rb none

Change 3128445 on 2016/09/16 by Matt.Kuhlenschmidt

	Guard against scene outliner crash.  Print out tree when items appear twice.
	https://jira.ol.epicgames.net/browse/UE-35935

	#rb none

Change 3128454 on 2016/09/16 by Matt.Kuhlenschmidt

	Remove category for WindowTitleBarArea.  It is very custom for internal use and should not be a top level widget

	#rb none

Change 3128482 on 2016/09/16 by Michael.Dupuis

	Added new key binding for generic Save, Save As
	Added new key binding for Save All for the content browser

	#rb Alexis.Matte (approved by MattK)

Change 3128560 on 2016/09/16 by Matt.Kuhlenschmidt

	Fix build warning

	#codereview nick.darnell
	#rb none

Change 3128642 on 2016/09/16 by Alexis.Matte

	#jira UE-36047 We now convert the light color correctly when importing and exporting fbx files. UE4 is sRGB and FBX is linear
	#rb none
	#codereview matt.kuhlenschmidt

Change 3128733 on 2016/09/16 by Nick.Darnell

	UMG - Fixing a bad merge, some code was removed causing all BindWidget statements to fail to compile correctly.

	#jira UE-36105
	#rb none

Change 3128768 on 2016/09/16 by Matt.Kuhlenschmidt

	Fix selection outline showing around edges of all internal mesh sections of a component instead of around the entire actor

	#rb none

Change 3128779 on 2016/09/16 by Matt.Kuhlenschmidt

	Fix offset characters on some small fonts

	#rb none

Change 3130057 on 2016/09/19 by Jamie.Dale

	Fixing volatility and invalidation issues for text widgets

	#jira UE-33988
	#rb Nick.Darnell

Change 3130064 on 2016/09/19 by Jamie.Dale

	Changed mprof meta-data to allow unicode strings and updated ReadString to deal with them correctly

	#rb James.Hopkin

Change 3130233 on 2016/09/19 by Michael.Dupuis

	#jira UE-32914 Added missing args that the UI supported
	#rb Alexis.Matte

Change 3130265 on 2016/09/19 by Nick.Darnell

	Automation - Cleaning up some API items.

	#rb none

Change 3130378 on 2016/09/19 by Matt.Kuhlenschmidt

	Fix reentrancy saving assets while a prompt for checkout dialog is open

	#rb none

Change 3130398 on 2016/09/19 by Jamie.Dale

	Fixing UHT error when building

	#rb none

Change 3132101 on 2016/09/20 by Nick.Darnell

	UMG - Adding a toolbar option in the designer for the 'G' command, similar to 'Game View' in the level editor, it disables all the dashed lines / future editor visuals.

	#rb none

Change 3132110 on 2016/09/20 by Nick.Darnell

	PR #2792: ShowFlags for WidgetComponents (Contributed by projectgheist)

	#jira UE-13770

	#rb Nick.Darnell

Change 3132111 on 2016/09/20 by Nick.Darnell

	UMG - The retainer now embeds a virtual window into the focus path so that paths are resolved correctly.

	#rb none

Change 3132138 on 2016/09/20 by Michael.Dupuis

	#jira UE-30945 Added missing PostEditComponentMove after drag is finished
	#rb Alexis.Matte

Change 3132147 on 2016/09/20 by Michael.Dupuis

	#jira UE-30866 Fixed the filter to work properly
	#rb Alexis.Matte

Change 3132190 on 2016/09/20 by Matt.Kuhlenschmidt

	Fix static analysis warnings in this file

	#rb none

Change 3132231 on 2016/09/20 by Nick.Darnell

	Slate - Updating the material blend states to match what is expected of Slate rendering, which differs a lot from the scene renderer with the way it treats alpha.  This fixes translucent rendering with the retainer widget, users will need to set their materials to Alpha Composite though for it to behave as expected.

	#jira UE-33285
	#rb none

Change 3132255 on 2016/09/20 by Alex.Delesky

	#jira UE-36048 - TMap and TSet properties are now disallowed from adding more children through the Details panel when they contain the dfault value for a key or element. Reset to Default is also no longer allowed on a Map or Set child when it will result in a second default value existing within the container.

	#rb Matt.Kuhlenschmidt

Change 3132587 on 2016/09/20 by Mike.Fricker

	MIDI Plugin: Fixed a CIS error in shipping configuration (introduced in CL 3108604)
	#rb none
	#lockdown matt.kuhlenschmidt

Change 3132623 on 2016/09/20 by Matt.Kuhlenschmidt

	Fix crash opening the cooker settings

	https://jira.it.epicgames.net/browse/UE-36197

	#rb none
	#lockdown nick.darnell

Change 3133144 on 2016/09/20 by Nick.Darnell

	Build configuration for automation tests.

	#rb none
	#lockdown matt.kuhlenschmidt

Change 3133206 on 2016/09/20 by Matt.Kuhlenschmidt

	Fix default material on odin text

	#rb none
	#lockdown nick.darnell

Change 3133913 on 2016/09/21 by Nick.Darnell

	Back out revision 17 from //UE4/Dev-Editor/Engine/Source/Runtime/UMG/Private/Slate/SRetainerWidget.cpp

	#rb none
	#jira UE-36231
	#lockdown matt.kuhlenschmidt

[CL 3133983 by Matt Kuhlenschmidt in Main branch]
2016-09-21 10:07:18 -04:00

2715 lines
87 KiB
C#

/**
* Copyright 1998-2016 Epic Games, Inc. All Rights Reserved.
*/
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Configuration;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Reflection;
using System.Text;
using System.Windows.Forms;
using System.Xml;
using System.Xml.Serialization;
using System.Linq;
using EnvDTE;
using EpicCommonUtils;
using UnrealControls;
using System.Drawing.Drawing2D;
using System.Windows.Forms.DataVisualization.Charting;
namespace MemoryProfiler2
{
public partial class MainWindow : Form
{
public const int DEFAULT_MINOR_TICK_WIDTH = 12;
public const int DEFAULT_MAJOR_TICK_WIDTH = 30;
/// <summary> A class that is serialised to disk with settings info. </summary>
public SettableOptions Options = null;
/// <summary> List of file offsets to create custom snapshots for. </summary>
private List<int> CustomSnapshots = new List<int>();
/// <summary> Current active snapshot. Either a diff if start is != start of actual snapshot if start == start. </summary>
public FStreamSnapshot CurrentSnapshot;
/// <summary> Current file name associated with open file. </summary>
public string CurrentFilename;
/// <summary> Progress indicator window. </summary>
public SlowProgressDialog ProgressDialog = new SlowProgressDialog();
/// <summary> Selected memory pool filter. </summary>
public EMemoryPool SelectedMemoryPool = EMemoryPool.MEMPOOL_None;
/// <summary> Font used to draw numbers on an axis. </summary>
public Font AxisFont = new Font( FontFamily.GenericSansSerif, 13, GraphicsUnit.Pixel );
/// <summary> Initializes common controls and setups all needed properties. </summary>
private void CommonInit()
{
Options = UnrealControls.XmlHandler.ReadXml<SettableOptions>( Path.Combine( Application.StartupPath, "MemoryProfiler2.ClassGroups.xml" ) );
Options.ApplyDefaults();
AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler( CurrentDomain_AssemblyResolve );
ExclusiveListView.ListViewItemSorter = new FColumnSorter();
PopulateClassGroups();
InvertCallgraphViewMenuItem.Checked = Options.InvertCallStacksInCallGraphView;
FilterObjectVMFunctionsMenuItem.Checked = Options.FilterOutObjectVMFunctions;
SelectedMemoryPool = ( EMemoryPool )Options.MemoryPoolFilterState;
UpdatePoolFilterFromSelectedPool();
FCallGraphTreeViewParser.SetProfilerWindow( this );
FCallStackHistoryView.SetProfilerWindow( this );
FExclusiveListViewParser.SetProfilerWindow( this );
FTimeLineChartView.SetProfilerWindow( this );
FHistogramParser.SetProfilerWindow( this );
FMemoryBitmapParser.SetProfilerWindow( this );
FShortLivedAllocationView.SetProfilerWindow( this );
SetupFilteringControls();
ResetFilteringState();
LastResizedSize = Size;
ToolTip DetailsViewTips = new ToolTip();
DetailsViewTips.SetToolTip( DetailsViewStartLabel, "Shows start snapshot detailed information" );
DetailsViewTips.SetToolTip( DetailsViewDiffLabel, "Shows detailed information as a difference between end and start snapshot" );
DetailsViewTips.SetToolTip( DetailsViewEndLabel, "Shows end snapshot detailed information" );
}
/// <summary> Default constructor. </summary>
public MainWindow()
{
InitializeComponent();
CommonInit();
}
/// <summary> Filename based constructor. </summary>
/// <param name="Filename"> Name of the filename that we want to be loaded on the application start </param>
public MainWindow( string Filename )
{
InitializeComponent();
CommonInit();
ParseFile( Filename );
}
/// <summary> Saves options, occurs before the main window is closed. </summary>
private void MainWindowFormClosing( object sender, FormClosingEventArgs e )
{
UnrealControls.XmlHandler.WriteXml<SettableOptions>( Options, Path.Combine( Application.StartupPath, "MemoryProfiler2.ClassGroups.xml" ), "" );
if( FStreamInfo.GlobalInstance != null )
{
FStreamInfo.GlobalInstance.Shutdown();
}
}
/// <summary> Set the wait cursor to the hourglass for long operations. </summary>
public void SetWaitCursor( bool bOn )
{
UseWaitCursor = bOn;
if( UseWaitCursor )
{
Cursor = Cursors.WaitCursor;
}
else
{
Cursor = Cursors.Default;
}
}
/// <summary> Updates the status string label with the passed in string. </summary>
/// <param name="Status"> New status to set. </param>
public void UpdateStatus( string Status )
{
StatusStripLabel.Text = Status;
Refresh();
}
#region "Classes to filter" menu
/*-----------------------------------------------------------------------------
"Classes to filter" menu
-----------------------------------------------------------------------------*/
/// <summary> Tag used to determine that "All" history menu was chosen. </summary>
const string AllHistoryTag = "AllHistory";
/// <summary> Function used to compare class group name. </summary>
public int ClassGroupSortFunction( ClassGroup Left, ClassGroup Right )
{
return ( string.Compare( Left.Name, Right.Name, StringComparison.InvariantCultureIgnoreCase ) );
}
/// <summary> Populates class groups into "Classes to filter" menu. </summary>
private void PopulateClassGroups()
{
// Clear out the old list (if any)
FilterClassesDropDownButton.DropDownItems.Clear();
// Add in each classgroup alphabetically
Options.ClassGroups.Sort( new Comparison<ClassGroup>( ClassGroupSortFunction ) );
foreach( ClassGroup FilterClass in Options.ClassGroups )
{
ToolStripMenuItemEx MenuItem = new ToolStripMenuItemEx( FilterClass.Name );
MenuItem.CheckOnClick = true;
MenuItem.Checked = true;
MenuItem.Tag = FilterClass;
MenuItem.CheckState = FilterClass.bFilter ? CheckState.Checked : CheckState.Unchecked;
MenuItem.MouseUp += ClassesToFilterMouseUp;
MenuItem.FilteringColor = FilterClass.Color;
MenuItem.bDrawExclamationMark = false;
MenuItem.Image = Properties.Resources.ExclamationMark;
MenuItem.DisplayStyle = ToolStripItemDisplayStyle.Text;
FilterClassesDropDownButton.DropDownItems.Add( MenuItem );
}
// Add in the all and none options
ToolStripSeparator Separator = new ToolStripSeparator();
FilterClassesDropDownButton.DropDownItems.Add( Separator );
ToolStripMenuItem AllMenuItem = new ToolStripMenuItem( "All" );
AllMenuItem.Click += new System.EventHandler( FilterAllClick );
AllMenuItem.MouseUp += ClassesToFilterMouseUp;
AllMenuItem.Tag = AllHistoryTag;
FilterClassesDropDownButton.DropDownItems.Add( AllMenuItem );
ToolStripMenuItem NoneMenuItem = new ToolStripMenuItem( "None" );
NoneMenuItem.Click += new System.EventHandler( FilterNoneClick );
FilterClassesDropDownButton.DropDownItems.Add( NoneMenuItem );
}
#endregion
/// <summary> Assembly resolve method to pick correct StandaloneSymbolParser DLL. </summary>
private Assembly CurrentDomain_AssemblyResolve( Object sender, ResolveEventArgs args )
{
// Name is fully qualified assembly definition - e.g. "p4dn, Version=1.0.0.0, Culture=neutral, PublicKeyToken=ff968dc1933aba6f"
string[] AssemblyInfo = args.Name.Split( ",".ToCharArray() );
string AssemblyName = AssemblyInfo[0];
int ToolsIndex = AssemblyName.ToLower().IndexOf( "tools" );
if( ToolsIndex > 0 )
{
string ToolsName = AssemblyName.Substring( 0, ToolsIndex );
AssemblyName = Application.StartupPath + "\\" + ToolsName + "\\";
if( Environment.Is64BitProcess )
{
AssemblyName += ToolsName + "Tools_x64.dll";
}
else
{
AssemblyName += ToolsName + "Tools.dll";
}
Debug.WriteLineIf( System.Diagnostics.Debugger.IsAttached, "Loading assembly: " + AssemblyName );
Assembly ToolsAssembly = Assembly.LoadFile( AssemblyName );
return ToolsAssembly;
}
return ( null );
}
#region Snapshot helper functions
/*-----------------------------------------------------------------------------
Snapshot helper functions
-----------------------------------------------------------------------------*/
/// <summary> Returns true if the " Filter In" option is selected (otherwise the option is assumed to be " Filter Out"). </summary>
public bool IsFilteringIn()
{
return FilterTypeSplitButton.Text == " Filter In";
}
/// <summary>
/// Returns index of selected start snapshot.
/// NOTE: 'Start' snapshot is -1
/// </summary>
public int GetStartSnapshotIndex()
{
return DiffStartComboBox.SelectedIndex - 1;
}
/// <summary>
/// Returns index of selected end snapshot.
/// NOTE: 'Start' snapshot is -1
/// </summary>
public int GetEndSnapshotIndex()
{
return DiffEndComboBox.SelectedIndex - 1;
}
/// <summary> Returns stream index of the selected start snapshot. </summary>
public ulong GetStartSnapshotStreamIndex()
{
return DiffStartComboBox.SelectedIndex == 0 ? 0 : FStreamInfo.GlobalInstance.SnapshotList[ DiffStartComboBox.SelectedIndex - 1 ].StreamIndex;
}
/// <summary> Returns stream index of the selected end snapshot. </summary>
public ulong GetEndSnapshotStreamIndex()
{
return DiffEndComboBox.SelectedIndex == 0 ? 0 : FStreamInfo.GlobalInstance.SnapshotList[ DiffEndComboBox.SelectedIndex - 1 ].StreamIndex;
}
/// <summary> Returns the snapshot index based on start snapshot index and stream index. </summary>
/// <param name="StartSnapshot"> Snapshot index we start searching, may be 0 if we want to look through all snapshots. </param>
/// <param name="StreamIndex"> Stream index of the snapshot that we are looking for. </param>
public int GetSnapshotIndexFromStreamIndex( int StartSnapshot, ulong StreamIndex )
{
for( int SnapshotIndex = StartSnapshot; SnapshotIndex < FStreamInfo.GlobalInstance.SnapshotList.Count; SnapshotIndex++ )
{
if( FStreamInfo.GlobalInstance.SnapshotList[ SnapshotIndex ].StreamIndex > StreamIndex )
{
return SnapshotIndex;
}
}
return FStreamInfo.GlobalInstance.SnapshotList.Count;
}
/// <summary> Returns the allocation count of the far left point on the timeline chart. </summary>
private long GetStartingAllocationCount()
{
if( DiffStartComboBox.SelectedIndex <= DiffEndComboBox.SelectedIndex )
{
if( DiffStartComboBox.SelectedIndex == 0 )
{
return 0;
}
return FStreamInfo.GlobalInstance.SnapshotList[ DiffStartComboBox.SelectedIndex - 1 ].AllocationCount;
}
else
{
if( DiffEndComboBox.SelectedIndex == 0 )
{
return 0;
}
return FStreamInfo.GlobalInstance.SnapshotList[ DiffEndComboBox.SelectedIndex - 1 ].AllocationCount;
}
}
/// <summary> Updates current snapshot based on selected values in diff start/ end combo boxes. </summary>
private void UpdateCurrentSnapshot()
{
if( FStreamInfo.GlobalInstance.SnapshotList == null )
{
return;
}
// Start == "Start"
if( DiffStartComboBox.SelectedIndex == 0 )
{
// End == Start == "Start"
if( DiffEndComboBox.SelectedIndex == 0 )
{
// "Start" is a pseudo snapshot so there is nothing to compare here.
CurrentSnapshot = null;
}
else
{
// Comparing to "Start" means we can simply use the current index (-1 as Start doesn't have index associated).
CurrentSnapshot = FStreamInfo.GlobalInstance.SnapshotList[ DiffEndComboBox.SelectedIndex - 1 ];
}
}
// Start != "Start"
else
{
// End == "Start"
if( DiffEndComboBox.SelectedIndex == 0 )
{
// Comparing to "Start" means we can simply use the current index (-1 as Start doesn't have index associated).
CurrentSnapshot = FStreamInfo.GlobalInstance.SnapshotList[ DiffStartComboBox.SelectedIndex - 1 ];
}
// Start != End and both are != "Start"
else
{
// Do a real diff in this case and create a new snapshot.
CurrentSnapshot = FStreamSnapshot.DiffSnapshots( FStreamInfo.GlobalInstance.SnapshotList[ DiffStartComboBox.SelectedIndex - 1 ], FStreamInfo.GlobalInstance.SnapshotList[ DiffEndComboBox.SelectedIndex - 1 ] );
}
}
UpdateDetailsTab();
}
/// <summary> Parses the data stream into the current view. </summary>
private void ParseCurrentView()
{
// Update the current snapshot based on combo box settings.
UpdateCurrentSnapshot();
// If valid, parse it into the selected tab view.
if( CurrentSnapshot != null )
{
bool bShouldSortBySize = ( SortCriteriaSplitButton.Text == " Sort by Size" );
List<FCallStackAllocationInfo> CallStackList = null;
if( AllocationsTypeSplitButton.Text == " Active Allocations" )
{
CallStackList = CurrentSnapshot.ActiveCallStackList;
}
else
{
CallStackList = CurrentSnapshot.LifetimeCallStackList;
}
// make sure the SelectedMemoryPool isn't masking out anything for Non-PS3 profiles
if (!MemoryPoolFilterButton.Enabled)
{
SelectedMemoryPool = IsFilteringIn() ? EMemoryPool.MEMPOOL_All : EMemoryPool.MEMPOOL_None;
}
// Parse snapshots into views.
// updating the call graph view is WAY SLOW
if( MainTabControl.SelectedTab == CallGraphTabPage )
{
FCallGraphTreeViewParser.ParseSnapshot( CallGraphTreeView, CallStackList, bShouldSortBySize, FilterTextBox.Text.ToUpperInvariant(), Options.InvertCallStacksInCallGraphView );
}
else if( MainTabControl.SelectedTab == ExclusiveTabPage )
{
FExclusiveListViewParser.ParseSnapshot( ExclusiveListView, CallStackList, bShouldSortBySize, FilterTextBox.Text.ToUpperInvariant() );
}
else if( MainTabControl.SelectedTab == TimeLineTabPage )
{
FTimeLineChartView.ParseSnapshot( TimeLineChart, CurrentSnapshot );
}
else if( MainTabControl.SelectedTab == HistogramTabPage )
{
FHistogramParser.ParseSnapshot( CallStackList, FilterTextBox.Text.ToUpperInvariant() );
}
else if( MainTabControl.SelectedTab == CallstackHistoryTabPage )
{
// Refresh tab with existing history callstacks, in case any options have changed.
FCallStackHistoryView.RefreshCallStackHistoryGraph();
}
else if( MainTabControl.SelectedTab == MemoryBitmapTabPage )
{
FMemoryBitmapParser.ResetZoom();
}
else if( MainTabControl.SelectedTab == ShortLivedAllocationsTabPage )
{
FShortLivedAllocationView.ParseSnapshot( FilterTextBox.Text.ToUpperInvariant() );
}
ResetFilteringState();
}
else
{
// Clear the views to signal error.
ResetViews();
}
UpdateStatus( "Displaying " + CurrentFilename );
}
private void GoButton_Click( object sender, EventArgs e )
{
SetWaitCursor( true );
#if !DEBUG
try
#endif // !DEBUG
{
ParseCurrentView();
}
#if !DEBUG
catch( Exception ex )
{
UpdateStatus( "Error updating view: " + ex.Message );
Trace.WriteLine("-----------------------------------");
Trace.WriteLine(ex.ToString());
Trace.WriteLine("-----------------------------------");
}
#endif // !DEBUG
SetWaitCursor( false );
}
/// <summary> Resets combobox items and various views into data. </summary>
private void ResetComboBoxAndViews()
{
// Reset combobox items.
DiffStartComboBox.Items.Clear();
DiffEndComboBox.Items.Clear();
// Clear text filter.
FilterTextBox.Text = "";
// Reset views.
ResetViews();
}
/// <summary> Resets the various views into the data. </summary>
private void ResetViews()
{
// Clear callgraph tree.
CallGraphTreeView.Nodes.Clear();
FCallGraphTreeViewParser.ParentFunctionIndex = -1;
ParentLabel.Text = "(not set)";
// Clear exclusive list view.
FExclusiveListViewParser.ClearView();
// Clear timeline view.
FTimeLineChartView.ClearView();
// Clear callstack history view.
FCallStackHistoryView.ClearView();
// Clear histogram view.
FHistogramParser.ClearView();
// Clear memory bitmap view.
FMemoryBitmapParser.ClearView();
// Clear short lived allocation view.
FShortLivedAllocationView.ClearView();
}
/// <summary> Parses the memory profiler snapshot file. </summary>
private void ParseFile( string InCurrentFilename )
{
CurrentFilename = InCurrentFilename;
MemoryPoolFilterButton.Enabled = false;
// Only parse if we have a valid file.
if( CurrentFilename != "" )
{
// Disable all menus.
MainToolStrip.Enabled = false;
MainTabControl.Enabled = false;
#if !DEBUG
try
#endif // !DEBUG
{
if( FStreamInfo.GlobalInstance != null )
{
// clean up old stream info
// this includes terminating the addr2line process, if there is one
FStreamInfo.GlobalInstance.Shutdown();
}
// Create a new stream info from the opened file.
FStreamInfo.GlobalInstance = new FStreamInfo( CurrentFilename, new ProfilingOptions() );
CustomSnapshots.Sort();
// Parse the token stream and metadata.
#if !DEBUG
ProgressDialog.OnBeginBackgroundWork = delegate( BackgroundWorker BGWorker, DoWorkEventArgs EventArgs )
{
FStreamParser.Parse( this, BGWorker, null, CustomSnapshots, EventArgs );
};
if( ProgressDialog.ShowDialog() != DialogResult.OK )
{
UpdateStatus( "Failed to parse '" + CurrentFilename + "', due to '" + ProgressDialog.ExceptionResult + "'" );
return;
}
#else
FStreamParser.Parse( this, ProgressDialog.SlowWork, null, CustomSnapshots, null );
#endif // !DEBUG
// Add Start, End values and user generated snapshots in between.
DiffStartComboBox.Items.Add( "Start" );
DiffEndComboBox.Items.Add( "Start" );
// Count-1 as End is implicit last snapshot in list.
for( int SnapshotIndex = 0; SnapshotIndex < FStreamInfo.GlobalInstance.SnapshotList.Count - 1; SnapshotIndex++ )
{
string SnapshotDescription = "#" + SnapshotIndex;
if( !String.IsNullOrEmpty( FStreamInfo.GlobalInstance.SnapshotList[ SnapshotIndex ].Description ) )
{
SnapshotDescription += ": " + FStreamInfo.GlobalInstance.SnapshotList[ SnapshotIndex ].Description;
}
DiffStartComboBox.Items.Add( SnapshotDescription );
DiffEndComboBox.Items.Add( SnapshotDescription );
}
DiffStartComboBox.Items.Add( "End" );
DiffEndComboBox.Items.Add( "End" );
// Start defaults to "Start" and End defaults to "End" being selected.
DiffStartComboBox.SelectedIndex = 0;
DiffEndComboBox.SelectedIndex = DiffEndComboBox.Items.Count - 1;
UpdateStatus( "Parsed " + CurrentFilename );
// Re-enable all required menus
MainToolStrip.Enabled = true;
MainTabControl.Enabled = true;
ResetFilteringState();
}
#if !DEBUG
catch( Exception ex )
{
UpdateStatus( "Failed to parse '" + CurrentFilename + "', due to '" + ex.Message + "'" );
// Reset combobox items and various views into data
ResetComboBoxAndViews();
// Clean up global FStreamInfo so that we can test whether
// FStreamInfo.GlobalInstance is null to see if there's a valid
// mprof loaded.
if( FStreamInfo.GlobalInstance != null )
{
FStreamInfo.GlobalInstance.Shutdown();
}
FStreamInfo.GlobalInstance = null;
}
#endif // !DEBUG
}
}
#endregion
#region Open file in Visual Studio methods
/*-----------------------------------------------------------------------------
Open file in Visual Studio methods
-----------------------------------------------------------------------------*/
protected EnvDTE.DTE FindOrCreateDTEInstance( string ObjectName )
{
// Try to find an open copy, and if that fails, create one
EnvDTE.DTE result;
try
{
result = System.Runtime.InteropServices.Marshal.GetActiveObject( ObjectName ) as EnvDTE.DTE;
}
catch
{
System.Type t = System.Type.GetTypeFromProgID( ObjectName );
result = System.Activator.CreateInstance( t ) as EnvDTE.DTE;
}
return result;
}
/// <summary> Opens specified file in the Visual Studio. </summary>
/// <param name="Filename"> File we want to be opened in the Visual Studio. </param>
/// <param name="LineNumber"> Linenumber we want that the Visual Studio will jump to. </param>
protected void OpenFileInVisualStudio( string Filename, int LineNumber )
{
// Get a copy of VS running
EnvDTE.DTE devenv = FindOrCreateDTEInstance( "VisualStudio.DTE" );
if( devenv == null )
{
// Couldn't get VS running at all!
return;
}
// Make sure the window is visible and prevent it from disappearing
devenv.MainWindow.Visible = true;
devenv.UserControl = true;
// Open the file
Window win = devenv.ItemOperations.OpenFile( Filename, EnvDTE.Constants.vsViewKindTextView );
// Go to the desired line number
if( LineNumber >= 0 )
{
TextSelection selection = devenv.ActiveDocument.Selection as TextSelection;
selection.GotoLine( LineNumber, true );
}
}
// 0 == deepest part of callstack
void OpenCallstackEntryInVS( FCallStackAllocationInfo AllocationInfo, int Index )
{
FCallStack CallStack = FStreamInfo.GlobalInstance.CallStackArray[ AllocationInfo.CallStackIndex ];
FCallStackAddress Address = FStreamInfo.GlobalInstance.CallStackAddressArray[ CallStack.AddressIndices[ CallStack.AddressIndices.Count - 1 - Index ] ];
string Filename = FStreamInfo.GlobalInstance.NameArray[ Address.FilenameIndex ];
try
{
OpenFileInVisualStudio( Filename, Address.LineNumber );
}
catch( Exception )
{
}
}
#endregion
#region Main toolstrip, menu, tab etc events
/*-----------------------------------------------------------------------------
Main toolstrip, menu, tab etc events
-----------------------------------------------------------------------------*/
/// <summary> Occurs when a tab is selected. </summary>
private void MainTabControl_Selected( object sender, TabControlEventArgs e )
{
SortCriteriaSplitButton.Enabled = e.TabPage == CallGraphTabPage || e.TabPage == ExclusiveTabPage;
AllocationsTypeSplitButton.Enabled = e.TabPage == CallGraphTabPage || e.TabPage == ExclusiveTabPage || e.TabPage == HistogramTabPage;
ContainersSplitButton.Enabled = e.TabPage == ExclusiveTabPage;
FilterTypeSplitButton.Enabled = e.TabPage == TimeLineTabPage ? false : true;
FilterClassesDropDownButton.Enabled = e.TabPage == TimeLineTabPage ? false : true;
FilterTypeSplitButton.Enabled = e.TabPage == TimeLineTabPage ? false : true;
FilterLabel.Enabled = e.TabPage == TimeLineTabPage ? false : true;
FilterTextBox.Enabled = e.TabPage == TimeLineTabPage ? false : true;
if( e.TabPage != ExclusiveTabPage )
{
SelectionSizeStatusLabel.Text = "";
}
if( e.TabPage == DetailsTabPage )
{
UpdateDetailsTab();
}
}
private void QuitMenuItem_Click( object sender, EventArgs e )
{
Application.Exit();
}
/// <summary> Occurs when a key is pressed in "Text filter" text box. </summary>
private void FilterTextBox_KeyPress( object sender, KeyPressEventArgs e )
{
if( e.KeyChar == ( char )Keys.Enter )
{
GoButton_Click( sender, new EventArgs() );
e.Handled = true;
}
}
private void FilterObjectVMFunctionsMenuItem_CheckedChanged( object sender, EventArgs e )
{
Options.FilterOutObjectVMFunctions = FilterObjectVMFunctionsMenuItem.Checked;
}
/// <summary> Processes a command key. </summary>
protected override bool ProcessCmdKey( ref Message Msg, Keys KeyData )
{
if( MainTabControl.SelectedTab == HistogramTabPage && FHistogramParser.ProcessKeys( KeyData ) )
{
return true;
}
return base.ProcessCmdKey( ref Msg, KeyData );
}
/// <summary> Creates a file open dialog for selecting the .mprof file. </summary>
private void OpenToolStripMenuItem_Click( object sender, EventArgs e )
{
OpenFileDialog OpenMProfFileDialog = new OpenFileDialog();
OpenMProfFileDialog.Title = "Open the profile data file from the game's 'Profiling' folder";
OpenMProfFileDialog.Filter = "Profiling Data (*.mprof)|*.mprof";
OpenMProfFileDialog.RestoreDirectory = false;
OpenMProfFileDialog.SupportMultiDottedExtensions = true;
if( OpenMProfFileDialog.ShowDialog() == DialogResult.OK )
{
// Reset combobox items and various views into data
ResetComboBoxAndViews();
ParseFile( OpenMProfFileDialog.FileName );
}
}
/// <summary> Brings up dialog for user to pick filename to export data to. </summary>
private void ExportToCSVToolStripMenuItem_Click( object sender, EventArgs e )
{
try
{
SaveFileDialog ExportToCSVFileDialog = new SaveFileDialog();
ExportToCSVFileDialog.Title = "Export memory profiling data to a .csv file";
ExportToCSVFileDialog.Filter = "CallGraph in CSV (*.csv)|*.csv";
ExportToCSVFileDialog.RestoreDirectory = false;
ExportToCSVFileDialog.SupportMultiDottedExtensions = false;
if( ExportToCSVFileDialog.ShowDialog() == DialogResult.OK )
{
// Determine whether to export lifetime or active allocations.
bool bShouldExportActiveAllocations = ( AllocationsTypeSplitButton.Text == " Active Allocations" );
// Export call graph from current snapshot to CSV.
CurrentSnapshot.ExportToCSV( ExportToCSVFileDialog.FileName, bShouldExportActiveAllocations );
}
}
catch( Exception ex )
{
MessageBox.Show( ex.Message, "Failed to export to CSV", MessageBoxButtons.OK, MessageBoxIcon.Error );
}
}
/// <summary> Opens an UDN Memory Profiler page. </summary>
private void QuickStartMenuClick( object sender, EventArgs e )
{
//MessageBox.Show( "Define USE_MALLOC_PROFILER 1 in UMemoryDefines.h\n\nWhile running, type SNAPSHOTMEMORY at suitable intervals. At the end of profiling, type DUMPALLOCSTOFILE to save the .mprof file.\n\nLoad in the .mprof file from <Name>Game/Profiling/<timestamp>/<Name>-<timestamp>.mprof", "Memory Profiler Quick Start", MessageBoxButtons.OK, MessageBoxIcon.Information );
System.Diagnostics.Process.Start( "https://udn.unrealengine.com/docs/ue3/INT/Engine/Subsystems/Memory/Profiling/Tools/Profiler/index.html" );
}
/// <summary> Opens the options dialog. </summary>
private void OptionsToolStripMenuItem_Click( object sender, EventArgs e )
{
OptionsDialog DisplayOptions = new OptionsDialog( this, Options );
DisplayOptions.ShowDialog();
PopulateClassGroups();
ResetFilteringState();
}
/// <summary> Handles clicking on the one of the split buttons ( sort, allocations, containers and filter ). </summary>
private void SplitButtonClick( object sender, EventArgs e )
{
ToolStripSplitButton Button = ( ToolStripSplitButton )sender;
if( Button.DropDownItems.Count > 1 )
{
// Update the button to the next entry in the split button drop down item collection
bool bFoundEntry = false;
foreach( ToolStripMenuItem MenuItem in Button.DropDownItems )
{
if( bFoundEntry )
{
Button.Text = MenuItem.Text;
bFoundEntry = false;
}
else if( Button.Text == MenuItem.Text )
{
bFoundEntry = true;
}
}
// Handle case of looping around to the beginning
if( bFoundEntry )
{
Button.Text = Button.DropDownItems[ 0 ].Text;
}
}
UpdateFilteringState();
}
/// <summary> Handles clicking on the one of the sort by menu items. </summary>
private void SortByClick( object sender, EventArgs e )
{
ToolStripMenuItem Item = ( ToolStripMenuItem )sender;
SortCriteriaSplitButton.Text = Item.Text;
UpdateFilteringState();
}
/// <summary> Handles clicking on the one of the allocations type menu items. </summary>
private void AllocationsTypeClick( object sender, EventArgs e )
{
ToolStripMenuItem Item = ( ToolStripMenuItem )sender;
AllocationsTypeSplitButton.Text = Item.Text;
UpdateFilteringState();
}
/// <summary> Handles clicking on the one of the containers visibility menu items. </summary>
private void ContainersSplitClick( object sender, EventArgs e )
{
ToolStripMenuItem Item = ( ToolStripMenuItem )sender;
ContainersSplitButton.Text = Item.Text;
UpdateFilteringState();
}
/// <summary> Handles clicking on the one of the filtering type menu items. </summary>
private void FilterTypeClick( object sender, EventArgs e )
{
ToolStripMenuItem Item = ( ToolStripMenuItem )sender;
FilterTypeSplitButton.Text = Item.Text;
UpdateFilteringState();
}
/// <summary> Changes the check state of all class groups. </summary>
/// <param name="bState"> Boolean check state that we want to set </param>
private void SetAllClasses( bool bState )
{
foreach( ToolStripItem Item in FilterClassesDropDownButton.DropDownItems )
{
ToolStripMenuItem MenuItem = Item as ToolStripMenuItem;
if( MenuItem != null && Item.Tag is ClassGroup )
{
ClassGroup FilterClass = ( ClassGroup )Item.Tag;
if( FilterClass != null )
{
MenuItem.Checked = bState;
FilterClass.bFilter = bState;
}
}
}
}
/// <summary> Checks all class group in the class filter menu. </summary>
private void FilterAllClick( object sender, EventArgs e )
{
SetAllClasses( true );
FilterClassesDropDownButton.ShowDropDown();
UpdateFilteringState();
}
/// <summary> Unchecks all class group in the class filter menu. </summary>
private void FilterNoneClick( object sender, EventArgs e )
{
SetAllClasses( false );
FilterClassesDropDownButton.ShowDropDown();
UpdateFilteringState();
}
/// <summary> Handles clicking on the one of the class groups. </summary>
private void ClassesToFilterMouseUp( object sender, MouseEventArgs e )
{
ToolStripMenuItem Item = ( ToolStripMenuItem )sender;
if( Item.Tag is ClassGroup )
{
ClassGroup FilterClass = ( ClassGroup )Item.Tag;
if( e.Button == MouseButtons.Left )
{
FilterClass.bFilter = Item.Checked;
}
else if( e.Button == MouseButtons.Right )
{
ViewHistoryContextMenu.Tag = FilterClass;
ViewHistoryContextMenu.Show( Item.Owner, new Point( e.Location.X + Item.Bounds.Location.X, e.Location.Y + Item.Bounds.Location.Y ) );
}
}
else if( Item.Tag is string )
{
if( e.Button == MouseButtons.Right )
{
ViewHistoryContextMenu.Tag = Item.Tag;
ViewHistoryContextMenu.Show( Item.Owner, new Point( e.Location.X + Item.Bounds.Location.X, e.Location.Y + Item.Bounds.Location.Y ) );
}
}
if( e.Button == MouseButtons.Left )
{
// Make the drop down list not go away when clicked (DismissWhenClicked is unsettable)
FilterClassesDropDownButton.ShowDropDown();
}
UpdateFilteringState();
}
#endregion
#region XML options methods
/*-----------------------------------------------------------------------------
XML options methods
-----------------------------------------------------------------------------*/
protected void XmlSerializer_UnknownAttribute( object sender, XmlAttributeEventArgs e )
{
}
protected void XmlSerializer_UnknownNode( object sender, XmlNodeEventArgs e )
{
}
#endregion
#region Timeline chart panel events
/*-----------------------------------------------------------------------------
Timeline chart panel events
-----------------------------------------------------------------------------*/
private void TimeLineChart_SelectionRangeChanged( object sender, System.Windows.Forms.DataVisualization.Charting.CursorEventArgs Event )
{
if( Event.Axis.AxisName == System.Windows.Forms.DataVisualization.Charting.AxisName.X )
{
// Disregard event when zooming or invalid (NaN) selection.
if( Event.NewSelectionStart != Event.NewSelectionEnd )
{
}
// Single frame is selected, parse it!
else
{
int SelectedFrame = ( int )( Event.NewSelectionStart + ( GetStartingAllocationCount() / 5000 ) );
bool bAdded = FTimeLineChartView.AddCustomSnapshot( TimeLineChart, Event );
if( bAdded )
{
MessageBox.Show( "Custom mark point added. Reload file for new blank mark point." );
}
if( !CustomSnapshots.Contains( SelectedFrame ) )
{
CustomSnapshots.Add( SelectedFrame );
}
}
}
}
#endregion
#region Memory pool menu events
/*-----------------------------------------------------------------------------
Memory pool menu events
-----------------------------------------------------------------------------*/
/// <summary> Updates memory pool filter menu items based on the selected memory pool. </summary>
private void UpdatePoolFilterFromSelectedPool()
{
PoolMainItem.Checked = ( SelectedMemoryPool & EMemoryPool.MEMPOOL_Main ) != EMemoryPool.MEMPOOL_None;
PoolLocalItem.Checked = ( SelectedMemoryPool & EMemoryPool.MEMPOOL_Local ) != EMemoryPool.MEMPOOL_None;
PoolHostDefaultItem.Checked = ( SelectedMemoryPool & EMemoryPool.MEMPOOL_HostDefault ) != EMemoryPool.MEMPOOL_None;
PoolHostMoviesItem.Checked = ( SelectedMemoryPool & EMemoryPool.MEMPOOL_HostMovies ) != EMemoryPool.MEMPOOL_None;
}
/// <summary> Updates the selected memory pool based on memory pool filter menu items. </summary>
private void RefreshSelectedMemoryPool()
{
if (MemoryPoolFilterButton.Enabled)
{
SelectedMemoryPool = EMemoryPool.MEMPOOL_None;
if (PoolMainItem.Checked)
{
SelectedMemoryPool |= EMemoryPool.MEMPOOL_Main;
}
if (PoolLocalItem.Checked)
{
SelectedMemoryPool |= EMemoryPool.MEMPOOL_Local;
}
if (PoolHostDefaultItem.Checked)
{
SelectedMemoryPool |= EMemoryPool.MEMPOOL_HostDefault;
}
if (PoolHostMoviesItem.Checked)
{
SelectedMemoryPool |= EMemoryPool.MEMPOOL_HostMovies;
}
}
else
{
SelectedMemoryPool = EMemoryPool.MEMPOOL_All;
}
Options.MemoryPoolFilterState = ( uint )SelectedMemoryPool;
UpdateFilteringState();
}
/// <summary> Handles clicking on the one of the memory pools. </summary>
private void MemoryPoolFilterClick( object sender, EventArgs e )
{
RefreshSelectedMemoryPool();
}
/// <summary> Unchecks all memory pools in the memory pool filter menu. </summary>
private void PoolAllItem_Click( object sender, EventArgs e )
{
PoolMainItem.Checked = true;
PoolLocalItem.Checked = true;
PoolHostDefaultItem.Checked = true;
PoolHostMoviesItem.Checked = true;
RefreshSelectedMemoryPool();
}
/// <summary> Unchecks all memory pools in the memory pool filter menu. </summary>
private void PoolNoneItem_Click( object sender, EventArgs e )
{
PoolMainItem.Checked = false;
PoolLocalItem.Checked = false;
PoolHostDefaultItem.Checked = false;
PoolHostMoviesItem.Checked = false;
RefreshSelectedMemoryPool();
}
/// <summary> Prevents from hiding the drop down list after selecting one of the menu items. </summary>
private void PoolFilterButtonItem_MouseUp( object sender, MouseEventArgs e )
{
if( e.Button == MouseButtons.Left )
{
// Make the drop down list not go away when clicked (DismissWhenClicked is unsettable)
MemoryPoolFilterButton.ShowDropDown();
}
}
#endregion
#region Callstack history view helper functions
/*-----------------------------------------------------------------------------
Callstack history view helper functions
-----------------------------------------------------------------------------*/
/// <summary> Set callstacks for the callstack history view based on selected histogram bar and starts processing. </summary>
public void SetHistoryCallStacks( FHistogramBar Bar )
{
// Collect callstack indices in a sorted list to make it easier
// to filter out duplicate callstacks.
List<int> CallstackIndices = new List<int>();
foreach( FCallStackAllocationInfo AllocInfo in Bar.CallStackList )
{
bool bDone = false;
for( int Index = 0; Index < CallstackIndices.Count; Index++ )
{
if( CallstackIndices[ Index ] == AllocInfo.CallStackIndex )
{
// callstack is already in the list
bDone = true;
break;
}
else if( CallstackIndices[ Index ] > AllocInfo.CallStackIndex )
{
CallstackIndices.Insert( Index, AllocInfo.CallStackIndex );
bDone = true;
break;
}
}
if( !bDone )
{
CallstackIndices.Add( AllocInfo.CallStackIndex );
}
}
List<FCallStack> Callstacks = new List<FCallStack>( CallstackIndices.Count );
foreach( int Index in CallstackIndices )
{
Callstacks.Add( FStreamInfo.GlobalInstance.CallStackArray[ Index ] );
}
SetHistoryCallStacks( Callstacks );
}
/// <summary> Set callstacks for the callstack history view based on selected class group and starts processing. </summary>
public void SetHistoryCallStacks( ClassGroup InClassGroup )
{
// No callstack can be in multiple patterns, so there is no
// need to check for duplicates here.
List<FCallStack> Callstacks = new List<FCallStack>();
foreach( CallStackPattern Pattern in InClassGroup.CallStackPatterns )
{
Callstacks.AddRange( Pattern.GetCallStacks() );
}
SetHistoryCallStacks( Callstacks );
}
/// <summary> Set callstacks for the callstack history view based on selected callstacks in the callgrahp view and starts processing. </summary>
public void SetHistoryCallStacks( List<FCallStack> CallStacks )
{
if( !FStreamInfo.GlobalInstance.CreationOptions.GenerateSizeGraphsCheckBox.Checked )
{
return;
}
FCallStackHistoryView.SetHistoryCallstacks( CallStacks );
MainTabControl.SelectedTab = CallstackHistoryTabPage;
}
/// <summary> Handles mouse click on the view history menu. </summary>
private void ViewHistoryMenuItem_Click( object Sender, EventArgs e )
{
ToolStripMenuItem MenuItem = ( ( ToolStripMenuItem )Sender );
object Tag = MenuItem.Owner.Tag;
if( Tag is ListView )
{
SetHistoryCallStacks( GetSelectedCallStacks( ( ListView )Tag ) );
}
else if( Tag is FHistogramBar )
{
SetHistoryCallStacks( ( FHistogramBar )Tag );
}
else if( Tag is ClassGroup )
{
SetHistoryCallStacks( ( ClassGroup )Tag );
}
else if( Tag is string )
{
string TagString = ( string )Tag;
if( TagString == AllHistoryTag )
{
DialogResult DlgResult = MessageBox.Show
(
"Displaying callstack history for all callstacks may take an hour or more.\nDo You want to continue?",
"Show history for all callstacks?",
MessageBoxButtons.OKCancel
);
if( DlgResult == DialogResult.OK )
{
SetHistoryCallStacks( FStreamInfo.GlobalInstance.CallStackArray );
}
}
}
else
{
throw new ArgumentException( "ViewHistoryContextMenu.Tag was not set to a supported object type" );
}
}
/// <summary> Gets callstack list from selection done in the listview. </summary>
private static List<FCallStack> GetSelectedCallStacks( ListView InListView )
{
List<FCallStack> CallStacks = new List<FCallStack>( InListView.SelectedItems.Count );
foreach( ListViewItem Item in InListView.SelectedItems )
{
FCallStack CallStack = null;
if( Item.Tag is FCallStackAllocationInfo )
{
CallStack = FStreamInfo.GlobalInstance.CallStackArray[ ( ( FCallStackAllocationInfo )Item.Tag ).CallStackIndex ];
}
else if( Item.Tag is FCallStack )
{
CallStack = ( FCallStack )Item.Tag;
}
else if( Item.Tag is FShortLivedCallStackTag )
{
CallStack = ( ( FShortLivedCallStackTag )Item.Tag ).CallStack;
}
else if( Item.Tag is FCallStackTag )
{
CallStack = ( ( FCallStackTag )Item.Tag ).CallStack;
}
else
{
Debug.Assert( false, "Unsupported ListView tag type" );
}
CallStacks.Add( CallStack );
}
return CallStacks;
}
#endregion
#region Drawing functions
/*-----------------------------------------------------------------------------
Drawing functions
-----------------------------------------------------------------------------*/
/// <summary> Format a value into human readable string ended with "bytes", "KB" or "MB" based on size. </summary>
/// <param name="Size"> Value that we want to be converted into a string. </param>
public static string FormatSizeString( long Size )
{
string[] Units = { "bytes", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB" };
int UnitIndex = 0;
double AbsSize = Math.Abs(Size);
while (AbsSize >= 1024)
{
AbsSize /= 1024;
++UnitIndex;
}
return String.Format("{0} {1}", AbsSize.ToString("N2"), Units[UnitIndex]);
}
/// <summary> Format a value into human readable string ended ex. "5.50 MB (5767168 bytes). </summary>
/// <param name="Size"> Value that we want to be converted into a string. </param>
public static string FormatSizeString2( long Size )
{
return String.Format("{0} ({1} bytes)", FormatSizeString(Size), Size.ToString("N0"));
}
/// <summary> Setups string label for an axis based on tick. </summary>
/// <param name="TickMultiplier"> </param>
/// <param name="AxisHeightInBytes"> </param>
/// <param name="AxisLabel"> Human readable value for size label. </param>
/// <param name="MajorTick"> </param>
public static void SetUpAxisLabel( int TickMultiplier, ref float AxisHeightInBytes, out string AxisLabel, out long MajorTick )
{
long MajorTicks = 16 * Math.Max( TickMultiplier, 1 );
AxisLabel = "bytes";
MajorTick = ( long )AxisHeightInBytes / MajorTicks;
if( MajorTick > 4 * 1024 * 1024 )
{
AxisHeightInBytes /= 1024 * 1024;
MajorTick /= 1024 * 1024;
AxisLabel = "MB";
}
else if( MajorTick > 4 * 1024 )
{
AxisHeightInBytes /= 1024;
MajorTick /= 1024;
AxisLabel = "KB";
}
}
public void DrawYAxis( Graphics InGraphics, Pen InPen, Color Color, long MajorTick, long MinorTick, float Right, float Top, float PixelHeight, string AxisLabel, float AxisHeight )
{
DrawYAxis( InGraphics, InPen, Color, MajorTick, DEFAULT_MAJOR_TICK_WIDTH, MinorTick, DEFAULT_MINOR_TICK_WIDTH, Right, Top, PixelHeight, 0, PixelHeight, AxisLabel, AxisHeight, false, false );
}
public void DrawYAxis
(
Graphics InGraphics, Pen Pen, Color Color, long MajorTick, int MajorTickWidth, long MinorTick, int MinorTickWidth,
float Right, float Top, float WindowHeight, float WindowOffset, float PixelHeight,
string AxisLabel, float AxisHeight, bool InvertAxis, bool AxisLabelAtOrigin
)
{
DrawYAxis( InGraphics, Pen, MajorTick, MajorTickWidth, MinorTick, MinorTickWidth, Right, Top, WindowHeight, WindowOffset, PixelHeight, AxisLabel, AxisHeight, InvertAxis, AxisLabelAtOrigin, AxisFont, Color);
}
public static void DrawYAxis
(
Graphics InGraphics, Pen InPen, long MajorTick, int MajorTickWidth, long MinorTick, int MinorTickWidth,
float Right, float Top, float WindowHeight, float WindowOffset, float PixelHeight,
string AxisLabel, float AxisHeight, bool InvertAxis, bool AxisLabelAtOrigin, Font AxisFont, Color AxisFontColor
)
{
const int AxisLabelXOffset = 5;
float YScale = PixelHeight / AxisHeight;
SizeF LabelSize = InGraphics.MeasureString( AxisLabel, AxisFont );
float AxisLabelX, AxisLabelY;
if( AxisLabelAtOrigin )
{
AxisLabelX = Right - MajorTickWidth - AxisLabelXOffset - LabelSize.Width;
AxisLabelY = Top;
}
else
{
AxisLabelX = Right - ( MajorTickWidth + LabelSize.Width ) / 2;
AxisLabelY = Top - LabelSize.Height - 10;
}
TextRenderer.DrawText(InGraphics, AxisLabel, AxisFont, new Point((int)AxisLabelX, (int)AxisLabelY), AxisFontColor);
for( long j = AxisLabelAtOrigin ? MinorTick : 0; j <= AxisHeight; j += MinorTick )
{
int TickY;
if( InvertAxis )
{
TickY = ( int )( Top + YScale * j - WindowOffset );
}
else
{
TickY = ( int )( Top + YScale * ( AxisHeight - j ) - WindowOffset );
}
if( TickY >= Top && TickY < Top + WindowHeight + 1 )
{
if( j % MajorTick == 0 )
{
string Label = j.ToString();
SizeF StringSize = InGraphics.MeasureString( Label, AxisFont );
InGraphics.DrawLine( InPen, Right - MajorTickWidth, TickY, Right, TickY );
TextRenderer.DrawText(InGraphics, Label, AxisFont, new Point((int)(Right - MajorTickWidth - AxisLabelXOffset - StringSize.Width), (int)(TickY - StringSize.Height / 2)), AxisFontColor);
}
else
{
InGraphics.DrawLine( InPen, Right - MinorTickWidth, TickY, Right, TickY );
}
}
}
}
#endregion
#region Histogram panel events
/*-----------------------------------------------------------------------------
Histogram panel events
-----------------------------------------------------------------------------*/
private void HistogramPanel_Paint( object sender, PaintEventArgs e )
{
if( FStreamInfo.GlobalInstance == null )
{
return;
}
#if !DEBUG
try
#endif // !DEBUG
{
FHistogramParser.PaintPanel( e );
}
#if !DEBUG
catch( Exception ex )
{
Console.WriteLine( "Failed to repaint histogram " + ex.Message );
}
#endif // !DEBUG
}
private void HistogramPanel_MouseClick( object sender, MouseEventArgs e )
{
if( FHistogramParser.HistogramBars == null )
{
return;
}
FHistogramParser.UnsafeMouseClick( sender, e );
}
#endregion
#region Memory bitmap panel events
/*-----------------------------------------------------------------------------
Memory bitmap panel events
-----------------------------------------------------------------------------*/
private void MemoryBitmap_AllocationHistoryListView_SelectedIndexChanged( object sender, EventArgs e )
{
FMemoryBitmapParser.UpdateAllocationHistory();
}
private void MemoryBitmapPanel_ResetButton_Click( object sender, EventArgs e )
{
FMemoryBitmapParser.ResetZoom();
}
private void MemoryBitmapPanel_ResetSelection_Click( object sender, EventArgs e )
{
FMemoryBitmapParser.ResetSelection();
}
private void MemoryBitmapPanel_MouseClick( object sender, MouseEventArgs e )
{
FMemoryBitmapParser.BitmapClick( e );
}
private void MemoryBitmap_UndoZoomButton_Click( object sender, EventArgs e )
{
FMemoryBitmapParser.UndoLastZoom();
}
private void MemoryBitmapPanel_MouseDown( object sender, MouseEventArgs e )
{
FMemoryBitmapParser.BitmapMouseDown( e );
}
private void MemoryBitmapPanel_MouseMove( object sender, MouseEventArgs e )
{
FMemoryBitmapParser.BitmapMouseMove( e );
}
private void MemoryBitmapPanel_MouseUp( object sender, MouseEventArgs e )
{
FMemoryBitmapParser.BitmapMouseUp( e );
}
private void MemoryBitmapPanel_Paint( object sender, PaintEventArgs e )
{
FMemoryBitmapParser.PaintPanel( e );
}
private void MemoryBitmapPanel_Resize( object sender, EventArgs e )
{
Debug.WriteLine( "MemoryBitmapPanel_Resize" );
if( !bInResizingMode )
{
FMemoryBitmapParser.RefreshMemoryBitmap();
}
}
private void MemoryBitmap_AllocationHistoryListView_MouseClick( object sender, MouseEventArgs e )
{
if( e.Button == MouseButtons.Right )
{
ViewHistoryContextMenu.Tag = sender;
ViewHistoryContextMenu.Show( ( ListView )sender, e.Location );
}
}
private void MemoryBitmap_HeatMapButton_CheckedChanged( object sender, EventArgs e )
{
if( MemoryBitmapHeatMapButton.Checked )
{
MemoryBitmapHeatMapButton.Text = "Show Memory Map";
MemoryBitmapHeatMapButton.ToolTipText = "'Show Memory Map' shows memory bitmap. Uncheck to enable.";
}
else
{
MemoryBitmapHeatMapButton.Text = "Show Heat Map";
MemoryBitmapHeatMapButton.ToolTipText = "'Show Heat Map' shows how \"hot\" each address is the more allocations that have inhabited a given address, the whiter it will be. Check to enable.";
}
FMemoryBitmapParser.RefreshMemoryBitmap();
}
/// <summary> If True we are in the resizing mode so don't update bitmap panel to improve performance and usability. </summary>
bool bInResizingMode = false;
/// <summary> Last size of the main form used to detect when we really changed the size of the windows in the resizing mode. </summary>
Size LastResizedSize = new Size();
/// <summary> Occurs when a form enters resizing mode. </summary>
private void MainWindow_ResizeBegin( object sender, EventArgs e )
{
bInResizingMode = true;
}
/// <summary> Occurs when a form exits resizing mode. </summary>
private void MainWindow_ResizeEnd( object sender, EventArgs e )
{
Debug.WriteLine( "MainWindow_ResizeEnd" );
bInResizingMode = false;
// Resize memory bitmap panel after resizing has finished.
if( MainTabControl.SelectedTab == MemoryBitmapTabPage && Size != LastResizedSize )
{
MemoryBitmapPanel_Resize( sender, e );
}
LastResizedSize = Size;
}
#endregion
#region Callgraph view events
/*-----------------------------------------------------------------------------
Callgraph view events
-----------------------------------------------------------------------------*/
private void CallGraphTreeView_NodeMouseClick( object sender, TreeNodeMouseClickEventArgs EventArgs )
{
// Preserve eventargs with clicked node, etc.
CallGraphContextMenu.Tag = EventArgs;
if( EventArgs.Button == MouseButtons.Right )
{
CallGraphTreeView.SelectedNode = EventArgs.Node;
CallGraphContextMenu.Show( CallGraphTreeView, EventArgs.Location );
}
}
private void InvertCallgraphViewToolStripMenuItem_CheckedChanged( object sender, EventArgs e )
{
Options.InvertCallStacksInCallGraphView = InvertCallgraphViewMenuItem.Checked;
}
/// <summary> The search text. </summary>
private string LastSearchText;
/// <summary> Tree node that will be selected after the first element has been found. </summary>
private TreeNode NodeToSelect;
/// <summary> Whether wa want to use Regex in the search. </summary>
private bool bSearchTextIsRegex;
/// <summary> Whether we want to match case in the search. </summary>
private bool bSearchTextMatchCase;
private void SearchCallGraphView( string SearchText )
{
CallGraphTreeView.Select();
if( SearchText == null )
{
FindDialog FindWindow = new FindDialog( LastSearchText, bSearchTextIsRegex, bSearchTextMatchCase );
DialogResult Result = FindWindow.ShowDialog();
if( Result == DialogResult.Cancel )
{
return;
}
SearchText = FindWindow.SearchTextBox.Text;
bSearchTextIsRegex = FindWindow.RegexCheckButton.Checked;
bSearchTextMatchCase = FindWindow.MatchCaseCheckButton.Checked;
if( Result == DialogResult.Yes )
{
FCallGraphTreeViewParser.UnhighlightAll( CallGraphTreeView );
TreeNode FirstResult;
long AllocationSize;
int AllocationCount;
try
{
int NumResults = FCallGraphTreeViewParser.HighlightAllNodes( CallGraphTreeView, SearchText, bSearchTextIsRegex, bSearchTextMatchCase, out FirstResult, out AllocationSize, out AllocationCount );
MessageBox.Show( NumResults + " results found\nTotal size: " + FormatSizeString( AllocationSize ) + "\nTotal count: " + AllocationCount, "Find all results" );
}
catch( ArgumentException )
{
// a message box is displayed when this exception is thrown,
// so no need to inform the user of the error again
FirstResult = null;
}
if( FirstResult != null )
{
SelectCallGraphViewNode( FirstResult );
}
LastSearchText = SearchText;
return;
}
}
LastSearchText = SearchText;
try
{
TreeNode Node = FCallGraphTreeViewParser.FindNode( CallGraphTreeView, LastSearchText, bSearchTextIsRegex, bSearchTextMatchCase );
if( Node != null )
{
SelectCallGraphViewNode( Node );
}
else
{
MessageBox.Show( "The search string was not found" );
}
}
catch( ArgumentException )
{
// a message box is displayed when this exception is thrown,
// so no need to inform the user of the error again
}
}
private void SelectCallGraphViewNode( TreeNode Node )
{
// Unfortunately SelectedNode gets reset for some reason after searching
// so we have to use a convoluted way of selecting the desired node later.
NodeToSelect = Node;
// Ensure that paint event is triggered for this tabpage and run the selection code there.
CallGraphTabPage.Invalidate();
}
private void FindToolStripMenuItem_Click( object sender, EventArgs e )
{
if( MainTabControl.SelectedTab == CallGraphTabPage )
{
SearchCallGraphView( null );
}
else
{
MessageBox.Show( "Find is only implemented for the Callgraph View tab" );
}
}
private void FindNextToolStripMenuItem_Click( object sender, EventArgs e )
{
if( MainTabControl.SelectedTab == CallGraphTabPage )
{
SearchCallGraphView( LastSearchText );
}
else
{
MessageBox.Show( "Find is only implemented for the Callgraph View tab" );
}
}
private void UnhighlightAllToolStripMenuItem_Click( object sender, EventArgs e )
{
if( MainTabControl.SelectedTab == CallGraphTabPage )
{
FCallGraphTreeViewParser.UnhighlightAll( CallGraphTreeView );
}
}
private void CopyHighlightedToClipboardToolStripMenuItem_Click( object sender, EventArgs e )
{
if( MainTabControl.SelectedTab == CallGraphTabPage )
{
List<string> StringArray = FCallGraphTreeViewParser.GetHighlightedNodesAsStrings( CallGraphTreeView );
StringBuilder Result = new StringBuilder();
foreach( string Line in StringArray )
{
Result.AppendLine( Line );
}
if( Result.Length > 0 )
{
Clipboard.SetText( Result.ToString() );
}
}
}
private void CopyFunctionToClipboardToolStripMenuItem_Click( object sender, EventArgs e )
{
TreeNodeMouseClickEventArgs ClickEventArgs = ( TreeNodeMouseClickEventArgs )CallGraphContextMenu.Tag;
if( ClickEventArgs.Node.Tag != null )
{
Clipboard.SetText( FStreamInfo.GlobalInstance.NameArray[ FStreamInfo.GlobalInstance.CallStackAddressArray[ ( (FCallGraphNode)ClickEventArgs.Node.Tag ).AddressIndex ].FunctionIndex ] );
}
}
private void CopySizeToClipboardToolStripMenuItem_Click( object sender, EventArgs e )
{
TreeNodeMouseClickEventArgs ClickEventArgs = ( TreeNodeMouseClickEventArgs )CallGraphContextMenu.Tag;
if( ClickEventArgs.Node.Tag != null )
{
Clipboard.SetText( ( (FCallGraphNode)ClickEventArgs.Node.Tag ).AllocationSize.ToString() );
}
}
private void CallGraphTabPage_Paint( object sender, PaintEventArgs e )
{
if( NodeToSelect != null )
{
CallGraphTreeView.SelectedNode = NodeToSelect;
NodeToSelect = null;
}
}
private void ViewHistoryToolStripMenuItem_Click( object sender, EventArgs e )
{
TreeNodeMouseClickEventArgs eventArgs = ( TreeNodeMouseClickEventArgs )CallGraphContextMenu.Tag;
var Payload = (FCallGraphNode)eventArgs.Node.Tag;
if( Payload == null )
{
// TODO: implement this!
MessageBox.Show( "You can't view the history of the root node (not implemented yet). Please pick a child node." );
return;
}
SetHistoryCallStacks( Payload.CallStacks );
}
private void ExpandAllCollapseAllToolStripMenuItem_Click( object sender, EventArgs e )
{
TreeNodeMouseClickEventArgs ClickEventArgs = ( TreeNodeMouseClickEventArgs )CallGraphContextMenu.Tag;
// Expand/ collapse all nodes in subtree if double clicked on.
if( ClickEventArgs.Node.IsExpanded )
{
ClickEventArgs.Node.Collapse( false );
}
// Expand subtree recursively... this might be slow.
else
{
ClickEventArgs.Node.ExpandAll();
}
}
private void SetParentToolStripMenuItem_Click( object sender, EventArgs e )
{
TreeNodeMouseClickEventArgs eventArgs = ( TreeNodeMouseClickEventArgs )CallGraphContextMenu.Tag;
var Payload = (FCallGraphNode)eventArgs.Node.Tag;
if( Payload != null )
{
FCallGraphTreeViewParser.ParentFunctionIndex = FStreamInfo.GlobalInstance.CallStackAddressArray[ Payload.AddressIndex ].FunctionIndex;
ParentLabel.Text = FStreamInfo.GlobalInstance.NameArray[ FCallGraphTreeViewParser.ParentFunctionIndex ];
}
// Reparse with updated filter.
GoButton_Click( sender, new EventArgs() );
ResetParentMenuItem.Enabled = true;
}
private void ResetParentMenuItem_Click( object sender, EventArgs e )
{
FCallGraphTreeViewParser.ParentFunctionIndex = -1;
ParentLabel.Text = "(not set)";
// Reparse with updated filter.
GoButton_Click( sender, new EventArgs() );
ResetParentMenuItem.Enabled = false;
}
#endregion
#region Short lived allocation panel events
/*-----------------------------------------------------------------------------
Short lived allocation panel events
-----------------------------------------------------------------------------*/
private void ShortLivedListView_ColumnClick( object sender, ColumnClickEventArgs e )
{
FShortLivedAllocationView.ListColumnClick( e );
}
private void ShortLivedListView_MouseClick( object sender, MouseEventArgs e )
{
if( e.Button == MouseButtons.Right )
{
ViewHistoryContextMenu.Tag = sender;
ViewHistoryContextMenu.Show( ( ListView )sender, e.Location );
}
}
private void ShortLivedListView_SelectedIndexChanged( object sender, EventArgs e )
{
ShortLivedCallStackListView.BeginUpdate();
ShortLivedCallStackListView.Items.Clear();
// We can only display a single selected element.
if( ShortLivedListView.SelectedItems.Count == 1 )
{
FCallStack CallStack = ( ( FShortLivedCallStackTag )ShortLivedListView.SelectedItems[ 0 ].Tag ).CallStack;
CallStack.AddToListView( ShortLivedCallStackListView, true );
// if sender is null this is being called from a callback, so no need to look up addresses
if( sender != null && FStreamInfo.GlobalInstance.SymbolParser != null )
{
FStreamInfo.GlobalInstance.SymbolParser.ResolveCallstackSymbolInfoAsync(ESymbolResolutionMode.Full, CallStack, delegate(FCallStack CS)
{
BeginInvoke(new EventHandler(ShortLivedListView_SelectedIndexChanged), null, null);
}, true);
}
}
ShortLivedCallStackListView.EndUpdate();
}
#endregion
#region Exclusive list view panel events
/*-----------------------------------------------------------------------------
Exclusive list view panel events
-----------------------------------------------------------------------------*/
/// <summary> Update 2nd list view with full graph of selected row. </summary>
private void ExclusiveListView_SelectedIndexChanged( object sender, EventArgs e )
{
ExclusiveSingleCallStackView.BeginUpdate();
ExclusiveSingleCallStackView.Items.Clear();
// We can only display a single selected element.
if( ExclusiveListView.SelectedItems.Count == 1 )
{
FCallStackAllocationInfo AllocationInfo = ( FCallStackAllocationInfo )ExclusiveListView.SelectedItems[ 0 ].Tag;
FStreamInfo.GlobalInstance.CallStackArray[ AllocationInfo.CallStackIndex ].AddToListView( ExclusiveSingleCallStackView, true );
// if sender is null this is being called from a callback, so no need to look up addresses
if( sender != null && FStreamInfo.GlobalInstance.SymbolParser != null )
{
FCallStack CallStack = FStreamInfo.GlobalInstance.CallStackArray[AllocationInfo.CallStackIndex];
FStreamInfo.GlobalInstance.SymbolParser.ResolveCallstackSymbolInfoAsync(ESymbolResolutionMode.Full, CallStack, delegate(FCallStack CS)
{
BeginInvoke(new EventHandler(ExclusiveListView_SelectedIndexChanged), null, null);
}, true);
}
}
ExclusiveSingleCallStackView.EndUpdate();
// Sum up the size of all selected items
int TotalSize = 0;
int TotalCount = 0;
foreach( ListViewItem Item in ExclusiveListView.SelectedItems )
{
int Size, Count;
if( int.TryParse( Item.SubItems[ 0 ].Text, out Size ) && int.TryParse( Item.SubItems[ 2 ].Text, out Count ) )
{
TotalSize += Size;
TotalCount += Count;
}
}
if( ExclusiveListView.SelectedItems.Count > 0 )
{
string suffix = " KB in selection (in " + TotalCount.ToString() + " allocations)";
SelectionSizeStatusLabel.Text = TotalSize.ToString( "N0" ) + suffix;
}
else
{
SelectionSizeStatusLabel.Text = "";
}
}
private void ExclusiveListView_ColumnClick( object sender, ColumnClickEventArgs e )
{
ListViewEx MyListView = sender as ListViewEx;
if( MyListView != null && MyListView.Items.Count > 0 )
{
FColumnSorter ColumnSorter = MyListView.ListViewItemSorter as FColumnSorter;
if( ColumnSorter != null )
{
ColumnSorter.OnColumnClick( MyListView, e );
MyListView.SetSortArrow( ColumnSorter.ColumnToSortBy, ColumnSorter.ColumnSortModeAscending );
}
}
}
private void ExclusiveListView_DoubleClick( object sender, EventArgs e )
{
if( ExclusiveListView.SelectedItems.Count > 0 )
{
FCallStackAllocationInfo AllocationInfo = ( FCallStackAllocationInfo )ExclusiveListView.SelectedItems[ 0 ].Tag;
OpenCallstackEntryInVS( AllocationInfo, 0 );
}
}
/// <summary> Class used to sort columns by specified column in the exclusive list view. </summary>
public class FColumnSorter : IComparer
{
public int ColumnToSortBy = 0;
public bool ColumnSortModeAscending = false;
public IComparer ElementComparer = new CaseInsensitiveComparer();
public int Compare( Object ObjectA, Object ObjectB )
{
ListViewItem ItemA = ( ListViewItem )ObjectA;
ListViewItem ItemB = ( ListViewItem )ObjectB;
string StringA = ItemA.SubItems[ ColumnToSortBy ].Text;
string StringB = ItemB.SubItems[ ColumnToSortBy ].Text;
long IntA;
long IntB;
if( long.TryParse( StringA, out IntA ) && long.TryParse( StringB, out IntB ) )
{
return ElementComparer.Compare( IntA, IntB ) * ( ColumnSortModeAscending ? 1 : -1 );
}
else
{
return ElementComparer.Compare( StringA, StringB ) * ( ColumnSortModeAscending ? 1 : -1 );
}
}
public void OnColumnClick( ListView sender, ColumnClickEventArgs e )
{
if( e.Column == ColumnToSortBy )
{
ColumnSortModeAscending = !ColumnSortModeAscending;
}
else
{
ColumnToSortBy = e.Column;
ColumnSortModeAscending = false;
}
sender.Sort();
}
}
#endregion
#region Callstack history view panel events
/*-----------------------------------------------------------------------------
Callstack history view panel events
-----------------------------------------------------------------------------*/
private void CallstackHistoryAxisUnitFramesButton_Click( object sender, EventArgs e )
{
CallstackHistoryAxisUnitFramesButton.Checked = true;
CallstackHistoryAxisUnitAllocationsButton.Checked = false;
FCallStackHistoryView.RefreshCallStackHistoryGraph();
}
private void CallstackHistoryAxisUnitAllocationsButton_Click( object sender, EventArgs e )
{
CallstackHistoryAxisUnitAllocationsButton.Checked = true;
CallstackHistoryAxisUnitFramesButton.Checked = false;
FCallStackHistoryView.RefreshCallStackHistoryGraph();
}
private void CallStackHistoryPanel_Paint( object sender, PaintEventArgs e )
{
FCallStackHistoryView.PaintHistoryPanel( e );
}
private void CallStackHistoryPanel_Resize( object sender, EventArgs e )
{
FCallStackHistoryView.RefreshCallStackHistoryGraph();
}
private void ShowSnapshotsButton_CheckedChanged( object sender, EventArgs e )
{
FCallStackHistoryView.RefreshCallStackHistoryGraph();
}
private void CallstackHistoryResetZoomButton_Click( object sender, EventArgs e )
{
FCallStackHistoryView.ResetZoom();
}
private void ShowCompleteHistoryButton_CheckedChanged( object sender, EventArgs e )
{
FCallStackHistoryView.RefreshCallStackHistoryGraph();
}
private void CallStackHistoryVScroll_ValueChanged( object sender, EventArgs e )
{
CallStackHistoryPanel.Invalidate();
}
private void CallStackHistoryHScroll_ValueChanged( object sender, EventArgs e )
{
CallStackHistoryPanel.Invalidate();
}
/// <summary> The modifier flags for a KeyDown or KeyUp event used to update zoom factor in the callstack history view. </summary>
Keys CallstackHistoryKeys = Keys.None;
private void MainTabControl_MouseWheel( object sender, MouseEventArgs e )
{
if( MainTabControl.SelectedTab == CallstackHistoryTabPage )
{
if( (CallstackHistoryKeys & Keys.Control) != 0 )
{
FCallStackHistoryView.UpdateZoom( e.Delta > 0 ? 1 : -1, ref FCallStackHistoryView.HZoom );
}
if( ( CallstackHistoryKeys & Keys.Shift ) != 0 )
{
FCallStackHistoryView.UpdateZoom( e.Delta > 0 ? 1 : -1, ref FCallStackHistoryView.VZoom );
}
}
}
private void MainTabControl_KeyDown( object sender, KeyEventArgs e )
{
if( MainTabControl.SelectedTab == CallstackHistoryTabPage )
{
CallstackHistoryKeys = e.Modifiers;
}
}
private void MainTabControl_KeyUp( object sender, KeyEventArgs e )
{
if( MainTabControl.SelectedTab == CallstackHistoryTabPage )
{
CallstackHistoryKeys = e.Modifiers;
}
}
private void CallStackHistoryPanel_MouseMove( object sender, MouseEventArgs e )
{
CallStackHistoryPanel.Focus();
}
#endregion
#region Generic copy to.. context menu support
/*-----------------------------------------------------------------------------
Generic copy to.. context menu support
-----------------------------------------------------------------------------*/
private void ExclusiveListView_MouseClick( object sender, MouseEventArgs e )
{
if( e.Button == MouseButtons.Right )
{
ViewHistoryContextMenu.Tag = sender;
ViewHistoryContextMenu.Show( ( ListView )sender, e.Location );
}
}
/// <summary> Copies first selected listview item to the clipboard. </summary>
private void CopyFunctionToClipboardMenuItem_Click( object sender, EventArgs e )
{
ListView MyListView = ( ListView )CallStackViewerContextMenu.Tag;
if( MyListView.SelectedItems.Count > 0 )
{
Clipboard.SetText( MyListView.SelectedItems[ 0 ].Text );
}
}
/// <summary> Copies whole callstack from the selected listview item to the clipboard. </summary>
private void CopyCallstackToClipboardMenuItem_Click( object sender, EventArgs e )
{
ListView MyListView = ( ListView )CallStackViewerContextMenu.Tag;
if( MyListView.Items.Count > 0 )
{
string SelectedCallstack = "";
for( int ItemIndex = 0; ItemIndex < MyListView.Items.Count; ItemIndex++ )
{
SelectedCallstack += MyListView.Items[ ItemIndex ].Text;
if( ItemIndex + 1 != MyListView.Items.Count )
{
SelectedCallstack += "\r\n";
}
}
Clipboard.SetText( SelectedCallstack );
}
}
private void ShortLivedCallStackListView_MouseClick( object sender, MouseEventArgs e )
{
if( e.Button == MouseButtons.Right )
{
CallStackViewerContextMenu.Tag = sender;
CallStackViewerContextMenu.Show( ( ListView )sender, e.Location );
}
}
private void ExclusiveSingleCallStackView_MouseClick( object sender, MouseEventArgs e )
{
if( e.Button == MouseButtons.Right )
{
CallStackViewerContextMenu.Tag = sender;
CallStackViewerContextMenu.Show( ( ListView )sender, e.Location );
}
}
private void MemoryBitmapCallStackListView_MouseClick( object sender, MouseEventArgs e )
{
if( e.Button == MouseButtons.Right )
{
CallStackViewerContextMenu.Tag = sender;
CallStackViewerContextMenu.Show( ( ListView )sender, e.Location );
}
}
private void HistogramViewCallStackListView_MouseClick( object sender, MouseEventArgs e )
{
if( e.Button == MouseButtons.Right )
{
CallStackViewerContextMenu.Tag = sender;
CallStackViewerContextMenu.Show( ( ListView )sender, e.Location );
}
}
#endregion
#region Auto validating of changed options support
/*-----------------------------------------------------------------------------
Auto validating of changed options support
-----------------------------------------------------------------------------*/
/// <summary> Enumerates all controls that are used to filtering states. </summary>
enum EFilteringControl : int
{
FC_StartSnapshot,
FC_EndSnapshot,
FC_SortType,
FC_AllocationType,
FC_ContainersVisibilityType,
FC_FilterType,
FC_GroupArray,
FC_TextFilter,
FC_MemoryPool,
Count,
}
ToolStripItem[] FilteringControl = new ToolStripItem[(int)EFilteringControl.Count];
/// <summary> Contains properties used to hold current filtering state. </summary>
struct FFilteringState
{
public int StartSnapshot;
public int EndSnapshot;
public string SortType;
public string AllocationType;
public string ContainersVisibilityType;
public string FilterType;
public List<bool> GroupArray;
public string TextFilter;
public EMemoryPool MemoryPool;
/// <summary> Default constructor. </summary>
public FFilteringState( bool bFake )
{
StartSnapshot = -1;
EndSnapshot = -1;
SortType = "";
AllocationType = "";
ContainersVisibilityType = "";
FilterType = "";
GroupArray = new List<bool>( 40 );
TextFilter = "";
MemoryPool = EMemoryPool.MEMPOOL_None;
}
/// <summary> Creates a new copy of this class. </summary>
public FFilteringState DeepCopy()
{
FFilteringState Copy = ( FFilteringState )MemberwiseClone();
Copy.GroupArray = new List<bool>( GroupArray );
return Copy;
}
};
/// <summary> Starting filtering state, assigned after application launch or after pressing Go button. </summary>
FFilteringState StartingState = new FFilteringState( false );
/// <summary> Current filtering state. </summary>
FFilteringState CurrentState = new FFilteringState( false );
/// <summary> Is auto validation of filtering states is enabled? </summary>
bool bAutoValidationIsEnabled = false;
/// <summary> Occurs when the value of the ToolStripComboBox.SelectedIndex property has changed. </summary>
private void DiffStartComboBox_SelectedIndexChanged( object sender, EventArgs e )
{
UpdateFilteringState();
UpdateDetailsTab();
}
/// <summary> Occurs when the value of the ToolStripComboBox.SelectedIndex property has changed. </summary>
private void DiffEndComboBox_SelectedIndexChanged( object sender, EventArgs e )
{
UpdateFilteringState();
UpdateDetailsTab();
}
/// <summary> Occurs when the value of the ToolStripItem.Text property changes. </summary>
private void FilterTextBox_TextChanged( object sender, EventArgs e )
{
UpdateFilteringState();
}
/// <summary> Checks filtering states and updates controls by adding an exclamation mark as nessesary. </summary>
void UpdateFilteringState()
{
if( bAutoValidationIsEnabled )
{
// Get actual states of filtering controls.
CurrentState.StartSnapshot = DiffStartComboBox.SelectedIndex;
CurrentState.EndSnapshot = DiffEndComboBox.SelectedIndex;
CurrentState.SortType = SortCriteriaSplitButton.Text;
CurrentState.AllocationType = AllocationsTypeSplitButton.Text;
CurrentState.ContainersVisibilityType = ContainersSplitButton.Text;
CurrentState.FilterType = FilterTypeSplitButton.Text;
CurrentState.GroupArray.Clear();
foreach( ClassGroup Group in Options.ClassGroups )
{
CurrentState.GroupArray.Add( Group.bFilter );
}
CurrentState.TextFilter = FilterTextBox.Text;
CurrentState.MemoryPool = SelectedMemoryPool;
//bool bDiffFound = !CurrentState.CompareWith( StartingState );
// Find the changes.
bool[] bEquals = new bool[ ( int )EFilteringControl.Count ];
bEquals[ ( int )EFilteringControl.FC_StartSnapshot ] = CurrentState.StartSnapshot == StartingState.StartSnapshot;
bEquals[ ( int )EFilteringControl.FC_EndSnapshot ] = CurrentState.EndSnapshot == StartingState.EndSnapshot;
bEquals[ ( int )EFilteringControl.FC_SortType ] = CurrentState.SortType == StartingState.SortType;
bEquals[ ( int )EFilteringControl.FC_AllocationType ] = CurrentState.AllocationType == StartingState.AllocationType;
bEquals[ ( int )EFilteringControl.FC_ContainersVisibilityType ] = CurrentState.ContainersVisibilityType == StartingState.ContainersVisibilityType;
bEquals[ ( int )EFilteringControl.FC_FilterType ] = CurrentState.FilterType == StartingState.FilterType;
bEquals[ ( int )EFilteringControl.FC_TextFilter ] = CurrentState.TextFilter == StartingState.TextFilter;
bEquals[ ( int )EFilteringControl.FC_MemoryPool ] = CurrentState.MemoryPool == StartingState.MemoryPool;
bEquals[ ( int )EFilteringControl.FC_GroupArray ] = true;
if( CurrentState.GroupArray.Count == StartingState.GroupArray.Count )
{
for( int Index = 0; Index < CurrentState.GroupArray.Count; Index++ )
{
bool bDiffGroup = CurrentState.GroupArray[ Index ] != StartingState.GroupArray[ Index ];
if( bDiffGroup )
{
bEquals[ ( int )EFilteringControl.FC_GroupArray ] = false;
}
ToolStripMenuItemEx MenuItem = FilterClassesDropDownButton.DropDownItems[ Index ] as ToolStripMenuItemEx;
if( MenuItem != null )
{
MenuItem.bDrawExclamationMark = bDiffGroup;
}
}
}
else
{
bEquals[ ( int )EFilteringControl.FC_GroupArray ] = false;
}
bool bEqualProperties = true;
for( int Eq = 0; Eq < ( int )EFilteringControl.Count; Eq++ )
{
bEqualProperties = bEqualProperties && bEquals[ Eq ];
}
// Update UI.
GoButton.Image = bEqualProperties ? Properties.Resources.Play : Properties.Resources.PlayRed;
for( int Eq = 0; Eq < ( int )EFilteringControl.Count; Eq++ )
{
FilteringControl[ Eq ].DisplayStyle = bEquals[ Eq ] ? ToolStripItemDisplayStyle.Text : ToolStripItemDisplayStyle.ImageAndText;
}
}
}
/// <summary> Sets starting and current filtering state to the default values. </summary>
void ResetFilteringState()
{
bAutoValidationIsEnabled = true;
StartingState.StartSnapshot = DiffStartComboBox.SelectedIndex;
StartingState.EndSnapshot = DiffEndComboBox.SelectedIndex;
StartingState.SortType = SortCriteriaSplitButton.Text;
StartingState.AllocationType = AllocationsTypeSplitButton.Text;
StartingState.ContainersVisibilityType = ContainersSplitButton.Text;
StartingState.FilterType = FilterTypeSplitButton.Text;
StartingState.GroupArray.Clear();
foreach( ClassGroup Group in Options.ClassGroups )
{
StartingState.GroupArray.Add( Group.bFilter );
}
StartingState.TextFilter = FilterTextBox.Text;
StartingState.MemoryPool = SelectedMemoryPool;
CurrentState = StartingState.DeepCopy();
UpdateFilteringState();
}
/// <summary> Asigns filtering controls with internal list and setups drawing events. </summary>
void SetupFilteringControls()
{
FilteringControl[ ( int )EFilteringControl.FC_StartSnapshot ] = DiffStartToolLabel;
FilteringControl[ ( int )EFilteringControl.FC_EndSnapshot ] = DiffEndToolLabel;
FilteringControl[ ( int )EFilteringControl.FC_SortType ] = SortCriteriaSplitButton;
FilteringControl[ ( int )EFilteringControl.FC_AllocationType ] = AllocationsTypeSplitButton;
FilteringControl[ ( int )EFilteringControl.FC_ContainersVisibilityType ] = ContainersSplitButton;
FilteringControl[ ( int )EFilteringControl.FC_FilterType ] = FilterTypeSplitButton;
FilteringControl[ ( int )EFilteringControl.FC_GroupArray ] = FilterClassesDropDownButton;
FilteringControl[ ( int )EFilteringControl.FC_TextFilter ] = FilterLabel;
FilteringControl[ ( int )EFilteringControl.FC_MemoryPool ] = MemoryPoolFilterButton;
FilterClassesDropDownButton.DropDown.Renderer.RenderItemText += new ToolStripItemTextRenderEventHandler( Renderer_RenderItemText );
for( int Eq = 0; Eq < ( int )EFilteringControl.Count; Eq++ )
{
FilteringControl[ Eq ].Paint += new PaintEventHandler( MainWindow_ToolStripItem_Paint );
}
}
/// <summary> Occurs when the item is redrawn. Draws an exclamation mark icon on changed controls. </summary>
void MainWindow_ToolStripItem_Paint( object sender, PaintEventArgs e )
{
// Hacky... instead of adding a bunch of new controls based on toolstrip item I used 'ImageAndText' as a style for drawing an exclamation mark icon.
ToolStripItem Item = sender as ToolStripItem;
if( Item != null && Item.DisplayStyle == ToolStripItemDisplayStyle.ImageAndText )
{
int MarkVerticalPos = ( e.ClipRectangle.Height - Properties.Resources.ExclamationMark.Height ) / 2;
e.Graphics.DrawImage( Properties.Resources.ExclamationMark, 2, MarkVerticalPos );
}
}
/// <summary> Occurs when the text for a ToolStripItem is rendered. </summary>
void Renderer_RenderItemText( object sender, ToolStripItemTextRenderEventArgs e )
{
ToolStripMenuItemEx MenuItem = e.Item as ToolStripMenuItemEx;
if( MenuItem != null )
{
MenuItem.DrawItemExlamationMarkAndFilteringColorInfo( e );
}
}
#endregion
#region Details view panel methods
/*-----------------------------------------------------------------------------
Details view panel methods
-----------------------------------------------------------------------------*/
void UpdateDetailsTab()
{
if( !MainTabControl.Enabled )
{
return;
}
int StartSnapshotIndex = DiffStartComboBox.SelectedIndex;
int EndSnapshotIndex = DiffEndComboBox.SelectedIndex;
FStreamSnapshot StartSnapshot = StartSnapshotIndex > 0 ? FStreamInfo.GlobalInstance.SnapshotList[ StartSnapshotIndex - 1 ] : null;
FStreamSnapshot EndSnapshot = EndSnapshotIndex > 0 ? FStreamInfo.GlobalInstance.SnapshotList[ EndSnapshotIndex - 1 ] : null;
FStreamSnapshot.PrepareLevelNamesForDetailsTab( StartSnapshot, CurrentSnapshot, EndSnapshot );
DetailsStartTextBox.Text = StartSnapshot != null ? StartSnapshot.ToString() : "";
DetailsEndTextBox.Text = EndSnapshot != null ? EndSnapshot.ToString() : "";
DetailsDiffTextBox.Text = CurrentSnapshot != null ? CurrentSnapshot.ToString() : "";
}
#endregion
}
/// <summary> A tool strip menu item expanded with ability to draw icon next to the text and filtering color information box. </summary>
public class ToolStripMenuItemEx : ToolStripMenuItem
{
public ToolStripMenuItemEx( string InText )
{
// Hacky.. added eight spaces to make a space for additional indicators.
Text = " " + InText;
}
/// <summary> Filtering color used in the memory bitmap view and histogram view. </summary>
public Color FilteringColor;
/// <summary> If true draws exlamation mark icon which indicates that this menu item check state has changed. </summary>
public bool bDrawExclamationMark = false;
/// <summary> Draws additional information on tool strip menu item. </summary>
internal void DrawItemExlamationMarkAndFilteringColorInfo( ToolStripItemTextRenderEventArgs e )
{
float MarkSize = 8;
float ColorBoxSize = 16;
float RequiredSize = MarkSize + ColorBoxSize;
// SizeF SpaceSize = e.Graphics.MeasureString( " ", Font );
// int NumSpaces = (int)Math.Ceiling( RequiredSize / SpaceSize.Width );
int LeftPos = e.TextRectangle.Left;
// Draw an exlamation mark icon.
if( bDrawExclamationMark )
{
int MarkVerticalPos = ( e.Item.Height - Properties.Resources.ExclamationMark.Height ) / 2;
e.Graphics.DrawImage( Properties.Resources.ExclamationMark, LeftPos, MarkVerticalPos );
}
LeftPos += 8;
// Draw filtering color information box.
int ColorVerticalPos = ( e.Item.Height - Properties.Resources.ExclamationMark.Height ) / 2;
e.Graphics.FillRectangle( new SolidBrush( FilteringColor ), LeftPos, ColorVerticalPos, 16, 16 );
}
}
// Class that brokers UI requests from the worker thread back to the UI thread and returns the result
public class FUIBroker
{
public FUIBroker(Control InWidget)
{
Widget = InWidget;
}
public string ShowOpenFileDialog(OpenFileDialog InFileDialog)
{
return (string)Widget.Invoke(new Func<string>(delegate()
{
return (InFileDialog.ShowDialog() == DialogResult.OK) ? InFileDialog.FileName : null;
}));
}
public DialogResult ShowMessageBox(string InTitle, string InMessage, MessageBoxButtons InButtons, MessageBoxIcon InIcon)
{
return (DialogResult)Widget.Invoke(new Func<DialogResult>(delegate ()
{
return MessageBox.Show(InMessage, InTitle, InButtons, InIcon);
}));
}
private Control Widget;
}
public enum ESymbolResolutionMode
{
// Perform fast resolution. We always need the symbol name, however in this mode you may skip file and line look-up if it's too slow to do up-front.
Fast,
// Perform full resolution. Attempt to resolve the symbol name, line, and file, ignoring how slow that may be to complete.
Full,
}
// Symbol parsing interface.
// Derived types must implement a static method called StaticPlatformName which returns a string matching the value returned by FPlatformProperties::PlatformName() for the given platform.
public abstract class ISymbolParser
{
public virtual bool InitializeSymbolService(string ExecutableName, FUIBroker UIBroker)
{
return false;
}
public virtual void ShutdownSymbolService()
{
}
public virtual bool ResolveAddressToSymboInfo(ESymbolResolutionMode SymbolResolutionMode, ulong Address, out string OutFileName, out string OutFunction, out int OutLineNumber)
{
OutFileName = null;
OutFunction = null;
OutLineNumber = 0;
return false;
}
public virtual bool ResolveAddressSymbolInfo(ESymbolResolutionMode SymbolResolutionMode, FCallStackAddress Address)
{
if (Address.LineNumber == 0)
{
string Filename;
string Function;
int LineNumber;
if (ResolveAddressToSymboInfo(SymbolResolutionMode, Address.ProgramCounter, out Filename, out Function, out LineNumber))
{
if (Filename != null)
{
// Look up or add filename index.
Address.FilenameIndex = FStreamInfo.GlobalInstance.GetNameIndex(Filename, true);
}
if (Function != null)
{
// Look up or add function index.
Address.FunctionIndex = FStreamInfo.GlobalInstance.GetNameIndex(Function, true);
}
if (LineNumber != 0)
{
Address.LineNumber = LineNumber;
}
}
else
{
return false;
}
}
return true;
}
public virtual bool ResolveCallstackSymbolInfo(ESymbolResolutionMode SymbolResolutionMode, FCallStack CallStack)
{
bool bSuccess = true;
foreach (int AddressIndex in CallStack.AddressIndices)
{
FCallStackAddress Address = FStreamInfo.GlobalInstance.CallStackAddressArray[AddressIndex];
bSuccess &= ResolveAddressSymbolInfo(SymbolResolutionMode, Address);
}
return bSuccess;
}
public delegate void ResolveCallstackSymbolInfoCallback(FCallStack CallStack);
public virtual void ResolveCallstackSymbolInfoAsync(ESymbolResolutionMode SymbolResolutionMode, FCallStack CallStack, ResolveCallstackSymbolInfoCallback Callback, bool bCancelCurrentWork)
{
if (bCancelCurrentWork)
{
foreach (var Worker in ResolveCallstackSymbolInfoAsyncTasks)
{
if (Worker.IsBusy && !Worker.CancellationPending)
{
Worker.CancelAsync();
}
}
}
for (int WorkerIndex = ResolveCallstackSymbolInfoAsyncTasks.Count - 1; WorkerIndex >= 0; --WorkerIndex)
{
var Worker = ResolveCallstackSymbolInfoAsyncTasks[WorkerIndex];
if (!Worker.IsBusy)
{
ResolveCallstackSymbolInfoAsyncTasks.RemoveAt(WorkerIndex);
}
}
var AsyncWorker = new BackgroundWorker();
AsyncWorker.DoWork += new DoWorkEventHandler(delegate(object Obj, DoWorkEventArgs Args)
{
var Worker = Obj as BackgroundWorker;
foreach (int AddressIndex in CallStack.AddressIndices)
{
if (Worker.CancellationPending)
{
break;
}
FCallStackAddress Address = FStreamInfo.GlobalInstance.CallStackAddressArray[AddressIndex];
ResolveAddressSymbolInfo(SymbolResolutionMode, Address);
}
if (!Worker.CancellationPending)
{
Callback(CallStack);
}
});
AsyncWorker.RunWorkerAsync();
ResolveCallstackSymbolInfoAsyncTasks.Add(AsyncWorker);
}
public static ISymbolParser GetSymbolParserForPlatform(string PlatformName)
{
if (CachedSymbolParserTypes == null)
{
// Find all types that derive from LocalizationProvider in any of our DLLs
CachedSymbolParserTypes = new Dictionary<string, Type>();
var LoadedAssemblies = AppDomain.CurrentDomain.GetAssemblies();
foreach (var Dll in LoadedAssemblies)
{
var AllTypes = Dll.GetTypes();
foreach (var PotentialSymbolParserType in AllTypes)
{
if (PotentialSymbolParserType != typeof(ISymbolParser) && !PotentialSymbolParserType.IsAbstract && !PotentialSymbolParserType.IsInterface && typeof(ISymbolParser).IsAssignableFrom(PotentialSymbolParserType))
{
// Types should implement a static StaticPlatformName method
var Method = PotentialSymbolParserType.GetMethod("StaticPlatformName");
if (Method != null)
{
try
{
var TypePlatformName = Method.Invoke(null, null) as string;
CachedSymbolParserTypes.Add(TypePlatformName, PotentialSymbolParserType);
}
catch
{
Console.Error.WriteLine("Type '{0}' threw when calling its StaticPlatformName method.", PotentialSymbolParserType.FullName);
}
}
else
{
Console.Error.WriteLine("Type '{0}' derives from ISymbolParser but is missing its StaticPlatformName method.", PotentialSymbolParserType.FullName);
}
}
}
}
}
Type SymbolParserType;
CachedSymbolParserTypes.TryGetValue(PlatformName, out SymbolParserType);
if (SymbolParserType != null)
{
try
{
return Activator.CreateInstance(SymbolParserType) as ISymbolParser;
}
catch
{
Console.Error.WriteLine("Unable to create an instance of the type '{0}'", SymbolParserType.FullName);
}
}
return null;
}
private static Dictionary<string, Type> CachedSymbolParserTypes;
private List<BackgroundWorker> ResolveCallstackSymbolInfoAsyncTasks = new List<BackgroundWorker>();
}
// Ideally, this should be split up into 'StudioSettings' and 'Settings'
public class SettableOptions
{
[XmlArray]
[CategoryAttribute( "Settings" )]
[DescriptionAttribute( "A list of class groups to define the callstack filtering." )]
public List<ClassGroup> ClassGroups
{
get;
set;
}
[XmlIgnore]
[Browsable( false )]
public ClassGroup UngroupedGroup
{
get
{
ClassGroup Result = ClassGroups.FirstOrDefault( x => x.Name == "Ungrouped" );
if( Result == null )
{
// No ungrouped group found, so make one
Result = new ClassGroup();
Result.Name = "Ungrouped";
Result.Color = Color.LightGray;
Result.bFilter = true;
ClassGroups.Add( Result );
}
if( Result.CallStackPatterns.Length != 1 )
{
// Ungrouped group should have exactly one pattern.
// Overwrite whatever's there with a pattern that will match everything.
CallStackPattern Pattern = new CallStackPattern();
Pattern.StackFramePatterns = new string[] { "." };
Pattern.UseRegexes = true;
Pattern.PatternOrderGroup = PatternOrderGroup.CatchAll;
Pattern.OrderBias = short.MaxValue;
Result.CallStackPatterns = new CallStackPattern[] { Pattern };
}
return Result;
}
}
[Browsable( false )]
[XmlElement]
public uint MemoryPoolFilterState
{
get;
set;
}
[XmlElement]
public bool InvertCallStacksInCallGraphView
{
get;
set;
}
[XmlElement]
[CategoryAttribute("Filters")]
public bool FilterOutObjectVMFunctions
{
get;
set;
}
[XmlElement]
[CategoryAttribute("Filters")]
public bool TrimAllocatorFunctions
{
get;
set;
}
[XmlArray]
[CategoryAttribute("Filters")]
[DescriptionAttribute("A list of allocator functions to trim to (when TrimAllocatorFunctions is enabled).")]
public List<FCallStackFunctionFilter> AllocatorFunctions
{
get;
set;
}
public SettableOptions()
{
ClassGroups = new List<ClassGroup>();
TrimAllocatorFunctions = true;
AllocatorFunctions = new List<FCallStackFunctionFilter>();
}
public void ApplyDefaults()
{
if (AllocatorFunctions.Count == 0)
{
AllocatorFunctions.Add(new FCallStackFunctionFilter("FMallocProfiler::", FCallStackFunctionFilter.EFilterMode.StartsWith));
AllocatorFunctions.Add(new FCallStackFunctionFilter("FMallocGcmProfiler::", FCallStackFunctionFilter.EFilterMode.StartsWith));
AllocatorFunctions.Add(new FCallStackFunctionFilter("FMallocPoisonProxy::", FCallStackFunctionFilter.EFilterMode.StartsWith));
AllocatorFunctions.Add(new FCallStackFunctionFilter("FMemory::", FCallStackFunctionFilter.EFilterMode.StartsWith));
AllocatorFunctions.Add(new FCallStackFunctionFilter("operator new", FCallStackFunctionFilter.EFilterMode.StartsWith));
AllocatorFunctions.Add(new FCallStackFunctionFilter("FSlateControlledConstruction::", FCallStackFunctionFilter.EFilterMode.StartsWith));
}
}
public List<CallStackPattern> GetOrderedPatternList()
{
List<CallStackPattern> ResultArray = new List<CallStackPattern>();
foreach( ClassGroup Group in ClassGroups )
{
ResultArray.AddRange( Group.CallStackPatterns );
}
ResultArray.Sort( ( x, y ) => x.Ordinal - y.Ordinal );
return ResultArray;
}
}
}