zeffii / TubeTool

generate tubing between two selected polygons (now supports 2 objects simultaneously in edit mode) b2.8+
GNU General Public License v2.0
292 stars 28 forks source link

stage 5 #6

Closed zeffii closed 9 years ago

zeffii commented 9 years ago

small code dump from lunch

import bpy

objects = bpy.data.objects
obj = objects['Obj_TT_tube.002']

scene = bpy.context.scene
settings = 'PREVIEW'
modifiers = True
obj_data = obj.to_mesh(scene, modifiers, settings)

obj_n = objects.new('MESHED_' + obj.name, obj_data)
obj_n.location = (0, 0, 0)
obj_n.matrix_world = obj.matrix_world.copy()
bpy.context.scene.objects.link(obj_n)
obj.hide_render = True
obj.hide = True

this generates mesh from curve, uses the current settings -- tho i feel this is probably more convoluted than practical.

I think the way to go is really:

zeffii commented 9 years ago

image it will hide the CurveObject from view and render. and convert in place to Mesh. (note that you will see a change in the shading of the object, curve objects seem to be lit differently than mesh objects.. the geometry should be identical )

zeffii commented 9 years ago

Using the F6 menu, property changes caused by the black circles aren't reflected immediately in the sliders, mouse must first be moved. More annoyingly I have an 'equalize radii' mode ready which uses a boolean tickbox to grey out parts (radii 1 / 2) and enable a single radius slider.

-- all this works fine if the UI is on a panel ( T panel ), which recieves automatic redraw calls. The blender API prohibits manual redraws because it can potentially cause a recursive call to the redraw mechanism. There exists code to force it (shown in the Gotchas documentation) but fuck it.

zeffii commented 9 years ago

image

zeffii commented 9 years ago

image

toomanydemons commented 9 years ago

hmmmm a draw call issue. Damn I don't think Python uses events/delegates. Hold on let me take a look and try to better understand the problem

On Fri, Apr 17, 2015 at 4:52 AM, Dealga McArdle notifications@github.com wrote:

[image: image] https://cloud.githubusercontent.com/assets/619340/7200783/91ce527c-e500-11e4-9ef1-de286b0c0197.png

— Reply to this email directly or view it on GitHub https://github.com/zeffii/TubeTool/issues/6#issuecomment-93963830.

toomanydemons commented 9 years ago

Oh well you haven't put it online it seems :P But I think I get what you're trying to do. Well there was bound to be a headache in there somewhere :D

I'm pretty sure my trying to help you in Python would be like getting help from a chimp.

You'll figure it out ;)

An equal radii button is a good idea!

On Fri, Apr 17, 2015 at 1:57 PM, Allen Grippin pawnswizard@gmail.com wrote:

hmmmm a draw call issue. Damn I don't think Python uses events/delegates. Hold on let me take a look and try to better understand the problem

On Fri, Apr 17, 2015 at 4:52 AM, Dealga McArdle notifications@github.com wrote:

[image: image] https://cloud.githubusercontent.com/assets/619340/7200783/91ce527c-e500-11e4-9ef1-de286b0c0197.png

— Reply to this email directly or view it on GitHub https://github.com/zeffii/TubeTool/issues/6#issuecomment-93963830.

zeffii commented 9 years ago

i'll push to master, can revert if it sucks hard.

just a heads up, F6 menu will work as expected, just the greying out isn't done until the window is closed/reopened. (changing radius 1 and 2 has no effect if equal radii is ticked )