Revision: 33068
          
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=33068
Author:   kjym3
Date:     2010-11-15 00:07:06 +0100 (Mon, 15 Nov 2010)

Log Message:
-----------
* Fix for relative paths to style module files.

When a .blend file is saved, the "Remap Relative" option allows users
to keep relative paths valid even if the .blend file is saved into a
different directory.  Now the Remap Relative option takes care of relative
paths to style module files.  In addition, the following operations work
as expected with respect to style modules:
- File >> External Data >> Make All Path Relative
- File >> External Data >> Make All Path Absolute
- File >> External Data >> Report Missing Files

* Indentation fix in the UI code (no functionality changes).

Modified Paths:
--------------
    branches/soc-2008-mxcurioni/release/scripts/ui/properties_render.py
    branches/soc-2008-mxcurioni/source/blender/blenlib/BLI_bpath.h
    branches/soc-2008-mxcurioni/source/blender/blenlib/intern/bpath.c

Modified: branches/soc-2008-mxcurioni/release/scripts/ui/properties_render.py
===================================================================
--- branches/soc-2008-mxcurioni/release/scripts/ui/properties_render.py 
2010-11-14 22:30:51 UTC (rev 33067)
+++ branches/soc-2008-mxcurioni/release/scripts/ui/properties_render.py 
2010-11-14 23:07:06 UTC (rev 33068)
@@ -264,14 +264,14 @@
             col.operator("scene.freestyle_module_add")
 
             for i, module in enumerate(freestyle.modules):
-                    box = layout.box()
-                    box.context_pointer_set("freestyle_module", module)
-                    row = box.row(align=True)
-                    row.prop(module, "use", 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'
+                box = layout.box()
+                box.context_pointer_set("freestyle_module", module)
+                row = box.row(align=True)
+                row.prop(module, "use", 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):

Modified: branches/soc-2008-mxcurioni/source/blender/blenlib/BLI_bpath.h
===================================================================
--- branches/soc-2008-mxcurioni/source/blender/blenlib/BLI_bpath.h      
2010-11-14 22:30:51 UTC (rev 33067)
+++ branches/soc-2008-mxcurioni/source/blender/blenlib/BLI_bpath.h      
2010-11-14 23:07:06 UTC (rev 33068)
@@ -39,6 +39,12 @@
        struct Scene *scene;                    /* Current scene */
 };
 
+struct BPathIteratorFrsModuleData {
+       struct Scene *scene;                    /* Current scene */
+       struct SceneRenderLayer *layer; /* Scene render layer */
+       struct FreestyleModuleConfig *module;
+};
+
 struct BPathIterator {
        char*   path;
        char*   lib;
@@ -54,6 +60,8 @@
 
        /* only for seq data */
        struct BPathIteratorSeqData seqdata;
+       /* only for Freestyle module data */
+       struct BPathIteratorFrsModuleData frsmoduledata;
 };
 
 void                   BLI_bpathIterator_init                          (struct 
BPathIterator *bpi, char *base_path);

Modified: branches/soc-2008-mxcurioni/source/blender/blenlib/intern/bpath.c
===================================================================
--- branches/soc-2008-mxcurioni/source/blender/blenlib/intern/bpath.c   
2010-11-14 22:30:51 UTC (rev 33067)
+++ branches/soc-2008-mxcurioni/source/blender/blenlib/intern/bpath.c   
2010-11-14 23:07:06 UTC (rev 33068)
@@ -48,6 +48,7 @@
 #include "DNA_sequence_types.h"
 #include "DNA_vfont_types.h"
 #include "DNA_windowmanager_types.h"
+#include "DNA_freestyle_types.h"
 
 #include "BLI_blenlib.h"
 #include "BLI_bpath.h"
@@ -75,6 +76,7 @@
        BPATH_LIB,
        BPATH_SEQ,
        BPATH_CDATA,
+       BPATH_FRS_MODULE,
 
         BPATH_DONE
 };
@@ -92,6 +94,11 @@
        bpi->seqdata.seqar = NULL;
        bpi->seqdata.scene = NULL;
        
+       /* Freestyle module specific */
+       bpi->frsmoduledata.scene = NULL;
+       bpi->frsmoduledata.layer = NULL;
+       bpi->frsmoduledata.module = NULL;
+
        bpi->base_path= base_path ? base_path : G.main->name;
 
        BLI_bpathIterator_step(bpi);
@@ -254,6 +261,32 @@
        return NULL;
 }
 
+static struct FreestyleModuleConfig *frs_module_stepdata__internal(struct 
BPathIterator *bpi, int step_next)
+{
+       struct FreestyleModuleConfig *module;
+
+       /* Initializing */
+       if (bpi->frsmoduledata.scene==NULL) {
+               bpi->frsmoduledata.scene= G.main->scene.first;
+               bpi->frsmoduledata.layer= 
bpi->frsmoduledata.scene->r.layers.first;
+               bpi->frsmoduledata.module= 
bpi->frsmoduledata.layer->freestyleConfig.modules.first;
+       }
+
+       while (bpi->frsmoduledata.scene) {
+               while (bpi->frsmoduledata.layer) {
+                       while (bpi->frsmoduledata.module) {
+                               module= bpi->frsmoduledata.module;
+                               bpi->frsmoduledata.module= module->next;
+                               return module;
+                       }
+                       bpi->frsmoduledata.layer= 
bpi->frsmoduledata.layer->next;
+               }
+               bpi->frsmoduledata.scene= bpi->frsmoduledata.scene->id.next;
+       }
+
+       return NULL;
+}
+
 static void seq_getpath(struct BPathIterator *bpi, char *path) {
        Sequence *seq = (Sequence *)bpi->data;
 
@@ -431,6 +464,20 @@
                        } else {
                                bpi_type_step__internal(bpi);
                        }
+               } else if  ((bpi->type) == BPATH_FRS_MODULE) {
+                       if (bpi->data)  bpi->data = 
frs_module_stepdata__internal( bpi, 1 );
+                       else                    bpi->data = 
frs_module_stepdata__internal( bpi, 0 );
+
+                       if (bpi->data) {
+                               FreestyleModuleConfig *module = 
(FreestyleModuleConfig *)bpi->data;
+                               bpi->lib = NULL;
+                               bpi->path = module->module_path;
+                               bpi->name = NULL;
+                               bpi->len = sizeof(module->module_path);
+                               break;
+                       } else {
+                               bpi_type_step__internal(bpi);
+                       }
                }
        }
 }
@@ -468,6 +515,9 @@
        case BPATH_CDATA:
                prefix= "Mesh Data";
                break;
+       case BPATH_FRS_MODULE:
+               prefix= "Freestyle Module";
+               break;
        default:
                prefix= "Unknown";
                break;


_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to