This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# http://learningblender3dsoftware.blogspot.in/2012/12/learning-about-operators-2-screen.html | |
import bpy | |
def main(context): | |
screen = context.screen | |
for area in screen.areas: | |
if area.type == 'VIEW_3D': | |
active_space = area.spaces[0] | |
attrs = ['show_floor', 'show_axis_x', 'show_axis_y', 'show_axis_z'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# http://www.blender.org/documentation/blender_python_api_2_65_3/bpy.types.Area.html | |
# http://www.blender.org/documentation/blender_python_api_2_65_3/bpy.types.Space.html | |
import bpy | |
template_Area = "Area: {0}\n" | |
template_Space = "\tSpace: {0} {1}\n" | |
for area in bpy.context.screen.areas: | |
print(template_Area.format(area.type)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Name of the project | |
# The binary file will use the name of the project! | |
PROJECT := $(shell basename $(shell pwd)) | |
# Header files | |
HEADERS = -I../../util/ | |
# C++ source files | |
SOURCES := $(shell find ./ -name "*.cpp") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <vector> | |
#include <algorithm> | |
using namespace std; | |
//---------------------------------------------------------------------------- | |
using VectorOfIntPointers = vector<const int *>; | |
void printPointersToElements(const VectorOfIntPointers& pointers) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Source this script in tcsh to setup shell completions | |
# for git. Completions are activated by typing or Control-D | |
# in the shell after entering a partial command. | |
# | |
# Usage: | |
# source git-completion.tcsh (e.g. in ~/.cshrc) | |
# | |
# Supported completions: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Create a bezier curve object | |
>>> bpy.ops.curve.primitive_bezier_curve_add() | |
{'FINISHED'} | |
# Get a reference to the curve object | |
>>> curve_object = bpy.context.active_object | |
# Print out its data path |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import bge | |
controller = bge.logic.getCurrentController() | |
sensor = controller.sensors['up_WKEY'] | |
if sensor.getKeyStatus(bge.events.WKEY) == bge.logic.KX_INPUT_JUST_ACTIVATED: | |
owner = controller.owner | |
actuator = controller.actuators['upkeycount'] | |
actuator.value = str(owner.get(actuator.propName) + 1) | |
controller.activate(actuator) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import bge | |
controller = bge.logic.getCurrentController() | |
owner = controller.owner | |
print(type(owner)) | |
print(owner.getPropertyNames()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import bpy | |
from mathutils.geometry import interpolate_bezier | |
def get_points(spline, clean=True): | |
knots = spline.bezier_points | |
if len(knots) < 2: | |
return |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import socket | |
if __name__ == "__main__": | |
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) | |
sock.connect(("localhost", 9000)) | |
data = "some data" | |
sock.sendall(data) | |
result = sock.recv(1024) | |
print result | |
sock.close() |
OlderNewer