You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
#lockdown Nick.Penwarden
==========================
MAJOR FEATURES + CHANGES
==========================
Change 3280282 on 2017/01/31 by Matt.Kuhlenschmidt
GitHub 3171 : fix 'memoreport -full' causes ensure condition fail on particle object
Change 3281111 on 2017/02/01 by Michael.Dupuis
#jira UE-36318 : was'nt notifying that we changed the current level in the case where you add/create new level in the Level window
Change 3281225 on 2017/02/01 by Jamie.Dale
Several improvements to culture switching and LocRes files
- LocRes files now de-duplicate translations when they're generated, which can result in smaller LocRes files.
- The localization compilation step now produces a LocNat file, which contains meta-data specifying the native culture during compile, and where the native LocRes file can be found.
- Changing cultures now loads the native localization data prior to loading the non-native translations to ensure that translations are always applied to a consistent base.
- The "leet" culture (available when localization testing is enabled) is now always applied against the native translation, and correctly restores non-translated text when switching away from the "leet" culture.
- "-culture=leet" now works correctly on the command line ("-leet" also works).
- LoadLocalizationResourcesForCulture is no longer called multiple times during initialization of the text localization manager.
- General clean-up of localization code to favor using LocKeyFuncs with maps and sets, rather than rolling their own key funcs.
Change 3281291 on 2017/02/01 by Alexis.Matte
Make sure the sections material slot assignation is persist correctly for staticmesh and for skeletal mesh
#jira UE-39639
Change 3281718 on 2017/02/01 by Michael.Dupuis
#jira UE-34186: invert processing order of special character, to take into account that key name could be considered a special character and would cause the assumption done to no longer be valid
Change 3281861 on 2017/02/01 by Alexis.Matte
Fix import of morph target when there is no animation
#jira UE-41383
Change 3282791 on 2017/02/02 by Chris.Wood
Split crash analytics methods to fix comment parsing issues.
[UE-32787] - Document Crash Report Client analytics events in code
Change 3283316 on 2017/02/02 by Alexis.Matte
Make sure we do not import more then the maximum allowed node
#jira UE-41405
Change 3283349 on 2017/02/02 by Jamie.Dale
Updated Portal to stage its .locnat files
Change 3283927 on 2017/02/02 by Matt.Kuhlenschmidt
Fix component/actor selection becoming out of sync after undo/redo
#jira UE-41416
Change 3284061 on 2017/02/02 by Alexis.Matte
Fix the scene importer front x axis import
#jira UE-41318
Change 3284280 on 2017/02/02 by Alex.Delesky
#jira UE-41060 - Placing blocking volumes in the level via the Content Menu's "Place Actor" command will now place a blocking volume in the level and not generate an empty warning in the output log
Change 3285053 on 2017/02/03 by Michael.Dupuis
#jira UE-33777: Handle the global landscape editor ui command list so specified shortcut will be treated
Change 3285444 on 2017/02/03 by Jamie.Dale
Updated FastDecimalFormat to support the correct 0-9 numerals for the current locale
These are typically still Latin, but Middle Eastern languages have some variants.
This addresses an inconsistency between FText formatting of numbers and dates (since numbers always used Latin, but dates used the culture correct numerals).
Change 3287422 on 2017/02/06 by Michael.Dupuis
#jira UE-36580: Improved the whole word algo to take into consideration localisation
Change 3287455 on 2017/02/06 by Alexis.Matte
When swaping the mesh point by the mesh component, we noe clean up the override material instead of empty it.
#jira UE-41397
Change 3287745 on 2017/02/06 by Alexis.Matte
Merge from orion dev-general cl:3286668
Fix a crash when importing a LOD containing different material with less sections
Change 3287996 on 2017/02/06 by Michael.Dupuis
#jira UE-37290: fixed naming to be "move to level" instead of "move level"
Change 3288090 on 2017/02/06 by Jamie.Dale
Fixing missing include breaking the FText natvis
Change 3288105 on 2017/02/06 by Jamie.Dale
FTextStringHelper::ReadFromString_ComplexText now only looks at the start of the buffer when matching the complex text macros
Change 3288150 on 2017/02/06 by Jamie.Dale
Fixing display names for tutorial categories so that they can be localized
They were already FText, but the config wasn't defining them in a localizable way.
#jira UE-37926
Change 3288469 on 2017/02/06 by Alex.Delesky
#jira UE-35464 - Enables the editor to parse SubRip Subtitles files to create subtitle assets.
This also introduces the Subtitles module.
Change 3288540 on 2017/02/06 by Alex.Delesky
Backing out changelist 3288469 due to build issue with module includes
#jira none
Change 3289074 on 2017/02/06 by Alex.Delesky
Back out changelist 3288540 - reintroducing Subtitles module to parse SubRip Subtitles files
#jira UE-35464
Change 3289753 on 2017/02/07 by Michael.Dupuis
#jira UE-34599: Take into consideration UMaterialExpressionMaterialFunctionCall when getting the GUID
Change 3290097 on 2017/02/07 by Nick.Darnell
Automation - The automation framework no longer buckets errors, warnings and log statements into a seperate set of buckets. There is now only one log, and all entries go into it to provide some context when things fail. Continued working on the styling of the reports.
Change 3290182 on 2017/02/07 by Michael.Trepka
Added missing initialization for SWindow::bIsMirrorWindow
Change 3290472 on 2017/02/07 by Michael.Dupuis
#jira UE-37358: Add reference list in the dialog for all delete type
Change 3290513 on 2017/02/07 by Michael.Dupuis
#jira UE-37958: was testing the trailing number 0 twice and never testing the 1
Change 3290543 on 2017/02/07 by Michael.Dupuis
#jira UE-35931: Refresh detail panel on selection lost
Change 3290581 on 2017/02/07 by Michael.Dupuis
Fixed possible crash if we have no level blueprint specified (was crashing during the delete of an actor)
Change 3290721 on 2017/02/07 by Michael.Dupuis
#jira UE-40360: Pass the custom spawning struct which contain the level override into to the spawn function
Change 3291958 on 2017/02/08 by Alexis.Matte
Back out revision 26 from //UE4/Dev-Editor/Engine/Source/Developer/AssetTools/Private/AssetTools.cpp
Change 3292017 on 2017/02/08 by Alexis.Matte
Add some fbx automation tests to validate material re-import
Change 3292030 on 2017/02/08 by Michael.Dupuis
#jira UE-37958: was testing the trailing number 0 twice and never testing the 1
Change 3293062 on 2017/02/08 by Jamie.Dale
Reduced the number of allocations that happen when rebuilding text
This change removes the wasteful FTextHistory::ToText function and replaces it with two more specialized functions; FTextHistory::BuildLocalizedDisplayString and FTextHistory::BuildInvariantDisplayString.
These new functions return an FString (for the display string), rather than an FText (which was simply mined for its display string). Simply avoiding going via an FText saves at least two allocations per-rebuild.
Changes:
- Removed FTextHistory::ToText and replaced it with FTextHistory::BuildLocalizedDisplayString and FTextHistory::BuildInvariantDisplayString.
- Moved the localization aware chronological and transformation implementations into FTextChronoFormatter and FTextTransformer. These return an FString which avoids an FText allocation during rebuild, and is simply passed into an FText during normal FText usage.
- Moved FText::AsDate, FText::AsDateTime, FText::AsTime, FText::ToUpper, and FText::ToLower into Text.cpp, and these now use FTextChronoFormatter and FTextTransformer from the common text implementation.
- Moved FText::AsTimespan into Text.cpp. This had no dependency on ICU, so this is now the common text implementation.
- Added FTextFormatter::FormatStr variants. FTextFormatter::Format calls these FTextFormatter::FormatStr versions internally, and they're also used during text rebuilding (saving not only an FText allocation, but also a container copy).
- Removed FText::CreateNumericalText and FText::CreateChronologicalText as they were mostly superfluous.
- General update from using MakeShareable to MakeShared (saving 1 allocation).
- General clean-up of L10N/I18N class friendship.
#jira UE-41533
Change 3293292 on 2017/02/08 by Alex.Delesky
Performing some cleanup in the Subtitles module, and creating a SubtitlesEditor module for the subtitles asset factories since it causes issue in client builds.
Change 3293477 on 2017/02/08 by Jamie.Dale
Fixed TProperty::InitializeValueInternal and TProperty::DestroyValueInternal mismatch when dealing with fixed size arrays
#jira UE-41007
Change 3293571 on 2017/02/08 by Matt.Kuhlenschmidt
Fix lots of outline data being added to the font cache due to wrongly hashing outline material and color data.
Change 3293572 on 2017/02/08 by Matt.Kuhlenschmidt
Fix details panel categories in the static mesh editor
Change 3294216 on 2017/02/09 by Michael.Dupuis
#jira UE-40609: manually position the window based on it'S max possible size
#3128 GitHub
Change 3294430 on 2017/02/09 by Jamie.Dale
Kerning-only text shaping no longer draws characters to get their metrics
It now goes via the low-level FT caches like HarfBuzz does.
Change 3294588 on 2017/02/09 by Alexis.Matte
If we remove a LODGroup from baseengine.ini, the fbx importer UI will now be able to recover in case the last fbx import was done with the just removed LODGroup
Change 3294847 on 2017/02/09 by Matt.Kuhlenschmidt
Merging //UE4/Dev-Main to Dev-Editor (//UE4/Dev-Editor)
Change 3295093 on 2017/02/09 by Arciel.Rekman
Linux: fix Setup.sh not working in paths with space (UE-41819).
Change 3295205 on 2017/02/09 by Matt.Kuhlenschmidt
Fix material UV's no longer working om 9 slice elements
Change 3295816 on 2017/02/09 by Arciel.Rekman
Linux: fix starting programs from a path with space.
Change 3296129 on 2017/02/09 by Arciel.Rekman
Linux i686: changes necessary to compile BlankProgram.
- Added new architecture to UBT.
- Fixed system headers.
- Added third party libs for i686:
- jemalloc
- elftoolchain
- zlib
- SDL2
- libc++
Change 3296564 on 2017/02/10 by Jamie.Dale
Cleaned up PO comment preservation
Change 3296694 on 2017/02/10 by Jamie.Dale
AllocateNameEntry now takes TCharType* rather than void* and cast
Change 3296744 on 2017/02/10 by Jamie.Dale
Moved the PO DOM from UnrealEd to Internationalization
Change 3297250 on 2017/02/10 by Jamie.Dale
Split the PO import/export pipeline out of the commandlet
Change 3297420 on 2017/02/10 by Alexis.Matte
Add Isolate and highlight feature for the material panel in the staticmesh and the skeletal editor.
#jira UE-38985
Change 3297594 on 2017/02/10 by Alexis.Matte
When importing from fbx a static mesh with find material anywhere, the next LODs import by the user will create new material entries instead of using the existing one.
Change 3297752 on 2017/02/10 by Arciel.Rekman
i686 support: more third party libs.
- libcurl
- OpenSSL
- libpng
- libvorbis
- libogg
- libopus
Change 3297754 on 2017/02/10 by Arciel.Rekman
i686 support: PhysX
Change 3297922 on 2017/02/10 by Alexis.Matte
When importing a new LOD to a staticmesh, the data source file is not anymore wipe or change to the last fbx import filename.
Change 3298330 on 2017/02/10 by Arciel.Rekman
i686: missing libcurl.
Change 3298620 on 2017/02/11 by Jamie.Dale
FLocTextHelper improvements
- It can now support non-standard target layouts (where the native and foreign cultures are in different locations - see FLocTextTargetPaths).
- The XForeignArchive functions are now more strict, and *only* accept foreign cultures (use the XArchive functions instead if you're using both native and foreign cultures as parameters).
Change 3299293 on 2017/02/13 by Matt.Kuhlenschmidt
PR #3241: UE-41870: Add quotes when passing through the directory path (Contributed by projectgheist)
Change 3299299 on 2017/02/13 by Matt.Kuhlenschmidt
PR #3224: Git plugin: fix git autodetection and add error message (Contributed by SRombauts)
Change 3299391 on 2017/02/13 by Matt.Kuhlenschmidt
Fix material instances being marked dirty when opening
#jira UE-41721, UE-41719
Change 3299441 on 2017/02/13 by Nick.Darnell
PR #3243: Fix bug that UWidget::GetOwningPlayer doesn't return (Contributed by yeonseok-yi)
Change 3299567 on 2017/02/13 by Nick.Darnell
Slate - The Checkbox no longer just passes visibility down to the internal widgets it creates, that prevents future changes to effect it if it starts collapsed.
#jira UE-41904
Change 3299870 on 2017/02/13 by Jamie.Dale
Added cycle counters for font rendering/shaping
Change 3300116 on 2017/02/13 by Michael.Dupuis
#jira UE-41866: Update cache when performing an undo
Change 3300178 on 2017/02/13 by Alexis.Matte
Fix a crash when re-importing a LOD with more sections then the base LOD
Change 3300191 on 2017/02/13 by Alexis.Matte
Make sure we do not loose castshadow and recomputetangents section flags when we re-import a skeletal mesh.
Change 3300351 on 2017/02/13 by Alexis.Matte
Remove the clean up of unused material for the staticmesh editor. Unused material can be delete manually in the UI
#jira UE-39639
Change 3302138 on 2017/02/14 by Nick.Darnell
Automation - Adding support for -DeveloperReportOutputPath and -DeveloperReportUrl to permit local runs of the automation tool to generate reports on the report server, and launch the browser window to view them.
Change 3302139 on 2017/02/14 by Nick.Darnell
UMG - Additional fixes to the way we migrate changes from the preview to the serialized version of the widget tree. This fixes several issues with edit-inline objects on UWidgets.
Change 3302281 on 2017/02/14 by Nick.Darnell
Slate - Bringing over changes to the invalidation panel from one of the game streams. This fixes issues with animations in volatile widgets, as well as some issues with cache relative offset, and offers a method for enabling a different caching method to preserve batching through a commandline, but at the cost of not being able to use GPU buffers, possibly a better option on mobile in some cases.
Change 3302415 on 2017/02/14 by Nick.Darnell
Disabling the open asset editor test.
Change 3302976 on 2017/02/14 by Nick.Darnell
Automation - Updating one of the tests to open 70 different known asset types, and ensure that they open without dirtying the package. AutomationTestSettings are now defaultengine, not sure why they setup to be user specific previously. Most of these settings need to be removed, or split off into the modules that own them, rather than being in Engine. TODO.
Change 3303724 on 2017/02/15 by Matt.Kuhlenschmidt
Removed hard coded list of thumbnails, preventing objects with valid thumbnails from showing up. Thumbnails are now shown by default. Use meta=(DisplayThumbnail=false) to remove
#jira UE-41958
Change 3303729 on 2017/02/15 by Matt.Kuhlenschmidt
PR #3253: UE-34539: (Bugfix) Allow binary files in git stored via git-fat, git-lfs, etc to be diffed (take 2) (Contributed by rpav)
Change 3303733 on 2017/02/15 by Matt.Kuhlenschmidt
PR #3248: Fix for TAssetSubClassOf properties reset on undo. (Contributed by StefanoProsperi)
Change 3303823 on 2017/02/15 by Nick.Darnell
Automation - Continued improvements on screenshots. Added some fixes to turn off the tonemapper when visualizing buffers. Fixed several screenshots due to this change. Adding lightboxes to the reports. Adding some styling to make things sweeter.
Change 3303937 on 2017/02/15 by Matt.Kuhlenschmidt
Fix build error
Change 3303982 on 2017/02/15 by Nick.Darnell
Automation - Making the opening of the image no longer threaded, not really helpful for the IO operation and just makes it harder to follow.
Change 3304058 on 2017/02/15 by Matt.Kuhlenschmidt
Fix build attempt #2 (not reproducible locally)
Change 3304393 on 2017/02/15 by Matt.Barnes
Submitting test content for UEQATC-3548
Change 3304517 on 2017/02/15 by Nick.Darnell
Slate - Making some fixes to the automatic disabling of the pixel snapping code with render transforms. Sometimes it gets confused, we may want to move to a seperate transform stack for layout and render, and make sure the element drawer has access to both.
Change 3304560 on 2017/02/15 by Nick.Darnell
UMG - SA fix.
Change 3304890 on 2017/02/15 by Matt.Kuhlenschmidt
PR #3220: UE-41243: Force resolution in standalone if large than primary workin. (Contributed by projectgheist)
Change 3305360 on 2017/02/15 by Arciel.Rekman
Linux: fix crash on exit (UE-41907).
- It is not safe to dereference UAnimGraphNode_PoseDriver::StaticClass during the final shutdown sequence since the instance has already been destroyed in StaticExit().
Change 3306023 on 2017/02/16 by Nick.Darnell
Paper2D - Adding a method to create SlateBrushes from PaperSprites the same way we can for materials and textures in blueprints.
Change 3306030 on 2017/02/16 by Nick.Darnell
Slate - Making some additional fixes to invalidation panels from a game branch. Adding a RoundToVector function to FVector2D, fixing the 3 places we defined a RoundToInt (which wasn't a great name since the convention wasn't meant to be used that way).
Change 3306031 on 2017/02/16 by Nick.Darnell
Slate - Retainer widgets no longer tick using PreTick on SlateApplication, they now paint during their normal paint.
Change 3306046 on 2017/02/16 by Nick.Darnell
UMG - Adding CanEditChange to WidgetComponent to gray out the CylinderArcAngle property unless you select the right geometry mode.
Change 3308887 on 2017/02/17 by Matt.Kuhlenschmidt
Fix crash if blurs are rotated
#jira UE-42037
Change 3309114 on 2017/02/17 by Jamie.Dale
Unifying non-shaped text to use the same atlas cache as shaped text
Change 3310044 on 2017/02/17 by Matt.Kuhlenschmidt
Outline color on text elements is now inherited properly
#jira UE-40691
Change 3310268 on 2017/02/17 by Matt.Kuhlenschmidt
Guard against rendering MIDs with potentially no parent in slate.
#jira UE-42047
Change 3311531 on 2017/02/20 by Michael.Dupuis
#jira UETOOL-1100:
Add the possibility to have dynamic min/max slider value
Synchonize all Color vector together when changing the min/max slider value
Change 3311534 on 2017/02/20 by Michael.Dupuis
incremental build fix
Change 3311535 on 2017/02/20 by Michael.Dupuis
incremental build fix take 2...
Change 3311743 on 2017/02/20 by Michael.Dupuis
buildfix lunix incremental
Change 3312496 on 2017/02/20 by Arciel.Rekman
Linux: fix PhysX crash in i686.
- Changed layout to one that works.
Change 3313127 on 2017/02/20 by Jamie.Dale
Fixed crash when performing a non-async cooked package save
It isn't safe to call TotalSize on the BulkArchive when it's not a FBufferArchive (as used during async save) once the archive has been closed.
Change 3313990 on 2017/02/21 by Nick.Darnell
Automation - Added a summary area at the top of the report.
Change 3314034 on 2017/02/21 by Jamie.Dale
Fixed crash when deleting a streamed font
Change 3314942 on 2017/02/21 by Nick.Darnell
Automation - More templating styling work.
Change 3315080 on 2017/02/21 by Nick.Darnell
Automation - Providing a way for users to remove explict events from the event log when automated tests run. Needed for other systems linked into the automation system like google mock.
Change 3315452 on 2017/02/21 by Nick.Darnell
Json - Adding support for Map and Set properties to the JsonObjectConverter. Can now save out map and sets. No support for loading them yet.
Change 3315614 on 2017/02/21 by Nick.Darnell
Json - Adding support for loading sets and map json data.
Change 3315924 on 2017/02/21 by Arciel.Rekman
Vulkan: edigrating various Linux fixes by Josh.
- This is to make Linux Vulkan work in Dev-Editor easier (for the contractor and myself).
Original descriptions:
CL 3313445
- Various Vulkan fixes:
- Compiles in Linux
- Many cubemap bugs squashed
- Changed the scratch reflection cubemap clear to SetRenderTargestsAndClear, instead of SetRenderTarget() / Clear()
- Added compute fences
CL 3314152
- Fixed compile error on Mac, but I am pretty sure we can just remote VulkanRHI from Mac building entirely, but needs to be tested.
Change 3316741 on 2017/02/22 by Jamie.Dale
Ensure that enums used by BP nodes have been PostLoaded so they have the correct display names
#jira UE-42253
Change 3316800 on 2017/02/22 by Matt.Kuhlenschmidt
Merging //UE4/Dev-Main to Dev-Editor (//UE4/Dev-Editor)
Change 3317058 on 2017/02/22 by Alexis.Matte
Fix the scene importer to support correctly the obj file format
#jira UE-35606
Change 3318039 on 2017/02/22 by Arciel.Rekman
i686 support: added missing libwebsockets.
Change 3318095 on 2017/02/22 by Arciel.Rekman
i686 support: Oodle.
Change 3319002 on 2017/02/23 by Michael.Dupuis
#jira UE-41794 : Do not exit the landscape mode when doing undo from the creation of the landscape
Change 3319012 on 2017/02/23 by Alexis.Matte
PR #3066: Improve asset import by permitted relative paths and easing editing of mapped mount points. (Contributed by paulevans)
#jira UE-40039
Change 3319035 on 2017/02/23 by Nick.Darnell
UMG - Adding a note about the font sizes in UE4 in Slate, using 96 dpi.
#jira UE-42170
Change 3319040 on 2017/02/23 by Matt.Kuhlenschmidt
PR #3278: Git plugin: fix revision number for blueprint diff menu (Contributed by SRombauts)
#jira UE-42129
Change 3319072 on 2017/02/23 by Michael.Dupuis
#jira UETOOL-1101: Add support for DetailGroup reset to default
Right now it's only enable for the color grading
Change 3319077 on 2017/02/23 by Nick.Darnell
Automation - Moving away from most of the templating being done in C++. Moving to dust.js to just do it in the browser window. The json report file is now the actual source of the information we use to template the resulting report html. Maaay have to move to doing the templating server side in the future to stream it to the client better, but avoiding that so we don't have to ship a server. Disabling several places we were taking editor screenshots, none of that code was actually comparing screenshots, it was a hold-over from earlier days.
PhysX - Fixing a problem with Physx FillInlinePxShapeArray. Deprecating it, adding FillInlinePxShapeArray_AssumesLocked, and locking places we were assuming it was already locked in the landscape component.
Change 3319088 on 2017/02/23 by Nick.Darnell
PR #3245: UE-41707: Re-order includes correctly (Contributed by projectgheist)
#jira UE-41914
Change 3319104 on 2017/02/23 by Michael.Dupuis
fix incremental build
Change 3319146 on 2017/02/23 by Matt.Kuhlenschmidt
PR #3292: Git plugin: fix update status on directories broken since UE4.12 (Contributed by SRombauts)
#jira UE-42272
Change 3319252 on 2017/02/23 by Michael.Dupuis
fix warning with missing #undef LOCTEXT_NAMESPACE
Change 3319298 on 2017/02/23 by Alex.Delesky
Removing the Subtitles and SubtitlesEditor modules (it'll eventually be brought back as the Overlay and OverlayEditor modules)
Change 3319388 on 2017/02/23 by Alexis.Matte
Fbx Importer now find collision model under fbx LOD Group
#jira UE-42141
Change 3319528 on 2017/02/23 by Michael.Dupuis
Fixed Undo/Redo to be consistent with other vector modifcation behavior
Change 3319583 on 2017/02/23 by Alexis.Matte
Fix the sample rate to use the least common multiplier of all keys
#jira UE-42012
Change 3319705 on 2017/02/23 by Nick.Darnell
Static Analysis - Fixing sonobjectconverter.cpp(460) : warning C6011: Dereferencing NULL pointer 'ArrayProperty'.
Change 3319711 on 2017/02/23 by Nick.Darnell
Editor - Adding some checks to make sure the struct we're accessing is still a valid handle.
#jira UE-42262
Change 3319736 on 2017/02/23 by Alex.Delesky
Adding Subtitles and SubtitlesEditor to the JunkManifest file.
Change 3319919 on 2017/02/23 by Nick.Darnell
Automation - Fixing an issue with moving a location that doesn't exist.
Change 3319932 on 2017/02/23 by Alexis.Matte
Fbx importer, do not apply more then one time the transform option to the scene node.
#jira UE-42277
Change 3320105 on 2017/02/23 by Nick.Darnell
Editor - Adding some additional checks to the margin customization.
#jira UE-42262
Change 3321577 on 2017/02/24 by Jamie.Dale
Moving Internationalization module from Runtime to Developer
Change 3321625 on 2017/02/24 by Jamie.Dale
Moving InternationalizationSettings module from Developer to Editor
Change 3321642 on 2017/02/24 by Jamie.Dale
Moving SCulturePicker from the Localization module to the InternationalizationSettings module
Change 3321734 on 2017/02/24 by Alexis.Matte
PR #2979: Fix extra root bone for Blender exported FBX. (Contributed by manmohanbishnoi)
We fix the extra root only when the file creator is from blender and the root node is named armature. We cannot simply remove all dummy node, since this is use by the rigid mesh workflow.
#jira UE-39050
Change 3321912 on 2017/02/24 by Jamie.Dale
Split LocalizationCommandletExecution out of the Localization module to remove some editor dependencies
Change 3322274 on 2017/02/24 by Jamie.Dale
Moving Localization module from Editor to Developer, and merging the Internationalization module into it
Removed hard-dependency between Engine and Localization/Internationalization via an interface.
Change 3322774 on 2017/02/25 by Jamie.Dale
Unifying LocRes and LocNat file format between generation and loading
This lets the code in Core be shared by Localization, and allows some code that was proxying via archives (due to the code being logically identical, but different C++ types) to use these new types directly.
#tests Built Debug, Shipping, and Editor. Verified that LocNat and LocRes generation and loading worked as before.
Change 3322795 on 2017/02/25 by Jamie.Dale
Fixing mismatch between SOURCE_CONTROL_WITH_SLATE and its .Build.cs file
The define was set to disable Slate for Linux program targets only, but the .Build.cs disabled Slate for all Linux targets.
Since the define was touched most recently (CL# 2534983), I updated the .Build.cs file to match its logic, and moved the definition of the define to the .Build.cs file so that they stay in sync with one another.
Change 3322853 on 2017/02/25 by Jamie.Dale
Moved the conflict and word count reporting to FLocTextHelper
Change 3323089 on 2017/02/26 by Jamie.Dale
Added functions to get the target name and path from FLocTextHelper
Change 3323391 on 2017/02/27 by Ben.Cosh
This fixes an issue with blueprint config variables having their value destroyed by CDO serialization
#Jira UE-40586 Blueprint variable defaults set from config files value are overwritten by CDO serialization
#Proj Engine, CoreUObject
Change 3323406 on 2017/02/27 by Ben.Cosh
Fixed a problem that caused UK2Node::ExpandSplitPin to destroy pins it didn't own in when expanding a collapsed graph during compilation.
#jira UE-41211 - Crash when splitting a UDS pin on a collapsed graph
#Proj BlueprintGraph
Change 3323572 on 2017/02/27 by Nick.Darnell
Automation - Continued itteration on the style of the automation reports, now with attentional info, like where the log came from.
Automation - Fixing a bug in the functional actor tests, navigating to the actors sometimes opened other objects in the package, now it only opens the map. Also improved the way we focus the actor so that the level editor is also brought to the foreground.
Automation - Fixing a bug in how the automation system was registering for capturing logging. It was swapping out GWarn for its own version, but GWarn isn't called for anything that isn't an error or warning, meaning that none of the Display/Logging or analytics capture attempts were actually working. Suddenly a flood of informations started being captured during tests. For now - only going to capture 'Display' logs instead of 'Log' level.
Automation - Successful comparisons now print more information so that the automation logs do a better job of tracking the flow of the test.
Automation - The screenshot comparison test now prints more information even during successful comparisons.
Editor - The message log no longer emits a SetSelection, just because the selection is updated the categoriry view model. This was causing things like the automation tool, which sets the selection every time (which may itself be an issue) to completely rebuild the message log every time a new automation message was emited. The message log now checks if the selection would actually change the viewstate before it does it.
Domino Test - Adding an arrow to visualize the state of the up vector the test is looking for; playing with idea for test visualizers that may help with debugging in the future.
Change 3323580 on 2017/02/27 by Michael.Trepka
Fixed some Xcode 8.3 compile errors
Change 3323634 on 2017/02/27 by Nick.Darnell
Build - Fix incremental build.
Change 3323740 on 2017/02/27 by Jamie.Dale
Adding #error if the SOURCE_CONTROL_WITH_SLATE define is missing
Change 3323865 on 2017/02/27 by Nick.Darnell
Automation - Disabling the screenshot from the small editor icons test, until the editor screenshot method starts comparing things, and the screenshots we take are better / more scoped.
Change 3324228 on 2017/02/27 by Jamie.Dale
Can no longer name assets or folders with a leading underscore
#jira UE-40541
Change 3324429 on 2017/02/27 by Jamie.Dale
Removing FLocTextTargetPaths
It was added to support something that I'm now going to do a different way.
Change 3324473 on 2017/02/27 by Jamie.Dale
Moved the GatherText SCC utils into the Localization module
Change 3324481 on 2017/02/27 by Jamie.Dale
Moving the localized asset utils out of GatherText base
Change 3324485 on 2017/02/27 by Jamie.Dale
Cleaning up some includes now that the localization SCC is no longer in GatherText
Change 3324910 on 2017/02/28 by Nick.Darnell
Slate - Moving the SlateRotatedRect into its own file, and removing FSlateRotatedClipRectType, since there's no longer a difference and we only use FSlateRotatedRect.
Change 3325329 on 2017/02/28 by Michael.Dupuis
#jira UE-42083: Removed various Modify(true) that would force user to save the levels even if they did'nt really modified them
Replace TMap<TLazyObjectPtr,...> as it would dirty the level at every Find performed
Change 3325410 on 2017/02/28 by Michael.Dupuis
missing include for incremental build
Change 3325415 on 2017/02/28 by Nick.Darnell
UMG - Adding some setters and getters for RedrawTime to the WidgetComponent.
Change 3325418 on 2017/02/28 by Nick.Darnell
Automation - Fixing the warnings on startup about smoke tests taking longer than 2s. Had to add an option to disable capturing the callstack when running smokes, it adds a bit too much overhead during startup.
Change 3325698 on 2017/02/28 by Alexis.Matte
Put back the code to isolate material versus section in the skeletal mesh. The code was override by a temporary hack done in paragon branch
Change 3325790 on 2017/02/28 by Michael.Trepka
Copy of CL 3319588
Fixed address sanitizer support in MacToolChain (Apple changed the name of the env variable Xcode uses to enable it) and added support for thread sanitizer
Change 3326118 on 2017/02/28 by Alexis.Matte
Add LOD settings LOD distances to fbx import dialog option. The option are not supported yet by the scene importer
#jira UE-41291
Change 3326183 on 2017/02/28 by Alexis.Matte
PR #3298: Import SpecularFactor for Roughness and Shininess for Metallic textures (Contributed by VladimirPobedinskiy)
#jira UE-42301
Change 3326196 on 2017/02/28 by Jamie.Dale
Force the correct package localization ID when duplicating a BP for nativization
Change 3327037 on 2017/03/01 by Michael.Dupuis
fixed fortnite mac non editor build
Change 3327483 on 2017/03/01 by Jamie.Dale
Renaming LocNat to LocMeta
Change 3327486 on 2017/03/01 by Jamie.Dale
Renaming LocNat to LocMeta
Change 3327541 on 2017/03/01 by Michael.Trepka
Removed Mac OpenGL RHI files and disabled building of OpenGL RHI on Mac
Change 3328000 on 2017/03/01 by Nick.Darnell
Automation - Noisy rendering features are now disabled by default when taking screenshots.
Change 3328323 on 2017/03/01 by Michael.Trepka
Copy of CL 3307526
Fixed mouse position issues in fullscreen mode on Mac
Change 3328410 on 2017/03/01 by Alexis.Matte
Remove unwanted option when importing skeletal mesh
Make the FBX tests uptodate with the new ImportUI options
#jira UE-41291
Change 3329586 on 2017/03/02 by Jamie.Dale
Adding missing includes when running with bUseMallocProfiler enabled
Change 3329999 on 2017/03/02 by Nick.Darnell
UMG - Removing a deprecated 4.8 function to get the label on UWidget.
Change 3330004 on 2017/03/02 by Nick.Darnell
UMG - Adding TargetPlatform to the dependencies of UMGEditor module.
Change 3330021 on 2017/03/02 by Nick.Darnell
UMG - Adding TargetPlatform to the private include path of the UMG module.
Change 3330041 on 2017/03/02 by Nick.Darnell
Engine - Adding a comment to the PreLoadMap call so people know what the string being passed in is.
Change 3330048 on 2017/03/02 by Nick.Darnell
Editor - Don't allow querying the cursor in the editor viewport while saving packages. Depending upon the code that gets triggered, it may cause packages to load, or things to be initialized while saving is occuring.
Change 3330602 on 2017/03/02 by mason.seay
Map for Functional Screenshot Test Bug
Change 3330632 on 2017/03/02 by Alexis.Matte
Fix fbx crash when there is only one UVChannel but using the naming convention to place it further then the first index
Change 3330862 on 2017/03/02 by Jamie.Dale
Adding FPaths::SetExtension
This is like FPaths::ChangeExtension, but also applies the extension if the file doesn't have one.
Change 3331491 on 2017/03/03 by Nick.Darnell
Automation - Fixing a threading issue in the SAsyncImage, it was accessing potentially bogus memory if the Widget had been deleted before the task ran.
Change 3331498 on 2017/03/03 by Nick.Darnell
Build - Fixing a build warning.
Change 3331807 on 2017/03/03 by Nick.Darnell
Automation - Making the Disable Noisy Rendering Features more robust, disabling a few more markers. Adding a better way of rolling back the changes.
Change 3331999 on 2017/03/03 by Michael.Trepka
Fixed a memory leak on texture creation with BulkData in OpenGLTexture.cpp
Change 3332481 on 2017/03/03 by Arciel.Rekman
Fix building lighting in commandlet (UE-42551).
- Process task graph while running as commandlet.
- Also, if for any reason - like the lack of -messaging - local swarm interface fails to initialize or takes too much time to send the message, bail out.
Change 3332606 on 2017/03/04 by Jamie.Dale
Fixing crash reporting loc word counts when the report is starting empty
Change 3332614 on 2017/03/04 by Jamie.Dale
Fixed text namespaces being treated as case-insensitive when export to JSON manifests and archives
Change 3332619 on 2017/03/04 by Jamie.Dale
Fixing CIS error
Change 3333000 on 2017/03/06 by Matt.Kuhlenschmidt
PR #3295: Non-editable FStringAssetReference using VisibleAnywhere (Contributed by projectgheist)
#jira UE-42284
Change 3333039 on 2017/03/06 by Alexis.Matte
Make custom ui for FbxSceneImportData object
#jira UE-37896
Change 3333047 on 2017/03/06 by Nick.Darnell
UMG - Removing an extra assignment in WidgetSwitcher.
Change 3333056 on 2017/03/06 by Alexis.Matte
Build fix
Change 3333073 on 2017/03/06 by Matt.Kuhlenschmidt
Added more logging for when window creation fails due to too many windows.
#jira UE-42478
Change 3333081 on 2017/03/06 by Matt.Kuhlenschmidt
PR #3327: Git Plugin: fix RunDumpToFile() to check git ReturnCode (Contributed by SRombauts)
#jira UE-42535
Change 3333103 on 2017/03/06 by Matt.Kuhlenschmidt
PR #3336: UE-42407: using GetWindowMode instead of switching on IsFullscreenViewport (Contributed by stefanzimecki)
#jira UE-42407, UE-42565
Change 3333142 on 2017/03/06 by Jamie.Dale
Added a way to view/copy a list references (including those that aren't loaded) to the reference viewer
Change 3333443 on 2017/03/06 by Matt.Kuhlenschmidt
Eliminate the usage of SWebBrowser to show viewport controls in level viewports. There is an non-trivial startup cost initializing CEF and is not worth paying that cost on editor startup for one tiny control. The button now opens a web page on click.
#jira UE-42461
PR #3314: Drop UE4Editor -> CEF dependency to 2x speedup Linux UE4Editor startup (Contributed by slonopotamus)
Change 3333914 on 2017/03/06 by Matt.Kuhlenschmidt
Remove double middle mouse click to change to perspective view
#jira UE-42444
Change 3333936 on 2017/03/06 by Matt.Kuhlenschmidt
Fixed excessive fname initialization in these files
Change 3334063 on 2017/03/06 by Alexis.Matte
fix build linux
Change 3334166 on 2017/03/06 by Jamie.Dale
Adding Data Table export/import support for TMap and TSet
#jira UE-42415
Change 3334459 on 2017/03/06 by Alexis.Matte
PR #3334: Respect bForceFrontXAxis option when exporting to FBX (Contributed by rajkosto)
#jira UE-42563
Change 3335132 on 2017/03/07 by Jamie.Dale
Fixing typo
Change 3335140 on 2017/03/07 by Jamie.Dale
Fixing CSV import warnings in GameplayEffects test
Change 3335164 on 2017/03/07 by Alexis.Matte
Avoid selecting skeletal mesh section in the level when high light them in persona editor
#jira UE-20151
Change 3335186 on 2017/03/07 by Jamie.Dale
Fixed CSV parser missing empty cells at the end of the string
Change 3335218 on 2017/03/07 by Arciel.Rekman
SDL2: delete unused project/build files.
Change 3335222 on 2017/03/07 by Arciel.Rekman
SDL2: delete more unused project/build files.
Change 3335230 on 2017/03/07 by Matt.Kuhlenschmidt
Additional fixes for blur and blur slot not propagating padding to each other
#jira UE-42553
Change 3335896 on 2017/03/07 by Jamie.Dale
ToolTips and Engine were double gathering the same meta-data
#jira UE-36480
Change 3336009 on 2017/03/07 by Matt.Kuhlenschmidt
Fix details panels becoming unusable if "Show only Modified Properties" is enabled and there are no modified properties
Change 3336247 on 2017/03/07 by Jamie.Dale
Selection height is now the max of the line height and text height to account for negative line scaling
#jira UE-40673
Change 3336253 on 2017/03/07 by Jamie.Dale
Added a setting to control whether we should use the font metrics or the bounding box when laying out a font
#jira UE-41074
Change 3336303 on 2017/03/07 by Arciel.Rekman
Refactor of OS memory allocation functions.
- Bring PageSize/OSAllocationGranularity in line with the established definitions.
- PageSize is a hardware mapping granularity that is also used for PageProtect() and any other functions that involve setting virtual memory properties.
- OSAllocationGranularity is a virtual address allocation granularity that on some platforms may be applied on top of that (notably VirtualAlloc in Windows only returns addresses that are 16 page aligned).
- BinnedPageSize and BinnedAllocationGranularity are the values expected by Binned and Binned2 for size and the alignment of OS allocations.
- Disable the logic in CachedOSPageAllocator that allowed buffers larger than the requested size to be returned.
- This caused wrong allocation size to be passed in BinnedFreeToOS() from Binned2.
- Make Binned2 work on Linux
- Addresses returned from BinnedAllocFromOS() need to be BinnedPageSize (minimum 64KB) aligned for Binned2 to work. This results in the need to artificially align mmap()'d addresses, at some performance cost.
- The same function can be used on other systems with mmap()/munmap() (Mac, Android, iOS)
- Switch Linux to Binned2 by default.
- Add ability to sanity-check OS memory allocations.
- Debug and Development build will store a descriptor to check that values passed to BinnedFreeToOS() are the same (mmap-based allocation only).
Change 3337098 on 2017/03/08 by Michael.Dupuis
#jira UE-42589: Added a guard if the mesh component is not attached, this can happen when moving a component out of the screen
Change 3337183 on 2017/03/08 by Matt.Kuhlenschmidt
Hide the preview toolbar button, it is not being used
Change 3337801 on 2017/03/08 by Michael.Trepka
Fixed some module dependencies to make sure we don't build OpenGLDrv on Mac
Change 3338373 on 2017/03/08 by Joe.Graf
Fixed external plugin cooking and deployment by remapping plugin directories upon cook & deployment
Tested directory structures:
D:\SomePluginDir
D:\UE4\AnotherPluginDir
D:\UE4\Engine\Plugins
D:\UE4\MyProject\Plugins
Change 3338482 on 2017/03/08 by Alexis.Matte
Remove "BlueprinReadOnly" flag on "WITH_EDITORONLY_DATA" class variable
Change 3338679 on 2017/03/08 by Matt.Kuhlenschmidt
Fixed arrow keys not working to navigate between elements in the details panel
Change 3339086 on 2017/03/09 by Dmitriy.Dyomin
Added: Mobile friendly slate settings
Change 3339366 on 2017/03/09 by Nick.Darnell
Build - Attempting to fix build.
#jira UE-42675
Change 3339506 on 2017/03/09 by Jamie.Dale
Fixing Linux Server build error
#jira UE-42675
Change 3340450 on 2017/03/09 by Cody.Albert
Ensure that the hittest grid is valid before trying to find a focusable widget
Change 3340492 on 2017/03/09 by Arciel.Rekman
Fix IOS compile error (UE-42695).
Change 3340565 on 2017/03/09 by Arciel.Rekman
Fix another compile error (UE-42695).
Change 3341527 on 2017/03/10 by Alexis.Matte
Fix crash when dragging a re-import scene and there is new asset created
#jira UE-42766
[CL 3341914 by Nick Darnell in Main branch]
3052 lines
97 KiB
C++
3052 lines
97 KiB
C++
// Copyright 1998-2017 Epic Games, Inc. All Rights Reserved.
|
|
|
|
|
|
#include "PropertyNode.h"
|
|
#include "Misc/ConfigCacheIni.h"
|
|
#include "UObject/MetaData.h"
|
|
#include "Serialization/ArchiveReplaceObjectRef.h"
|
|
#include "Components/ActorComponent.h"
|
|
#include "Editor/UnrealEdEngine.h"
|
|
#include "Engine/UserDefinedStruct.h"
|
|
#include "UnrealEdGlobals.h"
|
|
#include "ScopedTransaction.h"
|
|
#include "PropertyRestriction.h"
|
|
#include "Kismet2/StructureEditorUtils.h"
|
|
#include "Kismet2/BlueprintEditorUtils.h"
|
|
#include "Misc/ScopeExit.h"
|
|
#include "Editor.h"
|
|
#include "ObjectPropertyNode.h"
|
|
#include "PropertyHandleImpl.h"
|
|
#include "EditorSupportDelegates.h"
|
|
#include "ConstructorHelpers.h"
|
|
|
|
#include "Framework/Notifications/NotificationManager.h"
|
|
#include "Widgets/Notifications/SNotificationList.h"
|
|
|
|
#define LOCTEXT_NAMESPACE "PropertyNode"
|
|
|
|
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();
|
|
|
|
bool bIsEditInlineNew = false;
|
|
bool bShowInnerObjectProperties = false;
|
|
if ( !Property.IsValid() )
|
|
{
|
|
// Disable all flags if no property is bound.
|
|
SetNodeFlags(EPropertyNodeFlags::SingleSelectOnly | EPropertyNodeFlags::EditInlineNew | EPropertyNodeFlags::ShowInnerObjectProperties, false);
|
|
}
|
|
else
|
|
{
|
|
const bool GotReadAddresses = GetReadAddressUncached( *this, false, nullptr, false );
|
|
const bool bSingleSelectOnly = GetReadAddressUncached( *this, true, nullptr);
|
|
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");
|
|
static const FName Name_ShowInnerProperties("ShowInnerProperties");
|
|
|
|
bIsEditInlineNew = bIsObjectOrInterface && GotReadAddresses && MyProperty->HasMetaData(Name_EditInline);
|
|
bShowInnerObjectProperties = bIsObjectOrInterface && MyProperty->HasMetaData(Name_ShowInnerProperties);
|
|
|
|
if(bIsEditInlineNew)
|
|
{
|
|
SetNodeFlags(EPropertyNodeFlags::EditInlineNew, true);
|
|
}
|
|
else if(bShowInnerObjectProperties)
|
|
{
|
|
SetNodeFlags(EPropertyNodeFlags::ShowInnerObjectProperties, true);
|
|
}
|
|
|
|
//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 bRequiresValidation = bIsEditInlineNew || bShowInnerObjectProperties || ( MyProperty && (MyProperty->IsA<UArrayProperty>() || MyProperty->IsA<USetProperty>() || MyProperty->IsA<UMapProperty>() ));
|
|
|
|
// 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();
|
|
if (!ComplexParent)
|
|
{
|
|
return nullptr;
|
|
}
|
|
|
|
if (FObjectPropertyNode* ObjectNode = ComplexParent->AsObjectNode())
|
|
{
|
|
return ObjectNode;
|
|
}
|
|
else if (FPropertyNode* ParentNodePtr = ComplexParent->GetParentNode())
|
|
{
|
|
return ParentNodePtr->FindObjectItemParent();
|
|
}
|
|
return nullptr;
|
|
}
|
|
|
|
const class FObjectPropertyNode* FPropertyNode::FindObjectItemParent() const
|
|
{
|
|
const auto ComplexParent = FindComplexParent();
|
|
if (!ComplexParent)
|
|
{
|
|
return nullptr;
|
|
}
|
|
|
|
if (const FObjectPropertyNode* ObjectNode = ComplexParent->AsObjectNode())
|
|
{
|
|
return ObjectNode;
|
|
}
|
|
else if (const FPropertyNode* ParentNodePtr = ComplexParent->GetParentNode())
|
|
{
|
|
return ParentNodePtr->FindObjectItemParent();
|
|
}
|
|
return nullptr;
|
|
}
|
|
|
|
/**
|
|
* 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;
|
|
}
|
|
|
|
|
|
bool FPropertyNode::DoesChildPropertyRequireValidation(UProperty* InChildProp)
|
|
{
|
|
return InChildProp != nullptr && (Cast<UObjectProperty>(InChildProp) != nullptr || Cast<UStructProperty>(InChildProp) != nullptr);
|
|
}
|
|
|
|
/**
|
|
* Used to see if any data has been destroyed from under the property tree. Should only be called by PropertyWindow::OnIdle
|
|
*/
|
|
EPropertyDataValidationResult FPropertyNode::EnsureDataIsValid()
|
|
{
|
|
bool bValidateChildren = !HasNodeFlags(EPropertyNodeFlags::SkipChildValidation);
|
|
bool bValidateChildrenKeyNodes = false; // by default, we don't check this, since it's just for Map properties
|
|
|
|
// 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 container children is correct
|
|
UArrayProperty* ArrayProperty = Cast<UArrayProperty>(MyProperty);
|
|
USetProperty* SetProperty = Cast<USetProperty>(MyProperty);
|
|
UMapProperty* MapProperty = Cast<UMapProperty>(MyProperty);
|
|
UStructProperty* StructProperty = Cast<UStructProperty>(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;
|
|
|
|
UProperty* ContainerElementProperty = MyProperty;
|
|
|
|
if (ArrayProperty)
|
|
{
|
|
ContainerElementProperty = ArrayProperty->Inner;
|
|
}
|
|
else if (SetProperty)
|
|
{
|
|
ContainerElementProperty = SetProperty->ElementProp;
|
|
}
|
|
else if (MapProperty)
|
|
{
|
|
// Need to attempt to validate both the key and value properties...
|
|
bValidateChildrenKeyNodes = DoesChildPropertyRequireValidation(MapProperty->KeyProp);
|
|
|
|
ContainerElementProperty = MapProperty->ValueProp;
|
|
}
|
|
|
|
bValidateChildren = DoesChildPropertyRequireValidation(ContainerElementProperty);
|
|
|
|
//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::EditInlineNew) || HasNodeFlags(EPropertyNodeFlags::ShowInnerObjectProperties)) ;
|
|
//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 EPropertyDataValidationResult::ObjectInvalid;
|
|
}
|
|
|
|
// If an object property with ShowInnerProperties changed object values out from under the property
|
|
bool bShowInnerObjectPropertiesObjectChanged = false;
|
|
|
|
//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 EPropertyDataValidationResult::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 (SetProperty && !bIgnoreAllMismatch)
|
|
{
|
|
// like arrays, ensure that set structures have the proper number of children
|
|
int32 SetNum = FScriptSetHelper::Num(Addr);
|
|
|
|
if (NumArrayChildren == -1)
|
|
{
|
|
NumArrayChildren = SetNum;
|
|
}
|
|
|
|
bArrayHasNewItem = GetNumChildNodes() < SetNum;
|
|
bArraysHaveEqualNum = bArraysHaveEqualNum && (NumArrayChildren == SetNum);
|
|
bArraysMatchChildNum = bArraysMatchChildNum && (GetNumChildNodes() == SetNum);
|
|
}
|
|
|
|
if (MapProperty && !bIgnoreAllMismatch)
|
|
{
|
|
int32 MapNum = FScriptMapHelper::Num(Addr);
|
|
|
|
if (NumArrayChildren == -1)
|
|
{
|
|
NumArrayChildren = MapNum;
|
|
}
|
|
|
|
bArrayHasNewItem = GetNumChildNodes() < MapNum;
|
|
bArraysHaveEqualNum = bArraysHaveEqualNum && (NumArrayChildren == MapNum);
|
|
bArraysMatchChildNum = bArraysMatchChildNum && (GetNumChildNodes() == MapNum);
|
|
}
|
|
|
|
if (ObjectProperty && !bIgnoreAllMismatch)
|
|
{
|
|
UObject* Obj = ObjectProperty->GetObjectPropertyValue(Addr);
|
|
|
|
if (!bShowInnerObjectPropertiesObjectChanged && HasNodeFlags(EPropertyNodeFlags::ShowInnerObjectProperties) && ChildNodes.Num() == 1)
|
|
{
|
|
bool bChildObjectFound = false;
|
|
// should never have more than one node (0 is ok if the object property is null)
|
|
check(ChildNodes.Num() == 1);
|
|
bool bNeedRebuild = false;
|
|
FObjectPropertyNode* ChildObjectNode = ChildNodes[0]->AsObjectNode();
|
|
for(int32 ObjectIndex = 0; ObjectIndex < ChildObjectNode->GetNumObjects(); ++ObjectIndex)
|
|
{
|
|
if(Obj == ChildObjectNode->GetUObject(ObjectIndex))
|
|
{
|
|
bChildObjectFound = true;
|
|
break;
|
|
}
|
|
}
|
|
bShowInnerObjectPropertiesObjectChanged = !bChildObjectFound;
|
|
}
|
|
|
|
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 EPropertyDataValidationResult::ArraySizeChanged;
|
|
}
|
|
|
|
if(bShowInnerObjectPropertiesObjectChanged)
|
|
{
|
|
RebuildChildren();
|
|
return EPropertyDataValidationResult::EditInlineNewValueChanged;
|
|
}
|
|
|
|
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 (!HasNodeFlags(EPropertyNodeFlags::ShowInnerObjectProperties) && ObjectProperty && ((!bObjectPropertyNull && !bHasChildren) || (bObjectPropertyNull && bHasChildren)))
|
|
{
|
|
RebuildChildren();
|
|
return EPropertyDataValidationResult::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::ShowInnerObjectProperties) || (HasNodeFlags(EPropertyNodeFlags::EditInlineNew) && !IsEditConst()) ? EPropertyDataValidationResult::EditInlineNewValueChanged : EPropertyDataValidationResult::PropertiesChanged;
|
|
}
|
|
|
|
EPropertyDataValidationResult FinalResult = EPropertyDataValidationResult::DataValid;
|
|
|
|
// Validate children and/or their key nodes.
|
|
if (bValidateChildren || bValidateChildrenKeyNodes)
|
|
{
|
|
for (int32 Scan = 0; Scan < ChildNodes.Num(); ++Scan)
|
|
{
|
|
TSharedPtr<FPropertyNode>& ChildNode = ChildNodes[Scan];
|
|
check(ChildNode.IsValid());
|
|
|
|
if (bValidateChildren)
|
|
{
|
|
EPropertyDataValidationResult ChildDataResult = ChildNode->EnsureDataIsValid();
|
|
if (FinalResult == EPropertyDataValidationResult::DataValid && ChildDataResult != EPropertyDataValidationResult::DataValid)
|
|
{
|
|
FinalResult = ChildDataResult;
|
|
}
|
|
}
|
|
|
|
// If the child property has a key node that needs validation, validate it here
|
|
TSharedPtr<FPropertyNode>& ChildKeyNode = ChildNode->GetPropertyKeyNode();
|
|
if (bValidateChildrenKeyNodes && ChildKeyNode.IsValid())
|
|
{
|
|
EPropertyDataValidationResult ChildDataResult = ChildKeyNode->EnsureDataIsValid();
|
|
if (FinalResult == EPropertyDataValidationResult::DataValid && ChildDataResult != EPropertyDataValidationResult::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);
|
|
}
|
|
}
|
|
|
|
bool FPropertyNode::GetChildNode(const int32 ChildArrayIndex, TSharedPtr<FPropertyNode>& OutChildNode)
|
|
{
|
|
OutChildNode = nullptr;
|
|
|
|
for (auto Child = ChildNodes.CreateIterator(); Child; ++Child)
|
|
{
|
|
if (Child->IsValid() && (*Child)->ArrayIndex == ChildArrayIndex)
|
|
{
|
|
OutChildNode = *Child;
|
|
return true;
|
|
}
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
bool FPropertyNode::GetChildNode(const int32 ChildArrayIndex, TSharedPtr<FPropertyNode>& OutChildNode) const
|
|
{
|
|
OutChildNode = nullptr;
|
|
|
|
for (auto Child = ChildNodes.CreateConstIterator(); Child; ++Child)
|
|
{
|
|
if (Child->IsValid() && (*Child)->ArrayIndex == ChildArrayIndex)
|
|
{
|
|
OutChildNode = *Child;
|
|
return true;
|
|
}
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
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());
|
|
|
|
USetProperty* SetProp = Cast<USetProperty>(Property);
|
|
USetProperty* OuterSetProp = Cast<USetProperty>(Property->GetOuter());
|
|
|
|
UMapProperty* MapProp = Cast<UMapProperty>(Property);
|
|
UMapProperty* OuterMapProp = Cast<UMapProperty>(Property->GetOuter());
|
|
|
|
// calculate the values for the current object
|
|
{
|
|
PropertyValueBaseAddress = (OuterArrayProp == NULL && OuterSetProp == NULL && OuterMapProp == 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 && OuterSetProp == NULL && OuterMapProp == NULL)
|
|
? PropertyNode->GetValueBaseAddress(PropertyDefaultValueRoot.ValueAddress)
|
|
: ParentNode->GetValueBaseAddress(PropertyDefaultValueRoot.ValueAddress);
|
|
PropertyDefaultAddress = PropertyNode->GetValueAddress(PropertyDefaultValueRoot.ValueAddress);
|
|
|
|
//////////////////////////
|
|
// If this is a container property, we must take special measures to use the base address of the property's value; for instance,
|
|
// the array property's PropertyDefaultBaseAddress points to an FScriptArray*, while PropertyDefaultAddress points to the
|
|
// FScriptArray's Data pointer.
|
|
if ( ArrayProp != NULL || SetProp != NULL || MapProp != 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;
|
|
}
|
|
if ( ProcessSetProperty(Cast<USetProperty>(Property), PropertyValueAddress) )
|
|
{
|
|
return;
|
|
}
|
|
if ( ProcessMapProperty(Cast<UMapProperty>(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;
|
|
}
|
|
|
|
/**
|
|
* USetProperty version - invokes ProcessProperty on the each item in the set
|
|
*
|
|
* @param SetProp the property to process
|
|
* @param PropertyValueAddress the address of the property's value
|
|
*
|
|
* @return true if the property was handled by this method
|
|
*/
|
|
bool ProcessSetProperty( USetProperty* SetProp, uint8* PropertyValueAddress )
|
|
{
|
|
bool bResult = false;
|
|
|
|
if (SetProp != NULL)
|
|
{
|
|
FScriptSet* SetValuePtr = SetProp->GetPropertyValuePtr(PropertyValueAddress);
|
|
|
|
FScriptSetLayout SetLayout = SetValuePtr->GetScriptLayout(SetProp->ElementProp->ElementSize, SetProp->ElementProp->GetMinAlignment());
|
|
int32 ItemsLeft = SetValuePtr->Num();
|
|
|
|
for (int32 Index = 0; ItemsLeft > 0; ++Index)
|
|
{
|
|
if (SetValuePtr->IsValidIndex(Index))
|
|
{
|
|
--ItemsLeft;
|
|
ProcessProperty(SetProp->ElementProp, (uint8*)SetValuePtr->GetData(Index, SetLayout));
|
|
}
|
|
}
|
|
|
|
bResult = true;
|
|
}
|
|
|
|
return bResult;
|
|
}
|
|
|
|
/**
|
|
* UMapProperty version - invokes ProcessProperty on each item in the map
|
|
*
|
|
* @param MapProp the property to process
|
|
* @param PropertyValueAddress the address of the property's value
|
|
*
|
|
* @return true if the property was handled by this method
|
|
*/
|
|
bool ProcessMapProperty( UMapProperty* MapProp, uint8* PropertyValueAddress )
|
|
{
|
|
bool bResult = false;
|
|
|
|
if (MapProp != NULL)
|
|
{
|
|
FScriptMap* MapValuePtr = MapProp->GetPropertyValuePtr(PropertyValueAddress);
|
|
|
|
FScriptMapLayout MapLayout = MapValuePtr->GetScriptLayout(MapProp->KeyProp->ElementSize, MapProp->KeyProp->GetMinAlignment(), MapProp->ValueProp->ElementSize, MapProp->ValueProp->GetMinAlignment());
|
|
int32 ItemsLeft = MapValuePtr->Num();
|
|
|
|
for (int32 Index = 0; ItemsLeft > 0; ++Index)
|
|
{
|
|
if (MapValuePtr->IsValidIndex(Index))
|
|
{
|
|
--ItemsLeft;
|
|
|
|
uint8* Data = (uint8*)MapValuePtr->GetData(Index, MapLayout);
|
|
|
|
ProcessProperty(MapProp->KeyProp, MapProp->KeyProp->ContainerPtrToValuePtr<uint8>(Data));
|
|
ProcessProperty(MapProp->ValueProp, MapProp->ValueProp->ContainerPtrToValuePtr<uint8>(Data));
|
|
}
|
|
}
|
|
|
|
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());
|
|
USetProperty* OuterSetProperty = Cast<USetProperty>(InProperty->GetOuter());
|
|
UMapProperty* OuterMapProperty = Cast<UMapProperty>(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;
|
|
}
|
|
}
|
|
else if (OuterSetProperty != NULL)
|
|
{
|
|
FScriptSetHelper SetHelper(OuterSetProperty, ValueTracker.GetPropertyDefaultBaseAddress());
|
|
|
|
if ( ValueTracker.GetPropertyDefaultBaseAddress() != NULL && !SetHelper.IsValidIndex(GetArrayIndex()) )
|
|
{
|
|
bDiffersFromDefaultForObject = true;
|
|
}
|
|
}
|
|
else if (OuterMapProperty != NULL)
|
|
{
|
|
FScriptMapHelper MapHelper(OuterMapProperty, ValueTracker.GetPropertyDefaultBaseAddress());
|
|
|
|
if ( ValueTracker.GetPropertyDefaultBaseAddress() != NULL && !MapHelper.IsValidIndex(GetArrayIndex()) )
|
|
{
|
|
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());
|
|
USetProperty* OuterSetProperty = Cast<USetProperty>(InProperty->GetOuter());
|
|
UMapProperty* OuterMapProperty = Cast<UMapProperty>(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 = PPF_PropertyWindow;
|
|
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 ( !OuterSetProperty && !OuterMapProperty )
|
|
{
|
|
// 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
|
|
{
|
|
// Port flags will cause enums to display correctly
|
|
InProperty->ExportTextItem( DefaultValue, ValueTracker.GetPropertyDefaultAddress(), ValueTracker.GetPropertyDefaultAddress(), InObject, PortFlags, NULL );
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
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() > 0)
|
|
{
|
|
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 = nullptr;
|
|
if ( GUnrealEd && GUnrealEd->PlayWorld && !GUnrealEd->bIsSimulatingInEditor && Object->IsIn(GUnrealEd->PlayWorld))
|
|
{
|
|
OldGWorld = SetPlayInEditorWorld(GUnrealEd->PlayWorld);
|
|
bIsGameWorld = true;
|
|
}
|
|
|
|
FPropertyNode* ParentPropertyNode = GetParentNode();
|
|
UProperty* ParentProperty = ParentPropertyNode != nullptr ? ParentPropertyNode->GetProperty() : nullptr;
|
|
|
|
// If we're about to modify an element in a set, check to ensure that we're not duplicating a default value
|
|
if (Cast<USetProperty>(ParentProperty) != nullptr)
|
|
{
|
|
FScriptSetHelper SetHelper(Cast<USetProperty>(ParentProperty), ParentPropertyNode->GetValueBaseAddress((uint8*)Object));
|
|
FDefaultConstructedPropertyElement DefaultElementValue(SetHelper.ElementProp);
|
|
|
|
int32 ThisElementIndex = SetHelper.FindElementIndex(TheProperty->ContainerPtrToValuePtr<uint8>(ValueTrackerPtr->GetPropertyValueAddress()));
|
|
int32 DefaultIndex = SetHelper.FindElementIndex(DefaultElementValue.GetObjAddress());
|
|
|
|
if (DefaultIndex != INDEX_NONE && ThisElementIndex != DefaultIndex)
|
|
{
|
|
FNotificationInfo ResetToDefaultErrorInfo = LOCTEXT("SetElementResetToDefault_Duplicate", "Cannot reset the element back to its default value because the default already exists in the set");
|
|
ResetToDefaultErrorInfo.ExpireDuration = 3.0f;
|
|
FSlateNotificationManager::Get().AddNotification(ResetToDefaultErrorInfo);
|
|
return;
|
|
}
|
|
}
|
|
|
|
// If we're about to modify a map, ensure that the default key value is not duplicated
|
|
if (Cast<UMapProperty>(ParentProperty) != nullptr)
|
|
{
|
|
if (PropertyKeyNode.IsValid())
|
|
{
|
|
// This is the value node; it should always be reset to default. The key node should be checked separately.
|
|
PropertyKeyNode->ResetToDefault( InNotifyHook );
|
|
}
|
|
else
|
|
{
|
|
// Key node, so perform the default check here
|
|
FScriptMapHelper MapHelper(Cast<UMapProperty>(ParentProperty), ParentPropertyNode->GetValueBaseAddress((uint8*)Object));
|
|
FDefaultConstructedPropertyElement DefaultKeyValue(MapHelper.KeyProp);
|
|
|
|
uint8* PairPtr = MapHelper.GetPairPtr(ArrayIndex);
|
|
int32 ThisKeyIndex = MapHelper.FindMapIndexWithKey(TheProperty->ContainerPtrToValuePtr<uint8>(ValueTrackerPtr->GetPropertyValueAddress()));
|
|
int32 DefaultIndex = MapHelper.FindMapIndexWithKey(DefaultKeyValue.GetObjAddress());
|
|
|
|
if (DefaultIndex != INDEX_NONE && ThisKeyIndex != DefaultIndex)
|
|
{
|
|
FNotificationInfo ResetToDefaultErrorInfo = LOCTEXT("MapKeyResetToDefault_Duplicate", "Cannot reset the key back to its default value because the default already exists in the map");
|
|
ResetToDefaultErrorInfo.ExpireDuration = 3.0f;
|
|
FSlateNotificationManager::Get().AddNotification(ResetToDefaultErrorInfo);
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
|
|
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
|
|
|
|
if(Cast<UArrayProperty>(ParentProperty) != nullptr)
|
|
{
|
|
UArrayProperty* ArrayProp = Cast<UArrayProperty>(ParentProperty);
|
|
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;
|
|
TheProperty->ExportText_Direct(ValueAfterImport, ValueTracker.GetPropertyValueAddress(), ValueTracker.GetPropertyValueAddress(), NULL, 0);
|
|
|
|
// If this is an instanced component property we must move the old component to the
|
|
// transient package so resetting owned components on the parent doesn't find it
|
|
UObjectProperty* ObjectProperty = Cast<UObjectProperty>(TheProperty);
|
|
if (ObjectProperty
|
|
&& ObjectProperty->HasAnyPropertyFlags(CPF_InstancedReference)
|
|
&& ObjectProperty->PropertyClass->IsChildOf(UActorComponent::StaticClass())
|
|
&& PreviousValue != ValueAfterImport)
|
|
{
|
|
FString ComponentName = PreviousValue;
|
|
ConstructorHelpers::StripObjectClass(ComponentName);
|
|
if (UActorComponent* Component = Cast<UActorComponent>(StaticFindObject(UActorComponent::StaticClass(), ANY_PACKAGE, *ComponentName)))
|
|
{
|
|
Component->Modify();
|
|
Component->Rename(nullptr, GetTransientPackage(), REN_DontCreateRedirectors);
|
|
}
|
|
}
|
|
|
|
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);
|
|
|
|
InPropertyChangedEvent.SetActiveMemberProperty(OriginalActiveProperty);
|
|
InNotifyHook->NotifyPostChange( InPropertyChangedEvent, &PropertyChain.Get() );
|
|
}
|
|
}
|
|
|
|
|
|
if( 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);
|
|
|
|
// Redraw viewports
|
|
FEditorSupportDelegates::RedrawAllViewports.Broadcast();
|
|
}
|
|
|
|
|
|
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);
|
|
}
|
|
|
|
bool FPropertyNode::ParentOrSelfHasMetaData(const FName& MetaDataKey) const
|
|
{
|
|
return (Property.IsValid() && Property->HasMetaData(MetaDataKey)) || (ParentNode && ParentNode->ParentOrSelfHasMetaData(MetaDataKey));
|
|
}
|
|
|
|
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::PropagateContainerPropertyChange( UObject* ModifiedObject, const FString& OriginalContainerContent, EPropertyArrayChangeType::Type ChangeType, int32 Index )
|
|
{
|
|
UProperty* NodeProperty = GetProperty();
|
|
UArrayProperty* ArrayProperty = NULL;
|
|
USetProperty* SetProperty = NULL;
|
|
UMapProperty* MapProperty = NULL;
|
|
|
|
FPropertyNode* ParentPropertyNode = GetParentNode();
|
|
|
|
UProperty* ConvertedProperty = NULL;
|
|
|
|
if (ChangeType == EPropertyArrayChangeType::Add || ChangeType == EPropertyArrayChangeType::Clear)
|
|
{
|
|
ConvertedProperty = NodeProperty;
|
|
}
|
|
else
|
|
{
|
|
ConvertedProperty = Cast<UProperty>(NodeProperty->GetOuter());
|
|
}
|
|
|
|
ArrayProperty = Cast<UArrayProperty>(ConvertedProperty);
|
|
SetProperty = Cast<USetProperty>(ConvertedProperty);
|
|
MapProperty = Cast<UMapProperty>(ConvertedProperty);
|
|
|
|
check(ArrayProperty || SetProperty || MapProperty);
|
|
|
|
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);
|
|
}
|
|
|
|
FString OriginalContent;
|
|
ConvertedProperty->ExportText_Direct(OriginalContent, Addr, Addr, NULL, PPF_Localized);
|
|
|
|
bool bIsDefaultContainerContent = OriginalContent == OriginalContainerContent;
|
|
|
|
if (Addr != NULL && ArrayProperty)
|
|
{
|
|
FScriptArrayHelper ArrayHelper(ArrayProperty, Addr);
|
|
|
|
// Check if the original value was the default value and change it only then
|
|
if (bIsDefaultContainerContent)
|
|
{
|
|
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));
|
|
}
|
|
}
|
|
} // End Array
|
|
|
|
else if ( Addr != NULL && SetProperty )
|
|
{
|
|
FScriptSetHelper SetHelper(SetProperty, Addr);
|
|
|
|
// Check if the original value was the default value and change it only then
|
|
if (bIsDefaultContainerContent)
|
|
{
|
|
int32 ElementToInitialize = -1;
|
|
switch (ChangeType)
|
|
{
|
|
case EPropertyArrayChangeType::Add:
|
|
ElementToInitialize = SetHelper.AddDefaultValue_Invalid_NeedsRehash();
|
|
SetHelper.Rehash();
|
|
break;
|
|
case EPropertyArrayChangeType::Clear:
|
|
SetHelper.EmptyElements();
|
|
break;
|
|
case EPropertyArrayChangeType::Insert:
|
|
check(false); // Insert is not supported for sets
|
|
break;
|
|
case EPropertyArrayChangeType::Delete:
|
|
SetHelper.RemoveAt(ArrayIndex);
|
|
SetHelper.Rehash();
|
|
break;
|
|
case EPropertyArrayChangeType::Duplicate:
|
|
check(false); // Duplicate not supported on sets
|
|
break;
|
|
}
|
|
|
|
if (ElementToInitialize >= 0)
|
|
{
|
|
AdditionalInitializationUDS(SetProperty->ElementProp, SetHelper.GetElementPtr(ElementToInitialize));
|
|
}
|
|
}
|
|
} // End Set
|
|
else if (Addr != NULL && MapProperty)
|
|
{
|
|
FScriptMapHelper MapHelper(MapProperty, Addr);
|
|
|
|
// Check if the original value was the default value and change it only then
|
|
if (bIsDefaultContainerContent)
|
|
{
|
|
int32 ElementToInitialize = -1;
|
|
switch (ChangeType)
|
|
{
|
|
case EPropertyArrayChangeType::Add:
|
|
ElementToInitialize = MapHelper.AddDefaultValue_Invalid_NeedsRehash();
|
|
MapHelper.Rehash();
|
|
break;
|
|
case EPropertyArrayChangeType::Clear:
|
|
MapHelper.EmptyValues();
|
|
break;
|
|
case EPropertyArrayChangeType::Insert:
|
|
check(false); // Insert is not supported for maps
|
|
break;
|
|
case EPropertyArrayChangeType::Delete:
|
|
MapHelper.RemoveAt(ArrayIndex);
|
|
MapHelper.Rehash();
|
|
break;
|
|
case EPropertyArrayChangeType::Duplicate:
|
|
check(false); // Duplicate is not supported for maps
|
|
break;
|
|
}
|
|
|
|
if (ElementToInitialize >= 0)
|
|
{
|
|
uint8* PairPtr = MapHelper.GetPairPtr(ElementToInitialize);
|
|
|
|
AdditionalInitializationUDS(MapProperty->KeyProp, MapProperty->KeyProp->ContainerPtrToValuePtr<uint8>(PairPtr));
|
|
AdditionalInitializationUDS(MapProperty->ValueProp, MapProperty->ValueProp->ContainerPtrToValuePtr<uint8>(PairPtr));
|
|
}
|
|
}
|
|
} // End Map
|
|
}
|
|
|
|
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);
|
|
UMapProperty* ParentMapProp = Cast<UMapProperty>(ParentProp);
|
|
USetProperty* ParentSetProp = Cast<USetProperty>(ParentProp);
|
|
UProperty* Prop = GetProperty();
|
|
|
|
if (ParentArrayProp && ParentArrayProp->Inner != Prop)
|
|
{
|
|
ParentArrayProp = nullptr;
|
|
}
|
|
|
|
if (ParentMapProp && ParentMapProp->KeyProp != Prop && ParentMapProp->ValueProp != Prop)
|
|
{
|
|
ParentMapProp = nullptr;
|
|
}
|
|
|
|
if (ParentSetProp && ParentSetProp->ElementProp != Prop)
|
|
{
|
|
ParentSetProp = 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)
|
|
{
|
|
uint8* DestSimplePropAddr = GetValueBaseAddress( (uint8*)ActualObjToChange );
|
|
if (DestSimplePropAddr != nullptr)
|
|
{
|
|
UProperty* ComplexProperty = Prop;
|
|
FPropertyNode* ComplexPropertyNode = this;
|
|
if (ParentArrayProp || ParentMapProp || ParentSetProp)
|
|
{
|
|
ComplexProperty = ParentProp;
|
|
ComplexPropertyNode = ParentNode;
|
|
}
|
|
|
|
uint8* DestComplexPropAddr = ComplexPropertyNode->GetValueBaseAddress((uint8*)ActualObjToChange);
|
|
uint8* ModifiedComplexPropAddr = ComplexPropertyNode->GetValueBaseAddress((uint8*)ModifiedObject);
|
|
|
|
bool bShouldImport = false;
|
|
{
|
|
uint8* TempComplexPropAddr = (uint8*)FMemory::Malloc(ComplexProperty->GetSize(), ComplexProperty->GetMinAlignment());
|
|
ComplexProperty->InitializeValue(TempComplexPropAddr);
|
|
ON_SCOPE_EXIT
|
|
{
|
|
ComplexProperty->DestroyValue(TempComplexPropAddr);
|
|
FMemory::Free(TempComplexPropAddr);
|
|
};
|
|
|
|
// Importing the previous value into the temporary property can potentially affect shared state (such as FText display string values), so we back-up the current value
|
|
// before we do this, so that we can restore it once we've checked whether the two properties are identical
|
|
// This ensures that shared state keeps the correct value, even if the destination property itself isn't imported (or only partly imported, as is the case with arrays/maps/sets)
|
|
FString CurrentValue;
|
|
ComplexProperty->ExportText_Direct(CurrentValue, ModifiedComplexPropAddr, nullptr, ModifiedObject, PPF_None);
|
|
ComplexProperty->ImportText(*PreviousValue, TempComplexPropAddr, PPF_None, ModifiedObject);
|
|
bShouldImport = ComplexProperty->Identical(DestComplexPropAddr, TempComplexPropAddr, PPF_None);
|
|
ComplexProperty->ImportText(*CurrentValue, TempComplexPropAddr, PPF_None, ModifiedObject);
|
|
}
|
|
|
|
// Only import if the value matches the previous value of the property that changed
|
|
if (bShouldImport)
|
|
{
|
|
Prop->ImportText(NewValue, DestSimplePropAddr, PPF_None, 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::IsHidden(const FString& Value, TArray<FText>* OutReasons) const
|
|
{
|
|
bool bIsHidden = false;
|
|
for( auto It = Restrictions.CreateConstIterator() ; It ; ++It )
|
|
{
|
|
TSharedRef<const FPropertyRestriction> Restriction = (*It);
|
|
if( Restriction->IsValueHidden(Value) )
|
|
{
|
|
bIsHidden = true;
|
|
if (OutReasons)
|
|
{
|
|
OutReasons->Add(Restriction->GetReason());
|
|
}
|
|
else
|
|
{
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
return bIsHidden;
|
|
}
|
|
|
|
bool FPropertyNode::IsDisabled(const FString& Value, TArray<FText>* OutReasons) const
|
|
{
|
|
bool bIsDisabled = false;
|
|
for (const TSharedRef<const FPropertyRestriction>& Restriction : Restrictions)
|
|
{
|
|
if( Restriction->IsValueDisabled(Value) )
|
|
{
|
|
bIsDisabled = true;
|
|
if (OutReasons)
|
|
{
|
|
OutReasons->Add(Restriction->GetReason());
|
|
}
|
|
else
|
|
{
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
return bIsDisabled;
|
|
}
|
|
|
|
bool FPropertyNode::IsRestricted(const FString& Value, TArray<FText>& OutReasons) const
|
|
{
|
|
const bool bIsHidden = IsHidden(Value, &OutReasons);
|
|
const bool bIsDisabled = IsDisabled(Value, &OutReasons);
|
|
return (bIsHidden || bIsDisabled);
|
|
}
|
|
|
|
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;
|
|
const 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;
|
|
}
|
|
|
|
#undef LOCTEXT_NAMESPACE
|