Merge branch 'master' into xr-controller-support

This commit is contained in:
Peter Kim 2021-06-04 19:16:18 +09:00
commit 35b083b1c8
11 changed files with 643 additions and 457 deletions

View File

@ -1390,6 +1390,8 @@ class SVGGeometryRECT(SVGGeometry):
ob = SVGCreateCurve(self._context)
cu = ob.data
id_names_from_node(self._node, ob)
if self._styles['useFill']:
cu.dimensions = '2D'
cu.fill_mode = 'BOTH'

File diff suppressed because it is too large Load Diff

View File

@ -422,7 +422,7 @@ def unregister():
scripting.unregister()
base_ui.unregister()
render.unregister()
scenography.register()
scenography.unregister()
scripting_properties.unregister()
object_properties.unregister()
texturing_properties.unregister()
@ -430,7 +430,7 @@ def unregister():
scenography_properties.unregister()
render_properties.unregister()
for cls in classes:
for cls in reversed(classes):
unregister_class(cls)

View File

@ -304,4 +304,4 @@ def unregister():
shading_gui.unregister()
object_gui.unregister()
scenography_gui.unregister()
render_gui.register()
render_gui.unregister()

View File

@ -34,11 +34,8 @@ from bl_ui import properties_data_modifier
for member in dir(properties_data_modifier):
subclass = getattr(properties_data_modifier, member)
try:
if hasattr(subclass, "COMPAT_ENGINES"):
subclass.COMPAT_ENGINES.add('POVRAY_RENDER')
except BaseException as e:
print(e.__doc__)
print('An exception occurred: {}'.format(e))
del properties_data_modifier

View File

@ -36,38 +36,26 @@ from bl_ui import properties_output
for member in dir(properties_output):
subclass = getattr(properties_output, member)
try:
if hasattr(subclass, "COMPAT_ENGINES"):
subclass.COMPAT_ENGINES.add('POVRAY_RENDER')
except BaseException as e:
print(e.__doc__)
print('An exception occurred: {}'.format(e))
pass
del properties_output
from bl_ui import properties_freestyle
for member in dir(properties_freestyle):
subclass = getattr(properties_freestyle, member)
try:
if hasattr(subclass, "COMPAT_ENGINES"):
if not (subclass.bl_space_type == 'PROPERTIES' and subclass.bl_context == "render"):
subclass.COMPAT_ENGINES.add('POVRAY_RENDER')
# subclass.bl_parent_id = "RENDER_PT_POV_filter"
except BaseException as e:
print(e.__doc__)
print('An exception occurred: {}'.format(e))
pass
del properties_freestyle
from bl_ui import properties_view_layer
for member in dir(properties_view_layer):
subclass = getattr(properties_view_layer, member)
try:
if hasattr(subclass, "COMPAT_ENGINES"):
subclass.COMPAT_ENGINES.add('POVRAY_RENDER')
except BaseException as e:
print(e.__doc__)
print('An exception occurred: {}'.format(e))
pass
del properties_view_layer
# Use some of the existing buttons.
@ -452,17 +440,13 @@ if check_render_freestyle_svg():
'''
for member in dir(render_freestyle_svg):
subclass = getattr(render_freestyle_svg, member)
try:
if hasattr(subclass, "COMPAT_ENGINES"):
subclass.COMPAT_ENGINES.add('POVRAY_RENDER')
if subclass.bl_idname == "RENDER_PT_SVGExporterPanel":
subclass.bl_parent_id = "RENDER_PT_POV_filter"
subclass.bl_options = {'HIDE_HEADER'}
# subclass.bl_order = 11
print(subclass.bl_info)
except BaseException as e:
print(e.__doc__)
print('An exception occurred: {}'.format(e))
pass
# del render_freestyle_svg.RENDER_PT_SVGExporterPanel.bl_parent_id

View File

@ -31,12 +31,8 @@ from bl_ui import properties_data_camera
for member in dir(properties_data_camera):
subclass = getattr(properties_data_camera, member)
try:
if hasattr(subclass, "COMPAT_ENGINES"):
subclass.COMPAT_ENGINES.add('POVRAY_RENDER')
except BaseException as e:
print(e.__doc__)
print('An exception occurred: {}'.format(e))
pass
del properties_data_camera
# ##################################
@ -54,12 +50,8 @@ from bl_ui import properties_physics_common
for member in dir(properties_physics_common):
subclass = getattr(properties_physics_common, member)
try:
if hasattr(subclass, "COMPAT_ENGINES"):
subclass.COMPAT_ENGINES.add('POVRAY_RENDER')
except BaseException as e:
print(e.__doc__)
print('An exception occurred: {}'.format(e))
pass
del properties_physics_common
# Physics Rigid Bodies wrapping every class 'as is'
@ -67,12 +59,8 @@ from bl_ui import properties_physics_rigidbody
for member in dir(properties_physics_rigidbody):
subclass = getattr(properties_physics_rigidbody, member)
try:
if hasattr(subclass, "COMPAT_ENGINES"):
subclass.COMPAT_ENGINES.add('POVRAY_RENDER')
except BaseException as e:
print(e.__doc__)
print('An exception occurred: {}'.format(e))
pass
del properties_physics_rigidbody
# Physics Rigid Body Constraint wrapping every class 'as is'
@ -80,12 +68,8 @@ from bl_ui import properties_physics_rigidbody_constraint
for member in dir(properties_physics_rigidbody_constraint):
subclass = getattr(properties_physics_rigidbody_constraint, member)
try:
if hasattr(subclass, "COMPAT_ENGINES"):
subclass.COMPAT_ENGINES.add('POVRAY_RENDER')
except BaseException as e:
print(e.__doc__)
print('An exception occurred: {}'.format(e))
pass
del properties_physics_rigidbody_constraint
# Physics Smoke and fluids wrapping every class 'as is'
@ -93,12 +77,8 @@ from bl_ui import properties_physics_fluid
for member in dir(properties_physics_fluid):
subclass = getattr(properties_physics_fluid, member)
try:
if hasattr(subclass, "COMPAT_ENGINES"):
subclass.COMPAT_ENGINES.add('POVRAY_RENDER')
except BaseException as e:
print(e.__doc__)
print('An exception occurred: {}'.format(e))
pass
del properties_physics_fluid
# Physics softbody wrapping every class 'as is'
@ -106,12 +86,8 @@ from bl_ui import properties_physics_softbody
for member in dir(properties_physics_softbody):
subclass = getattr(properties_physics_softbody, member)
try:
if hasattr(subclass, "COMPAT_ENGINES"):
subclass.COMPAT_ENGINES.add('POVRAY_RENDER')
except BaseException as e:
print(e.__doc__)
print('An exception occurred: {}'.format(e))
pass
del properties_physics_softbody
# Physics Field wrapping every class 'as is'
@ -119,12 +95,8 @@ from bl_ui import properties_physics_field
for member in dir(properties_physics_field):
subclass = getattr(properties_physics_field, member)
try:
if hasattr(subclass, "COMPAT_ENGINES"):
subclass.COMPAT_ENGINES.add('POVRAY_RENDER')
except BaseException as e:
print(e.__doc__)
print('An exception occurred: {}'.format(e))
pass
del properties_physics_field
# Physics Cloth wrapping every class 'as is'
@ -132,12 +104,8 @@ from bl_ui import properties_physics_cloth
for member in dir(properties_physics_cloth):
subclass = getattr(properties_physics_cloth, member)
try:
if hasattr(subclass, "COMPAT_ENGINES"):
subclass.COMPAT_ENGINES.add('POVRAY_RENDER')
except BaseException as e:
print(e.__doc__)
print('An exception occurred: {}'.format(e))
pass
del properties_physics_cloth
# Physics Dynamic Paint wrapping every class 'as is'
@ -145,24 +113,16 @@ from bl_ui import properties_physics_dynamicpaint
for member in dir(properties_physics_dynamicpaint):
subclass = getattr(properties_physics_dynamicpaint, member)
try:
if hasattr(subclass, "COMPAT_ENGINES"):
subclass.COMPAT_ENGINES.add('POVRAY_RENDER')
except BaseException as e:
print(e.__doc__)
print('An exception occurred: {}'.format(e))
pass
del properties_physics_dynamicpaint
from bl_ui import properties_particle
for member in dir(properties_particle): # add all "particle" panels from blender
subclass = getattr(properties_particle, member)
try:
if hasattr(subclass, "COMPAT_ENGINES"):
subclass.COMPAT_ENGINES.add('POVRAY_RENDER')
except BaseException as e:
print(e.__doc__)
print('An exception occurred: {}'.format(e))
pass
del properties_particle
@ -795,6 +755,7 @@ def register():
def unregister():
bpy.types.LIGHT_PT_POV_light.remove(light_panel_func)
for cls in reversed(classes):
unregister_class(cls)
bpy.types.LIGHT_PT_POV_light.remove(light_panel_func)

View File

@ -353,125 +353,6 @@ class RenderPovSettingsWorld(PropertyGroup):
)
class WorldTextureSlot(PropertyGroup):
"""Declare world texture slot level properties for UI and translated to POV."""
bl_idname = ("pov_texture_slots",)
bl_description = ("Texture_slots from Blender-2.79",)
# Adding a "real" texture datablock as property is not possible
# (or at least not easy through a dynamically populated EnumProperty).
# That's why we'll use a prop_search() UILayout function in texturing_gui.py.
# So we'll assign the name of the needed texture datablock to the below StringProperty.
texture: StringProperty(update=active_texture_name_from_uilist)
# and use another temporary StringProperty to change the linked data
texture_search: StringProperty(
name="", update=active_texture_name_from_search, description="Browse Texture to be linked"
)
blend_factor: FloatProperty(
name="Blend",
description="Amount texture affects color progression of the " "background",
soft_min=0.0,
soft_max=1.0,
default=1.0,
)
horizon_factor: FloatProperty(
name="Horizon",
description="Amount texture affects color of the horizon",
soft_min=0.0,
soft_max=1.0,
default=1.0,
)
object: StringProperty(
name="Object",
description="Object to use for mapping with Object texture coordinates",
default="",
)
offset: FloatVectorProperty(
name="Offset",
description=("Fine tune of the texture mapping X, Y and Z locations "),
precision=4,
step=0.1,
soft_min=-100.0,
soft_max=100.0,
default=(0.0, 0.0, 0.0),
options={"ANIMATABLE"},
subtype="TRANSLATION",
)
scale: FloatVectorProperty(
name="Size",
subtype="XYZ",
size=3,
description="Set scaling for the textures X, Y and Z sizes ",
precision=4,
step=0.1,
soft_min=-100.0,
soft_max=100.0,
default=(1.0, 1.0, 1.0),
options={"ANIMATABLE"},
)
texture_coords: EnumProperty(
name="Coordinates",
description="Texture coordinates used to map the texture onto the background",
items=(
("VIEW", "View", "Use view vector for the texture coordinates"),
(
"GLOBAL",
"Global",
"Use global coordinates for the texture coordinates (interior mist)",
),
(
"ANGMAP",
"AngMap",
"Use 360 degree angular coordinates, e.g. for spherical light probes",
),
("SPHERE", "Sphere", "For 360 degree panorama sky, spherical mapped, only top half"),
("EQUIRECT", "Equirectangular", "For 360 degree panorama sky, equirectangular mapping"),
("TUBE", "Tube", "For 360 degree panorama sky, cylindrical mapped, only top half"),
("OBJECT", "Object", "Use linked objects coordinates for texture coordinates"),
),
default="VIEW",
)
use_map_blend: BoolProperty(
name="Blend Map", description="Affect the color progression of the background", default=True
)
use_map_horizon: BoolProperty(
name="Horizon Map", description="Affect the color of the horizon", default=False
)
use_map_zenith_down: BoolProperty(
name="", description="Affect the color of the zenith below", default=False
)
use_map_zenith_up: BoolProperty(
name="Zenith Up Map", description="Affect the color of the zenith above", default=False
)
zenith_down_factor: FloatProperty(
name="Zenith Down",
description="Amount texture affects color of the zenith below",
soft_min=0.0,
soft_max=1.0,
default=1.0,
)
zenith_up_factor: FloatProperty(
name="Zenith Up",
description="Amount texture affects color of the zenith above",
soft_min=0.0,
soft_max=1.0,
default=1.0,
)
"""
# class WORLD_TEXTURE_SLOTS_UL_layerlist(bpy.types.UIList):
# texture_slots:
@ -490,7 +371,6 @@ classes = (
RenderPovSettingsCamera,
RenderPovSettingsLight,
RenderPovSettingsWorld,
WorldTextureSlot,
)
@ -501,14 +381,12 @@ def register():
bpy.types.Camera.pov = PointerProperty(type=RenderPovSettingsCamera)
bpy.types.Light.pov = PointerProperty(type=RenderPovSettingsLight)
bpy.types.World.pov = PointerProperty(type=RenderPovSettingsWorld)
bpy.types.World.pov_texture_slots = CollectionProperty(type=WorldTextureSlot)
def unregister():
del bpy.types.Camera.pov
del bpy.types.Light.pov
del bpy.types.World.pov
del bpy.types.World.pov_texture_slots
for cls in reversed(classes):
unregister_class(cls)

View File

@ -29,16 +29,8 @@ from bl_ui import properties_material
for member in dir(properties_material):
subclass = getattr(properties_material, member)
try:
# mat=bpy.context.active_object.active_material
# if (mat and mat.pov.type == "SURFACE"
# and not (mat.pov.material_use_nodes or mat.use_nodes)):
# and (engine in cls.COMPAT_ENGINES)) if subclasses were sorted
if hasattr(subclass, "COMPAT_ENGINES"):
subclass.COMPAT_ENGINES.add('POVRAY_RENDER')
except BaseException as e:
print(e.__doc__)
print('An exception occurred: {}'.format(e))
pass
del properties_material
from .shading_properties import check_material

View File

@ -49,12 +49,8 @@ from bl_ui import properties_texture
for member in dir(properties_texture):
subclass = getattr(properties_texture, member)
try:
if hasattr(subclass, "COMPAT_ENGINES"):
subclass.COMPAT_ENGINES.add('POVRAY_RENDER')
except BaseException as e:
print(e.__doc__)
print('An exception occurred: {}'.format(e))
pass
del properties_texture

View File

@ -756,14 +756,28 @@ class LayerInit(bpy.types.Operator):
return {'FINISHED'}
def is_metarig(obj):
if not (obj and obj.data and obj.type == 'ARMATURE'):
return False
if 'rig_id' in obj.data:
return False
for b in obj.pose.bones:
if b.rigify_type != "":
return True
return False
class Generate(bpy.types.Operator):
"""Generates a rig from the active metarig armature"""
bl_idname = "pose.rigify_generate"
bl_label = "Rigify Generate Rig"
bl_options = {'UNDO', 'INTERNAL'}
bl_options = {'UNDO'}
bl_description = 'Generates a rig from the active metarig armature'
@classmethod
def poll(cls, context):
return is_metarig(context.object)
def execute(self, context):
try:
generate.generate_rig(context, context.object)
@ -818,40 +832,60 @@ class Sample(bpy.types.Operator):
"""Create a sample metarig to be modified before generating the final rig"""
bl_idname = "armature.metarig_sample_add"
bl_label = "Add a sample metarig for a rig type"
bl_options = {'UNDO', 'INTERNAL'}
bl_label = "Add Metarig Sample"
bl_options = {'UNDO'}
metarig_type: StringProperty(
name="Type",
description="Name of the rig type to generate a sample of",
maxlen=128,
options={'SKIP_SAVE'}
)
@classmethod
def poll(cls, context):
return context.mode == 'EDIT_ARMATURE'
def draw(self, context):
layout = self.layout
layout.use_property_split = True
layout.use_property_decorate = False
col = layout.column()
build_type_list(context, context.window_manager.rigify_types)
col.prop(context.object.data, "active_feature_set")
col.prop_search(self, "metarig_type", context.window_manager, "rigify_types")
def invoke(self, context, event):
if self.metarig_type == "":
return context.window_manager.invoke_props_dialog(self)
return self.execute(context)
def execute(self, context):
if context.mode == 'EDIT_ARMATURE' and self.metarig_type != "":
try:
rig = rig_lists.rigs[self.metarig_type]["module"]
create_sample = rig.create_sample
except (ImportError, AttributeError, KeyError):
raise Exception("rig type '" + self.metarig_type + "' has no sample.")
else:
create_sample(context.active_object)
finally:
bpy.ops.object.mode_set(mode='EDIT')
if self.metarig_type == "":
self.report({'ERROR'}, "You must select a rig type to create a sample of.")
return {'CANCELLED'}
try:
rig = rig_lists.rigs[self.metarig_type]["module"]
create_sample = rig.create_sample
except (ImportError, AttributeError, KeyError):
raise Exception("rig type '" + self.metarig_type + "' has no sample.")
else:
create_sample(context.active_object)
finally:
bpy.ops.object.mode_set(mode='EDIT')
return {'FINISHED'}
class EncodeMetarig(bpy.types.Operator):
""" Creates Python code that will generate the selected metarig.
"""
"""Creates Python code that will generate the selected metarig"""
bl_idname = "armature.rigify_encode_metarig"
bl_label = "Rigify Encode Metarig"
bl_options = {'UNDO'}
@classmethod
def poll(self, context):
return context.mode == 'EDIT_ARMATURE'
return context.mode == 'EDIT_ARMATURE' and is_metarig(context.object)
def execute(self, context):
name = "metarig.py"
@ -865,21 +899,19 @@ class EncodeMetarig(bpy.types.Operator):
text = write_metarig(context.active_object, layers=True, func_name="create", groups=True, widgets=True)
text_block.write(text)
bpy.ops.object.mode_set(mode='EDIT')
self.report({'INFO'}, f"Metarig written to text datablock: {text_block.name}")
return {'FINISHED'}
class EncodeMetarigSample(bpy.types.Operator):
""" Creates Python code that will generate the selected metarig
as a sample.
"""
"""Creates Python code that will generate the selected metarig as a sample"""
bl_idname = "armature.rigify_encode_metarig_sample"
bl_label = "Rigify Encode Metarig Sample"
bl_options = {'UNDO'}
@classmethod
def poll(self, context):
return context.mode == 'EDIT_ARMATURE'
return context.mode == 'EDIT_ARMATURE' and is_metarig(context.object)
def execute(self, context):
name = "metarig_sample.py"
@ -894,9 +926,31 @@ class EncodeMetarigSample(bpy.types.Operator):
text_block.write(text)
bpy.ops.object.mode_set(mode='EDIT')
self.report({'INFO'}, f"Metarig Sample written to text datablock: {text_block.name}")
return {'FINISHED'}
class VIEW3D_MT_rigify(bpy.types.Menu):
bl_label = "Rigify"
bl_idname = "VIEW3D_MT_rigify"
def draw(self, context):
layout = self.layout
layout.operator(Generate.bl_idname, text="Generate")
if context.mode == 'EDIT_ARMATURE':
layout.separator()
layout.operator(Sample.bl_idname)
layout.separator()
layout.operator(EncodeMetarig.bl_idname, text="Encode Metarig")
layout.operator(EncodeMetarigSample.bl_idname, text="Encode Metarig Sample")
def draw_rigify_menu(self, context):
if is_metarig(context.object):
self.layout.menu(VIEW3D_MT_rigify.bl_idname)
class EncodeWidget(bpy.types.Operator):
""" Creates Python code that will generate the selected metarig.
"""
@ -923,6 +977,10 @@ class EncodeWidget(bpy.types.Operator):
return {'FINISHED'}
def draw_mesh_edit_menu(self, context):
self.layout.operator(EncodeWidget.bl_idname)
self.layout.separator()
def FktoIk(rig, window='ALL'):
@ -1338,6 +1396,7 @@ classes = (
UpgradeMetarigTypes,
SwitchToLegacy,
Sample,
VIEW3D_MT_rigify,
EncodeMetarig,
EncodeMetarigSample,
EncodeWidget,
@ -1359,6 +1418,9 @@ def register():
for cls in classes:
register_class(cls)
bpy.types.VIEW3D_MT_editor_menus.append(draw_rigify_menu)
bpy.types.VIEW3D_MT_edit_mesh.prepend(draw_mesh_edit_menu)
# Sub-modules.
rot_mode.register()
@ -1373,4 +1435,7 @@ def unregister():
for cls in classes:
unregister_class(cls)
bpy.types.VIEW3D_MT_editor_menus.remove(draw_rigify_menu)
bpy.types.VIEW3D_MT_edit_mesh.remove(draw_mesh_edit_menu)
animation_unregister()