Release v0.1.3
This commit is contained in:
@@ -157,6 +157,32 @@ function selectAsset(uuid) {
|
||||
return { selected: true, uuid };
|
||||
}
|
||||
|
||||
function selectNode(uuid) {
|
||||
if (!global.Editor || !Editor.Selection || typeof Editor.Selection.select !== 'function') {
|
||||
throw new Error('Editor.Selection.select is unavailable in this Cocos environment.');
|
||||
}
|
||||
|
||||
Editor.Selection.clear('node');
|
||||
Editor.Selection.select('node', uuid);
|
||||
return { selected: true, uuid };
|
||||
}
|
||||
|
||||
function clearSelection(type) {
|
||||
if (!global.Editor || !Editor.Selection || typeof Editor.Selection.clear !== 'function') {
|
||||
throw new Error('Editor.Selection.clear is unavailable in this Cocos environment.');
|
||||
}
|
||||
|
||||
const normalized = String(type || 'all').trim().toLowerCase();
|
||||
if (normalized === 'asset' || normalized === 'node') {
|
||||
Editor.Selection.clear(normalized);
|
||||
return { cleared: true, type: normalized };
|
||||
}
|
||||
|
||||
Editor.Selection.clear('asset');
|
||||
Editor.Selection.clear('node');
|
||||
return { cleared: true, type: 'all' };
|
||||
}
|
||||
|
||||
function getCurrentSelection() {
|
||||
if (!global.Editor || !Editor.Selection || typeof Editor.Selection.getSelected !== 'function') {
|
||||
throw new Error('Editor.Selection API is unavailable in this Cocos environment.');
|
||||
@@ -170,6 +196,7 @@ function getCurrentSelection() {
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
clearSelection,
|
||||
deleteAsset,
|
||||
getCurrentSelection,
|
||||
listAssets,
|
||||
@@ -179,4 +206,5 @@ module.exports = {
|
||||
queryAssetMeta,
|
||||
queryAssetUrl,
|
||||
selectAsset,
|
||||
selectNode,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user