[jsb] Fix that BufferAsset is not bound correctly. (#11695)

* [jsb] Fix that BufferAsset is not bound correctly.
This commit is contained in:
James Chen
2022-06-24 18:44:17 +08:00
committed by GitHub
parent d5e1bfa1a1
commit 8fcfed75ca
3 changed files with 11 additions and 1 deletions
@@ -386,6 +386,12 @@ bool DownloadTask_to_seval(const cc::network::DownloadTask &v, se::Value *ret);
//bool nativevalue_to_se(const cc::TypedArray &typedArray, se::Value &to, se::Object * /*ctx*/); // NOLINT(readability-identifier-naming) // NOLINT
bool nativevalue_to_se(const cc::ArrayBuffer &arrayBuffer, se::Value &to, se::Object * /*ctx*/); // NOLINT(readability-identifier-naming) // NOLINT
inline bool nativevalue_to_se(cc::ArrayBuffer *arrayBuffer, se::Value &to, se::Object *ctx) { // NOLINT(readability-identifier-naming) // NOLINT
if (arrayBuffer == nullptr) {
return false;
}
return nativevalue_to_se(*arrayBuffer, to, ctx);
}
inline bool nativevalue_to_se(const ccstd::vector<int8_t> &from, se::Value &to, se::Object * /*ctx*/) { // NOLINT(readability-identifier-naming)
se::HandleObject array{se::Object::createTypedArray(se::Object::TypedArrayType::INT8, from.data(), from.size())};
+3
View File
@@ -37,6 +37,9 @@ public:
inline ArrayBuffer *getBuffer() const { return _buffer; }
inline void setNativeAssetForJS(ArrayBuffer *buffer) { _buffer = buffer; }
inline ArrayBuffer *getNativeAssetForJS() const { return _buffer; }
ccstd::any getNativeAsset() const override;
void setNativeAsset(const ccstd::any &obj) override;
bool validate() const override { return _buffer != nullptr; }
+2 -1
View File
@@ -97,12 +97,13 @@ rename_functions = ICreateInfo::[structInfo=struct],
IPassInfoFull::[switch_=switch],
Material::[getProperty=_getProperty _props=_propsInternal],
EffectAsset::[registerAsset=register],
BufferAsset::[getBuffer=buffer],
Skeleton::[getBindposes=_getBindposes setBindposes=_setBindposes]
getter_setter= Asset::[_uuid/getUuid/setUuid nativeUrl/getNativeUrl _nativeDep/getNativeDep isDefault/isDefault],
ImageAsset::[format url/getUrl?/setUrl?],
BufferAsset::[buffer],
BufferAsset::[_nativeAsset/getNativeAssetForJS/setNativeAssetForJS],
TextureBase::[isCompressed/isCompressed _width:width/getWidth/setWidth _height:height/getHeight/setHeight],
SimpleTexture::[mipmapLevel/mipmapLevel],
RenderTexture::[window],