blender customization

This commit is contained in:
Vysyr committed 2026-10-31 17:21:00 +01:00
1 parent fb39e290c0
commit 8c0a639fba
12 files changed
+264 -8

No files matched your search

+24 -2
View File
@@ -17,12 +17,30 @@ if "ue_workshop" in sys.modules:
importlib.reload(sys.modules["ue_workshop"])
from ue_workshop import Scene, Sequence, Renderer, camera, lighting, materials
from ue_workshop.paths import PROJECT
# WYBOR POSTACI: "primitive", "robot", "pilot" lub "file".
MODEL = "file"
MODEL_FILE = PROJECT / "source_assets/character/character_custom.blend"
MODEL_HEIGHT = 200 # centymetry; None zachowuje oryginalny rozmiar
MODEL_ROTATION = (0, 0, 0) # roll, pitch, yaw; np. (0, 0, 90) obraca model
# 1. MODEL I SCENA. Jednostki: centymetry. Os Z wskazuje gore.
scene = Scene("MyShot")
blue = materials.color("Character", rgb=(0.04, 0.35, 0.8), metallic=0.2)
floor = materials.color("Floor", rgb=(0.07, 0.08, 0.11))
character = scene.character(material=blue, head_scale=1.0)
if MODEL == "primitive":
blue = materials.color("Character", rgb=(0.04, 0.35, 0.8), metallic=0.2)
character = scene.character(material=blue, head_scale=1.0)
else:
sources = {
"robot": (PROJECT / "DemoAssets/RobotPolice/RobotPolice.fbx", "RobotPolice"),
"pilot": (PROJECT / "DemoAssets/pilot/pilot.fbx", "Pilot"),
"file": (MODEL_FILE, "CustomCharacter"),
}
if MODEL not in sources:
raise ValueError("MODEL: primitive, robot, pilot lub file.")
source, name = sources[MODEL]
character = scene.model(source, name=name, height=MODEL_HEIGHT, rotation=MODEL_ROTATION)
scene.primitive("Cube", name="Floor", location=(0, 0, -10), scale=(20, 20, 0.2), material=floor)
lighting.studio(scene, key_color=(1.0, 0.75, 0.5), fill_color=(0.3, 0.6, 1.0))
cam = camera.create(scene, location=(450, -550, 300), focal_length=45)
@@ -33,6 +51,10 @@ shot.camera(cam)
# Rotacja: (roll, pitch, yaw), w stopniach.
shot.transform_key(character, 0, rotation=(0, 0, 0))
shot.transform_key(character, 47, rotation=(0, 0, 360))
# Opcjonalny podskok (dziala tak samo dla robota i wlasnego modelu):
# shot.transform_key(character, 0, location=(0, 0, 0), interpolation="auto")
# shot.transform_key(character, 24, location=(0, 0, 80), interpolation="auto")
# shot.transform_key(character, 47, location=(0, 0, 0), interpolation="auto")
shot.save()
# 3. WYNIK. Najpierw obejrzyj animacje w Sequencerze, potem zmien RENDER na True.