when i create a C++ project in UE5.3 but I create a project it gives me this error message

WindowsTargetRules.Compiler to VisualStudio2019. The current compiler version was detected as: 14.29.30152

Error Message

Running F:/Program Files/Epic Games/UE_5.3/Engine/Build/BatchFiles/Build.bat  -projectfiles -project="F:/Download/Game/CppFuncToBluePrint/CppFuncToBluePrint4/CppFuncToBluePrint4.uproject" -game -rocket -progress
Using bundled DotNet SDK version: 6.0.302
Running UnrealBuildTool: dotnet "..\..\Engine\Binaries\DotNET\UnrealBuildTool\UnrealBuildTool.dll" -projectfiles -project="F:/Download/Game/CppFuncToBluePrint/CppFuncToBluePrint4/CppFuncToBluePrint4.uproject" -game -rocket -progress
Log file: C:\Users\abcd\AppData\Local\UnrealBuildTool\Log_GPF.txt

Generating VisualStudio project files:
Discovering modules, targets and source code for project...
Microsoft platform targets must be compiled with Visual Studio 2022 17.4 (MSVC 14.34.x) or later for the installed engine. Please update Visual Studio 2022 and ensure no configuration is forcing WindowsTargetRules.Compiler to VisualStudio2019. The current compiler version was detected as: 14.29.30152

日本語 メッセージ

F:/Program Files/Epic Games/UE_5.3/Engine/Build/BatchFiles/Build.bat -projectfiles -project="F:/Download/Game/CppFuncToBluePrint/CppFuncToBluePrint4/CppFuncToBluePrint4.uproject" -game -rocket -progress を実行します。
バンドルされている DotNet SDK バージョンの使用: 6.0.302
UnrealBuildTool の実行: dotnet "..\..\Engine\Binaries\DotNET\UnrealBuildTool\UnrealBuildTool.dll" -projectfiles -project="F:/Download/Game/CppFuncToBluePrint/CppFuncToBluePrint4/CppFuncToBluePrint4.uproject" -game -rocket -progress
ログ ファイル: C:\Users\abcd\AppData\Local\UnrealBuildTool\Log_GPF.txt

VisualStudio プロジェクト ファイルの生成:
プロジェクトのモジュール、ターゲット、ソース コードを検出しています...
Microsoft プラットフォーム ターゲットは、インストールされているエンジンに対して Visual Studio 2022 17.4 (MSVC 14.34.x) 以降でコンパイルする必要があります。 Visual Studio 2022 を更新し、WindowsTargetRules.Compiler を VisualStudio2019 に強制する構成がないことを確認してください。 現在のコンパイラのバージョンは 14.29.30152 として検出されました。

直し方はVisual Studio Installer で個別のコンポーネントタブからMSVC のなかから14.29.30152のチェックを外すこと

参考

https://forums.unrealengine.com/t/help-when-i-create-a-c-project-in-ue5-3-but-i-create-a-project-it-gives-me-this-error-message/1305945

maya ls python のまとめ

このごろサイトが丸ごとなくなったので置いておく

Top Node をとってくる

topNodeList=cmds.ls(assemblies=True)

dagObjects 階層をとってくる

topNodeList=cmds.ls( "root", dagObjects=True, type="transform" )

[UnrealEngine] PythonでGet All Collision Presets

DefaultEngine.iniに記載されているので無理やり読む

#!/usr/bin/env python
# -*- coding: utf-8 -*-

import codecs


project_config_dir=unreal.Paths.project_config_dir()
#D:\MOSAProduct\MOSAProduct\Config\DefaultEngine.ini
DefaultEngineINI_Path=project_config_dir+"DefaultEngine.ini"
print("DefaultEngineINI_Path="+DefaultEngineINI_Path)
#fout = codecs.open('sjis.txt', 'w', 'shift_jis')

import re
def get_CollisionProfileNameStr(content):
    #m = re.search('"(.*)".*', content)
    result = re.findall('"(.*?)"', content)
    print("result[0]="+str(result[0]))
    #print("result[1]="+str(result[1]))
    return str(result[0])

CollisionProfileStrArr=[]
for line in codecs.open(DefaultEngineINI_Path, 'r', 'utf_8'):
    #fout.write(line)
    #print(line)
    if("-Profiles=(Name=" in line):
        ProfilesName=get_CollisionProfileNameStr(line)
        CollisionProfileStrArr.append(ProfilesName)
    if("+Profiles=(Name=" in line):
        ProfilesName=get_CollisionProfileNameStr(line)
        CollisionProfileStrArr.append(ProfilesName)
        
print("-----------------------Do Unique-----------------------------")
CollisionProfileStrSet = set(CollisionProfileStrArr)
CollisionProfileStrArr = list(CollisionProfileStrSet)
CollisionProfileStrArr.sort()
CollisionProfileStrArrBuildCSV=""
for CollisionProfileStr in CollisionProfileStrArr:
    print("CollisionProfileStr="+CollisionProfileStr)
    CollisionProfileStrArrBuildCSV=CollisionProfileStrArrBuildCSV+","+CollisionProfileStr

print("CollisionProfileStrArrBuildCSV="+CollisionProfileStrArrBuildCSV)

[mel] 全リファレンスからオブジェクトを読み込み

[mel] 全リファレンスからオブジェクトを読み込み

[mel] import object from all references


global proc reference_to_object(){
    print("reference_to_object \n");
    
    string $refArr[] = `file -q -list`;
    //-list(-l)		query
    //すべてのファイルをリスト表示します。 すべてのセグメント/リファレンス ファイルの名前を文字配列で返し、複製は削除します。つまり、ファイルが複数回参照され、-withoutCopyNumber フラグを設定している場合は、シーン内で 1 度リスト表示されます。
    
    string $mayaAsciiArr[] = {};
    for ($ref in $refArr) {
        print($ref+" \n");
        string $fileNameExt[];
        $numTokens = `tokenize $ref "." $fileNameExt`;

        //_Motion.ma{1} の対応
        string $ExtArr[];
        $numTokens2 = `tokenize $fileNameExt[1] "{" $ExtArr`;
        //print("$fileNameExt[1]="+$fileNameExt[1]+" \n");
        /*
        if($fileNameExt[1]=="ma"){
            print("HIT!! >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"+ $ref+" \n");
            //Array Append Add
            $mayaAsciiArr[size($mayaAsciiArr)] = $ref;
        }else
        //_Motion.ma{1}  の対応
        */ 
        if($ExtArr[0]=="ma"){
            print("HIT!! >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"+ $ref+" \n");
            //Array Append Add
            $refFileName=$fileNameExt[0]+"."+$ExtArr[0];
            $mayaAsciiArr[size($mayaAsciiArr)] = $refFileName;
        }
    }
    string $Ref_MayaAsciiArr[] = {};
    for ($ref_mayaAscii in $mayaAsciiArr) {
        print("$ref_mayaAscii= "+ $ref_mayaAscii+" \n");
        string $sceneName=`file -q -sceneName`;
        print("$sceneName= "+$sceneName+" \n");
        
        if($ref_mayaAscii==$sceneName){
            print("-----------------------HIT $sceneName ------------------------------ \n");
        }else{
            $Ref_MayaAsciiArr[size($Ref_MayaAsciiArr)] = $ref_mayaAscii;
        }
    }
    //string $refArrStr = stringArrayToString($refArr,", \n");
    //print("$refArrStr= "+$refArrStr+ " \n");
    print("----------------------------------- $Ref_MayaAsciiArr ------------------------------------------ \n");
    for ($ref_mayaAscii_path in $Ref_MayaAsciiArr) {
        print("$ref_mayaAscii_path= "+$ref_mayaAscii_path+" \n");
        //=====================================================================
        file -importReference $ref_mayaAscii_path;
        //-importReference(-ir)		create
        //指定したファイル内でデータの周りのリファレンスのカプセル化を削除します。これにより指定したファイルの内容がカレント シーンの一部となり、オリジナル ファイルのすべてのリファレンスが失われます。 インポートされたリファレンスの名前が返されます。
        //====================================================================
    }
    print("----------------------------------- $Ref_MayaAsciiArr ------------------------------------------ \n");

    
}

//reference_to_object();

[Maya] .offsetParentMatrixをmel/Pythonスクリプトで取り扱う場合の研究

解決策から、、画像のような状態でよかった。関数はこんな感じ

global proc _Input_Lines(){
    print("_Input_Lines \n");
    
    _offsetParentMatrix_Value_Input("Dummy_calf_l",-15.216,0);
    _offsetParentMatrix_Value_Input("Dummy_calf_r",15.216,0);
    _offsetParentMatrix_Value_Input("Dummy_foot_l",-7.821,-0.047);
    _offsetParentMatrix_Value_Input("Dummy_foot_r",7.821,0.047);
}

global proc _offsetParentMatrix_Value_Input(string $NodeName,float $X,float $Y){
    print("_offsetParentMatrix_Value_Input \n");
    string $LocatorName="OffsetParentMatrix_locator_"+$NodeName;
    print("$LocatorName= "+$LocatorName+" \n");
    spaceLocator -position 0.0 0.0 0.0 -name $LocatorName;
    $LocatorNameTransX = $LocatorName+".translateX";
    print("$LocatorNameTransX= "+$LocatorNameTransX+" \n");
    setAttr $LocatorNameTransX $X;
    $LocatorNameTransY = $LocatorName+".translateY";
    print("$LocatorNameTransY= "+$LocatorNameTransY+" \n");
    setAttr $LocatorNameTransY $Y;
    $LocatorName_worldMatrix0 = $LocatorName+".worldMatrix[0]";
    print("$LocatorName_worldMatrix0= "+$LocatorName_worldMatrix0+" \n");
    $NodeName_offsetParentMatrix = $NodeName+".offsetParentMatrix";
    print("$NodeName_offsetParentMatrix= "+$NodeName_offsetParentMatrix+" \n");
    connectAttr -f $LocatorName_worldMatrix0 $NodeName_offsetParentMatrix;
}

で大丈夫そう

————————————————–下は参考サイトの例————————————————-

この関数を

import os
import stat
import maya.cmds as cmds
#import maya.OpenMaya as OpenMaya
import maya.api.OpenMaya as OpenMaya
def func_offsetParentMatrix(node,driver):
    mult = cmds.createNode("multMatrix")

    offset = matrix_to_list(
        OpenMaya.MMatrix(cmds.getAttr("{}.worldMatrix[0]".format(node)))
        * OpenMaya.MMatrix(cmds.getAttr("{}.matrix".format(node))).inverse()
        * OpenMaya.MMatrix(cmds.getAttr("{}.worldInverseMatrix[0]".format(driver)))
    )
    cmds.setAttr("{}.matrixIn[0]".format(mult), offset, type="matrix")

    cmds.connectAttr("{}.worldMatrix[0]".format(driver), "{}.matrixIn[1]".format(mult))

    parent = cmds.listRelatives(node, parent=True, path=True)
    if parent:
        cmds.connectAttr("{}.worldInverseMatrix[0]".format(parent[0]), "{}.matrixIn[2]".format(mult))

    cmds.connectAttr(
        "{}.matrixSum".format(mult), "{}.offsetParentMatrix".format(node)
    )
    
def matrix_to_list(mtx):
    lst=[]
    for row in range(0,4):
        for col in range(0,4):
            lst.append(mtx.getElement(row,col))
    return lst
    
def list_to_matrix(lst):
    mtx=OpenMaya.MMatrix(lst)
    # OpenMaya.MScriptUtil.createMatrixFromList(lst, mtx)
    return mtx

こう使った。

global proc Func_TEST_offsetParentMatrix_Proc(){    
    print("Func_TEST_offsetParentMatrix_Proc");
    spaceLocator -position -15.216 0.0 0.0 -name "calf_l_OffsetMatrix_locator_l" -absolute;
    func_offsetParentMatrix_Python_Proc("Dummy_calf_telescopic_l","calf_l_OffsetMatrix_locator_l");
}
    
global proc func_offsetParentMatrix_Python_Proc(string $node,string $driver){
    print("func_offsetParentMatrix");
    python("import func_offsetParentMatrix");
	python("import importlib");
	python("importlib.reload(func_offsetParentMatrix)");
    python("func_offsetParentMatrix.func_offsetParentMatrix('"+$node+"','"+$driver+"')");
}

参考

offsetParentMatrixの記事
https://www.chadvernon.com/blog/space-switching-offset-parent-matrix/

matrix_to_list
https://gist.github.com/rjmoggach/4ea80af3104a3517d3a2a46293acf043

Python3.11 で 簿記3級 の勉強

今回はPython3.11.5を使った。

https://www.python.org/downloads/windows/

python-3.11.5-amd64.exe

まあまあ時間かかる。。。。

システム環境変数追加なんで再起動して下さい。

F:\Python311に入れた

C:\Users\furcr>F:

F:>cd F:\Python311

F:\Python311>pip

動いたら

pip install pandas

動いたら

https://qiita.com/et47/items/ec05beb03c09d79a9f09

をやっていく

とりま


#仕訳をPandasのDataFrame形式で、仕訳帳 df_siwake に入力します。
#Siwakeクラスの関数 entry を呼び出すことで、df_siwakeに仕訳データの行を追加し、更新します。
#仕訳ルール①:借方(左側)、貸方(右側)に勘定科目と金額を記載する
#に従い、仕訳を入力するための空のDataFrameとして仕訳帳 df_siwake を作成します。


import pandas as pd
df_siwake = pd.DataFrame(index=[],columns=['仕訳番号', '日付', '借方科目', '借方金額', '貸方科目', '貸方金額'])
print("df_siwake= "+str(df_siwake))



#仕訳入力時に必ず貸借が一致していることにより、後ほど残高試算表を作るときにも、
#貸借金額が一致することが保証されます。

#そこで仕訳入力用のクラス Siwake を定義し、まずは①複合仕訳の入力に対応する形で
#関数 entry を定義します。

#※最終的には Siwake 内に②データ型チェック、③貸借一致チェックの関数を実装しますが、
#コードが長くなるため、末尾に補足として追記します。

class Siwake:
    def __init__(self):
        self.siwake_no = 0
        print("self.siwake_no= "+str(self.siwake_no))

    def entry(self, df, date, kari, kashi): 
        self.siwake_no += 1 # ...仕訳番号を更新
        print("self.siwake_no= "+str(self.siwake_no))

        for i in range(len(kari)): # ...複合仕訳に対応するため[借方科目、借方金額]の数だけループを回す                    
            kari_entry = pd.Series([self.siwake_no] + [date] + kari[i] + ["", 0], index=df.columns)          
            print("kari_entry= "+str(kari_entry))
            df = df._append(kari_entry, ignore_index=True)

        for i in range(len(kashi)): # ...複合仕訳に対応するため[貸方科目、貸方金額]の数だけループを回す                    
            kashi_entry = pd.Series([self.siwake_no] + [date] + ["", 0] + kashi[i], index=df.columns)
            print("kashi_entry= "+str(kashi_entry))
            df = df._append(kashi_entry, ignore_index=True)

        return df
        
siwake = Siwake()


#仕訳①:会社を設立
#現金1000を元手に会社を設立しました。
#この元手のことを資本金と呼び、仕訳は以下の通りです。
print(u"------------会社を設立-----------")
df_siwake = siwake.entry(df_siwake, 20200401,[['現金', 1000]],[['資本金', 1000]])
df_siwake[df_siwake['仕訳番号']==siwake.siwake_no]

#仕訳②:商品の仕入
#商品500を外部業者より仕入れました。
#仕訳は以下の通りです。
print(u"------------商品の仕入-----------")
df_siwake = siwake.entry(df_siwake, 20200402,[['商品', 500]],[['買掛金', 500]])
df_siwake[df_siwake['仕訳番号']==siwake.siwake_no]

#仕訳③:商品を売上
#仕入れた商品のうち200について、価格300で販売しました。
#売上についての仕訳は以下の通りです。
print(u"------------商品を売上-----------")
df_siwake = siwake.entry(df_siwake, 20200403,[['売掛金', 300]],[['売上', 300]])
df_siwake[df_siwake['仕訳番号']==siwake.siwake_no]

#仕訳④:仕入代金を支払
#仕入代金500のうち300について、外部業者に支払いました。
#(残りの200は翌月支払の契約と仮定します)
#仕訳は以下の通りです。
print(u"------------仕入代金を支払-----------")
df_siwake = siwake.entry(df_siwake, 20200420,[['買掛金', 300]],[['現金', 300]])
df_siwake[df_siwake['仕訳番号']==siwake.siwake_no]

#仕訳⑤:販売代金を回収
#販売代金200について、販売先から現金で回収しました。
#(残りの100は翌月回収の契約と仮定します)
#仕訳は以下の通りです。
print(u"------------販売代金を回収-----------")
df_siwake = siwake.entry(df_siwake, 20200430,[['現金', 200]],[['売掛金', 200]])
df_siwake[df_siwake['仕訳番号']==siwake.siwake_no]

参考URL

https://www.sejuku.net/blog/64370

UE4 きれいなグラデーションの虹色のレインボーのマテリアルが作りたい

正解はtexCoordの応用だった。

texCoordを縦のグラデーションと横グラデーションに分け

値をLerpのAlphaにつないでお好きな色をA,Bにつなぐ。

2つ作ってMultplyして縦横グラデーションになるようにMIXした。

さらに回転させたい

下の部分が見切れていたので追加しました。

参考

UE4]UMGで使えるでシンプルなグラデーションを作 …historia.co.jp

https://wgld.org/d/glsl/g008.html

https://wgld.org/d/glsl/g010.html