Python bpy 模块,props() 实例源码

我们从Python开源项目中,提取了以下50个代码示例,用于说明如何使用bpy.props()

项目:CatHide-Addon-for-Blender    作者:samytichadou    | 项目源码 | 文件源码
def register():
    bpy.utils.register_class(CatHideUIList)
    bpy.utils.register_class(CatHidePresetUIList)
    bpy.utils.register_class(CatHidePanel)
    bpy.utils.register_class(CathideRefresh)
    bpy.utils.register_class(CathideApply)
    bpy.utils.register_class(CathidePresetAdd)
    bpy.utils.register_class(CathidePresetDelete)
    bpy.utils.register_class(CathidePresetClear)
    bpy.utils.register_class(CathideApplyPreset)
    bpy.utils.register_class(CatHidePanelList)
    bpy.types.Scene.panel_cathide_list = \
        bpy.props.CollectionProperty(type=CatHidePanelList)
    bpy.types.Scene.cathide_index = IntProperty()
    bpy.utils.register_class(CatHidePresetList)
    bpy.types.Scene.preset_cathide_list = \
        bpy.props.CollectionProperty(type=CatHidePresetList)
    bpy.types.Scene.cathide_preset_index = IntProperty()
    bpy.types.Scene.cathide_show_presetdetails = BoolProperty()
项目:blender-idtech4-md5    作者:motorsep    | 项目源码 | 文件源码
def register():

    global oldname, oldnamehelper

    oldname = {}
    oldnamehelper = {}

    bpy.types.Bone.Export = bpy.props.BoolProperty(
            name = "export", 
            description = "Will this bone be exported?",
            default = False)
    bpy.types.Bone.ReparentBool = bpy.props.BoolProperty(
            name = "reparent", 
            description = "Will this bone be reparented?",
            default = False)
    bpy.types.Bone.ReparentName = bpy.props.StringProperty(
            name = "to", 
            description = "Reparenting to this bone for export",
            default = "")                               

    bpy.utils.register_module(__name__) #mikshaw
    bpy.types.INFO_MT_file_export.append(menu_func)
    bpy.app.handlers.save_pre.append(fakeuser_for_actions)
    bpy.app.handlers.scene_update_post.append(sceneupdate_handler)
项目:b3d_osc_panel    作者:zeffii    | 项目源码 | 文件源码
def event_dispatcher(self, context, type_op):
        if type_op == 'start':

            wm = context.window_manager
            self._timer = wm.event_timer_add(self.speed, context.window)
            wm.modal_handler_add(self)

            osc_statemachine['status'] = RUNNING
            props = context.scene.generic_osc
            paths = context.scene.generic_osc_list
            start_server_comms(props.ip, props.port, [i.path for i in paths])

        if type_op == 'end':
            # osc_statemachine['server'].shutdown()
            osc_statemachine['server'].shutdown()
            osc_statemachine['server'].server_close()
            osc_statemachine['status'] = STOPPED
项目:bpy_lambda    作者:bcongdon    | 项目源码 | 文件源码
def register():
    from bpy.types import Scene
    from bpy.props import (BoolProperty,
                           IntProperty,
                           StringProperty,
                           )

    Scene.pc_pc2_rotx = BoolProperty(default=True, name="Rotx = 90")
    Scene.pc_pc2_world_space = BoolProperty(default=True, name="World Space")
    Scene.pc_pc2_modifiers = BoolProperty(default=True, name="Apply Modifiers")
    Scene.pc_pc2_subsurf = BoolProperty(default=True, name="Turn Off SubSurf")
    Scene.pc_pc2_start = IntProperty(default=0, name="Frame Start")
    Scene.pc_pc2_end = IntProperty(default=100, name="Frame End")
    Scene.pc_pc2_group = StringProperty()
    Scene.pc_pc2_folder = StringProperty(default="Set me Please!")
    Scene.pc_pc2_exclude = StringProperty(default="*")   

    bpy.utils.register_module(__name__)

    update_panel(None, bpy.context)
项目:bpy_lambda    作者:bcongdon    | 项目源码 | 文件源码
def execute(self, context):
        if context.mode == "OBJECT":
            o = context.active_object
            props = archipack_reference_point.datablock(o)
            if props is None:
                return {'CANCELLED'}
            bpy.ops.object.select_all(action="DESELECT")
            bpy.ops.archipack.reference_point(location_3d=props.location_3d)
            for child in o.children:
                child.select = True
            bpy.ops.archipack.parent_to_reference()
            context.scene.objects.unlink(o)
            return {'FINISHED'}
        else:
            self.report({'WARNING'}, "Archipack: Option only valid in Object mode")
            return {'CANCELLED'}
项目:bpy_lambda    作者:bcongdon    | 项目源码 | 文件源码
def execute(self, context):
        if context.mode == "OBJECT":
            o = context.active_object
            props = archipack_reference_point.datablock(o)
            if props is None:
                return {'CANCELLED'}
            sel = [obj for obj in context.selected_objects if obj != o and obj.parent != o]
            itM = o.matrix_world.inverted()
            # print("parent_to_reference parenting:%s objects" % (len(sel)))
            for child in sel:
                rs = child.matrix_world.to_3x3().to_4x4()
                loc = itM * child.matrix_world.translation
                child.parent = None
                child.matrix_parent_inverse.identity()
                child.location = Vector((0, 0, 0))
                child.parent = o
                child.matrix_world = rs
                child.location = loc
            return {'FINISHED'}
        else:
            self.report({'WARNING'}, "Archipack: Option only valid in Object mode")
            return {'CANCELLED'}
项目:bpy_lambda    作者:bcongdon    | 项目源码 | 文件源码
def update_fpath(self, context):
    global start_up
    start_up=False
    ReadLabel(bpy.context.scene.fpath)
    if Message != "":
        start_up=True
    else:
        typ = bpy.types.Scene
        var = bpy.props
        typ.FromLat = var.FloatProperty(description="From Latitude", min=float(MINIMUM_LATITUDE), max=float(MAXIMUM_LATITUDE), precision=3, default=0.0)
        typ.ToLat = var.FloatProperty(description="To Latitude", min=float(MINIMUM_LATITUDE), max=float(MAXIMUM_LATITUDE), precision=3)
        typ.FromLong = var.FloatProperty(description="From Longitude", min=float(WESTERNMOST_LONGITUDE), max=float(EASTERNMOST_LONGITUDE), precision=3)
        typ.ToLong = var.FloatProperty(description="To Longitude", min=float(WESTERNMOST_LONGITUDE), max=float(EASTERNMOST_LONGITUDE), precision=3)
        typ.Scale = var.IntProperty(description="Scale", min=1, max=100, default=1)
        typ.Magnify = var.BoolProperty(description="Magnify", default=False)


#Import the data and draw the planet
项目:bpy_lambda    作者:bcongdon    | 项目源码 | 文件源码
def initialize():
    global MAXIMUM_LATITUDE, MINIMUM_LATITUDE
    global WESTERNMOST_LONGITUDE, EASTERNMOST_LONGITUDE
    global LINES, LINE_SAMPLES, SAMPLE_BITS, MAP_RESOLUTION
    global OFFSET, SCALING_FACTOR
    global SAMPLE_TYPE, UNIT, TARGET_NAME, RadiusUM, Message
    global start_up

    LINES = LINE_SAMPLES = SAMPLE_BITS = MAP_RESOLUTION = 0
    MAXIMUM_LATITUDE = MINIMUM_LATITUDE = 0.0
    WESTERNMOST_LONGITUDE = EASTERNMOST_LONGITUDE = 0.0
    OFFSET = SCALING_FACTOR = 0.0
    SAMPLE_TYPE = UNIT = TARGET_NAME = RadiusUM = Message = ""
    start_up=True

    bpy.types.Scene.fpath = bpy.props.StringProperty(
        name="Import File ",
        description="Select your img file",
        subtype="FILE_PATH",
        default="",
        update=update_fpath)
项目:bpy_lambda    作者:bcongdon    | 项目源码 | 文件源码
def register():
    bpy.utils.register_class(CubeMapInfo)
    bpy.utils.register_class(CubeMapSetup)
    bpy.types.Scene.cube_map = bpy.props.PointerProperty(
            name="cube_map",
            type=CubeMapInfo,
            options={'HIDDEN'},
            )

    bpy.utils.register_class(RENDER_PT_cube_map)

    bpy.app.handlers.render_init.append(cube_map_render_init)
    bpy.app.handlers.render_pre.append(cube_map_render_pre)
    bpy.app.handlers.render_post.append(cube_map_render_post)
    bpy.app.handlers.render_cancel.append(cube_map_render_cancel)
    bpy.app.handlers.render_complete.append(cube_map_render_complete)
项目:bpy_lambda    作者:bcongdon    | 项目源码 | 文件源码
def save(self):
    scn = bpy.context.scene
    cats = set([cat.name for cat in self.cats])
    libpath = bpy.context.scene.matlib.current_library.path

    cmd = """
print(30*"+")
import bpy
if not hasattr(bpy.context.scene, "matlib_categories"):
  class EmptyProps(bpy.types.PropertyGroup):
    pass
  bpy.utils.register_class(EmptyProps)
  bpy.types.Scene.matlib_categories = bpy.props.CollectionProperty(type=EmptyProps)
cats = bpy.context.scene.matlib_categories
for cat in cats:
  cats.remove(0)
"""
    for cat in cats:
      cmd += """
cat = cats.add()
cat.name = "%s" """ % cat.capitalize()
    cmd +='''
bpy.ops.wm.save_mainfile(filepath="%s", check_existing=False, compress=True)''' % winpath(libpath)

    return send_command(cmd, "save_categories.py")
项目:bpy_lambda    作者:bcongdon    | 项目源码 | 文件源码
def draw(self, context):
        self.layout.operator_context = 'INVOKE_REGION_WIN'
        self.layout.operator("mesh.archimesh_room", text="Add Room")
        self.layout.operator("mesh.archimesh_door", text="Add Door")
        self.layout.operator("mesh.archimesh_window", text="Add Rail Window")
        self.layout.operator("mesh.archimesh_winpanel", text="Add Panel Window")
        self.layout.operator("mesh.archimesh_kitchen", text="Add Cabinet")
        self.layout.operator("mesh.archimesh_shelves", text="Add Shelves")
        self.layout.operator("mesh.archimesh_column", text="Add Column")
        self.layout.operator("mesh.archimesh_stairs", text="Add Stairs")
        self.layout.operator("mesh.archimesh_roof", text="Add Roof")
        self.layout.menu("INFO_MT_mesh_decoration_add", text="Decoration props", icon="GROUP")

# --------------------------------------------------------------
# Register all operators and panels
# --------------------------------------------------------------


# Add-ons Preferences Update Panel

# Define Panel classes for updating
项目:bpy_lambda    作者:bcongdon    | 项目源码 | 文件源码
def draw(self, context):
        layout = self.layout

        col = layout.column(align=True)
        # AddObjectHelper props
        col.prop(self, "view_align")
        col.prop(self, "location")
        col.prop(self, "rotation")

        col = layout.column()
        col.label("Curve:")
        col.prop(self, "types")

        col = layout.column(align=True)
        col.label("Resize:")
        col.prop(self, "scale_x")
        col.prop(self, "scale_y")
项目:bpy_lambda    作者:bcongdon    | 项目源码 | 文件源码
def draw_curve(props, context):
    if props.spiral_type == 'ARCH':
        verts = make_spiral(props, context)
    if props.spiral_type == 'LOG':
        verts = make_spiral(props, context)
    if props.spiral_type == 'SPHERE':
        verts = make_spiral_spheric(props, context)
    if props.spiral_type == 'TORUS':
        verts = make_spiral_torus(props, context)

    curve_data = bpy.data.curves.new(name='Spiral', type='CURVE')
    curve_data.dimensions = '3D'

    spline = curve_data.splines.new(type=props.curve_type)
    """
    if props.curve_type == 0:
        spline = curve_data.splines.new(type='POLY')
    elif props.curve_type == 1:
        spline = curve_data.splines.new(type='NURBS')
    """
    spline.points.add(len(verts) * 0.25 - 1)
    # Add only one quarter of points as elements in verts,
    # because verts looks like: "x,y,z,?,x,y,z,?,x,..."
    spline.points.foreach_set('co', verts)
    new_obj = object_data_add(context, curve_data)
项目:bpy_lambda    作者:bcongdon    | 项目源码 | 文件源码
def execute(self,context):
        props = self.properties
        R = props.R
        ob = context.object
        layers = 20*[False]
        layers[0] = True
        if ob:
            if ob.pov.imported_cyl_loc:
                LOC = ob.pov.imported_cyl_loc
            if ob.pov.imported_cyl_loc_cap:
                LOC_CAP = ob.pov.imported_cyl_loc_cap
        else:
            if not props.imported_cyl_loc:
                LOC_CAP = LOC = bpy.context.scene.cursor_location
                LOC_CAP[2] += 2.0
            else:
                LOC = props.imported_cyl_loc
                LOC_CAP = props.imported_cyl_loc_cap
            self.report({'INFO'}, "This native POV-Ray primitive "
                                     "won't have any vertex to show in edit mode")

        pov_cylinder_define(context, self, None, self.R, LOC, LOC_CAP)

        return {'FINISHED'}
项目:bpy_lambda    作者:bcongdon    | 项目源码 | 文件源码
def execute(self, context):
        props = context.scene.muv_props.texlock
        obj = bpy.context.active_object
        bm = bmesh.from_edit_mesh(obj.data)
        if muv_common.check_version(2, 73, 0) >= 0:
            bm.verts.ensure_lookup_table()
            bm.edges.ensure_lookup_table()
            bm.faces.ensure_lookup_table()

        if not bm.loops.layers.uv:
            self.report(
                {'WARNING'}, "Object must have more than one UV map")
            return {'CANCELLED'}

        props.verts_orig = [
            {"vidx": v.index, "vco": v.co.copy(), "moved": False}
            for v in bm.verts if v.select]

        return {'FINISHED'}
项目:bpy_lambda    作者:bcongdon    | 项目源码 | 文件源码
def draw(self, context):
        layout = self.layout
        layout.operator_context = 'INVOKE_REGION_WIN'
        props = layout.operator("view3d.enable_manipulator", text='Translate', icon='MAN_TRANS')
        props.translate = True
        props = layout.operator("view3d.enable_manipulator", text='Rotate', icon='MAN_ROT')
        props.rotate = True
        props = layout.operator("view3d.enable_manipulator", text='Scale', icon='MAN_SCALE')
        props.scale = True
        UseSeparator(self, context)
        props = layout.operator("view3d.enable_manipulator", text='Combo', icon='MAN_SCALE')
        props.scale = True
        props.rotate = True
        props.translate = True
        props = layout.operator("view3d.enable_manipulator", text='Hide', icon='MAN_SCALE')
        props.scale = False
        props.rotate = False
        props.translate = False


# ********** Object Mirror **********
项目:bpy_lambda    作者:bcongdon    | 项目源码 | 文件源码
def draw(self, context):
        from math import pi
        layout = self.layout
        layout.operator_enum("view3d.view_orbit", "type")
        props = layout.operator("view3d.view_orbit", "Orbit Opposite")
        props.type = 'ORBITRIGHT'
        props.angle = pi

        UseSeparator(self, context)
        layout.operator("view3d.view_roll", text="Roll Left").type = 'LEFT'
        layout.operator("view3d.view_roll", text="Roll Right").type = 'RIGHT'
        UseSeparator(self, context)
        layout.operator_enum("view3d.view_pan", "type")
        UseSeparator(self, context)
        layout.operator("view3d.zoom", text="Zoom In").delta = 1
        layout.operator("view3d.zoom", text="Zoom Out").delta = -1
        UseSeparator(self, context)
        layout.operator("view3d.zoom_camera_1_to_1", text="Zoom Camera 1:1")
        UseSeparator(self, context)
        layout.operator("view3d.fly")
        layout.operator("view3d.walk")
项目:bpy_lambda    作者:bcongdon    | 项目源码 | 文件源码
def draw(self, context):
        layout = self.layout
        props = layout.operator("view3d.viewnumpad", text="Top")
        props.align_active = True
        props.type = 'TOP'
        props = layout.operator("view3d.viewnumpad", text="Bottom")
        props.align_active = True
        props.type = 'BOTTOM'
        props = layout.operator("view3d.viewnumpad", text="Front")
        props.align_active = True
        props.type = 'FRONT'
        props = layout.operator("view3d.viewnumpad", text="Back")
        props.align_active = True
        props.type = 'BACK'
        props = layout.operator("view3d.viewnumpad", text="Right")
        props.align_active = True
        props.type = 'RIGHT'
        props = layout.operator("view3d.viewnumpad", text="Left")
        props.align_active = True
        props.type = 'LEFT'
项目:bpy_lambda    作者:bcongdon    | 项目源码 | 文件源码
def draw(self, context):
        layout = self.layout
        layout.operator("view3d.select_border")
        layout.operator("armature.select_all")
        layout.operator("armature.select_inverse", text="Inverse")
        layout.operator("armature.select_hierarchy",
                        text="Parent").direction = 'PARENT'
        layout.operator("armature.select_hierarchy",
                        text="Child").direction = 'CHILD'
        props = layout.operator("armature.select_hierarchy",
                                text="Extend Parent")
        props.extend = True
        props.direction = 'PARENT'
        props = layout.operator("armature.select_hierarchy",
                                text="Extend Child")
        props.extend = True
        props.direction = 'CHILD'
        layout.operator("object.select_pattern", text="Select Pattern...")
项目:bpy_lambda    作者:bcongdon    | 项目源码 | 文件源码
def draw(self, context):
        layout = self.layout
        props = layout.operator("pose.select_hierarchy", text="Parent")
        props.extend = False
        props.direction = 'PARENT'

        props = layout.operator("pose.select_hierarchy", text="Child")
        props.extend = False
        props.direction = 'CHILD'

        props = layout.operator("pose.select_hierarchy", text="Extend Parent")
        props.extend = True
        props.direction = 'PARENT'

        props = layout.operator("pose.select_hierarchy", text="Extend Child")
        props.extend = True
        props.direction = 'CHILD'
项目:archipack    作者:s-leger    | 项目源码 | 文件源码
def execute(self, context):
        if context.mode == "OBJECT":
            o = context.active_object
            props = archipack_reference_point.datablock(o)
            if props is None:
                return {'CANCELLED'}
            bpy.ops.object.select_all(action="DESELECT")
            bpy.ops.archipack.reference_point(location_3d=props.location_3d)
            for child in o.children:
                child.select = True
            bpy.ops.archipack.parent_to_reference()
            context.scene.objects.unlink(o)
            return {'FINISHED'}
        else:
            self.report({'WARNING'}, "Archipack: Option only valid in Object mode")
            return {'CANCELLED'}
项目:armature-panel    作者:proxeIO    | 项目源码 | 文件源码
def register():
    '''
        Register
    '''

    # register module
    registerModule = bpy.utils.register_module

    # window manager
    windowManager = bpy.types.WindowManager

    # pointer property
    pointerProperty = bpy.props.PointerProperty

    # register
    registerModule(__name__)

    # armature data ui pointer property
    windowManager.armatureDataUI = pointerProperty(type=armatureData)

    # button
    bpy.types.BONE_PT_display.append(button)

    # Unregister
项目:blender-addons    作者:scorpion81    | 项目源码 | 文件源码
def draw_curve(props, context):
    if props.spiral_type == 1:
        verts = make_spiral(props, context)
    if props.spiral_type == 2:
        verts = make_spiral(props, context)
    if props.spiral_type == 3:
        verts = make_spiral_spheric(props, context)
    if props.spiral_type == 4:
        verts = make_spiral_torus(props, context)

    curve_data = bpy.data.curves.new(name='Spiral', type='CURVE')
    curve_data.dimensions = '3D'

    if props.curve_type == 0:
        spline = curve_data.splines.new(type='POLY')
    elif props.curve_type == 1:
        spline = curve_data.splines.new(type='NURBS')

    spline.points.add( len(verts)*0.25-1 )                          #Add only one quarter of points as elements in verts, because verts looks like: "x,y,z,?,x,y,z,?,x,..."
    spline.points.foreach_set('co', verts)
    new_obj = object_data_add(context, curve_data)
项目:UPBGE-CommunityAddon    作者:elmeunick9    | 项目源码 | 文件源码
def register():
    bpy.utils.register_class(ListItem)
    bpy.utils.register_class(MY_UL_List)
    bpy.utils.register_class(LIST_OT_NewItem)
    bpy.utils.register_class(LIST_OT_DeleteItem)
    bpy.utils.register_class(PT_FiltersList)

    bpy.types.Scene.my_list = prop.CollectionProperty(type = ListItem)
    bpy.types.Scene.list_index = prop.IntProperty(name = "Index for my_list", default = 0)
    bpy.types.Scene.aas=bpy.props.EnumProperty(items=populateFilterSelector, name="2DFilter")
项目:CatHide-Addon-for-Blender    作者:samytichadou    | 项目源码 | 文件源码
def register():
    bpy.utils.register_class(CatHideUIList)
    bpy.utils.register_class(CatHidePanel)
    bpy.utils.register_class(CathideRefresh)
    bpy.utils.register_class(CathideApply)
    bpy.utils.register_class(CatHidePanelList)
    bpy.types.Scene.panel_cathide_list = \
        bpy.props.CollectionProperty(type=CatHidePanelList)
    bpy.types.Scene.cathide_index = IntProperty()
项目:CatHide-Addon-for-Blender    作者:samytichadou    | 项目源码 | 文件源码
def register():
    bpy.utils.register_class(CatHideUIList)
    bpy.utils.register_class(CatHideSpecificUIList)
    bpy.utils.register_class(CatHidePresetUIList)
    bpy.utils.register_class(CatHidePanel)
    bpy.utils.register_class(CathideRefresh)
    bpy.utils.register_class(CathideApply)
    bpy.utils.register_class(CathideApplySpecific)
    bpy.utils.register_class(CathidePresetAdd)
    bpy.utils.register_class(CathidePresetDelete)
    bpy.utils.register_class(CathidePresetClear)
    bpy.utils.register_class(CathideApplyPreset)
    bpy.utils.register_class(CathideResetCatOnly)
    bpy.utils.register_class(CathideResetPanelOnly)
    bpy.utils.register_class(CatHidePanelList)
    bpy.types.Scene.cathide_panel_list = \
        bpy.props.CollectionProperty(type=CatHidePanelList)
    bpy.types.Scene.cathide_index = IntProperty()
    bpy.utils.register_class(CatHideSpecificPanelList)
    bpy.types.Scene.cathide_specific_panel_list = \
        bpy.props.CollectionProperty(type=CatHideSpecificPanelList)
    bpy.types.Scene.cathide_specific_index = IntProperty()
    bpy.utils.register_class(CatHidePresetList)
    bpy.types.Scene.cathide_preset_list = \
        bpy.props.CollectionProperty(type=CatHidePresetList)
    bpy.types.Scene.cathide_preset_index = IntProperty()
    bpy.types.Scene.cathide_show_specific = BoolProperty()
    bpy.types.Scene.cathide_show_specific_details = BoolProperty()
    bpy.types.Scene.cathide_show_preset = BoolProperty()
    bpy.types.Scene.cathide_show_presetcatdetails = BoolProperty()
    bpy.types.Scene.cathide_show_presetspaneldetails = BoolProperty()
项目:Sverchok    作者:Sverchok    | 项目源码 | 文件源码
def draw_buttons(self, context, layout):
        props = self.compile().properties

        for name in props.keys():
            layout.prop(self, name)
项目:Sverchok    作者:Sverchok    | 项目源码 | 文件源码
def draw_buttons(self, context, layout):
        props = self.get_cls(self.bl_idname).properties

        for name in props.keys():
            layout.prop(self, name)
项目:Sverchok    作者:Sverchok    | 项目源码 | 文件源码
def stateful(cls):
    """
    class decorator for creating stateful class
    """
    func = cls()
    get_signature(func)
    module_name = func.__module__.split(".")[-2]
    props = {}
    for name, prop in getattr(cls, 'properties', {}).items():
        if isinstance(prop, SvRxBaseTypeP):
            props[name] = prop.get_prop()
        else:
            props[name] = prop

    props.update(func.properties)

    class InnerStateful(cls, Stateful):
        category = module_name
        inputs_template = func.inputs_template.copy()
        outputs_template = func.outputs_template.copy()
        properties = props.copy()
        parameters = func.parameters.copy()
        returns = func.returns.copy()

    func_new = InnerStateful()
    class_factory(func_new)
    InnerStateful.node_cls = func_new.cls

    NodeStateful.add_cls(cls.bl_idname, InnerStateful)
    return InnerStateful
项目:freesound    作者:iwkse    | 项目源码 | 文件源码
def register():
    bpy.utils.register_module(__name__)
# Extend the scene class here to include the addon data
    bpy.types.Scene.freesound_data = bpy.props.PointerProperty(type=FreeSoundData)
项目:bpy_lambda    作者:bcongdon    | 项目源码 | 文件源码
def banner(context):
    sc = context.space_data
    version_string = sys.version.strip().replace('\n', ' ')

    add_scrollback("PYTHON INTERACTIVE CONSOLE %s" % version_string, 'OUTPUT')
    add_scrollback("", 'OUTPUT')
    add_scrollback("Command History:     Up/Down Arrow", 'OUTPUT')
    add_scrollback("Cursor:              Left/Right Home/End", 'OUTPUT')
    add_scrollback("Remove:              Backspace/Delete", 'OUTPUT')
    add_scrollback("Execute:             Enter", 'OUTPUT')
    add_scrollback("Autocomplete:        Ctrl-Space", 'OUTPUT')
    add_scrollback("Zoom:                Ctrl +/-, Ctrl-Wheel", 'OUTPUT')
    add_scrollback("Builtin Modules:     bpy, bpy.data, bpy.ops, "
                   "bpy.props, bpy.types, bpy.context, bpy.utils, "
                   "bgl, blf, mathutils",
                   'OUTPUT')
    add_scrollback("Convenience Imports: from mathutils import *; "
                   "from math import *", 'OUTPUT')
    add_scrollback("Convenience Variables: C = bpy.context, D = bpy.data",
                   'OUTPUT')
    add_scrollback("", 'OUTPUT')
    sc.prompt = PROMPT

    return {'FINISHED'}


# workaround for readline crashing, see: T43491
项目:bpy_lambda    作者:bcongdon    | 项目源码 | 文件源码
def register():
    bpy.utils.register_module(__name__)
    bpy.types.Scene.atom_cluster = bpy.props.PointerProperty(type=
                                                  CLASS_atom_cluster_Properties)
    bpy.types.INFO_MT_mesh_add.append(DEF_menu_func)
项目:bpy_lambda    作者:bcongdon    | 项目源码 | 文件源码
def find_datablock_in_selection(self, context):
        """
            find witch selected object this instance belongs to
            provide support for "copy to selected"
        """
        selected = [o for o in context.selected_objects]
        for o in selected:
            props = archipack_fence.datablock(o)
            if props:
                for part in props.rail_mat:
                    if part == self:
                        return props
        return None
项目:bpy_lambda    作者:bcongdon    | 项目源码 | 文件源码
def update(self, context):
        props = self.find_datablock_in_selection(context)
        if props is not None:
            props.update(context)
项目:bpy_lambda    作者:bcongdon    | 项目源码 | 文件源码
def update(self, context, manipulable_refresh=False):
        props = self.find_datablock_in_selection(context)
        if props is not None:
            props.update(context, manipulable_refresh)
项目:bpy_lambda    作者:bcongdon    | 项目源码 | 文件源码
def find_in_selection(self, context):
        """
            find witch selected object this instance belongs to
            provide support for "copy to selected"
        """
        selected = [o for o in context.selected_objects]
        for o in selected:
            props = archipack_roof.datablock(o)
            if props:
                for part in props.rail_mat:
                    if part == self:
                        return props
        return None
项目:bpy_lambda    作者:bcongdon    | 项目源码 | 文件源码
def update(self, context):
        props = self.find_in_selection(context)
        if props is not None:
            props.update(context)
项目:bpy_lambda    作者:bcongdon    | 项目源码 | 文件源码
def update(self, context, manipulable_refresh=False):
        props = self.find_in_selection(context)
        if props is not None:
            props.update(context, manipulable_refresh)
项目:bpy_lambda    作者:bcongdon    | 项目源码 | 文件源码
def update(self, context, manipulable_refresh=False):
        props = self.find_in_selection(context)
        if props is not None:
            props.update(context, manipulable_refresh)
项目:bpy_lambda    作者:bcongdon    | 项目源码 | 文件源码
def find_in_selection(self, context):
        """
            find witch selected object this instance belongs to
            provide support for "copy to selected"
        """
        selected = [o for o in context.selected_objects]
        for o in selected:
            props = archipack_roof.datablock(o)
            if props and props.boundary == self:
                    return props
        return None
项目:bpy_lambda    作者:bcongdon    | 项目源码 | 文件源码
def find_in_selection(self, context):
        """
            find witch selected object this instance belongs to
            provide support for "copy to selected"
        """
        selected = [o for o in context.selected_objects]
        for o in selected:
            props = archipack_roof.datablock(o)
            if props:
                for part in props.axis.parts:
                    if part == self:
                        return props.axis
        return None
项目:bpy_lambda    作者:bcongdon    | 项目源码 | 文件源码
def find_in_selection(self, context):
        """
            find witch selected object this instance belongs to
            provide support for "copy to selected"
        """
        selected = [o for o in context.selected_objects]
        for o in selected:
            props = archipack_roof.datablock(o)
            if props and props.axis == self:
                    return props
        return None
项目:bpy_lambda    作者:bcongdon    | 项目源码 | 文件源码
def find_in_selection(self, context):
        """
            find witch selected object this instance belongs to
            provide support for "copy to selected"
        """
        selected = [o for o in context.selected_objects]
        for o in selected:
            props = archipack_slab.datablock(o)
            if props:
                for part in props.rail_mat:
                    if part == self:
                        return props
        return None
项目:bpy_lambda    作者:bcongdon    | 项目源码 | 文件源码
def update(self, context):
        props = self.find_in_selection(context)
        if props is not None:
            props.update(context)
项目:bpy_lambda    作者:bcongdon    | 项目源码 | 文件源码
def find_in_selection(self, context):
        """
            find witch selected object this instance belongs to
            provide support for "copy to selected"
        """
        selected = [o for o in context.selected_objects]
        for o in selected:
            props = archipack_slab.datablock(o)
            if props:
                for part in props.parts:
                    if part == self:
                        return props
        return None
项目:bpy_lambda    作者:bcongdon    | 项目源码 | 文件源码
def find_datablock_in_selection(self, context):
        """
            find witch selected object this instance belongs to
            provide support for "copy to selected"
        """
        selected = [o for o in context.selected_objects]
        for o in selected:
            props = archipack_wall2.datablock(o)
            if props:
                for part in props.parts:
                    if part == self:
                        return props
        return None
项目:bpy_lambda    作者:bcongdon    | 项目源码 | 文件源码
def update(self, context, manipulable_refresh=False):
        if not self.auto_update:
            return
        props = self.find_datablock_in_selection(context)
        if props is not None:
            props.update(context, manipulable_refresh)
项目:bpy_lambda    作者:bcongdon    | 项目源码 | 文件源码
def preset_values(self):
        blacklist = self.blacklist
        blacklist.extend(bpy.types.Mesh.bl_rna.properties.keys())
        d = getattr(bpy.context.active_object.data, self.preset_subdir)[0]
        props = d.rna_type.bl_rna.properties.items()
        ret = []
        for prop_id, prop in props:
            if prop_id not in blacklist:
                if not (prop.is_hidden or prop.is_skip_save):
                    ret.append("d.%s" % prop_id)
        return ret
项目:bpy_lambda    作者:bcongdon    | 项目源码 | 文件源码
def draw(self, context):
        o = context.active_object
        props = archipack_reference_point.datablock(o)
        if props is None:
            return
        layout = self.layout
        if (o.location - props.location_2d).length < 0.01:
            layout.operator('archipack.move_to_3d')
            layout.operator('archipack.move_2d_reference_to_cursor')
        else:
            layout.operator('archipack.move_to_2d')

        layout.prop(props, 'symbol_scale')
项目:bpy_lambda    作者:bcongdon    | 项目源码 | 文件源码
def execute(self, context):
        if context.mode == "OBJECT":
            o = context.active_object
            props = archipack_reference_point.datablock(o)
            if props is None:
                return {'CANCELLED'}
            props.location_3d = o.location
            o.location = props.location_2d
            return {'FINISHED'}
        else:
            self.report({'WARNING'}, "Archipack: Option only valid in Object mode")
            return {'CANCELLED'}