Blender Python (overall Python) noob here. I simply want to make a Custom UI that toggles my models accessories by enabling and disabling their viewport and render visibility. Generally, I want to know how to make customizeable input for operators but I simply can't wrap my head around it. I'm trying to avoid using Custom Drivers since I need a more user friendly input and not just a float property.

I don't exactly have a full script since I'm not sure how to approach it.

Here's a script that toggles the visibility of both the viewport and render but isn't a toggle:

$\begingroup$Hi. Which specific part of making the script are you having trouble with? What do you have so far?$\endgroup$
– Ray MairlotSep 2 '19 at 11:53

$\begingroup$I don't have a full script yet but here are some scripts I found similar to what I'm trying to achieve.$\endgroup$
– Scottie DoriaSep 2 '19 at 14:24

$\begingroup$This is a bad idea, what if "Cube" doesn't exist? What you can do is providing the user a list of objects in the scene to choose from (via pointer property) otherwise this script will always return an error if the cube can't be found...$\endgroup$
– brockmannSep 3 '19 at 9:52

$\begingroup$The "Cube" is just an example what's important is to have UI that toggles an object's visibility while being a bool property.$\endgroup$
– Scottie DoriaSep 3 '19 at 11:38

$\begingroup$The important bit is what object exactly. The object in context or the active object or any selection based on what? BTW: Wasn't notified, you have to use the @-sign to ping someone @ScottieDoria.$\endgroup$
– brockmannSep 3 '19 at 15:19

2 Answers
2

Syncing both properties and controlling them by another BoolProperty, takes a lot effort to manage situations like the User disables one of the properties in the Outliner: Is your custom (single) property in this case False or True?

One simple approach is using an operator to set the state of both properties and also store the name of the object (unique). In case the string property is not empty, the operator "resets" all the values: