Skip to content

Commit

Permalink
Update panels.py
Browse files Browse the repository at this point in the history
  • Loading branch information
andrian-melnic committed Jun 16, 2022
1 parent 8fc12e7 commit 9e3291d
Showing 1 changed file with 27 additions and 24 deletions.
51 changes: 27 additions & 24 deletions voca-addon/panels.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,35 @@
)

# ---------------------------------------------------------------------------- #
# Props and callbacks #
# Callbacks and props #
# ---------------------------------------------------------------------------- #


def loadUI_w_label(scene, name, box):
row = box.row()
# add space on var name
name_string = re.sub(r'(?<=[a-z])(?=[A-Z])', ' ',
name).replace('_edit', '').replace(' Path', '')
row.label(text=name_string + ': ')
row = box.row()
row.prop(scene, name)


def loadUI_no_label(scene, box, props, check, choice_texture):
for (prop_name, _) in props:
row = box.row()
# Disable row if not checked
if prop_name != check:
row = row.row()
row.enabled = choice_texture
row.prop(scene, prop_name)


def hide_callback(self, context):
for obj in bpy.context.blend_data.objects:
if obj.type == 'MESH' and (not "VOCA" in obj.name):
obj.hide_viewport = context.scene.hide

PROPS = {
# -------------------------------- Main props -------------------------------- #
'RUN': [
Expand Down Expand Up @@ -72,29 +98,6 @@
'HIDE': [('hide', BoolProperty(name="Hide meshes", description="Check-box to hide no-VOCA meshes", default=False, update=hide_callback))]
}

def loadUI_w_label(scene, name, box):
row = box.row()
# add space on var name
name_string = re.sub(r'(?<=[a-z])(?=[A-Z])', ' ', name).replace('_edit','').replace(' Path','')
row.label(text = name_string + ': ')
row = box.row()
row.prop(scene, name)

def loadUI_no_label(scene, box, props, check, choice_texture):
for (prop_name, _) in props:
row = box.row()
# Disable row if not checked
if prop_name != check:
row = row.row()
row.enabled = choice_texture
row.prop(scene, prop_name)


def hide_callback(self, context):
for obj in bpy.context.blend_data.objects:
if obj.type == 'MESH' and (not "VOCA" in obj.name):
obj.hide_viewport = context.scene.hide

# ---------------------------------------------------------------------------- #
# Panels #
# ---------------------------------------------------------------------------- #
Expand Down

0 comments on commit 9e3291d

Please sign in to comment.