Skip to content

Commit

Permalink
Bforartists 0.9.6 - gone through the addons again
Browse files Browse the repository at this point in the history
There were some overlooked updates.
  • Loading branch information
ReinerBforartists committed Mar 13, 2018
1 parent b08b4a7 commit 3eeeb5d
Show file tree
Hide file tree
Showing 68 changed files with 3,400 additions and 2,442 deletions.
363 changes: 179 additions & 184 deletions release/scripts/addons/add_advanced_objects_menu/__init__.py

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@


class PanelDupliCurve(Panel):
bl_idname = "VIEW3D_PT_arranjar_numa_curva"
bl_space_type = "VIEW_3D"
bl_region_type = "TOOLS"
bl_context = "objectmode"
Expand Down
113 changes: 62 additions & 51 deletions release/scripts/addons/add_advanced_objects_menu/cubester.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,28 +25,28 @@
bl_info = {
"name": "CubeSter",
"author": "Jacob Morris",
"version": (0, 7, 1),
"version": (0, 7, 2),
"blender": (2, 78, 0),
"location": "View 3D > Toolbar > CubeSter",
"description": "Takes image, image sequence, or audio file and converts it "
"into a height map based on pixel color and alpha values",
"category": "Add Mesh"
}
}

import bpy
import bmesh
from bpy.types import (
Operator,
Panel,
)
Operator,
Panel,
)

import timeit
from random import uniform
from math import radians
from os import (
path,
listdir,
)
path,
listdir,
)


# create block at center position x, y with block width 2 * hx and 2 * hy and height of h
Expand Down Expand Up @@ -146,18 +146,18 @@ def create_material(scene, ob, name):

if adv_obj.cubester_materials == "image":
mat.node_tree.links.new(
nodes["Image Texture"].outputs[0],
nodes["Diffuse BSDF"].inputs[0]
)
nodes["Image Texture"].outputs[0],
nodes["Diffuse BSDF"].inputs[0]
)
mat.node_tree.links.new(
nodes["Texture Coordinate"].outputs[2],
nodes["Image Texture"].inputs[0]
)
nodes["Texture Coordinate"].outputs[2],
nodes["Image Texture"].inputs[0]
)
else:
mat.node_tree.links.new(
nodes["Attribute"].outputs[0],
nodes["Diffuse BSDF"].inputs[0]
)
nodes["Attribute"].outputs[0],
nodes["Diffuse BSDF"].inputs[0]
)
else:
if adv_obj.cubester_materials == "image" or scene.render.engine != "BLENDER_RENDER":
tex = bpy.data.textures.new("CubeSter_" + name, "IMAGE")
Expand All @@ -177,9 +177,11 @@ def create_mesh_from_audio(self, scene, verts, faces):
audio_filepath = adv_obj.cubester_audio_path
width = adv_obj.cubester_audio_width_blocks
length = adv_obj.cubester_audio_length_blocks
size_per_hundred = adv_obj.cubester_size_per_hundred_pixels

size_per_hundred = adv_obj.cubester_size_per_hundred_pixels
size = size_per_hundred / 100
# Note: used for compatibility with vertex colors changes
bl_version = bool(bpy.app.version >= (2, 79, 1))

# create all blocks
y = -(width / 2) * size + (size / 2)
Expand Down Expand Up @@ -212,7 +214,8 @@ def create_mesh_from_audio(self, scene, verts, faces):
# go through each column, step by appropriate amount
for column in range(0, picture.size[0] * 4, 4 + skip_x * 4):
r, g, b, a = get_pixel_values(picture, pixels, row, column)
vert_colors += [(r, g, b) for i in range(24)]
get_colors = (r, g, b, a) if bl_version else (r, g, b)
vert_colors += [get_colors for i in range(24)]

bpy.ops.mesh.vertex_color_add()

Expand Down Expand Up @@ -244,7 +247,8 @@ def create_mesh_from_audio(self, scene, verts, faces):
for row in range(0, picture.size[1], skip_y + 1):
for column in range(0, picture.size[0] * 4, 4 + skip_x * 4):
r, g, b, a = get_pixel_values(picture, pixels, row, column)
frame_colors += [(r, g, b) for i in range(24)]
get_colors = (r, g, b, a) if bl_version else (r, g, b)
frame_colors += [get_colors for i in range(24)]

frames_vert_colors.append(frame_colors)

Expand Down Expand Up @@ -354,6 +358,8 @@ def create_mesh_from_image(self, scene, verts, faces):
adv_obj = scene.advanced_objects
picture = bpy.data.images[adv_obj.cubester_image]
pixels = list(picture.pixels)
# Note: used for compatibility with vertex colors changes
bl_version = bool(bpy.app.version >= (2, 79, 1))

x_pixels = picture.size[0] / (adv_obj.cubester_skip_pixels + 1)
y_pixels = picture.size[1] / (adv_obj.cubester_skip_pixels + 1)
Expand All @@ -367,7 +373,6 @@ def create_mesh_from_image(self, scene, verts, faces):
y = -height / 2 + half_width

vert_colors = []
weights = [uniform(0.0, 1.0) for i in range(4)] # random weights
rows = 0

# go through each row of pixels stepping by adv_obj.cubester_skip_pixels + 1
Expand All @@ -377,16 +382,17 @@ def create_mesh_from_image(self, scene, verts, faces):
# go through each column, step by appropriate amount
for column in range(0, picture.size[0] * 4, 4 + adv_obj.cubester_skip_pixels * 4):
r, g, b, a = get_pixel_values(picture, pixels, row, column)
get_colors = (r, g, b, a) if bl_version else (r, g, b)
h = find_point_height(r, g, b, a, scene)

# if not transparent
if h != -1:
if adv_obj.cubester_mesh_style == "blocks":
create_block(x, y, half_width, h, verts, faces)
vert_colors += [(r, g, b) for i in range(24)]
vert_colors += [get_colors for i in range(24)]
else:
verts += [(x, y, h)]
vert_colors += [(r, g, b) for i in range(4)]
vert_colors += [get_colors for i in range(4)]

x += step
y += step
Expand Down Expand Up @@ -464,14 +470,15 @@ def create_mesh_from_image(self, scene, verts, faces):
for row in range(0, picture.size[1], adv_obj.cubester_skip_pixels + 1):
for column in range(0, picture.size[0] * 4, 4 + adv_obj.cubester_skip_pixels * 4):
r, g, b, a = get_pixel_values(picture, pixels, row, column)
get_colors = (r, g, b, a) if bl_version else (r, g, b)
h = find_point_height(r, g, b, a, scene)

if h != -1:
frame_heights.append(h)
if adv_obj.cubester_mesh_style == "blocks":
frame_colors += [(r, g, b) for i in range(24)]
frame_colors += [get_colors for i in range(24)]
else:
frame_colors += [(r, g, b) for i in range(4)]
frame_colors += [get_colors for i in range(4)]

if adv_obj.cubester_mesh_style == "plane":
del vert_colors[len(vert_colors) - 4:len(vert_colors)]
Expand All @@ -482,24 +489,24 @@ def create_mesh_from_image(self, scene, verts, faces):
# determine what data to use
if adv_obj.cubester_materials == "vertex" or scene.render.engine == "BLENDER_ENGINE":
adv_obj.cubester_vertex_colors[ob.name] = {
"type": "vertex", "frames": frames_vert_colors,
"frame_skip": adv_obj.cubester_frame_step,
"total_images": max_images
}
"type": "vertex", "frames": frames_vert_colors,
"frame_skip": adv_obj.cubester_frame_step,
"total_images": max_images
}
else:
adv_obj.cubester_vertex_colors[ob.name] = {
"type": "image", "frame_skip": scene.cubester_frame_step,
"total_images": max_images
}
"type": "image", "frame_skip": adv_obj.cubester_frame_step,
"total_images": max_images
}
att = get_image_node(ob.data.materials[0])
att.image_user.frame_duration = len(frames) * adv_obj.cubester_frame_step

# animate mesh
create_f_curves(
mesh, frames,
adv_obj.cubester_frame_step,
adv_obj.cubester_mesh_style
)
mesh, frames,
adv_obj.cubester_frame_step,
adv_obj.cubester_mesh_style
)


# generate uv map for object
Expand Down Expand Up @@ -695,7 +702,7 @@ def material_frame_handler(scene):


class CubeSterPanel(Panel):
bl_idname = "OBJECT_PT.cubester"
bl_idname = "OBJECT_PT_cubester"
bl_label = "CubeSter"
bl_space_type = "VIEW_3D"
bl_region_type = "TOOLS"
Expand Down Expand Up @@ -879,11 +886,12 @@ def draw(self, context):

class CubeSter(Operator):
bl_idname = "mesh.cubester"
bl_label = "Generate Mesh"
bl_label = "Generate CubeSter Mesh"
bl_description = "Generate a mesh from an Image or Sound File"
bl_options = {"REGISTER", "UNDO"}

def execute(self, context):

verts, faces = [], []

start = timeit.default_timer()
Expand All @@ -901,7 +909,8 @@ def execute(self, context):
return {"CANCELLED"}
else:
if (adv_obj.cubester_audio_path != "" and
path.isfile(adv_obj.cubester_audio_path) and adv_obj.cubester_check_audio is True):
path.isfile(adv_obj.cubester_audio_path) and
adv_obj.cubester_check_audio is True):

create_mesh_from_audio(self, scene, verts, faces)
created = adv_obj.cubester_audio_file_length
Expand All @@ -913,19 +922,21 @@ def execute(self, context):
stop = timeit.default_timer()

if adv_obj.cubester_mesh_style == "blocks" or adv_obj.cubester_audio_image == "audio":
self.report({"INFO"},
"CubeSter: {} blocks and {} frame(s) "
"in {}s".format(str(int(len(verts) / 8)),
str(created),
str(round(stop - start, 4)))
)
self.report(
{"INFO"},
"CubeSter: {} blocks and {} frame(s) "
"in {}s".format(str(int(len(verts) / 8)),
str(created),
str(round(stop - start, 4)))
)
else:
self.report({"INFO"},
"CubeSter: {} points and {} frame(s) "
"in {}s" .format(str(len(verts)),
str(created),
str(round(stop - start, 4)))
)
self.report(
{"INFO"},
"CubeSter: {} points and {} frame(s) "
"in {}s" .format(str(len(verts)),
str(created),
str(round(stop - start, 4)))
)

return {"FINISHED"}

Expand Down
6 changes: 3 additions & 3 deletions release/scripts/addons/add_curve_extra_objects/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,9 +225,9 @@ def draw(self, context):
icon="LAYER_USED")


class INFO_MT_curve_knots_add1(Menu):
class INFO_MT_curve_knots_add(Menu):
# Define the "Extras" menu
bl_idname = "curve_knots_add"
bl_idname = "INFO_MT_curve_knots_add"
bl_label = "Plants"

def draw(self, context):
Expand All @@ -253,7 +253,7 @@ def menu_func(self, context):
icon='CURVE_DATA')
layout.separator()

layout.menu("curve_knots_add", text="Knots", icon='CURVE_DATA')
layout.menu(INFO_MT_curve_knots_add.bl_idname, text="Knots", icon='CURVE_DATA')
layout.separator()
layout.operator("curve.curlycurve", text="Curly Curve",
icon='CURVE_DATA')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1399,6 +1399,7 @@ def invoke(self, context, event):
# Simple change panel

class SimplePanel(Panel):
bl_idname = "VIEW3D_PT_simple_curve"
bl_label = "Simple Curve"
bl_space_type = "VIEW_3D"
bl_region_type = "TOOLS"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -979,6 +979,7 @@ def draw_spline_settings(self):
# Tools Panel > Create
# ------------------------------------------------------------
class SplinePanel(Panel):
bl_idname = "VIEW3D_PT_spirofit_spline"
bl_space_type = "VIEW_3D"
bl_context = "objectmode"
bl_region_type = "TOOLS"
Expand Down
4 changes: 2 additions & 2 deletions release/scripts/addons/add_curve_sapling/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ def execute(self, context):
class PresetMenu(Menu):
"""Create the preset menu by finding all preset files
in the preset directory"""
bl_idname = "sapling.presetmenu"
bl_idname = "SAPLING_MT_preset"
bl_label = "Presets"

def draw(self, context):
Expand Down Expand Up @@ -930,7 +930,7 @@ def draw(self, context):
row.label(" ")
row.prop(self, 'overwrite')
row = box.row()
row.menu('sapling.presetmenu', text='Load Preset')
row.menu('SAPLING_MT_preset', text='Load Preset')
row.prop(self, 'limitImport')

elif self.chooseSet == '1':
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -627,7 +627,7 @@ def execute(self, context):


class discombobulator_dodads_list(Menu):
bl_idname = "object.discombobulator_dodad_list"
bl_idname = "OBJECT_MT_discombobulator_dodad_list"
bl_label = "List of saved Doodads"
bl_description = "List of the saved Doodad Object Names"
bl_options = {'REGISTER'}
Expand All @@ -644,7 +644,7 @@ def draw(self, context):


class discombob_help(Menu):
bl_idname = "help.discombobulator"
bl_idname = "HELP_MT_discombobulator"
bl_label = "Usage Information"
bl_description = "Help"
bl_options = {'REGISTER'}
Expand Down Expand Up @@ -688,7 +688,7 @@ def draw(self, context):
layout = self.layout

row = layout.row()
row.menu('help.discombobulator', icon='INFO')
row.menu('HELP_MT_discombobulator', icon='INFO')
box = layout.box()
box.label("Protusions settings")
row = box.row()
Expand Down Expand Up @@ -740,7 +740,7 @@ def draw(self, context):
doodle = len(bpy.context.scene.discomb.DISC_doodads)

col.enabled = (True if doodle > 0 else False)
col.menu("object.discombobulator_dodad_list",
col.menu("OBJECT_MT_discombobulator_dodad_list",
text="List of saved Doodads ({})".format(doodle))

box = layout.box()
Expand Down
2 changes: 2 additions & 0 deletions release/scripts/addons/ant_landscape/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ def menu_func_landscape(self, context):

# Landscape Add Panel
class panel_func_add_landscape(bpy.types.Panel):
bl_idname = "ANTLANDSCAPE_PT_add"
bl_space_type = "VIEW_3D"
bl_context = "objectmode"
bl_region_type = "TOOLS"
Expand All @@ -90,6 +91,7 @@ def draw(self, context):

# Landscape Tools:
class AntLandscapeToolsPanel(bpy.types.Panel):
bl_idname = "ANTLANDSCAPE_PT_tools"
bl_space_type = "VIEW_3D"
bl_context = "objectmode"
bl_region_type = "TOOLS"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -586,6 +586,14 @@ class AntAddLandscape(bpy.types.Operator):
description="Automatic refresh"
)

@classmethod
def poll(self, context):
ob = context.object
if ob is not None:
if ob.mode == 'EDIT':
return False
return True

def draw(self, context):
draw_ant_refresh(self, context)
draw_ant_main(self, context, generate=True)
Expand Down
5 changes: 4 additions & 1 deletion release/scripts/addons/ant_landscape/ant_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,10 @@ class AntLandscapeRegenerate(bpy.types.Operator):

@classmethod
def poll(cls, context):
return bpy.context.active_object.ant_landscape
ob = bpy.context.active_object
if ob.mode == 'EDIT':
return False
return ob.ant_landscape


def execute(self, context):
Expand Down

0 comments on commit 3eeeb5d

Please sign in to comment.