├── .gitignore ├── Screenshots ├── menu.jpg ├── about.png └── playlist.jpg ├── Miku ├── miku-dancing.coding.io │ ├── battery.png │ ├── resources │ │ └── bgm.mp3 │ ├── models │ │ └── mmd │ │ │ ├── eyeM2.bmp │ │ │ ├── miku_v2.pmd │ │ │ └── wavefile_v2.vmd │ ├── index.html │ ├── lib │ │ ├── MorphAnimation2.js │ │ ├── CCDIKSolver.js │ │ └── MMDLoader.js │ └── main.js ├── Configs │ ├── MikuMainMenuItem.h │ ├── MikuConfigManager.h │ ├── MikuConfigManager.m │ └── MikuMainMenuItem.m ├── HookClasses │ ├── IDESourceCodeEditor+Miku.h │ └── IDESourceCodeEditor+Miku.m ├── Views │ ├── MikuDragView.h │ ├── MikuWebView.h │ ├── MikuWebView.m │ └── MikuDragView.m ├── Miku.h ├── PrefixHeader.pch ├── JRSwizzle │ ├── JRSwizzle.h │ └── JRSwizzle.m ├── XcodeHeaders │ ├── IDESourceCodeEditorContainerView.h │ ├── DVTViewController.h │ ├── IDEViewController.h │ ├── DVTLayoutView_ML.h │ ├── IDEEditor.h │ ├── DVTTextStorage.h │ ├── IDESourceCodeDocument.h │ └── IDESourceCodeEditor.h ├── Miku.m └── Info.plist ├── MikuConfig └── MikuConfig.plist ├── README.md └── Miku.xcodeproj └── project.pbxproj /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | *.xcworkspace 3 | xcuserdata 4 | -------------------------------------------------------------------------------- /Screenshots/menu.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/poboke/Miku/HEAD/Screenshots/menu.jpg -------------------------------------------------------------------------------- /Screenshots/about.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/poboke/Miku/HEAD/Screenshots/about.png -------------------------------------------------------------------------------- /Screenshots/playlist.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/poboke/Miku/HEAD/Screenshots/playlist.jpg -------------------------------------------------------------------------------- /Miku/miku-dancing.coding.io/battery.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/poboke/Miku/HEAD/Miku/miku-dancing.coding.io/battery.png -------------------------------------------------------------------------------- /Miku/miku-dancing.coding.io/resources/bgm.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/poboke/Miku/HEAD/Miku/miku-dancing.coding.io/resources/bgm.mp3 -------------------------------------------------------------------------------- /Miku/miku-dancing.coding.io/models/mmd/eyeM2.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/poboke/Miku/HEAD/Miku/miku-dancing.coding.io/models/mmd/eyeM2.bmp -------------------------------------------------------------------------------- /Miku/miku-dancing.coding.io/models/mmd/miku_v2.pmd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/poboke/Miku/HEAD/Miku/miku-dancing.coding.io/models/mmd/miku_v2.pmd -------------------------------------------------------------------------------- /Miku/miku-dancing.coding.io/models/mmd/wavefile_v2.vmd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/poboke/Miku/HEAD/Miku/miku-dancing.coding.io/models/mmd/wavefile_v2.vmd -------------------------------------------------------------------------------- /Miku/Configs/MikuMainMenuItem.h: -------------------------------------------------------------------------------- 1 | // 2 | // MikuMainMenuItem.h 3 | // ActivatePowerMode 4 | // 5 | // Created by Jobs on 16/1/15. 6 | // Copyright © 2015年 Jobs. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface MikuMainMenuItem : NSMenuItem 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Miku/HookClasses/IDESourceCodeEditor+Miku.h: -------------------------------------------------------------------------------- 1 | // 2 | // IDESourceCodeEditor+Hook.h 3 | // ActivatePowerMode 4 | // 5 | // Created by Jobs on 16/1/11. 6 | // Copyright © 2015年 Jobs. All rights reserved. 7 | // 8 | 9 | #import "IDESourceCodeEditor.h" 10 | 11 | @interface IDESourceCodeEditor (Miku) 12 | 13 | + (void)hookMiku; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /Miku/Views/MikuDragView.h: -------------------------------------------------------------------------------- 1 | // 2 | // MikuDragView.h 3 | // Miku 4 | // 5 | // Created by Jobs on 16/1/11. 6 | // Copyright © 2016年 Jobs. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "MikuWebView.h" 11 | 12 | @interface MikuDragView : NSView 13 | 14 | @property (nonatomic, strong) MikuWebView *mikuWebView; 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /MikuConfig/MikuConfig.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | MusicNames 6 | 7 | bgm1.mp3 8 | bgm2.mp3 9 | bgm3.mp3 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /Miku/Miku.h: -------------------------------------------------------------------------------- 1 | // 2 | // Miku.h 3 | // Miku 4 | // 5 | // Created by Jobs on 16/1/11. 6 | // Copyright © 2016年 Jobs. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "MikuDragView.h" 11 | 12 | @interface Miku : NSObject 13 | 14 | @property (nonatomic, assign, getter=isEnablePlugin) BOOL enablePlugin; 15 | @property (nonatomic, strong) MikuDragView *mikuDragView; 16 | 17 | + (instancetype)sharedPlugin; 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /Miku/PrefixHeader.pch: -------------------------------------------------------------------------------- 1 | // 2 | // PrefixHeader.pch 3 | // Miku 4 | // 5 | // Created by Jobs on 16/1/11. 6 | // Copyright © 2016年 Jobs. All rights reserved. 7 | // 8 | 9 | #ifndef Miku_PrefixHeader_pch 10 | #define Miku_PrefixHeader_pch 11 | 12 | #import 13 | #import "JRSwizzle.h" 14 | 15 | #define PluginVersion ([[NSBundle bundleForClass:[self class]] objectForInfoDictionaryKey:@"CFBundleShortVersionString"]) 16 | 17 | #endif 18 | -------------------------------------------------------------------------------- /Miku/JRSwizzle/JRSwizzle.h: -------------------------------------------------------------------------------- 1 | // JRSwizzle.h semver:1.0 2 | // Copyright (c) 2007-2011 Jonathan 'Wolf' Rentzsch: http://rentzsch.com 3 | // Some rights reserved: http://opensource.org/licenses/MIT 4 | // https://github.com/rentzsch/jrswizzle 5 | 6 | #import 7 | 8 | @interface NSObject (JRSwizzle) 9 | 10 | + (BOOL)jr_swizzleMethod:(SEL)origSel_ withMethod:(SEL)altSel_ error:(NSError**)error_; 11 | + (BOOL)jr_swizzleClassMethod:(SEL)origSel_ withClassMethod:(SEL)altSel_ error:(NSError**)error_; 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Miku/Configs/MikuConfigManager.h: -------------------------------------------------------------------------------- 1 | // 2 | // MikuConfigManager.h 3 | // ActivatePowerMode 4 | // 5 | // Created by Jobs on 16/1/11. 6 | // Copyright © 2015年 Jobs. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface MikuConfigManager : NSObject 12 | 13 | @property (nonatomic, assign, getter=isEnablePlugin) BOOL enablePlugin; 14 | @property (nonatomic, assign, getter=isEnableKeepDancing) BOOL enableKeepDancing; 15 | @property (nonatomic, assign) NSInteger musicType; 16 | 17 | + (instancetype)sharedManager; 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /Miku/Views/MikuWebView.h: -------------------------------------------------------------------------------- 1 | // 2 | // MikuWebView.h 3 | // Miku 4 | // 5 | // Created by Jobs on 16/1/11. 6 | // Copyright © 2016年 Jobs. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | //音乐类型 12 | typedef NS_ENUM(NSUInteger, MikuMusicType) { 13 | MikuMusicTypeDefault, //默认模式,慢动作时音乐播放会变慢 14 | MikuMusicTypeNormal, //正常模式,慢动作时音乐播放不变慢 15 | MikuMusicTypeMute, //静音模式 16 | }; 17 | 18 | @interface MikuWebView : WebView 19 | 20 | - (void)play; 21 | - (void)pause; 22 | - (void)setPlayingTime:(NSInteger)seconds; 23 | - (void)setIsKeepDancing:(BOOL)isKeepDancing; 24 | - (void)setMusicType:(MikuMusicType)musicType; 25 | 26 | @end 27 | -------------------------------------------------------------------------------- /Miku/miku-dancing.coding.io/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | MMD 5 | 6 | 7 | 32 | 33 | 34 | 35 |
36 | 37 |
38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /Miku/XcodeHeaders/IDESourceCodeEditorContainerView.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated by class-dump 3.5 (64 bit). 3 | // 4 | // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard. 5 | // 6 | 7 | #import "DVTLayoutView_ML.h" 8 | #import "IDESourceCodeEditor.h" 9 | 10 | //#import "DVTInvalidation.h" 11 | 12 | @class DVTStackBacktrace, IDESourceCodeEditor, IDEViewController, NSString; 13 | 14 | //@interface IDESourceCodeEditorContainerView : DVTLayoutView_ML 15 | @interface IDESourceCodeEditorContainerView : DVTLayoutView_ML 16 | { 17 | IDESourceCodeEditor *_editor; 18 | IDEViewController *_toolbarViewController; 19 | } 20 | 21 | + (void)initialize; 22 | //- (void).cxx_destruct; 23 | - (void)didCompleteLayout; 24 | @property(retain) IDESourceCodeEditor *editor; // @synthesize editor=_editor; 25 | - (void)primitiveInvalidate; 26 | - (void)showToolbarWithViewController:(id)arg1; 27 | 28 | // Remaining properties 29 | @property(retain) DVTStackBacktrace *creationBacktrace; 30 | @property(readonly, copy) NSString *debugDescription; 31 | @property(readonly, copy) NSString *description; 32 | @property(readonly) unsigned long long hash; 33 | @property(readonly) DVTStackBacktrace *invalidationBacktrace; 34 | @property(readonly) Class superclass; 35 | @property(readonly, nonatomic, getter=isValid) BOOL valid; 36 | 37 | @end 38 | 39 | -------------------------------------------------------------------------------- /Miku/HookClasses/IDESourceCodeEditor+Miku.m: -------------------------------------------------------------------------------- 1 | // 2 | // IDESourceCodeEditor+Hook.m 3 | // ActivatePowerMode 4 | // 5 | // Created by Jobs on 16/1/11. 6 | // Copyright © 2015年 Jobs. All rights reserved. 7 | // 8 | 9 | #import "IDESourceCodeEditor+Miku.h" 10 | #import "Miku.h" 11 | 12 | @implementation IDESourceCodeEditor (Miku) 13 | 14 | + (void)hookMiku 15 | { 16 | [self jr_swizzleMethod:@selector(viewDidLoad) 17 | withMethod:@selector(miku_viewDidLoad) 18 | error:NULL]; 19 | 20 | [self jr_swizzleMethod:@selector(textView:shouldChangeTextInRange:replacementString:) 21 | withMethod:@selector(miku_textView:shouldChangeTextInRange:replacementString:) 22 | error:NULL]; 23 | } 24 | 25 | 26 | - (void)miku_viewDidLoad 27 | { 28 | [self miku_viewDidLoad]; 29 | 30 | // 创建超时空结界空间 31 | MikuDragView *mikuDragView = [Miku sharedPlugin].mikuDragView; 32 | [self.containerView addSubview:mikuDragView]; 33 | } 34 | 35 | 36 | - (BOOL)miku_textView:(NSTextView *)textView shouldChangeTextInRange:(NSRange)affectedCharRange replacementString:(NSString *)replacementString 37 | { 38 | // 给Miku充能量 39 | MikuWebView *mikuWebView = [Miku sharedPlugin].mikuDragView.mikuWebView; 40 | [mikuWebView setPlayingTime:10]; 41 | 42 | return [self miku_textView:textView shouldChangeTextInRange:affectedCharRange replacementString:replacementString]; 43 | } 44 | 45 | @end 46 | -------------------------------------------------------------------------------- /Miku/XcodeHeaders/DVTViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated by class-dump 3.5 (64 bit). 3 | // 4 | // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard. 5 | // 6 | 7 | //#import "NSViewController.h" 8 | 9 | //#import "DVTControllerContentViewViewControllerAdditions.h" 10 | //#import "DVTEditor.h" 11 | //#import "DVTInvalidation.h" 12 | 13 | @class DVTControllerContentView, DVTExtension, DVTStackBacktrace, NSString; 14 | 15 | //@interface DVTViewController : NSViewController 16 | @interface DVTViewController : NSViewController 17 | { 18 | BOOL _didCallViewWillUninstall; 19 | void *_keepSelfAliveUntilCancellationRef; 20 | BOOL _isViewLoaded; 21 | DVTExtension *_representedExtension; 22 | } 23 | 24 | + (id)defaultViewNibBundle; 25 | + (id)defaultViewNibName; 26 | + (void)initialize; 27 | //- (void).cxx_destruct; 28 | - (void)_didInstallContentView:(id)arg1; 29 | - (void)_willUninstallContentView:(id)arg1; 30 | - (BOOL)becomeFirstResponder; 31 | @property(readonly) BOOL canBecomeMainViewController; 32 | - (BOOL)commitEditingForAction:(int)arg1 errors:(id)arg2; 33 | - (BOOL)delegateFirstResponder; 34 | @property(readonly, copy) NSString *description; 35 | - (void)dvtViewController_commonInit; 36 | - (id)initUsingDefaultNib; 37 | - (id)initWithCoder:(id)arg1; 38 | - (id)initWithNibName:(id)arg1 bundle:(id)arg2; 39 | - (void)invalidate; 40 | @property BOOL isViewLoaded; // @synthesize isViewLoaded=_isViewLoaded; 41 | - (void)loadView; 42 | - (void)primitiveInvalidate; 43 | @property(retain, nonatomic) DVTExtension *representedExtension; // @synthesize representedExtension=_representedExtension; 44 | - (void)separateKeyViewLoops; 45 | //@property(retain) DVTControllerContentView *view; 46 | - (id)supplementalMainViewController; 47 | - (void)viewDidInstall; 48 | - (void)viewWillUninstall; 49 | 50 | // Remaining properties 51 | @property(retain) DVTStackBacktrace *creationBacktrace; 52 | @property(readonly, copy) NSString *debugDescription; 53 | @property(readonly) unsigned long long hash; 54 | @property(readonly) DVTStackBacktrace *invalidationBacktrace; 55 | @property(readonly) Class superclass; 56 | @property(readonly, nonatomic, getter=isValid) BOOL valid; 57 | 58 | @end 59 | 60 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | # Miku 3 | 4 | Miku is a plugin for Xcode. A copy of atom-miku. 5 | 6 | 说明:这是一个在Xcode里召唤**程序员鼓励师**的插件,[atom-miku](https://github.com/sunqibuhuake/atom-miku)的盗版。 7 | 8 | 敲代码时Miku会唱歌和跳舞,停止敲代码时Miku的动作就会慢下来。 9 | 10 | ![image](https://github.com/poboke/Miku/raw/master/Screenshots/about.png) 11 | 12 | 13 | ## Menu 14 | 15 | Click the `Plugins` menu, choose the `Miku` sub menu. 16 | 17 | 点击Xcode的`Plugins`菜单,在`Miku`子菜单里可以选择一些选项。 18 | 19 | ![image](https://github.com/poboke/Miku/raw/master/Screenshots/menu.jpg) 20 | 21 | "Enable" : 是否启用插件,默认启用 22 | "Enable Keep Dancing" : 选中后会一直跳舞唱歌,不受打字影响 23 | "Music Type" : 音乐类型 24 | "Default 🔈" : 默认模式,跳舞慢动作时音乐播放会变慢 25 | "Normal 🔊" : 正常模式,跳舞慢动作时音乐播放不变慢 26 | "Mute 🔇" : 静音模式 27 | 28 | ## Custom music 29 | 30 | Custom music play list 31 | 32 | This plugin will auto play the musics in the `~/Music` directory. 33 | 34 | 35 | 自定义音乐播放列表 36 | 37 | 这个插件会自动播放`~/Music`文件夹里的音乐文件。 38 | 39 | 40 | ## Support Xcode versions 41 | 42 | - Xcode6 43 | - Xcode7 44 | 45 | 46 | ## Auto install and uninstall 47 | 48 | Using [Alcatraz](https://github.com/alcatraz/Alcatraz) 49 | 50 | 51 | ## Manual build and install 52 | 53 | - Download source code and open Miku.xcodeproj with Xcode. 54 | - Select "Edit Scheme" and set "Build Configuration" as "Release" 55 | - Build it. It automatically installs the plugin into the correct directory. 56 | - Restart Xcode. (Make sure that the Xcode process is terminated entirely) 57 | 58 | 59 | ## Manual uninstall 60 | 61 | Delete the following directory: 62 | `~/Library/Application Support/Developer/Shared/Xcode/Plug-ins/Miku.xcplugin` 63 | 64 | 65 | ## License 66 | 67 | (The WTFPL) 68 | 69 | DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE 70 | Version 2, December 2004 71 | 72 | Copyright (C) 2015 Jobs (www.poboke.com) 73 | 74 | Everyone is permitted to copy and distribute verbatim or modified 75 | copies of this license document, and changing it is allowed as long 76 | as the name is changed. 77 | 78 | DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE 79 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 80 | 81 | 0. You just DO WHAT THE FUCK YOU WANT TO. 82 | 83 | -------------------------------------------------------------------------------- /Miku/XcodeHeaders/IDEViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated by class-dump 3.5 (64 bit). 3 | // 4 | // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard. 5 | // 6 | 7 | #import "DVTViewController.h" 8 | 9 | //#import "DVTStatefulObject.h" 10 | //#import "IDESelectionSource.h" 11 | 12 | @class DVTStateToken, IDESelection, IDEWorkspace, IDEWorkspaceDocument, IDEWorkspaceTabController, NSString; 13 | 14 | //@interface IDEViewController : DVTViewController 15 | @interface IDEViewController : DVTViewController 16 | { 17 | // id _workspaceDocumentProvider; 18 | IDEWorkspaceTabController *_workspaceTabController; 19 | IDESelection *_outputSelection; 20 | DVTStateToken *_stateToken; 21 | } 22 | 23 | + (void)configureStateSavingObjectPersistenceByName:(id)arg1; 24 | + (id)keyPathsForValuesAffectingWorkspace; 25 | + (id)keyPathsForValuesAffectingWorkspaceDocument; 26 | + (long long)version; 27 | //- (void).cxx_destruct; 28 | - (void)_invalidateSubViewControllersForView:(id)arg1; 29 | - (BOOL)_knowsAboutInstalledState; 30 | - (void)_resolveWorkspaceDocumentProvider; 31 | - (void)_resolveWorkspaceTabController; 32 | @property(readonly) BOOL automaticallyInvalidatesChildViewControllers; 33 | - (void)commitState; 34 | - (void)commitStateToDictionary:(id)arg1; 35 | @property(readonly, copy) IDESelection *contextMenuSelection; 36 | - (id)initWithNibName:(id)arg1 bundle:(id)arg2; 37 | @property(copy) IDESelection *outputSelection; // @synthesize outputSelection=_outputSelection; 38 | - (void)primitiveInvalidate; 39 | - (void)revertState; 40 | - (void)revertStateWithDictionary:(id)arg1; 41 | - (void)setStateToken:(id)arg1; 42 | @property(retain, nonatomic) IDEWorkspaceTabController *workspaceTabController; // @synthesize workspaceTabController=_workspaceTabController; 43 | //@property(readonly) DVTStateToken *stateToken; // @synthesize stateToken=_stateToken; 44 | - (id)supplementalTargetForAction:(SEL)arg1 sender:(id)arg2; 45 | - (void)viewDidInstall; 46 | @property(readonly) IDEWorkspace *workspace; 47 | @property(readonly) IDEWorkspaceDocument *workspaceDocument; 48 | - (id)workspaceDocumentProvider; 49 | 50 | // Remaining properties 51 | @property(readonly, copy) NSString *debugDescription; 52 | @property(readonly, copy) NSString *description; 53 | @property(readonly) unsigned long long hash; 54 | @property(readonly) Class superclass; 55 | 56 | @end 57 | 58 | -------------------------------------------------------------------------------- /Miku/Miku.m: -------------------------------------------------------------------------------- 1 | // 2 | // Miku.m 3 | // Miku 4 | // 5 | // Created by Jobs on 16/1/11. 6 | // Copyright © 2016年 Jobs. All rights reserved. 7 | // 8 | 9 | #import "Miku.h" 10 | #import "MikuConfigManager.h" 11 | #import "MikuMainMenuItem.h" 12 | #import "IDESourceCodeEditor+Miku.h" 13 | 14 | @interface Miku() 15 | @end 16 | 17 | 18 | @implementation Miku 19 | 20 | + (void)pluginDidLoad:(NSBundle *)plugin 21 | { 22 | // Load only into Xcode 23 | NSString *identifier = [NSBundle mainBundle].bundleIdentifier; 24 | if (![identifier isEqualToString:@"com.apple.dt.Xcode"]) { 25 | return; 26 | } 27 | 28 | [self sharedPlugin]; 29 | } 30 | 31 | 32 | + (instancetype)sharedPlugin 33 | { 34 | static Miku *_sharedPlugin; 35 | 36 | static dispatch_once_t onceToken; 37 | dispatch_once(&onceToken, ^{ 38 | _sharedPlugin = [[self alloc] init]; 39 | }); 40 | 41 | return _sharedPlugin; 42 | } 43 | 44 | 45 | - (instancetype)init 46 | { 47 | if (self = [super init]) { 48 | 49 | self.mikuDragView = [[MikuDragView alloc] init]; 50 | 51 | [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(applicationDidFinishLaunching:) name:NSApplicationDidFinishLaunchingNotification object:nil]; 52 | } 53 | 54 | return self; 55 | } 56 | 57 | 58 | - (void)applicationDidFinishLaunching:(NSNotification *)notification 59 | { 60 | [[NSNotificationCenter defaultCenter] removeObserver:self name:NSApplicationDidFinishLaunchingNotification object:nil]; 61 | 62 | [self addPluginsMenu]; 63 | 64 | if ([MikuConfigManager sharedManager].isEnablePlugin) { 65 | self.enablePlugin = YES; 66 | } 67 | } 68 | 69 | 70 | - (void)addPluginsMenu 71 | { 72 | // Add Plugins menu next to Window menu 73 | NSMenu *mainMenu = [NSApp mainMenu]; 74 | NSMenuItem *pluginsMenuItem = [mainMenu itemWithTitle:@"Plugins"]; 75 | if (!pluginsMenuItem) { 76 | pluginsMenuItem = [[NSMenuItem alloc] init]; 77 | pluginsMenuItem.title = @"Plugins"; 78 | pluginsMenuItem.submenu = [[NSMenu alloc] initWithTitle:pluginsMenuItem.title]; 79 | NSInteger windowIndex = [mainMenu indexOfItemWithTitle:@"Window"]; 80 | [mainMenu insertItem:pluginsMenuItem atIndex:windowIndex]; 81 | } 82 | 83 | // Add Subitem 84 | MikuMainMenuItem *mainMenuItem = [[MikuMainMenuItem alloc] init]; 85 | [pluginsMenuItem.submenu addItem:mainMenuItem]; 86 | } 87 | 88 | 89 | - (void)setEnablePlugin:(BOOL)enablePlugin 90 | { 91 | _enablePlugin = enablePlugin; 92 | 93 | [IDESourceCodeEditor hookMiku]; 94 | 95 | self.mikuDragView.hidden = !enablePlugin; 96 | } 97 | 98 | 99 | - (void)dealloc 100 | { 101 | [[NSNotificationCenter defaultCenter] removeObserver:self]; 102 | } 103 | 104 | @end 105 | -------------------------------------------------------------------------------- /Miku/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleIdentifier 6 | $(PRODUCT_BUNDLE_IDENTIFIER) 7 | CFBundleDevelopmentRegion 8 | English 9 | CFBundleExecutable 10 | $(EXECUTABLE_NAME) 11 | CFBundleName 12 | $(PRODUCT_NAME) 13 | CFBundleIconFile 14 | 15 | CFBundleInfoDictionaryVersion 16 | 6.0 17 | CFBundlePackageType 18 | BNDL 19 | CFBundleSignature 20 | ???? 21 | LSMinimumSystemVersion 22 | $(MACOSX_DEPLOYMENT_TARGET) 23 | CFBundleVersion 24 | 2 25 | CFBundleShortVersionString 26 | 1.0.0 27 | XCPluginHasUI 28 | 29 | XC4Compatible 30 | 31 | NSPrincipalClass 32 | Miku 33 | DVTPlugInCompatibilityUUIDs 34 | 35 | 37B30044-3B14-46BA-ABAA-F01000C27B63 36 | 640F884E-CE55-4B40-87C0-8869546CAB7A 37 | A2E4D43F-41F4-4FB9-BB94-7177011C9AED 38 | AD68E85B-441B-4301-B564-A45E4919A6AD 39 | C4A681B0-4A26-480E-93EC-1218098B9AA0 40 | FEC992CC-CA4A-4CFD-8881-77300FCB848A 41 | A16FF353-8441-459E-A50C-B071F53F51B7 42 | 992275C1-432A-4CF7-B659-D84ED6D42D3F 43 | 9F75337B-21B4-4ADC-B558-F9CADF7073A7 44 | E969541F-E6F9-4D25-8158-72DC3545A6C6 45 | 8DC44374-2B35-4C57-A6FE-2AD66A36AAD9 46 | 5EDAC44F-8E0B-42C9-9BEF-E9C12EEC4949 47 | 7FDF5C7A-131F-4ABB-9EDC-8C5F8F0B8A90 48 | AABB7188-E14E-4433-AD3B-5CD791EAD9A3 49 | 0420B86A-AA43-4792-9ED0-6FE0F2B16A13 50 | CC0D0F4F-05B3-431A-8F33-F84AFCB2C651 51 | 7265231C-39B4-402C-89E1-16167C4CC990 52 | 9AFF134A-08DC-4096-8CEE-62A4BB123046 53 | F41BD31E-2683-44B8-AE7F-5F09E919790E 54 | ACA8656B-FEA8-4B6D-8E4A-93F4C95C362C 55 | 1637F4D5-0B27-416B-A78D-498965D64877 56 | 8A66E736-A720-4B3C-92F1-33D9962C69DF 57 | DA4FDFD8-C509-4D8B-8B55-84A7B66AE701 58 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /Miku/XcodeHeaders/DVTLayoutView_ML.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated by class-dump 3.5 (64 bit). 3 | // 4 | // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard. 5 | // 6 | 7 | //#import "NSView.h" 8 | 9 | @class NSCountedSet, NSMapTable, NSMutableDictionary; 10 | 11 | @interface DVTLayoutView_ML : NSView 12 | { 13 | NSCountedSet *_frameChangeObservations; 14 | NSCountedSet *_boundsChangeObservations; 15 | BOOL _implementsDrawRect; 16 | BOOL _implementsLayoutCompletionCallback; 17 | BOOL _layoutNeeded; 18 | NSMutableDictionary *_invalidationTokens; 19 | NSMapTable *_frameChangeStacksByView; 20 | NSMapTable *_boundsChangeStacksByView; 21 | BOOL _needsSecondLayoutPass; 22 | } 23 | 24 | + (void)_doRecursivelyLayoutSubviewsOfView:(id)arg1 populatingSetWithLaidOutViews:(id)arg2 completionCallBackHandlers:(id)arg3 currentLayoutPass:(long long)arg4 needsSecondPass:(char *)arg5; 25 | + (void)_layoutWindow:(id)arg1; 26 | + (void)_recursivelyLayoutSubviewsOfView:(id)arg1 populatingSetWithLaidOutViews:(id)arg2; 27 | + (id)alreadyLaidOutViewsForCurrentDisplayPassOfWindow:(id)arg1; 28 | + (void)clearAlreadyLaidOutViewsForCurrentDisplayPassOfWindow:(id)arg1; 29 | + (void)scheduleWindowForLayout:(id)arg1; 30 | //- (void).cxx_destruct; 31 | - (void)_DVTLayoutView_MLSharedInit; 32 | - (void)_autoLayoutViewViewBoundsDidChange:(id)arg1; 33 | - (void)_autoLayoutViewViewFrameDidChange:(id)arg1; 34 | - (void)_invalidateLayoutIfNeededAfterRegisteringRectChange:(struct CGRect)arg1 forView:(id)arg2 table:(id)arg3; 35 | - (void)_reallyLayoutIfNeededBottomUp; 36 | - (void)_reallyLayoutIfNeededTopDown; 37 | - (void)_setupObservationForObservedObject:(id)arg1 selector:(SEL)arg2 notificationName:(id)arg3 observationCountTable:(id *)arg4 rectChangeStackTable:(id *)arg5; 38 | - (void)_tearDownObservationForObservedObject:(id)arg1 notificationName:(id)arg2 observationCountTable:(id)arg3 rectChangeStackTable:(id)arg4; 39 | - (void)dealloc; 40 | - (void)didCompleteLayout; 41 | - (void)didLayoutSubview:(id)arg1; 42 | - (id)initWithCoder:(id)arg1; 43 | - (id)initWithFrame:(struct CGRect)arg1; 44 | - (void)invalidateLayout; 45 | - (void)invalidateLayoutWithBoundsChangesToView:(id)arg1; 46 | - (void)invalidateLayoutWithChangesToKeyPath:(id)arg1 ofObject:(id)arg2; 47 | - (void)invalidateLayoutWithFrameChangesToView:(id)arg1; 48 | @property(getter=isLayoutNeeded) BOOL layoutNeeded; // @synthesize layoutNeeded=_layoutNeeded; 49 | - (void)layoutBottomUp; 50 | - (void)layoutIfNeeded; 51 | - (void)layoutTopDown; 52 | @property BOOL needsSecondLayoutPass; // @synthesize needsSecondLayoutPass=_needsSecondLayoutPass; 53 | - (void)setFrameSize:(struct CGSize)arg1; 54 | - (void)stopInvalidatingLayoutWithBoundsChangesToView:(id)arg1; 55 | - (void)stopInvalidatingLayoutWithChangesToKeyPath:(id)arg1 ofObject:(id)arg2; 56 | - (void)stopInvalidatingLayoutWithFrameChangesToView:(id)arg1; 57 | - (id)subviewsOrderedForLayout; 58 | - (void)viewDidMoveToWindow; 59 | - (void)viewWillDraw; 60 | - (BOOL)wantsDefaultClipping; 61 | 62 | @end 63 | 64 | -------------------------------------------------------------------------------- /Miku/XcodeHeaders/IDEEditor.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated by class-dump 3.5 (64 bit). 3 | // 4 | // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard. 5 | // 6 | 7 | #import "IDEViewController.h" 8 | 9 | @class DVTFindBar, DVTNotificationToken, DVTObservingToken, DVTScopeBarsManager, IDEEditorContext, IDEEditorDocument, IDEFileTextSettings, NSScrollView; 10 | 11 | @interface IDEEditor : IDEViewController 12 | { 13 | DVTFindBar *_findBar; 14 | DVTNotificationToken *_documentDidChangeNotificationToken; 15 | DVTNotificationToken *_documentForNavBarStructureDidChangeNotificationToken; 16 | DVTObservingToken *_documentFileURLObservingToken; 17 | BOOL _discardsFindResultsWhenContentChanges; 18 | // id _delegate; 19 | IDEEditorDocument *_document; 20 | IDEEditorDocument *_documentForNavBarStructure; 21 | // id _findableObject; 22 | IDEFileTextSettings *_fileTextSettings; 23 | IDEEditorContext *_editorContext; 24 | } 25 | 26 | + (BOOL)canProvideCurrentSelectedItems; 27 | //- (void).cxx_destruct; 28 | - (id)_getUndoManager:(BOOL)arg1; 29 | - (id)_initWithNibName:(id)arg1 bundle:(id)arg2; 30 | - (id)createFindBar; 31 | - (id)currentSelectedDocumentLocations; 32 | - (id)currentSelectedItems; 33 | //@property(retain) id delegate; // @synthesize delegate=_delegate; 34 | - (void)didSetupEditor; 35 | @property BOOL discardsFindResultsWhenContentChanges; // @synthesize discardsFindResultsWhenContentChanges=_discardsFindResultsWhenContentChanges; 36 | @property(retain) IDEEditorDocument *document; // @synthesize document=_document; 37 | @property(retain, nonatomic) IDEEditorDocument *documentForNavBarStructure; // @synthesize documentForNavBarStructure=_documentForNavBarStructure; 38 | @property(retain) IDEEditorContext *editorContext; // @synthesize editorContext=_editorContext; 39 | - (void)editorContextDidHideFindBar; 40 | @property(retain, nonatomic) IDEFileTextSettings *fileTextSettings; // @synthesize fileTextSettings=_fileTextSettings; 41 | @property(readonly) DVTFindBar *findBar; // @synthesize findBar=_findBar; 42 | @property(readonly) BOOL findBarSupported; 43 | //@property(retain, nonatomic) id findableObject; // @synthesize findableObject=_findableObject; 44 | - (id)initUsingDefaultNib; 45 | - (id)initWithNibName:(id)arg1 bundle:(id)arg2; 46 | - (id)initWithNibName:(id)arg1 bundle:(id)arg2 document:(id)arg3; 47 | @property(readonly, getter=isPrimaryEditor) BOOL primaryEditor; 48 | @property(readonly) NSScrollView *mainScrollView; 49 | - (void)navigateToAnnotationWithRepresentedObject:(id)arg1 wantsIndicatorAnimation:(BOOL)arg2 exploreAnnotationRepresentedObject:(id)arg3; 50 | - (void)primitiveInvalidate; 51 | - (id)relatedMenuItemsForNavItem:(id)arg1; 52 | @property(readonly) DVTScopeBarsManager *scopeBarsManager; 53 | - (void)selectDocumentLocations:(id)arg1; 54 | - (void)setupContextMenuWithMenu:(id)arg1 withContext:(id)arg2; 55 | - (id)supplementalTargetForAction:(SEL)arg1 sender:(id)arg2; 56 | - (void)takeFocus; 57 | - (id)undoManager; 58 | 59 | @end 60 | 61 | -------------------------------------------------------------------------------- /Miku/Configs/MikuConfigManager.m: -------------------------------------------------------------------------------- 1 | // 2 | // MikuConfigManager.m 3 | // ActivatePowerMode 4 | // 5 | // Created by Jobs on 16/1/11. 6 | // Copyright © 2015年 Jobs. All rights reserved. 7 | // 8 | 9 | #import "MikuConfigManager.h" 10 | 11 | static NSString * const MikuPluginConfigKeyEnablePlugin = @"MikuPluginConfigKeyEnablePlugin"; 12 | static NSString * const MikuPluginConfigKeyEnableKeepDancing = @"MikuPluginConfigKeyEnableKeepDancing"; 13 | static NSString * const MikuPluginConfigKeyMusicType = @"MikuPluginConfigKeyMusicType"; 14 | 15 | @implementation MikuConfigManager 16 | 17 | @synthesize enablePlugin = _enablePlugin; 18 | @synthesize enableKeepDancing = _enableKeepDancing; 19 | @synthesize musicType = _musicType; 20 | 21 | + (instancetype)sharedManager 22 | { 23 | static MikuConfigManager *_sharedManager; 24 | 25 | static dispatch_once_t onceToken; 26 | dispatch_once(&onceToken, ^{ 27 | _sharedManager = [[self alloc] init]; 28 | }); 29 | 30 | return _sharedManager; 31 | } 32 | 33 | 34 | #pragma mark - Syntax sugar 35 | 36 | - (BOOL)boolValueForKey:(NSString *)aKey 37 | { 38 | return [[[NSUserDefaults standardUserDefaults] objectForKey:aKey] boolValue]; 39 | } 40 | 41 | 42 | - (void)setBoolValue:(BOOL)boolValue forKey:(NSString *)aKey 43 | { 44 | [[NSUserDefaults standardUserDefaults] setObject:@(boolValue) forKey:aKey]; 45 | [[NSUserDefaults standardUserDefaults] synchronize]; 46 | } 47 | 48 | 49 | #pragma mark - Property 50 | 51 | - (BOOL)isEnablePlugin 52 | { 53 | if (!_enablePlugin) { 54 | 55 | NSNumber *value = [[NSUserDefaults standardUserDefaults] objectForKey:MikuPluginConfigKeyEnablePlugin]; 56 | 57 | if (!value) { 58 | // First time runing 59 | self.enablePlugin = YES; 60 | self.enableKeepDancing = NO; 61 | self.musicType = 0; 62 | _enablePlugin = YES; 63 | } else { 64 | _enablePlugin = [value boolValue]; 65 | } 66 | } 67 | 68 | return _enablePlugin; 69 | } 70 | 71 | 72 | - (void)setEnablePlugin:(BOOL)enablePlugin 73 | { 74 | _enablePlugin = enablePlugin; 75 | [self setBoolValue:enablePlugin forKey:MikuPluginConfigKeyEnablePlugin]; 76 | } 77 | 78 | 79 | - (BOOL)isEnableKeepDancing 80 | { 81 | if (!_enableKeepDancing) { 82 | _enableKeepDancing = [self boolValueForKey:MikuPluginConfigKeyEnableKeepDancing]; 83 | } 84 | 85 | return _enableKeepDancing; 86 | } 87 | 88 | 89 | - (void)setEnableKeepDancing:(BOOL)enableKeepDancing 90 | { 91 | _enableKeepDancing = enableKeepDancing; 92 | [self setBoolValue:enableKeepDancing forKey:MikuPluginConfigKeyEnableKeepDancing]; 93 | } 94 | 95 | 96 | - (NSInteger)musicType 97 | { 98 | if (!_musicType) { 99 | NSNumber *value = [[NSUserDefaults standardUserDefaults] objectForKey:MikuPluginConfigKeyMusicType]; 100 | _musicType = [value integerValue]; 101 | } 102 | 103 | return _musicType; 104 | } 105 | 106 | 107 | - (void)setMusicType:(NSInteger)musicType 108 | { 109 | _musicType = musicType; 110 | [[NSUserDefaults standardUserDefaults] setObject:@(musicType) forKey:MikuPluginConfigKeyMusicType]; 111 | [[NSUserDefaults standardUserDefaults] synchronize]; 112 | } 113 | 114 | @end 115 | -------------------------------------------------------------------------------- /Miku/miku-dancing.coding.io/lib/MorphAnimation2.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by sunqi on 15-7-16. 3 | */ 4 | /** 5 | * @author takahiro / https://github.com/takahirox 6 | * 7 | * This class is similar to THREE.Animation. 8 | * It controls all mesh.morphTargetInfluences parameters in each frame. 9 | * 10 | * Passed parameter is similar to THREE.Animation's as well 11 | * other than that hierarchy corresponds to morphTargetInfluences and 12 | * each key should have weight instead of pos, rot, and scl. 13 | * 14 | * TODO 15 | * rename to appropriate one. 16 | * consider to combine with THREE.Animation 17 | */ 18 | 19 | THREE.MorphAnimation2 = function ( mesh, data ) { 20 | 21 | this.mesh = mesh; 22 | this.influences = mesh.morphTargetInfluences; 23 | this.data = data; 24 | this.hierarchy = data.hierarchy; 25 | 26 | this.currentTime = 0; 27 | 28 | for ( var i = 0; i < this.hierarchy.length; i++ ) { 29 | 30 | this.hierarchy[ i ].currentFrame = -1; 31 | 32 | } 33 | 34 | this.isPlaying = false; 35 | this.loop = true; 36 | 37 | }; 38 | 39 | THREE.MorphAnimation2.prototype = { 40 | 41 | constructor: THREE.MorphAnimation2, 42 | 43 | play: function ( startTime ) { 44 | 45 | this.currentTime = startTime !== undefined ? startTime : 0; 46 | this.isPlaying = true; 47 | this.reset(); 48 | 49 | THREE.AnimationHandler.play( this ); 50 | 51 | }, 52 | 53 | pause: function () { 54 | 55 | this.isPlaying = false; 56 | 57 | THREE.AnimationHandler.stop( this ); 58 | 59 | }, 60 | 61 | reset: function () { 62 | 63 | for ( var i = 0; i < this.hierarchy.length; i++ ) { 64 | 65 | this.hierarchy[ i ].currentFrame = -1; 66 | 67 | } 68 | 69 | }, 70 | 71 | // Note: This's for being used by THREE.AnimationHandler.update() 72 | resetBlendWeights: function () { 73 | }, 74 | 75 | update: function ( delta ) { 76 | 77 | if ( this.isPlaying === false ) return; 78 | 79 | this.currentTime += delta; 80 | 81 | var duration = this.data.length; 82 | 83 | if ( this.currentTime > duration || this.currentTime < 0 ) { 84 | 85 | if ( this.loop ) { 86 | 87 | this.currentTime %= duration; 88 | 89 | if ( this.currentTime < 0 ) { 90 | 91 | this.currentTime += duration; 92 | 93 | } 94 | 95 | this.reset(); 96 | 97 | } else { 98 | 99 | this.stop(); 100 | 101 | } 102 | 103 | } 104 | 105 | for ( var h = 0, hl = this.hierarchy.length; h < hl; h++ ) { 106 | 107 | var object = this.hierarchy[ h ]; 108 | var keys = object.keys; 109 | var weight = 0.0; 110 | 111 | while ( object.currentFrame + 1 < keys.length && 112 | this.currentTime >= keys[ object.currentFrame + 1 ].time ) { 113 | 114 | object.currentFrame++; 115 | 116 | } 117 | 118 | if ( object.currentFrame >= 0 ) { 119 | 120 | var prevKey = keys[ object.currentFrame ]; 121 | weight = prevKey.weight; 122 | 123 | if ( object.currentFrame < keys.length ) { 124 | 125 | var nextKey = keys[ object.currentFrame + 1 ]; 126 | 127 | if ( nextKey.time > prevKey.time ) { 128 | 129 | var interpolation = ( this.currentTime - prevKey.time ) / ( nextKey.time - prevKey.time ); 130 | weight = weight * ( 1.0 - interpolation ) + nextKey.weight * interpolation; 131 | 132 | } 133 | 134 | } 135 | 136 | } 137 | 138 | this.influences[ h ] = weight; 139 | 140 | } 141 | 142 | } 143 | 144 | }; 145 | -------------------------------------------------------------------------------- /Miku/Views/MikuWebView.m: -------------------------------------------------------------------------------- 1 | // 2 | // MikuWebView.m 3 | // Miku 4 | // 5 | // Created by Jobs on 16/1/11. 6 | // Copyright © 2016年 Jobs. All rights reserved. 7 | // 8 | 9 | #import "MikuWebView.h" 10 | 11 | @interface MikuWebView () 12 | @end 13 | 14 | 15 | @implementation MikuWebView 16 | 17 | - (instancetype)initWithFrame:(NSRect)frameRect 18 | { 19 | if (self = [super initWithFrame:frameRect]) { 20 | 21 | self.drawsBackground = NO; 22 | 23 | // 连接本地的异次元空间,因为加载远程的异次元空间速度太慢 24 | NSString *pluginPath = @"~/Library/Application Support/Developer/Shared/Xcode/Plug-ins/Miku.xcplugin"; 25 | NSBundle *pluginBundle = [NSBundle bundleWithPath:[pluginPath stringByExpandingTildeInPath]]; 26 | NSString *htmlPath = [pluginBundle pathForResource:@"index" 27 | ofType:@"html" 28 | inDirectory:@"miku-dancing.coding.io"]; 29 | NSURL *htmlUrl = [NSURL fileURLWithPath:htmlPath]; 30 | NSURLRequest *request = [NSURLRequest requestWithURL:htmlUrl]; 31 | [self.mainFrame loadRequest:request]; 32 | } 33 | 34 | return self; 35 | } 36 | 37 | 38 | - (NSView *)hitTest:(NSPoint)aPoint 39 | { 40 | // http://stackoverflow.com/questions/9073975/cocoa-webview-ignore-mouse-events-in-areas-without-content 41 | 42 | return (NSView *)[self nextResponder]; 43 | } 44 | 45 | 46 | #pragma mark - Controls 47 | 48 | /** 49 | * 播放 50 | */ 51 | - (void)play 52 | { 53 | [self stringByEvaluatingJavaScriptFromString:@"control.play()"]; 54 | } 55 | 56 | 57 | /** 58 | * 暂停 59 | */ 60 | - (void)pause 61 | { 62 | [self stringByEvaluatingJavaScriptFromString:@"control.pause()"]; 63 | } 64 | 65 | 66 | /** 67 | * 设置播放时间 68 | * 69 | * @param seconds 秒数 70 | */ 71 | - (void)setPlayingTime:(NSInteger)seconds 72 | { 73 | NSString *script = [NSString stringWithFormat:@"control.addFrame(%li)", seconds]; 74 | [self stringByEvaluatingJavaScriptFromString:script]; 75 | } 76 | 77 | 78 | /** 79 | * 设置是否一直跳舞,是的话就不会出现慢动作 80 | * 81 | * @param isKeepDancing 是否一直跳舞 82 | */ 83 | - (void)setIsKeepDancing:(BOOL)isKeepDancing 84 | { 85 | NSString *script = [NSString stringWithFormat:@"control.dance(%i)", isKeepDancing]; 86 | [self stringByEvaluatingJavaScriptFromString:script]; 87 | } 88 | 89 | 90 | /** 91 | * 设置音乐类型 92 | * 93 | * @param musicType 音乐类型 94 | */ 95 | - (void)setMusicType:(MikuMusicType)musicType 96 | { 97 | switch (musicType) { 98 | 99 | case MikuMusicTypeDefault: 100 | [self stringByEvaluatingJavaScriptFromString:@"control.mute(false)"]; 101 | [self stringByEvaluatingJavaScriptFromString:@"control.music(false)"]; 102 | break; 103 | 104 | case MikuMusicTypeNormal: 105 | [self stringByEvaluatingJavaScriptFromString:@"control.mute(false)"]; 106 | [self stringByEvaluatingJavaScriptFromString:@"control.music(true)"]; 107 | break; 108 | 109 | case MikuMusicTypeMute: 110 | [self stringByEvaluatingJavaScriptFromString:@"control.mute(true)"]; 111 | break; 112 | } 113 | } 114 | 115 | 116 | #pragma mark - Drag music onto miku 117 | 118 | - (NSDragOperation)draggingEntered:(id)sender 119 | { 120 | NSPasteboard *pasteboard = [sender draggingPasteboard]; 121 | 122 | if ([pasteboard.types containsObject:NSFilenamesPboardType]) { 123 | return NSDragOperationCopy; 124 | } 125 | 126 | return NSDragOperationNone; 127 | } 128 | 129 | 130 | - (BOOL)prepareForDragOperation:(id)sender 131 | { 132 | NSPasteboard *pasteboard = [sender draggingPasteboard]; 133 | 134 | NSArray *list = [pasteboard propertyListForType:NSFilenamesPboardType]; 135 | NSString *fileURL = list.firstObject; 136 | 137 | NSString *script = [NSString stringWithFormat:@"control.setPlayList(['%@'])", fileURL]; 138 | [self stringByEvaluatingJavaScriptFromString:script]; 139 | 140 | return NO; 141 | } 142 | 143 | @end 144 | -------------------------------------------------------------------------------- /Miku/Views/MikuDragView.m: -------------------------------------------------------------------------------- 1 | // 2 | // MikuDragView.m 3 | // Miku 4 | // 5 | // Created by Jobs on 16/1/11. 6 | // Copyright © 2016年 Jobs. All rights reserved. 7 | // 8 | 9 | #import "MikuDragView.h" 10 | #import "MikuConfigManager.h" 11 | 12 | @interface MikuDragView() 13 | 14 | @property (nonatomic, assign) NSPoint lastDragLocation; 15 | 16 | @end 17 | 18 | 19 | @implementation MikuDragView 20 | 21 | - (instancetype)init 22 | { 23 | if (self = [super initWithFrame:NSMakeRect(500, 50, 200, 300)]) { 24 | 25 | self.hidden = YES; 26 | 27 | // 使用WebView导通器连接异次元 28 | self.mikuWebView = [[MikuWebView alloc] initWithFrame:self.bounds]; 29 | self.mikuWebView.frameLoadDelegate = self; 30 | [self addSubview:self.mikuWebView]; 31 | } 32 | 33 | return self; 34 | } 35 | 36 | 37 | - (void)mouseDown:(NSEvent *)theEvent 38 | { 39 | // http://stackoverflow.com/questions/7195835/nsview-dragging-the-view 40 | 41 | // Convert to superview's coordinate space 42 | self.lastDragLocation = [self.superview convertPoint:[theEvent locationInWindow] fromView:nil]; 43 | } 44 | 45 | 46 | /** 47 | * 添加负离子防御罩,启用时空拖拽 48 | * 49 | * @param theEvent 50 | */ 51 | - (void)mouseDragged:(NSEvent *)theEvent 52 | { 53 | // We're working only in the superview's coordinate space, so we always convert. 54 | NSPoint newDragLocation = [self.superview convertPoint:[theEvent locationInWindow] fromView:nil]; 55 | NSPoint thisOrigin = self.frame.origin; 56 | thisOrigin.x += (-self.lastDragLocation.x + newDragLocation.x); 57 | thisOrigin.y += (-self.lastDragLocation.y + newDragLocation.y); 58 | [self setFrameOrigin:thisOrigin]; 59 | 60 | self.lastDragLocation = newDragLocation; 61 | } 62 | 63 | 64 | /** 65 | * 设置是否隐藏,隐藏时停止动作,显示时继续动作 66 | * 67 | * @param hidden 是否隐藏 68 | */ 69 | - (void)setHidden:(BOOL)hidden 70 | { 71 | [super setHidden:hidden]; 72 | 73 | if (hidden) { 74 | [self.mikuWebView pause]; 75 | } else { 76 | [self.mikuWebView play]; 77 | } 78 | } 79 | 80 | 81 | /** 82 | * 异次元空间加载完毕的代码 83 | * 84 | * @param sender 85 | * @param frame 86 | */ 87 | - (void)webView:(WebView *)sender didFinishLoadForFrame:(WebFrame *)frame 88 | { 89 | //等待异次元空间加载完毕,设置用户选择的属性 90 | MikuConfigManager *configManager = [MikuConfigManager sharedManager]; 91 | [self.mikuWebView setMusicType:configManager.musicType]; 92 | [self.mikuWebView setIsKeepDancing:configManager.isEnableKeepDancing]; 93 | [self setCustomPlayList]; 94 | } 95 | 96 | 97 | /** 98 | * 设置用户自定义的播放列表 99 | */ 100 | - (void)setCustomPlayList 101 | { 102 | NSFileManager *fileManager = [NSFileManager defaultManager]; 103 | 104 | NSString *musicFolderPath = [NSSearchPathForDirectoriesInDomains(NSMusicDirectory, NSUserDomainMask, YES) lastObject]; 105 | if (![fileManager fileExistsAtPath:musicFolderPath]) { 106 | return; 107 | } 108 | 109 | // 获取音乐文件夹下所有的音乐 110 | NSMutableArray *musicPaths = [[NSMutableArray alloc] init]; 111 | NSDirectoryEnumerator *directoryEnumerator = [fileManager enumeratorAtPath:musicFolderPath]; 112 | NSString *musicSubPath; 113 | while (musicSubPath = [directoryEnumerator nextObject]) { 114 | if ([musicSubPath hasSuffix:@".mp3"]) { 115 | NSString *musicPath = [musicFolderPath stringByAppendingPathComponent:musicSubPath]; 116 | musicPath = [musicPath stringByReplacingOccurrencesOfString:@"'" withString:@"\\'"]; 117 | musicPath = [NSString stringWithFormat:@"'%@'", musicPath]; 118 | [musicPaths addObject:musicPath]; 119 | } 120 | } 121 | 122 | if (musicPaths.count == 0) { 123 | return; 124 | } 125 | 126 | NSString *songs = [musicPaths componentsJoinedByString:@","]; 127 | NSString *script = [NSString stringWithFormat:@"control.setPlayList([%@])", songs]; 128 | [self.mikuWebView stringByEvaluatingJavaScriptFromString:script]; 129 | } 130 | 131 | 132 | - (void)drawRect:(NSRect)dirtyRect 133 | { 134 | [super drawRect:dirtyRect]; 135 | } 136 | 137 | @end 138 | -------------------------------------------------------------------------------- /Miku/miku-dancing.coding.io/lib/CCDIKSolver.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by sunqi on 15-7-16. 3 | */ 4 | /** 5 | * @author takahiro / https://github.com/takahirox 6 | * 7 | * CCD Algorithm 8 | * https://sites.google.com/site/auraliusproject/ccd-algorithm 9 | * 10 | * mesh.geometry needs to have iks array. 11 | * 12 | * ik parameter example 13 | * 14 | * ik = { 15 | * target: 1, 16 | * effector: 2, 17 | * links: [ { index: 5 }, { index: 4, limitation: new THREE.Vector3( 1, 0, 0 ) }, { index : 3 } ], 18 | * iteration: 10, 19 | * minAngle: 0.0, 20 | * maxAngle: 1.0, 21 | * }; 22 | */ 23 | 24 | THREE.CCDIKSolver = function ( mesh ) { 25 | 26 | this.mesh = mesh; 27 | 28 | }; 29 | 30 | THREE.CCDIKSolver.prototype = { 31 | 32 | constructor: THREE.CCDIKSolver, 33 | 34 | update: function () { 35 | 36 | var effectorVec = new THREE.Vector3(); 37 | var targetVec = new THREE.Vector3(); 38 | var axis = new THREE.Vector3(); 39 | var q = new THREE.Quaternion(); 40 | 41 | var bones = this.mesh.skeleton.bones; 42 | var iks = this.mesh.geometry.iks; 43 | 44 | // for reference overhead reduction in loop 45 | var math = Math; 46 | 47 | for ( var i = 0, il = iks.length; i < il; i++ ) { 48 | 49 | var ik = iks[ i ]; 50 | var effector = bones[ ik.effector ]; 51 | var target = bones[ ik.target ]; 52 | var targetPos = target.getWorldPosition(); 53 | var links = ik.links; 54 | var iteration = ik.iteration !== undefined ? ik.iteration : 1; 55 | 56 | for ( var j = 0; j < iteration; j++ ) { 57 | 58 | for ( var k = 0, kl = links.length; k < kl; k++ ) { 59 | 60 | var link = bones[ links[ k ].index ]; 61 | var limitation = links[ k ].limitation; 62 | var linkPos = link.getWorldPosition(); 63 | var invLinkQ = link.getWorldQuaternion().inverse(); 64 | var effectorPos = effector.getWorldPosition(); 65 | 66 | // work in link world 67 | effectorVec.subVectors( effectorPos, linkPos ); 68 | effectorVec.applyQuaternion( invLinkQ ); 69 | effectorVec.normalize(); 70 | 71 | targetVec.subVectors( targetPos, linkPos ); 72 | targetVec.applyQuaternion( invLinkQ ); 73 | targetVec.normalize(); 74 | 75 | var angle = targetVec.dot( effectorVec ); 76 | 77 | // TODO: continue (or break) the loop for the performance 78 | // if no longer needs to rotate (angle > 1.0-1e-5 ?) 79 | 80 | if ( angle > 1.0 ) { 81 | 82 | angle = 1.0; 83 | 84 | } else if ( angle < -1.0 ) { 85 | 86 | angle = -1.0; 87 | 88 | } 89 | 90 | angle = math.acos( angle ); 91 | 92 | if ( ik.minAngle !== undefined && angle < ik.minAngle ) { 93 | 94 | angle = ik.minAngle; 95 | 96 | } 97 | 98 | if ( ik.maxAngle !== undefined && angle > ik.maxAngle ) { 99 | 100 | angle = ik.maxAngle; 101 | 102 | } 103 | 104 | axis.crossVectors( effectorVec, targetVec ); 105 | axis.normalize(); 106 | 107 | q.setFromAxisAngle( axis, angle ); 108 | link.quaternion.multiply( q ); 109 | 110 | // TODO: re-consider the limitation specification 111 | if ( limitation !== undefined ) { 112 | 113 | var c = link.quaternion.w; 114 | 115 | if ( c > 1.0 ) { 116 | 117 | c = 1.0; 118 | 119 | } 120 | 121 | var c2 = math.sqrt( 1 - c * c ); 122 | link.quaternion.set( limitation.x * c2, 123 | limitation.y * c2, 124 | limitation.z * c2, 125 | c ); 126 | 127 | } 128 | 129 | link.updateMatrixWorld( true ); 130 | 131 | } 132 | 133 | } 134 | 135 | } 136 | 137 | }, 138 | 139 | }; 140 | 141 | -------------------------------------------------------------------------------- /Miku/JRSwizzle/JRSwizzle.m: -------------------------------------------------------------------------------- 1 | // JRSwizzle.m semver:1.0 2 | // Copyright (c) 2007-2011 Jonathan 'Wolf' Rentzsch: http://rentzsch.com 3 | // Some rights reserved: http://opensource.org/licenses/MIT 4 | // https://github.com/rentzsch/jrswizzle 5 | 6 | #import "JRSwizzle.h" 7 | 8 | #if TARGET_OS_IPHONE 9 | #import 10 | #import 11 | #else 12 | #import 13 | #endif 14 | 15 | #define SetNSErrorFor(FUNC, ERROR_VAR, FORMAT,...) \ 16 | if (ERROR_VAR) { \ 17 | NSString *errStr = [NSString stringWithFormat:@"%s: " FORMAT,FUNC,##__VA_ARGS__]; \ 18 | *ERROR_VAR = [NSError errorWithDomain:@"NSCocoaErrorDomain" \ 19 | code:-1 \ 20 | userInfo:[NSDictionary dictionaryWithObject:errStr forKey:NSLocalizedDescriptionKey]]; \ 21 | } 22 | #define SetNSError(ERROR_VAR, FORMAT,...) SetNSErrorFor(__func__, ERROR_VAR, FORMAT, ##__VA_ARGS__) 23 | 24 | #if OBJC_API_VERSION >= 2 25 | #define GetClass(obj) object_getClass(obj) 26 | #else 27 | #define GetClass(obj) (obj ? obj->isa : Nil) 28 | #endif 29 | 30 | @implementation NSObject (JRSwizzle) 31 | 32 | + (BOOL)jr_swizzleMethod:(SEL)origSel_ withMethod:(SEL)altSel_ error:(NSError**)error_ { 33 | #if OBJC_API_VERSION >= 2 34 | Method origMethod = class_getInstanceMethod(self, origSel_); 35 | if (!origMethod) { 36 | #if TARGET_OS_IPHONE 37 | SetNSError(error_, @"original method %@ not found for class %@", NSStringFromSelector(origSel_), [self class]); 38 | #else 39 | SetNSError(error_, @"original method %@ not found for class %@", NSStringFromSelector(origSel_), [self className]); 40 | #endif 41 | return NO; 42 | } 43 | 44 | Method altMethod = class_getInstanceMethod(self, altSel_); 45 | if (!altMethod) { 46 | #if TARGET_OS_IPHONE 47 | SetNSError(error_, @"alternate method %@ not found for class %@", NSStringFromSelector(altSel_), [self class]); 48 | #else 49 | SetNSError(error_, @"alternate method %@ not found for class %@", NSStringFromSelector(altSel_), [self className]); 50 | #endif 51 | return NO; 52 | } 53 | 54 | class_addMethod(self, 55 | origSel_, 56 | class_getMethodImplementation(self, origSel_), 57 | method_getTypeEncoding(origMethod)); 58 | class_addMethod(self, 59 | altSel_, 60 | class_getMethodImplementation(self, altSel_), 61 | method_getTypeEncoding(altMethod)); 62 | 63 | method_exchangeImplementations(class_getInstanceMethod(self, origSel_), class_getInstanceMethod(self, altSel_)); 64 | return YES; 65 | #else 66 | // Scan for non-inherited methods. 67 | Method directOriginalMethod = NULL, directAlternateMethod = NULL; 68 | 69 | void *iterator = NULL; 70 | struct objc_method_list *mlist = class_nextMethodList(self, &iterator); 71 | while (mlist) { 72 | int method_index = 0; 73 | for (; method_index < mlist->method_count; method_index++) { 74 | if (mlist->method_list[method_index].method_name == origSel_) { 75 | assert(!directOriginalMethod); 76 | directOriginalMethod = &mlist->method_list[method_index]; 77 | } 78 | if (mlist->method_list[method_index].method_name == altSel_) { 79 | assert(!directAlternateMethod); 80 | directAlternateMethod = &mlist->method_list[method_index]; 81 | } 82 | } 83 | mlist = class_nextMethodList(self, &iterator); 84 | } 85 | 86 | // If either method is inherited, copy it up to the target class to make it non-inherited. 87 | if (!directOriginalMethod || !directAlternateMethod) { 88 | Method inheritedOriginalMethod = NULL, inheritedAlternateMethod = NULL; 89 | if (!directOriginalMethod) { 90 | inheritedOriginalMethod = class_getInstanceMethod(self, origSel_); 91 | if (!inheritedOriginalMethod) { 92 | SetNSError(error_, @"original method %@ not found for class %@", NSStringFromSelector(origSel_), [self className]); 93 | return NO; 94 | } 95 | } 96 | if (!directAlternateMethod) { 97 | inheritedAlternateMethod = class_getInstanceMethod(self, altSel_); 98 | if (!inheritedAlternateMethod) { 99 | SetNSError(error_, @"alternate method %@ not found for class %@", NSStringFromSelector(altSel_), [self className]); 100 | return NO; 101 | } 102 | } 103 | 104 | int hoisted_method_count = !directOriginalMethod && !directAlternateMethod ? 2 : 1; 105 | struct objc_method_list *hoisted_method_list = malloc(sizeof(struct objc_method_list) + (sizeof(struct objc_method)*(hoisted_method_count-1))); 106 | hoisted_method_list->obsolete = NULL; // soothe valgrind - apparently ObjC runtime accesses this value and it shows as uninitialized in valgrind 107 | hoisted_method_list->method_count = hoisted_method_count; 108 | Method hoisted_method = hoisted_method_list->method_list; 109 | 110 | if (!directOriginalMethod) { 111 | bcopy(inheritedOriginalMethod, hoisted_method, sizeof(struct objc_method)); 112 | directOriginalMethod = hoisted_method++; 113 | } 114 | if (!directAlternateMethod) { 115 | bcopy(inheritedAlternateMethod, hoisted_method, sizeof(struct objc_method)); 116 | directAlternateMethod = hoisted_method; 117 | } 118 | class_addMethods(self, hoisted_method_list); 119 | } 120 | 121 | // Swizzle. 122 | IMP temp = directOriginalMethod->method_imp; 123 | directOriginalMethod->method_imp = directAlternateMethod->method_imp; 124 | directAlternateMethod->method_imp = temp; 125 | 126 | return YES; 127 | #endif 128 | } 129 | 130 | + (BOOL)jr_swizzleClassMethod:(SEL)origSel_ withClassMethod:(SEL)altSel_ error:(NSError**)error_ { 131 | return [GetClass((id)self) jr_swizzleMethod:origSel_ withMethod:altSel_ error:error_]; 132 | } 133 | 134 | @end 135 | -------------------------------------------------------------------------------- /Miku/Configs/MikuMainMenuItem.m: -------------------------------------------------------------------------------- 1 | // 2 | // MikuMainMenuItem.m 3 | // ActivatePowerMode 4 | // 5 | // Created by Jobs on 16/1/15. 6 | // Copyright © 2015年 Jobs. All rights reserved. 7 | // 8 | 9 | #import "MikuMainMenuItem.h" 10 | #import "MikuConfigManager.h" 11 | #import "MikuWebView.h" 12 | #import "Miku.h" 13 | 14 | typedef NS_ENUM(NSUInteger, MenuItemType) { 15 | kMenuItemTypeEnablePlugin = 1, 16 | kMenuItemTypeEnableKeepDancing, 17 | kMenuItemTypeEnableMusicDefault, 18 | kMenuItemTypeEnableMusicNormal, 19 | kMenuItemTypeEnableMusicMute, 20 | }; 21 | 22 | 23 | @interface MikuMainMenuItem () 24 | 25 | @property (nonatomic, strong) NSMenuItem *keepDancingMenuItem; 26 | 27 | @property (nonatomic, strong) NSMenuItem *musicMenuItem; 28 | @property (nonatomic, strong) NSMenuItem *musicDefaultMenuItem; 29 | @property (nonatomic, strong) NSMenuItem *musicNormalMenuItem; 30 | @property (nonatomic, strong) NSMenuItem *musicMuteMenuItem; 31 | 32 | @end 33 | 34 | 35 | @implementation MikuMainMenuItem 36 | 37 | - (instancetype)init 38 | { 39 | if (self = [super init]) { 40 | 41 | self.title = [NSString stringWithFormat:@"Miku (v%@)", PluginVersion]; 42 | 43 | NSMenu *configMenu = [[NSMenu alloc] init]; 44 | configMenu.autoenablesItems = NSOffState; 45 | self.submenu = configMenu; 46 | 47 | MikuConfigManager *configManager = [MikuConfigManager sharedManager]; 48 | 49 | NSMenuItem *pluginMenuItem = [self menuItemWithTitle:@"Enable" type:kMenuItemTypeEnablePlugin]; 50 | pluginMenuItem.state = configManager.isEnablePlugin; 51 | [configMenu addItem:pluginMenuItem]; 52 | 53 | self.keepDancingMenuItem = [self menuItemWithTitle:@"Enable keep Dancing" type:kMenuItemTypeEnableKeepDancing]; 54 | self.keepDancingMenuItem.state = configManager.isEnableKeepDancing; 55 | self.keepDancingMenuItem.enabled = configManager.isEnablePlugin; 56 | [configMenu addItem:self.keepDancingMenuItem]; 57 | 58 | // MusicType Menu Item Begin 59 | 60 | self.musicMenuItem = [[NSMenuItem alloc] init]; 61 | self.musicMenuItem.title = @"Music Type"; 62 | self.musicMenuItem.enabled = configManager.isEnablePlugin; 63 | [configMenu addItem:self.musicMenuItem]; 64 | 65 | NSMenu *musicConfigMenu = [[NSMenu alloc] init]; 66 | musicConfigMenu.autoenablesItems = NSOffState; 67 | self.musicMenuItem.submenu = musicConfigMenu; 68 | 69 | MikuMusicType musicType = configManager.musicType; 70 | 71 | self.musicDefaultMenuItem = [self menuItemWithTitle:@"Default 🔈" type:kMenuItemTypeEnableMusicDefault]; 72 | self.musicDefaultMenuItem.state = (musicType == MikuMusicTypeDefault); 73 | [musicConfigMenu addItem:self.musicDefaultMenuItem]; 74 | 75 | self.musicNormalMenuItem = [self menuItemWithTitle:@"Normal 🔊" type:kMenuItemTypeEnableMusicNormal]; 76 | self.musicNormalMenuItem.state = (musicType == MikuMusicTypeNormal); 77 | [musicConfigMenu addItem:self.musicNormalMenuItem]; 78 | 79 | self.musicMuteMenuItem = [self menuItemWithTitle:@"Mute 🔇" type:kMenuItemTypeEnableMusicMute]; 80 | self.musicMuteMenuItem.state = (musicType == MikuMusicTypeMute); 81 | [musicConfigMenu addItem:self.musicMuteMenuItem]; 82 | 83 | // MusicType Menu Item End 84 | 85 | } 86 | 87 | return self; 88 | } 89 | 90 | 91 | - (NSMenuItem *)menuItemWithTitle:(NSString *)title type:(MenuItemType)type 92 | { 93 | NSMenuItem *menuItem = [[NSMenuItem alloc] init]; 94 | menuItem.title = title; 95 | menuItem.tag = type; 96 | menuItem.state = NSOffState; 97 | menuItem.target = self; 98 | menuItem.action = @selector(clickMenuItem:); 99 | return menuItem; 100 | } 101 | 102 | 103 | - (void)clickMenuItem:(NSMenuItem *)menuItem 104 | { 105 | menuItem.state = !menuItem.state; 106 | 107 | MikuConfigManager *configManager = [MikuConfigManager sharedManager]; 108 | MikuWebView *mikuWebView = [Miku sharedPlugin].mikuDragView.mikuWebView; 109 | 110 | MenuItemType type = menuItem.tag; 111 | 112 | switch (type) { 113 | 114 | case kMenuItemTypeEnablePlugin: 115 | configManager.enablePlugin = !configManager.isEnablePlugin; 116 | [Miku sharedPlugin].enablePlugin = configManager.isEnablePlugin; 117 | self.keepDancingMenuItem.enabled = configManager.isEnablePlugin; 118 | self.musicMenuItem.enabled = configManager.isEnablePlugin; 119 | break; 120 | 121 | case kMenuItemTypeEnableKeepDancing: 122 | configManager.enableKeepDancing = !configManager.isEnableKeepDancing; 123 | [mikuWebView setIsKeepDancing:configManager.isEnableKeepDancing]; 124 | break; 125 | 126 | case kMenuItemTypeEnableMusicDefault: 127 | configManager.musicType = MikuMusicTypeDefault; 128 | [mikuWebView setMusicType:configManager.musicType]; 129 | self.musicNormalMenuItem.state = NSOffState; 130 | self.musicMuteMenuItem.state = NSOffState; 131 | break; 132 | 133 | case kMenuItemTypeEnableMusicNormal: 134 | configManager.musicType = MikuMusicTypeNormal; 135 | [mikuWebView setMusicType:configManager.musicType]; 136 | self.musicDefaultMenuItem.state = NSOffState; 137 | self.musicMuteMenuItem.state = NSOffState; 138 | break; 139 | 140 | case kMenuItemTypeEnableMusicMute: 141 | configManager.musicType = MikuMusicTypeMute; 142 | [mikuWebView setMusicType:configManager.musicType]; 143 | self.musicDefaultMenuItem.state = NSOffState; 144 | self.musicNormalMenuItem.state = NSOffState; 145 | break; 146 | } 147 | } 148 | 149 | @end 150 | -------------------------------------------------------------------------------- /Miku/miku-dancing.coding.io/main.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by sunqi on 16/1/6. 3 | */ 4 | 5 | var dancingTime = 3; 6 | var audio = document.querySelector('#miku-music'); 7 | var battery = document.querySelector('#battery'); 8 | var play = true; 9 | var mute = false; 10 | var music = false; 11 | var dance = false; 12 | var container; 13 | 14 | var playIndex = 0; 15 | var playList = ['./resources/bgm.mp3']; 16 | resetMusicSrc(); 17 | 18 | var mesh, camera, scene, renderer; 19 | 20 | var directionalLight; 21 | 22 | var ikSolver; 23 | 24 | var windowWidth = window.innerWidth; 25 | var windowHeight = window.innerHeight; 26 | 27 | var windowHalfX = window.innerWidth / 2; 28 | var windowHalfY = window.innerHeight / 2; 29 | 30 | var clock = new THREE.Clock(); 31 | 32 | init(); 33 | animate(); 34 | 35 | 36 | //重新设置音乐地址 37 | function resetMusicSrc() { 38 | //随机播放 39 | playIndex = parseInt(Math.random() * playList.length, 10); 40 | audio.src = playList[playIndex]; 41 | } 42 | 43 | function init() { 44 | 45 | container = document.createElement( 'div' ); 46 | document.body.appendChild( container ); 47 | 48 | camera = new THREE.PerspectiveCamera( 45, window.innerWidth / window.innerHeight, 1, 2000 ); 49 | camera.position.z = 35; 50 | 51 | // scene 52 | 53 | scene = new THREE.Scene(); 54 | 55 | camera.lookAt(scene.position); 56 | 57 | 58 | var ambient = new THREE.AmbientLight( 0x444444 ); 59 | scene.add( ambient ); 60 | 61 | directionalLight = new THREE.DirectionalLight( 0xFFEEDD ); 62 | directionalLight.position.set( -1, 1, 1 ).normalize(); 63 | scene.add( directionalLight ); 64 | 65 | //加载mmd模型 66 | var onProgress = function ( xhr ) { 67 | if ( xhr.lengthComputable ) { 68 | var percentComplete = xhr.loaded / xhr.total * 100; 69 | console.log( Math.round(percentComplete, 2) + '% downloaded' ); 70 | } 71 | }; 72 | 73 | var onError = function ( xhr ) { 74 | }; 75 | 76 | var loader = new THREE.MMDLoader(); 77 | loader.load( 'models/mmd/miku_v2.pmd', 'models/mmd/wavefile_v2.vmd', function ( object ) { 78 | 79 | //加载完后赠送10秒播放时间 80 | dancingTime = 10; 81 | audio.play(); 82 | //audio.loop = true; 83 | audio.onended = function(){ 84 | resetMusicSrc(); 85 | audio.onloadeddata = function(){ 86 | audio.play(); 87 | } 88 | } 89 | 90 | mesh = object; 91 | 92 | mesh.position.y = -10; 93 | scene.add( mesh ); 94 | 95 | var animation = new THREE.Animation( mesh, mesh.geometry.animation ); 96 | animation.play(); 97 | 98 | var morphAnimation = new THREE.MorphAnimation2( mesh, mesh.geometry.morphAnimation ); 99 | morphAnimation.play(); 100 | 101 | ikSolver = new THREE.CCDIKSolver( mesh ); 102 | 103 | }, onProgress, onError ); 104 | 105 | renderer = new THREE.WebGLRenderer({ alpha: true, antialias: true }); 106 | renderer.setPixelRatio( window.devicePixelRatio ); 107 | renderer.setSize( windowWidth, windowHeight ); 108 | container.appendChild( renderer.domElement ); 109 | window.addEventListener( 'resize', onWindowResize, false ); 110 | } 111 | 112 | function onWindowResize() { 113 | windowWidth = window.innerWidth; 114 | windowHeight = window.innerHeight; 115 | windowHalfX = window.innerWidth / 2; 116 | windowHalfY = window.innerHeight / 2; 117 | camera.aspect = windowWidth / windowHeight; 118 | camera.updateProjectionMatrix(); 119 | renderer.setSize( windowWidth, windowHeight ); 120 | } 121 | 122 | function onDocumentMouseMove( event ) { 123 | 124 | mouseX = ( event.clientX - windowHalfX ) / 2; 125 | mouseY = ( event.clientY - windowHalfY ) / 2; 126 | 127 | } 128 | 129 | 130 | function animate() { 131 | requestAnimationFrame( animate ); 132 | var delta = clock.getDelta(); 133 | render(delta); 134 | } 135 | 136 | function render(delta) { 137 | 138 | if( mesh && play ) { 139 | /* 140 | * 将getDelta的调用放在if判定的外部很重要哦 141 | * */ 142 | //var delta = clock.getDelta(); 143 | if(dancingTime > 0 || dance) { 144 | dancingTime -= delta; 145 | THREE.AnimationHandler.update( delta ); 146 | battery.style.display = 'none'; 147 | directionalLight.color.setHex(0xFFEEDD); 148 | if(mute){ 149 | audio.volume = 0; 150 | }else{ 151 | audio.volume = 1; 152 | audio.playbackRate = 1; 153 | } 154 | }else{ 155 | THREE.AnimationHandler.update( 0.003 ); 156 | battery.style.display = 'block'; 157 | directionalLight.color.setHex(0xFF9999); 158 | 159 | if(mute){ 160 | audio.volume = 0; 161 | }else if(music){ 162 | audio.volume = 1; 163 | audio.playbackRate = 1; 164 | }else{ 165 | audio.volume = 0.5; 166 | audio.playbackRate = 0.5; 167 | } 168 | } 169 | if( ikSolver ) { 170 | ikSolver.update(); 171 | } 172 | 173 | } 174 | camera.updateProjectionMatrix(); 175 | renderer.render( scene, camera ); 176 | } 177 | 178 | 179 | /* 180 | * 交互控制模块 181 | * */ 182 | 183 | var Control = function(){ 184 | this.render = renderer; 185 | this.camera = camera; 186 | this.scene = scene; 187 | } 188 | Control.prototype = { 189 | addFrame: function(s){ 190 | var seconds = s ? s : 3; 191 | dancingTime = seconds; 192 | }, 193 | play: function(){ 194 | play = true; 195 | audio.play(); 196 | }, 197 | pause: function(){ 198 | play = false; 199 | audio.pause(); 200 | }, 201 | mute: function(flag) { 202 | mute = flag; 203 | }, 204 | music: function(flag){ 205 | music = flag; 206 | audio.volume = 1; 207 | audio.playbackRate = 1; 208 | }, 209 | dance: function(flag){ 210 | dance = flag; 211 | }, 212 | setPlayList: function(list){ 213 | if (list.length == 0) { 214 | return; 215 | } 216 | playList = list; 217 | resetMusicSrc(); 218 | audio.play() 219 | } 220 | 221 | } 222 | var control = new Control(); 223 | -------------------------------------------------------------------------------- /Miku/XcodeHeaders/DVTTextStorage.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated by class-dump 3.5 (64 bit). 3 | // 4 | // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard. 5 | // 6 | 7 | //#import "NSTextStorage.h" 8 | 9 | //#import "DVTSourceBufferProvider.h" 10 | //#import "DVTSourceLanguageServiceDelegate.h" 11 | 12 | @class DVTFontAndColorTheme, DVTObservingToken, DVTSourceCodeLanguage, DVTSourceLandmarkItem, DVTSourceLanguageService, DVTSourceLanguageService, DVTSourceModel, NSDictionary, NSMutableAttributedString, NSString, NSTimer, _LazyInvalidationHelper; 13 | 14 | //@interface DVTTextStorage : NSTextStorage 15 | @interface DVTTextStorage : NSTextStorage 16 | { 17 | NSMutableAttributedString *_contents; 18 | // struct _DVTTextLineOffsetTable _lineOffsets; 19 | unsigned long long _changeCapacity; 20 | unsigned long long _numChanges; 21 | struct _DVTTextChangeEntry *_changes; 22 | DVTSourceCodeLanguage *_language; 23 | NSTimer *_sourceModelUpdater; 24 | DVTSourceLandmarkItem *_topSourceLandmark; 25 | DVTSourceLandmarkItem *_rootImportLandmark; 26 | NSTimer *_landmarksCacheTimer; 27 | double _lastEditTimestamp; 28 | unsigned long long _tabWidth; 29 | unsigned long long _indentWidth; 30 | unsigned long long _wrappedLineIndentWidth; 31 | DVTObservingToken *_wrappedLinesIndentObserver; 32 | double _advancementForSpace; 33 | DVTFontAndColorTheme *_fontAndColorTheme; 34 | struct _NSRange _rangeNeedingInvalidation; 35 | struct { 36 | unsigned int lineEndings:2; 37 | unsigned int usesTabs:1; 38 | unsigned int syntaxColoringEnabled:1; 39 | unsigned int processingLazyInvalidation:1; 40 | unsigned int breakChangeCoalescing:1; 41 | unsigned int doingBatchEdit:1; 42 | unsigned int batchEditMayContainTokens:1; 43 | unsigned int batchEditMayContainLinks:1; 44 | unsigned int batchEditMayContainAttachments:1; 45 | unsigned int doingSubwordMovement:1; 46 | unsigned int doingExpressionMovement:1; 47 | unsigned int delegateRespondsToShouldAllowEditing:1; 48 | unsigned int delegateRespondsToDidUpdateSourceLandmarks:1; 49 | unsigned int delegateRespondsToNodeTypeForItem:1; 50 | unsigned int delegateRespondsToSourceLanguageServiceContext:1; 51 | unsigned int forceFixAttributes:1; 52 | unsigned int languageServiceSupportsSourceModel:1; 53 | } _tsflags; 54 | _LazyInvalidationHelper *_lazyInvalidationHelper; 55 | // DVTSourceLanguageService *_sourceLanguageService; 56 | DVTObservingToken *_sourceLanguageServiceContextObservingToken; 57 | } 58 | 59 | + (id)_changeTrackingLogAspect; 60 | + (id)_sourceLandmarksLogAspect; 61 | + (void)initialize; 62 | + (id)keyPathsForValuesAffectingSourceLanguageServiceContext; 63 | + (BOOL)usesScreenFonts; 64 | //- (void).cxx_destruct; 65 | - (id)_ancestorItemForTokenizableItem:(id)arg1; 66 | - (id)_associatedTextViews; 67 | - (id)_debugInfoForChangeIndex:(unsigned long long)arg1 toChangeIndex:(unsigned long long)arg2; 68 | - (id)_debugInfoString; 69 | - (id)_debugStringFromUnsignedIntegers:(const unsigned long long *)arg1 count:(unsigned long long)arg2; 70 | - (void)_dropRecomputableState; 71 | - (void)_dumpChangeHistory; 72 | - (void)_dumpLineOffsetsTable; 73 | - (void)_dvtTextStorageCommonInit; 74 | - (BOOL)_forceFixAttributes; 75 | - (long long)_getIndentForObjectLiteral:(id)arg1 atLocation:(unsigned long long)arg2; 76 | - (void)_invalidateCallback:(id)arg1; 77 | - (void)_invalidateSourceLandmarks:(id)arg1; 78 | - (BOOL)_isExpressionItemLikeFunction:(id)arg1; 79 | - (BOOL)_isExpressionItemLikelyTarget:(id)arg1; 80 | - (BOOL)_isInvalidObjectLiteralItem:(id)arg1; 81 | - (BOOL)_isItemBlockExpression:(id)arg1; 82 | - (BOOL)_isItemBracketExpression:(id)arg1; 83 | - (BOOL)_isItemBracketLikeExpression:(id)arg1; 84 | - (BOOL)_isItemExpression:(id)arg1; 85 | - (BOOL)_isItemParenExpression:(id)arg1; 86 | - (BOOL)_isTextEmptyInBetweenItem:(id)arg1 prevItem:(id)arg2; 87 | - (id)_parenLikeItemAtLocation:(unsigned long long)arg1; 88 | - (void)_processLazyInvalidation; 89 | - (void)_restoreRecomputableState; 90 | - (unsigned long long)_reverseParseExpressionFromIndex:(unsigned long long)arg1 ofParent:(id)arg2; 91 | - (void)_setForceFixAttributes:(BOOL)arg1; 92 | - (id)_sourceLandmarkAtCharacterIndex:(unsigned long long)arg1 inLandmarkItems:(id)arg2; 93 | - (unsigned long long)_startLocationForObjCMethodCallAtLocation:(unsigned long long)arg1 withArgs:(char *)arg2; 94 | - (id)_textInBetweenItem:(id)arg1 prevItem:(id)arg2; 95 | - (void)_themeColorsChanged:(id)arg1; 96 | - (void)_updateLazyInvalidationForEditedRange:(struct _NSRange)arg1 changeInLength:(long long)arg2; 97 | - (void)addAttribute:(id)arg1 value:(id)arg2 range:(struct _NSRange)arg3; 98 | - (void)addAttributes:(id)arg1 range:(struct _NSRange)arg2; 99 | - (void)addLayoutManager:(id)arg1; 100 | @property(readonly) double advancementForSpace; 101 | @property(readonly) double advancementForTab; 102 | - (id)attribute:(id)arg1 atIndex:(unsigned long long)arg2 effectiveRange:(struct _NSRange *)arg3; 103 | - (id)attribute:(id)arg1 atIndex:(unsigned long long)arg2 longestEffectiveRange:(struct _NSRange *)arg3 inRange:(struct _NSRange)arg4; 104 | - (id)attributedSubstringFromRange:(struct _NSRange)arg1; 105 | - (id)attributesAtIndex:(unsigned long long)arg1 effectiveRange:(struct _NSRange *)arg2; 106 | - (id)attributesAtIndex:(unsigned long long)arg1 longestEffectiveRange:(struct _NSRange *)arg2 inRange:(struct _NSRange)arg3; 107 | @property BOOL batchEditMayContainAttachments; 108 | @property BOOL batchEditMayContainLinks; 109 | @property BOOL batchEditMayContainTokens; 110 | - (void)beginEditing; 111 | - (void)breakChangeTrackingCoalescing; 112 | - (unsigned long long)changeIndexForTimestamp:(double)arg1; 113 | - (struct _NSRange)characterRangeForCharacterRange:(struct _NSRange)arg1 fromChangeIndex:(unsigned long long)arg2 toChangeIndex:(unsigned long long)arg3; 114 | - (struct _NSRange)characterRangeForCharacterRange:(struct _NSRange)arg1 fromTimestamp:(double)arg2 toTimestamp:(double)arg3; 115 | - (struct _NSRange)characterRangeForLineRange:(struct _NSRange)arg1; 116 | - (struct _NSRange)characterRangeFromDocumentLocation:(id)arg1; 117 | - (void)clearChangeHistory; 118 | - (id)colorAtCharacterIndex:(unsigned long long)arg1 effectiveRange:(struct _NSRange *)arg2 context:(id)arg3; 119 | - (long long)columnForPositionConvertingTabs:(unsigned long long)arg1; 120 | - (id)compatibleLocationFromLocation:(id)arg1; 121 | - (id)contents; 122 | - (id)convertLocationToNativeNSStringEncodedLocation:(id)arg1; 123 | - (id)convertLocationToUTF8EncodedLocation:(id)arg1; 124 | @property(readonly) unsigned long long currentChangeIndex; 125 | - (struct _NSRange)currentWordAtIndex:(unsigned long long)arg1; 126 | - (void)dealloc; 127 | - (void)delayedInvalidateDisplayForLineRange:(struct _NSRange)arg1; 128 | //@property id delegate; 129 | @property(readonly, copy) NSString *description; 130 | - (void)didReplaceCharactersInRange:(struct _NSRange)arg1 withString:(id)arg2 changeInLength:(long long)arg3 replacedString:(id)arg4; 131 | - (void)doingBatchEdit:(BOOL)arg1; 132 | - (void)doingBatchEdit:(BOOL)arg1 notifyModel:(BOOL)arg2; 133 | - (struct _NSRange)doubleClickAtIndex:(unsigned long long)arg1 inRange:(struct _NSRange)arg2; 134 | - (unsigned long long)dvt_nextWordFromIndex:(unsigned long long)arg1 forward:(BOOL)arg2; 135 | - (void)endEditing; 136 | - (unsigned long long)firstColonAfterItem:(id)arg1 inRange:(struct _NSRange)arg2; 137 | - (long long)firstNonblankForLine:(long long)arg1 convertTabs:(BOOL)arg2; 138 | - (void)fixAttachmentAttributeInRange:(struct _NSRange)arg1; 139 | - (void)fixAttributesInRange:(struct _NSRange)arg1; 140 | - (void)fixSyntaxColoringInRange:(struct _NSRange)arg1; 141 | - (BOOL)fixesAttributesLazily; 142 | @property(retain) DVTFontAndColorTheme *fontAndColorTheme; 143 | - (struct _NSRange)functionOrMethodBodyRangeAtIndex:(unsigned long long)arg1; 144 | - (struct _NSRange)functionRangeAtIndex:(unsigned long long)arg1 isDefinitionOrCall:(char *)arg2; 145 | - (long long)getIndentForLine:(long long)arg1; 146 | - (id)getTextForLineSansBlanks:(long long)arg1; 147 | @property(readonly) BOOL hasPendingSourceLandmarkInvalidation; 148 | - (id)importLandmarkItems; 149 | - (id)importStatementStringAtCharacterIndex:(unsigned long long)arg1; 150 | - (id)importStatementStringAtCharacterIndex:(unsigned long long)arg1 effectiveRange:(struct _NSRange *)arg2 isModule:(char *)arg3; 151 | - (BOOL)indentAtBeginningOfLineForCharacterRange:(struct _NSRange)arg1 undoManager:(id)arg2; 152 | - (void)indentCharacterRange:(struct _NSRange)arg1 undoManager:(id)arg2; 153 | - (BOOL)indentLine:(long long)arg1 options:(unsigned long long)arg2 undoManager:(id)arg3; 154 | - (void)indentLineRange:(struct _NSRange)arg1 undoManager:(id)arg2; 155 | @property unsigned long long indentWidth; // @synthesize indentWidth=_indentWidth; 156 | - (double)indentationForWrappedLineAtIndex:(unsigned long long)arg1; 157 | - (id)init; 158 | - (id)initWithAttributedString:(id)arg1; 159 | - (id)initWithOwnedMutableAttributedString:(id)arg1; 160 | - (id)initWithString:(id)arg1; 161 | - (id)initWithString:(id)arg1 attributes:(id)arg2; 162 | - (void)invalidateAllLandmarks; 163 | - (void)invalidateAttributesInRange:(struct _NSRange)arg1; 164 | - (void)invalidateDisplayForLineRange:(struct _NSRange)arg1; 165 | - (void)invalidateDisplayInRange:(struct _NSRange)arg1; 166 | - (void)invalidateLayoutForLineRange:(struct _NSRange)arg1; 167 | - (BOOL)isAtBOL:(struct _NSRange)arg1; 168 | - (BOOL)isAtFirstArgumentInMethodCallAtLocation:(unsigned long long)arg1 inCall:(char *)arg2; 169 | - (BOOL)isDoingBatchEdit; 170 | @property(readonly) BOOL isEditable; 171 | @property(getter=isExpressionMovement) BOOL expressionMovement; 172 | @property(readonly, getter=isIndentable) BOOL indentable; 173 | @property(getter=isSubwordMovement) BOOL subwordMovement; 174 | @property(getter=isSyntaxColoringEnabled) BOOL syntaxColoringEnabled; 175 | @property(copy) DVTSourceCodeLanguage *language; 176 | //@property(readonly) DVTSourceLanguageService *languageService; 177 | @property double lastEditTimestamp; // @synthesize lastEditTimestamp=_lastEditTimestamp; 178 | - (unsigned long long)leadingWhitespacePositionsForLine:(unsigned long long)arg1; 179 | - (unsigned long long)length; 180 | - (unsigned long long)lineBreakBeforeIndex:(unsigned long long)arg1 withinRange:(struct _NSRange)arg2; 181 | @property unsigned long long lineEndings; 182 | - (struct _NSRange)lineRangeForCharacterRange:(struct _NSRange)arg1; 183 | - (struct _NSRange)lineRangeForLineRange:(struct _NSRange)arg1 fromChangeIndex:(unsigned long long)arg2 toChangeIndex:(unsigned long long)arg3; 184 | - (struct _NSRange)lineRangeForLineRange:(struct _NSRange)arg1 fromTimestamp:(double)arg2 toTimestamp:(double)arg3; 185 | - (unsigned long long)locationForOpeningBracketForClosingBracket:(unsigned long long)arg1 withArgs:(char *)arg2; 186 | - (struct _NSRange)methodCallRangeAtIndex:(unsigned long long)arg1; 187 | - (struct _NSRange)methodDefinitionRangeAtIndex:(unsigned long long)arg1; 188 | - (unsigned long long)nextExpressionFromIndex:(unsigned long long)arg1 forward:(BOOL)arg2; 189 | - (unsigned long long)nextWordFromIndex:(unsigned long long)arg1 forward:(BOOL)arg2; 190 | - (long long)nodeTypeAtCharacterIndex:(unsigned long long)arg1 effectiveRange:(struct _NSRange *)arg2 context:(id)arg3; 191 | - (long long)nodeTypeForTokenizableItem:(id)arg1; 192 | @property(readonly) unsigned long long numberOfLines; 193 | - (void)processEditing; 194 | @property BOOL processingLazyInvalidation; 195 | - (struct _NSRange)rangeOfWordAtIndex:(unsigned long long)arg1; 196 | - (struct _NSRange)rangeOfWordAtIndex:(unsigned long long)arg1 allowNonWords:(BOOL)arg2; 197 | - (void)removeAttribute:(id)arg1 range:(struct _NSRange)arg2; 198 | - (void)replaceCharactersInRange:(struct _NSRange)arg1 withAttributedString:(id)arg2; 199 | - (void)replaceCharactersInRange:(struct _NSRange)arg1 withAttributedString:(id)arg2 withUndoManager:(id)arg3; 200 | - (void)replaceCharactersInRange:(struct _NSRange)arg1 withString:(id)arg2; 201 | - (void)replaceCharactersInRange:(struct _NSRange)arg1 withString:(id)arg2 evenIfNotEditable:(BOOL)arg3; 202 | - (void)replaceCharactersInRange:(struct _NSRange)arg1 withString:(id)arg2 withUndoManager:(id)arg3; 203 | - (void)resetAdvancementForSpace; 204 | - (void)scheduleLazyInvalidationForRange:(struct _NSRange)arg1; 205 | - (void)setAttributes:(id)arg1 range:(struct _NSRange)arg2; 206 | @property(nonatomic) unsigned long long tabWidth; 207 | @property BOOL usesTabs; 208 | @property unsigned long long wrappedLineIndentWidth; // @synthesize wrappedLineIndentWidth=_wrappedLineIndentWidth; 209 | - (id)sourceLandmarkAtCharacterIndex:(unsigned long long)arg1; 210 | @property(readonly, nonatomic) NSDictionary *sourceLanguageServiceContext; 211 | @property(readonly) DVTSourceModel *sourceModel; 212 | //@property(readonly) DVTSourceLanguageService *sourceModelService; 213 | @property(readonly) DVTSourceModel *sourceModelWithoutParsing; 214 | - (id)string; 215 | - (id)stringBySwappingRange:(struct _NSRange)arg1 withAdjacentRange:(struct _NSRange)arg2; 216 | - (id)stringForItem:(id)arg1; 217 | - (id)symbolNameAtCharacterIndex:(unsigned long long)arg1 nameRanges:(id *)arg2; 218 | - (long long)syntaxTypeForItem:(id)arg1 context:(id)arg2; 219 | @property(readonly) DVTSourceLandmarkItem *topSourceLandmark; 220 | - (void)updateAttributesInRange:(struct _NSRange)arg1; 221 | - (id)updatedLocationFromLocation:(id)arg1 toTimestamp:(double)arg2; 222 | - (void)willReplaceCharactersInRange:(struct _NSRange)arg1 withString:(id)arg2 changeInLength:(long long)arg3; 223 | 224 | // Remaining properties 225 | @property(readonly, copy) NSString *debugDescription; 226 | @property(readonly) unsigned long long hash; 227 | @property(readonly) Class superclass; 228 | 229 | @end 230 | 231 | -------------------------------------------------------------------------------- /Miku/XcodeHeaders/IDESourceCodeDocument.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated by class-dump 3.5 (64 bit). 3 | // 4 | // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard. 5 | // 6 | 7 | //#import "IDEEditorDocument.h" 8 | 9 | #import "DVTTextStorage.h" 10 | //#import "DVTSourceLandmarkProvider.h" 11 | //#import "DVTSourceTextViewDelegate.h" 12 | //#import "DVTTextFindable.h" 13 | //#import "DVTTextReplacable.h" 14 | //#import "DVTTextStorageDelegate.h" 15 | //#import "IDEDiagnosticControllerDataSource.h" 16 | //#import "IDEDocumentStructureProviding.h" 17 | //#import "IDEObjectiveCSourceCodeGenerationDestination.h" 18 | //#import "IDESourceCodeDocument.h" 19 | 20 | @class DVTDelayedInvocation, DVTFileDataType, DVTGeneratedContentProvider, DVTNotificationToken, DVTObservingToken, DVTPerformanceMetric, DVTSourceCodeLanguage, DVTTextStorage, IDEDiagnosticController, IDEGeneratedContentStatusContext, IDESchemeActionCodeCoverageFile, IDESourceCodeAdjustNodeTypesRequest, NSArray, NSDictionary, NSMutableArray, NSMutableSet, NSSet, NSString, NSURL; 21 | 22 | //@interface IDESourceCodeDocument : IDEEditorDocument 23 | @interface IDESourceCodeDocument : NSDocument 24 | { 25 | DVTTextStorage *_textStorage; 26 | DVTSourceCodeLanguage *_language; 27 | IDEDiagnosticController *_diagnosticController; 28 | NSArray *_sourceLandmarks; 29 | NSMutableSet *_pendingAdjustNodeTypeRequests; 30 | IDESourceCodeAdjustNodeTypesRequest *_lastAdjustNodeTypesRequest; 31 | struct _NSRange _prefetchedNodeTypesLineRange; 32 | DVTGeneratedContentProvider *_generatedContentProvider; 33 | IDEGeneratedContentStatusContext *_generatedContentStatusContext; 34 | BOOL _generatesContent; 35 | DVTObservingToken *_generatedContentProviderDisplayNameObserver; 36 | DVTNotificationToken *_indexDidIndexWorkspaceObserver; 37 | DVTNotificationToken *_indexDidChangeObserver; 38 | unsigned long long _lineEndings; 39 | unsigned long long _textEncoding; 40 | BOOL _usesLanguageFromFileDataType; 41 | BOOL _languageSupportsSymbolColoring; 42 | BOOL _setUpPrintInfoDefaults; 43 | BOOL _isUnicodeWithBOM; 44 | BOOL _isUnicodeBE; 45 | BOOL _droppedRecomputableState; 46 | DVTDelayedInvocation *_dropRecomputableState; 47 | DVTObservingToken *_firstEditorWorkspaceToken; 48 | DVTObservingToken *_firstEditorWorkspaceActiveSchemeToken; 49 | DVTNotificationToken *_firstEditorWorkspaceActiveSchemeBuildablesDidChangeToken; 50 | NSMutableArray *_registeredEditors; 51 | BOOL _notifiesWhenClosing; 52 | BOOL _hasCoverageData; 53 | IDESchemeActionCodeCoverageFile *_coverageData; 54 | NSSet *__firstEditorWorkspacePreferredIndexableIdentifiers; 55 | NSDictionary *__firstEditorWorkspaceBuildSettings; 56 | } 57 | 58 | + (void)initialize; 59 | + (id)keyPathsForValuesAffectingSourceLanguageServiceContext; 60 | + (id)keyPathsForValuesAffecting_firstEditorWorkspace; 61 | + (id)syntaxColoringPrefetchLogAspect; 62 | + (id)topLevelStructureLogAspect; 63 | //- (void).cxx_destruct; 64 | - (void)_adjustNodeTypeForIdentifierItem:(id)arg1 withContext:(id)arg2; 65 | //- (id)_classModelItemForClassNamed:(id)arg1 withConditionBlock:(CDUnknownBlockType)arg2; 66 | - (void)_configureDocumentReadFromURL:(id)arg1 orData:(id)arg2 ofType:(id)arg3 usedEncoding:(unsigned long long)arg4 preferredLineEndings:(unsigned long long)arg5 readOutAttributes:(id)arg6; 67 | - (void)_delayedDropRecomputableState:(id)arg1; 68 | - (void)_documentMovingToBackground:(BOOL)arg1; 69 | - (void)_documentMovingToForeground; 70 | - (void)_dropRecomputableState; 71 | - (id)_firstEditor; 72 | - (id)_firstEditorWorkspace; 73 | @property(copy) NSDictionary *_firstEditorWorkspaceBuildSettings; // @synthesize _firstEditorWorkspaceBuildSettings=__firstEditorWorkspaceBuildSettings; 74 | @property(copy) NSSet *_firstEditorWorkspacePreferredIndexableIdentifiers; // @synthesize _firstEditorWorkspacePreferredIndexableIdentifiers=__firstEditorWorkspacePreferredIndexableIdentifiers; 75 | - (id)_firstObjCSourceModelItemToInsertBeforeInInstanceVariableBlock:(id)arg1; 76 | - (id)_firstTopLevelObjCInterfaceSourceModelItemToInsertBeforeInClassItem:(id)arg1; 77 | - (BOOL)_hasObjCMethodImplementationForName:(id)arg1 forClassNamed:(id)arg2; 78 | - (id)_insertObjCSourceCode:(id)arg1 inContainingSourceModelItem:(id)arg2 asCloseAsPossibleToLineNumber:(unsigned long long)arg3 firstPossibleItemToInsertBefore:(id)arg4 error:(id *)arg5; 79 | //- (id)_insertObjCSourceCode:(id)arg1 inContainingSourceModelItem:(id)arg2 withInsertAfterHint:(id)arg3 andInsertBeforeHint:(id)arg4 ignoreHintItemsConformingToSpecifications:(id)arg5 onlyConsiderItemsConformingToSpecifications:(id)arg6 insertAdditionalNewline:(BOOL)arg7 fallbackInsertionBlock:(CDUnknownBlockType)arg8; 80 | - (id)_insertObjCSourceCode:(id)arg1 inTopLevelOfClassItem:(id)arg2 asCloseAsPossibleToLineNumber:(unsigned long long)arg3 error:(id *)arg4; 81 | - (id)_insertObjCSourceCode:(id)arg1 inTopLevelOfClassItem:(id)arg2 withInsertAfterHint:(id)arg3 andInsertBeforeHint:(id)arg4 ignoreHintItemsConformingToSpecifications:(id)arg5 onlyConsiderItemsConformingToSpecifications:(id)arg6 insertAdditionalNewline:(BOOL)arg7 insertAtEndWhenInsertingWithoutHint:(BOOL)arg8 insertAfterObjCBlockWhenInsertingAtBeginning:(BOOL)arg9; 82 | - (id)_insertObjectiveCSourceCode:(id)arg1 inTeardownMethodForClassNamed:(id)arg2 options:(id)arg3 error:(id *)arg4; 83 | - (id)_insertSourceCode:(id)arg1 atBeginningOfClassSourceModelItem:(id)arg2 insertOnNextLine:(BOOL)arg3 insertAfterObjCBlock:(BOOL)arg4; 84 | //- (id)_insertSourceCode:(id)arg1 atBeginningOfContainingSourceModelItem:(id)arg2 insertOnNextLine:(BOOL)arg3 afterItemMatchingPredicateBlock:(CDUnknownBlockType)arg4; 85 | - (id)_insertSourceCode:(id)arg1 atEndOfClassSourceModelItem:(id)arg2 insertOnNextLine:(BOOL)arg3; 86 | //- (id)_insertSourceCode:(id)arg1 atEndOfContainingSourceModelItem:(id)arg2 insertOnNextLine:(BOOL)arg3 beforeItemMatchingPredicateBlock:(CDUnknownBlockType)arg4; 87 | - (id)_insertionHintForObjCSourceModelItem:(id)arg1; 88 | - (long long)_insertionHintMatchPriorityForObjCSourceModelItem:(id)arg1 givenInsertionHintItemName:(id)arg2 andLanguageSpecification:(id)arg3 ignoreItemsConformingToSpecifications:(id)arg4 onlyConsiderItemsConformingToSpecifications:(id)arg5; 89 | - (id)_instanceVariableDeclarationBlockItemForClassItem:(id)arg1; 90 | - (unsigned long long)_lineEndingUsedInString:(id)arg1; 91 | - (id)_objCCategoryImplementationClassModelItemForClassNamed:(id)arg1 categoryName:(id)arg2 error:(id *)arg3; 92 | - (id)_objCCategoryInterfaceClassModelItemForClassNamed:(id)arg1 categoryName:(id)arg2 options:(id)arg3 error:(id *)arg4; 93 | - (id)_objCImplementationClassModelItemForClassNamed:(id)arg1 error:(id *)arg2; 94 | - (id)_objCInterfaceClassModelItemForClassNamed:(id)arg1 error:(id *)arg2; 95 | - (id)_objCMethodImplementationItemForName:(id)arg1 inClassItem:(id)arg2; 96 | - (void)_prefetchNodeTypesForLineRange:(struct _NSRange)arg1 withContext:(id)arg2; 97 | - (id)_primitiveAddObjectiveCMethodSourceCode:(id)arg1 toClassItem:(id)arg2 withOptions:(id)arg3 error:(id *)arg4; 98 | - (id)_primitiveAddObjectiveCReleaseForTeardownMethodWithSourceCodeGenerator:(id)arg1 withReleaseCallCode:(id)arg2 inClassNamed:(id)arg3 options:(id)arg4 error:(id *)arg5; 99 | - (id)_primitiveAddObjectiveCSourceCode:(id)arg1 toClassItem:(id)arg2 withOptions:(id)arg3 insertAdditionalNewlineWhenInsertingWithAfterBeforeHint:(BOOL)arg4 insertAtEndWhenInsertingWithoutHint:(BOOL)arg5 insertAfterObjCBlockWhenInsertingAtBeginning:(BOOL)arg6 ignoreHintItemsConformingToSpecifications:(id)arg7 onlyConsiderItemsConformingToSpecifications:(id)arg8 error:(id *)arg9; 100 | - (id)_primitiveAppendObjectiveCSourceCode:(id)arg1 afterItem:(id)arg2 prependNewLine:(BOOL)arg3; 101 | //- (id)_primitiveInsertSourceCode:(id)arg1 atBeginning:(BOOL)arg2 ofContainingSourceModelItem:(id)arg3 insertOnNextLine:(BOOL)arg4 afterOrBeforeItemMatchingPredicateBlock:(CDUnknownBlockType)arg5; 102 | - (id)_readOptionsDictionaryForURL:(id)arg1 preferredEncoding:(unsigned long long)arg2 inOutData:(id *)arg3; 103 | - (void)_restoreRecomputableState; 104 | - (id)_sourceCodeTreeRangesInRange:(struct _NSRange)arg1; 105 | - (id)_stringByFlatteningMultiPathTokensWithString:(id)arg1; 106 | - (id)_teardownMethodNameForSourceCodeGeneratorWithOptions:(id)arg1; 107 | - (id)buildSettings; 108 | - (BOOL)canSave; 109 | - (BOOL)canSaveAs; 110 | - (struct _NSRange)characterRangeFromDocumentLocation:(id)arg1; 111 | - (void)closeToRevert; 112 | @property(retain) IDESchemeActionCodeCoverageFile *coverageData; // @synthesize coverageData=_coverageData; 113 | - (id)dataOfType:(id)arg1 error:(id *)arg2; 114 | - (long long)defaultPropertyAccessControl; 115 | - (id)derivedContentProviderForType:(id)arg1; 116 | @property(readonly, copy) NSString *description; 117 | @property(readonly) IDEDiagnosticController *diagnosticController; // @synthesize diagnosticController=_diagnosticController; 118 | - (id)diffDataSource; 119 | - (id)displayName; 120 | - (id)documentLocationFromCharacterRange:(struct _NSRange)arg1; 121 | - (id)editedContents; 122 | - (id)editorCompatibleLocationFromLocation:(id)arg1; 123 | - (void)editorDocumentWillClose; 124 | - (id)emptyPrivateCopy; 125 | - (id)errorForNotFindingClassItemForClassNamed:(id)arg1 humanReadableClassItemType:(id)arg2; 126 | @property(readonly) DVTFileDataType *fileDataType; 127 | - (id)findStringMatchingDescriptor:(id)arg1 backwards:(BOOL)arg2 from:(id)arg3 to:(id)arg4; 128 | - (void)flattenTreePlaceholdersEnclosingRanges:(id)arg1; 129 | @property(retain) IDEGeneratedContentStatusContext *generatedContentStatusContext; // @synthesize generatedContentStatusContext=_generatedContentStatusContext; 130 | @property BOOL generatesContent; // @synthesize generatesContent=_generatesContent; 131 | @property BOOL hasCoverageData; // @synthesize hasCoverageData=_hasCoverageData; 132 | @property(readonly) NSArray *ideTopLevelStructureObjects; 133 | - (id)indexCompatibleLocationFromLocation:(id)arg1; 134 | - (id)init; 135 | - (void)initialPrefetchNodeTypesForLineRange:(struct _NSRange)arg1 withContext:(id)arg2; 136 | - (id)insertCharactersAfterLocation:(id)arg1 withString:(id)arg2; 137 | - (id)insertCharactersBeforeLocation:(id)arg1 withString:(id)arg2; 138 | - (void)invalidateAndDisableDiagnosticController; 139 | - (void)invalidateDiagnosticController; 140 | @property(readonly) NSArray *knownFileReferences; 141 | @property(retain, nonatomic) DVTSourceCodeLanguage *language; // @synthesize language=_language; 142 | @property(nonatomic) unsigned long long lineEndings; // @synthesize lineEndings=_lineEndings; 143 | - (struct _NSRange)lineRangeOfSourceLandmark:(id)arg1; 144 | - (long long)nodeTypeForItem:(id)arg1 withContext:(id)arg2; 145 | @property BOOL notifiesWhenClosing; // @synthesize notifiesWhenClosing=_notifiesWhenClosing; 146 | - (id)objectSpecifier; 147 | @property(readonly) DVTPerformanceMetric *openingPerformanceMetric; 148 | - (void)prefetchNodeTypesExtraLines:(unsigned long long)arg1 upDirection:(BOOL)arg2 withContext:(id)arg3; 149 | @property(readonly) struct _NSRange prefetchedNodeTypesLineRange; // @synthesize prefetchedNodeTypesLineRange=_prefetchedNodeTypesLineRange; 150 | - (id)printInfo; 151 | - (id)printOperationWithSettings:(id)arg1 error:(id *)arg2; 152 | - (id)privateCopy; 153 | - (BOOL)readFromData:(id)arg1 ofType:(id)arg2 error:(id *)arg3; 154 | - (BOOL)readFromURL:(id)arg1 ofType:(id)arg2 error:(id *)arg3; 155 | - (void)registerDocumentEditor:(id)arg1; 156 | - (id)replaceCharactersAtLocation:(id)arg1 withString:(id)arg2; 157 | - (id)replaceCharactersAtLocation:(id)arg1 withString:(id)arg2 options:(unsigned long long)arg3; 158 | - (BOOL)replaceFindResults:(id)arg1 inSelection:(struct _NSRange)arg2 withString:(id)arg3 withError:(id *)arg4; 159 | - (BOOL)replaceFindResults:(id)arg1 withString:(id)arg2 inSelection:(struct _NSRange)arg3 withError:(id *)arg4; 160 | - (BOOL)replaceFindResults:(id)arg1 withString:(id)arg2 withError:(id *)arg3; 161 | - (BOOL)replaceTextWithContentsOfURL:(id)arg1 error:(id *)arg2; 162 | - (id)sdefSupport_contents; 163 | - (id)sdefSupport_editorSettings; 164 | - (BOOL)sdefSupport_notifiesWhenClosing; 165 | - (id)sdefSupport_selectedCharacterRange; 166 | - (id)sdefSupport_selectedParagraphRange; 167 | - (id)sdefSupport_selection; 168 | - (id)sdefSupport_text; 169 | - (void)setSdefSupport_contents:(id)arg1; 170 | - (void)setSdefSupport_editorSettings:(id)arg1; 171 | - (void)setSdefSupport_notifiesWhenClosing:(BOOL)arg1; 172 | - (void)setSdefSupport_selectedCharacterRange:(id)arg1; 173 | - (void)setSdefSupport_selectedParagraphRange:(id)arg1; 174 | - (void)setSdefSupport_selection:(id)arg1; 175 | - (void)setSdefSupport_text:(id)arg1; 176 | @property unsigned long long textEncoding; // @synthesize textEncoding=_textEncoding; 177 | - (void)setTextEncoding:(unsigned long long)arg1 convertContents:(BOOL)arg2; 178 | @property(nonatomic) BOOL usesLanguageFromFileDataType; // @synthesize usesLanguageFromFileDataType=_usesLanguageFromFileDataType; 179 | - (id)sourceCodeGenerator:(id)arg1 commitInsertionOfSourceCodeForCompositeResult:(id)arg2 error:(id *)arg3; 180 | - (id)sourceCodeGenerator:(id)arg1 prepareToAddObjectiveCAtSynthesizeWithName:(id)arg2 inClassNamed:(id)arg3 options:(id)arg4 error:(id *)arg5; 181 | - (id)sourceCodeGenerator:(id)arg1 prepareToAddObjectiveCClassMethodDeclarationWithName:(id)arg2 inClassNamed:(id)arg3 options:(id)arg4 error:(id *)arg5; 182 | - (id)sourceCodeGenerator:(id)arg1 prepareToAddObjectiveCClassMethodDefinitionWithName:(id)arg2 inClassNamed:(id)arg3 options:(id)arg4 error:(id *)arg5; 183 | - (id)sourceCodeGenerator:(id)arg1 prepareToAddObjectiveCInstanceMethodDeclarationWithName:(id)arg2 inClassNamed:(id)arg3 options:(id)arg4 error:(id *)arg5; 184 | - (id)sourceCodeGenerator:(id)arg1 prepareToAddObjectiveCInstanceMethodDefinitionWithName:(id)arg2 inClassNamed:(id)arg3 options:(id)arg4 error:(id *)arg5; 185 | - (id)sourceCodeGenerator:(id)arg1 prepareToAddObjectiveCInstanceVariableDeclarationWithName:(id)arg2 type:(id)arg3 inClassNamed:(id)arg4 options:(id)arg5 error:(id *)arg6; 186 | - (id)sourceCodeGenerator:(id)arg1 prepareToAddObjectiveCInstanceVariableReleaseForTeardownWithName:(id)arg2 inClassNamed:(id)arg3 options:(id)arg4 error:(id *)arg5; 187 | - (id)sourceCodeGenerator:(id)arg1 prepareToAddObjectiveCPropertyDeclarationWithName:(id)arg2 type:(id)arg3 inClassNamed:(id)arg4 options:(id)arg5 error:(id *)arg6; 188 | - (id)sourceCodeGenerator:(id)arg1 prepareToAddObjectiveCPropertyReleaseForTeardownWithName:(id)arg2 type:(id)arg3 inClassNamed:(id)arg4 options:(id)arg5 error:(id *)arg6; 189 | - (id)sourceLandmarkItemAtCharacterIndex:(unsigned long long)arg1; 190 | - (id)sourceLandmarkItemAtLineNumber:(unsigned long long)arg1; 191 | @property(readonly, nonatomic) NSDictionary *sourceLanguageServiceContext; 192 | - (id)supportedSourceCodeLanguagesForSourceCodeGeneration; 193 | - (id)textDocumentLocationForInsertingSourceCode:(id)arg1 atLocation:(unsigned long long)arg2; 194 | @property(readonly) DVTTextStorage *textStorage; // @synthesize textStorage=_textStorage; 195 | - (void)textStorageDidProcessEditing:(id)arg1; 196 | - (void)textStorageDidUpdateSourceLandmarks:(id)arg1; 197 | - (BOOL)textStorageShouldAllowEditing:(id)arg1; 198 | - (id)textViewWillReturnPrintJobTitle:(id)arg1; 199 | - (void)unregisterDocumentEditor:(id)arg1; 200 | - (void)updateChangeCount:(unsigned long long)arg1; 201 | - (id)updatedLocationFromLocation:(id)arg1 toTimestamp:(double)arg2; 202 | - (BOOL)writeToURL:(id)arg1 ofType:(id)arg2 error:(id *)arg3; 203 | 204 | // Remaining properties 205 | @property(readonly, copy) NSString *debugDescription; 206 | //@property(readonly) NSURL *fileURL; 207 | @property(readonly) unsigned long long hash; 208 | @property(readonly) Class superclass; 209 | @property unsigned long long supportedMatchingOptions; 210 | 211 | @end 212 | 213 | -------------------------------------------------------------------------------- /Miku.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | C501EC171C4D0C26005148A2 /* MikuConfigManager.m in Sources */ = {isa = PBXBuildFile; fileRef = C501EC141C4D0C26005148A2 /* MikuConfigManager.m */; }; 11 | C501EC181C4D0C26005148A2 /* MikuMainMenuItem.m in Sources */ = {isa = PBXBuildFile; fileRef = C501EC161C4D0C26005148A2 /* MikuMainMenuItem.m */; }; 12 | C55955D51C44C1CA007F9389 /* IDESourceCodeEditor+Miku.m in Sources */ = {isa = PBXBuildFile; fileRef = C55955D41C44C1CA007F9389 /* IDESourceCodeEditor+Miku.m */; }; 13 | C5A7B8A61C43B4920055F0C4 /* AppKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C5A7B8A51C43B4920055F0C4 /* AppKit.framework */; }; 14 | C5A7B8A81C43B4920055F0C4 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C5A7B8A71C43B4920055F0C4 /* Foundation.framework */; }; 15 | C5A7B8B01C43B4920055F0C4 /* JRSwizzle.m in Sources */ = {isa = PBXBuildFile; fileRef = C5A7B8AF1C43B4920055F0C4 /* JRSwizzle.m */; }; 16 | C5A7B8B51C43B4920055F0C4 /* Miku.m in Sources */ = {isa = PBXBuildFile; fileRef = C5A7B8B41C43B4920055F0C4 /* Miku.m */; }; 17 | C5A7B8C91C43B54E0055F0C4 /* IDESourceEditor in Frameworks */ = {isa = PBXBuildFile; fileRef = C5A7B8C81C43B54E0055F0C4 /* IDESourceEditor */; }; 18 | C5A7B8CB1C43B55E0055F0C4 /* DVTKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C5A7B8CA1C43B55E0055F0C4 /* DVTKit.framework */; }; 19 | C5A7B8CD1C43B56A0055F0C4 /* IDEKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C5A7B8CC1C43B56A0055F0C4 /* IDEKit.framework */; }; 20 | C5A7B8D01C43B9E80055F0C4 /* WebKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C5A7B8CF1C43B9E80055F0C4 /* WebKit.framework */; }; 21 | C5DD02F51C44C2ED00233375 /* miku-dancing.coding.io in Resources */ = {isa = PBXBuildFile; fileRef = C5DD02F41C44C2ED00233375 /* miku-dancing.coding.io */; }; 22 | C5DD02F81C44C32A00233375 /* MikuDragView.m in Sources */ = {isa = PBXBuildFile; fileRef = C5DD02F71C44C32A00233375 /* MikuDragView.m */; }; 23 | C5DD02FB1C44C33900233375 /* MikuWebView.m in Sources */ = {isa = PBXBuildFile; fileRef = C5DD02FA1C44C33900233375 /* MikuWebView.m */; }; 24 | /* End PBXBuildFile section */ 25 | 26 | /* Begin PBXFileReference section */ 27 | C501EC131C4D0C26005148A2 /* MikuConfigManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MikuConfigManager.h; sourceTree = ""; }; 28 | C501EC141C4D0C26005148A2 /* MikuConfigManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MikuConfigManager.m; sourceTree = ""; }; 29 | C501EC151C4D0C26005148A2 /* MikuMainMenuItem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MikuMainMenuItem.h; sourceTree = ""; }; 30 | C501EC161C4D0C26005148A2 /* MikuMainMenuItem.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MikuMainMenuItem.m; sourceTree = ""; }; 31 | C55955D31C44C1CA007F9389 /* IDESourceCodeEditor+Miku.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "IDESourceCodeEditor+Miku.h"; sourceTree = ""; }; 32 | C55955D41C44C1CA007F9389 /* IDESourceCodeEditor+Miku.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "IDESourceCodeEditor+Miku.m"; sourceTree = ""; }; 33 | C5A7B8A21C43B4920055F0C4 /* Miku.xcplugin */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = Miku.xcplugin; sourceTree = BUILT_PRODUCTS_DIR; }; 34 | C5A7B8A51C43B4920055F0C4 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = ""; }; 35 | C5A7B8A71C43B4920055F0C4 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = ""; }; 36 | C5A7B8AB1C43B4920055F0C4 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 37 | C5A7B8AE1C43B4920055F0C4 /* JRSwizzle.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = JRSwizzle.h; path = JRSwizzle/JRSwizzle.h; sourceTree = ""; }; 38 | C5A7B8AF1C43B4920055F0C4 /* JRSwizzle.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = JRSwizzle.m; path = JRSwizzle/JRSwizzle.m; sourceTree = ""; }; 39 | C5A7B8B31C43B4920055F0C4 /* Miku.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Miku.h; sourceTree = ""; }; 40 | C5A7B8B41C43B4920055F0C4 /* Miku.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = Miku.m; sourceTree = ""; }; 41 | C5A7B8BF1C43B5030055F0C4 /* DVTLayoutView_ML.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DVTLayoutView_ML.h; sourceTree = ""; }; 42 | C5A7B8C01C43B5030055F0C4 /* DVTTextStorage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DVTTextStorage.h; sourceTree = ""; }; 43 | C5A7B8C11C43B5030055F0C4 /* DVTViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DVTViewController.h; sourceTree = ""; }; 44 | C5A7B8C21C43B5030055F0C4 /* IDEEditor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDEEditor.h; sourceTree = ""; }; 45 | C5A7B8C31C43B5030055F0C4 /* IDESourceCodeDocument.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDESourceCodeDocument.h; sourceTree = ""; }; 46 | C5A7B8C41C43B5030055F0C4 /* IDESourceCodeEditor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDESourceCodeEditor.h; sourceTree = ""; }; 47 | C5A7B8C51C43B5030055F0C4 /* IDESourceCodeEditorContainerView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDESourceCodeEditorContainerView.h; sourceTree = ""; }; 48 | C5A7B8C61C43B5030055F0C4 /* IDEViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDEViewController.h; sourceTree = ""; }; 49 | C5A7B8C81C43B54E0055F0C4 /* IDESourceEditor */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = IDESourceEditor; path = /Applications/Xcode.app/Contents/PlugIns/IDESourceEditor.ideplugin/Contents/MacOS/IDESourceEditor; sourceTree = ""; }; 50 | C5A7B8CA1C43B55E0055F0C4 /* DVTKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = DVTKit.framework; path = /Applications/Xcode.app/Contents/SharedFrameworks/DVTKit.framework; sourceTree = ""; }; 51 | C5A7B8CC1C43B56A0055F0C4 /* IDEKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = IDEKit.framework; path = /Applications/Xcode.app/Contents/Frameworks/IDEKit.framework; sourceTree = ""; }; 52 | C5A7B8CF1C43B9E80055F0C4 /* WebKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = WebKit.framework; path = System/Library/Frameworks/WebKit.framework; sourceTree = SDKROOT; }; 53 | C5DD02F41C44C2ED00233375 /* miku-dancing.coding.io */ = {isa = PBXFileReference; lastKnownFileType = folder; path = "miku-dancing.coding.io"; sourceTree = ""; }; 54 | C5DD02F61C44C32A00233375 /* MikuDragView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MikuDragView.h; sourceTree = ""; }; 55 | C5DD02F71C44C32A00233375 /* MikuDragView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MikuDragView.m; sourceTree = ""; }; 56 | C5DD02F91C44C33900233375 /* MikuWebView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MikuWebView.h; sourceTree = ""; }; 57 | C5DD02FA1C44C33900233375 /* MikuWebView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MikuWebView.m; sourceTree = ""; }; 58 | /* End PBXFileReference section */ 59 | 60 | /* Begin PBXFrameworksBuildPhase section */ 61 | C5A7B89E1C43B4920055F0C4 /* Frameworks */ = { 62 | isa = PBXFrameworksBuildPhase; 63 | buildActionMask = 2147483647; 64 | files = ( 65 | C5A7B8D01C43B9E80055F0C4 /* WebKit.framework in Frameworks */, 66 | C5A7B8A61C43B4920055F0C4 /* AppKit.framework in Frameworks */, 67 | C5A7B8A81C43B4920055F0C4 /* Foundation.framework in Frameworks */, 68 | C5A7B8CB1C43B55E0055F0C4 /* DVTKit.framework in Frameworks */, 69 | C5A7B8C91C43B54E0055F0C4 /* IDESourceEditor in Frameworks */, 70 | C5A7B8CD1C43B56A0055F0C4 /* IDEKit.framework in Frameworks */, 71 | ); 72 | runOnlyForDeploymentPostprocessing = 0; 73 | }; 74 | C5A7B8A01C43B4920055F0C4 /* Frameworks */ = { 75 | isa = PBXFrameworksBuildPhase; 76 | buildActionMask = 2147483647; 77 | files = ( 78 | ); 79 | runOnlyForDeploymentPostprocessing = 0; 80 | }; 81 | /* End PBXFrameworksBuildPhase section */ 82 | 83 | /* Begin PBXGroup section */ 84 | C561CA481C44E34E00401E7A /* Configs */ = { 85 | isa = PBXGroup; 86 | children = ( 87 | C501EC131C4D0C26005148A2 /* MikuConfigManager.h */, 88 | C501EC141C4D0C26005148A2 /* MikuConfigManager.m */, 89 | C501EC151C4D0C26005148A2 /* MikuMainMenuItem.h */, 90 | C501EC161C4D0C26005148A2 /* MikuMainMenuItem.m */, 91 | ); 92 | path = Configs; 93 | sourceTree = ""; 94 | }; 95 | C5A7B8981C43B4910055F0C4 = { 96 | isa = PBXGroup; 97 | children = ( 98 | C5A7B8A91C43B4920055F0C4 /* Miku */, 99 | C5A7B8A41C43B4920055F0C4 /* Frameworks */, 100 | C5A7B8A31C43B4920055F0C4 /* Products */, 101 | ); 102 | sourceTree = ""; 103 | }; 104 | C5A7B8A31C43B4920055F0C4 /* Products */ = { 105 | isa = PBXGroup; 106 | children = ( 107 | C5A7B8A21C43B4920055F0C4 /* Miku.xcplugin */, 108 | ); 109 | name = Products; 110 | sourceTree = ""; 111 | }; 112 | C5A7B8A41C43B4920055F0C4 /* Frameworks */ = { 113 | isa = PBXGroup; 114 | children = ( 115 | C5A7B8C81C43B54E0055F0C4 /* IDESourceEditor */, 116 | C5A7B8CA1C43B55E0055F0C4 /* DVTKit.framework */, 117 | C5A7B8CC1C43B56A0055F0C4 /* IDEKit.framework */, 118 | C5A7B8CE1C43B57F0055F0C4 /* Other Frameworks */, 119 | ); 120 | name = Frameworks; 121 | sourceTree = ""; 122 | }; 123 | C5A7B8A91C43B4920055F0C4 /* Miku */ = { 124 | isa = PBXGroup; 125 | children = ( 126 | C5A7B8B31C43B4920055F0C4 /* Miku.h */, 127 | C5A7B8B41C43B4920055F0C4 /* Miku.m */, 128 | C5DD02F31C44C2C500233375 /* Views */, 129 | C561CA481C44E34E00401E7A /* Configs */, 130 | C5A7B8BB1C43B5030055F0C4 /* HookClasses */, 131 | C5A7B8BE1C43B5030055F0C4 /* XcodeHeaders */, 132 | C5A7B8AD1C43B4920055F0C4 /* JRSwizzle */, 133 | C5A7B8AA1C43B4920055F0C4 /* Supporting Files */, 134 | ); 135 | path = Miku; 136 | sourceTree = ""; 137 | }; 138 | C5A7B8AA1C43B4920055F0C4 /* Supporting Files */ = { 139 | isa = PBXGroup; 140 | children = ( 141 | C5A7B8AB1C43B4920055F0C4 /* Info.plist */, 142 | C5DD02F41C44C2ED00233375 /* miku-dancing.coding.io */, 143 | ); 144 | name = "Supporting Files"; 145 | sourceTree = ""; 146 | }; 147 | C5A7B8AD1C43B4920055F0C4 /* JRSwizzle */ = { 148 | isa = PBXGroup; 149 | children = ( 150 | C5A7B8AE1C43B4920055F0C4 /* JRSwizzle.h */, 151 | C5A7B8AF1C43B4920055F0C4 /* JRSwizzle.m */, 152 | ); 153 | name = JRSwizzle; 154 | sourceTree = ""; 155 | }; 156 | C5A7B8BB1C43B5030055F0C4 /* HookClasses */ = { 157 | isa = PBXGroup; 158 | children = ( 159 | C55955D31C44C1CA007F9389 /* IDESourceCodeEditor+Miku.h */, 160 | C55955D41C44C1CA007F9389 /* IDESourceCodeEditor+Miku.m */, 161 | ); 162 | path = HookClasses; 163 | sourceTree = ""; 164 | }; 165 | C5A7B8BE1C43B5030055F0C4 /* XcodeHeaders */ = { 166 | isa = PBXGroup; 167 | children = ( 168 | C5A7B8BF1C43B5030055F0C4 /* DVTLayoutView_ML.h */, 169 | C5A7B8C01C43B5030055F0C4 /* DVTTextStorage.h */, 170 | C5A7B8C11C43B5030055F0C4 /* DVTViewController.h */, 171 | C5A7B8C21C43B5030055F0C4 /* IDEEditor.h */, 172 | C5A7B8C31C43B5030055F0C4 /* IDESourceCodeDocument.h */, 173 | C5A7B8C41C43B5030055F0C4 /* IDESourceCodeEditor.h */, 174 | C5A7B8C51C43B5030055F0C4 /* IDESourceCodeEditorContainerView.h */, 175 | C5A7B8C61C43B5030055F0C4 /* IDEViewController.h */, 176 | ); 177 | path = XcodeHeaders; 178 | sourceTree = ""; 179 | }; 180 | C5A7B8CE1C43B57F0055F0C4 /* Other Frameworks */ = { 181 | isa = PBXGroup; 182 | children = ( 183 | C5A7B8CF1C43B9E80055F0C4 /* WebKit.framework */, 184 | C5A7B8A51C43B4920055F0C4 /* AppKit.framework */, 185 | C5A7B8A71C43B4920055F0C4 /* Foundation.framework */, 186 | ); 187 | name = "Other Frameworks"; 188 | sourceTree = ""; 189 | }; 190 | C5DD02F31C44C2C500233375 /* Views */ = { 191 | isa = PBXGroup; 192 | children = ( 193 | C5DD02F61C44C32A00233375 /* MikuDragView.h */, 194 | C5DD02F71C44C32A00233375 /* MikuDragView.m */, 195 | C5DD02F91C44C33900233375 /* MikuWebView.h */, 196 | C5DD02FA1C44C33900233375 /* MikuWebView.m */, 197 | ); 198 | path = Views; 199 | sourceTree = ""; 200 | }; 201 | /* End PBXGroup section */ 202 | 203 | /* Begin PBXNativeTarget section */ 204 | C5A7B8A11C43B4920055F0C4 /* Miku */ = { 205 | isa = PBXNativeTarget; 206 | buildConfigurationList = C5A7B8B81C43B4920055F0C4 /* Build configuration list for PBXNativeTarget "Miku" */; 207 | buildPhases = ( 208 | C5A7B89D1C43B4920055F0C4 /* Sources */, 209 | C5A7B89E1C43B4920055F0C4 /* Frameworks */, 210 | C5A7B89F1C43B4920055F0C4 /* Resources */, 211 | C5A7B8A01C43B4920055F0C4 /* Frameworks */, 212 | ); 213 | buildRules = ( 214 | ); 215 | dependencies = ( 216 | ); 217 | name = Miku; 218 | productName = Miku; 219 | productReference = C5A7B8A21C43B4920055F0C4 /* Miku.xcplugin */; 220 | productType = "com.apple.product-type.bundle"; 221 | }; 222 | /* End PBXNativeTarget section */ 223 | 224 | /* Begin PBXProject section */ 225 | C5A7B8991C43B4910055F0C4 /* Project object */ = { 226 | isa = PBXProject; 227 | attributes = { 228 | LastUpgradeCheck = 0720; 229 | ORGANIZATIONNAME = Jobs; 230 | TargetAttributes = { 231 | C5A7B8A11C43B4920055F0C4 = { 232 | CreatedOnToolsVersion = 7.2; 233 | }; 234 | }; 235 | }; 236 | buildConfigurationList = C5A7B89C1C43B4910055F0C4 /* Build configuration list for PBXProject "Miku" */; 237 | compatibilityVersion = "Xcode 3.2"; 238 | developmentRegion = English; 239 | hasScannedForEncodings = 0; 240 | knownRegions = ( 241 | en, 242 | ); 243 | mainGroup = C5A7B8981C43B4910055F0C4; 244 | productRefGroup = C5A7B8A31C43B4920055F0C4 /* Products */; 245 | projectDirPath = ""; 246 | projectRoot = ""; 247 | targets = ( 248 | C5A7B8A11C43B4920055F0C4 /* Miku */, 249 | ); 250 | }; 251 | /* End PBXProject section */ 252 | 253 | /* Begin PBXResourcesBuildPhase section */ 254 | C5A7B89F1C43B4920055F0C4 /* Resources */ = { 255 | isa = PBXResourcesBuildPhase; 256 | buildActionMask = 2147483647; 257 | files = ( 258 | C5DD02F51C44C2ED00233375 /* miku-dancing.coding.io in Resources */, 259 | ); 260 | runOnlyForDeploymentPostprocessing = 0; 261 | }; 262 | /* End PBXResourcesBuildPhase section */ 263 | 264 | /* Begin PBXSourcesBuildPhase section */ 265 | C5A7B89D1C43B4920055F0C4 /* Sources */ = { 266 | isa = PBXSourcesBuildPhase; 267 | buildActionMask = 2147483647; 268 | files = ( 269 | C5DD02F81C44C32A00233375 /* MikuDragView.m in Sources */, 270 | C501EC181C4D0C26005148A2 /* MikuMainMenuItem.m in Sources */, 271 | C5A7B8B01C43B4920055F0C4 /* JRSwizzle.m in Sources */, 272 | C5A7B8B51C43B4920055F0C4 /* Miku.m in Sources */, 273 | C501EC171C4D0C26005148A2 /* MikuConfigManager.m in Sources */, 274 | C5DD02FB1C44C33900233375 /* MikuWebView.m in Sources */, 275 | C55955D51C44C1CA007F9389 /* IDESourceCodeEditor+Miku.m in Sources */, 276 | ); 277 | runOnlyForDeploymentPostprocessing = 0; 278 | }; 279 | /* End PBXSourcesBuildPhase section */ 280 | 281 | /* Begin XCBuildConfiguration section */ 282 | C5A7B8B61C43B4920055F0C4 /* Debug */ = { 283 | isa = XCBuildConfiguration; 284 | buildSettings = { 285 | ALWAYS_SEARCH_USER_PATHS = NO; 286 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 287 | CLANG_CXX_LIBRARY = "libc++"; 288 | CLANG_ENABLE_MODULES = YES; 289 | CLANG_ENABLE_OBJC_ARC = YES; 290 | CLANG_WARN_BOOL_CONVERSION = YES; 291 | CLANG_WARN_CONSTANT_CONVERSION = YES; 292 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 293 | CLANG_WARN_EMPTY_BODY = YES; 294 | CLANG_WARN_ENUM_CONVERSION = YES; 295 | CLANG_WARN_INT_CONVERSION = YES; 296 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 297 | CLANG_WARN_UNREACHABLE_CODE = YES; 298 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 299 | COPY_PHASE_STRIP = NO; 300 | DEBUG_INFORMATION_FORMAT = dwarf; 301 | ENABLE_STRICT_OBJC_MSGSEND = YES; 302 | ENABLE_TESTABILITY = YES; 303 | GCC_C_LANGUAGE_STANDARD = gnu99; 304 | GCC_DYNAMIC_NO_PIC = NO; 305 | GCC_NO_COMMON_BLOCKS = YES; 306 | GCC_OPTIMIZATION_LEVEL = 0; 307 | GCC_PREPROCESSOR_DEFINITIONS = ( 308 | "DEBUG=1", 309 | "$(inherited)", 310 | ); 311 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 312 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 313 | GCC_WARN_UNDECLARED_SELECTOR = YES; 314 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 315 | GCC_WARN_UNUSED_FUNCTION = YES; 316 | GCC_WARN_UNUSED_VARIABLE = YES; 317 | MTL_ENABLE_DEBUG_INFO = YES; 318 | ONLY_ACTIVE_ARCH = YES; 319 | }; 320 | name = Debug; 321 | }; 322 | C5A7B8B71C43B4920055F0C4 /* Release */ = { 323 | isa = XCBuildConfiguration; 324 | buildSettings = { 325 | ALWAYS_SEARCH_USER_PATHS = NO; 326 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 327 | CLANG_CXX_LIBRARY = "libc++"; 328 | CLANG_ENABLE_MODULES = YES; 329 | CLANG_ENABLE_OBJC_ARC = YES; 330 | CLANG_WARN_BOOL_CONVERSION = YES; 331 | CLANG_WARN_CONSTANT_CONVERSION = YES; 332 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 333 | CLANG_WARN_EMPTY_BODY = YES; 334 | CLANG_WARN_ENUM_CONVERSION = YES; 335 | CLANG_WARN_INT_CONVERSION = YES; 336 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 337 | CLANG_WARN_UNREACHABLE_CODE = YES; 338 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 339 | COPY_PHASE_STRIP = NO; 340 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 341 | ENABLE_NS_ASSERTIONS = NO; 342 | ENABLE_STRICT_OBJC_MSGSEND = YES; 343 | GCC_C_LANGUAGE_STANDARD = gnu99; 344 | GCC_NO_COMMON_BLOCKS = YES; 345 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 346 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 347 | GCC_WARN_UNDECLARED_SELECTOR = YES; 348 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 349 | GCC_WARN_UNUSED_FUNCTION = YES; 350 | GCC_WARN_UNUSED_VARIABLE = YES; 351 | MTL_ENABLE_DEBUG_INFO = NO; 352 | }; 353 | name = Release; 354 | }; 355 | C5A7B8B91C43B4920055F0C4 /* Debug */ = { 356 | isa = XCBuildConfiguration; 357 | buildSettings = { 358 | COMBINE_HIDPI_IMAGES = YES; 359 | DEPLOYMENT_LOCATION = YES; 360 | DSTROOT = "$(HOME)"; 361 | FRAMEWORK_SEARCH_PATHS = ( 362 | "$(inherited)", 363 | "$(DEVELOPER_DIR)/../Frameworks", 364 | "$(DEVELOPER_DIR)/../SharedFrameworks", 365 | "$(DEVELOPER_DIR)/../OtherFrameworks", 366 | ); 367 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 368 | GCC_PREFIX_HEADER = Miku/PrefixHeader.pch; 369 | INFOPLIST_FILE = Miku/Info.plist; 370 | INSTALL_PATH = "/Library/Application Support/Developer/Shared/Xcode/Plug-ins"; 371 | MACH_O_TYPE = mh_bundle; 372 | MACOSX_DEPLOYMENT_TARGET = 10.11; 373 | PRODUCT_BUNDLE_IDENTIFIER = com.poboke.Miku; 374 | PRODUCT_NAME = "$(TARGET_NAME)"; 375 | WRAPPER_EXTENSION = xcplugin; 376 | }; 377 | name = Debug; 378 | }; 379 | C5A7B8BA1C43B4920055F0C4 /* Release */ = { 380 | isa = XCBuildConfiguration; 381 | buildSettings = { 382 | COMBINE_HIDPI_IMAGES = YES; 383 | DEPLOYMENT_LOCATION = YES; 384 | DSTROOT = "$(HOME)"; 385 | FRAMEWORK_SEARCH_PATHS = ( 386 | "$(inherited)", 387 | "$(DEVELOPER_DIR)/../Frameworks", 388 | "$(DEVELOPER_DIR)/../SharedFrameworks", 389 | "$(DEVELOPER_DIR)/../OtherFrameworks", 390 | ); 391 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 392 | GCC_PREFIX_HEADER = Miku/PrefixHeader.pch; 393 | INFOPLIST_FILE = Miku/Info.plist; 394 | INSTALL_PATH = "/Library/Application Support/Developer/Shared/Xcode/Plug-ins"; 395 | MACH_O_TYPE = mh_bundle; 396 | MACOSX_DEPLOYMENT_TARGET = 10.11; 397 | PRODUCT_BUNDLE_IDENTIFIER = com.poboke.Miku; 398 | PRODUCT_NAME = "$(TARGET_NAME)"; 399 | WRAPPER_EXTENSION = xcplugin; 400 | }; 401 | name = Release; 402 | }; 403 | /* End XCBuildConfiguration section */ 404 | 405 | /* Begin XCConfigurationList section */ 406 | C5A7B89C1C43B4910055F0C4 /* Build configuration list for PBXProject "Miku" */ = { 407 | isa = XCConfigurationList; 408 | buildConfigurations = ( 409 | C5A7B8B61C43B4920055F0C4 /* Debug */, 410 | C5A7B8B71C43B4920055F0C4 /* Release */, 411 | ); 412 | defaultConfigurationIsVisible = 0; 413 | defaultConfigurationName = Release; 414 | }; 415 | C5A7B8B81C43B4920055F0C4 /* Build configuration list for PBXNativeTarget "Miku" */ = { 416 | isa = XCConfigurationList; 417 | buildConfigurations = ( 418 | C5A7B8B91C43B4920055F0C4 /* Debug */, 419 | C5A7B8BA1C43B4920055F0C4 /* Release */, 420 | ); 421 | defaultConfigurationIsVisible = 0; 422 | defaultConfigurationName = Release; 423 | }; 424 | /* End XCConfigurationList section */ 425 | }; 426 | rootObject = C5A7B8991C43B4910055F0C4 /* Project object */; 427 | } 428 | -------------------------------------------------------------------------------- /Miku/XcodeHeaders/IDESourceCodeEditor.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated by class-dump 3.5 (64 bit). 3 | // 4 | // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard. 5 | // 6 | 7 | #import "IDEEditor.h" 8 | #import "IDESourceCodeDocument.h" 9 | 10 | #import "IDESourceCodeEditorContainerView.h" 11 | //#import "DVTFindBarFindable.h" 12 | //#import "DVTSourceTextViewDelegate.h" 13 | //#import "IDEComparisonEditorHostContext.h" 14 | //#import "IDEOpenQuicklyJumpToSupport.h" 15 | //#import "IDERefactoringExpressionSource.h" 16 | //#import "IDESourceControlLogDetailDelegate.h" 17 | //#import "IDESourceExpressionSource.h" 18 | //#import "IDETestingSelection.h" 19 | //#import "IDETextVisualizationHost.h" 20 | //#import "NSMenuDelegate.h" 21 | //#import "NSPopoverDelegate.h" 22 | //#import "NSTextViewDelegate.h" 23 | 24 | //@class DVTDispatchLock, DVTLayoutManager, DVTNotificationToken, DVTObservingToken, DVTOperation, DVTSDK, DVTScopeBarController, DVTSourceExpression, DVTSourceLanguageService, DVTSourceTextView, DVTStackBacktrace, DVTTextDocumentLocation, DVTTextSidebarView, DVTWeakInterposer, IDEAnalyzerResultsExplorer, IDECoverageTextVisualization, IDENoteAnnotationExplorer, IDESchemeActionCodeCoverageFile, IDESelection, IDESingleFileProcessingToolbarController, IDESourceCodeDocument, IDESourceCodeEditorAnnotationProvider, IDESourceCodeEditorContainerView, IDESourceCodeHelpNavigationRequest, IDESourceCodeNavigationRequest, IDESourceCodeSingleLineBlameProvider, IDESourceControlLogDetailViewController, IDESourceLanguageEditorExtension, IDEViewController, IDEWorkspaceTabController, NSArray, NSDictionary, NSImmediateActionGestureRecognizer, NSMutableArray, NSObject, NSOperationQueue, NSPopover, NSProgressIndicator, NSPulseGestureRecognizer, NSScrollView, NSString, NSTimer, NSTrackingArea, NSView; 25 | @class DVTDispatchLock, DVTLayoutManager, DVTNotificationToken, DVTObservingToken, DVTOperation, DVTSDK, DVTScopeBarController, DVTSourceExpression, DVTSourceLanguageService, DVTSourceTextView, DVTStackBacktrace, DVTTextDocumentLocation, DVTTextSidebarView, DVTWeakInterposer, IDEAnalyzerResultsExplorer, IDECoverageTextVisualization, IDENoteAnnotationExplorer, IDESchemeActionCodeCoverageFile, IDESelection, IDESingleFileProcessingToolbarController, IDESourceCodeDocument, IDESourceCodeEditorAnnotationProvider, IDESourceCodeEditorContainerView, IDESourceCodeHelpNavigationRequest, IDESourceCodeNavigationRequest, IDESourceCodeSingleLineBlameProvider, IDESourceControlLogDetailViewController, IDESourceLanguageEditorExtension, IDEViewController, IDEWorkspaceTabController, NSArray, NSDictionary, NSImmediateActionGestureRecognizer, NSMutableArray, NSObject, NSOperationQueue, NSPopover, NSProgressIndicator, NSPulseGestureRecognizer, NSScrollView, NSString, NSTimer, NSTrackingArea, NSView; 26 | 27 | //@interface IDESourceCodeEditor : IDEEditor 28 | @interface IDESourceCodeEditor : IDEEditor 29 | { 30 | NSScrollView *_scrollView; 31 | DVTSourceTextView *_textView; 32 | DVTLayoutManager *_layoutManager; 33 | IDESourceCodeEditorContainerView *_containerView; 34 | DVTTextSidebarView *_sidebarView; 35 | NSArray *_currentSelectedItems; 36 | NSDictionary *_syntaxColoringContext; 37 | DVTSourceExpression *_selectedExpression; 38 | DVTSourceExpression *_mouseOverExpression; 39 | IDESourceCodeNavigationRequest *_currentNavigationRequest; 40 | IDESourceCodeHelpNavigationRequest *_helpNavigationRequest; 41 | NSObject *_symbolLookupQueue; 42 | NSMutableArray *_stateChangeObservingTokens; 43 | DVTObservingToken *_topLevelItemsObserverToken; 44 | DVTObservingToken *_firstResponderObserverToken; 45 | DVTObservingToken *_editorLiveIssuesEnabledObserverToken; 46 | DVTObservingToken *_navigatorLiveIssuesEnabledObserverToken; 47 | DVTNotificationToken *_workspaceLiveSourceIssuesEnabledObserver; 48 | DVTObservingToken *_diagnosticControllerObserverToken; 49 | DVTObservingToken *_needsDiagnosisObserverToken; 50 | DVTObservingToken *_diagnosticItemsObserverToken; 51 | NSOperationQueue *_diagnoseRelatedFilesQueue; 52 | DVTOperation *_findRelatedFilesOperation; 53 | DVTOperation *_scheduleDiagnoticsForRelatedFilesOperation; 54 | DVTObservingToken *_sessionInProgressObserverToken; 55 | DVTNotificationToken *_coverageReportGenerationObserver; 56 | DVTObservingToken *_showCodeCoverageObserverToken; 57 | DVTObservingToken *_showCodeCoverageCountsObserverToken; 58 | DVTNotificationToken *_blueprintDidChangeNotificationObservingToken; 59 | DVTNotificationToken *_textStorageDidProcessEndingObserver; 60 | DVTNotificationToken *_themeChangedObserver; 61 | DVTNotificationToken *_textViewBoundsDidChangeObservingToken; 62 | DVTNotificationToken *_sourceCodeDocumentDidSaveNotificationToken; 63 | DVTNotificationToken *_indexDidChangeNotificationToken; 64 | // id _prefetchingNodeTypesToken; 65 | DVTObservingToken *_semanticsDisabledObservingToken; 66 | IDESourceCodeEditorAnnotationProvider *_annotationProvider; 67 | IDEAnalyzerResultsExplorer *_analyzerResultsExplorer; 68 | DVTWeakInterposer *_analyzerResultsScopeBar_dvtWeakInterposer; 69 | BOOL _hidingAnalyzerExplorer; 70 | IDENoteAnnotationExplorer *_noteAnnotationExplorer; 71 | IDESourceCodeSingleLineBlameProvider *_blameProvider; 72 | NSPopover *_blameLogPopover; 73 | IDESourceControlLogDetailViewController *_blameDetailController; 74 | IDESingleFileProcessingToolbarController *_singleFileProcessingToolbarController; 75 | NSView *_emptyView; 76 | NSView *_contentGenerationBackgroundView; 77 | NSProgressIndicator *_contentGenerationProgressIndicator; 78 | NSTimer *_contentGenerationProgressTimer; 79 | NSOperationQueue *_tokenizeQueue; 80 | DVTDispatchLock *_tokenizeAccessLock; 81 | unsigned long long _tokenizeGeneration; 82 | NSTrackingArea *_mouseTracking; 83 | NSDictionary *_previouslyRestoredStateDictionary; 84 | struct _NSRange _previousSelectedLineRange; 85 | unsigned long long _lastFocusedAnnotationIndex; 86 | struct _NSRange _lastEditedCharRange; 87 | DVTTextDocumentLocation *_continueToHereDocumentLocation; 88 | DVTTextDocumentLocation *_continueToLineDocumentLocation; 89 | DVTWeakInterposer *_hostViewController_dvtWeakInterposer; 90 | struct { 91 | unsigned int wantsDidScroll:1; 92 | unsigned int wantsDidFinishAnimatingScroll:1; 93 | unsigned int supportsContextMenuCustomization:1; 94 | unsigned int supportsAnnotationContextCreation:1; 95 | unsigned int wantsDidLoadAnnotationProviders:1; 96 | unsigned int reserved:3; 97 | } _hvcFlags; 98 | BOOL _trackingMouse; 99 | BOOL _scheduledInitialSetup; 100 | BOOL _initialSetupDone; 101 | BOOL _nodeTypesPrefetchingStarted; 102 | BOOL _isUninstalling; 103 | IDESchemeActionCodeCoverageFile *_coverageData; 104 | IDECoverageTextVisualization *_coverageTextVisualization; 105 | IDESourceLanguageEditorExtension *_editorExtension; 106 | NSPulseGestureRecognizer *_recognizeGestureInSideBarView; 107 | NSImmediateActionGestureRecognizer *_immediateActionRecognizer; 108 | DVTScopeBarController *_languageServiceStatusScopeBarController; 109 | } 110 | 111 | + (void)commitStateToDictionary:(id)arg1 withSourceTextView:(id)arg2 withSourceCodeDocument:(id)arg3; 112 | + (void)configureStateSavingObjectPersistenceByName:(id)arg1; 113 | + (id)keyPathsForValuesAffectingIsWorkspaceBuilding; 114 | + (void)revertStateWithDictionary:(id)arg1 withSourceTextView:(id)arg2 withSourceCodeDocument:(id)arg3; 115 | + (long long)version; 116 | //- (void).cxx_destruct; 117 | - (void)_applyPerFileTextSettings; 118 | - (void)_askToPromoteToUnicode; 119 | - (void)_blueprintDidChangeForSourceCodeEditor:(id)arg1; 120 | - (id)_breakpointManager; 121 | - (id)_calculateContinueToDocumentLocationFromDocumentLocation:(id)arg1; 122 | - (id)_calculateContinueToHereDocumentLocation; 123 | - (id)_calculateContinueToLineDocumentLocation; 124 | - (void)_cancelCurrentNavigationRequest; 125 | - (void)_cancelHelpNavigationRequest; 126 | - (void)_centerViewInSuperView:(id)arg1; 127 | - (void)_changeSourceCodeLanguageAction:(id)arg1; 128 | - (void)_contentGenerationProgressTimerFired:(id)arg1; 129 | - (void)_copyQualifiedSymbolName:(BOOL)arg1; 130 | - (void)_createFileBreakpointAtLocation:(long long)arg1; 131 | - (long long)_currentOneBasedLineNumber; 132 | - (id)_currentSelectedLandmarkItem; 133 | - (id)_diagnosticAnnotationsInRange:(struct _NSRange)arg1 fixableOnly:(BOOL)arg2; 134 | - (id)_diagnosticAnnotationsInScopeFixableOnly:(BOOL)arg1; 135 | - (void)_doInitialSetup; 136 | - (id)_documentLocationForLineNumber:(long long)arg1; 137 | - (id)_documentLocationUnderMouse; 138 | - (void)_doubleClickOnTemporaryHelpLinkTimerExpired; 139 | - (void)_doubleClickOnTemporaryLinkTimerExpired; 140 | - (void)_endObservingDiagnosticController; 141 | //- (void)_enumerateDiagnosticAnnotationsInSelection:(CDUnknownBlockType)arg1; 142 | - (BOOL)_expression:(id)arg1 representsTheSameLocationAsExpression:(id)arg2; 143 | - (id)_expressionAtCharacterIndex:(unsigned long long)arg1; 144 | - (void)_hideEmptyView; 145 | - (unsigned long long)_insertionIndexUnderMouse; 146 | - (void)_invalidateMouseOverExpression; 147 | - (BOOL)_isCurrentSelectedItemsValid; 148 | - (BOOL)_isExpressionImport:(id)arg1 module:(BOOL)arg2; 149 | - (id)_jumpToAnnotationWithSelectedRange:(struct _NSRange)arg1 fixIt:(BOOL)arg2 backwards:(BOOL)arg3; 150 | - (id)_jumpToDefinitionOfExpression:(id)arg1 fromScreenPoint:(struct CGPoint)arg2 clickCount:(long long)arg3 modifierFlags:(unsigned long long)arg4; 151 | - (void)_jumpToExpression:(id)arg1; 152 | - (void)_processCurrentFileUsingBuildCommand:(int)arg1; 153 | - (void)_refreshCurrentSelectedItemsIfNeeded; 154 | - (void)_sendDelayedSelectedExpressionDidChangeMessage; 155 | - (void)_showContentGenerationProgressIndicatorWithDelay:(double)arg1; 156 | - (void)_showCoverage:(BOOL)arg1; 157 | - (void)_showDocumentationForSelectedSymbol:(id)arg1; 158 | - (void)_showEmptyViewWithMessage:(id)arg1; 159 | - (id)_singleFileProcessingFilePath; 160 | - (id)_specialPasteContext; 161 | - (void)_startObservingDiagnosticController; 162 | - (void)_startPrefetchingNodeTypesInUpDirection:(BOOL)arg1 initialLineRange:(struct _NSRange)arg2 noProgressIterations:(unsigned long long)arg3; 163 | - (id)_stateDictionariesForDocuments; 164 | - (void)_stopShowingContentGenerationProgressInidcator; 165 | - (id)_testFromModelItem:(id)arg1 fromTests:(id)arg2; 166 | - (void)_textViewDidLoseFirstResponder; 167 | - (id)_transientStateDictionaryForDocument:(id)arg1; 168 | - (void)_updateSelectedExpression; 169 | - (void)_updatedMouseOverExpression; 170 | - (void)_useSourceCodeLanguageFromFileDataTypeAction:(id)arg1; 171 | //- (void)addVisualization:(id)arg1 fadeIn:(BOOL)arg2 completionBlock:(CDUnknownBlockType)arg3; 172 | - (void)analyzeCurrentFile; 173 | @property(retain) IDEAnalyzerResultsExplorer *analyzerResultsExplorer; // @synthesize analyzerResultsExplorer=_analyzerResultsExplorer; 174 | @property __weak DVTScopeBarController *analyzerResultsScopeBar; 175 | - (id)annotationContextForTextView:(id)arg1; 176 | @property(readonly) IDESourceCodeEditorAnnotationProvider *annotationProvider; // @synthesize annotationProvider=_annotationProvider; 177 | - (void)assembleCurrentFile; 178 | - (void)blameSelectedLine:(id)arg1; 179 | - (BOOL)canAnalyzeFile; 180 | - (BOOL)canAssembleFile; 181 | - (BOOL)canBecomeMainViewController; 182 | - (BOOL)canCompileFile; 183 | - (BOOL)canFlattenMultiPathTokens; 184 | - (BOOL)canPreprocessFile; 185 | - (void)commitStateToDictionary:(id)arg1; 186 | - (void)compileCurrentFile; 187 | - (id)completingTextView:(id)arg1 documentLocationForWordStartLocation:(unsigned long long)arg2; 188 | - (void)completingTextView:(id)arg1 willPassContextToStrategies:(id)arg2 atWordStartLocation:(unsigned long long)arg3; 189 | - (BOOL)completingTextViewHandleCancel:(id)arg1; 190 | - (void)configureStateSavingObservers; 191 | @property(retain) IDESourceCodeEditorContainerView *containerView; // @synthesize containerView=_containerView; 192 | - (void)contentViewDidCompleteLayout; 193 | @property(readonly) DVTSourceExpression *contextMenuExpression; 194 | - (void)contextMenu_revealInSymbolNavigator:(id)arg1; 195 | - (void)contextMenu_toggleIssueShown:(id)arg1; 196 | - (void)continueToCurrentLine:(id)arg1; 197 | - (void)continueToHere:(id)arg1; 198 | - (void)copyQualifiedSymbolName:(id)arg1; 199 | - (void)copySymbolName:(id)arg1; 200 | @property(retain) IDESchemeActionCodeCoverageFile *coverageData; // @synthesize coverageData=_coverageData; 201 | - (double)coverageGutterWidthWhenShowingCounts; 202 | @property(retain) IDECoverageTextVisualization *coverageTextVisualization; // @synthesize coverageTextVisualization=_coverageTextVisualization; 203 | - (id)currentEditorContext; 204 | - (id)currentSelectedDocumentLocations; 205 | - (id)currentSelectedItems; 206 | @property(readonly, nonatomic) struct CGRect currentSelectionFrame; 207 | - (id)cursorForAltTemporaryLink; 208 | - (void)debugLogJumpToDefinitionState:(id)arg1; 209 | - (void)deregisterForMouseEvents; 210 | - (BOOL)detailShouldShowOpenBlameView; 211 | - (void)didEndTokenizedEditingWithRanges:(id)arg1; 212 | - (void)didSetupEditor; 213 | - (id)documentLocationForOpenQuicklyQuery:(id)arg1; 214 | - (void)dvtFindBar:(id)arg1 didUpdateCurrentResult:(id)arg2; 215 | - (void)dvtFindBar:(id)arg1 didUpdateResults:(id)arg2; 216 | - (BOOL)editorDocumentIsCurrentRevision; 217 | @property(retain) IDESourceLanguageEditorExtension *editorExtension; // @synthesize editorExtension=_editorExtension; 218 | - (BOOL)editorIsHostedInComparisonEditor; 219 | - (BOOL)expressionContainsExecutableCode:(id)arg1; 220 | - (struct CGRect)expressionFrameForExpression:(id)arg1; 221 | - (void)fixAllInScope:(id)arg1; 222 | - (id)fixableDiagnosticAnnotationsInScope; 223 | - (void)flattenMultiPathTokens:(id)arg1; 224 | - (void)hideAnalyzerExplorerAnimate:(BOOL)arg1; 225 | //@property __weak IDEViewController *hostViewController; 226 | @property(retain) NSImmediateActionGestureRecognizer *immediateActionRecognizer; // @synthesize immediateActionRecognizer=_immediateActionRecognizer; 227 | - (id)importStringInExpression:(id)arg1; 228 | - (id)initWithNibName:(id)arg1 bundle:(id)arg2 document:(id)arg3; 229 | - (void)installBreakpointGestureRecognizersInView:(id)arg1; 230 | - (BOOL)isExpressionFunctionOrMethodCall:(id)arg1; 231 | - (BOOL)isExpressionFunctionOrMethodDefinition:(id)arg1; 232 | - (BOOL)isExpressionInFunctionOrMethodBody:(id)arg1; 233 | - (BOOL)isExpressionInPlainCode:(id)arg1; 234 | - (BOOL)isExpressionModuleImport:(id)arg1; 235 | - (BOOL)isExpressionPoundImport:(id)arg1; 236 | - (BOOL)isExpressionWithinComment:(id)arg1; 237 | - (BOOL)isLocationInFunctionOrMethodBody:(id)arg1; 238 | @property(readonly) BOOL isWorkspaceBuilding; 239 | - (void)jumpBetweenSourceFileAndGeneratedFile:(id)arg1; 240 | - (void)jumpBetweenSourceFileAndGeneratedFileWithAlternate:(id)arg1; 241 | - (void)jumpBetweenSourceFileAndGeneratedFileWithShiftPlusAlternate:(id)arg1; 242 | - (void)jumpToDefinition:(id)arg1; 243 | - (void)jumpToDefinitionWithAlternate:(id)arg1; 244 | - (void)jumpToDefinitionWithShiftPlusAlternate:(id)arg1; 245 | - (void)jumpToSelection:(id)arg1; 246 | @property(readonly, nonatomic) DVTSourceLanguageService *languageService; 247 | @property(retain) DVTScopeBarController *languageServiceStatusScopeBarController; // @synthesize languageServiceStatusScopeBarController=_languageServiceStatusScopeBarController; 248 | @property struct _NSRange lastEditedCharacterRange; // @synthesize lastEditedCharacterRange=_lastEditedCharRange; 249 | @property(retain) DVTLayoutManager *layoutManager; // @synthesize layoutManager=_layoutManager; 250 | - (void)loadView; 251 | - (id)mainScrollView; 252 | - (void)menuNeedsUpdate:(id)arg1; 253 | - (void)mouseEntered:(id)arg1; 254 | - (void)mouseExited:(id)arg1; 255 | - (void)mouseMoved:(id)arg1; 256 | @property(retain, nonatomic) DVTSourceExpression *mouseOverExpression; // @synthesize mouseOverExpression=_mouseOverExpression; 257 | - (void)navigateToAnnotationWithRepresentedObject:(id)arg1 wantsIndicatorAnimation:(BOOL)arg2 exploreAnnotationRepresentedObject:(id)arg3; 258 | - (void)openBlameView; 259 | - (void)openComparisonView; 260 | - (void)openQuicklyScoped:(id)arg1; 261 | - (id)pathCell:(id)arg1 menuItemForNavigableItem:(id)arg2 defaultMenuItem:(id)arg3; 262 | - (BOOL)pathCell:(id)arg1 shouldInitiallyShowMenuSearch:(id)arg2; 263 | - (BOOL)pathCell:(id)arg1 shouldSeparateDisplayOfChildItemsForItem:(id)arg2; 264 | - (void)popoverWillClose:(id)arg1; 265 | - (void)preprocessCurrentFile; 266 | - (void)primitiveInvalidate; 267 | @property(readonly) DVTSourceExpression *quickHelpExpression; 268 | @property(retain) NSPulseGestureRecognizer *recognizeGestureInSideBarView; // @synthesize recognizeGestureInSideBarView=_recognizeGestureInSideBarView; 269 | - (void)recognizeGestureInSideBarView:(id)arg1; 270 | - (void)recognizeImmediateActionGesture:(id)arg1; 271 | - (void)recognizerDidCancelAnimation:(id)arg1; 272 | - (void)recognizerDidCompleteAnimation:(id)arg1; 273 | - (void)recognizerDidDismissAnimation:(id)arg1; 274 | - (void)recognizerWillBeginAnimation:(id)arg1; 275 | - (id)refactoringExpressionUsingContextMenu:(BOOL)arg1; 276 | - (void)registerForMouseEvents; 277 | //- (void)removeVisualization:(id)arg1 fadeOut:(BOOL)arg2 completionBlock:(CDUnknownBlockType)arg3; 278 | - (void)revealInSymbolNavigator:(id)arg1; 279 | - (void)revertStateWithDictionary:(id)arg1; 280 | @property(retain) NSScrollView *scrollView; // @synthesize scrollView=_scrollView; 281 | - (void)selectAndHighlightDocumentLocations:(id)arg1; 282 | - (void)selectDocumentLocations:(id)arg1; 283 | - (void)selectDocumentLocations:(id)arg1 highlightSelection:(BOOL)arg2; 284 | @property(retain, nonatomic) DVTSourceExpression *selectedExpression; // @synthesize selectedExpression=_selectedExpression; 285 | - (struct _NSRange)selectedRangeForFindBar:(id)arg1; 286 | - (id)selectedTestsAndTestables; 287 | @property(readonly, nonatomic) NSString *selectedText; 288 | - (void)setCurrentSelectedItems:(id)arg1; 289 | @property(retain) IDESingleFileProcessingToolbarController *singleFileProcessingToolbarController; // @synthesize singleFileProcessingToolbarController=_singleFileProcessingToolbarController; 290 | @property(retain) DVTSourceTextView *textView; // @synthesize textView=_textView; 291 | - (void)setupGutterContextMenuWithMenu:(id)arg1; 292 | - (void)setupTextViewContextMenuWithMenu:(id)arg1; 293 | - (void)showAllIssues:(id)arg1; 294 | - (void)showAnalyzerExplorerForMessage:(id)arg1 animate:(BOOL)arg2; 295 | - (void)showErrorsOnly:(id)arg1; 296 | - (void)showQuickHelp:(id)arg1; 297 | @property(readonly) IDESourceCodeDocument *sourceCodeDocument; 298 | - (void)specialPaste:(id)arg1; 299 | - (void)startNoteExplorerForItem:(id)arg1; 300 | - (void)startSingleProcessingModeForURL:(id)arg1; 301 | - (id)startingLocationForFindBar:(id)arg1 findingBackwards:(BOOL)arg2; 302 | - (void)stopNoteExplorer; 303 | //- (void)symbolsForExpression:(id)arg1 inQueue:(id)arg2 completionBlock:(CDUnknownBlockType)arg3; 304 | - (id)syntaxColoringContextForTextView:(id)arg1; 305 | - (void)takeFocus; 306 | - (void)textDidChange:(id)arg1; 307 | - (void)textView:(id)arg1 clickedOnCell:(id)arg2 inRect:(struct CGRect)arg3 atIndex:(unsigned long long)arg4; 308 | - (void)textView:(id)arg1 didClickOnTemporaryLinkAtCharacterIndex:(unsigned long long)arg2 event:(id)arg3 isAltEvent:(BOOL)arg4; 309 | - (void)textView:(id)arg1 didRemoveAnnotations:(id)arg2; 310 | - (void)textView:(id)arg1 doubleClickedOnCell:(id)arg2 inRect:(struct CGRect)arg3 atIndex:(unsigned long long)arg4; 311 | - (void)textView:(id)arg1 handleMouseDidExitSidebar:(id)arg2; 312 | - (void)textView:(id)arg1 handleMouseDidMoveOverSidebar:(id)arg2 atLineNumber:(unsigned long long)arg3; 313 | - (void)textView:(id)arg1 handleMouseDownInSidebar:(id)arg2 atLineNumber:(unsigned long long)arg3; 314 | - (long long)textView:(id)arg1 interiorBackgroundStyle:(long long)arg2 forInlineTokenAttachmentCell:(id)arg3; 315 | - (id)textView:(id)arg1 menu:(id)arg2 forEvent:(id)arg3 atIndex:(unsigned long long)arg4; 316 | - (BOOL)textView:(id)arg1 shouldChangeTextInRange:(struct _NSRange)arg2 replacementString:(id)arg3; 317 | - (BOOL)textView:(id)arg1 shouldShowTemporaryLinkForCharacterAtIndex:(unsigned long long)arg2 proposedRange:(struct _NSRange)arg3 effectiveRanges:(id *)arg4; 318 | - (id)textView:(id)arg1 tokenTintColor:(id)arg2 forInlineTokenAttachmentCell:(id)arg3; 319 | - (void)textViewBoundsDidChange:(id)arg1; 320 | - (void)textViewDidChangeSelection:(id)arg1; 321 | - (void)textViewDidFinishAnimatingScroll:(id)arg1; 322 | - (void)textViewDidLoadAnnotationProviders:(id)arg1; 323 | - (void)textViewDidScroll:(id)arg1; 324 | - (void)toggleBreakpointAtCurrentLine:(id)arg1; 325 | - (void)toggleCodeCoverageShown:(id)arg1; 326 | - (void)toggleInvisibleCharactersShown:(id)arg1; 327 | - (void)toggleIssueShown:(id)arg1; 328 | - (void)toggleMessageBubbles:(id)arg1; 329 | //- (void)tokenizableRangesWithRange:(struct _NSRange)arg1 completionBlock:(CDUnknownBlockType)arg2; 330 | - (id)undoManagerForTextView:(id)arg1; 331 | - (void)uninstallBreakpointGestureRecognizers; 332 | - (BOOL)validateMenuItem:(id)arg1; 333 | - (void)viewDidInstall; 334 | - (void)viewWillUninstall; 335 | - (id)viewWindow; 336 | @property(readonly) NSArray *visualizations; 337 | - (void)willStartTokenizedEditingWithRanges:(id)arg1; 338 | 339 | // Remaining properties 340 | @property(readonly, copy) IDESelection *contextMenuSelection; 341 | @property(retain) DVTStackBacktrace *creationBacktrace; 342 | @property(readonly, copy) NSString *debugDescription; 343 | @property(readonly, copy) NSString *description; 344 | @property(readonly) unsigned long long hash; 345 | @property(readonly) DVTStackBacktrace *invalidationBacktrace; 346 | //@property(readonly, copy) IDESelection *outputSelection; 347 | @property(readonly) DVTSDK *sdk; 348 | @property(readonly) Class superclass; 349 | @property(readonly, nonatomic, getter=isValid) BOOL valid; 350 | //@property(readonly, nonatomic) IDEWorkspaceTabController *workspaceTabController; 351 | 352 | @end 353 | 354 | -------------------------------------------------------------------------------- /Miku/miku-dancing.coding.io/lib/MMDLoader.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by sunqi on 15-7-16. 3 | */ 4 | /** 5 | * @author takahiro / https://github.com/takahirox 6 | * 7 | * This loader loads and parses PMD and VMD binary files 8 | * then creates mesh for Three.js. 9 | * 10 | * PMD is a model data format and VMD is a motion data format 11 | * used in MMD(Miku Miku Dance). 12 | * 13 | * MMD is a 3D CG animation tool which is popular in Japan. 14 | * 15 | * 16 | * MMD official site 17 | * http://www.geocities.jp/higuchuu4/index_e.htm 18 | * 19 | * PMD, VMD format 20 | * http://blog.goo.ne.jp/torisu_tetosuki/e/209ad341d3ece2b1b4df24abf619d6e4 21 | * 22 | * PMX format 23 | * http://www18.ocn.ne.jp/~atrenas/MMD/step_0002.html 24 | * 25 | * Model data requirements 26 | * convert .tga files to .png files if exist. (Should I use THREE.TGALoader?) 27 | * 28 | * TODO 29 | * pmx format support. 30 | * multi vmd files support. 31 | * edge(outline) support. 32 | * culling support. 33 | * Shift_jis strings support. 34 | * toon(cel) shadering support. 35 | * sphere mapping support. 36 | * physics support. 37 | * camera motion in vmd support. 38 | * light motion in vmd support. 39 | */ 40 | 41 | THREE.MMDLoader = function ( showStatus, manager ) { 42 | 43 | THREE.Loader.call( this, showStatus ); 44 | this.manager = ( manager !== undefined ) ? manager : THREE.DefaultLoadingManager; 45 | 46 | }; 47 | 48 | THREE.MMDLoader.prototype = Object.create( THREE.Loader.prototype ); 49 | THREE.MMDLoader.prototype.constructor = THREE.MMDLoader; 50 | 51 | THREE.MMDLoader.prototype.load = function ( pmdUrl, vmdUrl, callback, onProgress, onError ) { 52 | 53 | var texturePath = this.extractUrlBase( pmdUrl ); 54 | this.loadPmdFile( pmdUrl, vmdUrl, texturePath, callback, onProgress, onError ); 55 | 56 | }; 57 | 58 | THREE.MMDLoader.prototype.loadFileAsBuffer = function ( url, onLoad, onProgress, onError ) { 59 | 60 | var loader = new THREE.XHRLoader( this.manager ); 61 | loader.setCrossOrigin( this.crossOrigin ); 62 | loader.setResponseType( 'arraybuffer' ); 63 | loader.load( url, function ( buffer ) { 64 | 65 | onLoad( buffer ); 66 | 67 | }, onProgress, onError ); 68 | 69 | }; 70 | 71 | THREE.MMDLoader.prototype.loadPmdFile = function ( pmdUrl, vmdUrl, texturePath, callback, onProgress, onError ) { 72 | 73 | var scope = this; 74 | 75 | this.loadFileAsBuffer( pmdUrl, function ( buffer ) { 76 | 77 | scope.loadVmdFile( buffer, vmdUrl, texturePath, callback, onProgress, onError ); 78 | 79 | }, onProgress, onError ); 80 | 81 | }; 82 | 83 | THREE.MMDLoader.prototype.loadVmdFile = function ( pmdBuffer, vmdUrl, texturePath, callback, onProgress, onError ) { 84 | 85 | var scope = this; 86 | 87 | if ( ! vmdUrl ) { 88 | 89 | scope.parse( pmdBuffer, null, texturePath, callBack ); 90 | return; 91 | 92 | } 93 | 94 | this.loadFileAsBuffer( vmdUrl, function ( buffer ) { 95 | 96 | scope.parse( pmdBuffer, buffer, texturePath, callback ); 97 | 98 | }, onProgress, onError ); 99 | 100 | }; 101 | 102 | THREE.MMDLoader.prototype.parse = function ( pmdBuffer, vmdBuffer, texturePath, callback ) { 103 | 104 | var pmd = this.parsePmd( pmdBuffer ); 105 | var vmd = vmdBuffer !== null ? this.parseVmd( vmdBuffer ) : null; 106 | var mesh = this.createMesh( pmd, vmd, texturePath ); 107 | callback( mesh ); 108 | 109 | }; 110 | 111 | THREE.MMDLoader.prototype.parsePmd = function ( buffer ) { 112 | 113 | var scope = this; 114 | var pmd = {}; 115 | var dv = new THREE.MMDLoader.DataView( buffer ); 116 | 117 | pmd.metadata = {}; 118 | pmd.metadata.format = 'pmd'; 119 | 120 | var parseHeader = function () { 121 | 122 | var metadata = pmd.metadata; 123 | metadata.magic = dv.getChars( 3 ); 124 | 125 | if ( metadata.magic !== 'Pmd' ) { 126 | 127 | throw 'PMD file magic is not Pmd, but ' + metadata.magic; 128 | 129 | } 130 | 131 | metadata.version = dv.getFloat32(); 132 | metadata.modelName = dv.getSjisStrings( 20 ); 133 | metadata.comment = dv.getSjisStrings( 256 ); 134 | 135 | }; 136 | 137 | var parseVertices = function () { 138 | 139 | var parseVertex = function () { 140 | 141 | var p = {}; 142 | p.position = [ dv.getFloat32(), dv.getFloat32(), dv.getFloat32() ]; 143 | p.normal = [ dv.getFloat32(), dv.getFloat32(), dv.getFloat32() ]; 144 | p.uv = [ dv.getFloat32(), dv.getFloat32() ]; 145 | p.skinIndices = [ dv.getUint16(), dv.getUint16() ]; 146 | p.skinWeight = dv.getUint8(); 147 | p.edgeFlag = dv.getUint8(); 148 | return p; 149 | 150 | }; 151 | 152 | var metadata = pmd.metadata; 153 | metadata.vertexCount = dv.getUint32(); 154 | 155 | pmd.vertices = []; 156 | 157 | for ( var i = 0; i < metadata.vertexCount; i++ ) { 158 | 159 | pmd.vertices.push( parseVertex() ); 160 | 161 | } 162 | 163 | }; 164 | 165 | var parseFaces = function () { 166 | 167 | var parseFace = function () { 168 | 169 | var p = {}; 170 | p.indices = [ dv.getUint16(), dv.getUint16(), dv.getUint16() ]; 171 | return p; 172 | 173 | }; 174 | 175 | var metadata = pmd.metadata; 176 | metadata.faceCount = dv.getUint32() / 3; 177 | 178 | pmd.faces = []; 179 | 180 | for ( var i = 0; i < metadata.faceCount; i++ ) { 181 | 182 | pmd.faces.push( parseFace() ); 183 | 184 | } 185 | 186 | }; 187 | 188 | var parseMaterials = function () { 189 | 190 | var parseMaterial = function () { 191 | 192 | var p = {}; 193 | p.diffuse = [ dv.getFloat32(), dv.getFloat32(), dv.getFloat32(), dv.getFloat32() ]; 194 | p.shiness = dv.getFloat32(); 195 | p.specular = [ dv.getFloat32(), dv.getFloat32(), dv.getFloat32() ]; 196 | p.emissive = [ dv.getFloat32(), dv.getFloat32(), dv.getFloat32() ]; 197 | p.toonIndex = dv.getUint8(); 198 | p.edgeFlag = dv.getUint8(); 199 | p.faceCount = dv.getUint32() / 3; 200 | p.fileName = dv.getChars( 20 ); 201 | return p; 202 | 203 | }; 204 | 205 | var metadata = pmd.metadata; 206 | metadata.materialCount = dv.getUint32(); 207 | 208 | pmd.materials = []; 209 | 210 | for ( var i = 0; i < metadata.materialCount; i++ ) { 211 | 212 | pmd.materials.push( parseMaterial() ); 213 | 214 | } 215 | 216 | }; 217 | 218 | var parseBones = function () { 219 | 220 | var parseBone = function () { 221 | 222 | var p = {}; 223 | p.name = dv.getSjisStrings( 20 ); 224 | p.parentIndex = dv.getUint16(); 225 | p.tailIndex = dv.getUint16(); 226 | p.type = dv.getUint8(); 227 | p.ikIndex = dv.getUint16(); 228 | p.position = [ dv.getFloat32(), dv.getFloat32(), dv.getFloat32() ]; 229 | return p; 230 | 231 | }; 232 | 233 | var metadata = pmd.metadata; 234 | metadata.boneCount = dv.getUint16(); 235 | 236 | pmd.bones = []; 237 | 238 | for ( var i = 0; i < metadata.boneCount; i++ ) { 239 | 240 | pmd.bones.push( parseBone() ); 241 | 242 | } 243 | 244 | }; 245 | 246 | var parseIks = function () { 247 | 248 | var parseIk = function () { 249 | 250 | var p = {}; 251 | p.target = dv.getUint16(); 252 | p.effector = dv.getUint16(); 253 | p.linkCount = dv.getUint8(); 254 | p.iteration = dv.getUint16(); 255 | p.maxAngle = dv.getFloat32(); 256 | 257 | p.links = []; 258 | for ( var i = 0; i < p.linkCount; i++ ) { 259 | 260 | p.links.push( dv.getUint16() ); 261 | 262 | } 263 | 264 | return p; 265 | 266 | }; 267 | 268 | var metadata = pmd.metadata; 269 | metadata.ikCount = dv.getUint16(); 270 | 271 | pmd.iks = []; 272 | 273 | for ( var i = 0; i < metadata.ikCount; i++ ) { 274 | 275 | pmd.iks.push( parseIk() ); 276 | 277 | } 278 | 279 | }; 280 | 281 | var parseMorphs = function () { 282 | 283 | var parseMorph = function () { 284 | 285 | var p = {}; 286 | p.name = dv.getSjisStrings( 20 ); 287 | p.vertexCount = dv.getUint32(); 288 | p.type = dv.getUint8(); 289 | 290 | p.vertices = []; 291 | for ( var i = 0; i < p.vertexCount; i++ ) { 292 | 293 | p.vertices.push( { 294 | index: dv.getUint32(), 295 | position: [ dv.getFloat32(), dv.getFloat32(), dv.getFloat32() ] 296 | } ) ; 297 | 298 | } 299 | 300 | return p; 301 | 302 | }; 303 | 304 | var metadata = pmd.metadata; 305 | metadata.morphCount = dv.getUint16(); 306 | 307 | pmd.morphs = []; 308 | 309 | for ( var i = 0; i < metadata.morphCount; i++ ) { 310 | 311 | pmd.morphs.push( parseMorph() ); 312 | 313 | } 314 | 315 | 316 | }; 317 | 318 | parseHeader(); 319 | parseVertices(); 320 | parseFaces(); 321 | parseMaterials(); 322 | parseBones(); 323 | parseIks(); 324 | parseMorphs(); 325 | 326 | return pmd; 327 | 328 | }; 329 | 330 | // Not yet 331 | THREE.MMDLoader.prototype.parsePmx = function ( buffer ) { 332 | 333 | var scope = this; 334 | var pmx = {}; 335 | var dv = new THREE.MMDLoader.DataView( buffer ); 336 | 337 | pmx.metadata = {}; 338 | pmd.metadata.format = 'pmx'; 339 | 340 | return pmx; 341 | 342 | }; 343 | 344 | THREE.MMDLoader.prototype.parseVmd = function ( buffer ) { 345 | 346 | var scope = this; 347 | var vmd = {}; 348 | var dv = new THREE.MMDLoader.DataView( buffer ); 349 | 350 | vmd.metadata = {}; 351 | 352 | var parseHeader = function () { 353 | 354 | var metadata = vmd.metadata; 355 | metadata.magic = dv.getChars( 30 ); 356 | 357 | if ( metadata.magic !== 'Vocaloid Motion Data 0002' ) { 358 | 359 | throw 'VMD file magic is not Vocaloid Motion Data 0002, but ' + metadata.magic; 360 | 361 | } 362 | 363 | metadata.name = dv.getSjisStrings( 20 ); 364 | 365 | }; 366 | 367 | var parseMotions = function () { 368 | 369 | var parseMotion = function () { 370 | 371 | var p = {}; 372 | p.boneName = dv.getSjisStrings( 15 ); 373 | p.frameNum = dv.getUint32(); 374 | p.position = [ dv.getFloat32(), dv.getFloat32(), dv.getFloat32() ]; 375 | p.rotation = [ dv.getFloat32(), dv.getFloat32(), dv.getFloat32(), dv.getFloat32() ]; 376 | 377 | p.interpolation = []; 378 | for ( var i = 0; i < 64; i++ ) { 379 | 380 | p.interpolation.push( dv.getUint8() ); 381 | 382 | } 383 | 384 | return p; 385 | 386 | }; 387 | 388 | var metadata = vmd.metadata; 389 | metadata.motionCount = dv.getUint32(); 390 | 391 | vmd.motions = []; 392 | for ( var i = 0; i < metadata.motionCount; i++ ) { 393 | 394 | vmd.motions.push( parseMotion() ); 395 | 396 | } 397 | 398 | }; 399 | 400 | var parseMorphs = function () { 401 | 402 | var parseMorph = function () { 403 | 404 | var p = {}; 405 | p.morphName = dv.getSjisStrings( 15 ); 406 | p.frameNum = dv.getUint32(); 407 | p.weight = dv.getFloat32(); 408 | return p; 409 | 410 | }; 411 | 412 | var metadata = vmd.metadata; 413 | metadata.morphCount = dv.getUint32(); 414 | 415 | vmd.morphs = []; 416 | for ( var i = 0; i < metadata.morphCount; i++ ) { 417 | 418 | vmd.morphs.push( parseMorph() ); 419 | 420 | } 421 | 422 | }; 423 | 424 | parseHeader(); 425 | parseMotions(); 426 | parseMorphs(); 427 | 428 | return vmd; 429 | 430 | }; 431 | 432 | // maybe better to create json and then use JSONLoader... 433 | THREE.MMDLoader.prototype.createMesh = function ( pmd, vmd, texturePath, onProgress, onError ) { 434 | 435 | var scope = this; 436 | var geometry = new THREE.Geometry(); 437 | var material = new THREE.MeshFaceMaterial(); 438 | 439 | var leftToRight = function() { 440 | 441 | var convertVector = function ( v ) { 442 | 443 | v[ 2 ] = -v[ 2 ]; 444 | 445 | }; 446 | 447 | var convertQuaternion = function ( q ) { 448 | 449 | q[ 0 ] = -q[ 0 ]; 450 | q[ 1 ] = -q[ 1 ]; 451 | 452 | }; 453 | 454 | var convertIndexOrder = function ( p ) { 455 | 456 | var tmp = p[ 2 ]; 457 | p[ 2 ] = p[ 0 ]; 458 | p[ 0 ] = tmp; 459 | 460 | }; 461 | 462 | for ( var i = 0; i < pmd.metadata.vertexCount; i++ ) { 463 | 464 | convertVector( pmd.vertices[ i ].position ); 465 | convertVector( pmd.vertices[ i ].normal ); 466 | 467 | } 468 | 469 | for ( var i = 0; i < pmd.metadata.faceCount; i++ ) { 470 | 471 | convertIndexOrder( pmd.faces[ i ].indices ); 472 | 473 | } 474 | 475 | for ( var i = 0; i < pmd.metadata.boneCount; i++ ) { 476 | 477 | convertVector( pmd.bones[ i ].position ); 478 | 479 | } 480 | 481 | for ( var i = 0; i < pmd.metadata.morphCount; i++ ) { 482 | 483 | var m = pmd.morphs[ i ]; 484 | 485 | for( var j = 0; j < m.vertexCount; j++ ) { 486 | 487 | convertVector( m.vertices[ j ].position ); 488 | 489 | } 490 | 491 | } 492 | 493 | for ( var i = 0; i < vmd.metadata.motionCount; i++ ) { 494 | 495 | convertVector( vmd.motions[ i ].position ); 496 | convertQuaternion( vmd.motions[ i ].rotation ); 497 | 498 | } 499 | 500 | }; 501 | 502 | var initVartices = function () { 503 | 504 | for ( var i = 0; i < pmd.metadata.vertexCount; i++ ) { 505 | 506 | geometry.vertices.push( 507 | new THREE.Vector3( 508 | pmd.vertices[ i ].position[ 0 ], 509 | pmd.vertices[ i ].position[ 1 ], 510 | pmd.vertices[ i ].position[ 2 ] 511 | ) 512 | ); 513 | 514 | geometry.skinIndices.push( 515 | new THREE.Vector4( 516 | pmd.vertices[ i ].skinIndices[ 0 ], 517 | pmd.vertices[ i ].skinIndices[ 1 ], 518 | 0.0, 519 | 0.0 520 | ) 521 | ); 522 | 523 | geometry.skinWeights.push( 524 | new THREE.Vector4( 525 | pmd.vertices[ i ].skinWeight / 100, 526 | (100 - pmd.vertices[ i ].skinWeight) / 100, 527 | 0.0, 528 | 0.0 529 | ) 530 | ); 531 | 532 | } 533 | 534 | }; 535 | 536 | var initFaces = function () { 537 | 538 | for ( var i = 0; i < pmd.metadata.faceCount; i++ ) { 539 | 540 | geometry.faces.push( 541 | new THREE.Face3( 542 | pmd.faces[ i ].indices[ 0 ], 543 | pmd.faces[ i ].indices[ 1 ], 544 | pmd.faces[ i ].indices[ 2 ] 545 | ) 546 | ); 547 | 548 | for ( var j = 0; j < 3; j++ ) { 549 | 550 | geometry.faces[ i ].vertexNormals[ j ] = 551 | new THREE.Vector3( 552 | pmd.vertices[ pmd.faces[ i ].indices[ j ] ].normal[ 0 ], 553 | pmd.vertices[ pmd.faces[ i ].indices[ j ] ].normal[ 1 ], 554 | pmd.vertices[ pmd.faces[ i ].indices[ j ] ].normal[ 2 ] 555 | ); 556 | 557 | } 558 | 559 | } 560 | 561 | }; 562 | 563 | var initBones = function () { 564 | 565 | var bones = []; 566 | 567 | for( var i = 0; i < pmd.metadata.boneCount; i++ ) { 568 | 569 | var bone = {}; 570 | var b = pmd.bones[ i ]; 571 | 572 | bone.parent = ( b.parentIndex === 0xFFFF ) ? -1 : b.parentIndex; 573 | bone.name = b.name; 574 | bone.pos = [ b.position[ 0 ], b.position[ 1 ], b.position[ 2 ] ]; 575 | bone.rotq = [ 0, 0, 0, 1 ]; 576 | bone.scl = [ 1, 1, 1 ]; 577 | 578 | if ( bone.parent !== -1 ) { 579 | 580 | bone.pos[ 0 ] -= pmd.bones[ bone.parent ].position[ 0 ]; 581 | bone.pos[ 1 ] -= pmd.bones[ bone.parent ].position[ 1 ]; 582 | bone.pos[ 2 ] -= pmd.bones[ bone.parent ].position[ 2 ]; 583 | 584 | } 585 | 586 | bones.push( bone ); 587 | 588 | } 589 | 590 | geometry.bones = bones; 591 | 592 | }; 593 | 594 | var initIKs = function () { 595 | 596 | var iks = []; 597 | 598 | for( var i = 0; i < pmd.metadata.ikCount; i++ ) { 599 | 600 | var ik = pmd.iks[i]; 601 | var param = {}; 602 | 603 | param.target = ik.target; 604 | param.effector = ik.effector; 605 | param.iteration = ik.iteration; 606 | param.maxAngle = ik.maxAngle * 4; 607 | param.links = []; 608 | 609 | for ( var j = 0; j < ik.links.length; j++ ) { 610 | 611 | var link = {}; 612 | link.index = ik.links[ j ]; 613 | 614 | // '0x820xd00x820xb4' = 'ひざ' 615 | // see THREE.MMDLoader.DataVie.getSjisStrings() 616 | if ( pmd.bones[ link.index ].name.indexOf( '0x820xd00x820xb4' ) >= 0 ) { 617 | 618 | link.limitation = new THREE.Vector3( 1.0, 0.0, 0.0 ); 619 | 620 | } 621 | 622 | param.links.push( link ); 623 | 624 | } 625 | 626 | iks.push( param ); 627 | 628 | } 629 | 630 | geometry.iks = iks; 631 | 632 | }; 633 | 634 | var initMorphs = function () { 635 | 636 | for ( var i = 0; i < pmd.metadata.morphCount; i++ ) { 637 | 638 | var m = pmd.morphs[ i ]; 639 | var params = {}; 640 | 641 | params.name = m.name; 642 | params.vertices = []; 643 | 644 | for( var j = 0; j < pmd.metadata.vertexCount; j++ ) { 645 | 646 | params.vertices[ j ] = new THREE.Vector3( 0, 0, 0 ); 647 | params.vertices[ j ].x = geometry.vertices[ j ].x; 648 | params.vertices[ j ].y = geometry.vertices[ j ].y; 649 | params.vertices[ j ].z = geometry.vertices[ j ].z; 650 | 651 | } 652 | 653 | if ( i !== 0 ) { 654 | 655 | for( var j = 0; j < m.vertexCount; j++ ) { 656 | 657 | var v = m.vertices[ j ]; 658 | var index = pmd.morphs[ 0 ].vertices[ v.index ].index; 659 | params.vertices[ index ].x += v.position[ 0 ]; 660 | params.vertices[ index ].y += v.position[ 1 ]; 661 | params.vertices[ index ].z += v.position[ 2 ]; 662 | 663 | } 664 | 665 | } 666 | 667 | geometry.morphTargets.push( params ); 668 | 669 | } 670 | 671 | }; 672 | 673 | var initMaterials = function () { 674 | 675 | var offset = 0; 676 | var materialParams = []; 677 | 678 | for ( var i = 1; i < pmd.metadata.materialCount; i++ ) { 679 | 680 | geometry.faceVertexUvs.push( [] ); 681 | 682 | } 683 | 684 | for ( var i = 0; i < pmd.metadata.materialCount; i++ ) { 685 | 686 | var m = pmd.materials[ i ]; 687 | var params = {}; 688 | 689 | for ( var j = 0; j < m.faceCount; j++ ) { 690 | 691 | geometry.faces[ offset ].materialIndex = i; 692 | 693 | var uvs = []; 694 | 695 | for ( var k = 0; k < 3; k++ ) { 696 | 697 | var v = pmd.vertices[ pmd.faces[ offset ].indices[ k ] ]; 698 | uvs.push( new THREE.Vector2( v.uv[ 0 ], v.uv[ 1 ] ) ); 699 | 700 | } 701 | 702 | geometry.faceVertexUvs[ 0 ].push( uvs ); 703 | 704 | offset++; 705 | 706 | } 707 | 708 | params.shading = 'phong'; 709 | params.colorDiffuse = [ m.diffuse[ 0 ], m.diffuse[ 1 ], m.diffuse[ 2 ] ]; 710 | params.opacity = m.diffuse[ 3 ]; 711 | params.colorSpecular = [ m.specular[ 0 ], m.specular[ 1 ], m.specular[ 2 ] ]; 712 | params.specularCoef = m.shiness; 713 | 714 | // temporal workaround 715 | // TODO: implement correctly 716 | params.doubleSided = true; 717 | 718 | if( m.fileName ) { 719 | 720 | var fileName = m.fileName; 721 | 722 | // temporal workaround, use .png instead of .tga 723 | // TODO: tga file support 724 | if ( fileName.indexOf( '.tga' ) ) { 725 | 726 | fileName = fileName.replace( '.tga', '.png' ); 727 | 728 | } 729 | 730 | // temporal workaround, disable sphere mapping so far 731 | // TODO: sphere mapping support 732 | var index; 733 | 734 | if( ( index = fileName.lastIndexOf( '*' ) ) >= 0 ) { 735 | 736 | fileName = fileName.slice( index + 1 ); 737 | 738 | } 739 | 740 | if( ( index = fileName.lastIndexOf( '+' ) ) >= 0 ) { 741 | 742 | fileName = fileName.slice( index + 1 ); 743 | 744 | } 745 | 746 | params.mapDiffuse = fileName; 747 | 748 | } else { 749 | 750 | params.colorEmissive = [ m.emissive[ 0 ], m.emissive[ 1 ], m.emissive[ 2 ] ]; 751 | 752 | } 753 | 754 | materialParams.push( params ); 755 | 756 | } 757 | 758 | var materials = scope.initMaterials( materialParams, texturePath ); 759 | 760 | for ( var i = 0; i < materials.length; i++ ) { 761 | 762 | var m = materials[ i ]; 763 | 764 | if ( m.map ) { 765 | 766 | m.map.flipY = false; 767 | 768 | } 769 | 770 | m.skinning = true; 771 | m.morphTargets = true; 772 | material.materials.push( m ); 773 | 774 | } 775 | 776 | }; 777 | 778 | var initMotionAnimations = function () { 779 | 780 | var orderedMotions = []; 781 | var boneTable = {}; 782 | 783 | for ( var i = 0; i < pmd.metadata.boneCount; i++ ) { 784 | 785 | var b = pmd.bones[ i ]; 786 | boneTable[ b.name ] = i; 787 | orderedMotions[ i ] = []; 788 | 789 | } 790 | 791 | for ( var i = 0; i < vmd.motions.length; i++ ) { 792 | 793 | var m = vmd.motions[ i ]; 794 | var num = boneTable[ m.boneName ]; 795 | 796 | if ( num === undefined ) 797 | continue; 798 | 799 | orderedMotions[ num ].push( m ); 800 | 801 | } 802 | 803 | for ( var i = 0; i < orderedMotions.length; i++ ) { 804 | 805 | orderedMotions[ i ].sort( function ( a, b ) { 806 | 807 | return a.frameNum - b.frameNum; 808 | 809 | } ) ; 810 | 811 | } 812 | 813 | var animation = { 814 | name: 'Action', 815 | fps: 30, 816 | length: 0.0, 817 | hierarchy: [] 818 | }; 819 | 820 | for ( var i = 0; i < geometry.bones.length; i++ ) { 821 | 822 | animation.hierarchy.push( 823 | { 824 | parent: geometry.bones[ i ].parent, 825 | keys: [] 826 | } 827 | ); 828 | 829 | } 830 | 831 | var maxTime = 0.0; 832 | 833 | for ( var i = 0; i < orderedMotions.length; i++ ) { 834 | 835 | var array = orderedMotions[ i ]; 836 | 837 | for ( var j = 0; j < array.length; j++ ) { 838 | 839 | var t = array[ j ].frameNum / 30; 840 | var p = array[ j ].position; 841 | var r = array[ j ].rotation; 842 | 843 | animation.hierarchy[ i ].keys.push( 844 | { 845 | time: t, 846 | pos: [ geometry.bones[ i ].pos[ 0 ] + p[ 0 ], 847 | geometry.bones[ i ].pos[ 1 ] + p[ 1 ], 848 | geometry.bones[ i ].pos[ 2 ] + p[ 2 ] ], 849 | rot: [ r[ 0 ], r[ 1 ], r[ 2 ], r[ 3 ] ], 850 | scl: [ 1, 1, 1 ] 851 | } 852 | ); 853 | 854 | if ( t > maxTime ) 855 | maxTime = t; 856 | 857 | } 858 | 859 | } 860 | 861 | // add 2 secs as afterglow 862 | maxTime += 2.0; 863 | animation.length = maxTime; 864 | 865 | for ( var i = 0; i < orderedMotions.length; i++ ) { 866 | 867 | var keys = animation.hierarchy[ i ].keys; 868 | 869 | if ( keys.length === 0 ) { 870 | 871 | keys.push( { time: 0.0, 872 | pos: [ geometry.bones[ i ].pos[ 0 ], 873 | geometry.bones[ i ].pos[ 1 ], 874 | geometry.bones[ i ].pos[ 2 ] ], 875 | rot: [ 0, 0, 0, 1 ], 876 | scl: [ 1, 1, 1 ] 877 | } ); 878 | 879 | } 880 | 881 | var k = keys[ 0 ]; 882 | 883 | if ( k.time !== 0.0 ) { 884 | 885 | keys.unshift( { time: 0.0, 886 | pos: [ k.pos[ 0 ], k.pos[ 1 ], k.pos[ 2 ] ], 887 | rot: [ k.rot[ 0 ], k.rot[ 1 ], k.rot[ 2 ], k.rot[ 3 ] ], 888 | scl: [ 1, 1, 1 ] 889 | } ); 890 | 891 | } 892 | 893 | k = keys[ keys.length - 1 ]; 894 | 895 | if ( k.time < maxTime ) { 896 | 897 | keys.push( { time: maxTime, 898 | pos: [ k.pos[ 0 ], k.pos[ 1 ], k.pos[ 2 ] ], 899 | rot: [ k.rot[ 0 ], k.rot[ 1 ], k.rot[ 2 ], k.rot[ 3 ] ], 900 | scl: [ 1, 1, 1 ] 901 | } ); 902 | 903 | } 904 | 905 | } 906 | 907 | geometry.animation = animation; 908 | 909 | }; 910 | 911 | var initMorphAnimations = function () { 912 | 913 | var orderedMorphs = []; 914 | var morphTable = {} 915 | 916 | for ( var i = 0; i < pmd.metadata.morphCount; i++ ) { 917 | 918 | var m = pmd.morphs[ i ]; 919 | morphTable[ m.name ] = i; 920 | orderedMorphs[ i ] = []; 921 | 922 | } 923 | 924 | for ( var i = 0; i < vmd.morphs.length; i++ ) { 925 | 926 | var m = vmd.morphs[ i ]; 927 | var num = morphTable[ m.morphName ]; 928 | 929 | if ( num === undefined ) 930 | continue; 931 | 932 | orderedMorphs[ num ].push( m ); 933 | 934 | } 935 | 936 | for ( var i = 0; i < orderedMorphs.length; i++ ) { 937 | 938 | orderedMorphs[ i ].sort( function ( a, b ) { 939 | 940 | return a.frameNum - b.frameNum; 941 | 942 | } ) ; 943 | 944 | } 945 | 946 | var morphAnimation = { 947 | fps: 30, 948 | length: 0.0, 949 | hierarchy: [] 950 | }; 951 | 952 | for ( var i = 0; i < pmd.metadata.morphCount; i++ ) { 953 | 954 | morphAnimation.hierarchy.push( { keys: [] } ); 955 | 956 | } 957 | 958 | var maxTime = 0.0; 959 | 960 | for ( var i = 0; i < orderedMorphs.length; i++ ) { 961 | 962 | var array = orderedMorphs[ i ]; 963 | 964 | for ( var j = 0; j < array.length; j++ ) { 965 | 966 | var t = array[ j ].frameNum / 30; 967 | var w = array[ j ].weight; 968 | 969 | morphAnimation.hierarchy[ i ].keys.push( { time: t, weight: w } ); 970 | 971 | if ( t > maxTime ) 972 | maxTime = t; 973 | 974 | } 975 | 976 | } 977 | 978 | // add 2 secs as afterglow 979 | maxTime += 2.0; 980 | 981 | // use animation's length if exists. animation is master. 982 | maxTime = ( geometry.animation !== undefined && 983 | geometry.animation.length > 0.0 ) 984 | ? geometry.animation.length : maxTime; 985 | morphAnimation.length = maxTime; 986 | 987 | for ( var i = 0; i < orderedMorphs.length; i++ ) { 988 | 989 | var keys = morphAnimation.hierarchy[ i ].keys; 990 | 991 | if ( keys.length === 0 ) { 992 | 993 | keys.push( { time: 0.0, weight: 0.0 } ); 994 | 995 | } 996 | 997 | var k = keys[ 0 ]; 998 | 999 | if ( k.time !== 0.0 ) { 1000 | 1001 | keys.unshift( { time: 0.0, weight: k.weight } ); 1002 | 1003 | } 1004 | 1005 | k = keys[ keys.length - 1 ]; 1006 | 1007 | if ( k.time < maxTime ) { 1008 | 1009 | keys.push( { time: maxTime, weight: k.weight } ); 1010 | 1011 | } 1012 | 1013 | } 1014 | 1015 | geometry.morphAnimation = morphAnimation; 1016 | 1017 | }; 1018 | 1019 | leftToRight(); 1020 | initVartices(); 1021 | initFaces(); 1022 | initBones(); 1023 | initIKs(); 1024 | initMorphs(); 1025 | initMaterials(); 1026 | 1027 | if ( vmd !== null ) { 1028 | 1029 | initMotionAnimations(); 1030 | initMorphAnimations(); 1031 | 1032 | } 1033 | 1034 | geometry.computeFaceNormals(); 1035 | geometry.verticesNeedUpdate = true; 1036 | geometry.normalsNeedUpdate = true; 1037 | geometry.uvsNeedUpdate = true; 1038 | 1039 | var mesh = new THREE.SkinnedMesh( geometry, material ); 1040 | return mesh; 1041 | 1042 | }; 1043 | 1044 | THREE.MMDLoader.DataView = function ( buffer, littleEndian ) { 1045 | 1046 | this.dv = new DataView( buffer ); 1047 | this.offset = 0; 1048 | this.littleEndian = ( littleEndian !== undefined ) ? littleEndian : true; 1049 | 1050 | }; 1051 | 1052 | THREE.MMDLoader.DataView.prototype = { 1053 | 1054 | constructor: THREE.MMDLoader.DataView, 1055 | 1056 | getInt8: function () { 1057 | 1058 | var value = this.dv.getInt8( this.offset ); 1059 | this.offset += 1; 1060 | return value; 1061 | 1062 | }, 1063 | 1064 | getUint8: function () { 1065 | 1066 | var value = this.dv.getUint8( this.offset ); 1067 | this.offset += 1; 1068 | return value; 1069 | 1070 | }, 1071 | 1072 | getInt16: function () { 1073 | 1074 | var value = this.dv.getInt16( this.offset, this.littleEndian ); 1075 | this.offset += 2; 1076 | return value; 1077 | 1078 | }, 1079 | 1080 | getUint16: function () { 1081 | 1082 | var value = this.dv.getUint16( this.offset, this.littleEndian ); 1083 | this.offset += 2; 1084 | return value; 1085 | 1086 | }, 1087 | 1088 | getInt32: function () { 1089 | 1090 | var value = this.dv.getInt32( this.offset, this.littleEndian ); 1091 | this.offset += 4; 1092 | return value; 1093 | 1094 | }, 1095 | 1096 | getUint32: function () { 1097 | 1098 | var value = this.dv.getUint32( this.offset, this.littleEndian ); 1099 | this.offset += 4; 1100 | return value; 1101 | 1102 | }, 1103 | 1104 | getFloat32: function () { 1105 | var value = this.dv.getFloat32( this.offset, this.littleEndian ); 1106 | this.offset += 4; 1107 | return value; 1108 | 1109 | }, 1110 | 1111 | getFloat64: function () { 1112 | 1113 | var value = this.dv.getFloat64( this.offset, this.littleEndian ); 1114 | this.offset += 8; 1115 | return value; 1116 | 1117 | }, 1118 | 1119 | getChars: function ( size ) { 1120 | 1121 | var str = ''; 1122 | 1123 | while ( size > 0 ) { 1124 | 1125 | var value = this.getUint8(); 1126 | size--; 1127 | 1128 | if( value === 0 ) 1129 | break; 1130 | 1131 | str += String.fromCharCode( value ); 1132 | 1133 | } 1134 | 1135 | while ( size > 0 ) { 1136 | 1137 | this.getUint8(); 1138 | size--; 1139 | 1140 | } 1141 | 1142 | return str; 1143 | 1144 | }, 1145 | 1146 | // using temporal workaround because Shift_JIS binary -> utf conversion isn't so easy. 1147 | // Shift_JIS binary will be converted to hex strings with prefix '0x' on each byte. 1148 | // for example Shift_JIS 'あいうえお' will be '0x82x0xa00x820xa20x800xa40x820xa60x820xa8'. 1149 | // functions which handle Shift_JIS data (ex: bone name check) need to know this trick. 1150 | // TODO: Shift_JIS support (by using http://imaya.blog.jp/archives/6368510.html) 1151 | getSjisStrings: function ( size ) { 1152 | 1153 | var str = ''; 1154 | 1155 | while ( size > 0 ) { 1156 | 1157 | var value = this.getUint8(); 1158 | size--; 1159 | 1160 | if ( value === 0 ) 1161 | break; 1162 | 1163 | str += '0x' + ( '0' + value.toString( 16 ) ).substr( -2 ); 1164 | 1165 | } 1166 | 1167 | while ( size > 0 ) { 1168 | 1169 | this.getUint8(); 1170 | size--; 1171 | 1172 | } 1173 | 1174 | return str; 1175 | 1176 | } 1177 | 1178 | }; 1179 | 1180 | --------------------------------------------------------------------------------