Commit 6cdeb206 by wester

testing fpr exposing API

parent 110727d8
/// @file GLTFFactory.h by Robert Poncelet /// @file GLTFFactory.h by Robert Poncelet
#pragma once #pragma once
#include "Factories/Factory.h" #include "Factories/Factory.h"
#include "GLTFFactory.generated.h" #include "GLTFFactory.generated.h"
UCLASS() UCLASS()
/// The class instantiated by the AssetToolsModule for importing the chosen UAsset into the content browser. Adapted from UFbxFactory. /// The class instantiated by the AssetToolsModule for importing the chosen UAsset into the content browser. Adapted from UFbxFactory.
class UGLTFFactory : public UFactory class UGLTFFactory : public UFactory
{ {
GENERATED_BODY() GENERATED_BODY()
UGLTFFactory(const FObjectInitializer& ObjectInitializer); UGLTFFactory(const FObjectInitializer& ObjectInitializer);
/// @name UFactory Implementation /// @name UFactory Implementation
///@{ ///@{
virtual bool DoesSupportClass(UClass * Class) override; virtual bool DoesSupportClass(UClass * Class) override;
virtual UObject* FactoryCreateBinary(UClass* InClass, UObject* InParent, FName InName, EObjectFlags Flags, UObject* Context, const TCHAR* Type, const uint8*& Buffer, const uint8* BufferEnd, FFeedbackContext* Warn, bool& bOutOperationCanceled) override; virtual UObject* FactoryCreateBinary(UClass* InClass, UObject* InParent, FName InName, EObjectFlags Flags, UObject* Context, const TCHAR* Type, const uint8*& Buffer, const uint8* BufferEnd, FFeedbackContext* Warn, bool& bOutOperationCanceled) override;
virtual bool FactoryCanImport(const FString& Filename) override; virtual bool FactoryCanImport(const FString& Filename) override;
///@} ///@}
bool bShowOption; bool bShowOption;
bool bDetectImportTypeOnImport; bool bDetectImportTypeOnImport;
/** true if the import operation was canceled. */ /** true if the import operation was canceled. */
bool bOperationCanceled; bool bOperationCanceled;
}; };
// Some copyright should be here... // Some copyright should be here...
#include "SlateBasics.h" #include "SlateBasics.h"
#include "GLTFLoader.h" #include "GLTFLoader.h"
// You should place include statements to your module's private header files here. You only need to // You should place include statements to your module's private header files here. You only need to
// add includes for headers that are used in most of your module's source files though. // add includes for headers that are used in most of your module's source files though.
\ No newline at end of file
// Some copyright should be here... // Some copyright should be here...
#include "GLTFLoaderPrivatePCH.h" #include "GLTFLoaderPrivatePCH.h"
#include "GLTFLoaderStyle.h" #include "GLTFLoaderStyle.h"
#include "SlateGameResources.h" #include "SlateGameResources.h"
#include "IPluginManager.h" #include "IPluginManager.h"
TSharedPtr< FSlateStyleSet > FGLTFLoaderStyle::StyleInstance = NULL; TSharedPtr< FSlateStyleSet > FGLTFLoaderStyle::StyleInstance = NULL;
void FGLTFLoaderStyle::Initialize() void FGLTFLoaderStyle::Initialize()
{ {
if (!StyleInstance.IsValid()) if (!StyleInstance.IsValid())
{ {
StyleInstance = Create(); StyleInstance = Create();
FSlateStyleRegistry::RegisterSlateStyle(*StyleInstance); FSlateStyleRegistry::RegisterSlateStyle(*StyleInstance);
} }
} }
void FGLTFLoaderStyle::Shutdown() void FGLTFLoaderStyle::Shutdown()
{ {
FSlateStyleRegistry::UnRegisterSlateStyle(*StyleInstance); FSlateStyleRegistry::UnRegisterSlateStyle(*StyleInstance);
ensure(StyleInstance.IsUnique()); ensure(StyleInstance.IsUnique());
StyleInstance.Reset(); StyleInstance.Reset();
} }
FName FGLTFLoaderStyle::GetStyleSetName() FName FGLTFLoaderStyle::GetStyleSetName()
{ {
static FName StyleSetName(TEXT("GLTFLoaderStyle")); static FName StyleSetName(TEXT("GLTFLoaderStyle"));
return StyleSetName; return StyleSetName;
} }
#define IMAGE_BRUSH( RelativePath, ... ) FSlateImageBrush( Style->RootToContentDir( RelativePath, TEXT(".png") ), __VA_ARGS__ ) #define IMAGE_BRUSH( RelativePath, ... ) FSlateImageBrush( Style->RootToContentDir( RelativePath, TEXT(".png") ), __VA_ARGS__ )
#define BOX_BRUSH( RelativePath, ... ) FSlateBoxBrush( Style->RootToContentDir( RelativePath, TEXT(".png") ), __VA_ARGS__ ) #define BOX_BRUSH( RelativePath, ... ) FSlateBoxBrush( Style->RootToContentDir( RelativePath, TEXT(".png") ), __VA_ARGS__ )
#define BORDER_BRUSH( RelativePath, ... ) FSlateBorderBrush( Style->RootToContentDir( RelativePath, TEXT(".png") ), __VA_ARGS__ ) #define BORDER_BRUSH( RelativePath, ... ) FSlateBorderBrush( Style->RootToContentDir( RelativePath, TEXT(".png") ), __VA_ARGS__ )
#define TTF_FONT( RelativePath, ... ) FSlateFontInfo( Style->RootToContentDir( RelativePath, TEXT(".ttf") ), __VA_ARGS__ ) #define TTF_FONT( RelativePath, ... ) FSlateFontInfo( Style->RootToContentDir( RelativePath, TEXT(".ttf") ), __VA_ARGS__ )
#define OTF_FONT( RelativePath, ... ) FSlateFontInfo( Style->RootToContentDir( RelativePath, TEXT(".otf") ), __VA_ARGS__ ) #define OTF_FONT( RelativePath, ... ) FSlateFontInfo( Style->RootToContentDir( RelativePath, TEXT(".otf") ), __VA_ARGS__ )
const FVector2D Icon16x16(16.0f, 16.0f); const FVector2D Icon16x16(16.0f, 16.0f);
const FVector2D Icon20x20(20.0f, 20.0f); const FVector2D Icon20x20(20.0f, 20.0f);
const FVector2D Icon40x40(40.0f, 40.0f); const FVector2D Icon40x40(40.0f, 40.0f);
TSharedRef< FSlateStyleSet > FGLTFLoaderStyle::Create() TSharedRef< FSlateStyleSet > FGLTFLoaderStyle::Create()
{ {
TSharedRef< FSlateStyleSet > Style = MakeShareable(new FSlateStyleSet("GLTFLoaderStyle")); TSharedRef< FSlateStyleSet > Style = MakeShareable(new FSlateStyleSet("GLTFLoaderStyle"));
Style->SetContentRoot(IPluginManager::Get().FindPlugin("GLTFLoader")->GetBaseDir() / TEXT("Resources")); Style->SetContentRoot(IPluginManager::Get().FindPlugin("GLTFLoader")->GetBaseDir() / TEXT("Resources"));
Style->Set("GLTFLoader.OpenPluginWindow", new IMAGE_BRUSH(TEXT("ButtonIcon_40x"), Icon40x40)); Style->Set("GLTFLoader.OpenPluginWindow", new IMAGE_BRUSH(TEXT("ButtonIcon_40x"), Icon40x40));
return Style; return Style;
} }
#undef IMAGE_BRUSH #undef IMAGE_BRUSH
#undef BOX_BRUSH #undef BOX_BRUSH
#undef BORDER_BRUSH #undef BORDER_BRUSH
#undef TTF_FONT #undef TTF_FONT
#undef OTF_FONT #undef OTF_FONT
void FGLTFLoaderStyle::ReloadTextures() void FGLTFLoaderStyle::ReloadTextures()
{ {
FSlateApplication::Get().GetRenderer()->ReloadTextureResources(); FSlateApplication::Get().GetRenderer()->ReloadTextureResources();
} }
const ISlateStyle& FGLTFLoaderStyle::Get() const ISlateStyle& FGLTFLoaderStyle::Get()
{ {
return *StyleInstance; return *StyleInstance;
} }
This source diff could not be displayed because it is too large. You can view the blob instead.
Copyright (c) 2016, Syoyo Fujita Copyright (c) 2016, Syoyo Fujita
All rights reserved. All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment