You can just install it like any other add-on, simply select the .py file.
As a standalone add-on it looks like this :
It creates a panel in the N-Panel in the 3D View. It basically works like any other old calendar widget. You can reset the date/time to the current day and time by clicking the button in the top left of the panel.
In the standalone add-on, it writes the date/time in the custom properties of the current scene’s world :
You can access it in your script with context.scene.world.calendar_props.
It can easily be modified to be included in a custom script or add-on. For instance I developed it to be used as a popover in my Task Tracker add-on (still wip).
Dont hesitate to let me know if some of you are interested in this, or would like to use it with improved functionality.
Using the link from github, if you change the calendar values it will automatically update the values in the world custom property. You can access it with
props = bpy.context.scene.world.calendar_props day = props.day
If you want to customize the location of the panel or make it appear only when the user presses on a button, you can for instance add this at the end of the script (replace HelloWorldPanel by your own panel) :
class HelloWorldPanel(bpy.types.Panel):
"""Creates a Panel in the Object properties window"""
bl_label = "Calendar Panel"
bl_idname = "OBJECT_PT_hello"
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
bl_context = "world"
def draw(self, context):
layout = self.layout
layout.popover(CalendarPanel.bl_idname)
This will place the calendar in a new panel in the world properties.
Thanks for the wonderful widget. I could have never coded such a widget so concisely without bloat.
For a pet-project of mine, I needed to be able to animate the date, so I added the such functionality. The user is able to enter any full path and keyframes are added to the scene on the custom property with a unix timestamp integer. If a full-path is not used, the script assumes the custom property to be under “scene”.
The date is used for some drivers to position the sun in the scene in my project. I thought it might be of use to some people so I decided to share it. I might open a new thread for it, crediting the original work.
Hehe I’m glad it was useful to you. I’m thrilled to see it used elsewhere. I wrote that a seemingly long time ago so if there’s something that bugs you don’t hesitate to ask here. Cheers