Power parts
The main content is the process of creating the game engine assets currently being created.
https://www.youtube.com/watch?v=nUGIblZhw9Q
Modular Animal Robot Biped is an asset that allows you to create characters with various patterns by combining parts consisting of legs, pelvis, torso, neck, head, tail, and arms.
WindowsでImageMagick
https://imagemagick.org/index.php
でフォルダとサブフォルダ内のpng画像ファイルのサイズを1024x1024に変える方法
コマンドプロンプトでフォルダに移動し
forfiles /S /M *.png /C "cmd /c magick mogrify -resize 1024x1024 @path
を実行
import bpy
# 選択されたメッシュオブジェクトを取得
selected_meshes = [obj for obj in bpy.context.selected_objects if obj.type == 'MESH']
for mesh in selected_meshes:
# すべてのオブジェクトの選択を解除
bpy.ops.object.select_all(action='DESELECT')
# メッシュを選択
mesh.select_set(True)
# メッシュに関連付けられているアーマチュアを探す
armature = None
if mesh.parent and mesh.parent.type == 'ARMATURE':
armature = mesh.parent
armature.select_set(True)
# アクティブなオブジェクトを設定 (エクスポートの際に必要)
bpy.context.view_layer.objects.active = mesh
# FBXとしてエクスポート
bpy.ops.export_scene.fbx(
filepath=f"path_to_save/{mesh.name}.fbx",
use_selection=True,
mesh_smooth_type='FACE',
bake_anim=False,
add_leaf_bones=False,
primary_bone_axis='X',
secondary_bone_axis='Y',
global_scale=1.0
)
import bpy
import json
# テキストファイルからエクスポートリストを読み込む
with open("your_filepath/export_list.txt", "r") as file:
export_list = json.load(file)
# 各オブジェクトグループをFBXとしてエクスポート
for group in export_list:
# すべてのオブジェクトの選択を解除
bpy.ops.object.select_all(action='DESELECT')
# グループ内のオブジェクトを選択
for obj_name in group:
obj = bpy.data.objects.get(obj_name)
if obj:
obj.select_set(True)
# アクティブなオブジェクトを設定 (エクスポートの際に必要)
bpy.context.view_layer.objects.active = bpy.data.objects.get(group[0])
# FBXとしてエクスポート
bpy.ops.export_scene.fbx(
filepath=f"your_filepath/{group[0]}.fbx",
#filepath=f"path_to_save/{'_'.join(group)}.fbx",
use_selection=True,
# 出力設定色々
mesh_smooth_type='FACE',
bake_anim=False,
add_leaf_bones=False,
primary_bone_axis='X',
secondary_bone_axis='Y',
global_scale=0.01
)
----------------------------------------------------------------
[
["Mesh1", "Armature1"],
["Mesh2", "Mesh3"],
["Armature1"]
]
import unreal
# エディタ内で選択されたアセットを取得
selected_assets = unreal.EditorUtilityLibrary.get_selected_assets()
for asset in selected_assets:
if isinstance(asset, unreal.Texture2D):
# Texture GroupをCharacterに設定
asset.set_editor_property('LODGroup', unreal.TextureGroup.TEXTUREGROUP_CHARACTER)
# アセットの変更を保存
unreal.EditorAssetLibrary.save_loaded_asset(asset)
#他の値に変更する場合はTEXTUREGROUP_CHARACTERの代わりに以下のEnumを使用する
#https://docs.unrealengine.com/4.26/en-US/PythonAPI/class/TextureGroup.html