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 bpy.types import ( | |
| GizmoGroup | |
| ) | |
| import bpy | |
| bl_info = { | |
| "name": "POC buttons", | |
| "description": "POC 2D BUTTON script refactored from GP Animator Desk addon", | |
| "author": "Anthony Aragues, P.Świda", | |
| "version": (0, 0, 1), |
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
| # 1. include this version file | |
| # 2. put a json file online format = { "version": "1.4.0", "message": "upgrade for these new features" } | |
| # 3. point to the url in version.py | |
| # 4. register a prop to show the ui message bpy.types.WindowManager.flex_update = bpy.props.StringProperty(name="Info", default="") | |
| # 5. point to that property name in version.py | |
| # 6. setup the UI to ue that property if populated | |
| #if bpy.context.window_manager.flex_update != "": | |
| # box = layout.box() | |
| # row = box.row(align=True) | |
| # row.alignment = 'EXPAND' |
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 | |
| for obj in bpy.context.scene.objects: | |
| obj.select_set(True) | |
| # split the mesh | |
| if obj.type == 'MESH': | |
| bpy.ops.mesh.separate(type='LOOSE') | |
| obj.select_set(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
| import bpy | |
| def changeNodes(objNodeTree): | |
| for objNode in objNodeTree.nodes: | |
| if objNode.type == 'GROUP' and objNode.node_tree: | |
| changeNodes(objNode.node_tree) | |
| # look for the generic mix node from 3.4 to try and make it mixrgb in 3.3 | |
| # [0]Factor, [2]A, [4]B == [0]fac, [1]color1, [2]color2 | |
| elif objNode.type=='' and objNode.inputs[0].name == 'Factor': |
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 | |
| arrObjects = bpy.context.selected_objects | |
| for obj in arrObjects: | |
| obj.select_set(False) | |
| for obj in arrObjects: | |
| obj.select_set(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 | |
| for obj in bpy.context.scene.objects: | |
| if obj.type == 'MESH': | |
| obj.select_set(True) | |
| try: | |
| bpy.context.view_layer.objects.active = obj | |
| bpy.ops.mesh.separate(type='LOOSE') | |
| bpy.ops.object.transform_apply(location=False, rotation=True, scale=True) | |
| except: |
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 numpy as np | |
| import cv2 | |
| import os | |
| # install all the above packages with pip3 | |
| # run this by setting the directories and calling fro command line | |
| # python3 processImages.py | |
| IMAGEFOLDER = '/Users/anthonyaragues/Downloads/in/' | |
| OUTPUTFOLDER = '/Users/anthonyaragues/Downloads/out/' |
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 bmesh | |
| import math | |
| def diceObj(obj, intSize = 0.5): | |
| arrDimensions = obj.dimensions | |
| # add one for both ends of a row because we want to start from the center | |
| intRowsX = math.floor((arrDimensions[0]/intSize) + 1) | |
| intRowsY = math.floor((arrDimensions[1]/intSize) + 1) | |
| bm = bmesh.new() | |
| bm.from_mesh(obj.data) |
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 batchTransform(arrBatch, context=None, update_view=False): | |
| # { | |
| # object: string name_full, | |
| # action: string = SCALE | ROTATE | ORIGIN | MOVE, | |
| # value: (x,y,z), or string for parent or collection name | |
| # mode: LOCAL=relative or adding, WORLD= world coordinates or setting value | |
| # } | |
| # return an array of issues, or empty array if all good. | |
| arrErrors=[] | |
| if context == None: |
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 faceTheWorld(obj, strMode="EDIT"): | |
| # Thanks to JohnKaz and Kritskiy on BPY Discord for this function, looks simple, but not easy to figure out! | |
| mw = obj.matrix_world.copy() | |
| bm = bmesh.new() | |
| if strMode == 'OBJECT': | |
| bm.from_mesh(obj.data) | |
| else: | |
| bm = bmesh.from_edit_mesh(obj.data) | |
| face = next(iter(face for face in bm.faces if face.select), None) |