Files
UnrealEngineUWP/Engine/Source/Editor/ContentBrowser/Private/SContentBrowser.cpp
Ben Marsh bf66aaa497 Copying //UE4/Release-Staging-4.12 to //UE4/Dev-Main (Source: //UE4/Release-4.12 @ 2955635)
==========================
MAJOR FEATURES + CHANGES
==========================

Change 2955635 on 2016/04/26 by Max.Chen

	Sequencer: Fix filtering so that folders that contain filtered nodes will also appear.

	#jira UE-28213

Change 2955617 on 2016/04/25 by Dmitriy.Dyomin

	Better fix for: Post processing rendering artifacts Nexus 6
	this device on Android 5.0.1 does not support BGRA8888 texture as a color attachment
	#jira: UE-24067

Change 2955522 on 2016/04/25 by Max.Chen

	Sequencer: Fix crash when resolving object guid and context is null.

	#jira UE-29916

Change 2955504 on 2016/04/25 by Alexis.Matte

	#jira UE-29926
	Fix build error for SplineComponent. I just move variable under #if !UE_BUILD_SHIPPING instead #if WITH_EDITORONLY_DATA to fix all build flavor, please feel free to adjust according to what the initial fix was suppose to do.

Change 2955500 on 2016/04/25 by Dan.Oconnor

	Integration of 2955445 from Dev-BP
	#jira UE-29012

Change 2955234 on 2016/04/25 by Lina.Halper

	Fixed tool tip of twist node

	#jira : UE-29907

Change 2955211 on 2016/04/25 by Ben.Marsh

	Exclude all plugins which aren't required for a project (ie. don't have any content or modules for the current target) from its target receipt. Prevents dependencies on .uplugin files whose dependencies are otherwise compiled out. Re-enable PS4Media plugin by default.

	#jira UE-29842

Change 2955155 on 2016/04/25 by Jamie.Dale

	Fixed an issue where text committed via a focus loss might not display the correct text if it was changed during commit

	#jira UE-28756

Change 2955144 on 2016/04/25 by Jamie.Dale

	Fixed a case where editable text controls would fail to select their text when focused

	There was an order of operations issue between the options to select all text and move the cursor to the end of the document, which caused the cursor move to happen after the select all, and undo the selection. The order of these operations has now been flipped.

	#jira UE-29818
	#jira UE-29772

Change 2955136 on 2016/04/25 by Chad.Taylor

	Merging to 4.12:

	Morpheus latency fix. Late update tracking frame was getting unnecessarily buffered an extra frame on the RHI thread. Removed buffering and the issue is fixed.

	#jira UE-22581

Change 2955134 on 2016/04/25 by Lina.Halper

	Removed code that blocks moving actor when they don't have physics asset

	#jira : UE-29796
	#code review: Benn.Gallagher

Change 2955130 on 2016/04/25 by Zak.Middleton

	#ue4 - (4.12) Don't reject low distance MTD, it could cause us to not process some valid overlaps.
	(copy of 2955001 in Main)

	#jira UE-29531
	#lockdown Nick.Penwarden

Change 2955098 on 2016/04/25 by Marc.Audy

	Don't spawn a child actor on the client if the server is going to have created one and be replicating it to the client
	#jira UE-7539

Change 2955049 on 2016/04/25 by Richard.TalbotWatkin

	Changes to how SplineComponents debug render. Added a SetDrawDebug method to control whether a spline is rendered. Also extended the facility to non-editor builds.
	#jira UE-29753 - Add ability to display a SplineComponent in-game

Change 2955040 on 2016/04/25 by Chris.Gagnon

	Fixed Initializer Order Warning in hot reload ctor.

	#jira UE-28811, UE-28960

Change 2954995 on 2016/04/25 by Marc.Audy

	Make USceneComponent::Pre/PostNetReceive and PostRepNotifies protected instead of private so that subclasses can implement replication behaviors
	#jira UE-29909

Change 2954970 on 2016/04/25 by Peter.Sauerbrei

	fix for openwrite with O_APPEND flag
	#jira UE-28417

Change 2954917 on 2016/04/25 by Chris.Gagnon

	Moved a desired change from Main to 4.12

	Added input settings to:
	- control if the viewport locks the mouse on acquire capture.
	- control if the viewport acquires capture on the application launch (first window activate).

	#jira UE-28811, UE-28960
	parity with 4.11 (UE-28811, UE-28960 would be reintroduced without this)

Change 2954908 on 2016/04/25 by Alexis.Matte

	#jira UE-29478
	Prevent modal dialog to use 100% of a core

Change 2954888 on 2016/04/25 by Marcus.Wassmer

	Fix compile issue with chinese locale
	#jira UE-29708

Change 2954813 on 2016/04/25 by Lina.Halper

	Fix when not re-validating the correct asset

	#jira : UE-29789
	#code review: Martin.Wilson

Change 2954810 on 2016/04/25 by mason.seay

	Updated map to improve coverage

	#jira UE-29618

Change 2954785 on 2016/04/25 by Max.Chen

	Sequencer: Always spawn sequencer spawnables. Disregard collision settings.

	#jira UE-29825

Change 2954781 on 2016/04/25 by mason.seay

	Test map for Audio Occlusion trace channels

	#jira UE-29618

Change 2954684 on 2016/04/25 by Marc.Audy

	Add GetIsReplicated accessor to AActor
	Deprecate specific GameplayAbility class implementations that was exposing bReplicates
	#jira UE-29897

Change 2954675 on 2016/04/25 by Alexis.Matte

	#jira UE-25430
	Light Intensity value in FBX is a ratio. So I just multiply the default intensity value by the ratio to have something closer to the look in the DCCs

Change 2954669 on 2016/04/25 by Alexis.Matte

	#jira UE-29507
	Import of rigid mesh animation is broken

Change 2954579 on 2016/04/25 by Ben.Marsh

	Temporarily stop the PS4Media plugin being enabled by default, so the UE4Game built for the binary release doesn't depend on it. Will implement whitelist/blacklist for platforms later.

	#jira UE-29842

Change 2954556 on 2016/04/25 by Taizyd.Korambayil

	#jira UE-29877 Setup ThirdPersonCharacter based on correct Code Class

Change 2954552 on 2016/04/25 by Taizyd.Korambayil

	#jira UE-29877 Deleting BP class

Change 2954498 on 2016/04/25 by Ryan.Gerleve

	Fix for remote player controllers reporting that they're actually local player controllers after a seamless travel on the server.
	Transition actors to the new level in a second pass after non-transitioning actors are handled.

	#jira UE-29213

Change 2954446 on 2016/04/25 by Max.Chen

	Sequencer: Fixed spawning actors with instance or multiple owned components

	  - Also fixed issue where recorded actors were sometimes set as transient, meaning they didn't get saved

	#jira UE-29774, UE-29859

Change 2954430 on 2016/04/25 by Marc.Audy

	Don't schedule a tick function with a tick interval that was disabled while it was pending rescheduling
	#jira UE-29118
	#jira UE-29747

Change 2954292 on 2016/04/25 by Richard.TalbotWatkin

	Replicated from //UE4/Dev-Editor CL 2946363 (by Frank.Fella)

	CurveEditorViewportClient - Bounds check when box selecting.  Prevents crashing when the box is outside the viewport.
	#jira UE-29265 - Crash when drag selecting curve keys in matinee

Change 2954262 on 2016/04/25 by Graeme.Thornton

	Fixed a editor crash when destroying linkers half way through a package EndLoad

	#jira UE-29437

Change 2954239 on 2016/04/25 by Marc.Audy

	Fix error message
	#jira UE-00000

Change 2954177 on 2016/04/25 by Dmitriy.Dyomin

	Fixed: Hidden surface removal is not enabled on PowerVR Android devices
	#jira UE-29871

Change 2954026 on 2016/04/24 by Josh.Adams

	[Somehow most files got unchecked in my previous checkin, grr]
	- ProtoStar content/config updates (enabled TAA in the levels, disabled es2 shaders, hides the Unbuilt lighting warning on Android)
	#lockdown nick.penwarden
	#jira UE-29863

Change 2954025 on 2016/04/24 by Josh.Adams

	- ProtoStar content/config updates (enabled TAA in the levels, disabled es2 shaders, hides the Unbuilt lighting warning on Android)
	#lockdown nick.penwarden
	#jira UE-29863

Change 2953946 on 2016/04/24 by Max.Chen

	Sequencer: Fix crash on undo of a sub section.

	#jira UE-29856

Change 2953898 on 2016/04/23 by mitchell.wilson

	#jira UE-29618 Adding subscene_001 sequence for nonlinear workflow testing

Change 2953859 on 2016/04/23 by Maciej.Mroz

	Merged from Dev-Blueprints 2953858
	#jira UE-29790 Editor crashes when opening KiteDemo

Change 2953764 on 2016/04/23 by Max.Chen

	Sequencer: Remove "Experimental" tag on the Level Sequence Actor

	#jira UETOOl-625

Change 2953763 on 2016/04/23 by Max.Chen

	Cinematics: Change text to "Edit Existing Cinematics"

	#jira UE-29102

Change 2953762 on 2016/04/23 by Max.Chen

	Sequencer: Follow up time slider hit testing fix. Don't hit test the selection range if it's empty. This was causing false positives when hovering close to the ranges.

	#jira UE-29658

Change 2953652 on 2016/04/22 by Rolando.Caloca

	UE4.12 - vk - Workaround driver bugs wrt texture format caps
	#jira UE-28140

Change 2953596 on 2016/04/22 by Marcus.Wassmer

	#jira UE-20276
	Merging dual normal clearcoat shading model.
	2863683
	2871229
	2876362
	2876573
	2884007
	2901595

Change 2953594 on 2016/04/22 by Chris.Babcock

	Disable crash handler for VulkanRHI on Android to prevent sig11 on loading driver
	#jira UE-29851
	#ue4
	#android

Change 2953520 on 2016/04/22 by Rolando.Caloca

	UE4.12 - vk - Enable deferred resource deletion
	- Added one resource heap per memory type
	- Improved DumpMemory()
	- Added ensures for missing format features
	#jira UE-28140

Change 2953459 on 2016/04/22 by Taizyd.Korambayil

	#jira UE-29748 Resaved Maps to Fix EC Build Warnings
	#jira UE-29744

Change 2953448 on 2016/04/22 by Ryan.Gerleve

	Fix Mac/Linux compile.

	#jira UE-29545

Change 2953311 on 2016/04/22 by Ryan.Gerleve

	Fix for infinite hang when loading a replay from within an actor tick while demo.AsyncLoadWorld is false. LoadMap for the replay is now deferred using the existing PendingNetGame mechanism.
	Added virtual UPendingNetGame::LoadMapCompleted function so that the base PendingNetGame and DemoPendingNetGame can have different behavior.
	To keep things simpler, also parse all replay metadata and streaming levels after the LoadMap call.

	#jira UE-29545

Change 2953219 on 2016/04/22 by mason.seay

	Test map for show collision features

	#jira UE-29618

Change 2953199 on 2016/04/22 by Phillip.Kavan

	[UE-29449] Fix InitProperties() optimization for Blueprint class instances when array property values differ in size.

	change summary:
	- improved UBlueprintGeneratedClass::BuildCustomArrayPropertyListForPostConstruction() by continuing to emit only delta entries for array values that exceed the default array value's size; previously we emitted a NULL in this case to signal a need to initialize all remaining array values in InitProperties(), even if they didn't differ from the default value of the inner property (which in most cases would already have been set at construction time, and thus potentially incurred a redundant copy iteration for each entry)
	- modified FObjectInitializer::InitArrayPropertyFromCustomList() to no longer reset the array value on the instance prior to initialization
	    - added code to properly resize the array on the instance prior to initialization (if it differs in size from the default array value)
	    - removed code that handled a NULL property value in the custom property list stream (this is no longer necessary, see above)
	- modified FObjectInitializer::InitProperties() to restore the post-construction optimization for Blueprint class instances (back to being enabled by default)

	#jira UE-29449

Change 2953195 on 2016/04/22 by Max.Chen

	Sequencer: Fix crash in actor reference track in the cached guid to actor map.

	#jira UE-27523

Change 2953124 on 2016/04/22 by Rolando.Caloca

	UE4.12 - vk - Increase temp frame buffer
	#jira UE-28140

Change 2953121 on 2016/04/22 by Chris.Babcock

	Rebuilt lighting for all levels
	#jira UE-29809

Change 2953073 on 2016/04/22 by mason.seay

	Test assets for notifies in animation composites and montages

	#jira UE-29618

Change 2952960 on 2016/04/22 by Richard.TalbotWatkin

	Changed eye dropper operation so that LMB click selects a color, and pressing Esc cancels the selection and restores the old color.
	#jira UE-28410 - Eye dropper selects color without clicking

Change 2952934 on 2016/04/22 by Allan.Bentham

	Ensure pool's refractive index >= 1
	#jira UE-29777

Change 2952881 on 2016/04/22 by Jamie.Dale

	Better fix for UE-28560 that doesn't regress thumbnail rendering

	We now just silence the warning if dealing with an inactive world.

	#jira UE-28560

Change 2952867 on 2016/04/22 by Thomas.Sarkanen

	Fix issues with matinee-controlled anim instances

	Regression caused by us no longer saving off the anim sequence between updates.

	#jira UE-29812 - Protostar Neutrino spawns but does not Animate or move.

Change 2952826 on 2016/04/22 by Maciej.Mroz

	Merged from Dev-Blueprints 2952820

	#jira UE-28895 Nativizing a blueprint project causes the next non-nativizing package attempt to fail

Change 2952819 on 2016/04/22 by Josh.Adams

	- Fixed crash in a Vulkan shader printout
	#lockdown nick.penwarden
	#jira UE-29820

Change 2952817 on 2016/04/22 by Rolando.Caloca

	UE4.12 - vk - Revert back to simple layouts
	#jira UE-28140

Change 2952792 on 2016/04/22 by Jamie.Dale

	Removed some code that caused worlds loaded by the Content Browser to be initialized before they were ready

	Supposedly this code existed for world thumbnail rendering, however only the active editor world generates a thumbnail, so initializing other worlds wasn't having any effect and thumbnails look identical to before.

	#jira UE-28560

Change 2952783 on 2016/04/22 by Taizyd.Korambayil

	#jira UE-28477 Resaved Flying Template Map

Change 2952767 on 2016/04/22 by Taizyd.Korambayil

	#jira UE-29736 Resaved Map to Fix EC Warnings

Change 2952762 on 2016/04/22 by Allan.Bentham

	Update reflection capture to contain only room5 content.
	#jira UE-29777

Change 2952749 on 2016/04/22 by Taizyd.Korambayil

	#jira UE-29740 Resaved Material and Map to Fix Empty Engine Version Error

Change 2952688 on 2016/04/22 by Martin.Wilson

	Fix for BP notifies not displaying when they derive from an abstract base class

	#jira UE-28556

Change 2952685 on 2016/04/22 by Thomas.Sarkanen

	Fix CIS for non-editor builds

	#jira UE-29308 - Fix crash from GC-ed animation asset

Change 2952664 on 2016/04/22 by Thomas.Sarkanen

	Made up/down behaviour for console history consistent and reverted to old ordering by default

	Pressing up or down now brings up history.
	Sorting can now be optionally bottom-to-top or top-to-bottom. Default behaviour is preserved to what it was before the recent changes.

	#jira UE-29595 - Console autocomplete behavior is non-intuitive / frustrating

Change 2952655 on 2016/04/22 by Jamie.Dale

	Changed the class filter to use an expression evaluator

	This makes it consistent with the other filters in the editor

	#jira UE-29811

Change 2952647 on 2016/04/22 by Allan.Bentham

	Back out changelist 2951539
	#jira UE-29777

Change 2952618 on 2016/04/22 by Benn.Gallagher

	Fixed naming error in rotation multiplier node
	#jira UE-29583

Change 2952612 on 2016/04/22 by Thomas.Sarkanen

	Fix garbage collection and undo/redo issues with anim instance proxy

	UObject-based properties are now cached each update on the proxy and nulled-out outside of evaluate/update phases.
	Moved some initialization code for CurrentAsset/CurrentVertexAnim from the proxy back to the instance (as its is encapsulated there now).

	#jira UE-29308 - Fix crash from GC-ed animation asset

Change 2952608 on 2016/04/22 by Richard.TalbotWatkin

	Changed 'Recently Used Levels' and 'Favorite Levels' to hold long package names instead of absolute paths. This means they are now project-relative and will remain valid even if the project location changes.
	#jira UE-29731 - Editor map recent files are not project relative, leading to missing links when moving projects.

Change 2952599 on 2016/04/22 by Dmitriy.Dyomin

	Disabled vulkan pipeline cache as it causes rendering artifacts right now
	#jira UE-29807

Change 2952540 on 2016/04/22 by Maciej.Mroz

	#jira UE-29787 Obsolete nativized files are never removed
	merged from Dev-Blueprints 2952531

Change 2952372 on 2016/04/21 by Josh.Adams

	- Fixed Vk memory allocations when reusing free pages
	#lockdown nick.penwarden
	#jira ue-29802

Change 2952350 on 2016/04/21 by Eric.Newman

	Added support for UEReleaseTesting backends to Orion and Ocean
	#jira op-3640

Change 2952140 on 2016/04/21 by Dan.Oconnor

	Demoted back to warning to fix regressions in content examples, in main we've added the ability to elevate warnings to errors, but no reason to rush that feature into 4.12
	#jira UE-28971

Change 2952135 on 2016/04/21 by Jeff.Farris

	Fixed issue in PlayerCameraManager where the priority-based sorting of CameraModifiers wasn't sorting properly.
	Manual re-implementation of CL 2948123 in 4.12 branch.
	#jira UE-29634

Change 2952121 on 2016/04/21 by Lee.Clark

	PS4 - 4.12 - Fix staging and deploying of system prxs

	#jira UE-29801

Change 2952120 on 2016/04/21 by Rolando.Caloca

	UE4.12 - vk - Move descriptor allocation to BSS
	#jira UE-21840

Change 2952027 on 2016/04/21 by Rolando.Caloca

	UE4.12 - vk - Fix descriptor sets lifetimes
	- Fix crash with null texture
	#jira UE-28140

Change 2951890 on 2016/04/21 by Eric.Newman

	Updating locked common dependencies for OrionService
	#jira OP-3640

Change 2951863 on 2016/04/21 by Eric.Newman

	Updating locked dependencies for UE 4.12 OrionService
	#jira OP-3640

Change 2951852 on 2016/04/21 by Owen.Stupka

	Fixed meteors destruct location
	#jira UE-29714

Change 2951739 on 2016/04/21 by Max.Chen

	Sequencer: Follow up for integral keys.

	#jira UE-29791

Change 2951717 on 2016/04/21 by Rolando.Caloca

	UE4.12 - Fix shader platform names
	#jira UE-28140

Change 2951714 on 2016/04/21 by Max.Chen

	Sequencer: Fix setting a key if it already exists at the current time.

	#jira UE-29791

Change 2951708 on 2016/04/21 by Rolando.Caloca

	UE4.12 - vk - Separate upload cmd buffer
	#jira UE-28140

Change 2951653 on 2016/04/21 by Marc.Audy

	If a child actor component is destroyed during garbage collection, do not rename, instead clear the caching mechanisms so that a new name is chosen if a new child is created in the future
	Remove now unused bRenameRequired parameter
	#jira UE-29612

Change 2951619 on 2016/04/21 by Chris.Babcock

	Move bCreateRenderStateForHiddenComponents out of WITH_EDITOR
	#jira UE-29786
	#ue4

Change 2951603 on 2016/04/21 by Cody.Albert

	#jira UE-29785
	Revert Github readme page back to original

Change 2951599 on 2016/04/21 by Ryan.Gerleve

	Fix assert when attempting to record a replay when the map has a placed actor that writes replay external data (such as ACharacter)

	#jira UE-29778

Change 2951558 on 2016/04/21 by Chris.Babcock

	Always rename destroyed child actor
	#jira UE-29709
	#ue4

Change 2951552 on 2016/04/21 by James.Golding

	Remove old code for handling 'show collision' in game, uses same method as editor now, fixes hidden meshes showing up in game when doing 'show collision'
	#jira UE-29303

Change 2951539 on 2016/04/21 by Allan.Bentham

	Use screenuv for distortion with ES2/31.
	#jira UE-29777

Change 2951535 on 2016/04/21 by Max.Chen

	We need to test if the hmd is enabled if it exists. Otherwise, this will return true even if we aren't rendering in stereo if there's an hmd plugin loaded.

	#jira UE-29711

Change 2951521 on 2016/04/21 by Taizyd.Korambayil

	#jira UE-29746 Replaced Deprecated Time Handler node in GameLevel_GM

Change 2951492 on 2016/04/21 by Jeremiah.Waldron

	Fix for Android IAP information reporting back incorrectly.
	#jira UE-29776

Change 2951486 on 2016/04/21 by Taizyd.Korambayil

	#jira UE-29741 Updated Infiltrator Demo Project to open with the correct Map

Change 2951450 on 2016/04/21 by Gareth.Martin

	Fix non-editor build
	#jira UE-16525

Change 2951380 on 2016/04/21 by Gareth.Martin

	Fix Landscape layer blend nodes not updating connections correctly when an input is changed from weight/alpha (one input) to height blend (two inputs) or vice-versa
	#jira UE-16525

Change 2951357 on 2016/04/21 by Richard.TalbotWatkin

	Fixed a crash when pushing a new menu leads to a window activation change which would result in the old root menu being dismissed.
	#jira UE-27981 - [CrashReport] Crash When Attempting to Select Variable Type After Clearing the Name Field

Change 2951352 on 2016/04/21 by Richard.TalbotWatkin

	Added slider bar thickness as a new property in FSliderStyle.
	#jira UE-19173 - SSlider is not fully stylable

Change 2951344 on 2016/04/21 by Gareth.Martin

	Fix bounds calculation for landscape splines that was causing the first landscape spline point to be invisible and later points to flicker.
	- Also fixes landscape spline lines not showing up on a flat landscape
	#jira UE-25114

Change 2951326 on 2016/04/21 by Taizyd.Korambayil

	#jira UE-28477 Resaving Maps

Change 2951271 on 2016/04/21 by Jamie.Dale

	Fixed a crash when pasting a path containing a class into the asset view of the Content Browser

	#jira UE-29616

Change 2951237 on 2016/04/21 by Jack.Porter

	Fix black screen on PC due to planar reflections

	#jira UE-29664

Change 2951184 on 2016/04/21 by Jamie.Dale

	Fixed crash in FCurveStructCustomization when no objects were selected for editing

	#jira UE-29638

Change 2951177 on 2016/04/21 by Ben.Marsh

	Fix hot reload from IDE failing when project is up to date. UBT returns an exit code of 2, and any non-zero exit code is treated as an error by Visual Studio. Build.bat was not correctly forwarding on the exit code at all prior to CL 2790858.

	#jira UE-29757

Change 2951171 on 2016/04/21 by Matthew.Griffin

	Fixed issue with Rebuild not working when installed in Program Files (x86)
	The brackets seem to cause lots of problems in combination with the if/else ones
	#jira UE-29648

Change 2951163 on 2016/04/21 by Jamie.Dale

	Changed the text customization to use the property handle functions to get/set the text value

	That ensures that it both transacts and notifies correctly.

	Added new functions to deal with multiple objects selection efficiently with the existing IEditableTextProperty API:
	  - FPropertyHandleBase::SetPerObjectValue
	  - FPropertyHandleBase::GetPerObjectValue
	  - FPropertyHandleBase::GetNumPerObjectValues

	These replace the need to cache the raw pointers.

	#jira UE-20223

Change 2951103 on 2016/04/21 by Thomas.Sarkanen

	Un-deprecated blueprint functions for attachment/detachment

	Renamed functions to <FuncName> (Deprecated).
	Hid functions in the BP context menu so new ones cant be added.

	#jira UE-23216 - "Snap to Target, Keep World Scale" when attaching doesn't work properly if parent is scaled.

Change 2951101 on 2016/04/21 by Allan.Bentham

	Enable mobile HQ DoF
	#jira UE-29765

Change 2951097 on 2016/04/21 by Thomas.Sarkanen

	Standalone games now benefit from parallel anim update if possible

	We now simply use the fact we want root motion to determine if we need to run immediately.

	#jira UE-29431 - Parallel anim update does not work in non-multiplayer games

Change 2951036 on 2016/04/21 by Lee.Clark

	PS4 - Fix WinDualShock working with VS2015

	#jira UE-29088

Change 2951034 on 2016/04/21 by Jack.Porter

	ProtoStar: Removed content not needed by remaining maps, resaved all content to fix version 0 issues

	#jira UE-29666

Change 2950995 on 2016/04/21 by Jack.Porter

	ProtoStar - delete unneeded maps

	#jira UE-29665

Change 2950787 on 2016/04/20 by Nick.Darnell

	SuperSearch - Moving the settings object into a seperate plugin to avoid there needing to be a circular dependency between SuperSearch and UnrealEd.

	#jira UE-29749
	#codeview Ben.Marsh

Change 2950786 on 2016/04/20 by Nick.Darnell

	Back out changelist 2950769 - Going to re-enable super search - about to move the settings into a plugin to prevent the circular reference.

	#jira UE-29749

Change 2950769 on 2016/04/20 by Ben.Marsh

	Comment out editor integration for super search to fix problems with the circular dependencies breaking hot reload and compiling QAGame in binary release.

Change 2950724 on 2016/04/20 by Lina.Halper

	Support for negative scaling for mirroring

	- Merging CL 2950718 using //UE4/Dev-Framework_to_//UE4/Release-4.12

	#jira: UE-27453

Change 2950293 on 2016/04/20 by andrew.porter

	Correcting sequencer test content

	#jira UE-29618

Change 2950283 on 2016/04/20 by Marc.Audy

	Don't route FlushPressedKeys on PIE shut down
	#jira UE-28734

Change 2950071 on 2016/04/20 by mason.seay

	Adjusted translation retargeting on head bone of UE4_Mannequin

	-Needed for anim bp test.  Tested animations and did not see any fallout from change.  If there is, it can be reverted.

	#jira UE-29618

Change 2950049 on 2016/04/20 by Mark.Satterthwaite

	Undo CL #2949690 and instead on Mac where we want to be able to capture videos of gameplay we just insert an intermediate texture as the back-buffer and use a manual blit to the drawable prior to present. This also changes the code to enforce that the back-buffer render-target should never be nil as the code & Metal API itself assumes that this situation cannot occur but it would appear from continued crashes inside PrepareToDraw that it actually can in the field. This will address another potential cause of UE-29006.
	#jira UE-29006
	#jira UE-29140

Change 2949977 on 2016/04/20 by Max.Chen

	Sequencer: Add FieldOfView to default tracks for CameraActor. Add FieldOfView to exclusion list for CineCameraActor.

	#jira UE-29660

Change 2949836 on 2016/04/20 by Gareth.Martin

	Fix landscape components flickering when perfectly flat (bounds size is 0)
	- This often happens for newly created landscapes
	#jira UE-29262

Change 2949768 on 2016/04/20 by Thomas.Sarkanen

	Moving parent & grouped child actors now does not result in deltas being applied twice

	Grouping and attachment now interact correctly.
	Also fixed up according to coding standard.

	Discovered and proposed by David.Bliss2 (Rocksteady).

	#jira UE-29233 - Delta applied twice when moving parent and grouped child actors
	From UDN: https://udn.unrealengine.com/questions/286537/moving-parent-grouped-child-actors-results-in-delt.html

Change 2949759 on 2016/04/20 by Thomas.Sarkanen

	Fix split pins not working as anim graph node inputs

	Limit surface area of this change by only modifying the anim BP compiler. A better version might be to move the call in the general blueprint compiler but it is riskier.

	#jira UE-12326 - Splitting a struct in an Anim Blueprint does not work

Change 2949739 on 2016/04/20 by Thomas.Sarkanen

	Fix layered bone per blend accessed from a struct in the fast-path

	Made sure that the fallback event is always built (logic was still split so if PatchFunctionNamesAndCopyRecordsInto aborted because of some unhandled case if might not have an event to call).
	Covered struct source->array dest case.
	Indicator icon is now built from the copy record itself, ensuring it is accurate to actual runtime data.

	#jira UE-29389 - Fast-Path: Layered Blend per Bone node failing to grab updated values from struct.

Change 2949715 on 2016/04/20 by Max.Chen

	Sequencer: Fix mouse wheel zoom so it defaults to zooming in on the current time/frame. This is a toggleable option in the Editor Preferences (Zoom Position = Current Time or Mouse Position)

	#jira UE-29661

Change 2949712 on 2016/04/20 by Taizyd.Korambayil

	#jira UE-28544 adjusted Player crosshair to be centered

Change 2949710 on 2016/04/20 by Alexis.Matte

	#jira UE-29477
	Pixel Inspector, UI get polish and adding "scene color" inspect property

Change 2949706 on 2016/04/20 by Alexis.Matte

	#jira UE-29475
	#jira UE-29476
	Favorite allow all UProperty to be favorite (the FStruct is now supported)
	Favorite scrollig is auto adjust to avoid scrolling when adding/removing a favorite

Change 2949691 on 2016/04/20 by Mark.Satterthwaite

	Fix typo from previous commit - retain not release...
	#jira UE-29140

Change 2949690 on 2016/04/20 by Mark.Satterthwaite

	Double-buffer the Metal viewport's back-buffer so that we can access the contents of the back-buffer after EndDrawingViewport is called until BeginDrawingViewport is called again on this viewport, this makes it possible to capture movies on Metal.
	#jira UE-29140

Change 2949616 on 2016/04/20 by Marc.Audy

	'Merge' latest version of Vulkan from Dev-Rendering to Release-4.12
	#jira UE-00000

Change 2949572 on 2016/04/20 by Jamie.Dale

	Fixed crash undoing a text property changed caused by a null entry in the array

	#jira UE-20223

Change 2949562 on 2016/04/20 by Alexis.Matte

	#jira UE-29447
	Fix the batch fbx import "not show options" dialog where some option can be different.

Change 2949560 on 2016/04/20 by Alexis.Matte

	#jira UE-28898
	Avoid importing multiple static mesh in the same package

Change 2949547 on 2016/04/20 by Mark.Satterthwaite

	You must use STENCIL_COMPONENT_SWIZZLE  to access the stencil component of a texture - not all APIs can swizzle it into .g automatically.
	#jira UE-29672

Change 2949443 on 2016/04/20 by Allan.Bentham

	Disable sRGB textures when ES31 feature level is set.
	Only use vk's sRGB formats when feature level > ES3_1

	#jira UE-29623

Change 2949428 on 2016/04/20 by Allan.Bentham

	Back out changelist 2949405
	#jira UE-29623

Change 2949405 on 2016/04/20 by Allan.Bentham

	Disable sRGB textures when ES31 feature level is set.
	Only use vk's sRGB formats when feature level > ES3_1

	#jira UE-29623

	Merging using Dev-Mobile_->_Release-4.12

Change 2949391 on 2016/04/20 by Richard.TalbotWatkin

	PIE with multiple windows now starts focused on Client 1, or the server if not a dedicated server. Added a new virtual call UEditorEngine::OnLoginPIEAllComplete, called when all clients have been successfully logged in when starting PIE. The default behavior is to set focus to the first client.
	#jira UE-26037 - Cumbersome workflow when running PIE with 2 clients
	#jira UE-26905 - First client window does not gain focus or mouse control when launching two clients

Change 2949389 on 2016/04/20 by Richard.TalbotWatkin

	Fixed regression which was saving the viewport config settings incorrectly.  Viewports are keyed by their layout on the same key as the config key, hence we do not need to prepend the SpecificLayoutString when saving out the config data when iterating through a layout's viewports.
	#jira UE-29058 - Viewport settings are not saved after shutting down editor

Change 2949388 on 2016/04/20 by Richard.TalbotWatkin

	Change auto-reimport settings so that "Detect Changes on Startup" defaults to true. Also removed the warning of potential unwanted behaviour when working in conjunction with source control; this is no longer necessary now that there is a prompt prior to auto-reimport.
	#jira UE-29257 - Auto import does not import assets

Change 2949203 on 2016/04/19 by Max.Chen

	Sequencer: Fix spawnables not getting default tracks.

	#jira UE-29644

Change 2949202 on 2016/04/19 by Max.Chen

	Sequencer: Fix particles not firing on loop.

	#jira UE-27881

Change 2949201 on 2016/04/19 by Max.Chen

	Sequencer: Fix multiple labels support

	#jira UE-26812

Change 2949200 on 2016/04/19 by Max.Chen

	Sequencer: Expose settings sequencer settings in the Editor Preferences page. Note, UMG and Niagara have separate sequencer settings pages.

	#jira UE-29516

Change 2949197 on 2016/04/19 by Max.Chen

	Sequencer: Fix unwind rotation when keying rotation so that rotations are always set to the nearest.

	#jira UE-22228

Change 2949196 on 2016/04/19 by Max.Chen

	Sequencer: Disable selection range drawing if it's empty so that playback range dragging can take precedence when they overlap. This fixes a bug where you can't drag the starting playback range when sequencer starts up.

	#jira UE-29657

Change 2949195 on 2016/04/19 by Max.Chen

	MovieSceneCapture: Default image compression quality to 100 (rather than 75).

	#jira UE-29657

Change 2949194 on 2016/04/19 by Max.Chen

	Sequencer: Matinee to Level Sequence fix for mapping properties correctly. This fixes focus distance not getting set properly on the conversion.

	#jira UETOOL-467

Change 2949193 on 2016/04/19 by Max.Chen

	Sequencer - Fix issues with level visibility.
	+ Don't mark sub-levels as dirty when the track evaluates.
	+ Fix an issue where sequencer gets into a refresh loop because drawing thumbnails causes levels to be added which was rebuilding the tree, which was redrawing thumbnails.
	+ Null check for when an objects world is null but the track is still evaluating.
	+ Remove UnrealEd references.

	#jira UE-25668

Change 2948990 on 2016/04/19 by Aaron.McLeran

	#jira UE-29654 FadeIn invalidates Audio Components in 4.11

Change 2948890 on 2016/04/19 by Jamie.Dale

	Downgraded an assert in SPathView::LoadSettings to avoid a common crash when a saved path no longer exists

	#jira UE-28858

Change 2948860 on 2016/04/19 by Mike.Beach

	Mirroring CL 2940334 (from Dev-Blueprints):
	Bettering CreateEvent node errors, so users are able to recover from API changes (not clearing the function name field, calling out the function by name in the error, etc.)

	#jira UE-28911

Change 2948857 on 2016/04/19 by Jamie.Dale

	Added an Asset Localization context menu to the Content Browser

	This allows you to create, edit, and view localized assets from any source asset, as well as edit and view source assets from any localized asset.

	#jira UE-29493

Change 2948854 on 2016/04/19 by Jamie.Dale

	UAT now stages all project translation targets

	#jira UE-20248

Change 2948831 on 2016/04/19 by Mike.Beach

	Mirroring CL 2945994 (from Dev-Blueprints):
	Pasting EdGraphNodes will no longer query sub-nodes for compatibility if the root cannot be pasted (for things like collapsed graphs, and anim state-machine nodes).

	#jira UE-29035

Change 2948825 on 2016/04/19 by Jamie.Dale

	Fixed shadow warning

	#jira UE-29212

Change 2948812 on 2016/04/19 by Marc.Audy

	Gracefully handle failure to load configurable engine classes
	#jira UE-26527

Change 2948791 on 2016/04/19 by Jamie.Dale

	Fixed regression in SEditableText bIsCaretMovedWhenGainFocus when using auto-complete
	Fixed regression in FSlateEditableTextLayout::SetText that caused it to call OnTextChanged when nothing had changed

	#jira UE-29494
	#jira UE-28886

Change 2948761 on 2016/04/19 by Jamie.Dale

	Sub-fonts are now only used when they contain the character to be rendered

	#jira UE-29212

Change 2948718 on 2016/04/19 by Jamie.Dale

	Fixed an issue where FEnginePackageLocalizationCache could be initialized before CoreUObject was ready

	This is now done lazily, either when the first CDO tries to load an asset (which is after CoreUObject is ready), or after the first call to ProcessNewlyLoadedUObjects (if no CDO loads an asset).

	#jira UE-29649

Change 2948717 on 2016/04/19 by Jamie.Dale

	Removed the AssetRegistry's dependency on MessageLog

	It was only there to add a category that was only ever used by the AssetTools module.

	#jira UE-29649

Change 2948683 on 2016/04/19 by Phillip.Kavan

	[UE-18419] Fix GetClassDefaults nodes to update properly in response to structural BP class changes.

	change summary:
	- modified UK2Node_GetClassDefaults::CreateOutputPins() to bind/unbind delegate handlers for the OnChanged() & OnCompile() events for BP class types.

	#jira UE-18419

Change 2948681 on 2016/04/19 by Phillip.Kavan

	[UE-17794] The "Delete Unused Variable" feature now considers the GetClassDefaults node as well.

	change summary:
	- added external linkage to UK2Node_GetClassDefaults::FindClassPin().
	- added an include for the K2Node_GetClassDefaults header file to BlueprintGraphDefinitions.h.
	- added UK2Node_GetClassDefaults::GetInputClass() as a public API w/ external linkage; moved default 'nullptr' param logic into this impl.
	- modified FBlueprintEditorUtils::IsVariableUsed() to add an extra check for a GetClassDefaults node with a visible output pin for the variable that's also connected.
	- modified UK2Node_GetClassDefaults::GetInputClass() to return the generated skeleton class for Blueprint class types.

	#jira UE-17794

Change 2948638 on 2016/04/19 by Lee.Clark

	PS4 - Fix SDK compile warnings

	#jira UE-29647

Change 2948401 on 2016/04/19 by Taizyd.Korambayil

	#jira UE-29250 Revuilt Lighting for Landscapes Map

Change 2948398 on 2016/04/19 by Mark.Satterthwaite

	Add a Mac Metal ES2 shader platform to allow the various ES2 emulation modes to work in the Editor. Fix various issues with the shader code to ensure that Metal can run with ES2 shader code at least in my limited test cases in QAGame.
	#jira UE-29170

Change 2948366 on 2016/04/19 by Taizyd.Korambayil

	#jira UE-29109 Replaced Box Mesh with BSP Floor

Change 2948360 on 2016/04/19 by Maciej.Mroz

	merged from Dev-Blueprints 2947488

	#jira UE-29115 Nativized BulletTrain - cannot shoot targets in intro tutorial
	#jira UE-28965 Packaging Project with Nativize Blueprint Assets Prevents Overlap Events from Firing
	#jira UE-29559
	- fixed private enum access
	- fixed private bitfield access
	- removed forced PostLoad
	- add BodyInstance.FixupData call to fix ResponseChannels
	- ignored RelativeLocation and RelativeRotation in converted root component
	- fixed AttachToComponent (UE-29559)

Change 2948358 on 2016/04/19 by Maciej.Mroz

	merged from Dev-Blueprints 2947953

	#jira UE-29605 Wrong bullet trails in nativized ShowUp
	Fixed USimpleConstructionScript::GetSceneRootComponentTemplate.

Change 2948357 on 2016/04/19 by Maciej.Mroz

	merged from Dev-Blueprints 2947984

	#jira UE-29374 Crash when hovering over Create Widget node in blueprints

	Safe UK2Node_ConstructObjectFromClass::GetPinHoverText.

Change 2948353 on 2016/04/19 by Maciej.Mroz

	merged from Dev-Blueprints 2948095

	#jira UE-29246 ExpandEnumAsExecs + UMETA(Hidden) Crashes Blueprint Compile
	"Hidden" and "Spacer" elementa from an enum does not generated exec pins for "ExpandEnumAsExecs"

Change 2948332 on 2016/04/19 by Benn.Gallagher

	Fixed old pins being left as non-transactional
	#jira UE-13801

Change 2948203 on 2016/04/19 by Lee.Clark

	PS4 - Use SDK 3.508.031

	#jira UEPLAT-1225

Change 2948168 on 2016/04/19 by mason.seay

	Updating test content:

	-Added Husk AI to level to test placed AI

	-Updated Spawn Husk BP to destroy itself to prevent spawn spamming

	#jira UE-29618

Change 2948153 on 2016/04/19 by Benn.Gallagher

	Missed mesh update for Owen IK fix.

	#jira UE-22540

Change 2948130 on 2016/04/19 by Benn.Gallagher

	Fixed old Owen punch IK setup so it no longer jitters when placing the hands on the surface.

	#jira UE-22540

Change 2948117 on 2016/04/19 by Taizyd.Korambayil

	#jira UE-28477 Resaved Template Map's to fix Warning Toast on Templates

Change 2948063 on 2016/04/19 by Lina.Halper

	- Anim composite notify change for better
	 - Fixed all nested anim notify

	- Merging CL 2944396 using //UE4/Dev-Framework_to_//UE4/Release-4.12

	#jira : UE-29101

Change 2948060 on 2016/04/19 by Lina.Halper

	Fix for composite section metadata saving for montage

	Merging CL 2944397 using //UE4/Dev-Framework_to_//UE4/Release-4.12

	#jira : UE-29228

Change 2948029 on 2016/04/19 by Ben.Marsh

	EC: Prevent automatically pushing CIS builds to the launcher; the changelist might be run more than once.

Change 2947986 on 2016/04/19 by Benn.Gallagher

	Fixed BP callable functions that affect skeletal mesh component transforms not working when simulating physics.
	#jira UE-27783

Change 2947976 on 2016/04/19 by Mark.Satterthwaite

	Duplicate CL #2943702 from 4.11.2: Change the way Metal validates the render-target state so that in FMetalContext::PrepareToDraw it can issue a last-ditch attempt to restore the render-targets. This won't fix the cause of the Mac Metal crashes but it might mitigate some of them and provide more information about why they are occurring.
	#jira UE-29006

Change 2947975 on 2016/04/19 by Mark.Satterthwaite

	Duplicate CL #2945061 from UE4-UT: Address UT issue UE-29150 directly in the UT branch: users without a sufficiently up-to-date Xcode won't have the 'metal' offline shader compiler so will have to use the slower online compiled text shader format.
	#jira UE-29150

Change 2947679 on 2016/04/19 by Jack.Porter

	Fixed 4.12 branch not compiling with the 1.0.8 Vulkan SDK
	#jira UE-29601

Change 2947657 on 2016/04/18 by Jack.Porter

	Update protostar reflection capture contents

	#jira UE-29600

Change 2947301 on 2016/04/18 by Ben.Marsh

	EC: Fix trigger ready emails failing to send due to recipient list being a space-separated list of addresses rather than an array reference.

Change 2947263 on 2016/04/18 by Marc.Audy

	Merging CL# 2945921 //UE4/Release-4.11 to //UE4/Release-4.12

	Ensure that all OwnedComponents in an Actor are duplicated for PIE even if not referenced by a property, unless that component is explicitly transient
	#jira UE-29209

Change 2946984 on 2016/04/18 by Ben.Marsh

	GUBP: Allow Ocean cooks in the release branch (fixes build startup failures)

Change 2946870 on 2016/04/18 by Ben.Marsh

	Remaking CL 2946810 to fix compile error in ShooterGame editor.

Change 2946859 on 2016/04/18 by Ben.Marsh

	GUBP: Don't exclude Ocean from builds in the release branch.

Change 2946847 on 2016/04/18 by Ben.Marsh

	GUBP: Fix warning on every build step due to OrionGame_Win32_Mono no longer existing.

Change 2946771 on 2016/04/18 by Ben.Marsh

	EC: Correct initial agent type for release branches. Causing full branch syncs on all agents.

Change 2946641 on 2016/04/18 by Ben.Marsh

	EC: Remove rogue comma causing branch definition parsing to fail.

Change 2946592 on 2016/04/18 by Ben.Marsh

	EC: Adding branch definition for 4.12 release

#lockdown Nick.Penwarden

[CL 2962354 by Ben Marsh in Main branch]
2016-05-01 17:37:41 -04:00

2469 lines
84 KiB
C++

// Copyright 1998-2016 Epic Games, Inc. All Rights Reserved.
#include "ContentBrowserPCH.h"
#include "AssetContextMenu.h"
#include "NewAssetOrClassContextMenu.h"
#include "PathContextMenu.h"
#include "ContentBrowserModule.h"
#include "ContentBrowserCommands.h"
#include "CollectionManagerModule.h"
#include "CollectionContextMenu.h"
#include "AssetRegistryModule.h"
#include "SDockTab.h"
#include "GenericCommands.h"
#include "IAddContentDialogModule.h"
#include "Engine/Selection.h"
#include "NativeClassHierarchy.h"
#include "GameProjectGenerationModule.h"
#define LOCTEXT_NAMESPACE "ContentBrowser"
const FString SContentBrowser::SettingsIniSection = TEXT("ContentBrowser");
SContentBrowser::~SContentBrowser()
{
// Remove the listener for when view settings are changed
UContentBrowserSettings::OnSettingChanged().RemoveAll( this );
// Remove listeners for when collections/paths are renamed/deleted
if (FCollectionManagerModule::IsModuleAvailable())
{
FCollectionManagerModule& CollectionManagerModule = FCollectionManagerModule::GetModule();
CollectionManagerModule.Get().OnCollectionRenamed().RemoveAll(this);
CollectionManagerModule.Get().OnCollectionDestroyed().RemoveAll(this);
}
FAssetRegistryModule* AssetRegistryModule = FModuleManager::GetModulePtr<FAssetRegistryModule>(TEXT("AssetRegistry"));
if (AssetRegistryModule != nullptr)
{
AssetRegistryModule->Get().OnPathRemoved().RemoveAll(this);
}
}
BEGIN_SLATE_FUNCTION_BUILD_OPTIMIZATION
void SContentBrowser::Construct( const FArguments& InArgs, const FName& InInstanceName, const FContentBrowserConfig* Config )
{
if ( InArgs._ContainingTab.IsValid() )
{
// For content browsers that are placed in tabs, save settings when the tab is closing.
ContainingTab = InArgs._ContainingTab;
InArgs._ContainingTab->SetOnPersistVisualState( SDockTab::FOnPersistVisualState::CreateSP( this, &SContentBrowser::OnContainingTabSavingVisualState ) );
InArgs._ContainingTab->SetOnTabClosed( SDockTab::FOnTabClosedCallback::CreateSP( this, &SContentBrowser::OnContainingTabClosed ) );
InArgs._ContainingTab->SetOnTabActivated( SDockTab::FOnTabActivatedCallback::CreateSP( this, &SContentBrowser::OnContainingTabActivated ) );
}
bIsLocked = InArgs._InitiallyLocked;
bAlwaysShowCollections = Config != nullptr ? Config->bAlwaysShowCollections : false;
HistoryManager.SetOnApplyHistoryData(FOnApplyHistoryData::CreateSP(this, &SContentBrowser::OnApplyHistoryData));
HistoryManager.SetOnUpdateHistoryData(FOnUpdateHistoryData::CreateSP(this, &SContentBrowser::OnUpdateHistoryData));
PathContextMenu = MakeShareable(new FPathContextMenu( AsShared() ));
PathContextMenu->SetOnNewAssetRequested( FNewAssetOrClassContextMenu::FOnNewAssetRequested::CreateSP(this, &SContentBrowser::NewAssetRequested) );
PathContextMenu->SetOnNewClassRequested( FNewAssetOrClassContextMenu::FOnNewClassRequested::CreateSP(this, &SContentBrowser::NewClassRequested) );
PathContextMenu->SetOnImportAssetRequested(FNewAssetOrClassContextMenu::FOnImportAssetRequested::CreateSP(this, &SContentBrowser::ImportAsset));
PathContextMenu->SetOnRenameFolderRequested(FPathContextMenu::FOnRenameFolderRequested::CreateSP(this, &SContentBrowser::OnRenameFolderRequested));
PathContextMenu->SetOnFolderDeleted(FPathContextMenu::FOnFolderDeleted::CreateSP(this, &SContentBrowser::OnOpenedFolderDeleted));
FrontendFilters = MakeShareable(new FAssetFilterCollectionType());
TextFilter = MakeShareable( new FFrontendFilter_Text() );
static const FName DefaultForegroundName("DefaultForeground");
FContentBrowserCommands::Register();
BindCommands();
ChildSlot
[
SNew(SVerticalBox)
// Path and history
+SVerticalBox::Slot()
.AutoHeight()
.Padding( 0, 0, 0, 0 )
[
SNew( SWrapBox )
.UseAllottedWidth( true )
.InnerSlotPadding( FVector2D( 5, 2 ) )
+ SWrapBox::Slot()
.FillLineWhenWidthLessThan( 600 )
.FillEmptySpace( true )
[
SNew( SHorizontalBox )
+ SHorizontalBox::Slot()
.FillWidth(1.0f)
[
SNew( SBorder )
.Padding( FMargin( 3 ) )
.BorderImage( FEditorStyle::GetBrush( "ToolPanel.GroupBorder" ) )
[
SNew( SHorizontalBox )
// New
+ SHorizontalBox::Slot()
.AutoWidth()
.VAlign( VAlign_Center )
.HAlign( HAlign_Left )
[
SNew( SComboButton )
.ComboButtonStyle( FEditorStyle::Get(), "ToolbarComboButton" )
.ButtonStyle(FEditorStyle::Get(), "FlatButton.Success")
.ForegroundColor(FLinearColor::White)
.ContentPadding(FMargin(6, 2))
.OnGetMenuContent_Lambda( [this]{ return MakeAddNewContextMenu( true, false ); } )
.ToolTipText( this, &SContentBrowser::GetAddNewToolTipText )
.IsEnabled( this, &SContentBrowser::IsAddNewEnabled )
.AddMetaData<FTagMetaData>(FTagMetaData(TEXT("ContentBrowserNewAsset")))
.HasDownArrow(false)
.ButtonContent()
[
SNew( SHorizontalBox )
// New Icon
+ SHorizontalBox::Slot()
.VAlign(VAlign_Center)
.AutoWidth()
[
SNew(STextBlock)
.TextStyle(FEditorStyle::Get(), "ContentBrowser.TopBar.Font")
.Font(FEditorStyle::Get().GetFontStyle("FontAwesome.11"))
.Text(FEditorFontGlyphs::File)
]
// New Text
+ SHorizontalBox::Slot()
.AutoWidth()
.VAlign(VAlign_Center)
.Padding(4, 0, 0, 0)
[
SNew( STextBlock )
.TextStyle( FEditorStyle::Get(), "ContentBrowser.TopBar.Font" )
.Text( LOCTEXT( "NewButton", "Add New" ) )
]
// Down Arrow
+ SHorizontalBox::Slot()
.VAlign(VAlign_Center)
.AutoWidth()
.Padding(4, 0, 0, 0)
[
SNew(STextBlock)
.TextStyle(FEditorStyle::Get(), "ContentBrowser.TopBar.Font")
.Font(FEditorStyle::Get().GetFontStyle("FontAwesome.10"))
.Text(FEditorFontGlyphs::Caret_Down)
]
]
]
// Import
+ SHorizontalBox::Slot()
.AutoWidth()
.VAlign( VAlign_Center )
.HAlign( HAlign_Left )
.Padding(6, 0)
[
SNew( SButton )
.ButtonStyle(FEditorStyle::Get(), "FlatButton")
.ToolTipText( this, &SContentBrowser::GetImportTooltipText )
.IsEnabled( this, &SContentBrowser::IsImportEnabled )
.OnClicked( this, &SContentBrowser::HandleImportClicked )
.ContentPadding(FMargin(6, 2))
.AddMetaData<FTagMetaData>(FTagMetaData(TEXT("ContentBrowserImportAsset")))
[
SNew( SHorizontalBox )
// Import Icon
+ SHorizontalBox::Slot()
.VAlign(VAlign_Center)
.AutoWidth()
[
SNew(STextBlock)
.TextStyle(FEditorStyle::Get(), "ContentBrowser.TopBar.Font")
.Font(FEditorStyle::Get().GetFontStyle("FontAwesome.11"))
.Text(FEditorFontGlyphs::Download)
]
// Import Text
+ SHorizontalBox::Slot()
.AutoWidth()
.VAlign(VAlign_Center)
.Padding(4, 0, 0, 0)
[
SNew( STextBlock )
.TextStyle( FEditorStyle::Get(), "ContentBrowser.TopBar.Font" )
.Text( LOCTEXT( "Import", "Import" ) )
]
]
]
// Save
+ SHorizontalBox::Slot()
.FillWidth(1.0f)
.VAlign(VAlign_Center)
.HAlign(HAlign_Left)
[
SNew( SButton )
.ButtonStyle(FEditorStyle::Get(), "FlatButton")
.ToolTipText( LOCTEXT( "SaveDirtyPackagesTooltip", "Save all modified assets." ) )
.ContentPadding(FMargin(6, 2))
.OnClicked( this, &SContentBrowser::OnSaveClicked )
.AddMetaData<FTagMetaData>(FTagMetaData(TEXT("ContentBrowserSaveDirtyPackages")))
[
SNew( SHorizontalBox )
// Save All Icon
+ SHorizontalBox::Slot()
.VAlign(VAlign_Center)
.AutoWidth()
[
SNew(STextBlock)
.TextStyle(FEditorStyle::Get(), "ContentBrowser.TopBar.Font")
.Font(FEditorStyle::Get().GetFontStyle("FontAwesome.11"))
.Text(FEditorFontGlyphs::Floppy_O)
]
// Save All Text
+ SHorizontalBox::Slot()
.AutoWidth()
.VAlign(VAlign_Center)
.Padding(4, 0, 0, 0)
[
SNew( STextBlock )
.TextStyle( FEditorStyle::Get(), "ContentBrowser.TopBar.Font" )
.Text( LOCTEXT( "SaveAll", "Save All" ) )
]
]
]
]
]
]
+ SWrapBox::Slot()
.FillEmptySpace( true )
[
SNew(SBorder)
.Padding(FMargin(3))
.BorderImage( FEditorStyle::GetBrush("ToolPanel.GroupBorder") )
[
SNew(SHorizontalBox)
// History Back Button
+SHorizontalBox::Slot()
.AutoWidth()
[
SNew(SVerticalBox)
+ SVerticalBox::Slot()
.FillHeight(1.0f)
[
SNew(SButton)
.VAlign(EVerticalAlignment::VAlign_Center)
.ButtonStyle(FEditorStyle::Get(), "FlatButton")
.ForegroundColor( FEditorStyle::GetSlateColor(DefaultForegroundName) )
.ToolTipText( this, &SContentBrowser::GetHistoryBackTooltip )
.ContentPadding( FMargin(1, 0) )
.OnClicked(this, &SContentBrowser::BackClicked)
.IsEnabled(this, &SContentBrowser::IsBackEnabled)
.AddMetaData<FTagMetaData>(FTagMetaData(TEXT("ContentBrowserHistoryBack")))
[
SNew(STextBlock)
.TextStyle(FEditorStyle::Get(), "ContentBrowser.TopBar.Font")
.Font(FEditorStyle::Get().GetFontStyle("FontAwesome.11"))
.Text(FText::FromString(FString(TEXT("\xf060"))) /*fa-arrow-left*/)
]
]
]
// History Forward Button
+ SHorizontalBox::Slot()
.AutoWidth()
[
SNew(SVerticalBox)
+ SVerticalBox::Slot()
.FillHeight(1.0f)
[
SNew(SButton)
.VAlign(EVerticalAlignment::VAlign_Center)
.ButtonStyle(FEditorStyle::Get(), "FlatButton")
.ForegroundColor( FEditorStyle::GetSlateColor(DefaultForegroundName) )
.ToolTipText( this, &SContentBrowser::GetHistoryForwardTooltip )
.ContentPadding( FMargin(1, 0) )
.OnClicked(this, &SContentBrowser::ForwardClicked)
.IsEnabled(this, &SContentBrowser::IsForwardEnabled)
.AddMetaData<FTagMetaData>(FTagMetaData(TEXT("ContentBrowserHistoryForward")))
[
SNew(STextBlock)
.TextStyle(FEditorStyle::Get(), "ContentBrowser.TopBar.Font")
.Font(FEditorStyle::Get().GetFontStyle("FontAwesome.11"))
.Text(FText::FromString(FString(TEXT("\xf061"))) /*fa-arrow-right*/)
]
]
]
// Separator
+ SHorizontalBox::Slot()
.AutoWidth()
.Padding(3, 0)
[
SNew(SSeparator)
.Orientation(Orient_Vertical)
]
// Path picker
+ SHorizontalBox::Slot()
.AutoWidth()
.VAlign( VAlign_Fill )
[
SAssignNew( PathPickerButton, SComboButton )
.Visibility( ( Config != nullptr ? Config->bUsePathPicker : true ) ? EVisibility::Visible : EVisibility::Collapsed )
.ButtonStyle(FEditorStyle::Get(), "FlatButton")
.ForegroundColor(FLinearColor::White)
.ToolTipText( LOCTEXT( "PathPickerTooltip", "Choose a path" ) )
.OnGetMenuContent( this, &SContentBrowser::GetPathPickerContent )
.HasDownArrow( false )
.AddMetaData<FTagMetaData>(FTagMetaData(TEXT("ContentBrowserPathPicker")))
.ContentPadding(FMargin(3, 3))
.ButtonContent()
[
SNew(STextBlock)
.TextStyle(FEditorStyle::Get(), "ContentBrowser.TopBar.Font")
.Font(FEditorStyle::Get().GetFontStyle("FontAwesome.11"))
.Text(FText::FromString(FString(TEXT("\xf07c"))) /*fa-folder-open*/)
]
]
// Path
+ SHorizontalBox::Slot()
.VAlign(VAlign_Center)
.HAlign(HAlign_Left)
.FillWidth(1.0f)
.Padding(FMargin(0))
[
SAssignNew(PathBreadcrumbTrail, SBreadcrumbTrail<FString>)
.ButtonContentPadding(FMargin(2, 2))
.ButtonStyle(FEditorStyle::Get(), "FlatButton")
.DelimiterImage(FEditorStyle::GetBrush("ContentBrowser.PathDelimiter"))
.TextStyle(FEditorStyle::Get(), "ContentBrowser.PathText")
.ShowLeadingDelimiter(false)
.InvertTextColorOnHover(false)
.OnCrumbClicked(this, &SContentBrowser::OnPathClicked)
.GetCrumbMenuContent(this, &SContentBrowser::OnGetCrumbDelimiterContent)
.AddMetaData<FTagMetaData>(FTagMetaData(TEXT("ContentBrowserPath")))
]
// Lock button
+ SHorizontalBox::Slot()
.AutoWidth()
.VAlign(VAlign_Center)
[
SNew(SVerticalBox)
.Visibility( ( Config != nullptr ? Config->bCanShowLockButton : true ) ? EVisibility::SelfHitTestInvisible : EVisibility::Collapsed )
+ SVerticalBox::Slot()
.FillHeight(1.0f)
[
SNew(SButton)
.VAlign(EVerticalAlignment::VAlign_Center)
.ButtonStyle(FEditorStyle::Get(), "FlatButton")
.ToolTipText( LOCTEXT("LockToggleTooltip", "Toggle lock. If locked, this browser will ignore Find in Content Browser requests.") )
.ContentPadding( FMargin(1, 0) )
.OnClicked(this, &SContentBrowser::ToggleLockClicked)
.AddMetaData<FTagMetaData>(FTagMetaData(TEXT("ContentBrowserLock")))
[
SNew(SImage)
.Image( this, &SContentBrowser::GetToggleLockImage)
]
]
]
]
]
]
// Assets/tree
+ SVerticalBox::Slot()
.FillHeight(1.0f)
[
// The tree/assets splitter
SAssignNew(PathAssetSplitterPtr, SSplitter)
// Sources View
+ SSplitter::Slot()
.Value(0.25f)
[
SNew(SVerticalBox)
.Visibility( this, &SContentBrowser::GetSourcesViewVisibility )
+ SVerticalBox::Slot()
.FillHeight(1.0f)
[
SAssignNew(PathCollectionSplitterPtr, SSplitter)
.Style( FEditorStyle::Get(), "ContentBrowser.Splitter" )
.Orientation( Orient_Vertical )
// Path View
+ SSplitter::Slot()
.Value(0.9f)
[
SNew(SBorder)
.Visibility( ( Config != nullptr ? Config->bShowAssetPathTree : true ) ? EVisibility::Visible : EVisibility::Collapsed )
.Padding(FMargin(3))
.BorderImage( FEditorStyle::GetBrush("ToolPanel.GroupBorder") )
[
SAssignNew( PathViewPtr, SPathView )
.OnPathSelected( this, &SContentBrowser::PathSelected )
.OnGetFolderContextMenu( this, &SContentBrowser::GetFolderContextMenu, true )
.OnGetPathContextMenuExtender( this, &SContentBrowser::GetPathContextMenuExtender )
.FocusSearchBoxWhenOpened( false )
.ShowTreeTitle( false )
.ShowSeparator( false )
.AllowClassesFolder( true )
.AddMetaData<FTagMetaData>(FTagMetaData(TEXT("ContentBrowserSources")))
.SearchContent()
[
SNew( SVerticalBox )
.AddMetaData<FTagMetaData>(FTagMetaData(TEXT("ContentBrowserSourcesToggle1")))
+ SVerticalBox::Slot()
.FillHeight( 1.0f )
.Padding(0,0,2,0)
[
SNew( SButton )
.VAlign( EVerticalAlignment::VAlign_Center )
.ButtonStyle( FEditorStyle::Get(), "ToggleButton" )
.ToolTipText( LOCTEXT( "SourcesTreeToggleTooltip", "Show or hide the sources panel" ) )
.ContentPadding( FMargin( 1, 0 ) )
.ForegroundColor( FEditorStyle::GetSlateColor(DefaultForegroundName) )
.OnClicked( this, &SContentBrowser::SourcesViewExpandClicked )
[
SNew( SImage )
.Image( this, &SContentBrowser::GetSourcesToggleImage )
]
]
]
]
]
// Collection View
+ SSplitter::Slot()
.Value(0.9f)
[
SNew(SBorder)
.Visibility( this, &SContentBrowser::GetCollectionViewVisibility )
.Padding(FMargin(3))
.BorderImage( FEditorStyle::GetBrush("ToolPanel.GroupBorder") )
[
SAssignNew(CollectionViewPtr, SCollectionView)
.OnCollectionSelected(this, &SContentBrowser::CollectionSelected)
.AddMetaData<FTagMetaData>(FTagMetaData(TEXT("ContentBrowserCollections")))
.AllowCollectionDrag(true)
.AllowQuickAssetManagement(true)
]
]
]
]
// Asset View
+ SSplitter::Slot()
.Value(0.75f)
[
SNew(SBorder)
.Padding(FMargin(3))
.BorderImage( FEditorStyle::GetBrush("ToolPanel.GroupBorder") )
[
SNew(SVerticalBox)
// Search and commands
+ SVerticalBox::Slot()
.AutoHeight()
[
SNew(SHorizontalBox)
// Expand/collapse sources button
+ SHorizontalBox::Slot()
.AutoWidth()
.Padding( 0, 0, 4, 0 )
[
SNew( SVerticalBox )
.Visibility(( Config != nullptr ? Config->bUseSourcesView : true ) ? EVisibility::SelfHitTestInvisible : EVisibility::Collapsed)
.AddMetaData<FTagMetaData>(FTagMetaData(TEXT("ContentBrowserSourcesToggle2")))
+ SVerticalBox::Slot()
.FillHeight( 1.0f )
[
SNew( SButton )
.VAlign( EVerticalAlignment::VAlign_Center )
.ButtonStyle( FEditorStyle::Get(), "ToggleButton" )
.ToolTipText( LOCTEXT( "SourcesTreeToggleTooltip", "Show or hide the sources panel" ) )
.ContentPadding( FMargin( 1, 0 ) )
.ForegroundColor( FEditorStyle::GetSlateColor(DefaultForegroundName) )
.OnClicked( this, &SContentBrowser::SourcesViewExpandClicked )
.Visibility( this, &SContentBrowser::GetPathExpanderVisibility )
[
SNew( SImage )
.Image( this, &SContentBrowser::GetSourcesToggleImage )
]
]
]
// Filter
+ SHorizontalBox::Slot()
.AutoWidth()
[
SNew( SComboButton )
.ComboButtonStyle( FEditorStyle::Get(), "ContentBrowser.Filters.Style" )
.ForegroundColor(FLinearColor::White)
.ContentPadding(0)
.ToolTipText( LOCTEXT( "AddFilterToolTip", "Add an asset filter." ) )
.OnGetMenuContent( this, &SContentBrowser::MakeAddFilterMenu )
.HasDownArrow( true )
.ContentPadding( FMargin( 1, 0 ) )
.AddMetaData<FTagMetaData>(FTagMetaData(TEXT("ContentBrowserFiltersCombo")))
.Visibility( ( Config != nullptr ? Config->bCanShowFilters : true ) ? EVisibility::Visible : EVisibility::Collapsed )
.ButtonContent()
[
SNew(SHorizontalBox)
+ SHorizontalBox::Slot()
.AutoWidth()
[
SNew(STextBlock)
.TextStyle(FEditorStyle::Get(), "ContentBrowser.Filters.Text")
.Font(FEditorStyle::Get().GetFontStyle("FontAwesome.9"))
.Text(FText::FromString(FString(TEXT("\xf0b0"))) /*fa-filter*/)
]
+ SHorizontalBox::Slot()
.AutoWidth()
.Padding(2,0,0,0)
[
SNew(STextBlock)
.TextStyle(FEditorStyle::Get(), "ContentBrowser.Filters.Text")
.Text(LOCTEXT("Filters", "Filters"))
]
]
]
// Search
+SHorizontalBox::Slot()
.Padding(4, 1, 0, 0)
.FillWidth(1.0f)
[
SAssignNew(SearchBoxPtr, SAssetSearchBox)
.HintText( this, &SContentBrowser::GetSearchAssetsHintText )
.OnTextChanged( this, &SContentBrowser::OnSearchBoxChanged )
.OnTextCommitted( this, &SContentBrowser::OnSearchBoxCommitted )
.PossibleSuggestions( this, &SContentBrowser::GetAssetSearchSuggestions )
.DelayChangeNotificationsWhileTyping( true )
.Visibility( ( Config != nullptr ? Config->bCanShowAssetSearch : true ) ? EVisibility::Visible : EVisibility::Collapsed )
.AddMetaData<FTagMetaData>(FTagMetaData(TEXT("ContentBrowserSearchAssets")))
]
// Save Search
+SHorizontalBox::Slot()
.AutoWidth()
.VAlign(VAlign_Center)
.Padding(2.0f, 0.0f, 0.0f, 0.0f)
[
SNew(SButton)
.ButtonStyle(FEditorStyle::Get(), "FlatButton")
.ToolTipText(LOCTEXT("SaveSearchButtonTooltip", "Save the current search as a dynamic collection."))
.IsEnabled(this, &SContentBrowser::IsSaveSearchButtonEnabled)
.OnClicked(this, &SContentBrowser::OnSaveSearchButtonClicked)
.ContentPadding( FMargin(1, 1) )
.Visibility( ( Config != nullptr ? Config->bCanShowAssetSearch : true ) ? EVisibility::Visible : EVisibility::Collapsed )
[
SNew(STextBlock)
.TextStyle(FEditorStyle::Get(), "ContentBrowser.Filters.Text")
.Font(FEditorStyle::Get().GetFontStyle("FontAwesome.10"))
.Text(FEditorFontGlyphs::Floppy_O)
]
]
]
// Filters
+ SVerticalBox::Slot()
.AutoHeight()
[
SAssignNew(FilterListPtr, SFilterList)
.OnFilterChanged(this, &SContentBrowser::OnFilterChanged)
.OnGetContextMenu(this, &SContentBrowser::GetFilterContextMenu)
.Visibility( ( Config != nullptr ? Config->bCanShowFilters : true ) ? EVisibility::Visible : EVisibility::Collapsed )
.FrontendFilters(FrontendFilters)
.AddMetaData<FTagMetaData>(FTagMetaData(TEXT("ContentBrowserFilters")))
]
// Assets
+ SVerticalBox::Slot()
.FillHeight( 1.0f )
.Padding( 0 )
[
SAssignNew(AssetViewPtr, SAssetView)
.ThumbnailLabel( Config != nullptr ? Config->ThumbnailLabel : EThumbnailLabel::ClassName )
.ThumbnailScale( Config != nullptr ? Config->ThumbnailScale : 0.18f )
.InitialViewType( Config != nullptr ? Config->InitialAssetViewType : EAssetViewType::Tile )
.ShowBottomToolbar( Config != nullptr ? Config->bShowBottomToolbar : true )
.OnPathSelected(this, &SContentBrowser::FolderEntered)
.OnAssetSelected(this, &SContentBrowser::OnAssetSelectionChanged)
.OnAssetsActivated(this, &SContentBrowser::OnAssetsActivated)
.OnGetAssetContextMenu(this, &SContentBrowser::OnGetAssetContextMenu)
.OnGetFolderContextMenu(this, &SContentBrowser::GetFolderContextMenu, false)
.OnGetPathContextMenuExtender(this, &SContentBrowser::GetPathContextMenuExtender)
.OnFindInAssetTreeRequested(this, &SContentBrowser::OnFindInAssetTreeRequested)
.OnAssetRenameCommitted(this, &SContentBrowser::OnAssetRenameCommitted)
.AreRealTimeThumbnailsAllowed(this, &SContentBrowser::IsHovered)
.FrontendFilters(FrontendFilters)
.HighlightedText(this, &SContentBrowser::GetHighlightedText)
.AllowThumbnailEditMode(true)
.AllowThumbnailHintLabel(false)
.CanShowFolders(Config != nullptr ? Config->bCanShowFolders : true)
.CanShowClasses(Config != nullptr ? Config->bCanShowClasses : true)
.CanShowRealTimeThumbnails( Config != nullptr ? Config->bCanShowRealTimeThumbnails : true)
.CanShowDevelopersFolder( Config != nullptr ? Config->bCanShowDevelopersFolder : true)
.CanShowCollections(true)
.AddMetaData<FTagMetaData>(FTagMetaData(TEXT("ContentBrowserAssets")))
]
]
]
]
];
AssetContextMenu = MakeShareable(new FAssetContextMenu(AssetViewPtr));
AssetContextMenu->BindCommands(Commands);
AssetContextMenu->SetOnFindInAssetTreeRequested( FOnFindInAssetTreeRequested::CreateSP(this, &SContentBrowser::OnFindInAssetTreeRequested) );
AssetContextMenu->SetOnRenameRequested( FAssetContextMenu::FOnRenameRequested::CreateSP(this, &SContentBrowser::OnRenameRequested) );
AssetContextMenu->SetOnRenameFolderRequested( FAssetContextMenu::FOnRenameFolderRequested::CreateSP(this, &SContentBrowser::OnRenameFolderRequested) );
AssetContextMenu->SetOnDuplicateRequested( FAssetContextMenu::FOnDuplicateRequested::CreateSP(this, &SContentBrowser::OnDuplicateRequested) );
AssetContextMenu->SetOnAssetViewRefreshRequested( FAssetContextMenu::FOnAssetViewRefreshRequested::CreateSP( this, &SContentBrowser::OnAssetViewRefreshRequested) );
if( Config != nullptr && Config->SelectedCollectionName.Name != NAME_None )
{
// Select the specified collection by default
FSourcesData DefaultSourcesData( Config->SelectedCollectionName );
TArray<FString> SelectedPaths;
AssetViewPtr->SetSourcesData( DefaultSourcesData );
}
else
{
// Select /Game by default
FSourcesData DefaultSourcesData(FName("/Game"));
TArray<FString> SelectedPaths;
SelectedPaths.Add(TEXT("/Game"));
PathViewPtr->SetSelectedPaths(SelectedPaths);
AssetViewPtr->SetSourcesData(DefaultSourcesData);
}
// Set the initial history data
HistoryManager.AddHistoryData();
// Load settings if they were specified
this->InstanceName = InInstanceName;
LoadSettings(InInstanceName);
if( Config != nullptr )
{
// Make sure the sources view is initially visible if we were asked to show it
if( ( bSourcesViewExpanded && ( !Config->bExpandSourcesView || !Config->bUseSourcesView ) ) ||
( !bSourcesViewExpanded && Config->bExpandSourcesView && Config->bUseSourcesView ) )
{
SourcesViewExpandClicked();
}
}
// Bindings to manage history when items are deleted
FCollectionManagerModule& CollectionManagerModule = FCollectionManagerModule::GetModule();
CollectionManagerModule.Get().OnCollectionRenamed().AddSP(this, &SContentBrowser::HandleCollectionRenamed);
CollectionManagerModule.Get().OnCollectionDestroyed().AddSP(this, &SContentBrowser::HandleCollectionRemoved);
CollectionManagerModule.Get().OnCollectionUpdated().AddSP(this, &SContentBrowser::HandleCollectionUpdated);
FAssetRegistryModule& AssetRegistryModule = FModuleManager::LoadModuleChecked<FAssetRegistryModule>(TEXT("AssetRegistry"));
AssetRegistryModule.Get().OnPathRemoved().AddSP(this, &SContentBrowser::HandlePathRemoved);
// We want to be able to search the feature packs in the super search so we need the module loaded
IAddContentDialogModule& AddContentDialogModule = FModuleManager::LoadModuleChecked<IAddContentDialogModule>("AddContentDialog");
// Update the breadcrumb trail path
UpdatePath();
}
END_SLATE_FUNCTION_BUILD_OPTIMIZATION
void SContentBrowser::BindCommands()
{
Commands = TSharedPtr< FUICommandList >(new FUICommandList);
Commands->MapAction(FGenericCommands::Get().Rename, FUIAction(
FExecuteAction::CreateSP(this, &SContentBrowser::HandleRenameCommand),
FCanExecuteAction::CreateSP(this, &SContentBrowser::HandleRenameCommandCanExecute)
));
Commands->MapAction(FGenericCommands::Get().Delete, FUIAction(
FExecuteAction::CreateSP(this, &SContentBrowser::HandleDeleteCommandExecute),
FCanExecuteAction::CreateSP(this, &SContentBrowser::HandleDeleteCommandCanExecute)
));
Commands->MapAction(FContentBrowserCommands::Get().OpenAssetsOrFolders, FUIAction(
FExecuteAction::CreateSP(this, &SContentBrowser::HandleOpenAssetsOrFoldersCommandExecute)
));
Commands->MapAction(FContentBrowserCommands::Get().PreviewAssets, FUIAction(
FExecuteAction::CreateSP(this, &SContentBrowser::HandlePreviewAssetsCommandEecute)
));
Commands->MapAction(FContentBrowserCommands::Get().CreateNewFolder, FUIAction(
FExecuteAction::CreateSP(this, &SContentBrowser::HandleCreateNewFolderCommandExecute)
));
Commands->MapAction(FContentBrowserCommands::Get().DirectoryUp, FUIAction(
FExecuteAction::CreateSP(this, &SContentBrowser::HandleDirectoryUpCommandExecute)
));
}
EVisibility SContentBrowser::GetCollectionViewVisibility() const
{
return bAlwaysShowCollections ? EVisibility::Visible : ( GetDefault<UContentBrowserSettings>()->GetDisplayCollections() ? EVisibility::Visible : EVisibility::Collapsed );
}
FText SContentBrowser::GetHighlightedText() const
{
return TextFilter->GetRawFilterText();
}
void SContentBrowser::CreateNewAsset(const FString& DefaultAssetName, const FString& PackagePath, UClass* AssetClass, UFactory* Factory)
{
AssetViewPtr->CreateNewAsset(DefaultAssetName, PackagePath, AssetClass, Factory);
}
bool SContentBrowser::IsImportEnabled() const
{
const FSourcesData& SourcesData = AssetViewPtr->GetSourcesData();
return SourcesData.PackagePaths.Num() == 1 && !ContentBrowserUtils::IsClassPath(SourcesData.PackagePaths[0].ToString());
}
FText SContentBrowser::GetImportTooltipText() const
{
const FSourcesData& SourcesData = AssetViewPtr->GetSourcesData();
if ( SourcesData.PackagePaths.Num() == 1 )
{
const FString CurrentPath = SourcesData.PackagePaths[0].ToString();
if ( ContentBrowserUtils::IsClassPath( CurrentPath ) )
{
return LOCTEXT( "ImportAssetToolTip_InvalidClassPath", "Cannot import assets to class paths." );
}
else
{
return FText::Format( LOCTEXT( "ImportAssetToolTip", "Import to {0}..." ), FText::FromString( CurrentPath ) );
}
}
else if ( SourcesData.PackagePaths.Num() > 1 )
{
return LOCTEXT( "ImportAssetToolTip_MultiplePaths", "Cannot import assets to multiple paths." );
}
return LOCTEXT( "ImportAssetToolTip_NoPath", "No path is selected as an import target." );
}
FReply SContentBrowser::HandleImportClicked()
{
ImportAsset( GetCurrentPath() );
return FReply::Handled();
}
void SContentBrowser::ImportAsset( const FString& InPath )
{
if ( ensure( !InPath.IsEmpty() ) )
{
FAssetToolsModule& AssetToolsModule = FModuleManager::Get().LoadModuleChecked<FAssetToolsModule>( "AssetTools" );
AssetToolsModule.Get().ImportAssets( InPath );
}
}
void SContentBrowser::SyncToAssets( const TArray<FAssetData>& AssetDataList, const bool bAllowImplicitSync, const bool bDisableFiltersThatHideAssets )
{
// Check to see if any of the assets require certain folders to be visible
const UContentBrowserSettings* tmp = GetDefault<UContentBrowserSettings>();
bool bDisplayDev = GetDefault<UContentBrowserSettings>()->GetDisplayDevelopersFolder();
bool bDisplayEngine = GetDefault<UContentBrowserSettings>()->GetDisplayEngineFolder();
bool bDisplayPlugins = GetDefault<UContentBrowserSettings>()->GetDisplayPluginFolders();
bool bDisplayLocalized = GetDefault<UContentBrowserSettings>()->GetDisplayL10NFolder();
if ( !bDisplayDev || !bDisplayEngine || !bDisplayPlugins || !bDisplayLocalized )
{
bool bRepopulate = false;
for (int32 AssetIdx = AssetDataList.Num() - 1; AssetIdx >= 0 && ( !bDisplayDev || !bDisplayEngine || !bDisplayPlugins || !bDisplayLocalized ); --AssetIdx)
{
const FAssetData& Item = AssetDataList[AssetIdx];
FString PackagePath;
if ( Item.AssetClass == NAME_Class )
{
// Classes are found in the /Classes_ roots
TSharedRef<FNativeClassHierarchy> NativeClassHierarchy = FContentBrowserSingleton::Get().GetNativeClassHierarchy();
NativeClassHierarchy->GetClassPath(Cast<UClass>(Item.GetAsset()), PackagePath, false/*bIncludeClassName*/);
}
else
{
// All other assets are found by their package path
PackagePath = Item.PackagePath.ToString();
}
const ContentBrowserUtils::ECBFolderCategory FolderCategory = ContentBrowserUtils::GetFolderCategory( PackagePath );
if ( !bDisplayDev && FolderCategory == ContentBrowserUtils::ECBFolderCategory::DeveloperContent )
{
bDisplayDev = true;
GetMutableDefault<UContentBrowserSettings>()->SetDisplayDevelopersFolder(true, true);
bRepopulate = true;
}
else if ( !bDisplayEngine && (FolderCategory == ContentBrowserUtils::ECBFolderCategory::EngineContent || FolderCategory == ContentBrowserUtils::ECBFolderCategory::EngineClasses) )
{
bDisplayEngine = true;
GetMutableDefault<UContentBrowserSettings>()->SetDisplayEngineFolder(true, true);
bRepopulate = true;
}
else if ( !bDisplayPlugins && (FolderCategory == ContentBrowserUtils::ECBFolderCategory::PluginContent || FolderCategory == ContentBrowserUtils::ECBFolderCategory::PluginClasses) )
{
bDisplayPlugins = true;
GetMutableDefault<UContentBrowserSettings>()->SetDisplayPluginFolders(true, true);
bRepopulate = true;
}
if (!bDisplayLocalized && ContentBrowserUtils::IsLocalizationFolder(PackagePath))
{
bDisplayLocalized = true;
GetMutableDefault<UContentBrowserSettings>()->SetDisplayL10NFolder(true);
bRepopulate = true;
}
}
// If we have auto-enabled any flags, force a refresh
if ( bRepopulate )
{
PathViewPtr->Populate();
}
}
if ( bDisableFiltersThatHideAssets )
{
// Disable the filter categories
FilterListPtr->DisableFiltersThatHideAssets(AssetDataList);
}
// Disable the filter search (reset the filter, then clear the search text)
// Note: we have to remove the filter immediately, we can't wait for OnSearchBoxChanged to hit
SetSearchBoxText(FText::GetEmpty());
SearchBoxPtr->SetText(FText::GetEmpty());
SearchBoxPtr->SetError(FText::GetEmpty());
// Tell the sources view first so the asset view will be up to date by the time we request the sync
PathViewPtr->SyncToAssets(AssetDataList, bAllowImplicitSync);
AssetViewPtr->SyncToAssets(AssetDataList);
}
void SContentBrowser::SetIsPrimaryContentBrowser (bool NewIsPrimary)
{
bIsPrimaryBrowser = NewIsPrimary;
if ( bIsPrimaryBrowser )
{
SyncGlobalSelectionSet();
}
else
{
USelection* EditorSelection = GEditor->GetSelectedObjects();
if ( ensure( EditorSelection != NULL ) )
{
EditorSelection->DeselectAll();
}
}
}
TSharedPtr<FTabManager> SContentBrowser::GetTabManager() const
{
if ( ContainingTab.IsValid() )
{
return ContainingTab.Pin()->GetTabManager();
}
return NULL;
}
void SContentBrowser::LoadSelectedObjectsIfNeeded()
{
// Get the selected assets in the asset view
const TArray<FAssetData>& SelectedAssets = AssetViewPtr->GetSelectedAssets();
// Load every asset that isn't already in memory
for ( auto AssetIt = SelectedAssets.CreateConstIterator(); AssetIt; ++AssetIt )
{
const FAssetData& AssetData = *AssetIt;
const bool bShowProgressDialog = (!AssetData.IsAssetLoaded() && FEditorFileUtils::IsMapPackageAsset(AssetData.ObjectPath.ToString()));
GWarn->BeginSlowTask(LOCTEXT("LoadingObjects", "Loading Objects..."), bShowProgressDialog);
(*AssetIt).GetAsset();
GWarn->EndSlowTask();
}
// Sync the global selection set if we are the primary browser
if ( bIsPrimaryBrowser )
{
SyncGlobalSelectionSet();
}
}
void SContentBrowser::GetSelectedAssets(TArray<FAssetData>& SelectedAssets)
{
// Make sure the asset data is up to date
AssetViewPtr->ProcessRecentlyLoadedOrChangedAssets();
SelectedAssets = AssetViewPtr->GetSelectedAssets();
}
void SContentBrowser::SaveSettings() const
{
const FString& SettingsString = InstanceName.ToString();
GConfig->SetBool(*SettingsIniSection, *(SettingsString + TEXT(".SourcesExpanded")), bSourcesViewExpanded, GEditorPerProjectIni);
GConfig->SetBool(*SettingsIniSection, *(SettingsString + TEXT(".Locked")), bIsLocked, GEditorPerProjectIni);
for(int32 SlotIndex = 0; SlotIndex < PathAssetSplitterPtr->GetChildren()->Num(); SlotIndex++)
{
float SplitterSize = PathAssetSplitterPtr->SlotAt(SlotIndex).SizeValue.Get();
GConfig->SetFloat(*SettingsIniSection, *(SettingsString + FString::Printf(TEXT(".VerticalSplitter.SlotSize%d"), SlotIndex)), SplitterSize, GEditorPerProjectIni);
}
for(int32 SlotIndex = 0; SlotIndex < PathCollectionSplitterPtr->GetChildren()->Num(); SlotIndex++)
{
float SplitterSize = PathCollectionSplitterPtr->SlotAt(SlotIndex).SizeValue.Get();
GConfig->SetFloat(*SettingsIniSection, *(SettingsString + FString::Printf(TEXT(".HorizontalSplitter.SlotSize%d"), SlotIndex)), SplitterSize, GEditorPerProjectIni);
}
// Save all our data using the settings string as a key in the user settings ini
FilterListPtr->SaveSettings(GEditorPerProjectIni, SettingsIniSection, SettingsString);
PathViewPtr->SaveSettings(GEditorPerProjectIni, SettingsIniSection, SettingsString);
CollectionViewPtr->SaveSettings(GEditorPerProjectIni, SettingsIniSection, SettingsString);
AssetViewPtr->SaveSettings(GEditorPerProjectIni, SettingsIniSection, SettingsString);
}
const FName SContentBrowser::GetInstanceName() const
{
return InstanceName;
}
bool SContentBrowser::IsLocked() const
{
return bIsLocked;
}
void SContentBrowser::SetKeyboardFocusOnSearch() const
{
// Focus on the search box
FSlateApplication::Get().SetKeyboardFocus( SearchBoxPtr, EFocusCause::SetDirectly );
}
FReply SContentBrowser::OnKeyDown( const FGeometry& MyGeometry, const FKeyEvent& InKeyEvent )
{
if( Commands->ProcessCommandBindings( InKeyEvent ) )
{
return FReply::Handled();
}
return FReply::Unhandled();
}
FReply SContentBrowser::OnPreviewMouseButtonDown( const FGeometry& MyGeometry, const FPointerEvent& MouseEvent )
{
// Clicking in a content browser will shift it to be the primary browser
FContentBrowserSingleton::Get().SetPrimaryContentBrowser(SharedThis(this));
return FReply::Unhandled();
}
FReply SContentBrowser::OnMouseButtonDown( const FGeometry& MyGeometry, const FPointerEvent& MouseEvent )
{
// Mouse back and forward buttons traverse history
if ( MouseEvent.GetEffectingButton() == EKeys::ThumbMouseButton)
{
HistoryManager.GoBack();
return FReply::Handled();
}
else if ( MouseEvent.GetEffectingButton() == EKeys::ThumbMouseButton2)
{
HistoryManager.GoForward();
return FReply::Handled();
}
return FReply::Unhandled();
}
FReply SContentBrowser::OnMouseButtonDoubleClick( const FGeometry& InMyGeometry, const FPointerEvent& InMouseEvent )
{
// Mouse back and forward buttons traverse history
if ( InMouseEvent.GetEffectingButton() == EKeys::ThumbMouseButton)
{
HistoryManager.GoBack();
return FReply::Handled();
}
else if ( InMouseEvent.GetEffectingButton() == EKeys::ThumbMouseButton2)
{
HistoryManager.GoForward();
return FReply::Handled();
}
return FReply::Unhandled();
}
void SContentBrowser::OnContainingTabSavingVisualState() const
{
SaveSettings();
}
void SContentBrowser::OnContainingTabClosed(TSharedRef<SDockTab> DockTab)
{
FContentBrowserSingleton::Get().ContentBrowserClosed( SharedThis(this) );
}
void SContentBrowser::OnContainingTabActivated(TSharedRef<SDockTab> DockTab, ETabActivationCause InActivationCause)
{
if(InActivationCause == ETabActivationCause::UserClickedOnTab)
{
FContentBrowserSingleton::Get().SetPrimaryContentBrowser(SharedThis(this));
}
}
void SContentBrowser::LoadSettings(const FName& InInstanceName)
{
FString SettingsString = InInstanceName.ToString();
// Test to see if we should load legacy settings from a previous instance name
// First make sure there aren't any existing settings with the given instance name
bool TestBool;
if ( !GConfig->GetBool(*SettingsIniSection, *(SettingsString + TEXT(".SourcesExpanded")), TestBool, GEditorPerProjectIni) )
{
// If there were not any settings and we are Content Browser 1, see if we have any settings under the legacy name "LevelEditorContentBrowser"
if ( InInstanceName.ToString() == TEXT("ContentBrowserTab1") && GConfig->GetBool(*SettingsIniSection, TEXT("LevelEditorContentBrowser.SourcesExpanded"), TestBool, GEditorPerProjectIni) )
{
// We have found some legacy settings with the old ID, use them. These settings will be saved out to the new id later
SettingsString = TEXT("LevelEditorContentBrowser");
}
// else see if we are Content Browser 2, and see if we have any settings under the legacy name "MajorContentBrowserTab"
else if ( InInstanceName.ToString() == TEXT("ContentBrowserTab2") && GConfig->GetBool(*SettingsIniSection, TEXT("MajorContentBrowserTab.SourcesExpanded"), TestBool, GEditorPerProjectIni) )
{
// We have found some legacy settings with the old ID, use them. These settings will be saved out to the new id later
SettingsString = TEXT("MajorContentBrowserTab");
}
}
// Now that we have determined the appropriate settings string, actually load the settings
GConfig->GetBool(*SettingsIniSection, *(SettingsString + TEXT(".SourcesExpanded")), bSourcesViewExpanded, GEditorPerProjectIni);
GConfig->GetBool(*SettingsIniSection, *(SettingsString + TEXT(".Locked")), bIsLocked, GEditorPerProjectIni);
for(int32 SlotIndex = 0; SlotIndex < PathAssetSplitterPtr->GetChildren()->Num(); SlotIndex++)
{
float SplitterSize = PathAssetSplitterPtr->SlotAt(SlotIndex).SizeValue.Get();
GConfig->GetFloat(*SettingsIniSection, *(SettingsString + FString::Printf(TEXT(".VerticalSplitter.SlotSize%d"), SlotIndex)), SplitterSize, GEditorPerProjectIni);
PathAssetSplitterPtr->SlotAt(SlotIndex).SizeValue = SplitterSize;
}
for(int32 SlotIndex = 0; SlotIndex < PathCollectionSplitterPtr->GetChildren()->Num(); SlotIndex++)
{
float SplitterSize = PathCollectionSplitterPtr->SlotAt(SlotIndex).SizeValue.Get();
GConfig->GetFloat(*SettingsIniSection, *(SettingsString + FString::Printf(TEXT(".HorizontalSplitter.SlotSize%d"), SlotIndex)), SplitterSize, GEditorPerProjectIni);
PathCollectionSplitterPtr->SlotAt(SlotIndex).SizeValue = SplitterSize;
}
// Save all our data using the settings string as a key in the user settings ini
FilterListPtr->LoadSettings(GEditorPerProjectIni, SettingsIniSection, SettingsString);
PathViewPtr->LoadSettings(GEditorPerProjectIni, SettingsIniSection, SettingsString);
CollectionViewPtr->LoadSettings(GEditorPerProjectIni, SettingsIniSection, SettingsString);
AssetViewPtr->LoadSettings(GEditorPerProjectIni, SettingsIniSection, SettingsString);
}
void SContentBrowser::SourcesChanged(const TArray<FString>& SelectedPaths, const TArray<FCollectionNameType>& SelectedCollections)
{
FString NewSource = SelectedPaths.Num() > 0 ? SelectedPaths[0] : (SelectedCollections.Num() > 0 ? SelectedCollections[0].Name.ToString() : TEXT("None"));
UE_LOG(LogContentBrowser, VeryVerbose, TEXT("The content browser source was changed by the sources view to '%s'"), *NewSource);
FSourcesData SourcesData;
{
TArray<FName> SelectedPathNames;
SelectedPathNames.Reserve(SelectedPaths.Num());
for (const FString& SelectedPath : SelectedPaths)
{
SelectedPathNames.Add(FName(*SelectedPath));
}
SourcesData = FSourcesData(MoveTemp(SelectedPathNames), SelectedCollections);
}
// A dynamic collection should apply its search query to the CB search, so we need to stash the current search so that we can restore it again later
if (SourcesData.IsDynamicCollection())
{
// Only stash the user search term once in case we're switching between dynamic collections
if (!StashedSearchBoxText.IsSet())
{
StashedSearchBoxText = TextFilter->GetRawFilterText();
}
FCollectionManagerModule& CollectionManagerModule = FCollectionManagerModule::GetModule();
const FCollectionNameType& DynamicCollection = SourcesData.Collections[0];
FString DynamicQueryString;
CollectionManagerModule.Get().GetDynamicQueryText(DynamicCollection.Name, DynamicCollection.Type, DynamicQueryString);
const FText DynamicQueryText = FText::FromString(DynamicQueryString);
SetSearchBoxText(DynamicQueryText);
SearchBoxPtr->SetText(DynamicQueryText);
}
else if (StashedSearchBoxText.IsSet())
{
// Restore the stashed search term
const FText StashedText = StashedSearchBoxText.GetValue();
StashedSearchBoxText.Reset();
SetSearchBoxText(StashedText);
SearchBoxPtr->SetText(StashedText);
}
if (!AssetViewPtr->GetSourcesData().IsEmpty())
{
// Update the current history data to preserve selection if there is a valid SourcesData
HistoryManager.UpdateHistoryData();
}
// Change the filter for the asset view
AssetViewPtr->SetSourcesData(SourcesData);
// Add a new history data now that the source has changed
HistoryManager.AddHistoryData();
// Update the breadcrumb trail path
UpdatePath();
}
void SContentBrowser::FolderEntered(const FString& FolderPath)
{
// Have we entered a sub-collection folder?
FName CollectionName;
ECollectionShareType::Type CollectionFolderShareType = ECollectionShareType::CST_All;
if (ContentBrowserUtils::IsCollectionPath(FolderPath, &CollectionName, &CollectionFolderShareType))
{
const FCollectionNameType SelectedCollection(CollectionName, CollectionFolderShareType);
TArray<FCollectionNameType> Collections;
Collections.Add(SelectedCollection);
CollectionViewPtr->SetSelectedCollections(Collections);
CollectionSelected(SelectedCollection);
}
else
{
// set the path view to the incoming path
TArray<FString> SelectedPaths;
SelectedPaths.Add(FolderPath);
PathViewPtr->SetSelectedPaths(SelectedPaths);
PathSelected(SelectedPaths[0]);
}
}
void SContentBrowser::PathSelected(const FString& FolderPath)
{
// You may not select both collections and paths
CollectionViewPtr->ClearSelection();
TArray<FString> SelectedPaths = PathViewPtr->GetSelectedPaths();
TArray<FCollectionNameType> SelectedCollections;
SourcesChanged(SelectedPaths, SelectedCollections);
// Notify 'asset path changed' delegate
FContentBrowserModule& ContentBrowserModule = FModuleManager::GetModuleChecked<FContentBrowserModule>( TEXT("ContentBrowser") );
FContentBrowserModule::FOnAssetPathChanged& PathChangedDelegate = ContentBrowserModule.GetOnAssetPathChanged();
if(PathChangedDelegate.IsBound())
{
PathChangedDelegate.Broadcast(FolderPath);
}
// Update the context menu's selected paths list
PathContextMenu->SetSelectedPaths(SelectedPaths);
}
TSharedRef<FExtender> SContentBrowser::GetPathContextMenuExtender(const TArray<FString>& InSelectedPaths) const
{
return PathContextMenu->MakePathViewContextMenuExtender(InSelectedPaths);
}
void SContentBrowser::CollectionSelected(const FCollectionNameType& SelectedCollection)
{
// You may not select both collections and paths
PathViewPtr->ClearSelection();
TArray<FCollectionNameType> SelectedCollections = CollectionViewPtr->GetSelectedCollections();
TArray<FString> SelectedPaths;
if( SelectedCollections.Num() == 0 )
{
// just select the game folder
SelectedPaths.Add(TEXT("/Game"));
SourcesChanged(SelectedPaths, SelectedCollections);
}
else
{
SourcesChanged(SelectedPaths, SelectedCollections);
}
}
void SContentBrowser::PathPickerPathSelected(const FString& FolderPath)
{
PathPickerButton->SetIsOpen(false);
if ( !FolderPath.IsEmpty() )
{
TArray<FString> Paths;
Paths.Add(FolderPath);
PathViewPtr->SetSelectedPaths(Paths);
}
PathSelected(FolderPath);
}
void SContentBrowser::PathPickerCollectionSelected(const FCollectionNameType& SelectedCollection)
{
PathPickerButton->SetIsOpen(false);
TArray<FCollectionNameType> Collections;
Collections.Add(SelectedCollection);
CollectionViewPtr->SetSelectedCollections(Collections);
CollectionSelected(SelectedCollection);
}
void SContentBrowser::OnApplyHistoryData( const FHistoryData& History )
{
PathViewPtr->ApplyHistoryData(History);
CollectionViewPtr->ApplyHistoryData(History);
AssetViewPtr->ApplyHistoryData(History);
// Update the breadcrumb trail path
UpdatePath();
if (History.SourcesData.HasPackagePaths())
{
// Notify 'asset path changed' delegate
FContentBrowserModule& ContentBrowserModule = FModuleManager::GetModuleChecked<FContentBrowserModule>(TEXT("ContentBrowser"));
FContentBrowserModule::FOnAssetPathChanged& PathChangedDelegate = ContentBrowserModule.GetOnAssetPathChanged();
if (PathChangedDelegate.IsBound())
{
PathChangedDelegate.Broadcast(History.SourcesData.PackagePaths[0].ToString());
}
}
}
void SContentBrowser::OnUpdateHistoryData(FHistoryData& HistoryData) const
{
const FSourcesData& SourcesData = AssetViewPtr->GetSourcesData();
const TArray<FAssetData>& SelectedAssets = AssetViewPtr->GetSelectedAssets();
const FText NewSource = SourcesData.HasPackagePaths() ? FText::FromName(SourcesData.PackagePaths[0]) : (SourcesData.HasCollections() ? FText::FromName(SourcesData.Collections[0].Name) : LOCTEXT("AllAssets", "All Assets"));
HistoryData.HistoryDesc = NewSource;
HistoryData.SourcesData = SourcesData;
HistoryData.SelectedAssets.Empty();
for ( auto AssetIt = SelectedAssets.CreateConstIterator(); AssetIt; ++AssetIt )
{
HistoryData.SelectedAssets.Add(AssetIt->ObjectPath);
}
}
void SContentBrowser::NewAssetRequested(const FString& SelectedPath, TWeakObjectPtr<UClass> FactoryClass)
{
if ( ensure(SelectedPath.Len() > 0) && ensure(FactoryClass.IsValid()) )
{
UFactory* NewFactory = NewObject<UFactory>(GetTransientPackage(), FactoryClass.Get());
FEditorDelegates::OnConfigureNewAssetProperties.Broadcast(NewFactory);
if ( NewFactory->ConfigureProperties() )
{
FString DefaultAssetName;
FString PackageNameToUse;
static FName AssetToolsModuleName = FName("AssetTools");
FAssetToolsModule& AssetToolsModule = FModuleManager::GetModuleChecked<FAssetToolsModule>(AssetToolsModuleName);
AssetToolsModule.Get().CreateUniqueAssetName(SelectedPath + TEXT("/") + NewFactory->GetDefaultNewAssetName(), TEXT(""), PackageNameToUse, DefaultAssetName);
CreateNewAsset(DefaultAssetName, SelectedPath, NewFactory->GetSupportedClass(), NewFactory);
}
}
}
void SContentBrowser::NewClassRequested(const FString& SelectedPath)
{
// Parse out the on disk location for the currently selected path, this will then be used as the default location for the new class (if a valid project module location)
FString ExistingFolderPath;
if (!SelectedPath.IsEmpty())
{
TSharedRef<FNativeClassHierarchy> NativeClassHierarchy = FContentBrowserSingleton::Get().GetNativeClassHierarchy();
NativeClassHierarchy->GetFileSystemPath(SelectedPath, ExistingFolderPath);
}
FGameProjectGenerationModule::Get().OpenAddCodeToProjectDialog(
FAddToProjectConfig()
.InitialPath(ExistingFolderPath)
.ParentWindow(FGlobalTabmanager::Get()->GetRootWindow())
);
}
void SContentBrowser::NewFolderRequested(const FString& SelectedPath)
{
if( ensure(SelectedPath.Len() > 0) && AssetViewPtr.IsValid() )
{
CreateNewFolder(SelectedPath, FOnCreateNewFolder::CreateSP(AssetViewPtr.Get(), &SAssetView::OnCreateNewFolder));
}
}
void SContentBrowser::SetSearchBoxText(const FText& InSearchText)
{
// Has anything changed? (need to test case as the operators are case-sensitive)
if (!InSearchText.ToString().Equals(TextFilter->GetRawFilterText().ToString(), ESearchCase::CaseSensitive))
{
TextFilter->SetRawFilterText( InSearchText );
SearchBoxPtr->SetError( TextFilter->GetFilterErrorText() );
if(InSearchText.IsEmpty())
{
FrontendFilters->Remove(TextFilter);
AssetViewPtr->SetUserSearching(false);
}
else
{
FrontendFilters->Add(TextFilter);
AssetViewPtr->SetUserSearching(true);
}
}
}
void SContentBrowser::OnSearchBoxChanged(const FText& InSearchText)
{
SetSearchBoxText(InSearchText);
// Broadcast 'search box changed' delegate
FContentBrowserModule& ContentBrowserModule = FModuleManager::GetModuleChecked<FContentBrowserModule>( TEXT("ContentBrowser") );
ContentBrowserModule.GetOnSearchBoxChanged().Broadcast(InSearchText, bIsPrimaryBrowser);
}
void SContentBrowser::OnSearchBoxCommitted(const FText& InSearchText, ETextCommit::Type CommitInfo)
{
SetSearchBoxText(InSearchText);
}
bool SContentBrowser::IsSaveSearchButtonEnabled() const
{
return !TextFilter->GetRawFilterText().IsEmptyOrWhitespace();
}
FReply SContentBrowser::OnSaveSearchButtonClicked()
{
// Need to make sure we can see the collections view
if (!bSourcesViewExpanded)
{
SourcesViewExpandClicked();
}
// We want to add any currently selected paths to the final saved query so that you get back roughly the same list of objects as what you're currently seeing
FString SelectedPathsQuery;
{
auto SelectedPaths = PathViewPtr->GetSelectedPaths();
for (int32 SelectedPathIndex = 0; SelectedPathIndex < SelectedPaths.Num(); ++SelectedPathIndex)
{
SelectedPathsQuery.Append(TEXT("Path:'"));
SelectedPathsQuery.Append(SelectedPaths[SelectedPathIndex]);
SelectedPathsQuery.Append(TEXT("'..."));
if (SelectedPathIndex + 1 < SelectedPaths.Num())
{
SelectedPathsQuery.Append(TEXT(" OR "));
}
}
}
// todo: should we automatically append any type filters too?
// Produce the final query
FText FinalQueryText;
if (SelectedPathsQuery.IsEmpty())
{
FinalQueryText = TextFilter->GetRawFilterText();
}
else
{
FinalQueryText = FText::FromString(FString::Printf(TEXT("(%s) AND (%s)"), *TextFilter->GetRawFilterText().ToString(), *SelectedPathsQuery));
}
CollectionViewPtr->MakeSaveDynamicCollectionMenu(FinalQueryText);
return FReply::Handled();
}
void SContentBrowser::OnPathClicked( const FString& CrumbData )
{
FSourcesData SourcesData = AssetViewPtr->GetSourcesData();
if ( SourcesData.HasCollections() )
{
// Collection crumb was clicked. See if we've clicked on a different collection in the hierarchy, and change the path if required.
TOptional<FCollectionNameType> CollectionClicked;
{
FString CollectionName;
FString CollectionTypeString;
if (CrumbData.Split(TEXT("?"), &CollectionName, &CollectionTypeString))
{
const int32 CollectionType = FCString::Atoi(*CollectionTypeString);
if (CollectionType >= 0 && CollectionType < ECollectionShareType::CST_All)
{
CollectionClicked = FCollectionNameType(FName(*CollectionName), ECollectionShareType::Type(CollectionType));
}
}
}
if ( CollectionClicked.IsSet() && SourcesData.Collections[0] != CollectionClicked.GetValue() )
{
TArray<FCollectionNameType> Collections;
Collections.Add(CollectionClicked.GetValue());
CollectionViewPtr->SetSelectedCollections(Collections);
CollectionSelected(CollectionClicked.GetValue());
}
}
else if ( !SourcesData.HasPackagePaths() )
{
// No collections or paths are selected. This is "All Assets". Don't change the path when this is clicked.
}
else if ( SourcesData.PackagePaths.Num() > 1 || SourcesData.PackagePaths[0].ToString() != CrumbData )
{
// More than one path is selected or the crumb that was clicked is not the same path as the current one. Change the path.
TArray<FString> SelectedPaths;
SelectedPaths.Add(CrumbData);
PathViewPtr->SetSelectedPaths(SelectedPaths);
PathSelected(SelectedPaths[0]);
}
}
void SContentBrowser::OnPathMenuItemClicked(FString ClickedPath)
{
OnPathClicked( ClickedPath );
}
TSharedPtr<SWidget> SContentBrowser::OnGetCrumbDelimiterContent(const FString& CrumbData) const
{
FSourcesData SourcesData = AssetViewPtr->GetSourcesData();
TSharedPtr<SWidget> Widget = SNullWidget::NullWidget;
TSharedPtr<SWidget> MenuWidget;
if( SourcesData.HasCollections() )
{
TOptional<FCollectionNameType> CollectionClicked;
{
FString CollectionName;
FString CollectionTypeString;
if (CrumbData.Split(TEXT("?"), &CollectionName, &CollectionTypeString))
{
const int32 CollectionType = FCString::Atoi(*CollectionTypeString);
if (CollectionType >= 0 && CollectionType < ECollectionShareType::CST_All)
{
CollectionClicked = FCollectionNameType(FName(*CollectionName), ECollectionShareType::Type(CollectionType));
}
}
}
if( CollectionClicked.IsSet() )
{
FCollectionManagerModule& CollectionManagerModule = FCollectionManagerModule::GetModule();
TArray<FCollectionNameType> ChildCollections;
CollectionManagerModule.Get().GetChildCollections(CollectionClicked->Name, CollectionClicked->Type, ChildCollections);
if( ChildCollections.Num() > 0 )
{
FMenuBuilder MenuBuilder( true, nullptr );
for( const FCollectionNameType& ChildCollection : ChildCollections )
{
const FString ChildCollectionCrumbData = FString::Printf(TEXT("%s?%s"), *ChildCollection.Name.ToString(), *FString::FromInt(ChildCollection.Type));
MenuBuilder.AddMenuEntry(
FText::FromName(ChildCollection.Name),
FText::GetEmpty(),
FSlateIcon(FEditorStyle::GetStyleSetName(), ECollectionShareType::GetIconStyleName(ChildCollection.Type)),
FUIAction(FExecuteAction::CreateSP(this, &SContentBrowser::OnPathMenuItemClicked, ChildCollectionCrumbData))
);
}
MenuWidget = MenuBuilder.MakeWidget();
}
}
}
else if( SourcesData.HasPackagePaths() )
{
TArray<FString> SubPaths;
const bool bRecurse = false;
if( ContentBrowserUtils::IsClassPath(CrumbData) )
{
TSharedRef<FNativeClassHierarchy> NativeClassHierarchy = FContentBrowserSingleton::Get().GetNativeClassHierarchy();
FNativeClassHierarchyFilter ClassFilter;
ClassFilter.ClassPaths.Add(FName(*CrumbData));
ClassFilter.bRecursivePaths = bRecurse;
NativeClassHierarchy->GetMatchingFolders(ClassFilter, SubPaths);
}
else
{
FAssetRegistryModule& AssetRegistryModule = FModuleManager::LoadModuleChecked<FAssetRegistryModule>(TEXT("AssetRegistry"));
IAssetRegistry& AssetRegistry = AssetRegistryModule.Get();
AssetRegistry.GetSubPaths( CrumbData, SubPaths, bRecurse );
}
if( SubPaths.Num() > 0 )
{
FMenuBuilder MenuBuilder( true, nullptr );
for( int32 PathIndex = 0; PathIndex < SubPaths.Num(); ++PathIndex )
{
const FString& SubPath = SubPaths[PathIndex];
// For displaying in the menu cut off the parent path since it is redundant
FString PathWithoutParent = SubPath.RightChop( CrumbData.Len() + 1 );
MenuBuilder.AddMenuEntry(
FText::FromString(PathWithoutParent),
FText::GetEmpty(),
FSlateIcon(FEditorStyle::GetStyleSetName(), "ContentBrowser.BreadcrumbPathPickerFolder"),
FUIAction(FExecuteAction::CreateSP(this, &SContentBrowser::OnPathMenuItemClicked, SubPath))
);
}
MenuWidget = MenuBuilder.MakeWidget();
}
}
if( MenuWidget.IsValid() )
{
// Do not allow the menu to become too large if there are many directories
Widget =
SNew( SVerticalBox )
+SVerticalBox::Slot()
.MaxHeight( 400.0f )
[
MenuWidget.ToSharedRef()
];
}
return Widget;
}
TSharedRef<SWidget> SContentBrowser::GetPathPickerContent()
{
FPathPickerConfig PathPickerConfig;
FSourcesData SourcesData = AssetViewPtr->GetSourcesData();
if ( SourcesData.HasPackagePaths() )
{
PathPickerConfig.DefaultPath = SourcesData.PackagePaths[0].ToString();
}
PathPickerConfig.OnPathSelected = FOnPathSelected::CreateSP(this, &SContentBrowser::PathPickerPathSelected);
PathPickerConfig.bAllowContextMenu = false;
PathPickerConfig.bAllowClassesFolder = true;
return SNew(SBox)
.WidthOverride(300)
.HeightOverride(500)
.Padding(4)
[
SNew(SVerticalBox)
// Path Picker
+SVerticalBox::Slot()
.FillHeight(1.f)
[
FContentBrowserSingleton::Get().CreatePathPicker(PathPickerConfig)
]
// Collection View
+SVerticalBox::Slot()
.AutoHeight()
.Padding(0, 6, 0, 0)
[
SNew(SCollectionView)
.AllowCollectionButtons(false)
.OnCollectionSelected(this, &SContentBrowser::PathPickerCollectionSelected)
.AllowContextMenu(false)
]
];
}
FString SContentBrowser::GetCurrentPath() const
{
FString CurrentPath;
const FSourcesData& SourcesData = AssetViewPtr->GetSourcesData();
if ( SourcesData.HasPackagePaths() && SourcesData.PackagePaths[0] != NAME_None )
{
CurrentPath = SourcesData.PackagePaths[0].ToString();
}
return CurrentPath;
}
TSharedRef<SWidget> SContentBrowser::MakeAddNewContextMenu(bool bShowGetContent, bool bShowImport)
{
// Get all menu extenders for this context menu from the content browser module
FContentBrowserModule& ContentBrowserModule = FModuleManager::GetModuleChecked<FContentBrowserModule>( TEXT("ContentBrowser") );
TArray<FContentBrowserMenuExtender> MenuExtenderDelegates = ContentBrowserModule.GetAllAssetContextMenuExtenders();
TArray<TSharedPtr<FExtender>> Extenders;
for (int32 i = 0; i < MenuExtenderDelegates.Num(); ++i)
{
if (MenuExtenderDelegates[i].IsBound())
{
Extenders.Add(MenuExtenderDelegates[i].Execute());
}
}
TSharedPtr<FExtender> MenuExtender = FExtender::Combine(Extenders);
FMenuBuilder MenuBuilder(/*bInShouldCloseWindowAfterMenuSelection=*/true, NULL, MenuExtender);
// Only add "New Folder" item if we do not have a collection selected
FNewAssetOrClassContextMenu::FOnNewFolderRequested OnNewFolderRequested;
if (CollectionViewPtr->GetSelectedCollections().Num() == 0)
{
OnNewFolderRequested = FNewAssetOrClassContextMenu::FOnNewFolderRequested::CreateSP(this, &SContentBrowser::NewFolderRequested);
}
const FSourcesData& SourcesData = AssetViewPtr->GetSourcesData();
int32 NumAssetPaths, NumClassPaths;
ContentBrowserUtils::CountPathTypes(SourcesData.PackagePaths, NumAssetPaths, NumClassPaths);
// New feature packs don't depend on the current paths, so we always add this item if it was requested
FNewAssetOrClassContextMenu::FOnGetContentRequested OnGetContentRequested;
if(bShowGetContent)
{
OnGetContentRequested = FNewAssetOrClassContextMenu::FOnGetContentRequested::CreateSP(this, &SContentBrowser::OnAddContentRequested);
}
// Only the asset items if we have an asset path selected
FNewAssetOrClassContextMenu::FOnNewAssetRequested OnNewAssetRequested;
FNewAssetOrClassContextMenu::FOnImportAssetRequested OnImportAssetRequested;
if(NumAssetPaths > 0)
{
OnNewAssetRequested = FNewAssetOrClassContextMenu::FOnNewAssetRequested::CreateSP(this, &SContentBrowser::NewAssetRequested);
if(bShowImport)
{
OnImportAssetRequested = FNewAssetOrClassContextMenu::FOnImportAssetRequested::CreateSP(this, &SContentBrowser::ImportAsset);
}
}
// This menu always lets you create classes, but uses your default project source folder if the selected path is invalid for creating classes
FNewAssetOrClassContextMenu::FOnNewClassRequested OnNewClassRequested = FNewAssetOrClassContextMenu::FOnNewClassRequested::CreateSP(this, &SContentBrowser::NewClassRequested);
FNewAssetOrClassContextMenu::MakeContextMenu(
MenuBuilder,
SourcesData.PackagePaths,
OnNewAssetRequested,
OnNewClassRequested,
OnNewFolderRequested,
OnImportAssetRequested,
OnGetContentRequested
);
FDisplayMetrics DisplayMetrics;
FSlateApplication::Get().GetDisplayMetrics( DisplayMetrics );
const FVector2D DisplaySize(
DisplayMetrics.PrimaryDisplayWorkAreaRect.Right - DisplayMetrics.PrimaryDisplayWorkAreaRect.Left,
DisplayMetrics.PrimaryDisplayWorkAreaRect.Bottom - DisplayMetrics.PrimaryDisplayWorkAreaRect.Top );
return
SNew(SVerticalBox)
+SVerticalBox::Slot()
.MaxHeight(DisplaySize.Y * 0.5)
[
MenuBuilder.MakeWidget()
];
}
bool SContentBrowser::IsAddNewEnabled() const
{
const FSourcesData& SourcesData = AssetViewPtr->GetSourcesData();
return SourcesData.PackagePaths.Num() == 1;
}
FText SContentBrowser::GetAddNewToolTipText() const
{
const FSourcesData& SourcesData = AssetViewPtr->GetSourcesData();
if ( SourcesData.PackagePaths.Num() == 1 )
{
const FString CurrentPath = SourcesData.PackagePaths[0].ToString();
if ( ContentBrowserUtils::IsClassPath( CurrentPath ) )
{
return FText::Format( LOCTEXT("AddNewToolTip_AddNewClass", "Create a new class in {0}..."), FText::FromString(CurrentPath) );
}
else
{
return FText::Format( LOCTEXT("AddNewToolTip_AddNewAsset", "Create a new asset in {0}..."), FText::FromString(CurrentPath) );
}
}
else if ( SourcesData.PackagePaths.Num() > 1 )
{
return LOCTEXT( "AddNewToolTip_MultiplePaths", "Cannot add assets or classes to multiple paths." );
}
return LOCTEXT( "AddNewToolTip_NoPath", "No path is selected as an add target." );
}
TSharedRef<SWidget> SContentBrowser::MakeAddFilterMenu()
{
return FilterListPtr->ExternalMakeAddFilterMenu();
}
TSharedPtr<SWidget> SContentBrowser::GetFilterContextMenu()
{
return FilterListPtr->ExternalMakeAddFilterMenu();
}
FReply SContentBrowser::OnSaveClicked()
{
ContentBrowserUtils::SaveDirtyPackages();
return FReply::Handled();
}
void SContentBrowser::OnAddContentRequested()
{
IAddContentDialogModule& AddContentDialogModule = FModuleManager::LoadModuleChecked<IAddContentDialogModule>("AddContentDialog");
FWidgetPath WidgetPath;
FSlateApplication::Get().GeneratePathToWidgetChecked(AsShared(), WidgetPath);
AddContentDialogModule.ShowDialog(WidgetPath.GetWindow());
}
void SContentBrowser::OnAssetSelectionChanged(const FAssetData& SelectedAsset)
{
if ( bIsPrimaryBrowser )
{
SyncGlobalSelectionSet();
}
// Notify 'asset selection changed' delegate
FContentBrowserModule& ContentBrowserModule = FModuleManager::GetModuleChecked<FContentBrowserModule>( TEXT("ContentBrowser") );
FContentBrowserModule::FOnAssetSelectionChanged& AssetSelectionChangedDelegate = ContentBrowserModule.GetOnAssetSelectionChanged();
const TArray<FAssetData>& SelectedAssets = AssetViewPtr->GetSelectedAssets();
AssetContextMenu->SetSelectedAssets(SelectedAssets);
CollectionViewPtr->SetSelectedAssets(SelectedAssets);
if(AssetSelectionChangedDelegate.IsBound())
{
AssetSelectionChangedDelegate.Broadcast(SelectedAssets, bIsPrimaryBrowser);
}
}
void SContentBrowser::OnAssetsActivated(const TArray<FAssetData>& ActivatedAssets, EAssetTypeActivationMethod::Type ActivationMethod)
{
TMap< TSharedRef<IAssetTypeActions>, TArray<UObject*> > TypeActionsToObjects;
TArray<UObject*> ObjectsWithoutTypeActions;
const FText LoadingTemplate = LOCTEXT("LoadingAssetName", "Loading {0}...");
const FText DefaultText = ActivatedAssets.Num() == 1 ? FText::Format(LoadingTemplate, FText::FromName(ActivatedAssets[0].AssetName)) : LOCTEXT("LoadingObjects", "Loading Objects...");
FScopedSlowTask SlowTask(100, DefaultText);
// Iterate over all activated assets to map them to AssetTypeActions.
// This way individual asset type actions will get a batched list of assets to operate on
for ( auto AssetIt = ActivatedAssets.CreateConstIterator(); AssetIt; ++AssetIt )
{
const FAssetData& AssetData = *AssetIt;
if (!AssetData.IsAssetLoaded() && FEditorFileUtils::IsMapPackageAsset(AssetData.ObjectPath.ToString()))
{
SlowTask.MakeDialog();
}
SlowTask.EnterProgressFrame(75.f/ActivatedAssets.Num(), FText::Format(LoadingTemplate, FText::FromName(AssetData.AssetName)));
UObject* Asset = (*AssetIt).GetAsset();
if ( Asset != NULL )
{
FAssetToolsModule& AssetToolsModule = FModuleManager::Get().LoadModuleChecked<FAssetToolsModule>("AssetTools");
TWeakPtr<IAssetTypeActions> AssetTypeActions = AssetToolsModule.Get().GetAssetTypeActionsForClass(Asset->GetClass());
if ( AssetTypeActions.IsValid() )
{
// Add this asset to the list associated with the asset type action object
TArray<UObject*>& ObjList = TypeActionsToObjects.FindOrAdd(AssetTypeActions.Pin().ToSharedRef());
ObjList.AddUnique(Asset);
}
else
{
ObjectsWithoutTypeActions.AddUnique(Asset);
}
}
}
// Now that we have created our map, activate all the lists of objects for each asset type action.
for ( auto TypeActionsIt = TypeActionsToObjects.CreateConstIterator(); TypeActionsIt; ++TypeActionsIt )
{
SlowTask.EnterProgressFrame(25.f/TypeActionsToObjects.Num());
const TSharedRef<IAssetTypeActions>& TypeActions = TypeActionsIt.Key();
const TArray<UObject*>& ObjList = TypeActionsIt.Value();
TypeActions->AssetsActivated(ObjList, ActivationMethod);
}
// Finally, open a simple asset editor for all assets which do not have asset type actions if activating with enter or double click
if ( ActivationMethod == EAssetTypeActivationMethod::DoubleClicked || ActivationMethod == EAssetTypeActivationMethod::Opened )
{
ContentBrowserUtils::OpenEditorForAsset(ObjectsWithoutTypeActions);
}
}
TSharedPtr<SWidget> SContentBrowser::OnGetAssetContextMenu(const TArray<FAssetData>& SelectedAssets)
{
if ( SelectedAssets.Num() == 0 )
{
return MakeAddNewContextMenu( false, true );
}
else
{
return AssetContextMenu->MakeContextMenu(SelectedAssets, AssetViewPtr->GetSourcesData(), Commands);
}
}
FReply SContentBrowser::ToggleLockClicked()
{
bIsLocked = !bIsLocked;
return FReply::Handled();
}
const FSlateBrush* SContentBrowser::GetToggleLockImage() const
{
if ( bIsLocked )
{
return FEditorStyle::GetBrush("ContentBrowser.LockButton_Locked");
}
else
{
return FEditorStyle::GetBrush("ContentBrowser.LockButton_Unlocked");
}
}
EVisibility SContentBrowser::GetSourcesViewVisibility() const
{
return bSourcesViewExpanded ? EVisibility::Visible : EVisibility::Collapsed;
}
const FSlateBrush* SContentBrowser::GetSourcesToggleImage() const
{
if ( bSourcesViewExpanded )
{
return FEditorStyle::GetBrush("ContentBrowser.HideSourcesView");
}
else
{
return FEditorStyle::GetBrush("ContentBrowser.ShowSourcesView");
}
}
FReply SContentBrowser::SourcesViewExpandClicked()
{
bSourcesViewExpanded = !bSourcesViewExpanded;
// Notify 'Sources View Expanded' delegate
FContentBrowserModule& ContentBrowserModule = FModuleManager::GetModuleChecked<FContentBrowserModule>( TEXT("ContentBrowser") );
FContentBrowserModule::FOnSourcesViewChanged& SourcesViewChangedDelegate = ContentBrowserModule.GetOnSourcesViewChanged();
if(SourcesViewChangedDelegate.IsBound())
{
SourcesViewChangedDelegate.Broadcast(bSourcesViewExpanded);
}
return FReply::Handled();
}
EVisibility SContentBrowser::GetPathExpanderVisibility() const
{
return bSourcesViewExpanded ? EVisibility::Collapsed : EVisibility::Visible;
}
FReply SContentBrowser::BackClicked()
{
HistoryManager.GoBack();
return FReply::Handled();
}
FReply SContentBrowser::ForwardClicked()
{
HistoryManager.GoForward();
return FReply::Handled();
}
bool SContentBrowser::HandleRenameCommandCanExecute() const
{
const TArray<TSharedPtr<FAssetViewItem>>& SelectedItems = AssetViewPtr->GetSelectedItems();
if (SelectedItems.Num() > 0)
{
return AssetContextMenu->CanExecuteRename();
}
else
{
const TArray<FString>& SelectedPaths = PathViewPtr->GetSelectedPaths();
if (SelectedPaths.Num() > 0)
{
return PathContextMenu->CanExecuteRename();
}
}
return false;
}
void SContentBrowser::HandleRenameCommand()
{
const TArray<TSharedPtr<FAssetViewItem>>& SelectedItems = AssetViewPtr->GetSelectedItems();
if (SelectedItems.Num() > 0)
{
AssetContextMenu->ExecuteRename();
}
else
{
const TArray<FString>& SelectedPaths = PathViewPtr->GetSelectedPaths();
if (SelectedPaths.Num() > 0)
{
PathContextMenu->ExecuteRename();
}
}
}
bool SContentBrowser::HandleDeleteCommandCanExecute() const
{
const TArray<TSharedPtr<FAssetViewItem>>& SelectedItems = AssetViewPtr->GetSelectedItems();
if (SelectedItems.Num() > 0)
{
return AssetContextMenu->CanExecuteDelete();
}
else
{
const TArray<FString>& SelectedPaths = PathViewPtr->GetSelectedPaths();
if (SelectedPaths.Num() > 0)
{
return PathContextMenu->CanExecuteDelete();
}
}
return false;
}
void SContentBrowser::HandleDeleteCommandExecute()
{
const TArray<TSharedPtr<FAssetViewItem>>& SelectedItems = AssetViewPtr->GetSelectedItems();
if (SelectedItems.Num() > 0)
{
AssetContextMenu->ExecuteDelete();
}
else
{
const TArray<FString>& SelectedPaths = PathViewPtr->GetSelectedPaths();
if (SelectedPaths.Num() > 0)
{
PathContextMenu->ExecuteDelete();
}
}
}
void SContentBrowser::HandleOpenAssetsOrFoldersCommandExecute()
{
AssetViewPtr->OnOpenAssetsOrFolders();
}
void SContentBrowser::HandlePreviewAssetsCommandEecute()
{
AssetViewPtr->OnPreviewAssets();
}
void SContentBrowser::HandleCreateNewFolderCommandExecute()
{
TArray<FString> SelectedPaths = PathViewPtr->GetSelectedPaths();
// only create folders when a single path is selected
const bool bCanCreateNewFolder = (SelectedPaths.Num() == 1) && ContentBrowserUtils::IsValidPathToCreateNewFolder(SelectedPaths[0]);
if (bCanCreateNewFolder)
{
CreateNewFolder(
SelectedPaths.Num() > 0
? SelectedPaths[0]
: FString(),
FOnCreateNewFolder::CreateSP(AssetViewPtr.Get(), &SAssetView::OnCreateNewFolder));
}
}
void SContentBrowser::HandleDirectoryUpCommandExecute()
{
TArray<FString> SelectedPaths = PathViewPtr->GetSelectedPaths();
if(SelectedPaths.Num() == 1 && !ContentBrowserUtils::IsRootDir(SelectedPaths[0]))
{
FString ParentDir = SelectedPaths[0] / TEXT("..");
FPaths::CollapseRelativeDirectories(ParentDir);
FolderEntered(ParentDir);
}
}
bool SContentBrowser::IsBackEnabled() const
{
return HistoryManager.CanGoBack();
}
bool SContentBrowser::IsForwardEnabled() const
{
return HistoryManager.CanGoForward();
}
bool SContentBrowser::CanExecuteDirectoryUp() const
{
TArray<FString> SelectedPaths = PathViewPtr->GetSelectedPaths();
return (SelectedPaths.Num() == 1 && !ContentBrowserUtils::IsRootDir(SelectedPaths[0]));
}
FText SContentBrowser::GetHistoryBackTooltip() const
{
if ( HistoryManager.CanGoBack() )
{
return FText::Format( LOCTEXT("HistoryBackTooltipFmt", "Back to {0}"), HistoryManager.GetBackDesc() );
}
return FText::GetEmpty();
}
FText SContentBrowser::GetHistoryForwardTooltip() const
{
if ( HistoryManager.CanGoForward() )
{
return FText::Format( LOCTEXT("HistoryForwardTooltipFmt", "Forward to {0}"), HistoryManager.GetForwardDesc() );
}
return FText::GetEmpty();
}
FText SContentBrowser::GetDirectoryUpTooltip() const
{
TArray<FString> SelectedPaths = PathViewPtr->GetSelectedPaths();
if(SelectedPaths.Num() == 1 && !ContentBrowserUtils::IsRootDir(SelectedPaths[0]))
{
FString ParentDir = SelectedPaths[0] / TEXT("..");
FPaths::CollapseRelativeDirectories(ParentDir);
return FText::Format(LOCTEXT("DirectoryUpTooltip", "Up to {0}"), FText::FromString(ParentDir) );
}
return FText();
}
EVisibility SContentBrowser::GetDirectoryUpToolTipVisibility() const
{
EVisibility ToolTipVisibility = EVisibility::Collapsed;
// if we have text in our tooltip, make it visible.
if(GetDirectoryUpTooltip().IsEmpty() == false)
{
ToolTipVisibility = EVisibility::Visible;
}
return ToolTipVisibility;
}
void SContentBrowser::SyncGlobalSelectionSet()
{
USelection* EditorSelection = GEditor->GetSelectedObjects();
if ( !ensure( EditorSelection != NULL ) )
{
return;
}
// Get the selected assets in the asset view
const TArray<FAssetData>& SelectedAssets = AssetViewPtr->GetSelectedAssets();
EditorSelection->BeginBatchSelectOperation();
{
TSet< UObject* > SelectedObjects;
// Lets see what the user has selected and add any new selected objects to the global selection set
for ( auto AssetIt = SelectedAssets.CreateConstIterator(); AssetIt; ++AssetIt )
{
// Grab the object if it is loaded
if ( (*AssetIt).IsAssetLoaded() )
{
UObject* FoundObject = (*AssetIt).GetAsset();
if( FoundObject != NULL && FoundObject->GetClass() != UObjectRedirector::StaticClass() )
{
SelectedObjects.Add( FoundObject );
// Select this object!
EditorSelection->Select( FoundObject );
}
}
}
// Now we'll build a list of objects that need to be removed from the global selection set
for( int32 CurEditorObjectIndex = 0; CurEditorObjectIndex < EditorSelection->Num(); ++CurEditorObjectIndex )
{
UObject* CurEditorObject = EditorSelection->GetSelectedObject( CurEditorObjectIndex );
if( CurEditorObject != NULL )
{
if( !SelectedObjects.Contains( CurEditorObject ) )
{
EditorSelection->Deselect( CurEditorObject );
}
}
}
}
EditorSelection->EndBatchSelectOperation();
}
void SContentBrowser::UpdatePath()
{
FSourcesData SourcesData = AssetViewPtr->GetSourcesData();
PathBreadcrumbTrail->ClearCrumbs();
if ( SourcesData.HasPackagePaths() )
{
TArray<FString> Crumbs;
SourcesData.PackagePaths[0].ToString().ParseIntoArray(Crumbs, TEXT("/"), true);
FString CrumbPath = TEXT("/");
for ( auto CrumbIt = Crumbs.CreateConstIterator(); CrumbIt; ++CrumbIt )
{
// If this is the root part of the path, try and get the localized display name to stay in sync with what we see in SPathView
const FText DisplayName = (CrumbIt.GetIndex() == 0) ? ContentBrowserUtils::GetRootDirDisplayName(*CrumbIt) : FText::FromString(*CrumbIt);
CrumbPath += *CrumbIt;
PathBreadcrumbTrail->PushCrumb(DisplayName, CrumbPath);
CrumbPath += TEXT("/");
}
}
else if ( SourcesData.HasCollections() )
{
FCollectionManagerModule& CollectionManagerModule = FCollectionManagerModule::GetModule();
TArray<FCollectionNameType> CollectionPathItems;
// Walk up the parents of this collection so that we can generate a complete path (this loop also adds the child collection to the array)
for (TOptional<FCollectionNameType> CurrentCollection = SourcesData.Collections[0];
CurrentCollection.IsSet();
CurrentCollection = CollectionManagerModule.Get().GetParentCollection(CurrentCollection->Name, CurrentCollection->Type)
)
{
CollectionPathItems.Insert(CurrentCollection.GetValue(), 0);
}
// Now add each part of the path to the breadcrumb trail
for (const FCollectionNameType& CollectionPathItem : CollectionPathItems)
{
const FString CrumbData = FString::Printf(TEXT("%s?%s"), *CollectionPathItem.Name.ToString(), *FString::FromInt(CollectionPathItem.Type));
FFormatNamedArguments Args;
Args.Add(TEXT("CollectionName"), FText::FromName(CollectionPathItem.Name));
const FText DisplayName = FText::Format(LOCTEXT("CollectionPathIndicator", "{CollectionName} (Collection)"), Args);
PathBreadcrumbTrail->PushCrumb(DisplayName, CrumbData);
}
}
else
{
PathBreadcrumbTrail->PushCrumb(LOCTEXT("AllAssets", "All Assets"), TEXT(""));
}
}
void SContentBrowser::OnFilterChanged()
{
FARFilter Filter = FilterListPtr->GetCombinedBackendFilter();
AssetViewPtr->SetBackendFilter( Filter );
// Notify 'filter changed' delegate
FContentBrowserModule& ContentBrowserModule = FModuleManager::GetModuleChecked<FContentBrowserModule>( TEXT("ContentBrowser") );
ContentBrowserModule.GetOnFilterChanged().Broadcast(Filter, bIsPrimaryBrowser);
}
FString SContentBrowser::GetPathText() const
{
FString PathLabelText;
if ( IsFilteredBySource() )
{
const FSourcesData& SourcesData = AssetViewPtr->GetSourcesData();
// At least one source is selected
const int32 NumSources = SourcesData.PackagePaths.Num() + SourcesData.Collections.Num();
if (NumSources > 0)
{
PathLabelText = SourcesData.HasPackagePaths() ? SourcesData.PackagePaths[0].ToString() : SourcesData.Collections[0].Name.ToString();
if (NumSources > 1)
{
PathLabelText += FString::Printf(*LOCTEXT("MultipleSourcesSuffix", " and %d others...").ToString(), NumSources - 1);
}
}
}
else
{
PathLabelText = LOCTEXT("AllAssets", "All Assets").ToString();
}
return PathLabelText;
}
bool SContentBrowser::IsFilteredBySource() const
{
const FSourcesData& SourcesData = AssetViewPtr->GetSourcesData();
return !SourcesData.IsEmpty();
}
void SContentBrowser::OnAssetRenameCommitted(const TArray<FAssetData>& Assets)
{
// After a rename is committed we allow an implicit sync so as not to
// disorientate the user if they are looking at a parent folder
const bool bAllowImplicitSync = true;
const bool bDisableFiltersThatHideAssets = false;
SyncToAssets(Assets, bAllowImplicitSync, bDisableFiltersThatHideAssets);
}
void SContentBrowser::OnFindInAssetTreeRequested(const TArray<FAssetData>& AssetsToFind)
{
SyncToAssets(AssetsToFind);
}
void SContentBrowser::OnRenameRequested(const FAssetData& AssetData)
{
AssetViewPtr->RenameAsset(AssetData);
}
void SContentBrowser::OnRenameFolderRequested(const FString& FolderToRename)
{
const TArray<FString>& SelectedFolders = AssetViewPtr->GetSelectedFolders();
if (SelectedFolders.Num() > 0)
{
AssetViewPtr->RenameFolder(FolderToRename);
}
else
{
const TArray<FString>& SelectedPaths = PathViewPtr->GetSelectedPaths();
if (SelectedPaths.Num() > 0)
{
PathViewPtr->RenameFolder(FolderToRename);
}
}
}
void SContentBrowser::OnOpenedFolderDeleted()
{
// Since the contents of the asset view have just been deleted, set the selected path to the default "/Game"
TArray<FString> DefaultSelectedPaths;
DefaultSelectedPaths.Add(TEXT("/Game"));
PathViewPtr->SetSelectedPaths(DefaultSelectedPaths);
FSourcesData DefaultSourcesData(FName("/Game"));
AssetViewPtr->SetSourcesData(DefaultSourcesData);
}
void SContentBrowser::OnDuplicateRequested(const TWeakObjectPtr<UObject>& OriginalObject)
{
UObject* Object = OriginalObject.Get();
if ( Object )
{
AssetViewPtr->DuplicateAsset(FPackageName::GetLongPackagePath(Object->GetOutermost()->GetName()), OriginalObject);
}
}
void SContentBrowser::OnAssetViewRefreshRequested()
{
AssetViewPtr->RequestSlowFullListRefresh();
}
void SContentBrowser::HandleCollectionRemoved(const FCollectionNameType& Collection)
{
AssetViewPtr->SetSourcesData(FSourcesData());
auto RemoveHistoryDelegate = [&](const FHistoryData& HistoryData)
{
return (HistoryData.SourcesData.Collections.Num() == 1 &&
HistoryData.SourcesData.PackagePaths.Num() == 0 &&
HistoryData.SourcesData.Collections.Contains(Collection));
};
HistoryManager.RemoveHistoryData(RemoveHistoryDelegate);
}
void SContentBrowser::HandleCollectionRenamed(const FCollectionNameType& OriginalCollection, const FCollectionNameType& NewCollection)
{
return HandleCollectionRemoved(OriginalCollection);
}
void SContentBrowser::HandleCollectionUpdated(const FCollectionNameType& Collection)
{
const FSourcesData& SourcesData = AssetViewPtr->GetSourcesData();
// If we're currently viewing the dynamic collection that was updated, make sure our active filter text is up-to-date
if (SourcesData.IsDynamicCollection() && SourcesData.Collections[0] == Collection)
{
FCollectionManagerModule& CollectionManagerModule = FCollectionManagerModule::GetModule();
const FCollectionNameType& DynamicCollection = SourcesData.Collections[0];
FString DynamicQueryString;
CollectionManagerModule.Get().GetDynamicQueryText(DynamicCollection.Name, DynamicCollection.Type, DynamicQueryString);
const FText DynamicQueryText = FText::FromString(DynamicQueryString);
SetSearchBoxText(DynamicQueryText);
SearchBoxPtr->SetText(DynamicQueryText);
}
}
void SContentBrowser::HandlePathRemoved(const FString& Path)
{
const FName PathName(*Path);
auto RemoveHistoryDelegate = [&](const FHistoryData& HistoryData)
{
return (HistoryData.SourcesData.PackagePaths.Num() == 1 &&
HistoryData.SourcesData.Collections.Num() == 0 &&
HistoryData.SourcesData.PackagePaths.Contains(PathName));
};
HistoryManager.RemoveHistoryData(RemoveHistoryDelegate);
}
FText SContentBrowser::GetSearchAssetsHintText() const
{
if (PathViewPtr.IsValid())
{
TArray<FString> Paths = PathViewPtr->GetSelectedPaths();
if (Paths.Num() != 0)
{
FString SearchHint = NSLOCTEXT( "ContentBrowser", "SearchBoxPartialHint", "Search" ).ToString();
SearchHint += TEXT(" ");
for(int32 i = 0; i < Paths.Num(); i++)
{
const FString& Path = Paths[i];
if (ContentBrowserUtils::IsRootDir(Path))
{
SearchHint += ContentBrowserUtils::GetRootDirDisplayName(Path).ToString();
}
else
{
SearchHint += FPaths::GetCleanFilename(Path);
}
if (i + 1 < Paths.Num())
{
SearchHint += ", ";
}
}
return FText::FromString(SearchHint);
}
}
return NSLOCTEXT( "ContentBrowser", "SearchBoxHint", "Search Assets" );
}
TArray<FString> SContentBrowser::GetAssetSearchSuggestions() const
{
TArray<FString> AllSuggestions;
FAssetToolsModule& AssetToolsModule = FModuleManager::LoadModuleChecked<FAssetToolsModule>("AssetTools");
TArray< TWeakPtr<IAssetTypeActions> > AssetTypeActionsList;
AssetToolsModule.Get().GetAssetTypeActionsList(AssetTypeActionsList);
for ( auto TypeActionsIt = AssetTypeActionsList.CreateConstIterator(); TypeActionsIt; ++TypeActionsIt )
{
if ( (*TypeActionsIt).IsValid() )
{
const TSharedPtr<IAssetTypeActions> TypeActions = (*TypeActionsIt).Pin();
AllSuggestions.Add( TypeActions->GetSupportedClass()->GetName() );
}
}
return AllSuggestions;
}
TSharedPtr<SWidget> SContentBrowser::GetFolderContextMenu(const TArray<FString>& SelectedPaths, FContentBrowserMenuExtender_SelectedPaths InMenuExtender, FOnCreateNewFolder InOnCreateNewFolder, bool bPathView)
{
// Clear any selection in the asset view, as it'll conflict with other view info
// This is important for determining which context menu may be open based on the asset selection for rename/delete operations
if (bPathView)
{
AssetViewPtr->ClearSelection();
}
// Ensure the path context menu has the up-to-date list of paths being worked on
PathContextMenu->SetSelectedPaths(SelectedPaths);
TSharedPtr<FExtender> Extender;
if(InMenuExtender.IsBound())
{
Extender = InMenuExtender.Execute(SelectedPaths);
}
const bool bInShouldCloseWindowAfterSelection = true;
FMenuBuilder MenuBuilder(bInShouldCloseWindowAfterSelection, Commands, Extender, true);
// We can only create folders when we have a single path selected
const bool bCanCreateNewFolder = SelectedPaths.Num() == 1 && ContentBrowserUtils::IsValidPathToCreateNewFolder(SelectedPaths[0]);
FText NewFolderToolTip;
if(SelectedPaths.Num() == 1)
{
if(bCanCreateNewFolder)
{
NewFolderToolTip = FText::Format(LOCTEXT("NewFolderTooltip_CreateIn", "Create a new folder in {0}."), FText::FromString(SelectedPaths[0]));
}
else
{
NewFolderToolTip = FText::Format(LOCTEXT("NewFolderTooltip_InvalidPath", "Cannot create new folders in {0}."), FText::FromString(SelectedPaths[0]));
}
}
else
{
NewFolderToolTip = LOCTEXT("NewFolderTooltip_InvalidNumberOfPaths", "Can only create folders when there is a single path selected.");
}
// New Folder
MenuBuilder.AddMenuEntry(
LOCTEXT("NewFolder", "New Folder"),
NewFolderToolTip,
FSlateIcon(FEditorStyle::GetStyleSetName(), "ContentBrowser.NewFolderIcon"),
FUIAction(
FExecuteAction::CreateSP( this, &SContentBrowser::CreateNewFolder, SelectedPaths.Num() > 0 ? SelectedPaths[0] : FString(), InOnCreateNewFolder ),
FCanExecuteAction::CreateLambda( [bCanCreateNewFolder] { return bCanCreateNewFolder; } )
),
"NewFolder"
);
return MenuBuilder.MakeWidget();
}
void SContentBrowser::CreateNewFolder(FString FolderPath, FOnCreateNewFolder InOnCreateNewFolder)
{
// Create a valid base name for this folder
FText DefaultFolderBaseName = LOCTEXT("DefaultFolderName", "NewFolder");
FText DefaultFolderName = DefaultFolderBaseName;
int32 NewFolderPostfix = 1;
while(ContentBrowserUtils::DoesFolderExist(FolderPath / DefaultFolderName.ToString()))
{
DefaultFolderName = FText::Format(LOCTEXT("DefaultFolderNamePattern", "{0}{1}"), DefaultFolderBaseName, FText::AsNumber(NewFolderPostfix));
NewFolderPostfix++;
}
InOnCreateNewFolder.ExecuteIfBound(DefaultFolderName.ToString(), FolderPath);
}
#undef LOCTEXT_NAMESPACE