void UNavCollision::PostLoad()
{
	Super::PostLoad();

	// Our owner needs to be post-loaded before us else they may not have loaded
	// their data yet.
	UObject* Outer = GetOuter();
	if (Outer)
	{
		Outer->ConditionalPostLoad();

		UStaticMesh* StaticMeshOuter = Cast<UStaticMesh>(Outer);
		if (StaticMeshOuter != NULL)
		{
			Setup(StaticMeshOuter->BodySetup);
		}
	}
}
//! @brief Apply this preset to a graph instance
//! @param graph The target graph instance to apply this preset
//! @param mode Reset to default other inputs of merge w/ previous values
//! @return Return true whether at least one input value is applied
bool FPreset::Apply(graph_inst_t* Instance, FPreset::ApplyMode mode) const
{
	bool AtLeastOneSet = false;
	graph_desc_t* Desc = Instance->Desc;
	
	for(int32 Idx = 0 ; Idx < mInputValues.Num() ; ++Idx)
	{
		const FInputValue& inp_value = mInputValues[Idx];

		// lookup by Input UID
		TSharedPtr<input_inst_t> inp_found =
			FindInput(Instance->Inputs, inp_value.mUid);

		// or by input identifier if no match was found
		if (!inp_found.Get())
		{
			inp_found =
				FindInput(Instance->Inputs, inp_value.mUid);
		}

		if (inp_found.Get() &&
		    inp_found->Type == inp_value.mType)
		{
			// Process only numerical (additional check)
			if (inp_found->IsNumerical())
			{
				TArray<FString> StrValueArray;
				inp_value.mValue.ParseIntoArray(StrValueArray,TEXT(","), true);

				TArray<float> ValueArray;

				for (TArray<FString>::TIterator ItV(StrValueArray); ItV; ++ItV)
				{
					ValueArray.Add(FCString::Atof(*(*	ItV)));
				}

				Instance->UpdateInput(inp_found->Uid, ValueArray);
				AtLeastOneSet = true;
			}
			else
			{
				if (inp_value.mValue != FString(TEXT("NULL")))
				{
					UObject* Object = FindObject<UTexture2D>(NULL, *inp_value.mValue);
					if (!Object)
					{
						Object = FindObject<USubstanceImageInput>(NULL, *inp_value.mValue);
					}

					if (Object)
					{
						Object->ConditionalPostLoad();
						Instance->UpdateInput(inp_found->Uid, Object);
					}
					/*else
					{
						debugf(
							TEXT("Unable to restore graph instance image input, object not found: %s"),
							*inp_value.mValue);
					}*/
				}
				else
				{
					Instance->UpdateInput(inp_found->Uid, NULL);
				}
			}
		}
	}

	if (AtLeastOneSet)
	{
		Instance->ParentInstance->MarkPackageDirty();
	}
	
	return AtLeastOneSet;
}
Exemple #3
0
void UBodySetup::PostLoad()
{
	Super::PostLoad();

	// Our owner needs to be post-loaded before us else they may not have loaded
	// their data yet.
	UObject* Outer = GetOuter();
	if (Outer)
	{
		Outer->ConditionalPostLoad();
	}

	if ( GetLinkerUE4Version() < VER_UE4_BUILD_SCALE_VECTOR )
	{
		BuildScale3D = FVector( BuildScale_DEPRECATED );
	}

	DefaultInstance.FixupData(this);

	if ( GetLinkerUE4Version() < VER_UE4_REFACTOR_PHYSICS_BLENDING )
	{
		if ( bAlwaysFullAnimWeight_DEPRECATED )
		{
			PhysicsType = PhysType_Simulated;
		}
		else if ( DefaultInstance.bSimulatePhysics == false )
		{
			PhysicsType = PhysType_Kinematic;
		}
		else
		{
			PhysicsType = PhysType_Default;
		}
	}

	if ( GetLinkerUE4Version() < VER_UE4_BODYSETUP_COLLISION_CONVERSION )
	{
		if ( DefaultInstance.GetCollisionEnabled() == ECollisionEnabled::NoCollision )
		{
			CollisionReponse = EBodyCollisionResponse::BodyCollision_Disabled;
		}
	}

	// Compress to whatever formats the active target platforms want
	ITargetPlatformManagerModule* TPM = GetTargetPlatformManager();
	if (TPM)
	{
		const TArray<ITargetPlatform*>& Platforms = TPM->GetActiveTargetPlatforms();

		for (int32 Index = 0; Index < Platforms.Num(); Index++)
		{
			GetCookedData(Platforms[Index]->GetPhysicsFormat(this));
		}
	}

	// make sure that we load the physX data while the linker's loader is still open
	CreatePhysicsMeshes();

	// fix up invalid transform to use identity
	// this can be here because BodySetup isn't blueprintable
	if ( GetLinkerUE4Version() < VER_UE4_FIXUP_BODYSETUP_INVALID_CONVEX_TRANSFORM )
	{
		for (int32 i=0; i<AggGeom.ConvexElems.Num(); ++i)
		{
			if ( AggGeom.ConvexElems[i].GetTransform().IsValid() == false )
			{
				AggGeom.ConvexElems[i].SetTransform(FTransform::Identity);
			}
		}
	}
}