First Maya script introduction

Introduction

Now that we've created a handy script for Maya, make a note of the steps to get started.

procedure

Prepare a test script

Prepare the following sample file.

helloWorld.py


# -*- coding: utf-8 -*-
def main()
  print u'hello hello'

Script storage

You can call it on Maya by placing the script in the directory below.

Maya 2015 Mac -/ Users / / Library / Preferences / Autodesk / maya / 2015-x64 / ja_JP / scripts -/ Users / / Library / Preferences / Autodesk / maya / scripts -/ Users / / Library / Preferences / Autodesk / maya / 2015-x64 / ja_JP / prefs / scripts

Maya 2016 Mac -/ Users / / Library / Preferences / Autodesk / maya / 2016 / ja_JP / scripts -/ Users / / Library / Preferences / Autodesk / maya / scripts -/ Users / / Library / Preferences / Autodesk / maya / 2016 / ja_JP / prefs / scripts

Maya 2017 Mac -/ Users / / Library / Preferences / Autodesk / maya / 2017 / ja_JP / scripts -/ Users / / Library / Preferences / Autodesk / maya / scripts -/ Users / / Library / Preferences / Autodesk / maya / 2017 / ja_JP / prefs / scripts

Try to run

  1. Press the icon at the bottom right of the screen to start the "script editor".

  2. Enter the command in the area under the displayed "Script Editor" and press "Ctrl + Enter" to execute the process.

    import helloWorld
    helloWorld.main()
    
  3. The result of the command is output in the upper area.

スクリーンショット 2016-11-30 11.05.36.png

Create shortcut

After selecting the code to put on the shelf, hold down the middle mouse button and drag and drop it toward ② to create a shortcut. After that, all you have to do is press the shortcut on the shelf.

スクリーンショット 2016-11-30 11.38.01.png

Recommended Posts

First Maya script introduction
[Introduction to pytorch-lightning] First Lit ♬
Introduction
First TensorFlow-Linear Regression as an Introduction
How to run a Maya Python script