Index: release/scripts/ui/properties_material.py =================================================================== --- release/scripts/ui/properties_material.py (revision 34588) +++ release/scripts/ui/properties_material.py (working copy) @@ -553,7 +553,32 @@ col.prop(halo, "flare_subflare_count", text="Subflares") col.prop(halo, "flare_subflare_size", text="Subsize") +class MATERIAL_PT_gameop(MaterialButtonsPanel, bpy.types.Panel): + bl_label = "Game Options" + COMPAT_ENGINES = {'BLENDER_GAME'} + @classmethod + def poll(cls, context): + return context.material and (context.scene.render.engine in cls.COMPAT_ENGINES) + + def draw(self, context): + layout = self.layout + game = context.material.game_options # dont use node material + + split = layout.split() + col = split.column() + col.prop(game, "two_side") + col.prop(game, "shared") + col = split.column() + col.prop(game, "text") + + row = layout.row() + row.label(text="Blend Alpha:") + row.label(text="Face Orientation:") + row = layout.row() + row.prop(game,"game_blend",text="") + row.prop(game,"face_orientation",text="") + class MATERIAL_PT_physics(MaterialButtonsPanel, bpy.types.Panel): bl_label = "Physics" COMPAT_ENGINES = {'BLENDER_GAME'} @@ -562,8 +587,14 @@ def poll(cls, context): return context.material and (context.scene.render.engine in cls.COMPAT_ENGINES) + def draw_header(self, context): + game = context.material.game_options + self.layout.prop(game, "physics", text="") + def draw(self, context): layout = self.layout + game = context.material.game_options + layout.active = game.physics phys = context.material.physics # dont use node material Index: source/blender/makesdna/DNA_material_types.h =================================================================== --- source/blender/makesdna/DNA_material_types.h (revision 34588) +++ source/blender/makesdna/DNA_material_types.h (working copy) @@ -72,6 +72,15 @@ float ms_spread; } VolumeSettings; +typedef struct GameOptions { +/* Game Engine Material Options + (Old Texface Options) */ + int game_flag; + int game_blend; + int game_face_ori; + int pad1; +} GameOptions; + typedef struct Material { ID id; struct AnimData *adt; /* animation data (must be immediately after id for utilities to use it) */ @@ -88,6 +97,7 @@ /* end synced with render_types.h */ struct VolumeSettings vol; + struct GameOptions gameopt; float fresnel_mir, fresnel_mir_i; float fresnel_tra, fresnel_tra_i; @@ -163,6 +173,28 @@ ListBase gpumaterial; /* runtime */ } Material; + +/* Material Game Options */ +// Game Options - game_flag +#define GEMAT_TwoSided 1 +#define GEMAT_Shaded 2 +#define GEMAT_Text 4 +#define GEMAT_Physics 8 + +// Blend Transparency Options - game_blend +#define GEMAT_Opaque 0 +#define GEMAT_Add 1 +#define GEMAT_Clip 2 +#define GEMAT_Alpha 3 +#define GEMAT_Alpha_Sort 4 + +// Face Orientation Options - game_face_ori +#define GEMAT_None 0 +#define GEMAT_Halo 1 +#define GEMAT_Billboard 2 +#define GEMAT_Shadow 3 + + /* **************** MATERIAL ********************* */ /* maximum number of materials per material array. Index: source/blender/makesrna/intern/rna_material.c =================================================================== --- source/blender/makesrna/intern/rna_material.c (revision 34588) +++ source/blender/makesrna/intern/rna_material.c (working copy) @@ -703,6 +703,59 @@ RNA_def_property_update(prop, 0, "rna_Material_update"); } +static void rna_def_material_gameop(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + + static EnumPropertyItem prop_gameblend_items[] = { + {GEMAT_Opaque, "OPAQUE", 0, "Opaque", ""}, + {GEMAT_Add, "ADD", 0, "Add", ""}, + {GEMAT_Clip, "CLIP", 0, "Alpha Clip", ""}, + {GEMAT_Alpha, "ALPHA", 0, "Alpha Blend", ""}, + {GEMAT_Alpha_Sort, "ALPHASORT", 0, "Alpha Sort", ""}, + {0, NULL, 0, NULL, NULL}}; + + static EnumPropertyItem prop_gameface_orientation_items[] = { + {GEMAT_None,"NONE",0,"None",""}, + {GEMAT_Halo, "HALO", 0, "Halo", ""}, + {GEMAT_Billboard, "BILLBOARD", 0, "Billboard", ""}, + {GEMAT_Shadow, "SHADOW", 0, "Shadow", ""}, + {0, NULL, 0, NULL, NULL}}; + + srna= RNA_def_struct(brna, "MaterialGameOp", NULL); + RNA_def_struct_sdna(srna, "GameOptions"); + RNA_def_struct_nested(brna, srna, "Material"); + RNA_def_struct_ui_text(srna, "Material Game Options", "Game Engine settings for a Material datablock"); + + prop= RNA_def_property(srna, "two_side", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "game_flag", GEMAT_TwoSided); /* use bitflags */ + RNA_def_property_ui_text(prop, "Two Side", "Use two side faces in Game Engine "); + + prop= RNA_def_property(srna, "shared", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "game_flag", GEMAT_Shaded); /* use bitflags */ + RNA_def_property_ui_text(prop, "Shared", "Use shared faces in Game Engine "); + + prop= RNA_def_property(srna, "text", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "game_flag", GEMAT_Text); /* use bitflags */ + RNA_def_property_ui_text(prop, "Text", "Use material as text in Game Engine "); + + prop= RNA_def_property(srna, "game_blend", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "game_blend"); + RNA_def_property_enum_items(prop, prop_gameblend_items); + RNA_def_property_ui_text(prop, "Blend Mode", "Blend Mode for Transparent Faces"); + + prop= RNA_def_property(srna, "face_orientation", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "game_face_ori"); + RNA_def_property_enum_items(prop, prop_gameface_orientation_items); + RNA_def_property_ui_text(prop, "Face Orientations", "Especial face orientation options"); + + prop= RNA_def_property(srna, "physics", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_negative_sdna(prop, NULL, "game_flag", GEMAT_Physics); /* use bitflags */ + RNA_def_property_ui_text(prop, "Physics", "Use physics properties of materials "); + +} + static void rna_def_material_colors(StructRNA *srna) { PropertyRNA *prop; @@ -1800,6 +1853,13 @@ RNA_def_property_pointer_funcs(prop, "rna_Material_physics_get", NULL, NULL, NULL); RNA_def_property_ui_text(prop, "Physics", "Game physics settings"); + /* game ops */ + prop= RNA_def_property(srna, "game_options", PROP_POINTER, PROP_NONE); + RNA_def_property_flag(prop, PROP_NEVER_NULL); + RNA_def_property_pointer_sdna(prop, NULL, "gameopt"); + RNA_def_property_struct_type(prop, "MaterialGameOp"); + RNA_def_property_ui_text(prop, "Game Options", "Game material settings"); + /* nodetree */ prop= RNA_def_property(srna, "node_tree", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "nodetree"); @@ -1843,6 +1903,7 @@ rna_def_material_mtex(brna); rna_def_material_strand(brna); rna_def_material_physics(brna); + rna_def_material_gameop(brna); RNA_api_material(srna); }
Index: release/scripts/ui/properties_material.py =================================================================== --- release/scripts/ui/properties_material.py (revision 34588) +++ release/scripts/ui/properties_material.py (working copy) @@ -553,7 +553,32 @@ col.prop(halo, "flare_subflare_count", text="Subflares") col.prop(halo, "flare_subflare_size", text="Subsize") +class MATERIAL_PT_gameop(MaterialButtonsPanel, bpy.types.Panel): + bl_label = "Game Options" + COMPAT_ENGINES = {'BLENDER_GAME'} + @classmethod + def poll(cls, context): + return context.material and (context.scene.render.engine in cls.COMPAT_ENGINES) + + def draw(self, context): + layout = self.layout + game = context.material.game_options # dont use node material + + split = layout.split() + col = split.column() + col.prop(game, "two_side") + col.prop(game, "shared") + col = split.column() + col.prop(game, "text") + + row = layout.row() + row.label(text="Blend Alpha:") + row.label(text="Face Orientation:") + row = layout.row() + row.prop(game,"game_blend",text="") + row.prop(game,"face_orientation",text="") + class MATERIAL_PT_physics(MaterialButtonsPanel, bpy.types.Panel): bl_label = "Physics" COMPAT_ENGINES = {'BLENDER_GAME'} @@ -562,8 +587,14 @@ def poll(cls, context): return context.material and (context.scene.render.engine in cls.COMPAT_ENGINES) + def draw_header(self, context): + game = context.material.game_options + self.layout.prop(game, "physics", text="") + def draw(self, context): layout = self.layout + game = context.material.game_options + layout.active = game.physics phys = context.material.physics # dont use node material Index: source/blender/makesdna/DNA_material_types.h =================================================================== --- source/blender/makesdna/DNA_material_types.h (revision 34588) +++ source/blender/makesdna/DNA_material_types.h (working copy) @@ -72,6 +72,15 @@ float ms_spread; } VolumeSettings; +typedef struct GameOptions { +/* Game Engine Material Options + (Old Texface Options) */ + int game_flag; + int game_blend; + int game_face_ori; + int pad1; +} GameOptions; + typedef struct Material { ID id; struct AnimData *adt; /* animation data (must be immediately after id for utilities to use it) */ @@ -88,6 +97,7 @@ /* end synced with render_types.h */ struct VolumeSettings vol; + struct GameOptions gameopt; float fresnel_mir, fresnel_mir_i; float fresnel_tra, fresnel_tra_i; @@ -163,6 +173,28 @@ ListBase gpumaterial; /* runtime */ } Material; + +/* Material Game Options */ +// Game Options - game_flag +#define GEMAT_TwoSided 1 +#define GEMAT_Shaded 2 +#define GEMAT_Text 4 +#define GEMAT_Physics 8 + +// Blend Transparency Options - game_blend +#define GEMAT_Opaque 0 +#define GEMAT_Add 1 +#define GEMAT_Clip 2 +#define GEMAT_Alpha 3 +#define GEMAT_Alpha_Sort 4 + +// Face Orientation Options - game_face_ori +#define GEMAT_None 0 +#define GEMAT_Halo 1 +#define GEMAT_Billboard 2 +#define GEMAT_Shadow 3 + + /* **************** MATERIAL ********************* */ /* maximum number of materials per material array. Index: source/blender/makesrna/intern/rna_material.c =================================================================== --- source/blender/makesrna/intern/rna_material.c (revision 34588) +++ source/blender/makesrna/intern/rna_material.c (working copy) @@ -703,6 +703,59 @@ RNA_def_property_update(prop, 0, "rna_Material_update"); } +static void rna_def_material_gameop(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + + static EnumPropertyItem prop_gameblend_items[] = { + {GEMAT_Opaque, "OPAQUE", 0, "Opaque", ""}, + {GEMAT_Add, "ADD", 0, "Add", ""}, + {GEMAT_Clip, "CLIP", 0, "Alpha Clip", ""}, + {GEMAT_Alpha, "ALPHA", 0, "Alpha Blend", ""}, + {GEMAT_Alpha_Sort, "ALPHASORT", 0, "Alpha Sort", ""}, + {0, NULL, 0, NULL, NULL}}; + + static EnumPropertyItem prop_gameface_orientation_items[] = { + {GEMAT_None,"NONE",0,"None",""}, + {GEMAT_Halo, "HALO", 0, "Halo", ""}, + {GEMAT_Billboard, "BILLBOARD", 0, "Billboard", ""}, + {GEMAT_Shadow, "SHADOW", 0, "Shadow", ""}, + {0, NULL, 0, NULL, NULL}}; + + srna= RNA_def_struct(brna, "MaterialGameOp", NULL); + RNA_def_struct_sdna(srna, "GameOptions"); + RNA_def_struct_nested(brna, srna, "Material"); + RNA_def_struct_ui_text(srna, "Material Game Options", "Game Engine settings for a Material datablock"); + + prop= RNA_def_property(srna, "two_side", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "game_flag", GEMAT_TwoSided); /* use bitflags */ + RNA_def_property_ui_text(prop, "Two Side", "Use two side faces in Game Engine "); + + prop= RNA_def_property(srna, "shared", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "game_flag", GEMAT_Shaded); /* use bitflags */ + RNA_def_property_ui_text(prop, "Shared", "Use shared faces in Game Engine "); + + prop= RNA_def_property(srna, "text", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "game_flag", GEMAT_Text); /* use bitflags */ + RNA_def_property_ui_text(prop, "Text", "Use material as text in Game Engine "); + + prop= RNA_def_property(srna, "game_blend", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "game_blend"); + RNA_def_property_enum_items(prop, prop_gameblend_items); + RNA_def_property_ui_text(prop, "Blend Mode", "Blend Mode for Transparent Faces"); + + prop= RNA_def_property(srna, "face_orientation", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "game_face_ori"); + RNA_def_property_enum_items(prop, prop_gameface_orientation_items); + RNA_def_property_ui_text(prop, "Face Orientations", "Especial face orientation options"); + + prop= RNA_def_property(srna, "physics", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_negative_sdna(prop, NULL, "game_flag", GEMAT_Physics); /* use bitflags */ + RNA_def_property_ui_text(prop, "Physics", "Use physics properties of materials "); + +} + static void rna_def_material_colors(StructRNA *srna) { PropertyRNA *prop; @@ -1800,6 +1853,13 @@ RNA_def_property_pointer_funcs(prop, "rna_Material_physics_get", NULL, NULL, NULL); RNA_def_property_ui_text(prop, "Physics", "Game physics settings"); + /* game ops */ + prop= RNA_def_property(srna, "game_options", PROP_POINTER, PROP_NONE); + RNA_def_property_flag(prop, PROP_NEVER_NULL); + RNA_def_property_pointer_sdna(prop, NULL, "gameopt"); + RNA_def_property_struct_type(prop, "MaterialGameOp"); + RNA_def_property_ui_text(prop, "Game Options", "Game material settings"); + /* nodetree */ prop= RNA_def_property(srna, "node_tree", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "nodetree"); @@ -1843,6 +1903,7 @@ rna_def_material_mtex(brna); rna_def_material_strand(brna); rna_def_material_physics(brna); + rna_def_material_gameop(brna); RNA_api_material(srna); }
|