__init__.py 文件源码

python
阅读 20 收藏 0 点赞 0 评论 0

项目:CutAwayShader 作者: i-Reboot 项目源码 文件源码
def poll(self, context):
        return True
# < !Warning Dialog: Delete all CutawayShaders -- can't be undone! >




# *************************************************************************************
# *************************************************************************************
#
# CutAwaySetupNode py_node class code
# This is the entry point for the code when the user selects "Shader Effects-> Cutaway Shader"
#
# *************************************************************************************
# *************************************************************************************




# ***************************** Define the Custom Node(s) *****************************
#                   We can create more than one new node if desired
#
# A custom node that allows the OSL cut away shader node to be easily set up
# Specifically, it:
# - Allows the cut away plane object to be selected from a drop down enumeration box,
# - Allows various shader mode selection options to be selected with check boxes
# - Connects all the required user inputs and outputs to the parent shader
# - Creates drivers to link the selected cutaway plane LOC,ROT,SCALE attributes to the OSL cut away shader
# - Creates the OSL shader node an pre-wires the node links for the user (these are really just for show - the drivers do the work)
# - Allows multiple slected objects in the scene to have the same cut away shader added to their existing materials 
#   (there is 1 parent shader and possibly many child shaders that follow the parent's node settings.)
# The general gist from here on is to:
    #   Define class props
    #   Do init:
    #       Define the node's input sockets.
    #       Define the node's output sockets.
    #       Get access to this nodes nodetree and nodetree.nodes functions/properties.
    #       Create the OSL cutaway Shader node.
    #       Link the outputs of this setup helper node to the inputes of the OSL cut away shader node.
    #       Set some user defaults on the OSL shader node.
    #       Group the this helper setup node and the OSL shader node together.
    #       Get access to the group node's nodetree and nodetree.nodes functions/properties.
    #       Create the group node's GROUP Input and Group Output nodes .
    #       Define the input and output socket types for the Group Input and OutPuts.
    #       Associate the input and output sockets to the input and ouput nodes.
    #       Make node links between the Group Input and Output Nodes and the setup helper + OSL shader node.
    #       Note: The links to this custom setup help node are for show only
    #             OSL node divers are set when a new cutaway plane is selected. Other OSL input values are written to directly by the py node code.
    #             The links to the OSL shader node are required and do work as normal.
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号