Motion transfer setup #1

Manually merged
Sybren A. Stüvel merged 18 commits from cgtinker/powership:motion_transfer into main 2023-06-05 12:06:15 +02:00
Showing only changes of commit cc09d703d2 - Show all commits

View File

@ -4,7 +4,7 @@ import functools
from collections import deque from collections import deque
from copy import copy from copy import copy
from math import degrees, radians from math import degrees, radians
from typing import TypeVar, Callable, Optional, Iterable, List from typing import TypeVar, Callable, Optional, Iterable, Union, Any, Tuple
import bpy import bpy
import nodeitems_utils import nodeitems_utils
@ -67,7 +67,10 @@ class PowerShipNodeTree(bpy.types.NodeTree):
def _prepare_nodes(self) -> None: def _prepare_nodes(self) -> None:
for node in self.nodes: for node in self.nodes:
if isinstance(node, AbstractPowerShipNode):
node.reset_run() node.reset_run()
else:
raise TypeError(f"Node type unknown {type(node)}")
def _run_from_node( def _run_from_node(
self, depsgraph: bpy.types.Depsgraph, start_node: "AbstractPowerShipNode" self, depsgraph: bpy.types.Depsgraph, start_node: "AbstractPowerShipNode"
@ -117,13 +120,13 @@ class NodeSocketExecute(bpy.types.NodeSocket):
def draw( def draw(
self, self,
context: bpy.types.Context, context: bpy.types.Context,
layout: bpy.types.Layout, layout: bpy.types.UILayout,
node: bpy.types.Node, node: bpy.types.Node,
text: bpy.types.Text, text: Union[str, Any],
) -> None: ) -> None:
layout.label(text=text) layout.label(text=text)
def draw_color(self, context: bpy.types.Context, node: bpy.types.Node) -> None: def draw_color(self, context: bpy.types.Context, node: bpy.types.Node) -> Tuple[float, float, float, float]:
return (1.0, 1.0, 1.0, 1.0) return (1.0, 1.0, 1.0, 1.0)