Workspace Layers version 3

free scripts, plugins, models, textures
User avatar
clintonman
Captain
Posts: 3718
Joined: 21 May 2009, 21:08
Type the number ten into the box: 0
Location: California
Contact:

Re: Workspace Layers version 3

Post by clintonman »

trueBlue wrote:
13 Jan 2021, 00:47
UT Oh!
Persistent ERROR.png
Got an error that would not close
Had to Ctrl + Alt + Delete, End Rosetta
Too bad. The error doesn't help because everything goes through the watchdog. If it happens again try to keep track of how you got to the point of error.
Clinton Reese

http://clintons3d.com

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

Re: Workspace Layers version 3

Post by trueBlue »

clintonman wrote:
13 Jan 2021, 01:01
trueBlue wrote:
13 Jan 2021, 00:30
...
Didn't your last version replace the existing Workspace Layers 3 only if it was an older version?
...
If it finds the old style of workspace layers it will ask a question, do you want to replace.
The button is just for replacing whether old or new.
Nope, I have a previous version loaded and I do not get the question
Are you checking for the DeepVisibility attribute too?

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

Re: Workspace Layers version 3

Post by clintonman »

trueBlue wrote:
13 Jan 2021, 01:09
clintonman wrote:
13 Jan 2021, 01:01
trueBlue wrote:
13 Jan 2021, 00:30
...
Didn't your last version replace the existing Workspace Layers 3 only if it was an older version?
...
If it finds the old style of workspace layers it will ask a question, do you want to replace.
The button is just for replacing whether old or new.
Nope, I have a previous version loaded and I do not get the question
Are you checking for the DeepVisibility attribute too?
Old style, not old version. It doesn't keep track of every version. It only checks for the old version that was so different that they are not compatible and don't operate the same way..
Clinton Reese

http://clintons3d.com

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

Re: Workspace Layers version 3

Post by trueBlue »

clintonman wrote:
13 Jan 2021, 01:03
trueBlue wrote:
13 Jan 2021, 00:47
UT Oh!
Persistent ERROR.png
Got an error that would not close
Had to Ctrl + Alt + Delete, End Rosetta
Too bad. The error doesn't help because everything goes through the watchdog. If it happens again try to keep track of how you got to the point of error.
I confirmed this issue is/was my use of the Copy Attributes script and has nothing to do with your new Workspace Layers version
I did a test in tS761 with the previous Workspace Layers version
First run was successful, second run tS becomes unresponsive.
I did a System Trace inside the Try & Catch Error on the first run and the connectors copied correctly, but there was some Debug info
SystemTraceCopyAttributes.png
SystemTraceCopyAttributes.png (9.11 KiB) Viewed 175 times

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

Re: Workspace Layers version 3

Post by clintonman »

Update Jan 13, 2021


works with groups
fix bad performance caused by new show and hide methods
fix infinite loop when running the replace script
fix replace script layer menu status to update properly
empty layer updates appearance of objects
Clinton Reese

http://clintons3d.com

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

Re: Workspace Layers version 3

Post by trueBlue »

Looks like the Refresh button no longer changes the Colors
I am getting mixed results when refreshing the menu(s)
It seems that only Visible (menu H) works when refreshing
For instance when I change it to menu H L and Refresh it, it changes to menu H, even though the item is Locked

Would it be possible, with the Refresh script, to Reset all of the Colors (White) for the Empty Layers?
Empty Layers.png
Empty Layers.png (6.68 KiB) Viewed 169 times
Would it also be possible to add an option to Not change the user's layer names in the Initialize Layers script?

I added a Shift + L shortcut for Workspace Layers which is really handy for showing the panel and or adding it to the scene
Workspace 3D Window

Code: Select all

<RS_ACC KEY="SHIFT L" GROUP="CLINTONTOOLBAR" CONTEXT="" DESC="Layers - Workspace Layers / Replace Workspace Layers 3 " COMMAND="Activity.Run(&quot;Scripts/CustomCommands/wsLayersGroup/loadIt&quot;)" />

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

Re: Workspace Layers version 3

Post by clintonman »

Thanks, I see a problem with the Refresh layers, similar to the infinite loop problem from the replace script.

Edit: Problem wasn't the Refresh layers, but the replace layer node. The disconnect/reconnect of the watchdog has to be alone in their own nodes.
The lock unlock is because the code for refresh was never updated to use the new locking node style.
Last edited by clintonman on 14 Jan 2021, 16:26, edited 1 time in total.
Clinton Reese

http://clintons3d.com

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

Re: Workspace Layers version 3

Post by trueBlue »

I found an additional (optional) way to update the last Workspace Layers version and includes more checks for your plugins
I would really prefer to add an option to not show this Alert. Gets old after awhile!
loadIt script

Code: Select all

function Execute(params)
{
	var owner = System.ThisOwner();
	var scene = Space.CurrentScene();

RsTool.Arrow();var PVT_LOCKED = 2;RsStackView.RemovePanelsFromCurrSelection(PVT_LOCKED, 0);Space.Unselect()

	//replace older version - before infinite loop fix
	if(Node.Exists(scene + "/workspacelayers3") && !Node.Exists(scene + "/workspacelayers3/Pause Activity")) {
		if(Question("An older Workspace Layers 3 version was found in your scene\n\nWould you like to update it to the current version?")) {
			var colors = [];
			var names = [];
			for(var i=0;i<24;i++) {
				var color = Node.Value(scene + "/workspacelayers3", "color" + i);
				colors.push(color);
				var name = Node.Value(scene + "/workspacelayers3", "name" + i);
				names.push(name);
			}

			Node.Delete(scene + "/workspacelayers3");

			Node.Copy(owner + "/workspacelayers3", scene);

			for(i=0;i<24;i++) {
				Node.Value(scene + "/workspacelayers3", "color" + i) = colors.shift();
				Node.Value(scene + "/workspacelayers3", "name" + i) = names.shift();
			}

			Activity.Run(scene + "/workspacelayers3/refreshlayers");

//Needed or all warnings are ignored
var warnings = preLoadWarnings()
System.Alert(warnings);
		}
	}

	//replace previous version - with DeepVisibility
	if(Node.Exists(scene + "/workspacelayers3") && Node.ConExists(scene + "/workspacelayers3", "DeepVisibility")) {
		if(Question("A previous Workspace Layers 3 version was found in your scene\n\nWould you like to update it to the current version?")) {
			var colors = [];
			var names = [];
			for(var i=0;i<24;i++) {
				var color = Node.Value(scene + "/workspacelayers3", "color" + i);
				colors.push(color);
				var name = Node.Value(scene + "/workspacelayers3", "name" + i);
				names.push(name);
			}

			Node.Delete(scene + "/workspacelayers3");

			Node.Copy(owner + "/workspacelayers3", scene);

			for(i=0;i<24;i++) {
				Node.Value(scene + "/workspacelayers3", "color" + i) = colors.shift();
				Node.Value(scene + "/workspacelayers3", "name" + i) = names.shift();
			}

			Activity.Run(scene + "/workspacelayers3/refreshlayers");

//Needed or all warnings are ignored
var warnings = preLoadWarnings()
System.Alert(warnings);
		}
	}

	if(Node.Exists(scene + "/unSelectable"))
	{
		System.Alert("WARNING !\nThe unSelectable script is present in your scene!\n\nWorkspace Layers 3 has it's own Locking and Unlocking system and you should not use it with Workspace Layers 3")
	}

	if(!Node.Exists(scene + "/workspacelayers3"))
	{

		var warnings = preLoadWarnings()

		System.Alert(warnings);

		Node.Copy(owner + "/workspacelayers3", scene);

		Activity.Run(scene + "/workspacelayers3/initializelayers");
	}

	UserInterface.OpenToolPanelViewEx2("" , "" ,scene + "/workspacelayers3", 3,0,0);

}

function preLoadWarnings()
{
	var warnings = "Workspace Layers 3 is not compatible with old Characters that have hair applied, like Bobby from the Characters library.\nHair can be adjusted by changing the hair profile from Line to Star or Circle\n\nAlt + LMB select 3D objects in the 3D View to temporarily select Locked objects";

	var clintons3dview = false;
	var clintons3d = false;

	if(!Node.Exists("Scripts/CustomCommands/unSelectable")) {
		warnings += "\n\nWARNING !\nThe UnSelectable script is not Installed and is Required!. Widget based layer locking behavior is disabled.";
	}

	// check that plugin is installed and loaded
	var xmldoc = new ActiveXObject("Msxml2.DOMDocument.6.0");
	xmldoc.load(System.GetMainDir() + "\\Scripts\\Plugins.xml");

	var doc = xmldoc.documentElement;

	for(var i=0;i<doc.childNodes.length;i++) {

		var child = doc.childNodes.item(i);
		var grandchild = child.childNodes.item(0);
		var NAME = grandchild.getAttribute("NAME");

		if(NAME == "Clintons3d ViewPlugin Package") {
			var STATUS = grandchild.getAttribute("STATUS");
			if(STATUS != "LOADED") {
				//warnings += "\n\nClintons3dView plugin installed, but not loaded. Web UI based layer locking is disabled until the plugin is loaded.";
			} 

			clintons3dview = true;
		}

		if(NAME == "Clintons3D Package") {
			STATUS = grandchild.getAttribute("STATUS");
			if(STATUS != "LOADED") {
				warnings += "\n\nClintons3dPlugin is Installed, but not Loaded. Widget based layer locking is disabled until the plugin is Loaded.";
			}

			VERSION = grandchild.getAttribute("VERSION");
			var verArr = VERSION.split(".")
			var vernum = parseInt(verArr[1]);
			if(vernum < 1638419) {
				warnings += "\n\nWARNING !\nClintons3D plugin v.1638419 or higher is Required. Widget based locking is disabled until the plugin is Updated.";
			}

			clintons3d = true;
		}

	}

	if(clintons3dview)
		warnings += "\n\nThis Workspace Layers 3 version does not use Web UI based layer locking and is disabled";

	if(!clintons3d)
		warnings += "\n\nWARNING !\nClintons3D plugin is not Installed. Widget based layer locking is disabled until the plugin is Installed and Loaded.";
	
	return warnings;
}

function Question(strText)
{
	var nSecondsToWait = -1;
	var strTitle = "Question";
	// values are hexadecimal
	var MB_YESNO = 4;
	var MB_SYSTEMMODAL = 4096;
	var MB_ICONQUESTION = 32;


	var nType = MB_YESNO+MB_SYSTEMMODAL+MB_ICONQUESTION;
	var IDYES = 6;
	var IDNO = 7;

	var shell = new ActiveXObject("WScript.shell");
	var button = shell.Popup (strText, nSecondsToWait, strTitle, nType);

	if(button == IDYES) return true;
	return false;
}

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

Re: Workspace Layers version 3

Post by clintonman »

Fixes the replace layers connect/disconnect issue
Fixes the locking/unlocking menu update
Randomizes the colors of empty layers
Option to not randomize the color
Attachments
wsLayersGroup.RsObj
(274.22 KiB) Downloaded 7 times
Clinton Reese

http://clintons3d.com

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

Re: Workspace Layers version 3

Post by trueBlue »

Great update!!!
There might be an issue with NURBS when refreshing, the menus go Blank
NURBS Patches and Curves' menu blank.png
NURBS Patches and Curves' menu blank.png (7.57 KiB) Viewed 162 times
Also the Protect Curve Color is not working, unless I misunderstanding it's use.
If checked, it should not use the Layer Color?
Line 709 maybe?

Or maybe you need to add Protect Curve Color to the colorchangeprocessor script?

Post Reply