This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import math | |
doc = MQSystem.getDocument() | |
curidx = doc.currentObjectIndex | |
if curidx != -1: | |
obj = doc.object[curidx] | |
if not (obj is None): | |
mtx = doc.getGlobalInverseMatrix(obj) | |
# show vertices | |
numVert = obj.numVertex |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// pmdの材質名リストを読み込む | |
// [簡易形式]LoadMaterialNames.cx | |
// | |
// pmdデータと同じフォルダにある txt ファイル | |
string materiallist = string.Format(@"{0}\{1}.txt", Path.GetDirectoryName(pmx.FilePath), Path.GetFileNameWithoutExtension(pmx.FilePath)); | |
// 材質名リストを一行ずつ読み込んでセットする | |
using (StreamReader reader = new StreamReader(materiallist, System.Text.Encoding.Default)) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// 指定した名前が含まれるボーンを削除する | |
// [簡易形式]DeleteSpecifiedBones.cx | |
// | |
string name = "スカート"; // ボーン名(一部) | |
for (int i = bone.Count - 1; i >= 0; i--) | |
{ | |
if (bone[i].Name.IndexOf(name) >= 0) | |
{ | |
bone.RemoveAt(i); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// 関連するボーンが存在しない剛体を削除する | |
// [簡易形式]DeleteUnlinkedBodies.cx | |
// | |
for (int i = body.Count - 1; i >= 0; i--) | |
{ | |
if (body[i].Bone == null) // 関連するボーンが存在しない | |
{ | |
body.RemoveAt(i); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// 接続剛体のないJOINTを削除する | |
// [簡易形式]DeleteUnlinkedJoionts.cx | |
for (int i = joint.Count - 1; i >= 0; i--) | |
{ | |
if (joint[i].BodyA == null || joint[i].BodyB == null) // 接続剛体が存在しない | |
{ | |
joint.RemoveAt(i); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// 選択頂点を反転する | |
// [簡易形式]ReverseVertexSelection.cx | |
IList<int> vlist = new List<int>(); // 処理対象頂点のリスト格納用 | |
int[] selectedMaterials = connect.View.PMDViewHelper.PartsSelect.GetCheckedMaterialIndices(); // 材質絞込み状態取得 | |
if (selectedMaterials.Length < material.Count) // 材質絞込みがされている? | |
{ | |
// 有効な頂点を記憶する | |
foreach (int i in selectedMaterials) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// モデルが参照している画像ファイルを列挙する | |
// [簡易形式]EnumResourceFiles.cx | |
// 補足:メモ帳に貼り付けますが、たまに失敗します。 | |
IList<string> usedlist = new List<string>(); // 一度以上現れたかの判定用リスト | |
string basepath = Path.GetDirectoryName(pmx.FilePath); // モデルが保存されているフォルダ名 | |
StringBuilder sb = new StringBuilder(); // 結果出力用 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// ボーンに手動ベイク用のガイドオブジェクトをくっつける | |
// [簡易形式]AddGuideObject.cx | |
// ここにガイドオブジェクトをつけたいボーンを記述する | |
string[] targetlist = new string[]{ | |
"首", | |
"頭", | |
"左腕", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <summary> | |
/// [PMDE]頂点モーフから選択頂点のみを抜き出す | |
/// [簡易形式]ExtractVertexFromMorph.cx | |
/// PMDEのリストから対象のモーフを選択し、PMDViewで頂点を選択して使用します | |
/// </summary> | |
// 処理元のモーフ取得 | |
int selectedMorph = connect.Form.SelectedExpressionIndex; | |
if (selectedMorph < 0) | |
{ |
OlderNewer