Typed array in Daz script

I have a javascript library that reads and writes C++ style data in binary format from/to a file. To do that, I use typed arrays (float32array,arraybuffer...).

I need to port this library to Daz/QtScript. QTScript is supposedly compatible with ECMA-262 which defines typed array, but I can't manage to make it work.

Does anybody have tried that ?

Comments

  • rbtwhizrbtwhiz Posts: 2,217

    Daz Studio 4.x is built on the Qt 4.x framework. To know exactly which version a particular build of Daz Studio is using, execute App.aboutQt(); in the Script IDE pane. Currently, that is Qt 4.8.7. Work is being done behind the scenes to migrate to the current version of Qt (e.g., see the various "source maintenance" comments in the change log), but that will not be part of the Daz Studio 4.x life-cycle as it is not ABI/API compatible.

    There are multiple editions of ECMA-262. Qt 4.8.7 supports ECMA-262 5th edition (perhaps 5.1, I haven't personally tested each stated difference).

    var dateNow = new Date;var sDateNow = dateNow.toJSON() //ECMA-262 5th editionprint( typeof sDateNow, ":", sDateNow );

    ArrayBuffer and Float32Array were not added until ECMA-262 6th edition.

    -Rob

  • rbtwhizrbtwhiz Posts: 2,217
    edited May 2016

    For a better view of how much of the ECMA-262 6th edition Global Object is supported...

    var oEcmaScript6Global = {};var oValues = {};oEcmaScript6Global[ "Values" ] = oValues;oValues[ "Infinity" ] = typeof Infinity;oValues[ "NaN" ] = typeof NaN;// 'undefined' is a primitive valuevar oFunctions = {};oEcmaScript6Global[ "Functions" ] = oFunctions;oFunctions[ "eval" ] = typeof eval;oFunctions[ "isFinite" ] = typeof isFinite;oFunctions[ "isNaN" ] = typeof isNaN;oFunctions[ "parseFloat" ] = typeof parseFloat;oFunctions[ "parseInt" ] = typeof parseInt;oFunctions[ "decodeURI" ] = typeof decodeURI;oFunctions[ "decodeURIComponent" ] = typeof decodeURIComponent;oFunctions[ "encodeURI" ] = typeof encodeURI;oFunctions[ "encodeURIComponent" ] = typeof encodeURIComponent;var oConstructors = {};oEcmaScript6Global[ "Constructors" ] = oConstructors;oConstructors[ "Array" ] = typeof Array;oConstructors[ "ArrayBuffer" ] = typeof ArrayBuffer;oConstructors[ "Boolean" ] = typeof Boolean;oConstructors[ "DataView" ] = typeof DataView;oConstructors[ "Date" ] = typeof Date;oConstructors[ "Error" ] = typeof Error;oConstructors[ "EvalError" ] = typeof EvalError;oConstructors[ "Float32Array" ] = typeof Float32Array;oConstructors[ "Float64Array" ] = typeof Float64Array;oConstructors[ "Function" ] = typeof Function;oConstructors[ "Int8Array" ] = typeof Int8Array;oConstructors[ "Int16Array" ] = typeof Int16Array;oConstructors[ "Int32Array" ] = typeof Int32Array;oConstructors[ "Map" ] = typeof Map;oConstructors[ "Number" ] = typeof Number;oConstructors[ "Object" ] = typeof Object;oConstructors[ "Proxy" ] = typeof Proxy;oConstructors[ "Promise" ] = typeof Promise;oConstructors[ "RangeError" ] = typeof RangeError;oConstructors[ "ReferenceError" ] = typeof ReferenceError;oConstructors[ "RegExp" ] = typeof RegExp;oConstructors[ "Set" ] = typeof Set;oConstructors[ "String" ] = typeof String;oConstructors[ "Symbol" ] = typeof Symbol;oConstructors[ "SyntaxError" ] = typeof SyntaxError;oConstructors[ "TypeError" ] = typeof TypeError;oConstructors[ "Uint8Array" ] = typeof Uint8Array;oConstructors[ "Uint8ClampedArray" ] = typeof Uint8ClampedArray;oConstructors[ "Uint16Array" ] = typeof Uint16Array;oConstructors[ "Uint32Array" ] = typeof Uint32Array;oConstructors[ "URIError" ] = typeof URIError;oConstructors[ "WeakMap" ] = typeof WeakMap;oConstructors[ "WeakSet" ] = typeof WeakSet;var oOthers = {};oEcmaScript6Global[ "Others" ] = oOthers;oOthers[ "JSON" ] = typeof JSON;oOthers[ "Math" ] = typeof Math;oOthers[ "Reflect" ] = typeof Reflect;var sSection, sProperty, sValue;var aProperties;var oProperties;var aSections = Object.keys( oEcmaScript6Global );for( var i = 0; i < aSections.length; i += 1 ){	sSection = aSections[ i ];	print( sSection );		oProperties = oEcmaScript6Global[ sSection ];	aProperties = Object.keys( oProperties );	for( var j = 0; j < aProperties.length; j += 1 ){		sProperty = aProperties[ j ];		sValue = oProperties[ sProperty ];		if( sValue == "undefined" ){			print( " -", sProperty );		} else {			print( " +", sProperty );		}	}}
    • - = not supported
    • + = supported

    -Rob

    Post edited by rbtwhiz on
  • Philemo_CarraraPhilemo_Carrara Posts: 1,175
    rbtwhiz said:

    Daz Studio 4.x is built on the Qt 4.x framework. To know exactly which version a particular build of Daz Studio is using, execute App.aboutQt(); in the Script IDE pane. Currently, that is Qt 4.8.7. Work is being done behind the scenes to migrate to the current version of Qt (e.g., see the various "source maintenance" comments in the change log), but that will not be part of the Daz Studio 4.x life-cycle as it is not ABI/API compatible.

    Thank you so much Rob for those detailed explanations. I had a vague hope of avoiding a plugin, but I see I won't have a choice. I saw in one of your other posts how to add new objects and functions to the script engine and I'll start from there.

    I'll use your script to assert what is available in scripting.

Sign In or Register to comment.