MoI discussion forum
MoI discussion forum

Full Version: Parametric design in MoI?

Show messages:  1-16  …  317-336  337-356  357-376  377-396  397-416  417-436  437-456  …  897-912

From: Frenchy Pilou (PILOU)
18 Sep 2016   [#377]
Red star! ;)
From: Max Smirnov (SMIRNOV)
19 Sep 2016   [#378]
Today evening I rewrote all nodes except arrays. I'm very impressed with the results.


From: Frenchy Pilou (PILOU)
19 Sep 2016   [#379]
Yes you can! Bravo!
From: mkdm
19 Sep 2016   [#380] In reply to [#378]
Hi Max,

...very promising results!

> Today evening I rewrote all nodes except arrays.

Does it mean that you are not going to add any new features to PointArray ?
For example : programmatic ways to specify the iteration order, or parameters to specify start,end,step,
or the possibility to map every array element to a generic tag object (IMHO this would be a very powerful feature, for example link an array element with a
GeometryFactory Subclasses).

Etc...etc...

I hope you have the time and and desire to do it.

Ciao!

- Marco (mkdm)
From: Max Smirnov (SMIRNOV)
19 Sep 2016   [#381] In reply to [#376]
>Some times ago, when you developed the excellent SubDiv scripts, if I remember correctly, you said that one day you'd add the ability to accept surfaces with more then 4 edges. Do you think to upgrade SubDiv script in order to give it that feature ?

Hi Marco,
I have no plans to continue developing of the Subdiv script this year. Maybe later.

>Does it mean that you are not going to add any new features to PointArray ?
I will add a new features, but not now.
From: mkdm
19 Sep 2016   [#382] In reply to [#381]
Ok Max.

Thanks for the clarifications.

Ciao!

- Marco (mkdm)
From: Max Smirnov (SMIRNOV)
21 Sep 2016   [#383]
Yes! I did it! :)
In this version I replaced "number" type with "numarray". Nodeeditor now uses only three types of data: objectlist (built-in moi type, in fact it's object array), point/frame array, number array.
Now you can send multiple values to each node input.
For example, you can create Circle node and set radius "10,15,33", and you will get three circles(use "," as array separator and "." as decimal separator).
Or create Point node and set X "0,2,4", Y "0,3,6", Z "0,5,10". In this case nodeeditor will process all arrays simultaneously. You will get three points(x,y,z): (0,0,0) (2,3,5) (4,6,9)
Also you can set arrays with a different lengths. In this case the arrays can be processed with different methods. Right now I implemented two methods "Long" and "Short"
This picture will help you to understand how it works.

Later I'll add Cross and Interpolation modes. But first I need to make "resize/interpolation" node.
Also I need to make Range slider node because some nodes uses arrays as range settings.
From: mkdm
21 Sep 2016   [#384] In reply to [#383]
Hi Max!

I'm very glad to read this your post! :)

Finally now I can rewrite and finish all my utility nodes.

Tomorrow i will start to test your new NodeEditor.

Thanks a lot and good night!

- Marco (mkdm)
From: Frenchy Pilou (PILOU)
21 Sep 2016   [#385]
Variable geometry! :)

French version of the Manual! ;)
http://moiscript.weebly.com/elephant-systegraveme-nodal.html


From: Max Smirnov (SMIRNOV)
22 Sep 2016   [#386] In reply to [#385]
Hi Pilou

It seems you've got duplicated arrays. Is that bug?
From: Max Smirnov (SMIRNOV)
22 Sep 2016   [#387]
Short mode bug fixed
From: Frenchy Pilou (PILOU)
22 Sep 2016   [#388] In reply to [#386]
:)
I have just launch the script! ;)
I see that was advantageous! :D
From: Max Smirnov (SMIRNOV)
22 Sep 2016   [#389] In reply to [#388]
I can't reproduce this bug. It looks like you accidentally pressed Apply button.
From: Frenchy Pilou (PILOU)
22 Sep 2016   [#390] In reply to [#389]
Surrely because I relaunch Moi and all works fine! ;)
From: Frenchy Pilou (PILOU)
22 Sep 2016   [#391]
Can i start translations of new nodes or I must wait some other updates?

PS I suppose this can be made ?

From: Karsten (KMRQUS)
22 Sep 2016   [#392] In reply to [#383]
Hello Max,

thanks for sharing this great work. I've started to study your changes and saw there are a lot. I think it will take a while, until I understand all the improvements. I've tested also some of my old nodes without number inputs and they all seems to work:-) Only the pushFrame has still the rad/deg conversion problem?

Thanks a lot and have a nice day
Karsten
From: Max Smirnov (SMIRNOV)
22 Sep 2016   [#393] In reply to [#392]
Hi Karsten,

>Only the pushFrame has still the rad/deg conversion problem?
I've forgot about this. Fixed. :)

>I think it will take a while, until I understand all the improvements.
Most noticable change is processInOut function. I'll explain how to use it.
From: mkdm
22 Sep 2016   [#394] In reply to [#393]
Hi Max,

> Most noticable change is processInOut function. I'll explain how to use it.

Explanations will be much appreciated. Thanks.

- Marco (mkdm)
From: Max Smirnov (SMIRNOV)
22 Sep 2016   [#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);

From: Max Smirnov (SMIRNOV)
22 Sep 2016   [#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.

Show messages:  1-16  …  317-336  337-356  357-376  377-396  397-416  417-436  437-456  …  897-912