<commit_before>import TreeComponent = require('../components/TreeComponent');

import SceneNode = require('../scene/Node');
import SceneModel = require('../scene/Model');
import Bone = require('../scene/Bone');
import Mesh = require('../scene/Mesh');

class Model extends TreeComponent<Bone|Mesh> {
    private model: SceneModel;

    constructor (model: SceneModel = null) {
        super('#model');

        this.model = model;

        if (this.model !== null) {
            this.model.change((changedNode:SceneNode) => {
                if (changedNode === model) {
                    this.updateItems();
                }
            });
        }
    }

    private updateItems() {
        let selectedItem = this.selectedItem,
            meshes = this.model.meshes.sort(function (a: Mesh, b: Mesh) {
                return a.name.localeCompare(b.name);
            }),
            bones = this.model.bones.sort(function (a: Bone, b: Bone) {
                return a.name.localeCompare(b.name);
            });
        this._itemWrapper.clear();
        meshes.forEach((mesh: Mesh) => {
            this._itemWrapper.add({
                label: mesh.name,
                icon: '',
                value: mesh,
                parent: null
            });
        });
        bones.forEach((bone: Bone) => {
            this._itemWrapper.add({
                label: bone.name,
                icon: '',
                value: bone,
                parent: null
            });
        });
        // Select the previously selected item, if any
        if (selectedItem !== null) {
            let selectedIndex = this._itemWrapper.indexOf(selectedItem);
            if (selectedIndex > -1) {
                this.selectedIndex = selectedIndex;
            }
        }
    }
}

export = Model;<commit_msg>Assign icons to bones and meshes<commit_after>import TreeComponent = require('../components/TreeComponent');

import SceneNode = require('../scene/Node');
import SceneModel = require('../scene/Model');
import Bone = require('../scene/Bone');
import Mesh = require('../scene/Mesh');

class Model extends TreeComponent<Bone|Mesh> {
    private model: SceneModel;

    constructor (model: SceneModel = null) {
        super('#model');

        this.model = model;

        if (this.model !== null) {
            this.model.change((changedNode:SceneNode) => {
                if (changedNode === model) {
                    this.updateItems();
                }
            });
        }
    }

    private updateItems() {
        let selectedItem = this.selectedItem,
            meshes = this.model.meshes.sort(function (a: Mesh, b: Mesh) {
                return a.name.localeCompare(b.name);
            }),
            bones = this.model.bones.sort(function (a: Bone, b: Bone) {
                return a.name.localeCompare(b.name);
            });
        this._itemWrapper.clear();
        meshes.forEach((mesh: Mesh) => {
            this._itemWrapper.add({
                label: mesh.name,
                icon: 'fa fa-square-o',
                value: mesh,
                parent: null
            });
        });
        bones.forEach((bone: Bone) => {
            this._itemWrapper.add({
                label: bone.name,
                icon: 'fa fa-circle-o',
                value: bone,
                parent: null
            });
        });
        // Select the previously selected item, if any
        if (selectedItem !== null) {
            let selectedIndex = this._itemWrapper.indexOf(selectedItem);
            if (selectedIndex > -1) {
                this.selectedIndex = selectedIndex;
            }
        }
    }
}

export = Model;
{'fraction_non_alphanumeric': 0.13224489795918368, 'fraction_numerical': 0.0005442176870748299, 'mean_word_length': 1.5457063711911356, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 13, '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': '5484219', 'n_tokens_mistral': 1002, 'n_tokens_neox': 945, 'n_words': 206}