2010-10-16 17:26:40 +00:00
|
|
|
# ##### BEGIN GPL LICENSE BLOCK #####
|
|
|
|
#
|
|
|
|
# This program is free software; you can redistribute it and/or
|
|
|
|
# modify it under the terms of the GNU General Public License
|
|
|
|
# as published by the Free Software Foundation; either version 2
|
|
|
|
# of the License, or (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this program; if not, write to the Free Software Foundation,
|
|
|
|
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
#
|
|
|
|
# ##### END GPL LICENSE BLOCK #####
|
|
|
|
|
|
|
|
# <pep8 compliant>
|
|
|
|
|
|
|
|
# classes for extracting info from blenders internal classes
|
|
|
|
|
|
|
|
import bpy
|
|
|
|
import bgl
|
|
|
|
|
|
|
|
import sys
|
|
|
|
|
2011-01-01 07:20:34 +00:00
|
|
|
|
2010-10-16 17:26:40 +00:00
|
|
|
def cutPoint(text, length):
|
2012-06-19 22:17:19 +00:00
|
|
|
"""Returns position of the last space found before 'length' chars"""
|
2011-01-01 07:20:34 +00:00
|
|
|
l = length
|
|
|
|
c = text[l]
|
|
|
|
while c != ' ':
|
|
|
|
l -= 1
|
|
|
|
if l == 0:
|
|
|
|
return length # no space found
|
|
|
|
c = text[l]
|
|
|
|
return l
|
|
|
|
|
|
|
|
|
|
|
|
def textWrap(text, length=70):
|
|
|
|
lines = []
|
|
|
|
while len(text) > 70:
|
|
|
|
cpt = cutPoint(text, length)
|
|
|
|
line, text = text[:cpt], text[cpt + 1:]
|
|
|
|
lines.append(line)
|
|
|
|
lines.append(text)
|
|
|
|
return lines
|
|
|
|
|
2010-10-16 17:26:40 +00:00
|
|
|
|
|
|
|
def write_sysinfo(op):
|
2011-01-01 07:20:34 +00:00
|
|
|
output_filename = "system-info.txt"
|
|
|
|
|
2011-03-22 11:44:46 +00:00
|
|
|
output = bpy.data.texts.get(output_filename)
|
|
|
|
if output:
|
2011-01-01 07:20:34 +00:00
|
|
|
output.clear()
|
|
|
|
else:
|
|
|
|
output = bpy.data.texts.new(name=output_filename)
|
|
|
|
|
2012-03-04 03:14:38 +00:00
|
|
|
header = "= Blender %s System Information =\n" % bpy.app.version_string
|
|
|
|
lilies = "%s\n\n" % (len(header) * "=")
|
|
|
|
firstlilies = "%s\n" % (len(header) * "=")
|
2011-01-01 07:20:34 +00:00
|
|
|
output.write(firstlilies)
|
|
|
|
output.write(header)
|
|
|
|
output.write(lilies)
|
|
|
|
|
|
|
|
# build info
|
2012-03-04 03:14:38 +00:00
|
|
|
output.write("\nBlender:\n")
|
2011-01-01 07:20:34 +00:00
|
|
|
output.write(lilies)
|
2013-11-04 13:21:39 +00:00
|
|
|
if bpy.app.build_branch and bpy.app.build_branch != "Unknown":
|
2013-11-15 11:11:59 +00:00
|
|
|
output.write("version %s, branch %r, commit date %r %r, hash %r, %r\n" %
|
2013-11-04 13:21:39 +00:00
|
|
|
(bpy.app.version_string,
|
|
|
|
bpy.app.build_branch,
|
2013-11-15 11:11:59 +00:00
|
|
|
bpy.app.build_commit_date,
|
|
|
|
bpy.app.build_commit_time,
|
2013-11-04 13:21:39 +00:00
|
|
|
bpy.app.build_hash,
|
|
|
|
bpy.app.build_type))
|
|
|
|
else:
|
|
|
|
output.write("version %s, revision %r. %r\n" %
|
|
|
|
(bpy.app.version_string,
|
|
|
|
bpy.app.build_change,
|
|
|
|
bpy.app.build_type))
|
|
|
|
|
2012-03-04 03:14:38 +00:00
|
|
|
output.write("build date: %r, %r\n" % (bpy.app.build_date, bpy.app.build_time))
|
|
|
|
output.write("platform: %r\n" % (bpy.app.build_platform))
|
|
|
|
output.write("binary path: %r\n" % (bpy.app.binary_path))
|
|
|
|
output.write("build cflags: %r\n" % (bpy.app.build_cflags))
|
|
|
|
output.write("build cxxflags: %r\n" % (bpy.app.build_cxxflags))
|
|
|
|
output.write("build linkflags: %r\n" % (bpy.app.build_linkflags))
|
|
|
|
output.write("build system: %r\n" % (bpy.app.build_system))
|
2011-01-01 07:20:34 +00:00
|
|
|
|
|
|
|
# python info
|
2012-03-04 03:14:38 +00:00
|
|
|
output.write("\nPython:\n")
|
2011-01-01 07:20:34 +00:00
|
|
|
output.write(lilies)
|
2012-03-04 03:14:38 +00:00
|
|
|
output.write("version: %s\n" % (sys.version))
|
|
|
|
output.write("paths:\n")
|
2011-01-01 07:20:34 +00:00
|
|
|
for p in sys.path:
|
2012-03-04 03:14:38 +00:00
|
|
|
output.write("\t%r\n" % (p))
|
2011-01-01 07:20:34 +00:00
|
|
|
|
2012-03-04 03:14:38 +00:00
|
|
|
output.write("\nDirectories:\n")
|
2011-01-01 07:20:34 +00:00
|
|
|
output.write(lilies)
|
2012-03-04 03:14:38 +00:00
|
|
|
output.write("scripts: %r\n" % (bpy.utils.script_paths()))
|
2012-07-29 01:02:25 +00:00
|
|
|
output.write("user scripts: %r\n" % (bpy.utils.script_path_user()))
|
|
|
|
output.write("pref scripts: %r\n" % (bpy.utils.script_path_pref()))
|
2012-03-04 03:14:38 +00:00
|
|
|
output.write("datafiles: %r\n" % (bpy.utils.user_resource('DATAFILES')))
|
|
|
|
output.write("config: %r\n" % (bpy.utils.user_resource('CONFIG')))
|
|
|
|
output.write("scripts : %r\n" % (bpy.utils.user_resource('SCRIPTS')))
|
|
|
|
output.write("autosave: %r\n" % (bpy.utils.user_resource('AUTOSAVE')))
|
|
|
|
output.write("tempdir: %r\n" % (bpy.app.tempdir))
|
|
|
|
|
|
|
|
output.write("\nFFmpeg:\n")
|
2011-12-28 12:35:58 +00:00
|
|
|
output.write(lilies)
|
|
|
|
ffmpeg = bpy.app.ffmpeg
|
|
|
|
if ffmpeg.supported:
|
2012-06-19 22:17:19 +00:00
|
|
|
for lib in ("avcodec", "avdevice", "avformat", "avutil", "swscale"):
|
2012-03-04 03:14:38 +00:00
|
|
|
output.write("%r:%r%r\n" % (lib, " " * (10 - len(lib)),
|
|
|
|
getattr(ffmpeg, lib + "_version_string")))
|
2011-12-28 12:35:58 +00:00
|
|
|
else:
|
2012-03-04 03:14:38 +00:00
|
|
|
output.write("Blender was built without FFmpeg support\n")
|
2011-12-28 12:35:58 +00:00
|
|
|
|
2013-12-08 09:03:17 +00:00
|
|
|
output.write("\nOther Libraries:\n")
|
|
|
|
output.write(lilies)
|
|
|
|
ocio = bpy.app.ocio
|
|
|
|
output.write("OpenColorIO: ")
|
|
|
|
if ocio.supported:
|
|
|
|
if ocio.version_string == "fallback":
|
|
|
|
output.write("Blender was built with OpenColorIO, " +
|
|
|
|
"but it currently uses fallback color management.\n")
|
|
|
|
else:
|
|
|
|
output.write("%s\n" % (ocio.version_string))
|
|
|
|
else:
|
|
|
|
output.write("Blender was built without OpenColorIO support\n")
|
|
|
|
|
|
|
|
oiio = bpy.app.oiio
|
|
|
|
output.write("OpenImageIO: ")
|
2014-02-12 21:51:33 +00:00
|
|
|
if ocio.supported:
|
2013-12-08 09:03:17 +00:00
|
|
|
output.write("%s\n" % (oiio.version_string))
|
|
|
|
else:
|
|
|
|
output.write("Blender was built without OpenImageIO support\n")
|
|
|
|
|
2013-12-08 11:13:09 +00:00
|
|
|
output.write("OpenShadingLanguage: ")
|
2013-12-08 09:03:17 +00:00
|
|
|
if bpy.app.build_options.cycles:
|
|
|
|
if bpy.app.build_options.cycles_osl:
|
|
|
|
from _cycles import osl_version_string
|
|
|
|
output.write("%s\n" % (osl_version_string))
|
|
|
|
else:
|
|
|
|
output.write("Blender was built without OpenShadingLanguage support in Cycles\n")
|
|
|
|
else:
|
|
|
|
output.write("Blender was built without Cycles support\n")
|
|
|
|
|
2011-03-22 11:44:46 +00:00
|
|
|
if bpy.app.background:
|
2012-03-04 03:14:38 +00:00
|
|
|
output.write("\nOpenGL: missing, background mode\n")
|
2011-03-22 11:44:46 +00:00
|
|
|
else:
|
2012-03-04 03:14:38 +00:00
|
|
|
output.write("\nOpenGL\n")
|
2011-03-22 11:44:46 +00:00
|
|
|
output.write(lilies)
|
2012-03-04 03:14:38 +00:00
|
|
|
output.write("renderer:\t%r\n" % (bgl.glGetString(bgl.GL_RENDERER)))
|
|
|
|
output.write("vendor:\t\t%r\n" % (bgl.glGetString(bgl.GL_VENDOR)))
|
|
|
|
output.write("version:\t%r\n" % (bgl.glGetString(bgl.GL_VERSION)))
|
|
|
|
output.write("extensions:\n")
|
2011-03-22 11:44:46 +00:00
|
|
|
|
|
|
|
glext = bgl.glGetString(bgl.GL_EXTENSIONS)
|
|
|
|
glext = textWrap(glext, 70)
|
|
|
|
for l in glext:
|
2012-03-04 03:14:38 +00:00
|
|
|
output.write("\t\t%r\n" % (l))
|
2011-01-01 07:20:34 +00:00
|
|
|
|
2014-01-04 14:24:10 +00:00
|
|
|
output.current_line_index = 0
|
|
|
|
|
2011-01-01 07:20:34 +00:00
|
|
|
op.report({'INFO'}, "System information generated in 'system-info.txt'")
|