[UE5.3.2]パッケージ化 292Wrapped by AutomationException: Cook failed. UE5

LogScript: Error: Script Msg: /Game/0_furcraeaTokyo/13_matahuman_UQ5motion/MF_Idle_MHUQ5 : アニメーション アセット (/Game/0_furcraeaTokyo/13_matahuman_UQ5motion/MF_Idle_MHUQ5.MF_Idle_MHUQ5) のターゲット USkeleton を取得できません
LogScript: Error: Script Msg: /Game/0_furcraeaTokyo/13_matahuman_UQ5motion/MF_Idle_MHUQ5 : 指定された USkeleton が無効

出力をよく見ているとが赤い文字の行がみつかりました。

MF_Idle_MHUQ5を検索して削除したらなおりました。

赤い文字の行を直していけば治るエラーでした。

参考URL

https://forums.unrealengine.com/t/unknown-cook-failure-cookcommand-automation-cs-249-wrapped-by-automationexception-cook-failed/138364/13

[UE5.3.2] UE5ぷちコンジェットコースター向け Blender の ベジェカーブ(BezierCurve)からUE5のSplineに座標わたせたよ(精度の問題で未完成)まとめ

ベジェカーブ作る前に日本語の場合は英語モードに切り替えなきゃスクリプトエラーになります。

BezierCurveはできるだけ大きく描きます。

BlenderPython

# Blender import
import bpy
import math
import bmesh
import csv

print("start python code....------------------------------------------>>>")

basedir="F:/SandBox/UE5PuchiCon22/Blender_Curve_To_Spline/"
with open(basedir+"/test.csv",'w',newline='') as file:

    writer = csv.writer(file,delimiter = ',') 
    count = 0
    writer.writerow(["","x","y","z",
            "i_x","i_y","i_z",
            "o_x","o_y","o_z"])
    
    print("bpy.data.curves= "+str(bpy.data.curves))
    for obj in bpy.data.curves:
        print("obj.name= "+str(obj.name))
        for object in bpy.data.objects:
            print("object.name= "+object.name)
        ob_curve = bpy.data.objects.get(obj.name)
        print("ob_curve= "+str(ob_curve))
        if(str(ob_curve)=="None"):
            print("ob_curve =is= NoneType")
        else:
            for curve in obj.splines:
                print("curve= "+str(curve))
                
                for bezpoint in curve.bezier_points:
                    print("bezpoint= "+str(bezpoint))
                    if(str(bezpoint)=="NoneType"):
                        print("bezpoint =is= NoneType")
                    else:
                        xyz = ob_curve.matrix_world @ bezpoint.co
                        xyz_left = ob_curve.matrix_world @ bezpoint.handle_left
                        xyz_right = ob_curve.matrix_world @ bezpoint.handle_right
                        count += 1
                        writer.writerow([count, xyz[0], xyz[1], xyz[2],
                        xyz_left[0], xyz_left[1], xyz_left[2],
                        xyz_right[0], xyz_right[1], xyz_right[2]])
            

出力されたCSV

値はかなり大きめじゃないとだめよ

,x,y,z,i_x,i_y,i_z,o_x,o_y,o_z
1,13.595291137695312,230.46768188476562,70.73152160644531,158.9687042236328,225.82052612304688,70.73152160644531,-178.57012939453125,236.6106414794922,70.73152160644531
2,-207.3365020751953,-38.245094299316406,120.08828735351562,-198.0128631591797,17.276376724243164,181.6839141845703,-222.84031677246094,-130.56887817382812,17.66411781311035
3,43.76624298095703,-265.9769287109375,0.0,-181.01539611816406,-265.9769287109375,0.0,258.02471923828125,-265.9769287109375,0.0
4,231.6976318359375,-64.63948059082031,49.9024543762207,191.0831298828125,-174.81529235839844,-94.65201568603516,255.28945922851562,-0.641462504863739,133.87005615234375

CSVにそって構造体作ります。ブループリント>構造体

CSVをUEにドラッグして読みこみ

BP_SplineにSplinrコンポーネント付けて、コンストラクションスクリプトでこれつくります。

なにかは描かれた

こっから先は精度の問題?

できたっていうのかなこれ。

ZIP
Blender_Curve_To_Spline.zip

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

UE532_CurveSpline2.zip

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

参考URL

https://blenderartists.org/t/world-location-of-bezier-points/1219282

https://teratail.com/questions/146037

Text Editorでデバッグ時にprintで出力したものがPython Consoleに出てこなくて困っていましたが、勘違いしていました。Python Consoleではなくて、System Consoleの方に出てきます。

メニューバー Window > Toggle System Console で別ウィンドウでコマンドプロンプトがたちあがります。

https://wiz.ooo/cg/2054

https://docs.blender.org/api/current/bpy.ops.mesh.html

https://zenn.dev/hotcocoa/articles/5c5ab06c40862b

https://reflectorange.net/archives/193.html

[C++]やさしいC++ プログラムをクラスで部品化する ちゃんと class という文字でクラス宣言できる。シンプルでOK

CarClass.cpp

#include <iostream>
using  namespace std;

//Carクラスの宣言
class Car{
	private:
		int num;
		double gas;

	public:
		Car();
		void  show();

};

//Car Class Member関数の定義 コンストラクタ
Car::Car()
{
	num=0;
	gas=0.0;
	cout << "車を作成しました \n";

}
//Car Class Member関数の定義 メソッド
void Car::show()
{
	cout << "車のナンバーは" << num << "です。\n";
	cout << "gasは" << gas << "です。\n";
}
//Car インスタンスの生成
int main(){
	Car car1;
	car1.show();
	return 0;
};

cd_samples5_6_class.cmd


C:\samples\chapter05\CarClass>cd C:\samples\chapter05\CarClass\

C:\samples\chapter05\CarClass>g++ CarClass.cpp -o CarClass.exe

C:\samples\chapter05\CarClass>CarClass.exe
車を作成しました
車のナンバーは0です。
gasは0です。

C:\samples\chapter05\CarClass>cmd /k
C:\samples\chapter05\CarClass>





[C++]スラスラわかるC++ プログラムをクラスで部品化する

HealthChecker.cpp

#include <iostream>
#include <string>
using namespace std;
#include "HealthChecker.h"

// 標準BMIを表すメンバ定数の実体
const int HealthChecker::STD_BMI = 22;

// BMIを返すメンバ関数の実装
double HealthChecker::getBmi() {
  // まだBMIが計算されていなかったら計算する
  if (this->bmi == 0) {
    double mHeight = this->height / 100;
    this->bmi = this->weight / mHeight / mHeight;
  }

  // BMIを返す
  return this->bmi;
}

// コンストラクタの実装
HealthChecker::HealthChecker(string name, double height, double weight) {
  // メンバ変数に初期値を設定する
  this->name = name;
  this->height = height;
  this->weight = weight;
  this->bmi = 0;
}

// 氏名を返すメンバ関数の実装
string HealthChecker::getName() {
  return this->name;
}

// 標準BMIを返すメンバ関数の実装
int HealthChecker::getStdBmi() {
  return HealthChecker::STD_BMI;
}

// 標準体重を返すメンバ関数の実装
double HealthChecker::getStdWeight() {
  double mHeight = this->height / 100;
  return HealthChecker::STD_BMI * mHeight * mHeight;
}

HealthChecker.h

class HealthChecker {
  private:
    static const int STD_BMI;		// 標準BMIを表すメンバ定数
    string name;			// 氏名を格納するメンバ変数
    double height;			// 身長を格納するメンバ変数
    double weight;			// 体重を格納するメンバ変数
    double bmi;				// BMIを格納するメンバ変数
  public:
    static int getStdBmi();		// 標準BMIを返すメンバ関数
    double getStdWeight();		// 標準体重を返すメンバ関数
    double getBmi();			// BMIを返すメンバ関数
    string getName();			// 氏名を返すメンバ関数
    HealthChecker(string name, double height, double weight); // コンストラクタ
};

list5_6.cpp

#include <iostream>
#include <string>
using namespace std;
#include "HealthChecker.h"

int main() {
  // HealthCheckerクラスのインスタンスを生成する
  HealthChecker yamada("山田一郎", 170, 67.5);

  // BMIの値を表示する
  cout << "BMIは、" << yamada.getBmi() << "です。" << endl;

  return 0;
}

cd_samples5_6_class.cmd


C:\samples\chapter05>cd C:\samples\chapter05\

C:\samples\chapter05>g++ list5_6.cpp HealthChecker.cpp -o list5_6.exe

C:\samples\chapter05>list5_6.exe
BMIは、23.3564です。

C:\samples\chapter05>cmd /k
C:\samples\chapter05>

[C++]スラスラわかるC++ stringをインクルードすればほかの言語並みに文字列は扱えるようにも見える。(print無いしウソ)

list5_3.cpp

#include <iostream>
#include <string>
#include <stdio.h>
using namespace std;

void printStr(string a){
   cout << a << endl;
};

int main() {
  // 文字列オブジェクト
  string s1, s2, s3;

  // 文字列オブジェクトに文字列を格納する
  s1 = "apple";
  s2 = "banana";

  // 文字列を比較する
  if (s1 > s2) {
    cout << "大きい。" << endl;
  }
  else if (s1 < s2) {
    cout << "小さい。" << endl;
  }
  else {
    cout << "等しい。" << endl;
  }

  // 文字列を連結する
  s3 = s1 + s2;
  cout << s3 << endl;

  //printf  ではこう使いにくい。
  printf("%s\n",s3.c_str());
  //printf  ではこう使いやすい。
  printStr(s3);

  // 長さを求める
  cout << s3.length() << endl;

  // 5番目から3文字の部分文字列を取り出す
  cout << s3.substr(5, 3) << endl;

  // 5文字目だけを取り出す
  cout << s3[5] << endl;

  // "na" という文字列を見つける
  cout << s3.find("na") << endl;
  
  // 文字列を空にする
  s3.clear();

  // 文字列が空であることを確認する
  if (s3.empty()) {
    cout << "空です。" << endl;
  }
  else {
    cout << "空ではありません。" << endl;
  }

  return 0;
}

cd_samples5_3.cmd


C:\samples\chapter05>cd C:\samples\chapter05\

C:\samples\chapter05>g++ -o list5_3.exe list5_3.cpp

C:\samples\chapter05>list5_3.exe
小さい。
applebanana
applebanana
applebanana
11
ban
b
7
空です。

C:\samples\chapter05>cmd /k
C:\samples\chapter05>

[C++]スラスラわかるC++ 「C++の仕様で配列は必ずのポインタ渡しになる」を知るための実験プログラム 4_12 cpp *ptr &address

chapter4.h


// 配列の平均値を返す関数のプロトタイプ宣言
double getAverage(const int *a, int length);

getAverage.cpp

double getAverage(const int *a, int length) {
  double sum;		// 合計値
  double average;	// 平均値
  int i;		// 配列の要素番号(ループカウンタ)

  // 配列の合計値を求める
  sum = 0;
  for (i = 0; i < length; i++) {
    // ポインタが指し示している要素の値を読み出し集計する
    sum += *a;

    // ポインタを更新する(次の要素を指し示す)
    a++;
  }

  // 配列の平均値を求める
  average = (double)sum / length;

  // 配列の合計値を返す
  return average;
}

list4_12.cpp

#include <iostream>
using namespace std;
#include "chapter4.h"

int main() {
  const int DATA_NUM = 10;	// 配列の要素数

  // 10人の学生のテストの得点を格納した配列
  int point[DATA_NUM] = { 85, 72, 63, 45, 100, 98, 52, 88, 74, 65 };
  double average;		// 平均値

  // 平均点を求める
  average = getAverage(point, DATA_NUM);

  // 平均点を表示する
  cout << "平均点:" << average << endl;

  return 0;
}

cd_samples4_12_pointer_address.cmd  

 g++ list4_12.cpp getAverage.cpp -o list4_12.exe


C:\samples\chapter04\4_12>cd C:\samples\chapter04\4_12\

C:\samples\chapter04\4_12>g++ list4_12.cpp getAverage.cpp -o list4_12.exe

C:\samples\chapter04\4_12>list4_12.exe
平均点:74.2

C:\samples\chapter04\4_12>cmd /k
C:\samples\chapter04\4_12>

[C++]スラスラわかるC++ 引数のポインタ渡しを知るための実験プログラム 4_9 cpp *ptr &address

list4_9.cpp

#include <iostream>
using namespace std;

// 引数をポインタ渡しで受け取る関数
void sub(int *ptr) {
  // 引数に渡されたアドレスを表示する
  cout << "sub関数:引数ptrに渡されたアドレス = " << ptr << endl;

  // 引数に渡されたアドレスが指し示す変数の値を読み出して表示する
  cout << "sub関数:引数ptrが指し示す変数の値 = " << *ptr << endl;

  // 引数に渡されたアドレスが指し示す変数に値を書き込む
  *ptr = 456;
  cout << "sub関数:引数ptrが指し示す変数に書き込んだ値 = " << *ptr << endl;

  // 戻り値を返さずに関数を終了する
  return;
}

// main関数
int main() {
  // ローカル変数を宣言し、値を書き込む
  int val = 123;

  // ローカル変数のアドレスを表示する
  cout << "main関数:変数valのアドレス = " << &val << endl;

  // ローカル変数の値を表示する
  cout << "main関数:変数valの値 = " << val << endl;

  // 引数のポインタ渡しで、sub関数を呼び出す
  sub(&val);

  // ローカル変数の値を表示する
  cout << "main関数:変数valの値 = " << val << endl;

  return 0;
}

cd_samples4_9_pointer_address.cmd


C:\samples\chapter04>cd C:\samples\chapter04\

C:\samples\chapter04>g++ -o list4_9.exe list4_9.cpp

C:\samples\chapter04>list4_9.exe
main関数:変数valのアドレス = 0x61ff0c
main関数:変数valの値 = 123
sub関数:引数ptrに渡されたアドレス = 0x61ff0c
sub関数:引数ptrが指し示す変数の値 = 123
sub関数:引数ptrが指し示す変数に書き込んだ値 = 456
main関数:変数valの値 = 456

C:\samples\chapter04>cmd /k
C:\samples\chapter04>

[C++]スラスラわかるC++ テキストファイルを読み込むプログラム 9_5 cpp ifstream fin

list9_6.cpp

#include <iostream>
#include <fstream>
#include <string>
using namespace std;

int main() {
  string s;

  // 入力用のテキストファイルをオープンする
  ifstream fin("myFile.txt");

  // ファイルがオープンできたかどうかチェックする
  if (!fin.is_open()==true) {
    // エラー処理
    cout << "ファイルをオープンできません!";

    // プログラムをエラー終了する
    return 1;
  }

 // ファイルから1行ずつ読み出す
  while (getline(fin, s)) {
    // 読み出した1行を画面に表示する
    cout << s << endl;
  }
    
  // ファイルをクローズする
  fin.close();

  // プログラムを正常終了する
  return 0;
}

myFile.txt  エンコードは1 ANSI じゃなきゃだめだとおもう やってない

C++ hello, world
C++の皆さん、こんにちは

cd_samples9_5_ofstream_file_output.cmd


C:\samples\chapter09>cd C:\samples\chapter09\

C:\samples\chapter09>g++ -o list9_6.exe list9_6.cpp

C:\samples\chapter09>list9_6.exe
C++ hello, world
C++の皆さん、こんにちは

C:\samples\chapter09>cmd /k
C:\samples\chapter09>

[C++]スラスラわかるC++ テキストファイルへ書き込むプログラム 9_5 cpp ofstream fout

list9_5.cpp

#include <iostream>
#include <fstream>
using namespace std;

int main() {
  // 出力用のテキストファイルをオープンする
  ofstream fout("myFile.txt");

  // ファイルがオープンできたかどうかチェックする
  if (!fout.is_open()==true) {
    // エラー処理
    cout << "ファイルをオープンできません!";

    // プログラムをエラー終了する
    return 1;
  }

  // ファイルに文字列を書き込む
  fout << "C++ hello, world" << endl;
  fout << "C++の皆さん、こんにちは" << endl;
    
  // ファイルをクローズする
  fout.close();
  cout << "ファイルに書き込みました!";

  // プログラムを正常終了する
  return 0;
}

cd_samples9_5_ofstream.cmd


C:\samples\chapter09>cd C:\samples\chapter09\

C:\samples\chapter09>g++ -o list9_5.exe list9_5.cpp

C:\samples\chapter09>list9_5.exe
ファイルに書き込みました!
C:\samples\chapter09>cmd /k
C:\samples\chapter09>

myFile.txt

C++ hello, world
C++の皆さん、こんにちは

[C++]スラスラわかるC++ 関数テンプレート 10_2 cpp function Template Standard Template Library (STL)

■関数テンプレート(Tはプレースホルダ)
template <Class T>T 関数名(T 引数名,T 引数名){
        Tをデータ型とした変数を使った処理;
}

list10_2.cpp

#include <iostream>
using namespace std;

// 関数テンプレートで定義したgetMin関数
//template <Class T>T 関数名(T 引数名,T 引数名){
template <class T> T getMin(T a, T b) {
  //return a < b ? a : b;
    if (a < b) {
        return a;
    } else {
        return b;
    }
}

// main関数
int main() {
  // int型のgetMin関数を呼び出す
  int a, b, c;
  a = 123;
  b = 456;
  c = getMin(a, b);
  cout << c << endl;

  // double型のgetMin関数を呼び出す
  double x, y, z;
  x = 1.23;
  y = 4.56;
  z = getMin(x, y);
  cout << z << endl;

  return 0;
}

cd_samples10_2_template.cmd


C:\samples\chapter10>cd C:\samples\chapter10\

C:\samples\chapter10>g++ -o list10_3.exe list10_3.cpp

C:\samples\chapter10>list10_3.exe
123
1.23
a
1.11

C:\samples\chapter10>cmd /k
C:\samples\chapter10>