* 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).
This commit is contained in:
2010-11-14 23:07:06 +00:00
parent 43f4dbceb4
commit a95181a7a0
3 changed files with 66 additions and 8 deletions

View File

@@ -264,14 +264,14 @@ class RENDER_PT_freestyle(RenderButtonsPanel, bpy.types.Panel):
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):

View File

@@ -39,6 +39,12 @@ struct BPathIteratorSeqData {
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 @@ struct BPathIterator {
/* 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);

View File

@@ -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 @@ enum BPathTypes {
BPATH_LIB,
BPATH_SEQ,
BPATH_CDATA,
BPATH_FRS_MODULE,
BPATH_DONE
};
@@ -92,6 +94,11 @@ void BLI_bpathIterator_init( struct BPathIterator *bpi, char *base_path ) {
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 @@ static struct Sequence *seq_stepdata__internal(struct BPathIterator *bpi, int st
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 @@ void BLI_bpathIterator_step( struct BPathIterator *bpi) {
} 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 @@ static void bpath_as_report(struct BPathIterator *bpi, const char *message, Repo
case BPATH_CDATA:
prefix= "Mesh Data";
break;
case BPATH_FRS_MODULE:
prefix= "Freestyle Module";
break;
default:
prefix= "Unknown";
break;