Browse Source

Add Runtime Color Setting

Adds a FloatVectorProperty to set the Runtime color.
pull/208/head
Patrick Dulebohn 5 years ago
parent
commit
27e5371400
  1. 4
      korman/exporter/material.py
  2. 2
      korman/properties/__init__.py
  3. 29
      korman/properties/prop_material.py
  4. 1
      korman/ui/__init__.py
  5. 41
      korman/ui/ui_material.py

4
korman/exporter/material.py

@ -1207,7 +1207,7 @@ class MaterialConverter:
# Colors
layer.ambient = utils.color(bpy.context.scene.world.ambient_color)
layer.preshade = utils.color(bm.diffuse_color)
layer.runtime = utils.color(bm.diffuse_color)
layer.runtime = utils.color(bm.plasma_mat.runtime_color)
layer.specular = utils.color(bm.specular_color)
layer.specularPower = min(100.0, float(bm.specular_hardness))
@ -1221,6 +1221,8 @@ class MaterialConverter:
bm.diffuse_color.g * emit_scale,
bm.diffuse_color.b * emit_scale,
1.0)
# fix runtime color for emit
layer.runtime = hsColorRGBA(1.0, 1.0, 1.0, 1.0)
def _requires_single_user(self, bo, bm):
if bo.data.show_double_sided:

2
korman/properties/__init__.py

@ -18,6 +18,7 @@ import bpy
from .prop_camera import *
from .prop_image import *
from .prop_lamp import *
from .prop_material import *
from . import modifiers
from .prop_object import *
from .prop_scene import *
@ -31,6 +32,7 @@ def register():
bpy.types.Camera.plasma_camera = bpy.props.PointerProperty(type=PlasmaCamera)
bpy.types.Image.plasma_image = bpy.props.PointerProperty(type=PlasmaImage)
bpy.types.Lamp.plasma_lamp = bpy.props.PointerProperty(type=PlasmaLamp)
bpy.types.Material.plasma_mat = bpy.props.PointerProperty(type=PlasmaMaterial)
bpy.types.Object.plasma_net = bpy.props.PointerProperty(type=PlasmaNet)
bpy.types.Object.plasma_object = bpy.props.PointerProperty(type=PlasmaObject)
bpy.types.Scene.plasma_scene = bpy.props.PointerProperty(type=PlasmaScene)

29
korman/properties/prop_material.py

@ -0,0 +1,29 @@
# This file is part of Korman.
#
# Korman is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Korman is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Korman. If not, see <http://www.gnu.org/licenses/>.
import bpy
from bpy.props import *
from .. import idprops
class PlasmaMaterial(bpy.types.PropertyGroup):
bl_idname = "material.plasma_mat"
runtime_color = FloatVectorProperty(name="Runtime Color:",
description="Sets the Runtime Color for Animated and Kickable Objects",
min=0.0,
max=1.0,
default=(0.0, 0.0, 0.0),
subtype="COLOR")

1
korman/ui/__init__.py

@ -17,6 +17,7 @@ from .ui_camera import *
from .ui_image import *
from .ui_lamp import *
from .ui_list import *
from .ui_material import *
from .ui_menus import *
from .ui_modifiers import *
from .ui_object import *

41
korman/ui/ui_material.py

@ -0,0 +1,41 @@
# This file is part of Korman.
#
# Korman is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Korman is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Korman. If not, see <http://www.gnu.org/licenses/>.
import bpy
from . import ui_list
class MaterialButtonsPanel:
bl_space_type = "PROPERTIES"
bl_region_type = "WINDOW"
bl_context = "material"
@classmethod
def poll(cls, context):
return context.material and context.scene.render.engine == "PLASMA_GAME"
class RuntimeColorPanel(MaterialButtonsPanel, bpy.types.Panel):
bl_label = "Runtime"
def draw(self, context):
material, slot = context.material, getattr(context, "material_slot", None)
mat_props = material.plasma_mat
layout = self.layout
split = layout.split()
col = split.column()
col.prop(mat_props, "runtime_color")
col = split.column()
Loading…
Cancel
Save