Code Monkey home page Code Monkey logo

blender_command_port's Introduction

Blender Command Port

Command Port addon for Blender.

How to use

Installing

Open User Preferences and click Install from File under Add-ons. Then navigate to the downloaded zip archive of this plugin and select it.

Starting the port

Command port can be configured and started from a Blender Command Port section of "Data" panel. Command port configuration

Basic usage

Command should be sent to command port as a text. It can be also done sent from Python:

import socket


def send_command(command):
    clientsocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    clientsocket.connect(('localhost', 5000))
    clientsocket.sendall(command.encode())
    while True:
        res = clientsocket.recv(4096)
        if not res:
            break
        print(res.decode())
    clientsocket.close()

send_command("""
j = 0
for i in range(10):
    print(j)
    j+=i*2
j
""")

Visual Studio Code Integration

The following json code can be pasted into a task.json file to add an 'Execute Script in Blender' task to VS Code.

{
	// See https://go.microsoft.com/fwlink/?LinkId=733558
	// for the documentation about the tasks.json format
	"version": "2.0.0",
	"tasks": [
		{
			"label": "Execute Script in Blender",
			"type": "shell",
			"command": "python",
			"args": [
				"${env:APPDATA}/Blender Foundation/Blender/2.82/scripts/addons/blender_command_port/execute_file_in_blender.py",
				"${file}",
				"5000"
			],
			"presentation": {
				"reveal": "always",
				"panel": "new"
			},
			"problemMatcher": []
		}
	]
}

PyCharm Integration

Another way is to use execute_file_in_blender.py script to create a run configuration in PyCharm that executes a file in Blender. Path to a file must be passed as a first script parameter, port need to be passed as a second one. PyCharm configuration

Authors

License

This project is licensed under the MIT License

blender_command_port's People

Contributors

p4vv37 avatar olivermead avatar jeffhanna avatar radivarig avatar davekennedy1 avatar hwpplayer1 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.