[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [17255] branches/blender2.5/blender/source : RNA / Data API

Brecht Van Lommel brecht at blender.org
Sat Nov 1 00:50:03 CET 2008


Revision: 17255
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=17255
Author:   blendix
Date:     2008-11-01 00:50:02 +0100 (Sat, 01 Nov 2008)

Log Message:
-----------
RNA / Data API

This is the first code for the Data API, also known as RNA system in the
2.5 Branch. It does not include a user interface, and only wraps some
Scene properties for testing. It is integrated with Scons and Makefiles,
and compiles a 'makesrna' program that generates an RNA.c file.

http://wiki.blender.org/index.php/BlenderDev/Blender2.5/DataAPI
http://wiki.blender.org/index.php/BlenderDev/Blender2.5/RNA

The changes are quite local, basically adding a makesrna module which
works similar to the makesdna module. The one external change is in
moving genfile.c from blenloader to the makesdna module, so that it can
be reused by the RNA code. This also meant changing the DNA makefiles.
It seems to be doing dependencies correct still in my tests, but if
there is an issue with the DNA not being rebuilt this commit might be
the one causing it. Also it seems for scons the makesdna and makesrna
modules are compiling without warnings. Not a new issue but this should
be fixed.

The RNA code supports all types as defined in the Data API design, so
in that sense it is fairly complete and I hope that aspect will not
have to change much. Some obviously missing parts are context related
code, notify() functions for updates and user defined / ID properties.

Modified Paths:
--------------
    branches/blender2.5/blender/source/Makefile
    branches/blender2.5/blender/source/blender/Makefile
    branches/blender2.5/blender/source/blender/SConscript
    branches/blender2.5/blender/source/blender/blenloader/intern/readblenentry.c
    branches/blender2.5/blender/source/blender/blenloader/intern/readfile.c
    branches/blender2.5/blender/source/blender/blenloader/intern/writefile.c
    branches/blender2.5/blender/source/blender/makesdna/DNA_sdna_types.h
    branches/blender2.5/blender/source/blender/makesdna/SConscript
    branches/blender2.5/blender/source/blender/makesdna/intern/Makefile
    branches/blender2.5/blender/source/blender/makesdna/intern/SConscript

Added Paths:
-----------
    branches/blender2.5/blender/source/blender/makesdna/DNA_genfile.h
    branches/blender2.5/blender/source/blender/makesdna/intern/dna_genfile.c
    branches/blender2.5/blender/source/blender/makesrna/
    branches/blender2.5/blender/source/blender/makesrna/Makefile
    branches/blender2.5/blender/source/blender/makesrna/RNA_access.h
    branches/blender2.5/blender/source/blender/makesrna/RNA_define.h
    branches/blender2.5/blender/source/blender/makesrna/RNA_types.h
    branches/blender2.5/blender/source/blender/makesrna/SConscript
    branches/blender2.5/blender/source/blender/makesrna/intern/
    branches/blender2.5/blender/source/blender/makesrna/intern/Makefile
    branches/blender2.5/blender/source/blender/makesrna/intern/SConscript
    branches/blender2.5/blender/source/blender/makesrna/intern/makesrna.c
    branches/blender2.5/blender/source/blender/makesrna/intern/rna_access.c
    branches/blender2.5/blender/source/blender/makesrna/intern/rna_define.c
    branches/blender2.5/blender/source/blender/makesrna/intern/rna_internal.h
    branches/blender2.5/blender/source/blender/makesrna/intern/rna_object.c
    branches/blender2.5/blender/source/blender/makesrna/intern/rna_scene.c

Removed Paths:
-------------
    branches/blender2.5/blender/source/blender/blenloader/BLO_genfile.h
    branches/blender2.5/blender/source/blender/blenloader/intern/genfile.c
    branches/blender2.5/blender/source/blender/blenloader/intern/genfile.h

Modified: branches/blender2.5/blender/source/Makefile
===================================================================
--- branches/blender2.5/blender/source/Makefile	2008-10-31 22:35:52 UTC (rev 17254)
+++ branches/blender2.5/blender/source/Makefile	2008-10-31 23:50:02 UTC (rev 17255)
@@ -73,8 +73,7 @@
 # PLUGAPPLIB libs that form the application to be plugged in
 # Note: the order is important here
 
-GRPLIB = $(OCGDIR)/blender/makesdna/$(DEBUG_DIR)DNA.o
-GRPLIB += $(OCGDIR)/creator/$(DEBUG_DIR)libcreator.a
+GRPLIB = $(OCGDIR)/creator/$(DEBUG_DIR)libcreator.a
 GRPLIB += $(OCGDIR)/blender/windowmanager/$(DEBUG_DIR)libwindowmanager.a
 GRPLIB += $(NAN_BSP)/lib/$(DEBUG_DIR)libbsp.a
 GRPLIB += $(NAN_BOOLOP)/lib/$(DEBUG_DIR)libboolop.a
@@ -149,6 +148,7 @@
     COMLIB += $(NAN_BULLET2)/lib/libbullet2.a
 endif
 
+COMLIB += $(OCGDIR)/blender/makesdna/$(DEBUG_DIR)libdna.a
 COMLIB += $(NAN_GUARDEDALLOC)/lib/libguardedalloc.a
 COMLIB += $(NAN_MEMUTIL)/lib/libmemutil.a
 COMLIB += $(NAN_BMFONT)/lib/$(DEBUG_DIR)libbmfont.a
@@ -230,8 +230,8 @@
 PULIB += $(OCGDIR)/blender/ed_interface/libed_interface.a
 PULIB += $(OCGDIR)/blender/windowmanager/libwindowmanager.a
 PULIB += $(OCGDIR)/blender/python/$(DEBUG_DIR)libpython.a
+PULIB += $(OCGDIR)/blender/makesrna/$(DEBUG_DIR)librna.a
 
-
 ifeq ($(NAN_NO_KETSJI),true)
     PULIB += $(NAN_MOTO)/lib/libmoto.a
     PULIB += $(OCGDIR)/kernel/gen_system/$(DEBUG_DIR)libgen_system.a
@@ -244,12 +244,12 @@
 SPLIB1 += $(NAN_STRING)/lib/$(DEBUG_DIR)libstring.a
 SPLIB1 += $(NAN_GHOST)/lib/$(DEBUG_DIR)libghost.a
 
-SPLIB = $(OCGDIR)/blender/makesdna/$(DEBUG_DIR)DNA.o
-SPLIB += $(OCGDIR)/blender/readblenfile/$(DEBUG_DIR)libreadblenfile.a
+SPLIB = $(OCGDIR)/blender/readblenfile/$(DEBUG_DIR)libreadblenfile.a
 # this is used for the plugin. It uses some things from libz.a, 
 # but somehow it consistently fails to resolve these symbols... or 
 # can I just not check them? nm claims they aren't...
 SPLIB += $(OCGDIR)/blender/blenkernel/blenkernel_blc/$(DEBUG_DIR)libblenkernel_blc.a
+SPLIB += $(OCGDIR)/blender/makesrna/$(DEBUG_DIR)librna.a
 
 # These three need to be explicitly mentioned on the cl, because 
 # if they are offered as a lib, they are optimized away. (nzc)

Modified: branches/blender2.5/blender/source/blender/Makefile
===================================================================
--- branches/blender2.5/blender/source/blender/Makefile	2008-10-31 22:35:52 UTC (rev 17254)
+++ branches/blender2.5/blender/source/blender/Makefile	2008-10-31 23:50:02 UTC (rev 17255)
@@ -33,7 +33,7 @@
 DIRS = windowmanager editors blenloader readblenfile
 DIRS += avi imbuf render radiosity blenlib blenkernel blenpluginapi
 DIRS += nodes
-DIRS += makesdna yafray
+DIRS += makesdna makesrna yafray
 DIRS += python
 
 ifeq ($(INTERNATIONAL), true)

Modified: branches/blender2.5/blender/source/blender/SConscript
===================================================================
--- branches/blender2.5/blender/source/blender/SConscript	2008-10-31 22:35:52 UTC (rev 17254)
+++ branches/blender2.5/blender/source/blender/SConscript	2008-10-31 23:50:02 UTC (rev 17255)
@@ -11,6 +11,7 @@
 			'imbuf/SConscript',
 			'imbuf/intern/cineon/SConscript',
 			'makesdna/SConscript',
+			'makesrna/SConscript',
 			'python/SConscript',
 			'radiosity/SConscript',
 			'readblenfile/SConscript',

Deleted: branches/blender2.5/blender/source/blender/blenloader/BLO_genfile.h
===================================================================
--- branches/blender2.5/blender/source/blender/blenloader/BLO_genfile.h	2008-10-31 22:35:52 UTC (rev 17254)
+++ branches/blender2.5/blender/source/blender/blenloader/BLO_genfile.h	2008-10-31 23:50:02 UTC (rev 17255)
@@ -1,35 +0,0 @@
-/*
- * $Id$
- *
- * ***** BEGIN GPL 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.
- *
- * 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.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- * external genfile function prototypes
- */
-
-#ifndef BLO_GENFILE_H
-#define BLO_GENFILE_H
-
-#endif
-

Deleted: branches/blender2.5/blender/source/blender/blenloader/intern/genfile.c
===================================================================
--- branches/blender2.5/blender/source/blender/blenloader/intern/genfile.c	2008-10-31 22:35:52 UTC (rev 17254)
+++ branches/blender2.5/blender/source/blender/blenloader/intern/genfile.c	2008-10-31 23:50:02 UTC (rev 17255)
@@ -1,1099 +0,0 @@
-/* genfile.c
- *
- * Functions for struct-dna, the genetic file dot c!
- *
- * $Id$
- *
- * ***** BEGIN GPL 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.
- *
- * 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.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- * DNA handling
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#ifndef WIN32 
-#include <unistd.h> // for read close
-#else
-#include <io.h> // for open close read
-#endif
-
-#include <string.h> // strncmp
-#include <stdio.h> // for printf
-#include <stdlib.h> // for atoi
-#include <fcntl.h> // for open O_RDONLY
-
-#include "MEM_guardedalloc.h" // for MEM_freeN MEM_mallocN MEM_callocN
-#include "BLI_blenlib.h"      // for  BLI_filesize
-
-#include "BKE_utildefines.h" // for O_BINARY TRUE MIN2
-
-#include "DNA_sdna_types.h" // for SDNA ;-)
-
-#include "BLO_writefile.h"
-#include "BLO_genfile.h"
-
-#include "genfile.h"
-
-/* gcc 4.1 on mingw was complaining that __int64 was alredy defined
-actually is saw the line below as typedef long long long long... 
-Anyhow, since its alredy defined, its safe to do an ifndef here- Cambpell*/
-#ifdef FREE_WINDOWS
-#ifndef __int64
-typedef long long __int64;
-#endif
-#endif
-
-/*
- * - please note: no builtin security to detect input of double structs
- * - if you want a struct not to be in DNA file: add two hash marks above it (#<enter>#<enter>)
-
-Structure DNA data is added to each blender file and to each executable, this to detect
-in .blend files new veriables in structs, changed array sizes, etc. It's also used for
-converting endian and pointer size (32-64 bits)
-As an extra, Python uses a call to detect run-time the contents of a blender struct.
-
-Create a structDNA: only needed when one of the input include (.h) files change.
-File Syntax:
-	SDNA (4 bytes) (magic number)
-	NAME (4 bytes)
-	<nr> (4 bytes) amount of names (int)
-	<string> 
-	<string>
-	...
-	...
-	TYPE (4 bytes)
-	<nr> amount of types (int)
-	<string>
-	<string>
-	...
-	...
-	TLEN (4 bytes)
-	<len> (short) the lengths of types
-	<len>
-	...
-	...
-	STRC (4 bytes)
-	<nr> amount of structs (int)
-	<typenr><nr_of_elems> <typenr><namenr> <typenr><namenr> ...
-	
-!!Remember to read/write integer and short aligned!!
-
- While writing a file, the names of a struct is indicated with a type number,
- to be found with: type= findstruct_nr(SDNA *, char *)
- The value of 'type' corresponds with the the index within the structs array
-
- For the moment: the complete DNA file is included in a .blend file. For
- the future we can think of smarter methods, like only included the used
- structs. Only needed to keep a file short though...
-
-ALLOWED AND TESTED CHANGES IN STRUCTS:
- - type change (a char to float will be divided by 255)
- - location within a struct (everthing can be randomly mixed up)
- - struct within struct (within struct etc), this is recursive
- - adding new elements, will be default initialized zero
- - remving elements
- - change of array sizes
- - change of a pointer type: when the name doesn't change the contents is copied
-
-NOT YET:
- - array (vec[3]) to float struct (vec3f)
-
-DONE:
- - endian compatibility
- - pointer conversion (32-64 bits)
-
-IMPORTANT:
- - do not use #defines in structs for array lenghts, this cannot be read by the dna functions
- - do not use uint, but unsigned int instead, ushort and ulong are allowed
- - only use a long in Blender if you want this to be the size of a pointer. so it is
-   32 bits or 64 bits, dependant at the cpu architecture
- - chars are always unsigned
- - aligment of variables has to be done in such a way, that any system does
-   not create 'padding' (gaps) in structures. So make sure that:
-   - short: 2 aligned
-   - int: 4 aligned
-   - float: 4 aligned
-   - double: 8 aligned
-   - long: 8 aligned
-   - struct: 8 aligned
- - the sdna functions have several error prints builtin, always check blender running from a console.
- 
-*/
-
-/* local */
-static int le_int(int temp);
-static short le_short(short temp);
-
-/* ************************* ENDIAN STUFF ********************** */
-
-static short le_short(short temp)
-{
-	short new;
-	char *rt=(char *)&temp, *rtn=(char *)&new;
-
-	rtn[0]= rt[1];
-	rtn[1]= rt[0];
-
-	return new;
-}
-
-
-static int le_int(int temp)
-{
-	int new;
-	char *rt=(char *)&temp, *rtn=(char *)&new;
-
-	rtn[0]= rt[3];
-	rtn[1]= rt[2];
-	rtn[2]= rt[1];
-	rtn[3]= rt[0];
-
-	return new;
-}
-
-
-/* ************************* MAKE DNA ********************** */
-

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list