I made an addon (well, just two buttons for now) that adds and set nodes for tri-planar mapping textures. This, since Quixel Bridge drops only a bunch of textures and connect them to the principled BSDF. Got that, and works. So there is a button: add box mapping. Yay! But now I want the users to be able to adjust the scale (mapping node) in the UI.
The data path is: node_tree.nodes["Mapping"].inputs[3].default_value
So I guess I have to use, in the Operator Class, something with:
bpy.context.object.active_material.node_tree.nodes["Mapping"].inputs[3].default_value
And probably I need to set up a FloatVector property in the operator class so I get the scale x,y,z together in the UI?.
So far I got only this:
class QXH_OT_scaletex(bpy.types.Operator):
bl_idname ="qhx.scaletex"
bl_label = "Scale Texture"
bl_description = "Scale the texture"
@classmethod
def poll(cls, context):
return context.active_object is not None
def execute(self, context):
# Make some references to material and it's nodes
activemat = context.object.active_material
treenode = activemat.node_tree.nodes
#scale the texture
# treenode["Mapping"].inputs[3].default_value
# ............
return {FINISHED}