refactor: move GOP_test to plugin system
This commit is contained in:
40
src/OpDefs/GopTransform.cpp
Normal file
40
src/OpDefs/GopTransform.cpp
Normal file
@@ -0,0 +1,40 @@
|
||||
#include "OpDefs/GopTransform.hpp"
|
||||
#include "Engine/Operator/AttributeHandle.h"
|
||||
|
||||
GopTransform::GopTransform(enzo::nt::OpId opId)
|
||||
: enzo::nt::GeometryOpDef(opId)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void GopTransform::cookOp(enzo::op::Context context)
|
||||
{
|
||||
using namespace enzo;
|
||||
|
||||
if(outputRequested(0))
|
||||
{
|
||||
// copy input geometry
|
||||
geo::Geometry geo = context.cloneInputGeo(0);
|
||||
|
||||
// ----
|
||||
// create geometry start
|
||||
// ----
|
||||
auto PAttr = geo.getAttribByName(ga::AttrOwner::POINT, "P");
|
||||
ga::AttributeHandleVector3 PAttrHandle(PAttr);
|
||||
|
||||
for(int i=0; i<PAttrHandle.getAllValues().size(); ++i)
|
||||
{
|
||||
enzo::bt::Vector3 vector = PAttrHandle.getValue(i);
|
||||
vector.y()+=2.5;
|
||||
PAttrHandle.setValue(i, vector);
|
||||
}
|
||||
// ----
|
||||
|
||||
|
||||
|
||||
// set output geometry
|
||||
setOutputGeometry(0, geo);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user