MQBoneManagerクラス

(new in Rev4.64)

MQBoneManager クラスはMetasequoia 4に標準搭載されている「ボーン」プラグイン BoneDeformer.dll とアクセスするためのラッパークラスです。

Rev4.70でボーン構造がノード単位で管理されるようになったのに伴い、互換性のない大幅な変更が行われました。

クラス
MQBoneManager コンストラクタ
メンバ関数
Verified 利用可能かどうか
BeginImport インポート開始
EndImport インポート終了
AddBone ボーン追加
DeleteBone ボーン削除
GetBoneNum ボーン数の取得
EnumBoneID ボーンIDの列挙
EnumSelectedBoneID 選択ボーンIDの列挙
Update 更新後の処理
GetName ボーン名の取得
SetName ボーン名の設定
GetParent 親ボーンの取得
SetParent 親ボーンの設定
GetChildNum 子ボーンの数の取得
GetChildren 子ボーンの取得
GetBasePos 位置の取得
SetBasePos 位置の設定
GetBaseMatrix 変換行列の取得
GetUpVector アップベクターの取得
SetUpVector アップベクターの設定
GetForwardAxis 前方の軸の取得
SetForwardAxis 前方の軸の設定
GetDeformPos 変形後の位置の取得
GetDeformMatrix 変形後の変換行列の設定
GetDeformScale 変形後のスケールの取得
SetDeformScale 変形後のスケールの設定
GetDeformRotate 変形後の回転角の取得
SetDeformRotate 変形後の回転角の設定
GetDeformTranslate 変形後の移動量の取得
SetDeformTranslate 変形後の移動量の設定
GetRotationMatrix 回転行列の取得
GetAngleMin 回転角制限の最小値の取得
SetAngleMin 回転角制限の最小値の設定
GetAngleMax 回転角制限の最大値の取得
SetAngleMax 回転角制限の最大値の設定
GetVisible 可視設定の取得
SetVisible 可視設定の設定
GetLock ロック設定の取得
SetLock ロック設定の設定
GetDummy ダミー設定の取得
SetDummy ダミー設定の設定
GetIKChain IKチェイン設定の取得
SetIKChain IKチェイン設定の設定
GetMovable 移動可否設定の取得
SetMovable 移動可否設定の設定
GetSkinObjectNum スキンオブジェクトの数の取得
EnumSkinObjectID スキンオブジェクトの列挙
AddSkinObject スキンオブジェクトの追加
DeleteSkinObject スキンオブジェクトの削除
GetVertexWeightArray 指定頂点へのボーン・ウェイトの取得
SetVertexWeight ウェイトの設定
GetWeightedVertexArray 指定ボーンが影響する頂点の取得
NormalizeVertexWeight ウェイトの正規化
GetIKName
GetIKParent
GetLink
GetGroupID
SetIKName
SetIKParent
SetLink
SetGroupID
EnumGroups
AddGroup
GetGroupName
PMD向け関数
GetEffectLimitNum 影響ボーン数制限の取得
DeformObject 変形の反映
VRMMeta_Get
VRMMeta_Set
VRM0xMeta_Get
VRM0xMeta_Set
VRM0x_GetFlipZ
VRM0x_SetFlipZ
VRMHumanoid_Get
VRMHumanoid_Set
VRMHumanoid_GetTemplate
VRMFirstPerson_NewMeshAnnotation
VRMFirstPerson_DeleteMeshAnnotation
VRMFirstPerson_Enumerate
VRMFirstPerson_GetMeshAnnotation
VRMFirstPerson_SetMeshAnnotation
VRMLookAt_Get
VRMLookAt_Set
VRMCollider_New
VRMCollider_Delete
VRMCollider_Enumerate
VRMCollider_GetParam
VRMCollider_SetParam
VRMColliderGroup_New
VRMColliderGroup_Delete
VRMColliderGroup_Enumerate
VRMColliderGroup_GetName
VRMColliderGroup_SetName
VRMColliderGroup_GetColliders
VRMColliderGroup_SetColliders
VRMSpringBone_New
VRMSpringBone_Delete
VRMSpringBone_Enumerate
VRMSpringBone_GetName
VRMSpringBone_SetName
VRMSpringBone_GetJointNum
VRMSpringBone_AddJoint
VRMSpringBone_DeleteJoint
VRMSpringBone_GetJoint
VRMSpringBone_GetJointNum
VRMSpringBone_SetJoint
VRMSpringBone_GetColliderGroups
VRMSpringBone_SetColliderGroups
VRMSpringBone_GetCenterBone
VRMSpringBone_SetCenterBone
VRMNodeConstraint_New
VRMNodeConstraint_Delete
VRMNodeConstraint_Enumerate
VRMNodeConstraint_Get
VRMNodeConstraint_Set
VRM向け関数

MQBoneManager::MQBoneManager(MQBasePlugin *plugin, MQDocument doc);

plugin
プラグイン
doc
ドキュメント

コンストラクタです。


static DWORD MQBoneManager::GetProductID();

ボーンプラグインのプロダクトIDを取得します。


static DWORD MQBoneManager::GetPluginID();

ボーンプラグインのプラグインIDを取得します。


bool MQBoneManager::Verified();

ボーンプラグインが利用可能かどうかを取得します。


void MQBoneManager::BeginImport();

インポートを開始します。

Importプラグイン内で使用する場合、ボーン・スキンオブジェクトを追加する前にこの関数を呼び出す必要があります。


void MQBoneManager::EndImport();

インポートを終了します。

Importプラグイン内でBeginImport()を呼び出してボーン・スキンオブジェクトを追加した後に、この関数を呼び出す必要があります。


UINT MQBoneManager::AddBone(const ADD_BONE_PARAM& param);

ボーンを追加します。


bool MQBoneManager::DeleteBone(UINT bone_id);

ボーンを削除します。


bool MQBoneManager::AddBrother(UINT bone_id, UINT brother_bone_id);

兄弟ボーンを追加します。

Rev4.70で廃止されました。


int MQBoneManager::GetBoneNum();

ボーン数を取得します。


int MQBoneManager::EnumBoneID(std::vector<UINT>& bone_id_array);

ボーンIDを列挙します。


int MQBoneManager::EnumSelectedBoneID(std::vector<UINT>& bone_id_array);

選択されているボーンIDを列挙します。


int MQBoneManager::Update();

ボーン・ウェイトの変更を表示に反映します。

常駐型・コマンドプラグインからボーン・ウェイトに対する変更を行った場合、最後にこの関数を呼び出してください。アンドゥを更新する場合は併せてMQBasePlugin::UpdateUndo()も呼び出します。


bool MQBoneManager::GetName(UINT bone_id, std::wstring& name);

void MQBoneManager::SetName(UINT bone_id, const wchar_t *name);

ボーンの名前を取得・設定します。


bool MQBoneManager::GetTipName(UINT bone_id, std::wstring& name);

void MQBoneManager::SetTipName(UINT bone_id, const wchar_t *tip_name);

ボーンの先端の名前を取得・設定します。

Rev4.70で廃止されました。


bool MQBoneManager::GetParent(UINT bone_id, UINT& parent_id);

void MQBoneManager::SetParent(UINT bone_id, UINT parent_id);

ボーンの親ボーンIDを取得・設定します。


bool MQBoneManager::GetChildNum(UINT bone_id, int& child_num);

ボーンの子ボーンの数を取得します。


bool MQBoneManager::GetChildren(UINT bone_id, std::vector<UINT>& children);

ボーンの子ボーンIDを取得します。


bool MQBoneManager::GetBrothers(UINT bone_id, std::vector<UINT>& brothers);

ボーンの兄弟ボーンIDを取得します。

Rev4.70で廃止されました。


bool MQBoneManager::GetBaseRootPos(UINT bone_id, MQPoint& pos);

void MQBoneManager::SetBaseRootPos(UINT bone_id, const MQPoint& pos);

ボーンの変形前の根の位置を取得・設定します。

Rev4.70で廃止され、GetBasePos()に代替されました。


bool MQBoneManager::GetBaseTipPos(UINT bone_id, MQPoint& pos);

void MQBoneManager::SetBaseTipPos(UINT bone_id, const MQPoint& pos);

ボーンの変形前の先端の位置を取得・設定します。

Rev4.70で廃止され、GetBasePos()に代替されました。


bool MQBoneManager::GetBasePos(UINT bone_id, MQPoint& pos);

void MQBoneManager::SetBasePos(UINT bone_id, const MQPoint& pos);

ボーンの変形前の位置を取得・設定します。


bool MQBoneManager::GetBaseMatrix(UINT bone_id, MQMatrix& matrix);

ボーンの変形前の座標変換行列を取得します。


bool MQBoneManager::GetUpVector(UINT bone_id, MQMatrix& matrix);

void MQBoneManager::SetUpVector(UINT bone_id, const MQMatrix matrix);

ボーンのアップベクターを取得・設定します。


bool MQBoneManager::GetForwardAxis(UINT bone_id, int& axis);

void MQBoneManager::SetForwardAxis(UINT bone_id, int axis);

axis
[0] +X
[1] -X
[2] +Y
[3] -Y
[4] +Z
[5] -Z

前方を示す軸を取得・設定します。


bool MQBoneManager::GetDeformRootPos(UINT bone_id, MQPoint& pos);

ボーンの変形後の根の位置を取得します。

Rev4.70で廃止され、GetDeformPos()に代替されました。


bool MQBoneManager::GetDeformTipPos(UINT bone_id, MQPoint& pos);

ボーンの変形後の先端の位置を取得します。

Rev4.70で廃止され、GetDeformPos()に代替されました。


bool MQBoneManager::GetDeformPos(UINT bone_id, MQPoint& pos);

ボーンの変形後の位置を取得します。


bool MQBoneManager::GetDeformMatrix(UINT bone_id, MQMatrix& matrix);

ボーンの変形後の座標変換行列を取得します。


bool MQBoneManager::GetDeformScale(UINT bone_id, MQPoint& scale);

void MQBoneManager::SetDeformScale(UINT bone_id, const MQPoint& scale);

ボーンの変形後のスケールを取得・設定します。


bool MQBoneManager::GetDeformRotate(UINT bone_id, MQAngle& angle);

void MQBoneManager::SetDeformRotate(UINT bone_id, const MQAngle& angle);

ボーンの変形後の回転角を取得・設定します。


bool MQBoneManager::GetDeformTranslate(UINT bone_id, MQPoint& translate);

void MQBoneManager::SetDeformTranslate(UINT bone_id, const MQPoint& translate);

ボーンの変形後の移動量を取得・設定します。


bool MQBoneManager::GetRotationMatrix(UINT bone_id, MQMatrix& matrix);

ボーンの回転行列を取得します。


bool MQBoneManager::GetAngleMin(UINT bone_id, MQAngle& angle);

void MQBoneManager::SetAngleMin(UINT bone_id, const MQAngle& angle);

ボーンの回転角制限の最小値を取得・設定します。


bool MQBoneManager::GetAngleMax(UINT bone_id, MQAngle& angle);

void MQBoneManager::SetAngleMax(UINT bone_id, const MQAngle& angle);

ボーンの回転角制限の最大値を取得・設定します。


bool MQBoneManager::GetVisible(UINT bone_id, bool& visible);

void MQBoneManager::SetVisible(UINT bone_id, bool visible);

ボーンの可視設定を取得・設定します。


bool MQBoneManager::GetLock(UINT bone_id, bool& lock);

void MQBoneManager::SetLock(UINT bone_id, bool lock);

ボーンのロック設定を取得・設定します。


bool MQBoneManager::GetDummy(UINT bone_id, bool& dummy);

void MQBoneManager::SetDummy(UINT bone_id, bool dummy);

ボーンのダミー設定を取得・設定します。


bool MQBoneManager::GetIKChain(UINT bone_id, int& chain);

void MQBoneManager::SetIKChain(UINT bone_id, int chain);

ボーンのIKチェイン設定を取得・設定します。

Rev4.70で値の定義が変更され、0でIKチェインなし、1以上で階層分たどった親ボーンがIKのルート側ボーンとなります。


bool MQBoneManager::GetEndPoint(UINT bone_id, bool& end_point);

void MQBoneManager::SetEndPoint(UINT bone_id, bool end_point);

ボーンの先端ノード設定を取得・設定します。

Rev4.70で廃止されました。


bool MQBoneManager::GetMovable(UINT bone_id, bool& movable);

void MQBoneManager::SetMovable(UINT bone_id, bool movable);

ボーンの移動可否設定を取得・設定します。


int MQBoneManager::GetSkinObjectNum();

スキンオブジェクトの数を取得します。


int MQBoneManager::EnumSkinObjectID(std::vector<UINT>& obj_id_array);

スキンオブジェクトのユニークIDを取得します。


bool MQBoneManager::AddSkinObject(MQObject obj);

スキンオブジェクトを追加します。


bool MQBoneManager::DeleteSkinObject(MQObject obj);

スキンオブジェクトとしての登録を解除します。


int MQBoneManager::GetVertexWeightArray(MQObject obj, UINT vertex_id, int array_num, UINT *bone_ids, float *weights);

obj
スキンオブジェクト
vertex_id
頂点のユニークID
array_num
ボーン・ウェイトの配列のサイズ
bone_ids
ボーンIDを格納する配列
weights
ウェイト(0~100)を格納する配列
戻り値
格納されたボーン・ウェイト数

指定した頂点に影響するボーンとウェイトを取得します。

array_numはbone_ids, weightsの配列のサイズを指定します。実際にウェイトが割り当てられているボーン数がarray_numを超えた場合、ウェイトの値の小さいものが切り捨てられます。すべてのボーンのウェイトを確実に取得したい場合、GetBoneNum()と同じ数の配列を用意します。

bone_ids, weightsにはウェイトの値が大きいものから降順となるよう各ボーンのウェイトが対として格納されます。


bool MQBoneManager::SetVertexWeight(MQObject obj, UINT vertex_id, UINT bone_id, float weight);

obj
スキンオブジェクト
vertex_id
頂点のユニークID
bone_id
ボーンID
weight
ウェイト(0~100)
戻り値
成功したかどうか

指定した頂点にボーンのウェイトを設定します。


int MQBoneManager::GetWeightedVertexArray(UINT bone_id, MQObject obj, std::vector<UINT>& vertex_ids, std::vector<float>& weights);

bone_id
ボーンID
obj
スキンオブジェクト
vertex_ids
頂点のユニークID
weights
ウェイト(0~100)
戻り値
影響する頂点数

指定したボーンが影響する頂点とウェイトを一括取得します。


bool MQBoneManager::NormalizeVertexWeight(MQObject obj, UINT vertex_id);

obj
スキンオブジェクト
vertex_id
頂点のユニークID
戻り値
成功したかどうか

指定した頂点に影響するボーンのウェイトを正規化します。


bool MQBoneManager::GetTipBone(UINT bone_id, UINT& tip_bone_id);

bool MQBoneManager::GetIKName(UINT bone_id, std::wstring& ik_name, std::wstring& ik_tip_name);

bool MQBoneManager::GetIKParent(UINT bone_id, UINT& ik_parent_bone_id, bool& isIK);

bool MQBoneManager::GetLink(UINT bone_id, LINK_PARAM& param);

bool MQBoneManager::GetGroupID(UINT bone_id, UINT& group_id);

void MQBoneManager::SetTipBone(UINT bone_id, UINT tip_bone_id);

void MQBoneManager::SetIKName(UINT bone_id, const wchar_t *ik_name, const wchar_t *ik_tip_name);

void MQBoneManager::SetIKParent(UINT bone_id, UINT ik_parent_bone_id, bool isIK);

void MQBoneManager::SetLink(UINT bone_id, const LINK_PARAM& param);

void MQBoneManager::SetGroupID(UINT bone_id, UINT group_id);

int MQBoneManager::EnumGroups(std::vector<UINT>& group_ids);

UINT MQBoneManager::AddGroup(const wchar_t *name);

bool MQBoneManager::GetGroupName(UINT group_id, std::wstring& name);

PMD向けの関数です。


int MQBoneManager::GetEffectLimitNum();

頂点ごとに影響するボーンの最大数を取得します。0なら制限はありません。


MQBoneManager::LIST_MODE MQBoneManager::GetListMode();

ボーンリストの表示モードを取得します。

Rev4.70で廃止されました。


void MQBoneManager::SetListMode(LIST_MODE mode);

ボーンリストの表示モードを設定します。

Rev4.70で廃止されました。


bool MQBoneManager::DeformObject(MQObject obj, MQObject target);

obj
スキンオブジェクト
target
objを複製したもの
戻り値
可否

ボーン情報に基づいてスキンオブジェクトの複製に変形を反映します。スキンオブジェクトを直接変形させることはできません。


bool MQBoneManager::VRMMeta_Get(VRM_META& meta);
bool MQBoneManager::VRMMeta_Set(const VRM_META& meta);
bool MQBoneManager::VRM0xMeta_Get(VRM0x_META& meta);
bool MQBoneManager::VRM0xMeta_Set(const VRM0x_META& meta);
bool MQBoneManager::VRM0x_GetFlipZ();
void MQBoneManager::VRM0x_SetFlipZ(bool flag);

VRMのメタ情報を取り扱います。


bool MQBoneManager::VRMHumanoid_Get(UINT bone_id, std::wstring& humanoid);
void MQBoneManager::VRMHumanoid_Set(UINT bone_id, const wchar_t *humanoid);
bool MQBoneManager::VRMHumanoid_GetTemplate(std::vector<VRM_HUMANOID_TEMPLATE>& humanoid, OPERATION_MODE mode = OPERATION_MODE::DEFAULT, bool acquire_bone_id = true);

VRMのヒューマノイド情報を取り扱います。


UINT MQBoneManager::VRMFirstPerson_NewMeshAnnotation(UINT obj_id, const VRM_MESH_ANNOTATION& anno);
bool MQBoneManager::VRMFirstPerson_DeleteMeshAnnotation(UINT annotation_id);
bool MQBoneManager::VRMFirstPerson_Enumerate(std::vector<UINT>& annotation_ids);
bool MQBoneManager::VRMFirstPerson_GetMeshAnnotation(UINT annotation_id, UINT& obj_id, VRM_MESH_ANNOTATION& anno);
bool MQBoneManager::VRMFirstPerson_SetMeshAnnotation(UINT annotation_id, const VRM_MESH_ANNOTATION& anno);

VRMの可視制御情報を取り扱います。


bool MQBoneManager::VRMLookAt_Get(VRM_LOOKAT_PARAM& param);
bool MQBoneManager::VRMLookAt_Set(const VRM_LOOKAT_PARAM& param);

VRMの視線情報を取り扱います。


UINT MQBoneManager::VRMCollider_New(UINT bone_id);
bool MQBoneManager::VRMCollider_Delete(UINT collider_id);
bool MQBoneManager::VRMCollider_Enumerate(std::vector<UINT>& collider_ids);
bool MQBoneManager::VRMCollider_GetParam(UINT collider_id, UINT& bone_id, VRM_COLLIDER_PARAM& param);
bool MQBoneManager::VRMCollider_SetParam(UINT collider_id, const VRM_COLLIDER_PARAM& param);
UINT MQBoneManager::VRMColliderGroup_New(const std::wstring& name, std::vector<UINT> collders = std::vector<UINT>());
bool MQBoneManager::VRMColliderGroup_Delete(UINT group_id);
bool MQBoneManager::VRMColliderGroup_Enumerate(std::vector<UINT>& group_ids);
bool MQBoneManager::VRMColliderGroup_GetName(UINT group_id, std::wstring& name);
bool MQBoneManager::VRMColliderGroup_SetName(UINT group_id, const std::wstring& name);
bool MQBoneManager::VRMColliderGroup_GetColliders(UINT group_id, std::vector<UINT>& collider_ids);
bool MQBoneManager::VRMColliderGroup_SetColliders(UINT group_id, std::vector<UINT> collider_ids);

VRMの衝突体を取り扱います。


UINT MQBoneManager::VRMSpringBone_New(const std::wstring& name);
bool MQBoneManager::VRMSpringBone_Delete(UINT spring_id);
bool MQBoneManager::VRMSpringBone_Enumerate(std::vector<UINT>& spring_ids);
bool MQBoneManager::VRMSpringBone_GetName(UINT spring_id, std::wstring& name);
bool MQBoneManager::VRMSpringBone_SetName(UINT spring_id, const std::wstring& name);
int VRMSpringBone_GetJointNum(UINT spring_id);
bool MQBoneManager::VRMSpringBone_AddJoint(UINT spring_id, UINT bone_id, const VRM_SPRING_JOINT& joint);
bool MQBoneManager::VRMSpringBone_DeleteJoint(UINT spring_id, int index);
bool MQBoneManager::VRMSpringBone_GetJoint(UINT spring_id, int index, UINT& bone_id, VRM_SPRING_JOINT& joint);
bool MQBoneManager::VRMSpringBone_SetJoint(UINT spring_id, int index, const VRM_SPRING_JOINT& joint);
bool MQBoneManager::VRMSpringBone_GetColliderGroups(UINT spring_id, std::vector<UINT>& group_ids);
bool MQBoneManager::VRMSpringBone_SetColliderGroups(UINT spring_id, std::vector<UINT> group_ids);
bool MQBoneManager::VRMSpringBone_GetCenterBone(UINT spring_id, UINT& center_bone_id);
bool MQBoneManager::VRMSpringBone_SetCenterBone(UINT spring_id, UINT center_bone_id);

VRMのばねボーンを取り扱います。


UINT MQBoneManager::VRMNodeConstraint_New(UINT bone_id);
bool MQBoneManager::VRMNodeConstraint_Delete(UINT nc_id);
bool MQBoneManager::VRMNodeConstraint_Enumerate(std::vector<UINT>& nc_ids);
bool MQBoneManager::VRMNodeConstraint_Get(UINT nc_id, UINT& bone_id, VRM_NODE_CONSTRAINT& param);
bool MQBoneManager::VRMNodeConstraint_Set(UINT nc_id, const VRM_NODE_CONSTRAINT& param);

VRMのノード拘束を取り扱います。