and this is? better commit messages please! :)<div><br></div><div>cheers</div><div><br><div class="gmail_quote">On Tue, Mar 13, 2012 at 1:36 AM, geo kgeo <span dir="ltr">&lt;<a href="mailto:kgeogeo@hotmail.com">kgeogeo@hotmail.com</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Revision: 3094<br>
          <a href="http://projects.blender.org/scm/viewvc.php?view=rev&amp;root=bf-extensions&amp;revision=3094" target="_blank">http://projects.blender.org/scm/viewvc.php?view=rev&amp;root=bf-extensions&amp;revision=3094</a><br>


Author:   kgeogeo<br>
Date:     2012-03-13 07:35:58 +0000 (Tue, 13 Mar 2012)<br>
Log Message:<br>
-----------<br>
Add BProjection.py<br>
<br>
Added Paths:<br>
-----------<br>
    contrib/py/scripts/addons/BProjection.py<br>
<br>
Added: contrib/py/scripts/addons/BProjection.py<br>
===================================================================<br>
--- contrib/py/scripts/addons/BProjection.py                            (rev 0)<br>
+++ contrib/py/scripts/addons/BProjection.py    2012-03-13 07:35:58 UTC (rev 3094)<br>
@@ -0,0 +1,630 @@<br>
+bl_info = {<br>
+    &quot;name&quot;: &quot;Z Projection&quot;,<br>
+    &quot;description&quot;: &quot;Help Clone tool&quot;,<br>
+    &quot;author&quot;: &quot;kgeogeo&quot;,<br>
+    &quot;version&quot;: (1, 0),<br>
+    &quot;blender&quot;: (2, 6, 3),<br>
+    &quot;category&quot;: &quot;Paint&quot;}<br>
+<br>
+import bpy<br>
+from bpy.types import Panel, Operator<br>
+from bpy.props import IntProperty, FloatProperty, BoolProperty, IntVectorProperty, StringProperty<br>
+from bpy_extras import view3d_utils<br>
+from mathutils import *<br>
+from math import *<br>
+import mathutils<br>
+import math<br>
+<br>
+def align_to_view(context):<br>
+    ob = context.object<br>
+    rotation = ob.custom_rotation<br>
+    scale = ob.custom_scale<br>
+    z = ob.custom_z<br>
+    posx = ob.custom_location[0]<br>
+    posy = ob.custom_location[1]<br>
+<br>
+    reg = bpy.context.area.regions[4]<br>
+    width = reg.width<br>
+    height = reg.height<br>
+<br>
+    r3d =  context.space_data.region_3d<br>
+    r3d.update()<br>
+    vl = r3d.view_location<br>
+    vr = r3d.view_rotation<br>
+    quat = mathutils.Quaternion((0.0, 0.0, 1.0), math.radians(float(rotation)))<br>
+<br>
+    v = Vector((1,0,z))<br>
+    v.rotate(vr)<br>
+<br>
+    pos = (posx,posy)<br>
+<br>
+    em = bpy.data.objects[&#39;Empty for clone&#39;]<br>
+    img = bpy.data.textures[&#39;Texture for clone&#39;].image<br>
+    if img and img.size[1] != 0:<br>
+        prop = img.size[0]/img.size[1]<br>
+        em.scale[0] = prop<br>
+    else: prop = 1<br>
+<br>
+    em.scale =  Vector((prop*scale, scale, scale))<br>
+    em.location = view3d_utils.region_2d_to_location_3d(context.area.regions[4], r3d, pos, v)<br>
+    em.rotation_euler = Quaternion.to_euler(vr*quat)<br>
+<br>
+class HelpClone(Panel):<br>
+    bl_space_type = &#39;VIEW_3D&#39;<br>
+    bl_region_type = &#39;UI&#39;<br>
+    bl_label = &quot;Help Clone&quot;<br>
+<br>
+    @classmethod<br>
+    def poll(cls, context):<br>
+        return (context.image_paint_object)<br>
+<br>
+    def draw(self, context):<br>
+        layout = self.layout<br>
+<br>
+        try:<br>
+            bpy.data.objects[&#39;Empty for clone&#39;]<br>
+<br>
+            col = layout.column(align =True)<br>
+            col.operator(&quot;object.removecloneplane&quot;, text=&quot;Remove clone plane&quot;)<br>
+<br>
+            tex = bpy.data.textures[&#39;Texture for clone&#39;]<br>
+<br>
+            layout.template_ID_preview(tex, &quot;image&quot;, open=&quot;image.open&quot;, rows=3, cols=3)<br>
+<br>
+            col = layout.column(align =True)<br>
+            col.operator(&#39;object.applyimage&#39;, text = &quot;Apply image&quot;)<br>
+            col = layout.column(align =True)<br>
+            ob = context.object<br>
+            col.prop(ob, &quot;custom_c3d&quot;,text=&quot;Capture Cursor3d&quot;)<br>
+            col.prop(ob, &quot;custom_rot&quot;,text=&quot;Rotate around selection&quot;)<br>
+            col = layout.column(align =True)<br>
+            col.prop(ob,&#39;custom_rotation&#39;, slider = True)<br>
+            col.prop(ob,&#39;custom_scale&#39;, slider = True)<br>
+            col.prop(ob,&#39;custom_z&#39;, slider = True)<br>
+            col.prop(ob,&#39;custom_location&#39;)<br>
+            col = layout.column(align =True)<br>
+            col.prop(ob,&#39;custom_scaleuv&#39;, slider = True)<br>
+            col = layout.column(align =True)<br>
+            col.prop(ob.material_slots[&#39;Material for clone&#39;].material,&#39;alpha&#39;, slider = True)<br>
+<br>
+        except:<br>
+            col = layout.column(align =True)<br>
+            col.operator(&quot;object.addcloneplane&quot;, text=&quot;Add clone plan&quot;)<br>
+<br>
+class ApplyImage(Operator):<br>
+    bl_idname = &quot;object.applyimage&quot;<br>
+    bl_label = &quot;Apply image&quot;<br>
+<br>
+    def execute(self, context):<br>
+        img = bpy.data.textures[&#39;Texture for clone&#39;].image<br>
+        em = bpy.data.objects[&#39;Empty for clone&#39;]<br>
+        uvdata = bpy.context.object.data.uv_textures.active.data<br>
+        uvdata[len(uvdata)-1].image = img<br>
+        if img and img.size[1] != 0:<br>
+            prop = img.size[0]/img.size[1]<br>
+            em.scale[0] = prop<br>
+<br>
+        context.object.data.update()<br>
+        align_to_view(context)<br>
+<br>
+        return {&#39;FINISHED&#39;}<br>
+<br>
+class DrawLines(Operator):<br>
+    bl_idname = &quot;object.drawlines&quot;<br>
+    bl_label = &quot;Draw lines&quot;<br>
+<br>
+    def invoke(self, context, event):<br>
+<br>
+        x = event.mouse_region_x<br>
+        y = event.mouse_region_y<br>
+        if len(bpy.context.object.grease_pencil.layers.active.frames)==0:<br>
+            bpy.ops.gpencil.draw(mode=&#39;DRAW&#39;, stroke=[{&quot;name&quot;:&quot;&quot;, &quot;pen_flip&quot;:False,<br>
+                                                                &quot;is_start&quot;:True, &quot;location&quot;:(0, 0, 0),<br>
+                                                                &quot;mouse&quot;:(x,y), &quot;pressure&quot;:1, &quot;time&quot;:0}])<br>
+        else:<br>
+            if len(bpy.context.object.grease_pencil.layers.active.frames[0].strokes) &lt; 4:<br>
+                bpy.ops.gpencil.draw(mode=&#39;DRAW&#39;, stroke=[{&quot;name&quot;:&quot;&quot;, &quot;pen_flip&quot;:False,<br>
+                                                                    &quot;is_start&quot;:True, &quot;location&quot;:(0, 0, 0),<br>
+                                                                    &quot;mouse&quot;:(x,y), &quot;pressure&quot;:1, &quot;time&quot;:0}])<br>
+            if len(bpy.context.object.grease_pencil.layers.active.frames[0].strokes) == 4:<br>
+                s = bpy.context.object.grease_pencil.layers.active.frames[0]<br>
+                v1 = s.strokes[1].points[0].co - s.strokes[0].points[0].co<br>
+                v2 = s.strokes[3].points[0].co - s.strokes[2].points[0].co<br>
+                prop = v1.x/v2.x<br>
+                bpy.context.object.custom_scale *= abs(prop)<br>
+                bpy.ops.gpencil.active_frame_delete()<br>
+<br>
+        return {&#39;FINISHED&#39;}<br>
+<br>
+class AddClonePlane(Operator):<br>
+    bl_idname = &quot;object.addcloneplane&quot;<br>
+    bl_label = &quot;Configure&quot;<br>
+<br>
+    def creatematerial(self, context):<br>
+        try:<br>
+            matclone = bpy.data.materials[&#39;Material for clone&#39;]<br>
+        except:<br>
+            bpy.data.textures.new(name=&#39;Texture for clone&#39;,type=&#39;IMAGE&#39;)<br>
+<br>
+            bpy.data.materials.new(name=&#39;Material for clone&#39;)<br>
+<br>
+            matclone = bpy.data.materials[&#39;Material for clone&#39;]<br>
+            matclone.texture_slots.add()<br>
+            matclone.use_shadeless = True<br>
+            matclone.use_transparency = True<br>
+            matclone.active_texture = bpy.data.textures[&#39;Texture for clone&#39;]<br>
+<br>
+            index = matclone.active_texture_index<br>
+            matclone.texture_slots[index].texture_coords = &#39;UV&#39;<br>
+<br>
+        old_index = context.object.active_material_index<br>
+        bpy.ops.object.material_slot_add()<br>
+        index = context.object.active_material_index<br>
+        bpy.context.object.material_slots[index].material = bpy.data.materials[&#39;Material for clone&#39;]<br>
+        bpy.ops.object.material_slot_assign()<br>
+        context.object.active_material_index = old_index<br>
+<br>
+    def execute(self, context):<br>
+        try:<br>
+            bpy.data.objects[&#39;Empty for clone&#39;]<br>
+<br>
+        except:<br>
+            bpy.ops.paint.texture_paint_toggle()<br>
+<br>
+            bpy.context.space_data.show_relationship_lines = False<br>
+<br>
+            ob = bpy.context.object<br>
+<br>
+            bpy.ops.object.add()<br>
+            em = bpy.context.object<br>
+            <a href="http://em.name" target="_blank">em.name</a> = &quot;Empty for clone&quot;<br>
+<br>
+            bpy.data.scenes[&#39;Scene&#39;].objects.active = ob<br>
+            ob.select = True<br>
+<br>
+            bpy.ops.object.editmode_toggle()<br>
+<br>
+            bpy.ops.mesh.primitive_plane_add()<br>
+            bpy.ops.object.vertex_group_assign(new = True)<br>
+            <a href="http://ob.vertex_groups.active.name" target="_blank">ob.vertex_groups.active.name</a> = &#39;texture plane&#39;<br>
+            bpy.ops.uv.unwrap()<br>
+<br>
+            bpy.ops.object.editmode_toggle()<br>
+            for i in range(4):<br>
+                ob.data.edges[len(ob.data.edges)-1-i].crease = 1<br>
+            bpy.ops.object.editmode_toggle()<br>
+<br>
+            em.select = True<br>
+            bpy.ops.object.hook_add_selob()<br>
+<br>
+            self.creatematerial(context)<br>
+<br>
+            bpy.ops.gpencil.data_add()<br>
+            bpy.context.object.grease_pencil.draw_mode = &#39;VIEW&#39;<br>
+            bpy.ops.gpencil.layer_add()<br>
+            bpy.context.object.grease_pencil.layers.active.color = [1.0,0,0]<br>
+<br>
+            bpy.ops.mesh.hide()<br>
+<br>
+            em.select = False<br>
+            em.hide = True<br>
+<br>
+            bpy.ops.object.editmode_toggle()<br>
+<br>
+            bpy.ops.object.applyimage()<br>
+            km = bpy.data.window_managers[&#39;WinMan&#39;].keyconfigs[&#39;Blender&#39;].keymaps[&#39;3D View&#39;]<br>
+            km.keymap_items[3-1].idname = &#39;view3d.rotate_view3d&#39;<br>
+            km.keymap_items[19-1].idname = &#39;view3d.zoom_view3d&#39;<br>
+            km.keymap_items[19-1].properties.delta = 1.0<br>
+            km.keymap_items[20-1].idname = &#39;view3d.zoom_view3d&#39;<br>
+            km.keymap_items[20-1].properties.delta = -1.0<br>
+            km.keymap_items[4-1].idname = &#39;view3d.pan_view3d&#39;<br>
+            km.keymap_items[26-1].idname = &#39;view3d.preset_view3d&#39;<br>
+            km.keymap_items[26-1].properties.view = &#39;FRONT&#39;<br>
+            km.keymap_items[28-1].idname = &#39;view3d.preset_view3d&#39;<br>
+            km.keymap_items[28-1].properties.view = &#39;RIGHT&#39;<br>
+            km.keymap_items[32-1].idname = &#39;view3d.preset_view3d&#39;<br>
+            km.keymap_items[32-1].properties.view = &#39;TOP&#39;<br>
+            km.keymap_items[34-1].idname = &#39;view3d.preset_view3d&#39;<br>
+            km.keymap_items[34-1].properties.view = &#39;BACK&#39;<br>
+            km.keymap_items[35-1].idname = &#39;view3d.preset_view3d&#39;<br>
+            km.keymap_items[35-1].properties.view = &#39;LEFT&#39;<br>
+            km.keymap_items[36-1].idname = &#39;view3d.preset_view3d&#39;<br>
+            km.keymap_items[36-1].properties.view = &#39;BOTTOM&#39;<br>
+            km = bpy.context.window_manager.keyconfigs.default.keymaps[&#39;Image Paint&#39;]<br>
+            kmi = km.keymap_items.new(&quot;object.drawlines&quot;, &#39;LEFTMOUSE&#39;, &#39;PRESS&#39;, shift=True)<br>
+<br>
+            align_to_view(context)<br>
+<br>
+            bpy.ops.paint.texture_paint_toggle()<br>
+<br>
+        return {&#39;FINISHED&#39;}<br>
+<br>
+class RemoveClonePlane(Operator):<br>
+    bl_idname = &quot;object.removecloneplane&quot;<br>
+    bl_label = &quot;Configure&quot;<br>
+<br>
+    def removematerial(self, context):<br>
+        i = 0<br>
+        for ms in context.object.material_slots:<br>
+            if <a href="http://ms.name" target="_blank">ms.name</a> == &#39;Material for clone&#39;:<br>
+                index = i<br>
+            i+=1<br>
+<br>
+        context.object.active_material_index = index<br>
<br>
@@ Diff output truncated at 10240 characters. @@<br>
_______________________________________________<br>
Bf-extensions-cvs mailing list<br>
<a href="mailto:Bf-extensions-cvs@blender.org">Bf-extensions-cvs@blender.org</a><br>
<a href="http://lists.blender.org/mailman/listinfo/bf-extensions-cvs" target="_blank">http://lists.blender.org/mailman/listinfo/bf-extensions-cvs</a><br>
</blockquote></div><br></div>