├── other
└── exchangers
│ ├── houdini
│ ├── exchanger.py
│ └── exchanger.shelf
│ ├── max
│ └── test.ms
│ ├── modo
│ ├── ex_code
│ │ ├── ex_import.py
│ │ └── ex_export.py
│ └── exchanger_config.CFG
│ └── blender
│ ├── 2.7
│ └── blender_exchanger
│ │ ├── __init__.py
│ │ └── blender_exchanger.py
│ └── 2.8
│ └── blender_exchanger
│ └── __init__.py
├── houdini
├── otls
│ ├── other
│ │ ├── checker2.hdalc
│ │ ├── wireframe.otllc
│ │ ├── checker2_sop.hdalc
│ │ ├── simple_reguide.otllc
│ │ ├── group_inverted_uvs.otllc
│ │ ├── mifth_simple_goz.otllc
│ │ ├── mifth_texel_density.otllc
│ │ ├── mifth_3dcoat_applinker.otllc
│ │ └── mifth_extract_objects.otllc
│ ├── modeling
│ │ ├── mifth_pipe.otllc
│ │ ├── mira_tree.otllc
│ │ ├── mifth_strap.otllc
│ │ ├── mifth_bend_plus.otllc
│ │ ├── mifth_capsule.otllc
│ │ ├── mifth_make_arc.otllc
│ │ ├── mifth_move_flow.otllc
│ │ ├── mifth_soft_push.otllc
│ │ ├── mifth_unbevel.otllc
│ │ ├── mifth_uv_center.otllc
│ │ ├── mifth_uv_grid.otllc
│ │ ├── mifth_uv_wrap.otllc
│ │ ├── mifth_attrib_ramp.otllc
│ │ ├── mifth_copy_curve.otllc
│ │ ├── mifth_copy_meshes.otllc
│ │ ├── mifth_edgestoface.otllc
│ │ ├── mifth_insert_mesh.otllc
│ │ ├── mifth_knife_plus.otllc
│ │ ├── mifth_lod_helper.otllc
│ │ ├── mifth_make_circle.otllc
│ │ ├── mifth_merge_verts.otllc
│ │ ├── mifth_scale_edges.otllc
│ │ ├── mifth_simple_gear.hdalc
│ │ ├── mifth_simple_pipe.otllc
│ │ ├── mifth_symmetrize.otllc
│ │ ├── mifth_unbevel_v2.otllc
│ │ ├── mifth_curve_length.otllc
│ │ ├── mifth_curve_surface.otllc
│ │ ├── mifth_divide_edges.otllc
│ │ ├── mifth_edgeflipflow.otllc
│ │ ├── mifth_extract_edges.otllc
│ │ ├── mifth_extrude_point.otllc
│ │ ├── mifth_seams_cheater.otllc
│ │ ├── mifth_spread_edges.otllc
│ │ ├── mifth_subdive_plus.otllc
│ │ ├── mifth_uv_layout_plus.otllc
│ │ ├── mifth_extract_edges_2.otllc
│ │ ├── mifth_point_to_circle.otllc
│ │ ├── mifth_round_edge_bevel.otllc
│ │ ├── mifth_round_edges_vdb.otllc
│ │ ├── mifth_uv_pixel_offset.otllc
│ │ ├── mirror_attribute_good.otllc
│ │ ├── mifth_destructive_extrude.otllc
│ │ ├── mifth_edge_collapse_plus.otllc
│ │ ├── mifth_edit_linear_falloff.otllc
│ │ ├── mifth_edit_radial_falloff.otllc
│ │ ├── mifth_symmetry_extrude_v1.otllc
│ │ ├── mifth_symmetry_extrude_v2.otllc
│ │ ├── mifth_attrib_copy_topology.otllc
│ │ └── mifth_transform_primitives.otllc
│ ├── render
│ │ └── mifth_extract_bake.otllc
│ └── animation
│ │ └── mifth_capture_symmetry.otllc
├── pk
│ ├── otls
│ │ └── pk_image_plane.hdalc
│ └── pk_shelf
│ │ └── pk.shelf
├── Houdini.keymap.overrides
└── toolbar
│ └── mf_obj.shelf
├── blender
├── animation_nodes
│ └── modeling
│ │ ├── clone_curve.blend
│ │ └── simple_array.blend
└── addons
│ ├── 2.8
│ ├── mira_tools
│ │ ├── mi_inputs.py
│ │ ├── mi_color_manager.py
│ │ ├── mi_widget_curve.py
│ │ ├── mi_settings.py
│ │ ├── mi_snap_points.py
│ │ ├── mi_widget_select.py
│ │ ├── mi_noise.py
│ │ ├── add_mesh_capsule.py
│ │ ├── mi_simple_modeling.py
│ │ ├── auto_load.py
│ │ ├── __init__.py
│ │ ├── mi_unbevel.py
│ │ ├── mi_linear_widget.py
│ │ ├── mi_looptools.py
│ │ ├── mi_retopo_loops.py
│ │ └── mi_widget_linear_deform.py
│ ├── io_simple_3dcoat
│ │ └── __init__.py
│ ├── df_tools
│ │ ├── __init__.py
│ │ └── df_objects.py
│ ├── quick_pipe
│ │ └── quick_pipe.py
│ └── mifth_tools
│ │ ├── mifth_vertex_paint.py
│ │ ├── __init__.py
│ │ └── mifth_tools_ui.py
│ └── 2.7
│ ├── mira_tools
│ ├── mi_inputs.py
│ ├── mi_color_manager.py
│ ├── mi_settings.py
│ ├── mi_widget_curve.py
│ ├── add_mesh_capsule.py
│ ├── mi_noise.py
│ ├── mi_widget_select.py
│ ├── __init__.py
│ ├── mi_widget_linear_deform.py
│ └── mi_looptools.py
│ ├── paint_clones
│ └── README.md
│ ├── super_grouper
│ └── __init__.py
│ ├── quick_pipe
│ └── quick_pipe.py
│ ├── io_simple_3dcoat
│ └── __init__.py
│ └── mifth_tools
│ ├── mifth_vertex_paint.py
│ └── __init__.py
├── README.md
├── nuke
└── gizmos
│ └── checker_view.gizmo
├── LICENSE
└── .gitignore
/other/exchangers/houdini/exchanger.py:
--------------------------------------------------------------------------------
1 | def get_exchange_path():
2 | return ''
--------------------------------------------------------------------------------
/houdini/otls/other/checker2.hdalc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mifth/mifthtools/HEAD/houdini/otls/other/checker2.hdalc
--------------------------------------------------------------------------------
/houdini/otls/other/wireframe.otllc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mifth/mifthtools/HEAD/houdini/otls/other/wireframe.otllc
--------------------------------------------------------------------------------
/houdini/otls/modeling/mifth_pipe.otllc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mifth/mifthtools/HEAD/houdini/otls/modeling/mifth_pipe.otllc
--------------------------------------------------------------------------------
/houdini/otls/modeling/mira_tree.otllc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mifth/mifthtools/HEAD/houdini/otls/modeling/mira_tree.otllc
--------------------------------------------------------------------------------
/houdini/otls/other/checker2_sop.hdalc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mifth/mifthtools/HEAD/houdini/otls/other/checker2_sop.hdalc
--------------------------------------------------------------------------------
/houdini/pk/otls/pk_image_plane.hdalc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mifth/mifthtools/HEAD/houdini/pk/otls/pk_image_plane.hdalc
--------------------------------------------------------------------------------
/houdini/otls/modeling/mifth_strap.otllc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mifth/mifthtools/HEAD/houdini/otls/modeling/mifth_strap.otllc
--------------------------------------------------------------------------------
/houdini/otls/other/simple_reguide.otllc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mifth/mifthtools/HEAD/houdini/otls/other/simple_reguide.otllc
--------------------------------------------------------------------------------
/houdini/otls/modeling/mifth_bend_plus.otllc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mifth/mifthtools/HEAD/houdini/otls/modeling/mifth_bend_plus.otllc
--------------------------------------------------------------------------------
/houdini/otls/modeling/mifth_capsule.otllc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mifth/mifthtools/HEAD/houdini/otls/modeling/mifth_capsule.otllc
--------------------------------------------------------------------------------
/houdini/otls/modeling/mifth_make_arc.otllc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mifth/mifthtools/HEAD/houdini/otls/modeling/mifth_make_arc.otllc
--------------------------------------------------------------------------------
/houdini/otls/modeling/mifth_move_flow.otllc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mifth/mifthtools/HEAD/houdini/otls/modeling/mifth_move_flow.otllc
--------------------------------------------------------------------------------
/houdini/otls/modeling/mifth_soft_push.otllc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mifth/mifthtools/HEAD/houdini/otls/modeling/mifth_soft_push.otllc
--------------------------------------------------------------------------------
/houdini/otls/modeling/mifth_unbevel.otllc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mifth/mifthtools/HEAD/houdini/otls/modeling/mifth_unbevel.otllc
--------------------------------------------------------------------------------
/houdini/otls/modeling/mifth_uv_center.otllc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mifth/mifthtools/HEAD/houdini/otls/modeling/mifth_uv_center.otllc
--------------------------------------------------------------------------------
/houdini/otls/modeling/mifth_uv_grid.otllc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mifth/mifthtools/HEAD/houdini/otls/modeling/mifth_uv_grid.otllc
--------------------------------------------------------------------------------
/houdini/otls/modeling/mifth_uv_wrap.otllc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mifth/mifthtools/HEAD/houdini/otls/modeling/mifth_uv_wrap.otllc
--------------------------------------------------------------------------------
/houdini/otls/other/group_inverted_uvs.otllc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mifth/mifthtools/HEAD/houdini/otls/other/group_inverted_uvs.otllc
--------------------------------------------------------------------------------
/houdini/otls/other/mifth_simple_goz.otllc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mifth/mifthtools/HEAD/houdini/otls/other/mifth_simple_goz.otllc
--------------------------------------------------------------------------------
/houdini/otls/modeling/mifth_attrib_ramp.otllc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mifth/mifthtools/HEAD/houdini/otls/modeling/mifth_attrib_ramp.otllc
--------------------------------------------------------------------------------
/houdini/otls/modeling/mifth_copy_curve.otllc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mifth/mifthtools/HEAD/houdini/otls/modeling/mifth_copy_curve.otllc
--------------------------------------------------------------------------------
/houdini/otls/modeling/mifth_copy_meshes.otllc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mifth/mifthtools/HEAD/houdini/otls/modeling/mifth_copy_meshes.otllc
--------------------------------------------------------------------------------
/houdini/otls/modeling/mifth_edgestoface.otllc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mifth/mifthtools/HEAD/houdini/otls/modeling/mifth_edgestoface.otllc
--------------------------------------------------------------------------------
/houdini/otls/modeling/mifth_insert_mesh.otllc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mifth/mifthtools/HEAD/houdini/otls/modeling/mifth_insert_mesh.otllc
--------------------------------------------------------------------------------
/houdini/otls/modeling/mifth_knife_plus.otllc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mifth/mifthtools/HEAD/houdini/otls/modeling/mifth_knife_plus.otllc
--------------------------------------------------------------------------------
/houdini/otls/modeling/mifth_lod_helper.otllc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mifth/mifthtools/HEAD/houdini/otls/modeling/mifth_lod_helper.otllc
--------------------------------------------------------------------------------
/houdini/otls/modeling/mifth_make_circle.otllc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mifth/mifthtools/HEAD/houdini/otls/modeling/mifth_make_circle.otllc
--------------------------------------------------------------------------------
/houdini/otls/modeling/mifth_merge_verts.otllc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mifth/mifthtools/HEAD/houdini/otls/modeling/mifth_merge_verts.otllc
--------------------------------------------------------------------------------
/houdini/otls/modeling/mifth_scale_edges.otllc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mifth/mifthtools/HEAD/houdini/otls/modeling/mifth_scale_edges.otllc
--------------------------------------------------------------------------------
/houdini/otls/modeling/mifth_simple_gear.hdalc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mifth/mifthtools/HEAD/houdini/otls/modeling/mifth_simple_gear.hdalc
--------------------------------------------------------------------------------
/houdini/otls/modeling/mifth_simple_pipe.otllc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mifth/mifthtools/HEAD/houdini/otls/modeling/mifth_simple_pipe.otllc
--------------------------------------------------------------------------------
/houdini/otls/modeling/mifth_symmetrize.otllc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mifth/mifthtools/HEAD/houdini/otls/modeling/mifth_symmetrize.otllc
--------------------------------------------------------------------------------
/houdini/otls/modeling/mifth_unbevel_v2.otllc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mifth/mifthtools/HEAD/houdini/otls/modeling/mifth_unbevel_v2.otllc
--------------------------------------------------------------------------------
/houdini/otls/other/mifth_texel_density.otllc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mifth/mifthtools/HEAD/houdini/otls/other/mifth_texel_density.otllc
--------------------------------------------------------------------------------
/houdini/otls/render/mifth_extract_bake.otllc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mifth/mifthtools/HEAD/houdini/otls/render/mifth_extract_bake.otllc
--------------------------------------------------------------------------------
/houdini/otls/modeling/mifth_curve_length.otllc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mifth/mifthtools/HEAD/houdini/otls/modeling/mifth_curve_length.otllc
--------------------------------------------------------------------------------
/houdini/otls/modeling/mifth_curve_surface.otllc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mifth/mifthtools/HEAD/houdini/otls/modeling/mifth_curve_surface.otllc
--------------------------------------------------------------------------------
/houdini/otls/modeling/mifth_divide_edges.otllc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mifth/mifthtools/HEAD/houdini/otls/modeling/mifth_divide_edges.otllc
--------------------------------------------------------------------------------
/houdini/otls/modeling/mifth_edgeflipflow.otllc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mifth/mifthtools/HEAD/houdini/otls/modeling/mifth_edgeflipflow.otllc
--------------------------------------------------------------------------------
/houdini/otls/modeling/mifth_extract_edges.otllc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mifth/mifthtools/HEAD/houdini/otls/modeling/mifth_extract_edges.otllc
--------------------------------------------------------------------------------
/houdini/otls/modeling/mifth_extrude_point.otllc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mifth/mifthtools/HEAD/houdini/otls/modeling/mifth_extrude_point.otllc
--------------------------------------------------------------------------------
/houdini/otls/modeling/mifth_seams_cheater.otllc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mifth/mifthtools/HEAD/houdini/otls/modeling/mifth_seams_cheater.otllc
--------------------------------------------------------------------------------
/houdini/otls/modeling/mifth_spread_edges.otllc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mifth/mifthtools/HEAD/houdini/otls/modeling/mifth_spread_edges.otllc
--------------------------------------------------------------------------------
/houdini/otls/modeling/mifth_subdive_plus.otllc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mifth/mifthtools/HEAD/houdini/otls/modeling/mifth_subdive_plus.otllc
--------------------------------------------------------------------------------
/houdini/otls/modeling/mifth_uv_layout_plus.otllc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mifth/mifthtools/HEAD/houdini/otls/modeling/mifth_uv_layout_plus.otllc
--------------------------------------------------------------------------------
/houdini/otls/other/mifth_3dcoat_applinker.otllc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mifth/mifthtools/HEAD/houdini/otls/other/mifth_3dcoat_applinker.otllc
--------------------------------------------------------------------------------
/houdini/otls/other/mifth_extract_objects.otllc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mifth/mifthtools/HEAD/houdini/otls/other/mifth_extract_objects.otllc
--------------------------------------------------------------------------------
/blender/animation_nodes/modeling/clone_curve.blend:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mifth/mifthtools/HEAD/blender/animation_nodes/modeling/clone_curve.blend
--------------------------------------------------------------------------------
/houdini/otls/modeling/mifth_extract_edges_2.otllc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mifth/mifthtools/HEAD/houdini/otls/modeling/mifth_extract_edges_2.otllc
--------------------------------------------------------------------------------
/houdini/otls/modeling/mifth_point_to_circle.otllc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mifth/mifthtools/HEAD/houdini/otls/modeling/mifth_point_to_circle.otllc
--------------------------------------------------------------------------------
/houdini/otls/modeling/mifth_round_edge_bevel.otllc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mifth/mifthtools/HEAD/houdini/otls/modeling/mifth_round_edge_bevel.otllc
--------------------------------------------------------------------------------
/houdini/otls/modeling/mifth_round_edges_vdb.otllc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mifth/mifthtools/HEAD/houdini/otls/modeling/mifth_round_edges_vdb.otllc
--------------------------------------------------------------------------------
/houdini/otls/modeling/mifth_uv_pixel_offset.otllc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mifth/mifthtools/HEAD/houdini/otls/modeling/mifth_uv_pixel_offset.otllc
--------------------------------------------------------------------------------
/houdini/otls/modeling/mirror_attribute_good.otllc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mifth/mifthtools/HEAD/houdini/otls/modeling/mirror_attribute_good.otllc
--------------------------------------------------------------------------------
/blender/animation_nodes/modeling/simple_array.blend:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mifth/mifthtools/HEAD/blender/animation_nodes/modeling/simple_array.blend
--------------------------------------------------------------------------------
/houdini/otls/animation/mifth_capture_symmetry.otllc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mifth/mifthtools/HEAD/houdini/otls/animation/mifth_capture_symmetry.otllc
--------------------------------------------------------------------------------
/houdini/otls/modeling/mifth_destructive_extrude.otllc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mifth/mifthtools/HEAD/houdini/otls/modeling/mifth_destructive_extrude.otllc
--------------------------------------------------------------------------------
/houdini/otls/modeling/mifth_edge_collapse_plus.otllc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mifth/mifthtools/HEAD/houdini/otls/modeling/mifth_edge_collapse_plus.otllc
--------------------------------------------------------------------------------
/houdini/otls/modeling/mifth_edit_linear_falloff.otllc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mifth/mifthtools/HEAD/houdini/otls/modeling/mifth_edit_linear_falloff.otllc
--------------------------------------------------------------------------------
/houdini/otls/modeling/mifth_edit_radial_falloff.otllc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mifth/mifthtools/HEAD/houdini/otls/modeling/mifth_edit_radial_falloff.otllc
--------------------------------------------------------------------------------
/houdini/otls/modeling/mifth_symmetry_extrude_v1.otllc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mifth/mifthtools/HEAD/houdini/otls/modeling/mifth_symmetry_extrude_v1.otllc
--------------------------------------------------------------------------------
/houdini/otls/modeling/mifth_symmetry_extrude_v2.otllc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mifth/mifthtools/HEAD/houdini/otls/modeling/mifth_symmetry_extrude_v2.otllc
--------------------------------------------------------------------------------
/houdini/otls/modeling/mifth_attrib_copy_topology.otllc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mifth/mifthtools/HEAD/houdini/otls/modeling/mifth_attrib_copy_topology.otllc
--------------------------------------------------------------------------------
/houdini/otls/modeling/mifth_transform_primitives.otllc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mifth/mifthtools/HEAD/houdini/otls/modeling/mifth_transform_primitives.otllc
--------------------------------------------------------------------------------
/other/exchangers/max/test.ms:
--------------------------------------------------------------------------------
1 | pluginManager.loadClass FBXIMP
2 | FbxImporterSetParam "SmoothingGroups" true
3 | importfile "C:\Users\GeraskinPA\Documents\Exchange\exchange.fbx" #noPrompt using:FBXIMP
4 | rescaleWorldUnits 100 #selOnly
5 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Mifth Tools
2 |
3 | ## Blender
4 |
5 | MiraTools:
6 | http://blenderartists.org/forum/showthread.php?366107-MiraTools
7 | https://github.com/mifth/mifthtools/wiki/Mira-Tools
8 |
9 | MifthTools:
10 | http://blenderartists.org/forum/showthread.php?346588-MifthTools-Addon
11 |
12 | Simple3DCoat Applink:
13 | http://3d-coat.com/forum/index.php?showtopic=15481
14 |
15 | ## Exchangers
16 | http://blenderartists.org/forum/showthread.php?378946-Modo-Blender-Exchanger
17 | http://community.thefoundry.co.uk/discussion/topic.aspx?f=119&t=114220
18 |
--------------------------------------------------------------------------------
/other/exchangers/modo/ex_code/ex_import.py:
--------------------------------------------------------------------------------
1 | # python
2 |
3 | import os
4 | #import modo
5 | import lx
6 |
7 |
8 | # load scene
9 | ex_path = lx.eval('user.value exPath ?').replace("\\", os.sep)
10 | if ex_path.endswith(os.sep) is False:
11 | ex_path += os.sep
12 | ex_path += 'exchange.fbx'
13 | lx.eval('loaderOptions.fbx false true false true true true true true false false true true false true 0')
14 |
15 | if lx.eval('user.value importDialog ?') == 1:
16 | lx.eval('scene.open {%s} import' % ex_path)
17 | else:
18 | lx.eval('!scene.open {%s} import' % ex_path)
--------------------------------------------------------------------------------
/blender/addons/2.8/mira_tools/mi_inputs.py:
--------------------------------------------------------------------------------
1 |
2 | pass_keys = {'NUMPAD_0', 'NUMPAD_1', 'NUMPAD_3', 'NUMPAD_4',
3 | 'NUMPAD_5', 'NUMPAD_6', 'NUMPAD_7', 'NUMPAD_8',
4 | 'NUMPAD_9', 'MIDDLEMOUSE', 'WHEELUPMOUSE', 'WHEELDOWNMOUSE',
5 | 'MOUSEMOVE', 'INBETWEEN_MOUSEMOVE', 'TRACKPADPAN', 'TRACKPADZOOM'}
6 |
7 |
8 | def get_input_pass(pass_keys, key_inputs, event):
9 | if event.type in pass_keys:
10 | return True
11 |
12 | if key_inputs == 'Maya':
13 | if event.type in {'RIGHTMOUSE', 'LEFTMOUSE'} and event.alt and not event.shift and not event.ctrl:
14 | return True
15 |
16 | return False
17 |
--------------------------------------------------------------------------------
/blender/addons/2.8/mira_tools/mi_color_manager.py:
--------------------------------------------------------------------------------
1 | from bpy.props import *
2 | # import math
3 | # import mathutils as mathu
4 | # import random
5 | # from mathutils import Vector
6 |
7 |
8 | # Curve Colors
9 | cur_point_base = (0.5, 0.8, 1.0, 1.0)
10 | cur_point_selected = (0.9, 0.5, 0.1, 1.0)
11 | cur_point_active = (0.9, 0.7, 0.3, 1.0)
12 |
13 | cur_point_closed_start = (0.7, 0.4, 0.9, 1.0)
14 | cur_point_closed_end = (0.3, 0.4, 0.9, 1.0)
15 |
16 | cur_line_base = (0.5, 0.8, 0.9, 1.0)
17 |
18 | cur_handle_1_base = (0.0, 0.5, 1.0, 1.0)
19 | cur_handle_2_base = (1.0, 0.5, 0.0, 1.0)
20 |
21 |
22 | # Draw Extrude Colors
23 | dre_point_base = (0.5, 0.8, 1.0, 1.0)
24 |
25 | # PolyLoop colors
26 | pl_point_col = (0.95, 0.7, 1.0, 1.0)
--------------------------------------------------------------------------------
/nuke/gizmos/checker_view.gizmo:
--------------------------------------------------------------------------------
1 | #! /home/mifth/Documents/soft/Nuke/libnuke-9.0.6.so -nx
2 | version 9.0 v6
3 | Gizmo {
4 | name VIEWER_INPUT
5 | }
6 | CheckerBoard2 {
7 | inputs 0
8 | format "4096 3112 0 0 4096 3112 1 4K_Super_35(full-ap)"
9 | boxsize 24
10 | centerlinewidth 0
11 | name CheckerBoard1
12 | xpos 189
13 | ypos -230
14 | }
15 | Crop {
16 | box {0 0 2048 1556}
17 | reformat true
18 | crop false
19 | name Crop1
20 | xpos 189
21 | ypos -120
22 | }
23 | Input {
24 | inputs 0
25 | name Input1
26 | xpos -52
27 | ypos -201
28 | }
29 | Merge2 {
30 | inputs 2
31 | operation under
32 | name Merge1
33 | xpos 123
34 | ypos 19
35 | }
36 | Output {
37 | name Output1
38 | xpos 218
39 | ypos 78
40 | }
41 | Reformat {
42 | inputs 0
43 | type "to box"
44 | box_width {{Input1.width x20 20148}}
45 | box_height {{Input1.height}}
46 | box_fixed true
47 | filter Impulse
48 | name Reformat1
49 | xpos 62
50 | ypos -203
51 | disable true
52 | }
53 | end_group
54 |
--------------------------------------------------------------------------------
/other/exchangers/modo/ex_code/ex_export.py:
--------------------------------------------------------------------------------
1 | # python
2 |
3 | import lx
4 | #import modo
5 | import os
6 |
7 |
8 | export_type_old = lx.eval('user.value sceneio.fbx.save.exportType ?')
9 | sample_type_old = lx.eval('user.value sceneio.fbx.save.sampleAnimation ?')
10 | save_type_old = lx.eval('user.value sceneio.fbx.save.animation ?')
11 |
12 | # change scene type
13 | lx.eval('user.value sceneio.fbx.save.exportType FBXExportSelectionWithHierarchy')
14 | lx.eval('user.value sceneio.fbx.save.sampleAnimation true')
15 | lx.eval('user.value sceneio.fbx.save.animation true')
16 |
17 | # save scene
18 | exp_path = lx.eval('user.value exPath ?').replace("\\", os.sep)
19 | if exp_path.endswith(os.sep) is False:
20 | exp_path += os.sep
21 | exp_path += 'exchange.fbx'
22 | lx.eval('scene.saveAs {%s} fbx true' % exp_path)
23 |
24 | # revert scene type
25 | lx.eval('user.value sceneio.fbx.save.exportType %s' % export_type_old)
26 | lx.eval('user.value sceneio.fbx.save.animation %s' % save_type_old)
27 | lx.eval('user.value sceneio.fbx.save.sampleAnimation %s' % sample_type_old)
--------------------------------------------------------------------------------
/blender/addons/2.8/mira_tools/mi_widget_curve.py:
--------------------------------------------------------------------------------
1 | import gpu
2 | from gpu_extras.batch import batch_for_shader
3 |
4 | import bpy
5 | from bpy.props import *
6 |
7 | from . import mi_utils_base as ut_base
8 |
9 |
10 | shader3d = gpu.shader.from_builtin('POINT_UNIFORM_COLOR' if bpy.app.version >= (4, 5, 0) else 'UNIFORM_COLOR')
11 | shader2d = gpu.shader.from_builtin('POINT_UNIFORM_COLOR' if bpy.app.version >= (4, 5, 0) else 'UNIFORM_COLOR')
12 |
13 |
14 | def draw_2d_point(point_x, point_y, p_size=4, p_col=(1.0,1.0,1.0,1.0)):
15 | gpu.state.point_size_set(p_size)
16 |
17 | coords = ((point_x, point_y), (point_x, point_y))
18 | batch = batch_for_shader(shader2d, 'POINTS', {"pos": coords})
19 | shader2d.bind()
20 | shader2d.uniform_float("color", (p_col[0], p_col[1], p_col[2], p_col[3]))
21 | batch.draw(shader2d)
22 |
23 |
24 | def draw_3d_polyline(points, p_size, l_size, p_col, x_ray):
25 |
26 | gpu.state.line_width_set(l_size)
27 |
28 | coords = [(point[0], point[1], point[2]) for point in points]
29 | batch = batch_for_shader(shader3d, 'LINE_STRIP', {"pos": coords})
30 | shader3d.bind()
31 | shader3d.uniform_float("color", (p_col[0], p_col[1], p_col[2], p_col[3]))
32 | batch.draw(shader3d)
33 |
34 |
--------------------------------------------------------------------------------
/blender/addons/2.7/mira_tools/mi_inputs.py:
--------------------------------------------------------------------------------
1 |
2 | # ***** BEGIN GPL LICENSE BLOCK *****
3 | #
4 | #
5 | # This program is free software; you can redistribute it and/or
6 | # modify it under the terms of the GNU General Public License
7 | # as published by the Free Software Foundation; either version 2
8 | # of the License, or (at your option) any later version.
9 | #
10 | # This program is distributed in the hope that it will be useful,
11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | # GNU General Public License for more details.
14 | #
15 | # You should have received a copy of the GNU General Public License
16 | # along with this program; if not, write to the Free Software Foundation,
17 | # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 | #
19 | # ***** END GPL LICENCE BLOCK *****
20 |
21 | import bpy
22 |
23 |
24 | pass_keys = ['NUMPAD_0', 'NUMPAD_1', 'NUMPAD_3', 'NUMPAD_4',
25 | 'NUMPAD_5', 'NUMPAD_6', 'NUMPAD_7', 'NUMPAD_8',
26 | 'NUMPAD_9', 'MIDDLEMOUSE', 'WHEELUPMOUSE', 'WHEELDOWNMOUSE',
27 | 'MOUSEMOVE']
28 |
29 |
30 | def get_input_pass(pass_keys, key_inputs, event):
31 | if event.type in pass_keys:
32 | return True
33 |
34 | if key_inputs == 'Maya':
35 | if event.type in {'RIGHTMOUSE', 'LEFTMOUSE'} and event.alt and not event.shift and not event.ctrl:
36 | return True
37 |
38 | return False
39 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) 2014, mifth
2 | All rights reserved.
3 |
4 | Redistribution and use in source and binary forms, with or without
5 | modification, are permitted provided that the following conditions are met:
6 |
7 | * Redistributions of source code must retain the above copyright notice, this
8 | list of conditions and the following disclaimer.
9 |
10 | * Redistributions in binary form must reproduce the above copyright notice,
11 | this list of conditions and the following disclaimer in the documentation
12 | and/or other materials provided with the distribution.
13 |
14 | * Neither the name of mifthtools nor the names of its
15 | contributors may be used to endorse or promote products derived from
16 | this software without specific prior written permission.
17 |
18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
22 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 |
29 |
--------------------------------------------------------------------------------
/blender/addons/2.7/mira_tools/mi_color_manager.py:
--------------------------------------------------------------------------------
1 | # ***** BEGIN GPL LICENSE BLOCK *****
2 | #
3 | #
4 | # This program is free software; you can redistribute it and/or
5 | # modify it under the terms of the GNU General Public License
6 | # as published by the Free Software Foundation; either version 2
7 | # of the License, or (at your option) any later version.
8 | #
9 | # This program is distributed in the hope that it will be useful,
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | # GNU General Public License for more details.
13 | #
14 | # You should have received a copy of the GNU General Public License
15 | # along with this program; if not, write to the Free Software Foundation,
16 | # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 | #
18 | # ***** END GPL LICENCE BLOCK *****
19 |
20 | import bpy
21 | import bgl
22 | import blf
23 |
24 | from bpy.props import *
25 | import math
26 | import mathutils as mathu
27 | import random
28 | from mathutils import Vector
29 |
30 |
31 | # Curve Colors
32 | cur_point_base = (0.5, 0.8, 1.0, 1.0)
33 | cur_point_selected = (0.9, 0.5, 0.1, 1.0)
34 | cur_point_active = (0.9, 0.7, 0.3, 1.0)
35 |
36 | cur_point_closed_start = (0.7, 0.4, 0.9, 1.0)
37 | cur_point_closed_end = (0.3, 0.4, 0.9, 1.0)
38 |
39 | cur_line_base = (0.5, 0.8, 0.9, 1.0)
40 |
41 | cur_handle_1_base = (0.0, 0.5, 1.0, 1.0)
42 | cur_handle_2_base = (1.0, 0.5, 0.0, 1.0)
43 |
44 |
45 | # Draw Extrude Colors
46 | dre_point_base = (0.5, 0.8, 1.0, 1.0)
47 |
48 | # PolyLoop colors
49 | pl_point_col = (0.95, 0.7, 1.0, 1.0)
--------------------------------------------------------------------------------
/blender/addons/2.7/paint_clones/README.md:
--------------------------------------------------------------------------------
1 | # Blender Paintclones
2 |
3 | *A tool to paint many clones over selected object(s).*
4 |
5 | ## Usage
6 | - In 3d view, find and unfold Paint Clones panel in the Tools panel (bottom)
7 | - Select object(s) to clone
8 | - Push "Pick source(s)"
9 | - Select target object(s)
10 | - Push "Paint Clones"
11 | - Draw your clones on target object(s) with left mouse button pressed
12 | - Right click (or esc) to stop painting
13 |
14 | When many objects are selected as sources for clones, the tool randomly clone objects from this list
15 |
16 |
17 | ## Options
18 |
19 | ### Optimize
20 |
21 | link clones data to source
22 |
23 |
24 | ### Align modes
25 |
26 | *align your clones main axis to follow this direction*
27 |
28 | - Target normal (perpendicular to surface).
29 | - Fixed axis (x y or z).
30 | - Follow stroke direction.
31 |
32 |
33 | ### Axis
34 |
35 | The main source axis for align direction
36 |
37 |
38 | ### Up Axis
39 |
40 | The axis of your source for secondary direction (up)
41 |
42 | - target normal when align is in Follow stroke mode
43 | - stroke direction otherwhise
44 |
45 |
46 | ### Randomize
47 |
48 | Randomize rotation and scale (scale down only)
49 |
50 |
51 | ### Spacing
52 |
53 | How many space is left between two clones
54 |
55 |
56 | ### Scatter
57 |
58 | Scatter clones arround stroke
59 |
60 | ### Grouping
61 |
62 | *you may want to group clones*
63 |
64 | - Use source group
65 | - Add to group (pick the group to add clones)
66 | - Create group (give the name of your new group)
67 |
68 |
69 | ### Pressure
70 |
71 | Options to change params according input device pressure
72 |
--------------------------------------------------------------------------------
/other/exchangers/modo/exchanger_config.CFG:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Ex
6 | mifth
7 |
8 | 49.50.53
9 |
10 |
11 | Export
12 | Export to other apps
13 | 0
14 |
15 |
16 | Import
17 | Import to other apps
18 | 0
19 |
20 |
21 | Path
22 | Exchange Path...
23 | Exchange Path.
24 | 0
25 |
26 |
27 | Import
28 | Show Import Dialog...
29 | Show Import Dialog.
30 | 0
31 |
32 |
33 |
34 |
35 |
36 |
37 | string
38 |
39 |
40 | boolean
41 |
42 |
43 |
44 |
--------------------------------------------------------------------------------
/blender/addons/2.8/io_simple_3dcoat/__init__.py:
--------------------------------------------------------------------------------
1 | # BEGIN GPL LICENSE BLOCK #####
2 | #
3 | # This program is free software; you can redistribute it and/or
4 | # modify it under the terms of the GNU General Public License
5 | # as published by the Free Software Foundation; either version 2
6 | # of the License, or (at your option) any later version.
7 | #
8 | # This program is distributed in the hope that it will be useful,
9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | # GNU General Public License for more details.
12 | #
13 | # You should have received a copy of the GNU General Public License
14 | # along with this program; if not, write to the Free Software Foundation,
15 | # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16 | #
17 | # END GPL LICENSE BLOCK #####
18 |
19 | bl_info = {
20 | "name": "Simple 3D-Coat Applink",
21 | "author": "Kalle-Samuli Riihikoski (haikalle), Mifth",
22 | "version": (0, 4, 0),
23 | "blender": (2, 93, 0),
24 | "location": "3D Viewport",
25 | "description": "Transfer data between 3D-Coat/Blender",
26 | "warning": "",
27 | "wiki_url": "https://3dcoat.com/forum/index.php?/topic/15481-blender-28-applink-simple3dcoat-fork-of-the-official/",
28 | "tracker_url": "",
29 | "category": "Import-Export"}
30 |
31 | from . import simple_coat
32 |
33 | import bpy
34 | from bpy.props import *
35 |
36 | classes = (
37 | simple_coat,
38 | )
39 |
40 |
41 | def register():
42 |
43 | for cls in classes:
44 | cls.register()
45 |
46 |
47 | def unregister():
48 | for cls in classes:
49 | cls.unregister()
50 |
51 |
52 | if __name__ == "__main__":
53 | register()
54 |
--------------------------------------------------------------------------------
/blender/addons/2.8/df_tools/__init__.py:
--------------------------------------------------------------------------------
1 | # ##### BEGIN GPL LICENSE BLOCK #####
2 | #
3 | # This program is free software; you can redistribute it and/or
4 | # modify it under the terms of the GNU General Public License
5 | # as published by the Free Software Foundation; either version 2
6 | # of the License, or (at your option) any later version.
7 | #
8 | # This program is distributed in the hope that it will be useful,
9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | # GNU General Public License for more details.
12 | #
13 | # You should have received a copy of the GNU General Public License
14 | # along with this program; if not, write to the Free Software Foundation,
15 | # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16 | #
17 | # ##### END GPL LICENSE BLOCK #####
18 |
19 | #
20 |
21 | bl_info = {
22 | "name": "DF Tools",
23 | "author": "DF Tools",
24 | "version": (1, 0, 0),
25 | "blender": (2, 80, 0),
26 | "location": "3D Vieport",
27 | "description": "DF Tools",
28 | "warning": "",
29 | "wiki_url": "",
30 | "category": "Mesh"}
31 |
32 |
33 | if "bpy" in locals():
34 | importlib.reload(df_objects)
35 |
36 | else:
37 | from . import df_objects
38 |
39 | import bpy
40 | from bpy.props import (
41 | BoolProperty,
42 | FloatProperty,
43 | StringProperty,
44 | EnumProperty,
45 | )
46 |
47 |
48 |
49 | classes = (
50 | df_objects.DFCopyOBJ,
51 | )
52 |
53 |
54 | def register():
55 | for cls in classes:
56 | bpy.utils.register_class(cls)
57 |
58 |
59 |
60 | def unregister():
61 | for cls in classes:
62 | bpy.utils.unregister_class(cls)
63 |
64 |
65 | if __name__ == "__main__":
66 | register()
67 |
--------------------------------------------------------------------------------
/blender/addons/2.8/mira_tools/mi_settings.py:
--------------------------------------------------------------------------------
1 | import bpy
2 |
3 | from bpy.props import *
4 | from bpy.types import Operator, AddonPreferences, PropertyGroup
5 |
6 |
7 | class MI_Addon_Settings(AddonPreferences):
8 | bl_idname = __package__
9 |
10 | key_inputs: EnumProperty(
11 | name = "Key Inputs Style",
12 | items = (('Blender', 'Blender', ''),
13 | ('Maya', 'Maya', '')
14 | ),
15 | default = 'Blender'
16 | )
17 |
18 | point_size: IntProperty( default = 6, min = 1)
19 | line_size: IntProperty( default = 1, min = 1)
20 | select_point_radius: FloatProperty( default = 9.0, min = 3.0)
21 |
22 | def draw(self, context):
23 | layout = self.layout
24 | #row = layout.row()
25 | #row.prop(self, "sg_icons_style")
26 | layout.prop(self, "key_inputs")
27 | layout.prop(self, "point_size")
28 | layout.prop(self, "line_size")
29 | layout.prop(self, "select_point_radius")
30 |
31 |
32 | class MI_Settings(PropertyGroup):
33 | # For all tools
34 | surface_snap: BoolProperty(default=False)
35 | snap_objects: EnumProperty(
36 | name = "Objects To Snap",
37 | items = (('Selected', 'Selected', ''),
38 | ('Visible', 'Visible', '')
39 | ),
40 | default = 'Visible'
41 | )
42 |
43 | convert_instances: BoolProperty(default=False) # This feat converts off duplis and group instances into meshes
44 | snap_points: BoolProperty(default=True) # This feat snaps points for CurveSurfaces and CurveStretch
45 |
46 | # Curve Settings
47 | curve_resolution: IntProperty(default=13, min=1, max=128)
48 | draw_handlers: BoolProperty(default=False)
49 |
50 | spread_mode: EnumProperty(
51 | name = "Spread Mode",
52 | items = (('Original', 'Original', ''),
53 | ('Uniform', 'Uniform', '')
54 | ),
55 | default = 'Original'
56 | )
57 |
--------------------------------------------------------------------------------
/blender/addons/2.7/mira_tools/mi_settings.py:
--------------------------------------------------------------------------------
1 | # ***** BEGIN GPL LICENSE BLOCK *****
2 | #
3 | #
4 | # This program is free software; you can redistribute it and/or
5 | # modify it under the terms of the GNU General Public License
6 | # as published by the Free Software Foundation; either version 2
7 | # of the License, or (at your option) any later version.
8 | #
9 | # This program is distributed in the hope that it will be useful,
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | # GNU General Public License for more details.
13 | #
14 | # You should have received a copy of the GNU General Public License
15 | # along with this program; if not, write to the Free Software Foundation,
16 | # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 | #
18 | # ***** END GPL LICENCE BLOCK *****
19 |
20 | import bpy
21 |
22 | from bpy.props import *
23 | from bpy.types import Operator, AddonPreferences, PropertyGroup
24 |
25 |
26 | class MI_Addon_Settings(AddonPreferences):
27 | bl_idname = __package__
28 |
29 | key_inputs = EnumProperty(
30 | name = "Key Inputs Style",
31 | items = (('Blender', 'Blender', ''),
32 | ('Maya', 'Maya', '')
33 | ),
34 | default = 'Blender'
35 | )
36 |
37 | def draw(self, context):
38 | layout = self.layout
39 | #row = layout.row()
40 | #row.prop(self, "sg_icons_style")
41 | layout.prop(self, "key_inputs")
42 |
43 |
44 | class MI_Settings(PropertyGroup):
45 | # For all tools
46 | surface_snap = BoolProperty(default=False)
47 | snap_objects = EnumProperty(
48 | name = "Objects To Snap",
49 | items = (('Selected', 'Selected', ''),
50 | ('Visible', 'Visible', '')
51 | ),
52 | default = 'Visible'
53 | )
54 | convert_instances = BoolProperty(default=False) # This feat converts off duplis and group instances into meshes
55 |
56 | # Curve Settings
57 | curve_resolution = IntProperty(default=13, min=1, max=128)
58 | draw_handlers = BoolProperty(default=False)
59 |
60 | spread_mode = EnumProperty(
61 | name = "Spread Mode",
62 | items = (('Original', 'Original', ''),
63 | ('Uniform', 'Uniform', '')
64 | ),
65 | default = 'Original'
66 | )
--------------------------------------------------------------------------------
/other/exchangers/blender/2.7/blender_exchanger/__init__.py:
--------------------------------------------------------------------------------
1 | # BEGIN GPL LICENSE BLOCK #####
2 | #
3 | # This program is free software; you can redistribute it and/or
4 | # modify it under the terms of the GNU General Public License
5 | # as published by the Free Software Foundation; either version 2
6 | # of the License, or (at your option) any later version.
7 | #
8 | # This program is distributed in the hope that it will be useful,
9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | # GNU General Public License for more details.
12 | #
13 | # You should have received a copy of the GNU General Public License
14 | # along with this program; if not, write to the Free Software Foundation,
15 | # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16 | #
17 | # END GPL LICENSE BLOCK #####
18 |
19 | bl_info = {
20 | "name": "Blender Exchanger",
21 | "author": "Paul Geraskin",
22 | "version": (0, 1, 0),
23 | "blender": (2, 75, 0),
24 | "location": "View3D > Ex",
25 | "description": "Transfer data between Blender and other packages",
26 | "warning": "",
27 | "wiki_url": "",
28 | "tracker_url": "",
29 | "category": "Import-Export"}
30 |
31 |
32 | if "bpy" in locals():
33 | import imp
34 | imp.reload(blender_exchanger)
35 | else:
36 | from . import blender_exchanger
37 |
38 |
39 | import bpy
40 | from bpy.props import *
41 |
42 |
43 | def register():
44 |
45 | class EX_Settings(bpy.types.PropertyGroup):
46 |
47 | doApplyModifiers = BoolProperty(
48 | name="Apply Modifiers",
49 | description="Apply Modifiers...",
50 | default=True
51 | )
52 |
53 | exportMaterials = BoolProperty(
54 | name="Export Materials",
55 | description="Export Materials...",
56 | default=True
57 | )
58 |
59 | importNormals = BoolProperty(
60 | name="Import Normals",
61 | description="Import Normals...",
62 | default=False
63 | )
64 |
65 | bpy.utils.register_module(__name__)
66 |
67 | bpy.types.Scene.b_exchanger = PointerProperty(
68 | name="Applink Variables",
69 | type=EX_Settings,
70 | description="Applink variables"
71 | )
72 |
73 |
74 | def unregister():
75 | import bpy
76 |
77 | del bpy.types.Scene.b_exchanger
78 | bpy.utils.unregister_module(__name__)
79 |
80 |
81 | if __name__ == "__main__":
82 | register()
83 |
--------------------------------------------------------------------------------
/blender/addons/2.8/df_tools/df_objects.py:
--------------------------------------------------------------------------------
1 | import bpy
2 | import bmesh
3 |
4 | from bpy.props import *
5 | from bpy.types import Operator
6 |
7 | import math
8 | import mathutils as mathu
9 | from mathutils import Vector, Matrix
10 |
11 | class DFCopyOBJ(bpy.types.Operator):
12 | bl_idname = "df.copy_obj"
13 | bl_label = "Clone Objects to Verts"
14 | bl_description = "Clone Objects to Verts"
15 | bl_options = {'REGISTER', 'UNDO'}
16 |
17 |
18 | def execute(self, context):
19 |
20 | get_obj = context.active_object
21 | if context.selected_objects[0] is get_obj:
22 | copy_obj = context.selected_objects[1]
23 | else:
24 | copy_obj = context.selected_objects[0]
25 |
26 | bm = bmesh.from_edit_mesh(get_obj.data)
27 | bm.verts.ensure_lookup_table()
28 |
29 | v_indexes = []
30 | if isinstance(bm.select_history[0], bmesh.types.BMVert):
31 | for element in bm.select_history:
32 | v_indexes.append(element.index)
33 |
34 | bpy.ops.object.editmode_toggle()
35 | bpy.ops.object.select_all(action='DESELECT')
36 |
37 | for idx in range(int(len(v_indexes) / 3)):
38 |
39 | true_idx = idx * 3
40 |
41 | v1 = get_obj.matrix_world @ get_obj.data.vertices[v_indexes[true_idx]].co.copy()
42 | v2 = get_obj.matrix_world @ get_obj.data.vertices[v_indexes[true_idx + 1]].co.copy()
43 | v3 = get_obj.matrix_world @ get_obj.data.vertices[v_indexes[true_idx + 2]].co.copy()
44 |
45 | dir1 = (v1 - v2).normalized()
46 | dir2 = dir1.cross(((v3 - v2).normalized())).normalized()
47 | dir2.negate()
48 | dir3 = dir1.cross(dir2).normalized()
49 |
50 | # clone obj
51 | copy_obj.select_set(True)
52 | bpy.ops.object.duplicate(linked=True)
53 | new_obj = context.selected_objects[0]
54 |
55 | new_mat = mathu.Matrix().to_3x3()
56 | new_mat[0][0], new_mat[1][0], new_mat[2][0] = dir1[0], dir1[1], dir1[2]
57 | new_mat[0][1], new_mat[1][1], new_mat[2][1] = dir2[0], dir2[1], dir2[2]
58 | new_mat[0][2], new_mat[1][2], new_mat[2][2] = dir3[0], dir3[1], dir3[2]
59 | #new_mat = new_mat.normalized()
60 |
61 | new_obj.matrix_world = new_mat.to_4x4()
62 | new_obj.location = v2.copy()
63 | new_obj.scale = copy_obj.scale.copy()
64 |
65 | bpy.ops.object.select_all(action='DESELECT')
66 |
67 | return {'FINISHED'}
68 |
--------------------------------------------------------------------------------
/blender/addons/2.7/mira_tools/mi_widget_curve.py:
--------------------------------------------------------------------------------
1 | # ***** BEGIN GPL LICENSE BLOCK *****
2 | #
3 | #
4 | # This program is free software; you can redistribute it and/or
5 | # modify it under the terms of the GNU General Public License
6 | # as published by the Free Software Foundation; either version 2
7 | # of the License, or (at your option) any later version.
8 | #
9 | # This program is distributed in the hope that it will be useful,
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | # GNU General Public License for more details.
13 | #
14 | # You should have received a copy of the GNU General Public License
15 | # along with this program; if not, write to the Free Software Foundation,
16 | # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 | #
18 | # ***** END GPL LICENCE BLOCK *****
19 |
20 | import bpy
21 | import bgl
22 | import blf
23 | import string
24 |
25 | from bpy.props import *
26 | from bpy.types import Operator, AddonPreferences
27 |
28 | from bpy_extras import view3d_utils
29 |
30 | import math
31 | import mathutils as mathu
32 | import random
33 | from mathutils import Vector
34 |
35 | from . import mi_utils_base as ut_base
36 |
37 |
38 | def draw_2d_point(point_x, point_y, p_size=4, p_col=(1.0,1.0,1.0,1.0)):
39 | bgl.glEnable(bgl.GL_BLEND)
40 | #bgl.glColor4f(1.0, 1.0, 1.0, 0.5)
41 | #bgl.glLineWidth(2)
42 |
43 | bgl.glPointSize(p_size)
44 | # bgl.glBegin(bgl.GL_LINE_LOOP)
45 | bgl.glBegin(bgl.GL_POINTS)
46 | # bgl.glBegin(bgl.GL_POLYGON)
47 | bgl.glColor4f(p_col[0], p_col[1], p_col[2], p_col[3])
48 | bgl.glVertex2f(point_x, point_y)
49 | bgl.glEnd()
50 |
51 | # restore opengl defaults
52 | bgl.glLineWidth(1)
53 | bgl.glDisable(bgl.GL_BLEND)
54 | bgl.glColor4f(0.0, 0.0, 0.0, 1.0)
55 |
56 |
57 | def draw_3d_polyline(points, p_size, p_col, x_ray):
58 | bgl.glEnable(bgl.GL_BLEND)
59 | bgl.glLineWidth(1)
60 |
61 | if x_ray is True:
62 | bgl.glDisable(bgl.GL_DEPTH_TEST)
63 |
64 | bgl.glPointSize(p_size)
65 | # bgl.glBegin(bgl.GL_LINE_LOOP)
66 | bgl.glBegin(bgl.GL_LINE_STRIP)
67 | bgl.glColor4f(p_col[0], p_col[1], p_col[2], p_col[3])
68 | # bgl.glBegin(bgl.GL_POLYGON)
69 |
70 | for point in points:
71 | bgl.glVertex3f(point[0], point[1], point[2])
72 |
73 | if x_ray is True:
74 | bgl.glEnable(bgl.GL_DEPTH_TEST)
75 |
76 | bgl.glEnd()
77 |
78 | # restore opengl defaults
79 | bgl.glLineWidth(1)
80 | bgl.glDisable(bgl.GL_BLEND)
81 | bgl.glColor4f(0.0, 0.0, 0.0, 1.0)
--------------------------------------------------------------------------------
/blender/addons/2.7/super_grouper/__init__.py:
--------------------------------------------------------------------------------
1 | # BEGIN GPL LICENSE BLOCK #####
2 | #
3 | # This program is free software; you can redistribute it and/or
4 | # modify it under the terms of the GNU General Public License
5 | # as published by the Free Software Foundation; either version 2
6 | # of the License, or (at your option) any later version.
7 | #
8 | # This program is distributed in the hope that it will be useful,
9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | # GNU General Public License for more details.
12 | #
13 | # You should have received a copy of the GNU General Public License
14 | # along with this program; if not, write to the Free Software Foundation,
15 | # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16 | #
17 | # END GPL LICENSE BLOCK #####
18 |
19 | bl_info = {
20 | "name": "Super Grouper",
21 | "author": "Paul Geraskin, Aleksey Juravlev, BA Community",
22 | "version": (0, 1, 0),
23 | "blender": (2, 73, 0),
24 | "location": "Toolshelf > Relations Tab",
25 | "warning": "",
26 | "description": "Super Grouper",
27 | "wiki_url": "",
28 | "category": "3D View"}
29 |
30 | if "bpy" in locals():
31 | import imp
32 | imp.reload(grouper_main)
33 | else:
34 | from . import grouper_main
35 |
36 |
37 | import bpy
38 | from bpy.props import *
39 |
40 |
41 | # registration
42 | def menu_func(self, context):
43 | self.layout.separator()
44 | self.layout.menu(grouper_main.SG_Specials_Main_Menu.bl_idname)
45 |
46 |
47 | def register():
48 | bpy.utils.register_module(__name__)
49 |
50 | bpy.types.Scene.super_groups = CollectionProperty(
51 | type=grouper_main.SG_Group)
52 | bpy.types.Object.sg_belong_id = CollectionProperty(
53 | type=grouper_main.SG_Object_Id)
54 | bpy.types.Scene.sg_settings = PointerProperty(
55 | type=grouper_main.SG_Other_Settings)
56 |
57 | # Unused, but this is needed for the TemplateList to work...
58 | bpy.types.Scene.super_groups_index = IntProperty(default=-1)
59 |
60 | bpy.types.VIEW3D_MT_object_specials.append(menu_func)
61 |
62 |
63 | def unregister():
64 | import bpy
65 |
66 | # del bpy.types.Scene.super_grouper
67 | # del bpy.miraTool
68 | del bpy.types.Scene.super_groups
69 | del bpy.types.Object.sg_belong_id
70 | del bpy.types.Scene.sg_settings
71 |
72 | del bpy.types.Scene.super_groups_index
73 |
74 | bpy.types.VIEW3D_MT_object_specials.remove(menu_func)
75 |
76 | bpy.utils.unregister_module(__name__)
77 |
78 |
79 | if __name__ == "__main__":
80 | register()
81 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Byte-compiled / optimized / DLL files
2 | __pycache__/
3 | *.py[cod]
4 | *$py.class
5 |
6 | # C extensions
7 | *.so
8 |
9 | # Distribution / packaging
10 | .Python
11 | build/
12 | develop-eggs/
13 | dist/
14 | downloads/
15 | eggs/
16 | .eggs/
17 | lib/
18 | lib64/
19 | parts/
20 | sdist/
21 | var/
22 | wheels/
23 | pip-wheel-metadata/
24 | share/python-wheels/
25 | *.egg-info/
26 | .installed.cfg
27 | *.egg
28 | MANIFEST
29 |
30 | # PyInstaller
31 | # Usually these files are written by a python script from a template
32 | # before PyInstaller builds the exe, so as to inject date/other infos into it.
33 | *.manifest
34 | *.spec
35 |
36 | # Installer logs
37 | pip-log.txt
38 | pip-delete-this-directory.txt
39 |
40 | # Unit test / coverage reports
41 | htmlcov/
42 | .tox/
43 | .nox/
44 | .coverage
45 | .coverage.*
46 | .cache
47 | nosetests.xml
48 | coverage.xml
49 | *.cover
50 | *.py,cover
51 | .hypothesis/
52 | .pytest_cache/
53 |
54 | # Translations
55 | *.mo
56 | *.pot
57 |
58 | # Django stuff:
59 | *.log
60 | local_settings.py
61 | db.sqlite3
62 | db.sqlite3-journal
63 |
64 | # Flask stuff:
65 | instance/
66 | .webassets-cache
67 |
68 | # Scrapy stuff:
69 | .scrapy
70 |
71 | # Sphinx documentation
72 | docs/_build/
73 |
74 | # PyBuilder
75 | target/
76 |
77 | # Jupyter Notebook
78 | .ipynb_checkpoints
79 |
80 | # IPython
81 | profile_default/
82 | ipython_config.py
83 |
84 | # pyenv
85 | .python-version
86 |
87 | # pipenv
88 | # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
89 | # However, in case of collaboration, if having platform-specific dependencies or dependencies
90 | # having no cross-platform support, pipenv may install dependencies that don't work, or not
91 | # install all needed dependencies.
92 | #Pipfile.lock
93 |
94 | # PEP 582; used by e.g. github.com/David-OConnor/pyflow
95 | __pypackages__/
96 |
97 | # Celery stuff
98 | celerybeat-schedule
99 | celerybeat.pid
100 |
101 | # SageMath parsed files
102 | *.sage.py
103 |
104 | # Environments
105 | .env
106 | .venv
107 | env/
108 | venv/
109 | ENV/
110 | env.bak/
111 | venv.bak/
112 |
113 | # Spyder project settings
114 | .spyderproject
115 | .spyproject
116 |
117 | # Rope project settings
118 | .ropeproject
119 |
120 | # mkdocs documentation
121 | /site
122 |
123 | # mypy
124 | .mypy_cache/
125 | .dmypy.json
126 | dmypy.json
127 |
128 | # Pyre type checker
129 | .pyre/
130 |
131 | #kdevelop
132 | .kdev4
133 | *.kdev4
134 |
135 | #Eclipse Pydev
136 | .project
137 | .pydevproject
138 | .settings
139 |
140 | #Blender
141 | *.blend1
142 |
143 |
--------------------------------------------------------------------------------
/other/exchangers/blender/2.8/blender_exchanger/__init__.py:
--------------------------------------------------------------------------------
1 | # BEGIN GPL LICENSE BLOCK #####
2 | #
3 | # This program is free software; you can redistribute it and/or
4 | # modify it under the terms of the GNU General Public License
5 | # as published by the Free Software Foundation; either version 2
6 | # of the License, or (at your option) any later version.
7 | #
8 | # This program is distributed in the hope that it will be useful,
9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | # GNU General Public License for more details.
12 | #
13 | # You should have received a copy of the GNU General Public License
14 | # along with this program; if not, write to the Free Software Foundation,
15 | # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16 | #
17 | # END GPL LICENSE BLOCK #####
18 |
19 | bl_info = {
20 | "name": "Blender Exchanger",
21 | "author": "Pavel Geraskin",
22 | "version": (0, 1),
23 | "blender": (2, 80, 0),
24 | "location": "3D Viewport",
25 | "description": "Transfer data between Blender and other packages",
26 | "warning": "",
27 | "wiki_url": "",
28 | "support": 'COMMUNITY',
29 | "category": "Object",
30 | }
31 |
32 |
33 | if "bpy" in locals():
34 | import imp
35 | imp.reload(blender_exchanger)
36 | else:
37 | from . import blender_exchanger
38 |
39 |
40 | import bpy
41 | from bpy.props import *
42 |
43 |
44 | class EX_Settings(bpy.types.PropertyGroup):
45 |
46 | doApplyModifiers: BoolProperty(
47 | name="Apply Modifiers",
48 | description="Apply Modifiers...",
49 | default=True
50 | )
51 |
52 | exportMaterials: BoolProperty(
53 | name="Export Materials",
54 | description="Export Materials...",
55 | default=True
56 | )
57 |
58 | importNormals: BoolProperty(
59 | name="Import Normals",
60 | description="Import Normals...",
61 | default=False
62 | )
63 |
64 |
65 | classes = (
66 | blender_exchanger.EX_ExportScene,
67 | blender_exchanger.EX_ImportScene,
68 | blender_exchanger.EX_MainPanel,
69 | blender_exchanger.EX_AddonPreferences,
70 | EX_Settings
71 | )
72 |
73 | def register():
74 | for cls in classes:
75 | bpy.utils.register_class(cls)
76 |
77 | bpy.types.Scene.b_exchanger = PointerProperty(name="Applink Variables", type=EX_Settings, description="Applink variables")
78 |
79 |
80 | def unregister():
81 | import bpy
82 |
83 | for cls in classes:
84 | bpy.utils.unregister_class(cls)
85 |
86 | del bpy.types.Scene.b_exchanger
87 | #bpy.utils.unregister_module(__name__)
88 |
89 |
90 | if __name__ == "__main__":
91 | register()
92 |
--------------------------------------------------------------------------------
/blender/addons/2.8/mira_tools/mi_snap_points.py:
--------------------------------------------------------------------------------
1 | import bpy
2 | import bmesh
3 | import math
4 | from math import *
5 | import mathutils as mathu
6 |
7 | from bpy.props import *
8 | from bpy.types import Operator, AddonPreferences
9 |
10 | from . import mi_utils_base as ut_base
11 | from . import mi_looptools as loop_t
12 | from mathutils import Vector, Matrix
13 |
14 |
15 | class MI_OT_Unbevel(bpy.types.Operator):
16 |
17 | """Draw a line with the mouse"""
18 | bl_idname = "mira.snap_points"
19 | bl_label = "Snap Points"
20 | bl_description = "Snap Points"
21 | bl_options = {'REGISTER', 'UNDO'}
22 |
23 | #reset_values: BoolProperty(default=False)
24 | #unbevel_value: bpy.props.FloatProperty(name="Snap Points", description="Snap Points", default=1000, min=0.0)
25 |
26 | def execute(self, context):
27 |
28 | #if self.reset_values is True:
29 | #self.reset_all_values()
30 |
31 | active_obj = context.active_object
32 |
33 | bm = bmesh.from_edit_mesh(active_obj.data)
34 | bm.verts.ensure_lookup_table()
35 | sel_verts = [v for v in bm.verts if v.select]
36 |
37 | curve_settings = context.scene.mi_settings
38 |
39 | if curve_settings.snap_objects == 'Selected':
40 | objects_array = [obj for obj in context.selected_objects if obj != active_obj and obj.type == 'MESH']
41 | else:
42 | objects_array = [obj for obj in context.visible_objects if obj != active_obj and obj.type == 'MESH']
43 |
44 | # do snapping
45 | if sel_verts and objects_array:
46 | vert_pose_list = {}
47 |
48 | # get nearest positions
49 | for obj in objects_array:
50 | bvh = mathu.bvhtree.BVHTree.FromObject(obj, context.evaluated_depsgraph_get())
51 |
52 | for idx, vert in enumerate(sel_verts):
53 | v_pos = obj.matrix_world.inverted() @ (active_obj.matrix_world @ vert.co)
54 | nearest = bvh.find_nearest(v_pos)
55 |
56 | if nearest and nearest[0]:
57 | v_pos_near = active_obj.matrix_world.inverted() @ (obj.matrix_world @ nearest[0])
58 |
59 | if vert in vert_pose_list.keys():
60 | # if new near position is less
61 | if (vert.co - vert_pose_list[vert]).length > (vert.co - v_pos_near).length:
62 | vert_pose_list[vert] = v_pos_near
63 | else:
64 | vert_pose_list[vert] = v_pos_near
65 |
66 | for vert in sel_verts:
67 | vert.co = vert_pose_list[vert]
68 |
69 | bm.normal_update()
70 | bmesh.update_edit_mesh(active_obj.data)
71 |
72 | return {'FINISHED'}
73 |
--------------------------------------------------------------------------------
/blender/addons/2.8/mira_tools/mi_widget_select.py:
--------------------------------------------------------------------------------
1 | import bpy
2 | from bpy.props import *
3 | from bpy.types import Operator, AddonPreferences
4 |
5 | import gpu
6 | from gpu_extras import presets
7 | from gpu_extras.batch import batch_for_shader
8 |
9 |
10 | shader3d = gpu.shader.from_builtin('POINT_UNIFORM_COLOR' if bpy.app.version >= (4, 5, 0) else 'UNIFORM_COLOR')
11 | shader2d = gpu.shader.from_builtin('POINT_UNIFORM_COLOR' if bpy.app.version >= (4, 5, 0) else 'UNIFORM_COLOR')
12 |
13 |
14 | def draw_circle_select(m_coords, radius = 16, p_col = (0.7,0.8,1.0,0.6), enabled = False, sub = False):
15 | if(enabled):
16 | f_col = p_col
17 |
18 | if sub:
19 | f_col = (1.0, 0.5, 0.4, 0.6)
20 |
21 | gpu.state.line_width_set(1)
22 |
23 | radius = int(radius)
24 |
25 | presets.draw_circle_2d(m_coords, (f_col[0], f_col[1], f_col[2], f_col[3]), radius, segments=64)
26 |
27 |
28 | def draw_box_select(anchor, m_coords, region, p_col = (0.7,0.8,1.0,0.6), enabled = False, dragging = False, sub = False):
29 |
30 | if enabled:
31 | f_col = p_col
32 | if sub:
33 | f_col = (1.0, 0.5, 0.4, 0.6)
34 |
35 | point_x = m_coords[0]
36 | point_y = m_coords[1]
37 |
38 | coords = []
39 |
40 | coords.append( (point_x, 0) )
41 | coords.append( (point_x, region.height) )
42 |
43 | coords.append( (0, point_y) )
44 | coords.append( (region.width, point_y) )
45 |
46 | gpu.state.line_width_set(1)
47 |
48 | batch = batch_for_shader(shader2d, 'LINES', {"pos": coords})
49 | shader2d.bind()
50 | shader2d.uniform_float("color", (f_col[0], f_col[1], f_col[2], f_col[3]))
51 | batch.draw(shader2d)
52 |
53 |
54 | if dragging:
55 | point_x = m_coords[0]
56 | point_y = m_coords[1]
57 |
58 | anc_x = anchor[0]
59 | anc_y = anchor[1]
60 |
61 | coords_2 = []
62 |
63 | coords_2.append( (anc_x, anc_y) )
64 | coords_2.append( (point_x, anc_y) )
65 | coords_2.append( (point_x, point_y) )
66 | coords_2.append( (anc_x, point_y) )
67 |
68 | batch = batch_for_shader(shader2d, 'LINE_LOOP', {"pos": coords_2})
69 | shader2d.bind()
70 | shader2d.uniform_float("color", (f_col[0], f_col[1], f_col[2], f_col[3]))
71 | batch.draw(shader2d)
72 |
73 | coords_3 = []
74 |
75 | coords_3.append( (anc_x, anc_y) )
76 | coords_3.append( (point_x, anc_y) )
77 | coords_3.append( (point_x, point_y) )
78 | coords_3.append( (anc_x, point_y) )
79 |
80 | batch = batch_for_shader(shader2d, 'LINE_STRIP', {"pos": coords_3})
81 | shader2d.bind()
82 | shader2d.uniform_float("color", (f_col[0], f_col[1], f_col[2], f_col[3]))
83 | batch.draw(shader2d)
84 |
--------------------------------------------------------------------------------
/blender/addons/2.8/mira_tools/mi_noise.py:
--------------------------------------------------------------------------------
1 | import bpy
2 | import blf
3 | import string
4 | import bmesh
5 |
6 | from bpy.props import *
7 | from bpy.types import Operator, AddonPreferences
8 |
9 | from bpy_extras import view3d_utils
10 |
11 | import math
12 | import mathutils as mathu
13 | import random
14 | from mathutils import Vector
15 |
16 | from . import mi_utils_base as ut_base
17 |
18 |
19 | class MI_OT_Noise(bpy.types.Operator):
20 | bl_idname = "mira.noise"
21 | bl_label = "Noise"
22 | bl_description = "Noise"
23 | bl_options = {'REGISTER', 'UNDO'}
24 |
25 | noise_type: EnumProperty(
26 | items=(('Turbulence', 'Turbulence', ''),
27 | ('Fractal', 'Fractal', ''),
28 | ('HeteroTerrain', 'HeteroTerrain', ''),
29 | ),
30 | default = 'Turbulence'
31 | )
32 |
33 | frequency: FloatProperty(default=1.0, soft_min=0)
34 | intensity: FloatProperty(default=1.0, soft_min=0)
35 | offset_x: FloatProperty(default=0.0)
36 | offset_y: FloatProperty(default=0.0)
37 | offset_z: FloatProperty(default=0.0)
38 | octaves: IntProperty(default=2)
39 | amplitude_scale: FloatProperty(default=0.5, soft_min=0)
40 | frequency_scale: FloatProperty(default=2.0, soft_min=0)
41 | hard: BoolProperty(default=True)
42 |
43 |
44 | def execute(self, context):
45 |
46 | obj = context.active_object
47 | noise_obj(obj, context, self)
48 |
49 | return {'FINISHED'}
50 |
51 | def invoke(self, context, event):
52 | # if context.area.type == 'VIEW_3D':
53 | # change startup
54 | # self.select_mouse_mode = context.preferences.inputs.select_mouse
55 | # context.preferences.inputs.select_mouse = 'RIGHT'
56 |
57 | return self.execute(context)
58 | # else:
59 | # self.report({'WARNING'}, "View3D not found, cannot run operator")
60 | # return {'CANCELLED'}
61 |
62 |
63 | def noise_obj(obj, context, self):
64 | bm = bmesh.from_edit_mesh(obj.data)
65 | verts = [v for v in bm.verts if v.select]
66 | if not verts:
67 | verts = [v for v in bm.verts if v.hide is False]
68 |
69 | for vert in verts:
70 | noise_pos = self.frequency * vert.co.copy()
71 | noise_pos.x += self.offset_x
72 | noise_pos.z += self.offset_y
73 | noise_pos.z += self.offset_z
74 |
75 | noise_val = None
76 | if self.noise_type == 'Turbulence':
77 | noise_val = mathu.noise.turbulence(noise_pos, self.octaves, self.hard, noise_basis="PERLIN_ORIGINAL", amplitude_scale=self.amplitude_scale, frequency_scale=self.frequency_scale)
78 | elif self.noise_type == 'Fractal':
79 | noise_val = mathu.noise.fractal(noise_pos, self.amplitude_scale, self.frequency_scale, self.octaves, noise_basis="PERLIN_ORIGINAL")
80 | else:
81 | noise_val = mathu.noise.hetero_terrain(noise_pos, self.amplitude_scale, self.frequency_scale, self.octaves, 0, noise_basis="PERLIN_ORIGINAL")
82 |
83 | vert_offset = vert.normal.copy().normalized() * noise_val
84 | vert.co += vert_offset * self.intensity
85 |
86 | bm.normal_update()
87 | bmesh.update_edit_mesh(obj.data)
88 |
--------------------------------------------------------------------------------
/blender/addons/2.7/mira_tools/add_mesh_capsule.py:
--------------------------------------------------------------------------------
1 | import bpy
2 | from bpy.types import Operator
3 | from bpy.props import FloatProperty
4 | from bpy.props import IntProperty
5 | from bpy_extras.object_utils import object_data_add
6 | from mathutils import Vector
7 | from math import cos
8 | from math import degrees
9 | from math import radians
10 | from math import sin
11 |
12 | # "The author is David Ludwig. The code was taken from here https://www.youtube.com/watch?v=O-Yhxhjx_VY "
13 |
14 | def add_capsule(length, radius, rings, segments, context):
15 |
16 | topRings = []
17 | bottomRings = []
18 | topCap = []
19 | bottomCap = []
20 |
21 | vertId = 0
22 |
23 | for j in range(0, rings + 1):
24 |
25 | if j == rings:
26 |
27 | topVertex = Vector((0, 0, ((length / 2) + radius)))
28 | bottomVertex = Vector((0, 0, -((length / 2) + radius)))
29 |
30 | topCap.append(topVertex)
31 | bottomCap.append(bottomVertex)
32 | else:
33 |
34 | heightAngle = radians((90 / rings) * (j + 1))
35 |
36 | topRing = []
37 | bottomRing = []
38 |
39 | for i in range(0, segments):
40 |
41 | zAngle = radians((360 / segments) * i)
42 |
43 | x = radius * cos(zAngle) * sin(heightAngle)
44 | y = radius * sin(zAngle) * sin(heightAngle)
45 | z = radius * cos(heightAngle)
46 |
47 | topVertex = Vector((x, y, z + (length / 2)))
48 | bottomVertex = Vector((x, y, -(z + (length / 2))))
49 |
50 | topRing.append(vertId)
51 | bottomRing.append(vertId + ((rings * segments) + 1))
52 | topCap.append(topVertex)
53 | bottomCap.append(bottomVertex)
54 |
55 | vertId += 1
56 |
57 | topRings.append(topRing)
58 | bottomRings.append(bottomRing)
59 |
60 | verts = topCap + bottomCap
61 |
62 | faces = []
63 |
64 | ringIndex = len(topRings) - 1
65 | while ringIndex > 0:
66 |
67 | topRing = topRings[ringIndex]
68 | topNextRing = topRings[ringIndex - 1]
69 |
70 | bottomRing = bottomRings[ringIndex]
71 | bottomNextRing = bottomRings[ringIndex - 1]
72 |
73 | for i in range(0, segments):
74 |
75 | index1 = i
76 | index2 = 0 if i + 1 == segments else i + 1
77 |
78 | topCapFace = [topRing[index1], topRing[index2], topNextRing[index2], topNextRing[index1]]
79 | bottomCapFace = [bottomRing[index2], bottomRing[index1], bottomNextRing[index1], bottomNextRing[index2]]
80 | faces.append(topCapFace)
81 | faces.append(bottomCapFace)
82 |
83 | ringIndex -= 1
84 |
85 | topRing = topRings[rings - 1]
86 | bottomRing = bottomRings[rings - 1]
87 |
88 | topCapRing = topRings[0]
89 | bottomCapRing = bottomRings[0]
90 |
91 | topCapFaces = []
92 | bottomCapFaces = []
93 |
94 | for i in range(0, segments):
95 |
96 | index1 = i
97 | index2 = 0 if i + 1 == segments else i + 1
98 |
99 | bodyFace = [topRing[index2], topRing[index1], bottomRing[index1], bottomRing[index2]]
100 | topCapFace = [topCapRing[index1], topCapRing[index2], rings * segments]
101 | bottomCapFace = [bottomCapRing[index2], bottomCapRing[index1], ((rings * segments) * 2) + 1]
102 |
103 | faces.append(bodyFace)
104 | topCapFaces.append(topCapFace)
105 | bottomCapFaces.append(bottomCapFace)
106 |
107 | faces += topCapFaces + bottomCapFaces
108 |
109 | mesh = bpy.data.meshes.new(name="Capsule")
110 | mesh.from_pydata(verts, [], faces)
111 | mesh.update()
112 |
113 | return object_data_add(context, mesh, operator=None)
114 |
--------------------------------------------------------------------------------
/blender/addons/2.8/mira_tools/add_mesh_capsule.py:
--------------------------------------------------------------------------------
1 | import bpy
2 | from bpy.types import Operator
3 | from bpy.props import FloatProperty
4 | from bpy.props import IntProperty
5 | from bpy_extras.object_utils import object_data_add
6 | from mathutils import Vector
7 | from math import cos
8 | from math import degrees
9 | from math import radians
10 | from math import sin
11 |
12 | # "The author is David Ludwig. The code was taken from here https://www.youtube.com/watch?v=O-Yhxhjx_VY "
13 |
14 | def add_capsule(length, radius, rings, segments, context):
15 |
16 | topRings = []
17 | bottomRings = []
18 | topCap = []
19 | bottomCap = []
20 |
21 | vertId = 0
22 |
23 | for j in range(0, rings + 1):
24 |
25 | if j == rings:
26 |
27 | topVertex = Vector((0, 0, ((length / 2) + radius)))
28 | bottomVertex = Vector((0, 0, -((length / 2) + radius)))
29 |
30 | topCap.append(topVertex)
31 | bottomCap.append(bottomVertex)
32 | else:
33 |
34 | heightAngle = radians((90 / rings) * (j + 1))
35 |
36 | topRing = []
37 | bottomRing = []
38 |
39 | for i in range(0, segments):
40 |
41 | zAngle = radians((360 / segments) * i)
42 |
43 | x = radius * cos(zAngle) * sin(heightAngle)
44 | y = radius * sin(zAngle) * sin(heightAngle)
45 | z = radius * cos(heightAngle)
46 |
47 | topVertex = Vector((x, y, z + (length / 2)))
48 | bottomVertex = Vector((x, y, -(z + (length / 2))))
49 |
50 | topRing.append(vertId)
51 | bottomRing.append(vertId + ((rings * segments) + 1))
52 | topCap.append(topVertex)
53 | bottomCap.append(bottomVertex)
54 |
55 | vertId += 1
56 |
57 | topRings.append(topRing)
58 | bottomRings.append(bottomRing)
59 |
60 | verts = topCap + bottomCap
61 |
62 | faces = []
63 |
64 | ringIndex = len(topRings) - 1
65 | while ringIndex > 0:
66 |
67 | topRing = topRings[ringIndex]
68 | topNextRing = topRings[ringIndex - 1]
69 |
70 | bottomRing = bottomRings[ringIndex]
71 | bottomNextRing = bottomRings[ringIndex - 1]
72 |
73 | for i in range(0, segments):
74 |
75 | index1 = i
76 | index2 = 0 if i + 1 == segments else i + 1
77 |
78 | topCapFace = [topRing[index1], topRing[index2], topNextRing[index2], topNextRing[index1]]
79 | bottomCapFace = [bottomRing[index2], bottomRing[index1], bottomNextRing[index1], bottomNextRing[index2]]
80 | faces.append(topCapFace)
81 | faces.append(bottomCapFace)
82 |
83 | ringIndex -= 1
84 |
85 | topRing = topRings[rings - 1]
86 | bottomRing = bottomRings[rings - 1]
87 |
88 | topCapRing = topRings[0]
89 | bottomCapRing = bottomRings[0]
90 |
91 | topCapFaces = []
92 | bottomCapFaces = []
93 |
94 | for i in range(0, segments):
95 |
96 | index1 = i
97 | index2 = 0 if i + 1 == segments else i + 1
98 |
99 | bodyFace = [topRing[index2], topRing[index1], bottomRing[index1], bottomRing[index2]]
100 | topCapFace = [topCapRing[index1], topCapRing[index2], rings * segments]
101 | bottomCapFace = [bottomCapRing[index2], bottomCapRing[index1], ((rings * segments) * 2) + 1]
102 |
103 | faces.append(bodyFace)
104 | topCapFaces.append(topCapFace)
105 | bottomCapFaces.append(bottomCapFace)
106 |
107 | faces += topCapFaces + bottomCapFaces
108 |
109 | mesh = bpy.data.meshes.new(name="Capsule")
110 | mesh.from_pydata(verts, [], faces)
111 | mesh.update()
112 |
113 | return object_data_add(context, mesh, operator=None)
114 |
--------------------------------------------------------------------------------
/blender/addons/2.8/mira_tools/mi_simple_modeling.py:
--------------------------------------------------------------------------------
1 | import bpy
2 | import bmesh
3 |
4 | from bpy.props import *
5 | from bpy.types import Operator, AddonPreferences
6 |
7 | import math
8 | import mathutils as mathu
9 |
10 |
11 | class MI_OT_SM_Symmetry(bpy.types.Operator):
12 |
13 | """Draw a line with the mouse"""
14 | bl_idname = "mira.sm_symmetry"
15 | bl_label = "MiraSymmetry"
16 | bl_description = "MiraSymmetry"
17 | bl_options = {'REGISTER', 'UNDO'}
18 |
19 | #taper_value: FloatProperty(default=0.0, min=-1000.0, max=1.0)
20 |
21 | sym_axis: EnumProperty(
22 | items=(('X', 'X', ''),
23 | ('Y', 'Y', ''),
24 | ('Z', 'Z', ''),
25 | ),
26 | default = 'X'
27 | )
28 |
29 | # deform_direction: EnumProperty(
30 | # items=(('Top', 'Top', ''),
31 | #('Bottom', 'Bottom', ''),
32 | #('Left', 'Left', ''),
33 | #('Right', 'Right', ''),
34 | #),
35 | # default = 'Top'
36 | #)
37 |
38 |
39 | def invoke(self, context, event):
40 |
41 |
42 | return self.execute(context)
43 | # else:
44 | # self.report({'WARNING'}, "View3D not found, cannot run operator")
45 | # return {'CANCELLED'}
46 |
47 |
48 | def execute(self, context):
49 |
50 | bpy.ops.object.mode_set(mode='OBJECT', toggle=False)
51 | ref_obj = context.active_object
52 | verts_ref = [v for v in ref_obj.data.vertices if v.select]
53 |
54 | tmp_obj = bpy.data.objects.new("MIRA_TMP", ref_obj.data.copy())
55 | tmp_obj.matrix_world = ref_obj.matrix_world.copy()
56 | context.scene.collection.objects.link(tmp_obj)
57 |
58 | bpy.ops.object.select_all(action='DESELECT')
59 |
60 | context.view_layer.objects.active = tmp_obj
61 | tmp_obj.select_set(True)
62 | verts_tmp = [v for v in tmp_obj.data.vertices if v.select]
63 |
64 | if self.sym_axis == 'X':
65 | for v in verts_tmp:
66 | v.co[0] = -v.co[0]
67 | elif self.sym_axis == 'Y':
68 | for v in verts_tmp:
69 | v.co[1] = -v.co[1]
70 | elif self.sym_axis == 'Z':
71 | for v in verts_tmp:
72 | v.co[2] = -v.co[2]
73 |
74 | bpy.ops.object.modifier_add(type='SHRINKWRAP')
75 | tmp_obj.modifiers["Shrinkwrap"].wrap_method = 'NEAREST_VERTEX'
76 | bpy.context.object.modifiers["Shrinkwrap"].target = ref_obj
77 | bpy.ops.object.modifier_apply(modifier="Shrinkwrap")
78 |
79 | verts_tmp = [v for v in tmp_obj.data.vertices if v.select] # get verts again with new positions
80 |
81 | for i,v in enumerate(verts_ref):
82 | v.co = verts_tmp[i].co
83 |
84 | if self.sym_axis == 'X':
85 | for v in verts_ref:
86 | v.co[0] = -v.co[0]
87 | elif self.sym_axis == 'Y':
88 | for v in verts_ref:
89 | v.co[1] = -v.co[1]
90 | elif self.sym_axis == 'Z':
91 | for v in verts_ref:
92 | v.co[2] = -v.co[2]
93 |
94 | bpy.ops.object.delete(use_global=False)
95 |
96 | context.view_layer.objects.active = ref_obj
97 | ref_obj.select_set(True)
98 | bpy.ops.object.mode_set(mode='EDIT', toggle=False)
99 |
100 | return {'FINISHED'}
101 |
102 |
103 |
104 |
105 |
--------------------------------------------------------------------------------
/blender/addons/2.7/quick_pipe/quick_pipe.py:
--------------------------------------------------------------------------------
1 | import bpy
2 | import bmesh
3 | import math
4 | import mathutils as mathu
5 |
6 | from bpy.props import IntProperty, FloatProperty
7 |
8 | bl_info = {
9 | "name": "Quick Pipe",
10 | "author": "floatvoid (Jeremy Mitchell), Pavel Geraskin",
11 | "version": (1, 0),
12 | "blender": (2, 79, 0),
13 | "location": "View3D > Edit Mode",
14 | "description": "Quickly converts an edge selection to an extruded curve.",
15 | "warning": "",
16 | "wiki_url": "",
17 | "category": "View3D"}
18 |
19 |
20 | class jmPipeTool(bpy.types.Operator):
21 | bl_idname = "object.quickpipe"
22 | bl_label = "Quick Pipe"
23 | bl_options = {'REGISTER', 'UNDO'}
24 |
25 | first_mouse_x = IntProperty()
26 | first_value = FloatProperty()
27 |
28 | def modal(self, context, event):
29 | if event.type in {'RIGHTMOUSE', 'ESC', 'LEFTMOUSE'}:
30 | return {'FINISHED'}
31 |
32 | if event.type == 'MOUSEMOVE':
33 | delta = (self.first_mouse_x - event.mouse_x)
34 |
35 | if event.ctrl:
36 | delta *= 0.1
37 |
38 | if event.shift:
39 | delta *= 0.1
40 |
41 | context.object.data.bevel_depth = abs( (self.first_value + delta) * 0.01 )
42 | elif event.type == 'WHEELUPMOUSE':
43 | bpy.context.object.data.bevel_resolution += 1
44 | elif event.type == 'WHEELDOWNMOUSE':
45 | if bpy.context.object.data.bevel_resolution > 0:
46 | bpy.context.object.data.bevel_resolution -= 1
47 |
48 | return {'RUNNING_MODAL'}
49 |
50 | def invoke(self, context, event):
51 | if context.object:
52 |
53 | if( context.object.type == 'MESH' ):
54 | self.first_mouse_x = event.mouse_x
55 |
56 | bpy.ops.mesh.duplicate_move()
57 | bpy.ops.mesh.separate(type='SELECTED')
58 | bpy.ops.object.editmode_toggle()
59 | bpy.ops.object.select_all(action='DESELECT')
60 |
61 | pipe = bpy.context.scene.objects[0]
62 | pipe.select = True
63 | bpy.context.scene.objects.active = pipe
64 | bpy.ops.object.convert(target='CURVE')
65 |
66 | pipe.data.fill_mode = 'FULL'
67 | #pipe.data.splines[0].use_smooth = True
68 | pipe.data.bevel_resolution = 1
69 | pipe.data.bevel_depth = 0.1
70 |
71 | elif( context.object.type == 'CURVE' ):
72 | self.report({'WARNING'}, "Need Edit Mode!")
73 | return {'CANCELLED'}
74 |
75 | self.first_value = pipe.data.bevel_depth
76 |
77 | context.window_manager.modal_handler_add(self)
78 | return {'RUNNING_MODAL'}
79 | else:
80 | self.report({'WARNING'}, "No active object, could not finish")
81 | return {'CANCELLED'}
82 |
83 |
84 | class VIEW3D_PT_tools_jmPipeTool(bpy.types.Panel):
85 |
86 | bl_label = "Quick Pipe"
87 | bl_space_type = 'VIEW_3D'
88 | bl_region_type = 'TOOLS'
89 | bl_category = 'Tools'
90 | bl_context = "mesh_edit"
91 | bl_options = {'DEFAULT_CLOSED'}
92 |
93 | def draw(self, context):
94 | layout = self.layout
95 |
96 | row = layout.row()
97 | row.operator("object.quickpipe")
98 |
99 |
100 | def register():
101 | bpy.utils.register_module(__name__)
102 |
103 |
104 | def unregister():
105 | bpy.utils.unregister_module(__name__)
106 |
107 | if __name__ == "__main__":
108 | register()
109 |
--------------------------------------------------------------------------------
/houdini/pk/pk_shelf/pk.shelf:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
35 |
36 |
37 |
38 |
91 |
92 |
93 |
94 |
114 |
115 |
116 |
--------------------------------------------------------------------------------
/blender/addons/2.7/mira_tools/mi_noise.py:
--------------------------------------------------------------------------------
1 | # ***** BEGIN GPL LICENSE BLOCK *****
2 | #
3 | #
4 | # This program is free software; you can redistribute it and/or
5 | # modify it under the terms of the GNU General Public License
6 | # as published by the Free Software Foundation; either version 2
7 | # of the License, or (at your option) any later version.
8 | #
9 | # This program is distributed in the hope that it will be useful,
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | # GNU General Public License for more details.
13 | #
14 | # You should have received a copy of the GNU General Public License
15 | # along with this program; if not, write to the Free Software Foundation,
16 | # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 | #
18 | # ***** END GPL LICENCE BLOCK *****
19 |
20 | import bpy
21 | import bgl
22 | import blf
23 | import string
24 | import bmesh
25 |
26 | from bpy.props import *
27 | from bpy.types import Operator, AddonPreferences
28 |
29 | from bpy_extras import view3d_utils
30 |
31 | import math
32 | import mathutils as mathu
33 | import random
34 | from mathutils import Vector
35 |
36 | from . import mi_utils_base as ut_base
37 |
38 |
39 | class MI_Noise(bpy.types.Operator):
40 | bl_idname = "mira.noise"
41 | bl_label = "Noise"
42 | bl_description = "Noise"
43 | bl_options = {'REGISTER', 'UNDO'}
44 |
45 | noise_type = EnumProperty(
46 | items=(('Turbulence', 'Turbulence', ''),
47 | ('Fractal', 'Fractal', ''),
48 | ('HeteroTerrain', 'HeteroTerrain', ''),
49 | ),
50 | default = 'Turbulence'
51 | )
52 |
53 | frequency = FloatProperty(default=1.0)
54 | intensity = FloatProperty(default=1.0)
55 | offset_x = FloatProperty(default=0.0)
56 | offset_y = FloatProperty(default=0.0)
57 | offset_z = FloatProperty(default=0.0)
58 | octaves = IntProperty(default=2)
59 | amplitude_scale = FloatProperty(default=0.5)
60 | frequency_scale = FloatProperty(default=2.0)
61 | hard = BoolProperty(default=True)
62 |
63 |
64 | def execute(self, context):
65 |
66 | obj = context.scene.objects.active
67 | noise_obj(obj, context, self)
68 |
69 | return {'FINISHED'}
70 |
71 | def invoke(self, context, event):
72 | # if context.area.type == 'VIEW_3D':
73 | # change startup
74 | # self.select_mouse_mode = context.user_preferences.inputs.select_mouse
75 | # context.user_preferences.inputs.select_mouse = 'RIGHT'
76 |
77 | return self.execute(context)
78 | # else:
79 | # self.report({'WARNING'}, "View3D not found, cannot run operator")
80 | # return {'CANCELLED'}
81 |
82 |
83 | def noise_obj(obj, context, self):
84 | bm = bmesh.from_edit_mesh(obj.data)
85 | verts = [v for v in bm.verts if v.select]
86 | if not verts:
87 | verts = [v for v in bm.verts if v.hide is False]
88 |
89 | for vert in verts:
90 | noise_pos = self.frequency * vert.co.copy()
91 | noise_pos.x += self.offset_x
92 | noise_pos.z += self.offset_y
93 | noise_pos.z += self.offset_z
94 |
95 | noise_val = None
96 | if self.noise_type == 'Turbulence':
97 | noise_val = mathu.noise.turbulence(noise_pos, self.octaves, self.hard, mathu.noise.types.STDPERLIN, self.amplitude_scale, self.frequency_scale)
98 | elif self.noise_type == 'Fractal':
99 | noise_val = mathu.noise.fractal(noise_pos, self.amplitude_scale, self.frequency_scale, self.octaves, mathu.noise.types.STDPERLIN)
100 | else:
101 | noise_val = mathu.noise.hetero_terrain(noise_pos, self.amplitude_scale, self.frequency_scale, self.octaves, 0, mathu.noise.types.STDPERLIN)
102 |
103 | vert_offset = vert.normal.copy().normalized() * noise_val
104 | vert.co += vert_offset * self.intensity
105 |
106 | bm.normal_update()
107 | bmesh.update_edit_mesh(obj.data)
108 |
--------------------------------------------------------------------------------
/blender/addons/2.7/io_simple_3dcoat/__init__.py:
--------------------------------------------------------------------------------
1 | # BEGIN GPL LICENSE BLOCK #####
2 | #
3 | # This program is free software; you can redistribute it and/or
4 | # modify it under the terms of the GNU General Public License
5 | # as published by the Free Software Foundation; either version 2
6 | # of the License, or (at your option) any later version.
7 | #
8 | # This program is distributed in the hope that it will be useful,
9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | # GNU General Public License for more details.
12 | #
13 | # You should have received a copy of the GNU General Public License
14 | # along with this program; if not, write to the Free Software Foundation,
15 | # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16 | #
17 | # END GPL LICENSE BLOCK #####
18 |
19 | bl_info = {
20 | "name": "Simple 3D-Coat Applink",
21 | "author": "Kalle-Samuli Riihikoski (haikalle), Paul Geraskin",
22 | "version": (0, 3, 2),
23 | "blender": (2, 69, 0),
24 | "location": "Scene > Simple 3D-Coat Applink",
25 | "description": "Transfer data between 3D-Coat/Blender",
26 | "warning": "",
27 | "wiki_url": "http://wiki.blender.org/index.php/Extensions:2.6/Py/"
28 | "Scripts/Import-Export/3dcoat_applink",
29 | "tracker_url": "https://projects.blender.org/tracker/?"
30 | "func=detail&aid=24446",
31 | "category": "Import-Export"}
32 |
33 |
34 | if "bpy" in locals():
35 | import imp
36 | imp.reload(simple_coat)
37 | else:
38 | from . import simple_coat
39 |
40 |
41 | import bpy
42 | from bpy.props import *
43 |
44 |
45 | def register():
46 |
47 | class SimpleSceneCoat3D(bpy.types.PropertyGroup):
48 |
49 | exportModelType = EnumProperty(
50 | name = "Export Type",
51 | items = (('OBJ', 'OBJ', ''),
52 | ('FBX', 'FBX', ''),
53 | ('DAE', 'DAE', ''),
54 | ),
55 | default = 'OBJ'
56 | )
57 |
58 | doApplyModifiers = BoolProperty(
59 | name="Apply Modifiers",
60 | description="Apply Modifiers...",
61 | default=True
62 | )
63 |
64 | exportMaterials = BoolProperty(
65 | name="Export Materials",
66 | description="Export Materials...",
67 | default=True
68 | )
69 |
70 | copyTexturesPath = StringProperty(
71 | name="Copy Textures Path",
72 | subtype="DIR_PATH",
73 | default="",
74 | )
75 |
76 | type = EnumProperty(name="Export Type",
77 | description="Different Export Types",
78 | items=(("ppp", "Per-Pixel Painting", ""),
79 | ("mv", "Microvertex Painting", ""),
80 | ("ptex", "Ptex Painting", ""),
81 | ("uv", "UV-Mapping", ""),
82 | ("ref", "Reference Mesh", ""),
83 | ("retopo", "Retopo mesh as new layer", ""),
84 | ("vox", "Mesh As Voxel Object", ""),
85 | ("voxcombine", "Mesh As single Voxel Object", ""),
86 | ("alpha", "Mesh As New Pen Alpha", ""),
87 | ("prim", "Mesh As Voxel Primitive", ""),
88 | ("curv", "Mesh As a Curve Profile", ""),
89 | ("autopo", "Mesh For Auto-retopology", ""),
90 | ),
91 | default= "ppp"
92 | )
93 |
94 | bpy.utils.register_module(__name__)
95 |
96 | bpy.types.Scene.simple3Dcoat = PointerProperty(
97 | name="Applink Variables",
98 | type=SimpleSceneCoat3D,
99 | description="Applink variables"
100 | )
101 |
102 |
103 | def unregister():
104 | import bpy
105 |
106 | del bpy.types.Scene.simple3Dcoat
107 | bpy.utils.unregister_module(__name__)
108 |
109 |
110 | if __name__ == "__main__":
111 | register()
112 |
--------------------------------------------------------------------------------
/other/exchangers/houdini/exchanger.shelf:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
45 |
46 |
47 |
48 |
73 |
74 |
75 |
76 |
103 |
104 |
105 |
106 |
122 |
123 |
124 |
--------------------------------------------------------------------------------
/blender/addons/2.8/quick_pipe/quick_pipe.py:
--------------------------------------------------------------------------------
1 | import bpy
2 | import bmesh
3 | import math
4 | import mathutils as mathu
5 |
6 | from bpy.props import (
7 | IntProperty,
8 | FloatProperty
9 | )
10 |
11 | bl_info = {
12 | "name": "Quick Pipe",
13 | "author": "floatvoid (Jeremy Mitchell), Pavel Geraskin",
14 | "version": (1, 0),
15 | "blender": (2, 80, 0),
16 | "location": "View3D > Edit Mode",
17 | "description": "Quickly converts an edge selection to an extruded curve.",
18 | "warning": "",
19 | "wiki_url": "",
20 | "category": "View3D"}
21 |
22 |
23 | class jmPipeTool(bpy.types.Operator):
24 | bl_idname = "object.quickpipe"
25 | bl_label = "Quick Pipe"
26 | bl_options = {'REGISTER', 'UNDO'}
27 |
28 | first_mouse_x : IntProperty()
29 | first_value : FloatProperty()
30 |
31 | def modal(self, context, event):
32 | if event.type in {'RIGHTMOUSE', 'ESC', 'LEFTMOUSE'}:
33 | return {'FINISHED'}
34 |
35 | if event.type == 'MOUSEMOVE':
36 | delta = (self.first_mouse_x - event.mouse_x)
37 |
38 | if event.ctrl:
39 | delta *= 0.1
40 |
41 | if event.shift:
42 | delta *= 0.1
43 |
44 | context.object.data.bevel_depth = abs( (self.first_value + delta) * 0.01 )
45 | elif event.type == 'WHEELUPMOUSE':
46 | bpy.context.object.data.bevel_resolution += 1
47 | elif event.type == 'WHEELDOWNMOUSE':
48 | if bpy.context.object.data.bevel_resolution > 0:
49 | bpy.context.object.data.bevel_resolution -= 1
50 |
51 | return {'RUNNING_MODAL'}
52 |
53 | def invoke(self, context, event):
54 | if context.object:
55 |
56 | if( context.object.type == 'MESH' ):
57 | self.first_mouse_x = event.mouse_x
58 |
59 | bpy.ops.mesh.duplicate_move()
60 | bpy.ops.mesh.separate(type='SELECTED')
61 | bpy.ops.object.editmode_toggle()
62 |
63 | #pipe = context.view_layer.objects[-1]
64 | pipe = context.selected_objects[-1]
65 | bpy.ops.object.select_all(action='DESELECT')
66 | pipe.select_set(state=True)
67 | context.view_layer.objects.active = pipe
68 | bpy.ops.object.convert(target='CURVE')
69 |
70 | pipe.data.fill_mode = 'FULL'
71 | pipe.data.splines[0].use_smooth = True
72 | pipe.data.bevel_resolution = 1
73 | pipe.data.bevel_depth = 0.1
74 |
75 | elif( context.object.type == 'CURVE' ):
76 | self.report({'WARNING'}, "Need Edit Mode!")
77 | return {'CANCELLED'}
78 |
79 | self.first_value = pipe.data.bevel_depth
80 |
81 | context.window_manager.modal_handler_add(self)
82 | return {'RUNNING_MODAL'}
83 | else:
84 | self.report({'WARNING'}, "No active object, could not finish")
85 | return {'CANCELLED'}
86 |
87 |
88 | #class VIEW3D_PT_tools_jmPipeTool(bpy.types.Panel):
89 |
90 | #bl_label = "Quick Pipe"
91 | #bl_space_type = 'VIEW_3D'
92 | #bl_region_type = 'TOOLS'
93 | #bl_category = 'Tools'
94 | #bl_context = "mesh_edit"
95 | #bl_options = {'DEFAULT_CLOSED'}
96 |
97 | #def draw(self, context):
98 | #layout = self.layout
99 |
100 | #row = layout.row()
101 | #row.operator("object.quickpipe")
102 |
103 |
104 | def menu_func(self, context):
105 | layout = self.layout
106 | layout.operator_context = "INVOKE_DEFAULT"
107 | self.layout.operator(jmPipeTool.bl_idname, text="Quick Pipe")
108 |
109 | classes = (
110 | jmPipeTool,
111 | )
112 |
113 |
114 | # Register
115 | def register():
116 | for cls in classes:
117 | bpy.utils.register_class(cls)
118 | # update_panel(None, bpy.context)
119 | bpy.types.VIEW3D_MT_edit_mesh_context_menu.append(menu_func) # Mesh Context Menu
120 | #bpy.types.VIEW3D_MT_edit_mesh_vertices.append(menu_func) # Vertices Menu(CTRL+V)
121 | bpy.types.VIEW3D_MT_edit_mesh_edges.append(menu_func) # Edge Menu(CTRL+E)
122 |
123 |
124 | def unregister():
125 | for cls in classes:
126 | bpy.utils.unregister_class(cls)
127 |
128 | bpy.types.VIEW3D_MT_edit_mesh_context_menu.remove(menu_func)
129 | #bpy.types.VIEW3D_MT_edit_mesh_vertices.remove(menu_func)
130 | bpy.types.VIEW3D_MT_edit_mesh_edges.remove(menu_func)
131 |
132 | if __name__ == "__main__":
133 | register()
134 |
--------------------------------------------------------------------------------
/blender/addons/2.7/mira_tools/mi_widget_select.py:
--------------------------------------------------------------------------------
1 | # ***** BEGIN GPL LICENSE BLOCK *****
2 | #
3 | #
4 | # This program is free software; you can redistribute it and/or
5 | # modify it under the terms of the GNU General Public License
6 | # as published by the Free Software Foundation; either version 2
7 | # of the License, or (at your option) any later version.
8 | #
9 | # This program is distributed in the hope that it will be useful,
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | # GNU General Public License for more details.
13 | #
14 | # You should have received a copy of the GNU General Public License
15 | # along with this program; if not, write to the Free Software Foundation,
16 | # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 | #
18 | # ***** END GPL LICENCE BLOCK *****
19 |
20 | import bpy
21 | import bgl
22 | import blf
23 | import string
24 |
25 | from bpy.props import *
26 | from bpy.types import Operator, AddonPreferences
27 |
28 | from bpy_extras import view3d_utils
29 |
30 | import math
31 | import mathutils as mathu
32 | import random
33 | from mathutils import Vector
34 |
35 | from . import mi_utils_base as ut_base
36 |
37 |
38 | def draw_circle_select(m_coords, radius = 16, p_col = (0.7,0.8,1.0,0.6), enabled = False, sub = False):
39 | if(enabled):
40 | f_col = p_col
41 | if sub:
42 | f_col = (1.0, 0.5, 0.4, 0.6)
43 | bgl.glEnable(bgl.GL_BLEND)
44 | bgl.glBegin(bgl.GL_POLYGON)
45 | bgl.glColor4f(f_col[0], f_col[1], f_col[2], f_col[3]/3)
46 |
47 | point_x = m_coords[0]
48 | point_y = m_coords[1]
49 |
50 | radius = int(radius)
51 |
52 | for x in range(0, radius*2):
53 | bgl.glVertex2f(point_x + radius * math.cos(x * (360/(radius*2)) / 180 * 3.14159), point_y + radius * math.sin(x * (360/(radius*2)) / 180 * 3.14159))
54 | bgl.glEnd()
55 |
56 | bgl.glBegin(bgl.GL_LINES)
57 | bgl.glColor4f(f_col[0], f_col[1], f_col[2], f_col[3])
58 | for x in range(0, radius*2):
59 | bgl.glVertex2f(point_x + radius * math.cos(x * (360 / (radius * 2)) / 180 * 3.14159),
60 | point_y + radius * math.sin(x * (360 / (radius * 2)) / 180 * 3.14159))
61 |
62 | bgl.glEnd()
63 | # restore opengl defaults
64 | bgl.glLineWidth(1)
65 | bgl.glDisable(bgl.GL_BLEND)
66 | bgl.glColor4f(0.0, 0.0, 0.0, 1.0)
67 |
68 |
69 | def draw_box_select(anchor, m_coords, region, p_col = (0.7,0.8,1.0,0.6), enabled = False, dragging = False, sub = False):
70 |
71 | if enabled:
72 | f_col = p_col
73 | if sub:
74 | f_col = (1.0, 0.5, 0.4, 0.6)
75 | bgl.glEnable(bgl.GL_BLEND)
76 | bgl.glLineStipple(1, 0xCCCC)
77 | bgl.glEnable(bgl.GL_LINE_STIPPLE)
78 |
79 | bgl.glBegin(bgl.GL_LINES)
80 | bgl.glColor4f(f_col[0], f_col[1], f_col[2], f_col[3])
81 |
82 | point_x = m_coords[0]
83 | point_y = m_coords[1]
84 |
85 | bgl.glVertex2f(point_x,0)
86 | bgl.glVertex2f(point_x, region.height)
87 |
88 | bgl.glVertex2f(0, point_y)
89 | bgl.glVertex2f(region.width, point_y)
90 |
91 | bgl.glEnd()
92 | bgl.glDisable(bgl.GL_LINE_STIPPLE)
93 | bgl.glDisable(bgl.GL_BLEND)
94 |
95 | if dragging:
96 | bgl.glEnable(bgl.GL_BLEND)
97 | bgl.glBegin(bgl.GL_QUADS)
98 | bgl.glColor4f(f_col[0], f_col[1], f_col[2], f_col[3] / 3)
99 | point_x = m_coords[0]
100 | point_y = m_coords[1]
101 |
102 | anc_x = anchor[0]
103 | anc_y = anchor[1]
104 |
105 | bgl.glVertex2f(anc_x, anc_y)
106 | bgl.glVertex2f(point_x, anc_y)
107 | bgl.glVertex2f(point_x,point_y)
108 | bgl.glVertex2f(anc_x,point_y)
109 | bgl.glEnd()
110 |
111 | bgl.glLineStipple(1, 0xCCCC)
112 | bgl.glEnable(bgl.GL_LINE_STIPPLE)
113 | bgl.glBegin(bgl.GL_LINE_LOOP)
114 |
115 | bgl.glColor4f(f_col[0], f_col[1], f_col[2], f_col[3])
116 | bgl.glVertex2f(anc_x, anc_y)
117 | bgl.glVertex2f(point_x, anc_y)
118 | bgl.glVertex2f(point_x, point_y)
119 | bgl.glVertex2f(anc_x, point_y)
120 |
121 | bgl.glEnd()
122 | # restore opengl defaults
123 | bgl.glLineWidth(1)
124 | bgl.glDisable(bgl.GL_LINE_STIPPLE)
125 | bgl.glDisable(bgl.GL_BLEND)
126 | bgl.glColor4f(0.0, 0.0, 0.0, 1.0)
--------------------------------------------------------------------------------
/blender/addons/2.8/mifth_tools/mifth_vertex_paint.py:
--------------------------------------------------------------------------------
1 | import bpy
2 |
3 | from bpy.props import *
4 | from bpy.types import Operator, AddonPreferences
5 | from bpy.types import Menu, Panel, UIList, PropertyGroup
6 | from bpy.props import StringProperty, BoolProperty, IntProperty, CollectionProperty, BoolVectorProperty, PointerProperty
7 |
8 |
9 | #class MFTVertexPaintMenu(bpy.types.Menu):
10 | #bl_idname = "mftv.vertex_paint_menu"
11 | #bl_label = "Mifth VertexPaint"
12 | #bl_description = "Mifth Vertex Paint Menu"
13 |
14 | #def draw(self, context):
15 | #layout = self.layout
16 |
17 | ##layout.separator()
18 | #layout.operator(MFTSetColorToSelected.bl_idname)
19 | #layout.operator(MFTInvertColors.bl_idname)
20 |
21 |
22 | class MFTSetColorToSelected(bpy.types.Operator):
23 | bl_idname = "mftv.set_colors_to_selected"
24 | bl_label = "Set Colors to Selected"
25 | bl_description = "Set Colors to Selected"
26 | bl_options = {'REGISTER', 'UNDO'}
27 |
28 | strength : FloatVectorProperty(
29 | name="Color",
30 | subtype='COLOR',
31 | default=(0.5, 0.5, 0.5),
32 | min=0.0, max=1.0,
33 | description="wire color of the group"
34 | )
35 |
36 | selected_faces_only : BoolProperty(name="Selected Faces Only", default=False)
37 |
38 | ch_col = False
39 |
40 | def execute(self, context):
41 |
42 | obj = context.view_layer.objects.active
43 | color_layer = obj.data.vertex_colors.active
44 |
45 | if self.ch_col is False:
46 | if context.scene.tool_settings.unified_paint_settings.use_unified_color is True:
47 | self.strength = context.scene.tool_settings.unified_paint_settings.color
48 | else:
49 | self.strength = context.tool_settings.vertex_paint.brush.color
50 | self.ch_col = True
51 |
52 |
53 | i = 0
54 | for poly in obj.data.polygons:
55 | for vert_idx in poly.vertices:
56 | if obj.data.vertices[vert_idx].select is True:
57 |
58 | if self.selected_faces_only is False:
59 | color_layer.data[i].color = (self.strength[0], self.strength[1], self.strength[2], 1.0)
60 | else:
61 | if poly.select is True:
62 | color_layer.data[i].color = (self.strength[0], self.strength[1], self.strength[2], 1.0)
63 |
64 | i += 1
65 |
66 | obj.data.update()
67 |
68 | return {'FINISHED'}
69 |
70 |
71 | class MFTInvertColors(bpy.types.Operator):
72 | bl_idname = "mftv.invert_colors"
73 | bl_label = "Invert Colors"
74 | bl_description = "Invert Colors"
75 | bl_options = {'REGISTER', 'UNDO'}
76 |
77 | selected_faces_only : BoolProperty(name="Selected Vertices Only", default=True)
78 | split_points : BoolProperty(name="Split Points", default=False)
79 |
80 | def execute(self, context):
81 |
82 | obj = context.view_layer.objects.active
83 | color_layer = obj.data.vertex_colors.active
84 |
85 | i = 0
86 | for poly in obj.data.polygons:
87 | for vert_idx in poly.vertices:
88 | if self.selected_faces_only is False:
89 | color_layer.data[i].color[
90 | 0] = 1.0 - color_layer.data[i].color[0]
91 | color_layer.data[i].color[
92 | 1] = 1.0 - color_layer.data[i].color[1]
93 | color_layer.data[i].color[
94 | 2] = 1.0 - color_layer.data[i].color[2]
95 | else:
96 | if obj.data.vertices[vert_idx].select is True:
97 | if self.split_points is True:
98 | if poly.select is True:
99 | color_layer.data[i].color[
100 | 0] = 1.0 - color_layer.data[i].color[0]
101 | color_layer.data[i].color[
102 | 1] = 1.0 - color_layer.data[i].color[1]
103 | color_layer.data[i].color[
104 | 2] = 1.0 - color_layer.data[i].color[2]
105 | else:
106 | color_layer.data[i].color[
107 | 0] = 1.0 - color_layer.data[i].color[0]
108 | color_layer.data[i].color[
109 | 1] = 1.0 - color_layer.data[i].color[1]
110 | color_layer.data[i].color[
111 | 2] = 1.0 - color_layer.data[i].color[2]
112 | i += 1
113 |
114 | obj.data.update()
115 |
116 | return {'FINISHED'}
117 |
--------------------------------------------------------------------------------
/blender/addons/2.7/mifth_tools/mifth_vertex_paint.py:
--------------------------------------------------------------------------------
1 | import bpy
2 |
3 | from bpy.props import *
4 | from bpy.types import Operator, AddonPreferences
5 | from bpy.types import Menu, Panel, UIList, PropertyGroup
6 | from bpy.props import StringProperty, BoolProperty, IntProperty, CollectionProperty, BoolVectorProperty, PointerProperty
7 |
8 |
9 | class MFTVertexPaintMenu(bpy.types.Menu):
10 | bl_idname = "mftv.vertex_paint_menu"
11 | bl_label = "Mifth VertexPaint"
12 | bl_description = "Mifth Vertex Paint Menu"
13 |
14 | def draw(self, context):
15 | layout = self.layout
16 |
17 | #layout.separator()
18 | layout.operator(MFTSetColorToSelected.bl_idname)
19 | layout.operator(MFTInvertColors.bl_idname)
20 |
21 |
22 | class MFTSetColorToSelected(bpy.types.Operator):
23 | bl_idname = "mftv.set_colors_to_selected"
24 | bl_label = "Set Colors to Selected"
25 | bl_description = "Set Colors to Selected"
26 | bl_options = {'REGISTER', 'UNDO'}
27 |
28 | strength = FloatVectorProperty(
29 | name="Color",
30 | subtype='COLOR',
31 | default=(0.5, 0.5, 0.5),
32 | min=0.0, max=1.0,
33 | description="wire color of the group"
34 | )
35 |
36 | selected_faces_only = BoolProperty(
37 | name="Selected Faces Only", default=False)
38 |
39 | ch_col = False
40 |
41 | def execute(self, context):
42 |
43 | obj = context.scene.objects.active
44 | color_layer = obj.data.vertex_colors.active
45 |
46 | if self.ch_col is False:
47 | if context.scene.tool_settings.unified_paint_settings.use_unified_color is True:
48 | self.strength = context.scene.tool_settings.unified_paint_settings.color
49 | else:
50 | self.strength = context.tool_settings.vertex_paint.brush.color
51 | self.ch_col = True
52 |
53 |
54 | i = 0
55 | for poly in obj.data.polygons:
56 | for vert_idx in poly.vertices:
57 | if obj.data.vertices[vert_idx].select is True:
58 |
59 | if self.selected_faces_only is False:
60 | color_layer.data[i].color = (self.strength[0], self.strength[1], self.strength[2], 1.0)
61 | else:
62 | if poly.select is True:
63 | color_layer.data[i].color = (self.strength[0], self.strength[1], self.strength[2], 1.0)
64 |
65 | i += 1
66 |
67 | obj.data.update()
68 |
69 | return {'FINISHED'}
70 |
71 |
72 | class MFTInvertColors(bpy.types.Operator):
73 | bl_idname = "mftv.invert_colors"
74 | bl_label = "Invert Colors"
75 | bl_description = "Invert Colors"
76 | bl_options = {'REGISTER', 'UNDO'}
77 |
78 | selected_faces_only = BoolProperty(
79 | name="Selected Vertices Only", default=True)
80 | split_points = BoolProperty(name="Split Points", default=False)
81 |
82 | def execute(self, context):
83 |
84 | obj = context.scene.objects.active
85 | color_layer = obj.data.vertex_colors.active
86 |
87 | i = 0
88 | for poly in obj.data.polygons:
89 | for vert_idx in poly.vertices:
90 | if self.selected_faces_only is False:
91 | color_layer.data[i].color[
92 | 0] = 1.0 - color_layer.data[i].color[0]
93 | color_layer.data[i].color[
94 | 1] = 1.0 - color_layer.data[i].color[1]
95 | color_layer.data[i].color[
96 | 2] = 1.0 - color_layer.data[i].color[2]
97 | else:
98 | if obj.data.vertices[vert_idx].select is True:
99 | if self.split_points is True:
100 | if poly.select is True:
101 | color_layer.data[i].color[
102 | 0] = 1.0 - color_layer.data[i].color[0]
103 | color_layer.data[i].color[
104 | 1] = 1.0 - color_layer.data[i].color[1]
105 | color_layer.data[i].color[
106 | 2] = 1.0 - color_layer.data[i].color[2]
107 | else:
108 | color_layer.data[i].color[
109 | 0] = 1.0 - color_layer.data[i].color[0]
110 | color_layer.data[i].color[
111 | 1] = 1.0 - color_layer.data[i].color[1]
112 | color_layer.data[i].color[
113 | 2] = 1.0 - color_layer.data[i].color[2]
114 | i += 1
115 |
116 | obj.data.update()
117 |
118 | return {'FINISHED'}
119 |
--------------------------------------------------------------------------------
/blender/addons/2.8/mira_tools/auto_load.py:
--------------------------------------------------------------------------------
1 | # import os
2 | import bpy
3 | # import sys
4 | import typing
5 | import inspect
6 | import pkgutil
7 | import importlib
8 | from pathlib import Path
9 |
10 | __all__ = (
11 | "init",
12 | "register",
13 | "unregister",
14 | )
15 |
16 | modules = None
17 | ordered_classes = None
18 |
19 | def init():
20 | global modules
21 | global ordered_classes
22 |
23 | modules = get_all_submodules(Path(__file__).parent)
24 | ordered_classes = get_ordered_classes_to_register(modules)
25 |
26 | def register():
27 | for cls in ordered_classes:
28 | bpy.utils.register_class(cls)
29 |
30 | for module in modules:
31 | if module.__name__ == __name__:
32 | continue
33 | if hasattr(module, "register"):
34 | module.register()
35 |
36 | def unregister():
37 | for cls in reversed(ordered_classes):
38 | bpy.utils.unregister_class(cls)
39 |
40 | for module in modules:
41 | if module.__name__ == __name__:
42 | continue
43 | if hasattr(module, "unregister"):
44 | module.unregister()
45 |
46 |
47 | # Import modules
48 | #################################################
49 |
50 | def get_all_submodules(directory):
51 | return list(iter_submodules(directory, directory.name))
52 |
53 | def iter_submodules(path, package_name):
54 | for name in sorted(iter_submodule_names(path)):
55 | yield importlib.import_module("." + name, package_name)
56 |
57 | def iter_submodule_names(path, root=""):
58 | for _, module_name, is_package in pkgutil.iter_modules([str(path)]):
59 | if is_package:
60 | sub_path = path / module_name
61 | sub_root = root + module_name + "."
62 | yield from iter_submodule_names(sub_path, sub_root)
63 | else:
64 | yield root + module_name
65 |
66 |
67 | # Find classes to register
68 | #################################################
69 |
70 | def get_ordered_classes_to_register(modules):
71 | return toposort(get_register_deps_dict(modules))
72 |
73 | def get_register_deps_dict(modules):
74 | deps_dict = {}
75 | classes_to_register = set(iter_classes_to_register(modules))
76 | for cls in classes_to_register:
77 | deps_dict[cls] = set(iter_own_register_deps(cls, classes_to_register))
78 | return deps_dict
79 |
80 | def iter_own_register_deps(cls, own_classes):
81 | yield from (dep for dep in iter_register_deps(cls) if dep in own_classes)
82 |
83 | if getattr(cls, "bl_parent_id", None):
84 | for other_cls in own_classes:
85 | if other_cls.__name__ == cls.bl_parent_id:
86 | yield other_cls
87 |
88 | def iter_register_deps(cls):
89 | for value in typing.get_type_hints(cls, {}, {}).values():
90 | dependency = get_dependency_from_annotation(value)
91 | if dependency is not None:
92 | yield dependency
93 |
94 | def get_dependency_from_annotation(value):
95 | if isinstance(value, tuple) and len(value) == 2:
96 | if value[0] in (bpy.props.PointerProperty, bpy.props.CollectionProperty):
97 | return value[1]["type"]
98 | return None
99 |
100 | def iter_classes_to_register(modules):
101 | base_types = get_register_base_types()
102 | for cls in get_classes_in_modules(modules):
103 | if any(base in base_types for base in cls.__bases__):
104 | if not getattr(cls, "is_registered", False):
105 | yield cls
106 |
107 | def get_classes_in_modules(modules):
108 | classes = set()
109 | for module in modules:
110 | for cls in iter_classes_in_module(module):
111 | classes.add(cls)
112 | return classes
113 |
114 | def iter_classes_in_module(module):
115 | for value in module.__dict__.values():
116 | if inspect.isclass(value):
117 | yield value
118 |
119 | def get_register_base_types():
120 | return set(getattr(bpy.types, name) for name in [
121 | "Panel", "Operator", "PropertyGroup",
122 | "AddonPreferences", "Header", "Menu",
123 | "Node", "NodeSocket", "NodeTree",
124 | "UIList", "RenderEngine"
125 | ])
126 |
127 |
128 | # Find order to register to solve dependencies
129 | #################################################
130 |
131 | def toposort(deps_dict):
132 | sorted_list = []
133 | sorted_values = set()
134 | while len(deps_dict) > 0:
135 | unsorted = []
136 | for value, deps in deps_dict.items():
137 | if len(deps) == 0:
138 | sorted_list.append(value)
139 | sorted_values.add(value)
140 | else:
141 | unsorted.append(value)
142 | deps_dict = {value : deps_dict[value] - sorted_values for value in unsorted}
143 | return sorted_list
144 |
--------------------------------------------------------------------------------
/blender/addons/2.8/mira_tools/__init__.py:
--------------------------------------------------------------------------------
1 |
2 | bl_info = {
3 | "name": "Mira Tools",
4 | "author": "Pavel Geraskin, Marvin K. Breuer, Graham Held, JoseConseco",
5 | "version": (3, 0, 2),
6 | "blender": (2, 90, 0),
7 | "location": "3D Viewport",
8 | "description": "Mira Tools",
9 | "warning": "",
10 | "wiki_url": "https://github.com/mifth/mifthtools/wiki/Mira-Tools",
11 | "tracker_url": "https://github.com/mifth/mifthtools/issues",
12 | "category": "Tools"}
13 |
14 |
15 | if "bpy" in locals():
16 | import imp
17 | imp.reload(mi_curve_stretch)
18 | imp.reload(mi_curve_surfaces)
19 | imp.reload(mi_settings)
20 | imp.reload(mi_gui)
21 | imp.reload(mi_noise)
22 | imp.reload(mi_deform)
23 | imp.reload(mi_linear_deformer)
24 | imp.reload(mi_linear_deformer_curve)
25 | imp.reload(mi_curve_guide)
26 | imp.reload(mi_draw_extrude)
27 | imp.reload(mi_poly_loop)
28 | imp.reload(mi_make_arc)
29 | imp.reload(mi_wrap_master)
30 | imp.reload(mi_primitives)
31 | imp.reload(mi_simple_extrude)
32 | imp.reload(mi_unbevel)
33 | imp.reload(mi_retopo_loops)
34 | imp.reload(mi_snap_points)
35 | imp.reload(mi_simple_modeling)
36 |
37 | else:
38 | from . import mi_curve_stretch
39 | from . import mi_curve_surfaces
40 | from . import mi_settings
41 | from . import mi_linear_deformer
42 | from . import mi_linear_deformer_curve
43 | from . import mi_curve_guide
44 | from . import mi_deform
45 | from . import mi_gui
46 | from . import mi_noise
47 | from . import mi_draw_extrude
48 | from . import mi_poly_loop
49 | from . import mi_make_arc
50 | from . import mi_wrap_master
51 | from . import mi_primitives
52 | from . import mi_simple_extrude
53 | from . import mi_unbevel
54 | from . import mi_retopo_loops
55 | from . import mi_snap_points
56 | from . import mi_simple_modeling
57 |
58 |
59 | import bpy
60 | from bpy.props import *
61 |
62 | from . import auto_load
63 | auto_load.init()
64 |
65 | import traceback
66 |
67 | def register():
68 | try:
69 | auto_load.register()
70 | except:
71 | traceback.print_exc()
72 |
73 | # bpy.types.Scene.mira_curve_points: PointerProperty( name="Mira Tool Variables", type=mi_curve_test.MR_CurvePoint, description="Mira Curve" )
74 | # bpy.types.Object.mi_curves = CollectionProperty( name="Mira Tool Variables", type=mi_curve_test.MI_CurveObject, description="Mira Curve" )
75 | bpy.types.Scene.mi_settings = PointerProperty( name="Global Settings", type=mi_settings.MI_Settings, description="Global Settings." )
76 | bpy.types.Scene.mi_cur_stretch_settings = PointerProperty( name="Curve Stretch Settings", type=mi_curve_stretch.MI_CurveStretchSettings, description="Curve Stretch Settings." )
77 | bpy.types.Scene.mi_cur_surfs_settings = PointerProperty( name="Curve Surfaces Settings", type=mi_curve_surfaces.MI_CurveSurfacesSettings, description="Curve Surfaces Settings." )
78 | bpy.types.Scene.mi_extrude_settings = PointerProperty( name="Extrude Variables", type=mi_draw_extrude.MI_ExtrudeSettings, description="Extrude Settings" )
79 | bpy.types.Scene.mi_ldeformer_settings = PointerProperty( name="Linear Deformer Variables", type=mi_linear_deformer.MI_LDeformer_Settings, description="Linear Deformer Settings" )
80 | bpy.types.Scene.mi_curguide_settings = PointerProperty( name="Curve Guide Variables", type=mi_curve_guide.MI_CurGuide_Settings, description="Curve Guide Settings" )
81 | bpy.types.Scene.mi_makearc_settings = PointerProperty( name="Make Arc Variables", type=mi_make_arc.MI_MakeArc_Settings, description="Make Arc Settings" )
82 | #bpy.types.Scene.mi_unbevel_settings = PointerProperty( name="Unbevel Settings", type=mi_unbevel.MI_Unbevel_Settings, description="Unbevel Settings" )
83 |
84 | # alternative gui
85 | bpy.types.WindowManager.mirawindow = bpy.props.PointerProperty(type = mi_gui.DropdownMiraToolProps)
86 | bpy.types.VIEW3D_MT_mesh_add.prepend(mi_gui.mifth_prim_menu)
87 |
88 |
89 | # bpy.types.VIEW3D_PT_tools_curveedit.append(mi_linear_deformer_curve.linear_deform_button)
90 |
91 | def unregister():
92 |
93 | #del bpy.types.Scene.miraTool
94 | #del bpy.types.Object.mi_curves # need to investigate if i need to delete it
95 | del bpy.types.Scene.mi_settings
96 | del bpy.types.Scene.mi_cur_stretch_settings
97 | del bpy.types.Scene.mi_cur_surfs_settings
98 | del bpy.types.Scene.mi_extrude_settings
99 | del bpy.types.Scene.mi_ldeformer_settings
100 | del bpy.types.Scene.mi_curguide_settings
101 | del bpy.types.Scene.mi_makearc_settings
102 |
103 | del bpy.types.WindowManager.mirawindow
104 | bpy.types.VIEW3D_MT_mesh_add.remove(mi_gui.mifth_prim_menu)
105 |
106 | # bpy.types.VIEW3D_PT_tools_curveedit.remove(mi_linear_deformer_curve.linear_deform_button)
107 | try:
108 | auto_load.unregister()
109 | except:
110 | traceback.print_exc()
111 |
112 | if __name__ == "__main__":
113 | register()
114 |
--------------------------------------------------------------------------------
/blender/addons/2.7/mifth_tools/__init__.py:
--------------------------------------------------------------------------------
1 | # BEGIN GPL LICENSE BLOCK #####
2 | #
3 | # This program is free software; you can redistribute it and/or
4 | # modify it under the terms of the GNU General Public License
5 | # as published by the Free Software Foundation; either version 2
6 | # of the License, or (at your option) any later version.
7 | #
8 | # This program is distributed in the hope that it will be useful,
9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | # GNU General Public License for more details.
12 | #
13 | # You should have received a copy of the GNU General Public License
14 | # along with this program; if not, write to the Free Software Foundation,
15 | # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16 | #
17 | # END GPL LICENSE BLOCK #####
18 |
19 | bl_info = {
20 | "name": "Mifth Tools",
21 | "author": "Paul Geraskin",
22 | "version": (0, 1, 0),
23 | "blender": (2, 78, 0),
24 | "location": "3D Viewport",
25 | "description": "Mifth Tools",
26 | "warning": "",
27 | "wiki_url": "",
28 | "tracker_url": "",
29 | "category": "Tools"}
30 |
31 |
32 | if "bpy" in locals():
33 | import imp
34 | imp.reload(mifth_tools_cloning)
35 | imp.reload(mifth_vertex_paint)
36 | imp.reload(mifth_tools)
37 | else:
38 | from . import mifth_tools_cloning
39 | from . import mifth_vertex_paint
40 | from . import mifth_tools
41 |
42 |
43 | import bpy
44 | from bpy.props import *
45 |
46 |
47 | # registration
48 | def menu_vertex_paint_func(self, context):
49 | self.layout.separator()
50 | self.layout.menu(mifth_vertex_paint.MFTVertexPaintMenu.bl_idname)
51 |
52 |
53 | def register():
54 | bpy.types.VIEW3D_MT_paint_vertex.append(menu_vertex_paint_func)
55 |
56 | class MFTProperties(bpy.types.PropertyGroup):
57 |
58 | # Output Settings
59 | outputFolder = StringProperty(
60 | name="outputFolder",
61 | subtype="NONE",
62 | default="seq"
63 | )
64 |
65 | outputSubFolder = StringProperty(
66 | name="outputSubFolder",
67 | subtype="NONE",
68 | default="ren"
69 | )
70 |
71 | outputSequence = StringProperty(
72 | name="outputSequence",
73 | subtype="NONE",
74 | default="render"
75 | )
76 |
77 | outputSequenceSize = IntProperty(
78 | default=8,
79 | min=1,
80 | max=60
81 | )
82 |
83 | doOutputSubFolder = BoolProperty(
84 | name="do Output SubFolder",
85 | description="do Output SubFolder...",
86 | default=False
87 | )
88 |
89 | # Curve Animator Settings
90 | doUseSceneFrames = BoolProperty(
91 | name="do use scene frames",
92 | description="do use scene frames...",
93 | default=False
94 | )
95 |
96 | curveAniStartFrame = IntProperty(
97 | default=1,
98 | min=1,
99 | max=10000
100 | )
101 |
102 | curveAniEndFrame = IntProperty(
103 | default=100,
104 | min=1,
105 | max=10000
106 | )
107 |
108 | curveAniStepFrame = IntProperty(
109 | default=10,
110 | min=1,
111 | max=10000
112 | )
113 |
114 | curveAniInterpolation = FloatProperty(
115 | default=0.3,
116 | min=0.0,
117 | max=1.0
118 | )
119 |
120 | # MorfCreator settings
121 | morfCreatorNames = StringProperty(
122 | name="MorfNames",
123 | subtype="NONE",
124 | default=""
125 | )
126 |
127 | morfUseWorldMatrix = BoolProperty(
128 | name="use world matrix",
129 | description="use world matrix...",
130 | default=False
131 | )
132 |
133 | morfApplyModifiers = BoolProperty(
134 | name="apply modifiers to morf",
135 | description="apply modifiers to morf...",
136 | default=False
137 | )
138 |
139 | bpy.utils.register_module(__name__)
140 |
141 | bpy.types.Scene.mifthTools = PointerProperty(
142 | name="Mifth Tools Variables",
143 | type=MFTProperties,
144 | description="Mifth Tools Properties"
145 | )
146 |
147 | bpy.types.Scene.mifthCloneTools = PointerProperty(
148 | name="Mifth Cloning Variables",
149 | type=mifth_tools_cloning.MFTCloneProperties,
150 | description="Mifth Cloning Properties"
151 | )
152 |
153 |
154 | def unregister():
155 | import bpy
156 |
157 | bpy.types.VIEW3D_MT_object_specials.remove(menu_vertex_paint_func)
158 |
159 | del bpy.types.Scene.mifthTools
160 | del bpy.types.Scene.mifthCloneTools
161 | # del bpy.mifthTools
162 | # del bpy.mifthCloneTools
163 | bpy.utils.unregister_module(__name__)
164 |
165 |
166 | if __name__ == "__main__":
167 | register()
168 |
--------------------------------------------------------------------------------
/blender/addons/2.7/mira_tools/__init__.py:
--------------------------------------------------------------------------------
1 | # BEGIN GPL LICENSE BLOCK #####
2 | #
3 | # This program is free software; you can redistribute it and/or
4 | # modify it under the terms of the GNU General Public License
5 | # as published by the Free Software Foundation; either version 2
6 | # of the License, or (at your option) any later version.
7 | #
8 | # This program is distributed in the hope that it will be useful,
9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | # GNU General Public License for more details.
12 | #
13 | # You should have received a copy of the GNU General Public License
14 | # along with this program; if not, write to the Free Software Foundation,
15 | # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16 | #
17 | # END GPL LICENSE BLOCK #####
18 |
19 | bl_info = {
20 | "name": "Mira Tools",
21 | "author": "Pavel Geraskin, Marvin K. Breuer, Graham Held",
22 | "version": (2, 1, 0),
23 | "blender": (2, 78, 0),
24 | "location": "3D Viewport",
25 | "description": "Mira Tools",
26 | "warning": "",
27 | "wiki_url": "https://github.com/mifth/mifthtools/wiki/Mira-Tools",
28 | "tracker_url": "https://github.com/mifth/mifthtools/issues",
29 | "category": "Tools"}
30 |
31 |
32 | if "bpy" in locals():
33 | import imp
34 | imp.reload(mi_curve_test)
35 | imp.reload(mi_curve_stretch)
36 | imp.reload(mi_curve_surfaces)
37 | imp.reload(mi_settings)
38 | imp.reload(mi_gui)
39 | imp.reload(mi_noise)
40 | imp.reload(mi_deform)
41 | imp.reload(mi_linear_deformer)
42 | imp.reload(mi_curve_guide)
43 | imp.reload(mi_draw_extrude)
44 | imp.reload(mi_poly_loop)
45 | imp.reload(mi_make_arc)
46 | imp.reload(mi_wrap_master)
47 | imp.reload(mi_primitives)
48 | imp.reload(mi_simple_extrude)
49 | else:
50 | from . import mi_curve_test
51 | from . import mi_curve_stretch
52 | from . import mi_curve_surfaces
53 | from . import mi_settings
54 | from . import mi_linear_deformer
55 | from . import mi_curve_guide
56 | from . import mi_deform
57 | from . import mi_gui
58 | from . import mi_noise
59 | from . import mi_draw_extrude
60 | from . import mi_poly_loop
61 | from . import mi_make_arc
62 | from . import mi_wrap_master
63 | from . import mi_primitives
64 | from . import mi_simple_extrude
65 |
66 |
67 | import bpy
68 | from bpy.props import *
69 |
70 |
71 | def register():
72 |
73 | bpy.utils.register_module(__name__)
74 |
75 | bpy.types.Scene.mi_settings = PointerProperty(
76 | name="Global Settings",
77 | type=mi_settings.MI_Settings,
78 | description="Global Settings."
79 | )
80 |
81 | bpy.types.Scene.mi_cur_stretch_settings = PointerProperty(
82 | name="Curve Stretch Settings",
83 | type=mi_curve_stretch.MI_CurveStretchSettings,
84 | description="Curve Stretch Settings."
85 | )
86 |
87 | bpy.types.Scene.mi_cur_surfs_settings = PointerProperty(
88 | name="Curve Surfaces Settings",
89 | type=mi_curve_surfaces.MI_CurveSurfacesSettings,
90 | description="Curve Surfaces Settings."
91 | )
92 |
93 | bpy.types.Scene.mi_extrude_settings = PointerProperty(
94 | name="Extrude Variables",
95 | type=mi_draw_extrude.MI_ExtrudeSettings,
96 | description="Extrude Settings"
97 | )
98 |
99 | bpy.types.Scene.mi_ldeformer_settings = PointerProperty(
100 | name="Linear Deformer Variables",
101 | type=mi_linear_deformer.MI_LDeformer_Settings,
102 | description="Linear Deformer Settings"
103 | )
104 |
105 | bpy.types.Scene.mi_curguide_settings = PointerProperty(
106 | name="Curve Guide Variables",
107 | type=mi_curve_guide.MI_CurGuide_Settings,
108 | description="Curve Guide Settings"
109 | )
110 |
111 | bpy.types.Scene.mi_makearc_settings = PointerProperty(
112 | name="Make Arc Variables",
113 | type=mi_make_arc.MI_MakeArc_Settings,
114 | description="Make Arc Settings"
115 | )
116 |
117 | # alternative gui
118 | bpy.types.WindowManager.mirawindow = bpy.props.PointerProperty(type = mi_gui.DropdownMiraToolProps)
119 | bpy.types.INFO_MT_mesh_add.prepend(mi_gui.mifth_prim_menu)
120 |
121 |
122 | def unregister():
123 | import bpy
124 |
125 | #del bpy.types.Scene.miraTool
126 | #del bpy.types.Object.mi_curves # need to investigate if i need to delete it
127 | del bpy.types.Scene.mi_settings
128 | del bpy.types.Scene.mi_cur_stretch_settings
129 | del bpy.types.Scene.mi_cur_surfs_settings
130 | del bpy.types.Scene.mi_extrude_settings
131 | del bpy.types.Scene.mi_ldeformer_settings
132 | del bpy.types.Scene.mi_curguide_settings
133 | del bpy.types.Scene.mi_makearc_settings
134 |
135 | del bpy.types.WindowManager.mirawindow
136 | bpy.types.INFO_MT_mesh_add.remove(mi_gui.mifth_prim_menu)
137 |
138 | bpy.utils.unregister_module(__name__)
139 |
140 |
141 | if __name__ == "__main__":
142 | register()
143 |
--------------------------------------------------------------------------------
/blender/addons/2.8/mifth_tools/__init__.py:
--------------------------------------------------------------------------------
1 | # BEGIN GPL LICENSE BLOCK #####
2 | #
3 | # This program is free software; you can redistribute it and/or
4 | # modify it under the terms of the GNU General Public License
5 | # as published by the Free Software Foundation; either version 2
6 | # of the License, or (at your option) any later version.
7 | #
8 | # This program is distributed in the hope that it will be useful,
9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | # GNU General Public License for more details.
12 | #
13 | # You should have received a copy of the GNU General Public License
14 | # along with this program; if not, write to the Free Software Foundation,
15 | # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16 | #
17 | # END GPL LICENSE BLOCK #####
18 |
19 | bl_info = {
20 | "name": "Mifth Tools",
21 | "author": "mifth",
22 | "version": (0, 1, 0),
23 | "blender": (2, 80, 0),
24 | "location": "3D Viewport",
25 | "description": "Mifth Tools",
26 | "warning": "",
27 | "wiki_url": "",
28 | "tracker_url": "",
29 | "category": "Tools"}
30 |
31 | # if "bpy" in locals():
32 | # import imp
33 | # imp.reload(mifth_tools_cloning)
34 | # imp.reload(mifth_vertex_paint)
35 | # imp.reload(mifth_tools_base)
36 | # imp.reload(mifth_tools_ui)
37 | # else:
38 | # from . import mifth_tools_cloning
39 | # from . import mifth_vertex_paint
40 | # from . import mifth_tools_base
41 | # from . import mifth_tools_ui
42 |
43 | import bpy
44 | from bpy.props import *
45 |
46 | from . import mifth_tools_cloning
47 | from . import mifth_vertex_paint
48 | from . import mifth_tools_base
49 | from . import mifth_tools_ui
50 |
51 | # registration
52 | #def menu_vertex_paint_func(self, context):
53 | #self.layout.separator()
54 | #self.layout.menu(mifth_vertex_paint.MFTVertexPaintMenu.bl_idname)
55 |
56 |
57 | class MFTProperties(bpy.types.PropertyGroup):
58 |
59 | # Output Settings
60 | outputFolder : StringProperty(
61 | name="outputFolder",
62 | subtype="NONE",
63 | default="seq"
64 | )
65 |
66 | outputSubFolder : StringProperty(
67 | name="outputSubFolder",
68 | subtype="NONE",
69 | default="ren"
70 | )
71 |
72 | outputSequence : StringProperty(
73 | name="outputSequence",
74 | subtype="NONE",
75 | default="render"
76 | )
77 |
78 | outputSequenceSize : IntProperty(
79 | default=8,
80 | min=1,
81 | max=60
82 | )
83 |
84 | doOutputSubFolder : BoolProperty(
85 | name="do Output SubFolder",
86 | description="do Output SubFolder...",
87 | default=False
88 | )
89 |
90 | # Curve Animator Settings
91 | doUseSceneFrames : BoolProperty(
92 | name="do use scene frames",
93 | description="do use scene frames...",
94 | default=False
95 | )
96 |
97 | curveAniStartFrame : IntProperty(
98 | default=1,
99 | min=1,
100 | max=10000
101 | )
102 |
103 | curveAniEndFrame : IntProperty(
104 | default=100,
105 | min=1,
106 | max=10000
107 | )
108 |
109 | curveAniStepFrame : IntProperty(
110 | default=10,
111 | min=1,
112 | max=10000
113 | )
114 |
115 | curveAniInterpolation : FloatProperty(
116 | default=0.3,
117 | min=0.0,
118 | max=1.0
119 | )
120 |
121 | # MorfCreator settings
122 | morfCreatorNames : StringProperty(
123 | name="MorfNames",
124 | subtype="NONE",
125 | default=""
126 | )
127 |
128 | morfUseWorldMatrix : BoolProperty(
129 | name="use world matrix",
130 | description="use world matrix...",
131 | default=False
132 | )
133 |
134 | morfApplyModifiers : BoolProperty(
135 | name="apply modifiers to morf",
136 | description="apply modifiers to morf...",
137 | default=False
138 | )
139 |
140 |
141 | classes = (
142 | mifth_tools_ui.MFT_PT_PanelPose,
143 | mifth_tools_ui.MFT_PT_PanelAnimation,
144 | mifth_tools_ui.MFT_PT_PanelPlaykot,
145 | mifth_tools_ui.MFT_PT_PanelDrawClones,
146 | mifth_tools_ui.MFT_PT_PanelOtherTools,
147 | mifth_tools_ui.MFT_PT_PanelVertexPaint,
148 | mifth_tools_base.MFTOutputCreator,
149 | mifth_tools_base.MFTSceneRender2X,
150 | mifth_tools_base.MFTCropNodeRegion,
151 | mifth_tools_base.MFTCurveAnimator,
152 | mifth_tools_base.MFTMorfCreator,
153 | mifth_tools_base.MFTCopyBonesTransform,
154 | mifth_tools_cloning.MFTCloneProperties,
155 | mifth_tools_cloning.MFTDrawClones,
156 | mifth_tools_cloning.MFTPickObjToDrawClone,
157 | mifth_tools_cloning.MFTCloneToSelected,
158 | mifth_tools_cloning.MFTRadialClone,
159 | mifth_tools_cloning.MFTGroupInstance,
160 | mifth_tools_cloning.MFTGroupToMesh,
161 | mifth_vertex_paint.MFTSetColorToSelected,
162 | mifth_vertex_paint.MFTInvertColors,
163 | MFTProperties,
164 | )
165 |
166 |
167 | # Register
168 | def register():
169 | for cls in classes:
170 | bpy.utils.register_class(cls)
171 | #update_panel(None, bpy.context)
172 |
173 | bpy.types.Scene.mifthTools = PointerProperty(
174 | name="Mifth Tools Variables",
175 | type=MFTProperties,
176 | description="Mifth Tools Properties"
177 | )
178 |
179 | bpy.types.Scene.mifthCloneTools = PointerProperty(
180 | name="Mifth Cloning Variables",
181 | type=mifth_tools_cloning.MFTCloneProperties,
182 | description="Mifth Cloning Properties"
183 | )
184 |
185 | def unregister():
186 | for cls in classes:
187 | bpy.utils.unregister_class(cls)
188 |
189 |
190 | if __name__ == "__main__":
191 | register()
192 |
--------------------------------------------------------------------------------
/houdini/Houdini.keymap.overrides:
--------------------------------------------------------------------------------
1 | h.pane.gview.tool:sop_polybevel::3.0 PolyBevel "Shelf Tool: PolyBevel" Ctrl+B
2 | h.pane.gview.state.select.rotate "Rotate Tool" "Invoke the rotate tool" E
3 | HCONTEXT h.pane.gview.state.sop.sidefx_rbdconstraintsfromcurves "sidefx_rbdconstraintsfromcurves Operation" "These keys apply to the sidefx_rbdconstraintsfromcurves operation."
4 | HCONTEXT h.pane.gview.state.sop.sidefx_rbdconstraintsfromcurves.pystate "sidefx_rbdconstraintsfromcurves.pystate Operation" "These keys apply to the sidefx_rbdconstraintsfromcurves.pystate operation."
5 | h.pane.gview.state.sop.sidefx_rbdconstraintsfromcurves.pystate.toggle_edit "Toggle Hinge Edits" "Toggle Hinge Edits" 4
6 | h.pane.maximize_full Maximize "Toggle pane full screen" Alt+\\'
7 | h.find "Find Operator" "Find operator" Alt+F
8 | HCONTEXT h.pane.gview.state.sop.sidefx_rbdconstraintsfromrules "sidefx_rbdconstraintsfromrules Operation" "These keys apply to the sidefx_rbdconstraintsfromrules operation."
9 | HCONTEXT h.pane.gview.state.sop.sidefx_rbdconstraintsfromrules.pystate "sidefx_rbdconstraintsfromrules.pystate Operation" "These keys apply to the sidefx_rbdconstraintsfromrules.pystate operation."
10 | h.pane.gview.state.sop.sidefx_rbdconstraintsfromrules.pystate.toggle_edit "Toggle Hinge Edits" "Toggle Hinge Edits" 4
11 | HCONTEXT h.pane.gview.state.sop.sidefx_rbdpaintstroke "sidefx_rbdpaintstroke Operation" "These keys apply to the sidefx_rbdpaintstroke operation."
12 | HCONTEXT h.pane.gview.state.sop.sidefx_rbdpaintstroke.pystate "sidefx_rbdpaintstroke.pystate Operation" "These keys apply to the sidefx_rbdpaintstroke.pystate operation."
13 | h.pane.gview.state.sop.sidefx_rbdpaintstroke.pystate.cycle_brushes "Cycle brushes" "Cycle stroke tools" 1
14 | h.pane.gview.model.seltypegroups "Select Groups" "Select geometry groups" 9 Pad9 Shift+D
15 | HCONTEXT h.pane.gview.state.sop.sidefx_rbdconstraintsfromlines "sidefx_rbdconstraintsfromlines Operation" "These keys apply to the sidefx_rbdconstraintsfromlines operation."
16 | HCONTEXT h.pane.gview.state.sop.sidefx_rbdconstraintsfromlines.pystate "sidefx_rbdconstraintsfromlines.pystate Operation" "These keys apply to the sidefx_rbdconstraintsfromlines.pystate operation."
17 | h.pane.gview.state.sop.sidefx_rbdconstraintsfromlines.pystate.toggle_edit "Toggle Hinge Edits" "Toggle Hinge Edits" 4
18 | HCONTEXT h.pane.gview.state.sop.sidefx_bend "sidefx_bend Operation" "These keys apply to the sidefx_bend operation."
19 | h.pane.gview.state.sop.sidefx_bend.bend Bending "Modulate bend parameter with mouse wheel" 1
20 | h.pane.gview.state.sop.sidefx_rbdconstraintsfromrules.pystate.show_hinge_edit "Toggle Transform Handle" "Toggle Transform Handle" 2
21 | h.pane.gview.state.view.set_pivot_and_center "Set Pivot And Center" "Set pivot and center view to geometry under the cursor"
22 | mplay.quit Quit Quit Ctrl+Q
23 | h.pane.gview.tool:edges_to_face EdgesToFace "Shelf Tool: EdgesToFace" Ctrl+F
24 | h.pane.gview.repeat_current "Repeat Current Operation" "Quick-repeat current operation" Shift+Q
25 | h.pane.gview.toggle_wireshaded "Toggle Wireframe/Shaded" "Toggle wireframe/shaded" Ctrl+W
26 | h.pane.gview.state.select.move "Move Tool" "Invoke the move tool" W
27 | h.pane.gview.tool:sop_edgeloop "Edge Loop" "Shelf Tool: Edge Loop" Ctrl+R
28 | h.pane.gview.state.sop.sidefx_rbdconstraintsfromcurves.pystate.toggle_tweak "Toggle Transform Handle" "Toggle Transform Handle" 2
29 | h.pane.gview.state.sop.sidefx_rbdpaintstroke.pystate.realtime_mode realtime "Enable realtime mode" 0
30 | h.pane.gview.state.sop.sidefx_bend.twist Twisting "Modulate twist parameter with mouse wheel" 2
31 | h.pane.gview.state.sop.sidefx_bend.squish Squishing "Modulate squish parameter with mouse wheel" 5
32 | h.pane.closetab "Close Tab" "Close tab"
33 | h.pane.gview.repeat_current_branch "Repeat Current Operation Branched" "Quick-repeat current operation branched" Ctrl+Shift+Q
34 | gplay.quit Quit Quit Ctrl+Q
35 | h.pane.gview.state.sop.sidefx_bend.length "Length Scaling" "Modulate length scale parameter with mouse wheel" 3
36 | h.pane.gview.state.sop.sidefx_rbdconstraintsfromlines.pystate.toggle_enable "Toggle Enable Line" "Toggle Enable Line" 3
37 | h.pane.gview.state.sop.sidefx_rbdpaintstroke.pystate.log_state "Log state" "Log state attributes" 8
38 | h.pane.gview.state.sop.sidefx_rbdpaintstroke.pystate.set_wireframe_brush "Set wireframe brush" "Set wireframe brush" 2
39 | h.pane.gview.tool:hard_gun_prim Prim "Shelf Tool: Prim" Alt+A
40 | h.pane.gview.state.sop.sidefx_rbdconstraintsfromlines.pystate.toggle_tweak "Toggle Transform Handle" "Toggle Transform Handle" 2
41 | h.pane.gview.tool:sop_polyextrude::2.0 PolyExtrude "Shelf Tool: PolyExtrude" Ctrl+E
42 | h.pane.gview.state.sop.sidefx_rbdconstraintsfromrules.pystate.show_bbox_handle "Toggle BBox Handle" "Toggle BBox Handle" 3
43 | h.pane.gview.state.sop.sidefx_rbdpaintstroke.pystate.debug_msg "Debug messages" "Enable debug messages" 7
44 | h.pane.gview.state.sop.sidefx_bend.taper Tapering "Modulate taper parameter with mouse wheel" 4
45 | h.pane.gview.state.sop.sidefx_rbdconstraintsfromcurves.pystate.toggle_draw "Toggle Curve/Hinge Mode" "Toggle Curve/Hinge Mode" 1
46 | h.pane.gview.state.sop.sidefx_rbdconstraintsfromlines.pystate.toggle_draw "Toggle Curve/Hinge Mode" "Toggle Curve/Hinge Mode" 1
47 | h.pane.gview.state.sop.sidefx_rbdpaintstroke.pystate.set_viewport_brush "Set viewport brush" "Set viewport brush" 3
48 | h.pane.gview.tool:sop_polysplit::2.0 PolySplit "Shelf Tool: PolySplit" Alt+R
49 | h.pane.gview.state.sop.sidefx_rbdpaintstroke.pystate.reload_state "Reload state" "Reload state" 9
50 | h.pane.gview.tool:merge_verts "Merge Verts" "Shelf Tool: Merge Verts" Alt+C
51 | h.pane.gview.state.new_select "Select Tool" "Invoke the select tool" Q
52 | h.pane.gview.tool:object_pose "Pose Tool" "Invoke the pose tool" Ctrl+Shift+R
53 | h.pane.gview.state.sop.sidefx_rbdconstraintsfromcurves.pystate.toggle_enable "Toggle Enable Curve" "Toggle Enable Curve" 3
54 | h.pane.gview.state.view.set_pivot "Set Pivot" "Set pivot to geometry under the cursor" Z
55 | h.pane.gview.state.sop.sidefx_rbdconstraintsfromrules.pystate.toggle "Toggle Handles" "Toggle Handles" Z
56 | h.pane.copytab "Copy Tab" "Copy tab"
57 | h.pane.gview.state.sop.sidefx_rbdpaintstroke.pystate.trace "Trace callbacks" "Enable trace for callbacks" 6
58 | h.pane.gview.tool:hard_gun_merge Merge "Shelf Tool: Merge" Shift+M
59 | h.pane.wsheet.bypass_mode "Set Bypass Flag" "Hold this key and select a node to toggle the bypass flag value" B
60 | h.pane.gview.tool:hard_gun_view_subdive "View Subdive" "Shelf Tool: View Subdive" Ctrl+~
61 | h.pane.gview.tool:hard_gun_view_subdive_2 "View Subdive 2" "Shelf Tool: View Subdive 2" Ctrl+`
62 | deskmgr.add Add "Add a desktop" D
63 | h.pane.gview.state.view.cycle_view_context "Cycle View Context" "Cycle view context" Alt+Z
64 | h.copy Copy "Copy selection" Ctrl+C
65 | h.pane.gview.state.select.scale "Scale Tool" "Invoke the scale tool" R
66 | h.quit Quit "Quit the appication" Ctrl+Q
67 |
--------------------------------------------------------------------------------
/blender/addons/2.8/mira_tools/mi_unbevel.py:
--------------------------------------------------------------------------------
1 | import bpy
2 | import bmesh
3 | import math
4 | from math import *
5 | import mathutils as mathu
6 |
7 | from bpy.props import *
8 | from bpy.types import Operator, AddonPreferences
9 |
10 | from . import mi_utils_base as ut_base
11 | from . import mi_looptools as loop_t
12 | from mathutils import Vector, Matrix
13 |
14 |
15 | class MI_OT_Unbevel(bpy.types.Operator):
16 |
17 | """Draw a line with the mouse"""
18 | bl_idname = "mira.unbevel"
19 | bl_label = "Unbevel"
20 | bl_description = "Unbevel"
21 | bl_options = {'REGISTER', 'UNDO'}
22 |
23 | #reset_values: BoolProperty(default=False)
24 | unbevel_value: bpy.props.FloatProperty(name="Unbevel Value", description="Unbevel Value", default=1.0, min=0.0)
25 |
26 | def execute(self, context):
27 |
28 | #if self.reset_values is True:
29 | #self.reset_all_values()
30 |
31 | active_obj = context.active_object
32 |
33 | bm = bmesh.from_edit_mesh(active_obj.data)
34 | bm.verts.ensure_lookup_table()
35 | #verts = [v for v in bm.verts if v.select]
36 |
37 | # get loops
38 | loops = loop_t.get_connected_input(bm)
39 | loops = loop_t.check_loops(loops, bm)
40 |
41 | if not loops:
42 | #self.report({'WARNING'}, "No Loops!")
43 | #return {'CANCELLED'}
44 |
45 | b_edges = [edge for edge in bm.edges if edge.select]
46 |
47 | #obj_matrix = active_obj.matrix_world
48 | #obj_matrix_inv = obj_matrix.inverted()
49 |
50 | if self.unbevel_value != 1:
51 |
52 | degree_90 = 1.5708
53 |
54 | if loops:
55 | for loop in loops:
56 | if loop[1] is True:
57 | continue
58 |
59 | loop_verts = []
60 |
61 | for ind in loop[0]:
62 | loop_verts.append(bm.verts[ind])
63 |
64 | v1 = (loop_verts[1].co - loop_verts[0].co).normalized()
65 | v2 = (loop_verts[2].co - loop_verts[1].co).normalized()
66 | angle_1 = v1.angle(v2) / 2
67 |
68 | v3 = (loop_verts[-2].co - loop_verts[-1].co).normalized()
69 | v4 = (loop_verts[-3].co - loop_verts[-2].co).normalized()
70 | angle_2 = v1.angle(v2) / 2
71 |
72 | rot_dir = v1.cross(v2).normalized()
73 | rot_mat = Matrix.Rotation(-angle_1, 3, rot_dir)
74 | rot_mat_2 = Matrix.Rotation((angle_2 - degree_90), 3, rot_dir)
75 | v1_nor = ((rot_mat @ v1).normalized() * 10000) + loop_verts[0].co
76 | v3_nor = (rot_mat_2 @ v3).normalized()
77 |
78 | scale_pos = mathu.geometry.intersect_line_plane(loop_verts[0].co, v1_nor, loop_verts[-1].co, v3_nor)
79 |
80 | for vert in loop_verts:
81 | vert.co = scale_pos.lerp(vert.co, self.unbevel_value)
82 |
83 | if self.unbevel_value == 0:
84 | bpy.ops.mesh.merge(type='COLLAPSE')
85 |
86 | bm.normal_update()
87 | bmesh.update_edit_mesh(active_obj.data)
88 |
89 | elif b_edges:
90 | b_edges_pos = []
91 | b_edgess_ids = [edge.index for edge in b_edges]
92 |
93 | for edge in b_edges:
94 | verts = edge.verts
95 |
96 | # fix normals
97 | if len(edge.link_faces) > 1:
98 | linked_edges_0 = 0
99 | linked_edges_1 = 0
100 |
101 | for edge2 in edge.link_faces[0].edges:
102 | if edge2.index in b_edgess_ids:
103 | linked_edges_0 += 1
104 |
105 | for edge2 in edge.link_faces[1].edges:
106 | if edge2.index in b_edgess_ids:
107 | linked_edges_1 += 1
108 |
109 | if len(edge.link_faces[0].verts) > 4 or linked_edges_0 < 2:
110 | ed_normal = edge.link_faces[1].normal
111 | elif len(edge.link_faces[1].verts) > 4 or linked_edges_1 < 2:
112 | ed_normal = edge.link_faces[0].normal
113 | else:
114 | ed_normal = edge.link_faces[0].normal.lerp(edge.link_faces[1].normal, 0.5)
115 |
116 | fix_dir = ed_normal.cross( (verts[0].co - verts[1].co).normalized() )
117 | v0_nor = mathu.geometry.intersect_line_plane(verts[0].normal + (fix_dir * 2), verts[0].normal - (fix_dir * 2), Vector((0,0,0)), fix_dir).normalized()
118 | v1_nor = mathu.geometry.intersect_line_plane(verts[1].normal + (fix_dir * 2), verts[1].normal - (fix_dir * 2), Vector((0,0,0)), fix_dir).normalized()
119 | #nor_dir = ed_normal
120 |
121 | else:
122 | v0_nor = verts[0].normal
123 | v1_nor = verts[1].normal
124 | #nor_dir = v0_nor.lerp(v1_nor, 0.5).normalized()
125 |
126 | # base math
127 | nor_dir = v0_nor.lerp(v1_nor, 0.5).normalized()
128 | side_dir_2 = (verts[0].co - verts[1].co).normalized()
129 | side_dir_2.negate()
130 | side_dir_1 = nor_dir.cross(side_dir_2).normalized()
131 | #side_dir_2 = (verts[0].co - verts[1].co).normalized()
132 | #side_dir_2 = nor_dir.cross(side_dir_1).normalized()
133 |
134 | pos_between = verts[0].co.lerp(verts[1].co, 0.5)
135 | angle_between_1 = v0_nor.angle(nor_dir)
136 | angle_between_2 = v1_nor.angle(nor_dir)
137 |
138 | rot_mat = Matrix.Rotation((-angle_between_1 * 2) - degree_90, 3, side_dir_1)
139 | rot_mat_2 = Matrix.Rotation((angle_between_1 * 2) + (degree_90 * 2), 3, side_dir_1)
140 | dir_1 = ((rot_mat @ nor_dir).normalized() * 10000) + verts[0].co
141 | dir_2 = (rot_mat_2 @ nor_dir).normalized()
142 |
143 | scale_pos = mathu.geometry.intersect_line_plane(verts[0].co, dir_1, verts[1].co, dir_2)
144 | b_edges_pos.append((verts[0], scale_pos))
145 | b_edges_pos.append((verts[1], scale_pos))
146 |
147 | for v_data in b_edges_pos:
148 | v_data[0].co = v_data[1].lerp(v_data[0].co, self.unbevel_value)
149 |
150 | if self.unbevel_value == 0:
151 | bpy.ops.mesh.merge(type='COLLAPSE')
152 |
153 | bm.normal_update()
154 | bmesh.update_edit_mesh(active_obj.data)
155 |
156 | return {'FINISHED'}
157 |
--------------------------------------------------------------------------------
/houdini/toolbar/mf_obj.shelf:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
53 |
54 |
55 |
56 |
104 |
105 |
106 |
107 |
108 | OBJ
109 |
110 |
114 |
115 |
116 |
117 |
118 | OBJ
119 |
120 |
125 |
126 |
127 |
128 |
147 |
148 |
149 |
150 |
164 |
165 |
166 |
167 |
174 |
175 |
176 |
--------------------------------------------------------------------------------
/blender/addons/2.8/mifth_tools/mifth_tools_ui.py:
--------------------------------------------------------------------------------
1 | import bpy
2 | from bpy.props import *
3 | from bpy.types import Operator, AddonPreferences
4 |
5 |
6 | class MFT_PT_PanelPose(bpy.types.Panel):
7 | bl_label = "Bones"
8 | bl_space_type = 'VIEW_3D'
9 | bl_region_type = 'UI'
10 | bl_context = "posemode"
11 | bl_category = 'Mifth'
12 | bl_options = {'DEFAULT_CLOSED'}
13 |
14 | def draw(self, context):
15 | layout = self.layout
16 | mifthTools = context.scene.mifthTools
17 |
18 | op = layout.operator("mft.copy_bones_transform", text="CopyBonesTransform")
19 | op.mode = 'Copy'
20 | op = layout.operator("mft.copy_bones_transform", text="PasteBonesTransform")
21 | op.mode = 'Paste'
22 |
23 |
24 | class MFT_PT_PanelAnimation(bpy.types.Panel):
25 | bl_label = "Animations"
26 | bl_space_type = 'VIEW_3D'
27 | bl_region_type = 'UI'
28 | bl_context = "objectmode"
29 | bl_category = 'Mifth'
30 | bl_options = {'DEFAULT_CLOSED'}
31 |
32 | def draw(self, context):
33 | layout = self.layout
34 | mifthTools = context.scene.mifthTools
35 |
36 | layout.operator("mft.curveanimator", text="Curve Animator")
37 | layout.prop(mifthTools, "doUseSceneFrames", text='UseSceneFrames')
38 | row = layout.row()
39 | row.prop(mifthTools, "curveAniStartFrame", text='Start')
40 | row.prop(mifthTools, "curveAniEndFrame", text='End')
41 | row = layout.row()
42 | row.prop(mifthTools, "curveAniStepFrame", text='Steps')
43 | row.prop(mifthTools, "curveAniInterpolation", text='Interpolation')
44 |
45 | layout.separator()
46 | layout.separator()
47 | layout.operator("mft.morfcreator", text="Morfer")
48 | layout.prop(mifthTools, "morfCreatorNames")
49 | layout.prop(mifthTools, "morfUseWorldMatrix", text='useWorldMatrix')
50 | layout.prop(mifthTools, "morfApplyModifiers", text='applyModifiers')
51 |
52 |
53 | class MFT_PT_PanelPlaykot(bpy.types.Panel):
54 | bl_label = "PlaykotTools"
55 | bl_space_type = 'NODE_EDITOR'
56 | bl_region_type = 'UI'
57 | bl_context = "objectmode"
58 | bl_category = 'Mifth'
59 | bl_options = {'DEFAULT_CLOSED'}
60 |
61 | def draw(self, context):
62 | layout = self.layout
63 | mifthTools = context.scene.mifthTools
64 |
65 | layout.operator("mft.render_scene_2x", text="ScaleCrop")
66 | layout.operator("mft.cropnoderegion", text="CropNodeRegion")
67 | layout.operator("mft.crop_to_viewport", text="CropToViewport")
68 |
69 | layout.separator()
70 | layout.operator("mft.outputcreator", text="Create Output")
71 | layout.prop(mifthTools, "outputFolder")
72 | row = layout.row()
73 | row.prop(mifthTools, "outputSubFolder")
74 | row.prop(mifthTools, "doOutputSubFolder", text='')
75 | layout.prop(mifthTools, "outputSequence")
76 | layout.prop(mifthTools, "outputSequenceSize")
77 |
78 |
79 | class MFT_PT_PanelDrawClones(bpy.types.Panel):
80 | bl_label = "Draw Clones"
81 | bl_space_type = 'VIEW_3D'
82 | bl_region_type = 'UI'
83 | bl_context = "objectmode"
84 | bl_category = 'Mifth'
85 | bl_options = {'DEFAULT_CLOSED'}
86 |
87 | def draw(self, context):
88 | layout = self.layout
89 | mifthTools = bpy.context.scene.mifthTools
90 | mifthCloneTools = bpy.context.scene.mifthCloneTools
91 |
92 | layout.label(text="Draw Clones:")
93 | layout.operator("mft.draw_clones", text="DrawClones")
94 | layout.operator("mft.pick_obj_to_clone_draw", text="PickObjects")
95 | layout.separator()
96 |
97 | layout.prop(mifthCloneTools, "drawClonesDirectionRotate", text='DirectionRotate')
98 | layout.prop(mifthCloneTools, "drawClonesRadialRotate", text='RadialRotate')
99 | layout.prop(mifthCloneTools, "drawClonesNormalRotate", text='NormalRotate')
100 | layout.separator()
101 |
102 | layout.prop(mifthCloneTools, "drawClonesOffsetNomalBefore", text='OffsetNormal')
103 | layout.prop(mifthCloneTools, "drawClonesRotateNomalAfter", text='RotateNormal')
104 | layout.separator()
105 |
106 | layout.prop(mifthCloneTools, "drawStrokeLength", text='Stroke')
107 | layout.prop(mifthCloneTools, "drawRandomStrokeScatter", text='Scatter')
108 | layout.separator()
109 |
110 | layout.prop(mifthCloneTools, "randNormalRotateClone", text='RandNormal')
111 | layout.prop(mifthCloneTools, "randDirectionRotateClone", text='RandDirection')
112 | layout.prop(mifthCloneTools, "randScaleClone", text='RandScale')
113 | layout.separator()
114 |
115 | layout.prop(mifthCloneTools, "drawPressure", text='DrawPressure')
116 | row = layout.row()
117 | row.prop(mifthCloneTools, "drawPressureRelativeStroke", text='S')
118 | row.prop(mifthCloneTools, "drawPressureScale", text='S')
119 | row.prop(mifthCloneTools, "drawPressureScatter", text='S')
120 | layout.separator()
121 |
122 | layout.prop(mifthCloneTools, "drawClonesAxis", text='Axis')
123 |
124 |
125 | class MFT_PT_PanelOtherTools(bpy.types.Panel):
126 | bl_label = "Other Tools"
127 | bl_space_type = 'VIEW_3D'
128 | bl_region_type = 'UI'
129 | bl_context = "objectmode"
130 | bl_category = 'Mifth'
131 | bl_options = {'DEFAULT_CLOSED'}
132 |
133 | def draw(self, context):
134 | layout = self.layout
135 | mifthTools = bpy.context.scene.mifthTools
136 | mifthCloneTools = bpy.context.scene.mifthCloneTools
137 |
138 | layout.label(text="Clone Selected:")
139 | layout.operator("mft.clonetoselected", text="CloneToSelected")
140 | layout.separator()
141 |
142 | layout.label(text="Radial Clone:")
143 | layout.operator("mft.radialclone", text="Radial Clone")
144 | # layout.prop(mifthTools, "radialClonesNumber", text='')
145 | row = layout.row()
146 | row.prop(mifthCloneTools, "radialClonesAxis", text='')
147 | row.prop(mifthCloneTools, "radialClonesAxisType", text='')
148 | layout.separator()
149 |
150 | layout.label(text="Position Group:")
151 | layout.operator("mft.group_instance_to_cursor", text="Position Group")
152 | layout.prop(mifthCloneTools, "getGroupsLst", text='')
153 | layout.separator()
154 |
155 | layout.operator("mft.group_to_mesh", text="Groups To Mesh")
156 |
157 |
158 | class MFT_PT_PanelVertexPaint(bpy.types.Panel):
159 | bl_label = "Vertex Paint"
160 | bl_space_type = 'VIEW_3D'
161 | bl_region_type = 'UI'
162 | bl_context = "vertexpaint"
163 | bl_category = 'Mifth'
164 | bl_options = {'DEFAULT_CLOSED'}
165 |
166 | def draw(self, context):
167 | layout = self.layout
168 | mifthTools = bpy.context.scene.mifthTools
169 |
170 | layout.operator("mftv.set_colors_to_selected", text="Set Colors")
171 | layout.operator("mftv.invert_colors", text="Invert Colors")
172 |
--------------------------------------------------------------------------------
/blender/addons/2.8/mira_tools/mi_linear_widget.py:
--------------------------------------------------------------------------------
1 | import gpu
2 | from gpu_extras.batch import batch_for_shader
3 |
4 | import bpy
5 | from bpy.props import *
6 | from bpy_extras import view3d_utils
7 |
8 | import mathutils as mathu
9 | from mathutils import Vector
10 |
11 | from . import mi_utils_base as ut_base
12 |
13 |
14 | shader3d = gpu.shader.from_builtin('POINT_UNIFORM_COLOR' if bpy.app.version >= (4, 5, 0) else 'UNIFORM_COLOR')
15 | shader2d = gpu.shader.from_builtin('POINT_UNIFORM_COLOR' if bpy.app.version >= (4, 5, 0) else 'UNIFORM_COLOR')
16 |
17 |
18 | class MI_LW_Point():
19 |
20 | # class constructor
21 | def __init__(self, position):
22 | self.position = position
23 |
24 |
25 | class MI_Linear_Widget():
26 |
27 | # class constructor
28 | def __init__(self):
29 | self.start_point = None
30 | self.middle_point = None
31 | self.end_point = None
32 |
33 |
34 | def update_middle_point(lw_tool):
35 | lw_dir = (lw_tool.end_point.position - lw_tool.start_point.position)
36 | lw_len = (lw_dir).length
37 | lw_dir = lw_dir.normalized()
38 |
39 | lw_tool.middle_point.position = lw_tool.start_point.position + (lw_dir * (lw_len / 2.0))
40 |
41 |
42 | def get_tool_verts(lw_tool, verts_ids, bm, obj, do_clamp, local_coords):
43 | apply_tool_verts = []
44 | final_dir = ( lw_tool.end_point.position - lw_tool.start_point.position )
45 | max_dist = final_dir.length
46 | for vert_id in verts_ids:
47 | v_pos = obj.matrix_world @ bm.verts[vert_id].co
48 | value = mathu.geometry.distance_point_to_plane(v_pos, lw_tool.start_point.position, final_dir)
49 | if value > 0:
50 | if value > max_dist and do_clamp:
51 | value = 1.0
52 | else:
53 | value /= max_dist
54 |
55 | pos_final = v_pos
56 | if local_coords is True:
57 | pos_final = bm.verts[vert_id].co.copy()
58 |
59 | apply_tool_verts.append( (vert_id, value, pos_final) )
60 |
61 | return apply_tool_verts
62 |
63 |
64 | def draw_lw(context, lw, cross_up_dir, draw_faloff):
65 | region = context.region
66 | rv3d = context.region_data
67 | addon_prefs = context.preferences.addons[__package__].preferences
68 |
69 | start_2d = view3d_utils.location_3d_to_region_2d(region, rv3d, lw.start_point.position)
70 | end_2d = view3d_utils.location_3d_to_region_2d(region, rv3d, lw.end_point.position)
71 | middle_2d = view3d_utils.location_3d_to_region_2d(region, rv3d, lw.middle_point.position)
72 |
73 | dist_ends = ((lw.start_point.position - lw.end_point.position).length * 0.1) * cross_up_dir
74 | end_p1 = view3d_utils.location_3d_to_region_2d(region, rv3d, lw.end_point.position + dist_ends)
75 | end_p2 = view3d_utils.location_3d_to_region_2d(region, rv3d, lw.end_point.position - dist_ends)
76 |
77 | if start_2d and end_2d and end_p1 and end_p2:
78 | gpu.state.line_width_set(addon_prefs.line_size)
79 | gpu.state.point_size_set(addon_prefs.point_size)
80 |
81 | coords = ((start_2d[0], start_2d[1]), (end_2d[0], end_2d[1]))
82 | batch = batch_for_shader(shader2d, 'LINE_STRIP', {"pos": coords})
83 | shader2d.bind()
84 | shader2d.uniform_float("color", (0.99, 0.5, 0.99, 1.0))
85 | batch.draw(shader2d)
86 |
87 |
88 | if draw_faloff:
89 | coords = ((start_2d[0], start_2d[1]), (end_p1[0], end_p1[1]), (end_p2[0], end_p2[1]))
90 | batch = batch_for_shader(shader2d, 'LINE_LOOP', {"pos": coords})
91 | shader2d.bind()
92 | shader2d.uniform_float("color", (0.99, 0.5, 0.99, 1.0))
93 | batch.draw(shader2d)
94 |
95 | coords = ((start_2d[0], start_2d[1]), (middle_2d[0], middle_2d[1]), (end_2d[0], end_2d[1]))
96 | batch = batch_for_shader(shader2d, 'POINTS', {"pos": coords})
97 | shader2d.bind()
98 | shader2d.uniform_float("color", (0.99, 0.8, 0.5, 1.0))
99 | batch.draw(shader2d)
100 |
101 |
102 | def pick_lw_point(context, m_coords, lw):
103 | region = context.region
104 | rv3d = context.region_data
105 | addon_prefs = context.preferences.addons[__package__].preferences
106 |
107 | return_point = None
108 | good_distance = None
109 |
110 | mouse_coords = Vector(m_coords)
111 |
112 | lw_points = [lw.start_point, lw.middle_point, lw.end_point]
113 | for lw_point in lw_points:
114 | vec_2d = view3d_utils.location_3d_to_region_2d(region, rv3d, lw_point.position)
115 | dist = (vec_2d - mouse_coords).length
116 | if dist <= addon_prefs.select_point_radius:
117 | if not return_point:
118 | return_point = lw_point
119 | good_distance = dist
120 | elif good_distance > dist:
121 | return_point = lw_point
122 | good_distance = dist
123 |
124 | return return_point
125 |
126 |
127 | def setup_lw_tool(rv3d, lw_tool, active_obj, verts, center_type, scale_size):
128 | # Types
129 | # 'Auto', 'X', 'X_Left', 'X_Right', 'Z', 'Z_Top', 'Z_Bottom'
130 |
131 | # get verts bounds
132 | cam_x = (rv3d.view_rotation @ Vector((1.0, 0.0, 0.0))).normalized()
133 | cam_y = (rv3d.view_rotation @ Vector((0.0, 1.0, 0.0))).normalized()
134 | #cam_z = (rv3d.view_rotation @ Vector((0.0, 0.0, -1.0))).normalized() # Camera Direction
135 | bounds = ut_base.get_verts_bounds(verts, active_obj, cam_x, cam_y, None, False)
136 |
137 | # set middle_point
138 | middle_p = None
139 | if center_type in {'Auto', 'X', 'Z'}:
140 | middle_p = bounds[3]
141 | elif center_type == 'X_Left':
142 | middle_p = bounds[3] + (cam_y * (bounds[1] / 2.0))
143 | elif center_type == 'X_Right':
144 | middle_p = bounds[3] - (cam_y * (bounds[1] / 2.0))
145 | elif center_type == 'Z_Top':
146 | middle_p = bounds[3] - (cam_x * (bounds[0] / 2.0))
147 | elif center_type == 'Z_Bottom':
148 | middle_p = bounds[3] + (cam_x * (bounds[0] / 2.0))
149 |
150 | # set lw_tool points
151 | start_p = None
152 | end_p = None
153 | if center_type == 'Auto':
154 | if bounds[0] > bounds[1]:
155 | # scale_size is additive value so that to get points on the top and on the left
156 | start_p = middle_p - (cam_x * (bounds[0] / 2.0) * scale_size)
157 | end_p = middle_p + (cam_x * (bounds[0] / 2.0) * scale_size)
158 | else:
159 | start_p = middle_p - (cam_y * (bounds[1] / 2.0) * scale_size)
160 | end_p = middle_p + (cam_y * (bounds[1] / 2.0) * scale_size)
161 | elif center_type in {'X', 'X_Left', 'X_Right'}:
162 | # scale_size is additive value so that to get points on the top and on the left
163 | start_p = middle_p - (cam_x * (bounds[0] / 2.0) * scale_size)
164 | end_p = middle_p + (cam_x * (bounds[0] / 2.0) * scale_size)
165 | elif center_type in {'Z', 'Z_Top', 'Z_Bottom'}:
166 | # scale_size is additive value so that to get points on the top and on the left
167 | start_p = middle_p - (cam_y * (bounds[1] / 2.0) * scale_size)
168 | end_p = middle_p + (cam_y * (bounds[1] / 2.0) * scale_size)
169 |
170 | lw_tool.start_point = MI_LW_Point(start_p)
171 | lw_tool.middle_point = MI_LW_Point(middle_p)
172 | lw_tool.end_point = MI_LW_Point(end_p)
173 |
--------------------------------------------------------------------------------
/other/exchangers/blender/2.7/blender_exchanger/blender_exchanger.py:
--------------------------------------------------------------------------------
1 | # ***** BEGIN GPL LICENSE BLOCK *****
2 | #
3 | #
4 | # This program is free software; you can redistribute it and/or
5 | # modify it under the terms of the GNU General Public License
6 | # as published by the Free Software Foundation; either version 2
7 | # of the License, or (at your option) any later version.
8 | #
9 | # This program is distributed in the hope that it will be useful,
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | # GNU General Public License for more details.
13 | #
14 | # You should have received a copy of the GNU General Public License
15 | # along with this program; if not, write to the Free Software Foundation,
16 | # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 | #
18 | # ***** END GPL LICENCE BLOCK *****
19 |
20 | import bpy
21 | from bpy.props import *
22 | from bpy.types import Operator, AddonPreferences
23 | import os
24 | import shutil
25 |
26 |
27 | class EX_MainPanel(bpy.types.Panel):
28 | bl_label = "Exchanger"
29 | bl_space_type = 'VIEW_3D'
30 | bl_region_type = 'TOOLS'
31 | bl_context = "objectmode"
32 | bl_category = 'Ex'
33 | #bl_options = {'DEFAULT_CLOSED'}
34 |
35 | def draw(self, context):
36 | layout = self.layout
37 | scene = context.scene
38 | b_exchanger = bpy.context.scene.b_exchanger
39 |
40 | # GUI
41 | row = layout.row()
42 |
43 | col = row.column()
44 |
45 | col.operator("ex_export.exchanger", text="Export")
46 | #op.world_scale = 1.0
47 | col.operator("ex_import.exchanger", text="Import")
48 | #op.world_scale = 1.0
49 |
50 | layout.separator()
51 |
52 | row = layout.row()
53 | op = col.operator("ex_export.exchanger", text="ExportHoudini")
54 | op.world_scale = 0.01
55 | op = col.operator("ex_import.exchanger", text="ImportHoudini")
56 | op.world_scale = 100.0
57 |
58 | row = layout.row()
59 | row.prop(b_exchanger, "doApplyModifiers", text="Apply Modifiers")
60 | row = layout.row()
61 | row.prop(b_exchanger, "exportMaterials", text="Export Materials")
62 | row = layout.row()
63 | row.prop(b_exchanger, "importNormals", text="Import Normals")
64 |
65 |
66 | class EX_AddonPreferences(AddonPreferences):
67 | # this must match the addon name, use '__package__'
68 | # when defining this in a submodule of a python package.
69 | # bl_idname = __name__
70 | bl_idname = __package__
71 |
72 | exchangedir = StringProperty(
73 | name="ExchangeFolder",
74 | subtype="DIR_PATH",
75 | default="",
76 | )
77 |
78 | def draw(self, context):
79 | layout = self.layout
80 | row = layout.row()
81 | row.label(text="Please, set Exchanges Folder and save Preferences")
82 | row = layout.row()
83 | row.prop(self, "exchangedir")
84 |
85 |
86 | class EX_ExportScene(bpy.types.Operator):
87 | bl_idname = "ex_export.exchanger"
88 | bl_label = "Export your custom property"
89 | bl_description = "Export your custom property"
90 | bl_options = {'UNDO'}
91 |
92 | world_scale = FloatProperty( default=1.0 )
93 |
94 | def invoke(self, context, event):
95 | # Addon Preferences
96 | user_preferences = context.user_preferences
97 | addon_prefs = user_preferences.addons[__package__].preferences
98 |
99 | b_exchanger = bpy.context.scene.b_exchanger
100 | scene = context.scene
101 |
102 | exchange_dir = addon_prefs.exchangedir.replace("\\", os.sep)
103 | if exchange_dir.endswith(os.sep) is False:
104 | exchange_dir += os.sep
105 |
106 | if len(bpy.context.selected_objects) > 0 and os.path.isdir(addon_prefs.exchangedir):
107 |
108 | # change render levl of susurf and multires for good export
109 | fix_modidiers = []
110 | for obj in bpy.context.selected_objects:
111 | for mod in obj.modifiers:
112 | if mod.type in {'SUBSURF', 'MULTIRES'}:
113 | fix_modidiers.append((mod, mod.render_levels))
114 |
115 | if mod.show_viewport is False:
116 | mod.render_levels = 0
117 | else:
118 | mod.render_levels = mod.levels
119 |
120 | # Export setings
121 | model_path = exchange_dir + "exchange.fbx"
122 | apply_modifiers = b_exchanger.doApplyModifiers
123 |
124 | # Export Model
125 | bpy.ops.export_scene.fbx(filepath=model_path, check_existing=True, axis_forward='-Z', axis_up='Y', use_selection=True, global_scale=self.world_scale, apply_unit_scale=True, bake_space_transform=True, use_mesh_modifiers=apply_modifiers, use_custom_props=True, primary_bone_axis='Y', secondary_bone_axis='X')
126 |
127 | # revert render level of modifiers back
128 | for mod_stuff in fix_modidiers:
129 | mod_stuff[0].render_levels = mod_stuff[1]
130 | fix_modidiers = None # clear array
131 |
132 | else:
133 | self.report(
134 | {'INFO'}, "No Selected Objects or Bad Exchange Folder!!!")
135 |
136 | return {'FINISHED'}
137 |
138 |
139 | class EX_ImportScene(bpy.types.Operator):
140 | bl_idname = "ex_import.exchanger"
141 | bl_label = "import your custom property"
142 | bl_description = "import your custom property"
143 | bl_options = {'UNDO'}
144 |
145 | world_scale = FloatProperty( default=1.0 )
146 |
147 | def invoke(self, context, event):
148 | # Addon Preferences
149 | user_preferences = context.user_preferences
150 | addon_prefs = user_preferences.addons[__package__].preferences
151 |
152 | scene = context.scene
153 | b_exchanger = bpy.context.scene.b_exchanger
154 |
155 | exchange_dir = addon_prefs.exchangedir.replace("\\", os.sep)
156 | if exchange_dir.endswith(os.sep) is False:
157 | exchange_dir += os.sep
158 |
159 | if os.path.isdir(exchange_dir):
160 |
161 | ## fix for animation removement for Modo
162 | #scene_objects = []
163 | #for obj in bpy.context.scene.objects:
164 | #scene_objects.append(obj.name)
165 |
166 | # Import setings
167 | model_path = exchange_dir + "exchange.fbx"
168 | importNormals = b_exchanger.importNormals
169 |
170 | # IMPORT
171 | bpy.ops.import_scene.fbx(filepath=model_path, axis_forward='-Z', axis_up='Y', global_scale=self.world_scale, bake_space_transform=True, use_custom_normals=importNormals, force_connect_children=False, primary_bone_axis='Y', secondary_bone_axis='X', use_prepost_rot=True)
172 |
173 | ## remove animatrins. Fix for Modo
174 | #for obj in scene.objects:
175 | #if obj.name not in scene_objects:
176 | #obj.animation_data.action.use_fake_user = False
177 | #obj.animation_data.action = None
178 |
179 | #scene_objects = None # clear
180 |
181 | else:
182 | self.report({'INFO'}, "Bad Exchange Folder!!!")
183 |
184 | return {'FINISHED'}
185 |
--------------------------------------------------------------------------------
/blender/addons/2.8/mira_tools/mi_looptools.py:
--------------------------------------------------------------------------------
1 | # import bmesh
2 | # import bpy
3 | # import collections
4 | # import mathutils
5 | # import math
6 | # from bpy_extras import view3d_utils
7 |
8 | # THIS CODE IS TAKEN FROM BLENDER LOOPTOOLS ADDON. Thanks a lot to Bart Crouch.
9 |
10 | ##########################################
11 | ####### General functions ################
12 | ##########################################
13 |
14 |
15 | # check loops and only return valid ones
16 | # method is modified
17 | def check_loops(loops, bm_mod):
18 | valid_loops = []
19 | for loop, circular in loops:
20 | # loop needs to have at least 3 vertices
21 | if len(loop) < 3:
22 | continue
23 | ## loop needs at least 1 vertex in the original, non-mirrored mesh
24 | #if mapping:
25 | #all_virtual = True
26 | #for vert in loop:
27 | #if mapping[vert] > -1:
28 | #all_virtual = False
29 | #break
30 | #if all_virtual:
31 | #continue
32 | # vertices can not all be at the same location
33 | stacked = True
34 | for i in range(len(loop) - 1):
35 | if (bm_mod.verts[loop[i]].co - \
36 | bm_mod.verts[loop[i+1]].co).length > 1e-6:
37 | stacked = False
38 | break
39 | if stacked:
40 | continue
41 | # passed all tests, loop is valid
42 | valid_loops.append([loop, circular])
43 |
44 | return(valid_loops)
45 |
46 |
47 | # input: bmesh, output: dict with the edge-key as key and face-index as value
48 | def dict_edge_faces(bm):
49 | edge_faces = dict([[edgekey(edge), []] for edge in bm.edges if \
50 | not edge.hide])
51 | for face in bm.faces:
52 | if face.hide:
53 | continue
54 | for key in face_edgekeys(face):
55 | edge_faces[key].append(face.index)
56 |
57 | return(edge_faces)
58 |
59 |
60 | # input: bmesh (edge-faces optional), output: dict with face-face connections
61 | def dict_face_faces(bm, edge_faces=False):
62 | if not edge_faces:
63 | edge_faces = dict_edge_faces(bm)
64 |
65 | connected_faces = dict([[face.index, []] for face in bm.faces if \
66 | not face.hide])
67 | for face in bm.faces:
68 | if face.hide:
69 | continue
70 | for edge_key in face_edgekeys(face):
71 | for connected_face in edge_faces[edge_key]:
72 | if connected_face == face.index:
73 | continue
74 | connected_faces[face.index].append(connected_face)
75 |
76 | return(connected_faces)
77 |
78 |
79 | # input: bmesh, output: dict with the vert index as key and edge-keys as value
80 | def dict_vert_edges(bm):
81 | vert_edges = dict([[v.index, []] for v in bm.verts if not v.hide])
82 | for edge in bm.edges:
83 | if edge.hide:
84 | continue
85 | ek = edgekey(edge)
86 | for vert in ek:
87 | vert_edges[vert].append(ek)
88 |
89 | return(vert_edges)
90 |
91 |
92 | # input: bmesh, output: dict with the vert index as key and face index as value
93 | def dict_vert_faces(bm):
94 | vert_faces = dict([[v.index, []] for v in bm.verts if not v.hide])
95 | for face in bm.faces:
96 | if not face.hide:
97 | for vert in face.verts:
98 | vert_faces[vert.index].append(face.index)
99 |
100 | return(vert_faces)
101 |
102 |
103 | # input: list of edge-keys, output: dictionary with vertex-vertex connections
104 | def dict_vert_verts(edge_keys):
105 | # create connection data
106 | vert_verts = {}
107 | for ek in edge_keys:
108 | for i in range(2):
109 | if ek[i] in vert_verts:
110 | vert_verts[ek[i]].append(ek[1-i])
111 | else:
112 | vert_verts[ek[i]] = [ek[1-i]]
113 |
114 | return(vert_verts)
115 |
116 |
117 | # return the edgekey ([v1.index, v2.index]) of a bmesh edge
118 | def edgekey(edge):
119 | return(tuple(sorted([edge.verts[0].index, edge.verts[1].index])))
120 |
121 |
122 | # returns the edgekeys of a bmesh face
123 | def face_edgekeys(face):
124 | return([tuple(sorted([edge.verts[0].index, edge.verts[1].index])) for \
125 | edge in face.edges])
126 |
127 |
128 | # calculate input loops
129 | # method is modified
130 | def get_connected_input(bm):
131 | # calculate selected loops
132 | edge_keys = [edgekey(edge) for edge in bm.edges if \
133 | edge.select and not edge.hide]
134 | loops = get_connected_selections(edge_keys)
135 |
136 | return(loops)
137 |
138 |
139 | # sorts all edge-keys into a list of loops
140 | def get_connected_selections(edge_keys):
141 | # create connection data
142 | vert_verts = dict_vert_verts(edge_keys)
143 |
144 | # find loops consisting of connected selected edges
145 | loops = []
146 | while len(vert_verts) > 0:
147 | loop = [iter(vert_verts.keys()).__next__()]
148 | growing = True
149 | flipped = False
150 |
151 | # extend loop
152 | while growing:
153 | # no more connection data for current vertex
154 | if loop[-1] not in vert_verts:
155 | if not flipped:
156 | loop.reverse()
157 | flipped = True
158 | else:
159 | growing = False
160 | else:
161 | extended = False
162 | for i, next_vert in enumerate(vert_verts[loop[-1]]):
163 | if next_vert not in loop:
164 | vert_verts[loop[-1]].pop(i)
165 | if len(vert_verts[loop[-1]]) == 0:
166 | del vert_verts[loop[-1]]
167 | # remove connection both ways
168 | if next_vert in vert_verts:
169 | if len(vert_verts[next_vert]) == 1:
170 | del vert_verts[next_vert]
171 | else:
172 | vert_verts[next_vert].remove(loop[-1])
173 | loop.append(next_vert)
174 | extended = True
175 | break
176 | if not extended:
177 | # found one end of the loop, continue with next
178 | if not flipped:
179 | loop.reverse()
180 | flipped = True
181 | # found both ends of the loop, stop growing
182 | else:
183 | growing = False
184 |
185 | # check if loop is circular
186 | if loop[0] in vert_verts:
187 | if loop[-1] in vert_verts[loop[0]]:
188 | # is circular
189 | if len(vert_verts[loop[0]]) == 1:
190 | del vert_verts[loop[0]]
191 | else:
192 | vert_verts[loop[0]].remove(loop[-1])
193 | if len(vert_verts[loop[-1]]) == 1:
194 | del vert_verts[loop[-1]]
195 | else:
196 | vert_verts[loop[-1]].remove(loop[0])
197 | loop = [loop, True]
198 | else:
199 | # not circular
200 | loop = [loop, False]
201 | else:
202 | # not circular
203 | loop = [loop, False]
204 |
205 | loops.append(loop)
206 |
207 | return(loops)
208 |
209 |
--------------------------------------------------------------------------------
/blender/addons/2.8/mira_tools/mi_retopo_loops.py:
--------------------------------------------------------------------------------
1 | import bpy
2 | import bmesh
3 |
4 | from bpy.props import *
5 | from bpy.types import Operator, AddonPreferences
6 |
7 | import math
8 | import mathutils as mathu
9 | import random
10 | from mathutils import Vector, Matrix
11 |
12 | from . import mi_utils_base as ut_base
13 |
14 | class MI_OT_Wrap_Object(bpy.types.Operator):
15 | bl_idname = "mira.retopo_loops"
16 | bl_label = "Retopo Loops"
17 | bl_description = "Retopo Loops"
18 | bl_options = {'REGISTER', 'UNDO'}
19 |
20 | retpo_mode: EnumProperty(
21 | items=(('Normal', 'Normal', ''),
22 | ('Generic', 'Generic', '')
23 | ),
24 | default='Generic'
25 | )
26 |
27 | #reset_values: BoolProperty(default=False)
28 | cuts_number: bpy.props.IntProperty(name="Cuts Number", description="Cuts Number for Generic Mode", default=10, min=2)
29 | verts_number: bpy.props.IntProperty(name="Verts Number", description="Verts Number for Cuts", default=8, min=3)
30 | rotate_loops: bpy.props.IntProperty(name="Rotate Loops", description="Cuts Number for Generic Mode", default=0, min=-360, max=360)
31 |
32 |
33 | def execute(self, context):
34 | # check issues
35 | if not context.selected_objects:
36 | self.report({'WARNING'}, "Please, Select Circle Objects for Loops and Add Some Hipoly Objects!")
37 | return {'CANCELLED'}
38 | elif len(context.selected_objects) == 1:
39 | self.report({'WARNING'}, "Please, Select 2 Circle Objects At Least!")
40 | return {'CANCELLED'}
41 |
42 | sel_objs = context.selected_objects.copy()
43 | curve_settings = context.scene.mi_settings
44 |
45 | # get meshes for snapping
46 | if sel_objs:
47 | for obj in sel_objs:
48 | obj.hide_viewport = True
49 |
50 | meshes_array = ut_base.get_obj_dup_meshes(None, curve_settings.convert_instances, context)
51 |
52 | for obj in sel_objs:
53 | obj.hide_viewport = False
54 |
55 | # check issues
56 | if not meshes_array:
57 | self.report({'WARNING'}, "Please, Select Circle Objects for Loops and Add Some Hipoly Objects!")
58 | return {'CANCELLED'}
59 |
60 | generic_sel_objs = []
61 |
62 | if self.retpo_mode == 'Generic':
63 | distances = []
64 | max_dist = 0
65 |
66 | # get distances
67 | for idx, obj in enumerate(sel_objs):
68 | if idx == 0:
69 | distances.append(0)
70 | else:
71 | dist = (obj.location - sel_objs[idx - 1].location).length
72 | max_dist += dist
73 | distances.append(max_dist)
74 |
75 | # create new generic objects
76 | for obj_count in range(self.cuts_number):
77 | count_length = (obj_count/(self.cuts_number - 1)) * max_dist
78 |
79 | obj_count_pos = None
80 | obj_count_rot = None
81 | obj_count_scale = None
82 |
83 | if obj_count == 0:
84 | obj_count_pos = sel_objs[0].location.copy()
85 | obj_count_rot = sel_objs[0].rotation_euler.copy()
86 | obj_count_scale = sel_objs[0].scale.copy()
87 |
88 | elif obj_count == self.cuts_number - 1:
89 | obj_count_pos = sel_objs[-1].location.copy()
90 | obj_count_rot = sel_objs[-1].rotation_euler.copy()
91 | obj_count_scale = sel_objs[-1].scale.copy()
92 |
93 | else:
94 | for idx, dist in enumerate(distances):
95 | if dist > count_length:
96 | obj1 = sel_objs[idx]
97 | obj2 = sel_objs[idx - 1]
98 | count_length_2 = (count_length - distances[idx-1]) / (dist - distances[idx-1])
99 |
100 | obj_count_pos = obj2.location.lerp(obj1.location, count_length_2)
101 | obj_count_rot = Vector(obj2.rotation_euler).lerp(Vector(obj1.rotation_euler), count_length_2)
102 | obj_count_scale = obj2.scale.lerp(obj1.scale, count_length_2)
103 | break
104 |
105 | bpy.ops.object.select_all(action='DESELECT')
106 | sel_objs[0].select_set(True)
107 |
108 | # create new prims
109 | bpy.ops.mesh.primitive_circle_add(vertices=self.verts_number, radius=1.0, enter_editmode=False)
110 | new_gen_obj = context.active_object
111 | new_gen_obj.location = obj_count_pos
112 | new_gen_obj.rotation_euler = obj_count_rot
113 | new_gen_obj.scale = obj_count_scale
114 | generic_sel_objs.append(new_gen_obj)
115 |
116 | # create new prims
117 | else:
118 | for obj in sel_objs:
119 | bpy.ops.object.select_all(action='DESELECT')
120 | bpy.ops.mesh.primitive_circle_add(vertices=self.verts_number, radius=1.0, enter_editmode=False)
121 | new_gen_obj = context.active_object
122 | new_gen_obj.location = obj.location.copy()
123 | new_gen_obj.rotation_euler = obj.rotation_euler.copy()
124 | new_gen_obj.scale = obj.scale.copy()
125 | generic_sel_objs.append(new_gen_obj)
126 |
127 | if self.rotate_loops != 0:
128 | for obj in generic_sel_objs:
129 | bpy.ops.object.select_all(action='DESELECT')
130 | obj.select_set(True)
131 | bpy.ops.transform.rotate(value=math.radians(self.rotate_loops), orient_axis='Z', orient_type='LOCAL', orient_matrix_type='LOCAL', constraint_axis=(False, False, True), use_proportional_edit=False, release_confirm=False)
132 |
133 | bpy.ops.object.select_all(action='DESELECT')
134 | for obj in generic_sel_objs:
135 | obj.select_set(True)
136 |
137 | context.view_layer.objects.active = context.selected_objects[0]
138 |
139 | bpy.ops.object.make_single_user(type='SELECTED_OBJECTS', object=True, obdata=True, material=False, animation=False)
140 | bpy.ops.object.transform_apply(location=True, rotation=True, scale=True)
141 | bpy.ops.object.join()
142 |
143 | retop_obj = context.active_object
144 | retop_obj.show_in_front = True
145 | retop_obj.show_wire = True
146 | #dg = bpy.context.evaluated_depsgraph_get()
147 | #dg.update()
148 |
149 | bpy.ops.object.editmode_toggle()
150 | bm = bmesh.from_edit_mesh(retop_obj.data)
151 |
152 | bpy.ops.mesh.select_mode(use_extend=False, use_expand=False, type='EDGE')
153 | bpy.ops.mesh.select_all(action='SELECT')
154 | bpy.ops.mesh.bridge_edge_loops()
155 |
156 | # snap verts
157 | new_positions = []
158 | for vert in bm.verts:
159 | vert_nor = vert.normal.copy()
160 | vert_nor.negate()
161 | best_obj, hit_normal, hit_position = ut_base.get_3dpoint_raycast(context, meshes_array, vert.co, vert_nor)
162 |
163 | if hit_position:
164 | new_positions.append(hit_position)
165 | else:
166 | new_positions.append(None)
167 |
168 | # set positions
169 | for idx, vert in enumerate(bm.verts):
170 | if new_positions[idx]:
171 | vert.co = new_positions[idx]
172 |
173 | bpy.ops.object.editmode_toggle()
174 |
175 | #retop_obj.data.from_pydata(out_verts, [], out_faces)
176 | retop_obj.data.update()
177 |
178 | return {'FINISHED'}
179 |
180 |
181 |
--------------------------------------------------------------------------------
/blender/addons/2.7/mira_tools/mi_widget_linear_deform.py:
--------------------------------------------------------------------------------
1 | # ***** BEGIN GPL LICENSE BLOCK *****
2 | #
3 | #
4 | # This program is free software; you can redistribute it and/or
5 | # modify it under the terms of the GNU General Public License
6 | # as published by the Free Software Foundation; either version 2
7 | # of the License, or (at your option) any later version.
8 | #
9 | # This program is distributed in the hope that it will be useful,
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | # GNU General Public License for more details.
13 | #
14 | # You should have received a copy of the GNU General Public License
15 | # along with this program; if not, write to the Free Software Foundation,
16 | # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 | #
18 | # ***** END GPL LICENCE BLOCK *****
19 |
20 | import bpy
21 | import bgl
22 | import blf
23 | import string
24 |
25 | from bpy.props import *
26 | from bpy.types import Operator, AddonPreferences
27 |
28 | from bpy_extras import view3d_utils
29 |
30 | import math
31 | import mathutils as mathu
32 | import random
33 | from mathutils import Vector
34 |
35 | from . import mi_utils_base as ut_base
36 |
37 |
38 | class MI_LW_Point():
39 |
40 | # class constructor
41 | def __init__(self, position):
42 | self.position = position
43 |
44 |
45 | class MI_Linear_Widget():
46 |
47 | # class constructor
48 | def __init__(self):
49 | self.start_point = None
50 | self.middle_point = None
51 | self.end_point = None
52 |
53 |
54 | def update_middle_point(lw_tool):
55 | lw_dir = (lw_tool.end_point.position - lw_tool.start_point.position)
56 | lw_len = (lw_dir).length
57 | lw_dir = lw_dir.normalized()
58 |
59 | lw_tool.middle_point.position = lw_tool.start_point.position + (lw_dir * (lw_len / 2.0))
60 |
61 |
62 | def get_tool_verts(lw_tool, verts_ids, bm, obj, do_clamp, local_coords):
63 | apply_tool_verts = []
64 | final_dir = ( lw_tool.end_point.position - lw_tool.start_point.position )
65 | max_dist = final_dir.length
66 | for vert_id in verts_ids:
67 | v_pos = obj.matrix_world * bm.verts[vert_id].co
68 | value = mathu.geometry.distance_point_to_plane(v_pos, lw_tool.start_point.position, final_dir)
69 | if value > 0:
70 | if value > max_dist and do_clamp:
71 | value = 1.0
72 | else:
73 | value /= max_dist
74 |
75 | pos_final = v_pos
76 | if local_coords is True:
77 | pos_final = bm.verts[vert_id].co.copy()
78 |
79 | apply_tool_verts.append( (vert_id, value, pos_final) )
80 |
81 | return apply_tool_verts
82 |
83 |
84 | def draw_lw(context, lw, cross_up_dir, draw_faloff):
85 | region = context.region
86 | rv3d = context.region_data
87 |
88 | start_2d = view3d_utils.location_3d_to_region_2d(region, rv3d, lw.start_point.position)
89 | end_2d = view3d_utils.location_3d_to_region_2d(region, rv3d, lw.end_point.position)
90 | middle_2d = view3d_utils.location_3d_to_region_2d(region, rv3d, lw.middle_point.position)
91 |
92 | dist_ends = ((lw.start_point.position - lw.end_point.position).length * 0.1) * cross_up_dir
93 | end_p1 = view3d_utils.location_3d_to_region_2d(region, rv3d, lw.end_point.position + dist_ends)
94 | end_p2 = view3d_utils.location_3d_to_region_2d(region, rv3d, lw.end_point.position - dist_ends)
95 |
96 | if start_2d and end_2d and end_p1 and end_p2:
97 | bgl.glEnable(bgl.GL_BLEND)
98 | bgl.glLineWidth(1)
99 | bgl.glPointSize(6)
100 |
101 | bgl.glBegin(bgl.GL_LINE_STRIP)
102 | bgl.glColor4f(0.99, 0.5, 0.99, 1.0)
103 | bgl.glVertex2f(start_2d[0], start_2d[1])
104 | bgl.glVertex2f(end_2d[0], end_2d[1])
105 | bgl.glEnd()
106 |
107 | if draw_faloff:
108 | bgl.glBegin(bgl.GL_LINE_LOOP)
109 | bgl.glColor4f(0.99, 0.5, 0.99, 1.0)
110 | bgl.glVertex2f(start_2d[0], start_2d[1])
111 | bgl.glVertex2f(end_p1[0], end_p1[1])
112 | bgl.glVertex2f(end_p2[0], end_p2[1])
113 | bgl.glEnd()
114 |
115 | bgl.glBegin(bgl.GL_POINTS)
116 | # bgl.glBegin(bgl.GL_POLYGON)
117 | bgl.glColor4f(0.99, 0.8, 0.5, 1.0)
118 | bgl.glVertex2f(start_2d[0], start_2d[1])
119 | bgl.glVertex2f(middle_2d[0], middle_2d[1])
120 | bgl.glVertex2f(end_2d[0], end_2d[1])
121 | bgl.glEnd()
122 |
123 | # restore opengl defaults
124 | bgl.glLineWidth(1)
125 | bgl.glDisable(bgl.GL_BLEND)
126 | bgl.glColor4f(0.0, 0.0, 0.0, 1.0)
127 |
128 |
129 | def pick_lw_point(context, m_coords, lw):
130 | region = context.region
131 | rv3d = context.region_data
132 |
133 | return_point = None
134 | good_distance = None
135 |
136 | mouse_coords = Vector(m_coords)
137 |
138 | lw_points = [lw.start_point, lw.middle_point, lw.end_point]
139 | for lw_point in lw_points:
140 | vec_2d = view3d_utils.location_3d_to_region_2d(region, rv3d, lw_point.position)
141 | dist = (vec_2d - mouse_coords).length
142 | if dist <= 9.0:
143 | if not return_point:
144 | return_point = lw_point
145 | good_distance = dist
146 | elif good_distance > dist:
147 | return_point = lw_point
148 |
149 | return return_point
150 |
151 |
152 | def setup_lw_tool(rv3d, lw_tool, active_obj, verts, center_type, scale_size):
153 | # Types
154 | # 'Auto', 'X', 'X_Left', 'X_Right', 'Z', 'Z_Top', 'Z_Bottom'
155 |
156 | # get verts bounds
157 | cam_x = (rv3d.view_rotation * Vector((1.0, 0.0, 0.0))).normalized()
158 | cam_y = (rv3d.view_rotation * Vector((0.0, 1.0, 0.0))).normalized()
159 | #cam_z = (rv3d.view_rotation * Vector((0.0, 0.0, -1.0))).normalized() # Camera Direction
160 | bounds = ut_base.get_verts_bounds(verts, active_obj, cam_x, cam_y, None, False)
161 |
162 | # set middle_point
163 | middle_p = None
164 | if center_type in {'Auto', 'X', 'Z'}:
165 | middle_p = bounds[3]
166 | elif center_type == 'X_Left':
167 | middle_p = bounds[3] + (cam_y * (bounds[1] / 2.0))
168 | elif center_type == 'X_Right':
169 | middle_p = bounds[3] - (cam_y * (bounds[1] / 2.0))
170 | elif center_type == 'Z_Top':
171 | middle_p = bounds[3] - (cam_x * (bounds[0] / 2.0))
172 | elif center_type == 'Z_Bottom':
173 | middle_p = bounds[3] + (cam_x * (bounds[0] / 2.0))
174 |
175 | # set lw_tool points
176 | start_p = None
177 | end_p = None
178 | if center_type == 'Auto':
179 | if bounds[0] > bounds[1]:
180 | # scale_size is additive value so that to get points on the top and on the left
181 | start_p = middle_p - (cam_x * (bounds[0] / 2.0) * scale_size)
182 | end_p = middle_p + (cam_x * (bounds[0] / 2.0) * scale_size)
183 | else:
184 | start_p = middle_p - (cam_y * (bounds[1] / 2.0) * scale_size)
185 | end_p = middle_p + (cam_y * (bounds[1] / 2.0) * scale_size)
186 | elif center_type in {'X', 'X_Left', 'X_Right'}:
187 | # scale_size is additive value so that to get points on the top and on the left
188 | start_p = middle_p - (cam_x * (bounds[0] / 2.0) * scale_size)
189 | end_p = middle_p + (cam_x * (bounds[0] / 2.0) * scale_size)
190 | elif center_type in {'Z', 'Z_Top', 'Z_Bottom'}:
191 | # scale_size is additive value so that to get points on the top and on the left
192 | start_p = middle_p - (cam_y * (bounds[1] / 2.0) * scale_size)
193 | end_p = middle_p + (cam_y * (bounds[1] / 2.0) * scale_size)
194 |
195 | lw_tool.start_point = MI_LW_Point(start_p)
196 | lw_tool.middle_point = MI_LW_Point(middle_p)
197 | lw_tool.end_point = MI_LW_Point(end_p)
--------------------------------------------------------------------------------
/blender/addons/2.8/mira_tools/mi_widget_linear_deform.py:
--------------------------------------------------------------------------------
1 | import gpu
2 | from gpu_extras.batch import batch_for_shader
3 |
4 | import bpy
5 | from bpy.props import *
6 | from bpy_extras import view3d_utils
7 |
8 | import mathutils as mathu
9 | from mathutils import Vector
10 |
11 | from . import mi_utils_base as ut_base
12 |
13 |
14 | shader3d = gpu.shader.from_builtin('POINT_UNIFORM_COLOR' if bpy.app.version >= (4, 5, 0) else 'UNIFORM_COLOR')
15 | shader2d = gpu.shader.from_builtin('POINT_UNIFORM_COLOR' if bpy.app.version >= (4, 5, 0) else 'UNIFORM_COLOR')
16 |
17 |
18 | class MI_LW_Point():
19 |
20 | # class constructor
21 | def __init__(self, position):
22 | self.position = position
23 |
24 |
25 | class MI_Linear_Widget():
26 |
27 | # class constructor
28 | def __init__(self):
29 | self.start_point = None
30 | self.middle_point = None
31 | self.end_point = None
32 |
33 |
34 | def update_middle_point(lw_tool):
35 | lw_dir = (lw_tool.end_point.position - lw_tool.start_point.position)
36 | lw_len = (lw_dir).length
37 | lw_dir = lw_dir.normalized()
38 |
39 | lw_tool.middle_point.position = lw_tool.start_point.position + (lw_dir * (lw_len / 2.0))
40 |
41 |
42 | def get_tool_verts(lw_tool, verts_ids, bm, obj, do_clamp, local_coords):
43 | apply_tool_verts = []
44 | final_dir = ( lw_tool.end_point.position - lw_tool.start_point.position )
45 | max_dist = final_dir.length
46 | for vert_id in verts_ids:
47 | v_pos = obj.matrix_world @ bm.verts[vert_id].co
48 | value = mathu.geometry.distance_point_to_plane(v_pos, lw_tool.start_point.position, final_dir)
49 | if value > 0:
50 | if value > max_dist and do_clamp:
51 | value = 1.0
52 | else:
53 | value /= max_dist
54 |
55 | pos_final = v_pos
56 | if local_coords is True:
57 | pos_final = bm.verts[vert_id].co.copy()
58 |
59 | apply_tool_verts.append( (vert_id, value, pos_final) )
60 |
61 | return apply_tool_verts
62 |
63 | def get_tool_verts_curv(lw_tool, verts_ids, obj, do_clamp, local_coords):
64 | apply_tool_verts = []
65 | final_dir = ( lw_tool.end_point.position - lw_tool.start_point.position )
66 | max_dist = final_dir.length
67 | for point in verts_ids:
68 | v_pos = obj.matrix_world @ point.co.xyz
69 | value = mathu.geometry.distance_point_to_plane(v_pos, lw_tool.start_point.position, final_dir)
70 | if value > 0:
71 | if value > max_dist and do_clamp:
72 | value = 1.0
73 | else:
74 | value /= max_dist
75 |
76 | pos_final = v_pos
77 | if local_coords is True:
78 | pos_final = point.co.xyz
79 |
80 | apply_tool_verts.append( (point, value, pos_final) )
81 |
82 | return apply_tool_verts
83 |
84 |
85 | def draw_lw(context, lw, cross_up_dir, draw_faloff):
86 | region = context.region
87 | rv3d = context.region_data
88 | addon_prefs = context.preferences.addons[__package__].preferences
89 |
90 | start_2d = view3d_utils.location_3d_to_region_2d(region, rv3d, lw.start_point.position)
91 | end_2d = view3d_utils.location_3d_to_region_2d(region, rv3d, lw.end_point.position)
92 | middle_2d = view3d_utils.location_3d_to_region_2d(region, rv3d, lw.middle_point.position)
93 |
94 | dist_ends = ((lw.start_point.position - lw.end_point.position).length * 0.1) * cross_up_dir
95 | end_p1 = view3d_utils.location_3d_to_region_2d(region, rv3d, lw.end_point.position + dist_ends)
96 | end_p2 = view3d_utils.location_3d_to_region_2d(region, rv3d, lw.end_point.position - dist_ends)
97 |
98 | if start_2d and end_2d and end_p1 and end_p2:
99 | gpu.state.line_width_set(addon_prefs.line_size)
100 | gpu.state.point_size_set(addon_prefs.point_size)
101 |
102 | coords = ((start_2d[0], start_2d[1]), (end_2d[0], end_2d[1]))
103 | batch = batch_for_shader(shader2d, 'LINE_STRIP', {"pos": coords})
104 | shader2d.bind()
105 | shader2d.uniform_float("color", (0.99, 0.5, 0.99, 1.0))
106 | batch.draw(shader2d)
107 |
108 |
109 | if draw_faloff:
110 | coords = ((start_2d[0], start_2d[1]), (end_p1[0], end_p1[1]), (end_p2[0], end_p2[1]))
111 | batch = batch_for_shader(shader2d, 'LINE_LOOP', {"pos": coords})
112 | shader2d.bind()
113 | shader2d.uniform_float("color", (0.99, 0.5, 0.99, 1.0))
114 | batch.draw(shader2d)
115 |
116 | coords = ((start_2d[0], start_2d[1]), (middle_2d[0], middle_2d[1]), (end_2d[0], end_2d[1]))
117 | batch = batch_for_shader(shader2d, 'POINTS', {"pos": coords})
118 | shader2d.bind()
119 | shader2d.uniform_float("color", (0.99, 0.8, 0.5, 1.0))
120 | batch.draw(shader2d)
121 |
122 |
123 | def pick_lw_point(context, m_coords, lw):
124 | region = context.region
125 | rv3d = context.region_data
126 |
127 | return_point = None
128 | good_distance = None
129 |
130 | mouse_coords = Vector(m_coords)
131 |
132 | lw_points = [lw.start_point, lw.middle_point, lw.end_point]
133 | for lw_point in lw_points:
134 | vec_2d = view3d_utils.location_3d_to_region_2d(region, rv3d, lw_point.position)
135 | dist = (vec_2d - mouse_coords).length
136 | if dist <= 9.0:
137 | if not return_point:
138 | return_point = lw_point
139 | good_distance = dist
140 | elif good_distance > dist:
141 | return_point = lw_point
142 |
143 | return return_point
144 |
145 |
146 | def setup_lw_tool(rv3d, lw_tool, active_obj, verts, center_type, scale_size):
147 | # Types
148 | # 'Auto', 'X', 'X_Left', 'X_Right', 'Z', 'Z_Top', 'Z_Bottom'
149 |
150 | # get verts bounds
151 | cam_x = (rv3d.view_rotation @ Vector((1.0, 0.0, 0.0))).normalized()
152 | cam_y = (rv3d.view_rotation @ Vector((0.0, 1.0, 0.0))).normalized()
153 | #cam_z = (rv3d.view_rotation @ Vector((0.0, 0.0, -1.0))).normalized() # Camera Direction
154 | bounds = ut_base.get_verts_bounds(verts, active_obj, cam_x, cam_y, None, False)
155 |
156 | # set middle_point
157 | middle_p = None
158 | if center_type in {'Auto', 'X', 'Z'}:
159 | middle_p = bounds[3]
160 | elif center_type == 'X_Left':
161 | middle_p = bounds[3] + (cam_y * (bounds[1] / 2.0))
162 | elif center_type == 'X_Right':
163 | middle_p = bounds[3] - (cam_y * (bounds[1] / 2.0))
164 | elif center_type == 'Z_Top':
165 | middle_p = bounds[3] - (cam_x * (bounds[0] / 2.0))
166 | elif center_type == 'Z_Bottom':
167 | middle_p = bounds[3] + (cam_x * (bounds[0] / 2.0))
168 |
169 | # set lw_tool points
170 | start_p = None
171 | end_p = None
172 | if center_type == 'Auto':
173 | if bounds[0] > bounds[1]:
174 | # scale_size is additive value so that to get points on the top and on the left
175 | start_p = middle_p - (cam_x * (bounds[0] / 2.0) * scale_size)
176 | end_p = middle_p + (cam_x * (bounds[0] / 2.0) * scale_size)
177 | else:
178 | start_p = middle_p - (cam_y * (bounds[1] / 2.0) * scale_size)
179 | end_p = middle_p + (cam_y * (bounds[1] / 2.0) * scale_size)
180 | elif center_type in {'X', 'X_Left', 'X_Right'}:
181 | # scale_size is additive value so that to get points on the top and on the left
182 | start_p = middle_p - (cam_x * (bounds[0] / 2.0) * scale_size)
183 | end_p = middle_p + (cam_x * (bounds[0] / 2.0) * scale_size)
184 | elif center_type in {'Z', 'Z_Top', 'Z_Bottom'}:
185 | # scale_size is additive value so that to get points on the top and on the left
186 | start_p = middle_p - (cam_y * (bounds[1] / 2.0) * scale_size)
187 | end_p = middle_p + (cam_y * (bounds[1] / 2.0) * scale_size)
188 |
189 | lw_tool.start_point = MI_LW_Point(start_p)
190 | lw_tool.middle_point = MI_LW_Point(middle_p)
191 | lw_tool.end_point = MI_LW_Point(end_p)
192 |
--------------------------------------------------------------------------------
/blender/addons/2.7/mira_tools/mi_looptools.py:
--------------------------------------------------------------------------------
1 | # ##### BEGIN GPL LICENSE BLOCK #####
2 | #
3 | # This program is free software; you can redistribute it and/or
4 | # modify it under the terms of the GNU General Public License
5 | # as published by the Free Software Foundation; either version 2
6 | # of the License, or (at your option) any later version.
7 | #
8 | # This program is distributed in the hope that it will be useful,
9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | # GNU General Public License for more details.
12 | #
13 | # You should have received a copy of the GNU General Public License
14 | # along with this program; if not, write to the Free Software Foundation,
15 | # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16 | #
17 | # ##### END GPL LICENSE BLOCK #####
18 |
19 | import bmesh
20 | import bpy
21 | import collections
22 | import mathutils
23 | import math
24 | from bpy_extras import view3d_utils
25 |
26 | # THIS CODE IS TAKEN FROM BLENDER LOOPTOOLS ADDON. Thanks a lot to Bart Crouch.
27 |
28 | ##########################################
29 | ####### General functions ################
30 | ##########################################
31 |
32 |
33 | # check loops and only return valid ones
34 | # method is modified
35 | def check_loops(loops, bm_mod):
36 | valid_loops = []
37 | for loop, circular in loops:
38 | # loop needs to have at least 3 vertices
39 | if len(loop) < 3:
40 | continue
41 | ## loop needs at least 1 vertex in the original, non-mirrored mesh
42 | #if mapping:
43 | #all_virtual = True
44 | #for vert in loop:
45 | #if mapping[vert] > -1:
46 | #all_virtual = False
47 | #break
48 | #if all_virtual:
49 | #continue
50 | # vertices can not all be at the same location
51 | stacked = True
52 | for i in range(len(loop) - 1):
53 | if (bm_mod.verts[loop[i]].co - \
54 | bm_mod.verts[loop[i+1]].co).length > 1e-6:
55 | stacked = False
56 | break
57 | if stacked:
58 | continue
59 | # passed all tests, loop is valid
60 | valid_loops.append([loop, circular])
61 |
62 | return(valid_loops)
63 |
64 |
65 | # input: bmesh, output: dict with the edge-key as key and face-index as value
66 | def dict_edge_faces(bm):
67 | edge_faces = dict([[edgekey(edge), []] for edge in bm.edges if \
68 | not edge.hide])
69 | for face in bm.faces:
70 | if face.hide:
71 | continue
72 | for key in face_edgekeys(face):
73 | edge_faces[key].append(face.index)
74 |
75 | return(edge_faces)
76 |
77 |
78 | # input: bmesh (edge-faces optional), output: dict with face-face connections
79 | def dict_face_faces(bm, edge_faces=False):
80 | if not edge_faces:
81 | edge_faces = dict_edge_faces(bm)
82 |
83 | connected_faces = dict([[face.index, []] for face in bm.faces if \
84 | not face.hide])
85 | for face in bm.faces:
86 | if face.hide:
87 | continue
88 | for edge_key in face_edgekeys(face):
89 | for connected_face in edge_faces[edge_key]:
90 | if connected_face == face.index:
91 | continue
92 | connected_faces[face.index].append(connected_face)
93 |
94 | return(connected_faces)
95 |
96 |
97 | # input: bmesh, output: dict with the vert index as key and edge-keys as value
98 | def dict_vert_edges(bm):
99 | vert_edges = dict([[v.index, []] for v in bm.verts if not v.hide])
100 | for edge in bm.edges:
101 | if edge.hide:
102 | continue
103 | ek = edgekey(edge)
104 | for vert in ek:
105 | vert_edges[vert].append(ek)
106 |
107 | return(vert_edges)
108 |
109 |
110 | # input: bmesh, output: dict with the vert index as key and face index as value
111 | def dict_vert_faces(bm):
112 | vert_faces = dict([[v.index, []] for v in bm.verts if not v.hide])
113 | for face in bm.faces:
114 | if not face.hide:
115 | for vert in face.verts:
116 | vert_faces[vert.index].append(face.index)
117 |
118 | return(vert_faces)
119 |
120 |
121 | # input: list of edge-keys, output: dictionary with vertex-vertex connections
122 | def dict_vert_verts(edge_keys):
123 | # create connection data
124 | vert_verts = {}
125 | for ek in edge_keys:
126 | for i in range(2):
127 | if ek[i] in vert_verts:
128 | vert_verts[ek[i]].append(ek[1-i])
129 | else:
130 | vert_verts[ek[i]] = [ek[1-i]]
131 |
132 | return(vert_verts)
133 |
134 |
135 | # return the edgekey ([v1.index, v2.index]) of a bmesh edge
136 | def edgekey(edge):
137 | return(tuple(sorted([edge.verts[0].index, edge.verts[1].index])))
138 |
139 |
140 | # returns the edgekeys of a bmesh face
141 | def face_edgekeys(face):
142 | return([tuple(sorted([edge.verts[0].index, edge.verts[1].index])) for \
143 | edge in face.edges])
144 |
145 |
146 | # calculate input loops
147 | # method is modified
148 | def get_connected_input(bm):
149 | # calculate selected loops
150 | edge_keys = [edgekey(edge) for edge in bm.edges if \
151 | edge.select and not edge.hide]
152 | loops = get_connected_selections(edge_keys)
153 |
154 | return(loops)
155 |
156 |
157 | # sorts all edge-keys into a list of loops
158 | def get_connected_selections(edge_keys):
159 | # create connection data
160 | vert_verts = dict_vert_verts(edge_keys)
161 |
162 | # find loops consisting of connected selected edges
163 | loops = []
164 | while len(vert_verts) > 0:
165 | loop = [iter(vert_verts.keys()).__next__()]
166 | growing = True
167 | flipped = False
168 |
169 | # extend loop
170 | while growing:
171 | # no more connection data for current vertex
172 | if loop[-1] not in vert_verts:
173 | if not flipped:
174 | loop.reverse()
175 | flipped = True
176 | else:
177 | growing = False
178 | else:
179 | extended = False
180 | for i, next_vert in enumerate(vert_verts[loop[-1]]):
181 | if next_vert not in loop:
182 | vert_verts[loop[-1]].pop(i)
183 | if len(vert_verts[loop[-1]]) == 0:
184 | del vert_verts[loop[-1]]
185 | # remove connection both ways
186 | if next_vert in vert_verts:
187 | if len(vert_verts[next_vert]) == 1:
188 | del vert_verts[next_vert]
189 | else:
190 | vert_verts[next_vert].remove(loop[-1])
191 | loop.append(next_vert)
192 | extended = True
193 | break
194 | if not extended:
195 | # found one end of the loop, continue with next
196 | if not flipped:
197 | loop.reverse()
198 | flipped = True
199 | # found both ends of the loop, stop growing
200 | else:
201 | growing = False
202 |
203 | # check if loop is circular
204 | if loop[0] in vert_verts:
205 | if loop[-1] in vert_verts[loop[0]]:
206 | # is circular
207 | if len(vert_verts[loop[0]]) == 1:
208 | del vert_verts[loop[0]]
209 | else:
210 | vert_verts[loop[0]].remove(loop[-1])
211 | if len(vert_verts[loop[-1]]) == 1:
212 | del vert_verts[loop[-1]]
213 | else:
214 | vert_verts[loop[-1]].remove(loop[0])
215 | loop = [loop, True]
216 | else:
217 | # not circular
218 | loop = [loop, False]
219 | else:
220 | # not circular
221 | loop = [loop, False]
222 |
223 | loops.append(loop)
224 |
225 | return(loops)
226 |
227 |
--------------------------------------------------------------------------------