Skip to content

Bug: My PLY Read Error, Why #5692

Open
Open

Description

@luckWithLvpeng

I have d ply File , Meshlab work well ,vtk work well ;
who help me test , thank you ;
4738e7f157104937a970c7fa49429abb_sublabel_9.zip

Activity

  1. added
    Bug
    on Jul 31, 2024
  2. tellypresence commented on Jul 31, 2024

    @tellypresence
    Collaborator

    That model may have problems, fails to load with error

    Validation failed: aiMesh::mFaces[4]::mIndices[0] is out of range
    
  3. luckWithLvpeng commented on Aug 1, 2024

    @luckWithLvpeng
    Author

    I have been positioned to bug;
    In the IOStreanBuffer.h

    template <class T>
    AI_FORCE_INLINE bool IOStreamBuffer<T>::getNextLine(std::vector<T> &buffer) {
        buffer.resize(m_cacheSize);
        if (m_cachePos >= m_cacheSize || 0 == m_filePos) {
            if (!readNextBlock()) {
                return false;
            }
        }
    
        if (IsLineEnd(m_cache[m_cachePos])) {
            // skip line end
            while (m_cache[m_cachePos] != '\n') {
                ++m_cachePos;
            }
            ++m_cachePos;
            if (isEndOfCache(m_cachePos, m_cacheSize)) {
                if (!readNextBlock()) {
                    return false;
                }
            }
        }
    
        size_t i(0);
        while (!IsLineEnd(m_cache[m_cachePos])) {
            buffer[i] = m_cache[m_cachePos];
            ++m_cachePos;
            ++i;
    
            if(i == buffer.size()) {
                buffer.resize(buffer.size() * 2);
            }
    
            if (m_cachePos >= m_cacheSize) {
                if (!readNextBlock()) {
                    return false;
                }
            }
        }
        buffer[i] = '\n';
        while (m_cachePos < m_cacheSize && (m_cache[m_cachePos] == '\n' || (m_cache[m_cachePos] == '\r' && m_cache[m_cachePos + 1] == '\n'))) {
            ++m_cachePos;
        }
    
        return true;
    }
    
    
    ``` ’\r‘, some time is my next float data , not a line  ending , this is a bug
    
  4. tellypresence commented on Aug 1, 2024

    @tellypresence
    Collaborator

    That's not checking for \r, it's checking for \r\n

  5. GitHubDragonFly commented on Aug 2, 2024

    @GitHubDragonFly

    @luckWithLvpeng maybe try the re-exported version of your file attached below.

    Your original file did get loaded by my PLY Viewer which has PLY ascii and binary export amongst export options.

    4738e7f157104937a970c7fa49429abb_sublabel_9_PLY_binary.zip

  6. tellypresence commented on Aug 2, 2024

    @tellypresence
    Collaborator

    That re-exported version works in my implementation

  7. luckWithLvpeng commented on Aug 14, 2024

    @luckWithLvpeng
    Author

    That's not checking for \r, it's checking for \r\n
    @tellypresence
    The original code detection is \ r, I changed to detection \ r \ n

  8. added
    PLY
    on Apr 5, 2025
  9. tellypresence commented on May 13, 2025

    @tellypresence
    Collaborator

    PLY issues tracked via epic #6163

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugPLY

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions