
練習的なやつ。
スクリプトをDAZ STUDIOのIDE Script(Window > Panes(Tabs) > Script IDE )に貼り付けてExcecuteボタンクリックで動く。
関連)DAZ スクリプトの導入・自作方法 【DAZ SCRIPT】
ちゃんと角度に合わせて3Dプレビューも動く。
パーツの選択し直しは出来ない。
スクリプトで動いている以上、DAZ STUDIOの通常機能は使えないのかも知れない。
市販品のツールでも、そういうの見たことないしな…。
DAZ Scriptの関節曲げツールのソース
(function() {
var dlg = new DzDialog();
dlg.caption = "関節操作ツール";
var mainLayout = new DzVBoxLayout(dlg);
mainLayout.margin = 10;
mainLayout.spacing = 5;
// 選択中のノードを取得
var selectedNode = Scene.getPrimarySelection();
if (!selectedNode) {
MessageBox.information("パーツを選択してください。", "エラー", "OK");
return;
}
// 回転コントロールの取得
var rotControls = {
"xRotate": selectedNode.getXRotControl(),
"yRotate": selectedNode.getYRotControl(),
"zRotate": selectedNode.getZRotControl()
};
var valueLabels = {};
// 各軸のコントロール作成
Object.keys(rotControls).forEach(function(axis) {
var groupBox = new DzGroupBox(dlg);
groupBox.title = axis;
mainLayout.addWidget(groupBox);
var hLayout = new DzHBoxLayout(groupBox);
var decreaseBtn = new DzPushButton(groupBox);
decreaseBtn.text = "-";
decreaseBtn.minimumWidth = 40;
hLayout.addWidget(decreaseBtn);
valueLabels[axis] = new DzLabel(groupBox);
valueLabels[axis].minimumWidth = 80;
valueLabels[axis].alignment = DzTextEdit.AlignCenter;
updateValueLabel(axis);
hLayout.addWidget(valueLabels[axis]);
var increaseBtn = new DzPushButton(groupBox);
increaseBtn.text = "+";
increaseBtn.minimumWidth = 40;
hLayout.addWidget(increaseBtn);
decreaseBtn.clicked.connect(function() {
var currentValue = rotControls[axis].getValue();
rotControls[axis].setValue(currentValue - 5);
updateValueLabel(axis);
Scene.update();
MainWindow.updateViewport();
});
increaseBtn.clicked.connect(function() {
var currentValue = rotControls[axis].getValue();
rotControls[axis].setValue(currentValue + 5);
updateValueLabel(axis);
Scene.update();
MainWindow.updateViewport();
});
});
function updateValueLabel(axis) {
var currentValue = rotControls[axis].getValue();
valueLabels[axis].text = currentValue.toFixed(2) + "°";
}
dlg.exec();
})();