help > Set light position in script--possible bug?
Showing 1-2 of 2 posts
Results per page:
Sep 5, 2017  05:09 PM | ajack
Set light position in script--possible bug?
Hi there,

I am using the most recent version of MRIcrogl for Mac, MRIcroGL 32-bit OSX (Cocoa) 14 July 2017.

Having a little trouble setting the light position via script. Based on what I see in the lower left hand window when I adjust the light position manually with sliders, I used the following in my script:

SHADERADJUST('Light', -180/46);

The script including this parameter successfully compiles and executes but doesn't adjust the light position (visually, no change and in lower left window, it stays on the default, 'Light', 0/70).

However, if I then click once on the left Light slider knob without moving it, the rendering changes to the correct lighting position (without changing the readout in the lower left window, which stays at 'Light' 0/70). If I then move one of the other sliders (say, specular), the lower left window updates to what I put in the script, 'Light' -180/46.   

Have any thoughts about what might be going on or how I might correct this?

May 7, 2018  11:05 PM | Chris Rorden
RE: Set light position in script--possible bug?
If you choose The View/Scripting menu to show the Scripting window, you will see that the Scripting Form has a menu named "Insert" - if you choose a command from here it will insert an appropriate function into your script and report a note about the function at the bottom of the window. I think you want the shaderlightazimuthelevation, which will change the location of the illumination. With the classic Pascal script, this would be:

shaderlightazimuthelevation(-21, 21);

With the pre-release and future releases
you can also write your script in Python, just make sure your script includes the key phrase "import gl". In this case, the script would be

import gl
gl.shaderlightazimuthelevation(-21, 21)