1
$\begingroup$

Okay so I am trying to add a color wheel to my custom UI panel to control multiple color inputs on different materials all at once, but I having a lot of problems trying to figure out what to do exactly and everything I have tried is giving me errors;

enter image description here

my idea was to add a driver to the color input of the node of the node using a custom property set to an array like this,

enter image description here

But when I try to use the custom property to control the driver it just says this enter image description here

and I have run out of ideas of what to do, I'm still new to python and I am not really good at it.

Python script:

import bpy

class meshsettings(bpy.types.Panel):
    bl_label = "Fandroid"
    bl_category = "RigSettings"
    bl_space_type = 'VIEW_3D'
    bl_region_type = 'TOOLS'

    @classmethod
    def poll(self, context):
        try:
            return (context.active_object.data.get("Rig_Fandroid") == "armature")
        except (AttributeError, KeyError, TypeError):
            return False

    def draw(self, context):
        layout = self.layout 
        row = layout.row()
        split = layout.split()
        col = split.column(align=True)

    def draw(self, context):
        layout = self.layout 
        row = layout.row()
        split = layout.split()
        col = split.column(align=True)

        row.label(text="Model Settings")
        col.prop(context.active_object.data,'["Subsurface"]', slider=True, text="Subsurface Level")
        col.prop(context.active_object.data,'["OpenSubDiv"]', slider=True, text="OpenSubDiv")
        col.prop(context.active_object.data,'["EdgeSplit"]', slider=True, text="EdgeSplit")
        col.label(text="Material Settings")
        col.prop(context.active_object.data,'["LightBrightness"]', slider=True, text="Light Brightness")
        col.prop(context.active_object.data,'["BaseColor"]', "color", text="")


bpy.utils.register_class(meshsettings)
$\endgroup$
  • 1
    $\begingroup$ Is this the same question you have asked 11 hours ago, which is deleted now? $\endgroup$ – cgslav Dec 29 '17 at 19:01
  • $\begingroup$ kind of, I now made it more clear and in the last post I had no idea what to do but now I have the idea of using the array and stuff, anyways I thought that it would be better to just remove the post than edit it and redo everything on it $\endgroup$ – Cutie _Tree Dec 29 '17 at 19:03
  • 2
    $\begingroup$ For future ref: to format code select code block and hit control - K or hit the code button {}. Is obj["BaseColor"] a list? a driver expects a float result. $\endgroup$ – batFINGER Dec 30 '17 at 7:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.