Skip to content

Commit

Permalink
修复 shader-graph 插件 run build 失败的问题 (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
knoxHuang authored Dec 11, 2023
1 parent 500d7a7 commit bb07575
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 14 deletions.
2 changes: 1 addition & 1 deletion extensions/shader-graph/src/contributions/assets-menu.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { MenuAssetInfo } from '@editor/library-type/packages/package-asset/@types/public';
import { MenuAssetInfo } from '@cocos/creator-types/editor/packages/package-asset/@types/public';
import { PACKAGE_NAME, DEFAULT_ASSET_NAME, GraphDataMgr, getName } from '../shader-graph';

function getMenu(assetInfo: MenuAssetInfo) {
Expand Down
9 changes: 3 additions & 6 deletions extensions/shader-graph/src/importer/shader-graph-handler.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
import { gte } from 'semver';
import { basename, extname } from 'path';
import { writeFileSync } from 'fs-extra';
import { AssetHandler, CreateAssetOptions } from '@editor/library-type/packages/asset-db/@types/protected';
import { Asset } from '@editor/asset-db';

import shaderGraph from './shader-graph';
import { PACKAGE_NAME, GraphDataMgr, getName } from '../shader-graph';

const ShaderGraphHandler: AssetHandler = {
const ShaderGraphHandler = {

name: shaderGraph.name,

Expand Down Expand Up @@ -44,7 +41,7 @@ const ShaderGraphHandler: AssetHandler = {
},
];
},
async create(options: CreateAssetOptions): Promise<string | null> {
async create(options: { target: string, template: string }): Promise<string | null> {
try {
let shaderGraph = '';
const name = getName(options.target);
Expand All @@ -64,7 +61,7 @@ const ShaderGraphHandler: AssetHandler = {
},
},

async open(asset): Promise<boolean> {
async open(asset: Asset): Promise<boolean> {
Editor.Message.send('shader-graph', 'open', asset.uuid);
return true;
},
Expand Down
5 changes: 2 additions & 3 deletions extensions/shader-graph/src/importer/utils-3.8.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { basename, extname, resolve } from 'path';
import { AssetDB, forEach } from '@editor/asset-db';
import { IAsset } from '@editor/library-type/packages/asset-db/@types/protected/asset';
import { AssetDB, forEach, Asset } from '@editor/asset-db';

// @ts-ignore
import { CCON } from 'cc/editor/serialization';
Expand All @@ -26,7 +25,7 @@ async function loadTexture(assetId: string): Promise<any | null> {
* @param asset 资源数据
* @param code
*/
export async function generateEffectAsset(asset: IAsset, code: string){
export async function generateEffectAsset(asset: Asset, code: string){
const name = basename(asset.source, extname(asset.source));

const effect = await buildEffect(name, code);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { merge, debounce } from 'lodash';

import type { IProperty } from '@editor/library-type/packages/scene/@types/public';
import type { IProperty } from '@cocos/creator-types/editor/packages/scene/@types/public';
import type { PropertyDefine } from '../../../../../../@types/shader-node-type';

import { FloatWindowConfig, FloatWindowDragTarget } from '../internal';
Expand Down
2 changes: 1 addition & 1 deletion extensions/shader-graph/src/panels/shader-graph/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
GraphConfigMgr,
PANEL_NAME,
} from '../../shader-graph';
import { AssetInfo } from '@editor/library-type/packages/asset-db/@types/public';
import { AssetInfo } from '@cocos/creator-types/editor/packages/asset-db/@types/public';
import { MaskType, declareGraphBlock } from '../../shader-graph';

let vm: any = null;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { join } from 'path';
import { existsSync, readFileSync } from 'fs-extra';

import type { AssetInfo } from '@editor/library-type/packages/asset-db/@types/public';
import type { AssetInfo } from '@cocos/creator-types/editor/packages/asset-db/@types/public';

import { MaskType } from './internal';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { getBlockDataByType, getBlockTemplateByType } from '../declare';
import { generateUUID, HTMLGraphForgeElement } from '../../block-forge';

import { BaseMgr, MessageMgr, MessageType, MaskMgr, GraphConfigMgr, IGraphConfig } from './index';
import { AssetInfo } from '@editor/library-type/packages/asset-db/@types/public';
import { AssetInfo } from '@cocos/creator-types/editor/packages/asset-db/@types/public';
import { getName } from '../utils';

/**
Expand Down

0 comments on commit bb07575

Please sign in to comment.