Merged changes in the trunk up to revision 31284.
authorTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>
Thu, 12 Aug 2010 13:41:59 +0000 (13:41 +0000)
committerTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>
Thu, 12 Aug 2010 13:41:59 +0000 (13:41 +0000)
1  2 
release/scripts/ui/properties_render.py
source/blender/blenkernel/intern/idcode.c
source/blender/blenloader/intern/readfile.c
source/blender/editors/interface/interface_templates.c
source/blender/python/doc/sphinx_doc_gen.py

index 6856e73dc2f59286623de93d043164dadc2b4ff3,6e8ebb1069132a48064b0794175d2f6a437518d7..7568af9ce433f983e4804f0218d4ae8d9b6c25db
@@@ -119,12 -119,11 +119,12 @@@ class RENDER_PT_layers(RenderButtonsPan
          col.prop(rl, "solid")
          col.prop(rl, "halo")
          col.prop(rl, "ztransp")
 -
 -        col = split.column()
          col.prop(rl, "sky")
 +              
 +        col = split.column()
          col.prop(rl, "edge")
          col.prop(rl, "strand")
 +        col.prop(rl, "freestyle")
  
          layout.separator()
  
          row.prop(rl, "pass_refraction_exclude", text="")
  
  
 +class RENDER_PT_freestyle(RenderButtonsPanel, bpy.types.Panel):
 +    bl_label = "Freestyle"
 +    COMPAT_ENGINES = {'BLENDER_RENDER'}
 +
 +    @classmethod
 +    def poll(cls, context):
 +        rd = context.scene.render
 +        rl = rd.layers[rd.active_layer_index]
 +        return rl and rl.freestyle
 +
 +    def draw(self, context):
 +        layout = self.layout
 +
 +        rd = context.scene.render
 +        rl = rd.layers[rd.active_layer_index]
 +        freestyle = rl.freestyle_settings
 +
 +        split = layout.split()
 +
 +        col = split.column()
 +        col.prop(freestyle, "mode", text="Control Mode")
 +
 +        if freestyle.mode == "EDITOR":
 +            col.label(text="Edge Detection Options:")
 +            col.prop(freestyle, "crease_angle")
 +            col.prop(freestyle, "sphere_radius")
 +            col.prop(freestyle, "dkr_epsilon")
 +
 +            lineset = freestyle.active_lineset
 +
 +            col.label(text="Line Sets:")
 +            row = col.row()
 +            rows = 2
 +            if lineset:
 +                rows = 5
 +            # FIXME: scrollbar does not work correctly
 +            row.template_list(freestyle, "linesets", freestyle, "active_lineset_index", rows=rows)
 +
 +            sub = row.column()
 +            subsub = sub.column(align=True)
 +            subsub.operator("scene.freestyle_lineset_add", icon='ZOOMIN', text="")
 +            subsub.operator("scene.freestyle_lineset_remove", icon='ZOOMOUT', text="")
 +            if lineset:
 +                sub.separator()
 +                subsub = sub.column(align=True)
 +                subsub.operator("scene.freestyle_lineset_move", icon='TRIA_UP', text="").direction = 'UP'
 +                subsub.operator("scene.freestyle_lineset_move", icon='TRIA_DOWN', text="").direction = 'DOWN'
 +
 +            if lineset:
 +                col.prop(lineset, "name")
 +                col.prop(lineset, "select_by_visibility")
 +                col.prop(lineset, "select_by_edge_types")
 +
 +                if lineset.select_by_visibility:
 +                    col.label(text="Visibility:")
 +                    sub = col.row(align=True)
 +                    sub.prop(lineset, "visibility", expand=True)
 +                    if lineset.visibility == "RANGE":
 +                        sub = col.row(align=True)
 +                        sub.prop(lineset, "qi_start")
 +                        sub.prop(lineset, "qi_end")
 +
 +                if lineset.select_by_edge_types:
 +                    col.label(text="Edge Types:")
 +                    row = col.row()
 +                    row.prop(lineset, "edge_type_negation", expand=True)
 +                    row = col.row()
 +                    row.prop(lineset, "edge_type_combination", expand=True)
 +
 +                    row = col.row()
 +                    sub = row.column()
 +                    sub.prop(lineset, "select_silhouette")
 +                    sub.prop(lineset, "select_border")
 +                    sub.prop(lineset, "select_crease")
 +                    sub.prop(lineset, "select_ridge")
 +                    sub.prop(lineset, "select_valley")
 +                    sub.prop(lineset, "select_suggestive_contour")
 +                    sub.prop(lineset, "select_material_boundary")
 +                    sub = row.column()
 +                    sub.prop(lineset, "select_contour")
 +                    sub.prop(lineset, "select_external_contour")
 +
 +        else: # freestyle.mode == "SCRIPT"
 +
 +            col.prop(freestyle, "crease_angle")
 +            col.prop(freestyle, "sphere_radius")
 +            col.prop(freestyle, "ridges_and_valleys")
 +            col.prop(freestyle, "suggestive_contours")
 +            sub = col.row()
 +            sub.prop(freestyle, "dkr_epsilon")
 +            sub.active = freestyle.suggestive_contours
 +            col.prop(freestyle, "material_boundaries")
 +            col.operator("scene.freestyle_module_add")
 +
 +            for i, module in enumerate(freestyle.modules):
 +                    box = layout.box()
 +                    box.set_context_pointer("freestyle_module", module)
 +                    row = box.row(align=True)
 +                    row.prop(module, "is_displayed", text="")
 +                    row.prop(module, "module_path", text="")
 +                    row.operator("scene.freestyle_module_remove", icon='X', text="")
 +                    row.operator("scene.freestyle_module_move", icon='TRIA_UP', text="").direction = 'UP'
 +                    row.operator("scene.freestyle_module_move", icon='TRIA_DOWN', text="").direction = 'DOWN'
 +
 +
 +class RENDER_PT_freestyle_linestyle(RenderButtonsPanel, bpy.types.Panel):
 +    bl_label = "Freestyle: Line Style"
 +    COMPAT_ENGINES = {'BLENDER_RENDER'}
 +
 +    @classmethod
 +    def poll(cls, context):
 +        rd = context.scene.render
 +        rl = rd.layers[rd.active_layer_index]
 +        if rl and rl.freestyle:
 +            freestyle = rl.freestyle_settings
 +            return freestyle.mode == "EDITOR" and freestyle.active_lineset
 +        return False
 +
 +    def draw_modifier_box_header(self, box, modifier):
 +        row = box.row()
 +        row.set_context_pointer("modifier", modifier)
 +        if modifier.expanded:
 +            icon = "TRIA_DOWN"
 +        else:
 +            icon = "TRIA_RIGHT"
 +        row.operator("scene.freestyle_modifier_toggle_fold", icon=icon, text="", emboss=False)
 +        row.label(text=modifier.rna_type.name)
 +        row.prop(modifier, "name", text="")
 +        row.prop(modifier, "enabled", text="")
 +        sub = row.row(align=True)
 +        sub.operator("scene.freestyle_modifier_move", icon='TRIA_UP', text="").direction = 'UP'
 +        sub.operator("scene.freestyle_modifier_move", icon='TRIA_DOWN', text="").direction = 'DOWN'
 +        row.operator("scene.freestyle_modifier_remove", icon='X', text="")
 +
 +    def draw_color_modifier(self, context, modifier):
 +        layout = self.layout
 +
 +        col = layout.column(align=True)
 +        self.draw_modifier_box_header(col.box(), modifier)
 +        if modifier.expanded:
 +            box = col.box()
 +            row = box.row()
 +            row.prop(modifier, "blend", text="")
 +            row.prop(modifier, "influence")
 +            if modifier.type == "DISTANCE_FROM_OBJECT":
 +                box.prop(modifier, "target")
 +            box.template_color_ramp(modifier, "color_ramp", expand=True)
 +            if modifier.type not in ["ALONG_STROKE"]:
 +                row = box.row(align=True)
 +                row.prop(modifier, "range_min")
 +                row.prop(modifier, "range_max")
 +
 +    def draw_alpha_modifier(self, context, modifier):
 +        layout = self.layout
 +
 +        col = layout.column(align=True)
 +        self.draw_modifier_box_header(col.box(), modifier)
 +        if modifier.expanded:
 +            box = col.box()
 +            row = box.row()
 +            row.prop(modifier, "blend", text="")
 +            row.prop(modifier, "influence")
 +            if modifier.type == "DISTANCE_FROM_OBJECT":
 +                box.prop(modifier, "target")
 +            row = box.row()
 +            row.prop(modifier, "mapping", text="")
 +            sub = row.column()
 +            sub.prop(modifier, "invert")
 +            if modifier.mapping == "CURVE":
 +                sub.enabled = False
 +                box.template_curve_mapping(modifier, "curve")
 +            if modifier.type not in ["ALONG_STROKE"]:
 +                row = box.row(align=True)
 +                row.prop(modifier, "range_min")
 +                row.prop(modifier, "range_max")
 +
 +    def draw_thickness_modifier(self, context, modifier):
 +        layout = self.layout
 +
 +        col = layout.column(align=True)
 +        self.draw_modifier_box_header(col.box(), modifier)
 +        if modifier.expanded:
 +            box = col.box()
 +            row = box.row()
 +            row.prop(modifier, "blend", text="")
 +            row.prop(modifier, "influence")
 +            if modifier.type == "DISTANCE_FROM_OBJECT":
 +                box.prop(modifier, "target")
 +            row = box.row()
 +            row.prop(modifier, "mapping", text="")
 +            sub = row.column()
 +            sub.prop(modifier, "invert")
 +            if modifier.mapping == "CURVE":
 +                sub.enabled = False
 +                box.template_curve_mapping(modifier, "curve")
 +            if modifier.type not in ["ALONG_STROKE"]:
 +                row = box.row(align=True)
 +                row.prop(modifier, "range_min")
 +                row.prop(modifier, "range_max")
 +            row = box.row(align=True)
 +            row.prop(modifier, "value_min")
 +            row.prop(modifier, "value_max")
 +
 +    def draw(self, context):
 +        layout = self.layout
 +
 +        rd = context.scene.render
 +        rl = rd.layers[rd.active_layer_index]
 +        lineset = rl.freestyle_settings.active_lineset
 +        linestyle = lineset.linestyle
 +
 +        split = layout.split()
 +        col = split.column()
 +        col.template_ID(lineset, "linestyle", new="scene.freestyle_linestyle_new")
 +
 +        col.separator()
 +        sub = col.row(align=True)
 +        sub.prop(linestyle, "panel", expand=True)
 +
 +        if linestyle.panel == "COLOR":
 +            col.label(text="Base Color:")
 +            col.prop(linestyle, "color", text="")
 +            col.label(text="Modifiers:")
 +            layout.operator_menu_enum("scene.freestyle_color_modifier_add", "type", text="Add Modifier")
 +            for modifier in linestyle.color_modifiers:
 +                self.draw_color_modifier(context, modifier)
 +        elif linestyle.panel == "ALPHA":
 +            col.label(text="Base Transparency:")
 +            col.prop(linestyle, "alpha")
 +            col.label(text="Modifiers:")
 +            layout.operator_menu_enum("scene.freestyle_alpha_modifier_add", "type", text="Add Modifier")
 +            for modifier in linestyle.alpha_modifiers:
 +                self.draw_alpha_modifier(context, modifier)
 +        elif linestyle.panel == "THICKNESS":
 +            col.label(text="Base Thickness:")
 +            col.prop(linestyle, "thickness")
 +            col.label(text="Modifiers:")
 +            layout.operator_menu_enum("scene.freestyle_thickness_modifier_add", "type", text="Add Modifier")
 +            for modifier in linestyle.thickness_modifiers:
 +                self.draw_thickness_modifier(context, modifier)
 +        elif linestyle.panel == "STROKES":
 +            pass
 +        elif linestyle.panel == "DISTORT":
 +            pass
 +        elif linestyle.panel == "MISC":
 +            pass
 +
 +
  class RENDER_PT_shading(RenderButtonsPanel, bpy.types.Panel):
      bl_label = "Shading"
      COMPAT_ENGINES = {'BLENDER_RENDER'}
@@@ -521,12 -272,6 +521,12 @@@ class RENDER_PT_post_processing(RenderB
          sub.prop(rd, "edge_threshold", text="Threshold", slider=True)
          sub.prop(rd, "edge_color", text="")
  
 +        layout.separator()
 +
 +        split = layout.split()
 +        col = split.column()
 +        col.prop(rd, "freestyle", text="Freestyle")
 +
  
  class RENDER_PT_output(RenderButtonsPanel, bpy.types.Panel):
      bl_label = "Output"
@@@ -695,7 -440,7 +695,7 @@@ class RENDER_PT_encoding(RenderButtonsP
          # Audio:
          sub = layout.column()
  
-         if rd.ffmpeg_format not in ('MP3'):
+         if rd.ffmpeg_format not in ('MP3'):
              sub.prop(rd, "ffmpeg_audio_codec", text="Audio Codec")
  
          sub.separator()
@@@ -858,26 -603,26 +858,26 @@@ class RENDER_PT_bake(RenderButtonsPanel
          rd = context.scene.render
  
          layout.operator("object.bake_image", icon='RENDER_STILL')
 -
 +        
          layout.prop(rd, "bake_type")
 -
 +        
          if rd.bake_type == 'NORMALS':
              layout.prop(rd, "bake_normal_space")
          elif rd.bake_type in ('DISPLACEMENT', 'AO'):
              layout.prop(rd, "bake_normalized")
 -
 +        
          # col.prop(rd, "bake_aa_mode")
          # col.prop(rd, "bake_enable_aa")
 -
 +        
          layout.separator()
 -
 +        
          split = layout.split()
  
          col = split.column()
          col.prop(rd, "bake_clear")
          col.prop(rd, "bake_margin")
          col.prop(rd, "bake_quad_split", text="Split")
 -
 +        
          col = split.column()
          col.prop(rd, "bake_active")
          sub = col.column()
          sub.prop(rd, "bake_distance")
          sub.prop(rd, "bake_bias")
  
 -
 +        
  def register():
      pass
  
index 0000000000000000000000000000000000000000,3e8f400967eeb6cfae8b626cde31dffd231cc032..bc5740b1638e222fa188302ac4594bd0ee312f93
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,128 +1,129 @@@
+ /**
+  * $Id$
+  *
+  * ***** BEGIN GPL LICENSE BLOCK *****
+  *
+  * This program is free software; you can redistribute it and/or
+  * modify it under the terms of the GNU General Public License
+  * as published by the Free Software Foundation; either version 2
+  * of the License, or (at your option) any later version.
+  *
+  * This program is distributed in the hope that it will be useful,
+  * but WITHOUT ANY WARRANTY; without even the implied warranty of
+  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  * GNU General Public License for more details.
+  *
+  * You should have received a copy of the GNU General Public License
+  * along with this program; if not, write to the Free Software Foundation,
+  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+  *
+  * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+  * All rights reserved.
+  *
+  * The Original Code is: all of this file.
+  *
+  * Contributor(s): none yet.
+  *
+  * ***** END GPL LICENSE BLOCK *****
+  * return info about ID types
+  */
+  
+ #include <stdlib.h>
+ #include <string.h>
+ #include "DNA_ID.h"
+ typedef struct {
+       unsigned short code;
+       char *name, *plural;
+       
+       int flags;
+ #define IDTYPE_FLAGS_ISLINKABLE       (1<<0)
+ } IDType;
+ /* plural need to match rna_main.c's MainCollectionDef */
+ static IDType idtypes[]= {
+       { ID_AC,                "Action",       "actions",              IDTYPE_FLAGS_ISLINKABLE}, 
+       { ID_AR,                "Armature", "armatures",        IDTYPE_FLAGS_ISLINKABLE}, 
+       { ID_BR,                "Brush",        "brushes",              IDTYPE_FLAGS_ISLINKABLE}, 
+       { ID_CA,                "Camera",       "cameras",              IDTYPE_FLAGS_ISLINKABLE}, 
+       { ID_CU,                "Curve",        "curves",               IDTYPE_FLAGS_ISLINKABLE}, 
+       { ID_GD,                "GPencil",      "gpencil",              IDTYPE_FLAGS_ISLINKABLE},  /* rename gpencil */
+       { ID_GR,                "Group",        "groups",               IDTYPE_FLAGS_ISLINKABLE}, 
+       { ID_ID,                "ID",           "ids",                  0}, /* plural is fake */
+       { ID_IM,                "Image",        "images",               IDTYPE_FLAGS_ISLINKABLE}, 
+       { ID_IP,                "Ipo",          "ipos",                 IDTYPE_FLAGS_ISLINKABLE},  /* deprecated */
+       { ID_KE,                "Key",          "keys",                 0}, 
+       { ID_LA,                "Lamp",         "lamps",                IDTYPE_FLAGS_ISLINKABLE}, 
+       { ID_LI,                "Library",      "libraries",    0}, 
++      { ID_LS,                "FreestyleLineStyle", "linestyles", 0}, 
+       { ID_LT,                "Lattice",      "lattices",             IDTYPE_FLAGS_ISLINKABLE}, 
+       { ID_MA,                "Material", "materials",        IDTYPE_FLAGS_ISLINKABLE}, 
+       { ID_MB,                "Metaball", "metaballs",        IDTYPE_FLAGS_ISLINKABLE}, 
+       { ID_ME,                "Mesh",         "meshes",               IDTYPE_FLAGS_ISLINKABLE}, 
+       { ID_NT,                "NodeTree",     "node_groups",  IDTYPE_FLAGS_ISLINKABLE}, 
+       { ID_OB,                "Object",       "objects",              IDTYPE_FLAGS_ISLINKABLE}, 
+       { ID_PA,                "ParticleSettings",     "particles", 0},
+       { ID_SCE,               "Scene",        "scenes",               IDTYPE_FLAGS_ISLINKABLE}, 
+       { ID_SCR,               "Screen",       "screens",              0}, 
+       { ID_SEQ,               "Sequence",     "sequences",    0}, /* not actually ID data */
+       { ID_SO,                "Sound",        "sounds",               IDTYPE_FLAGS_ISLINKABLE}, 
+       { ID_TE,                "Texture",      "textures",             IDTYPE_FLAGS_ISLINKABLE}, 
+       { ID_TXT,               "Text",         "texts",                IDTYPE_FLAGS_ISLINKABLE}, 
+       { ID_VF,                "VFont",        "fonts",                IDTYPE_FLAGS_ISLINKABLE}, 
+       { ID_WO,                "World",        "worlds",               IDTYPE_FLAGS_ISLINKABLE}, 
+       { ID_WM,                "WindowManager", "window_managers",     0}, 
+ };
+ static int nidtypes= sizeof(idtypes)/sizeof(idtypes[0]);
+ static IDType *idtype_from_name(const char *str) 
+ {
+       int i= nidtypes;
+       
+       while (i--)
+               if (strcmp(str, idtypes[i].name)==0)
+                       return &idtypes[i];
+       return NULL;
+ }
+ static IDType *idtype_from_code(int code) 
+ {
+       int i= nidtypes;
+       
+       while (i--)
+               if (code==idtypes[i].code)
+                       return &idtypes[i];
+       
+       return NULL;
+ }
+ int BKE_idcode_is_valid(int code) 
+ {
+       return idtype_from_code(code)?1:0;
+ }
+ int BKE_idcode_is_linkable(int code) {
+       IDType *idt= idtype_from_code(code);
+       return idt?(idt->flags&IDTYPE_FLAGS_ISLINKABLE):0;
+ }
+ const char *BKE_idcode_to_name(int code) 
+ {
+       IDType *idt= idtype_from_code(code);
+       
+       return idt?idt->name:NULL;
+ }
+ int BKE_idcode_from_name(const char *name) 
+ {
+       IDType *idt= idtype_from_name(name);
+       
+       return idt?idt->code:0;
+ }
+ const char *BKE_idcode_to_name_plural(int code) 
+ {
+       IDType *idt= idtype_from_code(code);
+       
+       return idt?idt->plural:NULL;
+ }
index b48f9dea70d4e7f84ac6f6d276734c5b44422438,c67375d8aa28d30f66aa1ff028f242441ed10593..3367eb17a2891d70f8c5f48f4b4c222691e24a00
@@@ -63,7 -63,6 +63,7 @@@
  #include "DNA_key_types.h"
  #include "DNA_lattice_types.h"
  #include "DNA_lamp_types.h"
 +#include "DNA_linestyle_types.h"
  #include "DNA_meta_types.h"
  #include "DNA_material_types.h"
  #include "DNA_mesh_types.h"
  #include "BKE_image.h"
  #include "BKE_lattice.h"
  #include "BKE_library.h" // for which_libbase
+ #include "BKE_idcode.h"
  #include "BKE_main.h" // for Main
  #include "BKE_mesh.h" // for ME_ defines (patching)
  #include "BKE_modifier.h"
@@@ -4107,8 -4107,9 +4108,9 @@@ static void composite_patch(bNodeTree *
  
  static void link_paint(FileData *fd, Scene *sce, Paint *p)
  {
-       if(p && p->brush) {
+       if(p) {
                p->brush= newlibadr_us(fd, sce->id.lib, p->brush);
+               p->paint_cursor= NULL;
        }
  }
  
@@@ -4118,7 -4119,6 +4120,7 @@@ static void lib_link_scene(FileData *fd
        Base *base, *next;
        Sequence *seq;
        SceneRenderLayer *srl;
 +      FreestyleLineSet *fls;
        TimeMarker *marker;
        
        sce= main->scene.first;
                        for(srl= sce->r.layers.first; srl; srl= srl->next) {
                                srl->mat_override= newlibadr_us(fd, sce->id.lib, srl->mat_override);
                                srl->light_override= newlibadr_us(fd, sce->id.lib, srl->light_override);
 +                              for(fls=srl->freestyleConfig.linesets.first; fls; fls= fls->next) {
 +                                      fls->linestyle= newlibadr_us(fd, sce->id.lib, fls->linestyle);
 +                              }
                        }
                        /*Game Settings: Dome Warp Text*/
                        sce->gm.dome.warptext= newlibadr(fd, sce->id.lib, sce->gm.dome.warptext);
@@@ -4237,7 -4234,6 +4239,7 @@@ static void direct_link_scene(FileData 
        Editing *ed;
        Sequence *seq;
        MetaStack *ms;
 +      SceneRenderLayer *srl;
  
        sce->theDag = NULL;
        sce->dagisvalid = 0;
        link_list(fd, &(sce->transform_spaces));
        link_list(fd, &(sce->r.layers));
  
 +      for(srl= sce->r.layers.first; srl; srl= srl->next) {
 +              link_list(fd, &(srl->freestyleConfig.modules));
 +      }
 +      for(srl= sce->r.layers.first; srl; srl= srl->next) {
 +              link_list(fd, &(srl->freestyleConfig.linesets));
 +      }
 +      
        sce->nodetree= newdataadr(fd, sce->nodetree);
        if(sce->nodetree)
                direct_link_nodetree(fd, sce->nodetree);
@@@ -5347,130 -5336,6 +5349,130 @@@ static void lib_link_group(FileData *fd
        }
  }
  
 +/* ************ READ LINE STYLE ***************** */
 +
 +static void lib_link_linestyle(FileData *fd, Main *main)
 +{
 +      FreestyleLineStyle *linestyle;
 +      LineStyleModifier *m;
 +
 +      linestyle = main->linestyle.first;
 +      while (linestyle) {
 +              for (m = linestyle->color_modifiers.first; m; m = m->next) {
 +                      if (m->type == LS_MODIFIER_DISTANCE_FROM_OBJECT) {
 +                              LineStyleColorModifier_DistanceFromObject *cm = (LineStyleColorModifier_DistanceFromObject *)m;
 +                              cm->target = newlibadr(fd, linestyle->id.lib, cm->target);
 +                      }
 +              }
 +              for (m = linestyle->alpha_modifiers.first; m; m = m->next){
 +                      if (m->type == LS_MODIFIER_DISTANCE_FROM_OBJECT) {
 +                              LineStyleAlphaModifier_DistanceFromObject *am = (LineStyleAlphaModifier_DistanceFromObject *)m;
 +                              am->target = newlibadr(fd, linestyle->id.lib, am->target);
 +                      }
 +              }
 +              for (m = linestyle->thickness_modifiers.first; m; m = m->next){
 +                      if (m->type == LS_MODIFIER_DISTANCE_FROM_OBJECT) {
 +                              LineStyleThicknessModifier_DistanceFromObject *tm = (LineStyleThicknessModifier_DistanceFromObject *)m;
 +                              tm->target = newlibadr(fd, linestyle->id.lib, tm->target);
 +                      }
 +              }
 +              linestyle = linestyle->id.next;
 +      }
 +}
 +
 +static void direct_link_linestyle_color_modifier(FileData *fd, LineStyleModifier *modifier)
 +{
 +      switch (modifier->type) {
 +      case LS_MODIFIER_ALONG_STROKE:
 +              {
 +                      LineStyleColorModifier_AlongStroke *m = (LineStyleColorModifier_AlongStroke *)modifier;
 +                      m->color_ramp = newdataadr(fd, m->color_ramp);
 +              }
 +              break;
 +      case LS_MODIFIER_DISTANCE_FROM_CAMERA:
 +              {
 +                      LineStyleColorModifier_DistanceFromCamera *m = (LineStyleColorModifier_DistanceFromCamera *)modifier;
 +                      m->color_ramp = newdataadr(fd, m->color_ramp);
 +              }
 +              break;
 +      case LS_MODIFIER_DISTANCE_FROM_OBJECT:
 +              {
 +                      LineStyleColorModifier_DistanceFromObject *m = (LineStyleColorModifier_DistanceFromObject *)modifier;
 +                      m->color_ramp = newdataadr(fd, m->color_ramp);
 +              }
 +              break;
 +      }
 +}
 +
 +static void direct_link_linestyle_alpha_modifier(FileData *fd, LineStyleModifier *modifier)
 +{
 +      switch (modifier->type) {
 +      case LS_MODIFIER_ALONG_STROKE:
 +              {
 +                      LineStyleAlphaModifier_AlongStroke *m = (LineStyleAlphaModifier_AlongStroke *)modifier;
 +                      m->curve = newdataadr(fd, m->curve);
 +                      direct_link_curvemapping(fd, m->curve);
 +              }
 +              break;
 +      case LS_MODIFIER_DISTANCE_FROM_CAMERA:
 +              {
 +                      LineStyleAlphaModifier_DistanceFromCamera *m = (LineStyleAlphaModifier_DistanceFromCamera *)modifier;
 +                      m->curve = newdataadr(fd, m->curve);
 +                      direct_link_curvemapping(fd, m->curve);
 +              }
 +              break;
 +      case LS_MODIFIER_DISTANCE_FROM_OBJECT:
 +              {
 +                      LineStyleAlphaModifier_DistanceFromObject *m = (LineStyleAlphaModifier_DistanceFromObject *)modifier;
 +                      m->curve = newdataadr(fd, m->curve);
 +                      direct_link_curvemapping(fd, m->curve);
 +              }
 +              break;
 +      }
 +}
 +
 +static void direct_link_linestyle_thickness_modifier(FileData *fd, LineStyleModifier *modifier)
 +{
 +      switch (modifier->type) {
 +      case LS_MODIFIER_ALONG_STROKE:
 +              {
 +                      LineStyleThicknessModifier_AlongStroke *m = (LineStyleThicknessModifier_AlongStroke *)modifier;
 +                      m->curve = newdataadr(fd, m->curve);
 +                      direct_link_curvemapping(fd, m->curve);
 +              }
 +              break;
 +      case LS_MODIFIER_DISTANCE_FROM_CAMERA:
 +              {
 +                      LineStyleThicknessModifier_DistanceFromCamera *m = (LineStyleThicknessModifier_DistanceFromCamera *)modifier;
 +                      m->curve = newdataadr(fd, m->curve);
 +                      direct_link_curvemapping(fd, m->curve);
 +              }
 +              break;
 +      case LS_MODIFIER_DISTANCE_FROM_OBJECT:
 +              {
 +                      LineStyleThicknessModifier_DistanceFromObject *m = (LineStyleThicknessModifier_DistanceFromObject *)modifier;
 +                      m->curve = newdataadr(fd, m->curve);
 +                      direct_link_curvemapping(fd, m->curve);
 +              }
 +              break;
 +      }
 +}
 +
 +static void direct_link_linestyle(FileData *fd, FreestyleLineStyle *linestyle)
 +{
 +      LineStyleModifier *modifier;
 +
 +      link_list(fd, &linestyle->color_modifiers);
 +      for(modifier=linestyle->color_modifiers.first; modifier; modifier= modifier->next)
 +              direct_link_linestyle_color_modifier(fd, modifier);
 +      link_list(fd, &linestyle->alpha_modifiers);
 +      for(modifier=linestyle->alpha_modifiers.first; modifier; modifier= modifier->next)
 +              direct_link_linestyle_alpha_modifier(fd, modifier);
 +      link_list(fd, &linestyle->thickness_modifiers);
 +      for(modifier=linestyle->thickness_modifiers.first; modifier; modifier= modifier->next)
 +              direct_link_linestyle_thickness_modifier(fd, modifier);
 +}
 +
  /* ************** GENERAL & MAIN ******************** */
  
  
@@@ -5504,7 -5369,6 +5506,7 @@@ static char *dataname(short id_code
                case ID_BR: return "Data from BR";
                case ID_PA: return "Data from PA";
                case ID_GD: return "Data from GD";
 +              case ID_LS: return "Data from LS";
        }
        return "Data from Lib Block";
        
@@@ -5671,9 -5535,6 +5673,9 @@@ static BHead *read_libblock(FileData *f
                case ID_GD:
                        direct_link_gpencil(fd, (bGPdata *)id);
                        break;
 +              case ID_LS:
 +                      direct_link_linestyle(fd, (FreestyleLineStyle *)id);
 +                      break;
        }
        
        /*link direct data of ID properties*/
@@@ -11277,7 -11138,6 +11279,7 @@@ static void lib_link_all(FileData *fd, 
        lib_link_nodetree(fd, main);    /* has to be done after scene/materials, this will verify group nodes */
        lib_link_brush(fd, main);
        lib_link_particlesettings(fd, main);
 +      lib_link_linestyle(fd, main);
  
        lib_link_mesh(fd, main);                /* as last: tpage images with users at zero */
  
@@@ -12197,23 -12057,6 +12199,23 @@@ static void expand_sound(FileData *fd, 
        expand_doit(fd, mainvar, snd->ipo); // XXX depreceated - old animation system
  }
  
 +static void expand_linestyle(FileData *fd, Main *mainvar, FreestyleLineStyle *linestyle)
 +{
 +      LineStyleModifier *m;
 +
 +      for (m = linestyle->color_modifiers.first; m; m = m->next) {
 +              if (m->type == LS_MODIFIER_DISTANCE_FROM_OBJECT)
 +                      expand_doit(fd, mainvar, ((LineStyleColorModifier_DistanceFromObject *)m)->target);
 +      }
 +      for (m = linestyle->alpha_modifiers.first; m; m = m->next){
 +              if (m->type == LS_MODIFIER_DISTANCE_FROM_OBJECT)
 +                      expand_doit(fd, mainvar, ((LineStyleAlphaModifier_DistanceFromObject *)m)->target);
 +      }
 +      for (m = linestyle->thickness_modifiers.first; m; m = m->next){
 +              if (m->type == LS_MODIFIER_DISTANCE_FROM_OBJECT)
 +                      expand_doit(fd, mainvar, ((LineStyleThicknessModifier_DistanceFromObject *)m)->target);
 +      }
 +}
  
  static void expand_main(FileData *fd, Main *mainvar)
  {
                                                break;
                                        case ID_PA:
                                                expand_particlesettings(fd, mainvar, (ParticleSettings *)id);
 +                                              break;
 +                                      case ID_LS:
 +                                              expand_linestyle(fd, mainvar, (FreestyleLineStyle *)id);
 +                                              break;
                                        }
  
                                        doit= 1;
@@@ -12755,8 -12594,8 +12757,8 @@@ static void read_libraries(FileData *ba
  
                                                                append_id_part(fd, mainptr, id, &realid);
                                                                if (!realid) {
-                                                                       BKE_reportf(fd->reports, RPT_ERROR, "LIB ERROR: %s:'%s' missing from '%s'\n", BLO_idcode_to_name(GS(id->name)), id->name+2, mainptr->curlib->filepath);
-                                                                       if(!G.background && basefd->reports) printf("LIB ERROR: %s:'%s' missing from '%s'\n", BLO_idcode_to_name(GS(id->name)), id->name+2, mainptr->curlib->filepath);
+                                                                       BKE_reportf(fd->reports, RPT_ERROR, "LIB ERROR: %s:'%s' missing from '%s'\n", BKE_idcode_to_name(GS(id->name)), id->name+2, mainptr->curlib->filepath);
+                                                                       if(!G.background && basefd->reports) printf("LIB ERROR: %s:'%s' missing from '%s'\n", BKE_idcode_to_name(GS(id->name)), id->name+2, mainptr->curlib->filepath);
                                                                }
                                                                
                                                                change_idid_adr(mainlist, basefd, id, realid);
                                ID *idn= id->next;
                                if(id->flag & LIB_READ) {
                                        BLI_remlink(lbarray[a], id);
-                                       BKE_reportf(basefd->reports, RPT_ERROR, "LIB ERROR: %s:'%s' unread libblock missing from '%s'\n", BLO_idcode_to_name(GS(id->name)), id->name+2, mainptr->curlib->filepath);
-                                       if(!G.background && basefd->reports)printf("LIB ERROR: %s:'%s' unread libblock missing from '%s'\n", BLO_idcode_to_name(GS(id->name)), id->name+2, mainptr->curlib->filepath);
+                                       BKE_reportf(basefd->reports, RPT_ERROR, "LIB ERROR: %s:'%s' unread libblock missing from '%s'\n", BKE_idcode_to_name(GS(id->name)), id->name+2, mainptr->curlib->filepath);
+                                       if(!G.background && basefd->reports)printf("LIB ERROR: %s:'%s' unread libblock missing from '%s'\n", BKE_idcode_to_name(GS(id->name)), id->name+2, mainptr->curlib->filepath);
                                        change_idid_adr(mainlist, basefd, id, NULL);
  
                                        MEM_freeN(id);
index 169ef4e76751dabf7168707944c6d13cd3fe7acd,eb99a45d62da3676a7df44135dc928b65344e473..6e235130a5ccf74d5447b08b1137f90d43f6575f
@@@ -118,8 -118,6 +118,8 @@@ void uiTemplateDopeSheetFilter(uiLayou
                uiItemR(row, ptr, "display_armature", 0, "", 0);
        if (mainptr && mainptr->particle.first)
                uiItemR(row, ptr, "display_particle", 0, "", 0);
 +      if (mainptr && mainptr->linestyle.first)
 +              uiItemR(row, ptr, "display_linestyle", 0, "", 0);
        
        /* group-based filtering (only when groups are available */
        if (mainptr && mainptr->group.first) {
@@@ -2099,12 -2097,6 +2099,6 @@@ static void list_item_row(bContext *C, 
        /* list item behind label & other buttons */
        sub= uiLayoutRow(overlap, 0);
  
-       if(itemptr->type == &RNA_ShapeKey) {
-               ob= (Object*)activeptr->data;
-               if(ob->mode == OB_MODE_EDIT && !(ob->type == OB_MESH))
-                       uiLayoutSetEnabled(sub, 0);
-       }
        but= uiDefButR(block, LISTROW, 0, "", 0,0, UI_UNIT_X*10,UI_UNIT_Y, activeptr, activepropname, 0, 0, i, 0, 0, "");
        uiButSetFlag(but, UI_BUT_NO_TOOLTIP);
  
                uiBlockSetEmboss(block, UI_EMBOSS);
                uiDefButR(block, OPTION, 0, "", 0, 0, UI_UNIT_X, UI_UNIT_Y, ptr, "use_textures", i, 0, 0, 0, 0,  NULL);
        }
 -      else if(RNA_struct_is_a(itemptr->type, &RNA_SceneRenderLayer)) {
 +      else if(RNA_struct_is_a(itemptr->type, &RNA_SceneRenderLayer) || itemptr->type == &RNA_FreestyleLineSet) {
                uiItemL(sub, name, icon);
                uiBlockSetEmboss(block, UI_EMBOSS);
                uiDefButR(block, OPTION, 0, "", 0, 0, UI_UNIT_X, UI_UNIT_Y, itemptr, "enabled", 0, 0, 0, 0, 0,  NULL);
index a74f95a63c49c89691bbed3396533f4d55553dec,940b5fbcce9e0f131baa70303422df4efc414440..b9a14f59e2cd691575677641700cc48c4e08caa2
@@@ -45,9 -45,9 +45,10 @@@ import rna_inf
  reload(rna_info)
  
  # lame, python wont give some access
+ ClassMethodDescriptorType = type(dict.__dict__['fromkeys'])
  MethodDescriptorType = type(dict.get)
  GetSetDescriptorType = type(int.real)
 +StaticMethodType = type(staticmethod(lambda: None))
  
  EXAMPLE_SET = set()
  EXAMPLE_SET_USED = set()
@@@ -152,10 -152,10 +153,10 @@@ def py_descr2sphinx(ident, fw, descr, m
      if type(descr) == GetSetDescriptorType:
          fw(ident + ".. attribute:: %s\n\n" % identifier)
          write_indented_lines(ident + "   ", fw, doc, False)
-     elif type(descr) == MethodDescriptorType: # GetSetDescriptorType's are not documented yet
+     elif type(descr) in (MethodDescriptorType, ClassMethodDescriptorType):
          write_indented_lines(ident, fw, doc, False)
      else:
-         raise TypeError("type was not GetSetDescriptorType or MethodDescriptorType")
+         raise TypeError("type was not GetSetDescriptorType, MethodDescriptorType or ClassMethodDescriptorType")
  
      write_example_ref(ident, fw, module_name + "." + type_name + "." + identifier)
      fw("\n")
@@@ -269,19 -269,17 +270,23 @@@ def pymodule2sphinx(BASEPATH, module_na
          descr_items = [(key, descr) for key, descr in sorted(value.__dict__.items()) if not key.startswith("__")]
  
          for key, descr in descr_items:
-             if type(descr) == MethodDescriptorType: # GetSetDescriptorType's are not documented yet
+             if type(descr) == ClassMethodDescriptorType:
+                 py_descr2sphinx("   ", fw, descr, module_name, type_name, key)
+         for key, descr in descr_items:
+             if type(descr) == MethodDescriptorType:
                  py_descr2sphinx("   ", fw, descr, module_name, type_name, key)
  
          for key, descr in descr_items:
              if type(descr) == GetSetDescriptorType:
                  py_descr2sphinx("   ", fw, descr, module_name, type_name, key)
  
 +        for key, descr in descr_items:
 +            if type(descr) == StaticMethodType:
 +                descr = getattr(value, key)
 +                write_indented_lines("   ", fw, descr.__doc__ or "Undocumented", False)
 +                fw("\n")
 +
          fw("\n\n")
  
      file.close()
@@@ -382,7 -380,6 +387,7 @@@ def rna2sphinx(BASEPATH)
  
  
      fw("   mathutils.rst\n\n")
 +    fw("   Freestyle.rst\n\n")
      fw("   blf.rst\n\n")
      
      # game engine
      pymodule2sphinx(BASEPATH, "mathutils", module, "Math Types & Utilities (mathutils)")
      del module
  
 +    import Freestyle as module
 +    pymodule2sphinx(BASEPATH, "Freestyle", module, "Freestyle Operators & Rules (Freestyle)")
 +    del module
 +
      import blf as module
      pymodule2sphinx(BASEPATH, "blf", module, "Font Drawing (blf)")
      del module