Skip to content

Instantly share code, notes, and snippets.

// Webpack config for development
var fs = require('fs');
var path = require('path');
var webpack = require('webpack');
var assetsPath = path.resolve(__dirname, '../static/dist');
var host = (process.env.HOST || 'localhost');
var port = parseInt(process.env.PORT) + 1 || 3001;
// https://github.com/halt-hammerzeit/webpack-isomorphic-tools
var WebpackIsomorphicToolsPlugin = require('webpack-isomorphic-tools/plugin');
// Webpack config for development
var fs = require('fs');
var path = require('path');
var webpack = require('webpack');
var assetsPath = path.resolve(__dirname, '../static/dist');
var host = (process.env.HOST || 'localhost');
var port = parseInt(process.env.PORT) + 1 || 3001;
// https://github.com/halt-hammerzeit/webpack-isomorphic-tools
var WebpackIsomorphicToolsPlugin = require('webpack-isomorphic-tools/plugin');
@AndrewRayCode
AndrewRayCode / get-selectors.js
Created June 24, 2016 01:19
Get all CSS selectors
Object.keys( document.styleSheets ).reduce( ( memo, key ) => {
return [
...memo,
...Object.keys( document.styleSheets[ key ].rules )
.map( tk => document.styleSheets[ key ].rules[ tk ].selectorText )
];
}, [] );

The Three.js Blender exporter has been broken for at least the last 10 releases of Three.js. It's had at least 20 individual authors and contributors, most of whom have left the project never to return. Nevertheless, I have successfully imported animated (both with rigging and morph target) meshes into Three.js. Here's all the things I've encountered which you need to know about:

  • The exporter flips all vertices, faces, etc in the mesh you export. There used to be a "Flip Y/Z" option in the exporter, but it was removed when the exporter was rewritten. Since then speculation is the Blender API changed, or some other change after this one mangled the faces on export. For now we're stuck with it until we track it down.
  • mrdoob/three.js#8723 Invalid json is exported for all files with animations, so you have to delete a key manually from the json
  • mrdoob/three.js#8710 morph target exporting doesn't work with "a
export function toScreenPosition( width:number, height:number, matrix:Object, camera:Object ):Vector2 {
const vector:Vector3 = new Vector3();
const widthHalf:number = 0.5 * width;
const heightHalf:number = 0.5 * height;
vector.setFromMatrixPosition( matrix );
vector.project( camera );
import React, { PropTypes, Component } from 'react';
import ReactDOM from 'react-dom';
import React3 from 'react-three-renderer';
import THREE, { Camera, } from 'three';
import transformControls from 'three-transformcontrols';
// Duped in editor for now :( but is quick fix
const GIZMO_MOVE = 'gizmo/move';
const GIZMO_SCALE = 'gizmo/scale';
const GIZMO_ROTATE = 'gizmo/rotate';
export function getRackscanEntries() {
return (dispatch) => {
console.log("API_URI: " + API_URI);
var data;
instance.get("/")
.then(function (response) {
dispatch(updateTOREntries(response.data));
}
})
{
"presets": [ "react", "es2015", "stage-0" ],
"plugins": [
"transform-decorators-legacy", <--- add this
"transform-runtime",
]
}
"parser": "babel-eslint",
"settings": {
"import/parser": "babel-eslint"
},
var fs = require('fs');
var path = require('path');
var filename = path.resolve( __dirname, process.argv[ 2 ] );
var contents = require( filename );
// First delete the useless animations key that crashes the object loader
// https://github.com/mrdoob/three.js/issues/8723
delete contents.animations;