Files
UnrealEngineUWP/Engine/Source/Editor/PropertyEditor/Private/PropertyNode.cpp
Matthew Griffin 1fa8a231ea Copying //UE4/Release-Staging-4.13 to //UE4/Dev-Main (Source: //UE4/Release-4.13 @ 3072953)
#lockdown Nick.Penwarden

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

Change 3072953 on 2016/08/01 by Uriel.Doyon

	Texture GUIDs are now included in cooked builds, as they are required by the texture streamer to link build data to in game textures.
	#jira UE-34045

Change 3072915 on 2016/08/01 by Nick.Whiting

	Fixing Google VR Preview being distorted by fixing merge error specifying number of verts per distortion mesh

	#jira UE-34044

Change 3072891 on 2016/08/01 by Nick.Whiting

	Integrating fix from DevVR to force GameGetsMouseControl to on when using VR PIE, since you always need focus for motion controllers

	#jira UE-33579

Change 3072885 on 2016/08/01 by Nick.Darnell

	UMG/Slate - Moving the SlateTextureAtlasInterface to engine, and redoing the parameters so that we can properly calculate the UV start and size information with full knowledge inside the texture so that we can deal with problems like squaring that happens on PVRTC textures.  Also moving the interface to engine so that dependent plugins/other consumers don't need to load their modules extremely early to deal with the RHIRenderers need to load early for the shaders, also wanted to avoid loading it when Paper2D is needed on servers.

	Continued - adding missing file.

	#jira UE-32876

Change 3072869 on 2016/08/01 by Ori.Cohen

	Fix CIS

	#jira UE-3402

Change 3072862 on 2016/08/01 by Josh.Adams

	- Fixed case issue for Linux
	#jira UE-34020

Change 3072818 on 2016/08/01 by Nick.Darnell

	UMG/Slate - Moving the SlateTextureAtlasInterface to engine, and redoing the parameters so that we can properly calculate the UV start and size information with full knowledge inside the texture so that we can deal with problems like squaring that happens on PVRTC textures.  Also moving the interface to engine so that dependent plugins/other consumers don't need to load their modules extremely early to deal with the RHIRenderers need to load early for the shaders, also wanted to avoid loading it when Paper2D is needed on servers.

	#jira UE-32876

Change 3072756 on 2016/08/01 by John.Billon

	Fixed crash when setting a composite texture on a render target cube.
	#Jira UE-33885

Change 3072755 on 2016/08/01 by John.Billon

	Exposed GPUMorphTargets (r.MorphTarget.Mode) as a project setting.
	#Jira UE-33574

Change 3072753 on 2016/08/01 by John.Billon

	Fixed a possible null dereference in distrubutions that was causing crashes when changing particle parameters.
	#Jira UE-32565
	#Jira UE-29528

Change 3072665 on 2016/08/01 by Ben.Marsh

	Fix parse errors in BuildGraph example script.

Change 3072664 on 2016/08/01 by Mike.Beach

	Mirrors CL 3072620 from Dev-Blueprints.

	Reverting a presumptive (guessed-at) fix from CL 2830752 (UE-22075). This was preventing REINST classes from retaining certain UObject references (specifically data/objects stored in Actor's "CurrentTransactionAnnotation" member). Those objects would be GC'd during the reinstancing process, and when we copied that data over later, towards the end of reinstancing, we'd be copying bad object pointers to the new actors.

	#jira UE-29631

Change 3072656 on 2016/08/01 by Mike.Beach

	Mirrors CL 3072614 from Dev-Blueprints.

	Fixing an issue where hot-reloading a Blueprint parent class was not reinstancing skeleton CDOs. This caused problems later where the skel class layout didn't reflect the CDO object.

	#jira UE-29613

Change 3072649 on 2016/08/01 by Mike.Beach

	Mirrors CL 3071292 from Dev-Blueprints.

	Preventing the Blueprint reinstancer's Function/PropertyMap from being GC'd during compile. This was causing issues where new functions/properties were being allocated in the same pointer location, and UpdateBytecodeReferences() was replacing those references as well (specifically in unrelated class's Children->Next chain, linking in functions/properties that did not belong to that class). This was causing a multitude of problems (mainly bad property offset read/writes and endless field iterator loops).

	#jira UE-29631

Change 3072568 on 2016/08/01 by Phillip.Kavan

	Blueprints: Prevent a crash on load in RemoveNodeAndPromoteChildren when removing a corrupted SCS node if it has no parent link (the children are moved to the root node instead)

	Mirrored from //Orion/Dev-General (CLs# 3065749/3065868).

	#jira UE-32780

Change 3072565 on 2016/08/01 by Rolando.Caloca

	UE4.13 - More info to track down crash with missing Primitive uniform buffer
	#jira UE-33418

Change 3072526 on 2016/08/01 by Matt.Kuhlenschmidt

	Fix hovering broken in the details panel
	#jira UE-20903

Change 3072509 on 2016/08/01 by Matt.Kuhlenschmidt

	Removed nested list views in a details panel customization which  caused the scrollbar in the details panel to become unusable
	#jira UE-20903

Change 3072479 on 2016/08/01 by Ori.Cohen

	Fix potential crash when calling SetSkeletalMesh on a skeletal mesh component that's using per poly collision

	#JIRA UE-34023

Change 3072438 on 2016/08/01 by Chris.Wood

	Fixed ICU dll loading logic so that monolithic tools like CRC don't try to load them.
	[UE-33943] - Crash Report Client window not opening in a packaged build

	#jira UE-33943
	#test Editor, run Packaged QAGame, crash Packaged QAGame, runs CrashReportClient, run SlateViewer, run EpicGamesLauncher

Change 3072360 on 2016/08/01 by Chris.Babcock

	Enable Google Play Games for ARM64 on Android
	#jira UE-34031
	#ue4
	#android

Change 3072337 on 2016/08/01 by Mitchell.Wilson

	Saving multiple files from VR template to resolve empty engine version warnings.
	#jira UE-33937

Change 3072302 on 2016/08/01 by Lina.Halper

	Fix issue where weight doesn't update correctly while updating list

	#jira: UE-33023

Change 3072250 on 2016/08/01 by Lina.Halper

	Add error message when rename failed

	#jira: UE-33661

Change 3072103 on 2016/08/01 by Lina.Halper

	- Undid previous propagating change of morphtarget - Refresh function
	- Made sure whatever happening, the buffer size remains sane and render thread will always get the same size

	#code review: Rolando.Caloca
	#jira: UE-33923

Change 3072062 on 2016/08/01 by Jurre.deBaare

	Static Mesh Editor and Persona viewport are very dark
	#fix Added same default config value for the directional light rotation as in FPreviewScene (otherwise would result in nulled rotator)
	#jira UE-33945

Change 3072061 on 2016/08/01 by Jurre.deBaare

	Incorrect importing of morph target weights when setting the percentage bases option on import
	#fix use original number of singular values to index into the weights array (otherwise we would be reading incorrect data if NumUsedSingularValues != the original number
	#jira UE-34003

Change 3072052 on 2016/08/01 by Chris.Babcock

	Vulkan extension fixes for Android
	#jira UE-32943
	#ue4
	#android

Change 3072039 on 2016/08/01 by Mitchell.Wilson

	Adding blueprint child of Paper2D character to the 2DSideScrollerExampleMap.
	#jira UE-33843

Change 3072003 on 2016/08/01 by Rob.Cannaday

	Change category of OnlineSubsystem, OnlineFramework from "TODO" to "Online Platform" to match other online subsystems.
	#jira UE-34008

Change 3071942 on 2016/08/01 by Matthew.Griffin

	Adding feature pack for TP_VirtualRealityBP

Change 3071937 on 2016/08/01 by Max.Chen

	Sequence Recorder: Fix a bug where transforms wouldn't be captured if an anim recorder exists but the skeletal mesh that the anim recorder is supposed to capture doesn't exist. This fixes the first person template character not getting recorded.

	#jira UE-32918

Change 3071932 on 2016/08/01 by Dmitry.Rekman

	Linux: fix launch on (UE-33934)

	#tests Tested launching on a native host.
	#jira UE-33934

	(Edigrating CL 3071928 //UE4/Dev-Platform/... to //UE4/Release-4.13/...)

Change 3071926 on 2016/08/01 by Andrew.Rodham

	Sequencer: Fixed exponential slowdown when restoring selection states

	#jira UE-33918

Change 3071917 on 2016/08/01 by Mitchell.Wilson

	Disabled shadow casting on RTS_Env_Ice_Fort_Trim pieces that are placed along the path in TowerDefenseMap and rebuilt lighting.
	#jira UE-15196

Change 3071914 on 2016/08/01 by Allan.Bentham

	Fix for incorrect feature level when using networked PIE.
	#jira UE-25807

Change 3071894 on 2016/08/01 by Andrew.Rodham

	Sequence Recorder: CIS fix
	#jira UE-31277

Change 3071884 on 2016/08/01 by phillip.patterson

	Updated UMG_Invalidation.uasset to Include Combo Box Test

	#jira UE-29618

Change 3071869 on 2016/08/01 by Mitchell.Wilson

	Changed LPF Freq Max on example 1.5 to bettery demonstrate Loww Pass Filter feature.
	#jira UE-33714

Change 3071868 on 2016/08/01 by phillip.patterson

	Added UMG_Invalidation.uasset for a test case

	#jira UE-29618

Change 3071855 on 2016/08/01 by Jurre.deBaare

	Engine fails to compile in Alembic with DebugBuildsActuallyUseDebugCRT enabled
	#fix Recompiled zlib to be correct debug version
	#jira UE-27576

Change 3071853 on 2016/08/01 by Jurre.deBaare

	Fix issue with debug asserts not compiling correctly
	#fix Debug build will use a different macro path in DetourAssert/RecastAssert in which there is a , instead of a ; which the compiler complains about
	#jira UE-33989

Change 3071851 on 2016/08/01 by Matt.Kuhlenschmidt

	Added guards against force deleting objects garbage collecting  objects while they are being deleted.  This will still ensure in an attempt to isolate the actual issue.
	#jira UE-33013

Change 3071849 on 2016/08/01 by Tom.Looman

	Resaved content files with engine version for VR Template

	#jira ue-33325

Change 3071822 on 2016/08/01 by Mitchell.Wilson

	Adding crosshair to WeapLauncher when not sighted in.
	#jira UE-30617

Change 3071798 on 2016/08/01 by Andrew.Rodham

	Sequencer: Fixed various issues to do with recording attached components

	There were several edge cases where attached components would be recorded with incorrect animation, transforms, or not recorded at all.

	#jira UE-30574
	#jira UE-31277

Change 3071789 on 2016/08/01 by Tom.Looman

	Fixed warning of missing gamemode in VR Template.

	#jira ue-33325

Change 3071787 on 2016/08/01 by Mitchell.Wilson

	Cleared material interface on Neutral.uasset to resolve a warning.
	#jira UE-33957

Change 3071784 on 2016/08/01 by Robert.Manuszewski

	Making sure UMediaPlayer objects are not added to any GC clusters because they can load additional assets after they had PostLoad called on them and that results in Disregard For GC assumptions being violated.

	#jira UE-33692
	#jira UE-33814

Change 3071746 on 2016/08/01 by Tom.Looman

	Added config.ini for Feature Pack creation to VR Template

	#jira ue-33325

Change 3071694 on 2016/08/01 by Robert.Manuszewski

	Fixing crash after opening edit config data for remote build then packaging

	#jira UE-33719

Change 3071660 on 2016/08/01 by Dmitriy.Dyomin

	Fixed: Nexus 5, Android 4.4.4 has inverted R/B color channels with r.TonemapperFilm enabled (replaced usage of LinearToSrgbBranching with LinearToSrgbBranchless for mobile)
	Also removed "OutputDevice" branches that are not used on mobile, otherwise generated LUT pixel shader has more than 2k lines and device refuses to compile it
	#jira UE-30104

Change 3071657 on 2016/08/01 by Matthew.Griffin

	Excluded TP_VirtualRealityBP Template from Mac Binary builds.

Change 3071651 on 2016/08/01 by Tom.Looman

	Removed config.ini ref from content.txt

	#jira UE-33325

Change 3071645 on 2016/08/01 by Jurre.deBaare

	Merge Actor Tool missing option to deselect Export Specific LOD
	#fix Added the ability to export a specific LOD or all LODs for the selected objects
	#jira UE-33100

	Non wrapped UVs in static mesh cause incorrect UVs on (HLOD) merged static mesh
	#fix force to generate unique UVs for baking out the material to ensure we get the correct texture data
	#jira UE-29976

Change 3071608 on 2016/08/01 by Thomas.Sarkanen

	Bringing hitch tracking fix over from Orion.

	Engine: Properly resetting the hitch buckets at the start of each FPS chart, so hitch time isn't accumulated across multiple runs

	#jira UE-33911 - Time spent in hitch tracking buckets is not reset between fps chart captures (so it grows each capture in a session)

Change 3071606 on 2016/08/01 by Matthew.Griffin

	Added TP_VirtualRealityBP to list of templates to make feature packs from, build DDC for and include in binary build.
	#jira UE-33959

Change 3071584 on 2016/08/01 by Matthew.Griffin

	Added support for per file Intellisense PCH settings, to improve its startup speed - disabled by default due to crashes.
	Split GetDirectIncludeDependencies function so that part of it could be used without having a build target.
	#jira UE-23720

Change 3071479 on 2016/07/31 by Dmitriy.Dyomin

	Fixed FAssetPtr remapping issues for duplicated packages (level Save As, level Duplicate). This fixes issue with broken foliage base cache.
	Hardened code in foliage base cache and removed asserts, so maps with broken cache can still load
	Merged from Dev-Mobile CL# 3057039
	#jira UE-32774

Change 3071478 on 2016/07/31 by Uriel.Doyon

	Fixed UnbuiltInstanceBoundsList not being reset correctly, creating broken rendered primitives.
	#jira UE-32585

Change 3071282 on 2016/07/30 by Max.Chen

	Cine Camera Actor: CIS fix

	#jira UE-33805

Change 3071272 on 2016/07/30 by Max.Chen

	Cine Camera Actor: Fix debug focus plane not getting updated when animated. Refactor UpdateDebugFocusPlane so that it's called from the actor tick instead of just in GetCameraView.

	#jira UE-33805

Change 3071229 on 2016/07/30 by Ben.Marsh

	Fix static analysis warning.

Change 3071077 on 2016/07/29 by Max.Chen

	Sequencer: Set relative location, rotation, scale explicitly to identity instead of calling ResetRelativeTransform because we don't want overlaps to fire until after the update pass.

	#jira UE-33432

Change 3071076 on 2016/07/29 by Max.Chen

	Sequencer: Set event track eval order to fire first. This fixes some ambiguity and also a bug where transform tracks don't evaluate pre/post if the eval position is changed in the middle of evaluation.

	#jira UE-33078

Change 3071070 on 2016/07/29 by Max.Chen

	Sequence Recorder: Record actors as possessables

	Added GetWorld() check when resolving bindings in case the world is being torn down.

	Copy from Dev-Sequencer

	#jira UE-33969

Change 3071069 on 2016/07/29 by Max.Chen

	Sequencer: Add Convert to Possessable

	Copy from Dev-Sequencer

	#jira UE-32139

Change 3071058 on 2016/07/29 by Max.Chen

	Sequencer: Tweak track colors

	Audio track brighter
	Transform, bool, event tracks less saturated
	Recording subsection more saturated
	Fade track gradient

	Copy from Dev-Sequencer

	#jira UE-33968

Change 3071057 on 2016/07/29 by Max.Chen

	Sequencer: Remove curve editor visibility as a toggleable config. It's now just a toggleable state that defaults to false. This fixes unexpected behavior of staying in the curve editor when restarting the editor or switching to a different level sequence asset.

	Copy from Dev-Sequencer

	#jira UE-33967

Change 3071004 on 2016/07/29 by Lauren.Ridge

	Fix for crash on color picker summon due to null SWindow #rb chris.gagnon

	#jira UE-33966

Change 3070956 on 2016/07/29 by Chris.Babcock

	Disable Oculus stress tests on Android(for now) to remove shader dependency unhandled on Mac editor
	#jira UE-33607
	#ue4
	#android

Change 3070807 on 2016/07/29 by Nick.Darnell

	Slate - Disabling thickness calculation in slate lines, the underlying code doesn't properly handle the edge cases that causes a breakdown and the lines become flipped/twisted, or have zero width.

	#jira UE-30481

Change 3070779 on 2016/07/29 by Rob.Cannaday

	Re-add bCompileSteamOSS as deprecated with a notice on how to use OnlineSubsystemSteam
	Remove reference to bCompileSteamOSS from GameModule.Build.cs.template, replacing it with a comment of how to include OnlineSubsystemSteam
	#jira UE-33922

Change 3070766 on 2016/07/29 by Matt.Kuhlenschmidt

	Make sure richtooltips are not generated for hidden enum items so that there is not a mismatch between rich tooltips and enum items (causing a crash)

	#jira UE-33914

Change 3070764 on 2016/07/29 by Phillip.Kavan

	[UE-20581] Optimize BP auto-recompile on PIE startup for BPs with multiple dependencies.

	Mirrored from CL# 3065278. (resubmitted as edit)

	#jira UE-20581

Change 3070757 on 2016/07/29 by Nick.Darnell

	Slate - Anything that requests a CreateUpdatableTexture from the SlateRHIRenderer and later releaseses it, the renderer now keeps those releases around for an extra frame on the game thread to avoid deleting a pointer that may have already been queued up on the CPU side of the renderer to be used in an element batch.  Which is what happens if you remove a widget in it's own tick, that happens to also contain a web browser widget.

	#jira UE-33450

Change 3070741 on 2016/07/29 by Phillip.Kavan

	Back out previous submit (forgot to convert to edit).

	#jira UE-20581

Change 3070737 on 2016/07/29 by Phillip.Kavan

	[UE-20581] Optimize BP auto-recompile on PIE startup for BPs with multiple dependencies.

	Mirrored from CL# 3065278.

	#jira UE-20581

Change 3070695 on 2016/07/29 by Ryan.Vance

	#jira UE-32145
	We were using the wrong texture format for the rift ogl bridge.
	Removed derived ogl bridge destructor to fix assert.
	Based on CL 3069701 from Oculus

Change 3070632 on 2016/07/29 by Mitchell.Wilson

	Rebuilt lighting for SubwaySequencer
	#jira UE-33564

Change 3070620 on 2016/07/29 by Chris.Babcock

	Fast ASTC texture compression, using ISPC.

	#jira UE-32308

Change 3070586 on 2016/07/29 by phillip.patterson

	Updating Sequencer_Focus for test case

	#jira UE-29618

Change 3070539 on 2016/07/29 by Jon.Nabozny

	Fix PhysX error where CCD is enabled on a Kinematic body. (This is copied from 3061370)

	#jira UE-33463

Change 3070538 on 2016/07/29 by Mitchell.Wilson

	Resaving TowerDefenseMap_Effects, TowerDefenseMap_Lights, and TowerDefenseMap_M to resolve MikkTSpace warnings.
	#jira UE-29730

Change 3070467 on 2016/07/29 by Lauren.Ridge

	Making the Color Picker accessible in VR Editing mode, hiding the eyedropper in VR mode. #rb mike.fricker

	#jira UE-33920
	#jira UE-33769

Change 3070460 on 2016/07/29 by Lauren.Ridge

	Changing VR Screenshot mode to use direct capture of the mirrored view on the monitor #rb mike.fricker

	#jira UE-32413

Change 3070455 on 2016/07/29 by Lauren.Ridge

	Fixes for auto-entry to VR mode. Adding HMD validity checks, Steam VR only switches to not worn after being in the worn state, adding default setting to ini file. #rb mike.fricker

	#jira UE-33635

Change 3070404 on 2016/07/29 by John.Pollard

	Fix: Console command "Open" crashes with dedicated server settings

	#jira UE-32511

Change 3070380 on 2016/07/29 by Matt.Kuhlenschmidt

	Fix incorrect tooltip for the lerp instruction in the material editor

	#jira UE-33896

Change 3070376 on 2016/07/29 by Ryan.Vance

	#jira UEVR-32
	Support base and neo multi-view vertex shaders on ps4.
	Compile both base and neo versions of the multi-view enabled vertex shaders.
	Pack them together in the resulting shader code.
	Unpack them and load the correct version when creating the vertex shader instance.

Change 3070345 on 2016/07/29 by James.Cobbett

	#jira UE-29618 Submitting test assets for Alembic Importer

Change 3070315 on 2016/07/29 by Ben.Woodhouse

	(cherry picked from dev-rendering)
	Fix for cooker crash with BC6H textures (XB1, but may affect other platforms). Also fixes corruption issue with texture slices not being a multiple of 4 pixels (expanding as necessary), courtesy of Stu McKenna at the Coalition
	Tested fix on xbox, PC and PS4, using QAGame
	#jira UE-28592

Change 3070314 on 2016/07/29 by Ben.Woodhouse

	(cherry picked from dev-rendering)

	Fix div 0 in motion blur. This caused artifacts in some fairly common cases
	#jira UE-32331

Change 3070272 on 2016/07/29 by Jon.Nabozny

	Fix CIS by removing unused (and deprecated) call to GetMovementInputVector() in ShooterCharacter.

	#jira UE-33944

Change 3070235 on 2016/07/29 by Mitchell.Wilson

	Hid Camera_Movement effects when the user is interacting with the sand in BP_RakeStuff.
	#jira UE-32742

Change 3070221 on 2016/07/29 by Jurre.deBaare

	HLOD: The forced viewing level slider does not stay in sync after building a cluster
	#fix The minimum drawing distance was being set to the original instead of the current value which would make it behaviour as normal (not being forced)
	#jira UE-32187

Change 3070218 on 2016/07/29 by Jurre.deBaare

	HLOD: Shadow logic in ALODActor is messed up
	#fix Moved shadow determination logic
	#jira UE-31753

Change 3070212 on 2016/07/29 by Jurre.deBaare

	HLOD Outliner scrolls back to the top when generating proxy meshes
	#fix Not refreshing the HLOD Outliner (not needed), and force scroll into view the first selected cluster
	#jira UE-30384

Change 3070176 on 2016/07/29 by Jurre.deBaare

	Some post processing features in Preview Scene Settings do not update immediately
	#fix Vector values as properties were not getting picked up due to their outer not being the struct but an FVector :D
	#jira UE-33895

Change 3070175 on 2016/07/29 by Jurre.deBaare

	Static Mesh Editor does not display Vertex Colors in Lit mode
	#fix Caused by not disabling advanced features which used to happen for preview scenes by default :/
	#jira UE-32977

Change 3070163 on 2016/07/29 by Chris.Wood

	Changed log warnings to info when WinSAT assessment unavailable
	[UE-30198] - WinSAT assessment unavailable when running Hardware Survey
	#jira UE-30198

	trivial change

Change 3070154 on 2016/07/29 by Matthew.Griffin

	Removed exceptions for IOS .a files now we are building code projects
	Additional inclusions for Android/IOS that cannot be determined via Build Products/Runtime Dependencies
	#jira UE-33868

Change 3070124 on 2016/07/29 by Alex.Delesky

	#jira UE-32911 - Fixing an issue where thumbnail preview scenes would spawn an additional instance of its preview actor even if one was already in the scene. Also fixes a crash on shutdown due to cached thumbnail scenes not being released when thumbnail renderers begin destruction.

Change 3070060 on 2016/07/29 by Chris.Wood

	Fixed command line argument saved to crash reports and used to restart crash processes
	[UE-30665] - CrashReporterClient send and restart does not reopen the project
	#jira UE-30665

	trivial re-add of a line lost in a confusing merge.

Change 3070035 on 2016/07/29 by Allan.Bentham

	Add cvars 'r.Android.DisableVulkanSupport' and 'r.Android.DisableOpenGLES31Support'
	Allows device profiles to disable vulkan and/or ES3.1.
	#jira UE-33379

Change 3070027 on 2016/07/29 by Tom.Looman

	Added fresh VR Template BP (origin: //depot/usr/Tom.Looman/VRTemplate/)

	#jira UE-33325

Change 3070009 on 2016/07/29 by James.Golding

	Disable 'convert proc mesh to static mesh' when template is selected. Also don't create static mesh if procmesh generate no geom.
	#jira UE-32395

Change 3070007 on 2016/07/29 by James.Golding

	Fix highlight when searching Anim Curves
	#jira UE-33073

Change 3070002 on 2016/07/29 by James.Golding

	Fix complex collision drawing in StaticMesh Editor
	#jira UE-33062

Change 3069998 on 2016/07/29 by Jon.Nabozny

	Fix AShooterCharacter heavy breathing even when running but not moving.

	#jira UE-32398

Change 3069980 on 2016/07/29 by James.Golding

	Add UV support to ProcMeshComp collision
	Fix bUseComplexAsSimpleCollision not being applied because ProcMeshBodySetup was transient, so setting was lost
	Move ProceduralMeshComponent out of 'experimental'
	#jira UE-29850, UE-33003

Change 3069970 on 2016/07/29 by James.Golding

	Add #if WITH_PHYSX around ISimEventCallbackFactory at Ori#s suggestion (forgot to do this in initial checkin CL 3053969)
	#jira UE-32819

Change 3069969 on 2016/07/29 by Andrew.Porter

	Adding movie test content to NotForLicensee.

	#jira UE-29618

Change 3069962 on 2016/07/29 by Chris.Wood

	Writing CrashReportClient config section from Engine config in crashing app to crash report folder. Crash Report Client reads new file and sets project-specific settings.
	[UE-31820] - CrashReportClient config is getting merged between streams and projects containing project-specific settings
	#jira UE-31820

	Affects Core and CrashReportClient.
	Removes existing values from CRC's own engine config file because they are project-specific and the file is agnostic.
	Added project-specific values to engine config with defaults set in BaseEngine.ini.
	Added overrides to Orion config.

Change 3069908 on 2016/07/29 by Jurre.deBaare

	Saving assets with UGS build, fixes build warnings
	#jira UE-123

Change 3069889 on 2016/07/29 by Jurre.deBaare

	Build fix for -game builds (missing WITH_EDITOR ifdef)
	#jira UE-123

Change 3069877 on 2016/07/29 by Allan.Bentham

	Add Android ES3.1, vulkan and iOS Metal material quality settings to project settings.
	Fixed issue that prevented settings editor saving out array property changes.

	#jira UE-33379

Change 3069872 on 2016/07/29 by Jurre.deBaare

	Added option to disable post processing option in preview scene
	Inverted normals on the sky sphere (asset change)

	Bad performance when changing (slider) values for the advanced preview scene
	#fix Small optimizations and now only save the data on closing of the preview scene tab
	#jira UE-33496

	Persona floor offset not being correct
	#fix Re-added floor offsetting mechanism (even though I find it very ugly), which now sets the advanced preview scene's floor offset
	#jira UE-32278

	Add a shortcut for hiding/showing the sky (and maybe the floor) in asset viewers
	#fix I will now hide the environment and O the floor
	#jira UE-33498

	Directional light rotation not saved with advanced preview scene profiles
	#fix Now does :)
	#jira UE-33619

Change 3069838 on 2016/07/29 by Luke.Thatcher

	Fix crash in ShooterGame when running the server. Paper2D plugin now has a dependency on the SlateRHIRenderer module, which needs to be loaded in PostConfigInit phase, otherwise shader types in the slate renderer module are not initialized in time.
	#jira UE-33671

Change 3069440 on 2016/07/28 by patrickr.donovan

	#jira UE-29618
	Test content for AA and materials with tessellation enabled and absolute world position material function.

Change 3069148 on 2016/07/28 by Lina.Halper

	Morphtarget deletion crash

	#jira: UE-33851
	#code review: Roalndo.caloca

Change 3069144 on 2016/07/28 by Michael.Trepka

	Check if UnrealBuildTool.csproj exists before trying to compile it in Mac GenerateProjectFiles.sh. Fixes a problem in binary distribution where the script would show an error (but still succeed) due to missing UnrealBuildTool.csproj

	#jira UE-31863

Change 3069021 on 2016/07/28 by Dmitry.Rekman

	Linux: a number of small fixes from pull requests.

	- Includes PR #1905 (UE-24848) by madsystem (arch installation: changed from clang to clang35)
	- Includes PR #2120 (UE-27742) by ABeekhub (mono-mvc for opensuse)
	- Includes PR #2131 (UE-27894) by vityafx (QMake build problem (no c++11 standard))
	- Includes PR #2305 (UE-29781) by salamanderrake (MakefileGenerator.cs small changes)
	- Includes PR #2361 (UE-30452) by salamanderrake (QMakefileProjectGenerator.cs fix for missing Includes paths and removal of duplicates)

	#tests Generated cmake, qmake, make projects and tested them (using ueprojectdirs and not standalone projects).  No tests done for arch/suse changes.

	#jira UE-24848
	#jira UE-27742
	#jira UE-27894
	#jira UE-29781
	#jira UE-30452

	(Edigrating CL 3069016 from //UE4/Dev-Platform/... to //UE4/Release-4.13/...)

Change 3068867 on 2016/07/28 by Mike.Fricker

	Mesh Paint: Fixed various bugs
	- Fixed brush preview not rendered for lasers/mouse when not actively painting (UE-33554)
	- Fixed 'full press' over actors preventing UI from being clickable (UE-33550)
	- Fixed brush cursor displayed when hovering over UI (including selection bar/close button) (UE-33551)
	- Fixed VR transform gizmo getting in the way of everything while painting (it is now hidden while in mesh paint mode)
	- Fixed not being able to interact with UIs after messing around with mesh paint (UE-33621)

	#jira UE-33554
	#jira UE-33550
	#jira UE-33551
	#jira UE-33621

Change 3068758 on 2016/07/28 by Mitchell.Wilson

	Minor update to BP_RakeStuff to solve issue with sand turning black when raking the same spot.
	#jira UE-33684

Change 3068733 on 2016/07/28 by Ori.Cohen

	Temp fix to make sure that deferred bodies that add angular impulse do not crash (From Benn.G)

	#JIRA UE-32630

Change 3068713 on 2016/07/28 by Lina.Halper

	#Checking in Benn G's fix

	 Fixed crash when adding a section to a zero length montage. Fixed nullptr deref in montage handling code and disabled menu option to add a section when zero length (makes no sense to do that).

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

Change 3068580 on 2016/07/28 by John.Pollard

	Disable hot reloading when using single process MP PIE

	Fixes UE-30516 - Crash in FObjectReplicator::StartReplicating when removing replicated uproperty and hot reloading with two players

	#jira UE-30516

Change 3068550 on 2016/07/28 by Jurre.deBaare

	Merge Actors: "Bake Vertex Data" is incorrectly listed underm materials
	#fix Added another flag and renamed the old one + added tooltips :) This also required some changes to the merge path just to make sure we end up with the correct data
	#jira UE-31886

Change 3068549 on 2016/07/28 by Jurre.deBaare

	Merged static meshes stop reaction to the Trace Complex on Move flag.
	#fix merge physics now defaults to true in the actor merging settings (people assumed the system didn't work and hadn't seen the option)
	#jira UE-30403

Change 3068548 on 2016/07/28 by Jurre.deBaare

	Merge Actor tool can no longer merge just materials for an actor
	#fix removed requirement of more than one static mesh component (left code in to renable later on once we add a bake materials button for actors in the world)
	#jira UE-32797

Change 3068547 on 2016/07/28 by Jurre.deBaare

	Make sure the advanced preview scene tab is shown by default
	#fix Made the tab spawn by default in all possible situations (as part of the existing UI layout)
	#jira UE-33499

Change 3068546 on 2016/07/28 by Jurre.deBaare

	Textures created from generating proxy meshes have incorrect compression format on tooltip

	#fix Required a PostEditChange call for the UTextures to correctly propogate the compression type
	#jira UE-30365

Change 3068543 on 2016/07/28 by Danny.Bouimad

	#jira UE-29618
	Made useability changes to the Phsyical Animation Profile Map

Change 3068407 on 2016/07/28 by Mitchell.Wilson

	Set delete index variable to 0 on reset in BP_RakeStuff to fix an issue with sand turning black when raking repeatedly in one place
	#jira UE-33684

Change 3068403 on 2016/07/28 by Ben.Marsh

	Add warnings and ignore entries in .uprojectdirs files which reference directories outside the root directory.

	#jira UE-33459

Change 3068358 on 2016/07/28 by Martin.Wilson

	Set default compression to NoClear as None is not a valid compression

	#jira UE-31958

Change 3068346 on 2016/07/28 by Benjamin.Hyder

	Updating TM-ContactShadows to include static meshes

	#jira UE-29618

Change 3068336 on 2016/07/28 by Martin.Wilson

	Added a new mode to Montage_Play so that we can choose what value we return (either length of the montage or the play time duration).

	#jira UE-32101

Change 3068321 on 2016/07/28 by Martin.Wilson

	Export bone selection widgets so that other modules can use them

	#Jira UE-30361

Change 3068316 on 2016/07/28 by Martin.Wilson

	Expose Root Motion Mode

	#jira UE-14431

Change 3068307 on 2016/07/28 by Benjamin.Hyder

	Rebuilding lighting in QA-Materials

	#jira UE-29618

Change 3068299 on 2016/07/28 by Benjamin.Hyder

	Renaming TM_Noise to TM-Noise

	#jira UE-29618

Change 3068285 on 2016/07/28 by Martin.Wilson

	Remove option to clear compression on animation sequences

	#jira UE-31957

Change 3068282 on 2016/07/28 by Benjamin.Hyder

	Re-Saving QA-Materials to remove log spam

	#jira UE-29618

Change 3068271 on 2016/07/28 by Martin.Wilson

	Add check to highlight recursion issue caused by game code

	#jira UE-31417

Change 3068259 on 2016/07/28 by Jamie.Dale

	Fixed UObject churn caused by re-use of a single thumbnail scene for BP and class types

	#jira UE-31709

Change 3068257 on 2016/07/28 by Jamie.Dale

	Removed some code that was no longer needed and could cause a crash

	#jira UE-33342

Change 3068204 on 2016/07/28 by Nick.Darnell

	Slate - Reverting the SMenuAnchor to a previous version, there was no reason afterall to need to use the last painted window as the host for menus, ended up solving it a lower level by properly supporting the deferral groups on the SVirtualWindow under different conditions.

	Slate - The hit test grid now properly records the hit test path for the invalidation box, so that when input is recieved, a widget path containing only one instance of the invalidation box is created, premitting things like mouse capture to properly work.

	UMG - Further refinements and improvements to the Widget Interaction Component.  This completes the documentation and a fixes several bugs with it that were found after the integration to main occured.

	#jira UE-33845

Change 3068197 on 2016/07/28 by Martin.Wilson

	Fix abstract notify state classes showing up in create menu

	#jira UE-33864

	Fix copy paste notifies introducing cross animation references

	#jira UE-32801

Change 3068183 on 2016/07/28 by Matthew.Griffin

	Remove hard coded staging for Crash Reporter and use its receipt instead
	#jira UE-33800

Change 3068097 on 2016/07/28 by Dmitriy.Dyomin

	Fixed: Decals don't render on Zenfone 2 (Added proper detection of FP16 render target support)
	#jira UE-22679

Change 3068074 on 2016/07/28 by Matthew.Griffin

	Added DDC nodes to list of content/shader modifiers for notifications

Change 3068053 on 2016/07/28 by Jack.Porter

	After resampling or changing landscape component size, delete any new components that are entirely in regions that correspond to previously deleted components

	#jira UE-5335

Change 3068043 on 2016/07/28 by Jack.Porter

	Fix crash in mobile preview when selecting objects during shader compilation

	#jira UE-33862

Change 3068031 on 2016/07/28 by Gareth.Martin

	Fix hang when changing material which is used on landscape and "LogMaterial: 0.03 seconds spent updating 1 materials, 1 interfaces, 0 instances, 1 with static permutations." log spam
	#jira UE-33708

Change 3068030 on 2016/07/28 by Gareth.Martin

	Fix "Max Pitch Angle" and "Random Yaw" foliage options being ignored in procedural foliage.
	#jira UE-20476

Change 3068029 on 2016/07/28 by Gareth.Martin

	Fixed landscape "continuous" sculpting not working in multiple viewports
	- the editor would tick with another viewport which didn't have the mouse down, ending the stroke. Now only the "active" viewport can end the stroke.
	#jira UE-32347

Change 3068013 on 2016/07/28 by Thomas.Sarkanen

	Added a tick dependency for slave components

	Ensures that slave components always get ticked after master components.
	Prevents potential main thread stall updating morph targets in slave components.

	#jira UE-23045 - Slave components could benefit from a tick dependency on master components

Change 3068011 on 2016/07/28 by Thomas.Sarkanen

	Added space bar as a shortcut to play/pause animation playback in Persona

	#jira UE-26788 - Framework - Animation - Add Hotkeys to the Viewport for Play/Pause

Change 3068009 on 2016/07/28 by Thomas.Sarkanen

	Multi-arg console commands now accept string commands with or without quotes

	Pre-parsed out each token prior to calling ImportText() rather than relying on ImportText's internal logic. This allows us to properly parse out quoted and non-quoted values as well as being robust to escape sequences etc.
	Removed old legacy code designed to fix trailing string params not being parsed correctly.
	Updated some NULLs to nullptr.

	#jira UE-23661 - Multi-arg console commands that take string params don't accept string params without quotation marks

Change 3067854 on 2016/07/28 by Dmitriy.Dyomin

	Fixed: World composition tiles that have child actor inside will become mdified if any other tile is unloaded
	#jira UE-33440

Change 3067831 on 2016/07/28 by Dmitriy.Dyomin

	Fixed: Landscape GrassType does not have the option to exclude Decals
	#jira UE-26669

Change 3067826 on 2016/07/28 by Dmitriy.Dyomin

	Fixed: Deleting foliage actor from foliage menu does not remove actors from PIE until editor is restarted
	Also fixed Replace foliage type case
	#jira UE-32010

Change 3067824 on 2016/07/28 by Dmitriy.Dyomin

	Fixed: The Empty Level is named "NewWorld" in the World Outliner as opposed to "Untitled"
	#jira UE-24767

Change 3067794 on 2016/07/27 by Jack.Porter

	Expose Lighting Channels to Foliage and Landscape Grass

	#jira UE-32794

Change 3067782 on 2016/07/27 by Jack.Porter

	Fixed crash on device when playing sounds when packaged using Android_Multi

	#jira UE-31981

Change 3067760 on 2016/07/27 by Jack.Porter

	Fixed issue where  landscape flatten target grid preview is displayed on wrong landscape when switching landscape target

	#jira UE-11756

Change 3067748 on 2016/07/27 by Dmitry.Rekman

	Linux: fix packaged projects not being runnable (UE-33608).

	- Added a shell script to run the binary.

	#jira UE-33608

	(Edigrating 3067587 from //UE4/Dev-Platform/... to //UE4/Release-4.13/...)

Change 3067512 on 2016/07/27 by Jeff.Fisher

	UEVR-13 PSVR: TCR Requirements (first two items)
	https://udn.unrealengine.com/questions/301886/trying-to-use-vrheadsetlost-and-vrheadsetreconnect.html
	https://udn.unrealengine.com/questions/302238/how-to-handle-morpheus-disconnection-event.html#answer-303803
	https://udn.unrealengine.com/questions/300748/psvr-trc-compliance.html
	Unshelved from pending changelist '3065760 (UE4/Dev-VR)
	-Implements HMD connect/disconnect/reconnect handling along the lines of sony sample tutorial_vr/basic_setup.
	-Known issue: some tracker location popping during reconnect.  I will try to fix that next.
	#jira UEVR-13
	#review-3066558 @chad.taylor

Change 3067511 on 2016/07/27 by Jeff.Fisher

	Duplicating 3058093 (UE4/Dev-VR)
	Linking SceHmdSetupDialog_stub_weak so one can easily use the sceHmdSetup library to pop up the system hmd setup dialog, if one wishes (someone did, we probably will soon).
	#jira UEVR-13

Change 3067488 on 2016/07/27 by Ori.Cohen

	Make the UI more clear for which physical animation is currently being editted.

	#JIRA UE-33332

Change 3067481 on 2016/07/27 by Chris.Babcock

	AAR support and updating libraries:
	- Google Play Games native C++ SDK 2.1
	- Google Play Services 9.2.0
	- android-support-v4.jar 23.0.0
	#jira UEPLAT-1251
	#jira UE-19190
	#ue4
	#android

Change 3067478 on 2016/07/27 by Ori.Cohen

	Fix it so renaming of physical animation profiles (and constraint profiles) do not lose previous settings

	#JIRA UE-33276, UE-33331

Change 3067474 on 2016/07/27 by Ori.Cohen

	Make it so property index comes in on reset of array value and duplication (From Matt.K)

	#JIRA UE-33276

Change 3067457 on 2016/07/27 by Ori.Cohen

	Fix currently highlighted text in physics profiles being copied over when chaing current profile

	#JIRA UE-33282

Change 3067451 on 2016/07/27 by Ori.Cohen

	Fix the case where objects welded together (even though they're simulating) do not re-weld when being detached in a long chain

	#JIRA UE-32531

Change 3067443 on 2016/07/27 by Ori.Cohen

	Make skeletalMeshComponent a property of physical animation component so things can be setup in the construction script.
	Mark the component as experimental and only expose valid functions into construction script

	#JIRA UE-33656

Change 3067439 on 2016/07/27 by Ori.Cohen

	Added more logging info for potential fixed framerate negative delta time crash

	#JIRA UE-32219

Change 3067348 on 2016/07/27 by mason.seay

	Updating map to have hit events test.

	#jira UE-29618

Change 3067342 on 2016/07/27 by Mitchell.Wilson

	Updating collision on TwinStickUFO to resolve issue with the ship getting stuck when rotating due to collision being offset slightly
	#jira UE-15698

Change 3067332 on 2016/07/27 by Dmitry.Rekman

	Fix for libstdc++ problems (UE-33584).

	#tests Built UE4Editor/UE4Game on Ubuntu 16.04 and 15.10.

	#JIRA UE-33584

	(Redoing CL 3065551 from Dev-Platform).

Change 3067262 on 2016/07/27 by Lina.Halper

	DUPEFIX: Fix compile issue of non-editor build due to - Reduce functions is not editoronly

	#tests: PIE/compile editor build/noneditor
	#jira: UE-33477

Change 3067228 on 2016/07/27 by Lina.Halper

	This fixes crash where mesh has changed hierarchy but hasn't been remapped yet.

	#jira: UE-29880

Change 3067168 on 2016/07/27 by Lina.Halper

	DUPEFIX: Smartname guid will be discarded during cooking, and once it's cooked, it's trusted to have correct name.

	#code review:Martin.Wilson, Benn.Gallagher
	#tests: cooked test map, run test map, PIE, saving content, loading standalone game
	#jira: UE-33454

Change 3067162 on 2016/07/27 by Lina.Halper

	pose asset source animation/animation asset preview pose now have proper skeleton filter

	#jira: UE-32607

Change 3067160 on 2016/07/27 by Lina.Halper

	Fix issue with preview curve not working when no asset

	#jira: UE-33402

Change 3067138 on 2016/07/27 by Lina.Halper

	DUPEFIX: Fix the guid keep generated by adding to the database.

	- This caused worse problem with non-deterministic cooking -   This doesn't fix UE-33454 for 100%, but this was the main reason why this was so visible

	#jira: UE-33772, UE-33454
	#tests: cooked AI_Test map, editor rename curves

Change 3067129 on 2016/07/27 by Lina.Halper

	DUPEFIX- Fix additive issue with remove linear key and built the new animation DDC
	#tests: Jump_Recovery_Additive, PIE
	#jira: UE-33477

Change 3067128 on 2016/07/27 by Michael.Trepka

	Copy of CL 3062046

	PRAGMA_DISABLE_OPTIMIZATION_ACTUAL and PRAGMA_ENABLE_OPTIMIZATION_ACTUAL defines for iOS

	#jira UE-33683

Change 3067104 on 2016/07/27 by Lina.Halper

	DUPEFIX: Support different samplerate for reimport with set range

	#jira: UE-16027

Change 3067093 on 2016/07/27 by Lina.Halper

	DUPE FIX: Fix baking is applied twice in the new created animation

	#jira: UE-31120

Change 3067088 on 2016/07/27 by Lina.Halper

	Fix issues with rename/delete of the curves

	#jira: UE-33663, UE-33730, UE-33661, UE-33662

Change 3066795 on 2016/07/27 by Mark.Satterthwaite

	Fix a race-condition in FMetalBlendState's constructor that could lead to crashes or use of the incorrect blend-state. This is a partial fix for UE-33778 which appears to have several causes.
	#jira UE-33778

Change 3066788 on 2016/07/27 by Mark.Satterthwaite

	Duplicate CL #3066338:
	Handle releasing an SRV/UAV & the source object within a single Metal command-buffer.
	#jira UE-33779

Change 3066786 on 2016/07/27 by Mark.Satterthwaite

	Duplicate CL #3064743:
	Proper fix for FORT-27685 - on Metal it is invalid to fail to set uniform parameters on a shader - if you don't set the parameter the buffer binding may be nil or too small for the data accessed in the shader and the GPU will then crash.
	#jira UE-33827
	#jira FORT-27685

Change 3066768 on 2016/07/27 by samuel.proctor

	Updated child blueprint used for profiler testing

	#jira UE-29618

Change 3066733 on 2016/07/27 by samuel.proctor

	Refreshed broken node in profiler test asset

	#jira UE-29618

Change 3066670 on 2016/07/27 by Sam.Deiter

	#Jira UEDOC-3139 Adding the blending tool tip images.

Change 3066669 on 2016/07/27 by Mark.Satterthwaite

	Duplicate CL #3063329:
	CL #3046743 was breaking other samples in unexpected ways after a recent Main merge, so make a Metal-specific change to the shader instead and amend the MetalBackend to better match HLSL's handling of NaN/inf with common single-precision float intrinsics. This is sufficient to fix the AtmosphericFog and the recent regressions.
	#jira UE-33600
	#jira UE-33028
	#jira UE-27879
	#jira UE-25802

Change 3066668 on 2016/07/27 by Mark.Satterthwaite

	Duplicate CL #3063327:
	Added FSpeedTreeWindNullUniformBuffer as a global resource to bind to shaders that require a SpeedTreeData uniform but don't yet have data available as a nil binding is invalid on Metal.
	#jira UE-32068

Change 3066625 on 2016/07/27 by Mark.Satterthwaite

	Duplicate CL #3062160:
	Fix the fix for handling RHISetStreamSource overriding stride on Metal - not all MTLVertexDescriptors are equally hashable so do this ourselves.
	#jira UE-33355

Change 3066624 on 2016/07/27 by Mark.Satterthwaite

	Duplicate CL #3063328:
	Mac Metal DXT/BC textures can have mip-levels smaller than the block size (they switch to uncompressed data).
	#jira UE-33820

Change 3066589 on 2016/07/27 by Mark.Satterthwaite

	Duplicate CL #3060590 to fix UE-33819:
	Fix FORT-27340: Mac Metal cannot natively support PF_G8 + sRGB as not all Mac GPUs have single-channel sRGB formats (according to Apple) so we must manually pack & unpack to RGBA8_sRGB - the code to do this was missing from UpdateTexture2D.
	#jira UE-33819

Change 3066588 on 2016/07/27 by Matt.Kuhlenschmidt

	Fixed Reset to default not updating when selecting new assets

	#jira UE-33817

Change 3066509 on 2016/07/27 by mason.seay

	Phys material needed for TM-SliceProcMesh

	#jira UE-29618

Change 3066500 on 2016/07/27 by mason.seay

	Rebuilt lighting

	#jira UE-29618

Change 3066499 on 2016/07/27 by Jurre.deBaare

	Map build should not generate empty HLOD folder in Editor
	#fix Asset outer (hlod folder/asset) was created regardless of whether or not it was needed, now checks first :)
	#jira UE-29564

Change 3066498 on 2016/07/27 by Jurre.deBaare

	HLOD outliner drag and drop operation can cause log spam
	#fix Found the log spam was coming from the scene outliner itself, caused by Formatting call receiving incorrect argument names which is now fixed
	#jira UE-32106

Change 3066485 on 2016/07/27 by Alan.Noon

	Resubmitting fixes for Puzzle Templates. Rebuilt in 4.13 via UGS
	#jira UE-30564

Change 3066470 on 2016/07/27 by mason.seay

	Test map and updating blueprint for slicing proc mesh

	#jira UE-29618

Change 3066367 on 2016/07/27 by Matthew.Griffin

	Switch UE4 Binary Release to be the job that runs nightly instead of the Full Build we use in main

Change 3066337 on 2016/07/27 by Matthew.Griffin

	Remaking CL 3066327 by Matthew.Griffin@Matthew.Griffin_G5772_MainStream on 2016-07-27 15:39

		Adding ArchiveDir parameter to Fortnite build command as it ignores StagingDir and has been filling up network drive

Change 3066158 on 2016/07/27 by Ben.Marsh

	Reverting assets causing warning, via integration from //UE4/Main.

Change 3065651 on 2016/07/26 by Ben.Marsh

	Remaking CL 3065267 by Alan.Noon@Alan.Noon_Z3739_Main_9938 on 2016/07/26 16:35:14

		Updated Puzzle Template (BP and C++) to mimic each other in terms of content, labelling and setup.

Change 3065650 on 2016/07/26 by Ben.Marsh

	Remaking CL 3065358 by James.Brinkerhoff@James.Brinkerhoff_Z2862_Ocean-Staging on 2016/07/26 17:31:04

		Hotfix for Ocean from CL 3065311: Fixes the load/apply order when applying customizations to characters in the editor

Change 3065649 on 2016/07/26 by Ben.Marsh

	Remaking CL 3065268 by Max.Chen@Max.Chen_T4664_UE4_Main on 2016/07/26 16:35:18

		Sequencer: Revert 3057233 because it breaks sequence recording.

		Copy from Dev-Sequencer

		#jira UE-33569

Change 3065308 on 2016/07/26 by Ben.Marsh

	Fix failure to parse EC settings for 4.13 branch.

Change 3065235 on 2016/07/26 by Ben.Marsh

	Set the IsReleaseBranch flag to true for builds in the Release-4.13 branch.

[CL 3079611 by Matthew Griffin in Main branch]
2016-08-05 17:47:48 -04:00

2628 lines
81 KiB
C++

// Copyright 1998-2016 Epic Games, Inc. All Rights Reserved.
#include "PropertyEditorPrivatePCH.h"
#include "ObjectPropertyNode.h"
#include "CategoryPropertyNode.h"
#include "ScopedTransaction.h"
#include "PropertyRestriction.h"
#include "Editor/UnrealEd/Public/Kismet2/StructureEditorUtils.h"
#include "Editor/UnrealEd/Public/Kismet2/BlueprintEditorUtils.h"
#include "Engine/UserDefinedStruct.h"
#include "Misc/ScopeExit.h"
#include "PropertyHandleImpl.h"
FPropertySettings& FPropertySettings::Get()
{
static FPropertySettings Settings;
return Settings;
}
FPropertySettings::FPropertySettings()
: bShowFriendlyPropertyNames( true )
, bExpandDistributions( false )
, bShowHiddenProperties(false)
{
GConfig->GetBool(TEXT("PropertySettings"), TEXT("ShowHiddenProperties"), bShowHiddenProperties, GEditorPerProjectIni);
GConfig->GetBool(TEXT("PropertySettings"), TEXT("ShowFriendlyPropertyNames"), bShowFriendlyPropertyNames, GEditorPerProjectIni);
GConfig->GetBool(TEXT("PropertySettings"), TEXT("ExpandDistributions"), bExpandDistributions, GEditorPerProjectIni);
}
DEFINE_LOG_CATEGORY(LogPropertyNode);
static FObjectPropertyNode* NotifyFindObjectItemParent(FPropertyNode* InNode)
{
FObjectPropertyNode* Result = NULL;
check(InNode);
FPropertyNode* ParentNode = InNode->GetParentNode();
if (ParentNode)
{
Result = ParentNode->FindObjectItemParent();
}
return Result;
}
FPropertyNode::FPropertyNode(void)
: ParentNode(NULL)
, Property(NULL)
, ArrayOffset(0)
, ArrayIndex(-1)
, MaxChildDepthAllowed(FPropertyNodeConstants::NoDepthRestrictions)
, PropertyNodeFlags (EPropertyNodeFlags::NoFlags)
, bRebuildChildrenRequested( false )
, PropertyPath(TEXT(""))
, bIsEditConst(false)
, bUpdateEditConstState(true)
, bDiffersFromDefault(false)
, bUpdateDiffersFromDefault(true)
{
}
FPropertyNode::~FPropertyNode(void)
{
DestroyTree();
}
void FPropertyNode::InitNode( const FPropertyNodeInitParams& InitParams )
{
//Dismantle the previous tree
DestroyTree();
//tree hierarchy
check(InitParams.ParentNode.Get() != this);
ParentNode = InitParams.ParentNode.Get();
ParentNodeWeakPtr = InitParams.ParentNode;
if (ParentNode)
{
//default to parents max child depth
MaxChildDepthAllowed = ParentNode->MaxChildDepthAllowed;
//if limitless or has hit the full limit
if (MaxChildDepthAllowed > 0)
{
--MaxChildDepthAllowed;
}
}
//Property Data
Property = InitParams.Property;
ArrayOffset = InitParams.ArrayOffset;
ArrayIndex = InitParams.ArrayIndex;
// Property is advanced if it is marked advanced or the entire class is advanced and the property not marked as simple
bool bAdvanced = Property.IsValid() ? ( Property->HasAnyPropertyFlags(CPF_AdvancedDisplay) || ( !Property->HasAnyPropertyFlags( CPF_SimpleDisplay ) && Property->GetOwnerClass() && Property->GetOwnerClass()->HasAnyClassFlags( CLASS_AdvancedDisplay ) ) ): false;
PropertyNodeFlags = EPropertyNodeFlags::NoFlags;
//default to copying from the parent
if (ParentNode)
{
SetNodeFlags(EPropertyNodeFlags::ShowCategories, !!ParentNode->HasNodeFlags(EPropertyNodeFlags::ShowCategories));
// We are advanced if our parent is advanced or our property is marked as advanced
SetNodeFlags(EPropertyNodeFlags::IsAdvanced, ParentNode->HasNodeFlags(EPropertyNodeFlags::IsAdvanced) || bAdvanced );
}
else
{
SetNodeFlags(EPropertyNodeFlags::ShowCategories, InitParams.bCreateCategoryNodes );
}
SetNodeFlags(EPropertyNodeFlags::ShouldShowHiddenProperties, InitParams.bForceHiddenPropertyVisibility);
SetNodeFlags(EPropertyNodeFlags::ShouldShowDisableEditOnInstance, InitParams.bCreateDisableEditOnInstanceNodes);
//Custom code run prior to setting property flags
//needs to happen after the above SetNodeFlags calls so that ObjectPropertyNode can properly respond to CollapseCategories
InitBeforeNodeFlags();
if ( !Property.IsValid() )
{
// Disable all flags if no property is bound.
SetNodeFlags(EPropertyNodeFlags::SingleSelectOnly | EPropertyNodeFlags::EditInline , false);
}
else
{
FReadAddressListData ReadAddresses;
const bool GotReadAddresses = GetReadAddressUncached( *this, false, ReadAddresses, false );
const bool bSingleSelectOnly = GetReadAddressUncached( *this, true, ReadAddresses );
SetNodeFlags(EPropertyNodeFlags::SingleSelectOnly, bSingleSelectOnly);
UProperty* MyProperty = Property.Get();
const bool bIsObjectOrInterface = Cast<UObjectPropertyBase>(MyProperty) || Cast<UInterfaceProperty>(MyProperty);
// true if the property can be expanded into the property window; that is, instead of seeing
// a pointer to the object, you see the object's properties.
static const FName Name_EditInline("EditInline");
const bool bEditInline = bIsObjectOrInterface && GotReadAddresses && MyProperty->HasMetaData(Name_EditInline);
SetNodeFlags(EPropertyNodeFlags::EditInline, bEditInline);
//Get the property max child depth
static const FName Name_MaxPropertyDepth("MaxPropertyDepth");
if (Property->HasMetaData(Name_MaxPropertyDepth))
{
int32 NewMaxChildDepthAllowed = Property->GetINTMetaData(Name_MaxPropertyDepth);
//Ensure new depth is valid. Otherwise just let the parent specified value stand
if (NewMaxChildDepthAllowed > 0)
{
//if there is already a limit on the depth allowed, take the minimum of the allowable depths
if (MaxChildDepthAllowed >= 0)
{
MaxChildDepthAllowed = FMath::Min(MaxChildDepthAllowed, NewMaxChildDepthAllowed);
}
else
{
//no current limit, go ahead and take the new limit
MaxChildDepthAllowed = NewMaxChildDepthAllowed;
}
}
}
}
InitExpansionFlags();
UProperty* MyProperty = Property.Get();
bool bIsEditInlineNew = MyProperty && !( MyProperty->PropertyFlags & CPF_EditConst ) && HasNodeFlags( EPropertyNodeFlags::EditInline ) != 0;
bool bRequiresValidation = bIsEditInlineNew || ( MyProperty && MyProperty->IsA<UArrayProperty>() );
// We require validation if our parent also needs validation (if an array parent was resized all the addresses of children are invalid)
bRequiresValidation |= (GetParentNode() && GetParentNode()->HasNodeFlags( EPropertyNodeFlags::RequiresValidation ) != 0);
SetNodeFlags( EPropertyNodeFlags::RequiresValidation, bRequiresValidation );
if ( InitParams.bAllowChildren )
{
RebuildChildren();
}
PropertyPath = FPropertyNode::CreatePropertyPath(this->AsShared())->ToString();
}
/**
* Used for rebuilding a sub portion of the tree
*/
void FPropertyNode::RebuildChildren()
{
CachedReadAddresses.Reset();
bool bDestroySelf = false;
DestroyTree(bDestroySelf);
if (MaxChildDepthAllowed != 0)
{
//the case where we don't want init child nodes is when an Item has children that we don't want to display
//the other option would be to make each node "Read only" under that item.
//The example is a material assigned to a static mesh.
if (HasNodeFlags(EPropertyNodeFlags::CanBeExpanded) && (ChildNodes.Num() == 0))
{
InitChildNodes();
}
}
//see if they support some kind of edit condition
if (Property.IsValid() && Property->GetBoolMetaData(TEXT("FullyExpand")))
{
bool bExpand = true;
bool bRecurse = true;
}
// Children have been rebuilt, clear any pending rebuild requests
bRebuildChildrenRequested = false;
// Notify any listener that children have been rebuilt
OnRebuildChildren.ExecuteIfBound();
}
void FPropertyNode::AddChildNode(TSharedPtr<FPropertyNode> InNode)
{
ChildNodes.Add(InNode);
}
void FPropertyNode::ClearCachedReadAddresses( bool bRecursive )
{
CachedReadAddresses.Reset();
if( bRecursive )
{
for( int32 ChildIndex = 0; ChildIndex < ChildNodes.Num(); ++ChildIndex )
{
ChildNodes[ChildIndex]->ClearCachedReadAddresses( bRecursive );
}
}
}
// Follows the chain of items upwards until it finds the object window that houses this item.
FComplexPropertyNode* FPropertyNode::FindComplexParent()
{
FPropertyNode* Cur = this;
FComplexPropertyNode* Found = NULL;
while( true )
{
Found = Cur->AsComplexNode();
if( Found )
{
break;
}
Cur = Cur->GetParentNode();
if( !Cur )
{
// There is a break in the parent chain
break;
}
}
return Found;
}
// Follows the chain of items upwards until it finds the object window that houses this item.
const FComplexPropertyNode* FPropertyNode::FindComplexParent() const
{
const FPropertyNode* Cur = this;
const FComplexPropertyNode* Found = NULL;
while( true )
{
Found = Cur->AsComplexNode();
if( Found )
{
break;
}
Cur = Cur->GetParentNode();
if( !Cur )
{
// There is a break in the parent chain
break;
}
}
return Found;
}
class FObjectPropertyNode* FPropertyNode::FindObjectItemParent()
{
auto ComplexParent = FindComplexParent();
return ComplexParent ? ComplexParent->AsObjectNode() : NULL;
}
const class FObjectPropertyNode* FPropertyNode::FindObjectItemParent() const
{
const auto ComplexParent = FindComplexParent();
return ComplexParent ? ComplexParent->AsObjectNode() : NULL;
}
/**
* Follows the top-most object window that contains this property window item.
*/
FObjectPropertyNode* FPropertyNode::FindRootObjectItemParent()
{
// not every type of change to property values triggers a proper refresh of the hierarchy, so find the topmost container window and trigger a refresh manually.
FObjectPropertyNode* TopmostObjectItem=NULL;
FObjectPropertyNode* NextObjectItem = FindObjectItemParent();
while ( NextObjectItem != NULL )
{
TopmostObjectItem = NextObjectItem;
FPropertyNode* NextObjectParent = NextObjectItem->GetParentNode();
if ( NextObjectParent != NULL )
{
NextObjectItem = NextObjectParent->FindObjectItemParent();
}
else
{
break;
}
}
return TopmostObjectItem;
}
/**
* Used to see if any data has been destroyed from under the property tree. Should only be called by PropertyWindow::OnIdle
*/
FPropertyNode::DataValidationResult FPropertyNode::EnsureDataIsValid()
{
bool bValidateChildren = !HasNodeFlags(EPropertyNodeFlags::SkipChildValidation);
// The root must always be validated
if( GetParentNode() == NULL || HasNodeFlags(EPropertyNodeFlags::RequiresValidation) != 0 )
{
CachedReadAddresses.Reset();
//Figure out if an array mismatch can be ignored
bool bIgnoreAllMismatch = false;
//make sure that force depth-limited trees don't cause a refresh
bIgnoreAllMismatch |= (MaxChildDepthAllowed==0);
//check my property
if (Property.IsValid())
{
UProperty* MyProperty = Property.Get();
//verify that the number of array children is correct
UArrayProperty* ArrayProperty = Cast<UArrayProperty>(MyProperty);
//default to unknown array length
int32 NumArrayChildren = -1;
//assume all arrays have the same length
bool bArraysHaveEqualNum = true;
//assume all arrays match the number of property window children
bool bArraysMatchChildNum = true;
bool bArrayHasNewItem = false;
if (ArrayProperty)
{
if (!ArrayProperty->Inner->IsA(UObjectProperty::StaticClass()) && !ArrayProperty->Inner->IsA(UStructProperty::StaticClass()))
{
bValidateChildren = false;
}
}
//verify that the number of object children are the same too
UObjectPropertyBase* ObjectProperty = Cast<UObjectPropertyBase>(MyProperty);
//check to see, if this an object property, whether the contents are NULL or not.
//This is the check to see if an object property was changed from NULL to non-NULL, or vice versa, from non-property window code.
bool bObjectPropertyNull = true;
//Edit inline properties can change underneath the window
bool bIgnoreChangingChildren = !HasNodeFlags(EPropertyNodeFlags::EditInline);
//ignore this node if the consistency check should happen for the children
bool bIgnoreStaticArray = (Property->ArrayDim > 1) && (ArrayIndex == -1);
//if this node can't possibly have children (or causes a circular reference loop) then ignore this as a object property
if (bIgnoreChangingChildren || bIgnoreStaticArray || HasNodeFlags(EPropertyNodeFlags::NoChildrenDueToCircularReference))
{
//this will bypass object property consistency checks
ObjectProperty = NULL;
}
FReadAddressList ReadAddresses;
const bool bSuccess = GetReadAddress( ReadAddresses );
//make sure we got the addresses correctly
if (!bSuccess)
{
UE_LOG( LogPropertyNode, Verbose, TEXT("Object is invalid %s"), *Property->GetName() );
return ObjectInvalid;
}
//check for null, if we find one, there is a problem.
for (int32 Scan = 0; Scan < ReadAddresses.Num(); ++Scan)
{
uint8* Addr = ReadAddresses.GetAddress(Scan);
//make sure the data still exists
if (Addr==NULL)
{
UE_LOG( LogPropertyNode, Verbose, TEXT("Object is invalid %s"), *Property->GetName() );
return ObjectInvalid;
}
if( ArrayProperty && !bIgnoreAllMismatch)
{
//ensure that array structures have the proper number of children
int32 ArrayNum = FScriptArrayHelper::Num(Addr);
//if first child
if (NumArrayChildren == -1)
{
NumArrayChildren = ArrayNum;
}
bArrayHasNewItem = GetNumChildNodes() < ArrayNum;
//make sure multiple arrays match
bArraysHaveEqualNum = bArraysHaveEqualNum && (NumArrayChildren == ArrayNum);
//make sure the array matches the number of property node children
bArraysMatchChildNum = bArraysMatchChildNum && (GetNumChildNodes() == ArrayNum);
}
if (ObjectProperty && !bIgnoreAllMismatch)
{
UObject* obj = ObjectProperty->GetObjectPropertyValue(Addr);
if (obj != NULL)
{
bObjectPropertyNull = false;
break;
}
}
}
//if all arrays match each other but they do NOT match the property structure, cause a rebuild
if (bArraysHaveEqualNum && !bArraysMatchChildNum)
{
RebuildChildren();
if( bArrayHasNewItem && ChildNodes.Num() )
{
TSharedPtr<FPropertyNode> LastChildNode = ChildNodes.Last();
// Don't expand huge children
if( LastChildNode->GetNumChildNodes() > 0 && LastChildNode->GetNumChildNodes() < 10 )
{
// Expand the last item for convenience since generally the user will want to edit the new value they added.
LastChildNode->SetNodeFlags(EPropertyNodeFlags::Expanded, true);
}
}
return ArraySizeChanged;
}
const bool bHasChildren = (GetNumChildNodes() != 0);
// If the object property is not null and has no children, its children need to be rebuilt
// If the object property is null and this node has children, the node needs to be rebuilt
if (ObjectProperty && ((!bObjectPropertyNull && !bHasChildren) || (bObjectPropertyNull && bHasChildren)))
{
RebuildChildren();
return PropertiesChanged;
}
}
}
if( bRebuildChildrenRequested )
{
RebuildChildren();
// If this property is editinline and not edit const then its editinline new and we can optimize some of the refreshing in some cases. Otherwise we need to refresh all properties in the view
return HasNodeFlags(EPropertyNodeFlags::EditInline) && !IsEditConst() ? EditInlineNewValueChanged : PropertiesChanged;
}
FPropertyNode::DataValidationResult FinalResult = DataValid;
//go through my children
if (bValidateChildren)
{
for (int32 Scan = 0; Scan < ChildNodes.Num(); ++Scan)
{
TSharedPtr<FPropertyNode>& ChildNode = ChildNodes[Scan];
check(ChildNode.IsValid());
FPropertyNode::DataValidationResult ChildDataResult = ChildNode->EnsureDataIsValid();
if (FinalResult == DataValid && ChildDataResult != DataValid)
{
FinalResult = ChildDataResult;
}
}
}
return FinalResult;
}
/**
* Sets the flags used by the window and the root node
* @param InFlags - flags to turn on or off
* @param InOnOff - whether to toggle the bits on or off
*/
void FPropertyNode::SetNodeFlags (const EPropertyNodeFlags::Type InFlags, const bool InOnOff)
{
if (InOnOff)
{
PropertyNodeFlags |= InFlags;
}
else
{
PropertyNodeFlags &= (~InFlags);
}
}
TSharedPtr<FPropertyNode> FPropertyNode::FindChildPropertyNode( const FName InPropertyName, bool bRecurse )
{
// Search Children
for(int32 ChildIndex=0; ChildIndex<ChildNodes.Num(); ChildIndex++)
{
TSharedPtr<FPropertyNode>& ChildNode = ChildNodes[ChildIndex];
if( ChildNode->GetProperty() && ChildNode->GetProperty()->GetFName() == InPropertyName )
{
return ChildNode;
}
else if( bRecurse )
{
TSharedPtr<FPropertyNode> PropertyNode = ChildNode->FindChildPropertyNode(InPropertyName, bRecurse );
if( PropertyNode.IsValid() )
{
return PropertyNode;
}
}
}
// Return nullptr if not found...
return nullptr;
}
/** @return whether this window's property is constant (can't be edited by the user) */
bool FPropertyNode::IsEditConst() const
{
if( bUpdateEditConstState )
{
// Ask the objects whether this property can be changed
const FObjectPropertyNode* ObjectPropertyNode = FindObjectItemParent();
bIsEditConst = (HasNodeFlags(EPropertyNodeFlags::IsReadOnly) != 0);
if(!bIsEditConst && Property != nullptr && ObjectPropertyNode)
{
bIsEditConst = (Property->PropertyFlags & CPF_EditConst) ? true : false;
if(!bIsEditConst)
{
// travel up the chain to see if this property's owner struct is editconst - if it is, so is this property
FPropertyNode* NextParent = ParentNode;
while(NextParent != nullptr && Cast<UStructProperty>(NextParent->GetProperty()) != NULL)
{
if(NextParent->IsEditConst())
{
bIsEditConst = true;
break;
}
NextParent = NextParent->ParentNode;
}
}
if(!bIsEditConst)
{
for(TPropObjectConstIterator CurObjectIt(ObjectPropertyNode->ObjectConstIterator()); CurObjectIt; ++CurObjectIt)
{
const TWeakObjectPtr<UObject> CurObject = *CurObjectIt;
if(CurObject.IsValid())
{
if(!CurObject->CanEditChange(Property.Get()))
{
// At least one of the objects didn't like the idea of this property being changed.
bIsEditConst = true;
break;
}
}
}
}
}
bUpdateEditConstState = false;
}
return bIsEditConst;
}
/**
* Appends my path, including an array index (where appropriate)
*/
bool FPropertyNode::GetQualifiedName( FString& PathPlusIndex, const bool bWithArrayIndex, const FPropertyNode* StopParent, bool bIgnoreCategories ) const
{
bool bAddedAnything = false;
if( ParentNodeWeakPtr.IsValid() && StopParent != ParentNode )
{
bAddedAnything = ParentNode->GetQualifiedName(PathPlusIndex, bWithArrayIndex, StopParent, bIgnoreCategories);
if( bAddedAnything )
{
PathPlusIndex += TEXT(".");
}
}
if( Property.IsValid() )
{
bAddedAnything = true;
Property->AppendName(PathPlusIndex);
}
if ( bWithArrayIndex && (ArrayIndex != INDEX_NONE) )
{
bAddedAnything = true;
PathPlusIndex += TEXT("[");
PathPlusIndex.AppendInt(ArrayIndex);
PathPlusIndex += TEXT("]");
}
return bAddedAnything;
}
bool FPropertyNode::GetReadAddressUncached( FPropertyNode& InPropertyNode,
bool InRequiresSingleSelection,
FReadAddressListData& OutAddresses,
bool bComparePropertyContents,
bool bObjectForceCompare,
bool bArrayPropertiesCanDifferInSize ) const
{
if (ParentNodeWeakPtr.IsValid())
{
return ParentNode->GetReadAddressUncached( InPropertyNode, InRequiresSingleSelection, OutAddresses, bComparePropertyContents, bObjectForceCompare, bArrayPropertiesCanDifferInSize );
}
return false;
}
bool FPropertyNode::GetReadAddressUncached( FPropertyNode& InPropertyNode, FReadAddressListData& OutAddresses ) const
{
if (ParentNodeWeakPtr.IsValid())
{
return ParentNode->GetReadAddressUncached( InPropertyNode, OutAddresses );
}
return false;
}
bool FPropertyNode::GetReadAddress(bool InRequiresSingleSelection,
FReadAddressList& OutAddresses,
bool bComparePropertyContents,
bool bObjectForceCompare,
bool bArrayPropertiesCanDifferInSize)
{
// @todo PropertyEditor Nodes which require validation cannot be cached
if( CachedReadAddresses.Num() && !CachedReadAddresses.bRequiresCache && !HasNodeFlags(EPropertyNodeFlags::RequiresValidation) )
{
OutAddresses.ReadAddressListData = &CachedReadAddresses;
return CachedReadAddresses.bAllValuesTheSame;
}
CachedReadAddresses.Reset();
bool bAllValuesTheSame = false;
if (ParentNodeWeakPtr.IsValid())
{
bAllValuesTheSame = GetReadAddressUncached( *this, InRequiresSingleSelection, CachedReadAddresses, bComparePropertyContents, bObjectForceCompare, bArrayPropertiesCanDifferInSize );
OutAddresses.ReadAddressListData = &CachedReadAddresses;
CachedReadAddresses.bAllValuesTheSame = bAllValuesTheSame;
CachedReadAddresses.bRequiresCache = false;
}
return bAllValuesTheSame;
}
/**
* fills in the OutAddresses array with the addresses of all of the available objects.
* @param InItem The property to get objects from.
* @param OutAddresses Storage array for all of the objects' addresses.
*/
bool FPropertyNode::GetReadAddress( FReadAddressList& OutAddresses )
{
// @todo PropertyEditor Nodes which require validation cannot be cached
if( CachedReadAddresses.Num() && !HasNodeFlags(EPropertyNodeFlags::RequiresValidation) )
{
OutAddresses.ReadAddressListData = &CachedReadAddresses;
return true;
}
CachedReadAddresses.Reset();
bool bSuccess = false;
if (ParentNodeWeakPtr.IsValid())
{
bSuccess = GetReadAddressUncached( *this, CachedReadAddresses );
if( bSuccess )
{
OutAddresses.ReadAddressListData = &CachedReadAddresses;
}
CachedReadAddresses.bRequiresCache = false;
}
return bSuccess;
}
/**
* Calculates the memory address for the data associated with this item's property. This is typically the value of a UProperty or a UObject address.
*
* @param StartAddress the location to use as the starting point for the calculation; typically the address of the object that contains this property.
*
* @return a pointer to a UProperty value or UObject. (For dynamic arrays, you'd cast this value to an FArray*)
*/
uint8* FPropertyNode::GetValueBaseAddress( uint8* StartAddress )
{
uint8* Result = NULL;
if ( ParentNodeWeakPtr.IsValid() )
{
Result = ParentNode->GetValueAddress(StartAddress);
}
return Result;
}
/**
* Calculates the memory address for the data associated with this item's value. For most properties, identical to GetValueBaseAddress. For items corresponding
* to dynamic array elements, the pointer returned will be the location for that element's data.
*
* @param StartAddress the location to use as the starting point for the calculation; typically the address of the object that contains this property.
*
* @return a pointer to a UProperty value or UObject. (For dynamic arrays, you'd cast this value to whatever type is the Inner for the dynamic array)
*/
uint8* FPropertyNode::GetValueAddress( uint8* StartAddress )
{
return GetValueBaseAddress( StartAddress );
}
/*-----------------------------------------------------------------------------
FPropertyItemValueDataTrackerSlate
-----------------------------------------------------------------------------*/
/**
* Calculates and stores the address for both the current and default value of
* the associated property and the owning object.
*/
class FPropertyItemValueDataTrackerSlate
{
public:
/**
* A union which allows a single address to be represented as a pointer to a uint8
* or a pointer to a UObject.
*/
union FPropertyValueRoot
{
UObject* OwnerObject;
uint8* ValueAddress;
};
void Reset(FPropertyNode* InPropertyNode, UObject* InOwnerObject)
{
OwnerObject = InOwnerObject;
PropertyNode = InPropertyNode;
bHasDefaultValue = false;
InnerInitialize();
}
void InnerInitialize()
{
{
PropertyValueRoot.OwnerObject = NULL;
PropertyDefaultValueRoot.OwnerObject = NULL;
PropertyValueAddress = NULL;
PropertyValueBaseAddress = NULL;
PropertyDefaultBaseAddress = NULL;
PropertyDefaultAddress = NULL;
}
PropertyValueRoot.OwnerObject = OwnerObject.Get();
check(PropertyNode);
UProperty* Property = PropertyNode->GetProperty();
check(Property);
check(PropertyValueRoot.OwnerObject);
FPropertyNode* ParentNode = PropertyNode->GetParentNode();
// if the object specified is a class object, transfer to the CDO instead
if ( Cast<UClass>(PropertyValueRoot.OwnerObject) != NULL )
{
PropertyValueRoot.OwnerObject = Cast<UClass>(PropertyValueRoot.OwnerObject)->GetDefaultObject();
}
UArrayProperty* ArrayProp = Cast<UArrayProperty>(Property);
UArrayProperty* OuterArrayProp = Cast<UArrayProperty>(Property->GetOuter());
// calculate the values for the current object
{
PropertyValueBaseAddress = OuterArrayProp == NULL
? PropertyNode->GetValueBaseAddress(PropertyValueRoot.ValueAddress)
: ParentNode->GetValueBaseAddress(PropertyValueRoot.ValueAddress);
PropertyValueAddress = PropertyNode->GetValueAddress(PropertyValueRoot.ValueAddress);
}
if( IsValidTracker() )
{
bHasDefaultValue = Private_HasDefaultValue();
// calculate the values for the default object
if ( bHasDefaultValue )
{
PropertyDefaultValueRoot.OwnerObject = PropertyValueRoot.OwnerObject ? PropertyValueRoot.OwnerObject->GetArchetype() : NULL;
PropertyDefaultBaseAddress = OuterArrayProp == NULL
? PropertyNode->GetValueBaseAddress(PropertyDefaultValueRoot.ValueAddress)
: ParentNode->GetValueBaseAddress(PropertyDefaultValueRoot.ValueAddress);
PropertyDefaultAddress = PropertyNode->GetValueAddress(PropertyDefaultValueRoot.ValueAddress);
//////////////////////////
// If this is an array property, we must take special measures; PropertyDefaultBaseAddress points to an FScriptArray*, while
// PropertyDefaultAddress points to the FScriptArray's Data pointer.
if ( ArrayProp != NULL )
{
PropertyValueAddress = PropertyValueBaseAddress;
PropertyDefaultAddress = PropertyDefaultBaseAddress;
}
}
}
}
/**
* Constructor
*
* @param InPropItem the property window item this struct will hold values for
* @param InOwnerObject the object which contains the property value
*/
FPropertyItemValueDataTrackerSlate( FPropertyNode* InPropertyNode, UObject* InOwnerObject )
: OwnerObject( InOwnerObject )
, PropertyNode(InPropertyNode)
, bHasDefaultValue(false)
{
InnerInitialize();
}
/**
* @return Whether or not this tracker has a valid address to a property and object
*/
bool IsValidTracker() const
{
return PropertyValueBaseAddress != 0 && OwnerObject.IsValid();
}
/**
* @return a pointer to the subobject root (outer-most non-subobject) of the owning object.
*/
UObject* GetTopLevelObject()
{
check(PropertyNode);
FObjectPropertyNode* RootNode = PropertyNode->FindRootObjectItemParent();
check(RootNode);
TArray<UObject*> RootObjects;
for ( TPropObjectIterator Itor( RootNode->ObjectIterator() ) ; Itor ; ++Itor )
{
TWeakObjectPtr<UObject> Object = *Itor;
if( Object.IsValid() )
{
RootObjects.Add(Object.Get());
}
}
UObject* Result;
for ( Result = PropertyValueRoot.OwnerObject; Result; Result = Result->GetOuter() )
{
if ( RootObjects.Contains(Result) )
{
break;
}
}
if( !Result )
{
// The result is not contained in the root so it is the top level object
Result = PropertyValueRoot.OwnerObject;
}
return Result;
}
/**
* Whether or not we have a default value
*/
bool HasDefaultValue() const { return bHasDefaultValue; }
/**
* @return The property node we are inspecting
*/
FPropertyNode* GetPropertyNode() const { return PropertyNode; }
/**
* @return The address of the property's value.
*/
uint8* GetPropertyValueAddress() const { return PropertyValueAddress; }
/**
* @return The base address of the property's default value.
*/
uint8* GetPropertyDefaultBaseAddress() const { return PropertyDefaultBaseAddress; }
/**
* @return The address of the property's default value.
*/
uint8* GetPropertyDefaultAddress() const { return PropertyDefaultAddress; }
/**
* @return The address of the owning object's archetype
*/
FPropertyValueRoot GetPropertyValueRoot() const { return PropertyValueRoot; }
private:
/**
* Determines whether the property bound to this struct exists in the owning object's archetype.
*
* @return true if this property exists in the owning object's archetype; false if the archetype is e.g. a
* CDO for a base class and this property is declared in the owning object's class.
*/
bool Private_HasDefaultValue() const
{
bool bResult = false;
if( IsValidTracker() )
{
check(PropertyValueBaseAddress);
check(PropertyValueRoot.OwnerObject);
UObject* ParentDefault = PropertyValueRoot.OwnerObject->GetArchetype();
check(ParentDefault);
if (PropertyValueRoot.OwnerObject->GetClass() == ParentDefault->GetClass())
{
// if the archetype is of the same class, then we must have a default
bResult = true;
}
else
{
// Find the member property which contains this item's property
FPropertyNode* MemberPropertyNode = PropertyNode;
for ( ;MemberPropertyNode != NULL; MemberPropertyNode = MemberPropertyNode->GetParentNode() )
{
UProperty* MemberProperty = MemberPropertyNode->GetProperty();
if ( MemberProperty != NULL )
{
if ( Cast<UClass>(MemberProperty->GetOuter()) != NULL )
{
break;
}
}
}
if ( MemberPropertyNode != NULL && MemberPropertyNode->GetProperty())
{
// we check to see that this property is in the defaults class
bResult = MemberPropertyNode->GetProperty()->IsInContainer(ParentDefault->GetClass());
}
}
}
return bResult;
}
private:
TWeakObjectPtr<UObject> OwnerObject;
/** The property node we are inspecting */
FPropertyNode* PropertyNode;
/** The address of the owning object */
FPropertyValueRoot PropertyValueRoot;
/**
* The address of the owning object's archetype
*/
FPropertyValueRoot PropertyDefaultValueRoot;
/**
* The address of this property's value.
*/
uint8* PropertyValueAddress;
/**
* The base address of this property's value. i.e. for dynamic arrays, the location of the FScriptArray which
* contains the array property's value
*/
uint8* PropertyValueBaseAddress;
/**
* The base address of this property's default value (see other comments for PropertyValueBaseAddress)
*/
uint8* PropertyDefaultBaseAddress;
/**
* The address of this property's default value.
*/
uint8* PropertyDefaultAddress;
/** Whether or not we have a default value */
bool bHasDefaultValue;
};
/* ==========================================================================================================
FPropertyItemComponentCollector
Given a property and the address for that property's data, searches for references to components and
keeps a list of any that are found.
========================================================================================================== */
/**
* Given a property and the address for that property's data, searches for references to components and keeps a list of any that are found.
*/
struct FPropertyItemComponentCollector
{
/** contains the property to search along with the value address to use */
const FPropertyItemValueDataTrackerSlate& ValueTracker;
/** holds the list of instanced objects found */
TArray<UObject*> Components;
/** Whether or not we have an edit inline new */
bool bContainsEditInlineNew;
/** Constructor */
FPropertyItemComponentCollector( const FPropertyItemValueDataTrackerSlate& InValueTracker )
: ValueTracker(InValueTracker)
, bContainsEditInlineNew( false )
{
check(ValueTracker.GetPropertyNode());
FPropertyNode* PropertyNode = ValueTracker.GetPropertyNode();
check(PropertyNode);
UProperty* Prop = PropertyNode->GetProperty();
if ( PropertyNode->GetArrayIndex() == INDEX_NONE )
{
// either the associated property is not an array property, or it's the header for the property (meaning the entire array)
for ( int32 ArrayIndex = 0; ArrayIndex < Prop->ArrayDim; ArrayIndex++ )
{
ProcessProperty(Prop, ValueTracker.GetPropertyValueAddress() + ArrayIndex * Prop->ElementSize);
}
}
else
{
// single element of either a dynamic or static array
ProcessProperty(Prop, ValueTracker.GetPropertyValueAddress());
}
}
/**
* Routes the processing to the appropriate method depending on the type of property.
*
* @param Property the property to process
* @param PropertyValueAddress the address of the property's value
*/
void ProcessProperty( UProperty* Property, uint8* PropertyValueAddress )
{
if ( Property != NULL )
{
bContainsEditInlineNew |= Property->HasMetaData(TEXT("EditInline")) && ((Property->PropertyFlags & CPF_EditConst) == 0);
if ( ProcessObjectProperty(Cast<UObjectPropertyBase>(Property), PropertyValueAddress) )
{
return;
}
if ( ProcessStructProperty(Cast<UStructProperty>(Property), PropertyValueAddress) )
{
return;
}
if ( ProcessInterfaceProperty(Cast<UInterfaceProperty>(Property), PropertyValueAddress) )
{
return;
}
if ( ProcessDelegateProperty(Cast<UDelegateProperty>(Property), PropertyValueAddress) )
{
return;
}
if ( ProcessMulticastDelegateProperty(Cast<UMulticastDelegateProperty>(Property), PropertyValueAddress) )
{
return;
}
if ( ProcessArrayProperty(Cast<UArrayProperty>(Property), PropertyValueAddress) )
{
return;
}
}
}
private:
/**
* UArrayProperty version - invokes ProcessProperty on the array's Inner member for each element in the array.
*
* @param ArrayProp the property to process
* @param PropertyValueAddress the address of the property's value
*
* @return true if the property was handled by this method
*/
bool ProcessArrayProperty( UArrayProperty* ArrayProp, uint8* PropertyValueAddress )
{
bool bResult = false;
if ( ArrayProp != NULL )
{
FScriptArray* ArrayValuePtr = ArrayProp->GetPropertyValuePtr(PropertyValueAddress);
uint8* ArrayValue = (uint8*)ArrayValuePtr->GetData();
for ( int32 ArrayIndex = 0; ArrayIndex < ArrayValuePtr->Num(); ArrayIndex++ )
{
ProcessProperty(ArrayProp->Inner, ArrayValue + ArrayIndex * ArrayProp->Inner->ElementSize);
}
bResult = true;
}
return bResult;
}
/**
* UStructProperty version - invokes ProcessProperty on each property in the struct
*
* @param StructProp the property to process
* @param PropertyValueAddress the address of the property's value
*
* @return true if the property was handled by this method
*/
bool ProcessStructProperty( UStructProperty* StructProp, uint8* PropertyValueAddress )
{
bool bResult = false;
if ( StructProp != NULL )
{
for ( UProperty* Prop = StructProp->Struct->PropertyLink; Prop; Prop = Prop->PropertyLinkNext )
{
for ( int32 ArrayIndex = 0; ArrayIndex < Prop->ArrayDim; ArrayIndex++ )
{
ProcessProperty(Prop, Prop->ContainerPtrToValuePtr<uint8>(PropertyValueAddress, ArrayIndex));
}
}
bResult = true;
}
return bResult;
}
/**
* UObjectProperty version - if the object located at the specified address is instanced, adds the component the list.
*
* @param ObjectProp the property to process
* @param PropertyValueAddress the address of the property's value
*
* @return true if the property was handled by this method
*/
bool ProcessObjectProperty( UObjectPropertyBase* ObjectProp, uint8* PropertyValueAddress )
{
bool bResult = false;
if ( ObjectProp != NULL )
{
UObject* ObjValue = ObjectProp->GetObjectPropertyValue(PropertyValueAddress);
if (ObjectProp->PropertyFlags & CPF_InstancedReference)
{
Components.AddUnique(ObjValue);
}
bResult = true;
}
return bResult;
}
/**
* UInterfaceProperty version - if the FScriptInterface located at the specified address contains a reference to an instance, add the component to the list.
*
* @param InterfaceProp the property to process
* @param PropertyValueAddress the address of the property's value
*
* @return true if the property was handled by this method
*/
bool ProcessInterfaceProperty( UInterfaceProperty* InterfaceProp, uint8* PropertyValueAddress )
{
bool bResult = false;
if ( InterfaceProp != NULL )
{
FScriptInterface* InterfaceValue = InterfaceProp->GetPropertyValuePtr(PropertyValueAddress);
UObject* InterfaceObj = InterfaceValue->GetObject();
if (InterfaceObj && InterfaceObj->IsDefaultSubobject())
{
Components.AddUnique(InterfaceValue->GetObject());
}
bResult = true;
}
return bResult;
}
/**
* UDelegateProperty version - if the FScriptDelegate located at the specified address contains a reference to an instance, add the component to the list.
*
* @param DelegateProp the property to process
* @param PropertyValueAddress the address of the property's value
*
* @return true if the property was handled by this method
*/
bool ProcessDelegateProperty( UDelegateProperty* DelegateProp, uint8* PropertyValueAddress )
{
bool bResult = false;
if ( DelegateProp != NULL )
{
FScriptDelegate* DelegateValue = DelegateProp->GetPropertyValuePtr(PropertyValueAddress);
if (DelegateValue->GetUObject() && DelegateValue->GetUObject()->IsDefaultSubobject())
{
Components.AddUnique(DelegateValue->GetUObject());
}
bResult = true;
}
return bResult;
}
/**
* UMulticastDelegateProperty version - if the FMulticastScriptDelegate located at the specified address contains a reference to an instance, add the component to the list.
*
* @param MulticastDelegateProp the property to process
* @param PropertyValueAddress the address of the property's value
*
* @return true if the property was handled by this method
*/
bool ProcessMulticastDelegateProperty( UMulticastDelegateProperty* MulticastDelegateProp, uint8* PropertyValueAddress )
{
bool bResult = false;
if ( MulticastDelegateProp != NULL )
{
FMulticastScriptDelegate* MulticastDelegateValue = MulticastDelegateProp->GetPropertyValuePtr(PropertyValueAddress);
TArray<UObject*> AllObjects = MulticastDelegateValue->GetAllObjects();
for( TArray<UObject*>::TConstIterator CurObjectIt( AllObjects ); CurObjectIt; ++CurObjectIt )
{
if ((*CurObjectIt)->IsDefaultSubobject())
{
Components.AddUnique((*CurObjectIt));
}
}
bResult = true;
}
return bResult;
}
};
bool FPropertyNode::GetDiffersFromDefaultForObject( FPropertyItemValueDataTrackerSlate& ValueTracker, UProperty* InProperty )
{
check( InProperty );
bool bDiffersFromDefaultForObject = false;
if ( ValueTracker.IsValidTracker() && ValueTracker.HasDefaultValue() && GetParentNode() != NULL )
{
//////////////////////////
// Check the property against its default.
// If the property is an object property, we have to take special measures.
UArrayProperty* OuterArrayProperty = Cast<UArrayProperty>(InProperty->GetOuter());
if ( OuterArrayProperty != NULL )
{
// make sure we're not trying to compare against an element that doesn't exist
if ( ValueTracker.GetPropertyDefaultBaseAddress() != NULL && GetArrayIndex() >= FScriptArrayHelper::Num(ValueTracker.GetPropertyDefaultBaseAddress()) )
{
bDiffersFromDefaultForObject = true;
}
}
// The property is a simple field. Compare it against the enclosing object's default for that property.
if ( !bDiffersFromDefaultForObject)
{
uint32 PortFlags = 0;
UObjectPropertyBase* ObjectProperty = Cast<UObjectPropertyBase>(InProperty);
if (InProperty->ContainsInstancedObjectProperty())
{
// Use PPF_DeepCompareInstances for component objects
if (ObjectProperty)
{
PortFlags |= PPF_DeepCompareInstances;
}
// Use PPF_DeltaComparison for instanced objects
else
{
PortFlags |= PPF_DeltaComparison;
}
}
if ( ValueTracker.GetPropertyValueAddress() == NULL || ValueTracker.GetPropertyDefaultAddress() == NULL )
{
// if either are NULL, we had a dynamic array somewhere in our parent chain and the array doesn't
// have enough elements in either the default or the object
bDiffersFromDefaultForObject = true;
}
else if ( GetArrayIndex() == INDEX_NONE && InProperty->ArrayDim > 1 )
{
for ( int32 Idx = 0; !bDiffersFromDefaultForObject && Idx < InProperty->ArrayDim; Idx++ )
{
bDiffersFromDefaultForObject = !InProperty->Identical(
ValueTracker.GetPropertyValueAddress() + Idx * InProperty->ElementSize,
ValueTracker.GetPropertyDefaultAddress() + Idx * InProperty->ElementSize,
PortFlags
);
}
}
else
{
uint8* PropertyValueAddr = ValueTracker.GetPropertyValueAddress();
uint8* DefaultPropertyValueAddr = ValueTracker.GetPropertyDefaultAddress();
if( PropertyValueAddr != NULL && DefaultPropertyValueAddr != NULL )
{
bDiffersFromDefaultForObject = !InProperty->Identical(
PropertyValueAddr,
DefaultPropertyValueAddr,
PortFlags
);
}
}
}
}
return bDiffersFromDefaultForObject;
}
/**
* If there is a property, sees if it matches. Otherwise sees if the entire parent structure matches
*/
bool FPropertyNode::GetDiffersFromDefault()
{
if( bUpdateDiffersFromDefault )
{
bUpdateDiffersFromDefault = false;
bDiffersFromDefault = false;
FObjectPropertyNode* ObjectNode = FindObjectItemParent();
if(ObjectNode && Property.IsValid() && !IsEditConst())
{
// Get an iterator for the enclosing objects.
for(int32 ObjIndex = 0; ObjIndex < ObjectNode->GetNumObjects(); ++ObjIndex)
{
UObject* Object = ObjectNode->GetUObject(ObjIndex);
TSharedPtr<FPropertyItemValueDataTrackerSlate> ValueTracker = GetValueTracker(Object, ObjIndex);
if(ValueTracker.IsValid() && Object && GetDiffersFromDefaultForObject(*ValueTracker, Property.Get()))
{
// If any object being observed differs from the result then there is no need to keep searching
bDiffersFromDefault = true;
break;
}
}
}
}
return bDiffersFromDefault;
}
FString FPropertyNode::GetDefaultValueAsStringForObject( FPropertyItemValueDataTrackerSlate& ValueTracker, UObject* InObject, UProperty* InProperty )
{
check( InObject );
check( InProperty );
bool bDiffersFromDefaultForObject = false;
FString DefaultValue;
// special case for Object class - no defaults to compare against
if ( InObject != UObject::StaticClass() && InObject != UObject::StaticClass()->GetDefaultObject() )
{
if ( ValueTracker.IsValidTracker() && ValueTracker.HasDefaultValue() )
{
//////////////////////////
// Check the property against its default.
// If the property is an object property, we have to take special measures.
UArrayProperty* OuterArrayProperty = Cast<UArrayProperty>(InProperty->GetOuter());
if ( OuterArrayProperty != NULL )
{
// make sure we're not trying to compare against an element that doesn't exist
if ( ValueTracker.GetPropertyDefaultBaseAddress() != NULL && GetArrayIndex() >= FScriptArrayHelper::Num(ValueTracker.GetPropertyDefaultBaseAddress()) )
{
bDiffersFromDefaultForObject = true;
DefaultValue = NSLOCTEXT("PropertyEditor", "ArrayLongerThanDefault", "Array is longer than the default.").ToString();
}
}
// The property is a simple field. Compare it against the enclosing object's default for that property.
if ( !bDiffersFromDefaultForObject)
{
uint32 PortFlags = 0;
UObjectPropertyBase* ObjectProperty = Cast<UObjectPropertyBase>(InProperty);
if (InProperty->ContainsInstancedObjectProperty())
{
// Use PPF_DeepCompareInstances for component objects
if (ObjectProperty)
{
PortFlags |= PPF_DeepCompareInstances;
}
// Use PPF_DeltaComparison for instanced objects
else
{
PortFlags |= PPF_DeltaComparison;
}
}
if ( ValueTracker.GetPropertyValueAddress() == NULL || ValueTracker.GetPropertyDefaultAddress() == NULL )
{
// if either are NULL, we had a dynamic array somewhere in our parent chain and the array doesn't
// have enough elements in either the default or the object
DefaultValue = NSLOCTEXT("PropertyEditor", "DifferentArrayLength", "Array has different length than the default.").ToString();
}
else if ( GetArrayIndex() == INDEX_NONE && InProperty->ArrayDim > 1 )
{
for ( int32 Idx = 0; !bDiffersFromDefaultForObject && Idx < InProperty->ArrayDim; Idx++ )
{
uint8* DefaultAddress = ValueTracker.GetPropertyDefaultAddress() + Idx * InProperty->ElementSize;
FString DefaultItem;
InProperty->ExportTextItem( DefaultItem, DefaultAddress, DefaultAddress, InObject, PortFlags, NULL );
if ( DefaultValue.Len() > 0 && DefaultItem.Len() > 0 )
{
DefaultValue += TEXT( ", " );
}
DefaultValue += DefaultItem;
}
}
else
{
InProperty->ExportTextItem( DefaultValue, ValueTracker.GetPropertyDefaultAddress(), ValueTracker.GetPropertyDefaultAddress(), InObject, PortFlags, NULL );
UByteProperty* ByteProperty = Cast<UByteProperty>(InProperty);
if ( ByteProperty != NULL && ByteProperty->Enum != NULL )
{
AdjustEnumPropDisplayName(ByteProperty->Enum, DefaultValue);
}
}
}
}
}
return DefaultValue;
}
FString FPropertyNode::GetDefaultValueAsString()
{
FObjectPropertyNode* ObjectNode = FindObjectItemParent();
FString DefaultValue;
if ( ObjectNode && Property.IsValid() )
{
// Get an iterator for the enclosing objects.
for ( int32 ObjIndex = 0; ObjIndex < ObjectNode->GetNumObjects(); ++ObjIndex )
{
UObject* Object = ObjectNode->GetUObject( ObjIndex );
TSharedPtr<FPropertyItemValueDataTrackerSlate> ValueTracker = GetValueTracker(Object, ObjIndex);
if( Object && ValueTracker.IsValid() )
{
FString NodeDefaultValue = GetDefaultValueAsStringForObject( *ValueTracker, Object, Property.Get() );
if ( DefaultValue.Len() > 0 && NodeDefaultValue.Len() )
{
DefaultValue += TEXT(", ");
}
DefaultValue += NodeDefaultValue;
}
}
}
return DefaultValue;
}
FText FPropertyNode::GetResetToDefaultLabel()
{
FString DefaultValue = GetDefaultValueAsString();
FText OutLabel = GetDisplayName();
if ( DefaultValue.Len() )
{
const int32 MaxValueLen = 60;
if ( DefaultValue.Len() > MaxValueLen )
{
DefaultValue = DefaultValue.Left( MaxValueLen );
DefaultValue += TEXT( "..." );
}
return FText::Format(NSLOCTEXT("FPropertyNode", "ResetToDefaultLabelFmt", "{0}: {1}"), OutLabel, FText::FromString(DefaultValue));
}
return OutLabel;
}
void FPropertyNode::ResetToDefault( FNotifyHook* InNotifyHook )
{
UProperty* TheProperty = GetProperty();
check(TheProperty);
// Get an iterator for the enclosing objects.
FObjectPropertyNode* ObjectNode = FindObjectItemParent();
if( ObjectNode )
{
// The property is a simple field. Compare it against the enclosing object's default for that property.
////////////////
FScopedTransaction Transaction( NSLOCTEXT("UnrealEd", "PropertyWindowEditProperties", "Edit Properties") );
// Whether or not we've process prechange already
bool bNotifiedPreChange = false;
// Whether or not an edit inline new was reset as a result of this reset to default
bool bEditInlineNewWasReset = false;
TArray< TMap<FString, int32> > ArrayIndicesPerObject;
for( int32 ObjIndex = 0; ObjIndex < ObjectNode->GetNumObjects(); ++ObjIndex )
{
TWeakObjectPtr<UObject> ObjectWeakPtr = ObjectNode->GetUObject( ObjIndex );
UObject* Object = ObjectWeakPtr.Get();
// special case for UObject class - it has no defaults
if( Object && Object != UObject::StaticClass() && Object != UObject::StaticClass()->GetDefaultObject() )
{
TSharedPtr<FPropertyItemValueDataTrackerSlate> ValueTrackerPtr = GetValueTracker(Object, ObjIndex);
if( ValueTrackerPtr.IsValid() && ValueTrackerPtr->IsValidTracker() && ValueTrackerPtr->HasDefaultValue() )
{
FPropertyItemValueDataTrackerSlate& ValueTracker = *ValueTrackerPtr;
bool bIsGameWorld = false;
// If the object we are modifying is in the PIE world, than make the PIE world the active
// GWorld. Assumes all objects managed by this property window belong to the same world.
UWorld* OldGWorld = NULL;
if ( GUnrealEd && GUnrealEd->PlayWorld && !GUnrealEd->bIsSimulatingInEditor && Object->IsIn(GUnrealEd->PlayWorld))
{
OldGWorld = SetPlayInEditorWorld(GUnrealEd->PlayWorld);
bIsGameWorld = true;
}
if( !bNotifiedPreChange )
{
// Call preedit change on all the objects
NotifyPreChange( GetProperty(), InNotifyHook );
bNotifiedPreChange = true;
}
// Cache the value of the property before modifying it.
FString PreviousValue;
TheProperty->ExportText_Direct(PreviousValue, ValueTracker.GetPropertyValueAddress(), ValueTracker.GetPropertyValueAddress(), NULL, 0);
FString PreviousArrayValue;
if( ValueTracker.GetPropertyDefaultAddress() != NULL )
{
UObject* RootObject = ValueTracker.GetTopLevelObject();
FPropertyItemComponentCollector ComponentCollector(ValueTracker);
// dynamic arrays are the only property type that do not support CopySingleValue correctly due to the fact that they cannot
// be used in a static array
FPropertyNode* ParentPropertyNode = GetParentNode();
if(ParentPropertyNode != NULL && ParentPropertyNode->GetProperty() && ParentPropertyNode->GetProperty()->IsA(UArrayProperty::StaticClass()))
{
UArrayProperty* ArrayProp = Cast<UArrayProperty>(ParentPropertyNode->GetProperty());
if(ArrayProp->Inner == TheProperty)
{
uint8* Addr = ParentPropertyNode->GetValueBaseAddress((uint8*)Object);
ArrayProp->ExportText_Direct(PreviousArrayValue, Addr, Addr, NULL, 0);
}
}
UArrayProperty* ArrayProp = Cast<UArrayProperty>(TheProperty);
if( ArrayProp != NULL )
{
TheProperty->CopyCompleteValue(ValueTracker.GetPropertyValueAddress(), ValueTracker.GetPropertyDefaultAddress());
}
else
{
if( GetArrayIndex() == INDEX_NONE && TheProperty->ArrayDim > 1 )
{
TheProperty->CopyCompleteValue(ValueTracker.GetPropertyValueAddress(), ValueTracker.GetPropertyDefaultAddress());
}
else
{
TheProperty->CopySingleValue(ValueTracker.GetPropertyValueAddress(), ValueTracker.GetPropertyDefaultAddress());
}
}
if( ComponentCollector.Components.Num() > 0 )
{
TMap<UObject*,UObject*> ReplaceMap;
FPropertyItemComponentCollector DefaultComponentCollector(ValueTracker);
for ( int32 CompIndex = 0; CompIndex < ComponentCollector.Components.Num(); CompIndex++ )
{
UObject* Component = ComponentCollector.Components[CompIndex];
if (Component != NULL)
{
if ( DefaultComponentCollector.Components.Contains(Component->GetArchetype()) )
{
ReplaceMap.Add(Component, Component->GetArchetype());
}
else if( DefaultComponentCollector.Components.IsValidIndex(CompIndex) )
{
ReplaceMap.Add(Component, DefaultComponentCollector.Components[CompIndex]);
}
}
}
FArchiveReplaceObjectRef<UObject> ReplaceAr(RootObject, ReplaceMap, false, true, true);
FObjectInstancingGraph InstanceGraph(RootObject);
TArray<UObject*> Subobjects;
FReferenceFinder Collector(
Subobjects, // InObjectArray
RootObject, // LimitOuter
false, // bRequireDirectOuter
true, // bIgnoreArchetypes
true, // bSerializeRecursively
false // bShouldIgnoreTransient
);
Collector.FindReferences( RootObject );
for( UObject* SubObj : Subobjects )
{
InstanceGraph.AddNewInstance(SubObj);
}
RootObject->InstanceSubobjectTemplates(&InstanceGraph);
}
bEditInlineNewWasReset = ComponentCollector.bContainsEditInlineNew;
}
else
{
TheProperty->ClearValue(ValueTracker.GetPropertyValueAddress());
}
// Cache the value of the property after having modified it.
FString ValueAfterImport;
Property->ExportText_Direct(ValueAfterImport, ValueTracker.GetPropertyValueAddress(), ValueTracker.GetPropertyValueAddress(), NULL, 0);
if((Object->HasAnyFlags(RF_ClassDefaultObject | RF_ArchetypeObject) ||
(Object->HasAnyFlags(RF_DefaultSubObject) && Object->GetOuter()->HasAnyFlags(RF_ClassDefaultObject | RF_ArchetypeObject))) &&
!bIsGameWorld)
{
PropagatePropertyChange(Object, *ValueAfterImport, PreviousArrayValue.IsEmpty() ? PreviousValue : PreviousArrayValue);
}
if(OldGWorld)
{
// restore the original (editor) GWorld
RestoreEditorWorld( OldGWorld );
}
ArrayIndicesPerObject.Add(TMap<FString, int32>());
FPropertyValueImpl::GenerateArrayIndexMapToObjectNode(ArrayIndicesPerObject[ObjIndex], this);
}
}
}
if( bNotifiedPreChange )
{
// Call PostEditchange on all the objects
// Assume reset to default, can change topology
FPropertyChangedEvent ChangeEvent( TheProperty, EPropertyChangeType::ValueSet );
ChangeEvent.SetArrayIndexPerObject(ArrayIndicesPerObject);
NotifyPostChange( ChangeEvent, InNotifyHook );
}
if( bEditInlineNewWasReset )
{
RequestRebuildChildren();
}
}
}
/**
* Helper function to obtain the display name for an enum property
* @param InEnum The enum whose metadata to pull from
* @param DisplayName The name of the enum value to adjust
*
* @return true if the DisplayName has been changed
*/
bool FPropertyNode::AdjustEnumPropDisplayName( UEnum *InEnum, FString& DisplayName ) const
{
// see if we have alternate text to use for displaying the value
UMetaData* PackageMetaData = InEnum->GetOutermost()->GetMetaData();
if ( PackageMetaData )
{
FName AltDisplayName = FName(*(DisplayName+TEXT(".DisplayName")));
FString ValueText = PackageMetaData->GetValue(InEnum, AltDisplayName);
if ( ValueText.Len() > 0 )
{
// use the alternate text for this enum value
DisplayName = ValueText;
return true;
}
}
//DisplayName has been unmodified
return false;
}
/**Walks up the hierachy and return true if any parent node is a favorite*/
bool FPropertyNode::IsChildOfFavorite (void) const
{
for (const FPropertyNode* TestParentNode = GetParentNode(); TestParentNode != NULL; TestParentNode = TestParentNode->GetParentNode())
{
if (TestParentNode->HasNodeFlags(EPropertyNodeFlags::IsFavorite))
{
return true;
}
}
return false;
}
/**
* Destroys all node within the hierarchy
*/
void FPropertyNode::DestroyTree(const bool bInDestroySelf)
{
ChildNodes.Empty();
}
/**
* Marks windows as visible based on the filter strings (EVEN IF normally NOT EXPANDED)
*/
void FPropertyNode::FilterNodes( const TArray<FString>& InFilterStrings, const bool bParentSeenDueToFiltering )
{
//clear flags first. Default to hidden
SetNodeFlags(EPropertyNodeFlags::IsSeenDueToFiltering | EPropertyNodeFlags::IsSeenDueToChildFiltering | EPropertyNodeFlags::IsParentSeenDueToFiltering, false);
SetNodeFlags(EPropertyNodeFlags::IsBeingFiltered, InFilterStrings.Num() > 0 );
//FObjectPropertyNode* ParentPropertyNode = FindObjectItemParent();
//@todo slate property window
bool bMultiObjectOnlyShowDiffering = false;/*TopPropertyWindow->HasFlags(EPropertyWindowFlags::ShowOnlyDifferingItems) && (ParentPropertyNode->GetNumObjects()>1)*/;
if (InFilterStrings.Num() > 0 /*|| (TopPropertyWindow->HasFlags(EPropertyWindowFlags::ShowOnlyModifiedItems)*/ || bMultiObjectOnlyShowDiffering)
{
//if filtering, default to NOT-seen
bool bPassedFilter = false; //assuming that we aren't filtered
//see if this is a filter-able primitive
FText DisplayName = GetDisplayName();
const FString& DisplayNameStr = DisplayName.ToString();
TArray <FString> AcceptableNames;
AcceptableNames.Add(DisplayNameStr);
//get the basic name as well of the property
UProperty* TheProperty = GetProperty();
if (TheProperty && (TheProperty->GetName() != DisplayNameStr))
{
AcceptableNames.Add(TheProperty->GetName());
}
bPassedFilter = IsFilterAcceptable(AcceptableNames, InFilterStrings);
if (bPassedFilter)
{
SetNodeFlags(EPropertyNodeFlags::IsSeenDueToFiltering, true);
}
SetNodeFlags(EPropertyNodeFlags::IsParentSeenDueToFiltering, bParentSeenDueToFiltering);
}
else
{
//indicating that this node should not be force displayed, but opened normally
SetNodeFlags(EPropertyNodeFlags::IsParentSeenDueToFiltering, true);
}
//default to doing only one pass
//bool bCategoryOrObject = (GetObjectNode()) || (GetCategoryNode()!=NULL);
int32 StartRecusionPass = HasNodeFlags(EPropertyNodeFlags::IsSeenDueToFiltering) ? 1 : 0;
//Pass 1, if a pass 1 exists (object or category), is to see if there are any children that pass the filter, if any do, trim the tree to the leaves.
// This will stop categories from showing ALL properties if they pass the filter AND a child passes the filter
//Pass 0, if no child exists that passes the filter OR this node didn't pass the filter
for (int32 RecursionPass = StartRecusionPass; RecursionPass >= 0; --RecursionPass)
{
for (int32 scan = 0; scan < ChildNodes.Num(); ++scan)
{
TSharedPtr<FPropertyNode>& ScanNode = ChildNodes[scan];
check(ScanNode.IsValid());
//default to telling the children this node is NOT visible, therefore if not in the base pass, only filtered nodes will survive the filtering process.
bool bChildParamParentVisible = false;
//if we're at the base pass, tell the children the truth about visibility
if (RecursionPass == 0)
{
bChildParamParentVisible = bParentSeenDueToFiltering || HasNodeFlags(EPropertyNodeFlags::IsSeenDueToFiltering);
}
ScanNode->FilterNodes(InFilterStrings, bChildParamParentVisible);
if (ScanNode->HasNodeFlags(EPropertyNodeFlags::IsSeenDueToFiltering | EPropertyNodeFlags::IsSeenDueToChildFiltering))
{
SetNodeFlags(EPropertyNodeFlags::IsSeenDueToChildFiltering, true);
}
}
//now that we've tried a pass at our children, if any of them have been successfully seen due to filtering, just quit now
if (HasNodeFlags(EPropertyNodeFlags::IsSeenDueToChildFiltering))
{
break;
}
}
}
void FPropertyNode::ProcessSeenFlags(const bool bParentAllowsVisible )
{
// Set initial state first
SetNodeFlags(EPropertyNodeFlags::IsSeen, false);
SetNodeFlags(EPropertyNodeFlags::IsSeenDueToChildFavorite, false );
bool bAllowChildrenVisible;
if ( AsObjectNode() )
{
bAllowChildrenVisible = true;
}
else
{
//can't show children unless they are seen due to child filtering
bAllowChildrenVisible = !!HasNodeFlags(EPropertyNodeFlags::IsSeenDueToChildFiltering);
}
//process children
for (int32 scan = 0; scan < ChildNodes.Num(); ++scan)
{
TSharedPtr<FPropertyNode>& ScanNode = ChildNodes[scan];
check(ScanNode.IsValid());
ScanNode->ProcessSeenFlags(bParentAllowsVisible && bAllowChildrenVisible ); //both parent AND myself have to allow children
}
if (HasNodeFlags(EPropertyNodeFlags::IsSeenDueToFiltering | EPropertyNodeFlags::IsSeenDueToChildFiltering))
{
SetNodeFlags(EPropertyNodeFlags::IsSeen, true);
}
else
{
//Finally, apply the REAL IsSeen
SetNodeFlags(EPropertyNodeFlags::IsSeen, bParentAllowsVisible && HasNodeFlags(EPropertyNodeFlags::IsParentSeenDueToFiltering));
}
}
/**
* Marks windows as visible based their favorites status
*/
void FPropertyNode::ProcessSeenFlagsForFavorites(void)
{
if( !HasNodeFlags(EPropertyNodeFlags::IsFavorite) )
{
bool bAnyChildFavorites = false;
//process children
for (int32 scan = 0; scan < ChildNodes.Num(); ++scan)
{
TSharedPtr<FPropertyNode>& ScanNode = ChildNodes[scan];
check(ScanNode.IsValid());
ScanNode->ProcessSeenFlagsForFavorites();
bAnyChildFavorites = bAnyChildFavorites || ScanNode->HasNodeFlags(EPropertyNodeFlags::IsFavorite | EPropertyNodeFlags::IsSeenDueToChildFavorite);
}
if (bAnyChildFavorites)
{
SetNodeFlags(EPropertyNodeFlags::IsSeenDueToChildFavorite, true);
}
}
}
void FPropertyNode::NotifyPreChange( UProperty* PropertyAboutToChange, FNotifyHook* InNotifyHook )
{
TSharedRef<FEditPropertyChain> PropertyChain = BuildPropertyChain( PropertyAboutToChange );
// Call through to the property window's notify hook.
if( InNotifyHook )
{
if ( PropertyChain->Num() == 0 )
{
InNotifyHook->NotifyPreChange( PropertyAboutToChange );
}
else
{
InNotifyHook->NotifyPreChange( &PropertyChain.Get() );
}
}
FObjectPropertyNode* ObjectNode = FindObjectItemParent();
if( ObjectNode )
{
UProperty* CurProperty = PropertyAboutToChange;
// Call PreEditChange on the object chain.
while ( true )
{
for( TPropObjectIterator Itor( ObjectNode->ObjectIterator() ) ; Itor ; ++Itor )
{
UObject* Object = Itor->Get();
if ( ensure( Object ) && PropertyChain->Num() == 0 )
{
Object->PreEditChange( Property.Get() );
}
else if( ensure( Object ) )
{
Object->PreEditChange( *PropertyChain );
}
}
// Pass this property to the parent's PreEditChange call.
CurProperty = ObjectNode->GetStoredProperty();
FObjectPropertyNode* PreviousObjectNode = ObjectNode;
// Traverse up a level in the nested object tree.
ObjectNode = NotifyFindObjectItemParent( ObjectNode );
if ( !ObjectNode )
{
// We've hit the root -- break.
break;
}
else if ( PropertyChain->Num() > 0 )
{
PropertyChain->SetActivePropertyNode( CurProperty->GetOwnerProperty() );
for ( FPropertyNode* BaseItem = PreviousObjectNode; BaseItem && BaseItem != ObjectNode; BaseItem = BaseItem->GetParentNode())
{
UProperty* ItemProperty = BaseItem->GetProperty();
if ( ItemProperty == NULL )
{
// if this property item doesn't have a Property, skip it...it may be a category item or the virtual
// item used as the root for an inline object
continue;
}
// skip over property window items that correspond to a single element in a static array, or
// the inner property of another UProperty (e.g. UArrayProperty->Inner)
if ( BaseItem->ArrayIndex == INDEX_NONE && ItemProperty->GetOwnerProperty() == ItemProperty )
{
PropertyChain->SetActiveMemberPropertyNode(ItemProperty);
}
}
}
}
}
}
void FPropertyNode::NotifyPostChange( FPropertyChangedEvent& InPropertyChangedEvent, class FNotifyHook* InNotifyHook )
{
TSharedRef<FEditPropertyChain> PropertyChain = BuildPropertyChain( InPropertyChangedEvent.Property );
// remember the property that was the chain's original active property; this will correspond to the outermost property of struct/array that was modified
UProperty* const OriginalActiveProperty = PropertyChain->GetActiveMemberNode()->GetValue();
FObjectPropertyNode* ObjectNode = FindObjectItemParent();
if( ObjectNode )
{
ObjectNode->InvalidateCachedState();
UProperty* CurProperty = InPropertyChangedEvent.Property;
// Fire ULevel::LevelDirtiedEvent when falling out of scope.
FScopedLevelDirtied LevelDirtyCallback;
// Call PostEditChange on the object chain.
while ( true )
{
int32 CurrentObjectIndex = 0;
for( TPropObjectIterator Itor( ObjectNode->ObjectIterator() ) ; Itor ; ++Itor )
{
UObject* Object = Itor->Get();
if ( PropertyChain->Num() == 0 )
{
//copy
FPropertyChangedEvent ChangedEvent = InPropertyChangedEvent;
if (CurProperty != InPropertyChangedEvent.Property)
{
//parent object node property. Reset other internals and leave the event type as unspecified
ChangedEvent = FPropertyChangedEvent(CurProperty, InPropertyChangedEvent.ChangeType);
}
ChangedEvent.ObjectIteratorIndex = CurrentObjectIndex;
if( Object )
{
Object->PostEditChangeProperty( ChangedEvent );
}
}
else
{
FPropertyChangedEvent ChangedEvent = InPropertyChangedEvent;
if (CurProperty != InPropertyChangedEvent.Property)
{
//parent object node property. Reset other internals and leave the event type as unspecified
ChangedEvent = FPropertyChangedEvent(CurProperty, InPropertyChangedEvent.ChangeType);
}
FPropertyChangedChainEvent ChainEvent(*PropertyChain, ChangedEvent);
ChainEvent.ObjectIteratorIndex = CurrentObjectIndex;
if( Object )
{
Object->PostEditChangeChainProperty(ChainEvent);
}
}
LevelDirtyCallback.Request();
++CurrentObjectIndex;
}
// Pass this property to the parent's PostEditChange call.
CurProperty = ObjectNode->GetStoredProperty();
FObjectPropertyNode* PreviousObjectNode = ObjectNode;
// Traverse up a level in the nested object tree.
ObjectNode = NotifyFindObjectItemParent( ObjectNode );
if ( !ObjectNode )
{
// We've hit the root -- break.
break;
}
else if ( PropertyChain->Num() > 0 )
{
PropertyChain->SetActivePropertyNode(CurProperty->GetOwnerProperty());
for ( FPropertyNode* BaseItem = PreviousObjectNode; BaseItem && BaseItem != ObjectNode; BaseItem = BaseItem->GetParentNode())
{
UProperty* ItemProperty = BaseItem->GetProperty();
if ( ItemProperty == NULL )
{
// if this property item doesn't have a Property, skip it...it may be a category item or the virtual
// item used as the root for an inline object
continue;
}
// skip over property window items that correspond to a single element in a static array, or
// the inner property of another UProperty (e.g. UArrayProperty->Inner)
if ( BaseItem->GetArrayIndex() == INDEX_NONE && ItemProperty->GetOwnerProperty() == ItemProperty )
{
PropertyChain->SetActiveMemberPropertyNode(ItemProperty);
}
}
}
}
}
// Broadcast the change to any listeners
BroadcastPropertyChangedDelegates();
// Call through to the property window's notify hook.
if( InNotifyHook )
{
if ( PropertyChain->Num() == 0 )
{
InNotifyHook->NotifyPostChange( InPropertyChangedEvent, InPropertyChangedEvent.Property );
}
else
{
PropertyChain->SetActiveMemberPropertyNode( OriginalActiveProperty );
PropertyChain->SetActivePropertyNode( InPropertyChangedEvent.Property);
InNotifyHook->NotifyPostChange( InPropertyChangedEvent, &PropertyChain.Get() );
}
}
if( ObjectNode && OriginalActiveProperty )
{
//if i have metadata forcing other property windows to rebuild
FString MetaData = OriginalActiveProperty->GetMetaData(TEXT("ForceRebuildProperty"));
if( MetaData.Len() > 0 )
{
// We need to find the property node beginning at the root/parent, not at our own node.
ObjectNode = FindObjectItemParent();
check(ObjectNode != NULL);
TSharedPtr<FPropertyNode> ForceRebuildNode = ObjectNode->FindChildPropertyNode( FName(*MetaData), true );
if( ForceRebuildNode.IsValid() )
{
ForceRebuildNode->RequestRebuildChildren();
}
}
}
// The value has changed so the cached value could be invalid
// Need to recurse here as we might be editing a struct with child properties that need re-caching
ClearCachedReadAddresses(true);
}
void FPropertyNode::BroadcastPropertyChangedDelegates()
{
PropertyValueChangedEvent.Broadcast();
// Walk through the parents and broadcast
FPropertyNode* LocalParentNode = GetParentNode();
while( LocalParentNode )
{
if( LocalParentNode->OnChildPropertyValueChanged().IsBound() )
{
LocalParentNode->OnChildPropertyValueChanged().Broadcast();
}
LocalParentNode = LocalParentNode->GetParentNode();
}
}
void FPropertyNode::SetOnRebuildChildren( FSimpleDelegate InOnRebuildChildren )
{
OnRebuildChildren = InOnRebuildChildren;
}
TSharedPtr< FPropertyItemValueDataTrackerSlate > FPropertyNode::GetValueTracker( UObject* Object, uint32 ObjIndex )
{
ensure( AsItemPropertyNode() );
TSharedPtr< FPropertyItemValueDataTrackerSlate > RetVal;
if( Object && Object != UObject::StaticClass() && Object != UObject::StaticClass()->GetDefaultObject() )
{
if( !ObjectDefaultValueTrackers.IsValidIndex(ObjIndex) )
{
uint32 NumToAdd = (ObjIndex - ObjectDefaultValueTrackers.Num()) + 1;
while( NumToAdd > 0 )
{
ObjectDefaultValueTrackers.Add( TSharedPtr<FPropertyItemValueDataTrackerSlate> () );
--NumToAdd;
}
}
TSharedPtr<FPropertyItemValueDataTrackerSlate>& ValueTracker = ObjectDefaultValueTrackers[ObjIndex];
if( !ValueTracker.IsValid() )
{
ValueTracker = MakeShareable( new FPropertyItemValueDataTrackerSlate( this, Object ) );
}
else
{
ValueTracker->Reset(this, Object);
}
RetVal = ValueTracker;
}
return RetVal;
}
TSharedRef<FEditPropertyChain> FPropertyNode::BuildPropertyChain( UProperty* InProperty )
{
TSharedRef<FEditPropertyChain> PropertyChain( MakeShareable( new FEditPropertyChain ) );
FPropertyNode* ItemNode = this;
FComplexPropertyNode* ComplexNode = FindComplexParent();
UProperty* MemberProperty = InProperty;
do
{
if (ItemNode == ComplexNode)
{
MemberProperty = PropertyChain->GetHead()->GetValue();
}
UProperty* TheProperty = ItemNode->GetProperty();
if ( TheProperty )
{
// Skip over property window items that correspond to a single element in a static array,
// or the inner property of another UProperty (e.g. UArrayProperty->Inner).
if ( ItemNode->GetArrayIndex() == INDEX_NONE && TheProperty->GetOwnerProperty() == TheProperty )
{
PropertyChain->AddHead( TheProperty );
}
}
ItemNode = ItemNode->GetParentNode();
}
while( ItemNode != NULL );
// If the modified property was a property of the object at the root of this property window, the member property will not have been set correctly
if (ItemNode == ComplexNode)
{
MemberProperty = PropertyChain->GetHead()->GetValue();
}
PropertyChain->SetActivePropertyNode( InProperty );
PropertyChain->SetActiveMemberPropertyNode( MemberProperty );
return PropertyChain;
}
FPropertyChangedEvent& FPropertyNode::FixPropertiesInEvent(FPropertyChangedEvent& Event)
{
ensure(Event.Property);
auto PropertyChain = BuildPropertyChain(Event.Property);
auto MemberProperty = PropertyChain->GetActiveMemberNode() ? PropertyChain->GetActiveMemberNode()->GetValue() : NULL;
if (ensure(MemberProperty))
{
Event.SetActiveMemberProperty(MemberProperty);
}
return Event;
}
void FPropertyNode::SetInstanceMetaData(const FName& Key, const FString& Value)
{
InstanceMetaData.Add(Key, Value);
}
const FString* FPropertyNode::GetInstanceMetaData(const FName& Key) const
{
return InstanceMetaData.Find(Key);
}
void FPropertyNode::InvalidateCachedState()
{
bUpdateDiffersFromDefault = true;
bUpdateEditConstState = true;
for( TSharedPtr<FPropertyNode>& ChildNode : ChildNodes )
{
ChildNode->InvalidateCachedState();
}
}
/**
* Does the string compares to ensure this Name is acceptable to the filter that is passed in
* @return Return True if this property should be displayed. False if it should be culled
*/
bool FPropertyNode::IsFilterAcceptable(const TArray<FString>& InAcceptableNames, const TArray<FString>& InFilterStrings)
{
bool bCompleteMatchFound = true;
if (InFilterStrings.Num())
{
//we have to make sure one name matches all criteria
for (int32 TestNameIndex = 0; TestNameIndex < InAcceptableNames.Num(); ++TestNameIndex)
{
bCompleteMatchFound = true;
FString TestName = InAcceptableNames[TestNameIndex];
for (int32 scan = 0; scan < InFilterStrings.Num(); scan++)
{
if (!TestName.Contains(InFilterStrings[scan]))
{
bCompleteMatchFound = false;
break;
}
}
if (bCompleteMatchFound)
{
break;
}
}
}
return bCompleteMatchFound;
}
void FPropertyNode::AdditionalInitializationUDS(UProperty* Property, uint8* RawPtr)
{
if (const UStructProperty* StructProperty = Cast<const UStructProperty>(Property))
{
if (!FStructureEditorUtils::Fill_MakeStructureDefaultValue(Cast<const UUserDefinedStruct>(StructProperty->Struct), RawPtr))
{
UE_LOG(LogPropertyNode, Warning, TEXT("MakeStructureDefaultValue parsing error. Property: %s "), *StructProperty->GetPathName());
}
}
}
void FPropertyNode::PropagateArrayPropertyChange( UObject* ModifiedObject, const FString& OriginalArrayContent, EPropertyArrayChangeType::Type ChangeType, int32 Index )
{
UProperty* NodeProperty = GetProperty();
UArrayProperty* ArrayProperty = NULL;
FPropertyNode* ParentPropertyNode = GetParentNode();
if (ChangeType == EPropertyArrayChangeType::Add || ChangeType == EPropertyArrayChangeType::Clear)
{
ArrayProperty = CastChecked<UArrayProperty>(NodeProperty);
}
else
{
ArrayProperty = CastChecked<UArrayProperty>(NodeProperty->GetOuter());
}
TArray<UObject*> ArchetypeInstances, ObjectsToChange;
FPropertyNode* SubobjectPropertyNode = NULL;
UObject* Object = ModifiedObject;
if (Object->HasAnyFlags(RF_ClassDefaultObject|RF_ArchetypeObject))
{
// Object is a default suobject, collect all instances.
Object->GetArchetypeInstances(ArchetypeInstances);
}
else if (Object->HasAnyFlags(RF_DefaultSubObject) && Object->GetOuter()->HasAnyFlags(RF_ClassDefaultObject|RF_ArchetypeObject))
{
// Object is a default subobject of a default object. Get the subobject property node and use its owner instead.
for (SubobjectPropertyNode = FindObjectItemParent(); SubobjectPropertyNode && !SubobjectPropertyNode->GetProperty(); SubobjectPropertyNode = SubobjectPropertyNode->GetParentNode());
if (SubobjectPropertyNode != NULL)
{
// Switch the object to the owner default object and collect its instances.
Object = Object->GetOuter();
Object->GetArchetypeInstances(ArchetypeInstances);
}
}
ObjectsToChange.Push(Object);
while (ObjectsToChange.Num() > 0)
{
check(ObjectsToChange.Num() > 0);
// Pop the first object to change
UObject* ObjToChange = ObjectsToChange[0];
UObject* ActualObjToChange = NULL;
ObjectsToChange.RemoveAt(0);
if (SubobjectPropertyNode)
{
// If the original object is a subobject, get the current object's subobject too.
// In this case we're not going to modify ObjToChange but its default subobject.
ActualObjToChange = *(UObject**)SubobjectPropertyNode->GetValueBaseAddress((uint8*)ObjToChange);
}
else
{
ActualObjToChange = ObjToChange;
}
if (ActualObjToChange != ModifiedObject)
{
uint8* Addr = NULL;
if (ChangeType == EPropertyArrayChangeType::Add || ChangeType == EPropertyArrayChangeType::Clear)
{
Addr = GetValueBaseAddress((uint8*)ActualObjToChange);
}
else
{
Addr = ParentPropertyNode->GetValueBaseAddress((uint8*)ActualObjToChange);
}
if (Addr != NULL)
{
FScriptArrayHelper ArrayHelper(ArrayProperty, Addr);
FString ArrayContent;
ArrayProperty->ExportText_Direct(ArrayContent, Addr, Addr, NULL, PPF_Localized);
bool bIsDefault = ArrayContent == OriginalArrayContent;
// Check if the original value was the default value and change it only then
if (bIsDefault)
{
int32 ElementToInitialize = -1;
switch (ChangeType)
{
case EPropertyArrayChangeType::Add:
ElementToInitialize = ArrayHelper.AddValue();
break;
case EPropertyArrayChangeType::Clear:
ArrayHelper.EmptyValues();
break;
case EPropertyArrayChangeType::Insert:
ArrayHelper.InsertValues(ArrayIndex, 1);
ElementToInitialize = ArrayIndex;
break;
case EPropertyArrayChangeType::Delete:
ArrayHelper.RemoveValues(ArrayIndex, 1);
break;
case EPropertyArrayChangeType::Duplicate:
ArrayHelper.InsertValues(ArrayIndex, 1);
// Copy the selected item's value to the new item.
NodeProperty->CopyCompleteValue(ArrayHelper.GetRawPtr(ArrayIndex), ArrayHelper.GetRawPtr(ArrayIndex + 1));
Object->InstanceSubobjectTemplates();
break;
}
if (ElementToInitialize >= 0)
{
AdditionalInitializationUDS(ArrayProperty->Inner, ArrayHelper.GetRawPtr(ElementToInitialize));
}
}
}
}
for (int32 i=0; i < ArchetypeInstances.Num(); ++i)
{
UObject* Obj = ArchetypeInstances[i];
if (Obj->GetArchetype() == ObjToChange)
{
ObjectsToChange.Push(Obj);
ArchetypeInstances.RemoveAt(i--);
}
}
}
}
void FPropertyNode::PropagatePropertyChange( UObject* ModifiedObject, const TCHAR* NewValue, const FString& PreviousValue )
{
TArray<UObject*> ArchetypeInstances, ObjectsToChange;
FPropertyNode* SubobjectPropertyNode = NULL;
UObject* Object = ModifiedObject;
if (Object->HasAnyFlags(RF_ClassDefaultObject|RF_ArchetypeObject))
{
// Object is a default subobject, collect all instances.
Object->GetArchetypeInstances(ArchetypeInstances);
}
else if (Object->HasAnyFlags(RF_DefaultSubObject) && Object->GetOuter()->HasAnyFlags(RF_ClassDefaultObject|RF_ArchetypeObject))
{
// Object is a default subobject of a default object. Get the subobject property node and use its owner instead.
for (SubobjectPropertyNode = FindObjectItemParent(); SubobjectPropertyNode && !SubobjectPropertyNode->GetProperty(); SubobjectPropertyNode = SubobjectPropertyNode->GetParentNode());
if (SubobjectPropertyNode != NULL)
{
// Switch the object to the owner default object and collect its instances.
Object = Object->GetOuter();
Object->GetArchetypeInstances(ArchetypeInstances);
}
}
static FName FNAME_EditableWhenInherited = GET_MEMBER_NAME_CHECKED(UActorComponent,bEditableWhenInherited);
if (GetProperty()->GetFName() == FNAME_EditableWhenInherited && ModifiedObject->IsA<UActorComponent>() && FString(TEXT("False")) == NewValue)
{
FBlueprintEditorUtils::HandleDisableEditableWhenInherited(ModifiedObject, ArchetypeInstances);
}
FPropertyNode* Parent = GetParentNode();
UProperty* ParentProp = Parent->GetProperty();
UArrayProperty* ParentArrayProp = Cast<UArrayProperty>(ParentProp);
UProperty* Prop = GetProperty();
UMapProperty* MapProp = Cast<UMapProperty>(Prop);
USetProperty* SetProp = Cast<USetProperty>(Prop);
if (ParentArrayProp != nullptr && ParentArrayProp->Inner != Prop)
{
ParentArrayProp = nullptr;
}
ObjectsToChange.Push(Object);
while (ObjectsToChange.Num() > 0)
{
check(ObjectsToChange.Num() > 0);
// Pop the first object to change
UObject* ObjToChange = ObjectsToChange[0];
UObject* ActualObjToChange = NULL;
ObjectsToChange.RemoveAt(0);
if (SubobjectPropertyNode)
{
// If the original object is a subobject, get the current object's subobject too.
// In this case we're not going to modify ObjToChange but its default subobject.
ActualObjToChange = *(UObject**)SubobjectPropertyNode->GetValueBaseAddress((uint8*)ObjToChange);
}
else
{
ActualObjToChange = ObjToChange;
}
if (ActualObjToChange != ModifiedObject)
{
FString OrgValue;
uint8* Addr = GetValueBaseAddress( (uint8*)ActualObjToChange );
if (Addr != nullptr)
{
if (MapProp != nullptr)
{
// Read previous value back into object
uint8* PreviousMap = (uint8*)FMemory::Malloc(MapProp->GetSize(), MapProp->GetMinAlignment());
ON_SCOPE_EXIT
{
FMemory::Free(PreviousMap);
};
MapProp->InitializeValue(PreviousMap);
ON_SCOPE_EXIT
{
MapProp->DestroyValue(PreviousMap);
};
MapProp->ImportText(*PreviousValue, PreviousMap, PPF_Localized, ModifiedObject);
uint8* ModifiedObjectAddr = GetValueBaseAddress( (uint8*)ModifiedObject );
auto ModifiedObjectAddrPtr = (TMap<int32, FString>*)ModifiedObjectAddr;
// Serialize differences from the 'default' (the old object)
TArray<uint8> Data;
{
FMemoryWriter Ar(Data);
MapProp->SerializeItem(Ar, Addr, PreviousMap);
}
// Deserialize differences back over the new object
{
FMemoryReader Ar(Data);
MapProp->SerializeItem(Ar, Addr, ModifiedObjectAddr);
}
}
else if (SetProp != nullptr)
{
// Read previous value back into object
uint8* PreviousSet = (uint8*)FMemory::Malloc(SetProp->GetSize(), SetProp->GetMinAlignment());
ON_SCOPE_EXIT
{
FMemory::Free(PreviousSet);
};
SetProp->InitializeValue(PreviousSet);
ON_SCOPE_EXIT
{
SetProp->DestroyValue(PreviousSet);
};
SetProp->ImportText(*PreviousValue, PreviousSet, PPF_Localized, ModifiedObject);
uint8* ModifiedObjectAddr = GetValueBaseAddress( (uint8*)ModifiedObject );
auto ModifiedObjectAddrPtr = (TMap<int32, FString>*)ModifiedObjectAddr;
// Serialize differences from the 'default' (the old object)
TArray<uint8> Data;
{
FMemoryWriter Ar(Data);
SetProp->SerializeItem(Ar, Addr, PreviousSet);
}
// Deserialize differences back over the new object
{
FMemoryReader Ar(Data);
SetProp->SerializeItem(Ar, Addr, ModifiedObjectAddr);
}
}
else
{
if (ParentArrayProp != nullptr)
{
uint8* ArrayAddr = ParentNode->GetValueBaseAddress( (uint8*)ActualObjToChange );
ParentArrayProp->ExportText_Direct(OrgValue, ArrayAddr, ArrayAddr, nullptr, PPF_Localized );
}
else
{
Prop->ExportText_Direct(OrgValue, Addr, Addr, nullptr, PPF_Localized );
}
// Check if the original value was the default value and change it only then
if (OrgValue == PreviousValue)
{
Prop->ImportText( NewValue, Addr, PPF_Localized, ActualObjToChange );
}
}
}
}
for (int32 InstanceIndex = 0; InstanceIndex < ArchetypeInstances.Num(); ++InstanceIndex)
{
UObject* Obj = ArchetypeInstances[InstanceIndex];
if (Obj->GetArchetype() == ObjToChange)
{
ObjectsToChange.Push(Obj);
ArchetypeInstances.RemoveAt(InstanceIndex--);
}
}
}
}
void FPropertyNode::AddRestriction( TSharedRef<const class FPropertyRestriction> Restriction )
{
Restrictions.AddUnique(Restriction);
}
bool FPropertyNode::IsRestricted(const FString& Value) const
{
for( auto It = Restrictions.CreateConstIterator() ; It ; ++It )
{
TSharedRef<const FPropertyRestriction> Restriction = (*It);
if( Restriction->IsValueRestricted(Value) )
{
return true;
}
}
return false;
}
bool FPropertyNode::IsRestricted(const FString& Value, TArray<FText>& OutReasons) const
{
for( auto It = Restrictions.CreateConstIterator() ; It ; ++It )
{
TSharedRef<const FPropertyRestriction> Restriction = (*It);
if( Restriction->IsValueRestricted(Value) )
{
OutReasons.Add(Restriction->GetReason());
}
}
return OutReasons.Num() > 0;
}
bool FPropertyNode::GenerateRestrictionToolTip(const FString& Value, FText& OutTooltip)const
{
static FText ToolTipFormat = NSLOCTEXT("PropertyRestriction", "TooltipFormat ", "{0}{1}");
static FText MultipleRestrictionsToolTopAdditionFormat = NSLOCTEXT("PropertyRestriction", "MultipleRestrictionToolTipAdditionFormat ", "({0} restrictions...)");
TArray<FText> Reasons;
bool bRestricted = IsRestricted(Value,Reasons);
FText Ret;
if( bRestricted && Reasons.Num() > 0 )
{
if( Reasons.Num() > 1 )
{
FText NumberOfRestrictions = FText::AsNumber(Reasons.Num());
OutTooltip = FText::Format(ToolTipFormat, Reasons[0], FText::Format(MultipleRestrictionsToolTopAdditionFormat,NumberOfRestrictions));
}
else
{
OutTooltip = FText::Format(ToolTipFormat, Reasons[0], FText());
}
}
return bRestricted;
}