View topic - Victor Oliveira: Blender 2.5 Integration

Victor Oliveira: Blender 2.5 Integration

Students Proposals sent to YafaRay

Victor Oliveira: Blender 2.5 Integration

Post Mon Mar 22, 2010 5:07 pm

Hi! My name is Victor Oliveira. I'm a fourth-year Computer Science student at University of Campinas (UNICAMP), Brazil [1].
Also, I've already worked with educational robotics [2] and image processing using GPUs. Currently, I'm doing an internship at Linux Technology Center IBM, with python and distributed systems.
Also, I like ballroom dance, jazz, samba and prog rock :)

Proposal description:
"YafaRay needs to be integrated in the upcoming Blender 2.5 release, using all the new advantages Blender 2.5 has got for integrating external applications, such as a render API, access to the Blender UI, direct access to the Blender Composite nodes and a more efficient scene exporting. In this new integration we would like to address some usability issues of the current exporter UI."

So, what I intend to do now:
    Build YafaRay's development version (darktide branch) [ok]
    Build Blender 2.4.9 and integrate with YafaRay [ok]
    Build Blender 2.5 [ok]
    Read Blender Python module documentation
    Play a little with Python in Blender
    Solve some bugs in exporter, to start getting used to YafaRay's source

[1] http://www.ic.unicamp.br/
[2] http://br-gogo.sourceforge.net/
User avatar
victor
 
Posts: 7
Joined: Mon Mar 22, 2010 3:15 pm

Re: Victor Oliveira: Blender 2.5 Integration

Post Mon Mar 22, 2010 10:30 pm

Hi Victor,

The whole Blender community is looking forward to this new exporter. Welcome to our community and good luck with your proposal.
User avatar
Samo
 
Posts: 3097
Joined: Tue Dec 20, 2005 10:39 am
Location: Spain

Re: Victor Oliveira: Blender 2.5 Integration

Post Tue Mar 23, 2010 3:26 pm

hi guys!

this is just a script I've done which uses blender new python API to put some spheres around the cursor, enjoy!

Code: Select all
from bpy import context
from math import sin, cos, radians

add_sphere = bpy.ops.mesh.primitive_ico_sphere_add
layers = [False]*32
layers[0] = True

cursor = context.scene.cursor_location

radius = 5
rad = [radians(degree) for degree in range(0,360, 36)]

add_sphere(location=(cursor.x,cursor.y,cursor.z), layer=layers)

for theta in rad:
    x = cursor.x + radius * cos(theta)
    y = cursor.y + radius * sin(theta)
    z = cursor.z
    add_sphere(location=(x,y,z), layer=layers)


bye!
User avatar
victor
 
Posts: 7
Joined: Mon Mar 22, 2010 3:15 pm

Re: Victor Oliveira: Blender 2.5 Integration

Post Thu Mar 25, 2010 7:08 pm

Hi again!

As a next step, I've done a little script of a dummy renderer using blender 2.5 API, It is based on POV-Ray exporter. when you press 'image' in 'render' it just shows a resized image (using imagemagick) of a given path. but this shows the basic capabilities of this new API.

To run, just put it in "{blender path}/.blender/scripts/io"

Code: Select all
import bpy
import os
import time
import tempfile

#this is the name of our Render
IDNAME = 'DUMMY_RENDER'

class DummyRenderEngine(bpy.types.RenderEngine):
    bl_idname = IDNAME
    bl_label = "Dummy Render"

    # callback to render scene
    def render(self, scene):
        r = scene.render

        # set string in stats
        self.update_stats("", "Rendering!")

        # compute resolution
        x= int(r.resolution_x*r.resolution_percentage*0.01)
        y= int(r.resolution_y*r.resolution_percentage*0.01)

        # get a render result to write into
        result = self.begin_result(0, 0, x, y)
        lay = result.layers[0]

        # here we export blender scene and renders using yafaray
        # but this is (still) dummy
        temp_path = tempfile.mktemp(suffix='.png')
        os.system("convert -scale %dx%d! %s %s" % (x, y, scene.image_path, temp_path) )
        lay.load_from_file(temp_path)
       
        self.end_result(result)

        # done
        self.end_result(result)
        self.update_stats("", "Done!")

# Use some of the existing buttons.
import properties_render
properties_render.RENDER_PT_render.COMPAT_ENGINES.add(IDNAME)
properties_render.RENDER_PT_dimensions.COMPAT_ENGINES.add(IDNAME)
properties_render.RENDER_PT_antialiasing.COMPAT_ENGINES.add(IDNAME)
properties_render.RENDER_PT_output.COMPAT_ENGINES.add(IDNAME)
del properties_render

# Use only a subset of the world panels
import properties_world
properties_world.WORLD_PT_preview.COMPAT_ENGINES.add(IDNAME)
properties_world.WORLD_PT_context_world.COMPAT_ENGINES.add(IDNAME)
properties_world.WORLD_PT_world.COMPAT_ENGINES.add(IDNAME)
properties_world.WORLD_PT_mist.COMPAT_ENGINES.add(IDNAME)
del properties_world

class RENDER_PT_dummy(bpy.types.Panel):
    bl_space_type = 'PROPERTIES'
    bl_region_type = 'WINDOW'
    bl_context = "render"
    bl_label = "Image Path"
   
    def draw_header(self, context):
        scene = context.scene
        #self.layout.prop(scene, "image_path", text="")
   
    def poll(self, context):
        rd = context.scene.render
        return (rd.use_game_engine == False)
   
    def draw(self, context):
        layout = self.layout
        scene = context.scene
        self.layout.prop(scene, "image_path", text="")
       
# extend scene with new property
scene = bpy.types.Scene
scene.StringProperty(attr="image_path",
         name="Image path",
         description="Image which will be displayed",
         default="")

# register engine and panel
classes = [
    DummyRenderEngine,
    RENDER_PT_dummy]


def register():
    register = bpy.types.register
    for cls in classes:
        register(cls)


def unregister():
    unregister = bpy.types.unregister
    for cls in classes:
        unregister(cls)

if __name__ == "__main__":
    register()
User avatar
victor
 
Posts: 7
Joined: Mon Mar 22, 2010 3:15 pm

Re: Victor Oliveira: Blender 2.5 Integration

Post Sun Apr 11, 2010 5:38 pm

hi!

here is a code of blender 2.5 working with yafaray's camera:
http://dl.dropbox.com/u/3479035/yafaray_blender2.5.zip

it is rendering a blue screen atm when you press 'render image' (using yafaray's interface API) :)

some ss
http://dl.dropbox.com/u/3479035/yafaray ... 2.5_ss.zip
User avatar
victor
 
Posts: 7
Joined: Mon Mar 22, 2010 3:15 pm

Re: Victor Oliveira: Blender 2.5 Integration

Post Sun Apr 18, 2010 7:37 pm

hi! we want to make some kind of automatic interface generation. for that we need each module declare somehow its properties, but we don't have functions for this in the current code-base, that's why i created a patch which implements "declare<type>" functions in modules, let's see how it works:
i'll use as example angularCamera.cc plugin, we add a new function:
Code: Select all
void angularCam_t::declare_properties(propMap_t &properties, renderEnvironment_t &render)
{
    properties.declarePoint("camera", "from");
    properties.declarePoint("camera", "to");
    properties.declarePoint("camera", "up");
   
    properties.declareInt("camera", "resx");
    properties.declareInt("camera", "resy");
   
    properties.declareDouble("camera", "aspect_ratio");
    properties.declareDouble("camera", "angle");
    properties.declareDouble("camera", "max_angle");
   
    properties.declareBool("camera", "circular");
    properties.declareBool("camera", "mirrored");
}


this says the types and names of properties this plugin expects. also, we give a "context" for the properties (in this case, "camera") which can be shared among others plugins, so other camera plugins will put their properties in "camera" context as well.

now, if we go to the python interface:
Code: Select all
>>> import yafrayinterface
>>> t = yafrayinterface.yafrayInterface_t()
>>> t.loadPlugins("/home/victor/yafaray/yafaray_build/lib/yafaray")
>>> p = t.getProperty('angular')
>>> p
<yafrayinterface.propMap_t; proxy of <Swig Object of type 'yafaray::propMap_t *' at 0xb76e8e90> >
>>> p.getNames()
('angle', 'aspect_ratio', 'circular', 'from', 'max_angle', 'mirrored', 'resx', 'resy', 'to', 'up')
>>> p.getType('angle')
3
>>> p.getObject('angle')
'camera'


getType returns a number for each type of property (see include/core_api/params.h)

with this we can create a blender interface for a module without having to create a python module for its interface. but many times we'll need to specify better our interface, then the next step is to create a set of python libs which allows the user to create a blender interface in a declarative way, just manipulating properties.

here is the patch
patch.diff
(10.92 KiB) Downloaded 324 times
.

bye!
User avatar
victor
 
Posts: 7
Joined: Mon Mar 22, 2010 3:15 pm

Re: Victor Oliveira: Blender 2.5 Integration

Post Sun Jun 06, 2010 6:40 pm

i'm happy someone is working to integrate 2.5

that will be be very nice to acces yafaray from 2.5


can you give us a timetable fro this integration or when the first version wil come out?


also will the new volume texture in 2.5 included?
as well as the ramp texture or the othere new texture like point density and voxel
which are new in 2.5 ?

hope to work in 2,5 with yafaray soon

happy 2.5
rickyblender
 
Posts: 66
Joined: Sun Dec 28, 2008 8:15 pm

Re: Victor Oliveira: Blender 2.5 Integration

Post Thu Jul 08, 2010 5:06 pm

Hey

this is great news to see an exporter coming for 2.5.

What is the current status of it?
...............................................
C l a a s E i c k e K u h n e n
Artist : Designer : Educator
User avatar
cekuhnen
 
Posts: 281
Joined: Mon Jan 10, 2005 10:00 pm

Re: Victor Oliveira: Blender 2.5 Integration

Post Sun Jul 11, 2010 3:41 am

I was wondering if the parameters laid out in the new interface for 2.5 will be keyable by hovering over a slider and pressing 'i'. Will the new integration be taking advantage of these new keyframing capabilities? I would very much like to be able to use this to be able to key settings aperature size for depth of field. :D
acolyte
 
Posts: 8
Joined: Sun Jul 11, 2010 3:38 am


Return to GSoC 2010 Proposals



Who is online

Users browsing this forum: No registered users and 0 guests

cron