Skip to content

Commit

Permalink
Support for basic light components
Browse files Browse the repository at this point in the history
  • Loading branch information
netpro2k committed Jan 15, 2021
1 parent f62aef5 commit eb64240
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 9 deletions.
34 changes: 34 additions & 0 deletions default-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,40 @@
"visible": { "type": "bool", "default": true }
}
},
"directional-light": {
"category": "Elements",
"node": true,
"properties": {
"color": {"type": "color"},
"intensity": {"type": "float", "default": 1.0},
"castShadow": { "type": "bool", "default": false },
"shadowMapResolution": {"type": "ivec2", "unit":"PIXEL", "default": {"x": 512, "y": 512}},
"shadowBias": {"type": "float", "default": 0.0},
"shadowRadius": {"type": "float", "default": 1.0}
}
},
"point-light": {
"category": "Elements",
"node": true,
"properties": {
"color": {"type": "color"},
"intensity": {"type": "float", "default": 1.0},
"range": {"type": "float", "default": 0.0},
"decay": {"type": "float", "default": 2.0},
"castShadow": { "type": "bool", "default": false },
"shadowMapResolution": {"type": "ivec2", "unit":"PIXEL", "default": {"x": 512, "y": 512}},
"shadowBias": {"type": "float", "default": 0.0},
"shadowRadius": {"type": "float", "default": 1.0}
}
},
"ambient-light": {
"category": "Elements",
"node": true,
"properties": {
"color": {"type": "color"},
"intensity": {"type": "float", "default": 1.0}
}
},
"waypoint": {
"category": "Elements",
"node": true,
Expand Down
21 changes: 12 additions & 9 deletions gather_properties.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,18 @@ def gather_material_property(export_settings, blender_object, target, property_n
def gather_vec_property(export_settings, blender_object, target, property_name, property_definition, hubs_config):
vec = getattr(target, property_name)

out = {
"x": vec[0],
"y": vec[1],
}

if len(vec) > 2:
out["z"] = vec[2]
if len(vec) > 3:
out["w"] = vec[4]
if property_definition.get("unit") == "PIXEL":
out = [vec[0], vec[1]]
else:
out = {
"x": vec[0],
"y": vec[1],
}

if len(vec) > 2:
out["z"] = vec[2]
if len(vec) > 3:
out["w"] = vec[4]

return out

Expand Down

0 comments on commit eb64240

Please sign in to comment.