コード例 #1
0
void UAblRayCastQueryTask::OnTaskTick(const TWeakObjectPtr<const UAblAbilityContext>& Context, float deltaTime) const
{
	Super::OnTaskTick(Context, deltaTime);

	if (IsAsyncFriendly() && UAbleSettings::IsAsyncEnabled())
	{
		UAblRayCastQueryTaskScratchPad* ScratchPad = Cast<UAblRayCastQueryTaskScratchPad>(Context->GetScratchPadForTask(this));
		check(ScratchPad);
		if (!ScratchPad->AsyncProcessed && ScratchPad->AsyncHandle._Handle != 0)
		{
			AActor* SourceActor = m_QueryLocation.GetSourceActor(*Context.Get());
			check(SourceActor);

			UWorld* World = SourceActor->GetWorld();

			FTraceDatum Datum;
			if (World->QueryTraceData(ScratchPad->AsyncHandle, Datum))
			{
				if (m_CopyResultsToContext)
				{
					CopyResultsToContext(Datum.OutHits, Context);
				}

				if (m_FireEvent)
				{
					Context->GetAbility()->OnRaycastEvent(Context.Get(), m_Name, Datum.OutHits);
				}

				ScratchPad->AsyncProcessed = true;
			}

		}
	}
}
コード例 #2
0
	FORCEINLINE bool operator()( const TWeakObjectPtr< UObject >& Lhs, const TWeakObjectPtr< UObject >& Rhs ) const
	{
		const bool LhsObjectValid = Lhs.IsValid();
		if ( !LhsObjectValid )
		{
			return true;
		}

		const bool RhsObjectValid = Rhs.IsValid();
		if ( !RhsObjectValid )
		{
			return false;
		}

		const UStruct* const PropertyTargetType = Property->GetOwnerStruct();
		const UClass* const LhsClass = Lhs->GetClass();

		if ( !LhsClass->IsChildOf( PropertyTargetType ) )
		{
			return true;
		}

		const UClass* const RhsClass = Rhs->GetClass();

		if ( !RhsClass->IsChildOf( PropertyTargetType ) )
		{
			return false;
		}

		typename UPropertyType::TCppType LhsValue = Property->GetPropertyValue_InContainer(Lhs.Get());
		typename UPropertyType::TCppType RhsValue = Property->GetPropertyValue_InContainer(Rhs.Get());

		return ComparePropertyValue( LhsValue, RhsValue );
	}
コード例 #3
0
	/** Called to make curve owner transactional */
	virtual void MakeTransactional() override
	{
		if (BaseSequence.IsValid())
		{
			BaseSequence.Get()->SetFlags(BaseSequence.Get()->GetFlags() | RF_Transactional);
		}
	}
コード例 #4
0
FString UK2Node_Tunnel::CreateUniquePinName(FString InSourcePinName) const
{
	if (GetClass() == UK2Node_Tunnel::StaticClass())
	{
		// When dealing with a tunnel node that is not a sub class (macro/collapsed graph entry and result), attempt to find the paired node and find a valid name between the two
		TWeakObjectPtr<UK2Node_EditablePinBase> TunnelEntry;
		TWeakObjectPtr<UK2Node_EditablePinBase> TunnelResult;
		FBlueprintEditorUtils::GetEntryAndResultNodes(GetGraph(), TunnelEntry, TunnelResult);

		if (TunnelEntry.IsValid() && TunnelResult.IsValid())
		{
			FString PinName(InSourcePinName);

			int32 Index = 1;
			while (TunnelEntry.Get()->FindPin(PinName) != nullptr || TunnelResult.Get()->FindPin(PinName) != nullptr)
			{
				++Index;
				PinName = InSourcePinName + FString::FromInt(Index);
			}

			return PinName;
		}
	}

	return Super::CreateUniquePinName(InSourcePinName);
}
コード例 #5
0
	/** Called to modify the owner of the curve */
	virtual void ModifyOwner() override
	{
		if (BaseSequence.IsValid())
		{
			// need to rebake
			BaseSequence.Get()->bNeedsRebake = true;
			BaseSequence.Get()->Modify(true);
		}
	}
コード例 #6
0
FGESEffectSpec::FGESEffectSpec(TWeakObjectPtr<AActor> TargetIn, TWeakObjectPtr<AActor> CauserIn,
	TWeakObjectPtr<AActor> InstigatorIn)
{
	IIGESEffect* targetInt = Cast<IIGESEffect>(TargetIn.Get());
	IIGESEffect* instigatorInt = Cast<IIGESEffect>(InstigatorIn.Get());

	TargetComponent = targetInt->GetEffectComponent();
	InstigatorComponent = instigatorInt->GetEffectComponent();
}
コード例 #7
0
void SDetailNameArea::OnEditBlueprintClicked( TWeakObjectPtr<UBlueprint> InBlueprint, TWeakObjectPtr<UObject> InAsset )
{
	if (UBlueprint* Blueprint = InBlueprint.Get())
	{
		// Set the object being debugged if given an actor reference (if we don't do this before we edit the object the editor wont know we are debugging something)
		if (UObject* Asset = InAsset.Get())
		{
			check(Asset->GetClass()->ClassGeneratedBy == Blueprint);
			Blueprint->SetObjectBeingDebugged(Asset);
		}
		// Open the blueprint
		GEditor->EditObject( Blueprint );
	}
}
コード例 #8
0
ファイル: VertexSnapping.cpp プロジェクト: Foreven/Unreal4-1
void FVertexSnappingImpl::DrawSnappingHelpers(const FSceneView* View,FPrimitiveDrawInterface* PDI)
{
	if( ActorVertsToDraw.IsValid() )
	{
		float PointSize = View->IsPerspectiveProjection() ? 4.0f : 5.0f;
		DrawSnapVertices( ActorVertsToDraw.Get(), PointSize, PDI );
	}

	for( auto It = ActorVertsToFade.CreateIterator(); It; ++It )
	{
		TWeakObjectPtr<AActor> Actor = It.Key();
		double FadeStart = It.Value();

		if( Actor.IsValid() )
		{
			float PointSize = View->IsPerspectiveProjection() ? 4.0f : 5.0f;

			if( FApp::GetCurrentTime()-FadeStart <= VertexSnappingConstants::FadeTime )
			{
				PointSize = FMath::Lerp( PointSize, 0.0f, (FApp::GetCurrentTime()-FadeStart)/VertexSnappingConstants::FadeTime );

				DrawSnapVertices( Actor.Get(), PointSize, PDI );
			}
		}
	
		if( !Actor.IsValid() || FApp::GetCurrentTime()-FadeStart > VertexSnappingConstants::FadeTime )
		{
			It.RemoveCurrent();
		}
	}
}
コード例 #9
0
AGameplayDebuggerPlayerManager& FGameplayDebuggerModule::GetPlayerManager(UWorld* World)
{
	const int32 PurgeInvalidWorldsSize = 5;
	if (PlayerManagers.Num() > PurgeInvalidWorldsSize)
	{
		for (TMap<TWeakObjectPtr<UWorld>, TWeakObjectPtr<AGameplayDebuggerPlayerManager> >::TIterator It(PlayerManagers); It; ++It)
		{
			if (!It.Key().IsValid())
			{
				It.RemoveCurrent();
			}
			else if (!It.Value().IsValid())
			{
				It.RemoveCurrent();
			}
		}
	}

	TWeakObjectPtr<AGameplayDebuggerPlayerManager> Manager = PlayerManagers.FindRef(World);
	AGameplayDebuggerPlayerManager* ManagerOb = Manager.Get();

	if (ManagerOb == nullptr)
	{
		ManagerOb = World->SpawnActor<AGameplayDebuggerPlayerManager>();
		PlayerManagers.Add(World, ManagerOb);
	}

	check(ManagerOb);
	return *ManagerOb;
}
コード例 #10
0
	/** Called to modify the owner of the curve */
	virtual void ModifyOwner()
	{
		if (BaseSequence.IsValid())
		{
			BaseSequence.Get()->Modify(true);
		}
	}
コード例 #11
0
FName FClassIconFinder::FindIconNameForActor( const TWeakObjectPtr<AActor>& InActor )
{
	// Actor specific overrides to normal per-class icons
	AActor* Actor = InActor.Get();
	FName BrushName = NAME_None;

	if ( Actor )
	{
		ABrush* Brush = Cast< ABrush >( Actor );
		if ( Brush )
		{
			if (Brush_Add == Brush->BrushType)
			{
				BrushName = TEXT( "ClassIcon.BrushAdditive" );
			}
			else if (Brush_Subtract == Brush->BrushType)
			{
				BrushName = TEXT( "ClassIcon.BrushSubtractive" );
			}
		}

		// Actor didn't specify an icon - fallback on the class icon
		if ( BrushName.IsNone() )
		{
			BrushName = FindIconNameForClass( Actor->GetClass() );
		}
	}
	else
	{
		// If the actor reference is NULL it must have been deleted
		BrushName = TEXT( "ClassIcon.Deleted" );
	}

	return BrushName;
}
コード例 #12
0
void FPaperExtractSpritesViewportClient::Draw(FViewport* Viewport, FCanvas* Canvas)
{
	// Super will clear the viewport 
	FPaperEditorViewportClient::Draw(Viewport, Canvas);

	UTexture2D* Texture = TextureBeingExtracted.Get();

	if (Texture != nullptr)
	{
		const bool bUseTranslucentBlend = Texture->HasAlphaChannel();

		// Fully stream in the texture before drawing it.
		Texture->SetForceMipLevelsToBeResident(30.0f);
		Texture->WaitForStreaming();

		FLinearColor TextureDrawColor = Settings->TextureTint;
		//FLinearColor RectOutlineColor = FLinearColor::Yellow;
		const FLinearColor RectOutlineColor = Settings->OutlineColor;

		const float XPos = -ZoomPos.X * ZoomAmount;
		const float YPos = -ZoomPos.Y * ZoomAmount;
		const float Width = Texture->GetSurfaceWidth() * ZoomAmount;
		const float Height = Texture->GetSurfaceHeight() * ZoomAmount;

		Canvas->DrawTile(XPos, YPos, Width, Height, 0.0f, 0.0f, 1.0f, 1.0f, TextureDrawColor, Texture->Resource, bUseTranslucentBlend);

		for (FPaperExtractedSprite Sprite : ExtractedSprites)
		{
			DrawRectangle(Canvas, RectOutlineColor, Sprite.Rect);
		}
	}
}
コード例 #13
0
void FAssetTypeActions_EditorUtilityBlueprint::ExecuteNewDerivedBlueprint(TWeakObjectPtr<UEditorUtilityBlueprint> InObject)
{
	if (auto Object = InObject.Get())
	{
		// The menu option should ONLY be available if there is only one blueprint selected, validated by the menu creation code
		UBlueprint* TargetBP = Object;
		UClass* TargetClass = TargetBP->GeneratedClass;

		if (!FKismetEditorUtilities::CanCreateBlueprintOfClass(TargetClass))
		{
			FMessageDialog::Open(EAppMsgType::Ok, LOCTEXT("InvalidClassToMakeBlueprintFrom", "Invalid class with which to make a Blueprint."));
			return;
		}

		FString Name;
		FString PackageName;
		CreateUniqueAssetName(Object->GetOutermost()->GetName(), TEXT("_Child"), PackageName, Name);

		UPackage* Package = CreatePackage(NULL, *PackageName);
		if (ensure(Package))
		{
			// Create and init a new Blueprint
			if (UBlueprint* NewBP = FKismetEditorUtilities::CreateBlueprint(TargetClass, Package, FName(*Name), BPTYPE_Normal, UEditorUtilityBlueprint::StaticClass(), UBlueprintGeneratedClass::StaticClass()))
			{
				FAssetEditorManager::Get().OpenEditorForAsset(NewBP);

				// Notify the asset registry
				FAssetRegistryModule::AssetCreated(NewBP);

				// Mark the package dirty...
				Package->MarkPackageDirty();
			}
		}
	}
}
コード例 #14
0
FVisualLogEntry::FVisualLogEntry(float InTimeStamp, FVector InLocation, const UObject* Object, TArray<TWeakObjectPtr<UObject> >* Children)
{
	TimeStamp = InTimeStamp;
	Location = InLocation;
	const AActor* AsActor = Cast<AActor>(Object);
	if (AsActor)
	{
		AsActor->GrabDebugSnapshot(this);
	}
	if (Children != NULL)
	{
		TWeakObjectPtr<UObject>* WeakActorPtr = Children->GetData();
		for (int32 Index = 0; Index < Children->Num(); ++Index, ++WeakActorPtr)
		{
			if (WeakActorPtr->IsValid())
			{
				const AActor* ChildActor = Cast<AActor>(WeakActorPtr->Get());
				if (ChildActor)
				{
					ChildActor->GrabDebugSnapshot(this);
				}
			}
		}
	}
}
コード例 #15
0
	virtual void TrackingStopped() override 
	{
		if (Widget.IsValid() && Widget->OnTrackingStopped.IsBound())
		{
			Widget->OnTrackingStopped.Execute(Widget.Get());
		}
	}
コード例 #16
0
void FBPProfilerStat::OnNavigateToObject()
{
	switch(ObjectContext.GetType())
	{
		case EScriptInstrumentation::Class:
		{
			break;
		}
		case EScriptInstrumentation::Instance:
		{
			break;
		}
		case EScriptInstrumentation::Event:
		case EScriptInstrumentation::Function:
		case EScriptInstrumentation::Branch:
		case EScriptInstrumentation::Macro:
		default:
		{
			TWeakObjectPtr<const UObject> ObjectPtr = ObjectContext.GetObjectPtr();
			if (ObjectPtr.IsValid())
			{
				FKismetEditorUtilities::BringKismetToFocusAttentionOnObject(ObjectPtr.Get());
			}
			break;
		}
	}
}
コード例 #17
0
	void DoTask(ENamedThreads::Type CurrentThread, const FGraphEventRef& MyCompletionGraphEvent)
	{
		if (USkeletalMeshComponent* Comp = SkeletalMeshComponent.Get())
		{
			Comp->ParallelBlendPhysics();
		}
	}
コード例 #18
0
FReply FEditorUtilityInstanceDetails::OnExecuteAction(TWeakObjectPtr<UFunction> WeakFunctionPtr)
{
    if (UFunction* Function = WeakFunctionPtr.Get())
    {
        FScopedTransaction Transaction( NSLOCTEXT("UnrealEd", "BlutilityAction", "Blutility Action") );
        FEditorScriptExecutionGuard ScriptGuard;

        UClass* MinRequiredClass = Function->GetOuterUClass();

        // Execute this function on any objects that support it
        for (auto SelectedObjectIt = SelectedObjectsList.CreateConstIterator(); SelectedObjectIt; ++SelectedObjectIt)
        {
            UObject* Object = (*SelectedObjectIt).Get();

            if ((Object != NULL) && (Object->IsA(MinRequiredClass)))
            {
                Object->ProcessEvent(Function, NULL);

                if (UGlobalEditorUtilityBase* BlutilityInstance = Cast<UGlobalEditorUtilityBase>(Object))
                {
                    BlutilityInstance->PostExecutionCleanup();
                }
            }
        }
    }

    return FReply::Handled();
}
コード例 #19
0
bool FPropertyTableColumn::CanSortBy() const
{
	TWeakObjectPtr< UObject > Object = DataSource->AsUObject();
	UProperty* Property = Cast< UProperty >( Object.Get() );

	TSharedPtr< FPropertyPath > Path = DataSource->AsPropertyPath();
	if ( Property == NULL && Path.IsValid() )
	{
		Property = Path->GetLeafMostProperty().Property.Get();
	}

	if ( Property != NULL )
	{
		return Property->IsA( UByteProperty::StaticClass() )  ||
			Property->IsA( UIntProperty::StaticClass() )   ||
			Property->IsA( UBoolProperty::StaticClass() )  ||
			Property->IsA( UFloatProperty::StaticClass() ) ||
			Property->IsA( UNameProperty::StaticClass() )  ||
			Property->IsA( UStrProperty::StaticClass() )   ||
			( Property->IsA( UObjectProperty::StaticClass() ) && !Property->HasAnyPropertyFlags(CPF_InstancedReference) );
			//Property->IsA( UTextProperty::StaticClass() );
	}

	return false;
}
コード例 #20
0
	void DoTask(ENamedThreads::Type CurrentThread, const FGraphEventRef& MyCompletionGraphEvent)
	{
		SCOPE_CYCLE_COUNTER(STAT_AnimGameThreadTime);
		if (USkeletalMeshComponent* Comp = SkeletalMeshComponent.Get())
		{
			Comp->CompleteParallelBlendPhysics();
		}
	}
コード例 #21
0
//------------------------------------------------------------------------------
bool FDeferredScriptLoader::Resolve(FArchive& Ar)
{
	if (UStruct* Target = TargetScriptContainerPtr.Get())
	{
		return LoadStructWithScript(Target, Ar);
	}
	return false;
}
コード例 #22
0
			// Called by the EditableText widget to get the current comment for the node
			static FString GetNodeComment(TWeakObjectPtr<UEdGraphNode> NodeWeakPtr)
			{
				if (UEdGraphNode* SelectedNode = NodeWeakPtr.Get())
				{
					return SelectedNode->NodeComment;
				}
				return FString();
			}
コード例 #23
0
ファイル: SAnimCurvePanel.cpp プロジェクト: Codermay/Unreal4
	virtual bool IsValidCurve( FRichCurveEditInfo CurveInfo ) override
	{
		// Get the curve with the ID directly from the sequence and compare it since undo/redo can cause previously
		// used curves to become invalid.
		FAnimCurveBase* CurrentCurveData = BaseSequence.Get()->RawCurveData.GetCurveData( CurveUID );
		return CurrentCurveData != nullptr &&
			CurveInfo.CurveToEdit == &((FFloatCurve*)CurrentCurveData)->FloatCurve;
	}
コード例 #24
0
void FAssetTypeActions_Texture::ExecuteFindMaterials(TWeakObjectPtr<UTexture> Object)
{
	auto Texture = Object.Get();
	if ( Texture )
	{
		// @todo AssetTypeActions Implement FindMaterials using the asset registry.
	}
}
コード例 #25
0
	virtual void MouseLeave(FViewport* Viewport) override
	{
		FEditorViewportClient::MouseLeave(Viewport);
		if (Widget.IsValid() && Widget->OnMouseLeave.IsBound())
		{
			Widget->OnMouseLeave.Execute(Widget.Get());
		}
	}
コード例 #26
0
	virtual void MouseMove(FViewport* Viewport, int32 x, int32 y) override
	{
		FEditorViewportClient::MouseMove(Viewport, x, y);
		if (Widget.IsValid() && Widget->OnMouseMove.IsBound())
		{
			Widget->OnMouseMove.Execute(x, y, Widget.Get());
		}
	}
コード例 #27
0
	virtual UObject* GetOwner()
	{
		if (BaseSequence.IsValid())
		{
			return BaseSequence.Get();
		}

		return NULL;
	}
コード例 #28
0
	virtual void Draw(const FSceneView* View, FPrimitiveDrawInterface* PDI) override
	{
		FEditorViewportClient::Draw(View, PDI);

		if (Widget.IsValid() && Widget->OnDraw.IsBound())
		{
			Widget->OnDraw.Execute(FJavascriptPDI(PDI),Widget.Get());
		}
	}
コード例 #29
0
void UAblAbilityTaskRaycastValidator::Validate(const TWeakObjectPtr<UAblAbilityTaskValidatorContext>& Context, const TWeakObjectPtr<const UAblAbilityTask>& Task) const
{
	const UAblRayCastQueryTask* RaycastTask = CastChecked<const UAblRayCastQueryTask>(Task.Get());

	if (!RaycastTask->GetFireEvent() && !RaycastTask->GetCopyResultsToContext())
	{
		Context->AddWarning(LOCTEXT("AbilityValidatorRayCastNoOutput", "Raycast Task is set to not fire its event or copy its results to the context. This Task won't be able to do anything with its results."));
	}
}
コード例 #30
-1
void UAblAbilityTaskPlayAnimationAssetValidator::Validate(const TWeakObjectPtr<UAblAbilityTaskValidatorContext>& Context, const TWeakObjectPtr<const UAblAbilityTask>& Task) const
{
	const UAblPlayAnimationTask* PlayAnimationTask = CastChecked<UAblPlayAnimationTask>(Task.Get());

	const UAnimationAsset* AnimationAsset = PlayAnimationTask->GetAnimationAsset();
	if (AnimationAsset == nullptr)
	{
		Context->AddError(LOCTEXT("AbilityValidatorPlayAnimationNoAsset", "Play Animation Task does not have a animation asset specified."));
	}
	else if (!AnimationAsset->IsA<UAnimSequenceBase>() && !AnimationAsset->IsA<UAnimMontage>())
	{
		Context->AddError(LOCTEXT("AbilityValidatorPlayAnimationWrongAssetType", "Play Animation Task has an invalid asset specified. Only Sequences and Montages are supported."));
	}

	if (PlayAnimationTask->GetAnimationMode() == EAblPlayAnimationTaskAnimMode::AbilityAnimationNode)
	{
		// None is our default value, so if that hasn't changed we need to tell the user.
		if (PlayAnimationTask->GetStateMachineName().IsNone())
		{
			Context->AddError(LOCTEXT("AbilityValidatorPlayAnimationInvalidStateMachine", "Play Animation Task is set to use Ability Animation Mode, but doesn't have a State Machine Name specified."));
		}

		if (PlayAnimationTask->GetAbilityStateName().IsNone())
		{
			Context->AddError(LOCTEXT("AbilityValidatorPlayAnimationInvalidAbilityNode", "Play Animation Task is set to use Ability Animation Mode, but doesn't have a Ability State Name specified."));
		}
	}
}