Skip to content

Instantly share code, notes, and snippets.

View tracebox55's full-sized avatar

tracebox tracebox55

View GitHub Profile
@tracebox55
tracebox55 / DeleteUnlinkedBodies.cs
Created October 14, 2013 14:26
[PMDE]関連するボーンが存在しない剛体を削除する
//
// 関連するボーンが存在しない剛体を削除する
// [簡易形式]DeleteUnlinkedBodies.cx
//
for (int i = body.Count - 1; i >= 0; i--)
{
if (body[i].Bone == null) // 関連するボーンが存在しない
{
body.RemoveAt(i);
}
@tracebox55
tracebox55 / DeleteSpecifiedBones.cs
Last active December 25, 2015 12:29
[PMDE]指定した名前が含まれるボーンを削除する
//
// 指定した名前が含まれるボーンを削除する
// [簡易形式]DeleteSpecifiedBones.cx
//
string name = "スカート"; // ボーン名(一部)
for (int i = bone.Count - 1; i >= 0; i--)
{
if (bone[i].Name.IndexOf(name) >= 0)
{
bone.RemoveAt(i);
@tracebox55
tracebox55 / LoadMaterialNames.cs
Last active December 25, 2015 12:19
[PMDE]pmdの材質名リストを読み込む
//
// 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))
{
@tracebox55
tracebox55 / DistanceB2V.py
Last active December 25, 2015 12:19
[メタセコ]2つの選択頂点の距離を算出する
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