Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,27 @@ void UCubismEyeBlinkComponent::Setup(UCubismModelComponent* InModel)
Model->AddTickPrerequisiteComponent(this); // model ticks after parameters are updated by components
}

TObjectPtr<UCubismModelComponent> UCubismEyeBlinkComponent::GetModel()
{
if (TObjectPtr<UCubismModelComponent> ModelComp = Cast<UCubismModelComponent>(GetOwner()->FindComponentByClass<UCubismModelComponent>()))
{
return ModelComp;
}

return nullptr;
}

// UObject interface
void UCubismEyeBlinkComponent::PostLoad()
{
Super::PostLoad();

const ACubismModel* Owner = Cast<ACubismModel>(GetOwner());
const TObjectPtr<UCubismModelComponent> ModelComp = GetModel();

Setup(Owner->Model);
if (ModelComp)
{
Setup(ModelComp);
}
}

#if WITH_EDITOR
Expand Down Expand Up @@ -118,9 +131,12 @@ void UCubismEyeBlinkComponent::OnComponentCreated()
{
Super::OnComponentCreated();

const ACubismModel* Owner = Cast<ACubismModel>(GetOwner());
const TObjectPtr<UCubismModelComponent> ModelComp = GetModel();

Setup(Owner->Model);
if (ModelComp)
{
Setup(ModelComp);
}
}

void UCubismEyeBlinkComponent::TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,27 @@ void UCubismHarmonicMotionComponent::Setup(UCubismModelComponent* InModel)
Model->AddTickPrerequisiteComponent(this); // model ticks after parameters are updated by components
}

TObjectPtr<UCubismModelComponent> UCubismHarmonicMotionComponent::GetModel()
{
if (TObjectPtr<UCubismModelComponent> ModelComp = Cast<UCubismModelComponent>(GetOwner()->FindComponentByClass<UCubismModelComponent>()))
{
return ModelComp;
}

return nullptr;
}

// UObject interface
void UCubismHarmonicMotionComponent::PostLoad()
{
Super::PostLoad();

const ACubismModel* Owner = Cast<ACubismModel>(GetOwner());
const TObjectPtr<UCubismModelComponent> ModelComp = GetModel();

Setup(Owner->Model);
if (ModelComp)
{
Setup(ModelComp);
}
}
// End of UObject interface

Expand All @@ -57,9 +70,12 @@ void UCubismHarmonicMotionComponent::OnComponentCreated()
{
Super::OnComponentCreated();

const ACubismModel* Owner = Cast<ACubismModel>(GetOwner());
const TObjectPtr<UCubismModelComponent> ModelComp = GetModel();

Setup(Owner->Model);
if (ModelComp)
{
Setup(ModelComp);
}
}

void UCubismHarmonicMotionComponent::TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,14 +119,27 @@ TObjectPtr<UAudioComponent> UCubismLipSyncComponent::CreateAudioComponent()
return NewAudio;
}

TObjectPtr<UCubismModelComponent> UCubismLipSyncComponent::GetModel()
{
if (TObjectPtr<UCubismModelComponent> ModelComp = Cast<UCubismModelComponent>(GetOwner()->FindComponentByClass<UCubismModelComponent>()))
{
return ModelComp;
}

return nullptr;
}

// UObject interface
void UCubismLipSyncComponent::PostLoad()
{
Super::PostLoad();

const ACubismModel* Owner = Cast<ACubismModel>(GetOwner());
const TObjectPtr<UCubismModelComponent> ModelComp = GetModel();

Setup(Owner->Model);
if (ModelComp)
{
Setup(ModelComp);
}
}

#if WITH_EDITOR
Expand Down Expand Up @@ -199,9 +212,12 @@ void UCubismLipSyncComponent::OnComponentCreated()
{
Super::OnComponentCreated();

const ACubismModel* Owner = Cast<ACubismModel>(GetOwner());
const TObjectPtr<UCubismModelComponent> ModelComp = GetModel();

Setup(Owner->Model);
if (ModelComp)
{
Setup(ModelComp);
}
}

void UCubismLipSyncComponent::OnComponentDestroyed(bool bDestroyingHierarchy)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,27 @@ void UCubismLookAtComponent::Setup(UCubismModelComponent* InModel)
Model->AddTickPrerequisiteComponent(this); // model ticks after parameters are updated by components
}

TObjectPtr<UCubismModelComponent> UCubismLookAtComponent::GetModel()
{
if (TObjectPtr<UCubismModelComponent> ModelComp = Cast<UCubismModelComponent>(GetOwner()->FindComponentByClass<UCubismModelComponent>()))
{
return ModelComp;
}

return nullptr;
}

// UObject interface
void UCubismLookAtComponent::PostLoad()
{
Super::PostLoad();

const ACubismModel* Owner = Cast<ACubismModel>(GetOwner());
const TObjectPtr<UCubismModelComponent> ModelComp = GetModel();

Setup(Owner->Model);
if (ModelComp)
{
Setup(ModelComp);
}
}
// End of UObject interface

Expand All @@ -60,9 +73,12 @@ void UCubismLookAtComponent::OnComponentCreated()
{
Super::OnComponentCreated();

const ACubismModel* Owner = Cast<ACubismModel>(GetOwner());
const TObjectPtr<UCubismModelComponent> ModelComp = GetModel();

Setup(Owner->Model);
if (ModelComp)
{
Setup(ModelComp);
}
}

void UCubismLookAtComponent::TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -224,14 +224,27 @@ bool UCubismRaycastComponent::RayIntersectTriangle
return true;
}

TObjectPtr<UCubismModelComponent> UCubismRaycastComponent::GetModel()
{
if (TObjectPtr<UCubismModelComponent> ModelComp = Cast<UCubismModelComponent>(GetOwner()->FindComponentByClass<UCubismModelComponent>()))
{
return ModelComp;
}

return nullptr;
}

// UObject interface
void UCubismRaycastComponent::PostLoad()
{
Super::PostLoad();

const ACubismModel* Owner = Cast<ACubismModel>(GetOwner());
const TObjectPtr<UCubismModelComponent> ModelComp = GetModel();

Setup(Owner->Model);
if (ModelComp)
{
Setup(ModelComp);
}
}
// End of UObject interface

Expand All @@ -240,8 +253,11 @@ void UCubismRaycastComponent::OnComponentCreated()
{
Super::OnComponentCreated();

const ACubismModel* Owner = Cast<ACubismModel>(GetOwner());
const TObjectPtr<UCubismModelComponent> ModelComp = GetModel();

Setup(Owner->Model);
if (ModelComp)
{
Setup(ModelComp);
}
}
// End of UActorComponent interface
Original file line number Diff line number Diff line change
Expand Up @@ -82,14 +82,28 @@ void UCubismExpressionComponent::StopAllExpressions(const bool bForce)
}
}

TObjectPtr<UCubismModelComponent> UCubismExpressionComponent::GetModel()
{
if (TObjectPtr<UCubismModelComponent> ModelComp = Cast<UCubismModelComponent>(GetOwner()->FindComponentByClass<UCubismModelComponent>()))
{
return ModelComp;
}

return nullptr;
}


// UObject interface
void UCubismExpressionComponent::PostLoad()
{
Super::PostLoad();

const ACubismModel* Owner = Cast<ACubismModel>(GetOwner());
const TObjectPtr<UCubismModelComponent> ModelComp = GetModel();

Setup(Owner->Model);
if (ModelComp)
{
Setup(ModelComp);
}
}

#if WITH_EDITOR
Expand Down Expand Up @@ -119,9 +133,12 @@ void UCubismExpressionComponent::OnComponentCreated()
{
Super::OnComponentCreated();

const ACubismModel* Owner = Cast<ACubismModel>(GetOwner());
const TObjectPtr<UCubismModelComponent> ModelComp = GetModel();

Setup(Owner->Model);
if (ModelComp)
{
Setup(ModelComp);
}
}

void UCubismExpressionComponent::TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,14 +187,27 @@ int32 UCubismDrawableComponent::GetDrawableMaskCount() const
return Model->GetDrawableMaskCount(Index);
}

TObjectPtr<UCubismModelComponent> UCubismDrawableComponent::GetModel()
{
if (TObjectPtr<UCubismModelComponent> ModelComp = Cast<UCubismModelComponent>(GetOwner()->FindComponentByClass<UCubismModelComponent>()))
{
return ModelComp;
}

return nullptr;
}

// UObject interface
void UCubismDrawableComponent::PostLoad()
{
Super::PostLoad();

const ACubismModel* Owner = Cast<ACubismModel>(GetOwner());
const TObjectPtr<UCubismModelComponent> ModelComp = GetModel();

Setup(Owner->Model);
if (ModelComp)
{
Setup(ModelComp);
}
}

#if WITH_EDITOR
Expand Down Expand Up @@ -269,9 +282,12 @@ void UCubismDrawableComponent::OnComponentCreated()
{
Super::OnComponentCreated();

const ACubismModel* Owner = Cast<ACubismModel>(GetOwner());
const TObjectPtr<UCubismModelComponent> ModelComp = GetModel();

Setup(Owner->Model);
if (ModelComp)
{
Setup(ModelComp);
}
}

void UCubismDrawableComponent::SendRenderDynamicData_Concurrent()
Expand Down
Loading