YafaRay4tS v1.0.0

LightWorks, VRay, Dribble, YafaRay and more..
User avatar
trueBlue
Captain
Posts: 5216
Joined: 06 Jul 2009, 22:50
Type the number ten into the box: 10

Re: YafaRay4tS v1.0.0

Post by trueBlue »

Render something in YafaRay4tS
Open the Image Viewer and open the above image
Change something and Render
Press the Refresh button in the Image Viewer
Refresh.png
.
I updated the Image Viewer in the previous post with your changes and made a few adjustments with Reset and the panel
User avatar
clintonman
Captain
Posts: 5432
Joined: 21 May 2009, 21:08
Type the number ten into the box: 0
Location: California
Contact:

Re: YafaRay4tS v1.0.0

Post by clintonman »

trueBlue wrote: 08 Mar 2024, 16:32 Render something in YafaRay4tS
Open the Image Viewer and open the above image
Change something and Render
Press the Refresh button in the Image Viewer
Refresh.png
.
I updated the Image Viewer in the previous post with your changes and made a few adjustments with Reset and the panel
Here are changes to OptDetectorFrame2 inside the tSDisplay to fix the problem.

OptDetectorFrame2

Code: Select all

// Execute 
// Called to execute the command 
function Execute(params) 
{
	util = System.CreateDO("Clintons3D Package/Utility functions");
	
	var Yaf_UseInternalViewer = Node.Value(Space.CurrentScene() + "/YafaRay4tS" + '/UIstate', 'Yaf_UseInternalViewer');
	var Yaf_UseCustomViewer = Node.Value(Space.CurrentScene() + "/YafaRay4tS" + '/UIstate', 'Yaf_UseCustomViewer');
	var InternalViewer = Node.Value(Space.CurrentScene() + "/YafaRay4tS" + '/UIstate', "InternalViewer");
	if (!Yaf_UseInternalViewer && !Yaf_UseCustomViewer && InternalViewer != "iOptDetector") {
		return;
	}

	var Yaf_RenderFilename = Node.Value(System.ThisOwner(), 'Yaf_RenderFilename');
	var fso = new ActiveXObject("Scripting.FileSystemObject");

	var bmpViewNode = Space.CurrentScene() + "/YafaRay4tS/tSDisplay/BmpViewTransmitter";
	var numFrames = Node.SubObjectCount("/Project/Windows Manager Space");
	var windowFrames = [];
	var numOptiViews = 0;
	
	for (var i = 0; i < numFrames; i++) {
		var curnode = "/Project/Windows Manager Space/" + Node.SubObject("/Project/Windows Manager Space", i);
		windowFrames.push(curnode);
		if (Node.ConExists(curnode, "RootNode") && Node.Value(curnode, "RootNode") == bmpViewNode) {
			numOptiViews++;
			OptDetectorFrame = curnode;
		}
	}
	
	// zero found, open opti window for the render
	if (numOptiViews == 0) {
		OptDetectors.OpenBitmapView(Space.CurrentScene() + "/YafaRay4tS/tSDisplay/BmpViewTransmitter");
		OptDetectorFrame = FindRenderOptWindow();
	}
	
	//close all open opti windows except for 1
	//more than one found - should never happen safety net
	else if (numOptiViews > 1) {
		for (var i = 0; i < numFrames; i++) {
			if (!Node.ConExists(windowFrames[i], "RootNode")) continue;
			// if (Node.Value(windowFrames[i], "RootNode") == bmpViewNode && numOptiViews > 1) {
			// 	WindowsManager.CloseWindow(windowFrames[i]);
			// 	numOptiViews--;
			// }
			if (Node.Value(windowFrames[i], "RootNode") == bmpViewNode) {
				if (numOptiViews > 1) {
					WindowsManager.CloseWindow(windowFrames[i]);
					numOptiViews--;
				} else {
					OptDetectorFrame = windowFrames[i];
				}
			}
		}
	
	// } else if (numOptiViews != 1) {
	}

	// OptDetectorFrame = FindRenderOptWindow();

	if (OptDetectorFrame != "") {
		// Add toolbar and size viewer to Output Render File's Width and Height
		var Yaf_UseAreaRender = Node.Value(Space.CurrentScene() + '/YafaRay4tS/ExportXML', 'Yaf_UseAreaRender');
		if(Yaf_UseAreaRender) {
			var Yaf_Width = Node.Value(Space.CurrentScene() + '/YafaRay4tS/ExportXML', 'Yaf_Width');
			var Yaf_Height = Node.Value(Space.CurrentScene() + '/YafaRay4tS/ExportXML', 'Yaf_Height');
			WindowsManager.MoveWindow(OptDetectorFrame, -1, -1, Yaf_Width, Yaf_Height, -1, -1, -1)
		} else {
			var size = GetHeightWidth();
			WindowsManager.MoveWindow(OptDetectorFrame, -1, -1, size.Width, size.Height, -1, -1, -1)
		}

		Node.Value(OptDetectorFrame, "TabsAsButtons") = -1;//util version does not work

		var fileSN = fso.GetBaseName(Yaf_RenderFilename) + "." + fso.GetExtensionName(Yaf_RenderFilename)
		// Node.Value(OptDetectorFrame, "Title") = Node.ShortName(Space.CurrentScene()) + " - " + fileSN;
		util.SetNodeValueString(OptDetectorFrame, "Title", Node.ShortName(Space.CurrentScene()) + " - " + fileSN);

		if (!Node.Exists(OptDetectorFrame + "/YafaRay4tS_ToolbarFrame")) {
			// Node.Copy(Space.CurrentScene() + "/YafaRay4tS/tSDisplay/YafaRay4tS_ToolbarFrame", OptDetectorFrame)
			util.Copy(Space.CurrentScene() + "/YafaRay4tS/tSDisplay/YafaRay4tS_ToolbarFrame", OptDetectorFrame)
			WindowsManager.Activate();
			WindowsManager.UpdateWindowsStructure();
		} else {
			//rewrite RootNode to force title update
			// Node.Value(OptDetectorFrame, "RootNode") = Space.CurrentScene() + "/YafaRay4tS/tSDisplay/BmpViewTransmitter";
			util.SetNodeValueString(OptDetectorFrame, "RootNode", Space.CurrentScene() + "/YafaRay4tS/tSDisplay/BmpViewTransmitter");
		}
	}

	//reset connector so image shows in the frame
	// Node.ConReset(Space.CurrentScene() + "/YafaRay4tS/tSDisplay/BmpViewTransmitter", "Bitmap");
	util.ConReset(Space.CurrentScene() + "/YafaRay4tS/tSDisplay/BmpViewTransmitter", "Bitmap", Space.CurrentScene() + "/YafaRay4tS/tSDisplay/BmpViewTransmitter", "Bitmap");

	CMD = Node.Value(Space.CurrentScene() + "/YafaRay4tS/ClearHistory", "ClearCommandHistory")

	if(CMD){RsApp.ClearHistory();}

}

function GetHeightWidth() 
{
	// var size = {};
	var Width = Node.Value(Space.CurrentScene() + "/YafaRay4tS", "Yaf_ResX")
	var Height = Node.Value(Space.CurrentScene() + "/YafaRay4tS", "Yaf_ResY")

	// var maxWidth = Math.floor(Node.Value("/Project/Windows Manager Space", "LayoutWidth") * 0.7);
	// var maxHeight = Math.floor(Node.Value("/Project/Windows Manager Space", "LayoutHeight") * 0.7);
	var maxWidth = Math.floor(Node.Value("/Project/Windows Manager Space/Frame Window", "Width") * 0.7);
	var maxHeight = Math.floor(Node.Value("/Project/Windows Manager Space/Frame Window", "Height") * 0.7);

	if (Height > maxHeight) {
		Width = Math.floor(Width * maxHeight / Height);
		Height = maxHeight;
	}
	if (Width > maxWidth) {
		Height = Math.floor(Height * maxWidth / Width);
		Width = maxWidth;
	}

	return {
		"Width": Width,
		"Height": Height
	}
}

function FindRenderOptWindow() 
{
	var childNode, OptWindow = "";
	var wms = "/Project/Windows Manager Space";
	var numChildren = Node.SubObjectCount(wms);
	var childNode
	for (var i = 0; i < numChildren; i++) {
		childNode = wms + "/" + Node.SubObject(wms, i);
		if (Node.Exists(childNode + "/BitmapView") && !Node.Exists(childNode + "/Ground")) {
			OptWindow = childNode;
			// break;
		}
	}

	return OptWindow;
}
Clinton Reese

http://clintons3d.com
User avatar
clintonman
Captain
Posts: 5432
Joined: 21 May 2009, 21:08
Type the number ten into the box: 0
Location: California
Contact:

Re: YafaRay4tS v1.0.0

Post by clintonman »

YafImageViewerMin256Width.jpg
Modified your last Image Viewer for minimum width of 256. 256 so there's some room for the image name.
Attachments
Image Viewer TB.RsObj
(47.61 KiB) Downloaded 4 times
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: YafaRay4tS v1.0.0

Post by trueBlue »

Thanks, got the updates :bananathumb:
User avatar
clintonman
Captain
Posts: 5432
Joined: 21 May 2009, 21:08
Type the number ten into the box: 0
Location: California
Contact:

Re: YafaRay4tS v1.0.0

Post by clintonman »

YafBGNightSunSky.jpg

Darktide night preview
has the same unfixable limitations as the day light, but it looks good with the sun/moon in some locations. moon/sun behind the camera seems to give the best previews
Clinton Reese

http://clintons3d.com
User avatar
bitkar
Captain
Posts: 1971
Joined: 16 Mar 2010, 07:14
Type the number ten into the box: 0
Location: Czech Republic
Contact:

Re: YafaRay4tS v1.0.0

Post by bitkar »

omg guys... it seems there will be yafaray4ts v2 soon :D keep it up!
Michal aka bitkar
tS freak since tS2 (1998) and forever (tS7.61 modeler)
User avatar
the_ant
Chief Petty Officer
Posts: 149
Joined: 02 Jun 2009, 09:26
Type the number ten into the box: 0
Location: Perugia - Italy

Re: YafaRay4tS v1.0.0

Post by the_ant »

Happy to browse through quasi-daily news in this amazing forum...

My "simple" question is: What are Pros and Cons in YafaRay versus VRay or Lightworks in TSp?

Hi all the gurues that keep this software still alive 15 years from its dismission... :bananacheers:
User avatar
bitkar
Captain
Posts: 1971
Joined: 16 Mar 2010, 07:14
Type the number ten into the box: 0
Location: Czech Republic
Contact:

Re: YafaRay4tS v1.0.0

Post by bitkar »

Vray has some minor bugs. Yafaray work a bit different when it comes to light sources. It uses objects and surfaces to emit lights as a primary (only?) method. This is very interesting way to do it. It also worked relatively fast, as I remember.
Michal aka bitkar
tS freak since tS2 (1998) and forever (tS7.61 modeler)
User avatar
trueBlue
Captain
Posts: 5216
Joined: 06 Jul 2009, 22:50
Type the number ten into the box: 10

Re: YafaRay4tS v1.0.0

Post by trueBlue »

@Clinton
External Viewer Active does not Show/Display the Rendered image using the TGA Viewer or the djv program
C:\Program Files\DJV2\bin\djv.exe

The YafaRay4tS/UIstate node never seems to change even though the YafaRay4tS scripts and the CustomCommands/YafarayScripts scripts seem to change the values

Here is a scene with a new(today)/current downloaded YafaRay4tS panel

Note: The View button does open the djv program on my pc
Attachments
YafaRay4tS External Viewer.RsScn
(1.9 MiB) Downloaded 4 times
User avatar
trueBlue
Captain
Posts: 5216
Joined: 06 Jul 2009, 22:50
Type the number ten into the box: 10

Re: YafaRay4tS v1.0.0

Post by trueBlue »

I do not see any code opening the Open External Viewer script
Is the Open External Viewer script suppose to be hooked up as shown:
Open External Viewer.png
Post Reply