Skip to content

Commit 3f70a83

Browse files
authored
Neil poster (#2928)
* testing out my blender skills * added download poster button to editor * made Neil's visor shiny
1 parent a0c8564 commit 3f70a83

File tree

4 files changed

+14
-7
lines changed

4 files changed

+14
-7
lines changed
Binary file not shown.
14.1 KB
Binary file not shown.

packages/space-opera/src/components/model_viewer_snippet/components/download_button.ts

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,10 @@ export async function prepareGlbPayload(modelName: string): Promise<Payload> {
7575
return {blob: await getModelViewer()!.exportScene(), filename: modelName};
7676
}
7777

78+
async function preparePosterPayload(posterName: string): Promise<Payload> {
79+
return {blob: await createPoster(), filename: posterName};
80+
}
81+
7882
// Fixes some formatting issues with the snippet as it is being placed into the
7983
// template.
8084
function beautify_snippet(snippetList: string[]): string {
@@ -188,18 +192,18 @@ async function prepareZipArchive(
188192
/**
189193
* A button to download GLB file resources.
190194
*/
191-
@customElement('me-download-button')
192-
export class DownloadButton extends GenericDownloadButton {
195+
@customElement('me-export-poster-button')
196+
export class ExportPosterButton extends GenericDownloadButton {
193197
constructor() {
194198
super();
195-
this.buttonLabel = 'GLB';
199+
this.buttonLabel = 'POSTER';
196200
}
197201

198202
stateChanged(state: State) {
199203
const loaded = getModelViewer()?.loaded;
200-
const modelName = getRelativeFilePaths(state).modelName!;
204+
const {posterName} = getRelativeFilePaths(state);
201205
this.preparePayload =
202-
loaded ? () => prepareGlbPayload(modelName) : undefined;
206+
loaded ? () => preparePosterPayload(posterName) : undefined;
203207
}
204208
}
205209

@@ -237,7 +241,7 @@ export class ExportZipButton extends GenericDownloadButton {
237241

238242
declare global {
239243
interface HTMLElementTagNameMap {
240-
'me-download-button': DownloadButton;
244+
'me-export-poster-button': ExportPosterButton;
241245
'me-export-zip-button': ExportZipButton;
242246
}
243247
}

packages/space-opera/src/components/model_viewer_snippet/model_viewer_snippet.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,10 @@ export class ExportPanel extends ConnectedLitElement {
115115
<me-expandable-tab tabName="File Manager" .open=${true}>
116116
<div slot="content">
117117
<me-import-card></me-import-card>
118-
<me-export-zip-button id="export-zip" style="display: block; margin-top: 10px;"></me-export-zip-button>
118+
<div style="display: flex; justify-content: space-between; margin-top: 10px;">
119+
<me-export-zip-button id="export-zip"></me-export-zip-button>
120+
<me-export-poster-button></me-export-poster-button>
121+
</div>
119122
</div>
120123
</me-expandable-tab>
121124
<me-expandable-tab tabName="Mobile View" .open=${true}>

0 commit comments

Comments
 (0)