This file contains hidden or 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
sing System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
using System.IO; | |
using UnityEditor; | |
public class CreatingPNG : MonoBehaviour | |
{ | |
public static Texture2D CreateTexture() | |
{ | |
int width = 100; |
This file contains hidden or 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
0 : Shader "Unlit/MyUnlitShader" | |
1 : { | |
2 : Properties | |
3 : { | |
4 : _MainTex ("Texture", 2D) = "white" {} | |
} | |
SubShader | |
{ | |
Tags { "RenderType"="Opaque" } | |
LOD 100 |
This file contains hidden or 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 | |
bpy.ops.object.select_all(action='SELECT') | |
bpy.ops.object.delete(use_global=False, confirm=False) |
This file contains hidden or 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
def make_a_parent(parent, child): | |
objects = bpy.data.objects | |
a = objects[parent] | |
b = objects[child] | |
b.parent = a |
This file contains hidden or 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
bpy.ops.mesh.primitive_cube_add(location=(0, 0, 0)) | |
bpy.context.object.name = "Generated" |
This file contains hidden or 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 | |
def making_object_active(name): | |
obj_to_make_active = bpy.data.objects[name] | |
bpy.context.view_layer.objects.active = obj_to_make_active | |
def duplicating_linked_object_with_name(name, new_object_name): | |
bpy.ops.object.select_all(action='DESELECT') | |
bpy.ops.object.select_pattern(pattern=name) | |
bpy.ops.object.duplicate_move_linked(OBJECT_OT_duplicate={"linked":True}) |
This file contains hidden or 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 | |
def set_location(name, xyz): | |
bpy.data.objects[name].location = xyz | |
def set_euler_rotation(name, xyz): | |
bpy.data.objects[name].rotation_euler = xyz | |
def set_scale(name, xyz): | |
bpy.data.objects[name].scale = xyz |
This file contains hidden or 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 | |
bpy.ops.object.select_all(action='DESELECT') | |
bpy.data.objects["PEPE"].select_set(state=True) |
This file contains hidden or 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 | |
def does_object_with_name_exist(name): | |
if name in bpy.data.objects: | |
return True | |
return False | |
if not does_object_with_name_exist("Generated"): | |
bpy.ops.mesh.primitive_cube_add(location=(0, 0, 0)) | |
bpy.context.object.name = "Generated" |
This file contains hidden or 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 | |
import uuid | |
## | |
def find_collection(context, item): | |
collections = item.users_collection | |
if len(collections) > 0: | |
return collections[0] | |
return context.scene.collection |