What is the best practice to resolve issues due to updated revisions in Three.JS? - three.js

I have some codes developed using Three.js R52. I need some features in some code developed using Three.js R56. While I tried to add those features to the original codes developed in R52 and replace the reference to R52 with that to R56, it tells me some some error.
For example, in the original code based on R52, THREE.Matrix4().multiplySelf function is used. After I change the reference to three.min.js from R52 to R56, I came across errors saying:
TypeError: multiplySelf is not a function.
Then I go through the changes listed in https://github.com/mrdoob/three.js/releases by searching "Matrix4", I did not see any note related to method 'multiplySelf'. I searched "multiplySelf" and it returns no entry found. I searched three.min.js R52 and found function "multiplySelf". But there is no 'multiplySelf' in R65.
Could anybody tell me what I should do now? And in general, what is the best practice to resolve issues due to updated revisions in Three.JS? Thanks...

I would create different sandboxes with the different versions of three.js. As such, I would be able to move from one sandbox to another and testing my functions without contaminating my code. I call sandbox a folder whose name is distinctive per three.js version where I only keep functionality relevant to that release and I never mix sandboxes. Usually you would have to keep a copy of your code in each sandbox until all the translations from one release to the other have been performed.
In addition you can use code like: if (THREE.REVISION < 58) to separate the different versions of three.js in your code.

Related

Unity URP Light2D, set target sorting layers programmatically

Im working on a personal 2D game and have been looking into the Universal Pipeline Renderer and the Light2D object.
I currently have Light2D objects being generated dynamically during level generation which works fine except I cant find a way to set the Target Sorting Layers option programmatically I can only set them at runtime using the editor. Am I missing something obvious or is this not possible?
Thanks
This used to work in at least some of the experimental versions of URP using
[lightSpriteComponent].m_ApplyToSortingLayers
however, when it stopped being experimental, this stopped working and broke one of my projects.
A way to set this from code and a way to set the light's sprite at runtime like the old form
[lightSpriteComponent].lightCookieSprite = Sprite
would be fantastic. They both existed and you could probably go into the URP code and find a way to access them again but, as of now, I don't think it's possible without going to an older version.

NativeScript markingMode: none errors

I'm part of a team that's using NativeScript and angular and we keep getting errors that look like:
Error: com.tns.NativeScriptException: Attempt to use cleared object reference id=<some-object-id-number>
From some research it's because we use markingMode: none in order to speed up our application. We want to keep using this so we need to find the source of the errors. From the documentation, it comes from creating a native object then wrapping it in a JS method so the garbage collector removes the native object in the method but since it's still being referenced an error is thrown. The documentation also indicated that this most likely stems from using plugins that haven't adapted to markingMode: none. The plugin I believe that's causing this is the nstudio nativescript-checkbox plugin. So I looked through the source code to try to find the native options that fit the criteria and my issues are the following:
I'm not sure if I'm finding all the native objects.
I don't know where to release them in the code.
I'm not sure if this plugin is the only one that's causing issues (we use a lot of plugins and all of them are pretty integral to our code).
I scoured our code base and couldn't find any instances where this may be a problem, but I could be wrong.
If anyone has experienced this markingMode: none issue, specifically with plugins, I would love to hear how you dealt with it and if you had any tips/suggestions moving forward. Here's the documentation detailing this issue:
https://docs.nativescript.org/core-concepts/android-runtime/advanced-topics/marking-mode-none
The NativeScript developers said it was fixed in this bug fix with an update, but I haven't noticed a change:
https://github.com/NativeScript/NativeScript/issues/7125
UPDATE: I commented out the checkbox plugin and no error, this is definitely being caused by the plugin
Removed all instances of the checkbox component and the side navigation bar and made our own custom components for them.

Xcode autocomplete showing results that don't exist on object

When using App Code, autocomplete will only show results directly related to my struct. This is a great feature as it keeps everything very clean and I know that accessing these properties isn't going to give me an error.
Except I don't like App Code and it's non native looking UI.
In Xcode it's quite different. Why am I getting flatMap, map, description, debugDescription?
Obviously if its my own code, I know which properties/functions are okay to use, because I wrote them. I can just ignore the noise. But if I'm using someone else's library this can slow things down. Especially when I'm just guessing or trying to remember a function.
Is there a way to fix this — to have Xcode not show me functions/properties that I can't use?
It always shows default system objects properties if the object/class is not found.
It's the behavior of Xcode

Three.js Typeface.js offline

the problem is obvious from the title, http://typeface.neocracy.org offline. It was used to convert fonts and used in conjunction with THREE.TextGeometry. But if it is offline, how is now possible to use custom fonts in three.js?
I made a new converter that outputs the same files as typeface.js.
http://gero3.github.io/facetype.js/
I loaded the source, but as far as I can see there is no chance to create the JS-font-files with this distribution. Maybe for someone with deep perl-knowledge...? In any case I installed perl, the ppm and dmake but trying to exec the Makefile only leads to errormessages about missing files. No - this is no alternative to the online-converter. Even worser: I didn't find any other converter or another side using the same one (cufon seems to create another format). So let's hope the site comes back to live - otherwise the great textfeature of three.js is worth nothing in the moment.

THREE.js seems to not work on localhost server

I am just starting out with THREE and have come across some odd failures which I believe are due to localhost / same-origin-poicy.
In short I created my own animation using armatures in Blender and exported using the three.js exporter plugin. The model displays but the animation doesn't run.
I used the online skinning animation example as the basis for the code and thought I may have incorrectly stripped out certain code that was causing it to fail but after looking for a couple of hours I have come to the conclusion I haven't ripped out anything incorrectly so...
To test if the example code worked locally I copied the online skinning animation example code including the buffalo.js/png files, modified the file references to map to my local copy and tried to run it in a local IIS server and all I get is the stats and no animation or model.
I checked the firebug console and only had a coupe of depreciation warnings no errors. I also checked with my model and code and I get no errors or warnings...
Anyone had this experience before? (I tested in chrome/firefox both had same behaviour)
Am happy to post code but the JSONLoader(ed) model is massive.
Thanks (and sorry for the long windedness of this SO question)
When it comes to running things on your local machine, have you tried the steps on this wiki page? How to run things locally
One example on the page suggests: chrome --allow-file-access-from-files
It's possible that your issue is related to the steps taken during your export. Without the exact errors or screenshots it's difficult to know where the issue originates from. Things to look out for:
Is your model being exported at the first frame?
Do you have the latest .py export plugin for Blender?
Using the latest version of Three.js?
Tried using THREE.SkinnedMesh?
Here is an article that gives you a brief overview of what is required for animated meshes within Three.js: Skeletal Animation
This second article provides a much more detailed tutorial, complete with example code at the bottom of the page: Skeletal Animation +1
In order to rule out same origin policy you can actually disable the security checks chrome uses when it starts up by adding this to the target window on your shortcut properties
--disable-web-security
see here for more information : Disable same origin policy in Chrome

Resources