...
 
Commits (83)
......@@ -43,7 +43,7 @@ def addText(string = '', loc = ((0, 0, 0)), textsize = 1, align = 'CENTER', offs
tcu = bpy.data.curves.new(string + 'Data', 'FONT')
text = bpy.data.objects.new(string + 'Text', tcu)
tcu.body = string
tcu.fill_mode = 'NONE'
tcu.fill_mode = 'BOTH'
tcu.align_x = align
tcu.size = textsize
tcu.offset_y = offset_y
......@@ -1524,7 +1524,7 @@ def createCurve(vertArray, self, align_matrix):
# set curveOptions
newCurve.dimensions = '2D'
newCurve.fill_mode = 'NONE'
newCurve.fill_mode = 'BOTH'
newSpline.use_cyclic_u = True
newSpline.use_endpoint_u = True
......
......@@ -381,9 +381,8 @@ classes = (CLASS_ImportCluster,
def register():
from bpy.utils import register_class
for cls in classes:
register_class(cls)
bpy.utils.register_class(cls)
bpy.types.Scene.atom_cluster = bpy.props.PointerProperty(type=
CLASS_atom_cluster_Properties)
......@@ -391,12 +390,12 @@ def register():
def unregister():
from bpy.utils import register_class
for cls in classes:
unregister_class(cls)
bpy.types.VIEW3D_MT_mesh_add.remove(DEF_menu_func)
del bpy.types.Scene.atom_cluster
for cls in reversed(classes):
bpy.utils.unregister_class(cls)
if __name__ == "__main__":
......
......@@ -965,11 +965,8 @@ class OBJECT_OT_add_mesh_rock(bpy.types.Operator):
# Build the presets list for the enum property.
# This needs to be a for loop as the user might add presets to
# the XML file and those should show here:
for i in range(len(presetsList)):
value = str(i)
name = presetsList[i][0]
description = name + " preset values."
presets.append((value, name, description))
for i, preset in enumerate(presetsList):
presets.append((str(i), preset[0], preset[0] + " preset values"))
preset_values: EnumProperty(
name="Presets",
......@@ -985,38 +982,38 @@ class OBJECT_OT_add_mesh_rock(bpy.types.Operator):
scale_X: FloatVectorProperty(
name="X scale",
description="X axis scaling range.",
description="X axis scaling range",
min=0.0, max=256.0, step=1,
default=defaults[1], size=2)
skew_X: FloatProperty(
name="X skew",
description="X Skew ratio. 0.5 is no skew.",
description="X Skew ratio. 0.5 is no skew",
min=-1.0, max=1.0, default=defaults[4])
scale_Y: FloatVectorProperty(
name="Y scale",
description="Y axis scaling range.",
description="Y axis scaling range",
min=.0, max=256.0, step=1,
default=defaults[2], size=2)
skew_Y: FloatProperty(
name="Y skew",
description="Y Skew ratio. 0.5 is no skew.",
description="Y Skew ratio. 0.5 is no skew",
min=-1.0, max=1.0, default=defaults[5])
scale_Z: FloatVectorProperty(
name="Z scale",
description="Z axis scaling range.",
description="Z axis scaling range",
min=0.0, max=256.0, step=1,
default=defaults[3], size=2)
skew_Z: FloatProperty(
name="Z skew",
description="Z Skew ratio. 0.5 is no skew.",
description="Z Skew ratio. 0.5 is no skew",
min=-1.0, max=1.0, default=defaults[6])
use_scale_dis: BoolProperty(
name="Scale displace textures",
description="Scale displacement textures with dimensions. May cause streched textures.",
description="Scale displacement textures with dimensions. May cause streched textures",
default=defaults[7])
scale_fac: FloatVectorProperty(
name="Scaling Factor",
description="XYZ scaling factor. 1: no scaling.",
description="XYZ scaling factor. 1: no scaling",
min=0.0001, max=256.0, step=0.1,
default=defaults[8], size=3)
......@@ -1035,28 +1032,28 @@ class OBJECT_OT_add_mesh_rock(bpy.types.Operator):
min=1, max=1024, default=defaults[11])
display_detail: IntProperty(
name="Display Detail",
description="Display detail. Use a lower value for high numbers of rocks.",
description="Display detail. Use a lower value for high numbers of rocks",
min=1, max=128, default=defaults[12])
smooth_fac: FloatProperty(
name="Smooth Factor",
description="Smoothing factor. A value of 0 disables.",
description="Smoothing factor. A value of 0 disables",
min=0.0, max=128.0, default=defaults[13])
smooth_it: IntProperty(
name="Smooth Iterations",
description="Smoothing iterations. A value of 0 disables.",
description="Smoothing iterations. A value of 0 disables",
min=0, max=128, default=defaults[14])
use_generate: BoolProperty(
name="Generate Rocks",
description="Enable actual generation.",
description="Enable actual generation",
default=defaults[15])
use_random_seed: BoolProperty(
name="Use a random seed",
description="Create a seed based on time. Causes user seed to be ignored.",
description="Create a seed based on time. Causes user seed to be ignored",
default=defaults[16])
user_seed: IntProperty(
name="User seed",
description="Use a specific seed for the generator.",
description="Use a specific seed for the generator",
min=0, max=1048576, default=defaults[17])
def draw(self, context):
......
......@@ -94,7 +94,7 @@ bl_info = {
"warning": "",
"wiki_url": "https://pablovazquez.art/amaranth",
"tracker_url": "https://developer.blender.org/maniphest/task/edit/form/2/",
"category": "Scene",
"category": "Interface",
}
......
......@@ -70,7 +70,7 @@ class AMTH_OBJECT_OT_meshlight_add(bpy.types.Operator):
bpy.ops.mesh.primitive_grid_add(
x_subdivisions=4, y_subdivisions=4,
rotation=self.rotation, radius=self.size)
rotation=self.rotation, size=self.size)
bpy.context.object.name = meshlight_name
meshlight = scene.objects[meshlight_name]
......@@ -86,7 +86,7 @@ class AMTH_OBJECT_OT_meshlight_add(bpy.types.Operator):
meshlight.active_material = material
material.use_nodes = True
material.diffuse_color = (1, 0.5, 0)
material.diffuse_color = (1, 0.5, 0, 1)
nodes = material.node_tree.nodes
links = material.node_tree.links
......@@ -179,16 +179,16 @@ def ui_menu_lamps_add(self, context):
self.layout.separator()
self.layout.operator(
AMTH_OBJECT_OT_meshlight_add.bl_idname,
icon="LAMP_AREA", text="Meshlight")
icon="LIGHT_AREA", text="Meshlight")
# //FEATURE: Add Meshlight: Single Sided
def register():
bpy.utils.register_class(AMTH_OBJECT_OT_meshlight_add)
bpy.types.VIEW3D_MT_mesh_add.append(ui_menu_lamps_add)
bpy.types.VIEW3D_MT_light_add.append(ui_menu_lamps_add)
def unregister():
bpy.utils.unregister_class(AMTH_OBJECT_OT_meshlight_add)
bpy.types.VIEW3D_MT_mesh_add.remove(ui_menu_lamps_add)
bpy.types.VIEW3D_MT_light_add.remove(ui_menu_lamps_add)
......@@ -23,9 +23,9 @@ bl_info = {
"name": "Motion Trail",
"author": "Bart Crouch",
"version": (3, 1, 3),
"blender": (2, 65, 4),
"blender": (2, 80, 0),
"location": "View3D > Toolbar > Motion Trail tab",
"warning": "",
"warning": "Needs bgl draw update",
"description": "Display and edit motion trails in the 3D View",
"wiki_url": "https://wiki.blender.org/index.php/Extensions:2.6/Py/"
"Scripts/Animation/Motion_Trail",
......@@ -1611,7 +1611,7 @@ class MotionTrailOperator(bpy.types.Operator):
class MotionTrailPanel(bpy.types.Panel):
bl_category = "Animation"
bl_space_type = 'VIEW_3D'
bl_region_type = 'TOOLS'
bl_region_type = 'UI'
bl_label = "Motion Trail"
bl_options = {'DEFAULT_CLOSED'}
......
This diff is collapsed.
......@@ -3,7 +3,7 @@
bl_info = {
"name": "Cycles Automatic Materials",
"author": "Théo Friberg",
"blender": (2, 70, 0),
"blender": (2, 80, 0),
"version": (0, 39),
"location": "Space > Automatic / Adjustable Material from Image",
"description": "One-click material setup from texture for Cycles. Blur from b°wide node pack.",
......
......@@ -48,8 +48,8 @@
"label": "Noise source",
"type": "ShaderNodeTexNoise",
"location": [-600, -150],
"inputs[1].default_value": "1000.0"
"inputs['Scale'].default_value": "1000.0"
}
]
}
\ No newline at end of file
}
......@@ -119,7 +119,7 @@
"in": [
["Texture Coordinate", "\"UV\"", 0]
],
"inputs[1].default_value": 100000.0
"inputs['Scale'].default_value": 100000.0
},
{
"type": "ShaderNodeMapping",
......@@ -129,7 +129,7 @@
["Texture Coordinate", "\"UV\"", 0]
],
"vector_type": "\"TEXTURE\"",
"translation": "(0.5, 0.5, 0)"
"inputs['Location'].default_value": "(0.5, 0.5, 0)"
},
{
"type": "ShaderNodeMixRGB",
......@@ -167,7 +167,7 @@
"label": "Prepare Randomization",
"location": [1605, 0],
"in": [
["Random Number Generator", 0],
["Random Number Generator", "\"Color\""],
["Adjust slope 2", 0]
],
"operation": "\"MULTIPLY\"",
......
### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ##### END GPL LICENSE BLOCK #####
# <pep8 compliant>
bl_info = {
"name": "Cacharanth",
"author": "Pablo Vazquez, Lukas Toenne",
"version": (0, 2),
"blender": (2, 73, 0),
"location": "View3D > Cacharanth (Tab)",
"description": "Import and Export Caches",
"warning": "",
"wiki_url": "",
"tracker_url": "https://developer.blender.org/maniphest/task/edit/form/2/",
"category": "Import-Export",
}
import bpy
from cacharanth import ui, meshcache
def register():
ui.register()
meshcache.register()
def unregister():
ui.unregister()
meshcache.unregister()
if __name__ == "__main__":
register()
### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ##### END GPL LICENSE BLOCK #####
# <pep8 compliant>
import bpy
from bpy.types import Operator
from bpy.props import *
def meshcache_export(context, objects):
scene = context.scene
for ob in objects:
filename = scene.meshcache_folder + "/" + scene.meshcache_group + "_" + ob.name + ".cache.mdd"
if ob.modifiers:
for mo in ob.modifiers:
if mo.type == 'SUBSURF':
mo.show_viewport = False
override = {
'blend_data' : context.blend_data,
'window' : context.window,
'screen' : context.screen,
'area' : context.area,
'region' : context.region,
'scene' : scene,
'active_object' : ob,
'object' : ob,
}
bpy.ops.export_shape.mdd(override,
filepath=filename,
frame_start=scene.meshcache_frame_start,
frame_end=scene.meshcache_frame_end,
fps=scene.meshcache_frame_rate)
def meshcache_import(context, objects):
scene = context.scene
mc_mod_name = "MeshCacheAM"
import os.path
for ob in objects:
filename = scene.meshcache_folder + "/" + scene.meshcache_group + "_" + ob.name + ".cache.mdd"
if os.path.isfile(filename):
has_meshcache = False
if ob.modifiers:
for mo in ob.modifiers:
if mo.type == 'MESH_CACHE':
has_meshcache = True
mo.name = mc_mod_name
if not has_meshcache:
ob.modifiers.new(mc_mod_name, "MESH_CACHE")
ob.modifiers[mc_mod_name].filepath = filename
ob.modifiers[mc_mod_name].frame_start = scene.meshcache_frame_start
else:
print("! No Meshcache found for {0}".format(ob.name))
class MeshcacheOperator():
@classmethod
def poll(cls, context):
if context.scene.meshcache_apply_to == 'GROUP':
# XXX doesn't seem correct
return bpy.data.collections
else:
return context.active_object is not None
def meshcache_objects(self, context):
"""Filtered list of Blender Objects used by the cache export/import"""
scene = context.scene
if scene.meshcache_apply_to == 'GROUP':
objects = bpy.data.collections[scene.meshcache_group].objects
else:
objects = context.selected_objects
if scene.use_meshcache_exclude_names:
excluded = { ex.name for ex in scene.meshcache_exclude_names if ex.name }
else:
excluded = []
for ob in objects:
if ob.type == 'MESH':
if ob.name not in excluded:
yield ob
self.report_used(ob)
else:
self.report_excluded(ob)
class MESH_OP_MeshcacheExport(MeshcacheOperator, Operator):
"""Export Meshcache"""
bl_idname = "object.meshcache_export"
bl_label = "Export Mesh Cache"
howmany_exported = 0
howmany_excluded = 0
def report_used(self, ob):
MESH_OP_MeshcacheExport.howmany_exported += 1
print("{0} - Exported".format(ob.name))
def report_excluded(self, ob):
MESH_OP_MeshcacheExport.howmany_excluded += 1
print("** {0} - Excluded".format(ob.name))
def execute(self, context):
print("\n== Meshcache Export Start ==")
MESH_OP_MeshcacheExport.howmany_exported = 0
MESH_OP_MeshcacheExport.howmany_excluded = 0
meshcache_export(context, self.meshcache_objects(context))
print("\n== Meshcache Export Finished ==")
print("== {0} Exported, {1} Excluded ==".format(
MESH_OP_MeshcacheExport.howmany_exported,
MESH_OP_MeshcacheExport.howmany_excluded))
self.report({'INFO'}, "Meshcache Exported")
return {'FINISHED'}
class MESH_OP_MeshcacheImport(MeshcacheOperator, Operator):
"""Import Meshcache (creates Meshcache modifiers when necessary)"""
bl_idname = "object.meshcache_import"
bl_label = "Import Mesh Cache"
howmany_imported = 0
howmany_excluded = 0
def report_used(self, ob):
MESH_OP_MeshcacheImport.howmany_imported += 1
print("{0} - Imported".format(ob.name))
def report_excluded(self, ob):
MESH_OP_MeshcacheImport.howmany_excluded += 1
print("** {0} - Excluded".format(ob.name))
def execute(self, context):
print("\n== Meshcache Import Start ==")
MESH_OP_MeshcacheImport.howmany_imported = 0
MESH_OP_MeshcacheImport.howmany_excluded = 0
meshcache_import(context, self.meshcache_objects(context))
print("\n== Meshcache Import Finished ==")
print("== {0} Imported, {1} Excluded ==".format(
MESH_OP_MeshcacheImport.howmany_imported,
MESH_OP_MeshcacheImport.howmany_excluded))
self.report({'INFO'}, "Meshcache Imported")
return {'FINISHED'}
def register():
bpy.utils.register_class(MESH_OP_MeshcacheExport)
bpy.utils.register_class(MESH_OP_MeshcacheImport)
def unregister():
bpy.utils.unregister_class(MESH_OP_MeshcacheExport)
bpy.utils.unregister_class(MESH_OP_MeshcacheImport)
### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ##### END GPL LICENSE BLOCK #####
# <pep8 compliant>
import bpy, os
from bpy.types import Operator, Panel, UIList
from bpy.props import *
from bpy_extras.io_utils import ImportHelper
from cacharanth import meshcache
from cacharanth.meshcache import MESH_OP_MeshcacheExport, MESH_OP_MeshcacheImport
class MESH_OP_MeshcacheRefresh(Operator):
"""Refresh"""
bl_idname = "scene.meshcache_refresh"
bl_label = "Refresh"
def execute(self, context):
context.scene.frame_current = context.scene.frame_current
return {'FINISHED'}
class CACHARANTH_GroupSelect(Operator):
bl_idname = "cacharanth.group_select"
bl_label = "Select Group"
bl_description = "Switch to another material in this mesh"
def avail_groups(self,context):
items = [(str(i),x.name,x.name, "GROUP", i) for i,x in enumerate(bpy.data.collections)]
return items
group_select: bpy.props.EnumProperty(items = avail_groups, name = "Available Groups")
@classmethod
def poll(cls, context):
return bpy.data.collections
def execute(self,context):
bpy.context.scene.meshcache_group = bpy.data.collections[int(self.group_select)].name
return {'FINISHED'}
def MeshcacheFolderSet(context, filepath):
import os
fp = filepath if os.path.isdir(filepath) else os.path.dirname(filepath)
for sc in bpy.data.scenes:
sc.meshcache_folder = fp
return {'FINISHED'}
class MeshcacheFolderSetButton(Operator, ImportHelper):
bl_idname = "buttons.meshcache_folder_set"
bl_label = "Set Mesh Cache Folder"
filename_ext = ".mdd"
def execute(self, context):
return MeshcacheFolderSet(context, self.filepath)
class MESH_UL_MeshcacheExcludeName(bpy.types.UIList):
def draw_item(self, context, layout, data, rule, icon, active_data, active_propname, index):
split = layout.split(0.5)
row = split.split(align=False)
row.label(text="%s" % (rule.name))
class MESH_OT_MeshcacheExcludeNameAdd(Operator):
bl_idname = "buttons.meshcache_exclude_add"
bl_label = "Add Exclude Rule"
bl_options = {'UNDO'}
def execute(self, context):
scene = context.scene
rules = scene.meshcache_exclude_names
rule = rules.add()
rule.name = "Rule.%.3d" % len(rules)
scene.meshcache_exclude_names_active_index = len(rules) - 1
return {'FINISHED'}
class MESH_OT_MeshcacheExcludeNameRemove(Operator):
bl_idname = "buttons.meshcache_exclude_remove"
bl_label = "Remove Exclude Rule"
bl_options = {'UNDO'}
def execute(self, context):
scene = context.scene
rules = scene.meshcache_exclude_names
rules.remove(scene.meshcache_exclude_names_active_index)
if scene.meshcache_exclude_names_active_index > len(rules) - 1:
scene.meshcache_exclude_names_active_index = len(rules) - 1
return {'FINISHED'}
class MeshcacheExcludeNames(bpy.types.PropertyGroup):
name: StringProperty(
name="Rule Name",
)
class VIEW3D_PT_MeshcacheToolsPanel(Panel):
"""Cacharanth Panel"""
bl_label = "Cacharanth Tools"
bl_idname = "VIEW3D_PT_MeshcacheToolsPanel"
bl_space_type = 'VIEW_3D'
bl_region_type = 'TOOLS'
bl_category = "Cacharanth"
def draw(self, context):
layout = self.layout
scene = bpy.context.scene
howmany_exported = MESH_OP_MeshcacheExport.howmany_exported
howmany_exported_excluded = MESH_OP_MeshcacheExport.howmany_excluded
howmany_imported = MESH_OP_MeshcacheImport.howmany_imported
howmany_imported_excluded = MESH_OP_MeshcacheImport.howmany_excluded
row = layout.row(align=True)
row.prop(scene, "meshcache_apply_to", expand=True)
if scene.meshcache_apply_to == 'GROUP':
if bpy.data.collections:
row = layout.row(align=True)
row.enabled = len(bpy.data.collections) != 0
row.label(text="Select Group:")
row.operator_menu_enum("cacharanth.group_select",
"group_select",
text=scene.meshcache_group,
icon="GROUP")
else:
row = layout.row(align=True)
row.label(text="There are no groups", icon="ERROR")
else:
row = layout.row(align=True)
row.label(text="{0} Selected Objects".format(
len(context.selected_objects)))
row = layout.row(align=True)
row.prop(scene, "meshcache_folder", text="Export Path")
row.operator("buttons.meshcache_folder_set", icon='FILEBROWSER', text="")
row = layout.row(align=True)
row.label(text="Export Settings:")
row.prop(scene, "meshcache_frame_start", text="Frame Start")
row.prop(scene, "meshcache_frame_end", text="Frame End")
row.prop(scene, "meshcache_frame_rate", text="FPS")
row = layout.row(align=True)
row.prop(scene, "use_meshcache_exclude_names",
text="Exclude Objects by Name")
if scene.use_meshcache_exclude_names:
row = layout.row()
row.template_list(
"MESH_UL_MeshcacheExcludeName", "meshcache_exclude_names",
scene, "meshcache_exclude_names",
scene, "meshcache_exclude_names_active_index")
col = row.column()
colsub = col.column(align=True)
colsub.operator("buttons.meshcache_exclude_add", icon='ZOOMIN', text="")
colsub.operator("buttons.meshcache_exclude_remove", icon='ZOOMOUT', text="")
if scene.meshcache_exclude_names:
index = scene.meshcache_exclude_names_active_index
rule = scene.meshcache_exclude_names[index]
row = layout.row(align=True)
row.prop(rule, "name", text="Exclude Text")
layout.separator()
row = layout.row(align=True)
row.operator("object.meshcache_import", icon="IMPORT")
row.operator("object.meshcache_export", icon="EXPORT")
row.operator("scene.meshcache_refresh", icon="FILE_REFRESH", text="")
row = layout.row(align=True)
row.label(text="Export:")
row.label(text="{0} Exported".format(str(howmany_exported)))
row.label(text="{0} Excluded".format(str(howmany_exported_excluded)))
row = layout.row(align=True)
row.label(text="Import:")
row.label(text="{0} Imported".format(str(howmany_imported)))
row.label(text="{0} Excluded".format(str(howmany_imported_excluded)))
classes = (
VIEW3D_PT_MeshcacheToolsPanel,
MESH_OP_MeshcacheRefresh,
MESH_UL_MeshcacheExcludeName,
MESH_OT_MeshcacheExcludeNameAdd,
MESH_OT_MeshcacheExcludeNameRemove,
MeshcacheExcludeNames,
MeshcacheFolderSetButton,
CACHARANTH_GroupSelect
)
def register():
for cls in classes:
bpy.utils.register_class(cls)
from bpy.types import Scene
Scene.meshcache_apply_to = EnumProperty(
name="Apply To",
items=(('GROUP', "Group", "Objects in a group"),
('OBJECT', "Selected Objects", "Selected objects only"),
),
default='OBJECT',
)
Scene.meshcache_folder = StringProperty(default="Choose a Path...")
Scene.meshcache_group = StringProperty(default="Select Group")
Scene.meshcache_frame_start = IntProperty(default=1,
soft_min=0)
Scene.meshcache_frame_end = IntProperty(default=1,
soft_min=1)
Scene.meshcache_frame_rate = IntProperty(default=24,
soft_min=1)
Scene.use_meshcache_exclude_names = BoolProperty(
default=False,
name="Exclude by Name",
description="Exclude objects with a name including text")
Scene.meshcache_exclude_names = CollectionProperty(type=MeshcacheExcludeNames)
Scene.meshcache_exclude_names_active_index = IntProperty()
def unregister():
for cls in classes:
bpy.utils.unregister_class(cls)
......@@ -20,7 +20,7 @@ bl_info = {
"name": "Camera Overscan",
"author": "John Roper, Barnstorm VFX, Luca Scheller",
"version": (1, 2, 1),
"blender": (2, 76, 0),
"blender": (2, 80, 0),
"location": "Render Settings > Camera Overscan",
"description": "Render Overscan",
"warning": "",
......@@ -173,7 +173,8 @@ class camera_overscan_props(PropertyGroup):
def register():
bpy.utils.register_module(__name__)
bpy.utils.register_class(CODuplicateCamera)
bpy.utils.register_class(camera_overscan_props)
bpy.types.RENDER_PT_dimensions.append(RO_Menu)
bpy.types.Scene.camera_overscan = PointerProperty(
type=camera_overscan_props
......@@ -181,7 +182,8 @@ def register():
def unregister():
bpy.utils.unregister_module(__name__)
bpy.utils.unregister_class(CODuplicateCamera)
bpy.utils.unregister_class(camera_overscan_props)
bpy.types.RENDER_PT_dimensions.remove(RO_Menu)
del bpy.types.Scene.camera_overscan
......
# ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 3
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ##### END GPL LICENSE BLOCK #####
# <pep8-80 compliant>
# This script was developed with financial support from the Foundation for
# Science and Technology of Portugal, under the grant SFRH/BD/66452/2009.
bl_info = {
"name": "Carnegie Mellon University Mocap Library Browser",
"author": "Daniel Monteiro Basso <daniel@basso.inf.br>",
"version": (2015, 3, 20),
"blender": (2, 66, 6),
"location": "View3D > Tools",
"description": "Assistant for using CMU Motion Capture data",
"wiki_url": "http://wiki.blender.org/index.php/Extensions:2.6/Py/"
"Scripts/3D_interaction/CMU_Mocap_Library_Browser",
"tracker_url": "https://developer.blender.org/maniphest/task/edit/form/2/",
"category": "Animation"}
if 'bpy' in locals():
import importlib
library = importlib.reload(library)
download = importlib.reload(download)
makehuman = importlib.reload(makehuman)
data = importlib.reload(data)
else:
from . import library
from . import download
from . import makehuman
from . import data
import os
import bpy
class CMUMocapSubjectBrowser(bpy.types.Panel):
bl_idname = "object.cmu_mocap_subject_browser"
bl_label = "CMU Mocap Subject Browser"
bl_space_type = 'VIEW_3D'
bl_region_type = 'TOOLS'
bl_category = 'Animation'
bl_options = {'DEFAULT_CLOSED'}
def draw(self, context):
data.initialize_subjects(context)
layout = self.layout
cml = context.preferences.addons['cmu_mocap_browser'].preferences
layout.template_list("UI_UL_list", "SB", cml, "subject_list",
cml, "subject_active")
layout.prop(cml, "subject_import_name")
if cml.subject_active != -1:
sidx = cml.subject_list[cml.subject_active].idx
remote_fname = library.skeleton_url.format(sidx)
tid = "{0:02d}".format(sidx)
local_path = os.path.expanduser(cml.local_storage)
if cml.follow_structure:
local_path = os.path.join(local_path, tid)
local_fname = os.path.join(local_path, tid + ".asf")
do_import = False
if os.path.exists(local_fname):
label = "Import Selected"
do_import = True
elif cml.automatically_import:
label = "Download and Import Selected"
else:
label = "Download Selected"
props = layout.operator("mocap.download_import",
text=label, icon='ARMATURE_DATA')
props.remote_file = remote_fname
props.local_file = local_fname
props.do_import = do_import
class CMUMocapMotionBrowser(bpy.types.Panel):
bl_idname = "object.cmu_mocap_motion_browser"
bl_label = "CMU Mocap Motion Browser"
bl_space_type = 'VIEW_3D'
bl_region_type = 'TOOLS'
bl_category = 'Animation'
bl_options = {'DEFAULT_CLOSED'}
def draw(self, context):
layout = self.layout
cml = context.preferences.addons['cmu_mocap_browser'].preferences
layout.template_list("UI_UL_list", "MB", cml, "motion_list",
cml, "motion_active")
if cml.motion_active == -1:
return
sidx = cml.subject_list[cml.subject_active].idx
midx = cml.motion_list[cml.motion_active].idx
motion = library.subjects[sidx]['motions'][midx]
fps = motion['fps']
ifps = fps // cml.frame_skip
row = layout.row()
row.column().label(text="Original: {0:d} fps.".format(fps))
row.column().label(text="Importing: {0:d} fps.".format(ifps))
layout.prop(cml, "frame_skip")
layout.prop(cml, "cloud_scale")
remote_fname = library.motion_url.format(sidx, midx)
tid = "{0:02d}".format(sidx)
local_path = os.path.expanduser(cml.local_storage)
if cml.follow_structure:
local_path = os.path.join(local_path, tid)
for target, icon, ext in (
('Motion Data', 'POSE_DATA', 'amc'),
('Marker Cloud', 'EMPTY_DATA', 'c3d'),
('Movie', 'FILE_MOVIE', 'mpg')):
action = "Import" if ext != 'mpg' else "Open"
fname = "{0:02d}_{1:02d}.{2}".format(sidx, midx, ext)
local_fname = os.path.join(local_path, fname)
do_import = False
if os.path.exists(local_fname):
label = "{0} {1}".format(action, target)
do_import = True
elif cml.automatically_import:
label = "Download and {0} {1}".format(action, target)
else:
label = "Download {0}".format(target)
row = layout.row()
props = row.operator("mocap.download_import", text=label, icon=icon)
props.remote_file = remote_fname + ext
props.local_file = local_fname
props.do_import = do_import
row.active = ext in motion['files']
class CMUMocapToMakeHuman(bpy.types.Panel):
bl_idname = "object.cmu_mocap_makehuman"
bl_label = "CMU Mocap to MakeHuman"
bl_space_type = 'VIEW_3D'
bl_region_type = 'TOOLS'
bl_category = 'Animation'
bl_options = {'DEFAULT_CLOSED'}
def draw(self, context):
layout = self.layout
cml = context.preferences.addons['cmu_mocap_browser'].preferences
layout.prop_search(cml, "floor", context.scene, "objects")
layout.prop(cml, "feet_angle")
layout.operator("object.cmu_align", text='Align armatures')
layout.operator("object.cmu_transfer", text='Transfer animation')
def register():
bpy.utils.register_module(__name__)
def unregister():
bpy.utils.unregister_module(__name__)
if __name__ == "__main__":
register()
# ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 3
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ##### END GPL LICENSE BLOCK #####
import bpy
from . import library
def initialize_subjects(context):
"""
Initializes the main object and the subject (actor) list
"""
cml = context.preferences.addons['cmu_mocap_browser'].preferences
if hasattr(cml, 'initialized'):
return
cml.initialized = True
while cml.subject_list:
cml.subject_list.remove(0)
for k, v in library.subjects.items():
n = cml.subject_list.add()
n.name = "{:d} - {}".format(k, v['desc'])
n.idx = k
def update_motions(obj, context):
"""
Updates the motion list after a subject is selected
"""
sidx = -1
if obj.subject_active != -1:
sidx = obj.subject_list[obj.subject_active].idx
while obj.motion_list:
obj.motion_list.remove(0)
if sidx != -1:
for k, v in library.subjects[sidx]["motions"].items():
n = obj.motion_list.add()
n.name = "{:d} - {}".format(k, v["desc"])
n.idx = k
obj.motion_active = -1
class ListItem(bpy.types.PropertyGroup):
name: bpy.props.StringProperty()
idx: bpy.props.IntProperty()
class CMUMocapLib(bpy.types.AddonPreferences):
bl_idname = 'cmu_mocap_browser'
local_storage: bpy.props.StringProperty(
name="Local Storage",
subtype='DIR_PATH',
description="Location to store downloaded resources",
default="~/cmu_mocap_lib"
)
follow_structure: bpy.props.BoolProperty(
name="Follow Library Folder Structure",
description="Store resources in subfolders of the local storage",
default=True
)
automatically_import: bpy.props.BoolProperty(
name="Automatically Import after Download",
description="Import the resource after the download is finished",
default=True
)
subject_list: bpy.props.CollectionProperty(
name="subjects", type=ListItem
)
subject_active: bpy.props.IntProperty(
name="subject_idx", default=-1, update=update_motions
)
subject_import_name: bpy.props.StringProperty(
name="Armature Name",
description="Identifier of the imported subject's armature",
default="Skeleton"
)
motion_list: bpy.props.CollectionProperty(
name="motions", type=ListItem
)
motion_active: bpy.props.IntProperty(
name="motion_idx", default=-1
)
frame_skip: bpy.props.IntProperty(
# usually the sample rate is 120, so the default 4 gives you 30fps
name="Fps Divisor", default=4,
description="Frame supersampling factor", min=1
)
cloud_scale: bpy.props.FloatProperty(
name="Marker Cloud Scale",
description="Scale the marker cloud by this value",
default=1., min=0.0001, max=1000000.0,
soft_min=0.001, soft_max=100.0
)
floor: bpy.props.StringProperty(
name="Floor",
description="Object to use as floor constraint"
)
feet_angle: bpy.props.FloatProperty(
name="Feet Angle",
description="Fix for wrong initial feet position",
default=0
)
def draw(self, context):
layout = self.layout
layout.operator("wm.url_open",
text="Carnegie Mellon University Mocap Library",
icon='URL').url = 'http://mocap.cs.cmu.edu/'
layout.prop(self, "local_storage")
layout.prop(self, "follow_structure")
layout.prop(self, "automatically_import")
# ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 3
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ##### END GPL LICENSE BLOCK #####
import os
import bpy
import bgl
import blf
import math