diff --git a/src/mol-plugin/state/actions/data-format.ts b/src/mol-plugin/state/actions/data-format.ts index 3cb8a05da5a2fae2722df766e895f691050b2d53..9a0ffd829f3fb6808703f6ee63f8028c72b6f3a3 100644 --- a/src/mol-plugin/state/actions/data-format.ts +++ b/src/mol-plugin/state/actions/data-format.ts @@ -150,6 +150,8 @@ type cifVariants = 'dscif' | -1 export function guessCifVariant(info: FileInfo, data: Uint8Array | string): cifVariants { if (info.ext === 'bcif') { try { + // TODO find a way to run msgpackDecode only once + // now it is run twice, here and during file parsing if (msgpackDecode(data as Uint8Array).encoder.startsWith('VolumeServer')) return 'dscif' } catch { } } else if (info.ext === 'cif') { diff --git a/src/mol-plugin/state/actions/structure.ts b/src/mol-plugin/state/actions/structure.ts index e8f8bfb09532de95672039efcd5215046e474232..f9ff6c4a973c937044879537f1aa38dcf84cd906 100644 --- a/src/mol-plugin/state/actions/structure.ts +++ b/src/mol-plugin/state/actions/structure.ts @@ -228,7 +228,7 @@ export function complexRepresentation( if (!params || !params.hideCoarse) { root.apply(StateTransforms.Model.StructureComplexElement, { type: 'spheres' }) .apply(StateTransforms.Representation.StructureRepresentation3D, - StructureRepresentation3DHelpers.getDefaultParamsStatic(ctx, 'spacefill')); + StructureRepresentation3DHelpers.getDefaultParamsStatic(ctx, 'spacefill', {}, 'polymer-id')); } } diff --git a/src/mol-plugin/state/transforms/representation.ts b/src/mol-plugin/state/transforms/representation.ts index f0873a69e5a3589938802a013ea1faaf89d58cba..127a50758decff275db4f14da3d144103e3d0016 100644 --- a/src/mol-plugin/state/transforms/representation.ts +++ b/src/mol-plugin/state/transforms/representation.ts @@ -108,13 +108,14 @@ namespace StructureRepresentation3DHelpers { }) } - export function getDefaultParamsStatic(ctx: PluginContext, name: BuiltInStructureRepresentationsName, structureParams?: Partial<PD.Values<StructureParams>>): StateTransformer.Params<StructureRepresentation3D> { + export function getDefaultParamsStatic(ctx: PluginContext, name: BuiltInStructureRepresentationsName, structureParams?: Partial<PD.Values<StructureParams>>, colorName?: BuiltInColorThemeName): StateTransformer.Params<StructureRepresentation3D> { const type = ctx.structureRepresentation.registry.get(name); - const colorParams = ctx.structureRepresentation.themeCtx.colorThemeRegistry.get(type.defaultColorTheme).defaultValues; + const color = colorName || type.defaultColorTheme; + const colorParams = ctx.structureRepresentation.themeCtx.colorThemeRegistry.get(color).defaultValues; const sizeParams = ctx.structureRepresentation.themeCtx.sizeThemeRegistry.get(type.defaultSizeTheme).defaultValues return ({ type: { name, params: structureParams ? { ...type.defaultValues, ...structureParams } : type.defaultValues }, - colorTheme: { name: type.defaultColorTheme, params: colorParams }, + colorTheme: { name: color, params: colorParams }, sizeTheme: { name: type.defaultSizeTheme, params: sizeParams } }) }