Skip to content

Commit

Permalink
Renamed VTKConverters.py to converters.py, and renamed classes
Browse files Browse the repository at this point in the history
- VTKConverters.py contains BVTK conversions, so renamed similar
  to other files
- VTK2Blender node renamed to BVTK_Node_VTKToBlender
  • Loading branch information
tkeskita committed May 9, 2019
1 parent b6356d0 commit 69e6142
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 29 deletions.
7 changes: 3 additions & 4 deletions __init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@
from . import customfilter
from . import info
from . import update
from . import converters

from . import VTKConverters
from . import VTKSources
from . import VTKReaders
from . import VTKWriters
Expand All @@ -90,8 +90,7 @@
importlib.reload(info)
importlib.reload(favorites_data)
importlib.reload(favorites)

importlib.reload(VTKConverters)
importlib.reload(converters)

importlib.reload(gen_VTKSources)
importlib.reload(VTKSources)
Expand Down Expand Up @@ -124,7 +123,7 @@ def on_frame_change(scene):
'''Update nodes after frame changes by updating all VTK to Blender nodes'''
for node_group in bpy.data.node_groups:
for node in node_group.nodes:
if node.bl_idname == 'VTK2BlenderType':
if node.bl_idname == 'BVTK_Node_VTKToBlenderType':
update.no_queue_update(node, node.update_cb)


Expand Down
4 changes: 2 additions & 2 deletions b_properties.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
b={'VTKImageContinuousDilate3DType': [True, True, True, True, True, True, True],
'VTK2BlenderType': [True, True],
'BVTK_Node_VTKToBlenderType': [True, True],
'VTKImageIslandRemoval2DType': [True, True, True, True],
'VTKPassArraysType': [True, True],
'VTKDensifyPolyDataType': [True],
Expand Down Expand Up @@ -957,4 +957,4 @@
'VTKAdjacencyMatrixToEdgeTableType': [True, True, True, True],
'VTKDIMACSGraphReaderType': [True, True, True],
'VTKExtractSelectedLocationsType': [True],
'VTKHyperOctreeCutterType': [True, True, True]}
'VTKHyperOctreeCutterType': [True, True, True]}
32 changes: 16 additions & 16 deletions VTKConverters.py → converters.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@
# Converters from VTK to Blender
# -----------------------------------------------------------------------------

class VTK2Blender(Node, BVTK_Node):
'''Output VTK Node to Blender Mesh Object'''
bl_idname = 'VTK2BlenderType' # type name
class BVTK_Node_VTKToBlender(Node, BVTK_Node):
'''Convert output from VTK Node to Blender Mesh Object'''
bl_idname = 'BVTK_Node_VTKToBlenderType' # type name
bl_label = 'VTK To Blender' # label for nice name display

def start_scan(self, context):
if context:
if self.auto_update:
bpy.ops.vtk.auto_update_scan(
bpy.ops.node.bvtk_auto_update_scan(
node_name=self.name,
tree_name=context.space_data.node_tree.name)

Expand All @@ -35,7 +35,7 @@ def draw_buttons(self, context, layout):
layout.prop(self, 'smooth', text='Smooth')
#layout.box().prop(self, "auto_center", text='auto center', expand=True)
layout.separator()
layout.operator("node.update", text="update").node_path = node_path(self)
layout.operator("node.bvtk_node_update", text="update").node_path = node_path(self)

def update_cb(self):
'''Update node'''
Expand Down Expand Up @@ -206,9 +206,9 @@ def compare(dict1, dict2):
return diff


class VTKAutoUpdateScan(bpy.types.Operator):
'''VTK Auto Update Scan'''
bl_idname = "vtk.auto_update_scan"
class BVTK_OT_AutoUpdateScan(bpy.types.Operator):
'''BVTK Auto Update Scan'''
bl_idname = "node.bvtk_auto_update_scan"
bl_label = "auto update"
_timer = None
node_name = bpy.props.StringProperty()
Expand Down Expand Up @@ -241,7 +241,7 @@ def execute(self, context):
self.tree = bpy.data.node_groups[self.tree_name].nodes
self.node = bpy.data.node_groups[self.tree_name].nodes[self.node_name]
self.last_map = map(self.node)
bpy.ops.node.update(node_path=node_path(self.node))
bpy.ops.node.bvtk_node_update(node_path=node_path(self.node))
wm = context.window_manager
self._timer = wm.event_timer_add(0.01, context.window)
wm.modal_handler_add(self)
Expand Down Expand Up @@ -492,9 +492,9 @@ def imgdata_to_blender(data, name):
tex.image = img


class OperatorNodeUpdate(bpy.types.Operator):
class BVTK_OT_NodeUpdate(bpy.types.Operator):
'''Node Update Operator'''
bl_idname = "node.update"
bl_idname = "node.bvtk_node_update"
bl_label = "update"
node_path = bpy.props.StringProperty()
use_queue = bpy.props.BoolProperty(default = True)
Expand All @@ -514,12 +514,12 @@ def execute(self, context):

# Add classes and menu items
TYPENAMES = []
add_class(VTK2Blender)
TYPENAMES.append('VTK2BlenderType')
add_class(BVTK_Node_VTKToBlender)
TYPENAMES.append('BVTK_Node_VTKToBlenderType')
menu_items = [NodeItem(x) for x in TYPENAMES]
CATEGORIES.append(BVTK_NodeCategory("converters", "converters", items=menu_items))
CATEGORIES.append(BVTK_NodeCategory("Converters", "Converters", items=menu_items))

add_class(OperatorNodeUpdate)
add_ui_class(VTKAutoUpdateScan)
add_class(BVTK_OT_NodeUpdate)
add_ui_class(BVTK_OT_AutoUpdateScan)
add_ui_class(VTKFunctionQueue)

6 changes: 3 additions & 3 deletions examples/clip.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
"width": 200.0
},
{
"bl_idname": "VTK2BlenderType",
"bl_idname": "BVTK_Node_VTKToBlenderType",
"color": [
0.6079999804496765,
0.6079999804496765,
Expand All @@ -73,7 +73,7 @@
"width": 200.0
},
{
"bl_idname": "VTK2BlenderType",
"bl_idname": "BVTK_Node_VTKToBlenderType",
"color": [
0.6079999804496765,
0.6079999804496765,
Expand Down Expand Up @@ -158,4 +158,4 @@
"width": 285.1534118652344
}
]
}
}
4 changes: 2 additions & 2 deletions favorites_data.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
favorites = [('VTK2BlenderType', 'ToBlender'),
favorites = [('BVTK_Node_VTKToBlenderType', 'VTK To Blender'),
('BVTK_Node_InfoType', 'Info'),
('VTKConeSourceType', 'vtkConeSource'),
('VTKClipPolyDataType', 'vtkClipPolyData'),
('BVTK_Node_ColorMapperType', 'Color Mapper'),
('BVTK_Node_ColorRampType', 'Color Ramp')]
('BVTK_Node_ColorRampType', 'Color Ramp')]
2 changes: 1 addition & 1 deletion info.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def draw_buttons(self, context, layout):
row.separator()
row.separator()
row.separator()
row.operator("node.update", text="update").node_path = node_path(self)
row.operator("node.bvtk_node_update", text="update").node_path = node_path(self)
row.separator()
row.separator()
row.separator()
Expand Down
2 changes: 1 addition & 1 deletion tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@ def set(objname, attr, val):
for i in range(len(linked)):
linked[i].location = (i * 300, 0)

tb = nodes.new('VTK2BlenderType')
tb = nodes.new('BVTK_Node_VTKToBlenderType')
tb.location = (len(linked) * 300, 0)
links.new(tb.inputs[0], linked[len(linked) - 1].outputs[0])

Expand Down

0 comments on commit 69e6142

Please sign in to comment.