Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
blender-addons
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
blender
blender-addons
Commits
9f7da477
Commit
9f7da477
authored
13 years ago
by
Campbell Barton
Browse files
Options
Downloads
Patches
Plain Diff
- open files for writing as utf-8
- write url's within quoteattr rather than as strings with surrounding quotes
parent
595167d1
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
io_scene_x3d/export_x3d.py
+17
-16
17 additions, 16 deletions
io_scene_x3d/export_x3d.py
with
17 additions
and
16 deletions
io_scene_x3d/export_x3d.py
+
17
−
16
View file @
9f7da477
...
...
@@ -172,7 +172,7 @@ def build_hierarchy(objects):
# H3D Functions
# -----------------------------------------------------------------------------
def
h3d_shader_glsl_frag_patch
(
filepath
,
scene
,
global_vars
,
frag_uniform_var_map
):
h3d_file
=
open
(
filepath
,
'
r
'
)
h3d_file
=
open
(
filepath
,
'
r
'
,
encoding
=
'
utf-8
'
)
lines
=
[]
last_transform
=
None
...
...
@@ -217,7 +217,7 @@ def h3d_shader_glsl_frag_patch(filepath, scene, global_vars, frag_uniform_var_ma
h3d_file
.
close
()
h3d_file
=
open
(
filepath
,
'
w
'
)
h3d_file
=
open
(
filepath
,
'
w
'
,
encoding
=
'
utf-8
'
)
h3d_file
.
writelines
(
lines
)
h3d_file
.
close
()
...
...
@@ -253,7 +253,7 @@ def export(file,
# -------------------------------------------------------------------------
import
bpy_extras
from
bpy_extras.io_utils
import
unique_name
from
xml.sax.saxutils
import
quoteattr
from
xml.sax.saxutils
import
quoteattr
,
escape
uuid_cache_object
=
{}
# object
uuid_cache_lamp
=
{}
# 'LA_' + object.name
...
...
@@ -1212,7 +1212,7 @@ def export(file,
else
:
print
(
"
SKIPPING
"
,
uniform
[
'
type
'
])
file_frag
=
open
(
os
.
path
.
join
(
base_dst
,
shader_url_frag
),
'
w
'
)
file_frag
=
open
(
os
.
path
.
join
(
base_dst
,
shader_url_frag
),
'
w
'
,
encoding
=
'
utf-8
'
)
file_frag
.
write
(
gpu_shader
[
'
fragment
'
])
file_frag
.
close
()
# patch it
...
...
@@ -1222,12 +1222,12 @@ def export(file,
frag_uniform_var_map
,
)
file_vert
=
open
(
os
.
path
.
join
(
base_dst
,
shader_url_vert
),
'
w
'
)
file_vert
=
open
(
os
.
path
.
join
(
base_dst
,
shader_url_vert
),
'
w
'
,
encoding
=
'
utf-8
'
)
file_vert
.
write
(
gpu_shader
[
'
vertex
'
])
file_vert
.
close
()
fw
(
'
%s<ShaderPart type=
"
FRAGMENT
"
url=
"
%s
"
/>
\n
'
%
(
ident
,
shader_url_frag
))
fw
(
'
%s<ShaderPart type=
"
VERTEX
"
url=
"
%s
"
/>
\n
'
%
(
ident
,
shader_url_vert
))
fw
(
'
%s<ShaderPart type=
"
FRAGMENT
"
url=%s />
\n
'
%
(
ident
,
quoteattr
(
shader_url_frag
))
)
fw
(
'
%s<ShaderPart type=
"
VERTEX
"
url=%s />
\n
'
%
(
ident
,
quoteattr
(
shader_url_vert
))
)
ident
=
ident
[:
-
1
]
fw
(
'
%s</ComposedShader>
\n
'
%
ident
)
...
...
@@ -1260,7 +1260,7 @@ def export(file,
images
=
[
f
.
replace
(
'
\\
'
,
'
/
'
)
for
f
in
images
]
images
=
[
f
for
i
,
f
in
enumerate
(
images
)
if
f
not
in
images
[:
i
]]
fw
(
ident_step
+
"
url=
'
%s
'
"
%
'
'
.
join
([
'"
%s
"'
%
f
for
f
in
images
]))
fw
(
ident_step
+
"
url=
'
%s
'
"
%
'
'
.
join
([
'"
%s
"'
%
escape
(
f
)
for
f
in
images
]))
fw
(
ident_step
+
'
/>
\n
'
)
def
writeBackground
(
ident
,
world
):
...
...
@@ -1315,20 +1315,20 @@ def export(file,
if
tex
.
type
==
'
IMAGE
'
and
tex
.
image
:
namemat
=
tex
.
name
pic
=
tex
.
image
basename
=
bpy
.
path
.
basename
(
pic
.
filepath
)
basename
=
quoteattr
(
bpy
.
path
.
basename
(
pic
.
filepath
)
)
if
namemat
==
'
back
'
:
fw
(
ident_step
+
'
backUrl=
"
%s
"
\n
'
%
basename
)
fw
(
ident_step
+
'
backUrl=%s
\n
'
%
basename
)
elif
namemat
==
'
bottom
'
:
fw
(
ident_step
+
'
bottomUrl=
"
%s
"
\n
'
%
basename
)
fw
(
ident_step
+
'
bottomUrl=%s
\n
'
%
basename
)
elif
namemat
==
'
front
'
:
fw
(
ident_step
+
'
frontUrl=
"
%s
"
\n
'
%
basename
)
fw
(
ident_step
+
'
frontUrl=%s
\n
'
%
basename
)
elif
namemat
==
'
left
'
:
fw
(
ident_step
+
'
leftUrl=
"
%s
"
\n
'
%
basename
)
fw
(
ident_step
+
'
leftUrl=%s
\n
'
%
basename
)
elif
namemat
==
'
right
'
:
fw
(
ident_step
+
'
rightUrl=
"
%s
"
\n
'
%
basename
)
fw
(
ident_step
+
'
rightUrl=%s
\n
'
%
basename
)
elif
namemat
==
'
top
'
:
fw
(
ident_step
+
'
topUrl=
"
%s
"
\n
'
%
basename
)
fw
(
ident_step
+
'
topUrl=%s
\n
'
%
basename
)
fw
(
ident_step
+
'
/>
\n
'
)
...
...
@@ -1515,9 +1515,10 @@ def save(operator, context, filepath="",
if
use_compress
:
import
gzip
# need to investigate encoding
file
=
gzip
.
open
(
filepath
,
'
w
'
)
else
:
file
=
open
(
filepath
,
'
w
'
)
file
=
open
(
filepath
,
'
w
'
,
encoding
=
'
utf-8
'
)
if
global_matrix
is
None
:
global_matrix
=
mathutils
.
Matrix
()
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment