How do I use .js functions missing in a plugin

Get help using Construct 2

Post » Tue Oct 03, 2017 4:13 pm

I'm using Babylon3D, a plugin to create 3D games but has some missing features.

Talked with the developer and due he dropped the support for the plugin everybody can use/share/edit for free.

Is possible use that missing functions via "execute javascript" from the engine "Babylon.js" that are not in the plugin?

For example, this Babylon.js code adds AO(Ambient Oclusion) to the scene:
Code: Select all
var ssao = new BABYLON.SSAORenderingPipeline("ssao", scene, 1.0, camera);



So, Is there anyway with "execute javascript" that i can use that missing plugin features?

If not, is there anyway editing the plugin or whatever that allow me use any engine function on C2?. I mean, for example add to the plugin some action that on C2 give me the chance to add real Babylon.Js code, so i can use anything.
B
25
S
10
G
3
Posts: 580
Reputation: 4,562

Post » Tue Oct 03, 2017 8:26 pm

The simplest would be to modify the plugin itself to add new features. You'll probably need to to figure out how it works first.

Otherwise you possibly could do it with the execute javascript action in the browser object. But scope is your enemy here. Anything saved with var will be gone very soon, so you'll need to attach it to a global object. Next if it needs to interact with what the plugin does already, you'll need to find a path in javascript to that stuff. It's very hacky in my opinion and it will not work after minifying.
B
94
S
33
G
113
Posts: 5,357
Reputation: 73,275

Post » Tue Oct 03, 2017 9:06 pm

First of all thanks for the fast reply @R0J0hound .

Yes, the best is add the features to the plugin, but i have 0 idea of javascript(or any language), how the SDK works or where to place this features in the actual structure of others plugin(15 plugins & 21 Behaviours) so i'm totally lost in that way :S .

So, an easy way i had in mind was if there is any chance to use real code, so i can test online in the engine editor of Babylon.js (like this one: https://www.babylonjs-playground.com/#1TDTWF#1) and if works add on the C2 events like the code i posted in the first message. Not much worried in case i can't minify really.

Then or "execute javascript" or add/create a plugin that allows comunicate with the babylon.js to use real code so i can access/use any function.

Other idea (Again if is possible) in case the use real code not works, maybe is create a blank plugin called "Babylon Enhanced" and add there only the missing features, personal structure, but i don't know if needs some communication with the real plugin and can be an option.

What you think? Any other ideas?
B
25
S
10
G
3
Posts: 580
Reputation: 4,562

Post » Tue Oct 03, 2017 10:09 pm

Anything will require a significant amount of work i think. Also there isn't a plugin to work with no one willing and able to figure out and make the necessary changes.
B
94
S
33
G
113
Posts: 5,357
Reputation: 73,275

Post » Fri Oct 06, 2017 8:58 pm

After days of intense work i found the solution, now i can add Babylon code to enable custom effects, ambient oclusion,etc... i mean, i can add any missing feature of the plugin placing inside the correct babylon plugin depending if is attached to a Camera, mesh or light.

Here a test using Depth of field, 3D chromatic aberration, edge blur, grain_blur,etc....
Image

I tried lots of code from the babylon examples and seems to work. The bad thing is to achieve that i have to change the runtime.js of the plugin every time i want to change a value.

So, now is try to find a way to change that values using Execution_Javascript in the same way its used for change other babylon stuff. If not i guess that now that i know the structure, what code is needed and where to place, for a skilled SDK coder will be more easy do the work to pass/set values from C2 events/actions, will see.
B
25
S
10
G
3
Posts: 580
Reputation: 4,562


Return to How do I....?

Who is online

Users browsing this forum: blackhornet and 26 guests