Problems of UV coordinates and SVG export #76736

Closed
opened 2020-05-14 10:22:47 +02:00 by baoyu · 27 comments

System Information
Operating system: Windows 10 1903
Graphics card: rtx 2070 super and rtx 2080

Blender Version
Broken: 2.9 alpha and all older versions
Worked: none worked

Short description of error
No.1, 2D UV point average coordinate behaves differently from other 3D package or 2D programs.
No.2, when exporting uv as svg from a blender file whose name contains Chinese charactor, the result svg file would have encoding issue in block causing most software treat the svg file as borken file.
Detailed problem discription here https://devtalk.blender.org/t/problems-of-uv-coordinates-and-svg-export/13148

Exact steps for others to reproduce the error
Just try the attached blend file.
你好测试.blend
Based on the default startup or an attached .blend file (as simple as possible).

**System Information** Operating system: Windows 10 1903 Graphics card: rtx 2070 super and rtx 2080 **Blender Version** Broken: 2.9 alpha and all older versions Worked: none worked **Short description of error** No.1, 2D UV point average coordinate behaves differently from other 3D package or 2D programs. No.2, when exporting uv as svg from a blender file whose name contains Chinese charactor, the result svg file would have encoding issue in <desc> block causing most software treat the svg file as borken file. Detailed problem discription here https://devtalk.blender.org/t/problems-of-uv-coordinates-and-svg-export/13148 **Exact steps for others to reproduce the error** Just try the attached blend file. [你好测试.blend](https://archive.blender.org/developer/F8534725/你好测试.blend) Based on the default startup or an attached .blend file (as simple as possible).
Author

Added subscriber: @baoyu

Added subscriber: @baoyu
Member

Added subscriber: @lichtwerk

Added subscriber: @lichtwerk
Member

Changed status from 'Needs Triage' to: 'Needs User Info'

Changed status from 'Needs Triage' to: 'Needs User Info'
Member

Just a first stab in the dark:

Does it help to specifiy encoding? Changing it "by hand" to

<?xml version="1.0" encoding="UTF-8" standalone="no"?>

or

<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>

Does the import in other software work then?

Just a first stab in the dark: Does it help to specifiy encoding? Changing it "by hand" to ``` <?xml version="1.0" encoding="UTF-8" standalone="no"?> ``` or ``` <?xml version="1.0" encoding="ISO-8859-1" standalone="no"?> ``` Does the import in other software work then?
Author

In #76736#931305, @lichtwerk wrote:
Just a first stab in the dark:

Does it help to specifiy encoding? Changing it "by hand" to

<?xml version="1.0" encoding="UTF-8" standalone="no"?>

or

<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>

Does the import in other software work then?

Nope.
e.g. my blender file name is "你好测试.blender" ("Hello test.blender" in English), when I export uv map as svg, other programs wouldn't recognize it. When open that svg file in text editor, note the 6th line goes:

<desc>ÄãºÃ²âÊÔ.blend, (Blender 2.90 (sub 1))</desc>

image.png

It's these Chinese charator being wrongly encoded to some weird unicode. I guess some tweaks in the svg export python script would solve the issue. Though I could manually fix this issue using text editor, I thought maybe the developer could solve the inconvience once for all CJK language users.

> In #76736#931305, @lichtwerk wrote: > Just a first stab in the dark: > > Does it help to specifiy encoding? Changing it "by hand" to > > ``` > <?xml version="1.0" encoding="UTF-8" standalone="no"?> > ``` > or > > ``` > <?xml version="1.0" encoding="ISO-8859-1" standalone="no"?> > ``` > > Does the import in other software work then? Nope. e.g. my blender file name is "你好测试.blender" ("Hello test.blender" in English), when I export uv map as svg, other programs wouldn't recognize it. When open that svg file in text editor, note the 6th line goes: ``` <desc>ÄãºÃ²âÊÔ.blend, (Blender 2.90 (sub 1))</desc> ``` ![image.png](https://archive.blender.org/developer/F8534954/image.png) It's these Chinese charator being wrongly encoded to some weird unicode. I guess some tweaks in the svg export python script would solve the issue. Though I could manually fix this issue using text editor, I thought maybe the developer could solve the inconvience once for all CJK language users.
Member

Maybe a misunderstanding, what I meant is changing the first line in the svg file in a text editor and save, have you tried that?
(your first line still shows as <?xml version="1.0" standalone="no"?> -- no encoding specified...)

Maybe a misunderstanding, what I meant is changing the first line in the svg file in a text editor and save, have you tried that? (your first line still shows as `<?xml version="1.0" standalone="no"?>` -- no encoding specified...)

Added subscriber: @jenkm

Added subscriber: @jenkm

No.1

Here the average value for all vertices, some vertices are overlaid.

For example:

uv-average.png

( 0.5 + 0.5 + 0.5 + 0.25 + 0.25 + 0.0 ) / 6 = 0.333

No.1 Here the average value for all vertices, some vertices are overlaid. For example: ![uv-average.png](https://archive.blender.org/developer/F8534995/uv-average.png) ( 0.5 + 0.5 + 0.5 + 0.25 + 0.25 + 0.0 ) / 6 = 0.333

I have no problems with exporting svg and then opening it in Affinity Designer.

export.png

I have no problems with exporting svg and then opening it in Affinity Designer. ![export.png](https://archive.blender.org/developer/F8535029/export.png)
Author

In #76736#931357, @jenkm wrote:
No.1

Here the average value for all vertices, some vertices are overlaid.

For example:

uv-average.png

( 0.5 + 0.5 + 0.5 + 0.25 + 0.25 + 0.0 ) / 6 = 0.333

Thank you! If I don't misunderstand what you said, when I don't rip apart the uv faces, the uv points are just overlaping each other like this:
image.png

However, this agorithom is kind unintuitive to artist, especially for those who are used to 2D programs that thinks and manipulates things in 2D space.
I highly suggest we offer a choice to change this calc behavier!

> In #76736#931357, @jenkm wrote: > No.1 > > Here the average value for all vertices, some vertices are overlaid. > > For example: > > ![uv-average.png](https://archive.blender.org/developer/F8534995/uv-average.png) > > ( 0.5 + 0.5 + 0.5 + 0.25 + 0.25 + 0.0 ) / 6 = 0.333 Thank you! If I don't misunderstand what you said, when I don't rip apart the uv faces, the uv points are just overlaping each other like this: ![image.png](https://archive.blender.org/developer/F8535045/image.png) However, this agorithom is kind unintuitive to artist, especially for those who are used to 2D programs that thinks and manipulates things in 2D space. I highly suggest we offer a choice to change this calc behavier!
Author

In #76736#931360, @jenkm wrote:
I have no problems with exporting svg and then opening it in Affinity Designer.

export.png

Why? How did you make that happen?

> In #76736#931360, @jenkm wrote: > I have no problems with exporting svg and then opening it in Affinity Designer. > > ![export.png](https://archive.blender.org/developer/F8535029/export.png) Why? How did you make that happen?
Author

In #76736#931360, @jenkm wrote:
I have no problems with exporting svg and then opening it in Affinity Designer.

export.png

Oh, I think I figured it out! Maybe it's be i18n thing. Can I see your translation config in Blender preference?
This is mine:image.png

> In #76736#931360, @jenkm wrote: > I have no problems with exporting svg and then opening it in Affinity Designer. > > ![export.png](https://archive.blender.org/developer/F8535029/export.png) Oh, I think I figured it out! Maybe it's be i18n thing. Can I see your translation config in Blender preference? This is mine:![image.png](https://archive.blender.org/developer/F8535076/image.png)

I use English, but I also tried switching to others.

Try "Load Factory Preferences" and then export.

I use English, but I also tried switching to others. Try "Load Factory Preferences" and then export.
Author

In #76736#931407, @jenkm wrote:
I use English, but I also tried switching to others.

Try "Load Factory Preferences" and then export.

I was using automatic, and basically automatic is the same as English. I tried switch to English, that didn't work either.
Then I tried export after Load Factory Preferences, failed again.
BTW, thanks for your patience!

> In #76736#931407, @jenkm wrote: > I use English, but I also tried switching to others. > > Try "Load Factory Preferences" and then export. I was using automatic, and basically automatic is the same as English. I tried switch to English, that didn't work either. Then I tried export after Load Factory Preferences, failed again. BTW, thanks for your patience!
Member

Changed status from 'Needs User Info' to: 'Needs Triage'

Changed status from 'Needs User Info' to: 'Needs Triage'

Added subscriber: @ideasman42

Added subscriber: @ideasman42

Changed status from 'Needs Triage' to: 'Needs User Info'

Changed status from 'Needs Triage' to: 'Needs User Info'

Please include the generated SVG, when I export this file on Linux I get the file name working properly: Suzanne.svg

Please include the generated SVG, when I export this file on Linux I get the file name working properly: ![Suzanne.svg](https://archive.blender.org/developer/F8571760/Suzanne.svg)
Author

In #76736#942610, @ideasman42 wrote:
Please include the generated SVG, when I export this file on Linux I get the file name working properly: Suzanne.svg

Here's the svg I exported from
Blender 2.90.3 Alpha
Hash: 86fa8dc7f7

Cube.svg

> In #76736#942610, @ideasman42 wrote: > Please include the generated SVG, when I export this file on Linux I get the file name working properly: ![Suzanne.svg](https://archive.blender.org/developer/F8571760/Suzanne.svg) Here's the svg I exported from Blender 2.90.3 Alpha Hash: 86fa8dc7f73a ![Cube.svg](https://archive.blender.org/developer/F8571767/Cube.svg)

If you type this into the Python console, does it display the file path properly?

bpy.data.filepath

(press Enter).


I see:

PYTHON INTERACTIVE CONSOLE 3.8.3 (default, May 17 2020, 18:15:42)  [GCC 10.1.0]

Builtin Modules:       bpy, bpy.data, bpy.ops, bpy.props, bpy.types, bpy.context, bpy.utils, bgl, blf, mathutils
Convenience Imports:   from mathutils import *; from math import *
Convenience Variables: C = bpy.context, D = bpy.data

>>> bpy.data.filepath

'/d/你好测试.blend'

>>> 

If you type this into the Python console, does it display the file path properly? ``` bpy.data.filepath ``` (press Enter). ----- I see: ``` PYTHON INTERACTIVE CONSOLE 3.8.3 (default, May 17 2020, 18:15:42) [GCC 10.1.0] Builtin Modules: bpy, bpy.data, bpy.ops, bpy.props, bpy.types, bpy.context, bpy.utils, bgl, blf, mathutils Convenience Imports: from mathutils import *; from math import * Convenience Variables: C = bpy.context, D = bpy.data >>> bpy.data.filepath '/d/你好测试.blend' >>> ```
Author

It returns:

>>> bpy.data.filepath

'C:\\Users\\jiabaoyu\\Desktop\\你好测试.blend'
It returns: ``` >>> bpy.data.filepath 'C:\\Users\\jiabaoyu\\Desktop\\你好测试.blend' ```

This issue was referenced by blender/blender-addons@86c4ca71ef

This issue was referenced by blender/blender-addons@86c4ca71ef180fd67fe64451f8533d5ca3f6417e

Changed status from 'Needs User Info' to: 'Resolved'

Changed status from 'Needs User Info' to: 'Resolved'
Campbell Barton self-assigned this 2020-06-02 11:30:42 +02:00
Committed fix blender/blender-addons@86c4ca71ef
Author

Good job Campbell!
Could you please check the other issue I posted ;)

Good job Campbell! Could you please check the other issue I posted ;)

@baoyu Blender uses the median center for coordinates, this is working as intended, we could support this but it's not something we use the bug tracker for.

@baoyu Blender uses the median center for coordinates, this is working as intended, we could support this but it's not something we use the bug tracker for.
Author

@ideasman42 Thanks! I was trying to implement that feature by making a addon, though my python skill is on a low level and I can't find default api for manipulating UV coordinate :(

@ideasman42 Thanks! I was trying to implement that feature by making a addon, though my python skill is on a low level and I can't find default api for manipulating UV coordinate :(
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
6 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#76736
No description provided.