Skip to content

Commit e33b7a1

Browse files
committed
fix: update shader file handling and improve webcam source options retrieval
1 parent a9d0ccd commit e33b7a1

4 files changed

Lines changed: 12 additions & 17 deletions

File tree

packages/dev/core/test/unit/Decorators/decorators.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ describe("TC39 Decorator Migration", () => {
5959
class ExpandClass {
6060
// @ts-expect-error Accessed dynamically by expandToProperty decorator
6161
private _myCallback() {
62-
// no-op
62+
// no-op
6363
}
6464

6565
@expandToProperty("_myCallback")

packages/dev/smartFilters/src/utils/buildTools/convertShaders.ts

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,34 +14,26 @@ import { log, error } from "./buildToolsLogger.js";
1414
export function ConvertShaders(shaderPath: string, smartFiltersCorePath: string, babylonCorePath?: string) {
1515
const stats = fs.statSync(shaderPath);
1616

17-
let shaderFiles: fs.Dirent[];
17+
let shaderFiles: { name: string; dir: string }[];
1818

1919
if (stats.isFile()) {
20-
// If it's a file, create a Dirent-like object for consistency
21-
const fileName = path.basename(shaderPath);
22-
const dirPath = path.dirname(shaderPath);
23-
shaderFiles = [
24-
{
25-
name: fileName,
26-
path: dirPath,
27-
isFile: () => true,
28-
isDirectory: () => false,
29-
} as fs.Dirent,
30-
];
20+
shaderFiles = [{ name: path.basename(shaderPath), dir: path.dirname(shaderPath) }];
3121
} else if (stats.isDirectory()) {
3222
// Get all files in the directory
3323
const allFiles = fs.readdirSync(shaderPath, { withFileTypes: true, recursive: true });
3424

3525
// Find all shaders (files with .fragment.glsl or .block.glsl extensions)
36-
shaderFiles = allFiles.filter((file) => file.isFile() && (file.name.endsWith(".fragment.glsl") || file.name.endsWith(".block.glsl")));
26+
shaderFiles = allFiles
27+
.filter((file) => file.isFile() && (file.name.endsWith(".fragment.glsl") || file.name.endsWith(".block.glsl")))
28+
.map((file) => ({ name: file.name, dir: file.parentPath }));
3729
} else {
3830
error(`Error: ${shaderPath} is neither a file nor a directory.`);
3931
return;
4032
}
4133

4234
// Convert all shaders
4335
for (const shaderFile of shaderFiles) {
44-
const fullPathAndFileName = path.join(shaderFile.path, shaderFile.name);
36+
const fullPathAndFileName = path.join(shaderFile.dir, shaderFile.name);
4537
ConvertShader(fullPathAndFileName, smartFiltersCorePath, babylonCorePath);
4638
}
4739
}

packages/tools/guiEditor/src/components/propertyTab/propertyGrids/gui/gridPropertyGridComponent.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,8 @@ export class GridPropertyGridComponent extends React.Component<IGridPropertyGrid
158158

159159
parsePercentage(value: string) {
160160
let floatResult;
161-
if (value.trim().at(-1) === "%") {
161+
const trimmed = value.trim();
162+
if (trimmed[trimmed.length - 1] === "%") {
162163
floatResult = parseFloat(value.replace("%", "")) / 100;
163164
} else {
164165
floatResult = parseFloat(value);

packages/tools/smartFiltersEditorControl/src/configuration/editorBlocks/webCamInputBlock/webCamInputBlock.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,9 @@ export class WebCamInputBlock extends InputBlock<ConnectionPointType.Texture> {
125125
*/
126126
@editableInPropertyPage("Source", PropertyTypeForEdition.List, "PROPERTIES", {
127127
notifiers: { update: true },
128-
options: WebCamInputBlock._WebCamSourceManager.onSourcesLoaded as Observable<IEditablePropertyListOption[]>,
128+
get options() {
129+
return WebCamInputBlock._WebCamSourceManager.onSourcesLoaded as Observable<IEditablePropertyListOption[]>;
130+
},
129131
valuesAreStrings: true,
130132
})
131133
public set webcamSourceId(id: string) {

0 commit comments

Comments
 (0)