Created
January 12, 2022 22:11
-
-
Save dunossauro/55be78cccbea7d64d06e99558290a281 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from math import radians | |
from bpy.ops import object, transform | |
from bpy import context, data | |
def selected_collection(collection): | |
[obj.select_set(True) for obj in collection.all_objects] | |
# My object collection | |
collection = data.collections['Logo'] | |
selected_collection(collection) | |
# Collection location and rotation | |
for obj in collection.all_objects: | |
obj.location.x = -7.52766 | |
obj.location.y = 3.5183 | |
obj.location.z = 0 | |
obj.rotation_euler.z = radians(33) | |
# Animation | |
for obj in collection.all_objects: | |
obj.keyframe_insert(data_path='rotation_euler', frame=0) | |
obj.rotation_euler.x = radians(180) | |
obj.rotation_euler.z = radians(0) | |
obj.keyframe_insert(data_path='rotation_euler', frame=48) | |
obj.rotation_euler.x = radians(0) | |
obj.rotation_euler.z = radians(33) | |
obj.keyframe_insert(data_path='rotation_euler', frame=96) | |
# Collection Instances | |
for y in range(8): | |
for x in range(1, 15): | |
object.collection_instance_add( | |
collection='Logo', | |
align='VIEW', | |
location=(x, -y, 0), | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment