KX_PolyProxy has incorrect getVertexIndex results #38030

Closed
opened 2014-01-02 16:32:50 +01:00 by Angus Hollands · 17 comments

This is a serious flaw in the API, which has occurred somewhere between Blender 2.64 and HEAD.

The values from getVertexIndex are (I believe) per bucket, which isn't respected in the getVertex call. I'm not sure whether the issue is in RAS_MeshObject or whether it is before this point, but essentially calling offset = slot->AddVertex(texvert) returns the bucket vertex index

This is a serious flaw in the API, which has occurred somewhere between Blender 2.64 and HEAD. The values from getVertexIndex are (I believe) per bucket, which isn't respected in the getVertex call. I'm not sure whether the issue is in RAS_MeshObject or whether it is before this point, but essentially calling offset = slot->AddVertex(texvert) returns the bucket vertex index
Author

Changed status to: 'Open'

Changed status to: 'Open'
Author

Added subscriber: @AngusHollands-4

Added subscriber: @AngusHollands-4
Author

Revision: dee33e8097
Author: Campbell Barton ideasman42@gmail.com
Date: 01/05/2013 23:41:55
Message:
fix [#34609] mesh.getVertex doesn't work as spected with poly.getMaterialIndex() and poly vertex indexes

revert r22906 (own old commit, was incorrectly trying to make vertex indices absolute)

Modified: source/gameengine/Ketsji/KX_PolyProxy.cpp
Modified: source/gameengine/Rasterizer/RAS_Polygon.cpp
Modified: source/gameengine/Rasterizer/RAS_Polygon.h

This seems to be the culprit

Revision: dee33e80970ff0b83a06b2dd5d23b8e25f7317df Author: Campbell Barton <ideasman42@gmail.com> Date: 01/05/2013 23:41:55 Message: fix [#34609] mesh.getVertex doesn't work as spected with poly.getMaterialIndex() and poly vertex indexes revert r22906 (own old commit, was incorrectly trying to make vertex indices absolute) ---- Modified: source/gameengine/Ketsji/KX_PolyProxy.cpp Modified: source/gameengine/Rasterizer/RAS_Polygon.cpp Modified: source/gameengine/Rasterizer/RAS_Polygon.h This seems to be the culprit

Added subscriber: @ThomasDinges

Added subscriber: @ThomasDinges

"Unbreak now" is only meant for Release show stoppers.

"Unbreak now" is only meant for Release show stoppers.
Author

My apologies, I had intended to set to medium.

My apologies, I had intended to set to medium.
Inês Almeida self-assigned this 2014-06-21 00:13:57 +02:00
Member

@AngusHollands-4 I am not sure I understand the problem.

The documentation says this:
"Returns the mesh vertex index of a polygon vertex This index and the one returned by getMaterialIndex() are needed to retrieve the vertex proxy from MeshProxy."

The commit dee33e8097 is already correcting something, are you saying it has a bug or that it is supposed to do something different?
I really don't know what this does or is supposed to do.

@AngusHollands-4 I am not sure I understand the problem. The documentation says this: "Returns the mesh vertex index of a polygon vertex This index and the one returned by getMaterialIndex() are needed to retrieve the vertex proxy from MeshProxy." The commit dee33e8097 is already correcting something, are you saying it has a bug or that it is supposed to do something different? I really don't know what this does or is supposed to do.
Author

Originally, the commit by Campbell appeared to break things. Since then the issue has disappeared, so I think this can be closed!

Originally, the commit by Campbell appeared to break things. Since then the issue has disappeared, so I think this can be closed!
Member

great! :)

great! :)
Member

Changed status from 'Open' to: 'Resolved'

Changed status from 'Open' to: 'Resolved'

Changed status from 'Resolved' to: 'Open'

Changed status from 'Resolved' to: 'Open'

Added subscriber: @Pickledtezcat

Added subscriber: @Pickledtezcat

I'm having trouble with this still, with Blender 2.72b (and before). Rather than open a new bug I'm going to reopen this one as it seems to be the same problem that never went away.

Some more details:
When using


poly = mesh.getPolygon(polyID)
        
        vert_length = poly.getNumVertex()
                    
        for v in range(vert_length):
            index = poly.getVertexIndex(v)
                            
            vertex = mesh.getVertex(0, index)   ### (the material index is 0 since there's only one material on the object).

The getVertexIndex() call is getting the wrong index in the following situations:

  1. when you have a mix of quads and triangles in a mesh.
  2. when you have more than one material in a mesh.

poly_problems_2.jpg

For illustration I've used a property to store xyz co-ordinates in poly groups captured from the mesh and then render.drawline to illustrate the results. You can see that all quad meshes and all triangle meshes are fine, but everything else just returns the wrong indexes. The objects are the same, just with some quads triangulated.

You can recreate the bug using this Blend:
poly_problems.blend

Just run the game engine.

In a nutshell the problem is that the poly.getVertexIndex as well as the poly.v1 poly.v2 poly.v3 poly.v4 functions (I tested them too with the same result) to return constituent vertices of a polygon are broken. They only work when all polys are of one type, either quads or triangles and only one material is present.

I'm having trouble with this still, with Blender 2.72b (and before). Rather than open a new bug I'm going to reopen this one as it seems to be the same problem that never went away. Some more details: When using ``` poly = mesh.getPolygon(polyID) vert_length = poly.getNumVertex() for v in range(vert_length): index = poly.getVertexIndex(v) vertex = mesh.getVertex(0, index) ### (the material index is 0 since there's only one material on the object). ``` The getVertexIndex() call is getting the wrong index in the following situations: 1. when you have a mix of quads and triangles in a mesh. 2. when you have more than one material in a mesh. ![poly_problems_2.jpg](https://archive.blender.org/developer/F122066/poly_problems_2.jpg) For illustration I've used a property to store xyz co-ordinates in poly groups captured from the mesh and then render.drawline to illustrate the results. You can see that all quad meshes and all triangle meshes are fine, but everything else just returns the wrong indexes. The objects are the same, just with some quads triangulated. You can recreate the bug using this Blend: [poly_problems.blend](https://archive.blender.org/developer/F122068/poly_problems.blend) Just run the game engine. In a nutshell the problem is that the poly.getVertexIndex as well as the poly.v1 poly.v2 poly.v3 poly.v4 functions (I tested them too with the same result) to return constituent vertices of a polygon are broken. They only work when all polys are of one type, either quads or triangles and only one material is present.

Added subscriber: @JacobMerrill-1

Added subscriber: @JacobMerrill-1
Member

Added subscriber: @JorgeBernalMartinez

Added subscriber: @JorgeBernalMartinez

This issue was referenced by 2a305580b2

This issue was referenced by 2a305580b2c76af62c129fbca043466ab010c2df

Changed status from 'Open' to: 'Resolved'

Changed status from 'Open' to: 'Resolved'
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
8 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#38030
No description provided.