@fps-games/editor 0.1.7-beta.3 → 0.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent-bridge/capabilities/assets.d.ts.map +1 -1
- package/dist/agent-bridge/capabilities/assets.js +12 -7
- package/dist/agent-bridge/capabilities/assets.js.map +1 -1
- package/dist/agent-bridge/capabilities/host-lifecycle.d.ts +1 -1
- package/dist/agent-bridge/capabilities/host-lifecycle.d.ts.map +1 -1
- package/dist/agent-bridge/capabilities/host-lifecycle.js +4 -2
- package/dist/agent-bridge/capabilities/host-lifecycle.js.map +1 -1
- package/dist/agent-bridge/capabilities/prefabs.js +50 -0
- package/dist/agent-bridge/capabilities/prefabs.js.map +1 -1
- package/dist/agent-bridge/capability-sources.d.ts.map +1 -1
- package/dist/agent-bridge/capability-sources.js +4 -1
- package/dist/agent-bridge/capability-sources.js.map +1 -1
- package/dist/build-info.json +15 -15
- package/dist/local-editor-harness.d.ts.map +1 -1
- package/dist/local-editor-harness.js +33 -3
- package/dist/local-editor-harness.js.map +1 -1
- package/node_modules/@fps-games/babylon-renderer/package.json +1 -1
- package/node_modules/@fps-games/editor-babylon/dist/projection.d.ts +1 -0
- package/node_modules/@fps-games/editor-babylon/dist/projection.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-babylon/dist/projection.js +550 -26
- package/node_modules/@fps-games/editor-babylon/dist/projection.js.map +1 -1
- package/node_modules/@fps-games/editor-babylon/package.json +5 -5
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-panels.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-panels.js +102 -2
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-panels.js.map +1 -1
- package/node_modules/@fps-games/editor-browser/package.json +3 -3
- package/node_modules/@fps-games/editor-core/package.json +2 -2
- package/node_modules/@fps-games/editor-forge-play/package.json +2 -2
- package/node_modules/@fps-games/editor-playable-sdk/dist/asset-database/metadata.js +198 -53
- package/node_modules/@fps-games/editor-playable-sdk/dist/asset-database/metadata.js.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/material-binding/binding.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/material-binding/binding.js +29 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/material-binding/binding.js.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/runtime-preview/nodes.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/runtime-preview/nodes.js +34 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/runtime-preview/nodes.js.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/scene-compiler/compiler.js +6 -2
- package/node_modules/@fps-games/editor-playable-sdk/dist/scene-compiler/compiler.js.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/package.json +3 -3
- package/node_modules/@fps-games/editor-protocol/dist/agent-bridge.d.ts +13 -0
- package/node_modules/@fps-games/editor-protocol/dist/agent-bridge.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-protocol/dist/agent-bridge.js +29 -0
- package/node_modules/@fps-games/editor-protocol/dist/agent-bridge.js.map +1 -1
- package/node_modules/@fps-games/editor-protocol/dist/index.d.ts +5 -0
- package/node_modules/@fps-games/editor-protocol/dist/index.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-protocol/dist/index.js.map +1 -1
- package/node_modules/@fps-games/editor-protocol/package.json +1 -1
- package/package.json +8 -8
|
@@ -2794,9 +2794,16 @@ function createInspectorMaterialSlotListItem(doc, item, labels) {
|
|
|
2794
2794
|
appendMaterialSlotListDetailRow(doc, content, labels.material, item.materialMeta || item.materialAssetId || item.materialLabel || '');
|
|
2795
2795
|
appendMaterialSlotListDetailRow(doc, content, labels.slotId, item.slotId ?? '');
|
|
2796
2796
|
appendMaterialSlotListDetailRow(doc, content, labels.ownerNodePath, item.ownerNodePath ?? '');
|
|
2797
|
-
appendMaterialSlotListDetailRow(doc, content, labels.
|
|
2797
|
+
appendMaterialSlotListDetailRow(doc, content, labels.primitive, formatMaterialSlotPrimitiveDetail(item));
|
|
2798
|
+
appendMaterialSlotListDetailRow(doc, content, labels.sourceMaterial, [
|
|
2799
|
+
item.sourceMaterialIndex == null ? '' : `#${item.sourceMaterialIndex}`,
|
|
2800
|
+
item.sourceMaterialName ?? '',
|
|
2801
|
+
item.materialNames && item.materialNames.length > 1 ? `(${item.materialNames.join(', ')})` : '',
|
|
2802
|
+
]
|
|
2798
2803
|
.filter(Boolean)
|
|
2799
2804
|
.join(' '));
|
|
2805
|
+
appendMaterialSlotListDetailRow(doc, content, labels.triangles, item.triangleCount == null ? '' : String(item.triangleCount));
|
|
2806
|
+
appendMaterialSlotListDetailRow(doc, content, labels.bounds, formatMaterialSlotBounds(item.boundingBox));
|
|
2800
2807
|
appendMaterialSlotListDetailRow(doc, content, labels.bindingPath, item.bindingPath ?? '');
|
|
2801
2808
|
details.appendChild(content);
|
|
2802
2809
|
return details;
|
|
@@ -2848,6 +2855,10 @@ function readInspectorMaterialSlotListItem(value) {
|
|
|
2848
2855
|
if (!key || !label)
|
|
2849
2856
|
return null;
|
|
2850
2857
|
const sourceMaterialIndex = value.sourceMaterialIndex;
|
|
2858
|
+
const nodeIndex = value.nodeIndex;
|
|
2859
|
+
const meshIndex = value.meshIndex;
|
|
2860
|
+
const primitiveIndex = value.primitiveIndex;
|
|
2861
|
+
const triangleCount = value.triangleCount;
|
|
2851
2862
|
return {
|
|
2852
2863
|
key,
|
|
2853
2864
|
label,
|
|
@@ -2858,8 +2869,16 @@ function readInspectorMaterialSlotListItem(value) {
|
|
|
2858
2869
|
materialLabel: readStringField(value, 'materialLabel') || undefined,
|
|
2859
2870
|
materialMeta: readStringField(value, 'materialMeta') || undefined,
|
|
2860
2871
|
materialPreview: isLocalEditorBrowserAssetPreview(value.materialPreview) ? value.materialPreview : undefined,
|
|
2872
|
+
nodeIndex: typeof nodeIndex === 'number' && Number.isFinite(nodeIndex) ? nodeIndex : undefined,
|
|
2873
|
+
nodeIndexPath: readNumberArrayField(value, 'nodeIndexPath'),
|
|
2874
|
+
meshIndex: typeof meshIndex === 'number' && Number.isFinite(meshIndex) ? meshIndex : undefined,
|
|
2875
|
+
primitiveIndex: typeof primitiveIndex === 'number' && Number.isFinite(primitiveIndex) ? primitiveIndex : undefined,
|
|
2861
2876
|
sourceMaterialIndex: typeof sourceMaterialIndex === 'number' && Number.isFinite(sourceMaterialIndex) ? sourceMaterialIndex : undefined,
|
|
2877
|
+
sourceMaterialIndices: readNumberArrayField(value, 'sourceMaterialIndices'),
|
|
2862
2878
|
sourceMaterialName: readStringField(value, 'sourceMaterialName') || undefined,
|
|
2879
|
+
materialNames: readStringArrayField(value, 'materialNames'),
|
|
2880
|
+
triangleCount: typeof triangleCount === 'number' && Number.isFinite(triangleCount) ? triangleCount : undefined,
|
|
2881
|
+
boundingBox: readMaterialSlotBoundsField(value, 'boundingBox'),
|
|
2863
2882
|
bindingPath: readStringField(value, 'bindingPath') || undefined,
|
|
2864
2883
|
};
|
|
2865
2884
|
}
|
|
@@ -2870,6 +2889,9 @@ function readInspectorMaterialSlotListLabels(property) {
|
|
|
2870
2889
|
slotId: readStringField(labels, 'slotId') || 'Slot ID',
|
|
2871
2890
|
ownerNodePath: readStringField(labels, 'ownerNodePath') || 'Owner Node Path',
|
|
2872
2891
|
sourceMaterial: readStringField(labels, 'sourceMaterial') || 'Source Material',
|
|
2892
|
+
primitive: readStringField(labels, 'primitive') || 'Primitive',
|
|
2893
|
+
triangles: readStringField(labels, 'triangles') || 'Triangles',
|
|
2894
|
+
bounds: readStringField(labels, 'bounds') || 'Bounds',
|
|
2873
2895
|
bindingPath: readStringField(labels, 'bindingPath') || 'Binding Path',
|
|
2874
2896
|
};
|
|
2875
2897
|
}
|
|
@@ -2877,12 +2899,73 @@ function readStringField(record, key) {
|
|
|
2877
2899
|
const value = record[key];
|
|
2878
2900
|
return typeof value === 'string' ? value : '';
|
|
2879
2901
|
}
|
|
2902
|
+
function readStringArrayField(record, key) {
|
|
2903
|
+
const value = record[key];
|
|
2904
|
+
if (!Array.isArray(value))
|
|
2905
|
+
return undefined;
|
|
2906
|
+
const strings = value.filter((item) => typeof item === 'string' && item.length > 0);
|
|
2907
|
+
return strings.length > 0 ? strings : undefined;
|
|
2908
|
+
}
|
|
2909
|
+
function readNumberArrayField(record, key) {
|
|
2910
|
+
const value = record[key];
|
|
2911
|
+
if (!Array.isArray(value))
|
|
2912
|
+
return undefined;
|
|
2913
|
+
const numbers = value.filter((item) => typeof item === 'number' && Number.isFinite(item));
|
|
2914
|
+
return numbers.length > 0 ? numbers : undefined;
|
|
2915
|
+
}
|
|
2916
|
+
function readMaterialSlotBoundsField(record, key) {
|
|
2917
|
+
const value = record[key];
|
|
2918
|
+
if (!isRecord(value))
|
|
2919
|
+
return undefined;
|
|
2920
|
+
const min = readMaterialSlotVec3Tuple(value.min);
|
|
2921
|
+
const max = readMaterialSlotVec3Tuple(value.max);
|
|
2922
|
+
if (!min && !max)
|
|
2923
|
+
return undefined;
|
|
2924
|
+
return {
|
|
2925
|
+
...(min ? { min } : {}),
|
|
2926
|
+
...(max ? { max } : {}),
|
|
2927
|
+
};
|
|
2928
|
+
}
|
|
2929
|
+
function readMaterialSlotVec3Tuple(value) {
|
|
2930
|
+
if (!Array.isArray(value) || value.length < 3)
|
|
2931
|
+
return null;
|
|
2932
|
+
const [x, y, z] = value;
|
|
2933
|
+
return typeof x === 'number' && Number.isFinite(x)
|
|
2934
|
+
&& typeof y === 'number' && Number.isFinite(y)
|
|
2935
|
+
&& typeof z === 'number' && Number.isFinite(z)
|
|
2936
|
+
? [x, y, z]
|
|
2937
|
+
: null;
|
|
2938
|
+
}
|
|
2939
|
+
function formatMaterialSlotPrimitiveDetail(item) {
|
|
2940
|
+
const parts = [
|
|
2941
|
+
item.nodeIndex == null ? '' : `node #${item.nodeIndex}`,
|
|
2942
|
+
item.meshIndex == null ? '' : `mesh #${item.meshIndex}`,
|
|
2943
|
+
item.primitiveIndex == null ? '' : `primitive #${item.primitiveIndex}`,
|
|
2944
|
+
].filter(Boolean);
|
|
2945
|
+
if (item.nodeIndexPath && item.nodeIndexPath.length > 0)
|
|
2946
|
+
parts.push(`path ${item.nodeIndexPath.join('/')}`);
|
|
2947
|
+
return parts.join(' / ');
|
|
2948
|
+
}
|
|
2949
|
+
function formatMaterialSlotBounds(bounds) {
|
|
2950
|
+
if (!bounds)
|
|
2951
|
+
return '';
|
|
2952
|
+
const min = bounds.min ? bounds.min.join(', ') : '';
|
|
2953
|
+
const max = bounds.max ? bounds.max.join(', ') : '';
|
|
2954
|
+
if (min && max)
|
|
2955
|
+
return `min ${min}; max ${max}`;
|
|
2956
|
+
if (min)
|
|
2957
|
+
return `min ${min}`;
|
|
2958
|
+
if (max)
|
|
2959
|
+
return `max ${max}`;
|
|
2960
|
+
return '';
|
|
2961
|
+
}
|
|
2880
2962
|
const inspectorGroundDecalLayoutImageCache = new Map();
|
|
2881
2963
|
const INSPECTOR_GROUND_DECAL_LAYOUT_MIN_SIZE = 0.02;
|
|
2882
2964
|
const INSPECTOR_GROUND_DECAL_LAYOUT_MAX_SIZE = 1.5;
|
|
2883
2965
|
function createInspectorGroundDecalLayoutControl(doc, _target, property, bindInput) {
|
|
2884
2966
|
const editable = isInspectorPropertyEditable(property);
|
|
2885
2967
|
const layers = readInspectorGroundDecalLayoutLayers(property);
|
|
2968
|
+
const previewLayers = readInspectorGroundDecalLayoutPreviewLayers(property, layers);
|
|
2886
2969
|
const composite = isInspectorGroundDecalLayoutCompositeValue(property.value);
|
|
2887
2970
|
const textureSize = readInspectorGroundDecalLayoutTextureSize(property.value);
|
|
2888
2971
|
const mask = readInspectorGroundDecalLayoutMask(property.value);
|
|
@@ -2959,10 +3042,13 @@ function createInspectorGroundDecalLayoutControl(doc, _target, property, bindInp
|
|
|
2959
3042
|
let previewRenderVersion = 0;
|
|
2960
3043
|
const renderPreview = () => {
|
|
2961
3044
|
const version = ++previewRenderVersion;
|
|
2962
|
-
void renderInspectorGroundDecalLayoutPreview(previewCanvas,
|
|
3045
|
+
void renderInspectorGroundDecalLayoutPreview(previewCanvas, previewLayers, textureSize, mask, () => version === previewRenderVersion);
|
|
2963
3046
|
};
|
|
2964
3047
|
const updateLayerRect = (layer, rect) => {
|
|
2965
3048
|
layer.rect = normalizeInspectorGroundDecalLayoutRect(rect);
|
|
3049
|
+
const previewLayer = findInspectorGroundDecalLayoutMatchingLayer(previewLayers, layer);
|
|
3050
|
+
if (previewLayer && previewLayer !== layer)
|
|
3051
|
+
previewLayer.rect = layer.rect;
|
|
2966
3052
|
const layerFieldInputs = fieldInputsByLayer.get(layer);
|
|
2967
3053
|
if (layerFieldInputs)
|
|
2968
3054
|
updateInspectorGroundDecalLayoutFieldInputs(layerFieldInputs, layer.rect);
|
|
@@ -3107,6 +3193,20 @@ function readInspectorGroundDecalLayoutLayers(property) {
|
|
|
3107
3193
|
zOrder: 0,
|
|
3108
3194
|
}];
|
|
3109
3195
|
}
|
|
3196
|
+
function readInspectorGroundDecalLayoutPreviewLayers(property, editableLayers) {
|
|
3197
|
+
if (isInspectorGroundDecalLayoutCompositeValue(property.value) && Array.isArray(property.value.previewLayers)) {
|
|
3198
|
+
const previewLayers = property.value.previewLayers
|
|
3199
|
+
.map((layer, fallbackIndex) => readInspectorGroundDecalLayoutLayer(layer, fallbackIndex))
|
|
3200
|
+
.filter((layer) => !!layer);
|
|
3201
|
+
if (previewLayers.length > 0) {
|
|
3202
|
+
return previewLayers.map(layer => findInspectorGroundDecalLayoutMatchingLayer(editableLayers, layer) ?? layer);
|
|
3203
|
+
}
|
|
3204
|
+
}
|
|
3205
|
+
return [...editableLayers];
|
|
3206
|
+
}
|
|
3207
|
+
function findInspectorGroundDecalLayoutMatchingLayer(layers, target) {
|
|
3208
|
+
return layers.find(layer => layer.id === target.id) ?? layers.find(layer => layer.index === target.index) ?? null;
|
|
3209
|
+
}
|
|
3110
3210
|
function isInspectorGroundDecalLayoutCompositeValue(value) {
|
|
3111
3211
|
return isRecord(value) && Array.isArray(value.layers);
|
|
3112
3212
|
}
|