Can you place the operation drop down from a math node into a panel?

The math node displays a drop down for options such as “Add, Multiply, Absolute”. Is it possible to display this dropdown in the properties panel?

for example like this:

    def draw(self, context):
        layout = self.layout
        node = context.scene.node_tree.nodes.active
        if node.type == 'MATH':
            layout.prop(node, "operation")

Cool. Thanks. Sorry it took a while to respond to this post. Here’s what worked for me based off of your answer:


node = bpy.context.active_object.active_material.node_tree.nodes['Math']
layout.prop(node, "operation")

Is there a way to display the other values on the Math node like we did with the operation? The ones Python reads as inputs[0].default_value and inputs[1].default_value?

Sure:

layout.prop(node.inputs[0], “default_value”)
layout.prop(node.inputs[1], “default_value”)

Lol, such a simple solution, yet was hidden from me. :yes: Thanks a million!