Hello everyone i have an idea for a script that would be very useful, but i dont know how to make it, i think it is a little bit challenging.
I would like to rotate the Uvwmap by the view angle of the viewport, for example 90 degree or 180 degree.
Forum topic · Scripts Wanted
Rotate UVWmap by view angle of viewport
By Dragan_ilic · 2021-04-26
Description
Attachments
- rotate_by_angle_view.jpg — rotate_by_angle_view.jpg1.7 MB
Comments (3)
Litte Error
Dragan_ilic · 2021-05-07
Ok know i have tried to make it, it works but just for the first rotation, i dont know why :(
does anyone has an idea?
Rollout Uvrotroll "Rotate Uvwmap by viewangle"
(
fn Uvwmap_Rotate rotdeg =
(
if selection.count == 1 do
(
perspview = Inverse(getViewTM())
perspdir = perspview.row3
Gpersp = #(dot perspdir [1,0,0], dot perspdir [0,1,0], dot perspdir [0,0,1])
Waxis = finditem Gpersp (amax Gpersp)
Saxis = #([1,0,0],[0,1,0],[0,0,1])
if Gpersp[Waxis] > 0 do rotdeg = -rotdeg
for node in selection where isProperty node #uvwmap do
(
node.uvwmap.gizmo.rotation = (angleaxis rotdeg Saxis[Waxis])
)
)
)
button rccw "rccw" pos:[5,10] height:20 width:35
button rcw "rcw" pos:[45,10] height:20 width:35
spinner rotsp "Deg" range:[0,360,90] fieldwidth:40 scale:1 pos:[85,12]
on rcw pressed do if selection.count > 0 do undo on Uvwmap_Rotate rotsp.value
on rccw pressed do if selection.count > 0 do undo on Uvwmap_Rotate -rotsp.value
)
createdialog Uvrotroll
.
jahman · 2021-05-07
Shouldn't it be like this?
node.uvwmap.gizmo.rotation *= (angleaxis rotdeg Saxis[Waxis])
Dragan_ilic · 2021-05-08
Thanks, now it continues the function.
But if i rotate it from the Side and go to the topview its changing the axis.