USDCustomNode

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import bpy

from pxr import Usd, UsdGeom

from .base_node import USDNode


class CubeNode(USDNode):
    """Merges two USD streams"""
    bl_idname = 'usd.CubeNode'
    bl_label = "Cube"

    def update_data(self, context):
        self.reset()

    sdf_path: bpy.props.StringProperty(
        name="SdfPath",
        default="",
        update=update_data
    )

    def draw_buttons(self, context, layout):
        layout.prop(self, 'sdf_path')

    def compute(self, **kwargs):

        input_stage = self.get_input_link('Input', **kwargs)

        if not self.sdf_path:
            return None

        stage = self.cached_stage.create()

        if input_stage:
            layer = input_stage.GetRootLayer()
            stage.GetRootLayer().subLayerPaths = [layer.realPath]

        UsdGeom.Cube.Define(stage, self.sdf_path)

        return stage

最終更新日: 2021-10-14 07:47:52