From 07ff2f8c6e144fbdb58ab2bdcd7b760001046742 Mon Sep 17 00:00:00 2001 From: Lubos Lenco Date: Mon, 11 Jan 2016 21:10:33 +0100 Subject: [PATCH] Geometry usage --- Assets/pipeline_resource.json | 5 +++- blender/__pycache__/nodes.cpython-34.pyc | Bin 6333 -> 6307 bytes blender/__pycache__/project.cpython-34.pyc | Bin 11442 -> 11484 bytes blender/__pycache__/props.cpython-34.pyc | Bin 3744 -> 3867 bytes blender/__pycache__/write_data.cpython-34.pyc | Bin 2320 -> 2398 bytes blender/armory.py | 5 ++++ blender/nodes.py | 24 +++++++++--------- blender/project.py | 3 ++- blender/props.py | 14 ++++++---- blender/write_data.py | 3 ++- 10 files changed, 34 insertions(+), 20 deletions(-) diff --git a/Assets/pipeline_resource.json b/Assets/pipeline_resource.json index 7e785eb7..3ec5ae44 100644 --- a/Assets/pipeline_resource.json +++ b/Assets/pipeline_resource.json @@ -5,7 +5,6 @@ "render_targets": [], "stages": [ - { "command": "set_target", "params": [""] @@ -14,6 +13,10 @@ "command": "clear_target", "params": ["depth", "color"] }, + { + "command": "draw_quad", + "params": ["material_resource", "material1", "env_map"] + }, { "command": "draw_geometry", "params": ["forward"] diff --git a/blender/__pycache__/nodes.cpython-34.pyc b/blender/__pycache__/nodes.cpython-34.pyc index bc4c824e179a7135f9a2bb72bf84e05969808dce..40e6c73665bebd17f7efcd9ede159f0784608a27 100644 GIT binary patch delta 74 zcmdmMxY&^M9S<+plYf)LqBe5=W0YWXb`L2^O|9bg$xqKrR>;dwNiDv`i#BowDlpw;m~0>+J-J+=+uE3+gn=Q8ks*tp!6jCep_YlE zM1Y}&iJ_U1A%&G8n~9-l14D@*RD`i`0|O9+r!X)CYqCxDQkD{^;>pWTNiEiMb`L2^ zP1O{dEGVZtxlmD?sVHOeOhp?}AqF5|lxE~&6lLUP)@RgZ7G@OM{6g^n6Qk1Rl`3#$C0UJ336_`#iOg4~^o?NcbttQ7%!oZNl$dJX);1VmqP|L(n zBEV3?#L&#hz*x9}Av}eFAy|`jvaO;NlcwNgK{?&YQxvr)A5pXv7GMAZMrlSaMo~sy zW_?CoX5r03N(Y!26*pg2najjzHn~v!4r9b*KaKf}v76s%OlM?Fn%t%}oiT5+oOT;y X@#dx4T8zAWJfb{GJgh*-!@~*yV0bAM diff --git a/blender/__pycache__/props.cpython-34.pyc b/blender/__pycache__/props.cpython-34.pyc index 751b74c4062708ffed2150cda6223b84e5da41a7..40b7616c7d7d86d867ea6cd2bcb7acf8dcd2c8d2 100644 GIT binary patch delta 962 zcmZvaO=uHQ5P;`xHoM7Y^IsEFk~UToU29D%Vk<4y*h=tFtxXg?Xb5glqg8mDib$nG z@t`Mh^yI~p7eVl*N6+3ohy?WFLA-cVL=c?WC6L7K@;+wgeedne+kKvUHWK_{hK*n1 z$=SEBgH=U*!VAiag9dDZ(gtYxpk+Wk1RM)!DPRk*Lty*BR(l*1>S3Jr|MyaI68%mB|M=o6<&*ec$(JY?>KBq*ZL$q)fT}fw zDRntwR@;sC)l2y`r*XMi!=`#2Kd2KT_1J$Wp)NI@D;?8ujXE26+y5>w40I{G1kP(| zQNX)K4PR>Cg@sS`F)@yB^qeT-NByCg#71Cyrbu?4hGP&+p?S9=i?s3#ehcKZ-83Qh zpb;Du5Ad&6z*E7wjRLIG$56rc!!-rueOOnZ<#&@B*cxmqAZ~!yihi=AEtHpzuasq$ z_sTIw7<(C9u%*j!jx~nPuo(Lo6O6+IOO^XMruhJPehE(-$?PO$r)fAb0*Ih6m8eM4 zof1)u7{hqL$b=5jlw?bKjn7axMPsn>8ERa1oBnA$x|ruRI~Ze(odio8EO(Bl+)7#M zsnjd9<6CXCB_FYe5Jz103H%x=ZCT$e%`VUwtZx?Q!x_A1p3}H`S->yma=gYOA0CL9 z(1lziX(e}*o@JSFjL^|!bM@w}rZhQo1Yd>IVv7EOG=2`7(espaR07bc$qN1sS4Img fCK>#fNIo&iWywWG#a+7=84D(}@oXX+H~s$rX=7Y_dj5tm(EjiDA_yBHGeYwW+3Fw8XX)JZK2)BF463YCEPiQJxn14 z*W;$h5*+FqP&M6583Xb>qObbxUK^^$826!Jl;NGZc);S^wAH?TtA4MsR+r=CpCuF! zo*_LN>jZ;PAzUC_B+MZ^RbHZT6p!>7no>$JEE-i2v)Ds{VBF+F$y9g_+kWmgX4aJ5 z-LTo-3AU=fY`<9blCp-Pyo`X?V*G!_bObGpRy-S3eAjaIxMJ9~-qc+>fbK_55vCEI zK3dTNg`#3e8ZHLvBCk>AEAU9v%##wD$LJFF(S+vVw|J&UJBsii-E{7gL>I|;mK$6y z!`JlMwHr8>HwjCKzAl69?(;y>CCNovarSm(@c2pC3uJ4%>+fv^vIcd#nAyZ=s3I62 p#@yXV&blxe1gLR035M2SpWb4 delta 179 zcmca7G(m{-9S<+p_r;ULv^H{nVixLUU|=X=U`SzPNMT}VW@6~Cn9R$fBF4&4!o-lp z%#g*xkix+04i=*^x!b4n>@sK~g-0hd~@D$rzr(zz`S#B!V@0{i^tb^Gl18 zQ;YR|6EpMlGAfFgfHqZmPu|O-H93h@axy!s@a9-nc}AgI0?zIMMfq8&$t3}a$=QkN SshexqW-u{vB~KRP^Z)=+`ztX3 diff --git a/blender/armory.py b/blender/armory.py index 0d2e5f98..56c366b2 100644 --- a/blender/armory.py +++ b/blender/armory.py @@ -1769,9 +1769,14 @@ class ArmoryExporter(bpy.types.Operator, ExportHelper): if is_instanced == True: om.instance_offsets = instance_offsets + # Export usage + if node.static_usage == False: + om.static_usage = False + # Delete the new mesh that we made earlier. bpy.data.meshes.remove(exportMesh) + o.mesh = om # One geometry data per file diff --git a/blender/nodes.py b/blender/nodes.py index e4934294..09545ece 100755 --- a/blender/nodes.py +++ b/blender/nodes.py @@ -4,11 +4,11 @@ from bpy.props import * # Implementation of custom nodes from Python # Derived from the NodeTree base type, similar to Menu, Operator, Panel, etc. -class MyCustomTree(NodeTree): +class CGTree(NodeTree): # Description string '''Logic nodes''' # Optional identifier string. If not explicitly defined, the python class name is used. - bl_idname = 'CustomTreeType' + bl_idname = 'CGTreeType' # Label for nice name display bl_label = 'CG Node Tree' # Icon identifier @@ -22,14 +22,14 @@ class MyCustomTree(NodeTree): # Mix-in class for all custom nodes in this tree type. # Defines a poll function to enable instantiation. -class MyCustomTreeNode: +class CGTreeNode: @classmethod def poll(cls, ntree): - return ntree.bl_idname == 'CustomTreeType' + return ntree.bl_idname == 'CGTreeType' # Derived from the Node base type. -class TransformNode(Node, MyCustomTreeNode): +class TransformNode(Node, CGTreeNode): # Description string '''A custom node''' # 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 = "") # Derived from the Node base type. -class TimeNode(Node, MyCustomTreeNode): +class TimeNode(Node, CGTreeNode): # Description string '''Time node''' @@ -102,7 +102,7 @@ class TimeNode(Node, MyCustomTreeNode): def free(self): print("Removing node ", self, ", Goodbye!") -class VectorNode(Node, MyCustomTreeNode): +class VectorNode(Node, CGTreeNode): bl_idname = 'VectorNodeType' # Label for nice name display bl_label = 'Vector' @@ -127,7 +127,7 @@ class VectorNode(Node, MyCustomTreeNode): render() -class ScaleValueNode(Node, MyCustomTreeNode): +class ScaleValueNode(Node, CGTreeNode): bl_idname = 'ScaleValueNodeType' # Label for nice name display bl_label = 'ScaleValue' @@ -153,7 +153,7 @@ class ScaleValueNode(Node, MyCustomTreeNode): render() -class SineNode(Node, MyCustomTreeNode): +class SineNode(Node, CGTreeNode): bl_idname = 'SineNodeType' # Label for nice name display bl_label = 'Sine' @@ -190,7 +190,7 @@ from nodeitems_utils import NodeCategory, NodeItem class MyNodeCategory(NodeCategory): @classmethod def poll(cls, context): - return context.space_data.tree_type == 'CustomTreeType' + return context.space_data.tree_type == 'CGTreeType' # all categories in a list node_categories = [ @@ -208,10 +208,10 @@ node_categories = [ def register(): bpy.utils.register_module(__name__) try: - nodeitems_utils.register_node_categories("CUSTOM_NODES", node_categories) + nodeitems_utils.register_node_categories("CG_NODES", node_categories) except: pass def unregister(): - nodeitems_utils.unregister_node_categories("CUSTOM_NODES") + nodeitems_utils.unregister_node_categories("CG_NODES") bpy.utils.unregister_module(__name__) diff --git a/blender/project.py b/blender/project.py index 1df07a99..4b37e81f 100755 --- a/blender/project.py +++ b/blender/project.py @@ -284,7 +284,8 @@ def buildNodeTrees(): # Export node scripts 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): rn = getRootNode(node_group) diff --git a/blender/props.py b/blender/props.py index 2916f449..2ec97666 100755 --- a/blender/props.py +++ b/blender/props.py @@ -10,12 +10,14 @@ def cb_scene_update(context): if edit_obj is not None and edit_obj.is_updated_data is True: edit_obj.geometry_cached = False -def initObjectProperties(): - # For geometry - bpy.types.Object.geometry_cached = bpy.props.BoolProperty(name="Geometry cached", default=False) +def initProperties(): + # For object + 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.custom_material = bpy.props.BoolProperty(name="Custom material", default=False) 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 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") @@ -44,7 +46,7 @@ class ObjectPropsPanel(bpy.types.Panel): if obj.custom_material: layout.prop(obj, 'custom_material_name') -# Menu in camera region +# Menu in data region class DataPropsPanel(bpy.types.Panel): bl_label = "Cycles Props" bl_space_type = "PROPERTIES" @@ -59,6 +61,8 @@ class DataPropsPanel(bpy.types.Panel): layout.prop(obj.data, 'frustum_culling') layout.prop(obj.data, 'pipeline_path') layout.prop(obj.data, 'pipeline_pass') + elif obj.type == 'MESH': + layout.prop(obj.data, 'static_usage') # Menu in materials region class MatsPropsPanel(bpy.types.Panel): @@ -80,7 +84,7 @@ class MatsPropsPanel(bpy.types.Panel): # Registration def register(): bpy.utils.register_module(__name__) - initObjectProperties() + initProperties() bpy.app.handlers.scene_update_post.append(cb_scene_update) def unregister(): diff --git a/blender/write_data.py b/blender/write_data.py index 610107bb..06b73175 100644 --- a/blender/write_data.py +++ b/blender/write_data.py @@ -34,7 +34,8 @@ def write_main(): """// Auto-generated package ; 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 projectHeight = """ + str(bpy.data.worlds[0]['CGProjectHeight']) + """; public static function main() {