View topic - execute yafaray from command line

execute yafaray from command line

General questions related with the YafaRay Project, 3D computer graphics and about this site.

execute yafaray from command line

Post Fri Aug 21, 2009 2:00 pm

Hi,

I need to render my file.blend with yafaray from command line. I can´t use the user interface, only command line and i´m using windows.

I tried to use this command: blender -b blendfilename.blend -P yaf_export.py --batch
but i got a message error.
mmcls
 
Posts: 5
Joined: Fri Aug 21, 2009 1:44 pm

Re: execute yafaray from command line

Post Fri Aug 21, 2009 4:11 pm

You probably need to do it this way:

- Check the 'output to XML' button in the Yafaray script window in blender, and 'Render'. This will create an XML scene file in Yafarays internal format.
- Then you execute yafaray-xml (in the yafaray installation directory) with the XML file name as the parameter
Hyperspace
 
Posts: 21
Joined: Sun Feb 22, 2009 9:02 pm

Re: execute yafaray from command line

Post Fri Aug 21, 2009 10:02 pm

Hi HyperSpace,

And... Do you know how i can do this (Check the 'output to XML' button in the Yafaray script window in blender, and 'Render'. This will create an XML scene file in Yafarays internal format) from command line?


Thanks very much!!
mmcls
 
Posts: 5
Joined: Fri Aug 21, 2009 1:44 pm

Re: execute yafaray from command line

Post Sat Aug 22, 2009 2:23 am

The button is in under settings, in the Yafaray script panel.

It is documented here (you can see the button in the top screenshot): http://www.yafaray.org/documentation/us ... ersettings
Hyperspace
 
Posts: 21
Joined: Sun Feb 22, 2009 9:02 pm

Re: execute yafaray from command line

Post Tue Aug 25, 2009 5:33 pm

and from command line?
mmcls
 
Posts: 5
Joined: Fri Aug 21, 2009 1:44 pm

Re: execute yafaray from command line

Post Tue Aug 25, 2009 7:37 pm

I want to do some animations with yafaray distributing the scenes between multiple computers.. So I need to do from command line..
mmcls
 
Posts: 5
Joined: Fri Aug 21, 2009 1:44 pm

Re: execute yafaray from command line

Post Fri Sep 04, 2009 10:37 am

I could also really do with this functionality, or at least the the functionality from the "export to xml" button so that it creates a different xml (perhaps with a frame number postfix or prefix) per frame of the animation.
cjreyn
 
Posts: 1
Joined: Fri Sep 04, 2009 10:31 am

Re: execute yafaray from command line

Post Wed Sep 09, 2009 12:06 pm

check out this thread:
http://www.yafaray.org/community/forum/ ... 552#p13552
for command line script to render using blender and yafaray.

Also here:
http://www.farmerjoe.info/test/Farmerjo ... ditions.7z
you can find a version of my render queue manager Farmerjoe (http://www.farmerjoe.info) with very early support for yafaray, there is a bug parsing the output from yafaray so frame numbers over 9 are not registered as complete, I simply dont have time to fix it but thought some people may like to give it a try. There are of course probably other bugs too let me know if you find them my email is in the readme.

At present I have only been developing Farmerjoe yafaray support for windows as I need to use it at work and have been using it successfully to queue renders up however if you want to try on linux or mac you can use the included Farmerjoe.pl script (Farmerjoe.exe is a packaged Perl script made using PAR) but you may have to edit some perl and/or python to get it to work ;)

Please remember that this is not complete and I only provide it as you *may* find it useful or interesting - I have packaged it up in a hurry as I know some of you may benefit from it even in an unfinished state so email me if you have any problems Ill try to help you out.

mitch
lobo_nz
 
Posts: 6
Joined: Thu Jul 21, 2005 11:54 am
Location: New Zealand

Re: execute yafaray from command line

Post Wed Sep 09, 2009 12:14 pm

I think what both cjreyn and mmcls want is not to render from the command line, but to export to XML from the command line.

I'm not sure if this is possible at all, as you would have to launch blender with the corresponding .blend, open up the YafaRay-exporter and tell it to export to XML - all from the command line...
IkariShinji
 
Posts: 176
Joined: Tue May 05, 2009 6:57 pm

Re: execute yafaray from command line

Post Wed Mar 03, 2010 1:00 am

I managed to make a few modifications to get Yafaray to render in the background. This will let you render from a command shell, so render farm is a hop, skip and a jump away. (If you use Dr.Queue, then it a matter of creating the blender job..)

Create a backup of yaf_export.py (Found in C:\Program Files\YafaRay\python, on Windows) and just add this line, after the imports (line 28):

Code: Select all
Window.DrawProgressBar = lambda *x: 1


Then you have to add a Text file in your Blender document, name it "Text", containing the following:

Code: Select all

# import order IS important for sys.path.append seemingly
import sys
import os
import platform
import Blender

# Enter the abolsute path to the YafaRay directory or the relative path
# (as seen from Blender.exe)
# If you have a directory structure like this:
#
# ,- Blender (containing Blender.exe)
# +- YafaRay
# + ...
#
# then set dllPath = "..\\YafaRay\\"
# dllPath = "..\\YafaRay\\"

dllPath = ""
pythonPath = ""
haveQt = True

_SYS = platform.system()

if _SYS == 'Windows':
   if dllPath == "":
      import _winreg
      regKey = _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE, 'Software\\YafRay Team\\YafaRay')
      dllPath = _winreg.QueryValueEx(regKey, 'InstallDir')[0] + '\\'

   if pythonPath == "":
      pythonPath = dllPath + 'python\\'

   from ctypes import cdll
   dlls = ['zlib1','libpng3','jpeg62','Iex','Half','IlmThread',\
      'IlmImf','mingwm10','libfreetype-6','yafraycore', 'yafarayplugin']

   qtDlls = ['QtCore4', 'QtGui4', 'yafarayqt']
   if os.path.exists(dllPath + 'yafarayqt.dll'):
      dlls += qtDlls
      haveQt = True
   else:
      print "WARNING: Qt GUI will NOT be available."

   for dll in dlls:
      print "Loading DLL: " + dllPath + dll + '.dll'
      cdll.LoadLibrary(dllPath + dll + '.dll')

   dllPath = str(dllPath + 'plugins\\')

# append a non-empty pythonpath to sys
if pythonPath != "":
   pythonPath = os.path.normpath(pythonPath)
   sys.path.append(pythonPath)

# assume for all non-windows systems unix-like paths,
# add search paths for the scripts
if _SYS != 'Windows':
   if pythonPath == "":
      searchPaths = []
      searchPaths.append(os.environ['HOME'] + '/.blender/scripts/yafaray/')
      searchPaths.append('/usr/local/share/yafaray/blender/')
      searchPaths.append('/usr/share/yafaray/blender/')
      searchPaths.append(Blender.Get('scriptsdir') + '/yafaray/')
      for p in searchPaths:
         if os.path.exists(p):
            sys.path.append(p)

if haveQt:
   try:
      import yafqt
   except:
      haveQt = False
      print "ERROR: Importing yafqt failed, Qt GUI will NOT be available."


import yaf_export
from yaf_export import yafrayRender

Blender.Set("renderdir","C:\\") # A Sneaky way to force an alternative renderdir

yafrayRender().render()


and then run "blender.exe home-kitchen-1.blend -b -P Text" in your command shell. I've only tested this on Windows, but it does work for me. Tell me if you run into any problems.
kapace
 
Posts: 1
Joined: Wed Mar 03, 2010 12:59 am

Re: execute yafaray from command line

Post Sun Jan 09, 2011 5:52 pm

Hi,

I've tested your script on Linux, and it seems to work well in what concerns about starting the apps (blender and yafaray) properly and so. It doesn't work, tough, the rendering of sequences.

Mi case is the following: I have an animation say 100 frames long. I modify the script yaf_export.py and the blend file itself according to your indications. I create a job through drqman. The job is well taken from the slave, the terminal shows yafaray handling texture images, progressing bars and so. But if job goes from 1 to 100, yafaray renders every time frame 1, although it renders each time on a different file with a timestamp on its name.

Apparently it's an issue about incompatibily between your call to yafaray,
Code: Select all
blender myblendfile.blend -b -P Text

and the "syntax" or drqueue's way to call blender using its commandline options.

I've tested this using the Blender predefined job on drqman, and the generic one too, and trying to spread the needed parameters (-s, -e, -b, -P Text) in different places, including drqueue generated script, with no success.

I'm wrong? is this expected? there's an easy solution modifying your script above or something like this?

Thanks for your time,
Raimon
glaurung
 
Posts: 1
Joined: Sun Jan 09, 2011 5:38 pm


Return to News & Discussion



Who is online

Users browsing this forum: No registered users and 3 guests

cron