Git Product home page Git Product logo

screenspace's Introduction

screenspace

Screenspace is a Maya plugin that allows pickable shapes to be added to transforms and display as if they're attached to the viewport.

alt text

Pickables can be styled and offset to your taste. Options include color, position, size, vertical and horizontal alignment, and many more.

alt text

Build your own custom interfaces and attach to any rig! (Azri rig courtesy of: https://www.gameanim.com/)

alt text

Building

You'll need CMake, git, and Maya to build from source. Run the following commands in a shell.

# Clone the repo
git clone [email protected]:eddiehoyle/screenspace.git

# Build
cd screenspace
mkdir build
cd build
cmake ..
make

Note: You might want to change the target Maya version. That's in screenspace/CMakeLists.txt, change the line set(MAYA_VERSION <Your Target Version>

Once built, check the plugin directory for a bunch of directories and files.

# Add to XBMLANGPATH directory
plugin/icons/out_pickable.png

# Add to MAYA_SCRIPT_PATH directory
plugin/scripts/AEpickableTemplate.mel

# Add to MAYA_PLUG_IN_PATH directory
plugin/screenspace.bundle # OSX
                  .so     # Linux
                  .dll    # Windows

See Maya's plugin installation guide for more information about these paths.

Loading

In Maya, go to Windows > Settings/Preferences and open the Plug-in Manager. Look for the screenspace plugin. Load it and you're all set!

How to use

Screenspace comes with an addPickable command that makes attaching to existing transforms easy.

from maya import cmds
cmds.addPickable(parent="transform1", camera="perspShape")

The above example features the minimum required arguments to run this command. You'll need a parent to attach the pickable to and a camera whose viewports to display the pickable on. Fill in these details to fit your needs.

Here's an example Python script to attach a pickable to a selected transform and the perspective camera.

from maya import cmds
selected = cmds.ls(selected=True, type="transform")
if len(selected) != 1:
    raise ValueError("Please select one transform.")
cmds.addPickable(parent=selected[0], camera="perspShape")

Advanced

The addPickable command also supports a bunch of extra options.

cmds.addPickable(parent="transform1",     # Attach pickable to this transform 
                 camera="perspShape",     # Display pickable on this camera's viewports
                 rotate=30.0,             # Rotation in degrees
                 offset=(50.0, 20.0),     # Offset shape position
                 size=20.0,               # Size multiplier
                 width=2.0,               # Width of shape
                 height=2.0,              # Height of shape
                 color=(1.0, 0.0, 0.5),   # Color RGB values (normalised)
                 opacity=0.5,             # Opacity (normalised)
                 position="relative",     # "relative" or "absolute" position
                 verticalAlign="middle",  # "bottom", "middle", or "top" alignment
                 horizontalAlign="left",  # "left", "middle", or "right" alignment
                 depth=0,                 # Ordering. Lower number means higher priority
                 )

Removing

Screenspace also comes with a removePickables command. This command attempts to remove any pickables found under current selection, or from a specified transform.

# Remove all pickables from selection
cmds.removePickables(selected=True)

# Remove pickables from 'transform1' node
cmds.removePickables(parent="transform1")

screenspace's People

Contributors

eddiehoyle avatar muream avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.