本文整理汇总了C++中USceneComponent::GetSocketTransform方法的典型用法代码示例。如果您正苦于以下问题:C++ USceneComponent::GetSocketTransform方法的具体用法?C++ USceneComponent::GetSocketTransform怎么用?C++ USceneComponent::GetSocketTransform使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类USceneComponent
的用法示例。
在下文中一共展示了USceneComponent::GetSocketTransform方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AdjustComponentDelta
void FComponentEditorUtils::AdjustComponentDelta(USceneComponent* Component, FVector& Drag, FRotator& Rotation)
{
USceneComponent* ParentSceneComp = Component->GetAttachParent();
if (ParentSceneComp)
{
const FTransform ParentToWorldSpace = ParentSceneComp->GetSocketTransform(Component->AttachSocketName);
if (!Component->bAbsoluteLocation)
{
Drag = ParentToWorldSpace.Inverse().TransformVector(Drag);
}
if (!Component->bAbsoluteRotation)
{
Rotation = ( ParentToWorldSpace.Inverse().GetRotation() * Rotation.Quaternion() * ParentToWorldSpace.GetRotation() ).Rotator();
}
}
}
示例2: AdjustComponentDelta
void FComponentEditorUtils::AdjustComponentDelta(USceneComponent* Component, FVector& Drag, FRotator& Rotation)
{
USceneComponent* ParentSceneComp = Component->GetAttachParent();
if (ParentSceneComp)
{
const FTransform ParentToWorldSpace = ParentSceneComp->GetSocketTransform(Component->AttachSocketName);
if (!Component->bAbsoluteLocation)
{
//transform the drag vector in relative to the parent transform
Drag = ParentToWorldSpace.InverseTransformVectorNoScale(Drag);
//Now that we have a global drag we can apply the parent scale
Drag = Drag * ParentToWorldSpace.Inverse().GetScale3D();
}
if (!Component->bAbsoluteRotation)
{
Rotation = ( ParentToWorldSpace.Inverse().GetRotation() * Rotation.Quaternion() * ParentToWorldSpace.GetRotation() ).Rotator();
}
}
}
示例3: InputWidgetDelta
bool FSCSEditorViewportClient::InputWidgetDelta( FViewport* Viewport, EAxisList::Type CurrentAxis, FVector& Drag, FRotator& Rot, FVector& Scale )
{
bool bHandled = false;
if(bIsManipulating && CurrentAxis != EAxisList::None)
{
bHandled = true;
AActor* PreviewActor = GetPreviewActor();
if(PreviewActor)
{
TArray<FSCSEditorTreeNodePtrType> SelectedNodes = BlueprintEditorPtr.Pin()->GetSelectedSCSEditorTreeNodes();
if(SelectedNodes.Num() > 0)
{
FVector ModifiedScale = Scale;
if( GEditor->UsePercentageBasedScaling() )
{
ModifiedScale = Scale * ((GEditor->GetScaleGridSize() / 100.0f) / GEditor->GetGridSize());
}
TSet<USceneComponent*> UpdatedComponents;
for(auto It(SelectedNodes.CreateIterator());It;++It)
{
FSCSEditorTreeNodePtrType SelectedNodePtr = *It;
// Don't allow editing of a root node, inherited SCS node or child node that also has a movable (non-root) parent node selected
const bool bCanEdit = !SelectedNodePtr->IsRoot() && !SelectedNodePtr->IsInherited()
&& !IsMovableParentNodeSelected(SelectedNodePtr, SelectedNodes);
if(bCanEdit)
{
USceneComponent* SceneComp = Cast<USceneComponent>(SelectedNodePtr->FindComponentInstanceInActor(PreviewActor, true));
USceneComponent* SelectedTemplate = Cast<USceneComponent>(SelectedNodePtr->GetComponentTemplate());
if(SceneComp != NULL && SelectedTemplate != NULL)
{
// Cache the current default values for propagation
FVector OldRelativeLocation = SelectedTemplate->RelativeLocation;
FRotator OldRelativeRotation = SelectedTemplate->RelativeRotation;
FVector OldRelativeScale3D = SelectedTemplate->RelativeScale3D;
USceneComponent* ParentSceneComp = SceneComp->GetAttachParent();
if( ParentSceneComp )
{
const FTransform ParentToWorldSpace = ParentSceneComp->GetSocketTransform(SceneComp->AttachSocketName);
if(!SceneComp->bAbsoluteLocation)
{
Drag = ParentToWorldSpace.Inverse().TransformVector(Drag);
}
if(!SceneComp->bAbsoluteRotation)
{
Rot = (ParentToWorldSpace.Inverse().GetRotation() * Rot.Quaternion() * ParentToWorldSpace.GetRotation()).Rotator();
}
}
FComponentEditorUtils::FTransformData OldDefaultTransform(*SelectedTemplate);
TSharedPtr<ISCSEditorCustomization> Customization = BlueprintEditorPtr.Pin()->CustomizeSCSEditor(SceneComp);
if(Customization.IsValid() && Customization->HandleViewportDrag(SceneComp, SelectedTemplate, Drag, Rot, ModifiedScale, GetWidgetLocation()))
{
UpdatedComponents.Add(SceneComp);
UpdatedComponents.Add(SelectedTemplate);
}
else
{
// Apply delta to the preview actor's scene component
GEditor->ApplyDeltaToComponent(
SceneComp,
true,
&Drag,
&Rot,
&ModifiedScale,
SceneComp->RelativeLocation );
UpdatedComponents.Add(SceneComp);
// Apply delta to the template component object
GEditor->ApplyDeltaToComponent(
SelectedTemplate,
true,
&Drag,
&Rot,
&ModifiedScale,
SelectedTemplate->RelativeLocation );
UpdatedComponents.Add(SelectedTemplate);
}
FComponentEditorUtils::FTransformData NewDefaultTransform(*SelectedTemplate);
if (SelectedNodePtr->IsNative())
{
if (ensure(SelectedTemplate->HasAnyFlags(RF_DefaultSubObject)))
{
FComponentEditorUtils::PropagateTransformPropertyChange(SelectedTemplate, OldDefaultTransform, NewDefaultTransform, UpdatedComponents);
}
}
if(PreviewBlueprint != NULL)
{
// Like PostEditMove(), but we only need to re-run construction scripts
if(PreviewBlueprint && PreviewBlueprint->bRunConstructionScriptOnDrag)
{
//.........这里部分代码省略.........