void FUMGSequencerObjectBindingManager::BindPossessableObject( const FGuid& PossessableGuid, UObject& PossessedObject )
{
	UPanelSlot* PossessedSlot = Cast<UPanelSlot>(&PossessedObject);
	if ( PossessedSlot != nullptr && PossessedSlot->Content != nullptr )
	{
		SlotContentPreviewObjectToGuidMap.Add(PossessedSlot->Content, PossessableGuid);
		GuidToSlotContentPreviewObjectsMap.Add(PossessableGuid, PossessedSlot->Content);

		// Save the name of the widget containing the slots.  This is the object to look up that contains the slot itself(the thing we are animating)
		FWidgetAnimationBinding NewBinding;
		NewBinding.AnimationGuid = PossessableGuid;
		NewBinding.SlotWidgetName = PossessedSlot->GetFName();
		NewBinding.WidgetName = PossessedSlot->Content->GetFName();

		WidgetAnimation->AnimationBindings.Add(NewBinding);
	}
	else if( PossessedSlot == nullptr )
	{
		PreviewObjectToGuidMap.Add(&PossessedObject, PossessableGuid);
		GuidToPreviewObjectsMap.Add(PossessableGuid, &PossessedObject);

		FWidgetAnimationBinding NewBinding;
		NewBinding.AnimationGuid = PossessableGuid;
		NewBinding.WidgetName = PossessedObject.GetFName();

		WidgetAnimation->AnimationBindings.Add(NewBinding);
	}
}
예제 #2
0
bool UPanelWidget::RemoveChildAt(int32 Index)
{
	if ( Index < 0 || Index >= Slots.Num() )
	{
		return false;
	}

	UPanelSlot* PanelSlot = Slots[Index];
	if ( PanelSlot->Content )
	{
		PanelSlot->Content->Slot = nullptr;
	}

	Slots.RemoveAt(Index);

	OnSlotRemoved(PanelSlot);

	const bool bReleaseChildren = true;
	PanelSlot->ReleaseSlateResources(bReleaseChildren);

	PanelSlot->Parent = nullptr;
	PanelSlot->Content = nullptr;

	InvalidateLayoutAndVolatility();

	return true;
}
예제 #3
0
UPanelSlot* UPanelWidget::AddChild(UWidget* Content)
{
	if ( Content == nullptr )
	{
		return nullptr;
	}

	if ( !bCanHaveMultipleChildren && GetChildrenCount() > 0 )
	{
		return nullptr;
	}

	Content->RemoveFromParent();

	UPanelSlot* PanelSlot = NewObject<UPanelSlot>(this, GetSlotClass());
	PanelSlot->SetFlags(RF_Transactional);
	PanelSlot->Content = Content;
	PanelSlot->Parent = this;

	if ( Content )
	{
		Content->Slot = PanelSlot;
	}

	Slots.Add(PanelSlot);

	OnSlotAdded(PanelSlot);

	InvalidateLayoutAndVolatility();

	return PanelSlot;
}
void UWidgetAnimation::BindPossessableObject(const FGuid& ObjectId, UObject& PossessedObject, UObject* Context)
{
	// If it's the Root Widget
	if (&PossessedObject == PreviewWidget.Get())
	{
		PreviewObjectToIds.Add(&PossessedObject, ObjectId);
		IdToPreviewObjects.Add(ObjectId, &PossessedObject);

		FWidgetAnimationBinding NewBinding;
		{
			NewBinding.AnimationGuid = ObjectId;
			NewBinding.WidgetName = PossessedObject.GetFName();
			NewBinding.bIsRootWidget = true;
		}

		AnimationBindings.Add(NewBinding);
		return;
	}
	
	UPanelSlot* PossessedSlot = Cast<UPanelSlot>(&PossessedObject);

	if ((PossessedSlot != nullptr) && (PossessedSlot->Content != nullptr))
	{
		SlotContentPreviewObjectToIds.Add(PossessedSlot->Content, ObjectId);
		IdToSlotContentPreviewObjects.Add(ObjectId, PossessedSlot->Content);

		// Save the name of the widget containing the slots. This is the object
		// to look up that contains the slot itself (the thing we are animating).
		FWidgetAnimationBinding NewBinding;
		{
			NewBinding.AnimationGuid = ObjectId;
			NewBinding.SlotWidgetName = PossessedSlot->GetFName();
			NewBinding.WidgetName = PossessedSlot->Content->GetFName();
			NewBinding.bIsRootWidget = false;
		}

		AnimationBindings.Add(NewBinding);
	}
	else if (PossessedSlot == nullptr)
	{
		PreviewObjectToIds.Add(&PossessedObject, ObjectId);
		IdToPreviewObjects.Add(ObjectId, &PossessedObject);

		FWidgetAnimationBinding NewBinding;
		{
			NewBinding.AnimationGuid = ObjectId;
			NewBinding.WidgetName = PossessedObject.GetFName();
			NewBinding.bIsRootWidget = false;
		}

		AnimationBindings.Add(NewBinding);
	}
}
예제 #5
0
bool UPanelWidget::ReplaceChildAt(int32 Index, UWidget* Content)
{
	if ( Index < 0 || Index >= Slots.Num() )
	{
		return false;
	}

	UPanelSlot* PanelSlot = Slots[Index];
	PanelSlot->Content = Content;

	if ( Content )
	{
		Content->Slot = PanelSlot;
	}

	PanelSlot->SynchronizeProperties();

	return true;
}