Changeset View
Changeset View
Standalone View
Standalone View
node_wrangler.py
| Context not available. | |||||
| mx, my = bpy.context.region.view2d.view_to_region(nlocx, nlocy, clip=False) | mx, my = bpy.context.region.view2d.view_to_region(nlocx, nlocy, clip=False) | ||||
| bgl.glVertex2f(mx,my) | bgl.glVertex2f(mx,my) | ||||
| for i in range(sides+1): | for i in range(sides+1): | ||||
| if (4<=i<=8): | if 4 <= i <= 8: | ||||
| if my > bottom_bar and mx < area_width: | if my > bottom_bar and mx < area_width: | ||||
| cosine = radius * cos(i * 2 * pi / sides) + mx | cosine = radius * cos(i * 2 * pi / sides) + mx | ||||
| sine = radius * sin(i * 2 * pi / sides) + my | sine = radius * sin(i * 2 * pi / sides) + my | ||||
| Context not available. | |||||
| mx, my = bpy.context.region.view2d.view_to_region(nlocx + ndimx, nlocy, clip=False) | mx, my = bpy.context.region.view2d.view_to_region(nlocx + ndimx, nlocy, clip=False) | ||||
| bgl.glVertex2f(mx,my) | bgl.glVertex2f(mx,my) | ||||
| for i in range(sides+1): | for i in range(sides+1): | ||||
| if (0<=i<=4): | if 0 <= i <= 4: | ||||
| if my > bottom_bar and mx < area_width: | if my > bottom_bar and mx < area_width: | ||||
| cosine = radius * cos(i * 2 * pi / sides) + mx | cosine = radius * cos(i * 2 * pi / sides) + mx | ||||
| sine = radius * sin(i * 2 * pi / sides) + my | sine = radius * sin(i * 2 * pi / sides) + my | ||||
| Context not available. | |||||
| mx, my = bpy.context.region.view2d.view_to_region(nlocx, nlocy - ndimy, clip=False) | mx, my = bpy.context.region.view2d.view_to_region(nlocx, nlocy - ndimy, clip=False) | ||||
| bgl.glVertex2f(mx,my) | bgl.glVertex2f(mx,my) | ||||
| for i in range(sides+1): | for i in range(sides+1): | ||||
| if (8<=i<=12): | if 8 <= i <= 12: | ||||
| if my > bottom_bar and mx < area_width: | if my > bottom_bar and mx < area_width: | ||||
| cosine = radius * cos(i * 2 * pi / sides) + mx | cosine = radius * cos(i * 2 * pi / sides) + mx | ||||
| sine = radius * sin(i * 2 * pi / sides) + my | sine = radius * sin(i * 2 * pi / sides) + my | ||||
| Context not available. | |||||
| mx, my = bpy.context.region.view2d.view_to_region(nlocx + ndimx, nlocy - ndimy, clip=False) | mx, my = bpy.context.region.view2d.view_to_region(nlocx + ndimx, nlocy - ndimy, clip=False) | ||||
| bgl.glVertex2f(mx,my) | bgl.glVertex2f(mx,my) | ||||
| for i in range(sides+1): | for i in range(sides+1): | ||||
| if (12<=i<=16): | if 12 <= i <= 16: | ||||
| if my > bottom_bar and mx < area_width: | if my > bottom_bar and mx < area_width: | ||||
| cosine = radius * cos(i * 2 * pi / sides) + mx | cosine = radius * cos(i * 2 * pi / sides) + mx | ||||
| sine = radius * sin(i * 2 * pi / sides) + my | sine = radius * sin(i * 2 * pi / sides) + my | ||||
| Context not available. | |||||
| # Set brightness of viewer to compensate for Film and CM exposure | # Set brightness of viewer to compensate for Film and CM exposure | ||||
| intensity = 1/context.scene.cycles.film_exposure # Film exposure is a multiplier | intensity = 1/context.scene.cycles.film_exposure # Film exposure is a multiplier | ||||
| intensity /= pow(2, (context.scene.view_settings.exposure)) # CM exposure is measured in stops/EVs (2^x) | intensity /= pow(2, context.scene.view_settings.exposure) # CM exposure is measured in stops/EVs (2^x) | ||||
| emission.inputs[1].default_value = intensity | emission.inputs[1].default_value = intensity | ||||
| else: | else: | ||||
| Context not available. | |||||
| nodes, links = get_nodes_links(context) | nodes, links = get_nodes_links(context) | ||||
| to_type = self.to_type | to_type = self.to_type | ||||
| # Those types of nodes will not swap. | # Those types of nodes will not swap. | ||||
| src_excludes = ('NodeFrame') | src_excludes = 'NodeFrame' | ||||
| # Those attributes of nodes will be copied if possible | # Those attributes of nodes will be copied if possible | ||||
| attrs_to_pass = ('color', 'hide', 'label', 'mute', 'parent', | attrs_to_pass = ('color', 'hide', 'label', 'mute', 'parent', | ||||
| 'show_options', 'show_preview', 'show_texture', | 'show_options', 'show_preview', 'show_texture', | ||||
| Context not available. | |||||
| output_node = nodes.new('TextureNodeOutput') | output_node = nodes.new('TextureNodeOutput') | ||||
| output_node.location.x = active.location.x + active.dimensions.x + 80 | output_node.location.x = active.location.x + active.dimensions.x + 80 | ||||
| output_node.location.y = active.location.y | output_node.location.y = active.location.y | ||||
| if (output_node and active.outputs): | if output_node and active.outputs: | ||||
| for i, output in enumerate(active.outputs): | for i, output in enumerate(active.outputs): | ||||
| if not output.hide: | if not output.hide: | ||||
| output_index = i | output_index = i | ||||
| Context not available. | |||||