mirror of
https://github.com/cocos/cocos4.git
synced 2026-11-21 08:02:39 +08:00
Output friendly information about effect name (#12137)
* Output friendly information about effect name * Apply suggestions from code review Co-authored-by: pandamicro <lphuabin@gmail.com>
This commit is contained in:
+5
-1
@@ -3286,4 +3286,8 @@ The native folder may be generated from older versions, please refer https://doc
|
||||
|
||||
### 16003
|
||||
|
||||
'%s' is removed since v%s, please use '%s' instead.
|
||||
'%s' is removed since v%s, please use '%s' instead.
|
||||
|
||||
### 16101
|
||||
|
||||
The effect('%s') you are looking for does not exist, please confirm the effect name in the editor. NOTE: Since 3.6, the name of the built-in effect has been changed to its name in the editor, please check it out. More information please refer to https://docs.cocos.com/creator/manual/en/shader/effect-inspector.html
|
||||
+2
-2
@@ -7,7 +7,8 @@
|
||||
"970b0598-bcb0-4714-91fb-2e81440dccd8",
|
||||
"bcd64cc6-2dd9-43f6-abbe-66318d332032",
|
||||
"d930590d-bb92-4cc8-8bd1-23cd027f9edf",
|
||||
"a3cd009f-0ab0-420d-9278-b9fdab939bbc"
|
||||
"a3cd009f-0ab0-420d-9278-b9fdab939bbc",
|
||||
"9361fd90-ba52-4f84-aa93-6e878fd576ca"
|
||||
]},
|
||||
"gfx-webgl": { "modules": [ "gfx-webgl" ] },
|
||||
"gfx-webgl2": { "modules": [ "gfx-webgl2" ] },
|
||||
@@ -15,7 +16,6 @@
|
||||
"modules": [ "3d" ],
|
||||
"dependentAssets": [
|
||||
"1baf0fc9-befa-459c-8bdd-af1a450a0319",
|
||||
"9361fd90-ba52-4f84-aa93-6e878fd576ca",
|
||||
"511d2633-09a7-4bdd-ac42-f778032124b3",
|
||||
"5d45aa00-e064-4938-b314-4265f0c2258c",
|
||||
"28d6d6b8-3f66-4a73-9795-17a0852ba2d4",
|
||||
|
||||
@@ -33,6 +33,7 @@ import { MacroRecord } from '../renderer/core/pass-utils';
|
||||
import { programLib } from '../renderer/core/program-lib';
|
||||
import { Asset } from './asset';
|
||||
import { legacyCC } from '../global-exports';
|
||||
import { warnID } from '../platform/debug';
|
||||
|
||||
export declare namespace EffectAsset {
|
||||
export interface IPropertyInfo {
|
||||
@@ -163,6 +164,30 @@ export declare namespace EffectAsset {
|
||||
}
|
||||
}
|
||||
|
||||
const legacyBuiltinEffectNames = [
|
||||
'planar-shadow',
|
||||
'skybox',
|
||||
'deferred-lighting',
|
||||
'bloom',
|
||||
'post-process',
|
||||
'profiler',
|
||||
'splash-screen',
|
||||
'standard',
|
||||
'unlit',
|
||||
'sprite',
|
||||
'particle',
|
||||
'particle-gpu',
|
||||
'particle-trail',
|
||||
'billboard',
|
||||
'terrain',
|
||||
'graphics',
|
||||
'clear-stencil',
|
||||
'spine',
|
||||
'occlusion-query',
|
||||
'geometry-renderer',
|
||||
'debug-renderer',
|
||||
];
|
||||
|
||||
/**
|
||||
* @en Effect asset is the base template for instantiating material, all effects should be unique globally.
|
||||
* All effects are managed in a static map of EffectAsset.
|
||||
@@ -211,6 +236,9 @@ export class EffectAsset extends Asset {
|
||||
return EffectAsset._effects[n];
|
||||
}
|
||||
}
|
||||
if (legacyBuiltinEffectNames.includes(name)) {
|
||||
warnID(16101, name);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
#include "core/Root.h"
|
||||
#include "engine/BaseEngine.h"
|
||||
#include "renderer/core/ProgramLib.h"
|
||||
#include "core/platform/Debug.h"
|
||||
|
||||
namespace cc {
|
||||
|
||||
@@ -132,6 +133,35 @@ EffectAsset *EffectAsset::get(const ccstd::string &name) {
|
||||
return iter->second;
|
||||
}
|
||||
}
|
||||
static ccstd::vector<ccstd::string> legacyBuiltinEffectNames{
|
||||
"planar-shadow",
|
||||
"skybox",
|
||||
"deferred-lighting",
|
||||
"bloom",
|
||||
"post-process",
|
||||
"profiler",
|
||||
"splash-screen",
|
||||
"standard",
|
||||
"unlit",
|
||||
"sprite",
|
||||
"particle",
|
||||
"particle-gpu",
|
||||
"particle-trail",
|
||||
"billboard",
|
||||
"terrain",
|
||||
"graphics",
|
||||
"clear-stencil",
|
||||
"spine",
|
||||
"occlusion-query",
|
||||
"geometry-renderer",
|
||||
"debug-renderer"
|
||||
};
|
||||
for (auto &legacyName : legacyBuiltinEffectNames) {
|
||||
if (name == legacyName) {
|
||||
debug::warnID(16101, name);
|
||||
}
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
@@ -451,6 +451,7 @@ ccstd::unordered_map<int, ccstd::string> debugInfos = {
|
||||
{ 16001, "'%s' is deprecated since v%s, please use '%s' instead." },
|
||||
{ 16002, "'%s' is removed since v%s." },
|
||||
{ 16003, "'%s' is removed since v%s, please use '%s' instead." },
|
||||
{ 16101, "The effect('%s') you are looking for does not exist, please confirm the effect name in the editor. NOTE: Since 3.6, the name of the built-in effect has been changed to its name in the editor, please check it out. More information please refer to https://docs.cocos.com/creator/manual/en/shader/effect-inspector.html" },
|
||||
|
||||
};
|
||||
}//namespace cc
|
||||
|
||||
Reference in New Issue
Block a user