<s> import bpy <EOL> from bpy . types import Operator <EOL> import mmd_tools . core . model as mmd_model <EOL> class AddDisplayItemFrame ( Operator ) : <EOL> bl_idname = '<STR_LIT>' <EOL> bl_label = '<STR_LIT>' <EOL> bl_description = '<STR_LIT>' <EOL> bl_options = { '<STR_LIT>' } <EOL> def execute ( self , context ) : <EOL> obj = context . active_object <EOL> root = mmd_model . Model . findRoot ( obj ) <EOL> mmd_root = root . mmd_root <EOL> item = mmd_root . display_item_frames . add ( ) <EOL> item . name = '<STR_LIT>' <EOL> return { '<STR_LIT>' } <EOL> class RemoveDisplayItemFrame ( Operator ) : <EOL> bl_idname = '<STR_LIT>' <EOL> bl_label = '<STR_LIT>' <EOL> bl_description = '<STR_LIT>' <EOL> bl_options = { '<STR_LIT>' } <EOL> def execute ( self , context ) : <EOL> obj = context . active_object <EOL> root = mmd_model . Model . findRoot ( obj ) <EOL> mmd_root = root . mmd_root <EOL> if not mmd_root . display_item_frames [ mmd_root . active_display_item_frame ] . is_special : <EOL> mmd_root . display_item_frames . remove ( mmd_root . active_display_item_frame ) <EOL> mmd_root . active_display_item_frame -= <NUM_LIT:1> <EOL> return { '<STR_LIT>' } <EOL> class MoveUpDisplayItemFrame ( Operator ) : <EOL> bl_idname = '<STR_LIT>' <EOL> bl_label = '<STR_LIT>' <EOL> bl_description = '<STR_LIT>' <EOL> bl_options = { '<STR_LIT>' } <EOL> def execute ( self , context ) : <EOL> obj = context . active_object <EOL> root = mmd_model . Model . findRoot ( obj ) <EOL> mmd_root = root . mmd_root <EOL> if mmd_root . active_display_item_frame <= <NUM_LIT:0> : <EOL> return { '<STR_LIT>' } <EOL> mmd_root . display_item_frames . move ( mmd_root . active_display_item_frame , mmd_root . active_display_item_frame - <NUM_LIT:1> ) <EOL> mmd_root . active_display_item_frame -= <NUM_LIT:1> <EOL> return { '<STR_LIT>' } <EOL> class MoveDownDisplayItemFrame ( Operator ) : <EOL> bl_idname = '<STR_LIT>' <EOL> bl_label = '<STR_LIT>' <EOL> bl_description = '<STR_LIT>' <EOL> bl_options = { '<STR_LIT>' } <EOL> def execute ( self , context ) : <EOL> obj = context . active_object <EOL> root = mmd_model . Model . findRoot ( obj ) <EOL> mmd_root = root . mmd_root <EOL> if len ( mmd_root . display_item_frames ) - <NUM_LIT:1> <= mmd_root . active_display_item_frame : <EOL> return { '<STR_LIT>' } <EOL> mmd_root . display_item_frames . move ( mmd_root . active_display_item_frame , mmd_root . active_display_item_frame + <NUM_LIT:1> ) <EOL> mmd_root . active_display_item_frame += <NUM_LIT:1> <EOL> return { '<STR_LIT>' } <EOL> class AddDisplayItem ( Operator ) : <EOL> bl_idname = '<STR_LIT>' <EOL> bl_label = '<STR_LIT>' <EOL> bl_description = '<STR_LIT>' <EOL> bl_options = { '<STR_LIT>' } <EOL> def execute ( self , context ) : <EOL> obj = context . active_object <EOL> root = mmd_model . Model . findRoot ( obj ) <EOL> mmd_root = root . mmd_root <EOL> frame = mmd_root . display_item_frames [ mmd_root . active_display_item_frame ] <EOL> item = frame . items . add ( ) <EOL> item . name = '<STR_LIT>' <EOL> return { '<STR_LIT>' } <EOL> class RemoveDisplayItem ( Operator ) : <EOL> bl_idname = '<STR_LIT>' <EOL> bl_label = '<STR_LIT>' <EOL> bl_description = '<STR_LIT>' <EOL> bl_options = { '<STR_LIT>' } <EOL> def execute ( self , context ) : <EOL> obj = context . active_object <EOL> root = mmd_model . Model . findRoot ( obj ) <EOL> mmd_root = root . mmd_root <EOL> frame = mmd_root . display_item_frames [ mmd_root . active_display_item_frame ] <EOL> frame . items . remove ( frame . active_item ) <EOL> frame . active_item -= <NUM_LIT:1> <EOL> return { '<STR_LIT>' } <EOL> class MoveUpDisplayItem ( Operator ) : <EOL> bl_idname = '<STR_LIT>' <EOL> bl_label = '<STR_LIT>' <EOL> bl_description = '<STR_LIT>' <EOL> bl_options = { '<STR_LIT>' } <EOL> def execute ( self , context ) : <EOL> obj = context . active_object <EOL> root = mmd_model . Model . findRoot ( obj ) <EOL> mmd_root = root . mmd_root <EOL> frame = mmd_root . display_item_frames [ mmd_root . active_display_item_frame ] <EOL> if frame . active_item <= <NUM_LIT:0> : <EOL> return { '<STR_LIT>' } <EOL> frame . items . move ( frame . active_item , frame . active_item - <NUM_LIT:1> ) <EOL> frame . active_item -= <NUM_LIT:1> <EOL> return { '<STR_LIT>' } <EOL> class MoveDownDisplayItem ( Operator ) : <EOL> bl_idname = '<STR_LIT>' <EOL> bl_label = '<STR_LIT>' <EOL> bl_description = '<STR_LIT>' <EOL> bl_options = { '<STR_LIT>' } <EOL> def execute ( self , context ) : <EOL> obj = context . active_object <EOL> root = mmd_model . Model . findRoot ( obj ) <EOL> mmd_root = root . mmd_root <EOL> frame = mmd_root . display_item_frames [ mmd_root . active_display_item_frame ] <EOL> if len ( frame . items ) - <NUM_LIT:1> <= frame . active_item : <EOL> return { '<STR_LIT>' } <EOL> frame . items . move ( frame . active_item , frame . active_item + <NUM_LIT:1> ) <EOL> frame . active_item += <NUM_LIT:1> <EOL> return { '<STR_LIT>' } <EOL> class SelectCurrentDisplayItem ( Operator ) : <EOL> bl_idname = '<STR_LIT>' <EOL> bl_label = '<STR_LIT>' <EOL> bl_description = '<STR_LIT>' <EOL> bl_options = { '<STR_LIT>' } <EOL> def execute ( self , context ) : <EOL> obj = context . active_object <EOL> root = mmd_model . Model . findRoot ( obj ) <EOL> rig = mmd_model . Model ( root ) <EOL> mmd_root = root . mmd_root <EOL> try : <EOL> bpy . ops . object . mode_set ( mode = '<STR_LIT>' ) <EOL> except Exception : <EOL> pass <EOL> arm = rig . armature ( ) <EOL> for i in context . scene . objects : <EOL> i . select = False <EOL> arm . hide = False <EOL> arm . select = True <EOL> context . scene . objects . active = arm <EOL> bpy . ops . object . mode_set ( mode = '<STR_LIT>' ) <EOL> frame = mmd_root . display_item_frames [ mmd_root . active_display_item_frame ] <EOL> item = frame . items [ frame . active_item ] <EOL> bone_name = item . name <EOL> for i in arm . pose . bones : <EOL> i . bone . select = ( i . name == bone_name ) <EOL> return { '<STR_LIT>' } </s>
