forked from bartvdbraak/blender
modified fix for commits r33811, 33812.
- SSS Presets were not working on pinned materials. - added ability for save-presets to define variables to stop them becoming too verbose. - remove object.active_node_material
This commit is contained in:
parent
4530b4984c
commit
a9ba96896a
@ -69,6 +69,12 @@ class AddPresetBase():
|
||||
file_preset = open(filepath, 'w')
|
||||
file_preset.write("import bpy\n")
|
||||
|
||||
if hasattr(self, "preset_defines"):
|
||||
for rna_path in self.preset_defines:
|
||||
exec(rna_path)
|
||||
file_preset.write("%s\n" % rna_path)
|
||||
file_preset.write("\n")
|
||||
|
||||
for rna_path in self.preset_values:
|
||||
value = eval(rna_path)
|
||||
# convert thin wrapped sequences to simple lists to repr()
|
||||
@ -150,17 +156,21 @@ class AddPresetRender(AddPresetBase, bpy.types.Operator):
|
||||
bl_label = "Add Render Preset"
|
||||
preset_menu = "RENDER_MT_presets"
|
||||
|
||||
preset_defines = [
|
||||
"scene = bpy.context.scene"
|
||||
]
|
||||
|
||||
preset_values = [
|
||||
"bpy.context.scene.render.field_order",
|
||||
"bpy.context.scene.render.fps",
|
||||
"bpy.context.scene.render.fps_base",
|
||||
"bpy.context.scene.render.pixel_aspect_x",
|
||||
"bpy.context.scene.render.pixel_aspect_y",
|
||||
"bpy.context.scene.render.resolution_percentage",
|
||||
"bpy.context.scene.render.resolution_x",
|
||||
"bpy.context.scene.render.resolution_y",
|
||||
"bpy.context.scene.render.use_fields",
|
||||
"bpy.context.scene.render.use_fields_still",
|
||||
"scene.render.field_order",
|
||||
"scene.render.fps",
|
||||
"scene.render.fps_base",
|
||||
"scene.render.pixel_aspect_x",
|
||||
"scene.render.pixel_aspect_y",
|
||||
"scene.render.resolution_percentage",
|
||||
"scene.render.resolution_x",
|
||||
"scene.render.resolution_y",
|
||||
"scene.render.use_fields",
|
||||
"scene.render.use_fields_still",
|
||||
]
|
||||
|
||||
preset_subdir = "render"
|
||||
@ -172,20 +182,20 @@ class AddPresetSSS(AddPresetBase, bpy.types.Operator):
|
||||
bl_label = "Add SSS Preset"
|
||||
preset_menu = "MATERIAL_MT_sss_presets"
|
||||
|
||||
preset_defines = [
|
||||
"material = (bpy.context.material.active_node_material if bpy.context.material.active_node_material else bpy.context.material)"
|
||||
]
|
||||
|
||||
preset_values = [
|
||||
"bpy.context.material.subsurface_scattering.back",
|
||||
"bpy.context.material.subsurface_scattering.color[0]",
|
||||
"bpy.context.material.subsurface_scattering.color[1]",
|
||||
"bpy.context.material.subsurface_scattering.color[2]",
|
||||
"bpy.context.material.subsurface_scattering.color_factor",
|
||||
"bpy.context.material.subsurface_scattering.error_threshold",
|
||||
"bpy.context.material.subsurface_scattering.front",
|
||||
"bpy.context.material.subsurface_scattering.ior",
|
||||
"bpy.context.material.subsurface_scattering.radius[0]",
|
||||
"bpy.context.material.subsurface_scattering.radius[1]",
|
||||
"bpy.context.material.subsurface_scattering.radius[2]",
|
||||
"bpy.context.material.subsurface_scattering.scale",
|
||||
"bpy.context.material.subsurface_scattering.texture_factor",
|
||||
"material.subsurface_scattering.back",
|
||||
"material.subsurface_scattering.color",
|
||||
"material.subsurface_scattering.color_factor",
|
||||
"material.subsurface_scattering.error_threshold",
|
||||
"material.subsurface_scattering.front",
|
||||
"material.subsurface_scattering.ior",
|
||||
"material.subsurface_scattering.radius",
|
||||
"material.subsurface_scattering.scale",
|
||||
"material.subsurface_scattering.texture_factor",
|
||||
]
|
||||
|
||||
preset_subdir = "sss"
|
||||
@ -197,13 +207,17 @@ class AddPresetCloth(AddPresetBase, bpy.types.Operator):
|
||||
bl_label = "Add Cloth Preset"
|
||||
preset_menu = "CLOTH_MT_presets"
|
||||
|
||||
preset_defines = [
|
||||
"cloth = bpy.context.cloth"
|
||||
]
|
||||
|
||||
preset_values = [
|
||||
"bpy.context.cloth.settings.air_damping",
|
||||
"bpy.context.cloth.settings.bending_stiffness",
|
||||
"bpy.context.cloth.settings.mass",
|
||||
"bpy.context.cloth.settings.quality",
|
||||
"bpy.context.cloth.settings.spring_damping",
|
||||
"bpy.context.cloth.settings.structural_stiffness",
|
||||
"cloth.settings.air_damping",
|
||||
"cloth.settings.bending_stiffness",
|
||||
"cloth.settings.mass",
|
||||
"cloth.settings.quality",
|
||||
"cloth.settings.spring_damping",
|
||||
"cloth.settings.structural_stiffness",
|
||||
]
|
||||
|
||||
preset_subdir = "cloth"
|
||||
@ -215,20 +229,24 @@ class AddPresetSunSky(AddPresetBase, bpy.types.Operator):
|
||||
bl_label = "Add Sunsky Preset"
|
||||
preset_menu = "LAMP_MT_sunsky_presets"
|
||||
|
||||
preset_defines = [
|
||||
"sky = bpy.context.object.data.sky"
|
||||
]
|
||||
|
||||
preset_values = [
|
||||
"bpy.context.object.data.sky.atmosphere_extinction",
|
||||
"bpy.context.object.data.sky.atmosphere_inscattering",
|
||||
"bpy.context.object.data.sky.atmosphere_turbidity",
|
||||
"bpy.context.object.data.sky.backscattered_light",
|
||||
"bpy.context.object.data.sky.horizon_brightness",
|
||||
"bpy.context.object.data.sky.spread",
|
||||
"bpy.context.object.data.sky.sun_brightness",
|
||||
"bpy.context.object.data.sky.sun_intensity",
|
||||
"bpy.context.object.data.sky.sun_size",
|
||||
"bpy.context.object.data.sky.use_sky_blend",
|
||||
"bpy.context.object.data.sky.use_sky_blend_type",
|
||||
"bpy.context.object.data.sky.use_sky_color_space",
|
||||
"bpy.context.object.data.sky.use_sky_exposure",
|
||||
"sky.atmosphere_extinction",
|
||||
"sky.atmosphere_inscattering",
|
||||
"sky.atmosphere_turbidity",
|
||||
"sky.backscattered_light",
|
||||
"sky.horizon_brightness",
|
||||
"sky.spread",
|
||||
"sky.sun_brightness",
|
||||
"sky.sun_intensity",
|
||||
"sky.sun_size",
|
||||
"sky.use_sky_blend",
|
||||
"sky.use_sky_blend_type",
|
||||
"sky.use_sky_color_space",
|
||||
"sky.use_sky_exposure",
|
||||
]
|
||||
|
||||
preset_subdir = "sunsky"
|
||||
@ -240,17 +258,21 @@ class AddPresetInteraction(AddPresetBase, bpy.types.Operator):
|
||||
bl_label = "Add Interaction Preset"
|
||||
preset_menu = "USERPREF_MT_interaction_presets"
|
||||
|
||||
preset_defines = [
|
||||
"user_preferences = bpy.context.user_preferences"
|
||||
]
|
||||
|
||||
preset_values = [
|
||||
"bpy.context.user_preferences.edit.use_drag_immediately",
|
||||
"bpy.context.user_preferences.edit.use_insertkey_xyz_to_rgb",
|
||||
"bpy.context.user_preferences.inputs.invert_mouse_wheel_zoom",
|
||||
"bpy.context.user_preferences.inputs.select_mouse",
|
||||
"bpy.context.user_preferences.inputs.use_emulate_numpad",
|
||||
"bpy.context.user_preferences.inputs.use_mouse_continuous",
|
||||
"bpy.context.user_preferences.inputs.use_mouse_emulate_3_button",
|
||||
"bpy.context.user_preferences.inputs.view_rotate_method",
|
||||
"bpy.context.user_preferences.inputs.view_zoom_axis",
|
||||
"bpy.context.user_preferences.inputs.view_zoom_method",
|
||||
"user_preferences.edit.use_drag_immediately",
|
||||
"user_preferences.edit.use_insertkey_xyz_to_rgb",
|
||||
"user_preferences.inputs.invert_mouse_wheel_zoom",
|
||||
"user_preferences.inputs.select_mouse",
|
||||
"user_preferences.inputs.use_emulate_numpad",
|
||||
"user_preferences.inputs.use_mouse_continuous",
|
||||
"user_preferences.inputs.use_mouse_emulate_3_button",
|
||||
"user_preferences.inputs.view_rotate_method",
|
||||
"user_preferences.inputs.view_zoom_axis",
|
||||
"user_preferences.inputs.view_zoom_method",
|
||||
]
|
||||
|
||||
preset_subdir = "interaction"
|
||||
|
@ -1,3 +1,5 @@
|
||||
import bpy
|
||||
bpy.context.active_object.active_node_material.subsurface_scattering.radius = 11.605, 3.884, 1.754
|
||||
bpy.context.active_object.active_node_material.subsurface_scattering.color = 0.430, 0.210, 0.168
|
||||
material = (bpy.context.material.active_node_material if bpy.context.material.active_node_material else bpy.context.material)
|
||||
|
||||
material.subsurface_scattering.radius = 11.605, 3.884, 1.754
|
||||
material.subsurface_scattering.color = 0.430, 0.210, 0.168
|
||||
|
@ -1,3 +1,5 @@
|
||||
import bpy
|
||||
bpy.context.active_object.active_node_material.subsurface_scattering.radius = 9.436, 3.348, 1.790
|
||||
bpy.context.active_object.active_node_material.subsurface_scattering.color = 0.439, 0.216, 0.141
|
||||
material = (bpy.context.material.active_node_material if bpy.context.material.active_node_material else bpy.context.material)
|
||||
|
||||
material.subsurface_scattering.radius = 9.436, 3.348, 1.790
|
||||
material.subsurface_scattering.color = 0.439, 0.216, 0.141
|
||||
|
@ -1,3 +1,5 @@
|
||||
import bpy
|
||||
bpy.context.active_object.active_node_material.subsurface_scattering.radius = 15.028, 4.664, 2.541
|
||||
bpy.context.active_object.active_node_material.subsurface_scattering.color = 0.987, 0.943, 0.827
|
||||
material = (bpy.context.material.active_node_material if bpy.context.material.active_node_material else bpy.context.material)
|
||||
|
||||
material.subsurface_scattering.radius = 15.028, 4.664, 2.541
|
||||
material.subsurface_scattering.color = 0.987, 0.943, 0.827
|
||||
|
@ -1,3 +1,5 @@
|
||||
import bpy
|
||||
bpy.context.active_object.active_node_material.subsurface_scattering.radius = 4.762, 0.575, 0.394
|
||||
bpy.context.active_object.active_node_material.subsurface_scattering.color = 0.222, 0.008, 0.002
|
||||
material = (bpy.context.material.active_node_material if bpy.context.material.active_node_material else bpy.context.material)
|
||||
|
||||
material.subsurface_scattering.radius = 4.762, 0.575, 0.394
|
||||
material.subsurface_scattering.color = 0.222, 0.008, 0.002
|
||||
|
@ -1,3 +1,5 @@
|
||||
import bpy
|
||||
bpy.context.active_object.active_node_material.subsurface_scattering.radius = 8.509, 5.566, 3.951
|
||||
bpy.context.active_object.active_node_material.subsurface_scattering.color = 0.925, 0.905, 0.884
|
||||
material = (bpy.context.material.active_node_material if bpy.context.material.active_node_material else bpy.context.material)
|
||||
|
||||
material.subsurface_scattering.radius = 8.509, 5.566, 3.951
|
||||
material.subsurface_scattering.color = 0.925, 0.905, 0.884
|
||||
|
@ -1,3 +1,5 @@
|
||||
import bpy
|
||||
bpy.context.active_object.active_node_material.subsurface_scattering.radius = 14.266, 7.228, 2.036
|
||||
bpy.context.active_object.active_node_material.subsurface_scattering.color = 0.855, 0.740, 0.292
|
||||
material = (bpy.context.material.active_node_material if bpy.context.material.active_node_material else bpy.context.material)
|
||||
|
||||
material.subsurface_scattering.radius = 14.266, 7.228, 2.036
|
||||
material.subsurface_scattering.color = 0.855, 0.740, 0.292
|
||||
|
@ -1,3 +1,5 @@
|
||||
import bpy
|
||||
bpy.context.active_object.active_node_material.subsurface_scattering.radius = 18.424, 10.443, 3.502
|
||||
bpy.context.active_object.active_node_material.subsurface_scattering.color = 0.889, 0.888, 0.796
|
||||
material = (bpy.context.material.active_node_material if bpy.context.material.active_node_material else bpy.context.material)
|
||||
|
||||
material.subsurface_scattering.radius = 18.424, 10.443, 3.502
|
||||
material.subsurface_scattering.color = 0.889, 0.888, 0.796
|
||||
|
@ -1,3 +1,5 @@
|
||||
import bpy
|
||||
bpy.context.active_object.active_node_material.subsurface_scattering.radius = 3.673, 1.367, 0.683
|
||||
bpy.context.active_object.active_node_material.subsurface_scattering.color = 0.574, 0.313, 0.174
|
||||
material = (bpy.context.material.active_node_material if bpy.context.material.active_node_material else bpy.context.material)
|
||||
|
||||
material.subsurface_scattering.radius = 3.673, 1.367, 0.683
|
||||
material.subsurface_scattering.color = 0.574, 0.313, 0.174
|
||||
|
@ -1,3 +1,5 @@
|
||||
import bpy
|
||||
bpy.context.active_object.active_node_material.subsurface_scattering.radius = 4.821, 1.694, 1.090
|
||||
bpy.context.active_object.active_node_material.subsurface_scattering.color = 0.749, 0.571, 0.467
|
||||
material = (bpy.context.material.active_node_material if bpy.context.material.active_node_material else bpy.context.material)
|
||||
|
||||
material.subsurface_scattering.radius = 4.821, 1.694, 1.090
|
||||
material.subsurface_scattering.color = 0.749, 0.571, 0.467
|
||||
|
@ -1,3 +1,5 @@
|
||||
import bpy
|
||||
bpy.context.active_object.active_node_material.subsurface_scattering.radius = 10.899, 6.575, 2.508
|
||||
bpy.context.active_object.active_node_material.subsurface_scattering.color = 0.947, 0.931, 0.852
|
||||
material = (bpy.context.material.active_node_material if bpy.context.material.active_node_material else bpy.context.material)
|
||||
|
||||
material.subsurface_scattering.radius = 10.899, 6.575, 2.508
|
||||
material.subsurface_scattering.color = 0.947, 0.931, 0.852
|
||||
|
@ -597,22 +597,6 @@ static PointerRNA rna_Object_active_material_get(PointerRNA *ptr)
|
||||
return rna_pointer_inherit_refine(ptr, &RNA_Material, ma);
|
||||
}
|
||||
|
||||
/* returns (optional) active node material in base material */
|
||||
static PointerRNA rna_Object_active_node_material_get(PointerRNA *ptr)
|
||||
{
|
||||
Object *ob= (Object*)ptr->id.data;
|
||||
Material *ma;
|
||||
|
||||
ma= (ob->totcol)? give_current_material(ob, ob->actcol): NULL;
|
||||
if(ma) {
|
||||
Material *manode= give_node_material(ma);
|
||||
if(manode)
|
||||
return rna_pointer_inherit_refine(ptr, &RNA_Material, manode);
|
||||
}
|
||||
|
||||
return rna_pointer_inherit_refine(ptr, &RNA_Material, ma);
|
||||
}
|
||||
|
||||
static void rna_Object_active_material_set(PointerRNA *ptr, PointerRNA value)
|
||||
{
|
||||
Object *ob= (Object*)ptr->id.data;
|
||||
@ -1794,13 +1778,6 @@ static void rna_def_object(BlenderRNA *brna)
|
||||
RNA_def_property_ui_text(prop, "Active Material", "Active material being displayed");
|
||||
RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_MaterialSlot_update");
|
||||
|
||||
prop= RNA_def_property(srna, "active_node_material", PROP_POINTER, PROP_NONE);
|
||||
RNA_def_property_struct_type(prop, "Material");
|
||||
RNA_def_property_pointer_funcs(prop, "rna_Object_active_node_material_get", NULL, NULL, NULL);
|
||||
RNA_def_property_ui_text(prop, "Active Material", "Active (node) material being displayed");
|
||||
RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL);
|
||||
|
||||
|
||||
prop= RNA_def_property(srna, "active_material_index", PROP_INT, PROP_UNSIGNED);
|
||||
RNA_def_property_int_sdna(prop, NULL, "actcol");
|
||||
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
|
||||
|
Loading…
Reference in New Issue
Block a user