Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Align to normal and fixed absolute axis #23

Merged
merged 1 commit into from
Nov 2, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Align to normal and fixed absolute axis
  • Loading branch information
s-leger authored Nov 1, 2017
commit eda482caaed36030e776bdf132cfc123a68b9bf9
22 changes: 20 additions & 2 deletions blender/addons/paint_clones/tools_painclones.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,10 @@ class PaintClonesProperties(PropertyGroup):
('X_AXIS', 'Absolute X', 'Absolute X axis, up follow stroke'),
('Y_AXIS', 'Absolute Y', 'Absolute Y axis, up follow stroke'),
('Z_AXIS', 'Absolute Z', 'Absolute Z axis, up follow stroke'),
('STROKE', 'Follow stroke', 'Follow stroke, up follow normal')
('STROKE', 'Follow stroke', 'Follow stroke, up follow normal'),
('X_NORMAL', 'Normal X', 'Absolute X axis, up follow normal'),
('Y_NORMAL', 'Normal Y', 'Absolute Y axis, up follow normal'),
('Z_NORMAL', 'Normal Z', 'Absolute Z axis, up follow normal')
),
default = 'NORMAL'
)
Expand Down Expand Up @@ -696,7 +699,22 @@ def obj_ray_cast(obj, matrix, view_vector, ray_origin):
if pct.align_mode == 'Z_AXIS':
track_vec = zAxis
up_vec = stroke_axis


# Rotation To X_NORMAL
if pct.align_mode == 'X_NORMAL':
track_vec = xAxis
up_vec = best_obj_nor

# Rotation To Y_NORMAL
if pct.align_mode == 'Y_NORMAL':
track_vec = yAxis
up_vec = best_obj_nor

# Rotation To Z_NORMAL
if pct.align_mode == 'Z_NORMAL':
track_vec = zAxis
up_vec = best_obj_nor

q = get_rot_quat(newDup, track_vec, up_vec, pct.track_axis, pct.up_axis)

bpy.ops.transform.rotate(value=q.angle, axis=(q.axis), proportional='DISABLED')
Expand Down