Exemplo n.º 1
0
import bpy as _bpy
import bpyml
from bpyml import TAG, ARGS, CHILDREN

_uilayout_rna = _bpy.types.UILayout.bl_rna

_uilayout_tags = (
    ["ui"] +
    _uilayout_rna.properties.keys() +
    _uilayout_rna.functions.keys()
    )

# these need to be imported directly
# >>> from bpyml_ui.locals import *
locals = bpyml.tag_module("%s.locals" % __name__, _uilayout_tags)


def _parse_rna(prop, value):
    if prop.type == 'FLOAT':
        value = float(value)
    elif prop.type == 'INT':
        value = int(value)
    elif prop.type == 'BOOLEAN':
        if value in {True, False}:
            pass
        else:
            if value not in {"True", "False"}:
                raise Exception("invalid bool value: %s" % value)
            value = bool(value == "True")
    elif prop.type in {'STRING', 'ENUM'}:
Exemplo n.º 2
0
# ##### END GPL LICENSE BLOCK #####

# <pep8 compliant>

import bpy as _bpy
import bpyml
from bpyml import TAG, ARGS, CHILDREN

_uilayout_rna = _bpy.types.UILayout.bl_rna

_uilayout_tags = (["ui"] + _uilayout_rna.properties.keys() +
                  _uilayout_rna.functions.keys())

# these need to be imported directly
# >>> from bpyml_ui.locals import *
locals = bpyml.tag_module("%s.locals" % __name__, _uilayout_tags)


def _parse_rna(prop, value):
    if prop.type == 'FLOAT':
        value = float(value)
    elif prop.type == 'INT':
        value = int(value)
    elif prop.type == 'BOOLEAN':
        if value in {True, False}:
            pass
        else:
            if value not in {"True", "False"}:
                raise Exception("invalid bool value: %s" % value)
            value = bool(value == "True")
    elif prop.type in {'STRING', 'ENUM'}: