Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sketchfab upload node #712

Merged
merged 16 commits into from
Jan 25, 2020
Merged

Sketchfab upload node #712

merged 16 commits into from
Jan 25, 2020

Conversation

ChemicalXandco
Copy link
Contributor

@ChemicalXandco ChemicalXandco commented Nov 25, 2019

Description

Sketchfab is a popular website to share and view 3D files, this provides a node to allow direct upload to Sketchfab from meshroom using the data api
This PR is based off the same branch in my fork as #631 in order to use the logging functions here.
The code here is based on the data api with python.

Features list

  • a node that allows files to be uploaded to Sketchfab
  • API key is provided by the user in the node settings
  • progress bar to track the progress of the upload

Implementation remarks

I have tried using urllib to avoid having to add requests dependency, but in order for this to work it would need other dependencies anyway so requests is the best option here.

Currently, the API key needs to be put in for every new node, but I will look into a solution to overwrite the default node settings so that it can be automatically added when a new node is created. I will create a separate PR for this if I get round to it.

value='',
uid=[0],
),
desc.StringParam(
Copy link
Member

Choose a reason for hiding this comment

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

Maybe good to put a Choice with predefined list of possible licenses? Or at least put standard values in the tooltip.

files = self.resolvedPaths(chunk.node.inputFiles.value)
zf = zipfile.ZipFile(uploadFile, 'w')
for file in files:
zf.write(file, os.path.basename(file))
Copy link
Member

Choose a reason for hiding this comment

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

Does this work when we connect Texture.outputTextures which contains the simplified regex: "texture_*.png"?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes because it goes through resolvedPaths which uses glob, like in the publish node. However, it does not work when Texture.output is connected because only the folder is copied, not the files in the folder. I will fix this

),
desc.BoolParam(
name='isPublished',
label='Publish',
Copy link
Member

Choose a reason for hiding this comment

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

I think it would be better to save the model in Draft Mode by default. You likely want to fix the model orientation and lighting before publishing.

Copy link
Member

Choose a reason for hiding this comment

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

The default value is already False.

Copy link
Member

Choose a reason for hiding this comment

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

I see, missed this.

description='Description cannot be longer than 1024 characters.',
value='',
uid=[0],
),
Copy link
Member

Choose a reason for hiding this comment

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

How about adding Categories (18) and Tags (comma separated)? This way the model Metadata would be complete.

@fabiencastan
Copy link
Member

fabiencastan commented Nov 26, 2019

Hi @ChemicalXandco,
Thanks for the contribution! That's a really interesting PR.
As a side note for potential futur contributions ;), it may be interesting to experiment with new nodes based on blender for the post-processing steps before uploading on sketchfab, as described here:
https://sketchfab.com/blogs/community/tutorial-low-poly-assets-from-3d-scans
Or with https://github.com/wjakob/instant-meshes.

* changed license to a ChoiceParam
* added private and password options
also delete temporary zip file when node terminates
@ChemicalXandco ChemicalXandco changed the title WIP Sketchfab upload node Sketchfab upload node Dec 2, 2019
desc.ChoiceParam(
name='category',
label='Category',
description='Maximum of 2 categories.',
Copy link
Member

Choose a reason for hiding this comment

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

Exclusive is set to True, so in all case, we can choose only one category.
So the description or the "exclusive" mode should be adjusted.

@fabiencastan fabiencastan added this to the Meshroom 2019.3.0 milestone Jan 4, 2020
@fabiencastan fabiencastan self-assigned this Jan 4, 2020
chunk.logger.debug('Files added to zip: {}'.format(str(files)))
chunk.logger.debug('Created {}'.format(uploadFile))

fileSize = os.path.getsize(uploadFile)/1000000
Copy link
Member

Choose a reason for hiding this comment

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

fileSize = os.path.getsize(uploadFile)/(1024*1024)

@fabiencastan fabiencastan merged commit 3edc35f into alicevision:develop Jan 25, 2020
@fabiencastan
Copy link
Member

@ChemicalXandco Thank you for this nice contribution!

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