[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [49380] branches/ge_components/source/ blender/blenkernel/intern/python_component.c: Cleaning up some #ifdef WITH_PYTHON lines.

Mitchell Stokes mogurijin at gmail.com
Mon Jul 30 09:12:18 CEST 2012


Revision: 49380
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=49380
Author:   moguri
Date:     2012-07-30 07:12:18 +0000 (Mon, 30 Jul 2012)
Log Message:
-----------
Cleaning up some #ifdef WITH_PYTHON lines.

Modified Paths:
--------------
    branches/ge_components/source/blender/blenkernel/intern/python_component.c

Modified: branches/ge_components/source/blender/blenkernel/intern/python_component.c
===================================================================
--- branches/ge_components/source/blender/blenkernel/intern/python_component.c	2012-07-30 07:08:56 UTC (rev 49379)
+++ branches/ge_components/source/blender/blenkernel/intern/python_component.c	2012-07-30 07:12:18 UTC (rev 49380)
@@ -15,16 +15,10 @@
 #include "RNA_types.h"
 
 #ifdef WITH_PYTHON
-	#include "Python.h"
-#endif
+#include "Python.h"
 
-#ifndef WITH_PYTHON
-	struct PyObject;
-#endif
-
 int verify_class(PyObject *cls)
 {
-#ifdef WITH_PYTHON
 	PyObject *list, *item;
 	char *name;
 	int i;
@@ -50,7 +44,6 @@
 	}
 
 	Py_DECREF(list);
-#endif
 	return 0;
 }
 
@@ -139,8 +132,38 @@
 
 	return pyclass;
 }
-#endif
 
+PyObject *arg_dict_from_component(PythonComponent *pc)
+{
+	ComponentProperty *cprop;
+	PyObject *args= NULL, *value=NULL;
+
+	args = PyDict_New();
+
+	cprop = pc->properties.first;
+
+	while (cprop)
+	{
+		if (cprop->type == CPROP_TYPE_INT)
+			value = PyLong_FromLong(cprop->data);
+		else if (cprop->type == CPROP_TYPE_FLOAT)
+			value = PyFloat_FromDouble(*(float*)(&cprop->data));
+		else if (cprop->type == CPROP_TYPE_BOOLEAN)
+			value = PyBool_FromLong(cprop->data);
+		else if (cprop->type == CPROP_TYPE_STRING)
+			value = PyUnicode_FromString((char*)cprop->poin);
+		else
+			continue;
+
+		PyDict_SetItemString(args, cprop->name, value);
+
+		cprop= cprop->next;
+	}
+
+	return args;
+}
+#endif /* WITH_PYTHON */
+
 ComponentProperty *create_property(char *name, short type, int data, void *poin)
 {
 	ComponentProperty *cprop;
@@ -340,38 +363,6 @@
 #endif /* WITH_PYTHON */
 }
 
-PyObject *arg_dict_from_component(PythonComponent *pc)
-{
-	ComponentProperty *cprop;
-	PyObject *args= NULL, *value=NULL;
-
-#ifdef WITH_PYTHON
-	args = PyDict_New();
-
-	cprop = pc->properties.first;
-
-	while (cprop)
-	{
-		if (cprop->type == CPROP_TYPE_INT)
-			value = PyLong_FromLong(cprop->data);
-		else if (cprop->type == CPROP_TYPE_FLOAT)
-			value = PyFloat_FromDouble(*(float*)(&cprop->data));
-		else if (cprop->type == CPROP_TYPE_BOOLEAN)
-			value = PyBool_FromLong(cprop->data);
-		else if (cprop->type == CPROP_TYPE_STRING)
-			value = PyUnicode_FromString((char*)cprop->poin);
-		else
-			continue;
-
-		PyDict_SetItemString(args, cprop->name, value);
-
-		cprop= cprop->next;
-	}
-
-#endif /* WITH_PYTHON */
-	return args;
-}
-
 PythonComponent *new_component_from_import(char *import)
 {
 	PythonComponent *pc = NULL;




More information about the Bf-blender-cvs mailing list