Skip to content
Snippets Groups Projects
World.c 30.6 KiB
Newer Older
  • Learn to ignore specific revisions
  • static PyObject *World_Repr( BPy_World * self )
    
    	return PyString_FromFormat( "[World \"%s\"]",
    				    self->world->id.name + 2 );
    
    Willian Padovani Germano's avatar
    Willian Padovani Germano committed
    /*
    
    Willian Padovani Germano's avatar
    Willian Padovani Germano committed
    	World *pa = a->world, *pb = b->world;
    	return (pa == pb) ? 0:-1;
    
    Willian Padovani Germano's avatar
    Willian Padovani Germano committed
    */
    
    PyObject *World_CreatePyObject( struct World * world )
    
    	BPy_World *blen_object;
    
    	blen_object = ( BPy_World * ) PyObject_NEW( BPy_World, &World_Type );
    
    	if( blen_object == NULL ) {
    		return ( NULL );
    	}
    	blen_object->world = world;
    	return ( ( PyObject * ) blen_object );
    
    int World_CheckPyObject( PyObject * py_obj )
    
    	return ( py_obj->ob_type == &World_Type );
    
    World *World_FromPyObject( PyObject * py_obj )
    
    	BPy_World *blen_obj;
    
    	blen_obj = ( BPy_World * ) py_obj;
    	return ( blen_obj->world );
    
    /*****************************************************************************/
    
    /* 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.						*/
    
    /*****************************************************************************/
    
    World *GetWorldByName( char *name )
    
    	World *world_iter;
    
    
    	world_iter = G.main->world.first;
    
    	while( world_iter ) {
    		if( StringEqual( name, GetIdName( &( world_iter->id ) ) ) ) {
    			return ( world_iter );
    
    		}
    		world_iter = world_iter->id.next;
    	}
    
    	/* There is no object with the given name */
    
    	return ( NULL );