About
FieldLayerData is the base class for custom field layers (FieldLayer)
A new FieldLayerData based class is registered with RegisterFieldLayerPlugin().
FieldLayerData
In a FieldLayerData based class the following functions can be implemented:
- FieldLayerData::InitSampling(): Prepares data for sampling.
- FieldLayerData::Sample(): Samples the layer.
- FieldLayerData::Aggregate(): Called after each thread/block if FIELDLAYER_AGGREGATE is set.
- FieldLayerData::FreeSampling(): Frees data after sampling.
- FieldLayerData::IsEqual(): Returns true if the layer is equal to the given layer.
- FieldLayerData::GetLinkedObject(): Returns a referenced object.
- FieldLayerData::SetLinkedObject(): Sets a referenced object.
- FieldLayerData::CheckDirty(): Updates the dirtiness.
Register
A FieldLayerData based class has to be registered with RegisterFieldLayerPlugin(). The flags are:
- Note
- Modifier layers are registered with FIELDLAYER_DIRECT.
Example
class HueShiftFieldLayer : public FieldLayerData
{
public:
static NodeData* Alloc()
{
{
return nullptr;
}
}
{
const BaseContainer& layerBc = layer.GetDataInstanceRef();
GeData data;
if (layerBc.GetParameter(
ConstDescID(DescLevel(FIELDLAYER_HUESHIFT_OFFSET)), data) ==
false)
MAXON_REMOVE_CONST(this)->_offset = data.GetFloat();
return {};
}
{
for (
Int i = inputs._blockCount - 1;
i >= 0; --
i)
{
const Vector color = outputs._color[
i];
hue =
FMod(hue + _offset, 1.0);
hsv.x = hue;
}
}
virtual void FreeSampling(
const FieldLayer& layer,
const FieldInfo&
info,
maxon::GenericData& extraData)
const
{
}
virtual Bool IsEqual(
const FieldLayer& layer,
const FieldLayerData& comp)
const
{
return true;
}
private:
};
Py_ssize_t i
Definition: abstract.h:645
#define INSTANCEOF(X, Y)
Definition: c4d_baselist.h:49
Definition: resultbase.h:766
PyObject PyObject * result
Definition: abstract.h:43
return OK
Definition: apibase.h:2740
MAXON_ATTRIBUTE_FORCE_INLINE Bool IsEqual(PREDICATE &&predicate, const T1 &a, const T2 &b)
Definition: collection.h:102
#define MAXON_SOURCE_LOCATION
Definition: memoryallocationbase.h:69
#define iferr(...)
Definition: errorbase.h:388
#define DebugStop(...)
Definition: debugdiagnostics.h:225
#define ConstDescID(...)
Definition: lib_description.h:592
Float32 FMod(Float32 v1, Float32 v2)
Definition: apibasemath.h:192
Vector RGBToHSV(const Vector &col)
maxon::Bool Bool
Definition: ge_sys_math.h:46
maxon::Float Float
Definition: ge_sys_math.h:57
maxon::Int Int
Definition: ge_sys_math.h:55
Vector HSVToRGB(const Vector &col)
FieldOutputBlockTemplate< false > FieldOutputBlock
Definition: operatingsystem.h:300
maxon::Vec3< maxon::Float64, 1 > Vector
Definition: ge_math.h:140
#define NewObj(T,...)
Definition: newobj.h:108
_Py_clock_info_t * info
Definition: pytime.h:197
"Hue Shift Layer"_s,
"Changes the color hue."_s,
"Hue Shift Layer"_s,
HueShiftFieldLayer::Alloc,
"Flhueshift"_s,
nullptr,
0,
nullptr);
if (registerFieldLayerSuccess == false)
#define FIELDLAYER_PREMULTIPLIED
The FieldLayer will receive FieldOutputBlock data premultiplied by alpha values.
Definition: ge_prepass.h:987
#define FIELDLAYER_NOROTATIONOUT
The FieldLayer doesn't calculate rotational velocities.
Definition: ge_prepass.h:988
#define FIELDLAYER_DIRECT
The FieldLayer will have access to directly manipulate the 'result' data in ModifyValues rather than ...
Definition: ge_prepass.h:980
#define FIELDLAYER_NOVALUEOUT
The FieldLayer doesn't calculate values.
Definition: ge_prepass.h:982
#define FIELDLAYER_NODIRECTIONOUT
The FieldLayer doesn't calculate directions.
Definition: ge_prepass.h:984
Bool RegisterFieldLayerPlugin(Int32 id, const maxon::String &name, const maxon::String &help, const maxon::String &pickInstruction, Int32 info, DataAllocator *g, const maxon::String &description, BaseBitmap *icon, Int32 disklevel, FieldLayerAcceptDragFunction *dragFunc=nullptr)
Further Reading