Clay Engine: New collection settings (not working yet)

This commit is contained in:
Clément Foucault 2017-02-15 18:54:31 +01:00
parent 69b96e27ee
commit 883ef2c9ce
5 changed files with 30 additions and 22 deletions

View File

@ -139,7 +139,8 @@ class COLLECTION_PT_object_mode_settings(CollectionButtonsPanel, Panel):
settings = collection.get_mode_settings('OBJECT')
col = layout.column()
template_engine_settings(col, settings, "foo")
template_engine_settings(col, settings, "show_wire")
template_engine_settings(col, settings, "show_backface_culling")
class COLLECTION_PT_edit_mode_settings(CollectionButtonsPanel, Panel):
@ -157,7 +158,7 @@ class COLLECTION_PT_edit_mode_settings(CollectionButtonsPanel, Panel):
settings = collection.get_mode_settings('EDIT')
col = layout.column()
template_engine_settings(col, settings, "bar")
template_engine_settings(col, settings, "show_occlude_wire")
if __name__ == "__main__": # only for live edit.

View File

@ -808,7 +808,8 @@ static void layer_collection_create_mode_settings_object(ListBase *lb)
ces->type = COLLECTION_MODE_OBJECT;
/* properties */
BKE_collection_engine_property_add_int(ces, "foo", 2);
BKE_collection_engine_property_add_int(ces, "show_wire", false);
BKE_collection_engine_property_add_int(ces, "show_backface_culling", false);
}
static void layer_collection_create_mode_settings_edit(ListBase *lb)
@ -820,7 +821,7 @@ static void layer_collection_create_mode_settings_edit(ListBase *lb)
ces->type = COLLECTION_MODE_EDIT;
/* properties */
BKE_collection_engine_property_add_float(ces, "bar", 0.5);
BKE_collection_engine_property_add_int(ces, "show_occlude_wire", false);
}
static void collection_create_mode_settings(ListBase *lb)

View File

@ -558,7 +558,7 @@ static void override_setting(CollectionEngineSettings *ces, const char *name, vo
CollectionEnginePropertyInt *prop = (CollectionEnginePropertyInt *)cep;
*((int *)ret) = prop->value;
}
else {
else if (cep->type == COLLECTION_PROP_TYPE_FLOAT) {
CollectionEnginePropertyFloat *prop = (CollectionEnginePropertyFloat *)cep;
*((float *)ret) = prop->value;
}
@ -636,6 +636,9 @@ static void CLAY_create_cache(CLAY_PassList *passes, CLAY_StorageList *stl, cons
continue;
}
// CollectionEngineSettings *ces_mode_ob = BKE_object_collection_engine_get(ob, COLLECTION_MODE_OBJECT, "");
// CollectionEngineSettings *ces_mode_ed = BKE_object_collection_engine_get(ob, COLLECTION_MODE_EDIT, "");
struct Batch *geom;
bool do_outlines;

View File

@ -194,15 +194,12 @@ void DRW_pass_setup_common(DRWPass **wire_overlay, DRWPass **wire_outline, DRWPa
if (non_meshes) {
/* Non Meshes Pass (Camera, empties, lamps ...) */
DRWShadingGroup *grp;
struct Batch *geom;
DRWState state = DRW_STATE_WRITE_COLOR | DRW_STATE_WRITE_DEPTH | DRW_STATE_DEPTH_LESS | DRW_STATE_BLEND;
state |= DRW_STATE_WIRE;
*non_meshes = DRW_pass_create("Non Meshes Pass", state);
GPUShader *sh = GPU_shader_get_builtin_shader(GPU_SHADER_3D_UNIFORM_COLOR);
/* Empties */
geom = DRW_cache_plain_axes_get();
plain_axes = shgroup_instance(*non_meshes, geom);

View File

@ -2427,7 +2427,7 @@ static void rna_LayerEngineSettings_##_ENGINE_##_##_NAME_##_set(PointerRNA *ptr,
RNA_LAYER_ENGINE_GET_SET(int, Clay, COLLECTION_MODE_NONE, _NAME_)
#define RNA_LAYER_ENGINE_CLAY_GET_SET_BOOL(_NAME_) \
RNA_LAYER_ENGINE_GET_SET(int, Clay, COLLECTION_MODE_NONE, _NAME_)
RNA_LAYER_ENGINE_GET_SET(bool, Clay, COLLECTION_MODE_NONE, _NAME_)
/* mode engines */
@ -2450,7 +2450,6 @@ static void rna_LayerEngineSettings_##_ENGINE_##_##_NAME_##_set(PointerRNA *ptr,
RNA_LAYER_ENGINE_GET_SET(bool, EditMode, COLLECTION_MODE_EDIT, _NAME_)
/* clay engine */
RNA_LAYER_ENGINE_CLAY_GET_SET_INT(type)
RNA_LAYER_ENGINE_CLAY_GET_SET_INT(matcap_icon)
RNA_LAYER_ENGINE_CLAY_GET_SET_FLOAT(matcap_rotation)
@ -2461,12 +2460,13 @@ RNA_LAYER_ENGINE_CLAY_GET_SET_FLOAT(ssao_factor_cavity)
RNA_LAYER_ENGINE_CLAY_GET_SET_FLOAT(ssao_factor_edge)
RNA_LAYER_ENGINE_CLAY_GET_SET_FLOAT(ssao_distance)
RNA_LAYER_ENGINE_CLAY_GET_SET_FLOAT(ssao_attenuation)
/* object engine */
RNA_LAYER_MODE_OBJECT_GET_SET_INT(foo)
/* object engine */
RNA_LAYER_MODE_OBJECT_GET_SET_BOOL(show_wire)
RNA_LAYER_MODE_OBJECT_GET_SET_BOOL(show_backface_culling)
/* mesh engine */
RNA_LAYER_MODE_EDIT_GET_SET_FLOAT(bar)
RNA_LAYER_MODE_EDIT_GET_SET_BOOL(show_occlude_wire)
#undef RNA_LAYER_ENGINE_GET_SET
#undef RNA_LAYER_ENGINE_USE_GET_SET
@ -5995,13 +5995,19 @@ static void rna_def_layer_collection_mode_settings_object(BlenderRNA *brna)
/* see RNA_LAYER_ENGINE_GET_SET macro */
prop = RNA_def_property(srna, "foo", PROP_INT, PROP_NONE);
RNA_def_property_ui_text(prop, "Foo", "");
RNA_def_property_int_funcs(prop, "rna_LayerEngineSettings_ObjectMode_foo_get", "rna_LayerEngineSettings_ObjectMode_foo_set", NULL);
RNA_def_property_ui_text(prop, "Foo Object Setting", "Temporary settings");
prop = RNA_def_property(srna, "show_wire", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_ui_text(prop, "Wire", "Add the object's wireframe over solid drawing");
RNA_def_property_boolean_funcs(prop, "rna_LayerEngineSettings_ObjectMode_show_wire_get", "rna_LayerEngineSettings_ObjectMode_show_wire_set");
RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_CollectionEngineSettings_update");
RNA_LAYER_MODE_OBJECT_USE(foo)
RNA_LAYER_MODE_OBJECT_USE(show_wire)
prop = RNA_def_property(srna, "show_backface_culling", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_ui_text(prop, "Backface Culling", "");
RNA_def_property_boolean_funcs(prop, "rna_LayerEngineSettings_ObjectMode_show_backface_culling_get", "rna_LayerEngineSettings_ObjectMode_show_backface_culling_set");
RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_CollectionEngineSettings_update");
RNA_LAYER_MODE_OBJECT_USE(show_backface_culling)
}
static void rna_def_layer_collection_mode_settings_edit(BlenderRNA *brna)
@ -6015,12 +6021,12 @@ static void rna_def_layer_collection_mode_settings_edit(BlenderRNA *brna)
/* see RNA_LAYER_ENGINE_GET_SET macro */
prop = RNA_def_property(srna, "bar", PROP_FLOAT, PROP_NONE);
RNA_def_property_ui_text(prop, "Bar Object Setting", "Temporary settings");
RNA_def_property_float_funcs(prop, "rna_LayerEngineSettings_EditMode_bar_get", "rna_LayerEngineSettings_EditMode_bar_set", NULL);
prop = RNA_def_property(srna, "show_occlude_wire", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_ui_text(prop, "Hidden Wire", "");
RNA_def_property_boolean_funcs(prop, "rna_LayerEngineSettings_EditMode_show_occlude_wire_get", "rna_LayerEngineSettings_EditMode_show_occlude_wire_set");
RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_CollectionEngineSettings_update");
RNA_LAYER_MODE_EDIT_USE(bar)
RNA_LAYER_MODE_EDIT_USE(show_occlude_wire)
}
static void rna_def_layer_collection_mode_settings(BlenderRNA *brna)