Clean up XLoader

Description of the problem

Someone would you please clean up XLoader code?
I think it’s a bit too messed up to work among contributors.

/cc @adrs2002

Three.js version
  • Dev
  • r85
Browser
  • All of them
  • Chrome
  • Firefox
  • Internet Explorer
OS
  • All of them
  • Windows
  • macOS
  • Linux
  • Android
  • iOS

Author: Fantashit

2 thoughts on “Clean up XLoader

  1. For example,

    wrong intents

    if ( this.loadingXdata.FrameInfo_Raw[ nowFrameName ].BoneInfs != null && this.loadingXdata.FrameInfo_Raw[ nowFrameName ].BoneInfs.length ) {
    var keys = Object.keys( this.loadingXdata.FrameInfo_Raw );
    var BoneDics_Name = [];
    for ( var m = 0; m < keys.length; m ++ ) {
    if ( this.loadingXdata.FrameInfo_Raw[ keys[ m ] ].FrameStartLv <= this.loadingXdata.FrameInfo_Raw[ nowFrameName ].FrameStartLv && nowFrameName != keys[ m ] ) {
    continue;
    }
    var b = new THREE.Bone();
    b.name = keys[ m ];
    b.applyMatrix( this.loadingXdata.FrameInfo_Raw[ keys[ m ] ].FrameTransformMatrix );
    BoneDics_Name[ b.name ] = putBones.length;
    putBones.push( b );
    var ivm = new THREE.Matrix4();
    ivm.getInverse( this.loadingXdata.FrameInfo_Raw[ keys[ m ] ].FrameTransformMatrix );
    BoneInverse.push( ivm );
    }
    for ( var _m = 0; _m < putBones.length; _m ++ ) {
    for ( var dx = 0; dx < this.loadingXdata.FrameInfo_Raw[ putBones[ _m ].name ].children.length; dx ++ ) {
    var nowBoneIndex = BoneDics_Name[ this.loadingXdata.FrameInfo_Raw[ putBones[ _m ].name ].children[ dx ] ];
    if ( putBones[ nowBoneIndex ] != null ) {
    putBones[ _m ].add( putBones[ nowBoneIndex ] );
    }
    }
    }
    }

    wrong spaces

    this .endLineCount++;

    wrong reference (maybe)

    return parseASCII( String.fromCharCode.apply( null, data ) );

    And I want it to

    • be entirely readable more (or we need comment)
    • follow the code style

Comments are closed.