<commit_before>import THREE from 'three';
import assign from 'react/lib/Object.assign';
import THREEContainerMixin from './THREEContainerMixin';

//
// The container methods are use by both the THREEScene composite component
// and by THREEObject3D components, so container/child stuff is in a separate
// mixin (THREEContainerMixin) and here gets merged into the typical THREE
// node methods for applying and updating props
//
var THREEObject3DMixin = assign({}, THREEContainerMixin, {

    construct: function(element) {
        this._currentElement = element;
        this._THREEObject3D = null;
    },

    getPublicInstance: function() {
        return this._THREEObject3D;
    },

    createTHREEObject: function() {
        return new THREE.Object3D();
    },

    applyTHREEObject3DProps: function(oldProps, props) {
        this.applyTHREEObject3DPropsToObject(this._THREEObject3D, oldProps, props);
    },

    applyTHREEObject3DPropsToObject: function(THREEObject3D, oldProps, props) {
        // these props have defaults
        if (typeof props.position !== 'undefined') {
            THREEObject3D.position.copy(props.position);
        } else {
            THREEObject3D.position.set(0,0,0);
        }

        if (typeof props.quaternion !== 'undefined') {
            THREEObject3D.quaternion.copy(props.quaternion);
        } else {
            THREEObject3D.quaternion.set(0,0,0,1); // no rotation
        }

        if (typeof props.visible !== 'undefined') {
            THREEObject3D.visible = props.visible;
        } else {
            THREEObject3D.visible = true;
        }

        if (typeof props.scale === "number") {
            THREEObject3D.scale.set(props.scale, props.scale, props.scale);
        } else if (props.scale instanceof THREE.Vector3) {
            // copy over scale values
            THREEObject3D.scale.copy(props.scale);
        } else {
            THREEObject3D.scale.set(1,1,1);
        }

        if (typeof props.up !== 'undefined') {
            this._THREEObject3D.up.copy(props.up);
        }

        if (typeof props.lookat !== 'undefined') {
            this._THREEObject3D.lookAt(props.lookat);
        }


        if (typeof props.name !== 'undefined') {
            THREEObject3D.name = props.name;
        }
    },

    transferTHREEObject3DPropsByName: function(oldProps, newProps, propnames) {
        var THREEObject3D = this._THREEObject3D;

        propnames.forEach(function(propname) {
            if (typeof newProps[propname] !== 'undefined') {
                THREEObject3D[propname] = newProps[propname];
            }
        });
    },

    applySpecificTHREEProps: function(/*oldProps, newProps*/) {<commit_msg>Wrong object ref in Object3DMixin<commit_after>import THREE from 'three';
import assign from 'react/lib/Object.assign';
import THREEContainerMixin from './THREEContainerMixin';

//
// The container methods are use by both the THREEScene composite component
// and by THREEObject3D components, so container/child stuff is in a separate
// mixin (THREEContainerMixin) and here gets merged into the typical THREE
// node methods for applying and updating props
//
var THREEObject3DMixin = assign({}, THREEContainerMixin, {

    construct: function(element) {
        this._currentElement = element;
        this._THREEObject3D = null;
    },

    getPublicInstance: function() {
        return this._THREEObject3D;
    },

    createTHREEObject: function() {
        return new THREE.Object3D();
    },

    applyTHREEObject3DProps: function(oldProps, props) {
        this.applyTHREEObject3DPropsToObject(this._THREEObject3D, oldProps, props);
    },

    applyTHREEObject3DPropsToObject: function(THREEObject3D, oldProps, props) {
        // these props have defaults
        if (typeof props.position !== 'undefined') {
            THREEObject3D.position.copy(props.position);
        } else {
            THREEObject3D.position.set(0,0,0);
        }

        if (typeof props.quaternion !== 'undefined') {
            THREEObject3D.quaternion.copy(props.quaternion);
        } else {
            THREEObject3D.quaternion.set(0,0,0,1); // no rotation
        }

        if (typeof props.visible !== 'undefined') {
            THREEObject3D.visible = props.visible;
        } else {
            THREEObject3D.visible = true;
        }

        if (typeof props.scale === "number") {
            THREEObject3D.scale.set(props.scale, props.scale, props.scale);
        } else if (props.scale instanceof THREE.Vector3) {
            // copy over scale values
            THREEObject3D.scale.copy(props.scale);
        } else {
            THREEObject3D.scale.set(1,1,1);
        }

        if (typeof props.up !== 'undefined') {
            THREEObject3D.up.copy(props.up);
        }

        if (typeof props.lookat !== 'undefined') {
            THREEObject3D.lookAt(props.lookat);
        }


        if (typeof props.name !== 'undefined') {
            THREEObject3D.name = props.name;
        }
    },

    transferTHREEObject3DPropsByName: function(oldProps, newProps, propnames) {
        var THREEObject3D = this._THREEObject3D;

        propnames.forEach(function(propname) {
            if (typeof newProps[propname] !== 'undefined') {
                THREEObject3D[propname] = newProps[propname];
            }
        });
    },

    applySpecificTHREEProps: function(/*oldProps, newProps*/) {
{'fraction_non_alphanumeric': 0.11123470522803114, 'fraction_numerical': 0.013904338153503892, 'mean_word_length': 2.4080859128237524, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7369638', 'n_tokens_mistral': 1610, 'n_tokens_neox': 1559, 'n_words': 326}