Fix for Unofficial UnLookAt function

User avatar
clintonman
Captain
Posts: 5430
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: 25 Aug 2022, 00:36 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");
This should do it.

Code: Select all

// Execute 
// Called to execute the command 
function Execute(params)
{
	var LookAtEnum = params.ConValue('LookAtEnum');

	lookatList = [];

	FindAllLookAts(Space.CurrentScene());

	var nodeEnum = System.CreateDO('Common Data Package/String Enum Data');
	nodeEnum.Clear();

	if(lookatList.length == 0) {
		Node.Value(System.ThisOwner(), "LookAtEnum") = nodeEnum;
		return;
	}

	for(var i=0;i<lookatList.length;i++) {
		nodeEnum.SetStringAt(i,lookatList[i]);
	}

	nodeEnum.SetSelectedString(lookatList[0])
	//params.ConValue("LookAtEnum") = nodeEnum;
	Node.Value(System.ThisOwner(), "LookAtEnum") = nodeEnum;

}

function FindAllLookAts(curNode)
{
	if(Node.Exists(curNode + "/LookAt2")) {
		lookatList.push(curNode);
		return;
	}

	var numChildren = Node.SubObjectCount(curNode);

	if(numChildren == 0) return;

	for(var i=0; i<numChildren; i++) {
		var childNode = curNode + "/" + Node.SubObject(curNode, i);
		FindAllLookAts(childNode)
	}
}
Clinton Reese

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

Re: Fix for Unofficial UnLookAt function

Post by trueBlue »

Thanks, that works great!
Here is an update...
Not sure with the current UI, maybe a little confusing by adding the Look At button
Wish the Select script did not run if the list is empty because it creates an Undo in the Command History and it Unselects any selected items

Made some changes to the Look At script...
It will only run Space.NodeMatrixElement(fsel,'roll') = 0; if the selected item is a model light
Also, the Status message only runs for 5 seconds
Is there a way to clear the Status message after the script runs and after the user selects the target object?
Still needs further testing
Let me know if you have any critiques or further suggestions
Attachments
Look At utilities.RsObj
(26.64 KiB) Downloaded 69 times
User avatar
clintonman
Captain
Posts: 5430
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: 25 Aug 2022, 15:51 ..
Also, the Status message only runs for 5 seconds
Is there a way to clear the Status message after the script runs and after the user selects the target object?
...
Nope, don't see any way to know when it's done or if it's aborted either.

trueBlue wrote: 25 Aug 2022, 15:51 Thanks, that works great!
Here is an update...
Not sure with the current UI, maybe a little confusing by adding the Look At button
Wish the Select script did not run if the list is empty because it creates an Undo in the Command History and it Unselects any selected items

Made some changes to the Look At script...
It will only run Space.NodeMatrixElement(fsel,'roll') = 0; if the selected item is a model light
Also, the Status message only runs for 5 seconds
Is there a way to clear the Status message after the script runs and after the user selects the target object?
Still needs further testing
Let me know if you have any critiques or further suggestions
Attached will return from select if list is empty.
LookAtUtil.jpg
LookAtUtil.jpg (41.51 KiB) Viewed 865 times

recommend vertical arrangement so it looks like a process, currently select and unlookat buttons look like 2 equal choices
1. scan the scene
2. choose a list item
3. select it
4. unlookat
space separation
look at, not part of the process
Attachments
Look At utilities.RsObj
(26.83 KiB) Downloaded 66 times
Clinton Reese

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

Re: Fix for Unofficial UnLookAt function

Post by trueBlue »

Is this, okay?
I added a panel frame to Encaps... & Look At, scripts included verses calling them from the UUFunctionSet
Floating panels.png
User avatar
clintonman
Captain
Posts: 5430
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: 26 Aug 2022, 02:12 Is this, okay?
I added a panel frame to Encaps... & Look At, scripts included verses calling them from the UUFunctionSet
Floating panels.png
Looks good to me. Don't know anything about the encaps.
Clinton Reese

http://clintons3d.com
User avatar
trueBlue
Captain
Posts: 5215
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: 26 Aug 2022, 02:17
trueBlue wrote: 26 Aug 2022, 02:12 Is this, okay?
I added a panel frame to Encaps... & Look At, scripts included verses calling them from the UUFunctionSet
Floating panels.png
Looks good to me. Don't know anything about the encaps.
:bananacheers:

tS761_UU_Artists_Guide.pdf
Chapter2 User Interface| 50
Post Reply