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
import bpy | |
# Create a red material | |
red_material = bpy.data.materials.new(name="RedMaterial") | |
red_material.diffuse_color = (1, 0, 0, 1) # Set color to red | |
# Assign the red material to selected objects | |
for obj in bpy.context.selected_objects: | |
obj.data.materials.append(red_material) | |
--------------------------------------------------------------- |
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
import bpy | |
# Clear existing mesh objects in the scene | |
bpy.ops.object.select_all(action='DESELECT') | |
bpy.ops.object.select_by_type(type='MESH') | |
bpy.ops.object.delete() | |
# Add a cube | |
bpy.ops.mesh.primitive_cube_add(size=2, location=(0, 0, 0)) |
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
class AddMaterial(bpy.types.Operator): | |
"""Add Material""" | |
bl_idname = "object.addmat_operator" | |
bl_label = "Add Material" | |
def execute(self, context): | |
ob = bpy.context.active_object | |
bpy.ops.object.shade_smooth() |
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
bl_info = { | |
"name": "Add Objects", | |
"author": "Demohero", | |
"version": (1, 0), | |
"blender": (3, 3, 0), | |
"location": "View3D > Sidebar", | |
"description": "Adds objects to the scene", | |
"warning": "", | |
"doc_url": "", | |
"category": "Add Objects", |
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
bl_context | |
{'object', 'interface', 'particle', '.paint_common', 'material', 'scene', '.vertexpaint', 'constraint', 'file_paths', 'data', 'physics', '.imagepaint_2d', 'save_load', '.mesh_edit', '.greasepencil_paint', '.posemode', '.imagepaint', '.objectmode', 'output', '.greasepencil_sculpt', 'system', 'input', 'world', '.paint_common_2d', 'render', 'editing', 'navigation', 'experimental', 'viewport', 'view_layer', '.armature_edit', '.greasepencil_vertex', 'modifier', 'addons', '.uv_sculpt', '.particlemode', 'animation', 'lights', 'shaderfx', 'keymap', 'bone_constraint', 'texture', 'bone', 'themes', '.weightpaint', '.sculpt_mode', '.greasepencil_weight'} |
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
# Modül oluşturma örnek | |
def greet(name): | |
print("Merhaba " + name) | |
-------- | |
# Import | |
import mymodule |
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
# Blender Menu Sample 1 | |
import bpy | |
class MySimpleMenu(bpy.types.Operator): | |
bl_idname = "my.simple_menu" | |
bl_label = "My Simple Menu" | |
def add_to_menu(self, context) : | |
self.layout.operator("mesh.primitive_cube_add", icon = "LIGHTPROBE_CUBEMAP") |
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
# Class for a car (Araba için class) | |
class Car(): | |
# Class Variables (Class değişkenleri) | |
# Attributes (Özellikler) | |
model = "Golf" | |
color = "Sarı" | |
# Objects of Car class (Nesneler) | |
car1 = Car() |