当前位置: 首页>>代码示例>>Python>>正文


Python bpy.types方法代码示例

本文整理汇总了Python中bpy.types方法的典型用法代码示例。如果您正苦于以下问题:Python bpy.types方法的具体用法?Python bpy.types怎么用?Python bpy.types使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在bpy的用法示例。


在下文中一共展示了bpy.types方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: SetObjScale

# 需要导入模块: import bpy [as 别名]
# 或者: from bpy import types [as 别名]
def SetObjScale(scn): 
     
     bpy.types.Scene.UEObjScale = BoolProperty(
        name = "Scale Selected Objects",update = ObjScale_Callback,
        description = "True or False?")        
     scn['UEObjScale'] = ObjScale
     return


#-------------------------------------------
#---------SCENE SETTINGS FUNCTIONS----------
#-------------------------------------------




#-------------------------------------------
#---------BATCH RENAME CALLBACKS-----------
#-------------------------------------------

#base name callback 
开发者ID:lluisgarcia,项目名称:UE4-Tools,代码行数:23,代码来源:ue_tools_v1-2-4.py

示例2: Animation_UI_Properties

# 需要导入模块: import bpy [as 别名]
# 或者: from bpy import types [as 别名]
def Animation_UI_Properties(scn):  
      
    #Show Rig Options
    bpy.types.Scene.UE_Show_Rig_Props= BoolProperty(
        name = "Show Rig Options",
        default=True,
        update = UE_Show_Rig_Props_Callback, 
        description = "Show The options for the RIG")
    scn['UE_Show_Rig_Props'] = True 
    
    #Show Rig Export Options
    bpy.types.Scene.UE_Show_Export_options= BoolProperty(
        name = "Show Export Options",
        default=False,
        update = UE_Show_Export_option_Callback, 
        description = "Show Export Options for customize the fbx name,folder and scale")
    scn['UE_Show_Export_options'] = False

     
   
#Rig Callbacks  UE_ShowAdvanced_Rig_Prop_Callback 
开发者ID:lluisgarcia,项目名称:UE4-Tools,代码行数:23,代码来源:ue_tools_v1-2-4.py

示例3: add_root_curves

# 需要导入模块: import bpy [as 别名]
# 或者: from bpy import types [as 别名]
def add_root_curves(action: bpy.types.Action):
    rootmotion_name = bpy.context.scene.godot_game_tools.rootmotion_name
    if action.fcurves.find('pose.bones["{}"].location'.format(rootmotion_name)) is None:
        x_curve = action.fcurves.new(data_path='pose.bones["{}"].location'.format(rootmotion_name), index=0, action_group="RootMotion")
        x_hips = action.fcurves[0]
        x_offset = x_hips.keyframe_points[0].co[1]
        for frame_index, keyframe_point in enumerate(x_hips.keyframe_points):
            kf = x_curve.keyframe_points.insert(frame=keyframe_point.co[0], value=keyframe_point.co[1]-x_offset, options={'FAST'}, keyframe_type='KEYFRAME')
            kf.interpolation = 'LINEAR'
        y_curve = action.fcurves.new(data_path='pose.bones["{}"].location'.format(rootmotion_name), index=1, action_group="RootMotion")
        y_hips = action.fcurves[1]
        y_offset = y_hips.keyframe_points[0].co[1]
        for frame_index, keyframe_point in enumerate(y_hips.keyframe_points):
            kf = y_curve.keyframe_points.insert(frame=keyframe_point.co[0], value=keyframe_point.co[1]-y_offset, options={'FAST'}, keyframe_type='KEYFRAME')
            kf.interpolation = 'LINEAR'
        z_curve = action.fcurves.new(data_path='pose.bones["{}"].location'.format(rootmotion_name), index=2, action_group="RootMotion")
        z_hips = action.fcurves[2]
        z_offset = z_hips.keyframe_points[0].co[1]
        for frame_index, keyframe_point in enumerate(z_hips.keyframe_points):
            kf = z_curve.keyframe_points.insert(frame=keyframe_point.co[0], value=keyframe_point.co[1]-z_offset, options={'FAST'}, keyframe_type='KEYFRAME')
            kf.interpolation = 'LINEAR'
        # print('Added Root Motion Curves to action {}'.format(action.name)) 
开发者ID:vini-guerrero,项目名称:Godot_Game_Tools,代码行数:24,代码来源:rootmotion_controller.py

示例4: import_from_folder

# 需要导入模块: import bpy [as 别名]
# 或者: from bpy import types [as 别名]
def import_from_folder(self, path, context):
        extensions = ['fbx']
        filenames = sorted(os.listdir(path))
        valid_files = []
        fileNamesList = []

        for filename in filenames:
            for ext in extensions:
                if filename.lower().endswith('.{}'.format(ext)):
                    valid_files.append(filename)
                    break

        for name in valid_files:
            file_path = os.path.join(path, name)
            extension = (os.path.splitext(file_path)[1])[1:].lower()

            if ext == "fbx":
                if hasattr(bpy.types, bpy.ops.import_scene.fbx.idname()):
                    actionName, actionExtension = os.path.splitext(name)
                    if actionName == "T-Pose":
                        # Local Variable
                        fileNamesList.append(actionName)
                        bpy.ops.import_scene.fbx(filepath = file_path) 
开发者ID:vini-guerrero,项目名称:Godot_Game_Tools,代码行数:25,代码来源:mixamo_controller.py

示例5: register

# 需要导入模块: import bpy [as 别名]
# 或者: from bpy import types [as 别名]
def register():
    main_register()
    scene_define()
    module_register()
    custom_register()
    existing_shapekey_merger = operator_exists(ApplyModifierForObjectWithShapeKeysOperator.bl_idname)
    if  existing_shapekey_merger == False:
        print ("Registering bundled ApplyModifierForObjectWithShapeKeysOperator")
        bpy.utils.register_class(ApplyModifierForObjectWithShapeKeysOperator)
    else: 
        print ("Existing ApplyModifierForObjectWithShapeKeysOperator found")
        existing_shapekey_merger = True

    bpy.types.TOPBAR_MT_file_import.append(menu_func_import)
    bpy.types.TOPBAR_MT_file_export.append(menu_func_export)
    ui.register_operators() 
开发者ID:Menithal,项目名称:Blender-Metaverse-Addon,代码行数:18,代码来源:__init__.py

示例6: get_location

# 需要导入模块: import bpy [as 别名]
# 或者: from bpy import types [as 别名]
def get_location(self):
        op_class = getattr(bpy.types, self.identifier)
        op_func = getattr(op_class, "execute", None)
        if op_func is None:
            op_func = getattr(op_class, "invoke", None)
        if op_func is None:
            op_func = getattr(op_class, "poll", None)

        if op_func:
            op_code = op_func.__code__
            source_path = op_code.co_filename

            # clear the prefix
            for p in script_paths:
                source_path = source_path.split(p)[-1]

            if source_path[0] in "/\\":
                source_path = source_path[1:]

            return source_path, op_code.co_firstlineno
        else:
            return None, None 
开发者ID:Microvellum,项目名称:Fluid-Designer,代码行数:24,代码来源:rna_info.py

示例7: invoke

# 需要导入模块: import bpy [as 别名]
# 或者: from bpy import types [as 别名]
def invoke(self, context, event):
        wm = context.window_manager
        
        for obj in bpy.context.scene.objects:
            if obj.type == 'CURVE' and obj.parent:
                obj.select = True
                bpy.context.scene.objects.active = obj
                bpy.ops.object.convert(target='MESH')
                bpy.ops.object.select_all(action='DESELECT')
                #these also need to be unwraped correctly
            
            if obj.type == 'MESH':
                if len(obj.data.vertices) > 1:
                    self.objects.append(obj)   
        
        self._timer = wm.event_timer_add(0.001, context.window)
        wm.modal_handler_add(self)
        if context.area.type == 'VIEW_3D':
            args = (self, context)
            self._handle = bpy.types.SpaceView3D.draw_handler_add(utils.draw_callback_px, args, 'WINDOW', 'POST_PIXEL')
            self.mouse_loc = []
            self.mouse_text = "Preparing Object "  + str(self.current_item + 1) + " of " + str(len(self.objects))
            self.header_text = "Preparing Object " + str(self.current_item + 1) + " of " + str(len(self.objects))
        return {'RUNNING_MODAL'} 
开发者ID:Microvellum,项目名称:Fluid-Designer,代码行数:26,代码来源:fd_scene.py

示例8: node_enum_items

# 需要导入模块: import bpy [as 别名]
# 或者: from bpy import types [as 别名]
def node_enum_items(self, context):
        enum_items = NODE_OT_add_search._enum_item_hack
        enum_items.clear()

        for index, item in enumerate(nodeitems_utils.node_items_iter(context)):
            if isinstance(item, nodeitems_utils.NodeItem):
                nodetype = getattr(bpy.types, item.nodetype, None)
                if nodetype:
                    enum_items.append(
                            (str(index),
                             item.label,
                             nodetype.bl_rna.description,
                             index,
                             ))
        return enum_items

    # Look up the item based on index 
开发者ID:Microvellum,项目名称:Fluid-Designer,代码行数:19,代码来源:node.py

示例9: operator_value_is_undo

# 需要导入模块: import bpy [as 别名]
# 或者: from bpy import types [as 别名]
def operator_value_is_undo(value):
    if value in {None, Ellipsis}:
        return False

    # typical properties or objects
    id_data = getattr(value, "id_data", Ellipsis)

    if id_data is None:
        return False
    elif id_data is Ellipsis:
        # handle mathutils types
        id_data = getattr(getattr(value, "owner", None), "id_data", None)

        if id_data is None:
            return False

    # return True if its a non window ID type
    return (isinstance(id_data, bpy.types.ID) and
            (not isinstance(id_data, (bpy.types.WindowManager,
                                      bpy.types.Screen,
                                      bpy.types.Brush,
                                      )))) 
开发者ID:Microvellum,项目名称:Fluid-Designer,代码行数:24,代码来源:wm.py

示例10: execute

# 需要导入模块: import bpy [as 别名]
# 或者: from bpy import types [as 别名]
def execute(self, context):
        from os.path import basename, splitext
        filepath = self.filepath

        # change the menu title to the most recently chosen option
        preset_class = getattr(bpy.types, self.menu_idname)
        preset_class.bl_label = bpy.path.display_name(basename(filepath))

        ext = splitext(filepath)[1].lower()

        # execute the preset using script.python_file_run
        if ext == ".py":
            bpy.ops.script.python_file_run(filepath=filepath)
        elif ext == ".xml":
            import rna_xml
            rna_xml.xml_file_run(context,
                                 filepath,
                                 preset_class.preset_xml_map)
        else:
            self.report({'ERROR'}, "unknown filetype: %r" % ext)
            return {'CANCELLED'}

        return {'FINISHED'} 
开发者ID:Microvellum,项目名称:Fluid-Designer,代码行数:25,代码来源:presets.py

示例11: draw_display_safe_settings

# 需要导入模块: import bpy [as 别名]
# 或者: from bpy import types [as 别名]
def draw_display_safe_settings(layout, safe_data, settings):
    show_safe_areas = settings.show_safe_areas
    show_safe_center = settings.show_safe_center

    split = layout.split()

    col = split.column()
    row = col.row(align=True)
    row.menu("SAFE_AREAS_MT_presets", text=bpy.types.SAFE_AREAS_MT_presets.bl_label)
    row.operator("safe_areas.preset_add", text="", icon='ZOOMIN')
    row.operator("safe_areas.preset_add", text="", icon='ZOOMOUT').remove_active = True

    col = split.column()
    col.prop(settings, "show_safe_center", text="Center-Cut Safe Areas")

    split = layout.split()
    col = split.column()
    col.active = show_safe_areas
    col.prop(safe_data, "title", slider=True)
    col.prop(safe_data, "action", slider=True)

    col = split.column()
    col.active = show_safe_areas and show_safe_center
    col.prop(safe_data, "title_center", slider=True)
    col.prop(safe_data, "action_center", slider=True) 
开发者ID:Microvellum,项目名称:Fluid-Designer,代码行数:27,代码来源:properties_data_camera.py

示例12: draw

# 需要导入模块: import bpy [as 别名]
# 或者: from bpy import types [as 别名]
def draw(self, context):
        layout = self.layout
        node = context.active_node
        # set "node" context pointer for the panel layout
        layout.context_pointer_set("node", node)

        if hasattr(node, "draw_buttons_ext"):
            node.draw_buttons_ext(context, layout)
        elif hasattr(node, "draw_buttons"):
            node.draw_buttons(context, layout)

        # XXX this could be filtered further to exclude socket types which don't have meaningful input values (e.g. cycles shader)
        value_inputs = [socket for socket in node.inputs if socket.enabled and not socket.is_linked]
        if value_inputs:
            layout.separator()
            layout.label("Inputs:")
            for socket in value_inputs:
                row = layout.row()
                socket.draw(context, row, node, iface_(socket.name, socket.bl_rna.translation_context))


# Node Backdrop options 
开发者ID:Microvellum,项目名称:Fluid-Designer,代码行数:24,代码来源:space_node.py

示例13: draw

# 需要导入模块: import bpy [as 别名]
# 或者: from bpy import types [as 别名]
def draw(self, context):
        layout = self.layout

        layout.operator(
                "wm.url_open", text="Add-ons Catalog", icon='URL',
                ).url = "http://wiki.blender.org/index.php/Extensions:2.6/Py/Scripts"

        layout.separator()

        layout.operator(
                "wm.url_open", text="How to share your add-on", icon='URL',
                ).url = "http://wiki.blender.org/index.php/Dev:Py/Sharing"
        layout.operator(
                "wm.url_open", text="Add-on Guidelines", icon='URL',
                ).url = "http://wiki.blender.org/index.php/Dev:2.5/Py/Scripts/Guidelines/Addons"
        layout.operator(
                "wm.url_open", text="API Concepts", icon='URL',
                ).url = bpy.types.WM_OT_doc_view._prefix + "/info_quickstart.html"
        layout.operator("wm.url_open", text="Add-on Tutorial", icon='URL',
                ).url = "http://www.blender.org/api/blender_python_api_current/info_tutorial_addon.html" 
开发者ID:Microvellum,项目名称:Fluid-Designer,代码行数:22,代码来源:space_userpref.py

示例14: draw

# 需要导入模块: import bpy [as 别名]
# 或者: from bpy import types [as 别名]
def draw(self, context):
        layout = self.layout

        sc = context.space_data
        clip = sc.clip

        row = layout.row(align=True)
        label = bpy.types.CLIP_MT_camera_presets.bl_label
        row.menu('CLIP_MT_camera_presets', text=label)
        row.operator("clip.camera_preset_add", text="", icon='ZOOMIN')
        row.operator("clip.camera_preset_add", text="",
                     icon='ZOOMOUT').remove_active = True

        col = layout.column(align=True)
        col.label(text="Sensor:")
        col.prop(clip.tracking.camera, "sensor_width", text="Width")
        col.prop(clip.tracking.camera, "pixel_aspect")

        col = layout.column()
        col.label(text="Optical Center:")
        row = col.row()
        row.prop(clip.tracking.camera, "principal", text="")
        col.operator("clip.set_center_principal", text="Center") 
开发者ID:Microvellum,项目名称:Fluid-Designer,代码行数:25,代码来源:space_clip.py

示例15: draw_item

# 需要导入模块: import bpy [as 别名]
# 或者: from bpy import types [as 别名]
def draw_item(self, context, layout, data, item, icon, active_data, active_propname, index):
        # assert(isinstance(item, bpy.types.ShapeKey))
        obj = active_data
        # key = data
        key_block = item
        if self.layout_type in {'DEFAULT', 'COMPACT'}:
            split = layout.split(0.66, False)
            split.prop(key_block, "name", text="", emboss=False, icon_value=icon)
            row = split.row(align=True)
            if key_block.mute or (obj.mode == 'EDIT' and not (obj.use_shape_key_edit_mode and obj.type == 'MESH')):
                row.active = False
            if not item.id_data.use_relative:
                row.prop(key_block, "frame", text="", emboss=False)
            elif index > 0:
                row.prop(key_block, "value", text="", emboss=False)
            else:
                row.label(text="")
            row.prop(key_block, "mute", text="", emboss=False)
        elif self.layout_type == 'GRID':
            layout.alignment = 'CENTER'
            layout.label(text="", icon_value=icon) 
开发者ID:Microvellum,项目名称:Fluid-Designer,代码行数:23,代码来源:properties_data_mesh.py


注:本文中的bpy.types方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。