• jujut
  • Asking for seconds
  • Email
  • Posts 33
  • Reputation 3
  • Member Since
  • Last Active
Email
All Posts Topics Started Likes
MPxData custom dependency graph Issue
I finally get something working correctly without the compoundAttribute:
Capture.PNG 

On this exemple the custom data drive in one attribute 5 kind of data:
float
MColor
MPointArray
std::vector of MPointArray
std::mt19937

Below the compute of customNodeA:
Code:

  if ( plug==p_customData )
  {
    //create customData
    MFnPluginData fnCustomData;
    fnCustomData.create(customData::id, &status);
    MDataHandle customDataHandle;
    customDataHandle = data.outputValue(p_customData);
    customData* myData = NULL;
    myData = (customData*)fnCustomData.data(&status);

    //edit customData
    float floatValue = data.inputValue( p_inFloat ).asFloat();
    myData->floatData=floatValue;
    MColor colorValue (1,0,0);
    myData->colorData=colorValue;
    MPointArray pointArraValue;
    pointArraValue.setLength(25);
    myData->pointArrayData=pointArraValue;
    std::vector < MPointArray > pointArrayVectorValue;
    pointArrayVectorValue.resize(13);
    pointArrayVectorValue[5].setLength(3);
    pointArrayVectorValue[12].setLength(100);
    myData->pointArrayVectorData=pointArrayVectorValue;
    std::mt19937 randomValue;
    randomValue.seed(1234);
    myData->randomData=randomValue;
    //out data
    customDataHandle.set(myData);
    
    data.setClean(plug);
  }else{
    return MS::kUnknownParameter;
  }


Below the comput of the customNodeB
Code:

  if ( plug == p_outFloat )
  {
    //get customData
    MDataHandle customDataHandle = data.inputValue( p_inData, &status );
    customData* myData = (customData*) customDataHandle.asPluginData();
    float out=0.0f;
    MColor outColor(0,0,0);
    MPointArray outPointArray;
    std::vector < MPointArray > outPointArrayVector;
    std::mt19937 outRandomValue;
    MGlobal::displayInfo(MString("  check customNodeB -------> "));
    if (myData != NULL) 
    {
      out = myData->floatData;
      outColor = myData->colorData;
      outPointArray = myData->pointArrayData;
      outPointArrayVector = myData->pointArrayVectorData;
      outRandomValue = myData->randomData;
      std::uniform_real_distribution<> dis(0, 1);
  
      //check customData Value
      MGlobal::displayInfo(MString("  floatData -------> ")+out);
      MGlobal::displayInfo(MString("  outColor R -------> ")+outColor.r);
      MGlobal::displayInfo(MString("  outColor G -------> ")+outColor.g);
      MGlobal::displayInfo(MString("  outColor B -------> ")+outColor.b);
      MGlobal::displayInfo(MString("  outPointArray length -------> ")+outPointArray.length());
      MGlobal::displayInfo(MString("  outPointArrayVector length -------> ")+outPointArrayVector.size());
      MGlobal::displayInfo(MString("  outPointArrayVector[5] length -------> ")+outPointArrayVector[5].length());
      MGlobal::displayInfo(MString("  outPointArrayVector[12] length -------> ")+outPointArrayVector[12].length());
      MGlobal::displayInfo(MString("  random -------> ")+dis(outRandomValue));
      
    }else{
      MGlobal::displayInfo(MString("  nothing plug in p_inData "));
    }
    //test output
    data.outputValue(p_outFloat).set(out);
    data.setClean(plug);
  }else{
    return MS::kUnknownParameter;
  }


I attach  to this message the source code of the test plug.

0 0
MPxData custom dependency graph Issue
ok so i try different way with a compoundAttribute.

First i try a compoundAttribute with one child (customData), it's not working. The same issue as before. Also when trying to check the connection of the compoundAttribute

Second i try a compoundAttribute with two child: the customData and a dummy attribute, and it's working fine :)

So i keep the second try with  the one flow connection because of the compoundAttribute and i can continue to evaluate the connection with plug == compoundData for checking if the customAttribute is connected in the compute(). And i don't need to check if the dummy attribute is connected. I can now transfert all what i want in my customAttribute which is very cool for what i need.

Thanks you pshipkov  for the compoundAttribute idea :)

I think it's not the cleanest way but it work fine :)

If anybody have an other idea?

0 0
MPxData custom dependency graph Issue
ok so i try different way with a compoundAttribute.

First i try a compoundAttribute with one child (customData), it's not working. The same issue as before. Also when trying to check the connection of the compoundAttribute

Second i try a compoundAttribute with two child: the customData and a dummy attribute, and it's working fine :)

So i keep the second try with  the one flow connection because of the compoundAttribute and i can continue to evaluate the connection with plug == customData for checking if the customAttribute is connected in the compute(). And i don't need to check if the dummy attribute is connected. I can now transfert all what i want in my customAttribute which is very cool for what i need.

Thanks you pshipkov  for the compoundAttribute idea :)

I think it's not the cleanest way but it work fine :)

If anybody have an other idea?



0 0
MPxData custom dependency graph Issue
yes it will work like this, but i would like to store specific things for simplifying the workflow and add custom std<<vector, random etc

0 0
MPxData custom dependency graph Issue
I just tested like this :
Code:

MObject thisNode = thisMObject();
MPlug testPlug (thisNode,p_customData);
if ( testPlug.isConnected() )
{
.....


And it seems to work, only if the out_float is also connected to customNodeB ...
0 0
MPxData custom dependency graph Issue

Hi,
Thanks for the reply.

Yes i am trying to add new dependency graph data, for streamming data between node.

Below a capture of the custom plugin info:
plugInfo.png 

Below an example on the nodeEditor:
nodeAandB.PNG 

Like you can see on the picture :
customNodeA->out_customData is connected to in_customData<-customNodeB.
customNodeB->out_floatData is connected to in_floatData<-customNodeB.

The issue is in the compute() of customNodeA.

When i try to detect if the out_customData output is connected it fail.
But when i try to detect  if the out_floatData output is connected it works.

Below it's what i do in the compute of the customNodeA:

Code:

MStatus status;
if (plug == p_customData )
{
MGlobal::displayInfo(MString(" customNodeA -------> data "));
data.setClean(plug);
}else if (plug == p_floatData ){
MGlobal::displayInfo(MString(" customNodeA -------> float "));
data.setClean(plug);
}else{
return MS::kUnknownParameter;
}
return MS::kSuccess;


Below what i do i nthe initialize() of the computeA:
Code:

  //input  param
  p_inFloat = nAttr.create("in_float", "in_float", MFnNumericData::kFloat, 1.0f);
  nAttr.setMin(0.0f);
  nAttr.setSoftMax(10.0f);
  nAttr.setStorable(true);
  nAttr.setKeyable(true);
  addAttribute(p_inFloat);
  //output customData
    p_customData = tAttr.create("out_customData", "out_customData", customData::id, MObject::kNullObj, &status);
  tAttr.setWritable(false);
  tAttr.setStorable(false);
    status = addAttribute(p_customData);
  // output floatData
  p_floatData = nAttr.create( "out_floatData", "out_floatData", MFnNumericData::kFloat, 0.0 );
  nAttr.setWritable(false);
  nAttr.setStorable(false);
  status = addAttribute(p_floatData);

  attributeAffects(p_inFloat, p_customData);
  attributeAffects(p_inFloat, p_floatData);


I attach to this topic the sourceCode and the compiled mll(maya2016 win) of this example project.

Thanks

 

0 0
MPxData custom dependency graph Issue

Hi,
I am creating custom suite of Node which used custom MPxData.
When i load the plugin in maya and check the plug-in information, i get the correct dependency Nodes: "customNode" and the correct dependency graph data types: "customData".
This data are correctly register in the maya plugin and also in the initialize custom node.

1- In the pluginMain.cpp:
initializePlugin()

Code:

status = plugin.registerData("customData", customData::id, customData::creator);
if (!status) {status.perror("Failed to register 'customData'");return status;}
status = plugin.registerNode("customNode", customNode::id, customNode::creator, customNode::initialize);
if (!status) {status.perror("customNode");return status;}

uninitializePlugin():

Code:

status = plugin.deregisterNode(customNode::id);if (!status) {status.perror("customNode");return status;}
status = plugin.deregisterData(customData::id);
if (!status) {status.perror("Failed to deregister 'customData'");return status;}

2- In the customNode.cpp:
initialize():

Code:

MFnTypedAttribute tAttr;

floatValue = nAttr.create("floatValue", "floatValue", MFnNumericData::kFloat, 1.0f);
nAttr.setMin(0.0f);
nAttr.setSoftMax(10.0f);
nAttr.setStorable(true);
nAttr.setKeyable(true);
addAttribute(floatValue);

p_outData = tAttr.create("outData", "outData", customData::id, MObject::kNullObj, &status);
tAttr.setStorable(false);
tAttr.setKeyable(false);
tAttr.setReadable(true);
tAttr.setWritable(false);
addAttribute(p_outData);

attributeAffects(floatValue, p_outData);

At this point everything seem to working fine, except in the compute() of the customNode.

compute():

Code:

MStatus customNode::compute(const MPlug& plug, MDataBlock& data){
if (plug == p_outData )
{
.....

The line "if (plug == p_outData )", don't return the correct value, it's always false. The p_outData (is connected to an other node)
"plug == p_outData" retrun correct value only when i unplug the p_outData....
I don't understand why, if i replace p_outData in the initialize by an other maya built-in DG data types it's working fine.
I try with MPxData and MPxGeometryData but i have the same issue.
If somehone have an idea it will be very helpfull, it's hard to find some example on internet about the MPxData.

Thanks

0 0
procedural node project c++
thanks.
Yes i will put the bin on the web. Need to finish, test and improve few things first
0 0
procedural node project c++

viki164 give me the idea to mix this plug with the openvdb suite from besha1.
Here some test:
mixing worley and a turbulence:
ovdb.PNG 

modulate worley by curve:
ovdb2.PNG 
simple turbulence:
ovdb3.PNG 

1 0
procedural node project c++
Ok for the fluid i will look onto a custom fluid emitter.  New things to learn and to test :) But first i will focus on finish the mesh part.

Ok for the multithread, the problem is that the anly thing that i do with th MFn class is the distanceTo and closestPoint and i can do this outside of the multithread part.

I will share the tools on this post directly soon, need to fix few things before
0 0
procedural node project c++
Just finished the modulate node.
node.PNG 

This node can drive position, curve or mesh. The computed distance can be smooth or expand.

Below few exemple:
curve:
curve.PNG 

locator:
trnslate.PNG 

mesh:
mesh.PNG 

All node are multihread. Except the modulateNode when curved is used as input, i need to disable the multithreading. I don't know why, my maya crash when i use an MFnNurbsCurve Class. Anybody have an idea? I have no crash with MFnMesh class.
0 0
procedural node project c++
Thanks :)
Yes i plan to do free public release but first i have to finish few things first. Or if someone is intereted to test the current version, just ask :)
1- New node which allow to modulate the noise with mesh,curve and position (closest to be done)
2- A way to inject the flow into particle

I am not very proud on how i inject the procedural into fluid. Currently i used a fluid cache and modulate it with the node before reinject into the fluidShape:
Capture.PNG 

Few other picture of the workflow on a mesh:
exempleWorkflow2.PNG 
turbulenceB.PNG 
turbulenceD.PNG 

Rock procedural experiment (with a polysmooth as input, in a way to increase the noise quality when procedural noise are set) :
rock.PNG 



0 0
procedural node project c++

Hi all,

I present a new project that i am working on. So any critic or comment are welcome.
This project is in my head since a lot of time so i finally decided to do it :)
Ok it's possible to do this with this kind of stuff with the sOup node but it's a good way for me to test and learn stuff.

This is a little suite of nodes for making procedural onto mesh ( work also with cached fluid ).
My goal is to produce a suite of node that allow the user to mix and create different kind of noise.

The workflow is simple:
1-init mesh point position
2-doing procedural stuff via mixing noise, modify, modulate etc
3-inject result into a deformer (position and/or color)

exempleWorkflow.PNG  exempleWorkflow3.PNG 

Currently the plugin is composed of the following nodes:

init:
This node init the input mesh or the voxel size and return position and normal.


worley:
This node is an implementation of the worley voronoi noise (euclidian, euclidian squared, manhattan, chebychev, minkowski exp 0.5, minkowski exp 4 )
See screen below:
worley.PNG 


turbulence:
This one is an implementation of various perlin derivative noise (turbulence, fbm, billowy, ridged, inigo quilez, mountain, flow noise )
See screen below:
turbulence.png

util:
This node allow different kind of operation onto the procedural flow. See screen below:
util.PNG  

displace:
This node can be use to displace the position of the mesh before being plug into a noise node.

color:
This node remap the procedural noise onto a color ramp.

deformer:
This node is the final which get the procedural and color flow.

Below few quick exemple done on a sphere (subdiv 500x500) with only one noiseNode (turbulence or worley) :
1.PNG  2.png  3.png 
4.png  5.png  6.png 
7.PNG  8.PNG  9.PNG 

quick other exemple on fluid:
fluid1.png     fluid4.png 
fluid2.png  fluid3.PNG 

1 0
rbfSuite Node
Yes this tools is available on gumroad : https://gumroad.com/julien

0 0
rbfSuite Node
Thanks.
Yes you can reproduce some of the exemple present in the video with the attribute transfer node.
But my first goal here was to provide a suite of node in a way to simply the process for different kind of situation based on distance interpolation.


The rbf suite is not a deformer but a suite of node:
jsRBF_simpleNode (node)
jsRBF_weightNode (node)
jsRBF_particleNode (node)
jsRBF_deformer  (deformer)
jsRBF_morpher  (deformer)
jsRBF_rbfToSkinCluster (command)

My second goal was to produce something in c++ which i can translate into shading process (not include in this suite):





1 0
count post selected

Add a Website Forum to your website.