﻿<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ja">
	<id>https://wiki.blender.jp/index.php?action=history&amp;feed=atom&amp;title=%E5%88%A9%E7%94%A8%E8%80%85%3AApinzonf%2FDev%3ADoc%2FTutorial_Modifier</id>
	<title>利用者:Apinzonf/Dev:Doc/Tutorial Modifier - 版の履歴</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.blender.jp/index.php?action=history&amp;feed=atom&amp;title=%E5%88%A9%E7%94%A8%E8%80%85%3AApinzonf%2FDev%3ADoc%2FTutorial_Modifier"/>
	<link rel="alternate" type="text/html" href="https://wiki.blender.jp/index.php?title=%E5%88%A9%E7%94%A8%E8%80%85:Apinzonf/Dev:Doc/Tutorial_Modifier&amp;action=history"/>
	<updated>2026-05-14T09:32:35Z</updated>
	<subtitle>このウィキのこのページに関する変更履歴</subtitle>
	<generator>MediaWiki 1.31.0</generator>
	<entry>
		<id>https://wiki.blender.jp/index.php?title=%E5%88%A9%E7%94%A8%E8%80%85:Apinzonf/Dev:Doc/Tutorial_Modifier&amp;diff=137805&amp;oldid=prev</id>
		<title>Yamyam: 1版 をインポートしました</title>
		<link rel="alternate" type="text/html" href="https://wiki.blender.jp/index.php?title=%E5%88%A9%E7%94%A8%E8%80%85:Apinzonf/Dev:Doc/Tutorial_Modifier&amp;diff=137805&amp;oldid=prev"/>
		<updated>2018-06-28T20:50:26Z</updated>

		<summary type="html">&lt;p&gt;1版 をインポートしました&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;ja&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;← 古い版&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;2018年6月28日 (木) 20:50時点における版&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-notice&quot; lang=&quot;ja&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(相違点なし)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>Yamyam</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.blender.jp/index.php?title=%E5%88%A9%E7%94%A8%E8%80%85:Apinzonf/Dev:Doc/Tutorial_Modifier&amp;diff=137804&amp;oldid=prev</id>
		<title>2012年8月6日 (月) 02:38にwiki&gt;Apinzonfによる</title>
		<link rel="alternate" type="text/html" href="https://wiki.blender.jp/index.php?title=%E5%88%A9%E7%94%A8%E8%80%85:Apinzonf/Dev:Doc/Tutorial_Modifier&amp;diff=137804&amp;oldid=prev"/>
		<updated>2012-08-06T02:38:30Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;新規ページ&lt;/b&gt;&lt;/p&gt;&lt;div&gt;= Tutorial Adding a New Modifier =&lt;br /&gt;
&lt;br /&gt;
In this tutorial you will learn the steps to create a new modifier in Blender.&lt;br /&gt;
&lt;br /&gt;
This tutorial is focused to people with a medium level of programming in (C, C++, python), and do not know the Blender source code.&lt;br /&gt;
&lt;br /&gt;
The development was done with [http://www.cmake.org CMake], [http://www.microsoft.com/visualstudio/en-us/products/2010-editions/express vs2010] and windows, but should be similar to other systems like SCons and Unix.&lt;br /&gt;
&lt;br /&gt;
You can read an introduction of the topic in [[Dev:Source/Modifiers/Adding]]&lt;br /&gt;
&lt;br /&gt;
== Directory Structure ==&lt;br /&gt;
&lt;br /&gt;
You can read wiki document about file structure [[Dev:2.5/Doc/Blender_Source/Files_structure]]&lt;br /&gt;
&lt;br /&gt;
To build blender need to select a directory we name as &amp;lt;tt&amp;gt;ANY FOLDER&amp;lt;/tt&amp;gt; where you'll make the following folders.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;ANY FOLDER/blender&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;ANY FOLDER/lib/windows&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;ANY FOLDER/build&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Download source code from svn repository== &lt;br /&gt;
&lt;br /&gt;
You can read wiki documentation about set up your local repository in [[Dev:2.5/Doc/Building_Blender/Windows/msvc/CMake]]&lt;br /&gt;
&lt;br /&gt;
For get Blender source code you need a svn client like [http://subversion.tigris.org/ svn command line] or [http://tortoisesvn.tigris.org/ svn graphical client]&lt;br /&gt;
&lt;br /&gt;
* In the command line of windows put this &amp;lt;br&amp;gt;cd ANY FOLDER &amp;lt;br&amp;gt;svn checkout https://svn.blender.org/svnroot/bf-blender/trunk/blender blender &amp;lt;br&amp;gt;svn checkout https://svn.blender.org/svnroot/bf-blender/trunk/lib/windows lib/windows&lt;br /&gt;
&lt;br /&gt;
* In the tortoise:&lt;br /&gt;
** Right click in ANY FOLDER/blender &amp;lt;br&amp;gt;and choose &amp;lt;b&amp;gt;SVN Checkout...&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;[[File:Apinzonf_GSOC_2012_Diagram_svn0.png|center|thumb|299px|svn Checkout ]]&lt;br /&gt;
** In the &amp;lt;b&amp;gt;URL of repository:&amp;lt;/b&amp;gt; put https://svn.blender.org/svnroot/bf-blender/trunk/blender&amp;lt;br&amp;gt;[[File:Apinzonf_GSOC_2012_Diagram_svn1.png|center|thumb|468px|Checkout Dialog]]&lt;br /&gt;
** Right click in ANY FOLDER/lib/windows &amp;lt;br&amp;gt;and choose &amp;lt;b&amp;gt;SVN Checkout...&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;in the &amp;lt;b&amp;gt;URL of repository:&amp;lt;/b&amp;gt; put https://svn.blender.org/svnroot/bf-blender/trunk/lib/windows&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Manual CMake Setup ==&lt;br /&gt;
&lt;br /&gt;
You can download and install CMake from [http://www.cmake.org www.cmake.org]&lt;br /&gt;
&lt;br /&gt;
You can find CMake in windows Menu: &amp;lt;b&amp;gt;CMake 2.8 -&amp;gt; Cmake (cmake gui)&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Your CMake application should look like the picture below&lt;br /&gt;
&lt;br /&gt;
[[File:Apinzonf_GSOC_2012_Diagram_Cmake1.png|center|thumb|662px|CMake gui ]]&lt;br /&gt;
&lt;br /&gt;
* In the field &amp;lt;b&amp;gt;Where is the source code:&amp;lt;/b&amp;gt; put the direction of &amp;lt;tt&amp;gt;ANY FOLDER/blender&amp;lt;/tt&amp;gt;&lt;br /&gt;
* In the field &amp;lt;b&amp;gt;Where is to build the binaries:&amp;lt;/b&amp;gt; put the direction of &amp;lt;tt&amp;gt;ANY FOLDER/build&amp;lt;/tt&amp;gt;&lt;br /&gt;
* Click in &amp;lt;b&amp;gt;Configure&amp;lt;/b&amp;gt; button, in the first time appear this dialog, and you choose Visual Studio 2010&lt;br /&gt;
[[File:Apinzonf_GSOC_2012_Diagram_Cmake0.png|center|thumb|500px|CMake gui ]]&lt;br /&gt;
&lt;br /&gt;
* Click in &amp;lt;b&amp;gt;Generate&amp;lt;/b&amp;gt; button&lt;br /&gt;
&lt;br /&gt;
== Build Blender using visual C++ 2010 ==&lt;br /&gt;
&lt;br /&gt;
After generating project files with Cmake, should appear the file &amp;lt;tt&amp;gt;ANY FOLDER/build/Bender.sln&amp;lt;/tt&amp;gt;, open that file, and set &amp;lt;b&amp;gt;Solution Configuration&amp;lt;/b&amp;gt; to &amp;lt;b&amp;gt;Release&amp;lt;/b&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:Apinzonf_GSOC_2012_Diagram_vs0.png|center|thumb|827px|Blender - Microsoft Visual Studio ]]&lt;br /&gt;
&lt;br /&gt;
In the &amp;lt;b&amp;gt;Solution Explorer&amp;lt;/b&amp;gt; locate the project &amp;lt;b&amp;gt;INSTALL&amp;lt;/b&amp;gt;, then right click on the project &amp;lt;b&amp;gt;INSTALL&amp;lt;/b&amp;gt; and select the option &amp;lt;b&amp;gt;Generate&amp;lt;/b&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
After completion of the compilation, you will find your own version of Blender in &amp;lt;tt&amp;gt;ANY FOLDER/build/bin/Release/blender.exe&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Adding a New Modifier =&lt;br /&gt;
&lt;br /&gt;
In the previous steps was obtained and compiled the source code, we now need to begin to add the modifier.&lt;br /&gt;
&lt;br /&gt;
This modifier will be very simple but contains all the elements to build something more complex.&lt;br /&gt;
&lt;br /&gt;
In this tutorial we will create a modifier for the scaling of the mesh.&lt;br /&gt;
&lt;br /&gt;
To create a new modifier in Blender, you need to modify a set of files and create several files to place our modifier algorithm.&lt;br /&gt;
&lt;br /&gt;
== Design the new modifier ==&lt;br /&gt;
&lt;br /&gt;
To create a modifier &amp;lt;b&amp;gt;&amp;quot;Scaling&amp;quot;&amp;lt;/b&amp;gt; we needs to interact with the GUI (&amp;lt;tt&amp;gt;rna_modifier.c, properties_data_modifier.py&amp;lt;/tt&amp;gt;) and be able to call a modifier over a method (&amp;lt;tt&amp;gt;MOD_scaling.c&amp;lt;/tt&amp;gt;) that receive the parameters of the modifier in some kind of structure (&amp;lt;tt&amp;gt;RNA_access.h, DNA_modifier_types.h, MOD_util.c&amp;lt;/tt&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
This is the list of files to be modified and created&lt;br /&gt;
&lt;br /&gt;
=== properties_data_modifier.py ===&lt;br /&gt;
&amp;lt;tt&amp;gt;ANY FOLDER/blender/release/scripts/startup/bl_ui/properties_data_modifier.py&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You must add a new function &amp;lt;tt&amp;gt;SCALING&amp;lt;/tt&amp;gt; in the class &amp;lt;tt&amp;gt;DATA_PT_modifiers&amp;lt;/tt&amp;gt;. This function sets the layout of the buttons and controls in the GUI.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;class DATA_PT_modifiers(ModifierButtonsPanel, Panel): &lt;br /&gt;
    ...&lt;br /&gt;
    def SCALING(self, layout, ob, md):&lt;br /&gt;
        split = layout.split(percentage=0.25)&lt;br /&gt;
        col = split.column()&lt;br /&gt;
        col.prop(md, &amp;quot;scaleui&amp;quot;)&lt;br /&gt;
    ...&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== DNA_modifier_types.h ===&lt;br /&gt;
&amp;lt;tt&amp;gt;ANY FOLDER/blender/source/blender/makesdna/DNA_modifier_types.h &amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Add a new modifier name to the ModifierType list, eModifierType_Scaling. Make sure the new entry comes before NUM_MODIFIER_TYPES, but does not modify the ordinal for any other modifier.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;typedef enum ModifierType {&lt;br /&gt;
	eModifierType_None = 0,&lt;br /&gt;
	...&lt;br /&gt;
	...&lt;br /&gt;
	eModifierType_Scaling,&lt;br /&gt;
	NUM_MODIFIER_TYPES&lt;br /&gt;
} ModifierType;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Add a new structure of your new modifier, at end of file of &amp;lt;tt&amp;gt;DNA_modifier_types.h&amp;lt;/tt&amp;gt;, and check that the structure meets the alignment requirements [[Dev:Source/Data_Structures/DNAStructs]]&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;typedef struct ScalingModifierData {&lt;br /&gt;
	ModifierData modifier;&lt;br /&gt;
	float scale;&lt;br /&gt;
	int pad; /* Variable needed to meet the alignment requirements */&lt;br /&gt;
} ScalingModifierData;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== RNA_access.h ===&lt;br /&gt;
&amp;lt;tt&amp;gt;ANY FOLDER/blender/source/blender/makesrna/RNA_access.h&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Add a new StructRNA declaration.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;extern StructRNA RNA_ScalingModifier;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== rna_modifier.c ===&lt;br /&gt;
&amp;lt;tt&amp;gt;ANY FOLDER/blender/source/blender/makesrna/intern/rna_modifier.c&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Add the new modifier to the modifier_type_items array. There are currently four categories it can go under: Modify, Generate, Deform, and Simulate. Entries within a category should be in alphabetical order. Add this modifier under &amp;lt;tt&amp;gt;{0, &amp;quot;&amp;quot;, 0, N_(&amp;quot;Deform&amp;quot;), &amp;quot;&amp;quot;}&amp;lt;/tt&amp;gt; block.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;EnumPropertyItem modifier_type_items[] = {&lt;br /&gt;
	...&lt;br /&gt;
	{0, &amp;quot;&amp;quot;, 0, N_(&amp;quot;Deform&amp;quot;), &amp;quot;&amp;quot;},&lt;br /&gt;
	...&lt;br /&gt;
	{eModifierType_Scaling, &amp;quot;SCALING&amp;quot;, ICON_MAN_SCALE, &amp;quot;Scaling the mesh&amp;quot;, &amp;quot;&amp;quot;},&lt;br /&gt;
	...&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In function &amp;lt;b&amp;gt;rna_Modifier_refine&amp;lt;/b&amp;gt;, add a new case for the modifier struct:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
static StructRNA *rna_Modifier_refine(struct PointerRNA *ptr)&lt;br /&gt;
{&lt;br /&gt;
	...&lt;br /&gt;
	switch (md-&amp;gt;type) {&lt;br /&gt;
		...&lt;br /&gt;
		case eModifierType_Scaling:&lt;br /&gt;
			return &amp;amp;RNA_ScalingModifier;&lt;br /&gt;
	...&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Add properties to the blender user interface with base on [[Dev:2.5/Source/Architecture/RNA]]&lt;br /&gt;
&lt;br /&gt;
Add new function &amp;lt;b&amp;gt;rna_def_modifier_scaling&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
static void rna_def_modifier_scaling(BlenderRNA *brna)&lt;br /&gt;
{&lt;br /&gt;
	StructRNA *srna;&lt;br /&gt;
	PropertyRNA *prop;&lt;br /&gt;
&lt;br /&gt;
	srna = RNA_def_struct(brna, &amp;quot;ScalingModifier&amp;quot;, &amp;quot;Modifier&amp;quot;);&lt;br /&gt;
	RNA_def_struct_ui_text(srna, &amp;quot;Scaling Modifier&amp;quot;, &amp;quot;Scaling effect modifier&amp;quot;);&lt;br /&gt;
	RNA_def_struct_sdna(srna, &amp;quot;ScalingModifierData&amp;quot;);&lt;br /&gt;
	RNA_def_struct_ui_icon(srna, ICON_MAN_SCALE);&lt;br /&gt;
&lt;br /&gt;
	/* scaleui: name for &amp;quot;properties_data_modifier.py&amp;quot;*/&lt;br /&gt;
	prop = RNA_def_property(srna, &amp;quot;scaleui&amp;quot;, PROP_FLOAT, PROP_NONE); &lt;br /&gt;
&lt;br /&gt;
	/*scale: name for &amp;quot;DNA_modifier_types.h&amp;quot;*/&lt;br /&gt;
	RNA_def_property_float_sdna(prop, NULL, &amp;quot;scale&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
	RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);&lt;br /&gt;
	RNA_def_property_ui_range(prop, -100, 100, 1, 3);&lt;br /&gt;
	RNA_def_property_ui_text(prop, &amp;quot;Scale&amp;quot;, &amp;quot;Scale factor&amp;quot;);&lt;br /&gt;
	RNA_def_property_update(prop, 0, &amp;quot;rna_Modifier_update&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Add line to defines new RNA function, invoke the previous function&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;void RNA_def_modifier(BlenderRNA *brna)&lt;br /&gt;
{&lt;br /&gt;
	...&lt;br /&gt;
	rna_def_modifier_remesh(brna);&lt;br /&gt;
	rna_def_modifier_skin(brna);&lt;br /&gt;
	rna_def_modifier_scaling(brna);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== CMakeLists.txt ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;ANY FOLDER/blender/source/blender/modifiers/CMakeLists.txt &amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Add a file name &amp;lt;tt&amp;gt;MOD_scaling.c&amp;lt;/tt&amp;gt; to bf_modifiers project&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cmake&amp;quot;&amp;gt;set(SRC&lt;br /&gt;
	...&lt;br /&gt;
	intern/MOD_scaling.c&lt;br /&gt;
	...&lt;br /&gt;
)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== MOD_modifiertypes.h ===&lt;br /&gt;
&amp;lt;tt&amp;gt;ANY FOLDER/blender/source/blender/modifiers/MOD_modifiertypes.h&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Add a new ModifierTypeInfo declaration.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;extern ModifierTypeInfo modifierType_Scaling;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== MOD_util.c ===&lt;br /&gt;
&amp;lt;tt&amp;gt;ANY FOLDER/blender/source/blender/modifiers/intern/MOD_util.c&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Add a new INIT_TYPE line.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;#define INIT_TYPE(typeName) (types[eModifierType_##typeName] = &amp;amp;modifierType_##typeName)&lt;br /&gt;
...&lt;br /&gt;
	INIT_TYPE(Scaling);&lt;br /&gt;
#undef INIT_TYPE&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== MOD_scaling.c ===&lt;br /&gt;
&amp;lt;tt&amp;gt;ANY FOLDER/blender/source/blender/modifiers/intern/MOD_scaling.c&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Create a new file name as &amp;lt;tt&amp;gt;MOD_scaling.c&amp;lt;/tt&amp;gt; in the folder &amp;lt;tt&amp;gt;ANY FOLDER/blender/source/blender/modifiers/intern/&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
 * ***** BEGIN GPL LICENSE BLOCK *****&lt;br /&gt;
 *&lt;br /&gt;
 * This program is free software; you can redistribute it and/or&lt;br /&gt;
 * modify it under the terms of the GNU General Public License&lt;br /&gt;
 * as published by the Free Software Foundation; either version 2&lt;br /&gt;
 * of the License, or (at your option) any later version.&lt;br /&gt;
 *&lt;br /&gt;
 * This program is distributed in the hope that it will be useful,&lt;br /&gt;
 * but WITHOUT ANY WARRANTY; without even the implied warranty of&lt;br /&gt;
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the&lt;br /&gt;
 * GNU General Public License for more details.&lt;br /&gt;
 *&lt;br /&gt;
 * You should have received a copy of the GNU General Public License&lt;br /&gt;
 * along with this program; if not, write to the Free Software  Foundation,&lt;br /&gt;
 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.&lt;br /&gt;
 *&lt;br /&gt;
 * The Original Code is Copyright (C) 2005 by the Blender Foundation.&lt;br /&gt;
 * All rights reserved.&lt;br /&gt;
 *&lt;br /&gt;
 * Contributor(s): Your name&lt;br /&gt;
 *&lt;br /&gt;
 * ***** END GPL LICENSE BLOCK *****&lt;br /&gt;
 *&lt;br /&gt;
 */&lt;br /&gt;
&lt;br /&gt;
/** \file blender/modifiers/intern/MOD_scaling.c&lt;br /&gt;
 *  \ingroup modifiers&lt;br /&gt;
 */&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#include &amp;quot;DNA_meshdata_types.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
#include &amp;quot;BLI_math.h&amp;quot;&lt;br /&gt;
#include &amp;quot;BLI_utildefines.h&amp;quot;&lt;br /&gt;
#include &amp;quot;BLI_string.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
#include &amp;quot;MEM_guardedalloc.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
#include &amp;quot;BKE_cdderivedmesh.h&amp;quot;&lt;br /&gt;
#include &amp;quot;BKE_particle.h&amp;quot;&lt;br /&gt;
#include &amp;quot;BKE_deform.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
#include &amp;quot;MOD_modifiertypes.h&amp;quot;&lt;br /&gt;
#include &amp;quot;MOD_util.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
static void initData(ModifierData *md)&lt;br /&gt;
{&lt;br /&gt;
	ScalingModifierData *smd = (ScalingModifierData *) md;&lt;br /&gt;
	smd-&amp;gt;scale = 1.0f;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
static void copyData(ModifierData *md, ModifierData *target)&lt;br /&gt;
{&lt;br /&gt;
	ScalingModifierData *smd = (ScalingModifierData *) md;&lt;br /&gt;
	ScalingModifierData *tsmd = (ScalingModifierData *) target;&lt;br /&gt;
	tsmd-&amp;gt;scale = smd-&amp;gt;scale;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
static int isDisabled(ModifierData *md, int UNUSED(useRenderParams))&lt;br /&gt;
{&lt;br /&gt;
	ScalingModifierData *smd = (ScalingModifierData *) md;&lt;br /&gt;
	/* disable if modifier is 1.0 for scale*/&lt;br /&gt;
	if (smd-&amp;gt;scale == 1.0f) return 1;&lt;br /&gt;
	return 0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md)&lt;br /&gt;
{&lt;br /&gt;
	ScalingModifierData *smd = (ScalingModifierData *)md;&lt;br /&gt;
	CustomDataMask dataMask = 0;&lt;br /&gt;
	return dataMask;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
static void ScalingModifier_do(&lt;br /&gt;
        ScalingModifierData *smd, Object *ob, DerivedMesh *dm,&lt;br /&gt;
        float (*vertexCos)[3], int numVerts)&lt;br /&gt;
{&lt;br /&gt;
	int i;&lt;br /&gt;
	float scale;&lt;br /&gt;
	scale = smd-&amp;gt;scale;&lt;br /&gt;
&lt;br /&gt;
	for (i = 0; i &amp;lt; numVerts; i++) {&lt;br /&gt;
		vertexCos[i][0] = vertexCos[i][0] * scale;&lt;br /&gt;
		vertexCos[i][1] = vertexCos[i][1] * scale;&lt;br /&gt;
		vertexCos[i][2] = vertexCos[i][2] * scale;&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
static void deformVerts(ModifierData *md, Object *ob, DerivedMesh *derivedData,&lt;br /&gt;
                        float (*vertexCos)[3], int numVerts, ModifierApplyFlag UNUSED(flag))&lt;br /&gt;
{&lt;br /&gt;
	DerivedMesh *dm = get_dm(ob, NULL, derivedData, NULL, 0);&lt;br /&gt;
&lt;br /&gt;
	ScalingModifier_do((ScalingModifierData *)md, ob, dm,&lt;br /&gt;
	                  vertexCos, numVerts);&lt;br /&gt;
&lt;br /&gt;
	if (dm != derivedData)&lt;br /&gt;
		dm-&amp;gt;release(dm);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
static void deformVertsEM(&lt;br /&gt;
        ModifierData *md, Object *ob, struct BMEditMesh *editData,&lt;br /&gt;
        DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts)&lt;br /&gt;
{&lt;br /&gt;
	DerivedMesh *dm = get_dm(ob, editData, derivedData, NULL, 0);&lt;br /&gt;
&lt;br /&gt;
	ScalingModifier_do((ScalingModifierData *)md, ob, dm,&lt;br /&gt;
	                  vertexCos, numVerts);&lt;br /&gt;
&lt;br /&gt;
	if (dm != derivedData)&lt;br /&gt;
		dm-&amp;gt;release(dm);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
ModifierTypeInfo modifierType_Scaling = {&lt;br /&gt;
	/* name */              &amp;quot;Scaling&amp;quot;,&lt;br /&gt;
	/* structName */        &amp;quot;ScalingModifierData&amp;quot;,&lt;br /&gt;
	/* structSize */        sizeof(ScalingModifierData),&lt;br /&gt;
	/* type */              eModifierTypeType_OnlyDeform,&lt;br /&gt;
	/* flags */             eModifierTypeFlag_AcceptsMesh |&lt;br /&gt;
	                        eModifierTypeFlag_SupportsEditmode,&lt;br /&gt;
&lt;br /&gt;
	/* copyData */          copyData,&lt;br /&gt;
	/* deformVerts */       deformVerts,&lt;br /&gt;
	/* deformMatrices */    NULL,&lt;br /&gt;
	/* deformVertsEM */     deformVertsEM,&lt;br /&gt;
	/* deformMatricesEM */  NULL,&lt;br /&gt;
	/* applyModifier */     NULL,&lt;br /&gt;
	/* applyModifierEM */   NULL,&lt;br /&gt;
	/* initData */          initData,&lt;br /&gt;
	/* requiredDataMask */  requiredDataMask,&lt;br /&gt;
	/* freeData */          NULL,&lt;br /&gt;
	/* isDisabled */        isDisabled,&lt;br /&gt;
	/* updateDepgraph */    NULL,&lt;br /&gt;
	/* dependsOnTime */     NULL,&lt;br /&gt;
	/* dependsOnNormals */	NULL,&lt;br /&gt;
	/* foreachObjectLink */ NULL,&lt;br /&gt;
	/* foreachIDLink */     NULL,&lt;br /&gt;
	/* foreachTexLink */    NULL,&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The most important funcion in the file MOD_scaling.c is&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
static void ScalingModifier_do(&lt;br /&gt;
        ScalingModifierData *smd, Object *ob, DerivedMesh *dm,&lt;br /&gt;
        float (*vertexCos)[3], int numVerts)&lt;br /&gt;
{&lt;br /&gt;
	int i;&lt;br /&gt;
	float scale;&lt;br /&gt;
	scale = smd-&amp;gt;scale;&lt;br /&gt;
 &lt;br /&gt;
	for (i = 0; i &amp;lt; numVerts; i++) {&lt;br /&gt;
		vertexCos[i][0] = vertexCos[i][0] * scale;&lt;br /&gt;
		vertexCos[i][1] = vertexCos[i][1] * scale;&lt;br /&gt;
		vertexCos[i][2] = vertexCos[i][2] * scale;&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In that function you scale every vertex in the mesh by the factor scale;&lt;br /&gt;
&lt;br /&gt;
== Configurate and Compile ==&lt;br /&gt;
&lt;br /&gt;
For changes in the CMakeLists.txt file to take effect, you must rerun CMake (cmake-gui) and click on Configure and Generate.&lt;br /&gt;
&lt;br /&gt;
Then you must reopen the file Blender.sln, and Generate the project INSTALL.&lt;/div&gt;</summary>
		<author><name>wiki&gt;Apinzonf</name></author>
		
	</entry>
</feed>