Mirror Matrix
-
clintonman
- Captain
- Posts: 5659
- Joined: 21 May 2009, 21:08
- Type the number ten into the box: 0
- Location: California
Mirror Matrix
New mirror tool that operates on the item matrix.
The built in mirror tool is a modeling tool so only effects the vertices of an object.
This Mirror Matrix tool operates on the matrix of an object as well as the vertices. This tool can be used with cameras and lights.
Another difference is that this tool will only mirror across the major XYZ axes and not an arbitrary plane like the modeling mirror tool.
Mirror Matrix script can be found about 1/3 way down on this page:
http://clintons3d.com/plugins/truespace ... index.html
Edit: Re-uploaded with a forgotten copy option and fixed typo in the installer messaging
All cubes mirrored across the x axis. All cubes on the left are the mirrored result. All cubes on the right are the original cubes. The effect can be seen with the new object centered nav widget. The cage widget shows the selected cubes. Orange more or less indicates the rotation center.
Far cube has a pivot - the pivot and mesh center(orange) did not mirror, only the vertices mirrored
Middle cube has no pivot - mesh center(orange) did not mirror
Near cube was Matrix Mirrored - matrix and mesh center mirrored succesfully
The built in mirror tool is a modeling tool so only effects the vertices of an object.
This Mirror Matrix tool operates on the matrix of an object as well as the vertices. This tool can be used with cameras and lights.
Another difference is that this tool will only mirror across the major XYZ axes and not an arbitrary plane like the modeling mirror tool.
Mirror Matrix script can be found about 1/3 way down on this page:
http://clintons3d.com/plugins/truespace ... index.html
Edit: Re-uploaded with a forgotten copy option and fixed typo in the installer messaging
All cubes mirrored across the x axis. All cubes on the left are the mirrored result. All cubes on the right are the original cubes. The effect can be seen with the new object centered nav widget. The cage widget shows the selected cubes. Orange more or less indicates the rotation center.
Far cube has a pivot - the pivot and mesh center(orange) did not mirror, only the vertices mirrored
Middle cube has no pivot - mesh center(orange) did not mirror
Near cube was Matrix Mirrored - matrix and mesh center mirrored succesfully
-
trueBlue
- Captain
- Posts: 5548
- Joined: 06 Jul 2009, 22:50
- Type the number ten into the box: 10
Re: Mirror Matrix
Can you explain how to use this Mirror Matrix script with a simple unmodified trueSpace primitive Cube?
One of the things that I do not understand is why the selected Cube is moved and not the copied object.
One of the things that I do not understand is why the selected Cube is moved and not the copied object.
-
clintonman
- Captain
- Posts: 5659
- Joined: 21 May 2009, 21:08
- Type the number ten into the box: 0
- Location: California
Re: Mirror Matrix
From the website:trueBlue wrote: 25 Mar 2020, 14:42 Can you explain how to use this Mirror Matrix script with a simple unmodified trueSpace primitive Cube?
One of the things that I do not understand is why the selected Cube is moved and not the copied object.
"Select a scene item then choose an axis and press the Mirror button. "
To keep it as a cube primitive you would uncheck "Mirror Mesh Vertices"
The object is copied and the original object is mirrored. The trueSpace copy command does not select the copied item so the original is mirrored.
-
trueBlue
- Captain
- Posts: 5548
- Joined: 06 Jul 2009, 22:50
- Type the number ten into the box: 10
Re: Mirror Matrix
I actually experimented with that.
It is possible to select the copied object.
If I then change sel to copy for the rest of your code following the Copy command, it does seem to work.
If I do not use
MeshModifiers.InvertSelection('')
in your Flip Normals script, I do not get hidden faces copied object rotated to show hidden faces
It is possible to select the copied object.
Code: Select all
var sel = Node.FirstSelected()
var copy = Node.Copy(sel, Node.Owner(sel))
Space.Select(copy)If I do not use
MeshModifiers.InvertSelection('')
in your Flip Normals script, I do not get hidden faces copied object rotated to show hidden faces
- Attachments
-
- MirrorMatrix.RsObj
- (45.47 KiB) Downloaded 237 times
-
clintonman
- Captain
- Posts: 5659
- Joined: 21 May 2009, 21:08
- Type the number ten into the box: 0
- Location: California
Re: Mirror Matrix
If you do that then you should probably also change the general copy button and the modeling mirror copy button so they're all consistent.trueBlue wrote: 25 Mar 2020, 17:39 I actually experimented with that.
It is possible to select the copied object.If I then change sel to copy for the rest of your code following the Copy command, it does seem to work.Code: Select all
var sel = Node.FirstSelected() var copy = Node.Copy(sel, Node.Owner(sel)) Space.Select(copy)
If I do not use
MeshModifiers.InvertSelection('')
in your Flip Normals script, I do not get hidden faces
HiddenFaces.png
copied object rotated to show hidden faces
-
clintonman
- Captain
- Posts: 5659
- Joined: 21 May 2009, 21:08
- Type the number ten into the box: 0
- Location: California
Re: Mirror Matrix
Update March 25:
bug fixed in the pivot - must flattened the vertices when the object has a pivot
bug shows itself when trying to snap an object to a vertex selection of a mirrored object that has a pivot. It ends up snapping well away from the geometry.
bug fixed in the pivot - must flattened the vertices when the object has a pivot
bug shows itself when trying to snap an object to a vertex selection of a mirrored object that has a pivot. It ends up snapping well away from the geometry.
Code: Select all
MeshModifiers.FlattenAxes('');-
clintonman
- Captain
- Posts: 5659
- Joined: 21 May 2009, 21:08
- Type the number ten into the box: 0
- Location: California
Re: Mirror Matrix
Update November 2020
works with multiple selections
updated the installer
works with the new not yet released nurbs objects
works with multiple selections
updated the installer
works with the new not yet released nurbs objects
-
trueBlue
- Captain
- Posts: 5548
- Joined: 06 Jul 2009, 22:50
- Type the number ten into the box: 10
Re: Mirror Matrix
Default primitive cube that has not been point edited
Mirror Matrix with Mirror Copy & Mirror Mesh Vertices, checked
Mirror X
Answered Yes to edit mesh Besides the error, is this new update PE only?
Mirror Matrix with Mirror Copy & Mirror Mesh Vertices, checked
Mirror X
Answered Yes to edit mesh Besides the error, is this new update PE only?
-
clintonman
- Captain
- Posts: 5659
- Joined: 21 May 2009, 21:08
- Type the number ten into the box: 0
- Location: California
Re: Mirror Matrix
Fixed the error. There was a missing return statement that should have stopped it from getting to the "edit mesh" question.trueBlue wrote: 25 Nov 2020, 18:19 Default primitive cube that has not been point edited
Mirror Matrix with Mirror Copy & Mirror Mesh Vertices, checked
Mirror X
Answered Yes to edit mesh
Mirror Matrix Error.png
Besides the error, is this new update PE only?
No, it's not for PE mode.
-
trueBlue
- Captain
- Posts: 5548
- Joined: 06 Jul 2009, 22:50
- Type the number ten into the box: 10
Re: Mirror Matrix
Thanks!
Why do you get this Alert? It seems that Z is the only one that works like you would expect X & Y just seems to Copy
Can you give a simple example how to use this with a simple Cube?
Why do you get this Alert? It seems that Z is the only one that works like you would expect X & Y just seems to Copy
Can you give a simple example how to use this with a simple Cube?
-
clintonman
- Captain
- Posts: 5659
- Joined: 21 May 2009, 21:08
- Type the number ten into the box: 0
- Location: California
Re: Mirror Matrix
The alert says that the vertices are not directly mirrored. So if you had an asymmetrical shape like the letter "P" it would still be oriented the same way. If it is a mesh the the vertices will be altered so the P is backward after the mirror.trueBlue wrote: 25 Nov 2020, 21:04 Thanks!
Why do you get this Alert?
Cube Mirror X.png
It seems that Z is the only one that works like you would expect
XYZ.png
X & Y just seems to Copy
Can you give a simple example how to use this with a simple Cube?
Move your cubes away from the X=0 and Y=0. It's like above it will mirror but the shape is symmetrical so you can't see it.
-
trueBlue
- Captain
- Posts: 5548
- Joined: 06 Jul 2009, 22:50
- Type the number ten into the box: 10
Re: Mirror Matrix
Ah okay, thank you for the explanation!
Do you see and issue changing the Alerts to Status messages?
I substituted this line in your errorDisplay script,
and added a delayed script that clears the message
Also if you delete an object's Mesh con and run Mirror, the object is still copied
Do you see and issue changing the Alerts to Status messages?
I substituted this line in your errorDisplay script,
Code: Select all
// System.Alert(ErrorList.replace(";", "\n"));
Node.Value("/Status Line", "Model") = ErrorList
-
clintonman
- Captain
- Posts: 5659
- Joined: 21 May 2009, 21:08
- Type the number ten into the box: 0
- Location: California
Re: Mirror Matrix
If you have several items selected the status line will be useless, only the first error will show for sure with the rest cutoff at the end.trueBlue wrote: 25 Nov 2020, 23:32 Ah okay, thank you for the explanation!
Do you see and issue changing the Alerts to Status messages?
I substituted this line in your errorDisplay script,and added a delayed script that clears the messageCode: Select all
// System.Alert(ErrorList.replace(";", "\n")); Node.Value("/Status Line", "Model") = ErrorList
errorDisplay.png
Also if you delete an object's Mesh con and run Mirror, the object is still copied
Now I notice a bug, only the first semicolon is being replaced. Need to change the errorDisplay script lines:
Code: Select all
var semiColonToNewline = /;/g
if(ErrorList) {
//System.Alert(ErrorList.replace(";", "\n"));
System.Alert(ErrorList.replace(semiColonToNewline, "\n"));
}-
trueBlue
- Captain
- Posts: 5548
- Joined: 06 Jul 2009, 22:50
- Type the number ten into the box: 10
Re: Mirror Matrix
Okay, I see.
The change works.
Thanks!
The change works.
Thanks!
-
clintonman
- Captain
- Posts: 5659
- Joined: 21 May 2009, 21:08
- Type the number ten into the box: 0
- Location: California
Re: Mirror Matrix
Update December 2020
Fixes a bug when mirroring scaled objects. The scale was being applied twice because of the mirror process.
Adds support for the upcoming NURBS patches and curves.
I'm releasing this one early because of the scaling bug that was just discovered.
http://clintons3d.com/plugins/truespace ... rrormatrix
Fixes a bug when mirroring scaled objects. The scale was being applied twice because of the mirror process.
Adds support for the upcoming NURBS patches and curves.
I'm releasing this one early because of the scaling bug that was just discovered.
http://clintons3d.com/plugins/truespace ... rrormatrix
-
trueBlue
- Captain
- Posts: 5548
- Joined: 06 Jul 2009, 22:50
- Type the number ten into the box: 10
-
clintonman
- Captain
- Posts: 5659
- Joined: 21 May 2009, 21:08
- Type the number ten into the box: 0
- Location: California
Re: Mirror Matrix
Darn, that one was fixed already. I must have updated the old version of the script.
The bug in the error display is also back.
The bug in the error display is also back.
-
trueBlue
- Captain
- Posts: 5548
- Joined: 06 Jul 2009, 22:50
- Type the number ten into the box: 10
Re: Mirror Matrix
Here is a chance to use the new Copy command too
Does this look correct?
Can you share the script name, line #, and command for the missing return statement?
Does this look correct?
Code: Select all
function CopyMesh(firstSel)
{
if(Node.ConExists(firstSel, "Matrix"))
nurbsNode = Node.Owner(firstSel);
else
nurbsNode = firstSel;
if(Node.ConExists(nurbsNode, "isaCurve")) {
Node.Copy(nurbsNode, Node.Owner(nurbsNode));
Node.ConRemove(nurbsNode, "LE2Data")
return;
}
if(Node.Exists(nurbsNode + "/CP to patch CP")) {
Node.Copy(nurbsNode, Node.Owner(nurbsNode));
Node.ConRemove(nurbsNode, "LE2Data")
return;
}
Node.Copy(firstSel, Node.Owner(firstSel));
Node.ConRemove(firstSel, "LE2Data")
}-
clintonman
- Captain
- Posts: 5659
- Joined: 21 May 2009, 21:08
- Type the number ten into the box: 0
- Location: California
Re: Mirror Matrix
It's in the process of being completely rewritten, so it answer will come later.trueBlue wrote: 07 Dec 2020, 17:42 Here is a chance to use the new Copy command too![]()
Does this look correct?Can you share the script name, line #, and command for the missing return statement?Code: Select all
function CopyMesh(firstSel) { if(Node.ConExists(firstSel, "Matrix")) nurbsNode = Node.Owner(firstSel); else nurbsNode = firstSel; if(Node.ConExists(nurbsNode, "isaCurve")) { Node.Copy(nurbsNode, Node.Owner(nurbsNode)); Node.ConRemove(nurbsNode, "LE2Data") return; } if(Node.Exists(nurbsNode + "/CP to patch CP")) { Node.Copy(nurbsNode, Node.Owner(nurbsNode)); Node.ConRemove(nurbsNode, "LE2Data") return; } Node.Copy(firstSel, Node.Owner(firstSel)); Node.ConRemove(firstSel, "LE2Data") }
-
clintonman
- Captain
- Posts: 5659
- Joined: 21 May 2009, 21:08
- Type the number ten into the box: 0
- Location: California
Re: Mirror Matrix
Re Released
Put the fixes from the previous release back in place
Improved camera and light rotations
When the copy options is used, the copy gets mirrored instead of the original - trueBlue request
Works with group objects
Copied nodes will arrange themselves in the link editor - trueBlue tip
Works with individual members of groups
Put the fixes from the previous release back in place
Improved camera and light rotations
When the copy options is used, the copy gets mirrored instead of the original - trueBlue request
Works with group objects
Copied nodes will arrange themselves in the link editor - trueBlue tip
Works with individual members of groups
-
trueBlue
- Captain
- Posts: 5548
- Joined: 06 Jul 2009, 22:50
- Type the number ten into the box: 10
Re: Mirror Matrix
Great improvements!
If an object is an Editable mesh and Mirror Mesh Vertices is enabled, the Normals get turned inside out. If I change doFlip to false for Editable shape the Normals do not get turned inside out.
Maybe trueSpace bakes the Normal into Editable shapes?
If an object is an Editable mesh and Mirror Mesh Vertices is enabled, the Normals get turned inside out. If I change doFlip to false for Editable shape the Normals do not get turned inside out.
Code: Select all
// if(MirrorVertices && Node.Exists( sel + "/Editable shape")) {
// doFlip = true;
// }
if(MirrorVertices && Node.Exists( sel + "/Editable shape")) {
doFlip = false;
}
-
clintonman
- Captain
- Posts: 5659
- Joined: 21 May 2009, 21:08
- Type the number ten into the box: 0
- Location: California
Re: Mirror Matrix
Thanks, but that's not the problem. NoFlip will just make it so it doesn't mirror the vertices of the mesh which you can't see in a symmetrical shape like a cube. The problem is the new mirror the copy instead of mirror the original. The copy needs to become the selected item for the next steps.
around line 124 of the MirrorStart script add a space select fixes it
around line 124 of the MirrorStart script add a space select fixes it
Code: Select all
if(makecopy) {
sel = CopyMesh(sel);
//arrange new node in the LE
Node.ConRemove(sel, "LE2Data");
Space.Select(sel);
} else {-
trueBlue
- Captain
- Posts: 5548
- Joined: 06 Jul 2009, 22:50
- Type the number ten into the box: 10
-
clintonman
- Captain
- Posts: 5659
- Joined: 21 May 2009, 21:08
- Type the number ten into the box: 0
- Location: California
Re: Mirror Matrix
Fixed inside out mirror of meshes. Hopefully, the last bug fix.
-
trueBlue
- Captain
- Posts: 5548
- Joined: 06 Jul 2009, 22:50
- Type the number ten into the box: 10
Re: Mirror Matrix
Not sure of unknown consequences, but if I copy your Flip Normals script and add it (Flip NormalsAgain) into your scripts, it fixes the Face that has a Flipped Normal (pink)
-
clintonman
- Captain
- Posts: 5659
- Joined: 21 May 2009, 21:08
- Type the number ten into the box: 0
- Location: California
Re: Mirror Matrix
Do you have steps and/or a sample to reproduce the flipped problem?trueBlue wrote: 22 Feb 2022, 23:41 Not sure of unknown consequences, but if I copy your Flip Normals script and add it (Flip NormalsAgain) into your scripts, it fixes the Face that has a Flipped Normal (pink)
Mirror Matrix Face Reversed Normal.png
-
trueBlue
- Captain
- Posts: 5548
- Joined: 06 Jul 2009, 22:50
- Type the number ten into the box: 10
Re: Mirror Matrix
I selected the top Face of the Cube (attached) and pressed the Y button
- Attachments
-
- Cube5d3f.RsObj
- (25.88 KiB) Downloaded 130 times
-
clintonman
- Captain
- Posts: 5659
- Joined: 21 May 2009, 21:08
- Type the number ten into the box: 0
- Location: California
Re: Mirror Matrix
This tool was never meant to be used in point edit mode.
If I modify the code as shown I get:
PE mode 1 face selected then the flipped face gets fixed after pressing the Y button.
PE mode nothing selected then all the faces are flipped after pressing Y.
Object mode also turns the mesh inside out, all faces flipped.
The only case where the change works is if faces are selected. Everything gets turned inside out if points or edges are selected.
If I modify the code as shown I get:
PE mode 1 face selected then the flipped face gets fixed after pressing the Y button.
PE mode nothing selected then all the faces are flipped after pressing Y.
Object mode also turns the mesh inside out, all faces flipped.
The only case where the change works is if faces are selected. Everything gets turned inside out if points or edges are selected.
-
trueBlue
- Captain
- Posts: 5548
- Joined: 06 Jul 2009, 22:50
- Type the number ten into the box: 10
Re: Mirror Matrix
Scratch the flipping normals again. I see that is not going to work
But I did find a solution
After I select the top Face, I use Select Connected, then press one of the X, Y, or Z buttons
But I did find a solution
After I select the top Face, I use Select Connected, then press one of the X, Y, or Z buttons
Code: Select all
MeshModifiers.ApplySelectionTool('/Widgets/Tools/Mesh editor/PE Select tool','apply_cmd:{0502CC2A-7F8C-4d29-BBB4-9F1F2ECDC84C}');












