MCPcopy Create free account
hub / github.com/FlaxEngine/FlaxEngine / InitOptions

Method InitOptions

Source/Engine/ContentImporters/ImportTexture.cpp:77–107  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

75}
76
77void ImportTexture::InitOptions(CreateAssetContext& context, Options& options)
78{
79 // Gather import options
80 if (context.CustomArg != nullptr)
81 {
82 // Copy options
83 options = *static_cast<Options*>(context.CustomArg);
84 ASSERT_LOW_LAYER(options.Sprites.Count() >= 0);
85 }
86 else
87 {
88 // Restore the previous settings or use default ones
89 if (!TryGetImportOptions(context.TargetAssetPath, options))
90 {
91 LOG(Warning, "Missing texture import options. Using default values.");
92 }
93 }
94
95 // Tweak options
96 if (options.IsAtlas)
97 {
98 // Disable streaming for atlases
99 // TODO: maybe we could use streaming for atlases?
100 options.NeverStream = true;
101
102 // Add default tile if has no sprites
103 if (options.Sprites.IsEmpty())
104 options.Sprites.Add({ Rectangle(Float2::Zero, Float2::One), TEXT("Default") });
105 }
106 options.MaxSize = Math::Min(options.MaxSize, GPU_MAX_TEXTURE_SIZE);
107}
108
109CreateAssetResult ImportTexture::Create(CreateAssetContext& context, const TextureData& textureData, Options& options)
110{

Callers

nothing calls this directly

Calls 5

RectangleClass · 0.50
MinFunction · 0.50
CountMethod · 0.45
IsEmptyMethod · 0.45
AddMethod · 0.45

Tested by

no test coverage detected