设为首页收藏本站同能贴吧 切换语言 繁体中文
开启辅助访问 切换到窄版
扫描二维码关注官方公众号
返回列表
+ 发新帖
查看: 145|回复: 0

[转载发布] ☯◦ MASTER PICTURES DEBUG TOOL ◦☯ 2017-07-12||v.0.9.3

[复制链接]
累计送礼:
0 个
累计收礼:
1 个
  • TA的每日心情
    开心
    2026-7-12 04:10
  • 签到天数: 209 天

    连续签到: 2 天

    [LV.7]常住居民III

    9072

    主题

    864

    回帖

    6万

    积分

    管理员

    Rank: 9Rank: 9Rank: 9

    VIP
    7
    卡币
    58885
    OK点
    16
    推广点
    0
    同能卷
    50
    积分
    68851

    灌水之王

    发表于 2026-7-27 07:35:11 | 显示全部楼层 |阅读模式



    SNIPET CODE: ↓↓↓↓↓↓?
                    PHP:       
    1. // ┌□-□───────────-RMMV PICTURES DEBUG TOOL-──────────────┐
    2. // □ Version-0.9.3 alpha release
    3. // □ Free for commercial and non commercial use.
    4. // └──────────────────────□□□□□□□□□───────────────────────┘
    5. /*:
    6. * @plugindesc AWSOME picture debuger for make a awsome game
    7. * @author jonforum || djmisterjon
    8. *
    9. * @param mouseButton
    10. * @desc set the default buton to debug (recomended middle)
    11. * 1:'left' 2:'middle' 3:'rigth'
    12. * @default 2
    13. *
    14. * @param lineSize
    15. * @desc the line size: number
    16. * @default 3
    17. *
    18. * @param pointSize
    19. * @desc The size and border for Squares : [x,y,b]
    20. * to use circle, add a radius at end [x,y,b,r]
    21. * @default [12,12,3]
    22. *
    23. * @param pointStyles
    24. * @desc the color for square, inside and border : [cIn,cOut]
    25. * use Hex without '#'
    26. * @default 'FFFF00','FF0000'
    27. *
    28. *
    29. * @param capturePictureBy
    30. * @desc theif old button over a picture, move this picture
    31. *clipboard use the fileName of the picture your are working
    32. *  'clipboard'  'click' 'none'
    33. * @default 'click'
    34. *
    35. * @param capturePictureLots
    36. * @desc if true, it will capture all pictures below the mouse
    37. * not work with clipboard
    38. * @default false
    39. *
    40. * @param clownGhostPictures
    41. * @desc move the original picture , or make a clown with alpha
    42. * [true,alpha]    alpha are between 0.1 and 1
    43. * @default [true,0.5]
    44. *
    45. * @param PixiLimiteSprites
    46. * @desc set the limite of sprites on map, before clear painting
    47. * @default 24
    48. *
    49. * @param clipBoardData
    50. * @desc set the formula you when automaticly copy in
    51. * possibility are: 'origin' 'end' 'dist' or 'full'
    52. * @default full
    53. *
    54. * @param psychedelicMode
    55. * @desc lines not clear() on update, so you can do..you can do...?
    56. *  nothing! is for fun! also test performance GPU&CPU!
    57. * @default false
    58. *
    59. * @param pixiResolution
    60. * @desc you have a cheap gpu, you can reduce de quantifier
    61. *  this afect only the PIXI , set to 0.1 to 1
    62. * @default 1
    63. *
    64. * @param showGridDebug
    65. * @desc show a grid over all scenes for debug
    66. * set true of false
    67. * @default true
    68. *
    69. * @param gridSetup
    70. * @desc set the color,borderSize and alpha for grid
    71. * ["colorBorder",border,alphaBorder]
    72. * @default ["ffffff",2,0.1]
    73. * @help
    74. *
    75. * @param whellRotation
    76. * @desc set the angle when you use the whell to
    77. * make the picture rotation. Is fixed to Anchor
    78. * @default 15
    79. * @help
    80. * ┌□-─-HELP ABOUT DEBUG PICTURE-───────┐
    81. *    https://goo.gl/XnRuFG
    82. * └─────□□□□□□□□□────────┘
    83. ABOUT THIS AWSOME PLUGIN:↓ ?
    84. Here is an exceptional plugin for all developer who develops a project based on an picture and pixi sprite engine.
    85. I lose more than 5 minutes to position some of my picture in my game engine, so I decided to remedy the situation.
    86. This plugin allows you with the mouse to move images and get all the information to position it.
    87. You can easily position && move an image and get the nessesary information in order to avoid lots trying and mistake, when you try positioning you sprites.
    88. It also take all adding in child picture container.
    89. It is exclusively a great tool to work, it can generate problems in the game, but the idea is to be able to activate it when necessaire, for avoid math calculation and save time.
    90. please lets me know if you have BUGS!?
    91. HOW IT USE:↓↓↓↓↓↓ ?
    92. At the base I designed them to work in javascript only and for my game engine, but I adapt them for all people, so now, it has parameters.
    93. here the basic step feature:
    94. Click on a picture with you middle(recomended) mouse button and hold it.
    95. Move you mouse with the picture where you need
    96. release middle button
    97. take information from console, title bar or in the clipBoard (CTRL+V) in your plugin or the sofware engine.
    98. FEATURES: ↓↓↓↓↓↓?
    99. more info go here
    100. https://goo.gl/XnRuFG
    101. */
    102. var jonLPictureDebuger = jonLPictureDebuger || {};
    103. (function($) {
    104.     // ┌□-□─────────────-PluginManager-───────────────┐
    105.     // □ parameter
    106.     // └──────────────────□□□□□□□□□───────────────────┘
    107.     var param = PluginManager.parameters('jonLPictureDebuger');
    108.     var pixiLimit = Number(param.PixiLimiteSprites);
    109.     var lineSize = Number(param.lineSize);
    110.     var sqSize = JSON.parse(param.pointSize);
    111.     var sqColor = param.pointStyles.match(/\w+/gi);
    112.     var lsdMode = JSON.parse(param.psychedelicMode);
    113.     var pinMode = param.capturePictureBy;
    114.     var clipboardNeed =  param.clipBoardData;
    115.     var showGridDebug =  JSON.parse(param.showGridDebug);
    116.     var gridSetup =  JSON.parse(param.gridSetup);
    117.     var mouseButton = Number(param.mouseButton);
    118.     var whellRotation = Number(param.whellRotation);
    119.     // ┌□-□───────────────────-CONSOLELOGCSS-─────────────────────┐
    120.     // □ consCss1[0] □ consCss1[1] □ consCss1[2] □ consCss1[3]
    121.     // └─────────────────────────□□□□□□□□□────────────────────────┘
    122.     var consCss1 = [
    123.     ['background: linear-gradient(#008000, #004000)', 'border: 2px solid #323335', 'color: white', 'display: block', 'line-height: 16px', 'font-weight: bold'
    124.     ].join(';'),
    125.     ['background: linear-gradient(#c91919, #6d0c0c)', 'border: 2px solid #323335', 'color: white', 'display: block', 'line-height: 16px', 'font-weight: bold'
    126.     ].join(';'),
    127.     ['background: linear-gradient(#ffa500 , #6B4500)', 'border: 2px solid #323335', 'color: white', 'display: block', 'line-height: 16px', 'font-weight: bold'
    128.     ].join(';'),
    129.     ['background: linear-gradient(#404040 , #191919)', 'border: 2px solid #323335', 'color: white', 'display: block', 'line-height: 16px', 'font-weight: bold'
    130.     ].join(';'),
    131.     ];
    132.     // ┌□-□─────────────-VARIABLESCOPE-───────────────┐
    133.     // □ jonLPictureDebuger
    134.     // └──────────────────□□□□□□□□□───────────────────┘
    135.     var scenes, pixiLine, isOlding, SCM, pixiShapeScene;
    136.     var dataXY = {},docuTxtData = [],fixXYline = [],endFixdata = [],distanceData = [],grabList = [],txtAboutHolding = '',
    137.         originClick = '',dataGlobalName = '',dataGlobalID = 0;
    138.     // ┌□-jonLPictureDebuger-□─────────────────────────-MOUSEEVENT-───────────────────────────────────┐
    139.     // □ _onMouseDown □ _onMouseMove □ _onMouseUp □ _UpdatePinGrabPicture □ _onWheel □ _onMouseDown
    140.     // └────────────────────────────────────────────────□□□□□□□□□─────────────────────────────────────┘
    141.     $._onMouseDown = function(event) { //_active
    142.         if(event.which!==mouseButton){return false;}
    143.         SCM = SceneManager._scene;
    144.         if (SCM.constructor.name !== 'Scene_Map' || !SCM._active) {return false};
    145.         pixiShapeScene = pixiShapeScene || SceneManager._scene._pixishapeDebug;
    146.         if (pixiShapeScene.children.length > pixiLimit) { pixiShapeScene.removeChildren()};
    147.         var x = Graphics.pageToCanvasX(event.pageX);
    148.         var y = Graphics.pageToCanvasY(event.pageY);
    149.         fixXYline = [x, y]; // for draw line follow
    150.         // check grabPicture  + //data txt setup
    151.         dataXY = {}; docuTxtData = []; dataXY.oX = x, dataXY.oY = y;
    152.         var origin = [];
    153.         if (!isOlding) {
    154.             dataGlobalID =0;
    155.             grabList = this._iniGrabPicture(x, y, grabList);
    156.             var grabListFix = grabList.valueOf();
    157.             txtAboutHolding = grabListFix.length && '░ID:'+dataGlobalID+' ' + grabListFix[0]._name + '░' || '';
    158.             if(grabListFix[0]._parentSpinePID){ // si a un parent (spine)
    159.                 var idSpine = grabListFix[0]._parentSpinePID;
    160.                 origin = grabListFix.length && $gameScreen._pictures[idSpine]._x, $gameScreen._pictures[idSpine]._y;
    161.             }else{
    162.                 origin = grabListFix.length && [grabListFix[0]._x, grabListFix[0]._y];
    163.             }
    164.          
    165.             // if click picture fix the pointer,
    166.             fixXYline = origin || fixXYline;
    167.             originClick = ' ░Origin:► '+'oX:' + fixXYline[0] + ' oY: ' + fixXYline[1] + ' ░'
    168.             docuTxtData.push(txtAboutHolding, originClick);
    169.             document.title = docuTxtData;
    170.             //pixi setup
    171.             var square = new PIXI.Graphics();
    172.             square.beginFill('0x' + sqColor[0]); square.lineStyle(sqSize[2], '0x' + sqColor[1]);
    173.             sqSize.length < 4 && square.drawRect(fixXYline[0], fixXYline[1], sqSize[0], sqSize[1]) || square.drawCircle(fixXYline[0], fixXYline[1], sqSize[3])
    174.             pixiShapeScene.addChild(square);
    175.             pixiLine = new PIXI.Graphics();
    176.             pixiLine.lineStyle(lineSize, 0xffffff).moveTo(fixXYline[0], fixXYline[1]).lineTo(fixXYline[0], fixXYline[1]);
    177.             pixiShapeScene.addChild(pixiLine);
    178.             isOlding = true;
    179.         };
    180.     };
    181.     $._onMouseMove = function(event) {
    182.         if(event.which!==mouseButton){return false;}
    183.         SCM = SceneManager._scene;
    184.         if (!isOlding || SCM.constructor.name !== 'Scene_Map' || !SCM._active) {return false};
    185.         var x = Graphics.pageToCanvasX(event.pageX);
    186.         var y = Graphics.pageToCanvasY(event.pageY);
    187.         if (isOlding) {
    188.             lsdMode || pixiLine.clear();
    189.             var color = lsdMode && '0x' + Math.floor(Math.random() * 16777215).toString(16) || 0xffffff;
    190.             pixiLine.lineStyle(lineSize, color).moveTo(fixXYline[0], fixXYline[1]).lineTo(x, y);
    191.             if (grabList) {this._UpdatePinGrabPicture(grabList, x, y)};}
    192.             else {isOlding = true};
    193.         document.title = docuTxtData + ' x»' + x + ' y»' + y;
    194.     };
    195.     $._onMouseUp = function(event) {
    196.         if(event.which!==mouseButton){return false;}
    197.         SCM = SceneManager._scene;
    198.         if (!SCM._active || SCM.constructor.name !== 'Scene_Map') {return false;};
    199.         pixiShapeScene = pixiShapeScene || SceneManager._scene._pixishapeDebug;
    200.         var x = Graphics.pageToCanvasX(event.pageX);
    201.         var y = Graphics.pageToCanvasY(event.pageY);
    202.         endFixdata = [x,y];
    203.         var square = new PIXI.Graphics();
    204.         square.beginFill('0x' + sqColor[0]); square.lineStyle(sqSize[2], '0x' + sqColor[1]);
    205.         sqSize.length < 4 && square.drawRect(x, y, sqSize[0], sqSize[1]) || square.drawCircle(x, y, sqSize[3])
    206.         pixiShapeScene.addChild(square);
    207.         var endDataXy = ' ░End:► '+'eX:' + endFixdata[0] + ' eY: ' + endFixdata[1] + ' ░'
    208.         distanceData = [endFixdata[0]-fixXYline[0],endFixdata[1]-fixXYline[1]];
    209.         var enddataResult = ' ((( X℅ '+distanceData[0]+' Y℅ '+distanceData[1]+' )))';
    210.         docuTxtData.push(endDataXy,enddataResult);
    211.         document.title = docuTxtData;
    212.         consoleDebugColoration();
    213.         // console Log coloration
    214.         isOlding = false;
    215.     };
    216.     // besoin de spliter chaque sprite dans des petit container
    217.     $._UpdatePinGrabPicture = function(grabList, X, Y) {
    218.          if(grabList[0]._parentSpinePID){ // si a un parent (spine)
    219.                 var idSpine = grabList[0]._parentSpinePID;
    220.                 X = X-$gameScreen._pictures[idSpine]._x;
    221.                 Y = Y-$gameScreen._pictures[idSpine]._y;
    222.          }
    223.         for (var i = grabList.length; i--;) { grabList[i]._x = grabList[i] && X, grabList[i]._y = grabList[i] && Y };
    224.     };
    225.     $._iniGrabPicture = function(x, y, grabList) { //spritePicture.isCursorOnPicture()  getBounds();
    226.         if (!pinMode || pinMode === 'none') {return false; }
    227.         var picTriged = SceneManager._scene._spriteset._pictureContainer.children.filter(function(pic) { return (pic.getBounds().contains(x, y)) });
    228.         grabList = [];
    229.         for (var i = picTriged.length; i--;) {
    230.             var id = picTriged[i]._pictureId; dataGlobalID = id;
    231.             var picScreen = $gameScreen._pictures[id];
    232.             var asOwnChild = picTriged[i].children.length;
    233.             var isPixiTextChild = asOwnChild && picTriged[i].children[asOwnChild - 1];
    234.             var ispixitxt = isPixiTextChild && isPixiTextChild.constructor.name === 'Text' || false;
    235.             var w = ispixitxt && isPixiTextChild.width || picTriged[i].width;
    236.             var h = ispixitxt && isPixiTextChild.height || picTriged[i].height;
    237.             dataGlobalName = picScreen._name;
    238.             var origin = picScreen._origin;
    239.             if (Array.isArray(origin)) { var ox = (w * origin[0]), oy = (h * origin[1]); }
    240.             else { var ox = (w * origin) / 2, oy = (h * origin) / 2; };
    241.             picScreen._pictureId = picTriged[i]._pictureId;
    242.             grabList.push(picScreen);
    243.             if (ispixitxt || !asOwnChild) {
    244.                 var square2 = new PIXI.Graphics();
    245.                 square2.alpha = 0.35;
    246.                 var color = '0x' + Math.floor(Math.random() * 16777215).toString(16) || 0xffffff;
    247.                 square2.beginFill(color);
    248.                 square2.drawRect(0 - ox, 0 - oy, w, h);
    249.                 picTriged[i].addChild(square2);
    250.                 var square3 = new PIXI.Graphics();
    251.                 square3.alpha = 1;
    252.                 square3.fillAlpha = 0
    253.                 square3.lineStyle(4, 0x000000);
    254.                 square3.drawRect(0 - ox, 0 - oy, w, h);
    255.                 picTriged[i].addChild(square3);
    256.             };
    257.             break; // if not lot pictures // TODO:
    258.         };
    259.         return grabList;
    260.     };
    261.     $._onWheel = function(event) { // TODO:
    262.         console.log('event: ', event);
    263.         var whellY = event.wheelDeltaY;
    264.         if(dataGlobalID){
    265.             var picWhell = $gameScreen._pictures[dataGlobalID];
    266.             picWhell._angle+=(whellY>0)&&whellRotation||-whellRotation;
    267.         }else{
    268.             var xZ = Graphics.pageToCanvasX(event.pageX);
    269.             var yZ = Graphics.pageToCanvasY(event.pageY);
    270.             console.log('>>>ZoomTo<<<', xZ,yZ);
    271.             $gameScreen._zoomX =xZ;$gameScreen._zoomY =yZ;
    272.             $gameScreen._zoomScale+=(whellY>0)&&(whellRotation/100)||-(whellRotation/100);
    273.         }
    274.     }
    275.     // ┌□-□────────────-FUNCTION-───────────────┐
    276.     // □ consoleDebugColoration
    277.     // └────────────────□□□□□□□□□───────────────┘
    278.     var consoleDebugColoration = function(){
    279.       console.log('%c RESULT FROM:'+dataGlobalName,consCss1[3],' PID:'+dataGlobalID);
    280.       console.log('%cOriginXY:',consCss1[0],String(fixXYline));
    281.       console.log('%cEndPointXY:',consCss1[1],String(endFixdata));
    282.       console.log('%cResultDistance:',consCss1[2],String(distanceData));
    283.       if(clipboardNeed==='origin'){//'origin' 'end' 'dist' or 'full'
    284.         require('nw.gui').Clipboard.get().set(String(fixXYline)); // this will send to clipboard
    285.       }else if(clipboardNeed==='end'){
    286.         require('nw.gui').Clipboard.get().set(String(endFixdata)); // this will send to clipboard
    287.       }else if(clipboardNeed==='dist'){
    288.         require('nw.gui').Clipboard.get().set(String(distanceData)); // this will send to clipboard
    289.       }else if(clipboardNeed==='full'){
    290.         require('nw.gui').Clipboard.get().set(String(['o:'+fixXYline,' e:'+endFixdata,' d:'+distanceData]));
    291.       };
    292.     };
    293. // ┌□-Scene_Map-□────────────-PROTOTYPE-─────────────────┐
    294. // □ newPixiPictureDebug □ BuildGridMapping □ updateMain
    295. // └──────────────────────────□□□□□□□□□──────────────────┘
    296. _Pixidebug_createDisplayObjects = Scene_Map.prototype.createDisplayObjects;
    297. Scene_Map.prototype.createDisplayObjects = function() {
    298.     _Pixidebug_createDisplayObjects.call(this);
    299.     this.newPixiPictureDebug();
    300.     if(showGridDebug){this.BuildGridMapping();}
    301. };
    302. Scene_Map.prototype.newPixiPictureDebug = function() {
    303.     this._PixiPictureDebug = new Sprite();
    304.     this._spriteset.addChild(this._PixiPictureDebug);
    305.     this._pixishapeDebug = new Sprite();
    306.     this._spriteset.addChild(this._pixishapeDebug);
    307.     this._pixiGridMapping = new Sprite();
    308.     this._spriteset.addChild(this._pixiGridMapping);
    309. };
    310. if(showGridDebug){
    311.     Scene_Map.prototype.BuildGridMapping = function() {
    312.         var PixiGrid = this._pixiGridMapping, x = 0, y = 0;
    313.         this.gridW = $gameMap.tileWidth()*$gameMap.width();
    314.         this.gridH = $gameMap.tileHeight()*$gameMap.height();
    315.         var length = $gameMap.height();
    316.         var w = this.gridW,h = $gameMap.tileHeight();
    317.         for(var i = 0;i<length;i++){
    318.             var inGrid = new PIXI.Graphics();
    319.             inGrid.alpha = gridSetup[2]; inGrid.fillAlpha = 0;
    320.             inGrid.lineStyle(gridSetup[1], '0x'+gridSetup[0]);
    321.             inGrid.drawRect(x, y+(i*h), w, h);
    322.             PixiGrid.addChild(inGrid);
    323.         };
    324.         var length = $gameMap.width();
    325.         var w = $gameMap.tileWidth(),h = this.gridH;
    326.         for(var i = 0;i<length;i++){
    327.             var inGrid = new PIXI.Graphics();
    328.             inGrid.alpha = gridSetup[2]; inGrid.fillAlpha = 0;
    329.             inGrid.lineStyle(gridSetup[1], '0x'+gridSetup[0]);
    330.             inGrid.drawRect(x+(i*w), y, w, h);
    331.             PixiGrid.addChild(inGrid);
    332.         };
    333.     };
    334. };
    335. if(showGridDebug){
    336.     alias_PixiJonDebuger_Scene_Map_updateMain = Scene_Map.prototype.updateMain;
    337.     Scene_Map.prototype.updateMain = function() {
    338.         alias_PixiJonDebuger_Scene_Map_updateMain.call(this);
    339.             this._pixiGridMapping.x=-($gameMap._displayX*$gameMap.tileWidth());
    340.             this._pixiGridMapping.y=-($gameMap._displayY*$gameMap.tileHeight());
    341.     };
    342. };
    343. // ┌□-document-□────────────-LISTERNER-─────────────────┐
    344. // □ mousedown □ mouseup □ mousemove □ wheel
    345. // └─────────────────────────□□□□□□□□□──────────────────┘
    346.     document.addEventListener('mousedown', $._onMouseDown.bind($));
    347.     document.addEventListener('mouseup', $._onMouseUp.bind($));
    348.     document.addEventListener('mousemove', $._onMouseMove.bind($));
    349.     document.addEventListener('wheel', $._onWheel.bind($));
    350. })(jonLPictureDebuger);
    复制代码



    本贴来自国际rpgmaker官方论坛作者:Jonforum处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:https://forums.rpgmakerweb.com/threads/o-master-pictures-debug-tool-o-2017-07-12-v-0-9-3.80705/

    本帖子中包含更多资源

    您需要 登录 才可以下载或查看,没有账号?立即注册

    x
    天天去同能,天天有童年!
    回复 送礼论坛版权

    使用道具 举报

    文明发言,和谐互动
    文明发言,和谐互动
    高级模式
    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    简体中文
    繁體中文
    English(英语)
    日本語(日语)
    Deutsch(德语)
    Русский язык(俄语)
    بالعربية(阿拉伯语)
    Türkçe(土耳其语)
    Português(葡萄牙语)
    ภาษาไทย(泰国语)
    한어(朝鲜语/韩语)
    Français(法语)
    关闭

    幸运抽奖

    社区每日抽奖来袭,快来试试你是欧皇还是非酋~

    立即查看

    聊天机器人
    Loading...

    QQ|Archiver|手机版|小黑屋|同能RPG制作大师 ( 沪ICP备12027754号-3 )

    GMT+8, 2026-8-22 07:53 , Processed in 0.109932 second(s), 57 queries .

    Powered by Discuz! X3.4

    Copyright © 2001-2020, Tencent Cloud.

    快速回复 返回顶部 返回列表