Jump to content

Contribute to BJS in javascript ?


Vousk-prod.
 Share

Recommended Posts

Hello gods of BJS,

You're now using typescript to write the code and then automatically generate the javascript version.

If we want to contribute and make some pull request on .js files, is this a problem for you ? Do you then need to rewrite our piece of code in typescript to actually integrate it to BJS ?

I'm not opposed to (try to) code directly in typescript but I don't know how to compile to javascript (I don't use Node.js, nor Visual Studio) and I'm not sure that I can compile without setting a proper project with all classes and dependencies... javascript version is really easy to modify, but for the typescript version I'm totally in the fog...

Link to comment
Share on other sites

Hmm, in fact I have a problem with the idea of coding something you'll have to rewrite after, that's pretty inefficient. We, as contributors, are here to help you in the dev, not to give you some extra work.

Do you know if the Visual Studio Express version is enough to code for BJS ?

Are the .sln files in Tools folder the ones we have to use to open the project and get our hands dirty ? (sorry if these questions look stupid, I don't know Visual Studio at all and I'm trying to guess how it works)

Link to comment
Share on other sites

Sorry to bother, but I've installed Visual Studio Express 2013 and I don't have typescript support, so I tried to install Update 2, but it requires Win8 (I'm under 7)... Any idea or suggestion ?

If it's out of the subject of this forum no problem just tell me and I'll search another solution, I wouldn't take you too much time (but maybe this will help also other people to contribute to BJS)

Link to comment
Share on other sites

So how is it going with Eclipse & the Planatir Truescript plug-in?  I have gotten about 90 % done with shape-keys, with only normals & interaction with self initiated Actions.

 

Looked at Mesh.convertToFlatShadedMesh() for normals, & realized I could use some of that code for normals, if Mesh was modularized better.  (Automaton is entirely Typed array based, but it should still work).

 

Have to go to Typescript, so might as well convert what I got now, and modify Mesh too.  I like how much better typescript is for classes.  Decided to also have Tower of Babel produce a .ts too.

 

Netbeans is pretty bad for Typescript.  Is it looking good over there?

Link to comment
Share on other sites

Very easy to install Eclipse + node.js + palantir.

 

I didn't had the time to test with coding, but for the moment when I open the BJS project inside this environnement, I have lots of errors : "Accessors are only available when targeting ECMAScript 5 and higher".

That's strange because in the Eclipse Preferences, I set Typescript compiler options to target ECMAScript 5 (instead of 3 by default).

 

Link to comment
Share on other sites

Thanks.

I've installed Visual Studio Express and it seems great and easy to use. I'll maybe use it for some Web projects, but unfortunatly typescript is only supported with Update 2, which requires Windows 8, and I'm using 7, so this solution is not applicable for me for BJS.

That's why I switched to Eclipse + plugs.

 

For the multiple error about accessors not available when targeting prior to ECMAScript 5 I solved it by targeting ES5 in the compiler AND switching to AMD for Module code Generation.

Link to comment
Share on other sites

A couple of questions about Ubuntu / Eclipse / Node.js / typscript plug-in/ Babylon set up, please.  A few days ago I got Eclipse from "Ubuntu software center", but it was old, 3.8.  I installed the git plug-in, which did not come automatically for that version, and the GitHub helper plug-in. 

 

I installed Node.JS from this pages info https://www.digitalocean.com/community/tutorials/how-to-install-node-js-on-an-ubuntu-14-04-server .  Question:  Do I need the Node.js package manager, npm, too?

 

I also installed the planatir typescript plug-in, but I did not do anything after that.

--------------

Have decided to started over before I got going by un-installing Eclipse 3.8.   I got Eclipse 4.4, Luna, directly from Eclipse, and expanded it into /opt.  Ran it once & only chose to carry-over the GitHub helper plug-in.

 

After I know what to do about Node.js package manager, I will install the typescript plug-in, but what next?  Get Babylon, obviously, but will the GitHelper plug-in make a project with a bunch of files I do not ever want to send up? I have thrown my local babylon.js git directory into the trash,  I kind of made a mess (there is no commit rollback in Git, I think).  Would deleting my GitHub fork of Babylon and reforking be a mistake?

 

Once I have a Babylon project, I am presuming that if I add/edit a .ts from eclipse, that it will "compile it" to a .js, right?  I also assume that taking all the .js's in the project to build a babylon.js is done as a separate thing with some kind of command line interface.

 

Finally, I may need to go to Florida for a while.  Whatever I do to my desktop, I am sure I can to my Macbook Pro.  What I have done with large code bases before with Netbeans is create a truecrypt volume, not so much for encryption (it's a nice to have though), but for encapsulation.  Every day I:

  • Turn on machine
  • Open the truecrypt vol
  • Run Ide with all projects in volume, & Ide is blissfully unaware.
  • close volume, and copy single file to memory stick (extreme fast as opposed to a 1000 separate files)

Now I have an entire volume backup every day.  Have had a PC fire once, so yea I am paranoid.  If I go on a trip, just plug in the memory stick into the mac, and copy file/volume to hard drive as single file.  Question: Can you have multiple Eclipse workspace directories?

 

Thanks,

 

Jeff

Link to comment
Share on other sites

Well, first question of whether Node.js package manager is needed, is yes.  Maybe not for editing / converting files from .ts to .js in Eclipse, but to build Babylon.js, using Gulp. 

 

I found the file => switch workspace menu item in Eclipse, so I can have multiple truecrypt volumes & switch development between Linux/Windows/Mac easily.

 

My forked Babylon.JS seems to be caught-up to the main one according to the GitHub webpages, so no need to do anything there.  Have no clue how.

 

I guess proceed with the package manager install, the typescript plug-in, & create the project using GitHub.  Then make the changes you outline above and see what happens.

Link to comment
Share on other sites

Wow, lots of questions at the same time :)
I cannot answer everything, but I can describe you my config and the exact order I've installed everything (but sorry, I'm under Windows 7, not linux) :

 

Before all, you need to know that I've decided not to use Git via Eclipse because I've already had a good working Git system on my PC.

FYI, after many not convincing tries, I've found that Git Extensions is the way to go on Windows (pretty simple to install, no bug - with some other I wasn't even able to fork BJS project, too heavy, timeout problems... - very easy to use, GUI is simple and clear, everything needed concerning Git is implemented, and you can also use git bash for complex cases).

 

Also I noticed that every of the following tools must be installed in the same CPU mode for better interoperability (I choose 32 bits to ensure proper compatiblity of every parts).

And always choose an installation path without space and not too far from the root folder (eg. C:/mysoft/, easier to configure and could avoid some stupid issues)

So the whole steps would be (way to do each one is not describe in details, you can find specific info for each step on the precious internet, but if you're really stucked just ask and I'll try to remember :P) :

  • Install java JDK 1.7 and add your java\jdk1.7.xx\bin folder to Windows environment variable Path (in fact I personnally installed 1.6 for compatibility issue with adb and the Unity3D android exporter, but this is an other story)
  • Create a GitHub account, and fork the BabylonJS/Babylon.js project. You'll have your own BJS version (yourname/Babylon.js)
  • Install Git Extensions (comes with msysgit and PuTTY)
  • Create a SSH Key with PuTTY
  • Add your marvelous SSH key in your GitHub account and in Git Extensions to bind them (but not in the darkness... <_< Hm...)
  • In Git Extensions, clone to a local repository your own version of BJS project on GitHub
  • Install Eclipse Luna
  • Install node.js (directly from node.js official website), no need for npm. Add node.js folder to the Windows environment variable Path
  • Restart Eclipse and install palantir typescript plug-in into Eclipse (via Help > Install new software... search for palantir). In my case palantir found node.js installation folder automatically)
  • Create a new general project in Eclipse (File > New > Project / General > Project)
  • Choose Babylon/ folder (inside your local Babylon.js forked repository folder). This will open the whole BJS typescript and javascript project structure.
  • Right-click your BJS project in Eclipse, open Properties, in typescript > compiler, choose ECMAScript target version 5 and AMD for Module Code Generation
  • Add a new line containing ".project" (without the ") in the .git/info/exclude file in your local Babylon.js forked folder (to ensure that you won't commit your Eclipse project config file to others on GitHub - better to do that in exclude file instead of .gitignore because the gitignore file is versioned, while the exclude file is not -)

 

Always refresh your Eclipse project (right-click, Refresh) after each fetch/pull of your BJS repository to have the correct file structure (this is required even if you close and restart Eclipse).

In Eclipse there's a Build automatically option activated by default. So .ts files are immmediatly compiled on every save. You can also choose to manually "compile all", to do a complete compiling of the whole project.

 

You can define as many Workspaces you need in Eclipse. A Workspace is intended to contain many Projects (related or not, your choice). You can easily switch Workspaces, and move projects from one to another (without moving physically the project files).

 

----

 

About backups, my PC does a daily backup of my working directory (locally, on another physical drive) and a weekly complete backup (FTP server). I also do regularly a ghost of my whole system and data on external drives I let to a friend's place when I leave my home for a long period (more paranoid than you :lol:). I'm using Personal Backup 5. Very very good stuff indeed ! Free for personnal use. The best I found after so many attempts with other softwares (almost the only one which could manage utf8, ftp servers, smart comparaison, and without the need of a service running all the time).

When away from home, if needed I wake up my PC with a wake on wan system and remotely use it via RDP. I'm using PocketCloud on android, very good but the response time is now very slow since the last update... (so I'm sometimes using Teamviewer for remote control, waiting for this lag problem to be fixed).

Hope this helps ! Cheers.

Link to comment
Share on other sites

Thanks!  I forgot about the Java part & just assumed it, but I guess that post could serve as a doc for the future for others not knowing Eclipse is built in Java.

 

Have built my volume & create a workspace in it, making it the default workspace.  Will stick to the Egit plug-in for now, since it has extensive documentation, and maybe other useful Eclipse tips. http://wiki.eclipse.org/EGit/User_Guide .  Not in a hurry, will read that before I go further.  Proceeding without reading carefully built help is for morons.  That's sugar coating it, but this is a family website.

 

Thank again,

 

Jeff

Link to comment
Share on other sites

  • 2 months later...

Thanks, Eth-K.  Options are good.  Really wish you were saying it was a Netbeans plug-in though.  Eclipse is good, but I miss how well Netbeans handled versioning, with little colored "tags" along the left side of lines / sections that have changed since last commit.  Hover over them & a little pop-over shows what it was before.

 

It does the full file diff in a separate tab like Eclipse, but against any previous commit.  When editing files, the hover / pop-over of the change that you can click a little revert button, or select text for clipboard is tough to live without.

Link to comment
Share on other sites

Just to throw some $0.02 into the ring (talk about mixed metaphors, eh?) Jetbrains makes a really nice IDE, WebStorm that's free for open source or academic use. It has decent typescript support, intellisense, etc. Also, cross platform. I use it professionally for just about everything from node.js code to personal websites. It's really pretty slick.  :)

 

As for contributions, I've checked out typescript (and even compared the generated code to the ts code) and tbh, I don't really think there's too large of a learning curve, especially if you've been following ES6. (I certainly like it better than coffeescript). IIRC, once of the goals of TypeScript is for it to be pretty easy for JS guys to pick up.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...