本文整理汇总了C++中UActorComponent::GetOwner方法的典型用法代码示例。如果您正苦于以下问题:C++ UActorComponent::GetOwner方法的具体用法?C++ UActorComponent::GetOwner怎么用?C++ UActorComponent::GetOwner使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UActorComponent
的用法示例。
在下文中一共展示了UActorComponent::GetOwner方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PyErr_Format
PyObject *py_ue_bind_key(ue_PyUObject *self, PyObject * args)
{
ue_py_check(self);
char *key_name;
int key;
PyObject *py_callable;
if (!PyArg_ParseTuple(args, "siO:bind_key", &key_name, &key, &py_callable))
{
return NULL;
}
if (!PyCallable_Check(py_callable))
{
return PyErr_Format(PyExc_Exception, "object is not a callable");
}
UInputComponent *input = nullptr;
if (self->ue_object->IsA<AActor>())
{
input = ((AActor *)self->ue_object)->InputComponent;
}
else if (self->ue_object->IsA<UActorComponent>())
{
UActorComponent *component = (UActorComponent *)self->ue_object;
if (!component->GetOwner())
return PyErr_Format(PyExc_Exception, "component is still not mapped to an Actor");
input = component->GetOwner()->InputComponent;
}
else
{
return PyErr_Format(PyExc_Exception, "uobject is not an actor or a component");
}
if (!input)
{
return PyErr_Format(PyExc_Exception, "no input manager for this uobject");
}
UPythonDelegate *py_delegate = FUnrealEnginePythonHouseKeeper::Get()->NewDelegate(input, py_callable, nullptr);
FInputKeyBinding input_key_binding(FKey(UTF8_TO_TCHAR(key_name)), (const EInputEvent)key);
input_key_binding.KeyDelegate.BindDelegate(py_delegate, &UPythonDelegate::PyInputHandler);
input->KeyBindings.Add(input_key_binding);
Py_RETURN_NONE;
}
示例2: ReconstructOwnerInstances
void FBlueprintCompileReinstancer::ReconstructOwnerInstances(TSubclassOf<UActorComponent> ComponentClass)
{
if (ComponentClass == nullptr)
{
return;
}
TArray<UObject*> ComponentInstances;
GetObjectsOfClass(ComponentClass, ComponentInstances, /*bIncludeDerivedClasses =*/false);
TSet<AActor*> OwnerInstances;
for (UObject* ComponentObj : ComponentInstances)
{
UActorComponent* Component = CastChecked<UActorComponent>(ComponentObj);
if (AActor* OwningActor = Component->GetOwner())
{
// we don't just rerun construction here, because we could end up
// doing it twice for the same actor (if it had multiple components
// of this kind), so we put that off as a secondary pass
OwnerInstances.Add(OwningActor);
}
}
for (AActor* ComponentOwner : OwnerInstances)
{
ComponentOwner->RerunConstructionScripts();
}
}
示例3: OnGetMaterialsForView
void FComponentMaterialCategory::OnGetMaterialsForView( IMaterialListBuilder& MaterialList )
{
const bool bAllowNullEntries = true;
// Iterate over every material on the actors
for( FMaterialIterator It( SelectedComponents ); It; ++It )
{
int32 MaterialIndex = It.GetMaterialIndex();
UActorComponent* CurrentComponent = It.GetComponent();
if( CurrentComponent )
{
UMaterialInterface* Material = It.GetMaterial();
AActor* Actor = CurrentComponent->GetOwner();
// Component materials can be replaced if the component supports material overrides
const bool bCanBeReplaced =
( CurrentComponent->IsA( UMeshComponent::StaticClass() ) ||
CurrentComponent->IsA( UTextRenderComponent::StaticClass() ) ||
CurrentComponent->IsA( ULandscapeComponent::StaticClass() ) );
// Add the material if we allow null materials to be added or we have a valid material
if( bAllowNullEntries || Material )
{
MaterialList.AddMaterial( MaterialIndex, Material, bCanBeReplaced );
}
}
}
}
示例4: GetParentObject
UObject* ULevelSequence::GetParentObject(UObject* Object) const
{
UActorComponent* Component = Cast<UActorComponent>(Object);
if (Component != nullptr)
{
return Component->GetOwner();
}
return nullptr;
}
示例5: PyErr_Format
PyObject *py_ue_get_owner(ue_PyUObject *self, PyObject * args)
{
ue_py_check(self);
UActorComponent *component = ue_py_check_type<UActorComponent>(self);
if (!component)
return PyErr_Format(PyExc_Exception, "uobject is not a component");
Py_RETURN_UOBJECT(component->GetOwner());
}
示例6: Refresh
void SDetailNameArea::Refresh( const TArray< TWeakObjectPtr<AActor> >& SelectedActors, const TArray< TWeakObjectPtr<UObject> >& SelectedObjects, FDetailsViewArgs::ENameAreaSettings NameAreaSettings )
{
// Convert the actor array to base object type
TArray< TWeakObjectPtr<UObject> > FinalSelectedObjects;
if(NameAreaSettings == FDetailsViewArgs::ActorsUseNameArea)
{
for(auto Actor : SelectedActors)
{
const TWeakObjectPtr<UObject> ObjectWeakPtr = Actor.Get();
FinalSelectedObjects.Add(ObjectWeakPtr);
}
}
else if( NameAreaSettings == FDetailsViewArgs::ComponentsAndActorsUseNameArea )
{
for(auto Actor : SelectedActors)
{
const TWeakObjectPtr<UObject> ObjectWeakPtr = Actor.Get();
FinalSelectedObjects.Add(ObjectWeakPtr);
}
// Note: assumes that actors and components are not selected together.
if( FinalSelectedObjects.Num() == 0 )
{
for(auto Object : SelectedObjects)
{
UActorComponent* ActorComp = Cast<UActorComponent>(Object.Get());
if(ActorComp && ActorComp->GetOwner())
{
FinalSelectedObjects.AddUnique(ActorComp->GetOwner());
}
}
}
}
Refresh( FinalSelectedObjects );
}
示例7: PyErr_Format
PyObject *py_ue_get_owner(ue_PyUObject *self, PyObject * args) {
ue_py_check(self);
if (!self->ue_object->IsA<UActorComponent>()) {
return PyErr_Format(PyExc_Exception, "uobject is not a component");
}
UActorComponent *component = (UActorComponent *)self->ue_object;
ue_PyUObject *ret = ue_get_python_wrapper(component->GetOwner());
if (!ret)
return PyErr_Format(PyExc_Exception, "uobject is in invalid state");
Py_INCREF(ret);
return (PyObject *)ret;
}
示例8: PyUnicode_FromString
PyObject *py_ue_get_actor_label(ue_PyUObject *self, PyObject * args) {
ue_py_check(self);
if (self->ue_object->IsA<AActor>()) {
AActor *actor = (AActor *)self->ue_object;
return PyUnicode_FromString(TCHAR_TO_UTF8(*(actor->GetActorLabel())));
}
if (self->ue_object->IsA<UActorComponent>()) {
UActorComponent *component = (UActorComponent *)self->ue_object;
return PyUnicode_FromString(TCHAR_TO_UTF8(*(component->GetOwner()->GetActorLabel())));
}
return PyErr_Format(PyExc_Exception, "uobject is not an actor or a component");
}
示例9: PyErr_Format
PyObject *py_ue_simple_move_to_location(ue_PyUObject *self, PyObject * args) {
ue_py_check(self);
FVector vec;
if (!py_ue_vector_arg(args, vec))
return NULL;
UWorld *world = ue_get_uworld(self);
if (!world)
return PyErr_Format(PyExc_Exception, "unable to retrieve UWorld from uobject");
APawn *pawn = nullptr;
if (self->ue_object->IsA<APawn>()) {
pawn = (APawn *)self->ue_object;
}
else if (self->ue_object->IsA<UActorComponent>()) {
UActorComponent *component = (UActorComponent *)self->ue_object;
AActor *actor = component->GetOwner();
if (actor) {
if (actor->IsA<APawn>()) {
pawn = (APawn *)actor;
}
}
}
if (!pawn)
return PyErr_Format(PyExc_Exception, "uobject is not a pawn");
AController *controller = pawn->GetController();
if (!controller)
return PyErr_Format(PyExc_Exception, "Pawn has no controller");
world->GetNavigationSystem()->SimpleMoveToLocation(controller, vec);
Py_INCREF(Py_None);
return Py_None;
}
示例10: ReplaceInstancesOfClass
//.........这里部分代码省略.........
GEditor->Layers->DisassociateActorFromLayers(OldActor);
}
World->EditorDestroyActor(OldActor, /*bShouldModifyLevel =*/true);
OldToNewInstanceMap.Add(OldActor, NewActor);
}
else
{
FName OldName(OldObject->GetFName());
OldObject->Rename(NULL, OldObject->GetOuter(), REN_DoNotDirty | REN_DontCreateRedirectors);
NewUObject = NewObject<UObject>(OldObject->GetOuter(), NewClass, OldName);
check(NewUObject != nullptr);
UEditorEngine::CopyPropertiesForUnrelatedObjects(OldObject, NewUObject);
if (UAnimInstance* AnimTree = Cast<UAnimInstance>(NewUObject))
{
// Initialising the anim instance isn't enough to correctly set up the skeletal mesh again in a
// paused world, need to initialise the skeletal mesh component that contains the anim instance.
if (USkeletalMeshComponent* SkelComponent = Cast<USkeletalMeshComponent>(AnimTree->GetOuter()))
{
SkelComponent->InitAnim(true);
}
}
OldObject->RemoveFromRoot();
OldObject->MarkPendingKill();
OldToNewInstanceMap.Add(OldObject, NewUObject);
if (bIsComponent)
{
UActorComponent* Component = Cast<UActorComponent>(NewUObject);
AActor* OwningActor = Component->GetOwner();
if (OwningActor)
{
OwningActor->ResetOwnedComponents();
// Check to see if they have an editor that potentially needs to be refreshed
if (OwningActor->GetClass()->ClassGeneratedBy)
{
PotentialEditorsForRefreshing.AddUnique(OwningActor->GetClass()->ClassGeneratedBy);
}
// we need to keep track of actor instances that need
// their construction scripts re-ran (since we've just
// replaced a component they own)
OwnersToReconstruct.Add(OwningActor);
}
}
}
// If this original object came from a blueprint and it was in the selected debug set, change the debugging to the new object.
if ((CorrespondingBlueprint) && (OldBlueprintDebugObject) && (NewUObject))
{
CorrespondingBlueprint->SetObjectBeingDebugged(NewUObject);
}
if (bLogConversions)
{
UE_LOG(LogBlueprint, Log, TEXT("Converted instance '%s' to '%s'"), *OldObject->GetPathName(), *NewUObject->GetPathName());
}
}
}
GEditor->OnObjectsReplaced().Remove(OnObjectsReplacedHandle);
示例11: UpdatePivotLocationForSelection
void UUnrealEdEngine::UpdatePivotLocationForSelection( bool bOnChange )
{
// Pick a new common pivot, or not.
AActor* SingleActor = nullptr;
USceneComponent* SingleComponent = nullptr;
if (GetSelectedComponentCount() > 0)
{
for (FSelectedEditableComponentIterator It(*GetSelectedComponents()); It; ++It)
{
UActorComponent* Component = CastChecked<UActorComponent>(*It);
AActor* ComponentOwner = Component->GetOwner();
if (ComponentOwner != nullptr)
{
auto SelectedActors = GetSelectedActors();
const bool bIsOwnerSelected = SelectedActors->IsSelected(ComponentOwner);
check(bIsOwnerSelected);
if (ComponentOwner->GetWorld() == GWorld)
{
SingleActor = ComponentOwner;
if (Component->IsA<USceneComponent>())
{
SingleComponent = CastChecked<USceneComponent>(Component);
}
const bool IsTemplate = ComponentOwner->IsTemplate();
const bool LevelLocked = !FLevelUtils::IsLevelLocked(ComponentOwner->GetLevel());
check(IsTemplate || LevelLocked);
}
}
}
}
else
{
for (FSelectionIterator It(GetSelectedActorIterator()); It; ++It)
{
AActor* Actor = static_cast<AActor*>(*It);
checkSlow(Actor->IsA(AActor::StaticClass()));
if (Actor->GetWorld() == GWorld)
{
const bool IsTemplate = Actor->IsTemplate();
const bool LevelLocked = !FLevelUtils::IsLevelLocked(Actor->GetLevel());
check(IsTemplate || LevelLocked);
SingleActor = Actor;
}
}
}
if (SingleComponent != NULL)
{
SetPivot(SingleComponent->GetComponentLocation(), false, true);
}
else if( SingleActor != NULL )
{
// For geometry mode use current pivot location as it's set to selected face, not actor
FEditorModeTools& Tools = GLevelEditorModeTools();
if( Tools.IsModeActive(FBuiltinEditorModes::EM_Geometry) == false || bOnChange == true )
{
// Set pivot point to the actor's location
FVector PivotPoint = SingleActor->GetActorLocation();
// If grouping is active, see if this actor is part of a locked group and use that pivot instead
if(GEditor->bGroupingActive)
{
AGroupActor* ActorGroupRoot = AGroupActor::GetRootForActor(SingleActor, true, true);
if(ActorGroupRoot)
{
PivotPoint = ActorGroupRoot->GetActorLocation();
}
}
SetPivot( PivotPoint, false, true );
}
}
else
{
ResetPivot();
}
}
示例12: Apply
/**
* Enacts the transaction.
*/
void FTransaction::Apply()
{
checkSlow(Inc==1||Inc==-1);
// Figure out direction.
const int32 Start = Inc==1 ? 0 : Records.Num()-1;
const int32 End = Inc==1 ? Records.Num() : -1;
// Init objects.
for( int32 i=Start; i!=End; i+=Inc )
{
FObjectRecord& Record = Records[i];
Record.bRestored = false;
UObject* Object = Record.Object.Get();
if (Object)
{
if (!ChangedObjects.Contains(Object))
{
Object->CheckDefaultSubobjects();
Object->PreEditUndo();
}
ChangedObjects.Add(Object, Record.ObjectAnnotation);
}
}
if (bFlip)
{
for (int32 i = Start; i != End; i += Inc)
{
Records[i].Save(this);
}
for (int32 i = Start; i != End; i += Inc)
{
Records[i].Load(this);
}
}
else
{
for (int32 i = Start; i != End; i += Inc)
{
Records[i].Restore(this);
}
}
// An Actor's components must always get its PostEditUndo before the owning Actor so do a quick sort
ChangedObjects.KeySort([](UObject& A, UObject& B)
{
UActorComponent* BAsComponent = Cast<UActorComponent>(&B);
return (BAsComponent ? (BAsComponent->GetOwner() != &A) : true);
});
TArray<ULevel*> LevelsToCommitModelSurface;
NumModelsModified = 0; // Count the number of UModels that were changed.
for (auto ChangedObjectIt : ChangedObjects)
{
UObject* ChangedObject = ChangedObjectIt.Key;
UModel* Model = Cast<UModel>(ChangedObject);
if (Model && Model->Nodes.Num())
{
FBSPOps::bspBuildBounds(Model);
++NumModelsModified;
}
if (UModelComponent* ModelComponent = Cast<UModelComponent>(ChangedObject))
{
ULevel* Level = ModelComponent->GetTypedOuter<ULevel>();
check(Level);
LevelsToCommitModelSurface.AddUnique(Level);
}
TSharedPtr<ITransactionObjectAnnotation> ChangedObjectTransactionAnnotation = ChangedObjectIt.Value;
if (ChangedObjectTransactionAnnotation.IsValid())
{
ChangedObject->PostEditUndo(ChangedObjectTransactionAnnotation);
}
else
{
ChangedObject->PostEditUndo();
}
}
// Commit model surfaces for unique levels within the transaction
for (ULevel* Level : LevelsToCommitModelSurface)
{
Level->CommitModelSurfaces();
}
// Flip it.
if (bFlip)
{
Inc *= -1;
}
for (auto ChangedObjectIt : ChangedObjects)
{
UObject* ChangedObject = ChangedObjectIt.Key;
//.........这里部分代码省略.........