Skip to content

Commit af226b0

Browse files
authored
SFE: Still show input blocks when "Only show custom blocks" is enabled (#129)
1 parent 8a2b9ab commit af226b0

File tree

4 files changed

+15
-2
lines changed

4 files changed

+15
-2
lines changed

packages/blocks/src/registration/IBlockRegistration.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,11 @@ export interface IBlockRegistration {
3636
*/
3737
tooltip: string;
3838

39+
/**
40+
* True if this is an input block
41+
*/
42+
isInput?: boolean;
43+
3944
/**
4045
* If true, this represents a custom block (not one that was programmatically included)
4146
*/

packages/blocks/src/registration/builtInBlockRegistrations.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -367,31 +367,37 @@ export const builtInBlockRegistrations: IBlockRegistration[] = [
367367
{
368368
blockType: "Float",
369369
namespace: inputsNamespace,
370+
isInput: true,
370371
tooltip: "A floating point number representing a value with a fractional component",
371372
},
372373
{
373374
blockType: "Color3",
374375
namespace: inputsNamespace,
376+
isInput: true,
375377
tooltip: "A set of 3 floating point numbers representing a color",
376378
},
377379
{
378380
blockType: "Color4",
379381
namespace: inputsNamespace,
382+
isInput: true,
380383
tooltip: "A set of 4 floating point numbers representing a color",
381384
},
382385
{
383386
blockType: "Texture",
384387
namespace: inputsNamespace,
388+
isInput: true,
385389
tooltip: "A texture to be used as input",
386390
},
387391
{
388392
blockType: "Vector2",
389393
namespace: inputsNamespace,
394+
isInput: true,
390395
tooltip: "A Vector2 to be used as input",
391396
},
392397
{
393398
blockType: "Boolean",
394399
namespace: inputsNamespace,
400+
isInput: true,
395401
tooltip: "A boolean to be used as input",
396402
},
397403
];

packages/editor/src/components/nodeList/nodeListComponent.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ export class NodeListComponent extends react.Component<
8989
for (const key in allBlocks) {
9090
const blockList = allBlocks[key]!.filter(
9191
(block: IBlockRegistration) =>
92-
(!this.state.onlyShowCustomBlocks || block.isCustom) &&
92+
(!this.state.onlyShowCustomBlocks || block.isCustom || block.isInput) &&
9393
(!this.state.filter ||
9494
block.blockType.toLowerCase().indexOf(this.state.filter.toLowerCase()) !== -1)
9595
)
@@ -153,7 +153,7 @@ export class NodeListComponent extends react.Component<
153153
const blockRegistrations = allBlocks[namespace];
154154
if (blockRegistrations && blockRegistrations.length) {
155155
for (const blockRegistration of blockRegistrations) {
156-
if (!this.state.onlyShowCustomBlocks || blockRegistration.isCustom) {
156+
if (!this.state.onlyShowCustomBlocks || blockRegistration.isCustom || blockRegistration.isInput) {
157157
const blockKey = getBlockKey(blockRegistration.blockType, blockRegistration.namespace);
158158
ledger.push(blockKey);
159159
}

packages/editor/src/configuration/editorBlocks/editorBlockRegistrations.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ export const editorBlockRegistrations: IBlockRegistration[] = [
99
{
1010
blockType: WebCamInputBlockName,
1111
namespace: inputsNamespace,
12+
isInput: true,
1213
tooltip: "Supplies a texture from a webcam",
1314
factory: async (smartFilter: SmartFilter) => {
1415
const module = await import(/* webpackChunkName: "webCamBlock" */ "./webCamInputBlock/webCamInputBlock.js");
@@ -18,6 +19,7 @@ export const editorBlockRegistrations: IBlockRegistration[] = [
1819
{
1920
blockType: TimeInputBlockName,
2021
namespace: inputsNamespace,
22+
isInput: true,
2123
tooltip: "Supplies a float value representing the current time",
2224
factory: (smartFilter: SmartFilter) => {
2325
const inputBlock = new InputBlock(smartFilter, "Time", ConnectionPointType.Float, 0.0);

0 commit comments

Comments
 (0)