Show and Hide Commands

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

Show and Hide Commands

Post by clintonman »

I ran into an issue with the unofficial updates show and hide scripts. I had a scene with about 500 items in it and it took a long time to show and hide a large number of items. In a smaller scene with 160 items it takes about 7 seconds to hide and show all. The show actually happens faster in the 3d view with the side panel update finishing later for the 7 second total time. The attached quick show and hide scripts work almost instantaneously. The limitation is they cut corners to do it. They don't fully support group objects and if an object doesn't already have a render attribute node it ignores it.

Anyway, I'm in the process of figuring out where to add these new "quick" commands. I'm leaning towards adding them to the popup view menu.
Attachments
QuickHide.RsObj
(7.17 KiB) Downloaded 112 times
QuickHideAll.RsObj
(7.65 KiB) Downloaded 107 times
QuickShow.RsObj
(7.41 KiB) Downloaded 117 times
QuickShowAll.RsObj
(7.54 KiB) Downloaded 117 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: Show and Hide Commands

Post by trueBlue »

I see what you mean about the HideAll & ShowAll scripts taking a lot of time when there are many objects
I think the biggest downfall is the Search function
It looks like these two commands run regardless if the object(s) have and ORA or Not

Code: Select all

D3DView.ShowRenderAttribsForObject('', curNode)
RsStackView.SetPanelExportInfo(curNode + '/Object Render Attributes','Default',1,1);

Code: Select all

function Search(curNode)
{
var util = System.CreateDO("Clintons3D Package/Utility functions");

	if(!Node.Exists(curNode + "/Object hider") &&	Node.ConExists(curNode, "WldMatrix") && Node.SubObjectCount(curNode) > 1) {
		if(IsNURBS(curNode)) {
			curNode = ConvertCurrentToLODMesh(curNode);
		}

		D3DView.ShowRenderAttribsForObject('', curNode)
		RsStackView.SetPanelExportInfo(curNode + '/Object Render Attributes','Default',1,1);

		if(Node.Exists(curNode +  "/Object Render Attributes")) {
			util.SetNodeValueInt(curNode +  "/Object Render Attributes", "Invisible", -1);
		}
		return;
	}
User avatar
trueBlue
Captain
Posts: 5208
Joined: 06 Jul 2009, 22:50
Type the number ten into the box: 10

Re: Show and Hide Commands

Post by trueBlue »

I tried a different way on 537 selected objects
10 seconds

Code: Select all

function Execute(params)
{
	sel = Node.Selection();
	for (i = 0; i < Node.SelectionLength(sel); i++)
		{Node.Select(Node.SelectionGetAt(sel, i)); ApplyMacro(Node.SelectionGetAt(sel, i))};
}

function ApplyMacro(selectedObj_)
{
var temp = Node.Create("Space 3D Package/Object Render Attributes",selectedObj_ + "/");
Node.ExportConnector(selectedObj_ + "/Object Render Attributes", "RenderAttributes", "", 1, 1)
}
Unfortunately, it is not the customized ORA panel :(
ORA.png
User avatar
clintonman
Captain
Posts: 5422
Joined: 21 May 2009, 21:08
Type the number ten into the box: 0
Location: California
Contact:

Re: Show and Hide Commands

Post by clintonman »

trueBlue wrote: 04 Nov 2021, 00:04 I tried a different way on 537 selected objects
10 seconds

Code: Select all

function Execute(params)
{
	sel = Node.Selection();
	for (i = 0; i < Node.SelectionLength(sel); i++)
		{Node.Select(Node.SelectionGetAt(sel, i)); ApplyMacro(Node.SelectionGetAt(sel, i))};
}

function ApplyMacro(selectedObj_)
{
var temp = Node.Create("Space 3D Package/Object Render Attributes",selectedObj_ + "/");
Node.ExportConnector(selectedObj_ + "/Object Render Attributes", "RenderAttributes", "", 1, 1)
}
Unfortunately, it is not the customized ORA panel :(
ORA.png
And on top of that it won't replace the "D3DView.ShowRenderAttribsForObject" command because it also creates and hooks up "RenderAttributes" nodes for group members. Non of these quick commands will replace the original but they work in most cases once the Object Render Attributes/RenderAttributes structures are already in place. So I figure the use case is use quick unless it doesn't work then use the slow way to get it setup then moving forward use the quick way.
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: Show and Hide Commands

Post by trueBlue »

With regards to the Unofficial Updates and your Quick ORA scripts...
I was thinking about using these as a LMB command and the xml scripts as a RMB command in the existing Workspace toolbars
I would also like to add a status message if there is objects that do not have an ORA node in the scene and include the Cameras & Lights
Quick Hide All example...

Code: Select all

function Execute(params)
{
	if(typeof(Clintons3dPlugin) == "undefined") {
		System.Alert("Required plugin is not installed.\n\nInstall the Clintons3dPlugin.rsx in the Package Manager and \nRestart trueSpace");
	return;
	}

ScriptObject.Execute("Scripts/Commands/HideCameraAndLights");

	var scene = Space.CurrentScene();
	var numTopLevel = Node.SubObjectCount(scene);

	for(var i=0; i< numTopLevel; i++) {
		var item = scene + "/" + Node.SubObject(scene, i);
		Search(item)
	}

if(!Node.Exists(item +  "/Object Render Attributes")) {
var util = System.CreateDO("Clintons3D Package/Utility functions");
util.SetStatusMessage("Alert...Object in your scene does not have Object Render Attributes", 5000)
}

}
Also add these scripts to the ViewToolbar in the same manner mentioned above
Also include your update to Workspace Layers 4
Also add Edit material in the LE button in your DX Material Components toolbar and a RMB command in the Material Editor's Convert D3D materials button to open it

Thoughts?
Anything else needing updated?
User avatar
clintonman
Captain
Posts: 5422
Joined: 21 May 2009, 21:08
Type the number ten into the box: 0
Location: California
Contact:

Re: Show and Hide Commands

Post by clintonman »

trueBlue wrote: 04 Nov 2021, 16:42 With regards to the Unofficial Updates and your Quick ORA scripts...
I was thinking about using these as a LMB command and the xml scripts as a RMB command in the existing Workspace toolbars
I would also like to add a status message if there is objects that do not have an ORA node in the scene and include the Cameras & Lights
Quick Hide All example...

Code: Select all

function Execute(params)
{
	if(typeof(Clintons3dPlugin) == "undefined") {
		System.Alert("Required plugin is not installed.\n\nInstall the Clintons3dPlugin.rsx in the Package Manager and \nRestart trueSpace");
	return;
	}

ScriptObject.Execute("Scripts/Commands/HideCameraAndLights");

	var scene = Space.CurrentScene();
	var numTopLevel = Node.SubObjectCount(scene);

	for(var i=0; i< numTopLevel; i++) {
		var item = scene + "/" + Node.SubObject(scene, i);
		Search(item)
	}

if(!Node.Exists(item +  "/Object Render Attributes")) {
var util = System.CreateDO("Clintons3D Package/Utility functions");
util.SetStatusMessage("Alert...Object in your scene does not have Object Render Attributes", 5000)
}

}
Also add these scripts to the ViewToolbar in the same manner mentioned above
Also include your update to Workspace Layers 4
Also add Edit material in the LE button in your DX Material Components toolbar and a RMB command in the Material Editor's Convert D3D materials button to open it

Thoughts?
Anything else needing updated?
The Quick Hide All already hides the cameras and lights. Calling the HideCameraAndLights will make it slower. If you want them separated then a check for cameras and lights would be needed in the Quick Hide All and a new QuickHideCameraAndLights would need to be created so it doesn't slow it down. All the same would be needed for the Show All as well.
I think you have some widget shortcuts for showing and hiding? If so you'll have to decide whether they call the quick or slow versions.

I don't see the advantage to having Edit material in the LE in the toolbar. Wouldn't you have to open the material editor first which already has the button?

The only other things I have planned are a modified View Widget where the "Fly through world" surface uses RMB to look around and LMB+RMB to move up and down. I've been in the Unreal Engine and decided I wanted to match it's behavior. I also plan to make a layout that replaces the last 7 buttons on the bottom toolbar with the buttons above the info display, minus the repeated material editor button. This gives me a little more room in the side panel.
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: Show and Hide Commands

Post by trueBlue »

All four Quick scripts do not Hide nor Show Cameras, Spot, and Projector lights
User avatar
clintonman
Captain
Posts: 5422
Joined: 21 May 2009, 21:08
Type the number ten into the box: 0
Location: California
Contact:

Re: Show and Hide Commands

Post by clintonman »

trueBlue wrote: 04 Nov 2021, 19:23 All four Quick scripts do not Hide nor Show Cameras, Spot, and Projector lights
That's why you still need the slow scripts. After you run the slow scripts on them once, the fast scripts work. I think I forgot to mention that you run the slow scripts first so everything works with the fast scripts from that point onward. It's also the reason why if you load the new layers into a busy scene it will still be slow loading because it uses the same slow techniques to build itself up. After that it's fast.
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: Show and Hide Commands

Post by trueBlue »

I just ran Hide All & Show All in a scene with 595 nodes
Quick Hide All does not hide Cameras, Spot, not Projector lights
I confirmed that their Object hider nodes are disconnected

Have you tried the Switch Workspace Main toolbar script in the Objects - tS7.61 Update objects library?
Screenshot 2021-11-04 123425.png
Screenshot 2021-11-04 123425.png (5.66 KiB) Viewed 1981 times
User avatar
trueBlue
Captain
Posts: 5208
Joined: 06 Jul 2009, 22:50
Type the number ten into the box: 10

Re: Show and Hide Commands

Post by trueBlue »

This is why it is not working
!Node.Exists(curNode + "/Object hider")
Post Reply