// ReturnPivotRotate 0.22 @name "ReturnPivotRotate" @version 2.5 @warnings @script generic @define INIT_TIME 0.0 @define INIT_FRAME 0 // LS26 軸ロック記録用 @if version != 2.5 var AxStat[3]; @end var CurScene; generic { CurScene = Scene(); var CurItems = CurScene.getSelect(); if(CurItems == nil) return; if(CurItems[1].isCamera() || CurItems[1].isLight()) return; var ItemNum = CurItems.size(); // AutoKeyフラグの保存 @if version != 2.5 var AutoFlag; AutoFlag = CurScene.generalopts[7]; if(!AutoFlag) AutoKey(); @end if(CurScene.currenttime != INIT_TIME) GoToFrame(INIT_FRAME); // PivotRotateが0以外ならPivotRotate値をRotateに還元する。 // Toolを選択してからResetでないとRotateに還元されない。 // PivotRotate()で値を操作してもRotateは変化しない。 var CurRot, CurPvtRot; if(ItemNum == 1){ CurPvtRot = CurItems[1].param(PIVOTROT, INIT_TIME); if(CurPvtRot != <0.0,0.0,0.0>){ RotatePivotTool(); @if version != 2.5 getAxizStat(CurItems[1]); setAxizLock(); @end // PivotRotateToolを操作すると変化量0でもRotate H/Bに無意味な誤差がでる為丸める // 好みでコメントアウトや評価する小数位の変更を Reset(); CurRot = CurItems[1].param(ROTATION, INIT_TIME); CurRot.x = round(CurRot.x,2); // CurRot.y = round(CurRot.y,3); CurRot.z = round(CurRot.z,2); setRotate(CurItems[1], CurRot); @if version != 2.5 setAxizLock(); @end } }else{ for(i = 1; i <= ItemNum; i++){ CurPvtRot = CurItems[i].param(PIVOTROT, INIT_TIME); if(CurPvtRot != <0.0,0.0,0.0>){ SelectItem(CurItems[i].id); RotatePivotTool(); @if version != 2.5 getAxizStat(CurItems[i]); setAxizLock(); @end Reset(); CurRot = CurItems[i].param(ROTATION, INIT_TIME); CurRot.x = round(CurRot.x,2); // CurRot.y = round(CurRot.y,3); CurRot.z = round(CurRot.z,2); setRotate(CurItems[i], CurRot); @if version != 2.5 setAxizLock(); @end } } if(ItemNum > 1) for(i = ItemNum - 1; i >= 1; i--) AddToSelection(CurItems[i].id); } // 保存してあるAutoKeyフラグに応じる @if version != 2.5 if(!AutoFlag) AutoKey(); @end RotateTool(); Refresh(); } // --------------------- @if version != 2.5 getAxizStat: Item { AxStat[1] = Item.axislocks[4]; AxStat[2] = Item.axislocks[5]; AxStat[3] = Item.axislocks[6]; } setAxizLock { if(AxStat[1]) EnableXH(); if(AxStat[2]) EnableYP(); if(AxStat[3]) EnableZB(); } @end setRotate: Item, Rot { var CurChan, KeyID; CurChan = Item.firstChannel(); CurChan = Item.nextChannel(); CurChan = Item.nextChannel(); // h CurChan = Item.nextChannel(); if((KeyID = CurChan.keyExists(CurScene.currenttime)) != nil) CurChan.setKeyValue(KeyID, Rot.x); else CurChan.createKey(CurScene.currenttime, Rot.x); // p CurChan = Item.nextChannel(); if((KeyID = CurChan.keyExists(CurScene.currenttime)) != nil) CurChan.setKeyValue(KeyID, Rot.y); else CurChan.createKey(CurScene.currenttime, Rot.y); // b CurChan = Item.nextChannel(); if((KeyID = CurChan.keyExists(CurScene.currenttime)) != nil) CurChan.setKeyValue(KeyID, Rot.z); else CurChan.createKey(CurScene.currenttime, Rot.z); }