').html ('Embedding Code').addClass ('ov_dialog_inner_title').appendTo (section);
let optionsSection = $('
').addClass ('ov_dialog_section').appendTo (section);
let embeddingCodeInput = AddCopyableTextInput (section, function () {
return GetEmbeddingCode (embeddingCodeParams);
});
AddCheckboxLine (optionsSection, 'Use current camera position', 'embed_camera', function (checked) {
embeddingCodeParams.camera = checked ? camera : null;
embeddingCodeInput.val (GetEmbeddingCode (embeddingCodeParams));
});
if (OV.FeatureSet.SetDefaultColor) {
AddCheckboxLine (optionsSection, 'Use overridden default color', 'embed_color', function (checked) {
embeddingCodeParams.color = checked ? importSettings.defaultColor : null;
embeddingCodeInput.val (GetEmbeddingCode (embeddingCodeParams));
});
embeddingCodeParams.color = importSettings.defaultColor;
}
embeddingCodeInput.val (GetEmbeddingCode (embeddingCodeParams));
}
if (!importer.IsOnlyFileSource (OV.FileSource.Url)) {
return OV.ShowMessageDialog (
'Embedding Failed',
'Embedding works only if you load files by url. Please upload your model files to a web server, open them by url, and try embedding again.',
null
);
}
let files = importer.GetFileList ().GetFiles ();
let modelFiles = [];
for (let fileIndex = 0; fileIndex < files.length; fileIndex++) {
let file = files[fileIndex];
modelFiles.push (file.fileUrl);
}
let sharingLinkParams = {
files : modelFiles,
color : null
};
let embeddingCodeParams = {
files : modelFiles,
camera : camera,
color : null
};
let dialog = new OV.ButtonDialog ();
let contentDiv = dialog.Init ('Share', [
{
name : 'Close',
onClick () {
dialog.Hide ();
}
}
]);
AddSharingLinkTab (contentDiv, sharingLinkParams);
AddEmbeddingCodeTab (contentDiv, embeddingCodeParams);
dialog.Show ();
return dialog;
};
OV.ShowSettingsDialog = function (importSettings, onOk)
{
let dialogSettings = {
defaultColor : importSettings.defaultColor
};
let dialog = new OV.ButtonDialog ();
let contentDiv = dialog.Init ('Settings', [
{
name : 'Cancel',
subClass : 'outline',
onClick () {
dialog.Hide ();
}
},
{
name : 'OK',
onClick () {
dialog.Hide ();
onOk (dialogSettings);
}
}
]);
let colorRow = $('
').addClass ('ov_dialog_table_row').appendTo (contentDiv);
$('