﻿<?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%3AKwk%2FGSoC2010%2FFasterWayToAddMaps</id>
	<title>利用者:Kwk/GSoC2010/FasterWayToAddMaps - 版の履歴</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%3AKwk%2FGSoC2010%2FFasterWayToAddMaps"/>
	<link rel="alternate" type="text/html" href="https://wiki.blender.jp/index.php?title=%E5%88%A9%E7%94%A8%E8%80%85:Kwk/GSoC2010/FasterWayToAddMaps&amp;action=history"/>
	<updated>2026-08-02T06:59:43Z</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:Kwk/GSoC2010/FasterWayToAddMaps&amp;diff=99123&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:Kwk/GSoC2010/FasterWayToAddMaps&amp;diff=99123&amp;oldid=prev"/>
		<updated>2018-06-28T19:38:35Z</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日 (木) 19:38時点における版&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:Kwk/GSoC2010/FasterWayToAddMaps&amp;diff=99122&amp;oldid=prev</id>
		<title>wiki&gt;Kwk: Footer</title>
		<link rel="alternate" type="text/html" href="https://wiki.blender.jp/index.php?title=%E5%88%A9%E7%94%A8%E8%80%85:Kwk/GSoC2010/FasterWayToAddMaps&amp;diff=99122&amp;oldid=prev"/>
		<updated>2010-08-16T12:57:15Z</updated>

		<summary type="html">&lt;p&gt;Footer&lt;/p&gt;
&lt;p&gt;&lt;b&gt;新規ページ&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{Page/Header|soc-2010-kwk|User:Kwk|User:Kwk/Gsoc2010/AutoSelectPaintImage}}&lt;br /&gt;
&lt;br /&gt;
=About=&lt;br /&gt;
This page is about a task in my GSoC 2010 project.&lt;br /&gt;
&lt;br /&gt;
=Situation=&lt;br /&gt;
&lt;br /&gt;
Currently there are quite a lot of steps needed to add bump, specular and diffuse maps to the currently active material.&lt;br /&gt;
&lt;br /&gt;
=Purpose=&lt;br /&gt;
&lt;br /&gt;
The purpose of this task was to simplify the setup the above steps. Of course, the parameters of each map need to be adjusted by the artist for tweaking, but the setup is basically always the same for all the maps:&lt;br /&gt;
&lt;br /&gt;
# Select a material&lt;br /&gt;
# Add a texture&lt;br /&gt;
## Name the texture&lt;br /&gt;
# Set the texture to use an image&lt;br /&gt;
# Create an image to be used in the texture&lt;br /&gt;
## Name the image&lt;br /&gt;
# Adjust the influence settings for the texutre regarding the type of map (bump, specular, diffuse, ...)&lt;br /&gt;
&lt;br /&gt;
=End-User documentation=&lt;br /&gt;
&lt;br /&gt;
To add bump, specular and diffuse maps to the next slot of the current active material, you can either chose the hard way of setting everything up yourself or you can do it the following way:&lt;br /&gt;
&lt;br /&gt;
# Start Blender.&lt;br /&gt;
# With the default cube selected, go to the UV/Image Editor.&lt;br /&gt;
&lt;br /&gt;
[[Image:soc-2010-kwk-add_map_001_switch_to_uv_image_editor.png|Shows how to go to UV/Image Editor.]]&lt;br /&gt;
&lt;br /&gt;
# Show the view properties by hitting either {{Shortcut|N}} or clicking on &amp;quot;View&amp;quot; and then &amp;quot;Properties&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
[[Image:soc-2010-kwk-add_map_002_show_properties.png|How to enable view properties.]]&lt;br /&gt;
&lt;br /&gt;
# Add as many bump, specular, or diffuse maps as you like&lt;br /&gt;
&lt;br /&gt;
[[Image:Soc-2010-kwk-add_map_003_find_buttons.png|The new buttons to add maps with default setup for later tweaking.]]&lt;br /&gt;
&lt;br /&gt;
This Video [http://vimeo.com/12864832] shows both, the old and the new shorter way to add maps.&lt;br /&gt;
&lt;br /&gt;
{{Note|Please remember,|no standard functionality is changed with those three buttons.}}&lt;br /&gt;
&lt;br /&gt;
=Technical details=&lt;br /&gt;
&lt;br /&gt;
For this feature, only Python coding was needed. Since the patch is pretty short I include it here. It should be self-explanatory&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;diff&amp;quot;&amp;gt;&lt;br /&gt;
Index: release/scripts/ui/space_image.py&lt;br /&gt;
===================================================================&lt;br /&gt;
--- release/scripts/ui/space_image.py	(Revision 31363)&lt;br /&gt;
+++ release/scripts/ui/space_image.py	(Arbeitskopie)&lt;br /&gt;
@@ -663,6 +663,31 @@&lt;br /&gt;
         row.operator(&amp;quot;brush.curve_preset&amp;quot;, icon=&amp;quot;LINCURVE&amp;quot;, text=&amp;quot;&amp;quot;).shape = 'LINE'&lt;br /&gt;
         row.operator(&amp;quot;brush.curve_preset&amp;quot;, icon=&amp;quot;NOCURVE&amp;quot;, text=&amp;quot;&amp;quot;).shape = 'MAX'&lt;br /&gt;
 &lt;br /&gt;
+class IMAGE_PT_paint_add_map(bpy.types.Panel):&lt;br /&gt;
+    bl_space_type = 'IMAGE_EDITOR'&lt;br /&gt;
+    bl_region_type = 'UI'&lt;br /&gt;
+    bl_label = &amp;quot;Add Maps&amp;quot;&lt;br /&gt;
+    bl_context = &amp;quot;texture&amp;quot;&lt;br /&gt;
+    bl_default_closed = False&lt;br /&gt;
+&lt;br /&gt;
+    @classmethod&lt;br /&gt;
+    def poll(self, context):&lt;br /&gt;
+        # TBD&lt;br /&gt;
+        return True       &lt;br /&gt;
+&lt;br /&gt;
+    def draw(self, context):&lt;br /&gt;
+        layout = self.layout&lt;br /&gt;
+&lt;br /&gt;
+        row = layout.row()&lt;br /&gt;
+&lt;br /&gt;
+        split = layout.split()&lt;br /&gt;
+&lt;br /&gt;
+        row = split.row(align=True)&lt;br /&gt;
+        row.label(text=&amp;quot;Add:&amp;quot;)&lt;br /&gt;
+        row.operator(&amp;quot;image.material_add_map&amp;quot;, text=&amp;quot;Diffuse&amp;quot;).channel_type = 'DIFFUSE' # , icon='FILE_IMAGE'&lt;br /&gt;
+        row.operator(&amp;quot;image.material_add_map&amp;quot;, text=&amp;quot;Bump&amp;quot;).channel_type = 'BUMP'&lt;br /&gt;
+        row.operator(&amp;quot;image.material_add_map&amp;quot;, text=&amp;quot;Specular&amp;quot;).channel_type = 'SPECULAR'&lt;br /&gt;
+&lt;br /&gt;
 def register():&lt;br /&gt;
     pass&lt;br /&gt;
 &lt;br /&gt;
Index: release/scripts/op/image.py&lt;br /&gt;
===================================================================&lt;br /&gt;
--- release/scripts/op/image.py	(Revision 31363)&lt;br /&gt;
+++ release/scripts/op/image.py	(Arbeitskopie)&lt;br /&gt;
@@ -188,7 +188,72 @@&lt;br /&gt;
 &lt;br /&gt;
         return {'FINISHED'}&lt;br /&gt;
 &lt;br /&gt;
+def check_free_texture_slots(mat):&lt;br /&gt;
+    &amp;quot;&amp;quot;&amp;quot;Returns True if there are texture slots free in mat; otherwise False is returned&amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
+    if mat != None:&lt;br /&gt;
+        for slot in mat.texture_slots:&lt;br /&gt;
+            if slot == None:&lt;br /&gt;
+                return True&lt;br /&gt;
+    return False&lt;br /&gt;
 &lt;br /&gt;
+class MaterialAddMap(bpy.types.Operator):&lt;br /&gt;
+    '''Add new map (e.g. diffuse, bump, specular) to the active material's next free texture slot.'''&lt;br /&gt;
+    bl_idname = &amp;quot;image.material_add_map&amp;quot;&lt;br /&gt;
+    bl_label = &amp;quot;Add Map&amp;quot;&lt;br /&gt;
+    bl_options = {'REGISTER', 'UNDO'}&lt;br /&gt;
+&lt;br /&gt;
+    channel_type = bpy.props.EnumProperty(items=(&lt;br /&gt;
+            ('DIFFUSE', &amp;quot;Diffuse Map&amp;quot;, &amp;quot;A 32 Bit RGB(A) color map&amp;quot;),&lt;br /&gt;
+            ('SPECULAR', &amp;quot;Specular Map&amp;quot;, &amp;quot;A 8 Bit greyscale map&amp;quot;),&lt;br /&gt;
+            ('BUMP', &amp;quot;Bump Map&amp;quot;, &amp;quot;A 8 Bit greyscale map&amp;quot;)&lt;br /&gt;
+            ),                &lt;br /&gt;
+            name=&amp;quot;Channel Type&amp;quot;,&lt;br /&gt;
+            description=&amp;quot;This defines how the new image will be used in the texture.&amp;quot;,&lt;br /&gt;
+            default='DIFFUSE')&lt;br /&gt;
+&lt;br /&gt;
+    @classmethod&lt;br /&gt;
+    def poll(self, context):&lt;br /&gt;
+        ''' Tests if a texture slot is free '''&lt;br /&gt;
+        mat = bpy.context.active_object.active_material&lt;br /&gt;
+        return check_free_texture_slots(mat)   &lt;br /&gt;
+    &lt;br /&gt;
+    def execute(self, context):&lt;br /&gt;
+        ctype = self.properties.channel_type&lt;br /&gt;
+        mat = bpy.context.active_object.active_material&lt;br /&gt;
+        tex = None&lt;br /&gt;
+        &lt;br /&gt;
+        # Tests if a texture slot is free&lt;br /&gt;
+        if check_free_texture_slots(mat):&lt;br /&gt;
+            tex = bpy.data.textures.new(ctype)&lt;br /&gt;
+        &lt;br /&gt;
+        if tex != None:            &lt;br /&gt;
+            # Set texture type to be an bpy.types.ImageTexture object&lt;br /&gt;
+            tex.type = 'IMAGE'&lt;br /&gt;
+            tex = tex.recast_type()&lt;br /&gt;
+            &lt;br /&gt;
+            # Decide which parts shall be influenced by the image texture&lt;br /&gt;
+            if ctype == 'DIFFUSE':&lt;br /&gt;
+                mat.add_texture(tex, texture_coordinates='UV', map_to='COLOR')&lt;br /&gt;
+            elif ctype == 'BUMP':&lt;br /&gt;
+                mat.add_texture(tex, texture_coordinates='UV', map_to='NORMAL')&lt;br /&gt;
+            elif ctype == 'SPECULAR':&lt;br /&gt;
+                mat.add_texture(tex, texture_coordinates='UV', map_to='SPECULARITY')&lt;br /&gt;
+&lt;br /&gt;
+            mat.texture_slots[tex.name]&lt;br /&gt;
+               &lt;br /&gt;
+            # Create a new image (named after &lt;br /&gt;
+            img = bpy.data.images.new(ctype)&lt;br /&gt;
+    &lt;br /&gt;
+            # Set image file format&lt;br /&gt;
+            # If I remember correctly, this is default.&lt;br /&gt;
+            img.file_format = 'TARGA'&lt;br /&gt;
+            &lt;br /&gt;
+            # Assign image to texture            &lt;br /&gt;
+            tex.image = img&lt;br /&gt;
+            &lt;br /&gt;
+&lt;br /&gt;
+        return {'FINISHED'}&lt;br /&gt;
+&lt;br /&gt;
 def register():&lt;br /&gt;
     pass&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Page/Footer|User:Kwk|User:Kwk/Gsoc2010/AutoSelectPaintImage}}&lt;/div&gt;</summary>
		<author><name>wiki&gt;Kwk</name></author>
		
	</entry>
</feed>