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 | |
| 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
| 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
| 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
| 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
| 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
| #you need to have installed pydub and conda | |
| #conda install -c conda-forge ffmpeg | |
| #conda install -c conda-forge pydub | |
| from pydub import AudioSegment | |
| path_file_input = "C://Users//X//Downloads//t_voice5812054872861705901.ogg" | |
| path_file_output = "C://Users//X//Desktop//bip//audioX.mp3" | |
| 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
| //Make sure to enable the Keywords (You may not need todo this in a loop) | |
| rend.material.EnableKeyword("_NORMALMAP"); | |
| rend.material.EnableKeyword("_METALLICGLOSSMAP"); | |
| //After that you can use this | |
| rend.material.SetTexture("_MainTex", result_render_texture); |
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
| public static void SetBaseColorMap(ref Renderer renderer, in RenderTexture render_texture) | |
| { | |
| renderer.material.SetTexture("_BaseColorMap", render_texture); | |
| } |
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 getPartsOfPath(path): | |
| path_to_folder = os.path.dirname(path) | |
| file_name_with_extension = os.path.basename(path) | |
| file_name_without_extension, extension = os.path.splitext(file_name_with_extension) | |
| return (path_to_folder, file_name_with_extension, file_name_without_extension, extension) | |
| getPartsOfPath("C:\\Users\\C\\Desktop\\Cosmos\\test.png") |