Skip to content

Commit

Permalink
Finalizing version 1.8 changes (edges option)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexschreyer committed Mar 8, 2014
1 parent f44c90e commit e82b4e7
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 10 deletions.
4 changes: 2 additions & 2 deletions as_sketchfab.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
as_sketchfab = SketchupExtension.new "Sketchfab Uploader", "as_sketchfab/as_sketchfab_uploader.rb"
as_sketchfab.copyright= 'Copyright 2012-2014 Alexander C. Schreyer'
as_sketchfab.creator= 'Alexander C. Schreyer, www.alexschreyer.net'
as_sketchfab.version = '1.7'
as_sketchfab.description = "A plugin to upload the current model to the Sketchfab website."
as_sketchfab.version = '1.8'
as_sketchfab.description = "Uploads the current model (or the selection) to the Sketchfab.com website."
Sketchup.register_extension as_sketchfab, true
28 changes: 20 additions & 8 deletions as_sketchfab/as_sketchfab_uploader.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
Name : Sketchfab Uploader
Version: 1.8
Date : TBD
Date : 3/8/2014
Description : This plugin uploads the currently open model to Sketchfab.com
Expand Down Expand Up @@ -47,14 +47,16 @@
- Added new upload method
- Implemented multipart upload via new API
- Added option to open model after uploading
1.8:
1.8 (3/8/2014):
- Uploads ZIPped models now
- Gives option to only upload selection if something has been selected.
- SketchUp material names are now preserved on upload.
- SU 2014 only: Option to include/exclude edges
Issues:
Issues/To-do:
- For versions before SU 2014: the post_url function does not accept returned data.
- Text labels, dimensions, construction-points and -lines don't upload (by design)
Credits:
Expand Down Expand Up @@ -192,9 +194,6 @@ def self.show_dialog_2013
contents = open(@zip_name, "rb") {|io| io.read }
encdata = [contents].pack('m')

# Then delete the temporary files - keep for debugging
# File.delete @zip_name

# Set up and show Webdialog
dlg = UI::WebDialog.new('Sketchfab Uploader', false,'SketchfabUploader', 450, 520, 150, 150, true)
dlg.navigation_buttons_enabled = false
Expand Down Expand Up @@ -309,7 +308,7 @@ def self.show_dialog_2013
$(this).val('True');
};
$('#pw-field').toggle();
});
});
$(document).ready(function() {
window.location='skp:prefill';
Expand Down Expand Up @@ -400,6 +399,10 @@ def self.show_dialog_2014
tags.gsub!(/,*\s+/,' ')
private = d.get_element_value("private").gsub(/"/, "'")
password = d.get_element_value("password").gsub(/"/, "'")
edges = d.get_element_value("edges").gsub(/"/, "'")

# Display edges in uploaded model?
(edges == "True") ? @options_hash[:edges] = true : @options_hash[:edges] = false

# Export model as KMZ and process
if Sketchup.active_model.export @filename, @options_hash then
Expand Down Expand Up @@ -499,6 +502,7 @@ def self.show_dialog_2014
<p><label for="private">Make model private?</label><input type="checkbox" name="private" id="private" value="" /> <span style="font-weight:normal;">(PRO account required)</span></p>
<p id="pw-field" style="display:none;"><label for="password">Password</label><input type="text" name="password" id="password" value="" style="width:200px;" /></p>
<p><label for="token">Your API token *</label><input type="text" name="token" id="token" value="" style="width:200px;" /></p>
<p><label for="options">Options:</label><input type="checkbox" name="edges" id="edges" checked="true" value="True" /> Include edges</p>
<p><input type="submit" id="submit" value="Submit Model" style="font-weight:bold;" /></p>
</form>
<p><span style="float:left;"><button value="Cancel" id="cancel">Dismiss</button></span><span style="float:right;margin-top:10px;">&copy; 2012-2014 by <a href="http://www.alexschreyer.net/" title="http://www.alexschreyer.net/" target="_blank" style="color:orange">Alex Schreyer</a></span></p>
Expand Down Expand Up @@ -535,7 +539,15 @@ def self.show_dialog_2014
};
$('#pw-field').toggle();
});
$('#edges').click(function(){
if ($(this).val() == 'True') {
$(this).val('');
} else {
$(this).val('True');
};
});
$(document).ready(function() {
window.location='skp:prefill';
});
Expand Down

0 comments on commit e82b4e7

Please sign in to comment.