Skip to content

Commit

Permalink
🎉 First code commit
Browse files Browse the repository at this point in the history
Added the main chunk of the plugin along with the docs and other tidbits
  • Loading branch information
LexFrench authored Sep 23, 2018
1 parent a90517f commit c01db87
Show file tree
Hide file tree
Showing 10 changed files with 742 additions and 1 deletion.
1 change: 1 addition & 0 deletions .bandit
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
skips: ['B312', 'B401']
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -102,3 +102,7 @@ venv.bak/

# mypy
.mypy_cache/

doc/tags

tags
32 changes: 32 additions & 0 deletions .pylintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
[MESSAGES CONTROL]

# Enable the message, report, category or checker with the given id(s). You can
# either give multiple identifier separated by comma (,) or put this option
# multiple time.
#enable=

# Disable the message, report, category or checker with the given id(s). You
# can either give multiple identifier separated by comma (,) or put this option
# multiple time (only on the command line, not in the configuration file where
# it should appear only once).

# Brain-dead errors regarding standard language features
# W0142 = *args and **kwargs support
# W0403 = Relative imports

# Pointless whinging
# R0201 = Method could be a function
# W0232 = Class has no __init__ method
# R0903 = Too few public methods
# R0913 = Too many arguments
# R0914 = Too many local variables

# PyLint's module importation is unreliable
# F0401 = Unable to import module
# W0402 = Uses of a deprecated module

# Already an error when wildcard imports are used
# W0614 = Unused import from wildcard

# Disable the message(s) with the given id(s).
disable=W0142,W0403,R0201,W0232,R0903,W0614,R0913,F0401,W0402,R0914,I0011
120 changes: 119 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,120 @@
# vim-JakeSender
Vim plugin for sending the contents of the current vim buffer to Maya or Motionbuilder

JakeSender is a basic vim plugin for sending python code from the current vim
buffer (or visual selection) to Autodesk's Maya or Autodesk's Motionbuilder

Jake is a good boy (sic) that will hide your commands, like a bone, in a
special safe place ($TEMPDIR) and then like Lassie, go tell Maya or
Motionbuilder where to find the file and to execute the content.

## Installation

### Via Plugin Manager (USE ONE!)

#### [Vim-Plug](https://github.com/junegunn/vim-plug)

1. Add `Plug 'lexfrench/vim-jakesender'` to your vimerc file
2. Reload your vimrc or restart vim
3. `:PlugInstall`

#### [Vundle](https://github.com/VundleVim/Vundle.vim) or similar

1. Add `Plugin 'lexfrench/vim-jakesender'` to your vimrc file
2. Reload your vimrc or restart
3. Run `:BundleInstall`

#### [NeoBundle](https://github.com/Shougo/neobundle.vim)

1. Add `NeoBundle 'lexfrench/vim-jakesender'` to your vimrc file
2. Reload your vimrc or restart
3. Run `:NeoUpdate`

#### [Pathogen](https://github.com/tpope/vim-pathogen)

```sh
cd ~/.vim/bundle
git clone https://github.com/lexfrench/vim-jakesender.git
```
### Manual Installation

#### Unix

(For Neovim, change `~/.vim/` to `~/.config/nvim/`.)

```sh
curl -fLo ~/.vim/plugin/jakeSender.vim --create-dirs \
https://raw.githubusercontent.com/lexfrench/vim-jakesender/master/plugin/jakeSender.vim
curl -fLo ~/.vim/doc/jakeSender.txt --create-dirs \
https://raw.githubusercontent.com/lexfrench/vim-jakesender/master/doc/jakeSender.txt
```

### Maya Configuration

In order to send commands to Maya, you'll need to enable the command port on startup. This can be done by adding the following to your `userSetup.py` file in your Maya scripts folder.

1. Create a `userSetup.py` file if you don't already have one

```
touch ~/maya/scripts/userSetup.py
```

2. Add the following
```python
import maya.cmds as cmds

cmds.commandPort(name=":8722", sourceType="mel", noreturn=False, echoOutput=False, bufferSize=4096)
```

### Motionbuilder Configuration

In order to send commands to Motionbuilder, you'll need to enable the python server in the Motionbuilder Preferences. [Check here.](http://bit.ly/MobuPythonPrefs)

## Usage

### Documentation

Please see the vim help system for full documentation of all options: `:help jakeSender`

### Commands

The following commands are available to send the buffer content to supported hosts (Maya and Motionbuilder):
* `SendBufferToMaya` : Sends the current buffer OR visual selection to Maya's command port
* `SendBufferToMobu` : Sends the current buffer OR visual selection to Motionbuilder's telnet server
* `SendLineToMaya` : Sends the current (single) line to Maya's command port
* `SendLineToMobu` : Sends the current (single) line to Motionbuilder's telnet server


### Basic Settings

```vim
" Host's address to send commands (This should be localhost or 127.0.0.1 in 99.99999% of the cases)
let g:jakeSenderHost="localhost"
" The port to send Maya commands to
let g:jakeSenderMayaPort=8722
" The telnet port for Motionbuilder's python server
let g:jakeSenderMobuPort=4242
```

### Default mappings

The following key mappings are provided by default:
* `<leader>m` **[SendBufferToMaya]**
* `<leader>x` **[SendBufferToMobu]**
* `<leader>lm` **[SendLineToMaya]**
* `<leader>lx` **[SendLineToMobu]**

## FAQ
**Q** Why did you write this plugin? Aren't there other plugins for sending commands to Maya? \
**A** Hi Carl, you don't mind if I call you Carl do you? So Carl, you're absolutely right, there are other plugins that send commands to Maya's command port. If you don't like mine, you should check out [Vimya](https://www.vim.org/scripts/script.php?script_id=2626). However, for the cases I found myself in, Vimya just didn't cut it. Specifically, I wanted to send commands to both Maya and Motionbuilder, since I use both at work quite frequently. Also, I've never written a vim plugin and this seemed like a good way to spend my Saturday. So to answer your question Carl, the main reason I created this package is because I GODDAMN WANTED TO! Sheesh Carl, you're so ungrateful!

**Q** Why do you call it JakeSender? \
**A** I'm glad you asked Carl! You see, at my office (where I'm going to be using this) we have an awesome office dog name Jake! And much like this tool, Jake makes my life a little better at work. But Carl, wouldn't you know it, there already is a vim-jake plugin on github. So I decided to go with JakeSender, since the script sends stuff... Get it Carl?

**Q** Can you port this plugin to Atom, Visual Studio Code, etc.? \
**A** Carl, do you see me using Atom, Visual Studio Code or other inferior editors at work? Why would I waste my time writing plugins for those editors when I'm perfectly happy in vim/neovim land?

**Q** Why do you keep calling me Carl? \
**A** Stop asking dumb questions Carl.

180 changes: 180 additions & 0 deletions doc/jakeSender.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,180 @@
*jakeSender.txt* Plugin for sending python to Maya and Motionbuilder

JakeSender REFERENCE MANUAL~

==============================================================================
CONTENTS *jakeSenderContents*

1.Intro........................|JakeSender|
2.Requirements.................|JakeSenderRequirements|
3.Installation.................|JakeSenderInstallation|
4.Configuring Maya.............|JakeSenderConfigMaya|
5.Configuring Motionbuilder....|JakeSenderConfigMobu|
6.Configuration Options........|JakeSenderConfigOptions|
7.Commands.....................|JakeSenderCommands|
8.Key Mappings.................|JakeSenderKeys|
9.Changelog....................|JakeSenderChangeLog|
10.License......................|JakeSenderLicense|

==============================================================================
1. Intro *JakeSender*

JakeSender is a basic vim plugin for sending python code from the current vim
buffer (or visual selection) to Autodesk's Maya or Autodesk's Motionbuilder

Jake is a good boy (sic) that will hide your commands, like a bone, in a
special safe place ($TEMPDIR) and then like Lassie, go tell Maya or
Motionbuilder where to find the file and to execute the content.

==============================================================================
2. Requirements *JakeSenderRequirements*

vim or neovim must have python support enabled. To check:
>
:echo has ('python')
<

==============================================================================
3. Installation *JakeSenderInstallation*

1. Extract the plugin file in your ~/.vim (*nix).
2. Next, to finish installing the help file run:
>
:helptags ~/.vim/doc
<
See |add-local-help| for more details.

==============================================================================
4. Configuring Maya *JakeSenderConfigMaya*

In order to send commands to Maya, you'll need to enable the command port on
startup. This can be done by adding the following to your `userSetup.py`
file in your Maya scripts folder.

1.Create a `userSetup.py` file if you don't already have one

>
touch ~/maya/scripts/userSetup.py
<

2. Add the following
>
import maya.cmds as cmds

cmds.commandPort(name=":8722",
sourceType="mel",
noreturn=False,
echoOutput=False,
bufferSize=4096)
<

==============================================================================
5. Configuring Motionbuilder *JakeSenderConfigMobu*

In order to send commands to Motionbuilder, you'll need to enable the python
server in the Motionbuilder Preferences.
http://bit.ly/MobuPythonPrefs

==============================================================================
6. Configuration Options *JakeSenderConfigOptions*

|'jakeSenderHost'| Host's address to send commands

|'jakeSenderMayaPort'| Maya's commandPort port..

|'jakeSenderMobuPort'| Motionbuilder's python telnet
server port

------------------------------------------------------------------------------
*'jakeSenderHost'*

Values: arbitrary string.
Default: "localhost"

This is the server address of the command port or telnet server that you want
to send python commands to. In 99.99999% you will want this to be set to
localhost or 127.0.0.1 for your local computer.

------------------------------------------------------------------------------
*'jakeSenderMayaPort'*

Values: interger value between 0-65535
Default: 8722

This is the port that Maya's commandPort server is listening on.

See |JakeSenderConfigMaya| on how to change this port to something else.

------------------------------------------------------------------------------
*'jakeSenderMobuPort'*

Values: interger value between 0-65535
Default: 4242

This is the port that Motionbuilder's telnet server is listening on.

==============================================================================
7. Commands *JakeSenderCommands*

The following commands are available to send the buffer content to supported
hosts (Maya and Motionbuilder)

:SendBufferToMaya |:SendBufferToMaya|
:SendBufferToMobu |:SendBufferToMobu|
:SendLineToMaya |:SendLineToMaya|
:SendLineToMobu |:SendLineToMobu|

*:SendBufferToMaya*

Sends the current buffer OR visual selection to Maya's command port

*:SendBufferToMobu*
Sends the current buffer OR visual selection to Motionbuilder's telnet server

*:SendLineToMaya*
Sends the current (single) line to Maya's command port

*:SendLineToMobu*
Sends the current (single) line to Motionbuilder's telnet server

==============================================================================
8. Key Mappings *JakeSenderKeys*

The following key mappings are provided by default:
>
nnoremap <leader>m :SendBufferToMaya<cr>
vnoremap <leader>m :<C-U>SendBufferToMaya<cr>

nnoremap <leader>x :SendBufferToMobu<cr>
vnoremap <leader>x :<C-U>SendBufferToMobu<cr>

nnoremap <leader>lm :SendLineToMaya<cr>
vnoremap <leader>lm :<C-U>SendLineToMaya<cr>

nnoremap <leader>lx :SendLineToMobu<cr>
vnoremap <leader>lx :<C-U>SendLineToMobu<cr>
<

==============================================================================
9. Change Log *JakeSenderChangeLog*

0.0.1
- First version that is opened to the public (Please GOD WORK)

==============================================================================
10. License *JakeSenderLicense*

Copyright (C) 2018 Alexander French

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>
Loading

0 comments on commit c01db87

Please sign in to comment.