@archvisioninc/canvas 2.4.1 → 2.4.3
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.
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { scene, newMetaDataEntry, selectedMeshes, updateCamera, updateEnvironment, buildMaterialsArray, buildSelectedMaterialArray } from '../helpers';
|
|
2
2
|
import { reactProps as props } from '../Canvas';
|
|
3
3
|
import { deleteSelected } from '../actions';
|
|
4
|
+
import { TRANSPARENCY_MODES } from '../constants';
|
|
5
|
+
import * as BABYLON from 'babylonjs';
|
|
4
6
|
import _ from 'lodash';
|
|
5
7
|
export const removeFromMaterial = inboundData => {
|
|
6
8
|
const {
|
|
@@ -19,6 +21,13 @@ export const removeFromMaterial = inboundData => {
|
|
|
19
21
|
if (material) {
|
|
20
22
|
// Basic attribute textures.
|
|
21
23
|
if (removeAlbedoTexture) {
|
|
24
|
+
const isStencil = material.transparencyType === TRANSPARENCY_MODES.stencil;
|
|
25
|
+
if (isStencil) {
|
|
26
|
+
material.albedoTexture.hasAlpha = false;
|
|
27
|
+
material.albedoTexture.useAlphaFromAlbedoTexture = false;
|
|
28
|
+
material.transparencyMode = BABYLON.PBRMaterial.PBRMATERIAL_ALPHABLEND;
|
|
29
|
+
material.transparencyType = TRANSPARENCY_MODES.simple;
|
|
30
|
+
}
|
|
22
31
|
material.albedoTexture?.dispose();
|
|
23
32
|
material.albedoTexture = null;
|
|
24
33
|
}
|
package/package.json
CHANGED
|
@@ -9,6 +9,8 @@ import {
|
|
|
9
9
|
} from '../helpers';
|
|
10
10
|
import { reactProps as props } from '../Canvas';
|
|
11
11
|
import { deleteSelected } from '../actions';
|
|
12
|
+
import { TRANSPARENCY_MODES } from '../constants';
|
|
13
|
+
import * as BABYLON from 'babylonjs';
|
|
12
14
|
import _ from 'lodash';
|
|
13
15
|
|
|
14
16
|
export const removeFromMaterial = inboundData => {
|
|
@@ -28,6 +30,15 @@ export const removeFromMaterial = inboundData => {
|
|
|
28
30
|
if (material) {
|
|
29
31
|
// Basic attribute textures.
|
|
30
32
|
if (removeAlbedoTexture) {
|
|
33
|
+
const isStencil = material.transparencyType === TRANSPARENCY_MODES.stencil;
|
|
34
|
+
|
|
35
|
+
if (isStencil) {
|
|
36
|
+
material.albedoTexture.hasAlpha = false;
|
|
37
|
+
material.albedoTexture.useAlphaFromAlbedoTexture = false;
|
|
38
|
+
material.transparencyMode = BABYLON.PBRMaterial.PBRMATERIAL_ALPHABLEND;
|
|
39
|
+
material.transparencyType = TRANSPARENCY_MODES.simple;
|
|
40
|
+
}
|
|
41
|
+
|
|
31
42
|
material.albedoTexture?.dispose();
|
|
32
43
|
material.albedoTexture = null;
|
|
33
44
|
}
|
package/src/scenes/App/App.js
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
/* eslint-disable */
|
|
2
1
|
import { useEffect, useState, useCallback } from 'react';
|
|
3
2
|
import { Notifications } from 'components';
|
|
4
3
|
import { AppContainer, DebugButtons, Button } from './styles';
|
|
5
4
|
import { theme } from 'static/theme';
|
|
6
5
|
import { fetchDownloadURL } from 'helpers/fetchHelpers';
|
|
7
6
|
import { ENVIRONMENTS } from 'constants';
|
|
8
|
-
import {
|
|
7
|
+
import { updateCamera, scene } from 'package/helpers';
|
|
9
8
|
import Canvas from 'package/Canvas';
|
|
10
9
|
import _ from 'lodash';
|
|
11
10
|
|
|
@@ -96,66 +95,17 @@ const App = () => {
|
|
|
96
95
|
onClick={() => {
|
|
97
96
|
const inboundData = {
|
|
98
97
|
payload: {
|
|
99
|
-
|
|
100
|
-
|
|
98
|
+
takeScreenshot: true,
|
|
99
|
+
aspectRatio: 1.33,
|
|
100
|
+
imageDataOnly: true,
|
|
101
101
|
},
|
|
102
102
|
};
|
|
103
103
|
|
|
104
|
-
|
|
104
|
+
updateCamera(inboundData);
|
|
105
|
+
console.log(scene.metadata?.screenshotData);
|
|
105
106
|
}}
|
|
106
107
|
>
|
|
107
|
-
|
|
108
|
-
</Button>
|
|
109
|
-
|
|
110
|
-
<Button
|
|
111
|
-
theme={theme}
|
|
112
|
-
$selectedTheme={selectedTheme}
|
|
113
|
-
onClick={() => {
|
|
114
|
-
const inboundData = {
|
|
115
|
-
payload: {
|
|
116
|
-
id: '_mat_billboard_9',
|
|
117
|
-
transparencyEnabled: false,
|
|
118
|
-
},
|
|
119
|
-
};
|
|
120
|
-
|
|
121
|
-
updateMaterial(inboundData);
|
|
122
|
-
}}
|
|
123
|
-
>
|
|
124
|
-
Disable alpha
|
|
125
|
-
</Button>
|
|
126
|
-
|
|
127
|
-
<Button
|
|
128
|
-
theme={theme}
|
|
129
|
-
$selectedTheme={selectedTheme}
|
|
130
|
-
onClick={() => {
|
|
131
|
-
const inboundData = {
|
|
132
|
-
payload: {
|
|
133
|
-
id: '_mat_billboard_9',
|
|
134
|
-
albedoHasAlpha: true,
|
|
135
|
-
},
|
|
136
|
-
};
|
|
137
|
-
|
|
138
|
-
updateMaterial(inboundData);
|
|
139
|
-
}}
|
|
140
|
-
>
|
|
141
|
-
Enable albedo alpha
|
|
142
|
-
</Button>
|
|
143
|
-
|
|
144
|
-
<Button
|
|
145
|
-
theme={theme}
|
|
146
|
-
$selectedTheme={selectedTheme}
|
|
147
|
-
onClick={() => {
|
|
148
|
-
const inboundData = {
|
|
149
|
-
payload: {
|
|
150
|
-
id: '_mat_billboard_9',
|
|
151
|
-
albedoHasAlpha: false,
|
|
152
|
-
},
|
|
153
|
-
};
|
|
154
|
-
|
|
155
|
-
updateMaterial(inboundData);
|
|
156
|
-
}}
|
|
157
|
-
>
|
|
158
|
-
Disable albedo alpha
|
|
108
|
+
Screenshot Data
|
|
159
109
|
</Button>
|
|
160
110
|
|
|
161
111
|
<Button
|