Skip to content

mm2txt and mm2ply: Add new option --ignore-missing-fields#35

Merged
jlblancoc merged 1 commit intodevelopfrom
feat/mm2txt-ignore-fields
Jan 31, 2026
Merged

mm2txt and mm2ply: Add new option --ignore-missing-fields#35
jlblancoc merged 1 commit intodevelopfrom
feat/mm2txt-ignore-fields

Conversation

@jlblancoc
Copy link
Copy Markdown
Member

@jlblancoc jlblancoc commented Jan 31, 2026

Summary by CodeRabbit

  • New Features

    • Added a new --ignore-missing-fields option for mm2ply and mm2txt: when set, missing fields listed in --export-fields produce warnings and those output columns are zero-padded instead of causing errors.
  • Documentation

    • Updated mm2ply and mm2txt usage docs to describe the new flag and its behavior.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jan 31, 2026

📝 Walkthrough

Walkthrough

Added a CLI switch --ignore-missing-fields to mm2ply and mm2txt and threaded it into export functions so missing fields listed in --export-fields are treated as warnings and zero-padded instead of causing errors; updated docs accordingly. (50 words)

Changes

Cohort / File(s) Summary
CLI & export logic
apps/mm2ply/main.cpp, apps/mm2txt/main.cpp
Add argIgnoreMissingFields switch; conditionally suppress errors for missing export fields and mark missing-field accessors (null bufPtr) to enable zero-padding. Thread flag through saveToPly call.
IO signature & writer
apps/mm2ply/main.cpp
Extend saveToPly(...) signature with ignoreMissingFields and update data-writing loop to emit zeros for missing fields when flagged.
Documentation
docs/source/app_mm2ply.rst, docs/source/app_mm2txt.rst
Document new --ignore-missing-fields option and behavior (missing fields become warnings and are padded with zeros).

Sequence Diagram(s)

mermaid
sequenceDiagram
participant User
participant CLI as "CLI parser\n(--ignore-missing-fields)"
participant Converter as "Export logic\n(saveToPly / mm2txt)"
participant Writer as "File writer\n(PLY/TXT)"
User->>CLI: invoke tool with args
CLI->>Converter: parse selectedFields + ignoreMissingFields
Converter->>Converter: validate fields per layer
alt field missing & ignoreMissingFields set
Converter->>Writer: prepare zero-padded column for missing field
else field missing & not set
Converter->>User: throw/raise error
end
Converter->>Writer: write points with available or zero-padded fields
Writer->>User: output file saved

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

🐰 I nibble code by lantern light,
If fields are missing, I won't fight.
I pad with zeros, soft and kind,
A gentle hop for every bind.
Export done — a carrot-grin delight. 🥕

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately and concisely describes the main change: adding a new --ignore-missing-fields option to both mm2txt and mm2ply applications.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/mm2txt-ignore-fields

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
docs/source/app_mm2txt.rst (1)

125-126: ⚠️ Potential issue | 🟡 Minor

Documentation inconsistency with the new --ignore-missing-fields option.

Line 125 states "All specified fields must exist in the point cloud, or an error will be raised" but this is no longer strictly true when --ignore-missing-fields is used. Consider updating this section to mention the exception.

📝 Suggested documentation update
-- All specified fields must exist in the point cloud, or an error will be raised
+- All specified fields must exist in the point cloud, or an error will be raised (unless ``--ignore-missing-fields`` is used, in which case missing fields produce a warning and are padded with zeros)
docs/source/app_mm2ply.rst (1)

105-106: ⚠️ Potential issue | 🟡 Minor

Documentation inconsistency with the new --ignore-missing-fields option.

Line 105 states "All specified fields must exist in the point cloud, or an error will be raised" but this contradicts the new --ignore-missing-fields behavior. Consider updating for consistency.

📝 Suggested documentation update
-- All specified fields must exist in the point cloud, or an error will be raised
+- All specified fields must exist in the point cloud, or an error will be raised (unless ``--ignore-missing-fields`` is used, in which case missing fields produce a warning and are padded with zeros)
🤖 Fix all issues with AI agents
In `@apps/mm2ply/main.cpp`:
- Around line 481-486: Selected missing-fields cause saveToPly() to throw
because selectedFields still holds names not present in the layer even when
argIgnoreMissingFields.isSet(); fix by either filtering missing names out of
selectedFields before calling saveToPly() or by updating saveToPly() to tolerate
unknown fields (emit "0" like saveToTxt()). Concretely: when
argIgnoreMissingFields.isSet(), iterate the layer's available field names and
remove any selectedFields entries that are absent prior to invoking saveToPly(),
and apply the same filtering at the other call site noted (around the 271-274
usage); alternatively, modify saveToPly() to detect missing accessors and output
zeros for those fields (mirroring saveToTxt()) so it will not throw.

Comment thread apps/mm2ply/main.cpp
@codecov
Copy link
Copy Markdown

codecov Bot commented Jan 31, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 77.03%. Comparing base (0d52dbf) to head (fd627a2).
⚠️ Report is 2 commits behind head on develop.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff            @@
##           develop      #35   +/-   ##
========================================
  Coverage    77.03%   77.03%           
========================================
  Files          179      179           
  Lines         9526     9526           
  Branches       917      917           
========================================
  Hits          7338     7338           
  Misses        2188     2188           
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@jlblancoc jlblancoc force-pushed the feat/mm2txt-ignore-fields branch from ceb0743 to fd627a2 Compare January 31, 2026 20:56
@jlblancoc jlblancoc enabled auto-merge January 31, 2026 20:57
@jlblancoc jlblancoc merged commit 5ed30ea into develop Jan 31, 2026
13 checks passed
@jlblancoc jlblancoc deleted the feat/mm2txt-ignore-fields branch January 31, 2026 21:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant