Nebula
Toggle main menu visibility
Loading...
Searching...
No Matches
materialdocument.h
Go to the documentation of this file.
1
#pragma once
2
//------------------------------------------------------------------------------
21
//------------------------------------------------------------------------------
22
#if WITH_NEBULA_EDITOR
23
#include "editorassets/assetdocument.h"
24
#include "
dynui/imguicontext.h
"
25
#include "
graphics/graphicsentity.h
"
26
#include "
materials/material.h
"
27
#include "
resources/resourceid.h
"
28
#include "
util/array.h
"
29
#include "
util/dictionary.h
"
30
31
namespace
GraphicsFeature
32
{
33
34
class
MaterialDocument
final :
public
Editor::AssetDocument
35
{
36
__DeclareClass
(
MaterialDocument
)
37
public
:
38
MaterialDocument
();
39
virtual
~MaterialDocument
();
40
42
void
Draw()
override
;
44
void
OnShown(
bool
shown)
override
;
46
bool
CanSave()
const override
;
47
49
static
void
OpenAsset(
const
IO::Path
& asset);
51
static
bool
CreateAsset(
const
IO::Path
& asset,
const
IO::URI
& workFile,
const
Util::String
& variant,
Util::String
& outError);
53
static
void
ListTemplates(
Util::Array<Util::String>
& out);
54
56
void
ApplyValue(
uint
offset,
const
void
* data,
uint
size);
59
void
ApplyTexture(
IndexT
slot,
const
IO::Path
& texture);
60
61
protected
:
62
bool
OnOpen()
override
;
63
void
OnClose()
override
;
64
bool
OnSave(
Util::String
& outError)
override
;
65
66
private
:
68
struct
Slot
69
{
71
IO::Path
texture;
73
IO::Path
original;
75
Resources::ResourceId held = Resources::InvalidResourceId;
77
Dynui::ImguiTextureId
image;
78
Ids::Id32
imageId = 0;
79
bool
hasImageId =
false
;
80
};
81
83
void
Loaded(Resources::ResourceId
id
);
85
void
ReadWorkFile();
87
void
DrawTextures(
const
MaterialTemplatesGPULang::Entry
* materialTemplate);
88
void
DrawValues(
const
MaterialTemplatesGPULang::Entry
* materialTemplate);
90
void
RunPendingTexture();
91
92
Resources::ResourceId resource;
93
Materials::MaterialId
material;
94
Graphics::GraphicsEntityId
previewObject;
95
Util::Array<Slot>
slots;
97
Util::Array<ubyte>
committed;
99
Util::String
workTemplate;
100
Util::Dictionary<Util::String, Util::String>
workValues;
102
IndexT
pendingSlot;
103
IO::Path
pendingTexture;
104
bool
shown;
105
};
106
107
}
// namespace GraphicsFeature
108
#endif
// WITH_NEBULA_EDITOR
109
//------------------------------------------------------------------------------
array.h
MaterialDocument
A material open in the asset editor: its textures and values, edited on the material the scene uses,...
IO::Path
A path is an abstraction around file paths.
Definition
path.h:26
IO::URI
An URI object can split a Uniform Resource Identifier string into its components or build a string fr...
Definition
uri.h:67
Util::Array
Nebula's dynamic array class.
Definition
array.h:61
Util::Dictionary
A collection of key/value pairs with quick value retrieval by key at roughly O(log n).
Definition
dictionary.h:35
Util::String
Nebula's universal string class.
Definition
string.h:50
dictionary.h
graphicsentity.h
imguicontext.h
material.h
GraphicsFeature
Definition
graphicsfeatureunit.cc:66
Ids::Id32
uint32_t Id32
Definition
id.h:138
resourceid.h
__DeclareClass
#define __DeclareClass(type)
Dynui::ImguiTextureId
Definition
imguicontext.h:54
Graphics::GraphicsEntityId
The graphics entity is only an Id, to which we can attach GraphicsContexts.
Definition
graphicsentity.h:16
MaterialTemplatesGPULang::Entry
Definition
materialtemplatetypes.h:153
Materials::MaterialId
Definition
material.h:36
uint
unsigned int uint
Definition
types.h:41
IndexT
int IndexT
Definition
types.h:49
code
addons
graphicsfeature
editor
assets
materialdocument.h
Generated on
for Nebula. Dark theme by
Tilen Majerle
. All rights reserved.