Revision: 21634
          
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=21634
Author:   joeedh
Date:     2009-07-16 22:10:33 +0200 (Thu, 16 Jul 2009)

Log Message:
-----------
added missing files identified by jmsoler

Added Paths:
-----------
    branches/bmesh/blender/source/blender/blenkernel/nla_private.h
    branches/bmesh/blender/source/blender/makesrna/intern/rna_main_api.c
    branches/bmesh/blender/source/blender/makesrna/intern/rna_mesh_api.c
    branches/bmesh/blender/source/blender/makesrna/intern/rna_nla.c
    branches/bmesh/blender/source/blender/makesrna/intern/rna_object_api.c
    branches/bmesh/blender/source/blender/makesrna/intern/rna_ui_api.c
    branches/bmesh/blender/source/blender/makesrna/intern/rna_wm_api.c

Added: branches/bmesh/blender/source/blender/blenkernel/nla_private.h
===================================================================
--- branches/bmesh/blender/source/blender/blenkernel/nla_private.h              
                (rev 0)
+++ branches/bmesh/blender/source/blender/blenkernel/nla_private.h      
2009-07-16 20:10:33 UTC (rev 21634)
@@ -0,0 +1,85 @@
+/**
+ * $Id: nla_private.h 21537 2009-07-11 22:22:53Z gsrb3d $
+ *
+ * ***** 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) 2009 Blender Foundation, Joshua Leung
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): Joshua Leung (full recode)
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#ifndef NLA_PRIVATE
+#define NLA_PRIVATE
+
+/* --------------- NLA Evaluation DataTypes ----------------------- */
+
+/* used for list of strips to accumulate at current time */
+typedef struct NlaEvalStrip {
+       struct NlaEvalStrip *next, *prev;
+       
+       NlaTrack *track;                        /* track that this strip 
belongs to */
+       NlaStrip *strip;                        /* strip that's being used */
+       
+       short track_index;                      /* the index of the track 
within the list */
+       short strip_mode;                       /* which end of the strip are 
we looking at */
+       
+       float strip_time;                       /* time at which which strip is 
being evaluated */
+} NlaEvalStrip;
+
+/* NlaEvalStrip->strip_mode */
+enum {
+               /* standard evaluation */
+       NES_TIME_BEFORE = -1,
+       NES_TIME_WITHIN,
+       NES_TIME_AFTER,
+       
+               /* transition-strip evaluations */
+       NES_TIME_TRANSITION_START,
+       NES_TIME_TRANSITION_END,
+} eNlaEvalStrip_StripMode;
+
+
+/* temp channel for accumulating data from NLA (avoids needing to clear all 
values first) */
+// TODO: maybe this will be used as the 'cache' stuff needed for editable 
values too?
+typedef struct NlaEvalChannel {
+       struct NlaEvalChannel *next, *prev;
+       
+       PointerRNA ptr;                 /* pointer to struct containing 
property to use */
+       PropertyRNA *prop;              /* RNA-property type to use (should be 
in the struct given) */
+       int index;                              /* array index (where 
applicable) */
+       
+       float value;                    /* value of this channel */
+} NlaEvalChannel;
+
+/* --------------- NLA Functions (not to be used as a proper API) 
----------------------- */
+
+/* convert from strip time <-> global time */
+float nlastrip_get_frame(NlaStrip *strip, float cframe, short mode);
+
+/* --------------- NLA Evaluation (very-private stuff) ----------------------- 
*/
+/* these functions are only defined here to avoid problems with the order in 
which they get defined... */
+
+NlaEvalStrip *nlastrips_ctime_get_strip(ListBase *list, ListBase *strips, 
short index, float ctime);
+void nlastrip_evaluate(PointerRNA *ptr, ListBase *channels, ListBase 
*modifiers, NlaEvalStrip *nes);
+void nladata_flush_channels(ListBase *channels);
+
+#endif // NLA_PRIVATE


Property changes on: 
branches/bmesh/blender/source/blender/blenkernel/nla_private.h
___________________________________________________________________
Name: svn:eol-style
   + native

Added: branches/bmesh/blender/source/blender/makesrna/intern/rna_main_api.c
===================================================================
--- branches/bmesh/blender/source/blender/makesrna/intern/rna_main_api.c        
                        (rev 0)
+++ branches/bmesh/blender/source/blender/makesrna/intern/rna_main_api.c        
2009-07-16 20:10:33 UTC (rev 21634)
@@ -0,0 +1,81 @@
+/**
+ * $Id: rna_main_api.c 21094 2009-06-23 00:09:26Z gsrb3d $
+ *
+ * ***** 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) 2009 Blender Foundation.
+ * All rights reserved.
+ *
+ * 
+ * Contributor(s): Blender Foundation
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#include <stdlib.h>
+#include <stdio.h>
+
+#include "RNA_define.h"
+#include "RNA_types.h"
+
+#ifdef RNA_RUNTIME
+
+#include "BKE_main.h"
+#include "BKE_mesh.h"
+#include "BKE_library.h"
+
+#include "DNA_mesh_types.h"
+
+Mesh *rna_Main_add_mesh(Main *main, char *name)
+{
+       Mesh *me= add_mesh(name);
+       me->id.us--;
+       return me;
+}
+
+void rna_Main_remove_mesh(Main *main, ReportList *reports, Mesh *me)
+{
+       if(me->id.us == 0)
+               free_libblock(&main->mesh, me);
+       else
+               BKE_report(reports, RPT_ERROR, "Mesh must have zero users to be 
removed.");
+       
+       /* XXX python now has invalid pointer? */
+}
+
+#else
+
+void RNA_api_main(StructRNA *srna)
+{
+       FunctionRNA *func;
+       PropertyRNA *prop;
+
+       func= RNA_def_function(srna, "add_mesh", "rna_Main_add_mesh");
+       RNA_def_function_ui_description(func, "Add a new mesh.");
+       prop= RNA_def_string(func, "name", "Mesh", 0, "", "New name for the 
datablock.");
+       prop= RNA_def_pointer(func, "mesh", "Mesh", "", "New mesh.");
+       RNA_def_function_return(func, prop);
+
+       func= RNA_def_function(srna, "remove_mesh", "rna_Main_remove_mesh");
+       RNA_def_function_flag(func, FUNC_USE_REPORTS);
+       RNA_def_function_ui_description(func, "Remove a mesh if it has zero 
users.");
+       prop= RNA_def_pointer(func, "mesh", "Mesh", "", "Mesh to remove.");
+       RNA_def_property_flag(prop, PROP_REQUIRED);
+}
+
+#endif
+


Property changes on: 
branches/bmesh/blender/source/blender/makesrna/intern/rna_main_api.c
___________________________________________________________________
Name: svn:eol-style
   + native

Added: branches/bmesh/blender/source/blender/makesrna/intern/rna_mesh_api.c
===================================================================
--- branches/bmesh/blender/source/blender/makesrna/intern/rna_mesh_api.c        
                        (rev 0)
+++ branches/bmesh/blender/source/blender/makesrna/intern/rna_mesh_api.c        
2009-07-16 20:10:33 UTC (rev 21634)
@@ -0,0 +1,241 @@
+/**
+ * $Id: rna_mesh_api.c 21283 2009-07-01 12:19:00Z blendix $
+ *
+ * ***** 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) 2009 Blender Foundation.
+ * All rights reserved.
+ *
+ * 
+ * Contributor(s): Blender Foundation
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#include <stdlib.h>
+#include <stdio.h>
+
+#include "RNA_define.h"
+#include "RNA_types.h"
+
+#ifdef RNA_RUNTIME
+
+#include "DNA_mesh_types.h"
+#include "DNA_scene_types.h"
+
+#include "BKE_customdata.h"
+#include "BKE_depsgraph.h"
+#include "BKE_DerivedMesh.h"
+#include "BKE_main.h"
+#include "BKE_mesh.h"
+
+#include "BLI_edgehash.h"
+
+#include "WM_api.h"
+#include "WM_types.h"
+
+static void rna_Mesh_calc_edges(Mesh *mesh)
+{
+       CustomData edata;
+       EdgeHashIterator *ehi;
+       MFace *mf = mesh->mface;
+       MEdge *med;
+       EdgeHash *eh = BLI_edgehash_new();
+       int i, *index, totedge, totface = mesh->totface;
+
+       for (i = 0; i < totface; i++, mf++) {
+               if (!BLI_edgehash_haskey(eh, mf->v1, mf->v2))
+                       BLI_edgehash_insert(eh, mf->v1, mf->v2, NULL);
+               if (!BLI_edgehash_haskey(eh, mf->v2, mf->v3))
+                       BLI_edgehash_insert(eh, mf->v2, mf->v3, NULL);
+               
+               if (mf->v4) {
+                       if (!BLI_edgehash_haskey(eh, mf->v3, mf->v4))
+                               BLI_edgehash_insert(eh, mf->v3, mf->v4, NULL);
+                       if (!BLI_edgehash_haskey(eh, mf->v4, mf->v1))
+                               BLI_edgehash_insert(eh, mf->v4, mf->v1, NULL);
+               } else {
+                       if (!BLI_edgehash_haskey(eh, mf->v3, mf->v1))
+                               BLI_edgehash_insert(eh, mf->v3, mf->v1, NULL);
+               }
+       }
+
+       totedge = BLI_edgehash_size(eh);
+
+       /* write new edges into a temporary CustomData */
+       memset(&edata, 0, sizeof(edata));
+       CustomData_add_layer(&edata, CD_MEDGE, CD_CALLOC, NULL, totedge);
+
+       ehi = BLI_edgehashIterator_new(eh);
+       med = CustomData_get_layer(&edata, CD_MEDGE);
+       for(i = 0; !BLI_edgehashIterator_isDone(ehi);
+           BLI_edgehashIterator_step(ehi), ++i, ++med, ++index) {
+               BLI_edgehashIterator_getKey(ehi, (int*)&med->v1, 
(int*)&med->v2);
+
+               med->flag = ME_EDGEDRAW|ME_EDGERENDER;
+       }
+       BLI_edgehashIterator_free(ehi);
+
+       /* free old CustomData and assign new one */
+       CustomData_free(&mesh->edata, mesh->totedge);
+       mesh->edata = edata;
+       mesh->totedge = totedge;
+
+       mesh->medge = CustomData_get_layer(&mesh->edata, CD_MEDGE);
+
+       BLI_edgehash_free(eh, NULL);
+}
+
+static void rna_Mesh_update(Mesh *mesh, bContext *C)
+{
+       Main *bmain= CTX_data_main(C);
+       Object *ob;
+
+       if(mesh->totface && mesh->totedge == 0)
+               rna_Mesh_calc_edges(mesh);
+
+       mesh_calc_normals(mesh->mvert, mesh->totvert, mesh->mface, 
mesh->totface, NULL);
+
+       for(ob=bmain->object.first; ob; ob=ob->id.next) {
+               if(ob->data == mesh) {
+                       ob->recalc |= OB_RECALC_DATA;
+                       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_DATA, ob);
+               }
+       }
+}
+
+static void rna_Mesh_add_verts(Mesh *mesh, int len)
+{

@@ Diff output truncated at 10240 characters. @@

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to