├── .gitignore ├── Blender add-on └── DatablockTools.py ├── BlenderNav └── BlenderNav.py ├── BoolTool ├── BoolTool 0.1.rar └── BoolTool 0.2.rar ├── LICENSE ├── Outros ├── Logs.rar └── Screens │ ├── Anim.gif │ ├── Modelling.gif │ ├── UI.gif │ └── UIbt.gif ├── README.md └── Theme ├── Graph 1.2.2.rar ├── Graph1.23.rar ├── Graph1.3.rar ├── Graph1.4.rar └── Graph1.41.rar /.gitignore: -------------------------------------------------------------------------------- 1 | /.project 2 | -------------------------------------------------------------------------------- /Blender add-on/DatablockTools.py: -------------------------------------------------------------------------------- 1 | bl_info = { 2 | "name": "Datablock Tools", 3 | "author": "Vitor Balbio", 4 | "version": (1, 1), 5 | "blender": (2, 69, 0), 6 | "location": "View3D > Object > Datablock Tools", 7 | "description": "Some tools to handle Datablocks ", 8 | "warning": "", 9 | "wiki_url": "http://wiki.blender.org/index.php/Extensions:2.6/Py/Scripts/3D_interaction/Datablock_Tools", 10 | "tracker_url": "", 11 | "category": "3D View"} 12 | 13 | import bpy 14 | import os 15 | 16 | def CleanImages(): 17 | # Clean Derivative Images 18 | # para cada objeto selecionado, para cada face verifica se a textura ( com nome já tratado 19 | # para remover a extensao se necessario) possui "." então busca na lista de imagens a image 20 | # original e aplica 21 | 22 | ImageList = [] 23 | # se o ultimo caracter nao for numero entao remove os ultimos 3 caracteres (formato da imagem)" 24 | for i in bpy.data.images: 25 | try: 26 | a = int(i.name[-1]) 27 | imagename = i.name 28 | except ValueError: 29 | imagename, a = os.path.splitext(i.name) 30 | 31 | ImageList.append([imagename,i]) 32 | 33 | 34 | for obj in bpy.context.selected_objects: 35 | for uv in obj.data.uv_textures.items(): 36 | for faceTex in uv[1].data: 37 | image = faceTex.image 38 | # se o ultimo caracter nao for numero entao remove os ultimos 3 caracteres (formato da imagem)" 39 | try: 40 | a = int(image.name[-1]) 41 | imagename = image.name 42 | except ValueError: 43 | imagename, a = os.path.splitext(image.name) 44 | 45 | if( ".0" in imagename): 46 | for ima_name, ima in ImageList: 47 | if((ima_name in imagename) and (".0" not in ima_name)): 48 | faceTex.image.user_clear() 49 | faceTex.image = ima 50 | 51 | 52 | class CleanImagesOP(bpy.types.Operator): 53 | """Replace the ".0x" images with the original and mark this to remove in next load""" 54 | bl_idname = "object.clean_images" 55 | bl_label = "Clean Images Datablock" 56 | 57 | @classmethod 58 | def poll(cls, context): 59 | return context.selected_objects is not None 60 | 61 | def execute(self, context): 62 | 63 | CleanImages() 64 | return {'FINISHED'} 65 | 66 | 67 | def CleanMaterials(): 68 | # Clean Derivative Materials 69 | # para cada objeto da cena se ele tiver um material que contenha "." entao busca na lista 70 | # de materiais o material original e aplica 71 | 72 | matlist = bpy.data.materials 73 | for obj in bpy.context.selected_objects: 74 | for mat_slt in obj.material_slots: 75 | if(mat_slt.material != None): # se não tiver material associado 76 | if( ".0" in mat_slt.material.name): 77 | for mat in matlist: 78 | if((mat.name in mat_slt.material.name) and ("." not in mat.name)): 79 | mat_slt.material = mat 80 | 81 | 82 | class CleanMaterialsOP(bpy.types.Operator): 83 | """Replace the ".0x" materials with the original and mark this to remove in next load""" 84 | bl_idname = "object.clean_materials" 85 | bl_label = "Clean Materials Datablock" 86 | 87 | @classmethod 88 | def poll(cls, context): 89 | return context.selected_objects is not None 90 | 91 | def execute(self, context): 92 | CleanMaterials() 93 | return {'FINISHED'} 94 | 95 | class SetInstanceOP(bpy.types.Operator): 96 | """Set all Seletect Objects as instance of Active Object""" 97 | bl_idname = "object.set_instance" 98 | bl_label = "Set as Instance" 99 | 100 | @classmethod 101 | def poll(cls, context): 102 | return ((context.selected_objects is not None) and (context.active_object is not None)) 103 | 104 | def execute(self, context): 105 | active_obj = bpy.context.active_object 106 | for sel_obj in bpy.context.selected_objects: 107 | sel_obj.data = active_obj.data 108 | return {'FINISHED'} 109 | 110 | class DatablockToolsMenu(bpy.types.Menu): 111 | bl_label = "Datablock Tools" 112 | bl_idname = "VIEW_MT_datablock_tools" 113 | 114 | def draw(self, context): 115 | layout = self.layout 116 | 117 | layout.operator("object.clean_images") 118 | layout.operator("object.clean_materials") 119 | layout.operator("object.set_instance") 120 | 121 | 122 | def draw_item(self, context): 123 | layout = self.layout 124 | layout.menu(DatablockToolsMenu.bl_idname) 125 | 126 | 127 | def register(): 128 | bpy.utils.register_class(CleanImagesOP) 129 | bpy.utils.register_class(CleanMaterialsOP) 130 | bpy.utils.register_class(SetInstanceOP) 131 | bpy.utils.register_class(DatablockToolsMenu) 132 | 133 | # lets add ourselves to the main header 134 | bpy.types.VIEW3D_MT_object.append(draw_item) 135 | 136 | 137 | def unregister(): 138 | bpy.utils.register_class(CleanImagesOP) 139 | bpy.utils.unregister_class(CleanMaterialsOP) 140 | bpy.utils.unregister_class(SetInstanceOP) 141 | bpy.utils.unregister_class(DatablockToolsMenu) 142 | 143 | bpy.types.VIEW3D_MT_object.remove(draw_item) 144 | 145 | 146 | if __name__ == "__main__": 147 | register() -------------------------------------------------------------------------------- /BlenderNav/BlenderNav.py: -------------------------------------------------------------------------------- 1 | bl_info = { 2 | "name": "Blender Navigator", 3 | "category": "Scene", 4 | } 5 | 6 | import bpy 7 | 8 | import socket 9 | import mathutils 10 | import math 11 | 12 | #----------- Initial Values ---------------------------- 13 | print("----------------------------------------------") 14 | 15 | 16 | # Math ----------------------------- 17 | TargetZoom = 0; 18 | 19 | # UDP Network 20 | HOST = '192.168.2.101' # Endereco IP do Servidor 21 | PORT = 6000 # Porta que o Servidor esta 22 | dest = (HOST, PORT) 23 | server = (HOST, PORT) 24 | 25 | #---------------------------------------------------------------------- 26 | 27 | # -------------------------------------------------------------- 28 | class BlenderNavPanel(bpy.types.Panel): 29 | """Blender Navigator Configs""" 30 | bl_label = "Blender Navigator" 31 | bl_idname = "VIEW3D_PT_BlenderNav" 32 | bl_space_type = 'VIEW_3D' 33 | bl_region_type = 'UI' 34 | bl_context = "screen" 35 | 36 | 37 | def draw(self, context): 38 | layout = self.layout 39 | wd = bpy.context.screen 40 | 41 | self.layout.prop(wd, "NavEnable") 42 | self.layout.prop(wd, "Drag_Sens") 43 | 44 | 45 | def register(): 46 | InitValues() 47 | bpy.utils.register_class(BlenderNavPanel) 48 | 49 | 50 | #---------------------------------------------------------------------- 51 | 52 | # ----------------- Modal Timer -------------------------------------- 53 | # Classe Principal Executa executa a cada 1/120 segundos a função "Modal" 54 | # para receber as funções pela rede 55 | 56 | class RunModalTimer(bpy.types.Operator): 57 | """Operator which runs its self from a timer""" 58 | bl_idname = "wm.run_nav" 59 | bl_label = "Blender Navigator Update" 60 | 61 | _timer = None 62 | _holdEnable = False; 63 | 64 | 65 | def modal(self, context, event): 66 | 67 | if(self._holdEnable != bpy.context.screen.NavEnable): 68 | self._holdEnable = bpy.context.screen.NavEnable 69 | 70 | if(self._holdEnable): 71 | StartReceive() 72 | else: 73 | udpReceive.close() 74 | 75 | if(self._holdEnable and event.type == 'TIMER' ): 76 | ReceiveData() 77 | 78 | return {'PASS_THROUGH'} 79 | 80 | def execute(self, context): 81 | wm = bpy.context.window_manager 82 | self._timer = wm.event_timer_add(1/120, context.window) 83 | wm.modal_handler_add(self) 84 | return {'RUNNING_MODAL'} 85 | 86 | def cancel(self, context): 87 | wm = bpy.context.window_manager 88 | wm.event_timer_remove(self._timer) 89 | return {'CANCELLED'} 90 | 91 | #---------------------------------------------------------------------- 92 | 93 | # ------------------Bridge Command ------------------------------------ 94 | 95 | def FilterCommand(message): 96 | 97 | if("CMD_Drag" in message): 98 | msg = message.split(" ") 99 | DeltaValx = msg[1] 100 | DeltaValy = msg[2] 101 | RotaScreen(DeltaValx,DeltaValy,0) 102 | 103 | elif("CMD_Scale" in message): 104 | msg = message.split(" ") 105 | DeltaVal = msg[1] 106 | ZoomScreen(DeltaVal) 107 | 108 | #---------------------------------------------------------------------- 109 | 110 | # ----------------- Transformations -------------------------------- 111 | def ZoomScreen(DeltaVal): 112 | sensivity = .05; 113 | 114 | try: 115 | area = bpy.context.area 116 | if(area.spaces.active.type == "VIEW_3D"): 117 | print(DeltaVal) 118 | area.spaces.active.region_3d.view_distance += (float(DeltaVal) * sensivity) 119 | 120 | except: 121 | return 122 | 123 | def RotaScreen(x,y,z): 124 | 125 | sensivity = .4; 126 | 127 | _x = float(y) * sensivity 128 | _y = float(x) * sensivity 129 | _z = float(z) * sensivity 130 | 131 | area = bpy.context.area 132 | 133 | try: # Evita erro em momentos que nao existe contexto 134 | if(area.spaces.active.type == "VIEW_3D"): 135 | #print(str(area) + ": " + str(area.spaces.active)) 136 | rotation=area.spaces.active.region_3d.view_rotation 137 | 138 | rotFinal = rotation 139 | 140 | rot = mathutils.Quaternion((1.0, 0.0, 0.0), math.radians(_x)) 141 | rotFinal = rotation * rot # Local Rotate 142 | 143 | rot = mathutils.Quaternion((0.0, 0.0, 1.0), math.radians(_y)) 144 | rotFinal = rot * rotFinal # Global Rotate 145 | 146 | TargetRotate = mathutils.Quaternion() 147 | TargetRotate.x = rotFinal.x 148 | TargetRotate.y = rotFinal.y 149 | TargetRotate.z = rotFinal.z 150 | TargetRotate.w = rotFinal.w 151 | 152 | rotation.x = rotFinal.x 153 | rotation.y = rotFinal.y 154 | rotation.z = rotFinal.z 155 | rotation.w = rotFinal.w 156 | 157 | rotation.normalize() 158 | except: 159 | pass 160 | # ----------------------------------------------------------------- 161 | 162 | # ----------------- UPD Data Controller --------------- 163 | 164 | def SendData(): 165 | global udpSend 166 | udpSend = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) 167 | udpSend.sendto ("Vitor".encode(), dest) 168 | udpSend.close() 169 | 170 | def StartReceive(): 171 | 172 | global udpReceive 173 | 174 | udpReceive = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) 175 | udpReceive.setblocking(0) 176 | udpReceive.bind(server) 177 | 178 | def ReceiveData(): 179 | try: 180 | data = udpReceive.recv(4096) 181 | if(data): 182 | FilterCommand(str(data.decode('utf-8'))); 183 | 184 | except socket.error: 185 | #print("Nenhum dado") 186 | pass 187 | #------------------------------------------------------ 188 | 189 | # --------------Registers ---------------------- 190 | def register(): 191 | bpy.utils.register_class(BlenderNavPanel) 192 | bpy.utils.register_class(RunModalTimer) 193 | 194 | # ---------------------- Painel UI Properties -------------_---------- 195 | bpy.types.Screen.NavEnable = bpy.props.BoolProperty(name="Enable") 196 | bpy.types.Screen.Drag_Sens = bpy.props.FloatProperty(name="Drag_Sens", default = 0.4) 197 | 198 | def unregister(): 199 | bpy.utils.unregister_class(RunModalTimer) 200 | bpy.utils.unregister_class(BlenderNavPanel) 201 | 202 | if __name__ == "__main__": 203 | register() 204 | #-------------------------------------------------- 205 | bpy.ops.wm.run_nav() 206 | 207 | 208 | 209 | -------------------------------------------------------------------------------- /BoolTool/BoolTool 0.1.rar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vitorbalbio/code/f99f1d36e92df1cd27750edc7823db3d452eff70/BoolTool/BoolTool 0.1.rar -------------------------------------------------------------------------------- /BoolTool/BoolTool 0.2.rar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vitorbalbio/code/f99f1d36e92df1cd27750edc7823db3d452eff70/BoolTool/BoolTool 0.2.rar -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2013 vitorbalbio 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | this software and associated documentation files (the "Software"), to deal in 7 | the Software without restriction, including without limitation the rights to 8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software is furnished to do so, 10 | subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /Outros/Logs.rar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vitorbalbio/code/f99f1d36e92df1cd27750edc7823db3d452eff70/Outros/Logs.rar -------------------------------------------------------------------------------- /Outros/Screens/Anim.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vitorbalbio/code/f99f1d36e92df1cd27750edc7823db3d452eff70/Outros/Screens/Anim.gif -------------------------------------------------------------------------------- /Outros/Screens/Modelling.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vitorbalbio/code/f99f1d36e92df1cd27750edc7823db3d452eff70/Outros/Screens/Modelling.gif -------------------------------------------------------------------------------- /Outros/Screens/UI.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vitorbalbio/code/f99f1d36e92df1cd27750edc7823db3d452eff70/Outros/Screens/UI.gif -------------------------------------------------------------------------------- /Outros/Screens/UIbt.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vitorbalbio/code/f99f1d36e92df1cd27750edc7823db3d452eff70/Outros/Screens/UIbt.gif -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Vitor Balbio Repository 2 | ==== 3 | 4 | Some public scripts 5 | -------------------------------------------------------------------------------- /Theme/Graph 1.2.2.rar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vitorbalbio/code/f99f1d36e92df1cd27750edc7823db3d452eff70/Theme/Graph 1.2.2.rar -------------------------------------------------------------------------------- /Theme/Graph1.23.rar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vitorbalbio/code/f99f1d36e92df1cd27750edc7823db3d452eff70/Theme/Graph1.23.rar -------------------------------------------------------------------------------- /Theme/Graph1.3.rar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vitorbalbio/code/f99f1d36e92df1cd27750edc7823db3d452eff70/Theme/Graph1.3.rar -------------------------------------------------------------------------------- /Theme/Graph1.4.rar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vitorbalbio/code/f99f1d36e92df1cd27750edc7823db3d452eff70/Theme/Graph1.4.rar -------------------------------------------------------------------------------- /Theme/Graph1.41.rar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vitorbalbio/code/f99f1d36e92df1cd27750edc7823db3d452eff70/Theme/Graph1.41.rar --------------------------------------------------------------------------------