Skip to content

Commit

Permalink
First Commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeremie Passerin committed Dec 14, 2021
1 parent 9c3684a commit a788238
Show file tree
Hide file tree
Showing 46 changed files with 5,953 additions and 0 deletions.
61 changes: 61 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
cmake_minimum_required(VERSION 2.6)

set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/modules)

project(harbieNodes)
set(MAYA_VERSION "2022" CACHE STRING "The Maya Version")

find_package(Maya REQUIRED)
set(CMAKE_INSTALL_PREFIX ${CMAKE_CURRENT_BINARY_DIR}/../output/${MAYA_VERSION})
set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT ${PROJECT_NAME})

set(SOURCE_FILES
"sources/_Utils.cpp"
"headers/_Utils.h"
"sources/pluginMain.cpp"
"sources/AbsRotationTrackerNode.cpp"
"headers/AbsRotationTrackerNode.h"
"sources/BeanRemoteNode.cpp"
"headers/BeanRemoteNode.h"
"sources/CorneBulgeInitNode.cpp"
"headers/CorneaBulgeInitNode.h"
"sources/CorneaBulgeNode.cpp"
"headers/CorneaBulgeNode.h"
"sources/CurveMultiAttachNode.cpp"
"headers/CurveMultiAttachNode.h"
"sources/FkIk2BonesNode.cpp"
"headers/FkIk2BonesNode.h"
"sources/InverseRotOrderNode.cpp"
"headers/InverseRotOrderNode.h"
"sources/MeshMultiAttachNode.cpp"
"headers/MeshMultiAttachNode.h"
"sources/PointAtBlendedAxisNode.cpp"
"headers/PointAtBlendedAxisNode.h"
"sources/PointAtDoubleAxisNode.cpp"
"headers/PointAtDoubleAxisNode.h"
"sources/PoseConstraintNode.cpp"
"headers/PoseConstraintNode.h"
"sources/PreviewPlaneNode.cpp"
"headers/PreviewPlaneNode.h"
"sources/RotationTrackerNode.cpp"
"headers/RotationTrackerNode.h"
"sources/SpinePointAtNode.cpp"
"headers/SpinePointAtNode.h"
"sources/SplitMatrixNode.cpp"
"headers/SplitMatrixNode.h"
"sources/SurfaceInfoCmd.cpp"
"headers/SurfaceInfoCmd.h"
"sources/SurfaceMultiAttachNode.cpp"
"headers/SurfaceMultiAttachNode.h"
"sources/rotationToSliderNode.cpp"
"headers/rotationToSliderNode.h"
)

include_directories(${MAYA_INCLUDE_DIR} maya lib)
link_directories(${MAYA_LIBRARY_DIR})
add_library(${PROJECT_NAME} SHARED ${SOURCE_FILES})
target_link_libraries(${PROJECT_NAME} ${MAYA_LIBRARIES})

MAYA_PLUGIN(${PROJECT_NAME})
install(TARGETS ${PROJECT_NAME} ${MAYA_TARGET_TYPE} DESTINATION .)

24 changes: 24 additions & 0 deletions headers/AbsRotationTrackerNode.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#pragma once

#include <maya/MPxNode.h>
#include <maya/MFnNumericAttribute.h>
#include <maya/MTypeId.h>


class AbsRotationTracker : public MPxNode
{
public:
AbsRotationTracker();
virtual ~AbsRotationTracker();
static void* creator();
static MStatus initialize();
virtual MStatus compute( const MPlug& plug, MDataBlock& data );

public:
static MTypeId id;
static MObject axis;
static MObject reference;
static MObject tracker;
static MObject outputA;
static MObject outputB;
};
38 changes: 38 additions & 0 deletions headers/BeanRemoteNode.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@

#include <maya/MPxNode.h>
#include <maya/MFnNumericAttribute.h>
#include <maya/MTypeId.h>

class BeanRemote : public MPxNode {
public:
BeanRemote();
virtual ~BeanRemote();
static void* creator();
static MStatus initialize();
virtual MStatus compute(const MPlug& plug, MDataBlock& data) override;
MStatus computeDirection(const MPlug& pPlug, const MPlug& nPlug, double value, MDataBlock& data);
virtual MPxNode::SchedulingType schedulingType() const override { return MPxNode::kParallel; }

public:
static MTypeId id;

static MObject x;
static MObject inputX;
static MObject minX;
static MObject maxX;
static MObject clampMinX;
static MObject clampMaxX;

static MObject y;
static MObject inputY;
static MObject minY;
static MObject maxY;
static MObject clampMinY;
static MObject clampMaxY;

static MObject output;
static MObject north;
static MObject south;
static MObject east;
static MObject west;
};
35 changes: 35 additions & 0 deletions headers/CorneaBulgeInitNode.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#pragma once

#include <maya/MPxNode.h>
#include <maya/MPointArray.h>
#include <vector>
#include <maya/MFnMesh.h>
#include <maya/MDoubleArray.h>
#include <maya/MFnComponentListData.h>


class CorneaBulgeInit : MPxNode {
public:
CorneaBulgeInit();
virtual ~CorneaBulgeInit();
static void* creator();
static MStatus initialize();
virtual MPxNode::SchedulingType schedulingType() const override {return MPxNode::kParallel;}
virtual MStatus compute(const MPlug& plug, MDataBlock& data) override;

public:
static MTypeId id;
static MObject inMesh;
static MObject centers;
static MObject reference;
static MObject distances;
static MObject indices;
static MObject components; // list of points that should be computed

private:
MStatus computeDistancesAndIndices(MFnMesh &fnMesh, const MFloatPointArray &inputCenters, const MFloatPointArray &positions,
MIntArray &indices, MFloatArray &distances, const MFnComponentListData &compListFn, MStatus &stat);
private:
MMeshIsectAccelParams accelParams;
};

27 changes: 27 additions & 0 deletions headers/CorneaBulgeNode.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# pragma once

#include <maya/MPxNode.h>
#include <maya/MPxDeformerNode.h>
#include <maya/MFnNumericAttribute.h>
#include <maya/MTypeId.h>
#include <maya/MDoubleArray.h>
#include <maya/MFnMesh.h>


class CorneaBulge : public MPxDeformerNode {
public:
CorneaBulge();
virtual ~CorneaBulge();
static void* creator();
static MStatus initialize();
virtual MPxNode::SchedulingType schedulingType() const override {return MPxNode::kParallel;}
virtual MStatus deform(MDataBlock &block, MItGeometry &iterator, const MMatrix &matrix, unsigned int multiIndex) override;
public:
static MTypeId id;
static MObject centers;
static MObject collider;
static MObject distances;
static MObject indices;
private:
MMeshIsectAccelParams accelParams;
};
54 changes: 54 additions & 0 deletions headers/CurveMultiAttachNode.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#pragma once

#include <vector>

#include <maya/MPxNode.h>
#include <maya/MFnNumericAttribute.h>
#include <maya/MFnNurbsCurve.h>
#include <maya/MDoubleArray.h>
#include <maya/MMatrixArray.h>
#include <maya/MTypeId.h>



class CurveMultiAttach : public MPxNode {
public:
CurveMultiAttach();
virtual ~CurveMultiAttach();
virtual MPxNode::SchedulingType schedulingType() const override { return MPxNode::kParallel; }
static void *creator();
static MStatus initialize();
virtual MStatus compute(const MPlug& plug, MDataBlock& data);

MMatrixArray getTransform(MFnNurbsCurve &curve, MDoubleArray &params, MVector &upVector,
bool isParametric, MMatrix &matrix);

public:
static MTypeId id;

// Input
static MObject curve;
static MObject u;
static MObject curveMatrix;
static MObject parentInverse;
static MObject upVector;
static MObject attach;
static MObject isLoop;
static MObject length;
static MObject slide;
static MObject start;
static MObject end;
static MObject reverse;

// Output
static MObject translate;
static MObject translateX;
static MObject translateY;
static MObject translateZ;
static MObject rotateX;
static MObject rotateY;
static MObject rotateZ;
static MObject rotate;
static MObject output;
};

115 changes: 115 additions & 0 deletions headers/FkIk2BonesNode.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
#pragma once

#include <maya/MPxNode.h>
#include <maya/MFnNumericAttribute.h>
#include <maya/MTypeId.h>
#include <maya/MTransformationMatrix.h>


class FkIk2Bones : public MPxNode {
public:
FkIk2Bones();
virtual ~FkIk2Bones();
virtual MPxNode::SchedulingType schedulingType() const override { return MPxNode::kParallel; }
virtual MStatus compute( const MPlug &plug, MDataBlock &data );
static void *creator();
static MStatus initialize();
void computeFK(const MTransformationMatrix &fkA_tfm, const MTransformationMatrix &fkB_tfm,
const MTransformationMatrix &fkC_tfm,
double &lengthA, double &lengthB, const bool &negate, MTransformationMatrix &boneA_tfm,
MTransformationMatrix &boneB_tfm, MTransformationMatrix &boneC_tfm);

void computeIK(const MTransformationMatrix &rootTfm, const MTransformationMatrix &effector,
const MTransformationMatrix &upVector, const double &lengthA, const double &lengthB,
const double &roll, const double &scaleA, const double &scaleB, const double &maxStretch,
const double &slide, const double &reverse, const bool &negate, double &softness,
MTransformationMatrix &boneA_tfm, MTransformationMatrix &boneB_tfm,
MTransformationMatrix &boneC_tfm);


void computeIkStretch(const double &lengthA, const double &lengthB, const double &scaleA, const double &scaleB,
const double &maxStretch, double &softness, double &distance,
const double &slide, const double &reverse, const double globalScale,
double &outA, double &outB) const;


double computeIkAngle(const double distance, const double boneA_length, const double boneB_length, const bool invert) ;




public:
static MTypeId id;
static MObject blend;
static MObject lengthA;
static MObject lengthB;
static MObject roll;
static MObject scaleA;
static MObject scaleB;
static MObject maxStretch;
static MObject softness;
static MObject slide;
static MObject reverse;
static MObject negate;

static MObject fkA;
static MObject fkB;
static MObject fkC;
static MObject root;
static MObject effector;
static MObject upv;

static MObject outBoneA;
static MObject outBoneB;
static MObject outBoneC;

static MObject boneATfm;
static MObject boneBTfm;
static MObject boneCTfm;

static MObject boneAPos;
static MObject boneAPosX;
static MObject boneAPosY;
static MObject boneAPosZ;

static MObject boneARot;
static MObject boneARotX;
static MObject boneARotY;
static MObject boneARotZ;

static MObject boneAScl;
static MObject boneASclX;
static MObject boneASclY;
static MObject boneASclZ;

static MObject boneBPos;
static MObject boneBPosX;
static MObject boneBPosY;
static MObject boneBPosZ;

static MObject boneBRot;
static MObject boneBRotX;
static MObject boneBRotY;
static MObject boneBRotZ;

static MObject boneBScl;
static MObject boneBSclX;
static MObject boneBSclY;
static MObject boneBSclZ;

static MObject boneCPos;
static MObject boneCPosX;
static MObject boneCPosY;
static MObject boneCPosZ;

static MObject boneCRot;
static MObject boneCRotX;
static MObject boneCRotY;
static MObject boneCRotZ;

static MObject boneCScl;
static MObject boneCSclX;
static MObject boneCSclY;
static MObject boneCSclZ;

};
19 changes: 19 additions & 0 deletions headers/InverseRotOrderNode.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#pragma once

#include <maya/MPxNode.h>
#include <maya/MTypeId.h>


class InverseRotOrder : public MPxNode {
public:
InverseRotOrder();
virtual ~InverseRotOrder();
virtual MPxNode::SchedulingType schedulingType() const override { return MPxNode::kParallel; };
static void* creator();
static MStatus initialize();
virtual MStatus compute( const MPlug& plug, MDataBlock& data );
public:
static MTypeId id;
static MObject rotOrder;
static MObject output;
};
Loading

0 comments on commit a788238

Please sign in to comment.