- Not everyone knows the Berlin clock and know how they "tick"! Blend4Web has a nice solution to show description of objects. We want to show in this station, how it works and use a script to automate the settings.
Create labels is described in the manual. If the commands once performed and actions copied from the Info Window to a script, it is easy to add labels with information and it is reduced therefore to a few clicks!
Here is the script:
#! bpy """ Name: 'berlin-clock.py' Blender: 27x Group: 'Example' Tooltip: 'Labelcreator--Blend4Web-Berlin-Clock' """ import bpy def create_labels(): "Create and compose labels for the berlin-clock" clock_labels = [["seconds", "Seconds", "Blinking every two seconds"], ["hour_01", "Hours", "One element = five hours"], ["hour_05", "Hours", "One element = one hour"], ["minute_01", "Minutes", "One element = five min./all 15 min. an other color"], ["minute_12", "Minutes", "One element = one minute"]] scn = bpy.context.scene for row in clock_labels: cube = bpy.data.objects[row] coords = cube.location bpy.ops.object.empty_add(type='PLAIN_AXES', location=(coords.x, coords.y, coords.z+1)) obj = bpy.context.object obj.name = row+"_label" obj.b4w_object_tags.title = row obj.b4w_object_tags.description = row obj.b4w_enable_object_tags = True obj.b4w_enable_anchor = True if __name__ == '__main__': scn = bpy.context.scene for ob in scn.objects: if ob.type == 'EMPTY': scn.objects.unlink(ob) bpy.data.objects.remove(ob) create_labels()
The steps 3 to 6 correspond to the steps of the previous learning station and are not repeated here.
|Hint:||Clicked on the label, to view the explanation, possibly the rotation must be stopped beforehand.|
|Remark:||The clock turns, but the time still stands still!|