Show and Hide Commands

User avatar
trueBlue
Captain
Posts: 5214
Joined: 06 Jul 2009, 22:50
Type the number ten into the box: 10

Re: Show and Hide Commands

Post by trueBlue »

clintonman wrote: 05 Nov 2021, 15:30
trueBlue wrote: 05 Nov 2021, 14:28
clintonman wrote: 04 Nov 2021, 22:57 Here is a version of the switch main toolbar script.
It works in 4View, Default, floating and yafaray layouts and it closes and opens the small main toolbar. It doesn't open it in place so it would have to be dragged back into place.
You never cease to amaze me!
One thing though, all though you can Ctrl + Drag the Main2 toolbar back into place, it is different in how I set up the layouts
Here is a different version that Only works in the 4View, Default, Floating, and Yafaray layouts
New:
Opens in a floating panel
If you are in one of the above layouts, it loads that layout, else the installer is removed with an Alert
Modal questions to remove the Main2 toolbar and remove the installer
Cancel button
ToolbarResultsWeird.jpg
my confusing result before I figured out what was happening


The dialog is confusing. Maybe the "Save your Layout Remove the installer?" should be 2 dialogs. It looks like it's asking to save the layout and remove the installer. or maybe it can be something wordier like "Remove the installer? Save your Layout after choosing yes or no".

Maybe it should also say that the toolbar will update after the selection is made since it's asking to remove the installer when the toolbar looks like it hasn't changed.

Code: Select all

	System.Alert("You will need to Save your " +layout+ " layout\nto make these changes permanent");

	if(Question("Remove the installer?")) {
		Node.Delete(Space.CurrentScene() + "/Switch Workspace Main toolbar")
	}
Better?
Moved the Alert & Question so the toolbar change happens before the Alert
Screenshot 2021-11-05 101734.png
Uploaded to the previous post
User avatar
clintonman
Captain
Posts: 5430
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 »

That's better. Only thing is if you switch to WorkspaceMain and then back to WorkspaceMain2 the little toolbar is missing.
Clinton Reese

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

Re: Show and Hide Commands

Post by trueBlue »

clintonman wrote: 05 Nov 2021, 17:45 That's better. Only thing is if you switch to WorkspaceMain and then back to WorkspaceMain2 the little toolbar is missing.
Yep!
As mentioned, just opening the Main2 toolbar and Ctrl + Drag it back into place is not the same
You will lose the ability to collapse it, and it is not that easy to create manually
I going to eliminate the option to Close the Main2 toolbar from the script
A user could remove it before saving the layout
Seems simple enough
User avatar
trueBlue
Captain
Posts: 5214
Joined: 06 Jul 2009, 22:50
Type the number ten into the box: 10

Re: Show and Hide Commands

Post by trueBlue »

clintonman wrote: 05 Nov 2021, 15:36
trueBlue wrote: 04 Nov 2021, 23:36 Interesting new way!
Thanks!
I tried the same for the QuickHide, but it does not work


Suggestion...
Line 41
Add

Code: Select all

if(Node.Exists(curNode + "/Object hider") && Node.Exists(curNode + "/Object Render Attributes")) {
util.SetNodeValueInt(curNode + "/Object hider", "Invisible", true)
util.SetNodeValueInt(curNode + "/Object hider", "Invisible", false)
util.SetNodeValueInt(curNode +  "/Object Render Attributes", "Cast shadows", 0)
util.SetNodeValueInt(curNode +  "/Object Render Attributes", "Receive shadows", 0)
Node.Disconnect(curNode + "/Object hider", "Invisible", curNode + "/Object Render Attributes", "Invisible")
util.SetNodeValueInt(curNode +  "/Object Render Attributes", "Invisible", -1);
}
Here's a quick hide with the status message.

Don't know what all that code is for but if it doesn't slow it down go for it.
Thank you!
The above code is in your original QuickHide minus the Disconnect
I did the opposite for the QuickShow, IE: ConnectTo
Also did the same for the QuickHideAll & QuickShowAll
Tested using a scene with over 500 objects and 50 lights
All seems super fast to me and I think it solves the problem with Cameras, Spot, and Projector lights, in with which you do not need to run the slow scripts first, except for objects that do not have an ORA

Ideally it would be awesome if you could incorporate these Quick scripts into the Slow scripts as Functions, if possible
Like, run the Quick Functions if the scene has more then a certain amount of objects
More importantly if the Slow scripts could be optimized NOT to run D3DView.ShowRenderAttribsForObject('', curNode) if the object already has an ORA node
User avatar
trueBlue
Captain
Posts: 5214
Joined: 06 Jul 2009, 22:50
Type the number ten into the box: 10

Re: Show and Hide Commands

Post by trueBlue »

My suspensions were correct! :D
Only running D3DView.ShowRenderAttribsForObject('', curNode) when the ORA does not exist runs SUPER fast IF all objects in the scene have an ORA
I updated the HideAll & ShowAll and ran it on a scene with 597 objects

Code: Select all

if(!Node.Exists(curNode +  "/Object Render Attributes")) {
			D3DView.ShowRenderAttribsForObject('', curNode)
			RsStackView.SetPanelExportInfo(curNode + '/Object Render Attributes','Default',1,1);
}

Activity.Run(System.ThisOwner() + "/UnBlockRsTSEvents")
Also added:

Code: Select all

if(typeof(tSBridge) != "undefined") {

// To create the object faster, disable synchronization between
// Rosetta and trueSpace
bEventsBlocked = false;

bEventsBlocked = tSBridge.RsTSEventsStatus();
tSBridge.BlockRsTSEvents(true);

}
User avatar
clintonman
Captain
Posts: 5430
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 »

The current Show and Hide scripts don't preserve the objects render attributes, so layer number and other settings can be lost.

These have been updated.

There was a bug in the GatherChildORAs function. Fixing that bug fixed a few of the lost ORA settings.

NURBS will now keep their ORA values when they are in a group. The Truespace command, D3DView.ShowRenderAttribsForObject, will cause the Object Render Attributes(ORA) nodes of subobjects to be replaced by a RenderAttributes(RA) node. This doesn't work for NURBS, so they needed to keep their ORA nodes and the group will have no effect on the NURBS appearance except for visible/invisible.
NURBS appearance fixes are inside the Show and Hide scripts because the external Fix NURBS ORA has no way of knowing what each NURBS object settings are. The RsApp.RunScriptBuffer form of the NURBS fix has been reverted to normal script because it was crashing tS for some reason when run inside the Show and Hide command nodes.

Bunch of changes made with the goal of preserving ORA values and cleaning up some zombie connectors and orphaned nodes. Old code was just commented out.

Edit: removed attachments, script bug fixed.
Last edited by clintonman on 01 Aug 2022, 21:18, edited 1 time in total.
Clinton Reese

http://clintons3d.com
User avatar
clintonman
Captain
Posts: 5430
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 »

"Multiple selections freezes trueSpace", trueBlue - paraphrased quote

Fixed. Works with multiple selections
Attachments
Hide.RsObj
(37.99 KiB) Downloaded 57 times
Show.RsObj
(34.23 KiB) Downloaded 57 times
Clinton Reese

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

Re: Show and Hide Commands

Post by trueBlue »

Thanks, multiple selections working now
Hair, Plants, Trees, and Grass has issues
You may notice that they are setup with an ORA and connected
Hair uses ORA.png
I have an idea for the ShowAll & HideAll scripts
Use your SelectAll script and then the new Show/Hide script
Edit: Currently, in the UU, the ShowAll & HideAll scripts have an error on second run
User avatar
clintonman
Captain
Posts: 5430
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 »

Wow, hair. I'm guessing it also doesn't work with the previous Show/Hide scripts. Also need to add a hair type to the scene view scripts.
Clinton Reese

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

Re: Show and Hide Commands

Post by trueBlue »

Yep!
Guessing you would have to treat a Hair 3D Group like you have done with your NURBS
Currently with your new Hide/Show scripts it treats the Hair 3D Group has a normal 3D Group but does not work with the object that has the Hair applied and replaces the Hair's ORA with a RA node

The D3DView.ShowRenderAttribsForObject('', ''); command does a good job showing the Hair's ORA panel in Settings and does not affect the predefined settings
Post Reply