MoI discussion forum
MoI discussion forum

Full Version: Node Wish List

Show messages:  1-18  …  239-258  259-278  279-298  299-318  319-338  339-358  359-378  …  419-425

From: MO (MO_TE)
15 Mar 2023   [#299] In reply to [#298]
Hi Wayne

I couldn't find the second part of your modification in my "main.js" file:
"LGraphCanvas.prototype.renderInfo = function (ctx, x, y)"

So I just added the first part and it worked.
Thank you
From: wayne hill (WAYNEHILL5202)
16 Mar 2023   [#300] In reply to [#299]
Hi Mo,

It is located about line 3891 in the original source code. No real need to comment it out, but good practice to eliminate duplicates.

Here is another modification to try out:

On the Node Editor:

To have the Save function use the current file as the save file instead of typing it in everytime:

On the 'editor.js' file location:

code:
Editor.prototype.onSaveButton = function ()
{
	if (this.graph.blocked) return;
	var saveFilePath = moi.filesystem.getSaveFileName( lang.getTranslation('Save as')+' ..',  lang.getTranslation('MoI Nodeeditor files')+' (*.nod)|*.nod' );
	if ( !saveFilePath ) return false;
	if ( this.graph.status !== LGraph.STATUS_STOPPED ) this.onPlayButton();
	var file = moi.filesystem.openFileStream( saveFilePath, 'w' );
	file.writeLine(LiteGraph.JSONprettify(this.graph.serialize(), {"indent":"	", 'maxLength':150}));
	file.close();
	this.graph.filename = saveFilePath;
	this.graph.setDirtyCanvas(true,true);
}


Change the second line:

code:
	var saveFilePath = moi.filesystem.getSaveFileName( lang.getTranslation('Save as')+' ..',  lang.getTranslation('MoI Nodeeditor files')+' (*.nod)|*.nod' );


To:

code:

Editor.prototype.onSaveButton = function () {
.
  // wjh 4-19-2022
	var saveFilePath = moi.filesystem.getSaveFileName(lang.getTranslation('Save as') + '..', lang.getTranslation('MoI Nodeeditor files') + ' (*.nod)|*.nod',lang.getTranslation(this.graph.filename));
.
.
}


From: MO (MO_TE)
16 Mar 2023   [#301] In reply to [#300]
Thank you for these cool modifications.

You are right.
search didn't work because of extra whitespaces .
LGraphCanvas.prototype.renderInfo = function (ctx, x, y)
LGraphCanvas.prototype.renderInfo = function( ctx, x, y )

Now I find it. :)

I usually prefer to have different versions of same node, But I gave it a try.
I added your modification as you showed, but couldn't see any difference.("save as" window pops up with empty name field)


Anyways, I change your code a bit.
Now if you press the save button and alt key , it saves on existing node file without confirmation.
otherwise works like before.
code:
Editor.prototype.onSaveButton = function (e)
{
	if (this.graph.blocked) return;
	var saveFilePath="";
	// var saveFilePath = moi.filesystem.getSaveFileName( lang.getTranslation('Save as')+' ..',  lang.getTranslation('MoI Nodeeditor files')+' (*.nod)|*.nod' );
	// if (e.altKey) {saveFilePath = moi.filesystem.getSaveFileName(lang.getTranslation('Save as') + '..', lang.getTranslation('MoI Nodeeditor files') + ' (*.nod)|*.nod',lang.getTranslation(this.graph.filename));}
	
	if (e.altKey) {saveFilePath = lang.getTranslation(this.graph.filename);}
	else {saveFilePath = moi.filesystem.getSaveFileName( lang.getTranslation('Save as')+' ..',  lang.getTranslation('MoI Nodeeditor files')+' (*.nod)|*.nod' );}

	if ( !saveFilePath ) return false;
	if ( this.graph.status !== LGraph.STATUS_STOPPED ) this.onPlayButton();
	var file = moi.filesystem.openFileStream( saveFilePath, 'w' );
	file.writeLine(LiteGraph.JSONprettify(this.graph.serialize(), {"indent":"	", 'maxLength':150}));
	file.close();
	this.graph.filename = saveFilePath;
	this.graph.setDirtyCanvas(true,true);
}

From: James (JFH)
1 Apr 2023   [#302] In reply to [#299]
MO,

Your Curves2/ConnectPoints node is very similar to Wayne's Points2/PtsInRange.
Indeed the output is identical with a "Max Links" setting of 4 or greater & "DistRange" minimum of 0. See below

The facility to generate lines within a range could be added with a dropdown selection as shown above so on "DistRange (min, max)" the "Distance" input would read 2 comma separated numbers.

Perhaps a better, more logical alternative would be to have instead 2 distance inputs: "distMin" & "distMax" with defaults of 0 & 1 respectively. In that way it would operate exactly as it does presently if no connection is made to "distMin" input.

James
https://www.instagram.com/nodeology/

PS I have replied here, in this thread, because the thread " things about MOI3D that you learn by teaching it." seems a peculiar location for submitting new node contributions. In the interest of accessibility of new nodes to latecomers & infrequent visitor to the forum, we should probably avoid scattering new node submissions across various different threads. This thread & "Nodebundle for playing with nodes" are the 2 established repositories of NE's expanding library of new nodes

Image Attachments:
connectPts.jpg 


From: MO (MO_TE)
1 Apr 2023   [#303] In reply to [#302]
Hi James
It seems once again I've reinvented the wheel. :)
Although I don't have the "Points2/PtsInRange" node in my NE package.
I changed the "ConnectPoints" node, now it has a range mode.

I get your point about threads.
I'll try to post in related threads.
From: James (JFH)
3 Apr 2023   [#304]
NODE PROPOSAL: srfNormals

The means of illustrating the surface orientation by displaying normals would offer great utility when working with nodes.
For instance extruding can sometimes give unexpected results due to false assumption of the orientation of faces.

Michael introduced functions for evaluating surface normals by scripts with v4 beta:
face.evaluateNormal( uv ) : Function that evaluates a uv parameter value and returns a normal vector.
I'm not sure whether Michael has builtin a normal vector display or whether it needs to be displayed as per existing vector nodes

See the full list of surface evaluation functions here:
http://moi3d.com/forum/lmessages.php?webtag=MOI&msg=9547.21

Another useful feature would be the inclusion of the facility to unify normals across a polysurface.
Disregard sentence above. Also see link suggested by Michael below:
http://moi3d.com/forum/index.php?webtag=MOI&msg=7777.1620

James
https://www.instagram.com/nodeology/

Image Attachments:
srfNormals.jpg 


From: Michael Gibson
4 Apr 2023   [#305] In reply to [#304]
Hi James, for the display check out here:
http://moi3d.com/forum/index.php?webtag=MOI&msg=7777.1620

That 'arrow3d' factory will make an annotation leader object with the property set on it for rotating the arrowhead plane so it's always facing the viewer. Should be good for a vector direction display.

re:
> Another useful feature would be the inclusion of the facility to unify normals across a polysurface.

This should happen automatically - when surfaces are joined together they should evaluate normals on a consistent side which will be to the exterior if it's a solid.

- Michael
From: James (JFH)
4 Apr 2023   [#306] In reply to [#305]
Michael, thank you for your reply.
quote:
This should happen automatically - when surfaces are joined together

Yes I misspoke, I should have said selected surfaces from separated polysurfaces.

Is there a way to ensure that faces remain unified after separating a solid object?
If you look at example below: the half the faces flip after Dodecahedron is separated as demonstrated by the direction of extrusions.


James
https://www.instagram.com/nodeology/
From: Michael Gibson
4 Apr 2023   [#307] In reply to [#306]
Hi James,

re:
> Is there a way to ensure that faces remain unified after separating a solid object?

I think that is supposed to be happening automatically already, can you please post your Dodecahedron so I can take a look?

- Michael
From: James (JFH)
4 Apr 2023   [#308] In reply to [#307]
Sorry Michael, again I got that wrong. The extrude node was set to "Long"; while the extrusion works as expected in "Union" mode.

However, the issue I have had previously, as it turns out, is not with the maintenance of face normals after separation but rather it seems, a limitation of extrude factory.

If you apply extrude to attached polyhedron (regardless whether separated or not) the extrusions does not conform to face normals, instead they're unidirectional.
I am hoping that the facility to show normals in NodeEditor may be step towards solving this issue.

Sorry again, I should have looked deeper before claiming that the issue was related to surface normals.
Great job with the latest BETA,
James
https://www.instagram.com/nodeology/

Attachments:
truncIcosohedron.3dm


From: Michael Gibson
4 Apr 2023   [#309] In reply to [#308]
Hi James,

re:
> If you apply extrude to attached polyhedron (regardless whether separated or not) the
> extrusions does not conform to face normals, instead they unidirectional.

It's because the surfaces are not planar. They are degree 1 surfaces with 4 corner points but the 4 points are not all on one plane.

You could do something like evaluate a surface normal at the middle of parameter space and use that as the extrusion direction, but the regular Extrude command will only extrude each piece along a separate individual direction if the piece that's being extruded is planar.

- Michael
From: James (JFH)
4 Apr 2023   [#310] In reply to [#309]
Thanks Michael,
quote:
You could do something like evaluate a surface normal at the middle of parameter space and use that as the extrusion direction

Yes this is exactly the method I desire to recreate with nodes, and the principal reason for "NODE PROPOSAL: srfNormals" above.

Thanks for clarifying this.
James
https://www.instagram.com/nodeology/
From: MO (MO_TE)
4 Apr 2023   [#311]
I studied the links James posted earlier.
There is something I couldn't understand:
"face.evaluateNormal( uv )" function returns the surface normal on given "uv" value, right?
According to :
https://moi3d.com/forum/lmessages.php?webtag=MOI&msg=9547.25
There is no function that returns the surface "uv" value,
So I don't know what "uv" value should look like.
what is "uv" parameter type?
I tried to set the "uv" value with array numbers [0.5,0.5],also I tried to set points as "uv", but that didn't work either.

With "face.planarFrame" property I managed to get normals of planar surfaces
This property uses the "untrimmed" version of the surface
And normal appears on the corner of the "untrimmed" surface.

From: Michael Gibson
4 Apr 2023   [#312] In reply to [#311]
Hi MO, the uv can be any object that has .x and .y properties on it. You can use a 3D point for it where you've just stored the x and y values, the z value will just be ignored.

The actual x and y (usually referred to as u and v when being used in parameter space) values you use should be in the uv rectangle for the surface's parameter range.

The lower left corner of the surface's parameter range is on a .domainMin property on the face, and the upper right corner of the surface's parameter range is on a .domainMax property on the face. Each of those face.domainMin and face.domainMax properties will give back a 2d point object with x and y values.

If you want something in the center of the parameter range you could do x = (face.domainMin.x + face.domainMax.x)/2 and y = (face.domainMin.y + face.domainMax.y)/2 .

- Michael
From: MO (MO_TE)
5 Apr 2023   [#313] In reply to [#312]
Thank you for your helpful answer Michael
I wasn't aware that "evaluateNormal()" function returns direction of the normal, not the normal itself.
This was the tricky part.
I took James' idea and took it further.
The results are satisfying. :)




Although, I had a problem on some extruded surfaces.
I extruded an "S shape" curve, and this is the result:



After rebuilding the surface with the network command problem solved.
From: Michael Gibson
5 Apr 2023   [#314] In reply to [#313]
Hi Mo,

re:
> Although, I had a problem on some extruded surfaces.
> I extruded an "S shape" curve, and this is the result:

Stepping by even distance amounts in parameter space does not necessarily yield even distances in 3D space, the parameter space may be squished or stretched in relation to 3D space. For an extrusion if you had uneven spacing in the control points of the curve being extruded that will have that type of squishing or stretching in it.

A rebuilt curve will have what is called an "arc length parameterization" which means the parameter space is in sync with 3D distances. The Network solved it because it implicitly does a rebuild on its input curves. If you ran Rebuild on your curve before extruding it that would also do it.

- Michael
From: MO (MO_TE)
5 Apr 2023   [#315] In reply to [#314]
Thank you
you are right, rebuilding the curves solves the problem as well.
From: Frenchy Pilou (PILOU)
6 Apr 2023   [#316]
You have also some info about orientation of a surface(s) in Dispersion Script(s) by Max Smirnov! ;)
http://moi3d.com/forum/index.php?webtag=MOI&msg=6486.1

https://moi3d.com/download/scripts/max/vSpray.v.1.1.2014.01.27.zip
https://moi3d.com/download/scripts/max/vSeed.v.1.2.2014.02.05.zip
https://moi3d.com/download/scripts/max/vDrop.v.1.0.2014.01.28.zip
https://moi3d.com/download/scripts/max/vOrientFast.v.1.0.2014.01.28.zip
https://moi3d.com/download/scripts/max/vOrient.v.1.0.2014.01.28.zip
https://moi3d.com/download/scripts/max/vClone.v.1.0.2014.01.26.zip



Only surface by surface!

From: wayne hill (WAYNEHILL5202)
8 Apr 2023   [#317] In reply to [#315]
Hi Mo,

Nice progress on the Normals Node. I attempted it a while back with no success. Will be watching for updates.

Wayne
From: MO (MO_TE)
8 Apr 2023   [#318] In reply to [#317]
Hi Wayne
It's almost done, although I couldn't figure out some problems. (Like Invert mode)
I'll be happy if you or someone else can improve it. :)
I'll post it soon.

Show messages:  1-18  …  239-258  259-278  279-298  299-318  319-338  339-358  359-378  …  419-425