﻿<?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=Dev%3ASource%2FModifiers%2FStack%2FAPI_Reference</id>
	<title>Dev:Source/Modifiers/Stack/API Reference - 版の履歴</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.blender.jp/index.php?action=history&amp;feed=atom&amp;title=Dev%3ASource%2FModifiers%2FStack%2FAPI_Reference"/>
	<link rel="alternate" type="text/html" href="https://wiki.blender.jp/index.php?title=Dev:Source/Modifiers/Stack/API_Reference&amp;action=history"/>
	<updated>2026-05-18T22:44:58Z</updated>
	<subtitle>このウィキのこのページに関する変更履歴</subtitle>
	<generator>MediaWiki 1.31.0</generator>
	<entry>
		<id>https://wiki.blender.jp/index.php?title=Dev:Source/Modifiers/Stack/API_Reference&amp;diff=55590&amp;oldid=prev</id>
		<title>Yamyam: 1版 をインポートしました</title>
		<link rel="alternate" type="text/html" href="https://wiki.blender.jp/index.php?title=Dev:Source/Modifiers/Stack/API_Reference&amp;diff=55590&amp;oldid=prev"/>
		<updated>2018-06-28T17:52:02Z</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日 (木) 17:52時点における版&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=Dev:Source/Modifiers/Stack/API_Reference&amp;diff=55589&amp;oldid=prev</id>
		<title>wiki&gt;Jaggz: /* Adding a modifier type */</title>
		<link rel="alternate" type="text/html" href="https://wiki.blender.jp/index.php?title=Dev:Source/Modifiers/Stack/API_Reference&amp;diff=55589&amp;oldid=prev"/>
		<updated>2017-04-14T02:59:31Z</updated>

		<summary type="html">&lt;p&gt;‎&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;Adding a modifier type&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;新規ページ&lt;/b&gt;&lt;/p&gt;&lt;div&gt;=Overview=&lt;br /&gt;
== ModifierTypeInfo ==&lt;br /&gt;
The modifier stack accesses modifiers through a standard interface. The interface for each modifier is stored as a set of callback function pointers in a &amp;lt;code&amp;gt;ModifierTypeInfo&amp;lt;/code&amp;gt; structure (defined in ''BKE_modifier.h''). There is a static array of these structures (one for each modifier type) accessible through the &amp;lt;code&amp;gt;modifierType_getInfo&amp;lt;/code&amp;gt; function defined in ''modifier.c''.&lt;br /&gt;
&lt;br /&gt;
== ModifierData ==&lt;br /&gt;
The data for a specific instance of a certain modifier type is stored in a &amp;lt;code&amp;gt;&amp;lt;type&amp;gt;ModifierData&amp;lt;/code&amp;gt; structure (e.g. &amp;lt;code&amp;gt;MirrorModifierData&amp;lt;/code&amp;gt; for the Mirror modifier), defined in ''DNA_modifier_types.h''. Each &amp;lt;code&amp;gt;&amp;lt;type&amp;gt;ModifierData&amp;lt;/code&amp;gt; structure must include, as its first field, a &amp;lt;code&amp;gt;ModifierData&amp;lt;/code&amp;gt; structure which contains a type identifier. This type identifier is passed to the &amp;lt;code&amp;gt;modifierType_getInfo&amp;lt;/code&amp;gt; function to retrieve a &amp;lt;code&amp;gt;ModifierTypeInfo&amp;lt;/code&amp;gt; structure describing the modifier type. Since the &amp;lt;code&amp;gt;ModifierData&amp;lt;/code&amp;gt; structure is the first field, any &amp;lt;code&amp;gt;&amp;lt;type&amp;gt;ModifierData&amp;lt;/code&amp;gt; pointer can be cast to a &amp;lt;code&amp;gt;ModifierData&amp;lt;/code&amp;gt; pointer and used to directly retrieve the type identifier.&lt;br /&gt;
&lt;br /&gt;
== Required vs. Optional functions ==&lt;br /&gt;
Some callback functions in &amp;lt;code&amp;gt;ModifierTypeInfo&amp;lt;/code&amp;gt; are '''required''', others are '''optional''' (these should be set to NULL if not implemented). Additionally, modifiers can be classified as either deforming or non-deforming, which affects which callback functions they are required to implement.&lt;br /&gt;
&lt;br /&gt;
== Adding a modifier type ==&lt;br /&gt;
To add a modifier type, the following things must be done (where &amp;lt;code&amp;gt;&amp;lt;type&amp;gt;&amp;lt;/code&amp;gt; is the one-word name of the modifier):&lt;br /&gt;
* Add an &amp;lt;code&amp;gt;eModifierType_&amp;lt;type&amp;gt;&amp;lt;/code&amp;gt; entry at the end of the &amp;lt;code&amp;gt;ModifierType&amp;lt;/code&amp;gt; enum in ''DNA_modifier_types.h'' (just before &amp;lt;code&amp;gt;NUM_MODIFIER_TYPES&amp;lt;/code&amp;gt; - the position is important to make sure all the other type values stay the same)&lt;br /&gt;
* Add a &amp;lt;code&amp;gt;&amp;lt;type&amp;gt;ModifierData&amp;lt;/code&amp;gt; structure definition to ''DNA_modifier_types.h'' (following the example of the existing structures and the guidelines in [[Dev:Source/Data Structures/DNAStructs|BlenderDev/DNAStructs]])&lt;br /&gt;
* Add function definitions to ''modifier.c''. The current convention is to name them &amp;lt;code&amp;gt;&amp;lt;type&amp;gt;Modifier_&amp;lt;functionName&amp;gt;&amp;lt;/code&amp;gt;, where &amp;lt;code&amp;gt;&amp;lt;type&amp;gt;&amp;lt;/code&amp;gt; is spelt starting with a lowercase letter (e.g. &amp;lt;code&amp;gt;curveModifier_deformVerts&amp;lt;/code&amp;gt;).&lt;br /&gt;
* Add a section to the &amp;lt;code&amp;gt;modifierType_getInfo&amp;lt;/code&amp;gt; function in ''modifier.c'' initialising the &amp;lt;code&amp;gt;ModifierTypeInfo&amp;lt;/code&amp;gt; structure for the new modifier (using the &amp;lt;code&amp;gt;INIT_TYPE&amp;lt;/code&amp;gt; macro and following the example of the existing sections)&lt;br /&gt;
* RNA wrap the modifier in ''rna_modifier.c'', by adding a function &amp;lt;code&amp;gt;static void rna_def_modifier_&amp;lt;type&amp;gt;(BlenderRNA *brna)&amp;lt;/code&amp;gt; similar to other modifiers.&lt;br /&gt;
* Add &amp;lt;code&amp;gt;def &amp;lt;type&amp;gt;(self, layout, ob, md, wide_ui):&amp;lt;/code&amp;gt; sections to the &amp;lt;code&amp;gt;DATA_PT_modifiers&amp;lt;/code&amp;gt; class in ''properties_data_modifier.py'', following the example of the existing sections.&lt;br /&gt;
&lt;br /&gt;
= Required functions =&lt;br /&gt;
== All Modifiers ==&lt;br /&gt;
=== copyData ===&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
 void copyData(ModifierData *''md'', ModifierData *''target'')&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
:Copy instance data for this modifier type. Should copy all user level settings to the target modifier.&lt;br /&gt;
&lt;br /&gt;
== Deforming modifiers ==&lt;br /&gt;
=== deformVerts ===&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
 void deformVerts(ModifierData *''md'', struct Object *''ob'',&lt;br /&gt;
                  struct DerivedMesh *''derivedData'', float (*''vertexCos'')[3],&lt;br /&gt;
                  int ''numVerts'')&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
:Should apply the deformation to the given vertex array.&lt;br /&gt;
:* If the deformer requires information from the object it can obtain it from the derivedData argument if non-NULL, and otherwise the ob argument. The derivedData argument should not be changed.&lt;br /&gt;
&lt;br /&gt;
=== deformVertsEM ===&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
 void deformVertsEM(ModifierData *''md'', struct Object *''ob'',&lt;br /&gt;
                    struct EditMesh *''editData'', struct DerivedMesh *''derivedData'',&lt;br /&gt;
                    float (*''vertexCos'')[3], int ''numVerts'')&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
:Like deformVerts but called during editmode (for modifiers which support editmode).&lt;br /&gt;
&lt;br /&gt;
== Non-deforming modifiers ==&lt;br /&gt;
=== applyModifier ===&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
 DerivedMesh *applyModifier(ModifierData *''md'', struct Object *''ob'',&lt;br /&gt;
                            struct DerivedMesh *''derivedData'',&lt;br /&gt;
                            int ''useRenderParams'', int ''isFinalCalc'')&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
:Should apply the modifier and return a DerivedMesh object (type is dependent on object type).&lt;br /&gt;
:* The derivedData argument will always be non-NULL; the modifier should read the mesh data from derivedData instead of the actual object data. &lt;br /&gt;
:* The useRenderParams argument indicates if the modifier is being applied in the service of the renderer (which may alter quality settings).&lt;br /&gt;
:* The isFinalCalc parameter indicates if the modifier is being calculated for a final result or for something temporary (like orcos). This is a hack at the moment, it is meant so subsurf can know if it is safe to reuse its internal cache.&lt;br /&gt;
:* The modifier may reuse the derivedData argument (i.e. return it in modified form), but must not release it.&lt;br /&gt;
&lt;br /&gt;
=== applyModifierEM ===&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
 DerivedMesh *applyModifierEM(ModifierData *''md'', struct Object *''ob'',&lt;br /&gt;
                              struct EditMesh *''editData'', struct DerivedMesh *''derivedData'')&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
:Like applyModifier but called during editmode (for modifiers which support editmode).&lt;br /&gt;
:* The DerivedMesh that is returned must support the operations that are expected from editmode objects. The same qualifications regarding derivedData apply as for applyModifier.&lt;br /&gt;
&lt;br /&gt;
= Optional functions =&lt;br /&gt;
== All Modifiers ==&lt;br /&gt;
=== initData ===&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
 void initData(ModifierData *''md'')&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
:Initialize new instance data for this modifier type. This function should set modifier variables to their default values.&lt;br /&gt;
&lt;br /&gt;
=== freeData ===&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
 void freeData(ModifierData *''md'')&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
:Should free internal modifier data variables. This function should not free the md variable itself.&lt;br /&gt;
&lt;br /&gt;
=== requiredDataMask ===&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
 CustomDataMask requiredDataMask(struct ModifierData *''md'')&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
:Should return a CustomDataMask indicating what data this modifier needs. If (mask &amp;amp; (1 &amp;lt;&amp;lt; (layer type))) != 0, this modifier needs that custom data layer. This function's return value can change depending on the modifier's settings.&lt;br /&gt;
:* Note that this means extra data (e.g. vertex groups) - it is assumed that all modifiers need mesh data and deform modifiers need vertex coordinates.&lt;br /&gt;
:* If this function is not present or it returns 0, it is assumed that no extra data is needed.&lt;br /&gt;
&lt;br /&gt;
=== isDisabled ===&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
 int isDisabled(ModifierData *''md'')&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
:Should return a boolean value indicating if this modifier is able to be calculated based on the modifier data. This is *not* regarding md-&amp;gt;flag (that is tested by the system); this just tests if the data validates (for example, a lattice will return false if the lattice object is not defined). If this function is not present, the modifier is assumed to never be disabled.&lt;br /&gt;
&lt;br /&gt;
=== updateDepgraph ===&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
 void updateDepgraph(ModifierData *''md'', struct DagForest *''forest'',&lt;br /&gt;
                     struct Object *''ob'', struct DagNode *''obNode'')&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
:Should add the appropriate relations to the [[Dev:Source/Data System/DependancyGraph|dependancy graph]] depending on the modifier data. These relations are used by Blender to determine when the modifier stack needs to be re-evaluated.&lt;br /&gt;
&lt;br /&gt;
=== dependsOnTime ===&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
 int dependsOnTime(ModifierData *''md'')&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
:Should return true if the modifier needs to be recalculated on time changes. This function is assumed to return false if not present.&lt;br /&gt;
&lt;br /&gt;
=== foreachObjectLink ===&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
 void foreachObjectLink(ModifierData *''md'', struct Object *''ob'',&lt;br /&gt;
                        ObjectWalkFunc ''walk'', void *''userData'')&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
:Should call the given walk function with a pointer to each Object pointer that the modifier data stores. This is used for unlinking objects or forwarding object references, and for linking on file load if foreachIDLink is not present.&lt;br /&gt;
:* If a modifier stores Object pointers, it should probably implement this function.&lt;br /&gt;
&lt;br /&gt;
=== foreachIDLink ===&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
 void foreachIDLink(ModifierData *''md'', struct Object *''ob'',&lt;br /&gt;
                    IDWalkFunc ''walk'', void *''userData'')&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
:Should call the given walk function with a pointer to each ID pointer (i.e. each datablock pointer) that the modifier data stores. This is used for linking on file load and for unlinking datablocks or forwarding datablock references.&lt;br /&gt;
:* If this function is not present and foreachObjectLink is, foreachObjectLink will be used.&lt;br /&gt;
:* If a modifier stores datablock pointers (including Object pointers), it should probably implement this function.&lt;br /&gt;
&lt;br /&gt;
= Enumerations =&lt;br /&gt;
== ModifierTypeType ==&lt;br /&gt;
=== eModifierTypeType_None ===&lt;br /&gt;
:Should not be used, only for None modifier type&lt;br /&gt;
&lt;br /&gt;
=== eModifierTypeType_OnlyDeform ===&lt;br /&gt;
:Modifier only does deformation, implies that modifier type should have a valid deformVerts function. OnlyDeform style modifiers implicitly accept either mesh or CV input but should still declare flags appropriately.&lt;br /&gt;
&lt;br /&gt;
=== eModifierTypeType_Constructive ===&lt;br /&gt;
&lt;br /&gt;
=== eModifierTypeType_Nonconstructive ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== ModifierTypeFlag ==&lt;br /&gt;
=== eModifierTypeFlag_AcceptsMesh ===&lt;br /&gt;
&lt;br /&gt;
=== eModifierTypeFlag_AcceptsCVs ===&lt;br /&gt;
&lt;br /&gt;
=== eModifierTypeFlag_SupportsMapping ===&lt;br /&gt;
&lt;br /&gt;
=== eModifierTypeFlag_SupportsEditmode ===&lt;br /&gt;
&lt;br /&gt;
=== eModifierTypeFlag_EnableInEditmode ===&lt;br /&gt;
:For modifiers that support editmode this determines if the modifier should be enabled by default in editmode. This should only be used by modifiers that are relatively speedy and also generally used in editmode, otherwise let the user enable it by hand.&lt;br /&gt;
&lt;br /&gt;
=== eModifierTypeFlag_RequiresOriginalData ===&lt;br /&gt;
:For modifiers that require original data and so cannot be placed after any non-deformative modifier.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Data types =&lt;br /&gt;
== ObjectWalkFunc ==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
 typedef void (*ObjectWalkFunc)(void *userData, Object *ob, Object **obpoin)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
:A pointer to a function to be called on each object pointer in the modifier data; passed to &amp;lt;code&amp;gt;forEachObjectLink&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== IDWalkFunc ==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
 typedef void (*IDWalkFunc)(void *userData, Object *ob, ID **idpoin)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
:A pointer to a function to be called on each ID pointer in the modifier data; passed to &amp;lt;code&amp;gt;forEachIDLink&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Script]]&lt;/div&gt;</summary>
		<author><name>wiki&gt;Jaggz</name></author>
		
	</entry>
</feed>