Bifrost SDK
Bifrost SDK documentation
HostData.h
Go to the documentation of this file.
1#line 1 "W:/bifrost-maya-plugin/src/bifrost-plugin/src/bifrostboard-plugin/hostdata/HostData.h"
2//-
3//**************************************************************************/
4// Copyright 2023 Autodesk, Inc. All rights reserved.
5//
6// Use of this software is subject to the terms of the Autodesk
7// license agreement provided at the time of installation or download,
8// or which otherwise accompanies this software in either electronic
9// or hard copy form.
10//**************************************************************************/
11//+
12
17
18#ifndef MAYA_HOST_DATA_H_
19#define MAYA_HOST_DATA_H_
20
21#include "MayaExport.h"
22
23#include <maya/MDagModifier.h>
24#include <maya/MDataBlock.h>
25#include <maya/MObject.h>
26#include <maya/MPlug.h>
27#include <maya/MTypeId.h>
28
29#include <Amino/Core/Ptr.h>
30
32
33namespace Amino {
34class MetadataItem;
35class Value;
36} // namespace Amino
37
38namespace BifrostGraph {
39namespace MayaTranslation {
40
50public:
58 ValueData(MPlug const& plug,
59 MDataBlock& block,
60 void*& extraHandle,
61 Amino::Ptr<Amino::Any> const& cachedValue,
62 Amino::MetadataItem const* inputPathOpts = nullptr)
63 : BifrostGraph::Executor::TypeTranslation::ValueData(),
64 m_plug(plug),
65 m_block(block),
66 m_inputPathOpts(inputPathOpts),
67 m_extraHandle(extraHandle),
68 m_cachedValue(cachedValue) {}
69
72 ~ValueData() final;
73
75 // copy constructor and assignment operator
77 ValueData& operator=(const ValueData&) = delete;
78 ValueData(const ValueData&) = delete;
80
82 inline const MPlug& getPlug() const { return m_plug; }
83
87 inline MDataBlock& getDataBlock() const { return m_block; }
88
90 inline const Amino::MetadataItem* getInputPathOptions() const { return m_inputPathOpts; }
91
93 inline void*& getExtraHandle() const { return m_extraHandle; }
94
96 inline const Amino::Ptr<Amino::Any>& getCachedValue() const { return m_cachedValue; }
97
98private:
99 MPlug const& m_plug;
100 MDataBlock& m_block;
101
102 const Amino::MetadataItem* m_inputPathOpts;
103
105 void*& m_extraHandle;
106
108 Amino::Ptr<Amino::Any> const& m_cachedValue;
109};
110
119public:
124 PortData(MObject const& object, MTypeId const& id)
125 : BifrostGraph::Executor::TypeTranslation::PortData(), m_object(object), m_id(id) {}
126
129 PortData(PortData const& other)
130 : BifrostGraph::Executor::TypeTranslation::PortData(),
131 m_object(other.m_object),
132 m_id(other.m_id) {}
133
136 ~PortData() override;
137
138private:
139 PortData& operator=(const PortData&) = delete;
140
141public:
143 MObject const m_object;
144
146 MTypeId const m_id;
147};
148
155public:
157 enum class ConversionMode {
158 kNone,
159 kConversionToShape,
160 kConversionToBoard
161 };
162
165 ConversionMode m_conversionMode{ConversionMode::kNone};
166 Amino::String m_convertFromNodeName{""};
167 Amino::String m_convertFromNodeUUID{""};
168 };
169
170public:
176 PortCreationData(PortData const& translationData,
177 MDGModifier& modifier,
178 ConversionData const& conversionData)
179 : PortData(translationData), m_modifier(modifier), m_conversionData(conversionData) {}
180
184
185private:
186 PortCreationData& operator=(const PortCreationData&) = delete;
187
188public:
191 MDGModifier& m_modifier;
193 ConversionData const& m_conversionData;
194};
195
203 : public BifrostGraph::Executor::TypeTranslation::PluginHostData {
204public:
208 explicit PluginHostData(MObject& object)
209 : BifrostGraph::Executor::TypeTranslation::PluginHostData(),
210 m_object(object) {}
211
215
216public:
219 MObject const m_object;
220};
221
222} // namespace MayaTranslation
223} // namespace BifrostGraph
224
225#endif
#define MAYA_HOST_DATA_SHARED_DECL
Definition: MayaExport.h:25
Smart pointers used to allow custom user classes (opaque classes) to be used within Amino graphs....
BifrostGraph Executor TypeTranslation.
Definition: HostData.h:33
Translation data used to pass Maya data between compute node and converter.
Definition: HostData.h:49
const Amino::MetadataItem * getInputPathOptions() const
Definition: HostData.h:90
~ValueData() final
Destructor always called by maya. User should not destroy the object itself.
const Amino::Ptr< Amino::Any > & getCachedValue() const
Definition: HostData.h:96
MDataBlock & getDataBlock() const
Definition: HostData.h:87
ValueData(MPlug const &plug, MDataBlock &block, void *&extraHandle, Amino::Ptr< Amino::Any > const &cachedValue, Amino::MetadataItem const *inputPathOpts=nullptr)
Constructor always called by maya. User should not create the object itself.
Definition: HostData.h:58
Translation data used to create the Maya attribute when a graph I/O (top level compound) is added.
Definition: HostData.h:118
MObject const m_object
The maya dependency node.
Definition: HostData.h:143
PortData(MObject const &object, MTypeId const &id)
Constructor always called by maya. User should not create the object itself.
Definition: HostData.h:124
PortData(PortData const &other)
Copy constructor.
Definition: HostData.h:129
MTypeId const m_id
The MTypeId of m_object.
Definition: HostData.h:146
~PortData() override
Destructor always called by maya. User should not destroy the object itself.
Translation data used to create Maya ports. This will be created by Maya.
Definition: HostData.h:154
PortCreationData(PortData const &translationData, MDGModifier &modifier, ConversionData const &conversionData)
Constructor always called by maya. User should not create the object itself.
Definition: HostData.h:176
~PortCreationData() final
Destructor always called by maya. User should not destroy the object itself.
ConversionMode
Mode to know if we are converting and to what.
Definition: HostData.h:157
To know if we are converting and to what.
Definition: HostData.h:164
Data used to initialize translation tables against the plugin. This will be created by Maya.
Definition: HostData.h:203
~PluginHostData() final
Destructor always called by maya. User should not destroy the object itself.
PluginHostData(MObject &object)
Constructor always called by maya. User should not create the object itself.
Definition: HostData.h:208
The string class used by Amino.
Definition: String.h:46
The host data for translating values from/to host/Amino.
The host data for creating host ports.