本文整理汇总了C++中UActorComponent::Modify方法的典型用法代码示例。如果您正苦于以下问题:C++ UActorComponent::Modify方法的具体用法?C++ UActorComponent::Modify怎么用?C++ UActorComponent::Modify使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UActorComponent
的用法示例。
在下文中一共展示了UActorComponent::Modify方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: BeginTransaction
void FSCSEditorViewportClient::BeginTransaction(const FText& Description)
{
//UE_LOG(LogSCSEditorViewport, Log, TEXT("FSCSEditorViewportClient::BeginTransaction() pre: %s %08x"), SessionName, *((uint32*)&ScopedTransaction));
if(!ScopedTransaction)
{
ScopedTransaction = new FScopedTransaction(Description);
auto BlueprintEditor = BlueprintEditorPtr.Pin();
if (BlueprintEditor.IsValid())
{
UBlueprint* PreviewBlueprint = BlueprintEditor->GetBlueprintObj();
if (PreviewBlueprint != nullptr)
{
FBlueprintEditorUtils::MarkBlueprintAsModified(PreviewBlueprint);
}
TArray<FSCSEditorTreeNodePtrType> SelectedNodes = BlueprintEditor->GetSelectedSCSEditorTreeNodes();
for(auto SelectedSCSNodeIter(SelectedNodes.CreateIterator()); SelectedSCSNodeIter; ++SelectedSCSNodeIter)
{
FSCSEditorTreeNodePtrType Node = *SelectedSCSNodeIter;
if(Node.IsValid())
{
if(USCS_Node* SCS_Node = Node->GetSCSNode())
{
SCS_Node->Modify();
}
// Modify both the component template and the instance in the preview actor (provided there is one)
UActorComponent* ComponentTemplate = Node->GetEditableComponentTemplate(PreviewBlueprint);
if (ComponentTemplate != nullptr)
{
ComponentTemplate->SetFlags(RF_Transactional);
ComponentTemplate->Modify();
}
AActor* PreviewActor = GetPreviewActor();
if (PreviewActor)
{
UActorComponent* ComponentPreviewInstance = Node->FindComponentInstanceInActor(PreviewActor);
if (ComponentPreviewInstance != nullptr)
{
ComponentPreviewInstance->SetFlags(RF_Transactional);
ComponentPreviewInstance->Modify();
}
}
}
}
}
}
//UE_LOG(LogSCSEditorViewport, Log, TEXT("FSCSEditorViewportClient::BeginTransaction() post: %s %08x"), SessionName, *((uint32*)&ScopedTransaction));
}
示例2: GetTemplateFromNode
void UK2Node_AddComponent::DestroyNode()
{
// See if this node has a template
UActorComponent* Template = GetTemplateFromNode();
if (Template != NULL)
{
// Save current template state - this is needed in order to ensure that we restore to the correct Outer in the case of a compile prior to the undo/redo action.
Template->Modify();
// Get the blueprint so we can remove it from it
UBlueprint* BlueprintObj = GetBlueprint();
// remove it
BlueprintObj->Modify();
BlueprintObj->ComponentTemplates.Remove(Template);
}
Super::DestroyNode();
}
示例3: BeginTransaction
void FSCSEditorViewportClient::BeginTransaction(const FText& Description)
{
//UE_LOG(LogSCSEditorViewport, Log, TEXT("FSCSEditorViewportClient::BeginTransaction() pre: %s %08x"), SessionName, *((uint32*)&ScopedTransaction));
if(!ScopedTransaction)
{
ScopedTransaction = new FScopedTransaction(Description);
if(PreviewBlueprint != NULL)
{
FBlueprintEditorUtils::MarkBlueprintAsModified(PreviewBlueprint);
}
TArray<FSCSEditorTreeNodePtrType> SelectedNodes = BlueprintEditorPtr.Pin()->GetSelectedSCSEditorTreeNodes();
if(SelectedNodes.Num() > 0)
{
for(auto SelectedSCSNodeIter(SelectedNodes.CreateIterator()); SelectedSCSNodeIter; ++SelectedSCSNodeIter)
{
FSCSEditorTreeNodePtrType Node = *SelectedSCSNodeIter;
if(Node.IsValid())
{
if(USCS_Node* SCS_Node = Node->GetSCSNode())
{
SCS_Node->Modify();
}
UActorComponent* ComponentTemplate = Node->GetComponentTemplate();
if(ComponentTemplate != NULL)
{
ComponentTemplate->SetFlags(RF_Transactional);
ComponentTemplate->Modify();
}
}
}
}
}
//UE_LOG(LogSCSEditorViewport, Log, TEXT("FSCSEditorViewportClient::BeginTransaction() post: %s %08x"), SessionName, *((uint32*)&ScopedTransaction));
}
示例4: CreateNode
USCS_Node* USimpleConstructionScript::CreateNode(UClass* NewComponentClass, FName NewComponentVariableName)
{
UBlueprint* Blueprint = GetBlueprint();
check(Blueprint);
check(NewComponentClass->IsChildOf(UActorComponent::StaticClass()));
ensure(Cast<UBlueprintGeneratedClass>(Blueprint->GeneratedClass));
// note that naming logic is duplicated in CreateNodeAndRenameComponent:
NewComponentVariableName = GenerateNewComponentName(NewComponentClass, NewComponentVariableName);
// A bit of a hack, but by doing this we ensure that the original object isn't outered to the BPGC. That way if we undo this action later, it'll rename the template away from the BPGC.
// This is necessary because of our template object naming scheme that's in place to ensure deterministic cooking. We have to keep the SCS node and template object names in sync as a result,
// and leaving the template outered to the BPGC can lead to template object name collisions when attempting to rename the remaining SCS nodes. See USCS_Node::NameWasModified() for more details.
UActorComponent* NewComponentTemplate = NewObject<UActorComponent>(GetTransientPackage(), NewComponentClass, NAME_None, RF_ArchetypeObject | RF_Transactional | RF_Public);
// Record initial object state in case we're in a transaction context.
NewComponentTemplate->Modify();
// Now set the actual name and outer to the BPGC.
NewComponentTemplate->Rename(*(NewComponentVariableName.ToString() + UActorComponent::ComponentTemplateNameSuffix), Blueprint->GeneratedClass, REN_DoNotDirty|REN_DontCreateRedirectors|REN_ForceNoResetLoaders);
return CreateNodeImpl(NewComponentTemplate, NewComponentVariableName);
}