python类props()的实例源码

console_python.py 文件源码 项目:bpy_lambda 作者: bcongdon 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
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
__init__.py 文件源码 项目:bpy_lambda 作者: bcongdon 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
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)
archipack_fence.py 文件源码 项目:bpy_lambda 作者: bcongdon 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
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
archipack_fence.py 文件源码 项目:bpy_lambda 作者: bcongdon 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def update(self, context):
        props = self.find_datablock_in_selection(context)
        if props is not None:
            props.update(context)
archipack_fence.py 文件源码 项目:bpy_lambda 作者: bcongdon 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def update(self, context, manipulable_refresh=False):
        props = self.find_datablock_in_selection(context)
        if props is not None:
            props.update(context, manipulable_refresh)
archipack_roof2d.py 文件源码 项目:bpy_lambda 作者: bcongdon 项目源码 文件源码 阅读 17 收藏 0 点赞 0 评论 0
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
archipack_roof2d.py 文件源码 项目:bpy_lambda 作者: bcongdon 项目源码 文件源码 阅读 16 收藏 0 点赞 0 评论 0
def update(self, context):
        props = self.find_in_selection(context)
        if props is not None:
            props.update(context)
archipack_roof2d.py 文件源码 项目:bpy_lambda 作者: bcongdon 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def update(self, context, manipulable_refresh=False):
        props = self.find_in_selection(context)
        if props is not None:
            props.update(context, manipulable_refresh)
archipack_roof2d.py 文件源码 项目:bpy_lambda 作者: bcongdon 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def update(self, context, manipulable_refresh=False):
        props = self.find_in_selection(context)
        if props is not None:
            props.update(context, manipulable_refresh)
archipack_roof2d.py 文件源码 项目:bpy_lambda 作者: bcongdon 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
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
archipack_roof2d.py 文件源码 项目:bpy_lambda 作者: bcongdon 项目源码 文件源码 阅读 15 收藏 0 点赞 0 评论 0
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
archipack_roof2d.py 文件源码 项目:bpy_lambda 作者: bcongdon 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
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
archipack_slab.py 文件源码 项目:bpy_lambda 作者: bcongdon 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
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
archipack_slab.py 文件源码 项目:bpy_lambda 作者: bcongdon 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def update(self, context):
        props = self.find_in_selection(context)
        if props is not None:
            props.update(context)
archipack_slab.py 文件源码 项目:bpy_lambda 作者: bcongdon 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
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
archipack_wall2.py 文件源码 项目:bpy_lambda 作者: bcongdon 项目源码 文件源码 阅读 16 收藏 0 点赞 0 评论 0
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
archipack_wall2.py 文件源码 项目:bpy_lambda 作者: bcongdon 项目源码 文件源码 阅读 17 收藏 0 点赞 0 评论 0
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)
archipack_preset.py 文件源码 项目:bpy_lambda 作者: bcongdon 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
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
archipack_reference_point.py 文件源码 项目:bpy_lambda 作者: bcongdon 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
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')
archipack_reference_point.py 文件源码 项目:bpy_lambda 作者: bcongdon 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
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'}


问题


面经


文章

微信
公众号

扫码关注公众号