Paste Code
Paste Blends
Paste Images
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);
}
  1. Index: release/scripts/ui/properties_material.py
  2. ===================================================================
  3. --- release/scripts/ui/properties_material.py   (revision 34588)
  4. +++ release/scripts/ui/properties_material.py   (working copy)
  5. @@ -553,7 +553,32 @@
  6.          col.prop(halo, "flare_subflare_count", text="Subflares")
  7.          col.prop(halo, "flare_subflare_size", text="Subsize")
  8.  
  9. +class MATERIAL_PT_gameop(MaterialButtonsPanel, bpy.types.Panel):
  10. +    bl_label = "Game Options"
  11. +    COMPAT_ENGINES = {'BLENDER_GAME'}
  12.  
  13. +    @classmethod
  14. +    def poll(cls, context):
  15. +         return context.material and (context.scene.render.engine in cls.COMPAT_ENGINES)
  16. +
  17. +    def draw(self, context):
  18. +         layout = self.layout
  19. +         game = context.material.game_options  # dont use node material
  20. +
  21. +         split = layout.split()
  22. +         col = split.column()
  23. +         col.prop(game, "two_side")
  24. +         col.prop(game, "shared")
  25. +         col = split.column()
  26. +         col.prop(game, "text")
  27. +
  28. +         row = layout.row()
  29. +         row.label(text="Blend Alpha:")
  30. +         row.label(text="Face Orientation:")
  31. +         row = layout.row()
  32. +         row.prop(game,"game_blend",text="")
  33. +         row.prop(game,"face_orientation",text="")
  34. +
  35.  class MATERIAL_PT_physics(MaterialButtonsPanel, bpy.types.Panel):
  36.      bl_label = "Physics"
  37.      COMPAT_ENGINES = {'BLENDER_GAME'}
  38. @@ -562,8 +587,14 @@
  39.      def poll(cls, context):
  40.          return context.material and (context.scene.render.engine in cls.COMPAT_ENGINES)
  41.  
  42. +    def draw_header(self, context):
  43. +         game = context.material.game_options
  44. +         self.layout.prop(game, "physics", text="")
  45. +
  46.      def draw(self, context):
  47.          layout = self.layout
  48. +        game = context.material.game_options
  49. +        layout.active = game.physics
  50.  
  51.          phys = context.material.physics  # dont use node material
  52.  
  53. Index: source/blender/makesdna/DNA_material_types.h
  54. ===================================================================
  55. --- source/blender/makesdna/DNA_material_types.h        (revision 34588)
  56. +++ source/blender/makesdna/DNA_material_types.h        (working copy)
  57. @@ -72,6 +72,15 @@
  58.         float ms_spread;
  59.  } VolumeSettings;
  60.  
  61. +typedef struct GameOptions {
  62. +/* Game Engine Material Options
  63. +       (Old Texface Options) */
  64. +       int game_flag;
  65. +       int game_blend;
  66. +       int game_face_ori;
  67. +       int pad1;
  68. +} GameOptions;
  69. +
  70.  typedef struct Material {
  71.         ID id;
  72.         struct AnimData *adt;   /* animation data (must be immediately after id for utilities to use it) */
  73. @@ -88,6 +97,7 @@
  74.         /* end synced with render_types.h */
  75.         
  76.         struct VolumeSettings vol;
  77. +       struct GameOptions gameopt;
  78.  
  79.         float fresnel_mir, fresnel_mir_i;
  80.         float fresnel_tra, fresnel_tra_i;
  81. @@ -163,6 +173,28 @@
  82.         ListBase gpumaterial;           /* runtime */
  83.  } Material;
  84.  
  85. +
  86. +/* Material Game Options */
  87. +// Game Options - game_flag
  88. +#define GEMAT_TwoSided 1
  89. +#define GEMAT_Shaded   2
  90. +#define GEMAT_Text             4
  91. +#define        GEMAT_Physics   8
  92. +
  93. +// Blend Transparency Options - game_blend
  94. +#define GEMAT_Opaque           0
  95. +#define GEMAT_Add                      1
  96. +#define        GEMAT_Clip                      2
  97. +#define GEMAT_Alpha                    3
  98. +#define        GEMAT_Alpha_Sort        4
  99. +
  100. +// Face Orientation Options - game_face_ori
  101. +#define GEMAT_None                     0
  102. +#define GEMAT_Halo                     1
  103. +#define GEMAT_Billboard                2
  104. +#define GEMAT_Shadow           3
  105. +
  106. +
  107.  /* **************** MATERIAL ********************* */
  108.  
  109.  /* maximum number of materials per material array.
  110. Index: source/blender/makesrna/intern/rna_material.c
  111. ===================================================================
  112. --- source/blender/makesrna/intern/rna_material.c       (revision 34588)
  113. +++ source/blender/makesrna/intern/rna_material.c       (working copy)
  114. @@ -703,6 +703,59 @@
  115.         RNA_def_property_update(prop, 0, "rna_Material_update");
  116.  }
  117.  
  118. +static void rna_def_material_gameop(BlenderRNA *brna)
  119. +{
  120. +       StructRNA *srna;
  121. +       PropertyRNA *prop;
  122. +
  123. +       static EnumPropertyItem prop_gameblend_items[] = {
  124. +               {GEMAT_Opaque, "OPAQUE", 0, "Opaque", ""},
  125. +               {GEMAT_Add, "ADD", 0, "Add", ""},
  126. +               {GEMAT_Clip, "CLIP", 0, "Alpha Clip", ""},             
  127. +               {GEMAT_Alpha, "ALPHA", 0, "Alpha Blend", ""},
  128. +               {GEMAT_Alpha_Sort, "ALPHASORT", 0, "Alpha Sort", ""},          
  129. +               {0, NULL, 0, NULL, NULL}};
  130. +
  131. +       static EnumPropertyItem prop_gameface_orientation_items[] = {
  132. +               {GEMAT_None,"NONE",0,"None",""},
  133. +               {GEMAT_Halo, "HALO", 0, "Halo", ""},
  134. +               {GEMAT_Billboard, "BILLBOARD", 0, "Billboard", ""},
  135. +               {GEMAT_Shadow, "SHADOW", 0, "Shadow", ""},             
  136. +               {0, NULL, 0, NULL, NULL}};
  137. +       
  138. +       srna= RNA_def_struct(brna, "MaterialGameOp", NULL);
  139. +       RNA_def_struct_sdna(srna, "GameOptions");
  140. +       RNA_def_struct_nested(brna, srna, "Material");
  141. +       RNA_def_struct_ui_text(srna, "Material Game Options", "Game Engine settings for a Material datablock");
  142. +       
  143. +       prop= RNA_def_property(srna, "two_side", PROP_BOOLEAN, PROP_NONE);
  144. +       RNA_def_property_boolean_sdna(prop, NULL, "game_flag", GEMAT_TwoSided); /* use bitflags */
  145. +       RNA_def_property_ui_text(prop, "Two Side", "Use two side faces in Game Engine ");
  146. +       
  147. +       prop= RNA_def_property(srna, "shared", PROP_BOOLEAN, PROP_NONE);
  148. +       RNA_def_property_boolean_sdna(prop, NULL, "game_flag", GEMAT_Shaded); /* use bitflags */
  149. +       RNA_def_property_ui_text(prop, "Shared", "Use shared faces in Game Engine ");
  150. +       
  151. +       prop= RNA_def_property(srna, "text", PROP_BOOLEAN, PROP_NONE);
  152. +       RNA_def_property_boolean_sdna(prop, NULL, "game_flag", GEMAT_Text); /* use bitflags */
  153. +       RNA_def_property_ui_text(prop, "Text", "Use material as text in Game Engine ");
  154. +       
  155. +       prop= RNA_def_property(srna, "game_blend", PROP_ENUM, PROP_NONE);
  156. +       RNA_def_property_enum_sdna(prop, NULL, "game_blend");
  157. +       RNA_def_property_enum_items(prop, prop_gameblend_items);
  158. +       RNA_def_property_ui_text(prop, "Blend Mode", "Blend Mode for Transparent Faces");
  159. +
  160. +       prop= RNA_def_property(srna, "face_orientation", PROP_ENUM, PROP_NONE);
  161. +       RNA_def_property_enum_sdna(prop, NULL, "game_face_ori");
  162. +       RNA_def_property_enum_items(prop, prop_gameface_orientation_items);
  163. +       RNA_def_property_ui_text(prop, "Face Orientations", "Especial face orientation options");
  164. +
  165. +       prop= RNA_def_property(srna, "physics", PROP_BOOLEAN, PROP_NONE);
  166. +       RNA_def_property_boolean_negative_sdna(prop, NULL, "game_flag", GEMAT_Physics); /* use bitflags */
  167. +       RNA_def_property_ui_text(prop, "Physics", "Use physics properties of materials ");
  168. +       
  169. +}
  170. +
  171.  static void rna_def_material_colors(StructRNA *srna)
  172.  {
  173.         PropertyRNA *prop;
  174. @@ -1800,6 +1853,13 @@
  175.         RNA_def_property_pointer_funcs(prop, "rna_Material_physics_get", NULL, NULL, NULL);
  176.         RNA_def_property_ui_text(prop, "Physics", "Game physics settings");
  177.  
  178. +       /* game ops */
  179. +       prop= RNA_def_property(srna, "game_options", PROP_POINTER, PROP_NONE);
  180. +       RNA_def_property_flag(prop, PROP_NEVER_NULL);
  181. +       RNA_def_property_pointer_sdna(prop, NULL, "gameopt");
  182. +       RNA_def_property_struct_type(prop, "MaterialGameOp");
  183. +       RNA_def_property_ui_text(prop, "Game Options", "Game material settings");
  184. +
  185.         /* nodetree */
  186.         prop= RNA_def_property(srna, "node_tree", PROP_POINTER, PROP_NONE);
  187.         RNA_def_property_pointer_sdna(prop, NULL, "nodetree");
  188. @@ -1843,6 +1903,7 @@
  189.         rna_def_material_mtex(brna);
  190.         rna_def_material_strand(brna);
  191.         rna_def_material_physics(brna);
  192. +       rna_def_material_gameop(brna);
  193.  
  194.         RNA_api_material(srna);
  195.  }
  196.  
go to heaven