• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ MakeShareable函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中MakeShareable函数的典型用法代码示例。如果您正苦于以下问题:C++ MakeShareable函数的具体用法?C++ MakeShareable怎么用?C++ MakeShareable使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: MakeShareable

TSharedRef< FSlateTextHighlightRunRenderer > FSlateTextHighlightRunRenderer::Create()
{
	return MakeShareable( new FSlateTextHighlightRunRenderer() );
}
开发者ID:WasPedro,项目名称:UnrealEngine4.11-HairWorks,代码行数:4,代码来源:SlateTextHighlightRunRenderer.cpp


示例2: FinalizeNodesRecursively


//.........这里部分代码省略.........
	else if( Node->Parent == nullptr )
	{
		// Tree root is always auto-sized
		Node->Size = 0.0f;
	}
	else
	{
		const FNodeSizeMapData& NodeSizeMapData = NodeSizeMapDataMap.FindChecked( Node.ToSharedRef() );

		++TotalAssetCount;
		TotalSize += NodeSizeMapData.AssetSize;

		if( !NodeSizeMapData.bHasKnownSize )
		{
			bAnyUnknownSizes = true;
		}

		// Setup a thumbnail
		const FSlateBrush* DefaultThumbnailSlateBrush;
		{
			// For non-class types, use the default based upon the actual asset class
			// This has the side effect of not showing a class icon for assets that don't have a proper thumbnail image available
			bool bIsClassType = false;
			const UClass* ThumbnailClass = FClassIconFinder::GetIconClassForAssetData( NodeSizeMapData.AssetData, &bIsClassType );
			const FName DefaultThumbnail = (bIsClassType) ? NAME_None : FName(*FString::Printf(TEXT("ClassThumbnail.%s"), *NodeSizeMapData.AssetData.AssetClass.ToString()));							
			DefaultThumbnailSlateBrush = FClassIconFinder::FindThumbnailForClass(ThumbnailClass, DefaultThumbnail);

			// @todo sizemap urgent: Actually implement rendered thumbnail support, not just class-based background images

			// const int32 ThumbnailSize = 128;	// @todo sizemap: Hard-coded thumbnail size.  Move this elsewhere
			//	TSharedRef<FAssetThumbnail> AssetThumbnail( new FAssetThumbnail( NodeSizeMapData.AssetData, ThumbnailSize, ThumbnailSize, AssetThumbnailPool ) );
			//	ChildTreeMapNode->AssetThumbnail = AssetThumbnail->MakeThumbnailImage();
		}

		if( Node->IsLeafNode() )
		{
			Node->CenterText = SizeMapInternals::MakeBestSizeString( NodeSizeMapData.AssetSize, NodeSizeMapData.bHasKnownSize );

			Node->Size = NodeSizeMapData.AssetSize;

			// The STreeMap widget is not expecting zero-sized leaf nodes.  So we make them very small instead.
			if( Node->Size == 0 )
			{
				Node->Size = 1;
			}

			// Leaf nodes get a background picture
			Node->BackgroundBrush = DefaultThumbnailSlateBrush;

			// "Asset name"
			// "Asset type"
			Node->Name = NodeSizeMapData.AssetData.AssetName.ToString();
			Node->Name2 = NodeSizeMapData.AssetData.AssetClass.ToString();
		}
		else
		{
			// Container nodes are always auto-sized
			Node->Size = 0.0f;

			// "Asset name (asset type, size)"
			Node->Name = FString::Printf( TEXT( "%s  (%s, %s)" ),
				*NodeSizeMapData.AssetData.AssetName.ToString(),
				*NodeSizeMapData.AssetData.AssetClass.ToString(),
				*SizeMapInternals::MakeBestSizeString( SubtreeSize + NodeSizeMapData.AssetSize, !bAnyUnknownSizesInSubtree && NodeSizeMapData.bHasKnownSize ) );

			const bool bNeedsSelfNode = NodeSizeMapData.AssetSize > 0;
			if( bNeedsSelfNode )
			{
				// We have children, so make some space for our own asset's size within our box
				FTreeMapNodeDataRef ChildSelfTreeMapNode = MakeShareable( new FTreeMapNodeData() );
				Node->Children.Add( ChildSelfTreeMapNode );
				ChildSelfTreeMapNode->Parent = Node.Get();	// Keep back-pointer to parent node

				// Map the "self" node to the same node data as its parent
				NodeSizeMapDataMap.Add( ChildSelfTreeMapNode, NodeSizeMapData );

				// "*SELF*"
				// "Asset type"
				ChildSelfTreeMapNode->Name = LOCTEXT( "SelfNodeLabel", "*SELF*" ).ToString();
				ChildSelfTreeMapNode->Name2 = NodeSizeMapData.AssetData.AssetClass.ToString();

				ChildSelfTreeMapNode->CenterText = SizeMapInternals::MakeBestSizeString( NodeSizeMapData.AssetSize, NodeSizeMapData.bHasKnownSize );
				ChildSelfTreeMapNode->Size = NodeSizeMapData.AssetSize;

				// Leaf nodes get a background picture
				ChildSelfTreeMapNode->BackgroundBrush = DefaultThumbnailSlateBrush;
			}
		}

	}

	// Sort all of my child nodes alphabetically.  This is just so that we get deterministic results when viewing the
	// same sets of assets.
	Node->Children.StableSort(
			[]( const FTreeMapNodeDataPtr& A, const FTreeMapNodeDataPtr& B )
			{
				return A->Name < B->Name;
			}
		);
}
开发者ID:johndpope,项目名称:UE4,代码行数:101,代码来源:SSizeMap.cpp


示例3: sun

// Create Objects
void TestScene::SetupObjects()
{    
    spObject sun(new Object);
    sun->SetVO(MakeShareable(new PrimitiveUVSphere(256, 128)));
    sun->GetTransform().SetScale(Vector3(2.f, 2.f, 2.f));
    Texture sunTexture;
    LoadTexture(sunTexture, "textures/texture_sun.png");
    sun->GetVO()->GetTexture() = sunTexture;
    sun->SetGLMode(GL_TRIANGLES);
    sun->EnableTexture();
    sun->SetName(L"Sun");
    objects.push_back(sun);
    objectMap.insert(std::make_pair(sun->GetName(), sun));

    spObject world(new Object);
    world->SetVO(MakeShareable(new PrimitiveUVSphere(256, 128)));
    world->GetTransform().SetPosition(Vector3(5.f, 0.f, 0.f));
    Texture worldTexture;
    LoadTexture(worldTexture, "textures/4kworld.png");
    world->GetVO()->GetTexture() = worldTexture;
    world->SetGLMode(GL_TRIANGLES);
    world->EnableTexture();
    world->SetName(L"Earth");
    world->SetParent(sun.Get(), TransformInheritance(true, false, true, false));
    objects.push_back(world);
    objectMap.insert(std::make_pair(world->GetName(), world));


    spObject clouds(new Object);
    clouds->SetVO(MakeShareable(new PrimitiveUVSphere(256, 128)));
    clouds->GetTransform().SetScale(Vector3(1.01f, 1.01f, 1.01f));
    Texture cloudTexture;
    LoadTexture(cloudTexture, "textures/clouds.png");
    clouds->GetVO()->GetTexture() = cloudTexture;
    clouds->SetGLMode(GL_TRIANGLES);
    clouds->EnableTexture();
    clouds->EnableTransparency();
    clouds->SetName(L"Clouds");
    clouds->SetParent(world.Get(), TransformInheritance(true, false, true, false));
    objects.push_back(clouds);
    objectMap.insert(std::make_pair(clouds->GetName(), clouds));

    //spObject disc(new Object);
    //disc->SetVO(new PrimitiveDisc(64));
    //Texture discTexture;
    //LoadTexture(discTexture, "crate.png");
    //disc->GetVO()->GetTexture() = discTexture;
    //disc->SetGLMode(GL_TRIANGLE_FAN);
    //disc->GetTransform().SetPosition(Vector3(2.5f, 0.0f, 0.0f));
    //disc->EnableTexture();
    //disc->SetName(L"Disc");
    //objects.push_back(disc);

    spObject moon(new Object);
    moon->SetVO(MakeShareable(new PrimitiveUVSphere(256, 128)));
    moon->GetTransform().SetScale(Vector3(0.27f, 0.27f, 0.27f));
    moon->GetTransform().SetPosition(Vector3(0.f, 0.f, -2.2f));
    Texture moonTexture;
    LoadTexture(moonTexture, "textures/moonmap1k.png");
    moon->GetVO()->GetTexture() = moonTexture;
    moon->SetGLMode(GL_TRIANGLES);
    moon->EnableTexture();
    moon->SetName(L"Moon");
    moon->SetParent(world.Get(), TransformInheritance(true, false, true, false));
    objects.push_back(moon);
    objectMap.insert(std::make_pair(moon->GetName(), moon));

    spObject hst(new Object);
    hst->SetVO(MakeShareable(new Model));
    static_cast<Model*>(hst->GetVO().Get())->Load("models/hst.obj", "textures/hst.png");
    hst->GetTransform().SetScale(Vector3(0.0001f, 0.0001f, 0.0001f)); // This thing is yuge!
    hst->GetTransform().SetPosition(Vector3(-1.1f, 0.f, 0.f));
    hst->GetTransform().SetPreRotation(Rotation(0.f, Vector3(0.25f, 0.25f, -0.25f)));
    hst->GetTransform().SetRotation(Rotation(0.f, Vector3(-0.2f, 0.8f, -0.2f)));
    hst->SetGLMode(GL_TRIANGLES);
    hst->SetName(L"HST");
    hst->EnableTexture();
    hst->SetParent(world.Get(), TransformInheritance(true, false, true, false));
    objects.push_back(hst);
    objectMap.insert(std::make_pair(hst->GetName(), hst));

    spObject iss(new Object);
    iss->SetVO(MakeShareable(new Model));
    static_cast<Model*>(iss->GetVO().Get())->Load("models/iss.obj", "textures/iss.png");
    iss->GetTransform().SetScale(Vector3(0.01f, 0.01f, 0.01f));
    iss->GetTransform().SetPreRotation(Rotation(0.f, Vector3(0.f, 0.5f, 0.f)));
    iss->GetTransform().SetRotation(Rotation(0.f, Vector3(0.25f, 0.5f, 0.25f)));
    iss->GetTransform().SetPosition(Vector3(0.f, 0.f, 1.2f));
    iss->SetGLMode(GL_TRIANGLES);
    iss->SetName(L"ISS");
    iss->EnableTexture();
    iss->SetParent(world.Get(), TransformInheritance(true, false, true, false));
    objects.push_back(iss);
    objectMap.insert(std::make_pair(iss->GetName(), iss));

    spObject teapot(new Object);
    teapot->SetVO(MakeShareable(new Model));
    static_cast<Model*>(teapot->GetVO().Get())->Load("Models/teapot.obj", "textures/teapot.png");
    teapot->GetTransform().SetPosition(Vector3(5.f, 5.f, -3.f));
//.........这里部分代码省略.........
开发者ID:Markyparky56,项目名称:minidawn,代码行数:101,代码来源:TestScene.cpp


示例4: MakeShareable

TSharedPtr<IMovieSceneTrackInstance> UMovieSceneDirectorTrack::CreateInstance()
{
	return MakeShareable( new FMovieSceneDirectorTrackInstance( *this ) ); 
}
开发者ID:1vanK,项目名称:AHRUnrealEngine,代码行数:4,代码来源:MovieSceneDirectorTrack.cpp


示例5: GLevelEditorModeTools

bool FCreateLandscapeCommand::Update()
{
	//Switch to the Landscape tool
	GLevelEditorModeTools().ActivateMode(FBuiltinEditorModes::EM_Landscape);
	FEdModeLandscape* LandscapeEdMode = (FEdModeLandscape*)GLevelEditorModeTools().GetActiveMode(FBuiltinEditorModes::EM_Landscape);

	//Modify the "Section size"
	LandscapeEdMode->UISettings->NewLandscape_QuadsPerSection = 7;
	LandscapeEdMode->UISettings->NewLandscape_ClampSize();

	//Create the landscape
	TSharedPtr<FLandscapeEditorDetailCustomization_NewLandscape> Customization_NewLandscape = MakeShareable(new FLandscapeEditorDetailCustomization_NewLandscape);
	Customization_NewLandscape->OnCreateButtonClicked();

	if (LandscapeEdMode->CurrentToolTarget.LandscapeInfo.IsValid())
	{
		UE_LOG(LogLandscapeAutomationTests, Display, TEXT("Created a new landscape"));
	}
	else
	{
		UE_LOG(LogLandscapeAutomationTests, Error, TEXT("Failed to create a new landscape"));
	}

	return true;
}
开发者ID:1vanK,项目名称:AHRUnrealEngine,代码行数:25,代码来源:LandscapeAutomationTests.cpp


示例6: MakeShareable

TSharedRef<IStructCustomization> FMathStructCustomization::MakeInstance() 
{
	return MakeShareable( new FMathStructCustomization );
}
开发者ID:Tigrouzen,项目名称:UnrealEngine-4,代码行数:4,代码来源:MathStructCustomizations.cpp


示例7: MakeShareable

TSharedRef< FEdModeGeometry > FEdModeGeometry::Create()
{
	TSharedRef< FEdModeGeometry > GeometryMode = MakeShareable( new FEdModeGeometry() );
	return GeometryMode;
}
开发者ID:Tigrouzen,项目名称:UnrealEngine-4,代码行数:5,代码来源:GeometryEdMode.cpp


示例8: FString

void SBlueprintEditorSelectedDebugObjectWidget::GenerateDebugWorldNames(bool bRestoreSelection)
{
	TSharedPtr<FString> OldSelection;

	// Store off the old selection
	if (bRestoreSelection && DebugWorldsComboBox.IsValid())
	{
		OldSelection = DebugWorldsComboBox->GetSelectedItem();
	}

	DebugWorldNames.Empty();
	DebugWorlds.Empty();

	DebugWorlds.Add(NULL);
	DebugWorldNames.Add(MakeShareable(new FString(GetDebugAllWorldsString())));

	UWorld* PreviewWorld = NULL;
	TSharedPtr<SSCSEditorViewport> PreviewViewportPtr = BlueprintEditor.Pin()->GetSCSViewport();
	if (PreviewViewportPtr.IsValid())
	{
		PreviewWorld = PreviewViewportPtr->GetPreviewScene().GetWorld();
	}

	for (TObjectIterator<UWorld> It; It; ++It)
	{
		UWorld *TestWorld = *It;
		if (!TestWorld || TestWorld->WorldType != EWorldType::PIE)
		{
			continue;
		}

		DebugWorlds.Add(TestWorld);
		ENetMode NetMode = TestWorld->GetNetMode();

		FString WorldName;

		switch (NetMode)
		{
		case NM_Standalone:
			WorldName = NSLOCTEXT("BlueprintEditor", "DebugWorldStandalone", "Standalone").ToString();
			break;

		case NM_ListenServer:
			WorldName = NSLOCTEXT("BlueprintEditor", "DebugWorldListenServer", "Listen Server").ToString();
			break;

		case NM_DedicatedServer:
			WorldName = NSLOCTEXT("BlueprintEditor", "DebugWorldDedicatedServer", "Dedicated Server").ToString();
			break;

		case NM_Client:
			FWorldContext &PieContext = GEngine->WorldContextFromWorld(TestWorld);
			WorldName = FString::Printf(TEXT("%s %d"), *NSLOCTEXT("BlueprintEditor", "DebugWorldClient", "Client").ToString(), PieContext.PIEInstance - 1);
			break;
		};

		DebugWorldNames.Add(MakeShareable(new FString(WorldName)));
	}

	// Attempt to restore the old selection
	if (bRestoreSelection && DebugWorldsComboBox.IsValid())
	{
		bool bMatchFound = false;
		for (int32 WorldIdx = 0; WorldIdx < DebugWorldNames.Num(); ++WorldIdx)
		{
			if (*DebugWorldNames[WorldIdx] == *OldSelection)
			{
				DebugWorldsComboBox->SetSelectedItem(DebugWorldNames[WorldIdx]);
				bMatchFound = true;
				break;
			}
		}

		// No match found, use the default option
		if (!bMatchFound)
		{
			DebugWorldsComboBox->SetSelectedItem(DebugWorldNames[0]);
		}
	}


	// Finally ensure we have a valid selection
	if (DebugWorldsComboBox.IsValid())
	{
		TSharedPtr<FString> CurrentSelection = DebugWorldsComboBox->GetSelectedItem();
		if (DebugWorldNames.Find(CurrentSelection) == INDEX_NONE)
		{
			if (DebugWorldNames.Num() > 0)
			{
				DebugWorldsComboBox->SetSelectedItem(DebugWorldNames[0]);
			}
			else
			{
				DebugWorldsComboBox->ClearSelection();
			}
		}
	}
}
开发者ID:Tigrouzen,项目名称:UnrealEngine-4,代码行数:98,代码来源:SBlueprintEditorSelectedDebugObjectWidget.cpp


示例9: MakeShareable

TSharedRef<IDetailCustomization> FSpriteDetailsCustomization::MakeInstanceForSpriteEditor(TAttribute<ESpriteEditorMode::Type> InEditMode)
{
	return MakeShareable(new FSpriteDetailsCustomization(InEditMode));
}
开发者ID:AndyHuang7601,项目名称:EpicGames-UnrealEngine,代码行数:4,代码来源:SpriteDetailsCustomization.cpp


示例10: MakeShareable

void FPythonEditorStyle::Initialize()
{
	// Only register once
	if( StyleSet.IsValid() )
	{
		return;
	}

	StyleSet = MakeShareable(new FSlateStyleSet("PythonEditor") );

	StyleSet->SetContentRoot(IPluginManager::Get().FindPlugin("UnrealEnginePython")->GetBaseDir() / TEXT("Resources"));

	// Icons
	{
		StyleSet->Set("PythonEditor.TabIcon", new IMAGE_BRUSH("UI/PythonEditor_16x", Icon16x16));

		StyleSet->Set("PythonEditor.New", new IMAGE_BRUSH("UI/GenericFile", Icon40x40));
		StyleSet->Set("PythonEditor.NewDirectory", new IMAGE_BRUSH("UI/GenericFile", Icon40x40));
		StyleSet->Set("PythonEditor.New.Small", new IMAGE_BRUSH("UI/GenericFile", Icon16x16));
		StyleSet->Set("PythonEditor.Delete", new IMAGE_BRUSH("UI/DeleteFile", Icon40x40));
		StyleSet->Set("PythonEditor.Delete.Small", new IMAGE_BRUSH("UI/DeleteFile", Icon16x16));

		StyleSet->Set("PythonEditor.Save", new IMAGE_BRUSH("UI/Save_40x", Icon40x40));
		StyleSet->Set("PythonEditor.Save.Small", new IMAGE_BRUSH("UI/Save_40x", Icon16x16));
		StyleSet->Set("PythonEditor.SaveAll", new IMAGE_BRUSH("UI/SaveAll_40x", Icon40x40));
		StyleSet->Set("PythonEditor.SaveAll.Small", new IMAGE_BRUSH("UI/SaveAll_40x", Icon16x16));
		StyleSet->Set("PythonEditor.Execute", new IMAGE_BRUSH("UI/Excute_x40", Icon40x40));
		StyleSet->Set("PythonEditor.Execute.Small", new IMAGE_BRUSH("UI/Excute_x40", Icon16x16));
		StyleSet->Set("PythonEditor.ExecuteInSandbox", new IMAGE_BRUSH("UI/Excute_x40", Icon40x40));
		StyleSet->Set("PythonEditor.ExecuteInSandbox.Small", new IMAGE_BRUSH("UI/Excute_x40", Icon16x16));
		StyleSet->Set("PythonEditor.PEP8ize", new IMAGE_BRUSH("UI/Excute_x40", Icon40x40));
		StyleSet->Set("PythonEditor.PEP8ize.Small", new IMAGE_BRUSH("UI/Excute_x40", Icon16x16));
	}

	const FSlateFontInfo Consolas10  = TTF_FONT("Font/DroidSansMono", 9);

	const FTextBlockStyle NormalText = FTextBlockStyle()
		.SetFont(Consolas10)
		.SetColorAndOpacity(FLinearColor::White)
		.SetShadowOffset(FVector2D::ZeroVector)
		.SetShadowColorAndOpacity(FLinearColor::Black)
		.SetHighlightColor(FLinearColor(0.02f, 0.3f, 0.0f))
		.SetHighlightShape(BOX_BRUSH("UI/TextBlockHighlightShape", FMargin(3.f / 8.f)));

	// Text editor
	{
		StyleSet->Set("TextEditor.NormalText", NormalText);

		StyleSet->Set("SyntaxHighlight.PY.Normal", FTextBlockStyle(NormalText).SetColorAndOpacity(FLinearColor(FColor(0xffffffff))));// yellow
		StyleSet->Set("SyntaxHighlight.PY.Operator", FTextBlockStyle(NormalText).SetColorAndOpacity(FLinearColor(FColor(0xfff92672)))); // light grey
		StyleSet->Set("SyntaxHighlight.PY.Keyword", FTextBlockStyle(NormalText).SetColorAndOpacity(FLinearColor(FColor(0xfff92672)))); // blue
		StyleSet->Set("SyntaxHighlight.PY.String", FTextBlockStyle(NormalText).SetColorAndOpacity(FLinearColor(FColor(0xffe6db74)))); // pinkish
		StyleSet->Set("SyntaxHighlight.PY.Number", FTextBlockStyle(NormalText).SetColorAndOpacity(FLinearColor(FColor(0xffae81dd)))); // cyan
		StyleSet->Set("SyntaxHighlight.PY.Comment", FTextBlockStyle(NormalText).SetColorAndOpacity(FLinearColor(FColor(0xff75715e)))); // green
		StyleSet->Set("SyntaxHighlight.PY.BuiltIn", FTextBlockStyle(NormalText).SetColorAndOpacity(FLinearColor(FColor(0xff52d9ef)))); // light grey
		StyleSet->Set("SyntaxHighlight.PY.Define", FTextBlockStyle(NormalText).SetColorAndOpacity(FLinearColor(FColor(0xffa6e22a)))); // light grey


		StyleSet->Set("TextEditor.Border", new BOX_BRUSH("UI/TextEditorBorder", FMargin(4.0f/16.0f), FLinearColor(0.02f,0.02f,0.02f,1)));

		const FEditableTextBoxStyle EditableTextBoxStyle = FEditableTextBoxStyle()
			.SetBackgroundImageNormal( FSlateNoResource() )
			.SetBackgroundImageHovered( FSlateNoResource() )
			.SetBackgroundImageFocused( FSlateNoResource() )
			.SetBackgroundImageReadOnly( FSlateNoResource() );
		
		StyleSet->Set("TextEditor.EditableTextBox", EditableTextBoxStyle);
	}

	// Project editor
	{
		StyleSet->Set("ProjectEditor.Border", new BOX_BRUSH("UI/TextEditorBorder", FMargin(4.0f/16.0f), FLinearColor(0.048f,0.048f,0.048f,1)));

		StyleSet->Set("ProjectEditor.Icon.Project", new IMAGE_BRUSH("UI/FolderClosed", Icon16x16, FLinearColor(0.25f,0.25f,0.25f,1)));
		StyleSet->Set("ProjectEditor.Icon.Folder", new IMAGE_BRUSH("UI/FolderClosed", Icon16x16, FLinearColor(0.25f,0.25f,0.25f,1)));
		StyleSet->Set("ProjectEditor.Icon.File", new IMAGE_BRUSH("UI/PythonEditor_16x", Icon16x16));
		StyleSet->Set("ProjectEditor.Icon.GenericFile", new IMAGE_BRUSH("UI/GenericFile", Icon16x16));
	}

	FSlateStyleRegistry::RegisterSlateStyle( *StyleSet.Get() );
}
开发者ID:rdsgautier,项目名称:UnrealEnginePython,代码行数:81,代码来源:PythonEditorStyle.cpp


示例11: SNew

void FSpriteDetailsCustomization::BuildCollisionSection(IDetailCategoryBuilder& CollisionCategory, IDetailLayoutBuilder& DetailLayout)
{
	TSharedPtr<IPropertyHandle> SpriteCollisionDomainProperty = DetailLayout.GetProperty(GET_MEMBER_NAME_CHECKED(UPaperSprite, SpriteCollisionDomain));

	CollisionCategory.HeaderContent
	(
		SNew(SBox)
		.HAlign(HAlign_Right)
		[
			SNew(SHorizontalBox)
			+SHorizontalBox::Slot()
			.Padding(FMargin(5.0f, 0.0f))
			.AutoWidth()
			[
				SNew(STextBlock)
				.Font(FEditorStyle::GetFontStyle("TinyText"))
				.Text(this, &FSpriteDetailsCustomization::GetCollisionHeaderContentText, SpriteCollisionDomainProperty)
			]
		]
	);

	TAttribute<EVisibility> ParticipatesInPhysics = TAttribute<EVisibility>::Create(TAttribute<EVisibility>::FGetter::CreateSP( this, &FSpriteDetailsCustomization::AnyPhysicsMode, SpriteCollisionDomainProperty));
	TAttribute<EVisibility> ParticipatesInPhysics3D = TAttribute<EVisibility>::Create(TAttribute<EVisibility>::FGetter::CreateSP(this, &FSpriteDetailsCustomization::PhysicsModeMatches, SpriteCollisionDomainProperty, ESpriteCollisionMode::Use3DPhysics));
	TAttribute<EVisibility> HideWhenInRenderingMode = TAttribute<EVisibility>::Create(TAttribute<EVisibility>::FGetter::CreateSP(this, &FSpriteDetailsCustomization::EditorModeIsNot, ESpriteEditorMode::EditRenderingGeomMode));
	TAttribute<EVisibility> ShowWhenInRenderingMode = TAttribute<EVisibility>::Create(TAttribute<EVisibility>::FGetter::CreateSP(this, &FSpriteDetailsCustomization::EditorModeMatches, ESpriteEditorMode::EditRenderingGeomMode));

	static const FText EditCollisionInCollisionMode = LOCTEXT("CollisionPropertiesHiddenInRenderingMode", "Switch to 'Edit Collsion' mode\nto edit Collision settings");
	CollisionCategory.AddCustomRow(EditCollisionInCollisionMode)
		.Visibility(ShowWhenInRenderingMode)
		.WholeRowContent()
		.HAlign(HAlign_Center)
		[
			SNew(STextBlock)
			.Font(DetailLayout.GetDetailFontItalic())
			.Justification(ETextJustify::Center)
			.Text(EditCollisionInCollisionMode)
		];

	CollisionCategory.AddProperty(SpriteCollisionDomainProperty).Visibility(HideWhenInRenderingMode);

	// Add the collision geometry mode into the parent container (renamed)
	{
		// Restrict the diced value
		TSharedPtr<FPropertyRestriction> PreventDicedRestriction = MakeShareable(new FPropertyRestriction(LOCTEXT("CollisionGeometryDoesNotSupportDiced", "Collision geometry can not be set to Diced")));
		const UEnum* const SpritePolygonModeEnum = FindObject<UEnum>(ANY_PACKAGE, TEXT("ESpritePolygonMode"));		
		PreventDicedRestriction->AddDisabledValue(SpritePolygonModeEnum->GetNameStringByValue((uint8)ESpritePolygonMode::Diced));

		// Find and add the property
		const FString CollisionGeometryTypePropertyPath = FString::Printf(TEXT("%s.%s"), GET_MEMBER_NAME_STRING_CHECKED(UPaperSprite, CollisionGeometry), GET_MEMBER_NAME_STRING_CHECKED(FSpriteGeometryCollection, GeometryType));
		TSharedPtr<IPropertyHandle> CollisionGeometryTypeProperty = DetailLayout.GetProperty(*CollisionGeometryTypePropertyPath);

		CollisionGeometryTypeProperty->AddRestriction(PreventDicedRestriction.ToSharedRef());

		CollisionCategory.AddProperty(CollisionGeometryTypeProperty)
			.DisplayName(LOCTEXT("CollisionGeometryType", "Collision Geometry Type"))
			.Visibility(ParticipatesInPhysics);
	}

	// Show the collision thickness only in 3D mode
	CollisionCategory.AddProperty( DetailLayout.GetProperty(GET_MEMBER_NAME_CHECKED(UPaperSprite, CollisionThickness)) )
		.Visibility(ParticipatesInPhysics3D);

	// Show the default body instance (and only it) from the body setup (if it exists)
	DetailLayout.HideProperty("BodySetup");
	IDetailPropertyRow& BodySetupDefaultInstance = CollisionCategory.AddProperty("BodySetup.DefaultInstance");
	
	TArray<TWeakObjectPtr<UObject>> SpritesBeingEdited;
	DetailLayout.GetObjectsBeingCustomized(/*out*/ SpritesBeingEdited);

	TArray<UObject*> BodySetupList;
	for (auto WeakSpritePtr : SpritesBeingEdited)
	{
		if (UPaperSprite* Sprite = Cast<UPaperSprite>(WeakSpritePtr.Get()))
		{
			if (UBodySetup* BodySetup = Sprite->BodySetup)
			{
				BodySetupList.Add(BodySetup);
			}
		}
	}
	
	if (BodySetupList.Num() > 0)
	{
		IDetailPropertyRow* DefaultInstanceRow = CollisionCategory.AddExternalObjectProperty(BodySetupList, GET_MEMBER_NAME_CHECKED(UBodySetup, DefaultInstance));
		if (DefaultInstanceRow != nullptr)
		{
			DefaultInstanceRow->Visibility(ParticipatesInPhysics);
		}
	}

	// Show the collision geometry when not None
	CollisionCategory.AddProperty(DetailLayout.GetProperty(GET_MEMBER_NAME_CHECKED(UPaperSprite, CollisionGeometry)))
		.Visibility(ParticipatesInPhysics);

	// Add the collision polygons into advanced (renamed)
	const FString CollisionGeometryPolygonsPropertyPath = FString::Printf(TEXT("%s.%s"), GET_MEMBER_NAME_STRING_CHECKED(UPaperSprite, CollisionGeometry), GET_MEMBER_NAME_STRING_CHECKED(FSpriteGeometryCollection, Shapes));
	CollisionCategory.AddProperty(DetailLayout.GetProperty(*CollisionGeometryPolygonsPropertyPath), EPropertyLocation::Advanced)
		.DisplayName(LOCTEXT("CollisionShapes", "Collision Shapes"))
		.Visibility(ParticipatesInPhysics);
}
开发者ID:AndyHuang7601,项目名称:EpicGames-UnrealEngine,代码行数:100,代码来源:SpriteDetailsCustomization.cpp


示例12: FString

void UMediaPlayer::InitializePlayer()
{
	if (URL != CurrentUrl)
	{
		// close previous player
		CurrentUrl = FString();

		if (Player.IsValid())
		{
			Player->Close();
			Player->OnClosed().RemoveAll(this);
			Player->OnOpened().RemoveAll(this);
			Player.Reset();
		}

		if (URL.IsEmpty())
		{
			return;
		}

		// create new player
		IMediaModule* MediaModule = FModuleManager::LoadModulePtr<IMediaModule>("Media");

		if (MediaModule == nullptr)
		{
			return;
		}

		Player = MediaModule->CreatePlayer(URL);

		if (!Player.IsValid())
		{
			return;
		}

		Player->OnClosed().AddUObject(this, &UMediaPlayer::HandleMediaPlayerMediaClosed);
		Player->OnOpened().AddUObject(this, &UMediaPlayer::HandleMediaPlayerMediaOpened);

		// open the new media file
		bool OpenedSuccessfully = false;

		if (URL.Contains(TEXT("://")))
		{
			OpenedSuccessfully = Player->Open(URL);
		}
		else
		{
			const FString FullUrl = FPaths::ConvertRelativePathToFull(FPaths::IsRelative(URL) ? FPaths::GameContentDir() / URL : URL);

			if (StreamMode == EMediaPlayerStreamModes::MASM_FromUrl)
			{
				OpenedSuccessfully = Player->Open(FullUrl);
			}
			else if (FPaths::FileExists(FullUrl))
			{
				FArchive* FileReader = IFileManager::Get().CreateFileReader(*FullUrl);
		
				if (FileReader == nullptr)
				{
					return;
				}

				if (FileReader->TotalSize() > 0)
				{
					TArray<uint8>* FileData = new TArray<uint8>();

					FileData->AddUninitialized(FileReader->TotalSize());
					FileReader->Serialize(FileData->GetData(), FileReader->TotalSize());

					OpenedSuccessfully = Player->Open(MakeShareable(FileData), FullUrl);
				}

				delete FileReader;
			}
		}

		// finish initialization
		if (OpenedSuccessfully)
		{
			CurrentUrl = URL;
		}
	}

	if (Player.IsValid())
	{
		Player->SetLooping(Looping);
	}
}
开发者ID:didixp,项目名称:Ark-Dev-Kit,代码行数:88,代码来源:MediaPlayer.cpp


示例13: MakeShareable

TSharedRef< FSlateFontMeasure > FSlateFontMeasure::Create( const TSharedRef<class FSlateFontCache>& FontCache )
{
	return MakeShareable( new FSlateFontMeasure( FontCache ) );
}
开发者ID:kidaa,项目名称:UnrealEngineVR,代码行数:4,代码来源:FontMeasure.cpp


示例14: MakeShareable

TSharedPtr<IMovieSceneTrackInstance> UFaceFXAnimationTrack::CreateInstance()
{
	return MakeShareable(new FFaceFXAnimationTrackInstance(this));
}
开发者ID:jcredmond,项目名称:FaceFX-UE4,代码行数:4,代码来源:FaceFXAnimationTrack.cpp


示例15: MakeShareable

TSharedRef<IStructCustomization> FBlackboardSelectorDetails::MakeInstance()
{
	return MakeShareable( new FBlackboardSelectorDetails );
}
开发者ID:Tigrouzen,项目名称:UnrealEngine-4,代码行数:4,代码来源:BlackboardSelectorDetails.cpp


示例16: FillToolbar

TSharedPtr<FExtender> FCurveAssetEditor::GetToolbarExtender()
{
	struct Local
	{
		static void FillToolbar(FToolBarBuilder& ToolbarBuilder, TSharedRef<SWidget> InputSnapWidget, TSharedRef<SWidget> OutputSnapWidget)
		{
			ToolbarBuilder.BeginSection("Curve");
			{
				ToolbarBuilder.AddToolBarButton(FRichCurveEditorCommands::Get().ZoomToFitHorizontal);
				ToolbarBuilder.AddToolBarButton(FRichCurveEditorCommands::Get().ZoomToFitVertical);
				ToolbarBuilder.AddToolBarButton(FRichCurveEditorCommands::Get().ZoomToFitAll);
				ToolbarBuilder.AddToolBarButton(FRichCurveEditorCommands::Get().ZoomToFitSelected);
			}
			ToolbarBuilder.EndSection();

			ToolbarBuilder.BeginSection("Interpolation");
			{
				ToolbarBuilder.AddToolBarButton(FRichCurveEditorCommands::Get().InterpolationCubicAuto);
				ToolbarBuilder.AddToolBarButton(FRichCurveEditorCommands::Get().InterpolationCubicUser);
				ToolbarBuilder.AddToolBarButton(FRichCurveEditorCommands::Get().InterpolationCubicBreak);
				ToolbarBuilder.AddToolBarButton(FRichCurveEditorCommands::Get().InterpolationLinear);
				ToolbarBuilder.AddToolBarButton(FRichCurveEditorCommands::Get().InterpolationConstant);
			}
			ToolbarBuilder.EndSection();

			ToolbarBuilder.BeginSection("Snap");
			{
				ToolbarBuilder.AddToolBarButton(FRichCurveEditorCommands::Get().ToggleSnapping);
				ToolbarBuilder.AddWidget(InputSnapWidget);
				ToolbarBuilder.AddWidget(OutputSnapWidget);
			}
			ToolbarBuilder.EndSection();
		}
	};

	TSharedPtr<FExtender> ToolbarExtender = MakeShareable(new FExtender);

	TSharedRef<SWidget> InputSnapWidget =
		SNew(SVerticalBox)
		+ SVerticalBox::Slot()
		.Padding(4)
		.AutoHeight()
		[
			SNew(STextBlock)
			.Text(LOCTEXT("InputSnap", "Time Snap"))
		]
		+ SVerticalBox::Slot()
		.Padding(4)
		.AutoHeight()
		[
			SNew(SComboButton)
			.ContentPadding(1)
			.OnGetMenuContent(this, &FCurveAssetEditor::BuildInputSnapMenu)
			.ButtonContent()
			[
				SNew(SEditableTextBox)
				.Text(this, &FCurveAssetEditor::GetInputSnapText)
				.OnTextCommitted(this, &FCurveAssetEditor::InputSnapTextComitted)
			]
		];

	TSharedRef<SWidget> OutputSnapWidget =
		SNew(SVerticalBox)
		+ SVerticalBox::Slot()
		.Padding(4)
		.AutoHeight()
		[
			SNew(STextBlock)
			.Text(LOCTEXT("OutputSnap", "Value Snap"))
		]
		+ SVerticalBox::Slot()
		.Padding(4)
		.AutoHeight()
		[
			SNew(SComboButton)
			.ContentPadding(1)
			.OnGetMenuContent(this, &FCurveAssetEditor::BuildOutputSnapMenu)
			.ButtonContent()
			[
				SNew(SEditableTextBox)
				.Text(this, &FCurveAssetEditor::GetOutputSnapText)
				.OnTextCommitted(this, &FCurveAssetEditor::OutputSnapTextComitted)
			]
		];

	ToolbarExtender->AddToolBarExtension(
		"Asset",
		EExtensionHook::After,
		TrackWidget->GetCommands(),
		FToolBarExtensionDelegate::CreateStatic(&Local::FillToolbar, InputSnapWidget, OutputSnapWidget)
		);

	return ToolbarExtender;
}
开发者ID:kidaa,项目名称:UnrealEngineVR,代码行数:94,代码来源:CurveAssetEditor.cpp


示例17: MakeShareable

TSharedRef< class IPropertyTableCustomColumn > FStatsViewerModule::CreateObjectCustomColumn(const FObjectHyperlinkColumnInitializationOptions& InOptions) const
{
	return MakeShareable(new FObjectHyperlinkColumn(InOptions));
}
开发者ID:RandomDeveloperM,项目名称:UE4_Hairworks,代码行数:4,代码来源:StatsViewerModule.cpp


示例18: FCombinedGraphDataSource

FCombinedGraphDataSourceRef FProfilerManager::CreateCombinedGraphDataSource( const uint32 StatID )
{
	FCombinedGraphDataSource* CombinedGraphDataSource = new FCombinedGraphDataSource( StatID, FTimeAccuracy::FPS060 );
	return MakeShareable( CombinedGraphDataSource );
}
开发者ID:PopCap,项目名称:GameIdea,代码行数:5,代码来源:ProfilerManager.cpp


示例19: CommandList

SMessagingDebugger::SMessagingDebugger()
	: CommandList(MakeShareable(new FUICommandList))
	, MessageTracer(NULL)
	, Model(MakeShareable(new FMessagingDebuggerModel()))
{ }
开发者ID:Codermay,项目名称:Unreal4,代码行数:5,代码来源:SMessagingDebugger.cpp


示例20: MakeShareable

TSharedRef<FMultiBox> FMultiBox::Create( const EMultiBoxType::Type InType, FMultiBoxCustomization InCustomization, const bool bInShouldCloseWindowAfterMenuSelection )
{
	TSharedRef<FMultiBox> NewBox = MakeShareable( new FMultiBox( InType, InCustomization, bInShouldCloseWindowAfterMenuSelection ) );

	return NewBox;
}
开发者ID:kidaa,项目名称:UnrealEngineVR,代码行数:6,代码来源:MultiBox.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ MakeString函数代码示例发布时间:2022-05-30
下一篇:
C++ MakeRequestBuf函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap