Skip to content

Commit

Permalink
add sample files.
Browse files Browse the repository at this point in the history
  • Loading branch information
yoshikinoko committed Dec 11, 2018
1 parent 3ff8604 commit cf89472
Show file tree
Hide file tree
Showing 28 changed files with 12,400 additions and 0 deletions.
Binary file added 01-01-scenegraph-sample/images/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 19 additions & 0 deletions 01-01-scenegraph-sample/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
const { Rectangle, Color } = require('scenegraph');

function main(selection, documentRoot) {
// Go to Plugins > Development > Developer Console to see this log output
console.log('No dialog is running!');

// Insert a red square at (0, 0) in the current artboard or group/container
const shape = new Rectangle();
shape.width = 100;
shape.height = 100;
shape.fill = new Color('#f00');
selection.insertionParent.addChild(shape);
}

module.exports = {
commands: {
menuCommand: main,
},
};
28 changes: 28 additions & 0 deletions 01-01-scenegraph-sample/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"name": "Red square",
"id": "abcd0123",
"version": "1.0.0",
"description": "Insert a square",
"icons": [
{
"width": 96,
"height": 96,
"path": "images/icon.png"
}
],
"host": {
"app": "XD",
"minVersion": "13.0.0"
},
"uiEntryPoints": [
{
"type": "menu",
"label": {
"default": "Insert a square",
"en": "Insert a square",
"ja": "正方形を挿入する"
},
"commandId": "menuCommand"
}
]
}
4 changes: 4 additions & 0 deletions 01-02-scenegraph-sample-webpack/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
build/
.git/
node_modules/
doc/
20 changes: 20 additions & 0 deletions 01-02-scenegraph-sample-webpack/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"extends": [
"airbnb"
],
"plugins": [],
"parserOptions": {},
"env": {
"browser": true
},
"globals": {
"scenegraph": true
},
"rules": {
"indent": ["error", 4],
"no-unused-vars": "warn",
"no-console": "off",
"import/no-unresolved": ["warn", { "ignore": ["uxp", "secenegraph", "commands", "clipboard"] }],
"no-param-reassign": ["error", { "props": true, "ignorePropertyModificationsFor": ["selection"] }]
}
}
3 changes: 3 additions & 0 deletions 01-02-scenegraph-sample-webpack/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules
build
build.xdx
28 changes: 28 additions & 0 deletions 01-02-scenegraph-sample-webpack/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Red square

## Setup

```bash
npm install
```

## Live-loading plugin for `Develop` folder

Deploy the plugin and monitor updates of files.

```bash
npm start
```

## Deploy plugin to the `Develop` Folder

```bash
npm deploy
```

## Usage

#### 1. Reload plugins:
`Plugins` > `Development` > `Reload Plugins` or press `shift + command(ctrl) + R` keys.
#### 2. Run the plugin:
`Plugins` > `Insert a square`
Loading

0 comments on commit cf89472

Please sign in to comment.