OBJ: Support polylines with more than 2 vertices. #104503

Merged
Aras Pranckevicius merged 2 commits from mheistermann/blender:dev/mh/obj-polyline-support into main 2023-02-14 16:31:02 +01:00
Contributor

The OBJ spec (page B1-17) allows "l" entries to specify
polylines with more than 2 vertices, optionally with texture
coordinates.

Previously, only the first 2 vertices of each polyline
were read and added as loose edges, failing when texture
coordinates were present.

This adds support for proper polylines, reading but ignoring
texture coordinates.

The OBJ spec (page B1-17) allows "l" entries to specify polylines with more than 2 vertices, optionally with texture coordinates. Previously, only the first 2 vertices of each polyline were read and added as loose edges, failing when texture coordinates were present. This adds support for proper polylines, reading but ignoring texture coordinates.
Martin Heistermann requested review from Aras Pranckevicius 2023-02-09 11:20:34 +01:00
Author
Contributor
This used to be https://archive.blender.org/developer/D17215
Author
Contributor

@aras_p I hope it's okay I added you as reviewer (can't un-assign you anyways :/), looking into commit history and reading your blog before, you appear to be a main developer of the OBJ importer.

I'll be happy about any comments & suggestions for improvement from other developers too, of course :)

@aras_p I hope it's okay I added you as reviewer (can't un-assign you anyways :/), looking into commit history and reading your blog before, you appear to be a main developer of the OBJ importer. I'll be happy about any comments & suggestions for improvement from other developers too, of course :)

Code looks good to me! Would be nice to have some test coverage; do you have a relatively simple .obj file that uses this?

Code looks good to me! Would be nice to have some test coverage; do you have a relatively simple .obj file that uses this?
Author
Contributor

I created a very simple test file with a few lines and polylines, including some with (bogus) texture coords, as well as out-of-bounds vertex references (polylines_artificial.obj).

I'm also attaching the file I had uploaded in D17215 which contains less variety but is not synthetic.

I created a very simple test file with a few lines and polylines, including some with (bogus) texture coords, as well as out-of-bounds vertex references (polylines_artificial.obj). I'm also attaching the file I had uploaded in D17215 which contains less variety but is not synthetic.
Martin Heistermann force-pushed dev/mh/obj-polyline-support from 6e3ce1193d to b7752b176e 2023-02-11 20:27:17 +01:00 Compare
Author
Contributor

I added a rudimentary test that expects the previously attached polylines_artificial.obj as io_tests/obj/polylines.obj in the test data repo.

In line with the existing tests, it checks for number of vertices/edges, as well as the position of the first and last vertex. Admittedly, more extensive tests would be nice.

I also rebased my branch to current main.

I added a rudimentary test that expects the previously attached `polylines_artificial.obj` as `io_tests/obj/polylines.obj` in the test data repo. In line with the existing tests, it checks for number of vertices/edges, as well as the position of the first and last vertex. Admittedly, more extensive tests would be nice. I also rebased my branch to current main.
Brecht Van Lommel added this to the Pipeline, Assets & IO project 2023-02-13 09:18:48 +01:00
Aras Pranckevicius merged commit cfe828b452 into main 2023-02-14 16:31:02 +01:00
Bastien Montagne removed this from the Pipeline, Assets & IO project 2023-07-03 13:02:23 +02:00
Sign in to join this conversation.
No reviewers
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset System
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Code Documentation
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
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
Viewport & EEVEE
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Asset Browser Project
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
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
Module
Viewport & EEVEE
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Severity
High
Severity
Low
Severity
Normal
Severity
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
2 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#104503
No description provided.