[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [27881] branches/soc-2009-yukishiro/source /blender/makesrna/intern: add missing files

Jingyuan Huang jingyuan.huang at gmail.com
Tue Mar 30 23:13:28 CEST 2010


Revision: 27881
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=27881
Author:   yukishiro
Date:     2010-03-30 23:13:28 +0200 (Tue, 30 Mar 2010)

Log Message:
-----------
add missing files

Added Paths:
-----------
    branches/soc-2009-yukishiro/source/blender/makesrna/intern/rna_action_api.c
    branches/soc-2009-yukishiro/source/blender/makesrna/intern/rna_image_api.c
    branches/soc-2009-yukishiro/source/blender/makesrna/intern/rna_material_api.c
    branches/soc-2009-yukishiro/source/blender/makesrna/intern/rna_pose_api.c
    branches/soc-2009-yukishiro/source/blender/makesrna/intern/rna_text_api.c

Added: branches/soc-2009-yukishiro/source/blender/makesrna/intern/rna_action_api.c
===================================================================
--- branches/soc-2009-yukishiro/source/blender/makesrna/intern/rna_action_api.c	                        (rev 0)
+++ branches/soc-2009-yukishiro/source/blender/makesrna/intern/rna_action_api.c	2010-03-30 21:13:28 UTC (rev 27881)
@@ -0,0 +1,81 @@
+/**
+ * ***** 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): Arystanbek Dyussenov
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <time.h>
+
+#include "RNA_define.h"
+#include "RNA_types.h"
+
+#include "DNA_action_types.h"
+
+#ifdef RNA_RUNTIME
+
+#include "BKE_action.h"
+
+#include "DNA_anim_types.h"
+#include "DNA_curve_types.h"
+
+/* XXX disabled until RNA allows returning arrays */
+#if 0
+/* return frame range of all curves (min, max) or (0, 1) if there are no keys */
+int *rna_Action_get_frame_range(bAction *act, int *ret_length)
+{
+	int *ret;
+	float start, end;
+
+	calc_action_range(act, &start, &end, 1);
+
+	*ret_length= 2;
+	ret= MEM_callocN(*ret_length * sizeof(int), "rna_Action_get_frame_range");
+
+	ret[0]= (int)start;
+	ret[1]= (int)end;
+	
+	return ret;
+}
+#endif
+
+#else
+
+void RNA_api_action(StructRNA *srna)
+{
+#if 0
+	FunctionRNA *func;
+	PropertyRNA *parm;
+
+	func= RNA_def_function(srna, "get_frame_range", "rna_Action_get_frame_range");
+	RNA_def_function_ui_description(func, "Get action frame range as a (min, max) tuple.");
+	parm= RNA_def_int_array(func, "frame_range", 1, NULL, 0, 0, "", "Action frame range.", 0, 0);
+	RNA_def_property_flag(parm, PROP_DYNAMIC_ARRAY);
+	RNA_def_function_return(func, parm);
+#endif
+}
+
+#endif
+

Added: branches/soc-2009-yukishiro/source/blender/makesrna/intern/rna_image_api.c
===================================================================
--- branches/soc-2009-yukishiro/source/blender/makesrna/intern/rna_image_api.c	                        (rev 0)
+++ branches/soc-2009-yukishiro/source/blender/makesrna/intern/rna_image_api.c	2010-03-30 21:13:28 UTC (rev 27881)
@@ -0,0 +1,82 @@
+/**
+ * $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) 2009 Blender Foundation.
+ * All rights reserved.
+ *
+ * 
+ * Contributor(s): Arystanbek Dyussenov
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <time.h>
+
+#include "RNA_define.h"
+#include "RNA_types.h"
+
+#include "DNA_object_types.h"
+
+#ifdef RNA_RUNTIME
+
+#include "BKE_utildefines.h"
+#include "BKE_image.h"
+
+#include "MEM_guardedalloc.h"
+
+/*
+  User should check if returned path exists before copying a file there.
+
+  TODO: it would be better to return a (abs, rel) tuple.
+*/
+static char *rna_Image_get_export_path(Image *image, char *dest_dir, int rel)
+{
+	int length = FILE_MAX;
+	char *path= MEM_callocN(length, "image file path");
+
+	if (!BKE_get_image_export_path(image, dest_dir, rel ? NULL : path, length, rel ? path : NULL, length )) {
+		MEM_freeN(path);
+		return NULL;
+	}
+
+	return path;
+}
+
+#else
+
+void RNA_api_image(StructRNA *srna)
+{
+	FunctionRNA *func;
+	PropertyRNA *parm;
+
+	func= RNA_def_function(srna, "get_export_path", "rna_Image_get_export_path");
+	RNA_def_function_ui_description(func, "Produce image export path.");
+	parm= RNA_def_string(func, "dest_dir", "", 0, "", "Destination directory.");
+	RNA_def_property_flag(parm, PROP_REQUIRED);
+	parm= RNA_def_boolean(func, "get_rel_path", 1, "", "Return relative path if True.");
+	RNA_def_property_flag(parm, PROP_REQUIRED);
+	parm= RNA_def_string(func, "path", "", 0, "", "Absolute export path.");
+	RNA_def_function_return(func, parm);
+}
+
+#endif
+

Added: branches/soc-2009-yukishiro/source/blender/makesrna/intern/rna_material_api.c
===================================================================
--- branches/soc-2009-yukishiro/source/blender/makesrna/intern/rna_material_api.c	                        (rev 0)
+++ branches/soc-2009-yukishiro/source/blender/makesrna/intern/rna_material_api.c	2010-03-30 21:13:28 UTC (rev 27881)
@@ -0,0 +1,126 @@
+/**
+ *
+ *
+ * ***** 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"
+
+#include "DNA_material_types.h"
+
+#ifdef RNA_RUNTIME
+
+#include "BKE_material.h"
+#include "BKE_texture.h"
+
+/*
+  Adds material to the first free texture slot.
+  If all slots are busy, replaces the first.
+*/
+static void rna_Material_add_texture(Material *ma, Tex *tex, int mapto, int texco)
+{
+	int i;
+	MTex *mtex;
+	int slot= -1;
+
+	for (i= 0; i < MAX_MTEX; i++) {
+		if (!ma->mtex[i]) {
+			slot= i;
+			break;
+		}
+	}
+
+	if (slot == -1)
+		slot= 0;
+
+	if (ma->mtex[slot]) {
+		ma->mtex[slot]->tex->id.us--;
+	}
+	else {
+		ma->mtex[slot]= add_mtex();
+	}
+
+	mtex= ma->mtex[slot];
+
+	mtex->tex= tex;
+	id_us_plus(&tex->id);
+
+	mtex->texco= mapto;
+	mtex->mapto= texco;
+}
+
+#else
+
+void RNA_api_material(StructRNA *srna)
+{
+	FunctionRNA *func;
+	PropertyRNA *parm;
+
+	/* copied from rna_def_material_mtex (rna_material.c) */
+	static EnumPropertyItem prop_texture_coordinates_items[] = {
+		{TEXCO_GLOB, "GLOBAL", 0, "Global", "Uses global coordinates for the texture coordinates."},
+		{TEXCO_OBJECT, "OBJECT", 0, "Object", "Uses linked object's coordinates for texture coordinates."},
+		{TEXCO_UV, "UV", 0, "UV", "Uses UV coordinates for texture coordinates."},
+		{TEXCO_ORCO, "ORCO", 0, "Generated", "Uses the original undeformed coordinates of the object."},
+		{TEXCO_STRAND, "STRAND", 0, "Strand", "Uses normalized strand texture coordinate (1D)."},
+		{TEXCO_STICKY, "STICKY", 0, "Sticky", "Uses mesh's sticky coordinates for the texture coordinates."},
+		{TEXCO_WINDOW, "WINDOW", 0, "Window", "Uses screen coordinates as texture coordinates."},
+		{TEXCO_NORM, "NORMAL", 0, "Normal", "Uses normal vector as texture coordinates."},
+		{TEXCO_REFL, "REFLECTION", 0, "Reflection", "Uses reflection vector as texture coordinates."},
+		{TEXCO_STRESS, "STRESS", 0, "Stress", "Uses the difference of edge lengths compared to original coordinates of the mesh."},
+		{TEXCO_TANGENT, "TANGENT", 0, "Tangent", "Uses the optional tangent vector as texture coordinates."},
+
+		{0, NULL, 0, NULL, NULL}};
+
+	static EnumPropertyItem prop_texture_mapto_items[] = {
+		{MAP_COL, "COLOR", 0, "Color", "Causes the texture to affect basic color of the material"},
+		{MAP_NORM, "NORMAL", 0, "Normal", "Causes the texture to affect the rendered normal"},
+		{MAP_COLSPEC, "SPECULAR_COLOR", 0, "Specularity Color", "Causes the texture to affect the specularity color"},
+		{MAP_COLMIR, "MIRROR", 0, "Mirror", "Causes the texture to affect the mirror color"},
+		{MAP_REF, "REFLECTION", 0, "Reflection", "Causes the texture to affect the value of the materials reflectivity"},
+		{MAP_SPEC, "SPECULARITY", 0, "Specularity", "Causes the texture to affect the value of specularity"},
+		{MAP_EMIT, "EMIT", 0, "Emit", "Causes the texture to affect the emit value"},
+		{MAP_ALPHA, "ALPHA", 0, "Alpha", "Causes the texture to affect the alpha value"},
+		{MAP_HAR, "HARDNESS", 0, "Hardness", "Causes the texture to affect the hardness value"},
+		{MAP_RAYMIRR, "RAY_MIRROR", 0, "Ray-Mirror", "Causes the texture to affect the ray-mirror value"},
+		{MAP_TRANSLU, "TRANSLUCENCY", 0, "Translucency", "Causes the texture to affect the translucency value"},
+		{MAP_AMB, "AMBIENT", 0, "Ambient", "Causes the texture to affect the value of ambient"},
+		{MAP_DISPLACE, "DISPLACEMENT", 0, "Displacement", "Let the texture displace the surface"},
+		{MAP_WARP, "WARP", 0, "Warp", "Let the texture warp texture coordinates of next channels"},
+		{0, NULL, 0, NULL, NULL}};
+
+	func= RNA_def_function(srna, "add_texture", "rna_Material_add_texture");
+	RNA_def_function_ui_description(func, "Add a texture to material's free texture slot.");
+	parm= RNA_def_pointer(func, "texture", "Texture", "", "Texture to add.");

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list