Skip to content

Fix upload pipeline for collection-instance (rigged) models; add validator dry-run - #2065

Draft
Tweekazoid wants to merge 6 commits into
mainfrom
feature_better_visibility_upload
Draft

Tweekazoid wants to merge 6 commits into
mainfrom
feature_better_visibility_upload

Conversation

@Tweekazoid

Copy link
Copy Markdown
Contributor

Fix upload pipeline for collection-instance (rigged) models; add validator dry-run

Problem

Models using collection-instance empties (e.g. rigged trams with body segments as instanced collections) were uploaded broken: geometry was missing, duplicated, or invisible because the pipeline only tracked direct parent/child hierarchies and didn't account for Blender's three-tier visibility system.

Changes

utils.py

  • New get_hierarchy_with_instances() walks instance_collection references in addition to object.children, with cycle detection. Used by upload.py and autothumb.py.

upload.py

  • Uses get_hierarchy_with_instances to build instance_collection_names and objects_in_instance_cols; excludes the latter from obnames to prevent double-loading.
  • Added _snapshot_and_project_visibility / _restore_visibility helpers that project per-view-layer eye-hide state onto Object.hide_viewport / Collection.hide_viewport before save_as_mainfile(copy=True), then restore — so eye-hidden objects stay hidden after append into a fresh scene.

upload_bg.py

  • After appending, discovers auto-loaded instance collections by walking the appended empties' instance_collection pointers instead of a second explicit libraries.load (which caused .001 duplicates).
  • Body collections are unlinked from the scene collection so they don't render directly at origin, but remain in bpy.data so instance empties can still reference them for rendering.

upload_dryrun.py (new)

  • Validator-only operator that runs the full upload-bg pipeline locally without a server round-trip.
  • Mirrors prepare_asset_data logic, invokes upload_bg.py in a non-blocking subprocess thread, optionally opens the resulting blend in a new Blender instance.

ui_panels.py

  • Dry-run button added to the upload panel, visible only to validators (profile_is_validator()), model/printable assets only.

@Tweekazoid Tweekazoid self-assigned this Apr 30, 2026
@Tweekazoid
Tweekazoid marked this pull request as draft April 30, 2026 21:36
@vilemduha

Copy link
Copy Markdown
Contributor

This is a big deal if we finally fix it, we should have a call maybe.

@Tweekazoid
Tweekazoid marked this pull request as ready for review May 5, 2026 08:17
@Tweekazoid
Tweekazoid marked this pull request as draft May 21, 2026 21:57
@Tweekazoid

Copy link
Copy Markdown
Contributor Author

@copilot resolve the merge conflicts in this pull request

Copilot AI and others added 3 commits September 17, 2026 13:02
…lity_upload

# Conflicts:
#	autothumb.py
#	upload_bg.py

Co-authored-by: Tweekazoid <7928647+Tweekazoid@users.noreply.github.com>
Co-authored-by: Tweekazoid <7928647+Tweekazoid@users.noreply.github.com>
Co-authored-by: Tweekazoid <7928647+Tweekazoid@users.noreply.github.com>

Copilot AI commented Sep 17, 2026

Copy link
Copy Markdown

@copilot resolve the merge conflicts in this pull request

Resolved in 962c6df by merging the latest main into this branch and fixing the conflicts in autothumb.py and upload_bg.py. I also pushed a follow-up validation/security fix in 286624b.

@codecov

codecov Bot commented Sep 17, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 11.21076% with 198 lines in your changes missing coverage. Please review.
✅ Project coverage is 34.03%. Comparing base (19066d5) to head (286624b).

Files with missing lines Patch % Lines
upload_dryrun.py 21.21% 78 Missing ⚠️
upload.py 4.16% 69 Missing ⚠️
upload_bg.py 0.00% 25 Missing ⚠️
utils.py 4.34% 22 Missing ⚠️
autothumb.py 0.00% 2 Missing ⚠️
ui_panels.py 0.00% 2 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #2065      +/-   ##
==========================================
- Coverage   34.21%   34.03%   -0.18%     
==========================================
  Files          87       88       +1     
  Lines       27581    27800     +219     
==========================================
+ Hits         9436     9461      +25     
- Misses      18145    18339     +194     
Flag Coverage Δ
python 34.03% <11.21%> (-0.18%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
__init__.py 0.00% <ø> (ø)
autothumb.py 22.24% <0.00%> (ø)
ui_panels.py 23.31% <0.00%> (-0.02%) ⬇️
utils.py 28.21% <4.34%> (-0.45%) ⬇️
upload_bg.py 19.69% <0.00%> (-1.33%) ⬇️
upload.py 14.44% <4.16%> (-0.71%) ⬇️
upload_dryrun.py 21.21% <21.21%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

3 participants