bibbinator
7th June 2015, 19:07
Hi,
So I have spent the past few weeks digging into adding scripting to my app, reading the doc, looking at posts, SO, etc. I have a couple of high level questions to make sure my direction is right. Any help appreciated.
I'm writing an image processing app that will allow scripted filters to be applied to the image. All operations will be on arrays of floats, so I'll be processing large arrays of floats from the native side in JS, calling into native code for some utilities and stuff, but I don't need a whole bunch of properties or methods exposed.
1. I'm attracted to the debugger and tools of the old QtScript/QScriptEngine compared to the new QJSEngine. Is it correct in thinking that as long as my needs stay straightforward and simple that I can start with the older system and switch to the newer one if needed later? Seems relatively easy to migrate? Or is the new QJSEngine that much better I should use it from the start?
2. What's the best way to make large float arrays available to script? Is there any way to make a memory buffer available to scripts so I don't have to pass too much data?
3. If I want to allow the modifier scripts to store local variables what's the most performant way to declare my methods? Should I use MyClass.prototype to declare the set of methods and properties, or some other JS construct? I'm not a JS expert and I have seen many different ways to declare methods/properties and not sure the differences between them.
Thanks,
Brett
So I have spent the past few weeks digging into adding scripting to my app, reading the doc, looking at posts, SO, etc. I have a couple of high level questions to make sure my direction is right. Any help appreciated.
I'm writing an image processing app that will allow scripted filters to be applied to the image. All operations will be on arrays of floats, so I'll be processing large arrays of floats from the native side in JS, calling into native code for some utilities and stuff, but I don't need a whole bunch of properties or methods exposed.
1. I'm attracted to the debugger and tools of the old QtScript/QScriptEngine compared to the new QJSEngine. Is it correct in thinking that as long as my needs stay straightforward and simple that I can start with the older system and switch to the newer one if needed later? Seems relatively easy to migrate? Or is the new QJSEngine that much better I should use it from the start?
2. What's the best way to make large float arrays available to script? Is there any way to make a memory buffer available to scripts so I don't have to pass too much data?
3. If I want to allow the modifier scripts to store local variables what's the most performant way to declare my methods? Should I use MyClass.prototype to declare the set of methods and properties, or some other JS construct? I'm not a JS expert and I have seen many different ways to declare methods/properties and not sure the differences between them.
Thanks,
Brett