-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from MozillaReality/moz-lightmaps
Add lightmap support and upgrade to Blender 2.83
- Loading branch information
Showing
4 changed files
with
101 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
fake_bpy_modules* | ||
__pycache__ | ||
.DS_Store | ||
.DS_Store | ||
io_scene_gltf2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import bpy | ||
|
||
import nodeitems_utils | ||
from nodeitems_utils import NodeCategory, NodeItem | ||
from bpy.types import Node | ||
|
||
class MozCategory(NodeCategory): | ||
@classmethod | ||
def poll(cls, context): | ||
return context.space_data.tree_type == 'ShaderNodeTree' | ||
|
||
node_categories = [ | ||
MozCategory("MOZ_NODES", "Hubs", items=[ | ||
NodeItem("moz_lightmap.node") | ||
]), | ||
] | ||
|
||
class MozLightmapNode(Node): | ||
"""MOZ_lightmap settings node""" | ||
bl_idname = 'moz_lightmap.node' | ||
bl_label = 'MOZ_lightmap settings' | ||
bl_icon = 'LIGHT' | ||
bl_width_min = 216.3 | ||
bl_width_max = 330.0 | ||
|
||
intensity: bpy.props.FloatProperty(name="Intensity", soft_min=0, soft_max=1, default=1) | ||
|
||
def init(self, context): | ||
lightmap = self.inputs.new('NodeSocketColor', "Lightmap") | ||
lightmap.hide_value = True | ||
|
||
self.width = 216.3 | ||
|
||
@classmethod | ||
def poll(cls, ntree): | ||
return ntree.bl_idname == 'ShaderNodeTree' | ||
|
||
def draw_buttons(self, context, layout): | ||
layout.prop(self, "intensity") | ||
|
||
def draw_label(self): | ||
return "MOZ_lightmap" | ||
|
||
def register(): | ||
bpy.utils.register_class(MozLightmapNode) | ||
nodeitems_utils.register_node_categories("MOZ_NODES", node_categories) | ||
|
||
def unregister(): | ||
bpy.utils.unregister_class(MozLightmapNode) | ||
nodeitems_utils.unregister_node_categories("MOZ_NODES") |