PromptBase
Upgrade
Close icon
General
Home
Marketplace
Create
Hire
Login
Chat
Sell
Explore

Prompt Details

Model
Chat - GPT-4o (gpt-4o)
Token size
154 ($0.00770 / call)
Example input
[fantasy-style trees]: fantasy-style trees
Example output
bl_info = { "name": "Fantasy Tree Generator", "author": "ChatGPT", "version": (1, 0), "blender": (3, 0, 0), "location": "View3D > Sidebar > Nature Generator", "description": "Generates a fantasy-style procedural tree with glowing leaves", "category": "Add Mesh", } import bpy import bmesh import random from math import radians, sin, cos from mathutils import Vector, Matrix # Property Group class TreeProperties(bpy.types.PropertyGroup): tree_height: bpy.props.FloatProperty(name="Tree Height", default=5, min=1, max=10) twist_angle: bpy.props.FloatProperty(name="Branch Twist Angle", default=45, min=0, max=180) leaf_clusters: bpy.props.IntProperty(name="Leaf Clusters", default=5, min=1, max=10) glow_strength: bpy.props.FloatProperty(name="Glow Strength", default=0.5, min=0.0, max=1.0) # Operator to generate the tree class OBJECT_OT_generate_tree(bpy.types.Operator): bl_idname = "object.generate_fantasy_tree" bl_label = "Generate Tree" bl_options = {'REGISTER', 'UNDO'} def execute(self, context): props = context.scene.tree_props # Clear previous tree if exists for obj in bpy.context.selected_objects: obj.select_set(False) # Create trunk bpy.ops.mesh.primitive_cylinder_add(vertices=8, radius=0.2, depth=props.tree_height, location=(0, 0, props.tree_height / 2)) trunk = bpy.context.active_object trunk.name = "Tree_Trunk" # Create branches for i in range(5): branch_length = props.tree_height * 0.3 angle = radians(props.twist_angle * random.random()) x_offset = cos(angle) * 0.5 y_offset = sin(angle) * 0.5 z_pos = props.tree_height * random.uniform(0.4, 0.9) bpy.ops.mesh.primitive_cylinder_add(vertices=6, radius=0.05, depth=branch_length, location=(x_offset, y_offset, z_pos)) branch = bpy.context.active_object branch.rotation_euler[1] = angle branch.rotation_euler[2] = angle branch.name = f"Branch_{i}" branch.parent = trunk # Create leaf material with glow mat = bpy.data.materials.new(name="Leaf_Glow_Material") mat.use_nodes = True nodes = mat.node_tree.nodes links = mat.node_tree.links nodes.clear() output = nodes.new(type='ShaderNodeOutputMaterial') emission = nodes.new(type='ShaderNodeEmission') emission.inputs['Strength'].default_value = props.glow_strength * 10 emission.inputs['Color'].default_value = (0.1, 1.0, 0.2, 1) links.new(emission.outputs['Emission'], output.inputs['Surface']) # Create glowing leaves for i in range(props.leaf_clusters): angle = random.uniform(0, 360) radius = 0.1 distance = random.uniform(0.2, 1.0) height = props.tree_height * random.uniform(0.6, 1.0) x = cos(radians(angle)) * distance y = sin(radians(angle)) * distance z = height bpy.ops.mesh.primitive_ico_sphere_add(radius=radius, location=(x, y, z)) leaf = bpy.context.active_object leaf.name = f"Leaf_{i}" leaf.data.materials.append(mat) leaf.parent = trunk return {'FINISHED'} # UI Panel class VIEW3D_PT_tree_generator(bpy.types.Panel): bl_label = "Nature Generator" bl_idname = "VIEW3D_PT_nature_generator" bl_space_type = 'VIEW_3D' bl_region_type = 'UI' bl_category = "Nature Generator" def draw(self, context): layout = self.layout props = context.scene.tree_props layout.prop(props, "tree_height") layout.prop(props, "twist_angle") layout.prop(props, "leaf_clusters") layout.prop(props, "glow_strength") layout.operator("object.generate_fantasy_tree", text="Generate Tree") # Registration classes = ( TreeProperties, OBJECT_OT_generate_tree, VIEW3D_PT_tree_generator, ) def register(): for cls in classes: bpy.utils.register_class(cls) bpy.types.Scene.tree_props = bpy.props.PointerProperty(type=TreeProperties) def unregister(): for cls in reversed(classes): bpy.utils.unregister_class(cls) del bpy.types.Scene.tree_props if __name__ == "__main__": register()
🤖 GPT

Nature Generator Addon For Blender

Add to Cart
Instant accessInstant access
Usage rightsCommercial use
Money-back guaranteeMoney‑back
By purchasing this prompt, you agree to our terms of service
GPT-4O
Tested icon
Guide icon
4 examples icon
Free credits icon
Here's a basic Blender addon written in Python that adds a "Nature Generator" tab to the "N" side panel. It enables users to generate custom trees and plants by leveraging Blender's built-in Sapling Tree Gen addon as a foundation. This example assumes the Sapling Tree Gen addon is already enabled (although it can also be activated via script). You can expand this addon in the future to include additional plant types and advanced customization options
...more
Added over 1 month ago
Report
Browse Marketplace