Describes how to implement a preview image for a node in the Node Editor.
Preview images are created with an implementation of PreviewImageProviderInterface.
static maxon::Id g_nodeRendererPreviewProvider =
maxon::Id(
"net.maxonexample.handbook.class.noderendererpreviewprovider");
class PreviewImageProviderExampleHandbook :
public maxon::Component<PreviewImageProviderExampleHandbook, maxon::nodes::PreviewImageProviderInterface>
{
public:
private:
maxon::NodePath _nodePath;
};
Definition: objectbase.h:2651
Definition: apibaseid.h:253
Reference to a job (JobInterface).
Definition: job.h:1222
Int64 Int
signed 32/64 bit int, size depends on the platform
Definition: apibase.h:188
bool Bool
boolean type, possible values are only false/true, 8 bit
Definition: apibase.h:181
@ NORMAL
Samples the surface as the user moves over it the SculptObject and returns a new hit point and normal...
#define MAXON_COMPONENT(KIND,...)
Definition: objectbase.h:2212
#define MAXON_METHOD
Definition: interfacebase.h:1001
The image provider must be registered within the NodeSpaceInterface implementation. A static function sets the reference:
This static function is referenced in the implementation of NodeSpaceInterface::Init():
The context-menu to select the render scene for the preview image is added to nodes that are registered in maxon::nodes::NODESPACE::MATERIALPREVIEWIDS. This is done in the Init() function of the implementation of the node space.
The selected scene identifier is then stored under maxon::nodes::PREVIEWIMAGEREQUEST::SCENETYPE, accessible in PreviewImageProviderInterface::Initialize():
static maxon::nodes::NodeSystemClass g_nodeSystemClass;
{
{
{
}, g_nodeSystemClass);
});
}
static maxon::Result<void> CreateMaterialGraphDefaultSetup(
const maxon::nodes::NodesGraphModelRef& graph)
{
maxon::GraphNode valuePort = shaderNode.GetInputs().FindChild(
maxon::Id("usernode_shade.colorB"))
iferr_return;
}
static
maxon::Result<
void> ConfigurePreviewImageRequest(
maxon::DataDictionaryObjectRef request)
{
request.Set(maxon::nodes::PREVIEWIMAGEREQUEST::PROVIDER, PreviewImageProviderExampleHandbook::GetClass())
iferr_return;
}
{
_class = NodeRendererNodeSystemClassImpl::GetClass().Create()
iferr_return;
spaceData.Set(maxon::nodes::NODESPACE::NODESYSTEMCLASS, _class)
iferr_return;
spaceData.Set(maxon::nodes::NODESPACE::MATERIALENDNODEIDS, std::move(materialEndNodeIds))
iferr_return;
spaceData.Set(maxon::nodes::NODESPACE::RENDERERS, std::move(supportedRenderers))
iferr_return;
spaceData.Set(maxon::nodes::NODESPACE::MATERIALPREVIEWIDS, std::move(materialPreviewNodes))
iferr_return;
}
static maxon::Id g_nodeRendererDatabaseID =
maxon::Id(
"net.maxonexample.handbook.nodes.registereddatabase");
{
{
err.CritStop();
return err;
};
const maxon::Url& binaryUrl = maxon::g_maxon.GetUrl();
const maxon::Id spaceDescriptionId =
maxon::Id(
"net.maxonexample.handbook.nodespace.node_renderer");
maxon::nodes::NodeSpaceRef nodeRendererSpace = NodeRendererNodeSpaceImpl::CreateInit(nodeRendererData)
iferr_return;
g_exampleNodeSpace = maxon::nodes::MaterialNodeSpaces::Register(NodeRendererNodeSpaceImpl::GetDescriptor().GetId(), nodeRendererSpace)
iferr_return;
}
static void FreeResources()
{
{
err.CritStop();
return;
};
g_nodeSystemClass = nullptr;
}
static MAXON_METHOD const AssetRepositoryRef & GetBuiltinRepository()
static MAXON_METHOD Result< void > RegisterDatabaseWithUrl(const Id &databaseId, const Url &url, const CString &version=CString::NullValue())
static MAXON_METHOD Result< void > UnregisterDatabase(const Id &databaseId)
Definition: genericdata.h:20
static MAXON_METHOD Result< DataDictionary > LoadDescription(const Id &spaceDescriptionId)
static MAXON_METHOD Result< NodeTemplate > CreateLazyTemplate(const Id &nodeId, Delegate< Result< NodeTemplate >()> &&creator, Delegate< Result< Bool >(const NodeSystemClass &cls)> &&support={})
static MAXON_METHOD Result< DescriptionProcessor > CreateNodeDescriptionProcessor(Delegate< Result< NodeTemplate >(const Id &descriptionId, const DataDescription &dataDescription)> &&delegate)
static MAXON_METHOD Result< NodeTemplate > LoadTemplate(const AssetRepositoryRef &repo, const Id &assetId)
static MAXON_METHOD Result< NodeSystemBasedNodeTemplate > BuildNodeFromDescription(const Id &id, const NodeSystemClass &nodeClass, Bool addDependencies=true, const Delegate< Result< void >(const MutableRoot &root, const TemplateArguments &args)> &finalizer={})
OK
Ok.
Definition: ge_prepass.h:0
Col4< Float, 1 > ColorA
Definition: vector4d.h:60
#define MAXON_DECLARATION_REGISTER(...)
Definition: module.h:933
#define MAXON_INITIALIZATION(...)
Definition: module.h:795
The maxon namespace contains all declarations of the MAXON API.
Definition: autoweight.h:14
Definition: animation_attributes.h:10
#define iferr_scope_handler
Definition: resultbase.h:1402