12 posts / 0 new
Last post
ForumImport
Offline
Last seen: 9 years 1 month ago
Joined: 09/22/2009 - 18:47
Yafray Xml And Python Scripting

hi there.
i noticed that when i render a preview in k3d the output is stored in /tmp, in particular the yafray 'world.xml' file is stored there.
1. is there a way i could get k3d to send that file to an external executable ?
2. if not is there a way i could retrieve the same rendering information another way? (python script?)
3. can anyone point me in the direction of a mirror of k3d's python api, http://www.k-3d.com/docs/epydoc <-- this one appears to be down

ForumImport
Offline
Last seen: 9 years 1 month ago
Joined: 09/22/2009 - 18:47
Yafray Xml And Python Scripting
ForumImport
Offline
Last seen: 9 years 1 month ago
Joined: 09/22/2009 - 18:47
Yafray Xml And Python Scripting

YafrayEngine renders scenes by creating the world.xml file, then running the executable "yafray" to render it. There isn't any way to access world.xml through scripting (you can use scripting to create new render engines, using the RenderEngineScript plugin, but that's a different use-case). So I've added a new property to YafrayEngine, "Executable", that defaults to yafray, but can be changed to anything that suits you. So you could use that to redirect rendering wherever you like. You'll have to build from the latest sources to get this change.
Thanks for the heads-up on the broken link, I've setup a redirect so it shouldn't be a problem in the future. All of the documentation is now hosted at k-3d.org.
Cheers,
Tim

ForumImport
Offline
Last seen: 9 years 1 month ago
Joined: 09/22/2009 - 18:47
Yafray Xml And Python Scripting

i thoroughly scraped the wiki for all info i could get before posting, i read about the RenderEngingeScript and it seemed like it did what i wanted (gave the output of the scene for rendering) but 0.7.10 and 0.7.11 configured perfectly but failed to build under latestbuntu karmic koala outputting something about end of file not being declared.
i could always hack around the problem by retrieving the world.xml files from /tmp but i would prefer to be able to script a more intergrated solution.
the error is posted below:
"""
[ 0%] Built target k3dsdk-parallel
[ 0%] Built target k3dsdk-sgi-tesselator
[ 0%] Built target k3dsdk-glew
[ 0%] Built target toFloat
[ 0%] Built target eLut
[ 1%] Built target k3dsdk-half
[ 1%] Building CXX object k3dsdk/CMakeFiles/k3dsdk.dir/gzstream.o
/home/radical/resources/stuff/k3d-source-0.7.10.0/k3dsdk/gzstream.cpp:71: error: ‘EOF’ was not declared in this scope
/home/radical/resources/stuff/k3d-source-0.7.10.0/k3dsdk/gzstream.cpp: In member function ‘virtual int k3d::filesystem::gzstreambuf::underflow()’:
/home/radical/resources/stuff/k3d-source-0.7.10.0/k3dsdk/gzstream.cpp:114: error: ‘EOF’ was not declared in this scope
/home/radical/resources/stuff/k3d-source-0.7.10.0/k3dsdk/gzstream.cpp:123: error: ‘EOF’ was not declared in this scope
/home/radical/resources/stuff/k3d-source-0.7.10.0/k3dsdk/gzstream.cpp: In member function ‘int k3d::filesystem::gzstreambuf::flush_buffer()’:
/home/radical/resources/stuff/k3d-source-0.7.10.0/k3dsdk/gzstream.cpp:139: error: ‘EOF’ was not declared in this scope
/home/radical/resources/stuff/k3d-source-0.7.10.0/k3dsdk/gzstream.cpp: In member function ‘virtual int k3d::filesystem::gzstreambuf::overflow(int)’:
/home/radical/resources/stuff/k3d-source-0.7.10.0/k3dsdk/gzstream.cpp:146: error: ‘EOF’ was not declared in this scope
/home/radical/resources/stuff/k3d-source-0.7.10.0/k3dsdk/gzstream.cpp:147: error: ‘EOF’ was not declared in this scope
/home/radical/resources/stuff/k3d-source-0.7.10.0/k3dsdk/gzstream.cpp:151: error: ‘EOF’ was not declared in this scope
/home/radical/resources/stuff/k3d-source-0.7.10.0/k3dsdk/gzstream.cpp: In member function ‘virtual int k3d::filesystem::gzstreambuf::sync()’:
/home/radical/resources/stuff/k3d-source-0.7.10.0/k3dsdk/gzstream.cpp:161: error: ‘EOF’ was not declared in this scope
make[2]: *** [k3dsdk/CMakeFiles/k3dsdk.dir/gzstream.o] Error 1
make[1]: *** [k3dsdk/CMakeFiles/k3dsdk.dir/all] Error 2
make: *** [all] Error 2
"""

ForumImport
Offline
Last seen: 9 years 1 month ago
Joined: 09/22/2009 - 18:47
Yafray Xml And Python Scripting

No, you need the latest sources from Mercurial:
http://www.k-3d.org/wiki/Code
Cheers,
Tim

ForumImport
Offline
Last seen: 9 years 1 month ago
Joined: 09/22/2009 - 18:47
Yafray Xml And Python Scripting

can you explain step by step how i can get it and build it, ive never used mecurial before

ForumImport
Offline
Last seen: 9 years 1 month ago
Joined: 09/22/2009 - 18:47
Yafray Xml And Python Scripting

Assuming you have installed mecurial and that you use a directory called projects for your builds:
cd projects
hg clone http://k3d.hg.sf.net/hgweb/k3d/k3d
mkdir k3d-build
cd k3d-build
ccmake ../k3d
# press c until you get the option to press g, it will then exit when finished
# note any missed dependencies and re run ccmake after you have added them.
# on a 4 core CPU I then build with all cores like this.
# NB -j5 is one more than the number of cores you wish to use.
make -j5
# then if in ccmake you enabled testing you can then run the tests with,
ctest -D Experimental
# to run the application without installing it just,
make run

ForumImport
Offline
Last seen: 9 years 1 month ago
Joined: 09/22/2009 - 18:47
Yafray Xml And Python Scripting

thanks, i tried that and it compiled up to 59% then it failed
"""
Scanning dependencies of target k3d-ngui-snap-tool
[ 59%] Building CXX object modules/ngui_snap_tool/CMakeFiles/k3d-ngui-snap-tool.dir/snap_tool_detail.cpp.o
[ 59%] Building CXX object modules/ngui_snap_tool/CMakeFiles/k3d-ngui-snap-tool.dir/tool.cpp.o
/home/radical/resources/projects/k3d/modules/ngui_snap_tool/tool.cpp: In function ‘std::_Ios_Fmtflags& std::operator&=(std::_Ios_Fmtflags&, std::_Ios_Fmtflags)’:
/home/radical/resources/projects/k3d/modules/ngui_snap_tool/tool.cpp:1006: internal compiler error: in get_expr_operands, at tree-ssa-operands.c:2072
Please submit a full bug report,
with preprocessed source if appropriate.
See for instructions.
make[2]: *** [modules/ngui_snap_tool/CMakeFiles/k3d-ngui-snap-tool.dir/tool.cpp.o] Error 1
make[1]: *** [modules/ngui_snap_tool/CMakeFiles/k3d-ngui-snap-tool.dir/all] Error 2
make: *** [all] Error 2
"""
if someone has already compiled this app why cant they just give me the binary?
radical@radical-desktop:~/resources/projects/build$ uname -a
Linux radical-desktop 2.6.31-15-generic #50-Ubuntu SMP Tue Nov 10 14:54:29 UTC 2009 i686 GNU/Linux

ForumImport
Offline
Last seen: 9 years 1 month ago
Joined: 09/22/2009 - 18:47
Yafray Xml And Python Scripting

i managed to get it to build but it wont start
"""
radical@radical-desktop:/opt/k3d/bin$ ls
k3d k3d-renderframe k3d-renderjob k3d-sl2xml k3d-uuidgen
radical@radical-desktop:/opt/k3d/bin$ ./k3d
./k3d: error while loading shared libraries: libk3dsdk-half.so: cannot open shared object file: No such file or directory
radical@radical-desktop:/opt/k3d/bin$
"""
any ideas??
EDIT: i just ran it from the build directory and it worked perfectly :). any advice for working with the RenderEngineScript plugin?

ForumImport
Offline
Last seen: 9 years 1 month ago
Joined: 09/22/2009 - 18:47
Yafray Xml And Python Scripting

"""
So I've added a new property to YafrayEngine, "Executable", that defaults to yafray, but can be changed to anything that suits you. So you could use that to redirect rendering wherever you like. You'll have to build from the latest sources to get this change.
"""
Thanks for that Timothy
could you tell me exactly what information is being sent to the binary so i know what to expect, does it send the full yafray xml, or the the direct location to the one created in /tmp?
I made a small python script to check, but it failed
"""
#!/usr/bin/python
import sys
test = open('/home/radical/test.log','w')
for arg in sys.argv:
test.write(arg+"\n")
test.write("done")
test.close()
"""
im trying to make a small toon renderer that will render out the frames with cairo http://www.cairographics.org/samples/ i need to somehow get my hands on the coords of each object in each frame. any help is welcome, thanks in advance

ForumImport
Offline
Last seen: 9 years 1 month ago
Joined: 09/22/2009 - 18:47
Yafray Xml And Python Scripting

You can see the command that gets executed in your console - we run the yafray executable, followed by the path to the world.xml file.
Your sample script works fine here, I suspect you might have forgotten to set its execute flag.
It does sound as if RenderEngineScript is what you really want, since a render script has access to the full K-3D scene, which is much richer than the contents of a Yafray XML file.
Cheers,
Tim

ForumImport
Offline
Last seen: 9 years 1 month ago
Joined: 09/22/2009 - 18:47
Yafray Xml And Python Scripting

You may also wish to take a look at this, http://freestyle.sourceforge.net/index.php

Log in or register to post comments