From 6c714821c5a7f4531d8bdd9acce52cab01664555 Mon Sep 17 00:00:00 2001 From: kircher1 <20366429+kircher1@users.noreply.github.com> Date: Fri, 12 Aug 2022 17:31:44 -0700 Subject: [PATCH 1/5] Adds a FileButton to the InspectableTypes --- packages/dev/core/src/Misc/iInspectable.ts | 12 +++++++++++- .../propertyGrids/customPropertyGridComponent.tsx | 15 +++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/packages/dev/core/src/Misc/iInspectable.ts b/packages/dev/core/src/Misc/iInspectable.ts index b3644449d6a..02f83f882a4 100644 --- a/packages/dev/core/src/Misc/iInspectable.ts +++ b/packages/dev/core/src/Misc/iInspectable.ts @@ -38,6 +38,10 @@ export enum InspectableType { * Tab */ Tab = 8, + /** + * File button. + */ + FileButton = 9, } /** @@ -90,11 +94,17 @@ export interface IInspectable { */ step?: number; /** - * Gets the callback function when using "Button" mode + * Gets the callback function when using "Button" or "FileButton" mode. + * In "FileButton" mode, the file is passed as the parameter. */ callback?: () => void; /** * Gets the list of options when using "Option" mode */ options?: IInspectableOptions[]; + /** + * Gets the extensions to accept when using "FileButton" mode. + * The value should be a comma separated string with the list of extensions to accept e.g., ".jpg, .png, .tga, .dds, .env". + */ + accept?: string } diff --git a/packages/dev/inspector/src/components/actionTabs/tabs/propertyGrids/customPropertyGridComponent.tsx b/packages/dev/inspector/src/components/actionTabs/tabs/propertyGrids/customPropertyGridComponent.tsx index bb5d5c2f400..06141cf6102 100644 --- a/packages/dev/inspector/src/components/actionTabs/tabs/propertyGrids/customPropertyGridComponent.tsx +++ b/packages/dev/inspector/src/components/actionTabs/tabs/propertyGrids/customPropertyGridComponent.tsx @@ -15,6 +15,7 @@ import type { LockObject } from "shared-ui-components/tabs/propertyGrids/lockObj import { ButtonLineComponent } from "shared-ui-components/lines/buttonLineComponent"; import { OptionsLineComponent } from "shared-ui-components/lines/optionsLineComponent"; import { TextLineComponent } from "shared-ui-components/lines/textLineComponent"; +import { FileButtonLineComponent } from "shared-ui-components/lines/fileButtonLineComponent"; interface ICustomPropertyGridComponentProps { globalState: GlobalState; @@ -131,6 +132,20 @@ export class CustomPropertyGridComponent extends React.Component; + case InspectableType.FileButton: + return ( + + ); } return null; From 3d7c4a873ebc4290ea4fc713732825fa27262dc0 Mon Sep 17 00:00:00 2001 From: kircher1 <20366429+kircher1@users.noreply.github.com> Date: Fri, 12 Aug 2022 17:34:31 -0700 Subject: [PATCH 2/5] comment --- packages/dev/core/src/Misc/iInspectable.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/dev/core/src/Misc/iInspectable.ts b/packages/dev/core/src/Misc/iInspectable.ts index 02f83f882a4..4c35b6b7fe6 100644 --- a/packages/dev/core/src/Misc/iInspectable.ts +++ b/packages/dev/core/src/Misc/iInspectable.ts @@ -39,7 +39,7 @@ export enum InspectableType { */ Tab = 8, /** - * File button. + * File button */ FileButton = 9, } From a3151b9e7a2555b240aa1cff76cc0e88ebd98ee0 Mon Sep 17 00:00:00 2001 From: kircher1 <20366429+kircher1@users.noreply.github.com> Date: Fri, 12 Aug 2022 17:56:07 -0700 Subject: [PATCH 3/5] Fix formatting --- packages/dev/core/src/Misc/iInspectable.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/dev/core/src/Misc/iInspectable.ts b/packages/dev/core/src/Misc/iInspectable.ts index 4c35b6b7fe6..a2d2e5fc4c6 100644 --- a/packages/dev/core/src/Misc/iInspectable.ts +++ b/packages/dev/core/src/Misc/iInspectable.ts @@ -106,5 +106,5 @@ export interface IInspectable { * Gets the extensions to accept when using "FileButton" mode. * The value should be a comma separated string with the list of extensions to accept e.g., ".jpg, .png, .tga, .dds, .env". */ - accept?: string + accept?: string; } From cda3965bba9bc349083aa1ca20d447ada18e8693 Mon Sep 17 00:00:00 2001 From: sebavan Date: Mon, 15 Aug 2022 16:22:29 +0200 Subject: [PATCH 4/5] Update packages/dev/inspector/src/components/actionTabs/tabs/propertyGrids/customPropertyGridComponent.tsx Co-authored-by: Raanan Weber --- .../tabs/propertyGrids/customPropertyGridComponent.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/dev/inspector/src/components/actionTabs/tabs/propertyGrids/customPropertyGridComponent.tsx b/packages/dev/inspector/src/components/actionTabs/tabs/propertyGrids/customPropertyGridComponent.tsx index 06141cf6102..a0381e1b97d 100644 --- a/packages/dev/inspector/src/components/actionTabs/tabs/propertyGrids/customPropertyGridComponent.tsx +++ b/packages/dev/inspector/src/components/actionTabs/tabs/propertyGrids/customPropertyGridComponent.tsx @@ -140,7 +140,7 @@ export class CustomPropertyGridComponent extends React.Component Date: Mon, 15 Aug 2022 16:25:01 +0200 Subject: [PATCH 5/5] Update customPropertyGridComponent.tsx --- .../tabs/propertyGrids/customPropertyGridComponent.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/dev/inspector/src/components/actionTabs/tabs/propertyGrids/customPropertyGridComponent.tsx b/packages/dev/inspector/src/components/actionTabs/tabs/propertyGrids/customPropertyGridComponent.tsx index a0381e1b97d..4486a5eea53 100644 --- a/packages/dev/inspector/src/components/actionTabs/tabs/propertyGrids/customPropertyGridComponent.tsx +++ b/packages/dev/inspector/src/components/actionTabs/tabs/propertyGrids/customPropertyGridComponent.tsx @@ -16,6 +16,7 @@ import { ButtonLineComponent } from "shared-ui-components/lines/buttonLineCompon import { OptionsLineComponent } from "shared-ui-components/lines/optionsLineComponent"; import { TextLineComponent } from "shared-ui-components/lines/textLineComponent"; import { FileButtonLineComponent } from "shared-ui-components/lines/fileButtonLineComponent"; +import { Logger } from "core/Misc/logger"; interface ICustomPropertyGridComponentProps { globalState: GlobalState; @@ -140,7 +141,7 @@ export class CustomPropertyGridComponent extends React.Component