Skip to content

Instantly share code, notes, and snippets.

@ttvd
Created December 19, 2021 20:02
Show Gist options
  • Save ttvd/df453d882dbbc85ca0e7b5485593fd1e to your computer and use it in GitHub Desktop.
Save ttvd/df453d882dbbc85ca0e7b5485593fd1e to your computer and use it in GitHub Desktop.
Dynamic Houdini Node Component
#pragma once
#include "HoudiniNodeComponent.generated.h"
UCLASS()
class HOUDININODE_API UHoudiniNodeComponent : public USceneComponent
{
GENERATED_UCLASS_BODY()
virtual ~UHoudiniNodeComponent();
public:
virtual void Serialize(FArchive& Ar) override;
public:
#if WITH_EDITOR
//! Called whenever a property on the actor changes.
virtual void PostEditChangeProperty(FPropertyChangedEvent& PropertyChangedEvent) override;
#endif
public:
//! Set a value (with a proper alignment) and return the offset.
template<typename TType> uint32 SetScratchSpaceValues(TType* Values, uint32 Bytes);
template<typename TType> uint32 SetScratchSpaceValues(const TArray<TType>& Values);
template<typename TType> uint32 SetScratchSpaceValue(TType Value);
public:
//! Set a value at the given offset.
template <typename TType> void SetScratchSpaceValuesAtOffset(TType* Values, uint32 Bytes, uint32 Offset);
template <typename TType> void SetScratchSpaceValuesAtOffset(const TArray<TType>& Values, uint32 Offset);
template <typename TType> void SetScratchSpaceValueAtOffset(TType Values, uint32 Offset);
public:
//! Get a value at the given offset.
template <typename TType> void GetScratchSpaceValuesAtOffset(uint32 Offset, int32 Dim, TArray<TType>& Values);
template <typename TType> void GetScratchSpaceValueAtOffset(uint32 Offset, TType& Value);
protected:
//! Scratch space buffer.
char ScratchSpaceBuffer[HOUDINI_NODE_SCRATCH_SPACE_BUFFER_SIZE];
//! Current scratch buffer offset.
uint32 ScratchSpaceBufferOffset;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment