[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [31136] branches/soc-2010-moguri-2/source: Updating PyDoc for the new Shader and Uniform types.

Mitchell Stokes mogurijin at gmail.com
Sat Aug 7 08:00:20 CEST 2010


Revision: 31136
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=31136
Author:   moguri
Date:     2010-08-07 08:00:19 +0200 (Sat, 07 Aug 2010)

Log Message:
-----------
Updating PyDoc for the new Shader and Uniform types. Also, I've added uniform type constants to bge.logic.

Modified Paths:
--------------
    branches/soc-2010-moguri-2/source/blender/makesdna/DNA_material_types.h
    branches/soc-2010-moguri-2/source/gameengine/Ketsji/KX_PythonInit.cpp
    branches/soc-2010-moguri-2/source/gameengine/PyDoc/bge.types.rst

Modified: branches/soc-2010-moguri-2/source/blender/makesdna/DNA_material_types.h
===================================================================
--- branches/soc-2010-moguri-2/source/blender/makesdna/DNA_material_types.h	2010-08-07 05:48:28 UTC (rev 31135)
+++ branches/soc-2010-moguri-2/source/blender/makesdna/DNA_material_types.h	2010-08-07 06:00:19 UTC (rev 31136)
@@ -240,7 +240,7 @@
 #define MA_UNF_IVEC2	6
 #define MA_UNF_IVEC3	7
 #define MA_UNF_IVEC4	8
-#define MA_UNF_MAT		9
+#define MA_UNF_MAT		9 /* Not yet implemented */
 #define MA_UNF_SAMPLER2D 10
 
 /* mode (is int) */

Modified: branches/soc-2010-moguri-2/source/gameengine/Ketsji/KX_PythonInit.cpp
===================================================================
--- branches/soc-2010-moguri-2/source/gameengine/Ketsji/KX_PythonInit.cpp	2010-08-07 05:48:28 UTC (rev 31135)
+++ branches/soc-2010-moguri-2/source/gameengine/Ketsji/KX_PythonInit.cpp	2010-08-07 06:00:19 UTC (rev 31136)
@@ -106,6 +106,9 @@
 #include "DNA_ID.h"
 #include "DNA_scene_types.h"
 
+/* for KX_PythonUniform type constants */
+#include "DNA_material_types.h"
+
 #include "PHY_IPhysicsEnvironment.h"
 #include "BKE_main.h"
 #include "BKE_utildefines.h"
@@ -1579,6 +1582,17 @@
 	KX_MACRO_addTypesToDict(d, ROT_MODE_ZXY, ROT_MODE_ZXY);
 	KX_MACRO_addTypesToDict(d, ROT_MODE_ZYX, ROT_MODE_ZYX);
 
+	/* KX_PythonUniform type */
+	KX_MACRO_addTypesToDict(d, MA_UNF_FLOAT, MA_UNF_FLOAT);
+	KX_MACRO_addTypesToDict(d, MA_UNF_VEC2, MA_UNF_VEC2);
+	KX_MACRO_addTypesToDict(d, MA_UNF_VEC3, MA_UNF_VEC3);
+	KX_MACRO_addTypesToDict(d, MA_UNF_VEC4, MA_UNF_VEC4);
+	KX_MACRO_addTypesToDict(d, MA_UNF_INT, MA_UNF_INT);
+	KX_MACRO_addTypesToDict(d, MA_UNF_IVEC2, MA_UNF_IVEC2);
+	KX_MACRO_addTypesToDict(d, MA_UNF_IVEC3, MA_UNF_IVEC3);
+	KX_MACRO_addTypesToDict(d, MA_UNF_IVEC4, MA_UNF_IVEC4);
+	KX_MACRO_addTypesToDict(d, MA_UNF_SAMPLER2D, MA_UNF_SAMPLER2D);
+
 	// Check for errors
 	if (PyErr_Occurred())
     {

Modified: branches/soc-2010-moguri-2/source/gameengine/PyDoc/bge.types.rst
===================================================================
--- branches/soc-2010-moguri-2/source/gameengine/PyDoc/bge.types.rst	2010-08-07 05:48:28 UTC (rev 31135)
+++ branches/soc-2010-moguri-2/source/gameengine/PyDoc/bge.types.rst	2010-08-07 06:00:19 UTC (rev 31136)
@@ -715,6 +715,63 @@
       :return: the material's index
       :rtype: integer
 
+.. class:: Shader(PyObject_Plus)
+   Python object for handling Blender shaders
+   
+   .. attribute:: vertex
+      
+	  The vertex shader source.
+	  
+	  :type: string
+	  
+   .. attribute:: geometry
+      
+	  The geometry shader source.
+	  
+	  :type: string
+	  
+   .. attribute:: fragment
+   
+      The fragment shader source.
+	  
+	  :type: string
+	  
+   .. attribute:: uniforms
+   
+      A list of uniforms attached to the shader
+	  
+	  :type: list of :class:`Uniform`
+	  
+   .. method:: addUniform(uniform)
+      
+	  :arg uniform: The uniform to add
+	  :type uniform: :class:`Uniform`
+	  
+.. class:: Uniform(PyObject_Plus)
+   Python object for handling custom uniform values for Blender shaders
+   
+   .. attribute:: name
+   
+      The name of the uniform as it will appear in the shader
+	  
+	  :type: string
+	  
+   .. attribute:: type
+   
+      The type of the uniform
+	  
+	  :type: Value in...
+
+         * MA_UNF_FLOAT
+		 * MA_UNF_VEC2
+		 * MA_UNF_VEC3
+		 * MA_UNF_VEC4
+		 * MA_UNF_INT
+		 * MA_UNF_IVEC2
+		 * MA_UNF_IVEC3
+		 * MA_UNF_IVEC4
+		 * MA_UNF_SAMPLER2D
+	  
 .. class:: KX_CameraActuator(SCA_IActuator)
 
    Applies changes to a camera.





More information about the Bf-blender-cvs mailing list