committed Tamito Kajiyama's RNA and GUI patch for Freestyle integration into Blender 2.5. As of I right now, Freestyle is back in the UI, but rendering still fails because of the texture manager.
This commit is contained in:
@@ -80,11 +80,12 @@ class SCENE_PT_layers(RenderButtonsPanel):
|
||||
col.itemR(rl, "solid")
|
||||
col.itemR(rl, "halo")
|
||||
col.itemR(rl, "ztransp")
|
||||
col.itemR(rl, "sky")
|
||||
|
||||
col = split.column()
|
||||
col.itemR(rl, "sky")
|
||||
col.itemR(rl, "edge")
|
||||
col.itemR(rl, "strand")
|
||||
col.itemR(rl, "freestyle")
|
||||
|
||||
if rl.zmask:
|
||||
split = layout.split()
|
||||
@@ -125,6 +126,33 @@ class SCENE_PT_layers(RenderButtonsPanel):
|
||||
row.itemR(rl, "pass_refraction")
|
||||
row.itemR(rl, "pass_refraction_exclude", text="", icon='ICON_X')
|
||||
|
||||
if rl.freestyle:
|
||||
layout.itemS()
|
||||
|
||||
split = layout.split()
|
||||
|
||||
col = split.column()
|
||||
col.itemL(text="Freestyle:")
|
||||
freestyle = rl.freestyle_settings
|
||||
col.itemR(freestyle, "sphere_radius", text="Sphere Radius")
|
||||
col.itemR(freestyle, "ridges_and_valleys", text="Ridges and Valleys")
|
||||
col.itemR(freestyle, "suggestive_contours", text="Suggestive Contours")
|
||||
col.itemR(freestyle, "dkr_epsilon", text="Dkr Epsilon")
|
||||
|
||||
col.itemO("scene.freestyle_module_add", text="Add Style Module")
|
||||
|
||||
for i, module in enumerate(freestyle.modules):
|
||||
box = layout.box()
|
||||
box.set_context_pointer("freestyle_module", module)
|
||||
row = box.row(align=True)
|
||||
row.itemR(module, "is_displayed", text="")
|
||||
row.itemR(module, "module_path", text="")
|
||||
row.itemO("scene.freestyle_module_remove", icon='ICON_X', text="")
|
||||
props = row.itemO("scene.freestyle_module_move_up", icon='VICON_MOVE_UP', text="", properties=True)
|
||||
props.active = (i > 0)
|
||||
props = row.itemO("scene.freestyle_module_move_down", icon='VICON_MOVE_DOWN', text="", properties=True)
|
||||
props.active = (i < len(freestyle.modules) - 1)
|
||||
|
||||
class SCENE_PT_shading(RenderButtonsPanel):
|
||||
__label__ = "Shading"
|
||||
COMPAT_ENGINES = set(['BLENDER_RENDER'])
|
||||
@@ -224,6 +252,13 @@ class SCENE_PT_post_processing(RenderButtonsPanel):
|
||||
sub.itemR(rd, "edge_threshold", text="Threshold", slider=True)
|
||||
sub.itemR(rd, "edge_color", text="")
|
||||
|
||||
layout.itemS()
|
||||
|
||||
split = layout.split()
|
||||
col = split.column()
|
||||
col.itemR(rd, "freestyle", text="Freestyle")
|
||||
|
||||
|
||||
class SCENE_PT_output(RenderButtonsPanel):
|
||||
__label__ = "Output"
|
||||
COMPAT_ENGINES = set(['BLENDER_RENDER'])
|
||||
|
||||
@@ -39,6 +39,7 @@ SET(INC ../windowmanager
|
||||
../../../intern/audaspace/intern
|
||||
../nodes
|
||||
../gpu
|
||||
../freestyle
|
||||
../blenfont
|
||||
../ikplugin
|
||||
)
|
||||
|
||||
@@ -5,7 +5,7 @@ sources = env.Glob('*.c')
|
||||
|
||||
incs = '../include ../../blenlib ../../blenkernel ../../makesdna ../../imbuf'
|
||||
incs += ' ../../windowmanager #/intern/guardedalloc #/extern/glew/include'
|
||||
incs += ' #/intern/guardedalloc ../../gpu'
|
||||
incs += ' #/intern/guardedalloc ../../gpu ../../freestyle'
|
||||
incs += ' ../../makesrna ../../render/extern/include #/intern/elbeem/extern'
|
||||
incs += ' ../../blenloader'
|
||||
|
||||
|
||||
@@ -44,6 +44,10 @@ void WORLD_OT_new(struct wmOperatorType *ot);
|
||||
|
||||
void SCENE_OT_render_layer_add(struct wmOperatorType *ot);
|
||||
void SCENE_OT_render_layer_remove(struct wmOperatorType *ot);
|
||||
void SCENE_OT_freestyle_module_add(struct wmOperatorType *ot);
|
||||
void SCENE_OT_freestyle_module_remove(struct wmOperatorType *ot);
|
||||
void SCENE_OT_freestyle_module_move_up(struct wmOperatorType *ot);
|
||||
void SCENE_OT_freestyle_module_move_down(struct wmOperatorType *ot);
|
||||
|
||||
#endif /* RENDER_INTERN_H */
|
||||
|
||||
|
||||
@@ -50,5 +50,9 @@ void ED_operatortypes_render(void)
|
||||
|
||||
WM_operatortype_append(SCENE_OT_render_layer_add);
|
||||
WM_operatortype_append(SCENE_OT_render_layer_remove);
|
||||
WM_operatortype_append(SCENE_OT_freestyle_module_add);
|
||||
WM_operatortype_append(SCENE_OT_freestyle_module_remove);
|
||||
WM_operatortype_append(SCENE_OT_freestyle_module_move_up);
|
||||
WM_operatortype_append(SCENE_OT_freestyle_module_move_down);
|
||||
}
|
||||
|
||||
|
||||
@@ -58,6 +58,8 @@
|
||||
|
||||
#include "GPU_material.h"
|
||||
|
||||
#include "FRS_freestyle.h"
|
||||
|
||||
#include "RNA_access.h"
|
||||
#include "RNA_enum_types.h"
|
||||
|
||||
@@ -643,3 +645,122 @@ void SCENE_OT_render_layer_remove(wmOperatorType *ot)
|
||||
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
|
||||
}
|
||||
|
||||
static int freestyle_module_add_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
Scene *scene= CTX_data_scene(C);
|
||||
|
||||
printf("freestyle_module_add_exec\n");
|
||||
FRS_add_module();
|
||||
|
||||
WM_event_add_notifier(C, NC_SCENE|ND_RENDER_OPTIONS, scene);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
void SCENE_OT_freestyle_module_add(wmOperatorType *ot)
|
||||
{
|
||||
/* identifiers */
|
||||
ot->name= "Add Freestyle Module";
|
||||
ot->idname= "SCENE_OT_freestyle_module_add";
|
||||
ot->description="Add a style module into the list of modules.";
|
||||
|
||||
/* api callbacks */
|
||||
ot->exec= freestyle_module_add_exec;
|
||||
|
||||
/* flags */
|
||||
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
|
||||
}
|
||||
|
||||
static int freestyle_module_remove_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
Scene *scene= CTX_data_scene(C);
|
||||
PointerRNA ptr= CTX_data_pointer_get_type(C, "freestyle_module", &RNA_FreestyleModuleSettings);
|
||||
FreestyleModuleConfig *module= ptr.data;
|
||||
|
||||
printf("freestyle_module_remove_exec\n");
|
||||
FRS_delete_module(module, NULL);
|
||||
|
||||
WM_event_add_notifier(C, NC_SCENE|ND_RENDER_OPTIONS, scene);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
void SCENE_OT_freestyle_module_remove(wmOperatorType *ot)
|
||||
{
|
||||
/* identifiers */
|
||||
ot->name= "Remove Freestyle Module";
|
||||
ot->idname= "SCENE_OT_freestyle_module_remove";
|
||||
ot->description="Remove the style module from the stack.";
|
||||
|
||||
/* api callbacks */
|
||||
ot->exec= freestyle_module_remove_exec;
|
||||
|
||||
/* flags */
|
||||
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
|
||||
}
|
||||
|
||||
static int freestyle_module_move_up_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
Scene *scene= CTX_data_scene(C);
|
||||
PointerRNA ptr= CTX_data_pointer_get_type(C, "freestyle_module", &RNA_FreestyleModuleSettings);
|
||||
FreestyleModuleConfig *module= ptr.data;
|
||||
int active = RNA_boolean_get(op->ptr, "active");
|
||||
|
||||
printf("freestyle_module_move_up_exec\n");
|
||||
if(active)
|
||||
FRS_move_up_module(module, NULL);
|
||||
|
||||
WM_event_add_notifier(C, NC_SCENE|ND_RENDER_OPTIONS, scene);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
void SCENE_OT_freestyle_module_move_up(wmOperatorType *ot)
|
||||
{
|
||||
/* identifiers */
|
||||
ot->name= "Move Up Freestyle Module";
|
||||
ot->idname= "SCENE_OT_freestyle_module_move_up";
|
||||
ot->description="Move the style module up in the stack.";
|
||||
|
||||
/* api callbacks */
|
||||
ot->exec= freestyle_module_move_up_exec;
|
||||
|
||||
/* flags */
|
||||
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
|
||||
|
||||
/* props */
|
||||
RNA_def_boolean(ot->srna, "active", 0, "Active", "True if the operator is enabled.");
|
||||
}
|
||||
|
||||
static int freestyle_module_move_down_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
Scene *scene= CTX_data_scene(C);
|
||||
PointerRNA ptr= CTX_data_pointer_get_type(C, "freestyle_module", &RNA_FreestyleModuleSettings);
|
||||
FreestyleModuleConfig *module= ptr.data;
|
||||
int active = RNA_boolean_get(op->ptr, "active");
|
||||
|
||||
printf("freestyle_module_move_down_exec\n");
|
||||
if(active)
|
||||
FRS_move_down_module(module, NULL);
|
||||
|
||||
WM_event_add_notifier(C, NC_SCENE|ND_RENDER_OPTIONS, scene);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
void SCENE_OT_freestyle_module_move_down(wmOperatorType *ot)
|
||||
{
|
||||
/* identifiers */
|
||||
ot->name= "Move Down Freestyle Module";
|
||||
ot->idname= "SCENE_OT_freestyle_module_move_down";
|
||||
ot->description="Move the style module down in the stack.";
|
||||
|
||||
/* api callbacks */
|
||||
ot->exec= freestyle_module_move_down_exec;
|
||||
|
||||
/* flags */
|
||||
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
|
||||
|
||||
/* props */
|
||||
RNA_def_boolean(ot->srna, "active", 0, "Active", "True if the operator is enabled.");
|
||||
}
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
#ifndef FRS_FREESTYLE_H
|
||||
#define FRS_FREESTYLE_H
|
||||
|
||||
#define FREESTYLE_SUGGESTIVE_CONTOURS_FLAG 1
|
||||
#define FREESTYLE_RIDGES_AND_VALLEYS_FLAG 2
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
@@ -295,22 +295,22 @@ extern "C" {
|
||||
|
||||
void FRS_delete_module(void *module_index_ptr, void *unused)
|
||||
{
|
||||
FreestyleModuleConfig* module_conf = (FreestyleModuleConfig*) BLI_findlink(freestyle_modules, (intptr_t)module_index_ptr);
|
||||
FreestyleModuleConfig* module_conf = (FreestyleModuleConfig*) module_index_ptr;
|
||||
|
||||
BLI_freelinkN( freestyle_modules, module_conf);
|
||||
}
|
||||
|
||||
void FRS_move_up_module(void *module_index_ptr, void *unused)
|
||||
{
|
||||
FreestyleModuleConfig* module_conf = (FreestyleModuleConfig*) BLI_findlink(freestyle_modules, (intptr_t)module_index_ptr);
|
||||
|
||||
FreestyleModuleConfig* module_conf = (FreestyleModuleConfig*) module_index_ptr;
|
||||
|
||||
BLI_remlink(freestyle_modules, module_conf);
|
||||
BLI_insertlink(freestyle_modules, module_conf->prev->prev, module_conf);
|
||||
}
|
||||
|
||||
void FRS_move_down_module(void *module_index_ptr, void *unused)
|
||||
{
|
||||
FreestyleModuleConfig* module_conf = (FreestyleModuleConfig*) BLI_findlink(freestyle_modules, (intptr_t)module_index_ptr);
|
||||
FreestyleModuleConfig* module_conf = (FreestyleModuleConfig*) module_index_ptr;
|
||||
|
||||
BLI_remlink(freestyle_modules, module_conf);
|
||||
BLI_insertlink(freestyle_modules, module_conf->next, module_conf);
|
||||
|
||||
@@ -3,6 +3,9 @@
|
||||
|
||||
#include "DNA_listBase.h"
|
||||
|
||||
#define FREESTYLE_SUGGESTIVE_CONTOURS_FLAG 1
|
||||
#define FREESTYLE_RIDGES_AND_VALLEYS_FLAG 2
|
||||
|
||||
typedef struct FreestyleModuleConfig {
|
||||
struct FreestyleModuleConfig *next, *prev;
|
||||
|
||||
|
||||
@@ -203,6 +203,7 @@ extern StructRNA RNA_FluidFluidSettings;
|
||||
extern StructRNA RNA_FluidSettings;
|
||||
extern StructRNA RNA_FluidSimulationModifier;
|
||||
extern StructRNA RNA_FollowPathConstraint;
|
||||
extern StructRNA RNA_FreestyleModuleSettings;
|
||||
extern StructRNA RNA_Function;
|
||||
extern StructRNA RNA_GameBooleanProperty;
|
||||
extern StructRNA RNA_GameFloatProperty;
|
||||
|
||||
@@ -711,6 +711,12 @@ void rna_def_render_layer_common(StructRNA *srna, int scene)
|
||||
if(scene) RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
|
||||
else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
||||
|
||||
prop= RNA_def_property(srna, "freestyle", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "layflag", SCE_LAY_FRS);
|
||||
RNA_def_property_ui_text(prop, "Freestyle", "Render stylized strokes in this Layer.");
|
||||
if(scene) RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
|
||||
else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
||||
|
||||
/* passes */
|
||||
prop= RNA_def_property(srna, "pass_combined", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_COMBINED);
|
||||
@@ -827,6 +833,62 @@ void rna_def_render_layer_common(StructRNA *srna, int scene)
|
||||
else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
||||
}
|
||||
|
||||
static void rna_def_freestyle_settings(BlenderRNA *brna)
|
||||
{
|
||||
StructRNA *srna;
|
||||
PropertyRNA *prop;
|
||||
|
||||
/* FreestyleModuleSettings */
|
||||
|
||||
srna= RNA_def_struct(brna, "FreestyleModuleSettings", NULL);
|
||||
RNA_def_struct_sdna(srna, "FreestyleModuleConfig");
|
||||
RNA_def_struct_ui_text(srna, "Freestyle Module", "Style module configuration for specifying a style module.");
|
||||
|
||||
prop= RNA_def_property(srna, "module_path", PROP_STRING, PROP_FILEPATH);
|
||||
RNA_def_property_string_sdna(prop, NULL, "module_path");
|
||||
RNA_def_property_ui_text(prop, "Module Path", "Path to a style module file.");
|
||||
RNA_def_property_update(prop, NC_SCENE, NULL);
|
||||
|
||||
prop= RNA_def_property(srna, "is_displayed", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "is_displayed", 1);
|
||||
RNA_def_property_ui_text(prop, "Is Displayed", "Enable this style module during the rendering.");
|
||||
RNA_def_property_update(prop, NC_SCENE, NULL);
|
||||
|
||||
/* FreestyleSettings */
|
||||
|
||||
srna= RNA_def_struct(brna, "FreestyleSettings", NULL);
|
||||
RNA_def_struct_sdna(srna, "FreestyleConfig");
|
||||
RNA_def_struct_nested(brna, srna, "SceneRenderLayer");
|
||||
RNA_def_struct_ui_text(srna, "Frestyle Settings", "Freestyle settings for a SceneRenderLayer datablock.");
|
||||
|
||||
prop= RNA_def_property(srna, "modules", PROP_COLLECTION, PROP_NONE);
|
||||
RNA_def_property_collection_sdna(prop, NULL, "modules", NULL);
|
||||
RNA_def_property_struct_type(prop, "FreestyleModuleSettings");
|
||||
RNA_def_property_ui_text(prop, "Style modules", "A list of style modules (to be applied from top to bottom).");
|
||||
|
||||
prop= RNA_def_property(srna, "suggestive_contours", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "flags", FREESTYLE_SUGGESTIVE_CONTOURS_FLAG);
|
||||
RNA_def_property_ui_text(prop, "Suggestive Contours", "Enable suggestive contours.");
|
||||
RNA_def_property_update(prop, NC_SCENE, NULL);
|
||||
|
||||
prop= RNA_def_property(srna, "ridges_and_valleys", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "flags", FREESTYLE_RIDGES_AND_VALLEYS_FLAG);
|
||||
RNA_def_property_ui_text(prop, "Ridges and Valleys", "Enable ridges and valleys.");
|
||||
RNA_def_property_update(prop, NC_SCENE, NULL);
|
||||
|
||||
prop= RNA_def_property(srna, "sphere_radius", PROP_FLOAT, PROP_NONE);
|
||||
RNA_def_property_float_sdna(prop, NULL, "sphere_radius");
|
||||
RNA_def_property_range(prop, 0.0, 1000.0);
|
||||
RNA_def_property_ui_text(prop, "Sphere Radius", "*TBD*");
|
||||
RNA_def_property_update(prop, NC_SCENE, NULL);
|
||||
|
||||
prop= RNA_def_property(srna, "dkr_epsilon", PROP_FLOAT, PROP_NONE);
|
||||
RNA_def_property_float_sdna(prop, NULL, "dkr_epsilon");
|
||||
RNA_def_property_range(prop, 0.0, 1000.0);
|
||||
RNA_def_property_ui_text(prop, "Dkr Epsilon", "*TBD*");
|
||||
RNA_def_property_update(prop, NC_SCENE, NULL);
|
||||
}
|
||||
|
||||
static void rna_def_scene_game_data(BlenderRNA *brna)
|
||||
{
|
||||
StructRNA *srna;
|
||||
@@ -1115,11 +1177,22 @@ static void rna_def_scene_game_data(BlenderRNA *brna)
|
||||
static void rna_def_scene_render_layer(BlenderRNA *brna)
|
||||
{
|
||||
StructRNA *srna;
|
||||
PropertyRNA *prop;
|
||||
|
||||
srna= RNA_def_struct(brna, "SceneRenderLayer", NULL);
|
||||
RNA_def_struct_ui_text(srna, "Scene Render Layer", "Render layer.");
|
||||
|
||||
rna_def_render_layer_common(srna, 1);
|
||||
|
||||
/* Freestyle */
|
||||
|
||||
rna_def_freestyle_settings(brna);
|
||||
|
||||
prop= RNA_def_property(srna, "freestyle_settings", PROP_POINTER, PROP_NONE);
|
||||
RNA_def_property_flag(prop, PROP_NEVER_NULL);
|
||||
RNA_def_property_pointer_sdna(prop, NULL, "freestyleConfig");
|
||||
RNA_def_property_struct_type(prop, "FreestyleSettings");
|
||||
RNA_def_property_ui_text(prop, "Freestyle Settings", "");
|
||||
}
|
||||
|
||||
static void rna_def_scene_render_data(BlenderRNA *brna)
|
||||
@@ -1714,6 +1787,11 @@ static void rna_def_scene_render_data(BlenderRNA *brna)
|
||||
RNA_def_property_ui_text(prop, "Edge Color", "");
|
||||
RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
|
||||
|
||||
prop= RNA_def_property(srna, "freestyle", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "mode", R_EDGE_FRS);
|
||||
RNA_def_property_ui_text(prop, "Edge", "Draw stylized strokes using Freestyle.");
|
||||
RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
|
||||
|
||||
prop= RNA_def_property(srna, "threads", PROP_INT, PROP_NONE);
|
||||
RNA_def_property_int_sdna(prop, NULL, "threads");
|
||||
RNA_def_property_range(prop, 1, 8);
|
||||
@@ -2244,6 +2322,12 @@ void RNA_def_scene(BlenderRNA *brna)
|
||||
RNA_def_property_flag(prop, PROP_EDITABLE);
|
||||
RNA_def_property_struct_type(prop, "GreasePencil");
|
||||
RNA_def_property_ui_text(prop, "Grease Pencil Data", "Grease Pencil datablock");
|
||||
|
||||
/* Freestyle */
|
||||
prop= RNA_def_property(srna, "freestyle_current_layer_number", PROP_INT, PROP_NONE);
|
||||
RNA_def_property_int_sdna(prop, NULL, "freestyle_current_layer_number");
|
||||
RNA_def_property_ui_text(prop, "Freestyle Current Layer Number", "Number of current layers in Freestyle.");
|
||||
RNA_def_property_update(prop, NC_SCENE, NULL);
|
||||
|
||||
/* Nestled Data */
|
||||
rna_def_tool_settings(brna);
|
||||
|
||||
Reference in New Issue
Block a user