Test: Adding back some UI list for World textures

This commit is contained in:
Maurice Raybaud 2019-05-05 22:00:14 +02:00
parent 792f4d5f69
commit 3412140b31
2 changed files with 111 additions and 11 deletions

View File

@ -20,14 +20,14 @@
bl_info = {
"name": "POV-3.7",
"author": "Campbell Barton, Silvio Falcinelli, Maurice Raybaud, "
"Constantin Rahn, Bastien Montagne, Leonid Desyatkov",
"author": "Campbell Barton, Maurice Raybaud, Leonid Desyatkov, "
"Bastien Montagne, Constantin Rahn, Silvio Falcinelli",
"version": (0, 1, 0),
"blender": (2, 80, 0),
"location": "Render > Engine > POV-Ray 3.7",
"description": "Basic POV-Ray 3.7 integration for blender",
"wiki_url": "http://wiki.blender.org/index.php/Extensions:2.6/Py/"
"Scripts/Render/POV-Ray",
"description": "POV-Ray 3.7 integration for blender",
"wiki_url": "https://archive.blender.org/wiki/index.php/"
"Extensions:2.6/Py/Scripts/Render/POV-Ray/",
"category": "Render",
}
@ -3592,6 +3592,79 @@ class RenderPovSettingsWorld(PropertyGroup):
precision=4, step=0.01, min=0, soft_max=1,
default=(0.0, 0.0, 0.0), options={'ANIMATABLE'}, subtype='COLOR',
)
world_texture_list_index: IntProperty(
name = "Index for texture_slots",
default = 0)
class WorldTextureSlot(PropertyGroup):
blend_factor: FloatProperty(
name="Blend",
description="Amount texture affects color progression of the "
"background",
soft_min=0.0, soft_max=1.0, default=1.0)
horizon_factor: FloatProperty(
name="Horizon",
description="Amount texture affects color of the horizon"
"",
soft_min=0.0, soft_max=1.0, default=1.0)
object: StringProperty(
name="Object",
description="Object to use for mapping with Object texture coordinates",
default="")
texture_coords: EnumProperty(
name="Coordinates",
description="Texture coordinates used to map the texture onto the background",
items=(("VIEW", "View", "Use view vector for the texture coordinates"),
("GLOBAL", "Global", "Use global coordinates for the texture coordinates (interior mist)"),
("ANGMAP", "AngMap", "Use 360 degree angular coordinates, e.g. for spherical light probes"),
("SPHERE", "Sphere", "For 360 degree panorama sky, spherical mapped, only top half"),
("EQUIRECT", "Equirectangular", "For 360 degree panorama sky, equirectangular mapping"),
("TUBE", "Tube", "For 360 degree panorama sky, cylindrical mapped, only top half"),
("OBJECT", "Object", "Use linked objects coordinates for texture coordinates")),
default="VIEW")
use_map_blend: BoolProperty(
name="Blend Map", description="Affect the color progression of the background",
default=True)
use_map_horizon: BoolProperty(
name="Horizon Map", description="Affect the color of the horizon",
default=False)
use_map_zenith_down: BoolProperty(
name="", description="Affect the color of the zenith below",
default=False)
use_map_zenith_up: BoolProperty(
name="Zenith Up Map", description="Affect the color of the zenith above",
default=False)
zenith_down_factor: FloatProperty(
name="Zenith Down",
description="Amount texture affects color of the zenith below",
soft_min=0.0, soft_max=1.0, default=1.0)
zenith_up_factor: FloatProperty(
name="Zenith Up",
description="Amount texture affects color of the zenith above",
soft_min=0.0, soft_max=1.0, default=1.0)
'''
#class WORLD_TEXTURE_SLOTS_UL_layerlist(bpy.types.UIList):
# texture_slots:
class WorldTextureSlots(bpy.props.PropertyGroup):
index = bpy.prop.PropertyInt(name='index')
#foo = random prop
bpy.types.World.texture_slots = bpy.props.CollectionProperty(type=PropertyGroup)
for i in range(18): # length of world texture slots
world.texture_slots.add()
'''
###############################################################################
# Text POV properties.
@ -3642,6 +3715,7 @@ classes = (
PovrayPreferences,
RenderPovSettingsCamera,
RenderPovSettingsWorld,
WorldTextureSlot,
RenderPovSettingsMaterial,
MaterialRaytraceMirror,
MaterialSubsurfaceScattering,
@ -3688,6 +3762,7 @@ def register():
bpy.types.Object.pov = PointerProperty(type=RenderPovSettingsObject)
bpy.types.Camera.pov = PointerProperty(type=RenderPovSettingsCamera)
bpy.types.World.pov = PointerProperty(type=RenderPovSettingsWorld)
bpy.types.World.texture_slots = CollectionProperty(type = WorldTextureSlot)
bpy.types.Text.pov = PointerProperty(type=RenderPovSettingsText)

View File

@ -24,7 +24,10 @@ import os #really import here and in render.py?
from os.path import isfile
from bl_operators.presets import AddPresetBase
from bpy.utils import register_class, unregister_class
from bpy.types import (
Operator,
UIList
)
# Example of wrapping every class 'as is'
from bl_ui import properties_output
for member in dir(properties_output):
@ -69,7 +72,7 @@ class POV_WORLD_MT_presets(bpy.types.Menu):
draw = bpy.types.Menu.draw_preset
class AddPresetWorld(AddPresetBase, bpy.types.Operator):
class AddPresetWorld(AddPresetBase, Operator):
'''Add a World Preset'''
bl_idname = "object.world_preset_add"
bl_label = "Add World Preset"
@ -528,7 +531,7 @@ class POV_LIGHT_MT_presets(bpy.types.Menu):
draw = bpy.types.Menu.draw_preset
class AddPresetLamp(AddPresetBase, bpy.types.Operator):
class AddPresetLamp(AddPresetBase, Operator):
'''Add a Lamp Preset'''
bl_idname = "object.light_preset_add"
bl_label = "Add Lamp Preset"
@ -941,7 +944,7 @@ class POV_RADIOSITY_MT_presets(bpy.types.Menu):
draw = bpy.types.Menu.draw_preset
class AddPresetRadiosity(AddPresetBase, bpy.types.Operator):
class AddPresetRadiosity(AddPresetBase, Operator):
'''Add a Radiosity Preset'''
bl_idname = "scene.radiosity_preset_add"
bl_label = "Add Radiosity Preset"
@ -1073,7 +1076,7 @@ class MATERIAL_MT_POV_sss_presets(bpy.types.Menu):
preset_operator = "script.execute_preset"
draw = bpy.types.Menu.draw_preset
class AddPresetSSS(AddPresetBase, bpy.types.Operator):
class AddPresetSSS(AddPresetBase, Operator):
'''Add an SSS Preset'''
bl_idname = "material.sss_preset_add"
bl_label = "Add SSS Preset"
@ -2229,7 +2232,7 @@ class CAMERA_PT_povray_replacement_text(CameraDataButtonsPanel, bpy.types.Panel)
# Text Povray Settings
###############################################################################
class TEXT_OT_povray_insert(bpy.types.Operator):
class TEXT_OT_povray_insert(Operator):
"""Tooltip"""
bl_idname = "text.povray_insert"
bl_label = "Insert"
@ -2339,11 +2342,33 @@ def menu_func_templates(self, context):
# Do not depend on POV-Ray being active renderer here...
self.layout.menu("TEXT_MT_templates_pov")
class WORLD_TEXTURE_SLOTS_UL_List(UIList):
"""Texture Slots UIList."""
def draw_item(self, context, layout, world, item, icon, active_data,
world_texture_list_index, index):
world = context.world#.pov
active_data = world.pov
#tex = context.texture #may be needed later?
# We could write some code to decide which icon to use here...
custom_icon = 'TEXTURE'
# Make sure your code supports all 3 layout types
if self.layout_type in {'DEFAULT', 'COMPACT'}:
layout.label(item.name, icon = custom_icon)
elif self.layout_type in {'GRID'}:
layout.alignment = 'CENTER'
layout.label("", icon = custom_icon)
classes = (
WORLD_PT_POV_world,
POV_WORLD_MT_presets,
AddPresetWorld,
WORLD_TEXTURE_SLOTS_UL_List,
#RenderButtonsPanel,
#ModifierButtonsPanel,
#MaterialButtonsPanel,