Fix #106430: Index the right UVmap in BMesh #106537

Closed
Martijn Versteegh wants to merge 5 commits from Baardaap:fix-named-uvmap_bmesh into main

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.

When accessing UVmaps from python in BMesh, the UVmap name/index was ignored
and the active UVmap always used. This fixes this by passing the layer index
to the underlying CustomData function.

When accessing UVmaps from python in BMesh, the UVmap name/index was ignored and the active UVmap always used. This fixes this by passing the layer index to the underlying CustomData function.
Martijn Versteegh added 2 commits 2023-04-04 11:31:14 +02:00
Martijn Versteegh requested review from Hans Goudey 2023-04-04 11:31:32 +02:00
Martijn Versteegh added this to the 3.5 milestone 2023-04-04 11:31:41 +02:00
Hans Goudey requested changes 2023-04-04 13:47:22 +02:00
Hans Goudey left a comment
Member

Makes sense! Just have an idea to make it a bit simpler.

Makes sense! Just have an idea to make it a bit simpler.
@ -25,3 +25,3 @@
using namespace blender;
using namespace blender::bke;
const int layer_index = CustomData_get_active_layer_index(&bm->ldata, CD_PROP_FLOAT2);
const int layer_index = layer == -1 ?
Member

It might be simper/clearer if BM_uv_map_get_offsets called CustomData_get_active_layer_index directly. Then BM_uv_map_get_offsets_n wouldn't have to have a special case for -1.

It might be simper/clearer if `BM_uv_map_get_offsets` called `CustomData_get_active_layer_index` directly. Then `BM_uv_map_get_offsets_n` wouldn't have to have a special case for -1.
HooglyBoogly marked this conversation as resolved
Martijn Versteegh added 1 commit 2023-04-04 14:21:13 +02:00
Hans Goudey requested changes 2023-04-04 14:23:05 +02:00
@ -46,1 +46,4 @@
BMUVOffsets BM_uv_map_get_offsets(const BMesh *bm)
{
return BM_uv_map_get_offsets_n(bm, CustomData_get_active_layer_index(&bm->ldata, CD_PROP_FLOAT2));
Member

Missing clang format here (line is 101 characters long)

Missing clang format here (line is 101 characters long)
HooglyBoogly marked this conversation as resolved
Martijn Versteegh added 1 commit 2023-04-04 16:39:23 +02:00
Martijn Versteegh requested review from Hans Goudey 2023-04-04 16:39:47 +02:00
Hans Goudey approved these changes 2023-04-04 16:42:04 +02:00
Hans Goudey reviewed 2023-04-04 16:42:25 +02:00
@ -21,3 +21,3 @@
#include "intern/bmesh_private.h"
BMUVOffsets BM_uv_map_get_offsets(const BMesh *bm)
BMUVOffsets BM_uv_map_get_offsets_n(const BMesh *bm, int layer)
Member

int layer -> const int layer

`int layer` -> `const int layer`
Martijn Versteegh added 1 commit 2023-04-04 16:59:13 +02:00
Martijn Versteegh deleted branch fix-named-uvmap_bmesh 2023-04-04 18:13:42 +02:00

Pull request closed

Sign in to join this conversation.
No reviewers
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
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#106537
No description provided.