当前位置: 首页>>代码示例>>C++>>正文


C++ TObjectIterator::InvalidateLightingCache方法代码示例

本文整理汇总了C++中TObjectIterator::InvalidateLightingCache方法的典型用法代码示例。如果您正苦于以下问题:C++ TObjectIterator::InvalidateLightingCache方法的具体用法?C++ TObjectIterator::InvalidateLightingCache怎么用?C++ TObjectIterator::InvalidateLightingCache使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TObjectIterator的用法示例。


在下文中一共展示了TObjectIterator::InvalidateLightingCache方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Build

void UStaticMesh::Build(bool bSilent)
{
#if WITH_EDITOR
	if (IsTemplate())
		return;

	if (SourceModels.Num() <= 0)
	{
		UE_LOG(LogStaticMesh,Warning,TEXT("Static mesh has no source models: %s"),*GetPathName());
		return;
	}

	if(!bSilent)
	{
		FFormatNamedArguments Args;
		Args.Add( TEXT("Path"), FText::FromString( GetPathName() ) );
		const FText StatusUpdate = FText::Format( LOCTEXT("BeginStaticMeshBuildingTask", "({Path}) Building"), Args );
		GWarn->BeginSlowTask( StatusUpdate, true );	
	}

	// Detach all instances of this static mesh from the scene.
	FStaticMeshComponentRecreateRenderStateContext RecreateRenderStateContext(this,false);

	// Release the static mesh's resources.
	ReleaseResources();

	// Flush the resource release commands to the rendering thread to ensure that the build doesn't occur while a resource is still
	// allocated, and potentially accessing the UStaticMesh.
	ReleaseResourcesFence.Wait();

	// Remember the derived data key of our current render data if any.
	FString ExistingDerivedDataKey = RenderData ? RenderData->DerivedDataKey : TEXT("");

	// Free existing render data and recache.
	CacheDerivedData();

	// Reinitialize the static mesh's resources.
	InitResources();

	// Ensure we have a bodysetup.
	CreateBodySetup();
	check(BodySetup != NULL);

#if WITH_EDITOR
	if( SourceModels.Num() )
	{
		// Rescale simple collision if the user changed the mesh build scale
		BodySetup->RescaleSimpleCollision( SourceModels[0].BuildSettings.BuildScale3D );
	}

	// Invalidate physics data if this has changed.
	// TODO_STATICMESH: Not necessary any longer?
	BodySetup->InvalidatePhysicsData();
	BodySetup->CreatePhysicsMeshes();
#endif

	// Compare the derived data keys to see if renderable mesh data has actually changed.
	check(RenderData);
	bool bHasRenderDataChanged = RenderData->DerivedDataKey != ExistingDerivedDataKey;

	if (bHasRenderDataChanged)
	{
		// Warn the user if the new mesh has degenerate tangent bases.
		if (HasBadTangents(this))
		{
			// Only suggest Recompute Tangents if the import hasn't already tried it
			FFormatNamedArguments Arguments;
			Arguments.Add( TEXT("Meshname"), FText::FromString(GetName()) );
			Arguments.Add( TEXT("Options"), SourceModels[0].BuildSettings.bRecomputeTangents ? FText::GetEmpty() : LOCTEXT("MeshRecomputeTangents", "Consider enabling Recompute Tangents in the mesh's Build Settings.") );
			const FText WarningMsg = FText::Format( LOCTEXT("MeshHasDegenerateTangents", "{Meshname} has degenerate tangent bases which will result in incorrect shading. {Options}"), Arguments );
			UE_LOG(LogStaticMesh,Warning,TEXT("%s"),*WarningMsg.ToString());
			if (!bSilent)
			{
				FMessageDialog::Open(EAppMsgType::Ok, WarningMsg);
			}
		}

		// Force the static mesh to re-export next time lighting is built
		SetLightingGuid();

		// Find any static mesh components that use this mesh and fixup their override colors if necessary.
		// Also invalidate lighting. *** WARNING components may be reattached here! ***
		for( TObjectIterator<UStaticMeshComponent> It; It; ++It )
		{
			if ( It->StaticMesh == this )
			{
				It->FixupOverrideColorsIfNecessary( true );
				It->InvalidateLightingCache();
			}
		}

	}

	if(!bSilent)
	{
		GWarn->EndSlowTask();
	}
	
#else
	UE_LOG(LogStaticMesh,Fatal,TEXT("UStaticMesh::Build should not be called on non-editor builds."));
//.........这里部分代码省略.........
开发者ID:1vanK,项目名称:AHRUnrealEngine,代码行数:101,代码来源:StaticMeshBuild.cpp


注:本文中的TObjectIterator::InvalidateLightingCache方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。