File: colladaImport14.py

package info (click to toggle)
blender 2.49.2~dfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 89,664 kB
  • ctags: 113,718
  • sloc: ansic: 738,048; cpp: 231,960; python: 104,955; asm: 33,960; sh: 16,233; ml: 12,962; makefile: 4,477; perl: 3,474; fortran: 108; java: 8
file content (137 lines) | stat: -rw-r--r-- 4,239 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
#!BPY

"""
Name: 'COLLADA 1.4(.dae) ...'
Blender: 241
Group: 'Import'
Tooltip: 'Import scene from COLLADA 1.4 format (.dae)'
"""

__author__ = "Illusoft - Pieter Visser"
__url__ = ("Project homepage, http://colladablender.illusoft.com")
__version__ = "0.3.160"
__email__ = "colladablender@illusoft.com"
__bpydoc__ = """\

Description: Imports a COLLADA 1.4 file into a Blender scene.

Bugs and Features: check the project website: http://colladablender.illusoft.com

Usage: Run the script from the menu or inside Blender.
"""

# --------------------------------------------------------------------------
# Illusoft Collada 1.4 plugin for Blender
# --------------------------------------------------------------------------
# ***** BEGIN GPL LICENSE BLOCK *****
#
# Copyright (C) 2006: Illusoft - colladablender@illusoft.com
# 2008.05.08 modif. for debug mode by migius (AKA Remigiusz Fiedler)
#
# 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 LICENCE BLOCK *****
# --------------------------------------------------------------------------

import sys
import Blender

error = False

######################## SET PATH TO FOLDER consisting 'colladaImEx' here (if necessary)

# Example:

# scriptsDir = "C:/Temp/"

scriptsDir = ""

#############################################################################

try:
	import colladaImEx.cstartup
	if Blender.Get('scriptsdir') is None and Blender.Get('uscriptsdir') is None:
		if scriptsDir == '' or scriptsDir is None:
			Blender.Draw.PupMenu("Cannot find folder %t | Please set path in file 'colladaImport14.py'")
			error = True
		else:
			loc = scriptsDir
	else:
		loc = ""
except ImportError:
	# Check if full version of python is installed:
	try:
		import os
		pythonFull = True
	except ImportError:
		pythonFull = False

	if not pythonFull:
		from sys import version_info
		version = '%s.%s' % version_info[0:2]
		print """
This script requires the xml module that is part of a
default standalone Python install.

To run the collada importer and exporter you need to have
Python version %s installed in your system. It can be downloaded from:

http://www.python.org

Notes:
- The minor (third) version number doesn't matter, you can have either
Python %s.1 or %s.2 or higher.
- If you do have Python %s installed and still can't run the scripts, then
make sure Blender's Python interpreter is finding the standalone modules
(run 'System Information' from Blender's Help -> System menu).
""" % (version, version, version, version)
		Blender.Draw.PupMenu("Please install full version of python %t | Check the console for more info")
		error = True
	else:
		if scriptsDir == "":
			Blender.Draw.PupMenu("Cannot find folder %t | Please set path in file 'colladaImport14.py'")
			error = True
		else:
			if scriptsDir not in sys.path:
				sys.path.append(scriptsDir)
			try:
				import colladaImEx.cstartup
				loc = scriptsDir
			except:
				Blender.Draw.PupMenu("Cannot find colladaImEx files %t | Please make sure the path is correct in file 'colladaImport14.py'")
				error = True
except StandardError:
	error = True

debug = False #or True
if debug:
	#hack for debug outputs to the console
	reload(colladaImEx.cstartup)
	colladaImEx.cstartup.Main(True, loc)
elif not error:
	try:
		reload(colladaImEx.cstartup)
		colladaImEx.cstartup.Main(True, loc)
	except StandardError:
		pass

"""a try to receive error messages to the console:
except:
	print 'deb: PROBLEM !!!!!' #-------
	#print sys.exc_info()[1]
	#print sys.exc_info()
	print sys.exc_type, sys.exc_value #-------
	#traceback.print_exc(file=sys.stdout)
"""