Skip to content

Commit

Permalink
Merge branch 'release/0.7.6'
Browse files Browse the repository at this point in the history
  • Loading branch information
mkeeter committed Feb 23, 2015
2 parents 7c9068e + a002f49 commit aa9ccbb
Show file tree
Hide file tree
Showing 153 changed files with 2,032 additions and 2,980 deletions.
30 changes: 30 additions & 0 deletions doc/release-notes/0.7.6.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
Antimony 0.7.6
--------------

This is a major release in terms of architecture:
All nodes are now defined as scripts, and scripts now have the power to
define UI primitives (points and wireframes) that show up in 3D views.

Files saved with `0.7.5` and earlier will be automatically upgraded to
using script nodes (instead of hard-coded nodes). This backwards
compatibility will be removed in later releases.

If you have a file for which automatic upgrading fails, send it in as
a bug report for further investigation.

**Features:**
- Added `fab.ui` namespace, with hooks to create 3D view objects from scripts.
- `fab.ui.point` allows points with user-defined drag functions
- `fab.ui.wireframe` creates user-defined wireframes
- Added `fab.color` namespace with a set of standard colors.
- Ported all hard-coded nodes into scripts.
- Skip early render stages if they are sufficiently fast.
- Show error message if Save As or Export target file isn't writable.
- New inspectors are placed in the center of a canvas if possible.
- Automatically upgrade hard-coded nodes in older files to scripts.

**Bugfixes:**
- Build issue: `sb` directory is now created before subfolders are copied.
- Off-by-one line highlighting error in script panes.
- Weird namespace issue in scripts.
- Remove white border in script UI (Linux).
1 change: 1 addition & 0 deletions py/fab/ui.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from _hooks.ui import *
17 changes: 17 additions & 0 deletions py/nodes/2D/circle.node
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import fab

title('Circle')

input('x', float)
input('y', float)
input('r', float, 1)

output('shape', fab.shapes.circle(x, y, r))

# UI
fab.ui.wireframe([
(math.cos(i/36. * 2*math.pi) * r + x,
math.sin(i/36. * 2*math.pi) * r + y, 0)
for i in range(36)], close=True)
fab.ui.point(x, y, 0)
fab.ui.point(x + r, y, 0, drag=(r, None, None))
21 changes: 16 additions & 5 deletions py/nodes/2D/circles/circle_center.node
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,25 @@ import fab
title('circle center')

def circle_center(x0,y0,r):
from fab.types import Shape, Transform
# sqrt((X-x0)^2+(Y-y0)^2)-r
return Shape(
'-r+q-Xf%(x0)gq-Yf%(y0)gf%(r)g' % locals(),
x0-r,y0-r,x0+r,y0+r)
from fab.types import Shape, Transform
# sqrt((X-x0)^2+(Y-y0)^2)-r
return Shape(
'-r+q-Xf%(x0)gq-Yf%(y0)gf%(r)g' % locals(),
x0-r,y0-r,x0+r,y0+r)

input('x0',float,0)
input('y0',float,0)
input('r',float,1)
input('_a',float,0)

output('shape',circle_center(x0,y0,r))

def drag_r(this,x,y,z):
dx = x-this.x0
dy = y-this.y0
this.r = math.sqrt(dx*dx+dy*dy)
this._a = math.atan2(dy,dx)

fab.ui.point(x0,y0)
fab.ui.point(x0+r*math.cos(_a),y0+r*math.sin(_a),drag=drag_r,relative=False)

4 changes: 4 additions & 0 deletions py/nodes/2D/circles/circle_edge.node
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,7 @@ input('x1',float,1)
input('y1',float,1)

output('shape',circle_edge(x0,y0,x1,y1))

fab.ui.point(x0,y0)
fab.ui.point(x1,y1)

8 changes: 8 additions & 0 deletions py/nodes/2D/point.node
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import fab

title('Point (2D)')

input('x', float)
input('y', float)

fab.ui.point(x, y, 0)
16 changes: 16 additions & 0 deletions py/nodes/2D/rectangle.node
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import fab

title('Rectangle')

input('xmin', float)
input('ymin', float)
input('xmax', float, 1)
input('ymax', float, 1)

output('shape', fab.shapes.rectangle(xmin, xmax, ymin, ymax))

# UI
fab.ui.wireframe([(xmin, ymin, 0), (xmax, ymin, 0),
(xmax, ymax, 0), (xmin, ymax, 0)], close=True)
fab.ui.point(xmin, ymin, 0)
fab.ui.point(xmax, ymax, 0)
8 changes: 8 additions & 0 deletions py/nodes/2D/rectangles/rectangle_center.node
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,11 @@ input('width',float,2)
input('height',float,1)

output('shape',rectangle_center(x0,y0,width,height))

def drag_hw(this,x,y,z):
this.height = 2*(y-this.y0)
this.width = 2*(x-this.x0)

fab.ui.point(x0,y0)
fab.ui.point(x0+width/2.0,y0+height/2.0,drag=drag_hw,relative=False)

13 changes: 13 additions & 0 deletions py/nodes/2D/rectangles/rectangle_center_rounded.node
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,16 @@ input('r',float,.25)

output('shape',rectangle_center_rounded(x0,y0,width,height,r))

def drag_r(this,x,y,z):
dx = this.x0+this.width/2.0-x
dy = this.y0+this.height/2.0-y
this.r = math.sqrt(dx*dx+dy*dy)/math.sqrt(2)

def drag_hw(this,x,y,z):
this.height = 2*(y-this.y0)
this.width = 2*(x-this.x0)

fab.ui.point(x0,y0)
fab.ui.point(x0+width/2.0,y0+height/2.0,drag=drag_hw,relative=False)
fab.ui.point(x0+width/2.0-r,y0+height/2.0-r,drag=drag_r,relative=False)

4 changes: 4 additions & 0 deletions py/nodes/2D/rectangles/rectangle_corner.node
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,7 @@ input('x1',float,1)
input('y1',float,.5)

output('shape',rectangle_corner(x0,y0,x1,y1))

fab.ui.point(x0,y0)
fab.ui.point(x1,y1)

10 changes: 10 additions & 0 deletions py/nodes/2D/rectangles/rectangle_corner_rounded.node
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,13 @@ input('y1',float,.5)
input('r',float,.25)

output('shape',rectangle_corner_rounded(x0,y0,x1,y1,r))

def drag_r(this,x,y,z):
dx = this.x1-x
dy = this.y1-y
this.r = math.sqrt(dx*dx+dy*dy)/math.sqrt(2)

fab.ui.point(x0,y0)
fab.ui.point(x1,y1)
fab.ui.point(x1-r,y1-r,drag=drag_r,relative=False)

15 changes: 15 additions & 0 deletions py/nodes/2D/text.node
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import fab

title('Text')

input('x', float)
input('y', float)
input('text', str)
input('scale', float, 1)

output('shape', fab.shapes.text(text, x, y, scale))

# UI
fab.ui.wireframe([(x, y, 0), (x, y+scale, 0)])
fab.ui.point(x, y, 0)
fab.ui.point(x, y + scale, 0, drag=(None, scale, None))
18 changes: 18 additions & 0 deletions py/nodes/2D/triangle.node
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import fab

title('Triangle')

input('x0', float)
input('y0', float)
input('x1', float, 1)
input('y1', float, 0)
input('x2', float, 0)
input('y2', float, 1)

output('shape', fab.shapes.triangle(x0, y0, x1, y1, x2, y2))

# UI
fab.ui.wireframe([(x0, y0, 0), (x1, y1, 0), (x2, y2, 0)], close=True)
fab.ui.point(x0, y0, 0)
fab.ui.point(x1, y1, 0)
fab.ui.point(x2, y2, 0)
9 changes: 9 additions & 0 deletions py/nodes/2D/triangles/triangle_right.node
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,13 @@ input('height',float,2)

output('shape',right_triangle(x0,y0,width,height))

def drag_w(this,x,y,z):
this.width = x-this.x0

def drag_h(this,x,y,z):
this.height = y-this.y0

fab.ui.point(x0,y0)
fab.ui.point(x0+width,y0,drag=drag_w,relative=False)
fab.ui.point(x0,y0+height,drag=drag_h,relative=False)

23 changes: 23 additions & 0 deletions py/nodes/3D/cone.node
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import fab

title('Cone')

input('x', float)
input('y', float)
input('z0', float)
input('z1', float, 1)
input('r', float, 1)

output('shape', fab.shapes.cone(x, y, z0, z1, r))

# UI
fab.ui.wireframe([
(math.cos(i/36. * 2*math.pi) * r + x,
math.sin(i/36. * 2*math.pi) * r + y, z0)
for i in range(36)], close=True)
fab.ui.wireframe([(x,y,z0), (x+r,y,z0)])
fab.ui.wireframe([(x,y,z0), (x,y,z1)])

fab.ui.point(x, y, z0)
fab.ui.point(x, y, z1)
fab.ui.point(x + r, y, z0, drag=(r, None, None))
24 changes: 24 additions & 0 deletions py/nodes/3D/cube.node
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import fab

title('Cube')

input('xmin', float)
input('ymin', float)
input('zmin', float)
input('xmax', float, 1)
input('ymax', float, 1)
input('zmax', float, 1)

output('shape', fab.shapes.cube(xmin, xmax, ymin, ymax, zmin, zmax))

# UI
fab.ui.wireframe([(xmin, ymin, zmin), (xmax, ymin, zmin),
(xmax, ymax, zmin), (xmin, ymax, zmin)], close=True)
fab.ui.wireframe([(xmin, ymin, zmax), (xmax, ymin, zmax),
(xmax, ymax, zmax), (xmin, ymax, zmax)], close=True)
fab.ui.wireframe([(xmin, ymin, zmin), (xmin, ymax, zmin),
(xmin, ymax, zmax), (xmin, ymin, zmax)], close=True)
fab.ui.wireframe([(xmax, ymin, zmin), (xmax, ymax, zmin),
(xmax, ymax, zmax), (xmax, ymin, zmax)], close=True)
fab.ui.point(xmin, ymin, zmin)
fab.ui.point(xmax, ymax, zmax)
9 changes: 9 additions & 0 deletions py/nodes/3D/cubes/cube_center.node
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,12 @@ input('height',float,2)
input('depth',float,1)

output('shape',cube_center(x0,y0,z0,width,height,depth))

def drag_hwd(this,x,y,z):
this.width += 2*x
this.height += 2*y
this.depth += 2*z

fab.ui.point(x0,y0)
fab.ui.point(x0+width/2.0,y0+height/2.0,z0+depth/2.0,drag=drag_hwd)

17 changes: 17 additions & 0 deletions py/nodes/3D/cubes/cube_center_rounded.node
Original file line number Diff line number Diff line change
Expand Up @@ -77,3 +77,20 @@ input('depth',float,1)
input('r',float,.25)

output('shape',cube_center_rounded(x0,y0,z0,width,height,depth,r))

def drag_hwd(this,x,y,z):
this.width += 2*x
this.height += 2*y
this.depth += 2*z

def drag_r(this,x,y,z):
dx = this.x0+this.width/2.0-x
dy = this.y0+this.height/2.0-y
dz = this.z0+this.depth/2.0-z
this.r = math.sqrt(dx*dx+dy*dy+dz*dz)/math.sqrt(3)

fab.ui.point(x0,y0,z0)
fab.ui.point(x0+width/2.0,y0+height/2.0,z0+depth/2.0,drag=drag_hwd)
fab.ui.point(x0+width/2.0-r,y0+height/2.0-r,z0+depth/2.0-r,drag=drag_r,relative=False)


3 changes: 3 additions & 0 deletions py/nodes/3D/cubes/cube_corner.node
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,6 @@ input('z1',float,.5)

output('shape',cube_corner(x0,y0,z0,x1,y1,z1))

fab.ui.point(x0,y0,z0)
fab.ui.point(x1,y1,z1)

12 changes: 12 additions & 0 deletions py/nodes/3D/cubes/cube_corner_rounded.node
Original file line number Diff line number Diff line change
Expand Up @@ -84,3 +84,15 @@ input('r',float,.25)

output('shape',cube_corner_rounded(x0,y0,z0,x1,y1,z1,r))

def drag_r(this,x,y,z):
dx = this.x1-x
dy = this.y1-y
dz = this.z1-z
this.r = math.sqrt(dx*dx+dy*dy+dz*dz)/math.sqrt(3)

fab.ui.point(x0,y0,z0)
fab.ui.point(x1,y1,z1)
fab.ui.point(x1-r,y1-r,z1-r,drag=drag_r,relative=False)



29 changes: 29 additions & 0 deletions py/nodes/3D/cylinder.node
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import fab

title('Cylinder')

input('x', float)
input('y', float)
input('z0', float)
input('z1', float, 1)
input('r', float, 1)

output('shape', fab.shapes.cylinder(x, y, z0, z1, r))

# UI
fab.ui.wireframe([(x, y, z0), (x, y, z1)])
fab.ui.wireframe([(x, y, z0), (x+r, y, z0)])

fab.ui.wireframe([
(math.cos(i/36. * 2*math.pi) * r + x,
math.sin(i/36. * 2*math.pi) * r + y, z0)
for i in range(36)], close=True)

fab.ui.wireframe([
(math.cos(i/36. * 2*math.pi) * r + x,
math.sin(i/36. * 2*math.pi) * r + y, z1)
for i in range(36)], close=True)

fab.ui.point(x, y, z0)
fab.ui.point(x, y, z1)
fab.ui.point(x + r, y, z0, drag=(r, None, None))
17 changes: 17 additions & 0 deletions py/nodes/3D/extrude.node
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import fab

title('Extrude')

input('_x', float)
input('_y', float)
input('z0', float)
input('z1', float, 1)

input('input', fab.types.Shape)
output('shape', fab.shapes.extrude_z(input, z0, z1))

# UI
fab.ui.wireframe([(_x, _y, z0), (_x, _y, z1)], color=fab.color.green)
fab.ui.point(_x, _y, z0, color=fab.color.green)
fab.ui.point(_x, _y, z1, color=fab.color.green)

11 changes: 11 additions & 0 deletions py/nodes/3D/point.node
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import fab

title('Point (3D)')

input('x', float)
input('y', float)
input('z', float)

# UI
fab.ui.point(x, y, z)

Loading

0 comments on commit aa9ccbb

Please sign in to comment.