Skip to content
Snippets Groups Projects
World.c 31.4 KiB
Newer Older
  • Learn to ignore specific revisions
  • 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000
    /* 
     *
     * ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
     *
     * This program is free software; you can redistribute it and/or
     * modify it under the terms of the GNU General Public License
     * as published by the Free Software Foundation; either version 2
     * of the License, or (at your option) any later version. The Blender
     * Foundation also sells licenses for use in proprietary software under
     * the Blender License.  See http://www.blender.org/BL/ for information
     * about this.
     *
     * This program is distributed in the hope that it will be useful,
     * but WITHOUT ANY WARRANTY; without even the implied warranty of
     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     * GNU General Public License for more details.
     *
     * You should have received a copy of the GNU General Public License
     * along with this program; if not, write to the Free Software Foundation,
     * Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
     *
     * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
     * All rights reserved.
     *
     * This is a new part of Blender.
     *
     * Contributor(s): Jacques Guignot
     *
     * ***** END GPL/BL DUAL LICENSE BLOCK *****
    */
    
    /**
     * \file World.c
     * \ingroup scripts
     * \brief Blender.World Module and World Data PyObject implementation.
     *
     * Note: Parameters between "<" and ">" are optional.  But if one of them is
     * given, all preceding ones must be given, too.  Of course, this only relates
     * to the Python functions and methods described here and only inside Python
     * code. [ This will go to another file later, probably the main exppython
     * doc file].  XXX Better: put optional args with their default value:
     * (self, name = "MyName")
     */
    
    #include <BKE_main.h>
    #include <BKE_global.h>
    #include <BKE_object.h>
    #include <BKE_library.h>
    #include <BLI_blenlib.h>
    
    #include "World.h"
    
    
    /*****************************************************************************/
    /* Python API function prototypes for the World module.                     */
    /*****************************************************************************/
    static PyObject *M_World_New (PyObject *self, PyObject *args,
                                   PyObject *keywords);
    static PyObject *M_World_Get (PyObject *self, PyObject *args);
    
    /*****************************************************************************/
    /* The following string definitions are used for documentation strings.      */
    /* In Python these will be written to the console when doing a               */
    /* Blender.World.__doc__                                                    */
    /*****************************************************************************/
    static char M_World_doc[] =
    "The Blender World module\n\n\
    This module provides access to **World Data** objects in Blender\n\n\
    Example::\n\n\
      from Blender import World, Object, Scene\n\
      c = World.New('ortho')      # create new ortho world data\n\
      c.lens = 35.0                # set lens value\n\
      cur = Scene.getCurrent()     # get current Scene\n\
      ob = Object.New('World')    # make world object\n\
      ob.link(c)                   # link world data with this object\n\
      cur.link(ob)                 # link object into scene\n\
      cur.setCurrentWorld(ob)     # make this world the active\n";
    
    static char M_World_New_doc[] =
    "(type) - return a new World object of type \"type\", \
    which can be 'persp' or 'ortho'.\n\
    () - return a new World object of type 'persp'.";
    
    static char M_World_Get_doc[] =
    "(name) - return the world with the name 'name', \
    returns None if not found.\n If 'name' is not specified, \
    it returns a list of all worlds in the\ncurrent scene.";
    
    /*****************************************************************************/
    /* Python method structure definition for Blender.World module:              */
    /*****************************************************************************/
    struct PyMethodDef M_World_methods[] = {
      {"New",(PyCFunction)M_World_New, METH_VARARGS|METH_KEYWORDS,M_World_New_doc},
      {"Get",         M_World_Get,         METH_VARARGS, M_World_Get_doc},
      {"get",         M_World_Get,         METH_VARARGS, M_World_Get_doc},
      {NULL, NULL, 0, NULL}
    };
    
    /*****************************************************************************/
    /* Python C_World methods declarations:                                   */
    /*****************************************************************************/
    static PyObject *World_getName(C_World *self);
    static PyObject *World_setName(C_World *self, PyObject *args);
    static PyObject *World_getColormodel(C_World *self);
    static PyObject *World_setColormodel(C_World *self, PyObject *args );
    static PyObject *World_getFastcol(C_World *self);
    static PyObject *World_setFastcol(C_World *self, PyObject *args );
    static PyObject *World_getSkytype(C_World *self);
    static PyObject *World_setSkytype(C_World *self, PyObject *args );
    static PyObject *World_getMode(C_World *self);
    static PyObject *World_setMode(C_World *self, PyObject *args );
    static PyObject *World_getTotex(C_World *self);
    static PyObject *World_setTotex(C_World *self, PyObject *args );
    static PyObject *World_getTexact(C_World *self);
    static PyObject *World_setTexact(C_World *self, PyObject *args );
    static PyObject *World_getMistype(C_World *self);
    static PyObject *World_setMistype(C_World *self, PyObject *args );
    static PyObject *World_getHor(C_World *self);
    static PyObject *World_setHor(C_World *self, PyObject *args );
    static PyObject *World_getZen(C_World *self);
    static PyObject *World_setZen(C_World *self, PyObject *args );
    static PyObject *World_getAmb(C_World *self);
    static PyObject *World_setAmb(C_World *self, PyObject *args );
    static PyObject *World_getStar(C_World *self);
    static PyObject *World_setStar(C_World *self, PyObject *args );
    static PyObject *World_getDof(C_World *self);
    static PyObject *World_setDof(C_World *self, PyObject *args );
    static PyObject *World_getMist(C_World *self);
    static PyObject *World_setMist(C_World *self, PyObject *args );
    
    /*****************************************************************************/
    /* Python C_World methods table:                                          */
    /*****************************************************************************/
    static PyMethodDef C_World_methods[] = {
      {"getName", (PyCFunction)World_getName, METH_NOARGS,
          "() - Return World Data name"},
      {"setName", (PyCFunction)World_setName, METH_VARARGS,
          "() - Return World Data name"},
      {"getColormodel", (PyCFunction)World_getColormodel, METH_NOARGS,
          "() - Return World Data colormodel"},
      {"setColormodel", (PyCFunction)World_setColormodel, METH_VARARGS,
          "() - Return World Data colormodel"},
      {"getFastcol", (PyCFunction)World_getFastcol, METH_NOARGS,
          "() - Return World Data fastcol"},
      {"setFastcol", (PyCFunction)World_setFastcol, METH_VARARGS,
          "() - Return World Data fastcol"},
      {"getSkytype", (PyCFunction)World_getSkytype, METH_NOARGS,
          "() - Return World Data skytype"},
      {"setSkytype", (PyCFunction)World_setSkytype, METH_VARARGS,
          "() - Return World Data skytype"},
      {"getMode", (PyCFunction)World_getMode, METH_NOARGS,
          "() - Return World Data mode"},
      {"setMode", (PyCFunction)World_setMode, METH_VARARGS,
          "() - Return World Data mode"},
      {"getTotex", (PyCFunction)World_getTotex, METH_NOARGS,
          "() - Return World Data totex"},
      {"setTotex", (PyCFunction)World_setTotex, METH_VARARGS,
          "() - Return World Data totex"},
      {"getTexact", (PyCFunction)World_getTexact, METH_NOARGS,
          "() - Return World Data texact"},
      {"setTexact", (PyCFunction)World_setTexact, METH_VARARGS,
          "() - Return World Data texact"},
      {"getMistype", (PyCFunction)World_getMistype, METH_NOARGS,
          "() - Return World Data mistype"},
      {"setMistype", (PyCFunction)World_setMistype, METH_VARARGS,
          "() - Return World Data mistype"},
      {"getHor", (PyCFunction)World_getHor, METH_NOARGS,
          "() - Return World Data hor"},
      {"setHor", (PyCFunction)World_setHor, METH_VARARGS,
          "() - Return World Data hor"},
      {"getZen", (PyCFunction)World_getZen, METH_NOARGS,
          "() - Return World Data zen"},
      {"setZen", (PyCFunction)World_setZen, METH_VARARGS,
          "() - Return World Data zen"},
      {"getAmb", (PyCFunction)World_getAmb, METH_NOARGS,
          "() - Return World Data amb"},
      {"setAmb", (PyCFunction)World_setAmb, METH_VARARGS,
          "() - Return World Data amb"},
      {"getStar", (PyCFunction)World_getStar, METH_NOARGS,
          "() - Return World Data star"},
      {"setStar", (PyCFunction)World_setStar, METH_VARARGS,
          "() - Return World Data star"},
      {"getDof", (PyCFunction)World_getDof, METH_NOARGS,
          "() - Return World Data dof"},
      {"setDof", (PyCFunction)World_setDof, METH_VARARGS,
          "() - Return World Data dof"},
      {"getMist", (PyCFunction)World_getMist, METH_NOARGS,
          "() - Return World Data mist"},
      {"setMist", (PyCFunction)World_setMist, METH_VARARGS,
          "() - Return World Data mist"},
      {0}
    };
    
    /*****************************************************************************/
    /* Python World_Type callback function prototypes:                          */
    /*****************************************************************************/
    static void World_DeAlloc (C_World *self);
    static int World_Print (C_World *self, FILE *fp, int flags);
    static int World_SetAttr (C_World *self, char *name, PyObject *v);
    static int World_Compare (C_World *a, C_World *b);
    static PyObject *World_GetAttr (C_World *self, char *name);
    static PyObject *World_Repr (C_World *self);
    
    /*****************************************************************************/
    /* Python World_Type structure definition:                                  */
    /*****************************************************************************/
    PyTypeObject World_Type =
    {
      PyObject_HEAD_INIT(NULL)
      0,                                      /* ob_size */
      "World",                               /* tp_name */
      sizeof (C_World),                    /* tp_basicsize */
      0,                                      /* tp_itemsize */
      /* methods */
      (destructor)World_DeAlloc,             /* tp_dealloc */
      (printfunc)World_Print,                /* tp_print */
      (getattrfunc)World_GetAttr,            /* tp_getattr */
      (setattrfunc)World_SetAttr,            /* tp_setattr */
      (cmpfunc)World_Compare,                /* tp_compare */
      (reprfunc)World_Repr,                  /* tp_repr */
      0,                                      /* tp_as_number */
      0,                                      /* tp_as_sequence */
      0,                                      /* tp_as_mapping */
      0,                                      /* tp_as_hash */
      0,0,0,0,0,0,
      0,                                      /* tp_doc */ 
      0,0,0,0,0,0,
      C_World_methods,                     /* tp_methods */
      0,                                      /* tp_members */
    };
    
    /**
     * \defgroup World_Module Blender.World module functions
     *
     */
    
    /*@{*/
    
    /**
     * \brief Python module function: Blender.World.New()
     *
     * This is the .New() function of the Blender.World submodule. It creates
     * new World Data in Blender and returns its Python wrapper object.  The
     * name parameter is mandatory.
     * \param <name> - string: The World Data name.
     * \return A new World PyObject.
     */
    
    static PyObject *M_World_New(PyObject *self, PyObject *args, PyObject *kwords)
    {
    
    	World *add_world(char *name);
    	char*name = NULL;
      C_World    *pyworld;
      World      *blworld;
    
    	if (!PyArg_ParseTuple(args, "s", &name))
        return (EXPP_ReturnPyObjError (PyExc_TypeError,
    																	 "expected  int argument"));
    
    
      blworld = add_world(name);
    
      if (blworld) 
    		pyworld = (C_World *)PyObject_NEW(C_World, &World_Type);
      else
        return (EXPP_ReturnPyObjError (PyExc_RuntimeError,
    																	 "couldn't create World Data in Blender"));
    
      if (pyworld == NULL)
        return (EXPP_ReturnPyObjError (PyExc_MemoryError,
    																	 "couldn't create World Data object"));
    
      pyworld->world = blworld; 
    
      return (PyObject *)pyworld;
    }
    
    /**
     * \brief Python module function: Blender.World.Get()
     *
     * This is the .Get() function of the Blender.World submodule.  It searches
     * the list of current World Data objects and returns a Python wrapper for
     * the one with the name provided by the user.  If called with no arguments,
     * it returns a list of all current World Data object names in Blender.
     * \param <name> - string: The name of an existing Blender World Data object.
     * \return () - A list with the names of all current World Data objects;\n
     * \return (name) - A Python wrapper for the World Data called 'name'
     * in Blender.
     */
    
    static PyObject *M_World_Get(PyObject *self, PyObject *args)
    {
    
      char   *name = NULL;
      World *world_iter;
      PyObject *worldlist;
      C_World *wanted_world = NULL;
      char error_msg[64];
    
    	if (!PyArg_ParseTuple(args, "|s", &name))
        return (EXPP_ReturnPyObjError (PyExc_TypeError,
    																	 "expected string argument (or nothing)"));
    
      world_iter = G.main->world.first;
    
    	if (name) { /* (name) - Search world by name */
        while ((world_iter) && (wanted_world == NULL)) {
          if (strcmp (name, world_iter->id.name+2) == 0) {
            wanted_world = (C_World *)PyObject_NEW(C_World, &World_Type);
    				if (wanted_world) wanted_world->world = world_iter;
          }
          world_iter = world_iter->id.next;
        }
    
        if (wanted_world == NULL) { /* Requested world doesn't exist */
          PyOS_snprintf(error_msg, sizeof(error_msg),
    										"World \"%s\" not found", name);
          return (EXPP_ReturnPyObjError (PyExc_NameError, error_msg));
        }
    
        return (PyObject *)wanted_world;
    	}
    
    	else { /* return a list of all worlds in the scene */
        worldlist = PyList_New (0);
        if (worldlist == NULL)
          return (PythonReturnErrorObject (PyExc_MemoryError,
    																			 "couldn't create PyList"));
    
    		while (world_iter) {
    			C_World *found_world = (C_World *)PyObject_NEW(C_World, &World_Type);
    			found_world->world = world_iter;
    			PyList_Append (worldlist ,  (PyObject *)found_world); 
    
          world_iter = world_iter->id.next;
    		}
    		return (worldlist);
    	}
    
    }
    /*@}*/
    
    /**
     * \brief Initializes the Blender.World submodule
     *
     * This function is used by Blender_Init() in Blender.c to register the
     * Blender.World submodule in the main Blender module.
     * \return PyObject*: The initialized submodule.
     */
    
    PyObject *M_World_Init (void)
    {
      PyObject  *submodule;
    
      printf ("In M_World_Init()\n");
    
      World_Type.ob_type = &PyType_Type;
    
      submodule = Py_InitModule3("Blender.World",
                      M_World_methods, M_World_doc);
    
      return (submodule);
    }
    
    
    /*****************************************************************************/
    /* Python C_World methods:                                                */
    /*****************************************************************************/
    
    /**
     * \defgroup World_Methods World Method Functions
     *
     * These are the World PyObject method functions.  They are used to get and
     * set values for the World Data member variables.
     */
    
    /*@{*/
    
    /**
     * \brief World PyMethod getName
     *
     * \return string: The World Data name.
     */
    
    static PyObject *World_getName(C_World *self)
    {
      PyObject *attr = PyString_FromString(self->world->id.name+2);
    
      if (attr) return attr;
    
      return (EXPP_ReturnPyObjError (PyExc_RuntimeError,
                                       "couldn't get World.name attribute"));
    }
    /**
     * \brief World PyMethod setName
     * \param name - string: The new World Data name.
     */
    
    static PyObject *World_setName(C_World *self, PyObject *args)
    {
      char *name = 0;
      char buf[21];
    	puts("mlmlml");
      if (!PyArg_ParseTuple(args, "s", &name))
        return (EXPP_ReturnPyObjError (PyExc_TypeError,
                                         "expected string argument"));
    	puts(name);
      snprintf(buf, sizeof(buf), "%s", name);
    
    	puts("mlmlml");
      rename_id(&self->world->id, buf);
    
      Py_INCREF(Py_None);
      return Py_None;
    }
    
    
    /**
     * \brief World PyMethod getColormodel
     *
     * \return int : The World Data colormodel.
     */
    
    static PyObject *World_getColormodel(C_World *self)
    {
      PyObject *attr = PyInt_FromLong((long)self->world->colormodel);
    
      if (attr) return attr;
    
      return (EXPP_ReturnPyObjError (PyExc_RuntimeError,
                                       "couldn't get World.colormodel attribute"));
    }
    
    
    /**
     * \brief World PyMethod setColormodel
     *
     * \return int : The World Data colormodel.
     */
    
    static PyObject *World_setColormodel(C_World *self, PyObject *args )
    {
      int colormodel;
    
      if (!PyArg_ParseTuple(args, "i", &colormodel))
        return (EXPP_ReturnPyObjError (PyExc_TypeError,
                                         "expected int argument"));
    	self->world->colormodel = colormodel;
      Py_INCREF(Py_None);
      return Py_None;
    }
    
    /**
     * \brief World PyMethod getFastcol
     *
     * \return int : The World Data fastcol.
     */
    
    static PyObject *World_getFastcol(C_World *self)
    {
      PyObject *attr = PyInt_FromLong((long)self->world->fastcol);
    
      if (attr) return attr;
    
      return (EXPP_ReturnPyObjError (PyExc_RuntimeError,
                                       "couldn't get World.fastcol attribute"));
    }
    
    
    /**
     * \brief World PyMethod setFastcol
     *
     * \return int : The World Data fastcol.
     */
    
    static PyObject *World_setFastcol(C_World *self, PyObject *args )
    {
      int fastcol;
    
      if (!PyArg_ParseTuple(args, "i", &fastcol))
        return (EXPP_ReturnPyObjError (PyExc_TypeError,
                                         "expected int argument"));
    	self->world->fastcol = fastcol;
      Py_INCREF(Py_None);
      return Py_None;
    }
    
    
    
    
    /**
     * \brief World PyMethod getSkytype
     *
     * \return int : The World Data skytype.
     */
    
    static PyObject *World_getSkytype(C_World *self)
    {
      PyObject *attr = PyInt_FromLong((long)self->world->skytype);
    
      if (attr) return attr;
    
      return (EXPP_ReturnPyObjError (PyExc_RuntimeError,
                                       "couldn't get World.skytype attribute"));
    }
    
    
    /**
     * \brief World PyMethod setSkytype
     *
     * \return int : The World Data skytype.
     */
    
    static PyObject *World_setSkytype(C_World *self, PyObject *args )
    {
      int skytype;
    
      if (!PyArg_ParseTuple(args, "i", &skytype))
        return (EXPP_ReturnPyObjError (PyExc_TypeError,
                                         "expected int argument"));
    	self->world->skytype = skytype;
      Py_INCREF(Py_None);
      return Py_None;
    }
    
    
    /**
     * \brief World PyMethod getMode
     *
     * \return int : The World Data mode.
     */
    
    static PyObject *World_getMode(C_World *self)
    {
      PyObject *attr = PyInt_FromLong((long)self->world->mode);
    
      if (attr) return attr;
    
      return (EXPP_ReturnPyObjError (PyExc_RuntimeError,
                                       "couldn't get World.mode attribute"));
    }
    
    
    /**
     * \brief World PyMethod setMode
     *
     * \return int : The World Data mode.
     */
    
    static PyObject *World_setMode(C_World *self, PyObject *args )
    {
      int mode;
    
      if (!PyArg_ParseTuple(args, "i", &mode))
        return (EXPP_ReturnPyObjError (PyExc_TypeError,
                                         "expected int argument"));
    	self->world->mode = mode;
      Py_INCREF(Py_None);
      return Py_None;
    }
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    /**
     * \brief World PyMethod getTotex
     *
     * \return int : The World Data totex.
     */
    
    static PyObject *World_getTotex(C_World *self)
    {
      PyObject *attr = PyInt_FromLong((long)self->world->totex);
    
      if (attr) return attr;
    
      return (EXPP_ReturnPyObjError (PyExc_RuntimeError,
                                       "couldn't get World.totex attribute"));
    }
    
    
    /**
     * \brief World PyMethod setTotex
     *
     * \return int : The World Data totex.
     */
    
    static PyObject *World_setTotex(C_World *self, PyObject *args )
    {
      int totex;
    
      if (!PyArg_ParseTuple(args, "i", &totex))
        return (EXPP_ReturnPyObjError (PyExc_TypeError,
                                         "expected int argument"));
    	self->world->totex = totex;
      Py_INCREF(Py_None);
      return Py_None;
    }
    
    /**
     * \brief World PyMethod getTexact
     *
     * \return int : The World Data texact.
     */
    
    static PyObject *World_getTexact(C_World *self)
    {
      PyObject *attr = PyInt_FromLong((long)self->world->texact);
    
      if (attr) return attr;
    
      return (EXPP_ReturnPyObjError (PyExc_RuntimeError,
                                       "couldn't get World.texact attribute"));
    }
    
    
    /**
     * \brief World PyMethod setTexact
     *
     * \return int : The World Data texact.
     */
    
    static PyObject *World_setTexact(C_World *self, PyObject *args )
    {
      int texact;
    
      if (!PyArg_ParseTuple(args, "i", &texact))
        return (EXPP_ReturnPyObjError (PyExc_TypeError,
                                         "expected int argument"));
    	self->world->texact = texact;
      Py_INCREF(Py_None);
      return Py_None;
    }
    
    /**
     * \brief World PyMethod getMistype
     *
     * \return int : The World Data mistype.
     */
    
    static PyObject *World_getMistype(C_World *self)
    {
      PyObject *attr = PyInt_FromLong((long)self->world->mistype);
    
      if (attr) return attr;
    
      return (EXPP_ReturnPyObjError (PyExc_RuntimeError,
                                       "couldn't get World.mistype attribute"));
    }
    
    
    /**
     * \brief World PyMethod setMistype
     *
     * \return int : The World Data mistype.
     */
    
    static PyObject *World_setMistype(C_World *self, PyObject *args )
    {
      int mistype;
    
      if (!PyArg_ParseTuple(args, "i", &mistype))
        return (EXPP_ReturnPyObjError (PyExc_TypeError,
                                         "expected int argument"));
    	self->world->mistype = mistype;
      Py_INCREF(Py_None);
      return Py_None;
    }
    
    
    
    
    
    
    
    
    
    static PyObject *World_getHor(C_World *self)
    {
      PyObject *attr = PyList_New(0);
    	if (!attr)
    		return (EXPP_ReturnPyObjError (PyExc_RuntimeError,
                                       "couldn't create list"));
    	PyList_Append(attr, PyFloat_FromDouble(self->world->horr));
    	PyList_Append(attr, PyFloat_FromDouble(self->world->horg));
    	PyList_Append(attr, PyFloat_FromDouble(self->world->horb));
    	return attr;
    }
    
    
    static PyObject *World_setHor(C_World *self, PyObject *args )
    {
    	PyObject *listargs=0;
      if (!PyArg_ParseTuple(args, "O", &listargs))
        return (EXPP_ReturnPyObjError (PyExc_TypeError,
    																	 "expected list argument"));
    	self->world->horr =  PyFloat_AsDouble(PyList_GetItem(listargs,0));
    	self->world->horg =  PyFloat_AsDouble(PyList_GetItem(listargs,1));
    	self->world->horb = PyFloat_AsDouble(PyList_GetItem(listargs,2));
    	Py_INCREF(Py_None);
    	return Py_None;
    }
    
    
    static PyObject *World_getZen(C_World *self)
    {
      PyObject *attr = PyList_New(0);
    	if (!attr)
    		return (EXPP_ReturnPyObjError (PyExc_RuntimeError,
                                       "couldn't create list"));
    	PyList_Append(attr, PyFloat_FromDouble(self->world->zenr));
    	PyList_Append(attr, PyFloat_FromDouble(self->world->zeng));
    	PyList_Append(attr, PyFloat_FromDouble(self->world->zenb));
    	return attr;
    }
    
    
    static PyObject *World_setZen(C_World *self, PyObject *args )
    {
    	PyObject *listargs=0;
      if (!PyArg_ParseTuple(args, "O", &listargs))
        return (EXPP_ReturnPyObjError (PyExc_TypeError,
    																	 "expected list argument"));
    	self->world->zenr =  PyFloat_AsDouble(PyList_GetItem(listargs,0));
    	self->world->zeng =  PyFloat_AsDouble(PyList_GetItem(listargs,1));
    	self->world->zenb = PyFloat_AsDouble(PyList_GetItem(listargs,2));
    	Py_INCREF(Py_None);
    	return Py_None;
    }
    
    
    
    
    static PyObject *World_getAmb(C_World *self)
    {
      PyObject *attr = PyList_New(0);
    	if (!attr)
    		return (EXPP_ReturnPyObjError (PyExc_RuntimeError,
                                       "couldn't create list"));
    	PyList_Append(attr, PyFloat_FromDouble(self->world->ambr));
    	PyList_Append(attr, PyFloat_FromDouble(self->world->ambg));
    	PyList_Append(attr, PyFloat_FromDouble(self->world->ambb));
    	return attr;
    }
    
    
    static PyObject *World_setAmb(C_World *self, PyObject *args )
    {
    	PyObject *listargs=0;
      if (!PyArg_ParseTuple(args, "O", &listargs))
        return (EXPP_ReturnPyObjError (PyExc_TypeError,"expected list argument"));
    	if (!PyList_Check(listargs))
        return (EXPP_ReturnPyObjError (PyExc_TypeError,"expected list argument"));
    	if (PyList_Size(listargs)!=3)
        return (EXPP_ReturnPyObjError (PyExc_TypeError,"wrong list size"));
    	self->world->ambr =  PyFloat_AsDouble(PyList_GetItem(listargs,0));
    	self->world->ambg =  PyFloat_AsDouble(PyList_GetItem(listargs,1));
    	self->world->ambb = PyFloat_AsDouble(PyList_GetItem(listargs,2));
    	Py_INCREF(Py_None);
    	return Py_None;
    }
    
    
    static PyObject *World_getStar(C_World *self)
    {
      PyObject *attr = PyList_New(0);
    	if (!attr)
    		return (EXPP_ReturnPyObjError (PyExc_RuntimeError,"couldn't create list"));
    	PyList_Append(attr, PyFloat_FromDouble(self->world->starr));
    	PyList_Append(attr, PyFloat_FromDouble(self->world->starg));
    	PyList_Append(attr, PyFloat_FromDouble(self->world->starb));
    	PyList_Append(attr, PyFloat_FromDouble(self->world->starsize));
    	PyList_Append(attr, PyFloat_FromDouble(self->world->starmindist));
    	PyList_Append(attr, PyFloat_FromDouble(self->world->stardist));
    	PyList_Append(attr, PyFloat_FromDouble(self->world->starcolnoise));
    	return attr;
    }
    
    
    static PyObject *World_setStar(C_World *self, PyObject *args )
    {
    	PyObject *listargs=0;
      if (!PyArg_ParseTuple(args, "O", &listargs))
        return (EXPP_ReturnPyObjError (PyExc_TypeError,"expected list argument"));
    	if (!PyList_Check(listargs))
        return (EXPP_ReturnPyObjError (PyExc_TypeError,"expected list argument"));
    	if (PyList_Size(listargs)!=7)
        return (EXPP_ReturnPyObjError (PyExc_TypeError,"wrong list size"));
    	self->world->starr =  PyFloat_AsDouble(PyList_GetItem(listargs,0));
    	self->world->starg =  PyFloat_AsDouble(PyList_GetItem(listargs,1));
    	self->world->starb = PyFloat_AsDouble(PyList_GetItem(listargs,2));
    	self->world->starsize = PyFloat_AsDouble(PyList_GetItem(listargs,3));
    	self->world->starmindist = PyFloat_AsDouble(PyList_GetItem(listargs,4));
    	self->world->stardist = PyFloat_AsDouble(PyList_GetItem(listargs,5));
    	self->world->starcolnoise = PyFloat_AsDouble(PyList_GetItem(listargs,6));
    	Py_INCREF(Py_None);
    	return Py_None;
    }
    
    
    
    static PyObject *World_getDof(C_World *self)
    {
      PyObject *attr = PyList_New(0);
    	if (!attr)
    		return (EXPP_ReturnPyObjError (PyExc_RuntimeError, "couldn't create list"));
    	PyList_Append(attr, PyFloat_FromDouble(self->world->dofsta));
    	PyList_Append(attr, PyFloat_FromDouble(self->world->dofend));
    	PyList_Append(attr, PyFloat_FromDouble(self->world->dofmin));
    	PyList_Append(attr, PyFloat_FromDouble(self->world->dofmax));
    	return attr;
    }
    
    
    static PyObject *World_setDof(C_World *self, PyObject *args )
    {
    	PyObject *listargs=0;
      if (!PyArg_ParseTuple(args, "O", &listargs))
        return (EXPP_ReturnPyObjError (PyExc_TypeError,"expected list argument"));
    	if (!PyList_Check(listargs))
        return (EXPP_ReturnPyObjError (PyExc_TypeError,"expected list argument"));
    	if (PyList_Size(listargs)!=4)
        return (EXPP_ReturnPyObjError (PyExc_TypeError,"wrong list size"));
    	self->world->dofsta =  PyFloat_AsDouble(PyList_GetItem(listargs,0));
    	self->world->dofend =  PyFloat_AsDouble(PyList_GetItem(listargs,1));
    	self->world->dofmin = PyFloat_AsDouble(PyList_GetItem(listargs,2));
    	self->world->dofmax= PyFloat_AsDouble(PyList_GetItem(listargs,3));
    	Py_INCREF(Py_None);
    	return Py_None;
    }
    
    
    
    
    static PyObject *World_getMist(C_World *self)
    {
      PyObject *attr = PyList_New(0);
    	if (!attr)
    		return (EXPP_ReturnPyObjError (PyExc_RuntimeError, "couldn't create list"));
    	PyList_Append(attr, PyFloat_FromDouble(self->world->misi));
    	PyList_Append(attr, PyFloat_FromDouble(self->world->miststa));
    	PyList_Append(attr, PyFloat_FromDouble(self->world->mistdist));
    	PyList_Append(attr, PyFloat_FromDouble(self->world->misthi));
    	return attr;
    }
    
    
    static PyObject *World_setMist(C_World *self, PyObject *args )
    {
    	PyObject *listargs=0;
      if (!PyArg_ParseTuple(args, "O", &listargs))
        return (EXPP_ReturnPyObjError (PyExc_TypeError,"expected list argument"));
    	if (!PyList_Check(listargs))
        return (EXPP_ReturnPyObjError (PyExc_TypeError,"expected list argument"));
    	if (PyList_Size(listargs)!=4)
        return (EXPP_ReturnPyObjError (PyExc_TypeError,"wrong list size"));
    	self->world->misi =  PyFloat_AsDouble(PyList_GetItem(listargs,0));
    	self->world->miststa =  PyFloat_AsDouble(PyList_GetItem(listargs,1));
    	self->world->mistdist =  PyFloat_AsDouble(PyList_GetItem(listargs,2));
    	self->world->misthi = PyFloat_AsDouble(PyList_GetItem(listargs,3));
    	Py_INCREF(Py_None);
    	return Py_None;
    }
    
    
    
    
    /*@{*/
    
    /**
     * \brief The World PyType destructor
     */
    
    static void World_DeAlloc (C_World *self)
    {
      PyObject_DEL (self);
    }
    
    /**
     * \brief The World PyType attribute getter
     *
     * This is the callback called when a user tries to retrieve the contents of
     * World PyObject data members.  Ex. in Python: "print myworld.lens".
     */
    
    static PyObject *World_GetAttr (C_World *self, char *name)
    {
    
    if (strcmp (name, "name") == 0)return  World_getName (self);
    if (strcmp (name, "colormodel") == 0)return  World_getColormodel (self);
    if (strcmp (name, "fastcol") == 0)return  World_getFastcol (self);
    if (strcmp (name, "skytype") == 0)return  World_getSkytype (self);
    if (strcmp (name, "mode") == 0)return  World_getMode (self);
    if (strcmp (name, "totex") == 0)return  World_getTotex (self);
    if (strcmp (name, "texact") == 0)return  World_getTexact (self);
    if (strcmp (name, "mistype") == 0)return  World_getMistype (self);
    if (strcmp (name, "hor") == 0)return  World_getHor (self);
    if (strcmp (name, "zen") == 0)return  World_getZen (self);
    if (strcmp (name, "amb") == 0)return  World_getAmb (self);
    if (strcmp (name, "star") == 0)return  World_getStar (self);
    if (strcmp (name, "dof") == 0)return  World_getDof (self);
    if (strcmp (name, "mist") == 0)return  World_getMist (self);
      return Py_FindMethod(C_World_methods, (PyObject *)self, name);
    }
    
    /**
     * \brief The World PyType attribute setter
     *
     * This is the callback called when the user tries to change the value of some
     * World data member.  Ex. in Python: "myworld.lens = 45.0".
     */
    
    static int World_SetAttr (C_World *self, char *name, PyObject *value)
    {
      PyObject *valtuple  = Py_BuildValue("(O)", value);
    
      if (!valtuple) 
        return EXPP_ReturnIntError(PyExc_MemoryError,
    															 "WorldSetAttr: couldn't parse args");
    		if (strcmp (name, "name") == 0) World_setName (self,valtuple);
    if (strcmp (name, "colormodel") == 0) World_setColormodel (self,valtuple);
    if (strcmp (name, "fastcol") == 0) World_setFastcol (self,valtuple);
    if (strcmp (name, "skytype") == 0) World_setSkytype (self,valtuple);
    if (strcmp (name, "mode") == 0) World_setMode (self,valtuple);
    if (strcmp (name, "totex") == 0) World_setTotex (self,valtuple);
    if (strcmp (name, "texact") == 0) World_setTexact (self,valtuple);
    if (strcmp (name, "mistype") == 0) World_setMistype (self,valtuple);
    if (strcmp (name, "hor") == 0) World_setHor (self,valtuple);
    if (strcmp (name, "zen") == 0) World_setZen (self,valtuple);
    if (strcmp (name, "amb") == 0) World_setAmb (self,valtuple);
    if (strcmp (name, "star") == 0) World_setStar (self,valtuple);
    if (strcmp (name, "dof") == 0) World_setDof (self,valtuple);
    if (strcmp (name, "mist") == 0) World_setMist (self,valtuple);
    return 0; /* normal exit */
    }
    
    /**
     * \brief The World PyType compare function
     *
     * This function compares two given World PyObjects, returning 0 for equality
     * and -1 otherwise.  In Python it becomes 1 if they are equal and 0 case not.
     * The comparison is done with their pointers to Blender World Data objects,
     * so any two wrappers pointing to the same Blender World Data will be
     * considered the same World PyObject.  Currently, only the "==" and "!="
     * comparisons are meaninful -- the "<", "<=", ">" or ">=" are not.
     */
    
    static int World_Compare (C_World *a, C_World *b)
    {
      World *pa = a->world, *pb = b->world;
      return (pa == pb) ? 0:-1;
    }
    
    /**
     * \brief The World PyType print callback
     *
     * This function is called when the user tries to print a PyObject of type
     * World.  It builds a string with the name of the wrapped Blender World.
     */
    
    static int World_Print(C_World *self, FILE *fp, int flags)
    { 
      fprintf(fp, "[World \"%s\"]", self->world->id.name+2);
      return 0;
    }
    
    /**
     * \brief The World PyType repr callback
     *
     * This function is called when the statement "repr(myworld)" is executed in
     * Python.  Repr gives a string representation of a PyObject.
     */
    
    static PyObject *World_Repr (C_World *self)
    {
      return PyString_FromString(self->world->id.name+2);
    }