trueSpace7.6 - Show Object Attributes (Bug)

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

trueSpace7.6 - Show Object Attributes (Bug)

Post by trueBlue »

SOA.PNG
SOA.PNG (5.21 KiB) Viewed 1992 times
trueSpace7.6's Show - Object Render Attributes is crazy!
Every time you select this button, it creates and shows the object's Object Render Attributes in Settings.

Code: Select all

D3DView.ShowRenderAttribsForObject('','')
:? There can be several and you do not know which one is which!
MORA.PNG
If you apply it to a 3D Encapsulation, and then apply it to one of the Sub Objects, you will get multiple panels
ORA SubObjects.PNG
This seems to help with the duplication:

Code: Select all

function Execute(params)
{
	Nsel = Node.SelectedCount()
	SelArray = new Array(Nsel)

	for (i=0; i<Nsel; i++)
	{
	  SelArray[i] = Node.Selected(i)
	}

	for (i=0; i<Nsel; i++)
	{
	  Sel = SelArray[i]
	  Node.Select(Sel)

	if(Node.Exists(Sel + "/Object Render Attributes") || (Node.Exists(Sel + "/RenderAttributes")))
	  for (j=0; j<Nsel; j++)
	 	{
		if(!Node.ConExists(Sel, "WldMatrix")) return;
		Node.Delete(Sel +  "/Object Render Attributes")
		Node.Delete(Sel +  "/RenderAttributes")
		Node.ConRemove(Sel,"Input Attributes")
		}
		Node.Delete(Sel +  "/Object Render Attributes")
		D3DView.ShowRenderAttribsForObject('','')
		}
}
User avatar
trueBlue
Captain
Posts: 5208
Joined: 06 Jul 2009, 22:50
Type the number ten into the box: 10

Re: trueSpace7.6 - Show Object Attributes (Bug)

Post by trueBlue »

Made some modifications in Clinton's Show script that is included in the Unofficial Updates.
Wanting to create a different way that stops the Object Render Attributes panel from showing in Settings
This works for single objects:

Code: Select all

function Execute(params)
{
	Nsel = Node.SelectedCount()
	SelArray = new Array(Nsel)

	for (i=0; i<Nsel; i++)
	{
	  SelArray[i] = Node.Selected(i)
	}

	for (i=0; i<Nsel; i++)
	{
	  Sel = SelArray[i]
	  Node.Select(Sel)

	if(!Node.ConExists(Sel, "WldMatrix")) return;

	if(!Node.Exists(Sel + "/Object Render Attributes"))
	  for (j=0; j<Nsel; j++)
 	  {
		Node.Delete(Sel +  "/OwnerName")
		Node.Create('Kernel Package/OwnerName', Sel + "/")
//		D3DView.ShowRenderAttribsForObject('','')
Node.Delete(Sel +  "/Object Render Attributes")
RsFileIO.LoadObject(System.GetMainDir() + "\\Scripts\\preobjects\\ObjectAttributes.rsobj", Sel + "/")
Node.ConRemove(Sel, "RenderAttributes")
Node.ExportConnector(Sel + "/Object Render Attributes", "RenderAttributes", "", 1, 1)


		Node.ConnectTo(Sel + "/OwnerName", "Object Name", Sel + "/Object Render Attributes", "Object_Name")
		Node.Value(Sel +  "/Object Render Attributes", "Invisible") = 0
	  }
	if(!Node.ConExists(Sel + "/Object Render Attributes", "Object_Name"))
	  for (j=0; j<Nsel; j++)
 	  {
		Node.Delete(Sel +  "/Object Render Attributes")
		Node.Delete(Sel +  "/OwnerName")
		Node.Create('Kernel Package/OwnerName', Sel + "/")
//		D3DView.ShowRenderAttribsForObject('','')
Node.Delete(Sel +  "/Object Render Attributes")
RsFileIO.LoadObject(System.GetMainDir() + "\\Scripts\\preobjects\\ObjectAttributes.rsobj", Sel + "/")
Node.ConRemove(Sel, "RenderAttributes")
Node.ExportConnector(Sel + "/Object Render Attributes", "RenderAttributes", "", 1, 1)

		Node.ConnectTo(Sel + "/OwnerName", "Object Name", Sel + "/Object Render Attributes", "Object_Name")
		Node.Value(Sel +  "/Object Render Attributes", "Invisible") = 0
	  }
	if(Node.ConExists(Sel + "/Object Render Attributes", "Object_Name"))
	  for (j=0; j<Nsel; j++)
 	  {
		Node.Delete(Sel +  "/OwnerName")
		Node.Delete(Sel +  "/Object Render Attributes")
		Node.Create('Kernel Package/OwnerName', Sel + "/")
//		D3DView.ShowRenderAttribsForObject('','')
Node.Delete(Sel +  "/Object Render Attributes")
RsFileIO.LoadObject(System.GetMainDir() + "\\Scripts\\preobjects\\ObjectAttributes.rsobj", Sel + "/")
Node.ConRemove(Sel, "RenderAttributes")
Node.ExportConnector(Sel + "/Object Render Attributes", "RenderAttributes", "", 1, 1)

		Node.ConnectTo(Sel + "/OwnerName", "Object Name", Sel + "/Object Render Attributes", "Object_Name")
		Node.Value(Sel +  "/Object Render Attributes", "Invisible") = 0
	  }
	if(Node.Exists(Sel + "/Object hider"))

	  for (j=0; j<Nsel; j++)
		{
		Node.Disconnect(Sel + "/Object hider", "Invisible", Sel + "/Object Render Attributes", "Invisible")
		Node.ConnectTo(Sel + "/Object hider", "Invisible", Sel + "/Object Render Attributes", "Invisible")
		}
	if(Node.ConExists(Sel, "Input Attributes"))
	  for (j=0; j<Nsel; j++)
 	  {
		Node.ConRemove(Sel, "Input Attributes")
	  }
	if (Node.ConExists(Sel, "LightAttributes"))

	  for (j=0; j<Nsel; j++)
		{
		Node.Value(Sel +  "/Object Render Attributes", "Cast shadows") = 0
		Node.Value(Sel +  "/Object Render Attributes", "Receive shadows") = 0
		Node.Disconnect(Sel + "/Object hider", "Invisible", Sel + "/Object Render Attributes", "Invisible")
		Node.ConnectTo(Sel + "/Object hider", "Invisible", Sel + "/Object Render Attributes", "Invisible")
		}
	if (Node.ConExists(Sel, "Camera"))

	  for (j=0; j<Nsel; j++)
		{
		Node.Value(Sel +  "/Object Render Attributes", "Cast shadows") = 0
		Node.Value(Sel +  "/Object Render Attributes", "Receive shadows") = 0
		Node.Disconnect(Sel + "/Object hider", "Invisible", Sel + "/Object Render Attributes", "Invisible")
		Node.ConnectTo(Sel + "/Object hider", "Invisible", Sel + "/Object Render Attributes", "Invisible")
		Node.ConRemove(Sel, "Object Name")
		Node.ExportConnector(Sel + "/OwnerName", "Object Name", "", 1, 1)
		}
	}

}
But does not work for Encapsulated objects!
WIP:

Code: Select all

function Execute(params)
{
var Sel = Node.Selection()

if(!Node.ConExists(Sel, "WldMatrix")) return;

if(Node.Exists(Sel + "/Object Render Attributes") || (Node.Exists(Sel + "/RenderAttributes")))
{
Node.Delete(Sel +  "/Object Render Attributes")
Node.Delete(Sel +  "/RenderAttributes")
Node.ConRemove(Sel,"Input Attributes")
}
D3DView.ShowRenderAttribsForObject('','')


/*
TODO:
Modify the above for multiple selections 
Remove --> D3DView.ShowRenderAttribsForObject('','')

		if(!Node.Exists(Sel + "/Object Render Attributes"))
		{
		Node.Delete(Sel +  "/Object Render Attributes")
		RsFileIO.LoadObject(System.GetMainDir() + "\\Scripts\\preobjects\\ObjectAttributes.rsobj", Sel + "/")
		Node.ConRemove(Sel, "RenderAttributes")
		Node.ExportConnector(Sel + "/Object Render Attributes", "RenderAttributes", "", 1, 1)
	  }

		if(!Node.Exists(Sel + "/RenderAttributes"))
		{
		Node.Create("Space 3D Package/RenderAttributes", Sel + "/")
Errror...
Node.ExportConnector(Sel + "/RenderAttributes", "InputAttributes", "", 1, 1)
Node.ExportConnector(Sel + "/RenderAttributes", "RenderAttributes", "", 1, 1)

		Node.ConnectTo(Sel + "/Object Render Attributes", "RenderAttributes", Sel, "Input Attributes")
	  }
TODO: Connect/Export -- > RenderAttributes node

*/

}
Post Reply