{"id":"22dmc67zbq","url":"https://pastebin.ca/22dmc67zbq","raw_url":"https://raw.anybin.ca/22dmc67zbq","visibility":"public","access":"public","created_at":1793388936810,"expires_at":1793993736810,"fetch_limit":null,"fetches_used":0,"reads_remaining":null,"size_bytes":3329,"syntax_hint":null,"title":null,"filename":"sammy aork","change_note":null,"cipher":null,"cipher_meta":null,"parent_id":null,"root_id":"22dmc67zbq","version":1,"owner_id":null,"recipient_id":null,"body":"import blender\nimport bpy\nimport random\n\n# Clear existing objects in the scene\nbpy.ops.object.select_all(action='SELECT')\nbpy.ops.object.delete(use_global=False)\n\n# Helper function to create materials\ndef create_material(name, r, g, b):\n    mat = bpy.data.materials.new(name=name)\n    mat.use_nodes = True\n    nodes = mat.node_tree.nodes\n    principled = nodes.get(\"Principled BSDF\")\n    if principled:\n        principled.inputs['Base Color'].default_value = (r, g, b, 1.0)\n    return mat\n\n# Create color palette\ncolors = {\n    'road': create_material('RoadMat', 0.1, 0.1, 0.1),\n    'light_b': create_material('LightB', 0.2, 0.5, 0.8),\n    'dark_b': create_material('DarkB', 0.7, 0.3, 0.3),\n    'yellow_b': create_material('YellowB', 0.9, 0.7, 0.2),\n    'car': create_material('CarMat', 0.1, 0.6, 0.3),\n    'pole': create_material('PoleMat', 0.4, 0.4, 0.4)\n}\n\n# 1. Create the Road Base\nbpy.ops.mesh.primitive_plane_add(size=30, location=(0, 0, 0))\nroad = bpy.context.active_object\nroad.name = \"Road_Base\"\nroad.data.materials.append(colors['road'])\n\n# 2. Generate 20+ Objects (Buildings, Cars, Streetlights)\nobj_count = 0\n\n# Side 1 Buildings (Left)\nfor i in range(6):\n    h = random.uniform(4.0, 8.0)\n    bpy.ops.mesh.primitive_cube_add(size=1, location=(-6, -10 + (i * 4), h/2))\n    b = bpy.context.active_object\n    b.name = f\"Building_L_{i}\"\n    b.scale = (3, 3, h)\n    b.data.materials.append(random.choice([colors['light_b'], colors['dark_b'], colors['yellow_b']]))\n    obj_count += 1\n\n# Side 2 Buildings (Right)\nfor i in range(6):\n    h = random.uniform(4.0, 8.0)\n    bpy.ops.mesh.primitive_cube_add(size=1, location=(6, -10 + (i * 4), h/2))\n    b = bpy.context.active_object\n    b.name = f\"Building_R_{i}\"\n    b.scale = (3, 3, h)\n    b.data.materials.append(random.choice([colors['light_b'], colors['dark_b'], colors['yellow_b']]))\n    obj_count += 1\n\n# Streetlights (Poles + Lamps)\nfor i in range(4):\n    y_pos = -8 + (i * 6)\n    # Pole\n    bpy.ops.mesh.primitive_cylinder_add(radius=0.1, depth=3, location=(-3.5, y_pos, 1.5))\n    p = bpy.context.active_object\n    p.name = f\"LightPole_{i}\"\n    p.data.materials.append(colors['pole'])\n    obj_count += 1\n    # Lamp head\n    bpy.ops.mesh.primitive_uv_sphere_add(radius=0.2, location=(-3.5, y_pos, 3.1))\n    lh = bpy.context.active_object\n    lh.name = f\"LampHead_{i}\"\n    lh.data.materials.append(colors['yellow_b'])\n    obj_count += 1\n\n# Cars scattered on the street\nfor i in range(4):\n    bpy.ops.mesh.primitive_cube_add(size=1, location=(random.uniform(-1.5, 1.5), -12 + (i * 7), 0.4))\n    car = bpy.context.active_object\n    car.name = f\"Car_{i}\"\n    car.scale = (1.2, 2.2, 0.7)\n    car.rotation_euler = (0, 0, random.uniform(-0.1, 0.1))\n    car.data.materials.append(colors['car'])\n    obj_count += 1\n\n# 3. Lights + Shadows Setup\nbpy.ops.object.light_add(type='SUN', radius=1, location=(5, -5, 12))\nsun = bpy.context.active_object\nsun.name = \"Main_Sun\"\nsun.data.energy = 4.0\nsun.data.use_shadow = True\nsun.rotation_euler = (0.6, 0.4, 0.2)\n\n# 4. Camera Setup\nbpy.ops.object.camera_add(location=(0, -18, 5))\ncam = bpy.context.active_object\ncam.name = \"Scene_Camera\"\ncam.rotation_euler = (1.35, 0, 0) # Tilted downward slightly to look down the street\nbpy.context.scene.camera = cam\n\nprint(f\"Generated {obj_count} objects dynamically with colors, lights, and a camera.\")\n"}