初期値から変化のあったパラメータを取得

Figure を操作していると、どのパラメータを触って、その形になったのか分からなくなる時があります。この script を使用すると、デフォルト値から変化したパラメータを抽出してくれます。

(function () {

    function getGroupProperties(oGROUP, bTRAVERSE, bRECURSE) {
        var aProperties = new Array();
        if (!oGROUP) { return aProperties; }
        else {
            const nPROPERTIES = oGROUP.getNumProperties();
            for (var i = 0; i < nPROPERTIES; i++) {
                aProperties.push(oGROUP.getProperty(i));
            }

            if (bRECURSE) { aProperties = aProperties.concat(getGroupProperties(oGROUP.getFirstChild(), bTRAVERSE, bRECURSE)); }
            if (bTRAVERSE) { aProperties = aProperties.concat(getGroupProperties(oGROUP.getNextSibling(), bTRAVERSE, bRECURSE)); }
        }
        return aProperties;
    }

    function getNodeProperties(oNODE, bTRAVERSE, bRECURSE) {
        const oPROPERTY_GROUP_TREE = oNODE.getPropertyGroups();
        const oPROPERTY_GROUP = oPROPERTY_GROUP_TREE.getFirstChild();
        return getGroupProperties(oPROPERTY_GROUP, bTRAVERSE, bRECURSE);
    }

    function run() {
        const oNODE = Scene.getPrimarySelection();
        if (oNODE) {
            const aPROPERTIES = getNodeProperties(oNODE, true, true);
        }
        else {
            return;
        }
        for (var i = 0; i < aPROPERTIES.length; i++) {
            p = aPROPERTIES[i];
            if (p.isNumeric()) {
                    pMax = p.getMax();
                    pDef = p.getDefaultValue();
                    pMin = p.getMin();
                    pVal = p.getValue();
                    if (p.getDefaultValue() != p.getValue()) {
                        print(p.getLabel());
                    }
            }

        }
        return null;
    }

    run();

})();