Hi Matt, I ran into a similar situation and struggled a little to make my peace with the POST_VIEW callback. Campbell told me that it was still quite experimental so I got it working for my project (with a modal operator to be re-activated from time to time) and let it go of it. Would love to see a reliable way of using it though.
> I'd also suggest that a good way to implement this would be as a custom object drawing callback I used it to draw a background plate, so in my case I don't know if a per-object solution would help. I would prefer an option to have a callback in the 3dview editor. If I have 100 3dview editors opened so be it, the code will run 100x. Though one thing doesn't exclude the other, and having either one I think both results (what I need and what you want) can be achieved). -- Dalai for the records, this is my use of it (see the edit.py) : http://www.dalaifelinto.com/ftp/impa/ibltoolkit.zip 2012/6/26 Matt Ebb <[email protected]> > Hi, > > I'm looking to do some custom drawing in the 3D View as part of a > render API plugin. In this particular case, it's to visualise lights, > for example spot light cone angles/sizes/etc. > > Working around this, trying to force the render engine's lights to > mimic blender's existing light properties is not adequate for several > reasons, the most significant being that what's built in to blender > doesn't encompass the range of functionality provided by other > renderers, such as orthographic shadow maps on distant lights. It > would be great to be able to draw this info into the 3D View myself, > depending on the custom engine-specific data attached to the object. > > I've done some testing, and using the region POST_VIEW callback, I can > successfully draw custom OpenGL, looping over all lights in bpy.data > but the problem is the user experience around it, especially in the > case of a render plugin, is not good. I've tried a few things and as > far as I can tell, this is only really possible as part of an > operator, that must be manually run. On top of this, it's only valid > for a certain area/region, which means if a user adds a new 3D View, > the operator must be run again. > > If anyone has any hacks/ideas for how this can be worked around or > improved, I'd love to hear. While I'd be happy with something that > just works for my use case, I'd also suggest that a good way to > implement this would be as a custom object drawing callback > (disclaimer: I have no idea how easy this would be to create). > > It's quite commonplace in other applications to allow plugins to do > custom openGL drawing per object - in many pipelines this is used to > represent custom object/geometry types that the host application > doesn't natively support, or to display a representation of geometry > that will be loaded or generated at render time, without having to > load that geometry into the host application's scene database. It'd > also be useful for render engines of course! Something like this would > probably be a better longer term solution. > > Anyway, any thoughts/ideas/hacks welcome! > > thanks, > > Matt > _______________________________________________ > Bf-python mailing list > [email protected] > http://lists.blender.org/mailman/listinfo/bf-python >
_______________________________________________ Bf-python mailing list [email protected] http://lists.blender.org/mailman/listinfo/bf-python
