LightShift Script

Next
 From:  MO (MO_TE)
11145.1 
Hi
I wanted to have more control over the lighting inside moi.
After some trial and error, I managed to write this script that I want to share.

It changes the light direction by dragging on the circle.
By default, It works on "Z-up" mode, which means the light is above the model.
"Y-up" option means the light is in front of the model.
The closer the pointer is to the center of the circle, the higher the angle of the light will shine on the model.



Update:
Now it's a dialog box!
Added "Default" button (Toggles default and modified light direction)
Added "Silhouette" button (Toggles silhouette (light on/off))



Instruction:
Copy the "LightShift_Dialog.htm" to your commands folder.
Add a shortcut key and copy this code into it:
code:
script: var size= moi.ui.getUIPanel('moi://ui/SidePane.htm').document.width; moi.ui.createDialog( 'moi://commands/LightShift_Dialog.htm', 'defaultWidth:size, defaultHeight:size' )

EDITED: 24 Jul 2023 by MO_TE


  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  BurrMan
11145.2 In reply to 11145.1 
Great work Mo! Thanks.

I like that it doesn't persist between sessions.

Where is that setting changed? Maybe a toggle to set it back to default after fooling around?
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  MO (MO_TE)
11145.3 In reply to 11145.2 
Hi BurrMan
I'm glad you liked it.
You can use the "cancel" button, It resets the light direction to before the script is executed.
I think "moi" resets the light direction automatically to (1, 1, -1) every time you open it.
You can use this code to set it back to default:
code:
script:var dir = moi.view.lightDirection; dir.set(1,1,-1); moi.view.lightDirection = dir;
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  RayCAD1962 (RAYCAD003)
11145.4 In reply to 11145.1 
Hello MO,

Your script is remarkable indeed.
The way you can see the detail of your creation is good.
Hope that the next new Moi v5 will have some more script commands that can help more the users who loved 3D MOi.

Thank you for your time and support to this forum.
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Marc (TELLIER)
11145.5 
Wow, Very useful script!

Thanks !
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  MO (MO_TE)
11145.6 
Hi Ray and Marc
You're welcome.
I'm glad it's been useful for you.

I also find it useful if you use the script alongside other commands. E.g. fillet, blend
You can use this code. It will open the script in a separate window.
The "Done" and "Cancel" buttons become useless though.
code:
script: var sidePaneWidth= moi.ui.getUIPanel('moi://ui/SidePane.htm').document.width; moi.ui.createDialog( 'moi://commands/LightShift.htm', 'defaultWidth:sidePaneWidth,defaultHeight:sidePaneWidth' );
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Frenchy Pilou (PILOU)
11145.7 In reply to 11145.6 
You want to say that your lighting script works in a window, your fillet function in another window, your Blend function in another windows
and all that in the same time ? Or one by one ?
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  MO (MO_TE)
11145.8 In reply to 11145.7 
Hi Pilou
Yes, You can run "LightShift" script in a separate window.
Other things work as usual.
The point is you don't need to exit other commands to change the lighting. :)

Attachments:

  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Frenchy Pilou (PILOU)
11145.9 In reply to 11145.8 
Perfect i will try that and add it to my French repository! ;)

https://moiscript.weebly.com
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Frenchy Pilou (PILOU)
11145.10 
Excellent! :)

EDITED: 14 Jul 2023 by PILOU

  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Frenchy Pilou (PILOU)
11145.11 
in my French repository! ;)

https://moiscript.weebly.com/eclairage.html
---
Pilou
Is beautiful that please without concept!
My Moi French Site My Gallery My MagicaVoxel Gallery
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  christian (CHRI)
11145.12 In reply to 11145.11 
hi MO

Thanks for you creativity and your sharing
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Marbleman
11145.13 
Hi Mo,

Great script,

thank you
www.jameselliott.co.uk
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  danperk (SBEECH)
11145.14 
Thanks MO!
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  MO (MO_TE)
11145.15 
Hi everyone
Thanks for your suggestions and encouragement

I've revised about "LightShift" script since my last post.
I thought It's better to use this script as a separate dialog box, so users don't need to exit the running commands.
That made me to rewrite some part of the script and change it a bit.

I've updated my first post and attached "LightShift_Dialog.htm" to it.
Now you can toggle between the default and modified light direction ("Default" button), and toggle the light off or on. ("Silhouette" button)

I prefer to use this version, let me know if I should keep the old version. :)
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Death
11145.16 In reply to 11145.15 
Love it!

Thanx!

Even works with other custom light styles..
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
 From:  wayne hill (WAYNEHILL5202)
11145.17 
Excellent script Mo!

Using this macro for my project add-on graphics when quoting to customers.

Wayne
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged
 

Reply to All Reply to All