Scene View 2

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

Re: Scene View 2

Post by trueBlue »

Okay will do
Would like your help stopping Scene View 2 from opening infinite instances though
Fixed my mistake with the previous script, but still no go :(
Crashes tS too!
User avatar
trueBlue
Captain
Posts: 5216
Joined: 06 Jul 2009, 22:50
Type the number ten into the box: 10

Re: Scene View 2

Post by trueBlue »

I came up with the following:
openSceneView2 script

Code: Select all

	util = System.CreateDO("Clintons3D Package/Utility functions")

//Clear the Store
	var store = "/Scripts/CustomCommands/SceneView/Store";
	var subObjCount = Node.SubObjectCount(store);

	if(subObjCount > 0) {
		for(var i=subObjCount-1; i>=0; i--) {
			util.Delete(store + "/"+ Node.SubObject(store,i));
		}
	}

	Frame = WindowsManager.GetWindowsManagerNodeName();

	if(Node.Exists('/Project/Windows Manager Space/SceneGraphFrame')) {
		WindowsManager.CloseWindow('/Project/Windows Manager Space/SceneGraphFrame')
	}

	if(Node.Exists('/Project/Windows Manager Space/SceneViewFrame')) {
		WindowsManager.CloseWindow('/Project/Windows Manager Space/SceneViewFrame')
	}

//Open Scene View2
	if(!Node.Exists('/Project/Windows Manager Space/SceneViewFrame')) {
		WindowsManager.CreateWindowFromCLSID('{E9C4FE3C-C3C9-4dfd-8C85-E7F0F81029B4}', '', '', '', 1)
	}

	util.Rename(Frame + '/' + Node.SubObject(Frame, Node.SubObjectCount(Frame) - 1), 'SceneViewFrame')

	WindowsManager.SetFrameOwnerFrame(Frame + '/SceneViewFrame', WindowsManager.GetWorkWindow())
openSceneView2 script

Code: Select all

	util = System.CreateDO("Clintons3D Package/Utility functions")

	Frame = WindowsManager.GetWindowsManagerNodeName();

	if(Node.Exists('/Project/Windows Manager Space/SceneViewFrame')) {
		WindowsManager.CloseWindow('/Project/Windows Manager Space/SceneViewFrame')
	}

	if(Node.Exists('/Project/Windows Manager Space/SceneGraphFrame')) {
		WindowsManager.CloseWindow('/Project/Windows Manager Space/SceneGraphFrame')
	}

//will start empty if nothing is selected
	Space.Select(Space.CurrentScene() + "/" + Node.SubObject(Space.CurrentScene(), 0))
//SubObject 0 may be Vray and is not a good choice, so try a Cmaera
	if(Node.Exists(Space.CurrentScene() + "/Camera")) {
		Space.Select(Space.CurrentScene() + "/Camera")
	}

//Open Scene Graph Utilities
	if(!Node.Exists('/Project/Windows Manager Space/SceneGraphFrame')) {
		WindowsManager.CreateWindowFromCLSID('{DD2E0D6B-ED84-4b80-A624-757525B8A591}', '', '', '', 1)
	}

	util.Rename(Frame + '/' + Node.SubObject(Frame, Node.SubObjectCount(Frame) - 1), 'SceneGraphFrame')

	WindowsManager.SetFrameOwnerFrame(Frame + '/SceneGraphFrame', WindowsManager.GetWorkWindow())
User avatar
clintonman
Captain
Posts: 5432
Joined: 21 May 2009, 21:08
Type the number ten into the box: 0
Location: California
Contact:

Re: Scene View 2

Post by clintonman »

Update Feb 8 2024

fixed unofficial update delete not working
adds fewer entries to the command history

differences from current UU version:
prevents opening more than 1 scene view, but does not close and reopen the scene view, same for the node graph view
allows 1 each of scene view and node graph view, uu allows one or the other
does not use the SetFrameOwnerFrame command since it made the window undockable, window did not behave like other tS window frames
searches the entire windows manager space to see if the window is open, not just the top level

openSceneView2

Code: Select all

// Execute 
// Called to execute the command 
function Execute(params)
{
	//set uufs
	if(Node.Exists("Scripts/UUCommands/UUFunctionSet")) {
		var sceneViewFS = Node.AccessNearFnSet("Clintons3dView Function Set");
		sceneViewFS.UUFS = Node.AccessFnSet("Scripts/UUCommands/UUFunctionSet");
	}

	var util = System.CreateDO("Clintons3D Package/Utility functions")
	
	//clear the store

	var store = "/Scripts/CustomCommands/SceneView/Store";

	var subObjCount = Node.SubObjectCount(store);

	if(subObjCount > 0) {
		for(var i=subObjCount-1; i>=0; i--) {
			util.Delete(store + "/"+ Node.SubObject(store,i));
		}
	}

	var selCount = Node.SelectedCount();


	//will start blank if nothing is selected - select first scene item
	if(Node.SelectedCount() == 0) {
		var scene = Space.CurrentScene();
		Space.Select(scene + "/" + Node.SubObject(scene, 0));
	}

	var WMS = WindowsManager.GetWindowsManagerNodeName();

	var sceneViewNode = FindNodeByName(WMS, "Clintons3d SceneView Node");

	if(sceneViewNode) return;

	WindowsManager.CreateWindowFromCLSID('{E9C4FE3C-C3C9-4dfd-8C85-E7F0F81029B4}', '', '', '', 1);//scene view 2 

	//SetFrameOwnerFrame prevents docking and normal window behavior

	//var sceneview2 = WMS + '/' + Node.SubObject(WMS, Node.SubObjectCount(WMS) - 1)

	//WindowsManager.SetFrameOwnerFrame(sceneview2, WindowsManager.GetWorkWindow())

	if(selCount == 0) {
		Space.Unselect();
	}

}

function FindNodeByName(currentNode, searchName)
{
	if(Node.ShortName(currentNode) == searchName) {
		return currentNode;
	}

	var numsubobj = Node.SubObjectCount(currentNode);

	if(numsubobj == 0) return;

	for(var i=0;i<numsubobj;i++) {
		var subobj = currentNode + "/" + Node.SubObject(currentNode, i);
		var thenode = FindNodeByName(subobj, searchName);
		if(thenode) {
			return thenode;
		}
	}
}

openNodeGraphView

Code: Select all

// Execute 
// Called to execute the command 
function Execute(params)
{
	//set uufs
	if(Node.Exists("Scripts/UUCommands/UUFunctionSet")) {
		var sceneViewFS = Node.AccessNearFnSet("Clintons3dView Function Set");
		sceneViewFS.UUFS = Node.AccessFnSet("Scripts/UUCommands/UUFunctionSet");
	}

	var selCount = Node.SelectedCount();

	//will start blank if nothing is selected
	if(Node.SelectedCount() == 0) {
		var scene = Space.CurrentScene();
		Space.Select(scene + "/" + Node.SubObject(scene, 0));
	}

	var WMS = WindowsManager.GetWindowsManagerNodeName();

	var graphViewNode = FindNodeByName(WMS, "Clintons3d TemplateView Node");

	if(graphViewNode) return;

	WindowsManager.CreateWindowFromCLSID('{DD2E0D6B-ED84-4b80-A624-757525B8A591}', '', '', '', 1);//node view window

	//SetFrameOwnerFrame prevents docking and normal window behavior

	//var nodeview = WMS + '/' + Node.SubObject(WMS, Node.SubObjectCount(WMS) - 1)

	//WindowsManager.SetFrameOwnerFrame(nodeview, WindowsManager.GetWorkWindow())

	if(selCount == 0) {
		Space.Unselect();
	}

}

function FindNodeByName(currentNode, searchName)
{
	if(Node.ShortName(currentNode) == searchName) {
		return currentNode;
	}

	var numsubobj = Node.SubObjectCount(currentNode);

	if(numsubobj == 0) return;

	for(var i=0;i<numsubobj;i++) {
		var subobj = currentNode + "/" + Node.SubObject(currentNode, i);
		var thenode = FindNodeByName(subobj, searchName);
		if(thenode) {
			return thenode;
		}
	}
}
Clinton Reese

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

Re: Scene View 2

Post by trueBlue »

I updated your scripts, but having both open has issues!
The last opened and or one or the other Scene View flickers when your mouse is over the 3D View
Sometimes nether flickers, so it is intermittent
Edit: Just read previous post
Looks like it happens when nothing is selected
Further review, the Scene Graph Utilities seems to be the most prone with the flickering issue
User avatar
clintonman
Captain
Posts: 5432
Joined: 21 May 2009, 21:08
Type the number ten into the box: 0
Location: California
Contact:

Re: Scene View 2

Post by clintonman »

Update:
Previous fix did not work after restarting tS, so new fix released.

openSceneView2 and openNodeGraphView can have the top lines removed.

Code: Select all

	//set uufs
	if(Node.Exists("Scripts/UUCommands/UUFunctionSet")) {
		var sceneViewFS = Node.AccessNearFnSet("Clintons3dView Function Set");
		sceneViewFS.UUFS = Node.AccessFnSet("Scripts/UUCommands/UUFunctionSet");
	}
changes to Clintons3dView Function Set
comment out the top line

Code: Select all

//var UUFS;
and replace UUFS in the 2 delete functions

Code: Select all

		//UUFS.Delete();
		Node.AccessFnSet("Scripts/UUCommands/UUFunctionSet").Delete();
Clinton Reese

http://clintons3d.com
Post Reply