[Bf-extensions-cvs] [cec05c97] master: space_view3d_paint_bprojection: remove: unsupported T63750
meta-androcto
noreply at git.blender.org
Sun Sep 15 02:32:50 CEST 2019
Commit: cec05c972926115f963134ab0228c25feee4419c
Author: meta-androcto
Date: Sun Sep 15 10:32:26 2019 +1000
Branches: master
https://developer.blender.org/rBACcec05c972926115f963134ab0228c25feee4419c
space_view3d_paint_bprojection: remove: unsupported T63750
===================================================================
D space_view3d_paint_bprojection.py
===================================================================
diff --git a/space_view3d_paint_bprojection.py b/space_view3d_paint_bprojection.py
deleted file mode 100644
index 20bed060..00000000
--- a/space_view3d_paint_bprojection.py
+++ /dev/null
@@ -1,2158 +0,0 @@
-bl_info = {
- "name": "BProjection",
- "description": "Help Clone tool",
- "author": "kgeogeo",
- "version": (2, 0, 1),
- "blender": (2, 77, 3),
- "wiki_url": "http://wiki.blender.org/index.php/Extensions:2.6/Py/Scripts/3D_interaction/bprojection",
- "tracker_url": "https://developer.blender.org/maniphest/task/edit/form/2/",
- "category": "Paint"}
-
-import bpy
-from bpy.app.handlers import persistent
-from bpy.types import (
- Panel,
- Operator,
- PropertyGroup,
- AddonPreferences,
- )
-from bpy.props import (
- IntProperty,
- FloatProperty,
- BoolProperty,
- StringProperty,
- FloatVectorProperty,
- CollectionProperty,
- )
-from bpy_extras import view3d_utils
-
-from math import (
- radians,
- sqrt,
- pi,
- )
-
-from mathutils import (
- Quaternion,
- Vector,
- )
-
-BProjection_Empty = 'Empty for BProjection'
-BProjection_Material = 'Material for BProjection'
-BProjection_Texture = 'Texture for BProjection'
-
-
-# Main function for align the plan to view
-def align_to_view(context):
- global last_mouse
- last_mouse = Vector((0, 0))
- ob = context.object
- em = bpy.data.objects[BProjection_Empty]
- rotation = em.custom_rotation
- scale = em.custom_scale
- z = em.custom_location.z
- pos = [em.custom_location.x, em.custom_location.y]
-
- sd = context.space_data
- r3d = sd.region_3d
- r3d.update()
- vr = r3d.view_rotation
- quat = Quaternion((0.0, 0.0, 1.0), radians(float(rotation)))
- v = Vector((pos[0], pos[1], z))
- v.rotate(vr)
-
- em = bpy.data.objects[BProjection_Empty]
- img = bpy.data.textures[BProjection_Texture].image
-
- if img and img.size[1] != 0:
- prop = img.size[0] / img.size[1]
- else:
- prop = 1
-
- if em.custom_linkscale:
- em.scale = Vector((prop * scale[0], scale[0], 1))
- else:
- em.scale = Vector((prop * scale[0], scale[1], 1))
- pos_cur = em.location - sd.cursor.location
- rot_cur1 = em.rotation_euler.to_quaternion()
- em.location = v + ob.location
- em.rotation_euler = Quaternion.to_euler(vr * quat)
- if em.custom_c3d:
- if em.custom_old_scale != em.custom_scale:
- pos_cur = em.location - sd.cursor.location
- rot_cur2 = em.rotation_euler.to_quaternion()
- rot_cur1.invert()
- pos_cur.rotate(rot_cur1)
- pos_cur.rotate(rot_cur2)
- v = em.location - pos_cur
- sd.cursor.location = v
-
-
-def applyimage(context):
- img = bpy.data.textures[BProjection_Texture].image
- ob = context.object
-
- face = ob.data.polygons
- uvdata = ob.data.uv_textures.active.data
-
- for f, d in zip(face, uvdata):
- if f.select:
- d.image = img
-
- align_to_view(context)
- ob.data.update()
-
-
-# Function to update the properties
-def update_Location(self, context):
- align_to_view(context)
-
-
-def find_uv(context):
- obj = context.object
- me = obj.data.vertices
- vg = obj.vertex_groups
- l = []
- index_uv = 0
- for face in obj.data.polygons:
- x = len(face.vertices)
- for vertex in face.vertices:
- if (len(me[vertex]. groups) > 0):
- for g in me[vertex].groups:
- if vg[g.group].name == 'texture plane':
- x -= 1
-
- if x == 0:
- l.append([index_uv, len(face. vertices)])
- index_uv += len(face.vertices)
- return l
-
-
-# Function to update the scaleUV
-def update_UVScale(self, context):
- ob = context.object
- em = bpy.data.objects[BProjection_Empty]
- v = Vector((em.custom_offsetuv[0] / 10 + 0.5, em.custom_offsetuv[1] / 10 + 0.5))
- l = Vector((0.0, 0.0))
- s = em.custom_scaleuv
- os = em.custom_old_scaleuv
-
- l = find_uv(context)
-
- for i, j in l:
- for t in range(j):
- d = ob.data.uv_layers.active.data[i + t]
- vres = v - d.uv
- d.uv.x = v.x - vres.x / os[0] * s[0]
- d.uv.y = v.y - vres.y / os[1] * s[1]
-
- em.custom_old_scaleuv = s
-
- applyimage(context)
-
-
-def update_PropUVScale(self, context):
- em = bpy.data.objects[BProjection_Empty]
- if em.custom_linkscaleuv:
- em.custom_scaleuv = [em.custom_propscaleuv, em.custom_propscaleuv]
-
-
-def update_LinkUVScale(self, context):
- em = bpy.data.objects[BProjection_Empty]
- if em.custom_linkscaleuv:
- em.custom_propscaleuv = em.custom_scaleuv.x
- update_PropUVScale(self, context)
- else:
- update_UVScale(self, context)
-
-
-# Function to update the offsetUV
-def update_UVOffset(self, context):
- ob = context.object
- em = bpy.data.objects[BProjection_Empty]
- o = em.custom_offsetuv
- oo = em.custom_old_offsetuv
- l = find_uv(context)
- for i, j in l:
- for t in range(j):
- d = ob.data.uv_layers.active.data[i + t]
- d.uv = [d.uv[0] - oo[0] / 10 + o[0] / 10, d.uv[1] - oo[1] / 10 + o[1] / 10]
- em.custom_old_offsetuv = o
-
- applyimage(context)
-
-
-# Function to update the flip horizontal
-def update_FlipUVX(self, context):
- l = find_uv(context)
- for i, j in l:
- for t in range(j):
- d = context.object.data.uv_layers.active.data[i + t]
- x = d.uv.x
- d.uv.x = 1 - x
-
- applyimage(context)
-
-
-# Function to update the flip vertical
-def update_FlipUVY(self, context):
- l = find_uv(context)
- for i, j in l:
- for t in range(j):
- d = context.object.data.uv_layers.active.data[i + t]
- y = d.uv[1]
- d.uv[1] = 1 - y
-
- applyimage(context)
-
-
-# Function to update
-def update_Rotation(self, context):
- ob = context.object
- em = bpy.data.objects[BProjection_Empty]
- if em.custom_rotc3d:
- angle = em.custom_rotation - em.custom_old_rotation
- sd = context.space_data
- vr = sd.region_3d.view_rotation.copy()
- c = sd.cursor.location - ob.location
- e = bpy.data.objects[BProjection_Empty].location - ob.location
- vo = Vector((0.0, 0.0, 1.0))
- vo.rotate(vr)
- quat = Quaternion(vo, radians(angle))
- v = e - c
- v.rotate(quat)
- vr.invert()
- v.rotate(vr)
- c.rotate(vr)
- em.custom_location = c + v
- else:
- align_to_view(context)
-
- em.custom_old_rotation = em.custom_rotation
-
-
-# Function to update scale
-def update_Scale(self, context):
- ob = context.object
- em = bpy.data.objects[BProjection_Empty]
-
- if em.custom_scac3d:
- sd = context.space_data
- r3d = sd.region_3d
- vr = r3d.view_rotation.copy()
- vr.invert()
- e = em.location - ob.location
- c = sd.cursor.location - ob.location
- ce = e - c
-
- s = em.custom_scale
- os = em.custom_old_scale
- c.rotate(vr)
- ce.rotate(vr)
-
- v = Vector((s.x * ce.x / os.x, s.y * ce.y / os.y, 0.0))
- em.custom_location = c + v
-
- else:
- align_to_view(context)
-
- em.custom_old_scale = em.custom_scale
-
-
-def update_PropScale(self, context):
- em = bpy.data.objects[BProjection_Empty]
- if em.custom_linkscale:
- em.custom_scale = [em.custom_propscale, em.custom_propscale]
-
-
-def update_LinkScale(self, context):
- em = bpy.data.objects[BProjection_Empty]
- if em.custom_linkscale:
- em.custom_propscale = em.custom_scale.x
- update_PropScale(self, context)
- else:
- update_Scale(self, context)
-
-
-def update_activeviewname(self, context):
- em = bpy.data.objects[BProjection_Empty]
- if self.custom_active:
- em.custom_active_view = self.custom_active_view
-
-
-def update_style_clone(self, context):
- km = context.window_manager.keyconfigs.default.keymaps['Image Paint']
- for kmi in km.keymap_items:
- if self.custom_style_clone:
- if kmi.idname == 'paint.image_paint':
- kmi.idname = 'paint.bp_paint'
- else:
- if kmi.idname == 'paint.bp_paint':
- kmi.idname = 'paint.image_paint'
-
-
-class custom_props(PropertyGroup):
- custom_fnlevel: IntProperty(
- name="Fast navigate level",
- description="Increase or decrease the SubSurf level, decrease make navigation faster",
- default=0,
- )
- custom_location: FloatVectorProperty(
- name="Location",
- description="Location of the plane",
- default=(1.0, 0, -1.0),
- subtype='XYZ',
- soft_min=-10,
- soft_max=10,
- step=0.1,
- size=3,
- )
- custom_rotation: FloatProperty(
- name="Rotation",
- description="Rotate the plane",
- min=-180, max=180,
- default=0
- )
- custom_scale: FloatVectorProperty(
- name="Scales",
- description="Scale the planes",
- default=(1.0, 1.0),
- subtype='XYZ',
- min=0.1,
- max=10,
- soft_min=0.1,
- soft_max=10,
- step=0.1,
- size=2,
- )
- custom_propscale: FloatProperty(
- name="PropScale",
- description="Scale the Plane",
- default=1.0,
- min=0.1,
- max=10,
- soft_min=0.1,
- soft_max=10,
-
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-extensions-cvs
mailing list