Position Sun object(s) in real time for given latitude, longitude, date and time #29714
Labels
No Label
Interest
Animation & Rigging
Interest
Blender Cloud
Interest
Collada
Interest
Core
Interest
Documentation
Interest
Eevee & Viewport
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
Import and Export
Interest
Modeling
Interest
Modifiers
Interest
Nodes & Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds, Tests & Devices
Interest
Python API
Interest
Rendering & Cycles
Interest
Sculpt, Paint & Texture
Interest
Translations
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Meta
Good First Issue
Meta
Papercut
Module
Add-ons (BF-Blender)
Module
Add-ons (Community)
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
10 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender-addons#29714
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Project: Blender Extensions
Tracker: Py Scripts Upload
Blender: 2.60
Category: 3D View
Python: 3.1
Script name: Sun Position
Author(s): Michael Martin
Status: >Contrib
%%%One or more sun objects (lamps or meshes) may be placed in 3D space on the ecliptic or as an analemma at a given distance from the scenes xyz axis. Object positions are updated in real time as the sliders are moved. If 2 to 24 objects are selected, they will be placed 1 hour apart. If more than 24 objects are selected, they will be evenly distributed.
Sliders allow for latitude, longitude, month, day, year, hour, UTC zone, north offset, and distance. The UTC zone only allows for positive values, but these will be properly applied based on whether the longitude is west of east of Greenwich England.
Options allow for showing the north offset, daylight savings time, and allowing multiple objects to be positioned.
A choice list of preset locations and times is also provided.
When using a sun lamp, a "Track to" constraint should be applied so that the sun points at an empty or some other object located at the convergence of the XYZ axes (x: 0, y: 0, z: 0). This will allow proper shadow direction for a given latitude and longitude.
The sun position panel shows up in the Properties Panel of the 3D window.
%%%
Changed status to: 'Open'
%%%Added wiki page at http://wiki.blender.org/index.php/Extensions:2.6/Py/Scripts/3D_interaction/Sun_Position%%%
%%%Hi,
Just a Reminder for people to Join the Mail List.
If you have not already, please visit this page:
http://lists.blender.org/mailman/listinfo/bf-extensions-cvs
& join the list.%%%
%%%Hi,
I've modified the sun position script so that it can use Cycle's sky texture as well as a named object making sun animations possible in Cycles. I'd like to be able to submit this, but am unable to upload and/or modify this page. Should I just submit a new extensions page or is there a way of updating this page and uploading the new script? Thanks
P.S. Here is a link to a video showing a sun animation made using the sun widget in Cycles with defined shadows composited using Blender's internal render engine: http://wiki.blender.org/uploads/2/28/SunPanel.swf
%%%
%%%Hi Michael,
you should select the 'Attachments' tab and upload your script again. The interface is not very intuitive...
Cheers,
Daniel%%%
%%%Daniel,
I've tried the 'Attachments' tab on different browsers keeping it visible while pressing the 'Save Changes' button
according to instructions on the page, but no go. The files upload but then the following error is displayed:
Error - missing parameters
Additionally, the form does not permit anything to be changed, i.e. description etc. The only thing that appears
to work is adding comments in the 'Followups' tab.
Thanks %%%
%%%Daniel,
I got the files to upload in the last comment I just wrote. It appears the only way to upload files is to name them in the 'Attachments' tab,
and then add a comment here in the 'Followups' tab and pressing change in the 'Followups' tab contrary to instructions in the 'Attachments tab'.
Anyway, I'll update the Wiki documents.
Thanks again%%%
%%%Version 1.2
%%%Version 1.3
%%%Version 1.3.1
Fixed bug in sun lamp direction when using north offset%%%
%%%Version 1.3.2
Overhauled the way callbacks were being handled as they were continuely
eating CPU time. The are now handled through a modal operator initiated
by enabling or disabling the panel. Animations with keyframed Sun panel
values now work cleanly even with the Properties shelf hidden.%%%
%%%marking for contrib%%%
Changed status from 'Open' to: 'Archived'
%%%Hi,
Due to changes to the api including the merging of bmesh, several addons are outdated.
Please, if you are the author of an addon check your script with blender revision 44256 or newer.
That is builds made After blender 2.62 official release.
I would ask that updates be made to your addon before the Blender 2.63 release.
6-8 weeks away.
This allows time for the api to become more exposed & bmesh to stablize furthur.
If you need help, drop into irc freenode #blenderpython or #blendercoders & feel welcome to ask questions.
At the time of 2.63 release, scripts that are not repaired or in active developement will have their tracker page marked "Closed"
this will not affect your links to the tracker, similar to closing scripts in 2.49b, the page will be still availible & can be re-opened.
Thanks for your understanding & patience during these Exciting Times.
Brendon.%%%
%%%Version 1.4.0
Tested to make sure it works with Blender 2.62 r44610
as what data to include in the panel. This lets a user taylor the widget to a minimal for
simple animation purposes and maximum screen real estate or allow other options for study purposes.
method of ecliptic and analemma movement without being stopped by month.%%%
%%%There was a bug report about this in the blender bug tracker, animating the time does not work:
http://projects.blender.org/tracker/index.php?func=detail&aid=30610&group_id=9&atid=498
It's up to you if you want to support this, but the way updates are done now seems to depend on 3d view redrawing callbacks, which does not work for rendering in background mode or if no 3d view is visible. More reliable would be to use e.g. the scene_update_post handler:
http://www.blender.org/documentation/blender_python_api_2_60_6/bpy.app.handlers.html
http://wiki.blender.org/index.php/Dev:2.6/Source/Render/UpdateAPI
%%%
%%%Thanks for the info. As this has been my first python script, I've got a lot to learn. I'll try finding examples using the scene_update_post handler and try implementing callbacks through that. %%%
%%% v 1.4.1 3/26/2012
Fixed bug (tracking number [#30610]) where sun and/or object positions
were not being changed according to keyframe entries on the time field
when animating with the View3D port hidden.%%%
%%%V 2.0.1 5/19/2012
%%%
%%%In Blender 2.65 the script does not appear in the panel World.
the problem is the version of python?%%%
%%%V 2.0.2 12/22/2012
As of Blender 2.65, changes were introduced to the python API which restricted access to bpy data.
This caused the script to break when trying to get user preferences.
This new version hopefully fixes the problem.
%%%
%%%Hallo Michael,
the problem, Alberto described, is vanished but now I get an error message (as shown in the attachment) when I try to "Enable" your addon in the world panel. And then, after shutting down Blender, a crash message follows.
Anyway, thank you for your very useful addon !
Win7 64 with recents builds from buildbot as Win64 and MinGW
%%%
%%%Greetings Tom,
In looking at the clipboard you sent, it looks like you may have moved the python code from its original directory
and renamed at least one of the modules causing the error.
The error says it occurred in E:\3D\BLENDER\2.65\scripts\addons\sun_positionNEWoperators.py.
The addon doesn't have a file named sun_positionNEWoperators.py.
All PY files should be in a single directory named sun_position. In your case, make sure there is a directory called:
E:\3D\BLENDER\2.65\scripts\addons\sun_position
Inside of that directory the file names are:
init.py
map.py
north.py
operators.py
properties.py
sun_calc.py
ui_sun.py
WordMap.jpg
WordMap.png
WorldMapHR.jpg
WorldMapLLR.jpg
WorldMapLR.jpg
If any files exist outside this directory as in your case sun_positionNEWoperators.py,
you are going to have problems since Blender now sees two different files trying to
load operators named the same.
Hope this helps
%%%
%%%No, sorry, I've just renamed the folder "sun_position". There is a backslash after sun_positionNEW.
But I've attached another screenshot with the original foldername and as you can see the same happens...
Tom%%%
%%%Tom,
I think you must be using an experimental build. I downloaded one of the latest dynatopo builds and reproduced your error.
In fact, the error happens for every addon script I tried. I can't reproduce this with the Dec 20th offical 265a build so I can't
really say what I can do at this point. If the Blender API was changed again, I haven't yet found what that change is.
In the meantime, I found a minor bug regarding registering a module (SunPos_OT_Map) and have fixed that with
the new attachment which is now 2.03.
Thanks%%%
%%%http://markmail.org/message/5zu3bi2pnjuexyas
I hope this will be useful
Thanks for your work%%%
%%%Thanks Tom and Alberto, Your link Alberto referred to a fix I already made which was V 2.0.2 12/22/2012.
However, the Python API was changed once again in revision 53207 which changed the way callbacks are made.
Those changes are reflected in a new version.
V 2.0.4 is attached and only works starting with Blender 2.65 revision 53207.%%%
%%%V 2.0.5 12/31/2012
This version fixes the need of having to have a Properties panel open when making an animation.
So if the sun panel is enabled and an animation is started, keyframed sun position values and objects
should update properly when switching to any other screen or panel.
Got rid of the High resolution world map and the png map to reduce the size of this addon
from 2.7mb to 460KB.
%%%
%%%V 3.0.0 2/6/2013
Added new usage mode which allows the binding of sun to an environment texture (i.e. sun + HDR texture).
This only works in Cycles. Once an environment texture is loaded and a sun object selected, the
'Sync Sun to Texture' button can be pressed which will make a lat/long image of the texture appear in the 3D View.
Simply move the cross hair to where the sun should be placed.
The same can be accomplished without the sync button by using the elevation and rotation sliders to move
the sun to the desired location and then press "Bind Texture to Sun"%%%
%%%V 3.0.1 2/7/2013
Fixed bug where z rotation of sky texture was effected by environment texture.
i.e. If in Sun+HDR texture mode, rotation is applied, switching to normal mode with a
sky texture, the Z rotation wasn't reset to 0.0%%%
%%%Sorry Sir Xaire;
But your so very good add-on don't run with the new Blender 2.66 RC!
A few of work on the table for you.....
Congratulations.
Spirou4D(Blenderatist.org)%%%
Added subscriber: @cardboard-2
Changed status from 'Archived' to: 'Open'
This add-on is now broken. Doesn't work with the latest version blender 2.77 (py 3.5.1).
Changed status from 'Open' to: 'Archived'
hi, this addon was not accepted into addons contrib. Although we don't support this addon in Blender, you can get the working addon here: https://github.com/meta-androcto/blenderpython/tree/master/scripts/addons_extern/sun_position
Closing as invalid.
Ah, i see.
Thanks for your effort.
Added subscriber: @johirsute
To see the world map it's simple (it work for me at least) :
in file map.py, line 1064, change "==" to "!="
new code is : "if Map.glImage.bindcode != 0:"
then line 1066, put - [x] after bindcode
new code is : bgl.glBindTexture(bgl.GL_TEXTURE_2D, Map.glImage.bindcode[0])
Tada ! That's all
All the options seems to work except perhaps Object Group, don't experimenting it enough
And settings are saved, I have close, reopen and made anim rendering to test.
Added subscriber: @Twein
There is a new version 3.0.1. listed as a compatible with Blender 2.8 BETA.
Kevan Cress remade it based on Michael Martin.
https://blenderartists.org/t/list-of-addons-that-work-with-2-8/1132912
But there are some problems... Please help