Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlijenstina <lijenstina@gmail.com>2017-06-19 04:42:57 +0300
committerlijenstina <lijenstina@gmail.com>2017-06-19 04:42:57 +0300
commit7580e19b74a2d7bb9f05e3ac40e1e2c1edc79fd9 (patch)
tree9e2427d6e5677553414cb0d7dcda802941e1e4a7
parentc81a6e1b2c8cb7e4b73123068961c430ae14126e (diff)
Add Advanced Objects: Fix pixelate properties error
Bumped the Menu to 1.1.5 Fixed the ommission during the refactor Scene properties cannot be used inside an Operator replaced them with the self ones Removed the pixelate properties from init as not needed Fix the error related to moving drop to ground to a separate add-on - if it is not enabled it will error out No need for a duplicate entry
-rw-r--r--add_advanced_objects_menu/__init__.py27
-rw-r--r--add_advanced_objects_menu/pixelate_3d.py53
2 files changed, 41 insertions, 39 deletions
diff --git a/add_advanced_objects_menu/__init__.py b/add_advanced_objects_menu/__init__.py
index cacf8419..8b9cd86a 100644
--- a/add_advanced_objects_menu/__init__.py
+++ b/add_advanced_objects_menu/__init__.py
@@ -25,7 +25,7 @@
bl_info = {
"name": "Add Advanced Objects",
"author": "Meta Androcto",
- "version": (0, 1, 4),
+ "version": (0, 1, 5),
"blender": (2, 78, 0),
"location": "View3D > Add ",
"description": "Add Object & Camera extras",
@@ -179,8 +179,7 @@ class INFO_MT_Physics_tools_add(Menu):
def draw(self, context):
layout = self.layout
layout.operator_context = 'INVOKE_REGION_WIN'
- layout.operator("object.drop_on_active",
- text="Drop To Ground", icon="SORTSIZE")
+
layout.operator("ball.rope",
text="Wrecking Ball", icon='PHYSICS')
layout.operator("clot.rope",
@@ -249,7 +248,7 @@ class AdvancedObjPreferences(AddonPreferences):
box.label(text="Panels located in 3D View Tools Region > Create",
icon="LAYER_ACTIVE")
box.label(text="CubeSter", icon="LAYER_USED")
- box.label(text="Duplicate on Curve (Shown if an Active Curve Object is it the 3D View)",
+ box.label(text="Arrange on Curve (Shown if an Active Curve Object is it the 3D View)",
icon="LAYER_USED")
@@ -498,26 +497,6 @@ class AdvancedObjProperties(PropertyGroup):
default=0.25
)
- # pixelate_3d properties
- pixelate_3d_size = FloatProperty(
- name="Size",
- min=.05, max=5,
- default=.25,
- description="Size of the cube / grid"
- )
- pixelate_3d_gap = IntProperty(
- name="Gap",
- min=0, max=90,
- default=10,
- subtype='PERCENTAGE',
- description="Separation - percent of size"
- )
- pixelate_3d_smooth = FloatProperty(
- name="Smooth",
- min=0, max=1,
- default=.0,
- description="Smooth factor when subdividing mesh"
- )
# arrange_on_curve
arrange_c_use_selected = BoolProperty(
name="Use Selected",
diff --git a/add_advanced_objects_menu/pixelate_3d.py b/add_advanced_objects_menu/pixelate_3d.py
index d2b28971..3a9fc886 100644
--- a/add_advanced_objects_menu/pixelate_3d.py
+++ b/add_advanced_objects_menu/pixelate_3d.py
@@ -4,22 +4,25 @@
bl_info = {
"name": "3D Pixelate",
"author": "liero",
- "version": (0, 5, 2),
+ "version": (0, 5, 3),
"blender": (2, 74, 0),
"location": "View3D > Tool Shelf",
"description": "Creates a 3d pixelated version of the object",
"category": "Object"}
-# Note: winmgr properties are moved into __init__
-# search for patterns advanced_objects and adv_obj
+# Note: winmgr properties are moved to the operator
+
import bpy
from bpy.types import Operator
+from bpy.props import (
+ FloatProperty,
+ IntProperty,
+ )
-def pix(obj):
+def pix(self, obj):
sce = bpy.context.scene
- props = sce.advanced_objects
obj.hide = obj.hide_render = True
mes = obj.to_mesh(sce, True, 'RENDER')
mes.transform(obj.matrix_world)
@@ -34,12 +37,12 @@ def pix(obj):
fin = True
for i in dup.data.edges:
d = ver[i.vertices[0]].co - ver[i.vertices[1]].co
- if d.length > props.pixelate_3d_size:
+ if d.length > self.size:
ver[i.vertices[0]].select = True
ver[i.vertices[1]].select = True
fin = False
bpy.ops.object.editmode_toggle()
- bpy.ops.mesh.subdivide(number_cuts=1, smoothness=props.pixelate_3d_smooth)
+ bpy.ops.mesh.subdivide(number_cuts=1, smoothness=self.smooth)
bpy.ops.mesh.select_all(action='DESELECT')
bpy.ops.object.editmode_toggle()
if fin:
@@ -47,14 +50,14 @@ def pix(obj):
for i in ver:
for n in range(3):
- i.co[n] -= (.001 + i.co[n]) % props.pixelate_3d_size
+ i.co[n] -= (.001 + i.co[n]) % self.size
bpy.ops.object.mode_set(mode='EDIT', toggle=False)
bpy.ops.mesh.select_all(action='SELECT')
bpy.ops.mesh.remove_doubles(threshold=0.0001)
bpy.ops.mesh.delete(type='EDGE_FACE')
bpy.ops.object.mode_set()
- sca = props.pixelate_3d_size * (100 - props.pixelate_3d_gap) * .005
+ sca = self.size * (100 - self.gap) * .005
bpy.ops.mesh.primitive_cube_add(layers=[True] + [False] * 19)
bpy.ops.transform.resize(value=[sca] * 3)
bpy.context.scene.objects.active = dup
@@ -70,6 +73,27 @@ class Pixelate(Operator):
"Needs an existing Active Mesh Object")
bl_options = {'REGISTER', 'UNDO'}
+ size = FloatProperty(
+ name="Size",
+ min=.05, max=5,
+ default=.25,
+ description="Size of the cube / grid \n"
+ "Small values (below 0.1) can create a high polygon count"
+ )
+ gap = IntProperty(
+ name="Gap",
+ min=0, max=90,
+ default=10,
+ subtype='PERCENTAGE',
+ description="Separation - percent of size"
+ )
+ smooth = FloatProperty(
+ name="Smooth",
+ min=0, max=1,
+ default=.0,
+ description="Smooth factor when subdividing mesh"
+ )
+
@classmethod
def poll(cls, context):
return (context.active_object and
@@ -78,17 +102,16 @@ class Pixelate(Operator):
def draw(self, context):
layout = self.layout
- adv_obj = context.scene.advanced_objects
col = layout.column(align=True)
- col.prop(adv_obj, "pixelate_size")
- col.prop(adv_obj, "pixelate_gap")
- layout.prop(adv_obj, "pixelate_smooth")
+ col.prop(self, "size")
+ col.prop(self, "gap")
+ layout.prop(self, "smooth")
def execute(self, context):
- objeto = context.active_object
+ objeto = bpy.context.object
try:
- pix(objeto)
+ pix(self, objeto)
except Exception as e:
self.report({'WARNING'},