editMAでコンストレインを書き出すときに困ったはなし

https://qiita.com/9boz/items/e1408dccdc3c768df77e

さてコンストレインが書き出せるようにはなったのですが、
実際に運用してちょっとコンストレインまわりで困ったことが起きました。

![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/1484234/e02e3aa9-fd49-ca8e-ba4a-371f0a06cb4a.png)

こいつですね。
**blendParent1**
コンストレインされているノードに対して、キーフレームを設定すると　コンストレインとキーフレームを切り替えるためのアトリビュートが追加されるわけですけども

一旦書き出して

```python
import maya.cmds as cmds
exportFilePath = "D:/test/testPairBlend.editMA"
cmds.exportEdits(
                            exportFilePath,
                            type = "editMA",
                            selected =True,
                            includeConstraints  = True,
                            f =True
                        )

```

新しくシーンを構築して、読み込んでみますと

```python

cmds.file(exportFilePath,
        type = "editMA",
        i =True,
        applyTo = "sampleAsset_v01RN",
        f =True
        )

# Error: RuntimeError: file <maya console> line 6: file: D:/test/testPairBlend.editMA line 56: The transform '<main>:pCone1' has no 'blendParent1' attribute.

```

'blendParent1' アトリビュートが無いですねぇ

editMAだと　parentConstarint コマンドでコンストレインを掛けるのではなく、
createNode で　parentConstraintノードを作成して接続なので、
blendParent アトリビュートが追加されないんですね。

書き出せるかなー・・・・addAttr

https://help.autodesk.com/cloudhelp/2022/JPN/Maya-Tech-Docs/CommandsPython/exportEdits.html


**editCommand(ec)**
コマンドが考慮するべくリファレンスの編集のタイプを示すための二次フラグです。このフラグが指定されない場合、すべてのタイプの編集が含まれます。このフラグには文字列パラメータが必要です。有効な値は、「addAttr」、「connectAttr」、「deleteAttr」、「disconnectAttr」、「parent」、「setAttr」、「lock」、および「unlock」です。状況によっては、このフラグを複数回指定して、複数の編集タイプを考慮するように指定できます。

これかなぁ？

```python
import maya.cmds as cmds
exportFilePath = "D:/test/testPairBlend.editMA"
cmds.exportEdits(
                            exportFilePath,
                            type = "editMA",
                            selected =True,
                            includeConstraints  = True,
                            editCommand = "addAttr",
                            f =True
                        )
```

書き出されてませんなぁ・・・

```testPairBlend.editMA
//Maya ASCII 2022 scene
//Name: testPairBlend.editMA
//Last modified: Mon, Dec 30, 2024 11:24:59 PM
//Codeset: 932
requires maya "2022";
requires -nodeType "aiOptions" -nodeType "aiAOVDriver" -nodeType "aiAOVFilter" "mtoa" "5.0.0.4";
requires "stereoCamera" "10.0";
requires "stereoCamera" "10.0";
currentUnit -l centimeter -a degree -t film;
fileInfo "fileCreationSource" "ExportEdits";
createNode parentConstraint -n "pCone1_parentConstraint1";
	rename -uid "F2EA4BB8-412E-69C0-A545-FB916E8E4FB3";
	addAttr -dcb 0 -ci true -k true -sn "w0" -ln "pCube1W0" -dv 1 -min 0 -at "double";
	setAttr -k on ".nds";
	setAttr -k off ".v";
	setAttr -k off ".tx";
	setAttr -k off ".ty";
	setAttr -k off ".tz";
	setAttr -k off ".rx";
	setAttr -k off ".ry";
	setAttr -k off ".rz";
	setAttr -k off ".sx";
	setAttr -k off ".sy";
	setAttr -k off ".sz";
	setAttr ".erp" yes;
	setAttr ".tg[0].tot" -type "double3" -0.98457584847913937 0 -3.3275038100774061 ;
	setAttr ".rst" -type "double3" 1.4291536085618226 0 -3.2073003230214763 ;
	setAttr -k on ".w0";
createNode pairBlend -n "pairBlend2";
	rename -uid "820ECCFB-4D4A-FC6C-0BFD-558ECB464EF3";
connectAttr "<main>:pCube1.t" "pCone1_parentConstraint1.tg[0].tt";
connectAttr "<main>:pCube1.rp" "pCone1_parentConstraint1.tg[0].trp";
connectAttr "<main>:pCube1.rpt" "pCone1_parentConstraint1.tg[0].trt";
connectAttr "<main>:pCube1.r" "pCone1_parentConstraint1.tg[0].tr";
connectAttr "<main>:pCube1.ro" "pCone1_parentConstraint1.tg[0].tro";
connectAttr "<main>:pCube1.s" "pCone1_parentConstraint1.tg[0].ts";
connectAttr "<main>:pCube1.pm" "pCone1_parentConstraint1.tg[0].tpm";
connectAttr "<main>:pCone1.ro" "pCone1_parentConstraint1.cro";
connectAttr "<main>:pCone1.pim" "pCone1_parentConstraint1.cpim";
connectAttr "<main>:pCone1.rp" "pCone1_parentConstraint1.crp";
connectAttr "<main>:pCone1.rpt" "pCone1_parentConstraint1.crt";
connectAttr "pCone1_parentConstraint1.w0" "pCone1_parentConstraint1.tg[0].tw";
connectAttr "pCone1_parentConstraint1.ctx" "pairBlend2.itx2";
connectAttr "pCone1_parentConstraint1.cty" "pairBlend2.ity2";
connectAttr "pCone1_parentConstraint1.ctz" "pairBlend2.itz2";
connectAttr "pCone1_parentConstraint1.crx" "pairBlend2.irx2";
connectAttr "pCone1_parentConstraint1.cry" "pairBlend2.iry2";
connectAttr "pCone1_parentConstraint1.crz" "pairBlend2.irz2";
connectAttr "pCone1_parentConstraint1.msg" "<root>:MayaNodeEditorSavedTabsInfo.tgi[0].ni[16].dn"
		;
connectAttr "<main>:pCone1.blendParent1" "pairBlend2.w";
connectAttr "pairBlend2.otx" "<main>:pCone1.tx";
connectAttr "pairBlend2.oty" "<main>:pCone1.ty";
connectAttr "pairBlend2.otz" "<main>:pCone1.tz";
connectAttr "pairBlend2.orx" "<main>:pCone1.rx";
connectAttr "pairBlend2.ory" "<main>:pCone1.ry";
connectAttr "pairBlend2.orz" "<main>:pCone1.rz";
connectAttr "<main>:pCone1.ro" "pairBlend2.ro";
connectAttr "<root>:pCone1_translateX.o" "pairBlend2.itx1";
connectAttr "<root>:pCone1_translateY.o" "pairBlend2.ity1";
connectAttr "<root>:pCone1_translateZ.o" "pairBlend2.itz1";
connectAttr "<root>:pCone1_rotateX.o" "pairBlend2.irx1";
connectAttr "<root>:pCone1_rotateY.o" "pairBlend2.iry1";
connectAttr "<root>:pCone1_rotateZ.o" "pairBlend2.irz1";
connectAttr "pairBlend2.msg" "<root>:MayaNodeEditorSavedTabsInfo.tgi[0].ni[2].dn"
		;
// End of testPairBlend.editMA
```

う～ん

**onReferenceNode(orn)**
指定したリファレンス ノードに格納された編集のみを考慮することを示すための二次フラグです。このフラグは、「exportEdits」コマンドによる指定時のみ複数使用が可能です。

こっちのフラグも併用かなぁ？



```python
import maya.cmds as cmds
exportFilePath = "D:/test/testPairBlend.editMA"
cmds.exportEdits(
                            exportFilePath,
                            type = "editMA",
                            selected =True,
                            includeConstraints  = True,
                            editCommand = "addAttr",
                            onReferenceNode = "sampleAsset_v01RN",
                            f =True
                        )

# Error: RuntimeError: file <maya console> line 10: exportEdits: Only one target node option may be specified. # 
```

おっふぅ。
selected とぶつかってるのかしら

```python
import maya.cmds as cmds
exportFilePath = "D:/test/testPairBlend.editMA"
cmds.exportEdits(
                            exportFilePath,
                            type = "editMA",
                            includeConstraints  = True,
                            editCommand = "addAttr",
                            onReferenceNode = "sampleAsset_v01RN",
                            f =True
                        )
```
書き出せました。
さて・・・

```testPairBlend.editMA
//Maya ASCII 2022 scene
//Name: testPairBlend.editMA
//Last modified: Mon, Dec 30, 2024 11:33:21 PM
//Codeset: 932
requires maya "2022";
requires -nodeType "aiOptions" -nodeType "aiAOVDriver" -nodeType "aiAOVFilter" "mtoa" "5.0.0.4";
requires "stereoCamera" "10.0";
requires "stereoCamera" "10.0";
currentUnit -l centimeter -a degree -t film;
fileInfo "fileCreationSource" "ExportEdits";
createNode parentConstraint -n "pCone1_parentConstraint1";
	rename -uid "F2EA4BB8-412E-69C0-A545-FB916E8E4FB3";
	addAttr -dcb 0 -ci true -k true -sn "w0" -ln "pCube1W0" -dv 1 -min 0 -at "double";
	setAttr -k on ".nds";
	setAttr -k off ".v";
	setAttr -k off ".tx";
	setAttr -k off ".ty";
	setAttr -k off ".tz";
	setAttr -k off ".rx";
	setAttr -k off ".ry";
	setAttr -k off ".rz";
	setAttr -k off ".sx";
	setAttr -k off ".sy";
	setAttr -k off ".sz";
	setAttr ".erp" yes;
	setAttr ".tg[0].tot" -type "double3" -0.98457584847913937 0 -3.3275038100774061 ;
	setAttr ".rst" -type "double3" 1.4291536085618226 0 -3.2073003230214763 ;
	setAttr -k on ".w0";
createNode pairBlend -n "pairBlend2";
	rename -uid "820ECCFB-4D4A-FC6C-0BFD-558ECB464EF3";
connectAttr "pCone1_parentConstraint1.w0" "pCone1_parentConstraint1.tg[0].tw";
connectAttr "pCone1_parentConstraint1.ctx" "pairBlend2.itx2";
connectAttr "pCone1_parentConstraint1.cty" "pairBlend2.ity2";
connectAttr "pCone1_parentConstraint1.ctz" "pairBlend2.itz2";
connectAttr "pCone1_parentConstraint1.crx" "pairBlend2.irx2";
connectAttr "pCone1_parentConstraint1.cry" "pairBlend2.iry2";
connectAttr "pCone1_parentConstraint1.crz" "pairBlend2.irz2";
connectAttr "pCone1_parentConstraint1.msg" "<root>:MayaNodeEditorSavedTabsInfo.tgi[0].ni[16].dn"
		;
connectAttr "<root>:pCone1_translateX.o" "pairBlend2.itx1";
connectAttr "<root>:pCone1_translateY.o" "pairBlend2.ity1";
connectAttr "<root>:pCone1_translateZ.o" "pairBlend2.itz1";
connectAttr "<root>:pCone1_rotateX.o" "pairBlend2.irx1";
connectAttr "<root>:pCone1_rotateY.o" "pairBlend2.iry1";
connectAttr "<root>:pCone1_rotateZ.o" "pairBlend2.irz1";
connectAttr "pairBlend2.msg" "<root>:MayaNodeEditorSavedTabsInfo.tgi[0].ni[2].dn"
		;
parent -s -nc -r -add "pCone1_parentConstraint1" "<main>:pCone1" ;
select -ne "<main>:pCone1";
	addAttr -ci true -k true -sn "blendParent1" -ln "blendParent1" -dv 1 -smn 0 -smx 
		1 -at "double";
connectAttr "<main>:pSphere1.t" "<root>:pCylinder1_parentConstraint1.tg[0].tt";
connectAttr "<root>:pSphere1_translateX.o" "<main>:pSphere1.tx";
connectAttr "<root>:pSphere1_translateY.o" "<main>:pSphere1.ty";
connectAttr "<root>:pSphere1_translateZ.o" "<main>:pSphere1.tz";
connectAttr "<main>:pSphere1.rp" "<root>:pCylinder1_parentConstraint1.tg[0].trp"
		;
connectAttr "<main>:pSphere1.rpt" "<root>:pCylinder1_parentConstraint1.tg[0].trt"
		;
connectAttr "<main>:pSphere1.r" "<root>:pCylinder1_parentConstraint1.tg[0].tr";
connectAttr "<root>:pSphere1_rotateX.o" "<main>:pSphere1.rx";
connectAttr "<root>:pSphere1_rotateY.o" "<main>:pSphere1.ry";
connectAttr "<root>:pSphere1_rotateZ.o" "<main>:pSphere1.rz";
connectAttr "<main>:pSphere1.ro" "<root>:pCylinder1_parentConstraint1.tg[0].tro"
		;
connectAttr "<main>:pSphere1.s" "<root>:pCylinder1_parentConstraint1.tg[0].ts";
connectAttr "<root>:pSphere1_scaleX.o" "<main>:pSphere1.sx";
connectAttr "<root>:pSphere1_scaleY.o" "<main>:pSphere1.sy";
connectAttr "<root>:pSphere1_scaleZ.o" "<main>:pSphere1.sz";
connectAttr "<main>:pSphere1.pm" "<root>:pCylinder1_parentConstraint1.tg[0].tpm"
		;
connectAttr "<root>:pSphere1_visibility.o" "<main>:pSphere1.v";
connectAttr "<main>:pCube1.msg" "<root>:MayaNodeEditorSavedTabsInfo.tgi[0].ni[8].dn"
		;
connectAttr "<main>:pCube1.t" "pCone1_parentConstraint1.tg[0].tt";
connectAttr "<main>:pCube1.rp" "pCone1_parentConstraint1.tg[0].trp";
connectAttr "<main>:pCube1.rpt" "pCone1_parentConstraint1.tg[0].trt";
connectAttr "<main>:pCube1.r" "pCone1_parentConstraint1.tg[0].tr";
connectAttr "<main>:pCube1.ro" "pCone1_parentConstraint1.tg[0].tro";
connectAttr "<main>:pCube1.s" "pCone1_parentConstraint1.tg[0].ts";
connectAttr "<main>:pCube1.pm" "pCone1_parentConstraint1.tg[0].tpm";
connectAttr "<main>:pCone1.blendParent1" "pairBlend2.w";
connectAttr "<root>:pCone1_blendParent1.o" "<main>:pCone1.blendParent1";
connectAttr "<main>:pCone1.msg" "<root>:MayaNodeEditorSavedTabsInfo.tgi[0].ni[9].dn"
		;
connectAttr "pairBlend2.otx" "<main>:pCone1.tx";
connectAttr "pairBlend2.oty" "<main>:pCone1.ty";
connectAttr "pairBlend2.otz" "<main>:pCone1.tz";
connectAttr "<root>:pCone1_visibility.o" "<main>:pCone1.v";
connectAttr "pairBlend2.orx" "<main>:pCone1.rx";
connectAttr "pairBlend2.ory" "<main>:pCone1.ry";
connectAttr "pairBlend2.orz" "<main>:pCone1.rz";
connectAttr "<root>:pCone1_scaleX.o" "<main>:pCone1.sx";
connectAttr "<root>:pCone1_scaleY.o" "<main>:pCone1.sy";
connectAttr "<root>:pCone1_scaleZ.o" "<main>:pCone1.sz";
connectAttr "<main>:pCone1.ro" "pairBlend2.ro";
connectAttr "<main>:pCone1.ro" "pCone1_parentConstraint1.cro";
connectAttr "<main>:pCone1.pim" "pCone1_parentConstraint1.cpim";
connectAttr "<main>:pCone1.rp" "pCone1_parentConstraint1.crp";
connectAttr "<main>:pCone1.rpt" "pCone1_parentConstraint1.crt";
connectAttr "<main>:pConeShape1.msg" "<root>:MayaNodeEditorSavedTabsInfo.tgi[0].ni[12].dn"
		;
connectAttr "<main>:surfaceShader3SG.msg" "<root>:MayaNodeEditorSavedTabsInfo.tgi[0].ni[10].dn"
		;
// End of testPairBlend.editMA

```

addAttr は書き出されてますね。
代わりにアニメーションカーブのcreateNode周りが消えてますねぇ・・・

**includeAnimation　フラグを追加して！もう一回！**

```python
import maya.cmds as cmds
exportFilePath = "D:/test/testPairBlend.editMA"
cmds.exportEdits(
                            exportFilePath,
                            type = "editMA",
                            includeConstraints  = True,
                            editCommand = "addAttr",
                            includeAnimation =True,
                            onReferenceNode = "sampleAsset_v01RN",
                            f =True
                        )
```

あ、これは割とイケてるような・・・・・・
駄目ですね、pCone1に直接つながってるアニメーションカーブは書き出されていますが、
pairBlend経由のアニメーションカーブが書き出されてません。

```testPairBlend.editMA
//Maya ASCII 2022 scene
//Name: testPairBlend.editMA
//Last modified: Mon, Dec 30, 2024 11:36:59 PM
//Codeset: 932
requires maya "2022";
requires -nodeType "aiOptions" -nodeType "aiAOVDriver" -nodeType "aiAOVFilter" "mtoa" "5.0.0.4";
requires "stereoCamera" "10.0";
currentUnit -l centimeter -a degree -t film;
fileInfo "fileCreationSource" "ExportEdits";
createNode parentConstraint -n "pCone1_parentConstraint1";
	rename -uid "F2EA4BB8-412E-69C0-A545-FB916E8E4FB3";
	addAttr -dcb 0 -ci true -k true -sn "w0" -ln "pCube1W0" -dv 1 -min 0 -at "double";
	setAttr -k on ".nds";
	setAttr -k off ".v";
	setAttr -k off ".tx";
	setAttr -k off ".ty";
	setAttr -k off ".tz";
	setAttr -k off ".rx";
	setAttr -k off ".ry";
	setAttr -k off ".rz";
	setAttr -k off ".sx";
	setAttr -k off ".sy";
	setAttr -k off ".sz";
	setAttr ".erp" yes;
	setAttr ".tg[0].tot" -type "double3" -0.98457584847913937 0 -3.3275038100774061 ;
	setAttr ".rst" -type "double3" 1.4291536085618226 0 -3.2073003230214763 ;
	setAttr -k on ".w0";
createNode animCurveTL -n "pSphere1_translateZ";
	rename -uid "0CF890E7-47FA-C5EE-AF1B-03854F71FA86";
	setAttr ".tan" 18;
	setAttr ".wgt" no;
	setAttr ".ktv[0]"  1 0;
createNode animCurveTU -n "pSphere1_visibility";
	rename -uid "0E898703-4A7E-EF90-7FD5-8CBAC512F603";
	setAttr ".tan" 9;
	setAttr ".wgt" no;
	setAttr ".ktv[0]"  1 1;
	setAttr ".kot[0]"  5;
createNode animCurveTL -n "pSphere1_translateY";
	rename -uid "861B8D53-4DA8-1367-850D-C09DF3CA5B83";
	setAttr ".tan" 18;
	setAttr ".wgt" no;
	setAttr ".ktv[0]"  1 0;
createNode animCurveTU -n "pCone1_scaleY";
	rename -uid "2FECB485-4B38-84E3-B220-10B74FB40A48";
	setAttr ".tan" 18;
	setAttr ".wgt" no;
	setAttr ".ktv[0]"  1 1;
createNode animCurveTU -n "pCone1_scaleZ";
	rename -uid "91863F0A-45C7-B93B-BE56-F6BFCC0ECFD5";
	setAttr ".tan" 18;
	setAttr ".wgt" no;
	setAttr ".ktv[0]"  1 1;
createNode animCurveTL -n "pSphere1_translateX";
	rename -uid "68623C64-4443-50BB-3889-8FB915D885CC";
	setAttr ".tan" 18;
	setAttr ".wgt" no;
	setAttr ".ktv[0]"  1 0;
createNode pairBlend -n "pairBlend2";
	rename -uid "820ECCFB-4D4A-FC6C-0BFD-558ECB464EF3";
createNode animCurveTA -n "pSphere1_rotateX";
	rename -uid "2F0CE1C7-4E03-64A2-C2E4-3DB2E72EAC1F";
	setAttr ".tan" 18;
	setAttr ".wgt" no;
	setAttr ".ktv[0]"  1 0;
createNode animCurveTA -n "pSphere1_rotateY";
	rename -uid "4791779C-4CEF-EF31-DECD-ABAE55E28704";
	setAttr ".tan" 18;
	setAttr ".wgt" no;
	setAttr ".ktv[0]"  1 0;
createNode animCurveTA -n "pSphere1_rotateZ";
	rename -uid "C25A9C42-48BB-726B-F329-418F3E6482E3";
	setAttr ".tan" 18;
	setAttr ".wgt" no;
	setAttr ".ktv[0]"  1 0;
createNode animCurveTU -n "pCone1_scaleX";
	rename -uid "D88215EE-457F-FDB6-30B5-898EF0F59409";
	setAttr ".tan" 18;
	setAttr ".wgt" no;
	setAttr ".ktv[0]"  1 1;
createNode animCurveTU -n "pCone1_visibility";
	rename -uid "C4B559FD-46E8-7682-3B52-16B95AACB8B8";
	setAttr ".tan" 9;
	setAttr ".wgt" no;
	setAttr ".ktv[0]"  1 1;
	setAttr ".kot[0]"  5;
createNode animCurveTU -n "pCone1_blendParent1";
	rename -uid "483EE5E1-428C-E0AE-EAE8-E8A1FDE91656";
	setAttr ".tan" 18;
	setAttr ".wgt" no;
	setAttr ".ktv[0]"  1 1;
createNode animCurveTU -n "pSphere1_scaleX";
	rename -uid "792E4EB4-4BB4-E439-AC71-34B9854F8247";
	setAttr ".tan" 18;
	setAttr ".wgt" no;
	setAttr ".ktv[0]"  1 1;
createNode animCurveTU -n "pSphere1_scaleZ";
	rename -uid "6723FC29-4730-9A89-F952-128D6A6F9C53";
	setAttr ".tan" 18;
	setAttr ".wgt" no;
	setAttr ".ktv[0]"  1 1;
createNode animCurveTU -n "pSphere1_scaleY";
	rename -uid "031AEBC5-485B-42DD-E583-24AE8FE40D15";
	setAttr ".tan" 18;
	setAttr ".wgt" no;
	setAttr ".ktv[0]"  1 1;
connectAttr "pCone1_parentConstraint1.w0" "pCone1_parentConstraint1.tg[0].tw";
connectAttr "pCone1_parentConstraint1.ctx" "pairBlend2.itx2";
connectAttr "pCone1_parentConstraint1.cty" "pairBlend2.ity2";
connectAttr "pCone1_parentConstraint1.ctz" "pairBlend2.itz2";
connectAttr "pCone1_parentConstraint1.crx" "pairBlend2.irx2";
connectAttr "pCone1_parentConstraint1.cry" "pairBlend2.iry2";
connectAttr "pCone1_parentConstraint1.crz" "pairBlend2.irz2";
connectAttr "pCone1_parentConstraint1.msg" "<root>:MayaNodeEditorSavedTabsInfo.tgi[0].ni[16].dn"
		;
connectAttr "pCone1_scaleY.msg" "<root>:MayaNodeEditorSavedTabsInfo.tgi[0].ni[13].dn"
		;
connectAttr "pCone1_scaleZ.msg" "<root>:MayaNodeEditorSavedTabsInfo.tgi[0].ni[11].dn"
		;
connectAttr "<root>:pCone1_translateX.o" "pairBlend2.itx1";
connectAttr "<root>:pCone1_translateY.o" "pairBlend2.ity1";
connectAttr "<root>:pCone1_translateZ.o" "pairBlend2.itz1";
connectAttr "<root>:pCone1_rotateX.o" "pairBlend2.irx1";
connectAttr "<root>:pCone1_rotateY.o" "pairBlend2.iry1";
connectAttr "<root>:pCone1_rotateZ.o" "pairBlend2.irz1";
connectAttr "pairBlend2.msg" "<root>:MayaNodeEditorSavedTabsInfo.tgi[0].ni[2].dn"
		;
connectAttr "pCone1_scaleX.msg" "<root>:MayaNodeEditorSavedTabsInfo.tgi[0].ni[15].dn"
		;
connectAttr "pCone1_visibility.msg" "<root>:MayaNodeEditorSavedTabsInfo.tgi[0].ni[4].dn"
		;
connectAttr "pCone1_blendParent1.msg" "<root>:MayaNodeEditorSavedTabsInfo.tgi[0].ni[3].dn"
		;
parent -s -nc -r -add "pCone1_parentConstraint1" "<main>:pCone1" ;
select -ne "<main>:pCone1";
	addAttr -ci true -k true -sn "blendParent1" -ln "blendParent1" -dv 1 -smn 0 -smx 
		1 -at "double";
connectAttr "<main>:pSphere1.t" "<root>:pCylinder1_parentConstraint1.tg[0].tt";
connectAttr "pSphere1_translateX.o" "<main>:pSphere1.tx";
connectAttr "pSphere1_translateY.o" "<main>:pSphere1.ty";
connectAttr "pSphere1_translateZ.o" "<main>:pSphere1.tz";
connectAttr "<main>:pSphere1.rp" "<root>:pCylinder1_parentConstraint1.tg[0].trp"
		;
connectAttr "<main>:pSphere1.rpt" "<root>:pCylinder1_parentConstraint1.tg[0].trt"
		;
connectAttr "<main>:pSphere1.r" "<root>:pCylinder1_parentConstraint1.tg[0].tr";
connectAttr "pSphere1_rotateX.o" "<main>:pSphere1.rx";
connectAttr "pSphere1_rotateY.o" "<main>:pSphere1.ry";
connectAttr "pSphere1_rotateZ.o" "<main>:pSphere1.rz";
connectAttr "<main>:pSphere1.ro" "<root>:pCylinder1_parentConstraint1.tg[0].tro"
		;
connectAttr "<main>:pSphere1.s" "<root>:pCylinder1_parentConstraint1.tg[0].ts";
connectAttr "pSphere1_scaleX.o" "<main>:pSphere1.sx";
connectAttr "pSphere1_scaleY.o" "<main>:pSphere1.sy";
connectAttr "pSphere1_scaleZ.o" "<main>:pSphere1.sz";
connectAttr "<main>:pSphere1.pm" "<root>:pCylinder1_parentConstraint1.tg[0].tpm"
		;
connectAttr "pSphere1_visibility.o" "<main>:pSphere1.v";
connectAttr "<main>:pCube1.msg" "<root>:MayaNodeEditorSavedTabsInfo.tgi[0].ni[8].dn"
		;
connectAttr "<main>:pCube1.t" "pCone1_parentConstraint1.tg[0].tt";
connectAttr "<main>:pCube1.rp" "pCone1_parentConstraint1.tg[0].trp";
connectAttr "<main>:pCube1.rpt" "pCone1_parentConstraint1.tg[0].trt";
connectAttr "<main>:pCube1.r" "pCone1_parentConstraint1.tg[0].tr";
connectAttr "<main>:pCube1.ro" "pCone1_parentConstraint1.tg[0].tro";
connectAttr "<main>:pCube1.s" "pCone1_parentConstraint1.tg[0].ts";
connectAttr "<main>:pCube1.pm" "pCone1_parentConstraint1.tg[0].tpm";
connectAttr "<main>:pCone1.blendParent1" "pairBlend2.w";
connectAttr "pCone1_blendParent1.o" "<main>:pCone1.blendParent1";
connectAttr "<main>:pCone1.msg" "<root>:MayaNodeEditorSavedTabsInfo.tgi[0].ni[9].dn"
		;
connectAttr "pairBlend2.otx" "<main>:pCone1.tx";
connectAttr "pairBlend2.oty" "<main>:pCone1.ty";
connectAttr "pairBlend2.otz" "<main>:pCone1.tz";
connectAttr "pCone1_visibility.o" "<main>:pCone1.v";
connectAttr "pairBlend2.orx" "<main>:pCone1.rx";
connectAttr "pairBlend2.ory" "<main>:pCone1.ry";
connectAttr "pairBlend2.orz" "<main>:pCone1.rz";
connectAttr "pCone1_scaleX.o" "<main>:pCone1.sx";
connectAttr "pCone1_scaleY.o" "<main>:pCone1.sy";
connectAttr "pCone1_scaleZ.o" "<main>:pCone1.sz";
connectAttr "<main>:pCone1.ro" "pairBlend2.ro";
connectAttr "<main>:pCone1.ro" "pCone1_parentConstraint1.cro";
connectAttr "<main>:pCone1.pim" "pCone1_parentConstraint1.cpim";
connectAttr "<main>:pCone1.rp" "pCone1_parentConstraint1.crp";
connectAttr "<main>:pCone1.rpt" "pCone1_parentConstraint1.crt";
connectAttr "<main>:pConeShape1.msg" "<root>:MayaNodeEditorSavedTabsInfo.tgi[0].ni[12].dn"
		;
connectAttr "<main>:surfaceShader3SG.msg" "<root>:MayaNodeEditorSavedTabsInfo.tgi[0].ni[10].dn"
		;
// End of testPairBlend.editMA
```

**includeNodeを使用して、
pairBlendを書き出しノードに明示的に加えて、その関連ノードを引き出すのはどうですかね？**

```python
import maya.cmds as cmds
exportFilePath = "D:/test/testPairBlend.editMA"
cmds.exportEdits(
                            exportFilePath,
                            type = "editMA",
                            includeConstraints  = True,
                            editCommand = "addAttr",
                            includeAnimation =True,
                            includeNode = ["pairBlend2"],
                            onReferenceNode = "sampleAsset_v01RN",
                            f =True
                        )

```

addAttr OK
animationCurve OK
今度こそどうでしょうかね。

```testPairBlend.editMA
//Maya ASCII 2022 scene
//Name: testPairBlend.editMA
//Last modified: Mon, Dec 30, 2024 11:44:17 PM
//Codeset: 932
requires maya "2022";
requires -nodeType "aiOptions" -nodeType "aiAOVDriver" -nodeType "aiAOVFilter" "mtoa" "5.0.0.4";
requires "stereoCamera" "10.0";
currentUnit -l centimeter -a degree -t film;
fileInfo "fileCreationSource" "ExportEdits";
createNode parentConstraint -n "pCone1_parentConstraint1";
	rename -uid "F2EA4BB8-412E-69C0-A545-FB916E8E4FB3";
	addAttr -dcb 0 -ci true -k true -sn "w0" -ln "pCube1W0" -dv 1 -min 0 -at "double";
	setAttr -k on ".nds";
	setAttr -k off ".v";
	setAttr -k off ".tx";
	setAttr -k off ".ty";
	setAttr -k off ".tz";
	setAttr -k off ".rx";
	setAttr -k off ".ry";
	setAttr -k off ".rz";
	setAttr -k off ".sx";
	setAttr -k off ".sy";
	setAttr -k off ".sz";
	setAttr ".erp" yes;
	setAttr ".tg[0].tot" -type "double3" -0.98457584847913937 0 -3.3275038100774061 ;
	setAttr ".rst" -type "double3" 1.4291536085618226 0 -3.2073003230214763 ;
	setAttr -k on ".w0";
createNode animCurveTU -n "pSphere1_scaleZ";
	rename -uid "6723FC29-4730-9A89-F952-128D6A6F9C53";
	setAttr ".tan" 18;
	setAttr ".wgt" no;
	setAttr ".ktv[0]"  1 1;
createNode animCurveTU -n "pCone1_blendParent1";
	rename -uid "483EE5E1-428C-E0AE-EAE8-E8A1FDE91656";
	setAttr ".tan" 18;
	setAttr ".wgt" no;
	setAttr ".ktv[0]"  1 1;
createNode animCurveTU -n "pSphere1_visibility";
	rename -uid "0E898703-4A7E-EF90-7FD5-8CBAC512F603";
	setAttr ".tan" 9;
	setAttr ".wgt" no;
	setAttr ".ktv[0]"  1 1;
	setAttr ".kot[0]"  5;
createNode animCurveTU -n "pSphere1_scaleX";
	rename -uid "792E4EB4-4BB4-E439-AC71-34B9854F8247";
	setAttr ".tan" 18;
	setAttr ".wgt" no;
	setAttr ".ktv[0]"  1 1;
createNode animCurveTU -n "pSphere1_scaleY";
	rename -uid "031AEBC5-485B-42DD-E583-24AE8FE40D15";
	setAttr ".tan" 18;
	setAttr ".wgt" no;
	setAttr ".ktv[0]"  1 1;
createNode pairBlend -n "pairBlend2";
	rename -uid "820ECCFB-4D4A-FC6C-0BFD-558ECB464EF3";
createNode animCurveTA -n "pCone1_rotateX";
	rename -uid "26AA393A-40A3-C387-200D-A6AB46D4D68D";
	setAttr ".tan" 18;
	setAttr ".wgt" no;
	setAttr ".ktv[0]"  1 0;
createNode animCurveTA -n "pCone1_rotateY";
	rename -uid "6C78A965-48EA-8554-7AB7-9394C3BB72C0";
	setAttr ".tan" 18;
	setAttr ".wgt" no;
	setAttr ".ktv[0]"  1 0;
createNode animCurveTA -n "pCone1_rotateZ";
	rename -uid "480C18C1-49A7-8D44-73AF-559F0E9D3863";
	setAttr ".tan" 18;
	setAttr ".wgt" no;
	setAttr ".ktv[0]"  1 0;
createNode animCurveTA -n "pSphere1_rotateZ";
	rename -uid "C25A9C42-48BB-726B-F329-418F3E6482E3";
	setAttr ".tan" 18;
	setAttr ".wgt" no;
	setAttr ".ktv[0]"  1 0;
createNode animCurveTA -n "pSphere1_rotateY";
	rename -uid "4791779C-4CEF-EF31-DECD-ABAE55E28704";
	setAttr ".tan" 18;
	setAttr ".wgt" no;
	setAttr ".ktv[0]"  1 0;
createNode animCurveTA -n "pSphere1_rotateX";
	rename -uid "2F0CE1C7-4E03-64A2-C2E4-3DB2E72EAC1F";
	setAttr ".tan" 18;
	setAttr ".wgt" no;
	setAttr ".ktv[0]"  1 0;
createNode animCurveTU -n "pCone1_scaleZ";
	rename -uid "91863F0A-45C7-B93B-BE56-F6BFCC0ECFD5";
	setAttr ".tan" 18;
	setAttr ".wgt" no;
	setAttr ".ktv[0]"  1 1;
createNode animCurveTL -n "pSphere1_translateY";
	rename -uid "861B8D53-4DA8-1367-850D-C09DF3CA5B83";
	setAttr ".tan" 18;
	setAttr ".wgt" no;
	setAttr ".ktv[0]"  1 0;
createNode animCurveTL -n "pSphere1_translateX";
	rename -uid "68623C64-4443-50BB-3889-8FB915D885CC";
	setAttr ".tan" 18;
	setAttr ".wgt" no;
	setAttr ".ktv[0]"  1 0;
createNode animCurveTL -n "pSphere1_translateZ";
	rename -uid "0CF890E7-47FA-C5EE-AF1B-03854F71FA86";
	setAttr ".tan" 18;
	setAttr ".wgt" no;
	setAttr ".ktv[0]"  1 0;
createNode animCurveTU -n "pCone1_scaleX";
	rename -uid "D88215EE-457F-FDB6-30B5-898EF0F59409";
	setAttr ".tan" 18;
	setAttr ".wgt" no;
	setAttr ".ktv[0]"  1 1;
createNode animCurveTU -n "pCone1_scaleY";
	rename -uid "2FECB485-4B38-84E3-B220-10B74FB40A48";
	setAttr ".tan" 18;
	setAttr ".wgt" no;
	setAttr ".ktv[0]"  1 1;
createNode animCurveTL -n "pCone1_translateY";
	rename -uid "0512CE3D-44F3-8491-DD84-DEB77D310440";
	setAttr ".tan" 18;
	setAttr ".wgt" no;
	setAttr ".ktv[0]"  1 0;
createNode animCurveTL -n "pCone1_translateZ";
	rename -uid "FB27FDC9-427D-BD0C-6D02-99B4296C89CA";
	setAttr ".tan" 18;
	setAttr ".wgt" no;
	setAttr ".ktv[0]"  1 -3.2073003230214763;
createNode animCurveTL -n "pCone1_translateX";
	rename -uid "9BE84F84-4E03-6617-CE0A-DB8DA1A28DD5";
	setAttr ".tan" 18;
	setAttr ".wgt" no;
	setAttr ".ktv[0]"  1 1.4291536085618226;
createNode animCurveTU -n "pCone1_visibility";
	rename -uid "C4B559FD-46E8-7682-3B52-16B95AACB8B8";
	setAttr ".tan" 9;
	setAttr ".wgt" no;
	setAttr ".ktv[0]"  1 1;
	setAttr ".kot[0]"  5;
connectAttr "pCone1_parentConstraint1.w0" "pCone1_parentConstraint1.tg[0].tw";
connectAttr "pCone1_parentConstraint1.ctx" "pairBlend2.itx2";
connectAttr "pCone1_parentConstraint1.cty" "pairBlend2.ity2";
connectAttr "pCone1_parentConstraint1.ctz" "pairBlend2.itz2";
connectAttr "pCone1_parentConstraint1.crx" "pairBlend2.irx2";
connectAttr "pCone1_parentConstraint1.cry" "pairBlend2.iry2";
connectAttr "pCone1_parentConstraint1.crz" "pairBlend2.irz2";
connectAttr "pCone1_parentConstraint1.msg" "<root>:MayaNodeEditorSavedTabsInfo.tgi[0].ni[16].dn"
		;
connectAttr "pCone1_blendParent1.msg" "<root>:MayaNodeEditorSavedTabsInfo.tgi[0].ni[3].dn"
		;
connectAttr "pairBlend2.msg" "<root>:MayaNodeEditorSavedTabsInfo.tgi[0].ni[2].dn"
		;
connectAttr "pCone1_rotateX.o" "pairBlend2.irx1";
connectAttr "pCone1_rotateX.msg" "<root>:MayaNodeEditorSavedTabsInfo.tgi[0].ni[1].dn"
		;
connectAttr "pCone1_rotateY.o" "pairBlend2.iry1";
connectAttr "pCone1_rotateY.msg" "<root>:MayaNodeEditorSavedTabsInfo.tgi[0].ni[0].dn"
		;
connectAttr "pCone1_rotateZ.o" "pairBlend2.irz1";
connectAttr "pCone1_rotateZ.msg" "<root>:MayaNodeEditorSavedTabsInfo.tgi[0].ni[5].dn"
		;
connectAttr "pCone1_scaleZ.msg" "<root>:MayaNodeEditorSavedTabsInfo.tgi[0].ni[11].dn"
		;
connectAttr "pCone1_scaleX.msg" "<root>:MayaNodeEditorSavedTabsInfo.tgi[0].ni[15].dn"
		;
connectAttr "pCone1_scaleY.msg" "<root>:MayaNodeEditorSavedTabsInfo.tgi[0].ni[13].dn"
		;
connectAttr "pCone1_translateY.o" "pairBlend2.ity1";
connectAttr "pCone1_translateY.msg" "<root>:MayaNodeEditorSavedTabsInfo.tgi[0].ni[7].dn"
		;
connectAttr "pCone1_translateZ.o" "pairBlend2.itz1";
connectAttr "pCone1_translateZ.msg" "<root>:MayaNodeEditorSavedTabsInfo.tgi[0].ni[14].dn"
		;
connectAttr "pCone1_translateX.o" "pairBlend2.itx1";
connectAttr "pCone1_translateX.msg" "<root>:MayaNodeEditorSavedTabsInfo.tgi[0].ni[6].dn"
		;
connectAttr "pCone1_visibility.msg" "<root>:MayaNodeEditorSavedTabsInfo.tgi[0].ni[4].dn"
		;
parent -s -nc -r -add "pCone1_parentConstraint1" "<main>:pCone1" ;
select -ne "<main>:pCone1";
	addAttr -ci true -k true -sn "blendParent1" -ln "blendParent1" -dv 1 -smn 0 -smx 
		1 -at "double";
connectAttr "<main>:pSphere1.t" "<root>:pCylinder1_parentConstraint1.tg[0].tt";
connectAttr "pSphere1_translateX.o" "<main>:pSphere1.tx";
connectAttr "pSphere1_translateY.o" "<main>:pSphere1.ty";
connectAttr "pSphere1_translateZ.o" "<main>:pSphere1.tz";
connectAttr "<main>:pSphere1.rp" "<root>:pCylinder1_parentConstraint1.tg[0].trp"
		;
connectAttr "<main>:pSphere1.rpt" "<root>:pCylinder1_parentConstraint1.tg[0].trt"
		;
connectAttr "<main>:pSphere1.r" "<root>:pCylinder1_parentConstraint1.tg[0].tr";
connectAttr "pSphere1_rotateX.o" "<main>:pSphere1.rx";
connectAttr "pSphere1_rotateY.o" "<main>:pSphere1.ry";
connectAttr "pSphere1_rotateZ.o" "<main>:pSphere1.rz";
connectAttr "<main>:pSphere1.ro" "<root>:pCylinder1_parentConstraint1.tg[0].tro"
		;
connectAttr "<main>:pSphere1.s" "<root>:pCylinder1_parentConstraint1.tg[0].ts";
connectAttr "pSphere1_scaleX.o" "<main>:pSphere1.sx";
connectAttr "pSphere1_scaleY.o" "<main>:pSphere1.sy";
connectAttr "pSphere1_scaleZ.o" "<main>:pSphere1.sz";
connectAttr "<main>:pSphere1.pm" "<root>:pCylinder1_parentConstraint1.tg[0].tpm"
		;
connectAttr "pSphere1_visibility.o" "<main>:pSphere1.v";
connectAttr "<main>:pCube1.msg" "<root>:MayaNodeEditorSavedTabsInfo.tgi[0].ni[8].dn"
		;
connectAttr "<main>:pCube1.t" "pCone1_parentConstraint1.tg[0].tt";
connectAttr "<main>:pCube1.rp" "pCone1_parentConstraint1.tg[0].trp";
connectAttr "<main>:pCube1.rpt" "pCone1_parentConstraint1.tg[0].trt";
connectAttr "<main>:pCube1.r" "pCone1_parentConstraint1.tg[0].tr";
connectAttr "<main>:pCube1.ro" "pCone1_parentConstraint1.tg[0].tro";
connectAttr "<main>:pCube1.s" "pCone1_parentConstraint1.tg[0].ts";
connectAttr "<main>:pCube1.pm" "pCone1_parentConstraint1.tg[0].tpm";
connectAttr "<main>:pCone1.blendParent1" "pairBlend2.w";
connectAttr "pCone1_blendParent1.o" "<main>:pCone1.blendParent1";
connectAttr "<main>:pCone1.msg" "<root>:MayaNodeEditorSavedTabsInfo.tgi[0].ni[9].dn"
		;
connectAttr "pairBlend2.otx" "<main>:pCone1.tx";
connectAttr "pairBlend2.oty" "<main>:pCone1.ty";
connectAttr "pairBlend2.otz" "<main>:pCone1.tz";
connectAttr "pCone1_visibility.o" "<main>:pCone1.v";
connectAttr "pairBlend2.orx" "<main>:pCone1.rx";
connectAttr "pairBlend2.ory" "<main>:pCone1.ry";
connectAttr "pairBlend2.orz" "<main>:pCone1.rz";
connectAttr "pCone1_scaleX.o" "<main>:pCone1.sx";
connectAttr "pCone1_scaleY.o" "<main>:pCone1.sy";
connectAttr "pCone1_scaleZ.o" "<main>:pCone1.sz";
connectAttr "<main>:pCone1.ro" "pairBlend2.ro";
connectAttr "<main>:pCone1.ro" "pCone1_parentConstraint1.cro";
connectAttr "<main>:pCone1.pim" "pCone1_parentConstraint1.cpim";
connectAttr "<main>:pCone1.rp" "pCone1_parentConstraint1.crp";
connectAttr "<main>:pCone1.rpt" "pCone1_parentConstraint1.crt";
connectAttr "<main>:pConeShape1.msg" "<root>:MayaNodeEditorSavedTabsInfo.tgi[0].ni[12].dn"
		;
connectAttr "<main>:surfaceShader3SG.msg" "<root>:MayaNodeEditorSavedTabsInfo.tgi[0].ni[10].dn"
		;
// End of testPairBlend.editMA

```

読み込んでみます。


![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/1484234/5d81d542-e4cf-6238-25f1-cbfda72d4538.png)

お？これは？行けたかな？

まとめ
--

コンストレインの blendParent attrを考慮したい場合は、

- editCommand で addAttrを指定。  
- onReferenceNode　を使用。 selected とは併用できない
- includeAnimation を使用。  
- includeNode でpairBlendノードを指定。  

```python
import maya.cmds as cmds
exportFilePath = "D:/test/testPairBlend.editMA"
cmds.exportEdits(
                            exportFilePath,
                            type = "editMA",
                            includeConstraints  = True,
                            editCommand = "addAttr",
                            includeAnimation =True,
                            includeNode = ["pairBlend2"],
                            onReferenceNode = "sampleAsset_v01RN",
                            f =True
                        )

```

pairBlendノードの指定はなんとかコネクションとかから引っ張ってきて、入力不要にしたいですね。