[UE5.4.3]ControlRigのAim Math と KawaiiPhysicsでひざの突き抜けないボリュームのあるスカートできたよ

動画はこれだよ

https://youtu.be/VdRrUlSyOsE

ControlRig と KawaiiPhysicsを接続してるよ

4分岐

1L

1R

2L

2R

で完成!

今後の参考

·袴(はかま)の骨を足の子にする。モモはあまり揺らせないがスネは揺らせる。揺れ幅を抑えれば絶対に突き抜けないので安心。骨は袴の表面に複数入れるか足と同じ位置に1本入れる方法がある(動きは後者の方が単純)
(子にするのはモモだけというのもアリかも)

参考URL

管理者用 ZIP

https://drive.google.com/file/d/1l5EAxrJS8_Ll6ElZsOLRPNZ7p1tXPgUZ/view?usp=sharing

[maya][mel] mesh から SkinCluster を取得する

get SkinCluster from mesh

string $SkinSkinCluster = `findRelatedSkinCluster $mesh`;

応用例

        print(">>>>>>>>>>>>>SkinWeightCheck Start>>>>>>>>>>\n");
        select "|parts_low";
        string $selected[] = `ls -sl -long -absoluteName`;
        string $selectedStr = stringArrayToString($selected, ",");   // ","を区切り文字として結合する
        print("SkinWeightCheckの 選択したもの $selected= "+$selectedStr+"\n");
        
        string $mesh[];
        for ($sel in $selected) {
          string $allMesh[] = `listRelatives -ni -pa -ad -typ "mesh" $sel`;
          for ($am in $allMesh) {
            string $trans[] = `listRelatives -ni -pa -p $am`;
            $mesh[size($mesh)] = $trans[0];
          }
        }
        
        $mesh = stringArrayRemoveDuplicates($mesh);
        string $meshStr = stringArrayToString($mesh, ",");   // ","を区切り文字として結合する
        print("SkinWeightCheckの メッシュのみ選別したもの $mesh= "+$meshStr+"\n");
       
       for ($mesh_i in $mesh){
           //print("$mesh_i= "+$mesh_i+"\n");
           string $SkinCluster = `findRelatedSkinCluster $mesh_i`;
           print("メッシュ : "+$mesh_i+"   SkinCluster : "+$SkinCluster+" \n");
           //string $influenceJoint[] = `skinCluster -q -influence $mesh_i`;
           string $influenceJoint[];
           int $inflenceJointBool=0;
           if ( catch ($influenceJoint=`skinCluster -q -influence $mesh_i`)) {
               print("B ------------------------------------------------------------------------------->>>>>メッシュ : "+$mesh_i+" のインフルエンスジョイントがありません!!NG \n");
               $inflenceJointBool=1;
               $AllWeightMeshBool=1;
           }else{
               print("A OK \n");
               $inflenceJointBool=0;
           }
           int $WeightMeshBool=0;
           if($inflenceJointBool==0){
               print("メッシュ : "+$mesh_i+"   influenceJoint : "+$influenceJoint[0]+" \n");
               //vtx[100] の joint1 の weight を取得
               //skinPercent( 'skinCluster1', 'pPlane1.vtx[100]', t='joint1', query=True, value=True)
               //string $weight[] = `skinPercent -query -value -t $influence[0] $SkinCluster $mesh `;
               string $vertex = $mesh_i+".vtx[0]" ;
               //string $weight[] = `skinPercent -query -value $vertex $SkinCluster`;
               float $weightFloatArr[] = `skinPercent -query -value $SkinCluster $vertex`;
               print("$weightFloatArr= "+floatArrayToString($weightFloatArr, ", ")+"\n");
               //skinPercent -query -value skinCluster1 pPlane1.vtx[100];
               float $weightAll=0;
               for ($val in $weightFloatArr){
                  $weightAll=$weightAll + $val;
               }
               print("$weightAll= "+$weightAll+"\n");
               
               if($weightAll>0){
                   print("SkinWeight OK !!! $mesh_i= "+$mesh_i+" OK!!!!!\n");
               }else{
                   $WeightMeshBool=1;
                   print("SkinWeight -----------------------------------------------------------スキンウェイトがありません--Attention !!! $mesh_i= "+$mesh_i+" NG!!!!!\n");
               }
               $AllWeightMeshBool=$AllWeightMeshBool+$WeightMeshBool;
           }

       }//for

参考

[maya][python] findRelatedskinCLuster

https://discourse.techart.online/t/maya-python-findrelatedskincluster/2673

[Maya]特殊な複製 duplicate -upstreamNodes でスキンウェイトごと複製する。

あるようで知らない特殊な複製。

//	選択したノードに至る上流ノード (およびその接続) も複製されます。
//  スキンウェイトなどもコピーされます。
duplicate -upstreamNodes;

上記の場合

duplicate -returnRootsOnly -upstreamNodes; 
group root1 parts_low1;

カスタムした例

global proc skinWeightCopy_JointMeshGroup(){
    //選択
    select root parts_low;
    //スキンウェイトモデルのスキンウェイトごとコピー
    duplicate -returnRootsOnly -upstreamNodes; 
    //グループ化
    group -name "group_dup" root1 parts_low1;
    //元の名前にリネーム
    rename "group_dup|root1" "root";
    rename "group_dup|parts_low1" "parts_low";
}
skinWeightCopy_JointMeshGroup();

combine しながらエクスポート

global proc skinWeightCopy_JointMeshGroup(){
    //選択
    select "|root" "|parts_low";
    //スキンウェイトモデルのスキンウェイトごとコピー
    duplicate -returnRootsOnly -upstreamNodes; 
    //グループ化
    group -name "group_dup" root1 parts_low1;
    //元の名前にリネーム
    rename "group_dup|root1" "root";
    rename "group_dup|parts_low1" "parts_low";
}

global proc group_dup_parts_low_combine(){
    
    
    string $selected[] = `ls -sl -long -absoluteName`;
    //string $selectedStr = stringArrayToString($selected, ",");   // ","を区切り文字として結合する
    //print("選択したもの $selected= "+$selectedStr+"\n");
    string $mesh[];
    for ($sel in $selected) {
      string $allMesh[] = `listRelatives -ni -pa -ad -typ "mesh" $sel`;
      for ($am in $allMesh) {
        string $trans[] = `listRelatives -ni -pa -p $am`;
        $mesh[size($mesh)] = $trans[0];
      }
    }
    
    $mesh = stringArrayRemoveDuplicates($mesh);
    string $meshStr = stringArrayToString($mesh, ",");   // ","を区切り文字として結合する
    print(" メッシュのみ選別したもの $mesh= "+$meshStr+"\n");
    
    

    select -r $mesh; // <メッシュのみ選択
    // Combine実行
      
    // Skeletalだった場合
    string $combine[] = `polyUniteSkinned -ch 0 -muv 1`;
    rename $combine[0] "MeshGP";

    //よけておくグループ化
    select "|root" "parts_low";
    string $group_root;
    $group_root =`group -world -name "group_root"`;
        
    //MeshGPをparts_lowへ入れる
    select "MeshGP";
    string $group_parts_low;
    $group_parts_low =`group -world -name "parts_low"`;
       
    //worldへ移動 
    parent -world "group_dup|root";
    
    //出力用選択
    select "|root" "|parts_low";
    
    // Export
    // --------------------------------------------------------------------------
    simple_model_common_Export(2, "D:/MOSADesign/WorkData/Avatar/008/001/PL_008_001_001/Game/SK_PL_008_001_001_Body.fbx", 0);
    
    //おかたずけ partslow|MeshGP rootを削除
    delete "|parts_low" "|root" "|group_dup";
    
    //worldへ移動 
    parent -world "group_root|root";
    //worldへ移動 
    parent -world "group_root|parts_low"; 
    //group_root 削除
    delete "|group_root";
}



// Export
//--------------------------------------------------------------------------
global proc simple_model_common_Export(int $type, string $expName, int $modelType) {
  showHidden -a;
  // if($type == 2) {
  if ($type == 1) {
    FBXExportSmoothMesh -v 0;
  } else {
    FBXExportSmoothMesh -v 1;
  }
  FBXExportAnimationOnly -v 0;
  FBXExportInAscii -v 0 ;
  FBXExportConvertUnitString cm;
  FBXExportTriangulate -v 0;
  FBXExportSmoothingGroups -v 1;
  FBXExportConstraints -v 0;
  FBXExport -f $expName -s;
}

参考URL

https://help.autodesk.com/cloudhelp/2025/ENU/Maya-Tech-Docs/Commands/duplicate.html

http://me.autodesk.jp/wam/maya/docs/Maya2010/Commands/duplicate.html

[UE5.4.2] Editor Revision Control Helpersが追加されてUE5のBrueprint上でチェックインができるようになったみたい!

Checkout AssetとCheckout Directoryは前からあったが。

Editor Scripting
Asset
f Checkout Asset
f Checkout Directory
Editor Revision Control Helpers
f Check in File

1つのファイルをPERFORCEにチェックイン=アップロード+読み取り専用へ

f Check in Files

複数のファイルをPERFORCEにチェックイン=アップロード+読み取り専用へ

f Check Out File

1つのファイルをPERFORCEにチェックアウト=自分だけ書き込み許可

f Check Out or Add File

1つのファイルをPERFORCEにチェックアウトまたはファイルを追加+自分だけ書き込み許可

[UE5.4] Blueprint でのGet Editor Property とSet Editor Propertyのプロパティ名はPythonとは違った件。

今回の場合

https://docs.unrealengine.com/5.2/en-US/PythonAPI/class/StaticMesh.html

から引用すると

asset_import_data (AssetImportData): [Read-Write] Importing data and options used for this mesh

の場合

Pythonでは、「asset_import_data

Blueprintでは「AssetImportData」だ。

だれもそこんところ教えてはくれないぜ笑

[UE5.4.2]UE 5.4.2 – Python を使用して C++ 関数を呼び出す方法

BlancではC++フォルダができなかった。

ThirdPersonでやった。

親クラスに Blueprint Function Libraryを選択

Nameに適当にZFunctionsと入れCreate Class。

VisualStudioへ移動し

ZFunctions.h

// Fill out your copyright notice in the Description page of Project Settings.

#pragma once

#include "CoreMinimal.h"
#include "Kismet/BlueprintFunctionLibrary.h"
#include "ZFunctions.generated.h"

/**
 * 
 */
UCLASS()
class UE542PYTHONCALLCPP1_API UZFunctions : public UBlueprintFunctionLibrary
{
	GENERATED_BODY()
//ここから追加////////
public:
	UFUNCTION(BlueprintCallable)
	static void CalledFromPython(FString InputString);
//ここまで追加//////
};

ZFunctions.cpp

// Fill out your copyright notice in the Description page of Project Settings.


#include "ZFunctions.h"
//ここから追加////////
void UZFunctions::CalledFromPython(FString InputString) {
	UE_LOG(LogTemp, Error, TEXT("%s"), *InputString);
}
//ここまで追加//////

SolutionExplorer > your Project Name (right click)>Build

実行する。(Local Windows Debagger)

Outputlogで実行する unrealのクラス一覧

import unreal
for x in sorted(dir(unreal)):
   print(x)

めっちゃ重い

ZFunction が出る

クラスを使ってみる unreal.ZFunctionsのメソッド一覧

import unreal
for x in sorted(dir(unreal.ZFunctions)):
   print(x)

called_from_python が出てくる。

呼んでみる

unreal.ZFunctions.called_from_python('my test string')

作った関数によりエラーのメッセージが返ってきた。

参考URL

[UE4.21]UE 4.21 – Python を使用して C++ 関数を呼び出す方法

コンテンツブラウザを右クリックしてNew C++ Class

親クラスに Blueprint Function Libraryを選択

Nameに適当にZFunctionsと入れCreate Class。

VisualStudioが起動し

ZFunctions.h

public:
UFUNCTION(BlueprintCallable)
static void CalledFromPython(FString InputString);

を追加してこうなる。

//.Fill out your copyright notice in the Description page of Project Settings.

#pragma once

#include "CoreMinimal.h"
#include "Kismet/BlueprintFunctionLibrary.h"
#include "ZFunctions.generated.h"



UCLASS()
class UNREALPYTHONPROJECT_API UZFunctions : public UBlueprintFunctionLibrary
{
GENERATED BODY()

public:
   UFUNCTION(BlueprintCallable)
      static void CalledFromPython(FString InputString);
};

ZFunctions.cpp


//.Fill out your copyright notice in the Description page of Project Settings.

#include "ZFunctions.h"

void UZFunctions::CalledFromPython(FString InputString) {
UE_LOG(LogTemp, Error, TEXT("%s"), *InputString);
}

実行する。(Local Windows Debagger)

Outputlogで実行する

import unreal
for x in sorted(dir(unreal)):
   print(x)

ZFunction が出る

import unreal
for x in sorted(dir(unreal.ZFunctions)):
   print(x)

called_from_python が出てくる。

呼んでみる

unreal.ZFunctions.called_from_python('my test string')

呼ばれて作ったエラーメッセージが出た

参考URL

[UE5][C++]Python からブループリント関数を呼び出すことはできますか?

現時点では、Python はブループリント関数にアクセスできませんが、C++ メソッドにはアクセスできます。したがって
、解決策としては、C++ でブループリント関数を として宣言しBlueprintImplementableEvent、ブループリントでそれをオーバーライドします。

BlueprintImplementableEvent先に進む前に、を C++ から呼び出して、それが機能するかどうかを確認することをお勧めします。
次に、 を呼び出すための 2 番目の C++ 関数を作成しますBlueprintImplementableEvent。この関数は、Python に公開されるものであるため、
として実装する必要があります。BlueprintCallable

最後に、C++ とブループリントがコンパイルされたら、Python から呼び出し元関数を呼び出すだけです。
C++ クラスは、次のように通常の C++ モジュールとして表示されます。unreal.YourClassName.yourCallerFunctionName(yourClassInstance, args)
引数と戻り値は、期待どおりに処理されます。
関数を実行するクラス インスタンスを関数に渡す必要があります。特定の AActor インスタンスを操作するときに非常に便利です。


最後にもう 1 つ注意点があります。関数を、私が行ったようにブループリントイベントではなくブループリント関数として実装する必要がある場合は、関数を定数にするか、戻り値 (使用しない場合でも) を指定する必要があります。そうしないと、ブループリントのオーバーライドにイベントとして表示されます。

私のユースケースからの画面。明らかに、ブループリント関数の実装の詳細は関係ありません。
ブループリント関数

.h

.cpp

.py

参考

https://forums.unrealengine.com/t/is-it-possible-to-call-a-blueprint-function-from-python/447078/3

[UE5]LookAtとKawaiiPhysicsで突き抜けないスカートができたよ。ボリュームのあるスカートをKawaiiPhsicsで揺らす

Animブループリント系のLookAtを左右足と対応するスカートのボーンに設定する。

スカートのボーンの向きによるが、LcokAtの矢印が膝にくるように設定したら完成したよ。

走った感じ

作業の様子

参考URL

https://docs.unrealengine.com/4.27/ja/AnimatingObjects/SkeletalMeshAnimation/NodeReference/SkeletalControls/LookAt

管理者用zip

https://drive.google.com/file/d/1y9-PM9VpUy1HCVeuKxWDzk1qEIFJjmoS/view?usp=sharing

[UE5]CPPプロジェクトでプロジェクトのバージョンを上げる方法

[UE5] How to upgrade the project version in a CPP project

.uprojectを右クリックして>その他のオプションを確認>Switch Unreal Engine version …

Right-click on .uproject > Check other options > Switch Unreal Engine version…

モジュールのプロジェクト名は変更しないでください。

	"Modules": [
		{
			"Name": "KPUE532CPP",

KPUE54CPP.uprojectの中身も変更されます。

	"EngineAssociation": "5.4",

こんな感じです

変更前

{
	"FileVersion": 3,
	"EngineAssociation": "5.4",
	"Category": "",
	"Description": "",
	"Modules": [
		{
			"Name": "KPUE532CPP",
			"Type": "Runtime",
			"LoadingPhase": "Default"
		}
	],
	"Plugins": [
		{
			"Name": "ModelingToolsEditorMode",
			"Enabled": true,
			"TargetAllowList": [
				"Editor"
			]
		}
	]
}



変更後

{
	"FileVersion": 3,
	"EngineAssociation": "5.4",
	"Category": "",
	"Description": "",
	"Modules": [
		{
			"Name": "KPUE532CPP",
			"Type": "Runtime",
			"LoadingPhase": "Default"
		}
	],
	"Plugins": [
		{
			"Name": "ModelingToolsEditorMode",
			"Enabled": true,
			"TargetAllowList": [
				"Editor"
			]
		}
	]
}

内部的に他のファイルもたくさん変更されるようです。