Parametric design in MoI?
 1-14  …  355-374  375-394  395-414  415-434  435-454  …  895-912

Previous
Next
 From:  Max Smirnov (SMIRNOV)
7713.395 
Just finished my supper :) Now I'm ready to explain how to write nodes for the last version of nodeeditor.

this is an example. check the comments
code:
function Star() // let's make a new node
{
	this.addInput("Center","pointarray");		// input 0, type: pointarray
	this.addInput("Radius","numarray");		// input 1, type: numarray. In fact it's just a common numeric array like [1,2,3,4,5]
	this.addInput("Ratio","numarray");		// input 2, type: numarray
	this.addInput("Sides","numarray");		// input 3, type: numarray
	this.addOutput("Out","objectlist");		// output 0, type: objectlist
	this.properties = { mode:["Long","Long","Short"], radius:[1], ratio:[0.4], sides:[5] };
	// each node has two types of properties. both of them will stored when you save a .nod file, or clone a node
	// there  are only one difference: .properties is shown in nodeinfo panel and .internal is hidden
	// string arrays like mode:["Long","Long","Short"] will be processed as a droplist. First value "Long" points to selected value. Other ones is available values: "Long", "Short".
	// numeric arrays will be processed as numarrays
}

Star.title = "Star";	// default title
Star.desc = "Star";	// legacy litegraph parameter. At the moment I don't use it.

Star.prototype.onExecute = function()	// this function will run on node execution command
{
	var data = this.processInOut(this.properties.mode[0], this.multiProcess, null, this.properties.radius, this.properties.ratio, this.properties.sides);
	// .processInOut function processes input arrays and creates output arrays
	// first parameter: (string) array processing mode. 
	// modes supported:
	// Short, Long as described above in my post
	// Short+, Long+ same as  Short, Long, but objectarray will be processed as one element
	// Long# same as Long, but pointarray will be processed as one element
	// second parameter: callback function which will be called for processing of each value set (important!)
	// other parameters is optional. it's a default values for each input, which will be used if the input is not connected
	// you may skip it or set it to null. in this case processInOut function will generate default value automatically.
	// autovalue for numarray: [0]
	// autovalue for pointarray: (0,0,0)
	// autovalue for objectlist: empty objectlist
	// if you want to use another values, you need to set them directly like in this example:
	// null - autovalue(0,0,0),  this.properties.radius - [1],  this.properties.ratio - [0.4],  this.properties.sides - [5]
	
	// this function returns structure { inputs:[ input0, input1, ... input n], outputs:[output0, output1, ... output n]}
	// input0, input1, ... input n  - if the input connected, it wil return connected node data
	// output0, output1, ... output n  - returns concated output data generated by callback function for each output
	
	this.properties.radius = data.inputs[1];  // you can update properties values if input data is changed
	this.properties.ratio = data.inputs[2];
	this.properties.sides = data.inputs[3];
	this.setOutputData(0, data.outputs[0]); // set node output data
}

Star.prototype.multiProcess = function(center, r, rt, s) // callback function which will be called for processing of each value set (center = input0, r = input1, rt = input2, s = input3)
{
	// object array data will be sent as objectarray with one object (except Long+ Short+ modes)
	// point array data will be sent as pointarray with one object (except Long# mode)
	// numarray data will be sent as number
	
	var frame = center.getFrame();  // center.getFrame() = center.getFrame(0);
	return [factory( 'polygonstar', frame, frame.evaluate( 0, r, 0 ), s, frame.evaluate( 0, r*rt, 0 ))];
	// this function should return array [ output0, output1, ... output n ]
	// return [factory( 'polygonstar', frame, frame.evaluate( 0, r, 0 ), s, frame.evaluate( 0, r*rt, 0 ))] 
	// is the same as
	// var outputs = [];
	// outputs[0] = factory( 'polygonstar', frame, frame.evaluate( 0, r, 0 ), s, frame.evaluate( 0, r*rt, 0 ));
	// return outputs;
	// if node has more than one output you nned to set outputs[1], outputs[2] .. etc
	// correct output[n] data is objectlist / pointarray / number
}

LiteGraph.registerNodeType("Curves/Star", Star);
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Max Smirnov (SMIRNOV)
7713.396 
Frenchy Pilou
>Can i start translations of new nodes or I must wait some other updates?
No need to wait, you can start now

>PS I suppose this can be made ?
I can't implement this using current javascript api. Let's wait until Michael release MoI v.4.
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Frenchy Pilou (PILOU)
7713.397 In reply to 7713.396 
So maybe tomorrow! :)
And wait & see 4
---
Pilou
Is beautiful that please without concept!
My Gallery
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Karsten (KMRQUS)
7713.398 In reply to 7713.395 
Hello Max,

many thanks for the commented example. The important information for me at first is the automatic assignment of the sequence of the inputs to the parameters sequence of the callback, I supposed that, but I was not shure.
(// callback function which will be called for processing of each value set (center = input0, r = input1, rt = input2, s = input3) )
Am I right, that I can also direct access to the elements of a numarray with [] ? I can't find a explicit definition of that type!?

Have a nice evening
Karsten

p.s.: Incredible what is possible!
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Max Smirnov (SMIRNOV)
7713.399 In reply to 7713.398 
Karsten
>Am I right, that I can also direct access to the elements of a numarray with [] ?
Yes, you can access any element. It's just an array like [1,2,3,4,5].
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  mkdm
7713.400 In reply to 7713.395 
Hi Max,

Thanks a lot for the little tutorial. Much appreciated.

When I used previous versions of Project Elephant, I needed to comb through the code many times to understand the businnes logic...

I'm going to transfer this new logic into my old nodes.

Good night!

- Marco (mkdm)
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  speedy (AL2000)
7713.401 In reply to 7713.400 
Hello
My Friends I are in confusion.............
I started using Elephant, and I uploaded some applications....
Now, I post pictures of my ui
where you see what I've uploaded ...

Considering the last release of the legendary Max
the question is;
What should I charge, to have the updated features, I can add
that load in my Node Editor without removing what is already
..... or , do I have to remove everything, and in this case what should I enter

I await yours suggestion
regards
al

sorry for my bad English, I hope
I understand my problem















  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Karsten (KMRQUS)
7713.402 In reply to 7713.401 
Hello Al,

it seems that you use a very old version of the Elephant.(Date 2015). So you should rename your nodeeditor folder to e.g. nodeeditor-old. Than extract the archive and rename the folder nodeeditor.0.77.a to nodeeditor. Copy the folder to /ui of your Moi installation. Your node-files will not work with the new version - if you need them, you can change or dublicate your shortcut-key and can use them also.

Have a nice day
Karsten
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Frenchy Pilou (PILOU)
7713.403 
It's me or there is no "a" on the N° 0.77a of the last Elephant ?

---
Pilou
Is beautiful that please without concept!
My Gallery
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Frenchy Pilou (PILOU)
7713.404 
@Max : here the lang.js (0.77a) If you can add this part in your futur version (s) that will help me for avoid to reload numerous old versions! :)
http://moiscript.weebly.com/uploads/3/9/3/8/3938813/lang.js

Maybe there is somewhere in Sub- menus, ... something other to translate ?

French version of the Nodes! :)

EDITED: 23 Sep 2016 by PILOU

  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  speedy (AL2000)
7713.405 In reply to 7713.402 
Hi Karsten
Many Many Many....Thanks for your indication
Now Ok - Work fine
best
al
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Max Smirnov (SMIRNOV)
7713.406 
v.0.80
Added function updateThisNodeGraph. This function updates node graph without canvas reloading.
Knob, Slider and Output nodes has been rewritten. Now they use updateThisNodeGraph. Significant interface performance boost!
Fixed pointArray.pushFrame deg/rad bug
Changed node connections (lot of graphical changes)
Arrays group renamed to Points

Due lack of time I didn't tested all new graphical features well. Send me a message if you find glitches and bugs.

EDITED: 7 Mar 2022 by SMIRNOV

  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Karsten (KMRQUS)
7713.407 In reply to 7713.406 
Hello Max,

thanks for the update, but I have some problems to get it to run. It seems that arrays.js is missing - as file and as link in index.html!?

Have a nice evening
Karsten

p.s.: Adding from 0.77a fixed it:-)

EDITED: 25 Sep 2016 by KMRQUS

  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Max Smirnov (SMIRNOV)
7713.408 In reply to 7713.407 
Hi Karsten,
I've renamed Arrays section to Points in the last version.
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Karsten (KMRQUS)
7713.409 In reply to 7713.408 
Hello Max,

thanks for the reply. Ok, I understood! And now I see you mentioned it! I've tested the example.0.77 and get some errors, so I fixed it in the wrong way.

Have a nice evening
Karsten
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Frenchy Pilou (PILOU)
7713.410 
v 0.8 with example 0.77a
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Max Smirnov (SMIRNOV)
7713.411 
Dear friends, don't use .nod from the old beta version. And don't use old .js files.
This software still in developing. I'm changing nodes, variables, logic, names.
I'll think about back compatibility after v.1.0 release only.

EDITED: 7 Mar 2022 by SMIRNOV

  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Max Smirnov (SMIRNOV)
7713.412 
Bug found in Slider and Knob nodes. Please update interface.js

EDITED: 7 Mar 2022 by SMIRNOV

  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Frenchy Pilou (PILOU)
7713.413 In reply to 7713.412 

EDITED: 26 Sep 2016 by PILOU

  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  speedy (AL2000)
7713.414 In reply to 7713.413 
Dear friends
can someone explain to me the features
(Points Math) with some example ..
something is simple ..... but other features
they are unknow for me-
I upload a starting file......
Many thank
al
Attachments:

  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged
 

Reply to All Reply to All

 

 
Show messages:  1-14  …  335-354  355-374  375-394  395-414  415-434  435-454  455-474  …  895-912