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 os | |
| from pydub import AudioSegment | |
| def get_list_of_files_only_in_folder(folder_path): | |
| return [f for f in os.listdir(folder_path) if os.path.isfile(os.path.join(folder_path, f))] | |
| def convert_from_ogg_to_mp3(path_file_input, path_file_output): | |
| ogg_version = AudioSegment.from_ogg(path_file_input) | |
| ogg_version.export(path_file_output, format="mp3") |
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 os | |
| def get_list_of_files_only_in_folder(folder_path): | |
| return [f for f in os.listdir(folder_path) if os.path.isfile(os.path.join(folder_path, f))] | |
| def get_extension(name): | |
| return name.split('.')[-1] | |
| def rename_files_in_folder_to_numerical_order(path, start_index = 0): | |
| n = start_index; |
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
| from PIL import Image | |
| def crop(path_input, path_output, left, top, right, bottom): | |
| im = Image.open(path_input) | |
| im1 = im.crop((left, top, right, bottom)) # new cropped image | |
| im1.show() #Display the image if you wan't to | |
| im1 = im1.save(path_output) | |
| name = "somename" | |
| path_in = "C:\\Users\x\\x\\x\\"+name+".png" |
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
| from PIL import Image | |
| import os | |
| def get_list_of_files_only_in_folder(folder_path): | |
| return [f for f in os.listdir(folder_path) if os.path.isfile(os.path.join(folder_path, f))] | |
| def get_extension(name): | |
| return name.split('.')[-1] | |
| def crop(path_input, path_output, left, top, right, bottom): |
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 create_a_cube(name, position, set_rotation, scale): | |
| # Create a simple cube. | |
| bpy.ops.mesh.primitive_cube_add() | |
| # Get the cube object and rename it. | |
| cube = bpy.context.object | |
| cube.name = name | |
| cube.rotation_euler = set_rotation |
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 Union(name_a, name_b, new_one_name): | |
| # Create a boolean modifier named 'my_bool_mod' for the cube. | |
| mod_bool = bpy.data.objects[name_a].modifiers.new('my_bool_mod', 'BOOLEAN') | |
| # Set the mode of the modifier to DIFFERENCE. | |
| mod_bool.operation = 'UNION' #'DIFFERENCE' | |
| # Set the object to be used by the modifier. | |
| mod_bool.object = bpy.data.objects[name_b] | |
| bpy.context.view_layer.objects.active = bpy.data.objects[name_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
| import bpy | |
| import uuid | |
| def create_a_cube(name, position, set_rotation, scale): | |
| # Create a simple cube. | |
| bpy.ops.mesh.primitive_cube_add() | |
| # Get the cube object and rename it. | |
| cube = bpy.context.object | |
| cube.name = name |
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 | |
| import math | |
| import random | |
| def create_a_cube(name, position, set_rotation, scale): | |
| # Create a simple cube. | |
| bpy.ops.mesh.primitive_cube_add() | |
| # Get the cube object and rename it. |
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
| GameObject instanciatedCube = (GameObject)PrefabUtility.InstantiatePrefab(Resources.Load("Cube")); | |
| //Prefab has to be in folder named Resources |
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
| using UnityEditor; | |
| using UnityEngine; | |
| //How can i run a script in at at edit time (Not Runtime) when object is selected, and recive user input (Edit update loop) ? | |
| //Editor scripts have to be in folder named Editor | |
| //[CustomEditor(typeof(GameObject))] ensures that this peace of code will run only when we have GameObject selected so we are save to cast object to GameObject [selectedTarget = (GameObject)target;] | |
| [CustomEditor(typeof(GameObject))] //This is custom editor for the type GameObject ( This script will kick in when we have game object selected ) | |
| public class CubeEditor : Editor | |
| { |