Fix for Unofficial UnLookAt function

User avatar
clintonman
Captain
Posts: 5422
Joined: 21 May 2009, 21:08
Type the number ten into the box: 0
Location: California
Contact:

Re: Fix for Unofficial UnLookAt function

Post by clintonman »

trueBlue wrote: 23 Aug 2022, 19:37 What is your util command equivalent to:
Node.Value(fsel,"Matrix") = Node.Value(fsel,"WldMatrix");

SetNodeValueMatrix(fsel, "Matrix", Node.Value(fsel,"WldMatrix"));

Code: Select all

function SetNodeValueMatrix(node, conn, matrix)
{
	util.SetNodeValueMatrix(node, conn, 
			matrix.GetAt(0,0), matrix.GetAt(1,0), matrix.GetAt(2,0), matrix.GetAt(3,0),
			matrix.GetAt(0,1), matrix.GetAt(1,1), matrix.GetAt(2,1), matrix.GetAt(3,1),
			matrix.GetAt(0,2), matrix.GetAt(1,2), matrix.GetAt(2,2), matrix.GetAt(3,2),
			matrix.GetAt(0,3), matrix.GetAt(1,3), matrix.GetAt(2,3), matrix.GetAt(3,3)
	);
}
Clinton Reese

http://clintons3d.com
User avatar
trueBlue
Captain
Posts: 5208
Joined: 06 Jul 2009, 22:50
Type the number ten into the box: 10

Re: Fix for Unofficial UnLookAt function

Post by trueBlue »

Thanks, this was working until I tried it on a Workspace Sky light
ERR Source object: /Project/Space 3D, 1/UnLook At Error: Microsoft JScript runtime error Description: Invalid procedure call or argument Error code: 0x800a0005 - (null) Line: 15, Char: 1 Script text: SetNodeValueMatrix(fsel, "Matrix", Node.Value(fsel,"WldMatrix"));

Code: Select all

function SetNodeValueMatrix(node, conn, matrix)
{
	var util = System.CreateDO("Clintons3D Package/Utility functions")
	util.SetNodeValueMatrix(node, conn, 
			matrix.GetAt(0,0), matrix.GetAt(1,0), matrix.GetAt(2,0), matrix.GetAt(3,0),
			matrix.GetAt(0,1), matrix.GetAt(1,1), matrix.GetAt(2,1), matrix.GetAt(3,1),
			matrix.GetAt(0,2), matrix.GetAt(1,2), matrix.GetAt(2,2), matrix.GetAt(3,2),
			matrix.GetAt(0,3), matrix.GetAt(1,3), matrix.GetAt(2,3), matrix.GetAt(3,3)
	);
}
Turns out, the Workspace Sky light's Widget is the culprit
User avatar
clintonman
Captain
Posts: 5422
Joined: 21 May 2009, 21:08
Type the number ten into the box: 0
Location: California
Contact:

Re: Fix for Unofficial UnLookAt function

Post by clintonman »

trueBlue wrote: 23 Aug 2022, 20:24 Thanks, this was working until I tried it on a Workspace Sky light
ERR Source object: /Project/Space 3D, 1/UnLook At Error: Microsoft JScript runtime error Description: Invalid procedure call or argument Error code: 0x800a0005 - (null) Line: 15, Char: 1 Script text: SetNodeValueMatrix(fsel, "Matrix", Node.Value(fsel,"WldMatrix"));

Code: Select all

function SetNodeValueMatrix(node, conn, matrix)
{
	var util = System.CreateDO("Clintons3D Package/Utility functions")
	util.SetNodeValueMatrix(node, conn, 
			matrix.GetAt(0,0), matrix.GetAt(1,0), matrix.GetAt(2,0), matrix.GetAt(3,0),
			matrix.GetAt(0,1), matrix.GetAt(1,1), matrix.GetAt(2,1), matrix.GetAt(3,1),
			matrix.GetAt(0,2), matrix.GetAt(1,2), matrix.GetAt(2,2), matrix.GetAt(3,2),
			matrix.GetAt(0,3), matrix.GetAt(1,3), matrix.GetAt(2,3), matrix.GetAt(3,3)
	);
}
Looks like look at doesn't work with the widget node. Remove and look at works. Probably your new look at works if there is no widget node inside the sky light.
edit
spotlight has widget node, but it doesn't contain any matrix inputs
Clinton Reese

http://clintons3d.com
User avatar
trueBlue
Captain
Posts: 5208
Joined: 06 Jul 2009, 22:50
Type the number ten into the box: 10

Re: Fix for Unofficial UnLookAt function

Post by trueBlue »

Running the original ts command:
ToolMng.ActivateTool('{17D544A3-3F58-436B-83E7-F8B4D7D4E7C5}','{4E203C6C-A20D-4e32-82B4-FC482F5A0D06}');
on the workspace Sky light, hooks up the Widget's Matrix to the LookAt2 node
WTH :o
Edit: This is true with all of the UU lights, so with UU9 there will be no floating panel Widget
User avatar
trueBlue
Captain
Posts: 5208
Joined: 06 Jul 2009, 22:50
Type the number ten into the box: 10

Re: Fix for Unofficial UnLookAt function

Post by trueBlue »

Here is what have for Look At & UnLook At
I am contemplating making an UI like you did with Delete & Copy
The main reason is to add a script that selects all the objects in the scene that have a TargetMatrix
Is it possible to create a list of objects that have a TargetMatrix in a panel?
Attachments
UnLook At.RsObj
(9.92 KiB) Downloaded 66 times
Look At.RsObj
(5.35 KiB) Downloaded 66 times
User avatar
clintonman
Captain
Posts: 5422
Joined: 21 May 2009, 21:08
Type the number ten into the box: 0
Location: California
Contact:

Re: Fix for Unofficial UnLookAt function

Post by clintonman »

Why NodeMatrixElement?

Code: Select all

	//why 3 instead of 1, is undo thing?
	//RsTool.NormalizeRotation('');
	Space.NodeMatrixElement(fsel,'roll') = 0;
	Space.NodeMatrixElement(fsel,'pitch') = 0;
	Space.NodeMatrixElement(fsel,'yaw') = 0;
I changed unlook at so it doesn't have a function inside another function
Also changed the alert to "is not using Look At" instead of "is not using UnLook At"
trueBlue wrote: 23 Aug 2022, 23:36 ...
The main reason is to add a script that selects all the objects in the scene that have a TargetMatrix
...
Why? What would you do if all those objects are selected?

trueBlue wrote: 23 Aug 2022, 23:36 ...
Is it possible to create a list of objects that have a TargetMatrix in a panel?
Maybe...
Attachments
UnLook At.RsObj
(10.22 KiB) Downloaded 68 times
Clinton Reese

http://clintons3d.com
User avatar
trueBlue
Captain
Posts: 5208
Joined: 06 Jul 2009, 22:50
Type the number ten into the box: 10

Re: Fix for Unofficial UnLookAt function

Post by trueBlue »

clintonman wrote: 24 Aug 2022, 01:14 Why NodeMatrixElement?

Code: Select all

	//why 3 instead of 1, is undo thing?
	//RsTool.NormalizeRotation('');
	Space.NodeMatrixElement(fsel,'roll') = 0;
	Space.NodeMatrixElement(fsel,'pitch') = 0;
	Space.NodeMatrixElement(fsel,'yaw') = 0;
I changed unlook at so it doesn't have a function inside another function
Also changed the alert to "is not using Look At" instead of "is not using UnLook At"
trueBlue wrote: 23 Aug 2022, 23:36 ...
The main reason is to add a script that selects all the objects in the scene that have a TargetMatrix
...
Why? What would you do if all those objects are selected?

trueBlue wrote: 23 Aug 2022, 23:36 ...
Is it possible to create a list of objects that have a TargetMatrix in a panel?
Maybe...
NodeMatrixElement does not add an undo
I would like to be able to select one of the objects in the list
There could be another script that selects all of the Targets and run on each one
User avatar
clintonman
Captain
Posts: 5422
Joined: 21 May 2009, 21:08
Type the number ten into the box: 0
Location: California
Contact:

Re: Fix for Unofficial UnLookAt function

Post by clintonman »

trueBlue wrote: 24 Aug 2022, 02:14
clintonman wrote: 24 Aug 2022, 01:14 Why NodeMatrixElement?

Code: Select all

	//why 3 instead of 1, is undo thing?
	//RsTool.NormalizeRotation('');
	Space.NodeMatrixElement(fsel,'roll') = 0;
	Space.NodeMatrixElement(fsel,'pitch') = 0;
	Space.NodeMatrixElement(fsel,'yaw') = 0;
I changed unlook at so it doesn't have a function inside another function
Also changed the alert to "is not using Look At" instead of "is not using UnLook At"
trueBlue wrote: 23 Aug 2022, 23:36 ...
The main reason is to add a script that selects all the objects in the scene that have a TargetMatrix
...
Why? What would you do if all those objects are selected?

trueBlue wrote: 23 Aug 2022, 23:36 ...
Is it possible to create a list of objects that have a TargetMatrix in a panel?
Maybe...
NodeMatrixElement does not add an undo
I would like to be able to select one of the objects in the list
There could be another script that selects all of the Targets and run on each one
No undo means you can't get back to where you were before the look at.

LookAtStuff - 1. Build List, 2. make a selection in the list, 3. Select to select 3D object
Attachments
LookAtStuff.RsObj
(14.82 KiB) Downloaded 67 times
Clinton Reese

http://clintons3d.com
User avatar
trueBlue
Captain
Posts: 5208
Joined: 06 Jul 2009, 22:50
Type the number ten into the box: 10

Re: Fix for Unofficial UnLookAt function

Post by trueBlue »

Thank you, this is great!
No undo means you can't get back to where you were before the look at.
I do not think you can undo it
You can reapply it though

Found a bug with objects that have a Look At applied
Normalizing the Location is destructive :roll:

Edit: I am testing setting the roll, pitch, and yaw for lights only
User avatar
trueBlue
Captain
Posts: 5208
Joined: 06 Jul 2009, 22:50
Type the number ten into the box: 10

Re: Fix for Unofficial UnLookAt function

Post by trueBlue »

Is there a way, within your Make LookAt List script, to clear the list, if there are no objects in the scene that do not have Look At applied?
I have added a UnLook At button to the panel
Activity.Run("%THIS_NAME%" + "/UnLook At");
Activity.Run("%THIS_NAME%" + "/Make LookAt List");
Post Reply