利用者:Koilz/2.65.10 bex shape key add exec

提供: wiki
< 利用者:Koilz
2018年6月29日 (金) 05:53時点におけるYamyam (トーク | 投稿記録)による版 (1版 をインポートしました)
(差分) ← 古い版 | 最新版 (差分) | 新しい版 → (差分)
移動先: 案内検索
// 2.65.10 bex shape_key_add_exec
//
// this is a list of functions executed from shape_key_add_exec(){}
//
// they are not complete
//	# 	= no sub functions
//	*	= duplicate
//	no tab 	= no check

/*
 * ***** 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 *
 * The Original Code is Copyright (C) 2009 Blender Foundation
 * All rights reserved.
 *
 * The Original Code is: all of this file.
 *
 * ***** END GPL LICENSE BLOCK *****
 */

// source/blender/editors/object/object_shapekey.c
static int shape_key_add_exec(bContext *C, wmOperator *op)
{
	CTX_data_scene(C);
	ED_object_context(C);
	RNA_boolean_get(op->ptr, "from_mix");
	ED_object_shape_key_add(C, scene, ob, from_mix);					// source/blender/editors/object/object_shapekey.c
		BKE_object_insert_shape_key(scene, ob, NULL, from_mix)				// source/blender/blenkernel/intern/object.c
			insert_meshkey(scene, ob, name, from_mix);				// source/blender/blenkernel/intern/object.c
				BKE_key_add((ID *)me);						// source/blender/blenkernel/intern/key.c
					BKE_libblock_alloc(&G.main->key, ID_KE, "Key");
					GS(id->name)
				BKE_keyblock_add_ctime(key, name, FALSE);			// source/blender/blenkernel/intern/key.c
					BKE_keyblock_add(key, name);				// source/blender/blenkernel/intern/key.c
						MEM_callocN(sizeof(KeyBlock), "Keyblock");
						BLI_addtail(&key->block, kb);
						BLI_countlist(&key->block);
						BLI_strncpy(kb->name, name, sizeof(kb->name));
						BLI_strncpy(kb->name, "Basis", sizeof(kb->name));
						BLI_snprintf(kb->name, sizeof(kb->name), "Key %d", tot - 1);
						BLI_uniquename(&key->block, kb, "Key", '.', offsetof(KeyBlock, name), sizeof(kb->name));
					BKE_key_sort(key);
				BKE_key_convert_from_mesh(me, kb);				// source/blender/blenkernel/intern/key.c
					MEM_freeN(kb->data);
					MEM_callocN(me->key->elemsize * me->totvert, "kb->data");
					copy_v3_v3(fp, mvert->co);
				BKE_key_evaluate_object(scene, ob, &totelem);			// source/blender/blenkernel/intern/key.c
					BKE_key_from_object(ob);				// source/blender/blenkernel/intern/key.c
						ELEM(ob->type, OB_CURVE, OB_SURF)
					BKE_keyblock_from_object(ob);
					sizeof(float);
					sizeof(float);
					ELEM(ob->type, OB_CURVE, OB_SURF)
					sizeof(float);
					sizeof(float);
					MEM_callocN(size, "BKE_key_evaluate_object out");
					BLI_findlink(&key->block, ob->shapenr - 1);
					OB_TYPE_SUPPORT_VGROUP(ob->type)
					get_weights_array(ob, kb->vgroup);
					cp_key(0, tot, tot, out, key, actkb, kb, weights, 0);
					MEM_freeN(weights);
					ELEM(ob->type, OB_CURVE, OB_SURF)
					cp_cu_key(ob->data, key, actkb, kb, 0, tot, out, tot);
					BKE_scene_frame_get(scene);
					BKE_animsys_evaluate_animdata(scene, &key->id, key->adt, ctime, ADT_RECALC_DRIVERS);
					do_mesh_key(scene, ob, key, out, tot);
					do_latt_key(scene, ob, key, out, tot);
					do_curve_key(scene, ob, key, out, tot);
					do_curve_key(scene, ob, key, out, tot);
				BKE_keyblock_add_ctime(key, name, FALSE);
			insert_curvekey(scene, ob, name, from_mix);			// source/blender/blenkernel/intern/object.c
				BKE_curve_nurbs_get(cu);
				BKE_key_add((ID *)cu);
				BKE_keyblock_add_ctime(key, name, FALSE);
				MEM_dupallocN(basekb->data);
				BKE_key_convert_from_curve(cu, kb, lb);
				BKE_key_evaluate_object(scene, ob, &totelem);
				BKE_keyblock_add_ctime(key, name, FALSE);
			insert_lattkey(scene, ob, name, from_mix);			// source/blender/blenkernel/intern/object.c
				BKE_key_add((ID *)lt);
				BKE_keyblock_add_ctime(key, name, FALSE);
				MEM_dupallocN(basekb->data);
				BKE_key_convert_from_lattice(lt, kb);
				BKE_key_evaluate_object(scene, ob, &totelem);
				BKE_keyblock_add_ctime(key, name, FALSE);
		BKE_key_from_object(ob);
		BLI_findindex(&key->block, kb)
		WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob);
}