Geometry usage
This commit is contained in:
parent
42369a0cd8
commit
07ff2f8c6e
|
@ -5,7 +5,6 @@
|
||||||
"render_targets": [],
|
"render_targets": [],
|
||||||
"stages": [
|
"stages": [
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
"command": "set_target",
|
"command": "set_target",
|
||||||
"params": [""]
|
"params": [""]
|
||||||
|
@ -14,6 +13,10 @@
|
||||||
"command": "clear_target",
|
"command": "clear_target",
|
||||||
"params": ["depth", "color"]
|
"params": ["depth", "color"]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"command": "draw_quad",
|
||||||
|
"params": ["material_resource", "material1", "env_map"]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"command": "draw_geometry",
|
"command": "draw_geometry",
|
||||||
"params": ["forward"]
|
"params": ["forward"]
|
||||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -1769,9 +1769,14 @@ class ArmoryExporter(bpy.types.Operator, ExportHelper):
|
||||||
if is_instanced == True:
|
if is_instanced == True:
|
||||||
om.instance_offsets = instance_offsets
|
om.instance_offsets = instance_offsets
|
||||||
|
|
||||||
|
# Export usage
|
||||||
|
if node.static_usage == False:
|
||||||
|
om.static_usage = False
|
||||||
|
|
||||||
# Delete the new mesh that we made earlier.
|
# Delete the new mesh that we made earlier.
|
||||||
|
|
||||||
bpy.data.meshes.remove(exportMesh)
|
bpy.data.meshes.remove(exportMesh)
|
||||||
|
|
||||||
o.mesh = om
|
o.mesh = om
|
||||||
|
|
||||||
# One geometry data per file
|
# One geometry data per file
|
||||||
|
|
|
@ -4,11 +4,11 @@ from bpy.props import *
|
||||||
# Implementation of custom nodes from Python
|
# Implementation of custom nodes from Python
|
||||||
|
|
||||||
# Derived from the NodeTree base type, similar to Menu, Operator, Panel, etc.
|
# Derived from the NodeTree base type, similar to Menu, Operator, Panel, etc.
|
||||||
class MyCustomTree(NodeTree):
|
class CGTree(NodeTree):
|
||||||
# Description string
|
# Description string
|
||||||
'''Logic nodes'''
|
'''Logic nodes'''
|
||||||
# Optional identifier string. If not explicitly defined, the python class name is used.
|
# Optional identifier string. If not explicitly defined, the python class name is used.
|
||||||
bl_idname = 'CustomTreeType'
|
bl_idname = 'CGTreeType'
|
||||||
# Label for nice name display
|
# Label for nice name display
|
||||||
bl_label = 'CG Node Tree'
|
bl_label = 'CG Node Tree'
|
||||||
# Icon identifier
|
# Icon identifier
|
||||||
|
@ -22,14 +22,14 @@ class MyCustomTree(NodeTree):
|
||||||
|
|
||||||
# Mix-in class for all custom nodes in this tree type.
|
# Mix-in class for all custom nodes in this tree type.
|
||||||
# Defines a poll function to enable instantiation.
|
# Defines a poll function to enable instantiation.
|
||||||
class MyCustomTreeNode:
|
class CGTreeNode:
|
||||||
@classmethod
|
@classmethod
|
||||||
def poll(cls, ntree):
|
def poll(cls, ntree):
|
||||||
return ntree.bl_idname == 'CustomTreeType'
|
return ntree.bl_idname == 'CGTreeType'
|
||||||
|
|
||||||
|
|
||||||
# Derived from the Node base type.
|
# Derived from the Node base type.
|
||||||
class TransformNode(Node, MyCustomTreeNode):
|
class TransformNode(Node, CGTreeNode):
|
||||||
# Description string
|
# Description string
|
||||||
'''A custom node'''
|
'''A custom node'''
|
||||||
# Optional identifier string. If not explicitly defined, the python class name is used.
|
# Optional identifier string. If not explicitly defined, the python class name is used.
|
||||||
|
@ -70,7 +70,7 @@ class TransformNode(Node, MyCustomTreeNode):
|
||||||
#layout.prop_search(self, "objname", context.scene, "objects", text = "")
|
#layout.prop_search(self, "objname", context.scene, "objects", text = "")
|
||||||
|
|
||||||
# Derived from the Node base type.
|
# Derived from the Node base type.
|
||||||
class TimeNode(Node, MyCustomTreeNode):
|
class TimeNode(Node, CGTreeNode):
|
||||||
|
|
||||||
# Description string
|
# Description string
|
||||||
'''Time node'''
|
'''Time node'''
|
||||||
|
@ -102,7 +102,7 @@ class TimeNode(Node, MyCustomTreeNode):
|
||||||
def free(self):
|
def free(self):
|
||||||
print("Removing node ", self, ", Goodbye!")
|
print("Removing node ", self, ", Goodbye!")
|
||||||
|
|
||||||
class VectorNode(Node, MyCustomTreeNode):
|
class VectorNode(Node, CGTreeNode):
|
||||||
bl_idname = 'VectorNodeType'
|
bl_idname = 'VectorNodeType'
|
||||||
# Label for nice name display
|
# Label for nice name display
|
||||||
bl_label = 'Vector'
|
bl_label = 'Vector'
|
||||||
|
@ -127,7 +127,7 @@ class VectorNode(Node, MyCustomTreeNode):
|
||||||
render()
|
render()
|
||||||
|
|
||||||
|
|
||||||
class ScaleValueNode(Node, MyCustomTreeNode):
|
class ScaleValueNode(Node, CGTreeNode):
|
||||||
bl_idname = 'ScaleValueNodeType'
|
bl_idname = 'ScaleValueNodeType'
|
||||||
# Label for nice name display
|
# Label for nice name display
|
||||||
bl_label = 'ScaleValue'
|
bl_label = 'ScaleValue'
|
||||||
|
@ -153,7 +153,7 @@ class ScaleValueNode(Node, MyCustomTreeNode):
|
||||||
render()
|
render()
|
||||||
|
|
||||||
|
|
||||||
class SineNode(Node, MyCustomTreeNode):
|
class SineNode(Node, CGTreeNode):
|
||||||
bl_idname = 'SineNodeType'
|
bl_idname = 'SineNodeType'
|
||||||
# Label for nice name display
|
# Label for nice name display
|
||||||
bl_label = 'Sine'
|
bl_label = 'Sine'
|
||||||
|
@ -190,7 +190,7 @@ from nodeitems_utils import NodeCategory, NodeItem
|
||||||
class MyNodeCategory(NodeCategory):
|
class MyNodeCategory(NodeCategory):
|
||||||
@classmethod
|
@classmethod
|
||||||
def poll(cls, context):
|
def poll(cls, context):
|
||||||
return context.space_data.tree_type == 'CustomTreeType'
|
return context.space_data.tree_type == 'CGTreeType'
|
||||||
|
|
||||||
# all categories in a list
|
# all categories in a list
|
||||||
node_categories = [
|
node_categories = [
|
||||||
|
@ -208,10 +208,10 @@ node_categories = [
|
||||||
def register():
|
def register():
|
||||||
bpy.utils.register_module(__name__)
|
bpy.utils.register_module(__name__)
|
||||||
try:
|
try:
|
||||||
nodeitems_utils.register_node_categories("CUSTOM_NODES", node_categories)
|
nodeitems_utils.register_node_categories("CG_NODES", node_categories)
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def unregister():
|
def unregister():
|
||||||
nodeitems_utils.unregister_node_categories("CUSTOM_NODES")
|
nodeitems_utils.unregister_node_categories("CG_NODES")
|
||||||
bpy.utils.unregister_module(__name__)
|
bpy.utils.unregister_module(__name__)
|
||||||
|
|
|
@ -284,7 +284,8 @@ def buildNodeTrees():
|
||||||
|
|
||||||
# Export node scripts
|
# Export node scripts
|
||||||
for node_group in bpy.data.node_groups:
|
for node_group in bpy.data.node_groups:
|
||||||
buildNodeTree(node_group)
|
if type(node_group) == 'nodes.CGTree': # Build only cycles game trees
|
||||||
|
buildNodeTree(node_group)
|
||||||
|
|
||||||
def buildNodeTree(node_group):
|
def buildNodeTree(node_group):
|
||||||
rn = getRootNode(node_group)
|
rn = getRootNode(node_group)
|
||||||
|
|
|
@ -10,12 +10,14 @@ def cb_scene_update(context):
|
||||||
if edit_obj is not None and edit_obj.is_updated_data is True:
|
if edit_obj is not None and edit_obj.is_updated_data is True:
|
||||||
edit_obj.geometry_cached = False
|
edit_obj.geometry_cached = False
|
||||||
|
|
||||||
def initObjectProperties():
|
def initProperties():
|
||||||
# For geometry
|
# For object
|
||||||
bpy.types.Object.geometry_cached = bpy.props.BoolProperty(name="Geometry cached", default=False)
|
bpy.types.Object.geometry_cached = bpy.props.BoolProperty(name="Geometry cached", default=False) # TODO: move to mesh type
|
||||||
bpy.types.Object.instanced_children = bpy.props.BoolProperty(name="Instanced children", default=False)
|
bpy.types.Object.instanced_children = bpy.props.BoolProperty(name="Instanced children", default=False)
|
||||||
bpy.types.Object.custom_material = bpy.props.BoolProperty(name="Custom material", default=False)
|
bpy.types.Object.custom_material = bpy.props.BoolProperty(name="Custom material", default=False)
|
||||||
bpy.types.Object.custom_material_name = bpy.props.StringProperty(name="Name", default="")
|
bpy.types.Object.custom_material_name = bpy.props.StringProperty(name="Name", default="")
|
||||||
|
# For geometry
|
||||||
|
bpy.types.Mesh.static_usage = bpy.props.BoolProperty(name="Static usage", default=True)
|
||||||
# For camera
|
# For camera
|
||||||
bpy.types.Camera.frustum_culling = bpy.props.BoolProperty(name="Frustum Culling", default=False)
|
bpy.types.Camera.frustum_culling = bpy.props.BoolProperty(name="Frustum Culling", default=False)
|
||||||
bpy.types.Camera.pipeline_path = bpy.props.StringProperty(name="Pipeline Path", default="pipeline_resource/forward_pipeline")
|
bpy.types.Camera.pipeline_path = bpy.props.StringProperty(name="Pipeline Path", default="pipeline_resource/forward_pipeline")
|
||||||
|
@ -44,7 +46,7 @@ class ObjectPropsPanel(bpy.types.Panel):
|
||||||
if obj.custom_material:
|
if obj.custom_material:
|
||||||
layout.prop(obj, 'custom_material_name')
|
layout.prop(obj, 'custom_material_name')
|
||||||
|
|
||||||
# Menu in camera region
|
# Menu in data region
|
||||||
class DataPropsPanel(bpy.types.Panel):
|
class DataPropsPanel(bpy.types.Panel):
|
||||||
bl_label = "Cycles Props"
|
bl_label = "Cycles Props"
|
||||||
bl_space_type = "PROPERTIES"
|
bl_space_type = "PROPERTIES"
|
||||||
|
@ -59,6 +61,8 @@ class DataPropsPanel(bpy.types.Panel):
|
||||||
layout.prop(obj.data, 'frustum_culling')
|
layout.prop(obj.data, 'frustum_culling')
|
||||||
layout.prop(obj.data, 'pipeline_path')
|
layout.prop(obj.data, 'pipeline_path')
|
||||||
layout.prop(obj.data, 'pipeline_pass')
|
layout.prop(obj.data, 'pipeline_pass')
|
||||||
|
elif obj.type == 'MESH':
|
||||||
|
layout.prop(obj.data, 'static_usage')
|
||||||
|
|
||||||
# Menu in materials region
|
# Menu in materials region
|
||||||
class MatsPropsPanel(bpy.types.Panel):
|
class MatsPropsPanel(bpy.types.Panel):
|
||||||
|
@ -80,7 +84,7 @@ class MatsPropsPanel(bpy.types.Panel):
|
||||||
# Registration
|
# Registration
|
||||||
def register():
|
def register():
|
||||||
bpy.utils.register_module(__name__)
|
bpy.utils.register_module(__name__)
|
||||||
initObjectProperties()
|
initProperties()
|
||||||
bpy.app.handlers.scene_update_post.append(cb_scene_update)
|
bpy.app.handlers.scene_update_post.append(cb_scene_update)
|
||||||
|
|
||||||
def unregister():
|
def unregister():
|
||||||
|
|
|
@ -34,7 +34,8 @@ def write_main():
|
||||||
"""// Auto-generated
|
"""// Auto-generated
|
||||||
package ;
|
package ;
|
||||||
class Main {
|
class Main {
|
||||||
static inline var projectName = '""" + bpy.data.worlds[0]['CGProjectName'] + """';
|
public static inline var projectName = '""" + bpy.data.worlds[0]['CGProjectName'] + """';
|
||||||
|
public static inline var projectPackage = '""" + bpy.data.worlds[0]['CGProjectPackage'] + """';
|
||||||
static inline var projectWidth = """ + str(bpy.data.worlds[0]['CGProjectWidth']) + """;
|
static inline var projectWidth = """ + str(bpy.data.worlds[0]['CGProjectWidth']) + """;
|
||||||
static inline var projectHeight = """ + str(bpy.data.worlds[0]['CGProjectHeight']) + """;
|
static inline var projectHeight = """ + str(bpy.data.worlds[0]['CGProjectHeight']) + """;
|
||||||
public static function main() {
|
public static function main() {
|
||||||
|
|
Loading…
Reference in a new issue