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 3358702 on 2017/03/22 by Marc.Audy Always mark child actors pending kill when in PostLoad as often the World is too early to have a WorldContext which causes issues in DestroyActor #jira UE-42679 Change 3358737 on 2017/03/22 by Mieszko.Zielinski Exposed UBrainComponent::IsRunning() and UBrainComponent::IsPaused() to Blueprint #UE4 Change 3359062 on 2017/03/22 by Michael.Noland Blueprints: Show the Save and Find in CB buttons when working with level script blueprints (they will save/show the map package) #jira UE-30748 Change 3359066 on 2017/03/22 by Michael.Noland PR #3348: Make fields of FAttributeMetaData editable (Contributed by hoelzl) #jira UE-42620 Change 3359069 on 2017/03/22 by Michael.Noland PR #3288: InverseLerp Blueprint Tooltips Clarification (Contributed by wunawuna) #jira UE-42250 Change 3359108 on 2017/03/22 by Michael.Noland Blueprints: Fix an issue where running the editor in a different culture could break pins on nodes that have optional arrays of pins (e.g., animation graph nodes like blend by layer) #jira UE-36232 Change 3359235 on 2017/03/22 by Marc.Audy Expose bShouldPerformFullTickWhenPaused to blueprints and details panel #jira UE-17286 Change 3359324 on 2017/03/22 by Zak.Middleton #ue4 - (Merge) Disable collision on NavModifierVolumes. Previously they had an OverlapAll response and generated overlap events. They are only supposed to be used for preventing nav mesh generation, but overlap events could affect gameplay, and also are bad for performance. (Integrate CL 3249525 from Odin). Change 3359326 on 2017/03/22 by Zak.Middleton #ue4 - (Merge) Optimization during attachment to check bool before expensive casts and body instance fetching. (Integrate CL 3261262 from Odin). Change 3359327 on 2017/03/22 by Zak.Middleton #ue4 - (Merge) Make bSkipAgentHeightCheckWhenPickingNavData actually ignore height when picking data. (Integrate CL 3231908 from Odin) Change 3359328 on 2017/03/22 by Zak.Middleton #ue4 - (Merge) Make a static FName in UMovementComponent::OverlapTest const and move it to a namespace. (Integrate CL 3259985 from Odin) Change 3359329 on 2017/03/22 by Zak.Middleton #ue4 - (Merge) Fix ProjectileMovementComponent continuing to simulate (and generate hit events) after it is deactivated during simulation. HasStoppedSimulation() should check if bIsActive is false. (Integrate CL 3260001 from Odin) Change 3359330 on 2017/03/22 by Zak.Middleton #ue4 - (Merge) Fix accumulated forces in CharacterMovement when movement mode or activation changes. - Added CharacterMovementComponent::ClearAccumulatedForces() - AddForce() and related functions now avoid adding the force if in MovementMode "None". When ticking in "None", forces are cleared so they don't pile up until the next valid movement mode. Forces are also cleared if the updated component changes or when the capsule simulates physics. - CharacterMovementComponent::Deactivate() implemented to stop movement and call ClearAccumulatedForces(). - ClearAccumulatedForces() now also clears pending launch velocity. - Exposed ClearAccumulatedForces() to blueprints. - AddForce() and AddImpulse() now also check that character movement is active (not deactivated, able to tick). - ApplyAccumulatedForces() does not call ClearAccumulatedForces(), since that would prevent pending launch. - SimulateMovement() handles pending launch and clears forces regardless of whether it's simulated proxy. Added note to investigate using ApplyAccumulatedForces() in SimulateMovement(). - Inlined ActorComponent::IsActive(). (Integrate CLs3259933, 3266018 from Odin) Change 3359338 on 2017/03/22 by Zak.Middleton #ue4 - (Merge) TickCharacterPose() and clear root motion before abandoning tick in UCharacterMovementComponent::PerformMovement() when movement mode is None. Prevents root motion building up until next valid movement mode. (Integrate CL 3271928 from Odin) Change 3359345 on 2017/03/22 by Zak.Middleton #ue4 - (Merge) Fix characters sliding when landing on slanted surfaces or stairs, when aggressive "Perch" settings could cause a line trace (from the center of a capsule) instead of capsule trace and thereby screw up the floor distance checks. (Integrate CL 3273026 from Odin) Change 3359381 on 2017/03/22 by Zak.Middleton #ue4 - (Merge) Performance tweak to ApplyRadialDamageWithFalloff(). Don't rebuild FRadialDamageEvent each loop over hit actors. Added stats for BreakHitResult()/MakeHitResult() under "stat game". (Integrate CLs 3275415, 3276810 from Odin). Change 3359422 on 2017/03/22 by Zak.Middleton #ue4 - (Merge) Fix build (CollisionProfile included). Change 3359442 on 2017/03/22 by Michael.Noland Blueprints: Prevent comment boxes from clipping the last letter of some words at the edge by increasing the padding on the wrap-at position Change 3359445 on 2017/03/22 by Michael.Noland PR #2989: Improved BP comment nodes (Contributed by projectgheist) #jira UE-36788 #jira UE-39118 Change 3359446 on 2017/03/22 by Zak.Middleton #ue4 - (Merge) Add support for FScopedMovementUpdate to be able to queue up overlaps that do not require reflexive bGenerateOverlapEvents. This allows custom inspection or processing of overlaps within a scoped move. Overlap events from the move will still only trigger in UpdateOverlaps() if bGenerateOverlapEvents is enabled on both components, as before. (Integrate CL 3278307 from Odin) Change 3359494 on 2017/03/22 by Zak.Middleton #ue4 - (Merge) Make some data in FScopedMovementUpdate protected rather than private so it can easily be subclassed, and expose a new helper SetWorldLocationAndRotation(). (Integrated CL 3280775 from Odin). Change 3359506 on 2017/03/22 by Zak.Middleton #ue4 - (Merge) MovementComponent::Deactivate() calls StopMovement() to clear cached velocity. It's silly that reactivation many seconds or frames later would restore that velocity. Some special handling in CharacterMovement to keep it acting as before (it cleared velocity, but did not clear the path request, leaving that alone). (Integrate CL 3287026 from Odin). Change 3359514 on 2017/03/22 by Zak.Middleton #ue4 - (Merge) Collision.ListComponentsWithResponseToProfile command includes pending kill objects. (Integrate CL 3293322 from Odin) Change 3359553 on 2017/03/22 by Zak.Middleton #ue4 - (Merge) Optimization in CharacterMovement tick to not extract transform values twice. (Integrate CL 3299098 from Odin). Change 3359554 on 2017/03/22 by Zak.Middleton #ue4 - (Merge) Perf: optimize UKismetMathLibrary::GetForwardVector() (converts Rotator to forward direction). This way we avoid building a matrix, and avoids 1 more SinCos call. (Integrate CL 3296254 from Odin). Change 3359555 on 2017/03/22 by Zak.Middleton #ue4 - (Merge) Add OnComponentCollisionSettingsChangedEvent delegate to PrimitiveComponent. Fixed SkeletalMeshComponent not calling Super implementation. (Integrate CL 3295744 from Odin) Change 3359561 on 2017/03/22 by Zak.Middleton #ue4 - (Merge) Perf: AActor::GetComponents() with generic type should *not* assume the output array needs space for the entire contents of OwnedComponents. If OwnedComponents.Num() > the array reserve size, this forces an allocation, even if few or no components of the requested type are found. (Integrate CL 3299111 from Odin) Change 3359573 on 2017/03/22 by dan.reynolds Added BP log to the Passive Mix Modifier test platform BP Change 3359593 on 2017/03/22 by Zak.Middleton #ue4 - (Merge) Perf: avoid allocations during creation in AAIController::PostInitializeComponents() (in development builds). (Integrate CL 3299118 from Odin) Change 3359595 on 2017/03/22 by Zak.Middleton #ue4 - (Merge) Perf: HasActiveCameraComponent() and HasActivePawnControlCameraComponent() don't need to fill in an array while searching for a certain component. Also see CL 3359561, which could cause each of these functions to always cause an allocation when filling in the array when num components > 24. (Integrate CL 3299116 from Odin) Change 3359602 on 2017/03/22 by Zak.Middleton #ue4 - (Merge) Clean up some of the new fast overlap code in PrimitiveComponent. Mostly some variable renaming, and CVar access optimization. (Integrate CL 3340622 from Odin) Change 3359616 on 2017/03/22 by Zak.Middleton #ue4 - (Merge) Added support for bIgnoreTouches to FCollisionQueryParams. MoveComponent uses this to avoid PhysX collision queries for overlaps in GeomSweepMulti when bGenerateOverlapEvents is off. (Integrate CL 3340635 from Odin) Change 3359864 on 2017/03/23 by Mieszko.Zielinski Added a safeguard to prevent crashes resulting from people trying to name their BB keys things longer than 1024 characters #UE4 #jira UE-43120 Change 3360884 on 2017/03/23 by Zak.Middleton #ue4 - (Merge) Audio: AUDIO_MIXER_ENABLE_DEBUG_MODE turned off in Test builds. Shipping already had it off. (Integrate CL 3310724 from Odin) Change 3361045 on 2017/03/23 by Zak.Middleton #ue4 - (Merge) Audio: new cvars to help with optimization: - au.DisableReverbSubmix - au.DisableEQSubmix - au.DisableParallelSourceProcessing - au.SetAudioChannelCount Also checked in some code to cut down on the amount of parameter setting in EQ (Integrate of CL3303165in Odin by Aaron.Mcleran) Change 3361172 on 2017/03/23 by Zak.Middleton #ue4 - (Merge) Audio: added stat for HRTF. (Integrate CL 3310728 from Odin) Change 3361189 on 2017/03/23 by Zak.Middleton #ue4 - (Merge) CVar to toggle HRTF for perf settings. Default is on. (Integrate CL 3310926 from Odin). Change 3361914 on 2017/03/23 by Aaron.McLeran UE-42649 Fixing crash in cleaning up active sound in sound concurrency -Handling edge case of an active sound not have a sound base ptr, which is possible. Change 3361924 on 2017/03/23 by Aaron.McLeran UE-41378 Fixing passive mix modifier bug Change 3361978 on 2017/03/23 by Aaron.McLeran UE-42627 Fix for when audio device is removed and getting a deadlock in computing audio clock Change 3361989 on 2017/03/23 by Aaron.McLeran PR #3010: Check for null GEngine on sound processing Change 3362053 on 2017/03/23 by Zak.Middleton #ue4 - (Merge) Audio: Perf: Avoid thousands of Array.Add() calls during processing, which on shipping still does checks to see if the allocator has to grow, and updates ArrayCount. (Integrate CL 3311120 from Odin) Change 3362102 on 2017/03/23 by Aaron.McLeran PR #3182: Enabled SwitchOnEnum nodes for EAttenuationShape and EAttenuationDistanceModel Change 3362153 on 2017/03/23 by Aaron.McLeran UE-43286 Oculus audio plugin not working/available Change 3362162 on 2017/03/23 by Aaron.McLeran UE-42252 Frequent ensure in FLevelEditorViewportClient::UpdateAudioListener Change 3362206 on 2017/03/23 by Aaron.McLeran UE-43287 Fixing HRTF spatialization in editor viewport - Steam Audio doesn't support multiple audio devices at the moment - Instead of hard-coding all audio plugins to not work in main audio device (GDC temp fix), I allow audio plugins to specify if they should be used on main audio device Change 3362775 on 2017/03/24 by mason.seay Replaced deprecated node Change 3363024 on 2017/03/24 by Ben.Zeigler Fix regression in behavior of streamable manager where loading both a valid and null asset used to work but now fails. Instead added a warning for that case, but if only null are requested it still fails with an error Change 3363030 on 2017/03/24 by Zak.Middleton #ue4 - Lower default max sendrate for clients to 60Hz from 90Hz when net speed is high and player count is low. Throttled rate remains at 45Hz. This value has been tested in Paragon with no ill effect, and saves on bandwidth and server CPU when clients run at high framerate. Change 3363036 on 2017/03/24 by Zak.Middleton #ue4 - (Merge) Audio: Perf: turned a float divide into a multiply. It happens at least 32k times per audio update. (Integrate CL 3311158 from Odin) Change 3363541 on 2017/03/24 by Zak.Middleton #ue4 - (Merge) Audio: Perf: remove pointer indirection, and successive TArray Add()s in GetChannelMap(). (Integrate CL 3311169 from Odin) Change 3363642 on 2017/03/24 by Zak.Middleton #ue4 - (Merge) Audio: Perf: Save ~5% total audio update time. Savings in "Source Output Buffers". - Removed function call overhead to updating channel map. 64,000 function calls... - Simplified FSourceParam::Update() to reduce branching and have 1 return site. - Added alternative to GetChannelMap() called UpdateChannelMap() that avoids copying out values to an array. The values can then be fetched from the channel data directly. (Integrate CL 3311235 from Odin) Change 3364441 on 2017/03/24 by Ben.Zeigler Fix issue where calling LoadLocalIniFile on a plugin file would result in an empty file. It was assuming engine/game dirs, now it instead pulls it out of GConfig if available. This fixes issue where iterative cooking would fail on plugin config files Add FindConfigFileWithBaseName to GConfig Change 3364652 on 2017/03/25 by Phillip.Kavan #jira UE-43210 - Fix a runtime VM crash upon removing an element from a set after consecutive add/remove iterations. Change summary: - Fixed FScriptSet::Add() to initialize the HashIndex member of the new element when the HashSize does not change. Change 3365609 on 2017/03/27 by Richard.Hinckley #jira UEDOC-4720 Fixed global enums being dropped from documentation after being extracted by Doxygen. Change 3365737 on 2017/03/27 by Marc.Audy Move setting of the ParentComponent property on an actor to PostRepNotifies instead of having a separate OnRep function. Change 3365795 on 2017/03/27 by Marc.Audy Fix compile error Change 3365894 on 2017/03/27 by Phillip.Kavan #jira UE-35507 - Fix for a GLEO when choosing an LSBP class as the default value for a class input pin in a non-LSBP graph. Change summary: - Modified FGraphPinFilter::IsClassAllowed() to disallow a given class if the type is contained within a map package that does not match the current graph context. Change 3366067 on 2017/03/27 by Marc.Audy Add UWorld* to PostLoadMap indicating which world has been loaded. Null if an error has occurred. #jira UE-40228 Change 3366097 on 2017/03/27 by Marc.Audy Fixed missed deprecation disable pairing for PostLadMap Change 3366170 on 2017/03/27 by Aaron.McLeran Fixing div by zero Change 3366221 on 2017/03/27 by Aaron.McLeran UE-43240 Removing dependency on component visualizers in runtime Phonon module. Change 3366698 on 2017/03/27 by Marc.Audy Fix Orion compile errors Change 3366782 on 2017/03/27 by Aaron.McLeran Bringing over optimizations from Odin to Dev-framework. Original CL3311435Change 3366818 on 2017/03/27 by Aaron.McLeran Bringing fix from Odin to Dev-Framework from CL 3304533 Fix for rare condition that stomps memory during source recycling. Change 3366984 on 2017/03/27 by Michael.Noland Blueprints: Downgraded a warning in the connection drawing policy to verbose to suppress it. It does no good to a typical user. #jira UE-41638 Change 3367085 on 2017/03/27 by Brent.Pease - Improve AudioMixer buffering so that only two buffers are needed instead of three, buffer submission and buffer processing are ovelapped, and a warning is issued if the audio processing thread can not keep up. - Added time critical thread priority so that audio processing is not starved which would produce clicks and popping - Allow the audio thread to not be created if a platform implements its own BeginGeneratingAudio() call (as happens on Android) Change 3367434 on 2017/03/28 by Marc.Audy Fix UT compile error Change 3368587 on 2017/03/28 by Mike.Beach Adding a "CookedOnly" plugin type (now used by the nativized Blueprint plugin). Change 3368724 on 2017/03/28 by Zak.Middleton #ue4 - MovementComponent does not ignore initial blocking overlaps when moving from SafeMoveUpdatedComponent(). Set "p.MoveIgnoreFirstBlockingOverlap" back to zero and add a new flag that prevents the depenetration test from generating hit events (to prevent the problem discovered in UE-39387). #jira UE-41613, UE-28610 Change 3368748 on 2017/03/28 by Dan.Oconnor Provide &FUObjectThreadContext::Get().ObjLoaded when using the compilation manager, add validation functions for finding REINST/TRASH references Change 3368852 on 2017/03/28 by Mike.Beach Fixing a CIS error before it happens - wrapping implementation in preprocessor defines to match declaration in header. Change 3368873 on 2017/03/28 by Dan.Oconnor Rather than collecting script object references, just use the ScriptObjectReferences array. This allows reference replacing archives to update ScriptObjectReferences. Change 3368998 on 2017/03/28 by Dan.Oconnor Setting CLASS_Interface early in the compilation process Change 3369494 on 2017/03/29 by Marc.Audy Fix UAT compile error Change 3369924 on 2017/03/29 by Zak.Middleton #ue4 - Allow CharacterMovement AdjustFloorHeight() to adjust using the line trace if in penetration. Force next floor check so it will check after it depenetrates. #jira UE-36973 Change 3369932 on 2017/03/29 by Ben.Zeigler #jira UE-19494 Finish asset auditing work by allowing reading back a cooked asset registry in the editor Split off FAssetRegistryState as the struct to hold serialization and accessors, to allow loading multiple platform states at once. Optimized runtime asset registry serialization to be around 1/3 as large as before. Dependencies are disabled by default for the runtime registry, you can re-enable with bSerializeDependencies in Engine.ini Add FAssetPackageData which is explicitly per-package and only updated on save/load time. File size is stored in here and is computed for both editor and cooked data Add code to AssetManagerEditorModule to allow loading pre-cooked asset registry files and reading cooked sizes. The Asset Audit window now has a platform drop down that allows reading from cooked data Rename ChunkManifestGenerator to AssetRegistryGenerator and change it to directly hold an FAssetRegistryState internally Add new experimental AssetRegistry mode for iterative cooking. This mode is much faster as it does not need to do it's own internal dependency checking and it can be enabled with bUseAssetRegistryForIteration Change it so during cooking it doesn't directly load string asset references, but instead cues them for cook and uses the asset registry to find and add redirector mappings that are used during save time Change3370028on 2017/03/29 by Ben.Zeigler CIS fix Change 3370360 on 2017/03/29 by Mike.Beach Adding an extra field to FPlatformInfo; a 'UBTTarget' identifier intended to sync up with UBT's UnrealTargetPlatform enum (needed for programatically generating plugin platform whitelists). Change 3370363 on 2017/03/29 by Ben.Zeigler Fix issue where loading out of date editor asset registry cache would throw pointless errors Change 3370414 on 2017/03/29 by Marc.Audy Remove autos Change 3370428 on 2017/03/29 by Ben.Zeigler Fix linux CIS issue, remove implicit conversion from FSavePackageResultStruct back to enum result as it was creating ambiguous operators Change 3370453 on 2017/03/29 by Marc.Audy CIS fix Change 3370548 on 2017/03/29 by Marc.Audy #rn Fix issues with seamless travel in PIE and shared sub levels between different parents. Change 3370564 on 2017/03/29 by Mieszko.Zielinski PR #3429: fix comment typo (Contributed by kayama-shift) Change 3370602 on 2017/03/29 by Mieszko.Zielinski Fixed FRecastTileGenerator::Modifiers being erroneously counted twice when stating memory #UE4 Change 3370615 on 2017/03/29 by Phillip.Kavan #jira UE-35515 - No longer crash when creating a new BP class from one or more selected Actors in which the root component is not Blueprint-spawnable. Change summary: - Modified FKismetEditorUtilities::AddComponentsToBlueprint() to handle deferred SceneComponent SCS node adds when the parent component was not also added (due to not being BP-spawnable). Change 3370693 on 2017/03/29 by Michael.Noland Fixing some bad indentation #rnx Change 3370740 on 2017/03/29 by Ben.Zeigler DLC/Mod Cooking fixes, the list of packages from release build as in uncooked filename format so fixed code and made this more obvious Fix Asset Registry to allow loading multiple source asset registries into the same state, by keeping a list of preallocated buffers Change 3370792 on 2017/03/29 by Michael.Noland Blueprints: Deleted some unversioned backwards compat. code that would only matter for assets older than VER_UE4_OLDEST_LOADABLE_PACKAGE Change 3370794 on 2017/03/29 by Michael.Noland PR #3190: Reduce some output logging - Reduced an Oculus log from Log to Verbose because it spams quite a bit - Corrected the spelling and the meaning of a blueprint warning when an invalid breakpoint is encountered - Treat UInputComponent::GetAxisValue(None) as not a warning - Switch FGenericSaveGameSystem::LoadGame to silently attempt to load the file, it returns success/failure and it isn't necessary to have a separate warning at the file i/o layer #jira UE-41446 Change 3370831 on 2017/03/29 by Dan.Oconnor Iteration on compilation manager - Fix Skeleton class compilation order - Pass ObjLoaded array to compilation manager to ensure all objects get PostLoaded - Make sure data only classes get reinstanced, so that UpdateCustomPropertyListForPostConstruction is run correctly Change 3370923 on 2017/03/29 by Michael.Noland Blueprints: Added an icon to indicate whether or not a macro contains latent actions - Note: The state of the icon is cached for performance reasons on request, with the cache being cleared when the BP containing the macro is modified or a macro graph is removed - This does mean that editing the inner macro of a nested macro to add/remove a latent action will not show up in visualization for the outer node until the editor is restarted or the outer macro is modified Change 3371039 on 2017/03/29 by Dan.Oconnor Hacky fix for dropping return params when a function's return node is culled Change 3371750 on 2017/03/30 by Richard.Hinckley Stencil write mask exposed. Adds nine new options (all bits, plus each bit individually - write on pass or depth fail). This allows stencil overlaps to be detected by mixing masks. Change 3372513 on 2017/03/30 by Ben.Zeigler #jira UE-43475 Fix cooker issues with string asset references to null packages. Fix redirector detection to follow recursive chains, and correctly strip object class from redirected string asset references. Change 3372565 on 2017/03/30 by Richard.Hinckley Rolling back stencil change, will be moved to Dev-Rendering. Change 3372764 on 2017/03/30 by Marc.Audy Do not create a duplicate sub object that is not in the annotation if a sub object of the same name and class already exists. #jira UE-43328 #rn Fixed cases where the blueprint of a class used as a child actor could be dirtied when compiling the owning blueprint. Change 3372847 on 2017/03/30 by Marc.Audy Fix missing include Change 3372994 on 2017/03/30 by Zak.Middleton #ue4 - Fix build in Debug (checkSlow using incorrect function params). Change 3373195 on 2017/03/30 by Mike.Beach For nativization, changing it so we key off of the target platform-info struct instead of the platform (in preparation for defining the nativized plugin's platform whitelist). Change 3373320 on 2017/03/30 by mason.seay Basic for TM-Gameplay map (WIP) Change 3373448 on 2017/03/30 by Ben.Zeigler Fix recursive size display in audit window Improve asset manager comments Change 3373576 on 2017/03/30 by dan.reynolds AEOverview Update: Updated Passive Mix Modifier Test based on recent changes in behavior Also added Initial Delay Time timer to test Change 3373589 on 2017/03/30 by dan.reynolds AEOverview Passive Mix Mod Test Map update Change 3373624 on 2017/03/30 by Zak.Middleton #ue4 - Increase Pawn location replication precision to 2 decimal places from 0. Prevents replicated pawns from being inside geometry by a large amount. Removed CVars controlling CharacterMovement proxy shrink amount and made those instanced properties on the component. #jira UE-40420 Change 3374271 on 2017/03/31 by Marc.Audy Fix deprecation warning in new UT code Change 3374320 on 2017/03/31 by Marc.Audy Fix HTML5 compile. Change 3374413 on 2017/03/31 by Jeff.Farris Added ENGINE_API to 2 functions in PlanarReflection, so projects can subclass it. (Copied CL3276454from Robo Recall to Dev-Framework) Change 3374414 on 2017/03/31 by Jeff.Farris Added support for setting UNavigationSystem::bUpdateNavOctreeOnComponentChange (Copied CL 3267903 from RoboRecall to Dev-Framework) Change 3374616 on 2017/03/31 by Ben.Zeigler Copy of Fortnite CL #3312058 to add a missing redirector. I do not understand why this is not erroring on Main, I guess my minor cook changes somehow exposed this Change 3374664 on 2017/03/31 by Jeff.Farris Consted AIController::GetBrainComponent() (Copied 3239101 from Robo Recall to Dev-Framework) Change 3374665 on 2017/03/31 by Jeff.Farris PrimitiveComponent bIgnoreRadialImpulse and bIgnoreRadialForce are now exposed to BPs. bIgnoreRadialImpulse now respected when applying impulse to relevant movement components. (Coped CL 3242355 from Robo Recall to Dev-Framework) Change 3374779 on 2017/03/31 by Jeff.Farris Exposed SetAllPhysicsAngularVelocity to blueprints (Copied CL 3228390 from Robo Recall to Dev-Framework) Change 3374792 on 2017/03/31 by Ben.Zeigler #jira UE-42618 PR #3347: Improve support for FGameplayAttributeData properties in attribute sets (Contributed by hoelzl) Change 3374844 on 2017/03/31 by Ben.Zeigler #jira UE-42587 Fix issue where supressed gameplay effects that granted abilities would only work the first time, it now clears out of date ability handles Change 3374925 on 2017/03/31 by Marc.Audy Don't throw warning about missing world context for inactive worlds. #jira UE-42679 Change 3374927 on 2017/03/31 by Michael.Noland Editor: Added options for configuring the editor window background color and texture, which can be useful to visually distinguish the editor when switching between different branches or projects Change 3374995 on 2017/03/31 by Michael.Noland Editor: Rewrote CallInEditor support and promoted it so it can be used on functions in any class, not just blueprints derived from AActor: - CallInEditor used on native UFUNCTION() declarations will now show up without having to make a BP subclass - CallInEditor can now be used as a top-level keyword in the UFUNCTION() declaration (e.g., UFUNCTION(Category=CoolCommands, CallInEditor)) - Now shows each function as a separate button, placed in the category associated with the function - The button strip entry is now searchable by function name or tooltip - Prevented operating on functions that have parameters or return values, which would crash before - Removed the duplicate copies of properties placed in the Blutility section - Added a scoped transaction around CallInEditor execution - Allowed functions to be marked as CallInEditor in addition to custom events (currently we don't allow editing category or tooltip on custom events...) Editor: Moved Experimental/EarlyAccessPreview details customizations up to UObject so it can be used on any class, not just actors/components Upgrade Note: Behavior has changed so that CallInEditor can be called on CDOs as well, this will probably be walked back in a subsequent update, at least for actors and components. Change 3375005 on 2017/03/31 by Michael.Noland Fixing incremental compilation error due to missing include #rnx Change 3375015 on 2017/03/31 by Michael.Noland Fixing incremental compilation error due to missing include (for real) #rnx Change 3375045 on 2017/03/31 by Marc.Audy Only calculate the streaming levels prefix during seamless travel if it is a PIE world #jira UE-43485 Change 3375053 on 2017/03/31 by Ben.Zeigler #jira UE-41988 Fix it so leaving PIE while gameplay debugger is active will disable HUD extensions properly, restoring ability to print messages to screen Change 3375057 on 2017/03/31 by Ben.Zeigler #jira UE-39226 Don't add to DrawDebug list for player controllers with no local player Change 3375121 on 2017/03/31 by Michael.Noland Added missing include for FScopedTransaction #rnx Change 3375222 on 2017/03/31 by mason.seay Submitting work done to TM-Gameplay. Still WIP Change 3375308 on 2017/03/31 by Michael.Noland Editor: Added back CDO filtering to CallInEditor, it's too easy to explode in the BP editor. May consider allowing opt-in behavior when we revisit Blutilities Change 3375321 on 2017/03/31 by Ben.Zeigler #jira UE-39062 Fix issue where using the level editor toolbar to modify blueprints was not properly marking the blueprints as modified, so the constructor links weren't being updated until manually compiling or resaving Always recompute post constructor links when calling MarkBlueprintAsModified, as it can be called from native and other places where we modified CDOs but don't have a property changed event Change 3375372 on 2017/03/31 by Ben.Zeigler #jira UE-39568 Change Components to specifically update LatentActions the same as Actors do, so they update properly if bUpdateWhilePaused is set Change 3375380 on 2017/03/31 by Marc.Audy Modify IsMainAudioDevice to deal with the case where no audio device has been created. Change 3375402 on 2017/03/31 by Marc.Audy Fix DuplicateWorldForPIE in the case that the OwningWorld is null. Change 3376037 on 2017/04/02 by Phillip.Kavan #jira UE-35332 - Preserve the least common ancestor pin type on object array function node inputs after a node refresh. Change summary: - Added UK2Node_CallArrayFunction::GetDynamicallyTypedPins() to consolidate the code that retrieves type-dependent parameter pins. - Added FBlueprintEditorUtils::FindLinkedPinWithAuthoritativePinType() to consolidate the code that considers other linked pins when choosing which type to propagate to type-dependent parameter pins. - Added FBlueprintEditorUtils::PropagatePinTypeInfo() to consolidate the common code from UK2Node_CallArrayFunction::PropagateArrayTypeInfo(); this eliminated a redundant retrieval of the target pin set. - Refactored UK2Node_CallArrayFunction::PropagateArrayTypeInfo() to now call FBlueprintEditorUtils::PropagatePinTypeInfo() after retrieving the set of dynamically-typed pins. - Refactored UK2Node_CallArrayFunction::NotifyPinConnectionListChanged() to remove some unnecessary iteration passes and to ensure that we propagate the authoritative (least common ancestor) pin type for object- and struct-based types. Change 3376364 on 2017/04/03 by Richard.Hinckley UE-40920 Fix to Paper2D flipbook timeline editor. Previously, the timeline shown was one frame shorter than the animation. Now, the timeline shows the correct frame count. Change 3376366 on 2017/04/03 by Richard.Hinckley UE-40920 Bugfix to Paper2D flipbook editor. The red line indicating the current frame now adjusts properly if the timeline is longer than the editor window and the scroll bar is moved to the right. Change 3376517 on 2017/04/03 by Marc.Audy PR #3195: Added support for GamePad on RawInput Plugin (Contributed by katze7514) #jira UE-41499 Change 3376708 on 2017/04/03 by Mike.Beach Moving nativized plugins into a centralized folder (so we can use it as an additional plugin lookup dir) - this is so we can ultimately keep the generated code around for debugging purposes. Summary of changes: - nativized plugins now moved to ...\Intermediate\Plugins\<PLATFORM>\NativizedAssets - corresponding manifest files get saved inside the module and named to match the platform - nativized modules now whitelisted only for the platform they were generated for - cleanup on how we generate paths (now piping in platform name) and pass multi-cook process ids (for building manifest filenames) - extending the 'NativizeAssets' command line, so you can use it to specify the target plugin path (utilized by UAT to coordinate the plugin path between cook & build - was previously hardcoded in multiple places). Change 3376826 on 2017/04/03 by Phillip.Kavan #jira UE-43330 - Fix a crash when adding an input parameter to a Custom Event node after deleting a Function Graph containing a Create Event node. Change summary: - Modified UK2Node_CreateDelegate::HandleAnyChangeWithoutNotifying() to check for a valid blueprint before accessing it (since the accessor is now a checked operation). - Modified UK2Node_CreateDelegate::GetScopeClass() to also check for a valid blueprint before accessing it. - Switched 'NULL' to 'nullptr' in a few spots. Change 3376831 on 2017/04/03 by Ben.Zeigler #jira UE-43500, clean up UPackage when EDL/async loading fails. This restores EDL LoadPackage to work the same as non EDL and return NULL instead of an invalid empty package Change 3376846 on 2017/04/03 by Ben.Zeigler #jira UE-38760 Properly refresh exec pins when removing pin from a Switch on Int node Change 3376850 on 2017/04/03 by Dan.Oconnor Use authoritative class to mitigate compilation order issues Change 3376961 on 2017/04/03 by Ben.Zeigler #jira UE-43127 Add struct ops implementations for FIntVector and FBox2d, any blueprint type needs struct ops to avoid crashes Fix Box2d variable name in NoExportTypes Change 3376985 on 2017/04/03 by Ben.Zeigler #jira UE-43582 Remove Xbox-specific code from AssetRegistry because it won't work after my refactor. The serialization is much faster now and neither Bob nor I can conceive of a way this would take long enough to stall the main thread. If it it is somehow a problem, it should be wrapped in a slow task instead Change 3377009 on 2017/04/03 by Ben.Zeigler #jira UE-43036 Fix crash when right clicking blueprint with no parent class. Ensures are fine but crashes should be avoided so people can try to copy data out of them Change 3377054 on 2017/04/03 by Zak.Middleton #ue4 - Fix CharacterMovementComponent updated with very high delta time on server when initially joining. Make sure the ServerTimeStamp is initialized to current world time rather than zero to prevent large delta. #jira UE-40344 #udn https://udn.unrealengine.com/questions/310497/large-delta-time-for-first-player-movement-update.html Change 3377061 on 2017/04/03 by Dan.Oconnor Fixes for issues exposed by cooking with compilation manager. When cooking we end up with more blueprints compiling at a single time, which highlighted issues reading from generated classes while they were actively regenerating. Note that EInternalCompilerFlags::PostponeLocalsGenerationUntilPhaseTwo has only been added to mitigate risk - there is no known reason that existing compilation flows can't postpone generatation of local variables. Change 3377073 on 2017/04/03 by Mike.Beach CIS fix - proper initialization ordering. Change 3377371 on 2017/04/03 by Ben.Zeigler #jira UE-43144 Disallow creating map of FText, like bool it is not hashable Change 3377395 on 2017/04/03 by Dan.Oconnor Build fix - make order in source match initialization order in artifact Change 3377417 on 2017/04/03 by Dan.Oconnor Speculative SA fix Change 3377496 on 2017/04/03 by Aaron.McLeran #jira UE-43558 Cleaning up shutdown code with audio plugins. Change 3377608 on 2017/04/03 by Zak.Middleton #ue4 - Added function ACharacter::CacheInitialMeshOffset() to cache initial mesh offset, used as the target for network smoothing. Added a call to this function from BeginPlay() in addition to the existing call from PostInitializeComponents(), and exposed this to blueprints as well. This fixes the case of people moving the mesh in BeginPlay rather than in the editor or construction script and not having the mesh offset reflected correctly in network games. #jira UE-38966 Change 3377880 on 2017/04/03 by Aaron.McLeran Audio bug fixes #jira UE-43600 Fixing sounds played by playsoundatlocation for audio volume calculations #jira UE-43601 Fixing listener volume interpolation #jida UE-43602 Fixing reverb/eq interpolation Change 3377908 on 2017/04/03 by Phillip.Kavan #jira UE-43565 - Fix a regression on type-dependent array function node pins that have more than one link. Change summary: - Added FBlueprintEditorUtils::FindLinkedPinWithMostDerivedPinType() - Modified FBlueprintEditorUtils::FindLinkedPinWithAuthoritativePinType() to properly handle pins that have multiple links. Change 3377912 on 2017/04/03 by Dan.Oconnor Fix for missing SUBINSTANCE variables on anim BP skeletons. I elected to force SUBINSTANCE variable creation for the compilation manager codepath Change 3377946 on 2017/04/03 by Ben.Zeigler #jira UE-43594 Fix issue with streamable manager where a failed load would leave bAsyncLoadRequestOutstanding, which would confuse later calls to stream the same asset Lower some error verbosity now that I believe I have tracked down the issue Change 3377950 on 2017/04/03 by Michael.Noland Blueprints: Prevent merge tool from crashing in SVN when looking at a file with gaps in the revision history (May still not work correctly, but it won't crash; full fix covered by UE-43603) #jira UE-22428 Change 3377981 on 2017/04/03 by Michael.Noland PR #3416: UE-43005: Prevent crash due to too long name (Contributed by projectgheist) #jira UE-43291 #jira UE-43005 Change 3378039 on 2017/04/04 by Michael.Noland PhysX: Allowed the editor to compile when bRuntimePhysicsCooking is disabled (WITH_EDITOR is used in every place in C++ to force it in already) Change 3378041 on 2017/04/04 by Michael.Noland Paper2D: Adjusted under what circumstances CreatePhysicsMeshes is called on various Paper2D types to match UProceduralMeshComponent Change 3378081 on 2017/04/04 by Dan.Oconnor Fix Blueprint Context nodes so that they don't rely on Ar.IsBeingSaved() call before compilation 3x because of copy/paste Change 3378094 on 2017/04/04 by Dan.Oconnor Add missing preload call for compilation manager Change 3378917 on 2017/04/04 by Marc.Audy Fix static analysis (which is very dumb) Change 3378986 on 2017/04/04 by Dan.Oconnor Fix bad merge Change 3379100 on 2017/04/04 by Dan.Oconnor Fix missing CPF_ConstParm/CPF_ReferenceParm/CPF_OutParm logic in 'fast' skeleton path #jira UE-43629 Change 3379102 on 2017/04/04 by Ben.Zeigler Actually fix StreamableManager issues with cancelling a request messing up things in the future. We now always queue a request, even if it failed before or there is one in progress. This has to be done to avoid issues with cancelling the existing request or mounting new files after it's failed once Now that StreamableManager will retry missing files, add failed load packages to the known missing list so it won't spam errors over and over Change 3379147 on 2017/04/04 by Zak.Middleton #ue4 - Improve on CL 3377608: Made Character::CacheInitialMeshOffset() take location and rotation params so you can be explicit on the values, in case you try to change these during network smoothing, where reading the relative offsets would have been skewed. Change 3379254 on 2017/04/04 by Aaron.McLeran Fixing sounds in audio mixer when no EQ has been set. Change 3379760 on 2017/04/04 by Ben.Zeigler #jira UE-43647 Don't delete failed async packages that are rooted [CL 3380073 by Dan Oconnor in Main branch]
1519 lines
44 KiB
C++
1519 lines
44 KiB
C++
// Copyright 1998-2017 Epic Games, Inc. All Rights Reserved.
|
|
|
|
#include "SGraphNode.h"
|
|
#include "EdGraph/EdGraph.h"
|
|
#include "Widgets/SBoxPanel.h"
|
|
#include "SlateOptMacros.h"
|
|
#include "Framework/Application/SlateApplication.h"
|
|
#include "Widgets/Layout/SSpacer.h"
|
|
#include "Widgets/Images/SImage.h"
|
|
#include "Widgets/Input/SButton.h"
|
|
#include "Widgets/Input/SCheckBox.h"
|
|
#include "GraphEditorSettings.h"
|
|
#include "SCommentBubble.h"
|
|
#include "SGraphPin.h"
|
|
#include "GraphEditorDragDropAction.h"
|
|
#include "EdGraphSchema_K2.h"
|
|
#include "K2Node_Literal.h"
|
|
#include "NodeFactory.h"
|
|
#include "Logging/TokenizedMessage.h"
|
|
#include "DragAndDrop/ActorDragDropGraphEdOp.h"
|
|
#include "DragAndDrop/AssetDragDropOp.h"
|
|
#include "Editor/Persona/Public/BoneDragDropOp.h"
|
|
#include "Kismet2/BlueprintEditorUtils.h"
|
|
#include "SLevelOfDetailBranchNode.h"
|
|
#include "Widgets/SToolTip.h"
|
|
#include "IDocumentation.h"
|
|
#include "TutorialMetaData.h"
|
|
#include "SGraphPanel.h"
|
|
#include "Widgets/Text/SInlineEditableTextBlock.h"
|
|
#include "BlueprintEditorSettings.h"
|
|
|
|
/////////////////////////////////////////////////////
|
|
// SNodeTitle
|
|
|
|
void SNodeTitle::Construct(const FArguments& InArgs, UEdGraphNode* InNode)
|
|
{
|
|
GraphNode = InNode;
|
|
|
|
ExtraLineStyle = InArgs._ExtraLineStyle;
|
|
|
|
CachedSize = FVector2D::ZeroVector;
|
|
|
|
// If the user set the text, use it, otherwise use the node title by default
|
|
if(InArgs._Text.IsSet())
|
|
{
|
|
TitleText = InArgs._Text;
|
|
}
|
|
else
|
|
{
|
|
TitleText = TAttribute<FText>(this, &SNodeTitle::GetNodeTitle);
|
|
}
|
|
NodeTitleCache.SetCachedText(TitleText.Get(), GraphNode);
|
|
RebuildWidget();
|
|
}
|
|
|
|
void SNodeTitle::Tick( const FGeometry& AllottedGeometry, const double InCurrentTime, const float InDeltaTime )
|
|
{
|
|
CachedSize = AllottedGeometry.GetLocalSize();
|
|
|
|
// Checks to see if the cached string is valid, and if not, updates it.
|
|
if (NodeTitleCache.IsOutOfDate(GraphNode))
|
|
{
|
|
NodeTitleCache.SetCachedText(TitleText.Get(), GraphNode);
|
|
RebuildWidget();
|
|
}
|
|
}
|
|
|
|
FText SNodeTitle::GetNodeTitle() const
|
|
{
|
|
if (GetDefault<UBlueprintEditorSettings>()->bBlueprintNodeUniqueNames && GraphNode)
|
|
{
|
|
return FText::FromName(GraphNode->GetFName());
|
|
}
|
|
else
|
|
{
|
|
return (GraphNode != NULL)
|
|
? GraphNode->GetNodeTitle(ENodeTitleType::FullTitle)
|
|
: NSLOCTEXT("GraphEditor", "NullNode", "Null Node");
|
|
}
|
|
}
|
|
|
|
FText SNodeTitle::GetHeadTitle() const
|
|
{
|
|
return (GraphNode && GraphNode->bCanRenameNode) ? GraphNode->GetNodeTitle(ENodeTitleType::EditableTitle) : CachedHeadTitle;
|
|
}
|
|
|
|
FVector2D SNodeTitle::GetTitleSize() const
|
|
{
|
|
return CachedSize;
|
|
}
|
|
|
|
void SNodeTitle::RebuildWidget()
|
|
{
|
|
// Create the box to contain the lines
|
|
TSharedPtr<SVerticalBox> VerticalBox;
|
|
this->ChildSlot
|
|
[
|
|
SAssignNew(VerticalBox, SVerticalBox)
|
|
];
|
|
|
|
// Break the title into lines
|
|
TArray<FString> Lines;
|
|
const FString CachedTitleString = NodeTitleCache.GetCachedText().ToString().Replace(TEXT("\r"), TEXT(""));
|
|
CachedTitleString.ParseIntoArray(Lines, TEXT("\n"), false);
|
|
|
|
if (Lines.Num())
|
|
{
|
|
CachedHeadTitle = FText::FromString(Lines[0]);
|
|
}
|
|
|
|
// Pad the height of multi-line node titles to be a multiple of the graph snap grid taller than
|
|
// single-line nodes, so the pins will still line up if you place the node N cell snaps above
|
|
if (Lines.Num() > 1)
|
|
{
|
|
// Note: This code a little fragile, and will need to be updated if the font or padding of titles
|
|
// changes in the future, but the failure mode is just a slight misalignment.
|
|
const int32 EstimatedExtraHeight = (Lines.Num() - 1) * 13;
|
|
|
|
const int32 SnapSize = (int32)SNodePanel::GetSnapGridSize();
|
|
const int32 PadSize = SnapSize - (EstimatedExtraHeight % SnapSize);
|
|
|
|
if (PadSize < SnapSize)
|
|
{
|
|
VerticalBox->AddSlot()
|
|
[
|
|
SNew(SSpacer)
|
|
.Size(FVector2D(1.0f, PadSize))
|
|
];
|
|
}
|
|
}
|
|
|
|
// Make a separate widget for each line, using a less obvious style for subsequent lines
|
|
for (int32 Index = 1; Index < Lines.Num(); ++Index)
|
|
{
|
|
VerticalBox->AddSlot()
|
|
.AutoHeight()
|
|
[
|
|
SNew(STextBlock)
|
|
.TextStyle( FEditorStyle::Get(), ExtraLineStyle )
|
|
.Text(FText::FromString(Lines[Index]))
|
|
];
|
|
}
|
|
}
|
|
|
|
|
|
/////////////////////////////////////////////////////
|
|
// SGraphNode
|
|
|
|
// Check whether drag and drop functionality is permitted on the given node
|
|
bool SGraphNode::CanAllowInteractionUsingDragDropOp( const UEdGraphNode* GraphNodePtr, const TSharedPtr<FActorDragDropOp>& DragDropOp )
|
|
{
|
|
bool bReturn = false;
|
|
|
|
//Allow interaction only if this node is a literal type object.
|
|
//Only change actor reference if a single actor reference is dragged from the outliner.
|
|
if( GraphNodePtr->IsA( UK2Node_Literal::StaticClass() ) && DragDropOp->Actors.Num() == 1 )
|
|
{
|
|
bReturn = true;
|
|
}
|
|
return bReturn;
|
|
}
|
|
|
|
void SGraphNode::SetIsEditable(TAttribute<bool> InIsEditable)
|
|
{
|
|
IsEditable = InIsEditable;
|
|
}
|
|
|
|
bool SGraphNode::IsNodeEditable() const
|
|
{
|
|
bool bIsEditable = OwnerGraphPanelPtr.IsValid() ? OwnerGraphPanelPtr.Pin()->IsGraphEditable() : true;
|
|
return IsEditable.Get() && bIsEditable;
|
|
}
|
|
|
|
/** Set event when node is double clicked */
|
|
void SGraphNode::SetDoubleClickEvent(FSingleNodeEvent InDoubleClickEvent)
|
|
{
|
|
OnDoubleClick = InDoubleClickEvent;
|
|
}
|
|
|
|
void SGraphNode::SetVerifyTextCommitEvent(FOnNodeVerifyTextCommit InOnVerifyTextCommit)
|
|
{
|
|
OnVerifyTextCommit = InOnVerifyTextCommit;
|
|
}
|
|
|
|
void SGraphNode::SetTextCommittedEvent(FOnNodeTextCommitted InOnTextCommitted)
|
|
{
|
|
OnTextCommitted = InOnTextCommitted;
|
|
}
|
|
|
|
void SGraphNode::OnCommentTextCommitted(const FText& NewComment, ETextCommit::Type CommitInfo)
|
|
{
|
|
GetNodeObj()->OnUpdateCommentText(NewComment.ToString());
|
|
}
|
|
|
|
void SGraphNode::OnCommentBubbleToggled(bool bInCommentBubbleVisible)
|
|
{
|
|
GetNodeObj()->OnCommentBubbleToggled(bInCommentBubbleVisible);
|
|
}
|
|
|
|
void SGraphNode::SetDisallowedPinConnectionEvent(SGraphEditor::FOnDisallowedPinConnection InOnDisallowedPinConnection)
|
|
{
|
|
OnDisallowedPinConnection = InOnDisallowedPinConnection;
|
|
}
|
|
|
|
void SGraphNode::OnDragEnter( const FGeometry& MyGeometry, const FDragDropEvent& DragDropEvent )
|
|
{
|
|
TSharedPtr<FDragDropOperation> Operation = DragDropEvent.GetOperation();
|
|
if (!Operation.IsValid())
|
|
{
|
|
return;
|
|
}
|
|
|
|
// Is someone dragging a connection?
|
|
if (Operation->IsOfType<FGraphEditorDragDropAction>())
|
|
{
|
|
// Inform the Drag and Drop operation that we are hovering over this pin.
|
|
TSharedPtr<FGraphEditorDragDropAction> DragConnectionOp = StaticCastSharedPtr<FGraphEditorDragDropAction>(Operation);
|
|
DragConnectionOp->SetHoveredNode( SharedThis(this) );
|
|
}
|
|
else if (Operation->IsOfType<FActorDragDropGraphEdOp>())
|
|
{
|
|
TSharedPtr<FActorDragDropGraphEdOp> DragConnectionOp = StaticCastSharedPtr<FActorDragDropGraphEdOp>(Operation);
|
|
if( GraphNode->IsA( UK2Node_Literal::StaticClass() ) )
|
|
{
|
|
//Show tool tip only if a single actor is dragged
|
|
if( DragConnectionOp->Actors.Num() == 1 )
|
|
{
|
|
UK2Node_Literal* LiteralNode = CastChecked< UK2Node_Literal > ( GraphNode );
|
|
|
|
//Check whether this node is already referencing the same actor dragged from outliner
|
|
if( LiteralNode->GetObjectRef() != DragConnectionOp->Actors[0].Get() )
|
|
{
|
|
DragConnectionOp->SetToolTip(FActorDragDropGraphEdOp::ToolTip_Compatible);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
//For more that one actor dragged on to a literal node, show tooltip as incompatible
|
|
DragConnectionOp->SetToolTip(FActorDragDropGraphEdOp::ToolTip_MultipleSelection_Incompatible);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
DragConnectionOp->SetToolTip( (DragConnectionOp->Actors.Num() == 1) ? FActorDragDropGraphEdOp::ToolTip_Incompatible : FActorDragDropGraphEdOp::ToolTip_MultipleSelection_Incompatible);
|
|
}
|
|
}
|
|
else if (Operation->IsOfType<FBoneDragDropOp>())
|
|
{
|
|
//@TODO: A2REMOVAL: No support for A3 nodes handling this drag-drop op yet!
|
|
}
|
|
}
|
|
|
|
void SGraphNode::OnDragLeave( const FDragDropEvent& DragDropEvent )
|
|
{
|
|
TSharedPtr<FDragDropOperation> Operation = DragDropEvent.GetOperation();
|
|
if (!Operation.IsValid())
|
|
{
|
|
return;
|
|
}
|
|
|
|
// Is someone dragging a connection?
|
|
if (Operation->IsOfType<FGraphEditorDragDropAction>())
|
|
{
|
|
// Inform the Drag and Drop operation that we are not hovering any pins
|
|
TSharedPtr<FGraphEditorDragDropAction> DragConnectionOp = StaticCastSharedPtr<FGraphEditorDragDropAction>(Operation);
|
|
DragConnectionOp->SetHoveredNode( TSharedPtr<SGraphNode>(NULL) );
|
|
}
|
|
else if (Operation->IsOfType<FActorDragDropGraphEdOp>())
|
|
{
|
|
//Default tool tip
|
|
TSharedPtr<FActorDragDropGraphEdOp> DragConnectionOp = StaticCastSharedPtr<FActorDragDropGraphEdOp>(Operation);
|
|
DragConnectionOp->ResetToDefaultToolTip();
|
|
}
|
|
else if (Operation->IsOfType<FAssetDragDropOp>())
|
|
{
|
|
TSharedPtr<FAssetDragDropOp> AssetOp = StaticCastSharedPtr<FAssetDragDropOp>(Operation);
|
|
AssetOp->ResetToDefaultToolTip();
|
|
}
|
|
else if (Operation->IsOfType<FBoneDragDropOp>())
|
|
{
|
|
//@TODO: A2REMOVAL: No support for A3 nodes handling this drag-drop op yet!
|
|
}
|
|
}
|
|
|
|
FReply SGraphNode::OnDragOver( const FGeometry& MyGeometry, const FDragDropEvent& DragDropEvent )
|
|
{
|
|
TSharedPtr<FAssetDragDropOp> AssetOp = DragDropEvent.GetOperationAs<FAssetDragDropOp>();
|
|
if (AssetOp.IsValid())
|
|
{
|
|
if(GraphNode != NULL && GraphNode->GetSchema() != NULL)
|
|
{
|
|
bool bOkIcon = false;
|
|
FString TooltipText;
|
|
GraphNode->GetSchema()->GetAssetsNodeHoverMessage(AssetOp->AssetData, GraphNode, TooltipText, bOkIcon);
|
|
bool bReadOnly = OwnerGraphPanelPtr.IsValid() ? !OwnerGraphPanelPtr.Pin()->IsGraphEditable() : false;
|
|
bOkIcon = bReadOnly ? false : bOkIcon;
|
|
const FSlateBrush* TooltipIcon = bOkIcon ? FEditorStyle::GetBrush(TEXT("Graph.ConnectorFeedback.OK")) : FEditorStyle::GetBrush(TEXT("Graph.ConnectorFeedback.Error"));;
|
|
AssetOp->SetToolTip(FText::FromString(TooltipText), TooltipIcon);
|
|
}
|
|
return FReply::Handled();
|
|
}
|
|
return FReply::Unhandled();
|
|
}
|
|
|
|
/** Given a coordinate in SGraphPanel space (i.e. panel widget space), return the same coordinate in graph space while taking zoom and panning into account */
|
|
FVector2D SGraphNode::NodeCoordToGraphCoord( const FVector2D& NodeSpaceCoordinate ) const
|
|
{
|
|
TSharedPtr<SGraphPanel> OwnerCanvas = OwnerGraphPanelPtr.Pin();
|
|
if (OwnerCanvas.IsValid())
|
|
{
|
|
//@TODO: NodeSpaceCoordinate != PanelCoordinate
|
|
FVector2D PanelSpaceCoordinate = NodeSpaceCoordinate;
|
|
return OwnerCanvas->PanelCoordToGraphCoord( PanelSpaceCoordinate );
|
|
}
|
|
else
|
|
{
|
|
return FVector2D::ZeroVector;
|
|
}
|
|
}
|
|
|
|
FReply SGraphNode::OnDrop( const FGeometry& MyGeometry, const FDragDropEvent& DragDropEvent )
|
|
{
|
|
bool bReadOnly = OwnerGraphPanelPtr.IsValid() ? !OwnerGraphPanelPtr.Pin()->IsGraphEditable() : false;
|
|
TSharedPtr<FDragDropOperation> Operation = DragDropEvent.GetOperation();
|
|
if (!Operation.IsValid() || bReadOnly)
|
|
{
|
|
return FReply::Unhandled();
|
|
}
|
|
|
|
// Is someone dropping a connection onto this node?
|
|
if (Operation->IsOfType<FGraphEditorDragDropAction>())
|
|
{
|
|
TSharedPtr<FGraphEditorDragDropAction> DragConnectionOp = StaticCastSharedPtr<FGraphEditorDragDropAction>(Operation);
|
|
|
|
const FVector2D NodeAddPosition = NodeCoordToGraphCoord( MyGeometry.AbsoluteToLocal( DragDropEvent.GetScreenSpacePosition() ) );
|
|
|
|
FReply Result = DragConnectionOp->DroppedOnNode(DragDropEvent.GetScreenSpacePosition(), NodeAddPosition);
|
|
|
|
if (Result.IsEventHandled() && (GraphNode != NULL))
|
|
{
|
|
GraphNode->GetGraph()->NotifyGraphChanged();
|
|
}
|
|
return Result;
|
|
}
|
|
else if (Operation->IsOfType<FActorDragDropGraphEdOp>())
|
|
{
|
|
TSharedPtr<FActorDragDropGraphEdOp> DragConnectionOp = StaticCastSharedPtr<FActorDragDropGraphEdOp>(Operation);
|
|
if( CanAllowInteractionUsingDragDropOp( GraphNode, DragConnectionOp ) )
|
|
{
|
|
UK2Node_Literal* LiteralNode = CastChecked< UK2Node_Literal > ( GraphNode );
|
|
|
|
//Check whether this node is already referencing the same actor
|
|
if( LiteralNode->GetObjectRef() != DragConnectionOp->Actors[0].Get() )
|
|
{
|
|
//Replace literal node's object reference
|
|
LiteralNode->SetObjectRef( DragConnectionOp->Actors[ 0 ].Get() );
|
|
|
|
UBlueprint* Blueprint = FBlueprintEditorUtils::FindBlueprintForGraph(CastChecked<UEdGraph>(GraphNode->GetOuter()));
|
|
if (Blueprint != nullptr)
|
|
{
|
|
FBlueprintEditorUtils::MarkBlueprintAsModified(Blueprint);
|
|
}
|
|
}
|
|
}
|
|
return FReply::Handled();
|
|
}
|
|
else if (Operation->IsOfType<FAssetDragDropOp>())
|
|
{
|
|
UEdGraphNode* Node = GetNodeObj();
|
|
if(Node != NULL && Node->GetSchema() != NULL)
|
|
{
|
|
TSharedPtr<FAssetDragDropOp> AssetOp = StaticCastSharedPtr<FAssetDragDropOp>(Operation);
|
|
Node->GetSchema()->DroppedAssetsOnNode(AssetOp->AssetData, DragDropEvent.GetScreenSpacePosition(), Node);
|
|
}
|
|
return FReply::Handled();
|
|
}
|
|
else if (Operation->IsOfType<FBoneDragDropOp>())
|
|
{
|
|
//@TODO: A2REMOVAL: No support for A3 nodes handling this drag-drop op yet!
|
|
}
|
|
return FReply::Unhandled();
|
|
}
|
|
|
|
/**
|
|
* The system calls this method to notify the widget that a mouse button was pressed within it. This event is bubbled.
|
|
*
|
|
* @param MyGeometry The Geometry of the widget receiving the event
|
|
* @param MouseEvent Information about the input event
|
|
*
|
|
* @return Whether the event was handled along with possible requests for the system to take action.
|
|
*/
|
|
FReply SGraphNode::OnMouseButtonDown( const FGeometry& MyGeometry, const FPointerEvent& MouseEvent )
|
|
{
|
|
return FReply::Unhandled();
|
|
}
|
|
|
|
// The system calls this method to notify the widget that a mouse button was release within it. This event is bubbled.
|
|
FReply SGraphNode::OnMouseButtonUp( const FGeometry& MyGeometry, const FPointerEvent& MouseEvent )
|
|
{
|
|
return FReply::Unhandled();
|
|
}
|
|
|
|
// Called when a mouse button is double clicked. Override this in derived classes
|
|
FReply SGraphNode::OnMouseButtonDoubleClick( const FGeometry& InMyGeometry, const FPointerEvent& InMouseEvent )
|
|
{
|
|
if(InMouseEvent.IsMouseButtonDown(EKeys::LeftMouseButton))
|
|
{
|
|
OnDoubleClick.ExecuteIfBound(GraphNode);
|
|
return FReply::Handled();
|
|
}
|
|
return FReply::Unhandled();
|
|
}
|
|
|
|
TSharedPtr<IToolTip> SGraphNode::GetToolTip()
|
|
{
|
|
TSharedPtr<IToolTip> CurrentTooltip = SWidget::GetToolTip();
|
|
if (!CurrentTooltip.IsValid())
|
|
{
|
|
TSharedPtr<SToolTip> ComplexTooltip = GetComplexTooltip();
|
|
if (ComplexTooltip.IsValid())
|
|
{
|
|
SetToolTip(ComplexTooltip);
|
|
bProvidedComplexTooltip = true;
|
|
}
|
|
}
|
|
|
|
return SWidget::GetToolTip();
|
|
}
|
|
|
|
void SGraphNode::OnToolTipClosing()
|
|
{
|
|
if (bProvidedComplexTooltip)
|
|
{
|
|
SetToolTip(NULL);
|
|
bProvidedComplexTooltip = false;
|
|
}
|
|
}
|
|
|
|
void SGraphNode::Tick( const FGeometry& AllottedGeometry, const double InCurrentTime, const float InDeltaTime )
|
|
{
|
|
CachedUnscaledPosition = AllottedGeometry.AbsolutePosition/AllottedGeometry.Scale;
|
|
|
|
SNodePanel::SNode::Tick(AllottedGeometry, InCurrentTime, InDeltaTime);
|
|
|
|
const bool bNeedToUpdateCommentBubble = GetNodeObj()->ShouldMakeCommentBubbleVisible();
|
|
|
|
if (IsHovered() || bNeedToUpdateCommentBubble)
|
|
{
|
|
if (FNodeSlot* CommentSlot = GetSlot(ENodeZone::TopCenter))
|
|
{
|
|
TSharedPtr<SCommentBubble> CommentBubble = StaticCastSharedRef<SCommentBubble>(CommentSlot->GetWidget());
|
|
if (CommentBubble.IsValid())
|
|
{
|
|
if (bNeedToUpdateCommentBubble)
|
|
{
|
|
CommentBubble->SetCommentBubbleVisibility(true);
|
|
GetNodeObj()->SetMakeCommentBubbleVisible(false);
|
|
}
|
|
else
|
|
{
|
|
CommentBubble->TickVisibility(InCurrentTime, InDeltaTime);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
bool SGraphNode::IsSelectedExclusively() const
|
|
{
|
|
TSharedPtr<SGraphPanel> OwnerPanel = OwnerGraphPanelPtr.Pin();
|
|
|
|
if (!OwnerPanel->HasKeyboardFocus() || OwnerPanel->SelectionManager.GetSelectedNodes().Num() > 1)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
return OwnerPanel->SelectionManager.IsNodeSelected(GraphNode);
|
|
}
|
|
|
|
/** @param OwnerPanel The GraphPanel that this node belongs to */
|
|
void SGraphNode::SetOwner( const TSharedRef<SGraphPanel>& OwnerPanel )
|
|
{
|
|
check( !OwnerGraphPanelPtr.IsValid() );
|
|
SetParentPanel(OwnerPanel);
|
|
OwnerGraphPanelPtr = OwnerPanel;
|
|
GraphNode->DEPRECATED_NodeWidget = SharedThis(this);
|
|
|
|
/*Once we have an owner, and if hide Unused pins is enabled, we need to remake our pins to drop the hidden ones*/
|
|
if(OwnerGraphPanelPtr.Pin()->GetPinVisibility() != SGraphEditor::Pin_Show
|
|
&& LeftNodeBox.IsValid()
|
|
&& RightNodeBox.IsValid())
|
|
{
|
|
this->LeftNodeBox->ClearChildren();
|
|
this->RightNodeBox->ClearChildren();
|
|
CreatePinWidgets();
|
|
}
|
|
}
|
|
|
|
/** @param NewPosition The Node should be relocated to this position in the graph panel */
|
|
void SGraphNode::MoveTo( const FVector2D& NewPosition, FNodeSet& NodeFilter )
|
|
{
|
|
if ( !NodeFilter.Find( SharedThis( this )))
|
|
{
|
|
if (GraphNode && !RequiresSecondPassLayout())
|
|
{
|
|
NodeFilter.Add( SharedThis( this ) );
|
|
GraphNode->Modify();
|
|
GraphNode->NodePosX = NewPosition.X;
|
|
GraphNode->NodePosY = NewPosition.Y;
|
|
}
|
|
}
|
|
}
|
|
|
|
/** @return the Node's position within the graph */
|
|
FVector2D SGraphNode::GetPosition() const
|
|
{
|
|
return FVector2D( GraphNode->NodePosX, GraphNode->NodePosY );
|
|
}
|
|
|
|
FString SGraphNode::GetEditableNodeTitle() const
|
|
{
|
|
if (GraphNode != NULL)
|
|
{
|
|
// Trying to catch a non-reproducible crash in this function
|
|
check(GraphNode->IsValidLowLevel());
|
|
}
|
|
|
|
if(GraphNode)
|
|
{
|
|
return GraphNode->GetNodeTitle(ENodeTitleType::EditableTitle).ToString();
|
|
}
|
|
return NSLOCTEXT("GraphEditor", "NullNode", "Null Node").ToString();
|
|
|
|
// Get the portion of the node that is actually editable text (may be a subsection of the title, or something else entirely)
|
|
return (GraphNode != NULL)
|
|
? GraphNode->GetNodeTitle(ENodeTitleType::EditableTitle).ToString()
|
|
: NSLOCTEXT("GraphEditor", "NullNode", "Null Node").ToString();
|
|
}
|
|
|
|
FText SGraphNode::GetEditableNodeTitleAsText() const
|
|
{
|
|
FString NewString = GetEditableNodeTitle();
|
|
return FText::FromString(NewString);
|
|
}
|
|
|
|
FString SGraphNode::GetNodeComment() const
|
|
{
|
|
return GetNodeObj()->NodeComment;
|
|
}
|
|
|
|
UObject* SGraphNode::GetObjectBeingDisplayed() const
|
|
{
|
|
return GetNodeObj();
|
|
}
|
|
|
|
FSlateColor SGraphNode::GetNodeTitleColor() const
|
|
{
|
|
FLinearColor ReturnTitleColor = GraphNode->IsDeprecated() ? FLinearColor::Red : GetNodeObj()->GetNodeTitleColor();
|
|
|
|
if(!GraphNode->IsNodeEnabled())
|
|
{
|
|
ReturnTitleColor *= FLinearColor(0.5f, 0.5f, 0.5f, 0.4f);
|
|
}
|
|
else
|
|
{
|
|
ReturnTitleColor.A = FadeCurve.GetLerp();
|
|
}
|
|
return ReturnTitleColor;
|
|
}
|
|
|
|
FSlateColor SGraphNode::GetNodeBodyColor() const
|
|
{
|
|
FLinearColor ReturnBodyColor = FLinearColor::White;
|
|
if(!GraphNode->IsNodeEnabled())
|
|
{
|
|
ReturnBodyColor *= FLinearColor(1.0f, 1.0f, 1.0f, 0.5f);
|
|
}
|
|
return ReturnBodyColor;
|
|
}
|
|
|
|
FSlateColor SGraphNode::GetNodeTitleIconColor() const
|
|
{
|
|
FLinearColor ReturnIconColor = IconColor;
|
|
if(!GraphNode->IsNodeEnabled())
|
|
{
|
|
ReturnIconColor *= FLinearColor(1.0f, 1.0f, 1.0f, 0.3f);
|
|
}
|
|
return ReturnIconColor;
|
|
}
|
|
|
|
FLinearColor SGraphNode::GetNodeTitleTextColor() const
|
|
{
|
|
FLinearColor ReturnTextColor = FLinearColor::White;
|
|
if(!GraphNode->IsNodeEnabled())
|
|
{
|
|
ReturnTextColor *= FLinearColor(1.0f, 1.0f, 1.0f, 0.3f);
|
|
}
|
|
return ReturnTextColor;
|
|
}
|
|
|
|
FSlateColor SGraphNode::GetNodeCommentColor() const
|
|
{
|
|
return GetNodeObj()->GetNodeCommentColor();
|
|
}
|
|
|
|
/** @return the tooltip to display when over the node */
|
|
FText SGraphNode::GetNodeTooltip() const
|
|
{
|
|
if (GraphNode != NULL)
|
|
{
|
|
// Display the native title of the node when alt is held
|
|
if(FSlateApplication::Get().GetModifierKeys().IsAltDown())
|
|
{
|
|
return FText::FromString(GraphNode->GetNodeTitle(ENodeTitleType::ListView).BuildSourceString());
|
|
}
|
|
|
|
FText TooltipText = GraphNode->GetTooltipText();
|
|
|
|
if (UEdGraph* Graph = GraphNode->GetGraph())
|
|
{
|
|
// If the node resides in an intermediate graph, show the UObject name for debug purposes
|
|
if (Graph->HasAnyFlags(RF_Transient))
|
|
{
|
|
FFormatNamedArguments Args;
|
|
Args.Add(TEXT("NodeName"), FText::FromString(GraphNode->GetName()));
|
|
Args.Add(TEXT("TooltipText"), TooltipText);
|
|
TooltipText = FText::Format(NSLOCTEXT("GraphEditor", "GraphNodeTooltip", "{NodeName}\n\n{TooltipText}"), Args);
|
|
}
|
|
}
|
|
|
|
if (TooltipText.IsEmpty())
|
|
{
|
|
TooltipText = GraphNode->GetNodeTitle(ENodeTitleType::FullTitle);
|
|
}
|
|
|
|
return TooltipText;
|
|
}
|
|
else
|
|
{
|
|
return NSLOCTEXT("GraphEditor", "InvalidGraphNode", "<Invalid graph node>");
|
|
}
|
|
}
|
|
|
|
|
|
/** @return the node being observed by this widget*/
|
|
UEdGraphNode* SGraphNode::GetNodeObj() const
|
|
{
|
|
return GraphNode;
|
|
}
|
|
|
|
TSharedRef<SGraphNode> SGraphNode::GetNodeUnderMouse(const FGeometry& MyGeometry, const FPointerEvent& MouseEvent)
|
|
{
|
|
return StaticCastSharedRef<SGraphNode>(AsShared());
|
|
}
|
|
|
|
TSharedPtr<SGraphPanel> SGraphNode::GetOwnerPanel() const
|
|
{
|
|
return OwnerGraphPanelPtr.Pin();
|
|
}
|
|
|
|
void SGraphNode::UpdateErrorInfo()
|
|
{
|
|
//Check for node errors/warnings
|
|
if (GraphNode->bHasCompilerMessage)
|
|
{
|
|
if (GraphNode->ErrorType <= EMessageSeverity::Error)
|
|
{
|
|
ErrorMsg = FString( TEXT("ERROR!") );
|
|
ErrorColor = FEditorStyle::GetColor("ErrorReporting.BackgroundColor");
|
|
}
|
|
else if (GraphNode->ErrorType <= EMessageSeverity::Warning)
|
|
{
|
|
ErrorMsg = FString( TEXT("WARNING!") );
|
|
ErrorColor = FEditorStyle::GetColor("ErrorReporting.WarningBackgroundColor");
|
|
}
|
|
else
|
|
{
|
|
ErrorMsg = FString( TEXT("NOTE") );
|
|
ErrorColor = FEditorStyle::GetColor("InfoReporting.BackgroundColor");
|
|
}
|
|
}
|
|
else if (!GraphNode->NodeUpgradeMessage.IsEmpty())
|
|
{
|
|
ErrorMsg = FString(TEXT("UPGRADE NOTE"));
|
|
ErrorColor = FEditorStyle::GetColor("InfoReporting.BackgroundColor");
|
|
}
|
|
else
|
|
{
|
|
ErrorColor = FLinearColor(0,0,0);
|
|
ErrorMsg.Empty();
|
|
}
|
|
}
|
|
|
|
void SGraphNode::SetupErrorReporting()
|
|
{
|
|
UpdateErrorInfo();
|
|
|
|
if( !ErrorReporting.IsValid() )
|
|
{
|
|
TSharedPtr<SErrorText> ErrorTextWidget;
|
|
|
|
// generate widget
|
|
SAssignNew(ErrorTextWidget, SErrorText)
|
|
.BackgroundColor( this, &SGraphNode::GetErrorColor )
|
|
.ToolTipText( this, &SGraphNode::GetErrorMsgToolTip );
|
|
|
|
ErrorReporting = ErrorTextWidget;
|
|
}
|
|
ErrorReporting->SetError(ErrorMsg);
|
|
}
|
|
|
|
TSharedRef<SWidget> SGraphNode::CreateTitleWidget(TSharedPtr<SNodeTitle> NodeTitle)
|
|
{
|
|
SAssignNew(InlineEditableText, SInlineEditableTextBlock)
|
|
.Style(FEditorStyle::Get(), "Graph.Node.NodeTitleInlineEditableText")
|
|
.Text(NodeTitle.Get(), &SNodeTitle::GetHeadTitle)
|
|
.OnVerifyTextChanged(this, &SGraphNode::OnVerifyNameTextChanged)
|
|
.OnTextCommitted(this, &SGraphNode::OnNameTextCommited)
|
|
.IsReadOnly(this, &SGraphNode::IsNameReadOnly)
|
|
.IsSelected(this, &SGraphNode::IsSelectedExclusively);
|
|
InlineEditableText->SetColorAndOpacity(TAttribute<FLinearColor>::Create(TAttribute<FLinearColor>::FGetter::CreateSP(this, &SGraphNode::GetNodeTitleTextColor)));
|
|
|
|
return InlineEditableText.ToSharedRef();
|
|
}
|
|
|
|
/**
|
|
* Update this GraphNode to match the data that it is observing
|
|
*/
|
|
BEGIN_SLATE_FUNCTION_BUILD_OPTIMIZATION
|
|
void SGraphNode::UpdateGraphNode()
|
|
{
|
|
InputPins.Empty();
|
|
OutputPins.Empty();
|
|
|
|
// Reset variables that are going to be exposed, in case we are refreshing an already setup node.
|
|
RightNodeBox.Reset();
|
|
LeftNodeBox.Reset();
|
|
|
|
//
|
|
// ______________________
|
|
// | TITLE AREA |
|
|
// +-------+------+-------+
|
|
// | (>) L | | R (>) |
|
|
// | (>) E | | I (>) |
|
|
// | (>) F | | G (>) |
|
|
// | (>) T | | H (>) |
|
|
// | | | T (>) |
|
|
// |_______|______|_______|
|
|
//
|
|
TSharedPtr<SVerticalBox> MainVerticalBox;
|
|
SetupErrorReporting();
|
|
|
|
TSharedPtr<SNodeTitle> NodeTitle = SNew(SNodeTitle, GraphNode);
|
|
|
|
// Get node icon
|
|
IconColor = FLinearColor::White;
|
|
const FSlateBrush* IconBrush = NULL;
|
|
if (GraphNode != NULL && GraphNode->ShowPaletteIconOnNode())
|
|
{
|
|
IconBrush = GraphNode->GetIconAndTint(IconColor).GetOptionalIcon();
|
|
}
|
|
|
|
TSharedRef<SOverlay> DefaultTitleAreaWidget =
|
|
SNew(SOverlay)
|
|
+SOverlay::Slot()
|
|
[
|
|
SNew(SImage)
|
|
.Image( FEditorStyle::GetBrush("Graph.Node.TitleGloss") )
|
|
.ColorAndOpacity( this, &SGraphNode::GetNodeTitleIconColor )
|
|
]
|
|
+SOverlay::Slot()
|
|
.HAlign(HAlign_Left)
|
|
.VAlign(VAlign_Center)
|
|
[
|
|
SNew(SBorder)
|
|
.BorderImage( FEditorStyle::GetBrush("Graph.Node.ColorSpill") )
|
|
// The extra margin on the right
|
|
// is for making the color spill stretch well past the node title
|
|
.Padding( FMargin(10,5,30,3) )
|
|
.BorderBackgroundColor( this, &SGraphNode::GetNodeTitleColor )
|
|
[
|
|
SNew(SHorizontalBox)
|
|
+ SHorizontalBox::Slot()
|
|
.VAlign(VAlign_Top)
|
|
.Padding(FMargin(0.f, 0.f, 4.f, 0.f))
|
|
.AutoWidth()
|
|
[
|
|
SNew(SImage)
|
|
.Image(IconBrush)
|
|
.ColorAndOpacity(this, &SGraphNode::GetNodeTitleIconColor)
|
|
]
|
|
+ SHorizontalBox::Slot()
|
|
[
|
|
SNew(SVerticalBox)
|
|
+ SVerticalBox::Slot()
|
|
.AutoHeight()
|
|
[
|
|
CreateTitleWidget(NodeTitle)
|
|
]
|
|
+ SVerticalBox::Slot()
|
|
.AutoHeight()
|
|
[
|
|
NodeTitle.ToSharedRef()
|
|
]
|
|
]
|
|
]
|
|
]
|
|
+SOverlay::Slot()
|
|
.VAlign(VAlign_Top)
|
|
[
|
|
SNew(SBorder)
|
|
.Visibility(EVisibility::HitTestInvisible)
|
|
.BorderImage( FEditorStyle::GetBrush( "Graph.Node.TitleHighlight" ) )
|
|
.BorderBackgroundColor( this, &SGraphNode::GetNodeTitleIconColor )
|
|
[
|
|
SNew(SSpacer)
|
|
.Size(FVector2D(20,20))
|
|
]
|
|
];
|
|
|
|
SetDefaultTitleAreaWidget(DefaultTitleAreaWidget);
|
|
|
|
TSharedRef<SWidget> TitleAreaWidget =
|
|
SNew(SLevelOfDetailBranchNode)
|
|
.UseLowDetailSlot(this, &SGraphNode::UseLowDetailNodeTitles)
|
|
.LowDetail()
|
|
[
|
|
SNew(SBorder)
|
|
.BorderImage( FEditorStyle::GetBrush("Graph.Node.ColorSpill") )
|
|
.Padding( FMargin(75.0f, 22.0f) ) // Saving enough space for a 'typical' title so the transition isn't quite so abrupt
|
|
.BorderBackgroundColor( this, &SGraphNode::GetNodeTitleColor )
|
|
]
|
|
.HighDetail()
|
|
[
|
|
DefaultTitleAreaWidget
|
|
];
|
|
|
|
|
|
if (!SWidget::GetToolTip().IsValid())
|
|
{
|
|
TSharedRef<SToolTip> DefaultToolTip = IDocumentation::Get()->CreateToolTip( TAttribute< FText >( this, &SGraphNode::GetNodeTooltip ), NULL, GraphNode->GetDocumentationLink(), GraphNode->GetDocumentationExcerptName() );
|
|
SetToolTip(DefaultToolTip);
|
|
}
|
|
|
|
// Setup a meta tag for this node
|
|
FGraphNodeMetaData TagMeta(TEXT("Graphnode"));
|
|
PopulateMetaTag(&TagMeta);
|
|
|
|
TSharedPtr<SVerticalBox> InnerVerticalBox;
|
|
this->ContentScale.Bind( this, &SGraphNode::GetContentScale );
|
|
|
|
this->GetOrAddSlot( ENodeZone::Center )
|
|
.HAlign(HAlign_Center)
|
|
.VAlign(VAlign_Center)
|
|
[
|
|
SAssignNew(MainVerticalBox, SVerticalBox)
|
|
+SVerticalBox::Slot()
|
|
.AutoHeight()
|
|
[
|
|
SNew(SOverlay)
|
|
.AddMetaData<FGraphNodeMetaData>(TagMeta)
|
|
+SOverlay::Slot()
|
|
.Padding(Settings->GetNonPinNodeBodyPadding())
|
|
[
|
|
SNew(SImage)
|
|
.Image(FEditorStyle::GetBrush("Graph.Node.Body"))
|
|
.ColorAndOpacity(this, &SGraphNode::GetNodeBodyColor)
|
|
]
|
|
+SOverlay::Slot()
|
|
[
|
|
SAssignNew(InnerVerticalBox, SVerticalBox)
|
|
+SVerticalBox::Slot()
|
|
.AutoHeight()
|
|
.HAlign(HAlign_Fill)
|
|
.VAlign(VAlign_Top)
|
|
.Padding(Settings->GetNonPinNodeBodyPadding())
|
|
[
|
|
TitleAreaWidget
|
|
]
|
|
|
|
+SVerticalBox::Slot()
|
|
.AutoHeight()
|
|
.HAlign(HAlign_Fill)
|
|
.VAlign(VAlign_Top)
|
|
[
|
|
CreateNodeContentArea()
|
|
]
|
|
|
|
+SVerticalBox::Slot()
|
|
.AutoHeight()
|
|
.Padding(Settings->GetNonPinNodeBodyPadding())
|
|
[
|
|
ErrorReporting->AsWidget()
|
|
]
|
|
]
|
|
]
|
|
];
|
|
|
|
// Create comment bubble
|
|
TSharedPtr<SCommentBubble> CommentBubble;
|
|
const FSlateColor CommentColor = GetDefault<UGraphEditorSettings>()->DefaultCommentNodeTitleColor;
|
|
|
|
SAssignNew( CommentBubble, SCommentBubble )
|
|
.GraphNode( GraphNode )
|
|
.Text( this, &SGraphNode::GetNodeComment )
|
|
.OnTextCommitted( this, &SGraphNode::OnCommentTextCommitted )
|
|
.OnToggled( this, &SGraphNode::OnCommentBubbleToggled )
|
|
.ColorAndOpacity( CommentColor )
|
|
.AllowPinning( true )
|
|
.EnableTitleBarBubble( true )
|
|
.EnableBubbleCtrls( true )
|
|
.GraphLOD( this, &SGraphNode::GetCurrentLOD )
|
|
.IsGraphNodeHovered( this, &SGraphNode::IsHovered );
|
|
|
|
GetOrAddSlot( ENodeZone::TopCenter )
|
|
.SlotOffset( TAttribute<FVector2D>( CommentBubble.Get(), &SCommentBubble::GetOffset ))
|
|
.SlotSize( TAttribute<FVector2D>( CommentBubble.Get(), &SCommentBubble::GetSize ))
|
|
.AllowScaling( TAttribute<bool>( CommentBubble.Get(), &SCommentBubble::IsScalingAllowed ))
|
|
.VAlign( VAlign_Top )
|
|
[
|
|
CommentBubble.ToSharedRef()
|
|
];
|
|
|
|
CreateBelowWidgetControls(MainVerticalBox);
|
|
CreatePinWidgets();
|
|
CreateInputSideAddButton(LeftNodeBox);
|
|
CreateOutputSideAddButton(RightNodeBox);
|
|
CreateBelowPinControls(InnerVerticalBox);
|
|
CreateAdvancedViewArrow(InnerVerticalBox);
|
|
}
|
|
END_SLATE_FUNCTION_BUILD_OPTIMIZATION
|
|
|
|
|
|
TSharedRef<SWidget> SGraphNode::CreateNodeContentArea()
|
|
{
|
|
// NODE CONTENT AREA
|
|
return SNew(SBorder)
|
|
.BorderImage( FEditorStyle::GetBrush("NoBorder") )
|
|
.HAlign(HAlign_Fill)
|
|
.VAlign(VAlign_Fill)
|
|
.Padding( FMargin(0,3) )
|
|
[
|
|
SNew(SHorizontalBox)
|
|
+SHorizontalBox::Slot()
|
|
.HAlign(HAlign_Left)
|
|
.FillWidth(1.0f)
|
|
[
|
|
// LEFT
|
|
SAssignNew(LeftNodeBox, SVerticalBox)
|
|
]
|
|
+SHorizontalBox::Slot()
|
|
.AutoWidth()
|
|
.HAlign(HAlign_Right)
|
|
[
|
|
// RIGHT
|
|
SAssignNew(RightNodeBox, SVerticalBox)
|
|
]
|
|
];
|
|
}
|
|
|
|
/** Returns visibility of AdvancedViewButton */
|
|
EVisibility SGraphNode::AdvancedViewArrowVisibility() const
|
|
{
|
|
const bool bShowAdvancedViewArrow = GraphNode && (ENodeAdvancedPins::NoPins != GraphNode->AdvancedPinDisplay);
|
|
return bShowAdvancedViewArrow ? EVisibility::Visible : EVisibility::Collapsed;
|
|
}
|
|
|
|
void SGraphNode::OnAdvancedViewChanged( const ECheckBoxState NewCheckedState )
|
|
{
|
|
if(GraphNode && (ENodeAdvancedPins::NoPins != GraphNode->AdvancedPinDisplay))
|
|
{
|
|
const bool bAdvancedPinsHidden = (NewCheckedState != ECheckBoxState::Checked);
|
|
GraphNode->AdvancedPinDisplay = bAdvancedPinsHidden ? ENodeAdvancedPins::Hidden : ENodeAdvancedPins::Shown;
|
|
}
|
|
}
|
|
|
|
ECheckBoxState SGraphNode::IsAdvancedViewChecked() const
|
|
{
|
|
const bool bAdvancedPinsHidden = GraphNode && (ENodeAdvancedPins::Hidden == GraphNode->AdvancedPinDisplay);
|
|
return bAdvancedPinsHidden ? ECheckBoxState::Unchecked : ECheckBoxState::Checked;
|
|
}
|
|
|
|
const FSlateBrush* SGraphNode::GetAdvancedViewArrow() const
|
|
{
|
|
const bool bAdvancedPinsHidden = GraphNode && (ENodeAdvancedPins::Hidden == GraphNode->AdvancedPinDisplay);
|
|
return FEditorStyle::GetBrush(bAdvancedPinsHidden ? TEXT("Kismet.TitleBarEditor.ArrowDown") : TEXT("Kismet.TitleBarEditor.ArrowUp"));
|
|
}
|
|
|
|
/** Create widget to show/hide advanced pins */
|
|
void SGraphNode::CreateAdvancedViewArrow(TSharedPtr<SVerticalBox> MainBox)
|
|
{
|
|
const bool bHidePins = OwnerGraphPanelPtr.IsValid() && (OwnerGraphPanelPtr.Pin()->GetPinVisibility() != SGraphEditor::Pin_Show);
|
|
const bool bAnyAdvancedPin = GraphNode && (ENodeAdvancedPins::NoPins != GraphNode->AdvancedPinDisplay);
|
|
if(!bHidePins && GraphNode && MainBox.IsValid())
|
|
{
|
|
MainBox->AddSlot()
|
|
.AutoHeight()
|
|
.HAlign(HAlign_Fill)
|
|
.VAlign(VAlign_Top)
|
|
.Padding(3, 0, 3, 3)
|
|
[
|
|
SNew(SCheckBox)
|
|
.Visibility(this, &SGraphNode::AdvancedViewArrowVisibility)
|
|
.OnCheckStateChanged( this, &SGraphNode::OnAdvancedViewChanged )
|
|
.IsChecked( this, &SGraphNode::IsAdvancedViewChecked )
|
|
.Cursor(EMouseCursor::Default)
|
|
.Style(FEditorStyle::Get(), "Graph.Node.AdvancedView")
|
|
[
|
|
SNew(SHorizontalBox)
|
|
+SHorizontalBox::Slot()
|
|
.VAlign(VAlign_Center)
|
|
.HAlign(HAlign_Center)
|
|
[
|
|
SNew(SImage)
|
|
. Image(this, &SGraphNode::GetAdvancedViewArrow)
|
|
]
|
|
]
|
|
];
|
|
}
|
|
}
|
|
|
|
bool SGraphNode::ShouldPinBeHidden(const UEdGraphPin* InPin) const
|
|
{
|
|
const UEdGraphSchema_K2* K2Schema = Cast<const UEdGraphSchema_K2>(GraphNode->GetSchema());
|
|
|
|
bool bHideNoConnectionPins = false;
|
|
bool bHideNoConnectionNoDefaultPins = false;
|
|
|
|
// Not allowed to hide exec pins
|
|
const bool bCanHidePin = (K2Schema && (InPin->PinType.PinCategory != K2Schema->PC_Exec));
|
|
|
|
if (OwnerGraphPanelPtr.IsValid() && bCanHidePin)
|
|
{
|
|
bHideNoConnectionPins = OwnerGraphPanelPtr.Pin()->GetPinVisibility() == SGraphEditor::Pin_HideNoConnection;
|
|
bHideNoConnectionNoDefaultPins = OwnerGraphPanelPtr.Pin()->GetPinVisibility() == SGraphEditor::Pin_HideNoConnectionNoDefault;
|
|
}
|
|
|
|
const bool bIsOutputPin = InPin->Direction == EGPD_Output;
|
|
const bool bPinHasDefaultValue = !InPin->DefaultValue.IsEmpty() || (InPin->DefaultObject != NULL);
|
|
const bool bIsSelfTarget = K2Schema && (InPin->PinType.PinCategory == K2Schema->PC_Object) && (InPin->PinName == K2Schema->PN_Self);
|
|
const bool bPinHasValidDefault = !bIsOutputPin && (bPinHasDefaultValue || bIsSelfTarget);
|
|
const bool bPinHasConections = InPin->LinkedTo.Num() > 0;
|
|
|
|
const bool bPinDesiresToBeHidden = InPin->bHidden || (bHideNoConnectionPins && !bPinHasConections) || (bHideNoConnectionNoDefaultPins && !bPinHasConections && !bPinHasValidDefault);
|
|
|
|
// No matter how strong the desire, a pin with connections can never be hidden!
|
|
const bool bShowPin = !bPinDesiresToBeHidden || bPinHasConections;
|
|
|
|
return bShowPin;
|
|
}
|
|
|
|
void SGraphNode::CreateStandardPinWidget(UEdGraphPin* CurPin)
|
|
{
|
|
const bool bShowPin = ShouldPinBeHidden(CurPin);
|
|
|
|
if (bShowPin)
|
|
{
|
|
TSharedPtr<SGraphPin> NewPin = CreatePinWidget(CurPin);
|
|
check(NewPin.IsValid());
|
|
|
|
this->AddPin(NewPin.ToSharedRef());
|
|
}
|
|
}
|
|
|
|
void SGraphNode::CreatePinWidgets()
|
|
{
|
|
// Create Pin widgets for each of the pins.
|
|
for (int32 PinIndex = 0; PinIndex < GraphNode->Pins.Num(); ++PinIndex)
|
|
{
|
|
UEdGraphPin* CurPin = GraphNode->Pins[PinIndex];
|
|
|
|
if ( !ensureMsgf(CurPin->GetOuter() == GraphNode
|
|
, TEXT("Graph node ('%s' - %s) has an invalid %s pin: '%s'; (with a bad %s outer: '%s'); skiping creation of a widget for this pin.")
|
|
, *GraphNode->GetNodeTitle(ENodeTitleType::ListView).ToString()
|
|
, *GraphNode->GetPathName()
|
|
, (CurPin->Direction == EEdGraphPinDirection::EGPD_Input) ? TEXT("input") : TEXT("output")
|
|
, CurPin->PinFriendlyName.IsEmpty() ? *CurPin->PinName : *CurPin->PinFriendlyName.ToString()
|
|
, CurPin->GetOuter() ? *CurPin->GetOuter()->GetClass()->GetName() : TEXT("UNKNOWN")
|
|
, CurPin->GetOuter() ? *CurPin->GetOuter()->GetPathName() : TEXT("NULL")) )
|
|
{
|
|
continue;
|
|
}
|
|
|
|
CreateStandardPinWidget(CurPin);
|
|
}
|
|
}
|
|
|
|
TSharedPtr<SGraphPin> SGraphNode::CreatePinWidget(UEdGraphPin* Pin) const
|
|
{
|
|
return FNodeFactory::CreatePinWidget(Pin);
|
|
}
|
|
|
|
void SGraphNode::AddPin(const TSharedRef<SGraphPin>& PinToAdd)
|
|
{
|
|
PinToAdd->SetOwner(SharedThis(this));
|
|
|
|
const UEdGraphPin* PinObj = PinToAdd->GetPinObj();
|
|
const bool bAdvancedParameter = (PinObj != nullptr) && PinObj->bAdvancedView;
|
|
if (bAdvancedParameter)
|
|
{
|
|
PinToAdd->SetVisibility( TAttribute<EVisibility>(PinToAdd, &SGraphPin::IsPinVisibleAsAdvanced) );
|
|
}
|
|
|
|
if (PinToAdd->GetDirection() == EEdGraphPinDirection::EGPD_Input)
|
|
{
|
|
LeftNodeBox->AddSlot()
|
|
.AutoHeight()
|
|
.HAlign(HAlign_Left)
|
|
.VAlign(VAlign_Center)
|
|
.Padding(Settings->GetInputPinPadding())
|
|
[
|
|
PinToAdd
|
|
];
|
|
InputPins.Add(PinToAdd);
|
|
}
|
|
else // Direction == EEdGraphPinDirection::EGPD_Output
|
|
{
|
|
RightNodeBox->AddSlot()
|
|
.AutoHeight()
|
|
.HAlign(HAlign_Right)
|
|
.VAlign(VAlign_Center)
|
|
.Padding(Settings->GetOutputPinPadding())
|
|
[
|
|
PinToAdd
|
|
];
|
|
OutputPins.Add(PinToAdd);
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Get all the pins found on this node.
|
|
*
|
|
* @param AllPins The set of pins found on this node.
|
|
*/
|
|
void SGraphNode::GetPins( TSet< TSharedRef<SWidget> >& AllPins ) const
|
|
{
|
|
|
|
for( int32 PinIndex=0; PinIndex < this->InputPins.Num(); ++PinIndex )
|
|
{
|
|
AllPins.Add(InputPins[PinIndex]);
|
|
}
|
|
|
|
|
|
for( int32 PinIndex=0; PinIndex < this->OutputPins.Num(); ++PinIndex )
|
|
{
|
|
AllPins.Add(OutputPins[PinIndex]);
|
|
}
|
|
|
|
}
|
|
|
|
void SGraphNode::GetPins( TArray< TSharedRef<SWidget> >& AllPins ) const
|
|
{
|
|
|
|
for( int32 PinIndex=0; PinIndex < this->InputPins.Num(); ++PinIndex )
|
|
{
|
|
AllPins.Add(InputPins[PinIndex]);
|
|
}
|
|
|
|
|
|
for( int32 PinIndex=0; PinIndex < this->OutputPins.Num(); ++PinIndex )
|
|
{
|
|
AllPins.Add(OutputPins[PinIndex]);
|
|
}
|
|
|
|
}
|
|
|
|
TSharedPtr<SGraphPin> SGraphNode::GetHoveredPin( const FGeometry& MyGeometry, const FPointerEvent& MouseEvent ) const
|
|
{
|
|
// We just need to find the one WidgetToFind among our descendants.
|
|
TSet< TSharedRef<SWidget> > MyPins;
|
|
{
|
|
GetPins( MyPins );
|
|
}
|
|
TMap<TSharedRef<SWidget>, FArrangedWidget> Result;
|
|
|
|
FindChildGeometries(MyGeometry, MyPins, Result);
|
|
|
|
if ( Result.Num() > 0 )
|
|
{
|
|
FArrangedChildren ArrangedPins(EVisibility::Visible);
|
|
Result.GenerateValueArray( ArrangedPins.GetInternalArray() );
|
|
int32 HoveredPinIndex = SWidget::FindChildUnderMouse( ArrangedPins, MouseEvent );
|
|
if ( HoveredPinIndex != INDEX_NONE )
|
|
{
|
|
return StaticCastSharedRef<SGraphPin>(ArrangedPins[HoveredPinIndex].Widget);
|
|
}
|
|
}
|
|
|
|
return TSharedPtr<SGraphPin>();
|
|
}
|
|
|
|
TSharedPtr<SGraphPin> SGraphNode::FindWidgetForPin( UEdGraphPin* ThePin ) const
|
|
{
|
|
// Search input or output pins?
|
|
const TArray< TSharedRef<SGraphPin> > &PinsToSearch = (ThePin->Direction == EGPD_Input) ? InputPins : OutputPins;
|
|
|
|
// Actually search for the widget
|
|
for( int32 PinIndex=0; PinIndex < PinsToSearch.Num(); ++PinIndex )
|
|
{
|
|
if ( PinsToSearch[PinIndex]->GetPinObj() == ThePin )
|
|
{
|
|
return PinsToSearch[PinIndex];
|
|
}
|
|
}
|
|
|
|
return TSharedPtr<SGraphPin>(NULL);
|
|
}
|
|
|
|
void SGraphNode::PlaySpawnEffect()
|
|
{
|
|
SpawnAnim.Play( this->AsShared() );
|
|
}
|
|
|
|
FVector2D SGraphNode::GetContentScale() const
|
|
{
|
|
const float CurZoomValue = ZoomCurve.GetLerp();
|
|
return FVector2D( CurZoomValue, CurZoomValue );
|
|
}
|
|
|
|
FLinearColor SGraphNode::GetColorAndOpacity() const
|
|
{
|
|
return FLinearColor(1,1,1,FadeCurve.GetLerp());
|
|
}
|
|
|
|
FLinearColor SGraphNode::GetPinLabelColorAndOpacity() const
|
|
{
|
|
return FLinearColor(0,0,0,FadeCurve.GetLerp());
|
|
}
|
|
|
|
|
|
SGraphNode::SGraphNode()
|
|
: IsEditable(true)
|
|
, bProvidedComplexTooltip(false)
|
|
, bRenameIsPending( false )
|
|
, ErrorColor( FLinearColor::White )
|
|
, CachedUnscaledPosition( FVector2D::ZeroVector )
|
|
, Settings( GetDefault<UGraphEditorSettings>() )
|
|
{
|
|
// Set up animation
|
|
{
|
|
ZoomCurve = SpawnAnim.AddCurve(0, 0.1f);
|
|
FadeCurve = SpawnAnim.AddCurve(0.15f, 0.15f);
|
|
SpawnAnim.JumpToEnd();
|
|
}
|
|
}
|
|
|
|
void SGraphNode::PositionThisNodeBetweenOtherNodes(const TMap< UObject*, TSharedRef<SNode> >& NodeToWidgetLookup, UEdGraphNode* PreviousNode, UEdGraphNode* NextNode, float HeightAboveWire) const
|
|
{
|
|
if ((PreviousNode != NULL) && (NextNode != NULL))
|
|
{
|
|
TSet<UEdGraphNode*> PrevNodes;
|
|
PrevNodes.Add(PreviousNode);
|
|
|
|
TSet<UEdGraphNode*> NextNodes;
|
|
NextNodes.Add(NextNode);
|
|
|
|
PositionThisNodeBetweenOtherNodes(NodeToWidgetLookup, PrevNodes, NextNodes, HeightAboveWire);
|
|
}
|
|
}
|
|
|
|
void SGraphNode::PositionThisNodeBetweenOtherNodes(const TMap< UObject*, TSharedRef<SNode> >& NodeToWidgetLookup, TSet<UEdGraphNode*>& PreviousNodes, TSet<UEdGraphNode*>& NextNodes, float HeightAboveWire) const
|
|
{
|
|
// Find the previous position centroid
|
|
FVector2D PrevPos(0.0f, 0.0f);
|
|
for (auto NodeIt = PreviousNodes.CreateConstIterator(); NodeIt; ++NodeIt)
|
|
{
|
|
UEdGraphNode* PreviousNode = *NodeIt;
|
|
const FVector2D CornerPos(PreviousNode->NodePosX, PreviousNode->NodePosY);
|
|
PrevPos += CornerPos + NodeToWidgetLookup.FindChecked(PreviousNode)->GetDesiredSize() * 0.5f;
|
|
}
|
|
|
|
// Find the next position centroid
|
|
FVector2D NextPos(0.0f, 0.0f);
|
|
for (auto NodeIt = NextNodes.CreateConstIterator(); NodeIt; ++NodeIt)
|
|
{
|
|
UEdGraphNode* NextNode = *NodeIt;
|
|
const FVector2D CornerPos(NextNode->NodePosX, NextNode->NodePosY);
|
|
NextPos += CornerPos + NodeToWidgetLookup.FindChecked(NextNode)->GetDesiredSize() * 0.5f;
|
|
}
|
|
|
|
PositionThisNodeBetweenOtherNodes(PrevPos, NextPos, HeightAboveWire);
|
|
}
|
|
|
|
void SGraphNode::PositionThisNodeBetweenOtherNodes(const FVector2D& PrevPos, const FVector2D& NextPos, float HeightAboveWire) const
|
|
{
|
|
const FVector2D DesiredNodeSize = GetDesiredSize();
|
|
|
|
FVector2D DeltaPos(NextPos - PrevPos);
|
|
if (DeltaPos.IsNearlyZero())
|
|
{
|
|
DeltaPos = FVector2D(10.0f, 0.0f);
|
|
}
|
|
|
|
const FVector2D Normal = FVector2D(DeltaPos.Y, -DeltaPos.X).GetSafeNormal();
|
|
|
|
const FVector2D SlidingCapsuleBias = FVector2D::ZeroVector;//(0.5f * FMath::Sin(Normal.X * (float)HALF_PI) * DesiredNodeSize.X, 0.0f);
|
|
|
|
const FVector2D NewCenter = PrevPos + (0.5f * DeltaPos) + (HeightAboveWire * Normal) + SlidingCapsuleBias;
|
|
|
|
// Now we need to adjust the new center by the node size and zoom factor
|
|
const FVector2D NewCorner = NewCenter - (0.5f * DesiredNodeSize);
|
|
|
|
GraphNode->NodePosX = NewCorner.X;
|
|
GraphNode->NodePosY = NewCorner.Y;
|
|
}
|
|
|
|
FText SGraphNode::GetErrorMsgToolTip( ) const
|
|
{
|
|
FText Result;
|
|
// Append the node's upgrade message, if any.
|
|
if (!GraphNode->NodeUpgradeMessage.IsEmpty())
|
|
{
|
|
if (Result.IsEmpty())
|
|
{
|
|
Result = GraphNode->NodeUpgradeMessage;
|
|
}
|
|
else
|
|
{
|
|
Result = FText::Format(FText::FromString(TEXT("{0}\n\n{1}")), Result, GraphNode->NodeUpgradeMessage);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
Result = FText::FromString(GraphNode->ErrorMsg);
|
|
}
|
|
return Result;
|
|
}
|
|
|
|
bool SGraphNode::IsNameReadOnly() const
|
|
{
|
|
return !GraphNode->bCanRenameNode;
|
|
}
|
|
|
|
bool SGraphNode::OnVerifyNameTextChanged(const FText& InText, FText& OutErrorMessage)
|
|
{
|
|
bool bValid(true);
|
|
|
|
if ((GetEditableNodeTitle() != InText.ToString()) && OnVerifyTextCommit.IsBound())
|
|
{
|
|
bValid = OnVerifyTextCommit.Execute(InText, GraphNode, OutErrorMessage);
|
|
}
|
|
|
|
if( OutErrorMessage.IsEmpty() )
|
|
{
|
|
OutErrorMessage = FText::FromString(TEXT("Error"));
|
|
}
|
|
|
|
//UpdateErrorInfo();
|
|
//ErrorReporting->SetError(ErrorMsg);
|
|
|
|
return bValid;
|
|
}
|
|
|
|
void SGraphNode::OnNameTextCommited(const FText& InText, ETextCommit::Type CommitInfo)
|
|
{
|
|
OnTextCommitted.ExecuteIfBound(InText, CommitInfo, GraphNode);
|
|
|
|
UpdateErrorInfo();
|
|
if (ErrorReporting.IsValid())
|
|
{
|
|
ErrorReporting->SetError(ErrorMsg);
|
|
}
|
|
}
|
|
|
|
void SGraphNode::RequestRename()
|
|
{
|
|
if ((GraphNode != NULL) && GraphNode->bCanRenameNode)
|
|
{
|
|
bRenameIsPending = true;
|
|
}
|
|
}
|
|
|
|
void SGraphNode::ApplyRename()
|
|
{
|
|
if (bRenameIsPending)
|
|
{
|
|
bRenameIsPending = false;
|
|
InlineEditableText->EnterEditingMode();
|
|
}
|
|
}
|
|
|
|
FSlateRect SGraphNode::GetTitleRect() const
|
|
{
|
|
const FVector2D NodePosition = GetPosition();
|
|
const FVector2D NodeSize = GraphNode ? InlineEditableText->GetDesiredSize() : GetDesiredSize();
|
|
|
|
return FSlateRect( NodePosition.X, NodePosition.Y + NodeSize.Y, NodePosition.X + NodeSize.X, NodePosition.Y );
|
|
}
|
|
|
|
void SGraphNode::NotifyDisallowedPinConnection(const UEdGraphPin* PinA, const UEdGraphPin* PinB) const
|
|
{
|
|
OnDisallowedPinConnection.ExecuteIfBound(PinA, PinB);
|
|
}
|
|
|
|
bool SGraphNode::UseLowDetailNodeTitles() const
|
|
{
|
|
if (const SGraphPanel* MyOwnerPanel = GetOwnerPanel().Get())
|
|
{
|
|
return (MyOwnerPanel->GetCurrentLOD() <= EGraphRenderingLOD::LowestDetail) && !InlineEditableText->IsInEditMode();
|
|
}
|
|
else
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
|
|
TSharedRef<SWidget> SGraphNode::AddPinButtonContent(FText PinText, FText PinTooltipText, bool bRightSide, FString DocumentationExcerpt, TSharedPtr<SToolTip> CustomTooltip)
|
|
{
|
|
TSharedPtr<SWidget> ButtonContent;
|
|
if(bRightSide)
|
|
{
|
|
SAssignNew(ButtonContent, SHorizontalBox)
|
|
+SHorizontalBox::Slot()
|
|
.AutoWidth()
|
|
.HAlign(HAlign_Left)
|
|
[
|
|
SNew(STextBlock)
|
|
.Text(PinText)
|
|
.ColorAndOpacity(FLinearColor::White)
|
|
]
|
|
+SHorizontalBox::Slot()
|
|
.AutoWidth()
|
|
. VAlign(VAlign_Center)
|
|
. Padding( 7,0,0,0 )
|
|
[
|
|
SNew(SImage)
|
|
.Image(FEditorStyle::GetBrush(TEXT("PropertyWindow.Button_AddToArray")))
|
|
];
|
|
}
|
|
else
|
|
{
|
|
SAssignNew(ButtonContent, SHorizontalBox)
|
|
+SHorizontalBox::Slot()
|
|
.AutoWidth()
|
|
. VAlign(VAlign_Center)
|
|
. Padding( 0,0,7,0 )
|
|
[
|
|
SNew(SImage)
|
|
.Image(FEditorStyle::GetBrush(TEXT("PropertyWindow.Button_AddToArray")))
|
|
]
|
|
+SHorizontalBox::Slot()
|
|
.AutoWidth()
|
|
.HAlign(HAlign_Left)
|
|
[
|
|
SNew(STextBlock)
|
|
.Text(PinText)
|
|
.ColorAndOpacity(FLinearColor::White)
|
|
];
|
|
}
|
|
|
|
TSharedPtr<SToolTip> Tooltip;
|
|
|
|
if (CustomTooltip.IsValid())
|
|
{
|
|
Tooltip = CustomTooltip;
|
|
}
|
|
else if (!DocumentationExcerpt.IsEmpty())
|
|
{
|
|
Tooltip = IDocumentation::Get()->CreateToolTip( PinTooltipText, NULL, GraphNode->GetDocumentationLink(), DocumentationExcerpt );
|
|
}
|
|
|
|
TSharedRef<SButton> AddPinButton = SNew(SButton)
|
|
.ContentPadding(0.0f)
|
|
.ButtonStyle( FEditorStyle::Get(), "NoBorder" )
|
|
.OnClicked( this, &SGraphNode::OnAddPin )
|
|
.IsEnabled( this, &SGraphNode::IsNodeEditable )
|
|
.ToolTipText(PinTooltipText)
|
|
.ToolTip(Tooltip)
|
|
.Visibility(this, &SGraphNode::IsAddPinButtonVisible)
|
|
[
|
|
ButtonContent.ToSharedRef()
|
|
];
|
|
|
|
AddPinButton->SetCursor( EMouseCursor::Hand );
|
|
|
|
return AddPinButton;
|
|
}
|
|
|
|
EVisibility SGraphNode::IsAddPinButtonVisible() const
|
|
{
|
|
bool bIsHidden = false;
|
|
auto OwnerGraphPanel = OwnerGraphPanelPtr.Pin();
|
|
if(OwnerGraphPanel.IsValid())
|
|
{
|
|
bIsHidden |= (SGraphEditor::EPinVisibility::Pin_Show != OwnerGraphPanel->GetPinVisibility());
|
|
bIsHidden |= (OwnerGraphPanel->GetCurrentLOD() <= EGraphRenderingLOD::LowDetail);
|
|
}
|
|
|
|
return bIsHidden ? EVisibility::Collapsed : EVisibility::Visible;
|
|
}
|
|
|
|
void SGraphNode::PopulateMetaTag(FGraphNodeMetaData* TagMeta) const
|
|
{
|
|
if (GraphNode != nullptr)
|
|
{
|
|
// We want the name of the blueprint as our name - we can find the node from the GUID
|
|
UObject* Package = GraphNode->GetOutermost();
|
|
UObject* LastOuter = GraphNode->GetOuter();
|
|
while (LastOuter->GetOuter() != Package)
|
|
{
|
|
LastOuter = LastOuter->GetOuter();
|
|
}
|
|
TagMeta->Tag = FName(*FString::Printf(TEXT("GraphNode_%s_%s"), *LastOuter->GetFullName(), *GraphNode->NodeGuid.ToString()));
|
|
TagMeta->OuterName = LastOuter->GetFullName();
|
|
TagMeta->GUID = GraphNode->NodeGuid;
|
|
TagMeta->FriendlyName = FString::Printf(TEXT("%s in %s"), *GraphNode->GetNodeTitle(ENodeTitleType::ListView).ToString(), *TagMeta->OuterName);
|
|
}
|
|
}
|
|
|
|
EGraphRenderingLOD::Type SGraphNode::GetCurrentLOD() const
|
|
{
|
|
return OwnerGraphPanelPtr.IsValid() ? OwnerGraphPanelPtr.Pin()->GetCurrentLOD() : EGraphRenderingLOD::DefaultDetail;
|
|
}
|
|
|
|
void SGraphNode::RefreshErrorInfo()
|
|
{
|
|
SetupErrorReporting();
|
|
}
|