Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichel Selten <michel@mselten.demon.nl>2003-07-27 19:56:32 +0400
committerMichel Selten <michel@mselten.demon.nl>2003-07-27 19:56:32 +0400
commit916f527253e737b5bd31a0358828b719d251653d (patch)
tree44d99be0f35a744e77450bf29ebfe3a1e6e9fbee /source/blender/python/api2_2x/Material.c
parent2222fc716812cfd2a5fab4d1a8eb6f775fced1dc (diff)
* Fixed problems in with script linking.
I had to update many files to get this to work.
Diffstat (limited to 'source/blender/python/api2_2x/Material.c')
-rw-r--r--source/blender/python/api2_2x/Material.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/source/blender/python/api2_2x/Material.c b/source/blender/python/api2_2x/Material.c
index 28317600bbd..ee66097994f 100644
--- a/source/blender/python/api2_2x/Material.c
+++ b/source/blender/python/api2_2x/Material.c
@@ -584,6 +584,32 @@ int Material_CheckPyObject (PyObject *pyobj)
}
/*****************************************************************************/
+/* Description: Returns the object with the name specified by the argument */
+/* name. Note that the calling function has to remove the first */
+/* two characters of the object name. These two characters */
+/* specify the type of the object (OB, ME, WO, ...) */
+/* The function will return NULL when no object with the given */
+/* name is found. */
+/*****************************************************************************/
+Material * GetMaterialByName (char * name)
+{
+ Material * mat_iter;
+
+ mat_iter = G.main->mat.first;
+ while (mat_iter)
+ {
+ if (StringEqual (name, GetIdName (&(mat_iter->id))))
+ {
+ return (mat_iter);
+ }
+ mat_iter = mat_iter->id.next;
+ }
+
+ /* There is no material with the given name */
+ return (NULL);
+}
+
+/*****************************************************************************/
/* Python BPy_Material methods: */
/*****************************************************************************/
static PyObject *Material_getName(BPy_Material *self)