Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -18,7 +18,7 @@ img = bpy.data.images.load('./STScI-01G8H1NK4W8CJYHF2DDFD1W0DQ.png')
|
|
| 18 |
earth_texture = bpy.data.images.load('./ear0xuu2.jpg')
|
| 19 |
mars_texture = bpy.data.images.load('mar0kuu2.jpg')
|
| 20 |
apol=[]
|
| 21 |
-
|
| 22 |
def add_planet(name, radius, mass, distance_from_sun):
|
| 23 |
material = bpy.data.materials.new(name="Mymarsmat"+str(random.randint(1,36)))
|
| 24 |
material.use_nodes = True
|
|
@@ -36,20 +36,6 @@ def add_planet(name, radius, mass, distance_from_sun):
|
|
| 36 |
planet["mass"] = mass
|
| 37 |
return planet
|
| 38 |
|
| 39 |
-
def visualize_planets():
|
| 40 |
-
bpy.ops.object.select_all(action='DESELECT')
|
| 41 |
-
for obj in bpy.context.scene.objects:
|
| 42 |
-
if obj.type == 'MESH' and "mass" in obj:
|
| 43 |
-
obj.select_set(True)
|
| 44 |
-
##for area in bpy.context.screen.areas:
|
| 45 |
-
## if area.type == 'VIEW_3D':
|
| 46 |
-
## override = bpy.context.copy()
|
| 47 |
-
## override['area'] = area
|
| 48 |
-
## bpy.ops.view3d.snap_cursor_to_selected(override)
|
| 49 |
-
bpy.ops.view3d.snap_cursor_to_selected()
|
| 50 |
-
##bpy.ops.object.origin_set(type='ORIGIN_CURSOR')
|
| 51 |
-
##bpy.context.scene.cursor.location = (0, 0, 0)
|
| 52 |
-
|
| 53 |
def create_planet_flyby_animation(planet, radius, duration):
|
| 54 |
bpy.context.view_layer.objects.active = planet
|
| 55 |
planet.select_set(True)
|
|
@@ -126,11 +112,7 @@ def create_meteor_with_particle_system():
|
|
| 126 |
meteor.keyframe_insert(data_path="location", index=-1, frame=20)
|
| 127 |
|
| 128 |
def create_scene():
|
| 129 |
-
|
| 130 |
-
render = scene.render
|
| 131 |
-
render.resolution_x = 1920
|
| 132 |
-
render.resolution_y = 1080
|
| 133 |
-
render.engine = 'BLENDER_EEVEE'
|
| 134 |
world = bpy.context.scene.world
|
| 135 |
if not world.use_nodes:
|
| 136 |
world.use_nodes = True
|
|
@@ -143,8 +125,8 @@ def create_scene():
|
|
| 143 |
bg_node = world.node_tree.nodes.get('Background')
|
| 144 |
bg_node.inputs['Color'].default_value = (0, 0, 0, 1)
|
| 145 |
|
| 146 |
-
tex_environment = world.node_tree.nodes.new('ShaderNodeTexEnvironment')
|
| 147 |
-
tex_environment.image = img
|
| 148 |
##world = bpy.context.scene.world
|
| 149 |
tx_node = world.node_tree.nodes['Background']
|
| 150 |
world.node_tree.links.new(tex_environment.outputs[0], tx_node.inputs[0])
|
|
@@ -175,7 +157,7 @@ def create_scene():
|
|
| 175 |
|
| 176 |
add_animated_space_rocks()
|
| 177 |
create_meteor_with_particle_system()
|
| 178 |
-
create_particle_effects_animation()
|
| 179 |
##create_planet_flyby_animation(planet1, 4, 2)
|
| 180 |
##visualize_planets()
|
| 181 |
scene = bpy.context.scene
|
|
|
|
| 18 |
earth_texture = bpy.data.images.load('./ear0xuu2.jpg')
|
| 19 |
mars_texture = bpy.data.images.load('mar0kuu2.jpg')
|
| 20 |
apol=[]
|
| 21 |
+
print(bpy.app.version_string)
|
| 22 |
def add_planet(name, radius, mass, distance_from_sun):
|
| 23 |
material = bpy.data.materials.new(name="Mymarsmat"+str(random.randint(1,36)))
|
| 24 |
material.use_nodes = True
|
|
|
|
| 36 |
planet["mass"] = mass
|
| 37 |
return planet
|
| 38 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 39 |
def create_planet_flyby_animation(planet, radius, duration):
|
| 40 |
bpy.context.view_layer.objects.active = planet
|
| 41 |
planet.select_set(True)
|
|
|
|
| 112 |
meteor.keyframe_insert(data_path="location", index=-1, frame=20)
|
| 113 |
|
| 114 |
def create_scene():
|
| 115 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
| 116 |
world = bpy.context.scene.world
|
| 117 |
if not world.use_nodes:
|
| 118 |
world.use_nodes = True
|
|
|
|
| 125 |
bg_node = world.node_tree.nodes.get('Background')
|
| 126 |
bg_node.inputs['Color'].default_value = (0, 0, 0, 1)
|
| 127 |
|
| 128 |
+
##tex_environment = world.node_tree.nodes.new('ShaderNodeTexEnvironment')
|
| 129 |
+
##tex_environment.image = img
|
| 130 |
##world = bpy.context.scene.world
|
| 131 |
tx_node = world.node_tree.nodes['Background']
|
| 132 |
world.node_tree.links.new(tex_environment.outputs[0], tx_node.inputs[0])
|
|
|
|
| 157 |
|
| 158 |
add_animated_space_rocks()
|
| 159 |
create_meteor_with_particle_system()
|
| 160 |
+
##create_particle_effects_animation()
|
| 161 |
##create_planet_flyby_animation(planet1, 4, 2)
|
| 162 |
##visualize_planets()
|
| 163 |
scene = bpy.context.scene
|