diff options
171 files changed, 3754 insertions, 4117 deletions
diff --git a/add_advanced_objects_menu/__init__.py b/add_advanced_objects_menu/__init__.py index 42a33445..32bbbd7f 100644 --- a/add_advanced_objects_menu/__init__.py +++ b/add_advanced_objects_menu/__init__.py @@ -92,8 +92,8 @@ from bpy.props import ( # Define the "Scenes" menu -class INFO_MT_scene_elements_add(Menu): - bl_idname = "INFO_MT_scene_elements" +class VIEW3D_MT_scene_elements_add(Menu): + bl_idname = "VIEW3D_MT_scene_elements" bl_label = "Test Scenes" def draw(self, context): @@ -108,8 +108,8 @@ class INFO_MT_scene_elements_add(Menu): # Define the "Lights" menu -class INFO_MT_mesh_lamps_add(Menu): - bl_idname = "INFO_MT_scene_lamps" +class VIEW3D_MT_mesh_lights_add(Menu): + bl_idname = "VIEW3D_MT_scene_lights" bl_label = "Lighting Sets" def draw(self, context): @@ -122,8 +122,8 @@ class INFO_MT_mesh_lamps_add(Menu): # Define the "Chains" menu -class INFO_MT_mesh_chain_add(Menu): - bl_idname = "INFO_MT_mesh_chain" +class VIEW3D_MT_mesh_chain_add(Menu): + bl_idname = "VIEW3D_MT_mesh_chain" bl_label = "Chains" def draw(self, context): @@ -134,15 +134,15 @@ class INFO_MT_mesh_chain_add(Menu): # Define the "Array" Menu -class INFO_MT_array_mods_add(Menu): - bl_idname = "INFO_MT_array_mods" +class VIEW3D_MT_array_mods_add(Menu): + bl_idname = "VIEW3D_MT_array_mods" bl_label = "Array Mods" def draw(self, context): layout = self.layout layout.operator_context = 'INVOKE_REGION_WIN' - layout.menu("INFO_MT_mesh_chain", icon="LINKED") + layout.menu("VIEW3D_MT_mesh_chain", icon="LINKED") layout.operator("objects.circle_array_operator", text="Circle Array", icon="MOD_ARRAY") @@ -153,8 +153,8 @@ class INFO_MT_array_mods_add(Menu): # Define the "Blocks" Menu -class INFO_MT_quick_blocks_add(Menu): - bl_idname = "INFO_MT_quick_tools" +class VIEW3D_MT_quick_blocks_add(Menu): + bl_idname = "VIEW3D_MT_quick_tools" bl_label = "Block Tools" def draw(self, context): @@ -171,8 +171,8 @@ class INFO_MT_quick_blocks_add(Menu): # Define the "Phsysics Tools" Menu -class INFO_MT_Physics_tools_add(Menu): - bl_idname = "INFO_MT_physics_tools" +class VIEW3D_MT_Physics_tools_add(Menu): + bl_idname = "VIEW3D_MT_physics_tools" bl_label = "Physics Tools" def draw(self, context): @@ -190,12 +190,12 @@ def menu(self, context): layout = self.layout layout.operator_context = 'INVOKE_REGION_WIN' self.layout.separator() - self.layout.menu("INFO_MT_scene_elements", icon="SCENE_DATA") - self.layout.menu("INFO_MT_scene_lamps", icon="LAMP_SPOT") + self.layout.menu("VIEW3D_MT_scene_elements", icon="SCENE_DATA") + self.layout.menu("VIEW3D_MT_scene_lights", icon="LIGHT_SPOT") self.layout.separator() - self.layout.menu("INFO_MT_array_mods", icon="MOD_ARRAY") - self.layout.menu("INFO_MT_quick_tools", icon="MOD_BUILD") - self.layout.menu("INFO_MT_physics_tools", icon="PHYSICS") + self.layout.menu("VIEW3D_MT_array_mods", icon="MOD_ARRAY") + self.layout.menu("VIEW3D_MT_quick_tools", icon="MOD_BUILD") + self.layout.menu("VIEW3D_MT_physics_tools", icon="PHYSICS") # Addons Preferences @@ -524,7 +524,7 @@ def register(): ) # Add "Extras" menu to the "Add" menu - bpy.types.INFO_MT_add.append(menu) + bpy.types.VIEW3D_MT_add.append(menu) try: bpy.types.VIEW3D_MT_AddMenu.append(menu) except: @@ -533,7 +533,7 @@ def register(): def unregister(): # Remove "Extras" menu from the "Add" menu. - bpy.types.INFO_MT_add.remove(menu) + bpy.types.VIEW3D_MT_add.remove(menu) try: bpy.types.VIEW3D_MT_AddMenu.remove(menu) except: diff --git a/add_advanced_objects_menu/add_light_template.py b/add_advanced_objects_menu/add_light_template.py index 9e2c139f..5b4fbc86 100644 --- a/add_advanced_objects_menu/add_light_template.py +++ b/add_advanced_objects_menu/add_light_template.py @@ -5,10 +5,10 @@ from bpy.types import Operator from bpy.props import BoolProperty -def add_lamps(self, context): +def add_lights(self, context): if self.bKeyLight: - keyLight = bpy.data.lamps.new(name="Key_Light", type="SPOT") + keyLight = bpy.data.lights.new(name="Key_Light", type="SPOT") ob = bpy.data.objects.new("Key_Light", keyLight) constraint = ob.constraints.new(type='COPY_LOCATION') constraint.use_offset = True @@ -23,7 +23,7 @@ def add_lamps(self, context): ob.rotation_euler[2] = -0.785398 if self.bFillLight: - fillLight = bpy.data.lamps.new(name="Fill_Light", type="SPOT") + fillLight = bpy.data.lights.new(name="Fill_Light", type="SPOT") ob = bpy.data.objects.new("Fill_Light", fillLight) constraint = ob.constraints.new(type='COPY_LOCATION') constraint.use_offset = True @@ -39,7 +39,7 @@ def add_lamps(self, context): ob.data.energy = 0.3 if self.bBackLight: - backLight = bpy.data.lamps.new(name="Back_Light", type="SPOT") + backLight = bpy.data.lights.new(name="Back_Light", type="SPOT") ob = bpy.data.objects.new("Back_Light", backLight) constraint = ob.constraints.new(type='COPY_LOCATION') constraint.use_offset = True @@ -121,7 +121,7 @@ class OBJECT_OT_add_light_template(Operator): self.target = context.active_object self.camera = context.scene.camera - add_lamps(self, context) + add_lights(self, context) except Exception as e: self.report({'WARNING'}, diff --git a/add_advanced_objects_menu/copy2.py b/add_advanced_objects_menu/copy2.py index 489f6dee..9a94ac1d 100644 --- a/add_advanced_objects_menu/copy2.py +++ b/add_advanced_objects_menu/copy2.py @@ -168,7 +168,7 @@ def copy_to_from(scene, to_obj, from_obj, copymode, axes, edgescale, scale): if copymode == 'E': # don't pass edgescalling to object types that cannot be scaled - if from_obj.type in ["CAMERA", "LAMP", "EMPTY", "ARMATURE", "SPEAKER", "META"]: + if from_obj.type in ["CAMERA", "LIGHT", "EMPTY", "ARMATURE", "SPEAKER", "META"]: edgescale = False edge_copy(scene, to_obj, from_obj, axes, edgescale, scale) diff --git a/add_advanced_objects_menu/mesh_easylattice.py b/add_advanced_objects_menu/mesh_easylattice.py index 9a43474c..78f3d020 100644 --- a/add_advanced_objects_menu/mesh_easylattice.py +++ b/add_advanced_objects_menu/mesh_easylattice.py @@ -63,7 +63,7 @@ def createLattice(context, obj, props): # the rotation comes from the combined obj world # matrix which was converted to euler pairs ob.rotation_euler = buildRot_World(obj) - ob.show_x_ray = True + ob.show_in_front = True # Link object to scene scn = context.scene diff --git a/add_advanced_objects_menu/rope_alpha.py b/add_advanced_objects_menu/rope_alpha.py index 904168a1..4ef23fc1 100644 --- a/add_advanced_objects_menu/rope_alpha.py +++ b/add_advanced_objects_menu/rope_alpha.py @@ -622,7 +622,7 @@ class BallRope(Operator): bpy.ops.rigidbody.objects_add(type='ACTIVE') bpy.context.object.name = "CubeLink" if n != 0: - bpy.context.object.draw_type = 'WIRE' + bpy.context.object.display_type = 'WIRE' bpy.context.object.hide_render = True n += 1 bpy.context.object.scale.z = (longitud * 2) / (segmentos * 2) - separation diff --git a/add_advanced_objects_menu/scene_objects_bi.py b/add_advanced_objects_menu/scene_objects_bi.py index f189bb11..94bda4bc 100644 --- a/add_advanced_objects_menu/scene_objects_bi.py +++ b/add_advanced_objects_menu/scene_objects_bi.py @@ -43,11 +43,11 @@ class add_BI_scene(Operator): ) cam = bpy.context.active_object.data cam.lens = 35 - cam.draw_size = 0.1 + cam.display_size = 0.1 bpy.ops.view3d.viewnumpad(type='CAMERA') # add point lamp - bpy.ops.object.lamp_add( + bpy.ops.object.light_add( type="POINT", location=(4.07625, 1.00545, 5.90386), rotation=(0.650328, 0.055217, 1.866391) ) @@ -59,7 +59,7 @@ class add_BI_scene(Operator): lamp1.use_sphere = True # add point lamp2 - bpy.ops.object.lamp_add( + bpy.ops.object.light_add( type="POINT", location=(-0.57101, -4.24586, 5.53674), rotation=(1.571, 0, 0.785) ) diff --git a/add_advanced_objects_menu/scene_objects_cycles.py b/add_advanced_objects_menu/scene_objects_cycles.py index 85e85867..7158b02f 100644 --- a/add_advanced_objects_menu/scene_objects_cycles.py +++ b/add_advanced_objects_menu/scene_objects_cycles.py @@ -43,11 +43,11 @@ class add_cycles_scene(Operator): ) cam = bpy.context.active_object.data cam.lens = 35 - cam.draw_size = 0.1 + cam.display_size = 0.1 bpy.ops.view3d.viewnumpad(type='CAMERA') # add point lamp - bpy.ops.object.lamp_add( + bpy.ops.object.light_add( type="POINT", location=(4.07625, 1.00545, 5.90386), rotation=(0.650328, 0.055217, 1.866391) ) @@ -59,7 +59,7 @@ class add_cycles_scene(Operator): lamp1.use_sphere = True # add point lamp2 - bpy.ops.object.lamp_add( + bpy.ops.object.light_add( type="POINT", location=(-0.57101, -4.24586, 5.53674), rotation=(1.571, 0, 0.785) ) diff --git a/add_advanced_objects_menu/scene_texture_render.py b/add_advanced_objects_menu/scene_texture_render.py index 02d6490b..0f9ccc2b 100644 --- a/add_advanced_objects_menu/scene_texture_render.py +++ b/add_advanced_objects_menu/scene_texture_render.py @@ -43,7 +43,7 @@ class add_texture_scene(Operator): ) cam = bpy.context.active_object.data cam.lens = 35 - cam.draw_size = 0.1 + cam.display_size = 0.1 # add plane bpy.ops.mesh.primitive_plane_add(enter_editmode=True, location=(0, 0, 0)) diff --git a/add_advanced_objects_menu/trilighting.py b/add_advanced_objects_menu/trilighting.py index e0068e66..c163a894 100644 --- a/add_advanced_objects_menu/trilighting.py +++ b/add_advanced_objects_menu/trilighting.py @@ -173,7 +173,7 @@ class TriLighting(Operator): backx = obj_position.x + self.distance * singleback_vector.x backy = obj_position.y + self.distance * singleback_vector.y - backData = bpy.data.lamps.new(name="TriLamp-Back", type=self.secondarytype) + backData = bpy.data.lights.new(name="TriLamp-Back", type=self.secondarytype) backData.energy = backEnergy backLamp = bpy.data.objects.new(name="TriLamp-Back", object_data=backData) @@ -196,7 +196,7 @@ class TriLighting(Operator): rightx = obj_position.x + self.distance * singleright_vector.x righty = obj_position.y + self.distance * singleright_vector.y - rightData = bpy.data.lamps.new(name="TriLamp-Fill", type=self.secondarytype) + rightData = bpy.data.lights.new(name="TriLamp-Fill", type=self.secondarytype) rightData.energy = fillEnergy rightLamp = bpy.data.objects.new(name="TriLamp-Fill", object_data=rightData) scene.objects.link(rightLamp) @@ -215,7 +215,7 @@ class TriLighting(Operator): leftx = obj_position.x + self.distance * singleleft_vector.x lefty = obj_position.y + self.distance * singleleft_vector.y - leftData = bpy.data.lamps.new(name="TriLamp-Key", type=self.primarytype) + leftData = bpy.data.lights.new(name="TriLamp-Key", type=self.primarytype) leftData.energy = keyEnergy leftLamp = bpy.data.objects.new(name="TriLamp-Key", object_data=leftData) diff --git a/add_advanced_objects_panels/object_laplace_lightning.py b/add_advanced_objects_panels/object_laplace_lightning.py index f33ed935..f653de53 100644 --- a/add_advanced_objects_panels/object_laplace_lightning.py +++ b/add_advanced_objects_panels/object_laplace_lightning.py @@ -1087,7 +1087,7 @@ def setupObjects(): bpy.context.scene.objects.link(oOB) gOB = bpy.data.objects.new('ELground', None) - gOB.empty_draw_type = 'ARROWS' + gOB.empty_display_type = 'ARROWS' bpy.context.scene.objects.link(gOB) cME = makeMeshCube(1) diff --git a/add_advanced_objects_panels/unfold_transition.py b/add_advanced_objects_panels/unfold_transition.py index 42d8c3ba..44051bf0 100644 --- a/add_advanced_objects_panels/unfold_transition.py +++ b/add_advanced_objects_panels/unfold_transition.py @@ -129,8 +129,8 @@ class Set_Up_Fold(Operator): scn.objects.link(rig) scn.objects.active = rig bpy.ops.object.mode_set(mode="EDIT") - arm.draw_type = "WIRE" - rig.show_x_ray = True + arm.display_type = "WIRE" + rig.show_in_front = True mod = obj.modifiers.new("UnFold", "ARMATURE") mod.show_in_editmode = True mod.object = rig diff --git a/add_curve_extra_objects/__init__.py b/add_curve_extra_objects/__init__.py index 42ae2d44..5c093af4 100644 --- a/add_curve_extra_objects/__init__.py +++ b/add_curve_extra_objects/__init__.py @@ -225,9 +225,9 @@ class CurveExtraObjectsAddonPreferences(AddonPreferences): icon="LAYER_USED") -class INFO_MT_curve_knots_add(Menu): +class VIEW3D_MT_curve_knots_add(Menu): # Define the "Extras" menu - bl_idname = "INFO_MT_curve_knots_add" + bl_idname = "VIEW3D_MT_curve_knots_add" bl_label = "Plants" def draw(self, context): @@ -253,7 +253,7 @@ def menu_func(self, context): icon='CURVE_DATA') layout.separator() - layout.menu(INFO_MT_curve_knots_add.bl_idname, text="Knots", icon='CURVE_DATA') + layout.menu(VIEW3D_MT_curve_knots_add.bl_idname, text="Knots", icon='CURVE_DATA') layout.separator() layout.operator("curve.curlycurve", text="Curly Curve", icon='CURVE_DATA') @@ -282,17 +282,17 @@ def register(): bpy.utils.register_module(__name__) # Add "Extras" menu to the "Add Curve" menu - bpy.types.INFO_MT_curve_add.append(menu_func) + bpy.types.VIEW3D_MT_curve_add.append(menu_func) # Add "Extras" menu to the "Add Surface" menu - bpy.types.INFO_MT_surface_add.append(menu_surface) + bpy.types.VIEW3D_MT_surface_add.append(menu_surface) def unregister(): add_curve_simple.unregister() # Remove "Extras" menu from the "Add Curve" menu. - bpy.types.INFO_MT_curve_add.remove(menu_func) + bpy.types.VIEW3D_MT_curve_add.remove(menu_func) # Remove "Extras" menu from the "Add Surface" menu. - bpy.types.INFO_MT_surface_add.remove(menu_surface) + bpy.types.VIEW3D_MT_surface_add.remove(menu_surface) bpy.utils.unregister_module(__name__) diff --git a/add_curve_extra_objects/add_curve_curly.py b/add_curve_extra_objects/add_curve_curly.py index 779689a9..d3950787 100644 --- a/add_curve_extra_objects/add_curve_curly.py +++ b/add_curve_extra_objects/add_curve_curly.py @@ -479,12 +479,12 @@ def add_curlycurve_button(self, context): def register(): bpy.utils.register_class(add_curlycurve) - bpy.types.INFO_MT_curve_add.append(add_curlycurve_button) + bpy.types.VIEW3D_MT_curve_add.append(add_curlycurve_button) def unregister(): bpy.utils.unregister_class(add_curlycurve) - bpy.types.INFO_MT_curve_add.remove(add_curlycurve_button) + bpy.types.VIEW3D_MT_curve_add.remove(add_curlycurve_button) if __name__ == "__main__": diff --git a/add_curve_extra_objects/add_curve_simple.py b/add_curve_extra_objects/add_curve_simple.py index c6908ce9..697e9d97 100644 --- a/add_curve_extra_objects/add_curve_simple.py +++ b/add_curve_extra_objects/add_curve_simple.py @@ -1645,8 +1645,8 @@ class SimpleVariables(PropertyGroup): ) -class INFO_MT_simple_menu(Menu): - bl_idname = "INFO_MT_simple_menu" +class VIEW3D_MT_simple_menu(Menu): + bl_idname = "VIEW3D_MT_simple_menu" bl_label = "2D Objects" def draw(self, context): @@ -1714,7 +1714,7 @@ class INFO_MT_simple_menu(Menu): def Simple_button(self, context): layout = self.layout layout.separator() - self.layout.menu("INFO_MT_simple_menu", icon="MOD_CURVE") + self.layout.menu("VIEW3D_MT_simple_menu", icon="MOD_CURVE") def register(): @@ -1723,10 +1723,10 @@ def register(): bpy.utils.register_class(BezierDivide) bpy.utils.register_class(SimplePanel) bpy.utils.register_class(SimpleEdit) - bpy.utils.register_class(INFO_MT_simple_menu) + bpy.utils.register_class(VIEW3D_MT_simple_menu) bpy.utils.register_class(SimpleVariables) - bpy.types.INFO_MT_curve_add.append(Simple_button) + bpy.types.VIEW3D_MT_curve_add.append(Simple_button) bpy.types.Object.s_curve = PointerProperty(type=SimpleVariables) @@ -1737,10 +1737,10 @@ def unregister(): bpy.utils.unregister_class(BezierDivide) bpy.utils.unregister_class(SimplePanel) bpy.utils.unregister_class(SimpleEdit) - bpy.utils.unregister_class(INFO_MT_simple_menu) + bpy.utils.unregister_class(VIEW3D_MT_simple_menu) bpy.utils.unregister_class(SimpleVariables) - bpy.types.INFO_MT_curve_add.remove(Simple_button) + bpy.types.VIEW3D_MT_curve_add.remove(Simple_button) del bpy.types.Object.s_curve diff --git a/add_curve_extra_objects/add_curve_spirofit_bouncespline.py b/add_curve_extra_objects/add_curve_spirofit_bouncespline.py index 382b2d6b..e80c6ee1 100644 --- a/add_curve_extra_objects/add_curve_spirofit_bouncespline.py +++ b/add_curve_extra_objects/add_curve_spirofit_bouncespline.py @@ -933,7 +933,7 @@ def add_curve_object( bpy.context.scene.objects.active = cur cur.select = True if x_ray is True: - cur.show_x_ray = x_ray + cur.show_in_front = x_ray return diff --git a/add_curve_sapling/__init__.py b/add_curve_sapling/__init__.py index 274c1fef..15cd7291 100644 --- a/add_curve_sapling/__init__.py +++ b/add_curve_sapling/__init__.py @@ -1126,13 +1126,13 @@ def menu_func(self, context): def register(): bpy.utils.register_module(__name__) - bpy.types.INFO_MT_curve_add.append(menu_func) + bpy.types.VIEW3D_MT_curve_add.append(menu_func) def unregister(): bpy.utils.unregister_module(__name__) - bpy.types.INFO_MT_curve_add.remove(menu_func) + bpy.types.VIEW3D_MT_curve_add.remove(menu_func) if __name__ == "__main__": diff --git a/add_curve_sapling/utils.py b/add_curve_sapling/utils.py index af23e434..00949a81 100644 --- a/add_curve_sapling/utils.py +++ b/add_curve_sapling/utils.py @@ -735,13 +735,13 @@ def create_armature(armAnim, leafP, cu, frameRate, leafMesh, leafObj, leafVertSi newAction = bpy.data.actions.new(name='windAction') armOb.animation_data_create() armOb.animation_data.action = newAction - arm.draw_type = 'STICK' + arm.display_type = 'STICK' arm.use_deform_delay = True # Add the armature modifier to the curve armMod = treeOb.modifiers.new('windSway', 'ARMATURE') if previewArm: armMod.show_viewport = False - arm.draw_type = 'WIRE' + arm.display_type = 'WIRE' treeOb.hide = True armMod.use_apply_on_spline = True armMod.object = armOb @@ -1996,7 +1996,7 @@ def addTree(props): armMod = treeObj.modifiers.new('windSway', 'ARMATURE') if previewArm: bpy.data.objects['treeArm'].hide = True - bpy.data.armatures['tree'].draw_type = 'STICK' + bpy.data.armatures['tree'].display_type = 'STICK' armMod.object = bpy.data.objects['treeArm'] armMod.use_bone_envelopes = False armMod.use_vertex_groups = True diff --git a/add_mesh_BoltFactory/__init__.py b/add_mesh_BoltFactory/__init__.py index 46d250de..d441a0e8 100644 --- a/add_mesh_BoltFactory/__init__.py +++ b/add_mesh_BoltFactory/__init__.py @@ -49,14 +49,14 @@ def add_mesh_bolt_button(self, context): def register(): bpy.utils.register_module(__name__) - bpy.types.INFO_MT_mesh_add.append(add_mesh_bolt_button) + bpy.types.VIEW3D_MT_mesh_add.append(add_mesh_bolt_button) # bpy.types.VIEW3D_PT_tools_objectmode.prepend(add_mesh_bolt_button) # just for testing def unregister(): bpy.utils.unregister_module(__name__) - bpy.types.INFO_MT_mesh_add.remove(add_mesh_bolt_button) + bpy.types.VIEW3D_MT_mesh_add.remove(add_mesh_bolt_button) # bpy.types.VIEW3D_PT_tools_objectmode.remove(add_mesh_bolt_button) # just for testing diff --git a/add_mesh_extra_objects/__init__.py b/add_mesh_extra_objects/__init__.py index ecc023df..1197738c 100644 --- a/add_mesh_extra_objects/__init__.py +++ b/add_mesh_extra_objects/__init__.py @@ -107,9 +107,9 @@ from bpy.props import ( ) -class INFO_MT_mesh_vert_add(Menu): +class VIEW3D_MT_mesh_vert_add(Menu): # Define the "Single Vert" menu - bl_idname = "INFO_MT_mesh_vert_add" + bl_idname = "VIEW3D_MT_mesh_vert_add" bl_label = "Single Vert" def draw(self, context): @@ -126,9 +126,9 @@ class INFO_MT_mesh_vert_add(Menu): text="Object Origin Mirrored") -class INFO_MT_mesh_gears_add(Menu): +class VIEW3D_MT_mesh_gears_add(Menu): # Define the "Gears" menu - bl_idname = "INFO_MT_mesh_gears_add" + bl_idname = "VIEW3D_MT_mesh_gears_add" bl_label = "Gears" def draw(self, context): @@ -140,9 +140,9 @@ class INFO_MT_mesh_gears_add(Menu): text="Worm") -class INFO_MT_mesh_diamonds_add(Menu): +class VIEW3D_MT_mesh_diamonds_add(Menu): # Define the "Diamonds" menu - bl_idname = "INFO_MT_mesh_diamonds_add" + bl_idname = "VIEW3D_MT_mesh_diamonds_add" bl_label = "Diamonds" def draw(self, context): @@ -156,9 +156,9 @@ class INFO_MT_mesh_diamonds_add(Menu): text="Gem") -class INFO_MT_mesh_math_add(Menu): +class VIEW3D_MT_mesh_math_add(Menu): # Define the "Math Function" menu - bl_idname = "INFO_MT_mesh_math_add" + bl_idname = "VIEW3D_MT_mesh_math_add" bl_label = "Math Functions" def draw(self, context): @@ -172,29 +172,29 @@ class INFO_MT_mesh_math_add(Menu): self.layout.operator("mesh.make_triangle", icon="MESH_DATA") -class INFO_MT_mesh_mech(Menu): +class VIEW3D_MT_mesh_mech(Menu): # Define the "Math Function" menu - bl_idname = "INFO_MT_mesh_mech_add" + bl_idname = "VIEW3D_MT_mesh_mech_add" bl_label = "Mechanical" def draw(self, context): layout = self.layout layout.operator_context = 'INVOKE_REGION_WIN' - layout.menu("INFO_MT_mesh_pipe_joints_add", + layout.menu("VIEW3D_MT_mesh_pipe_joints_add", text="Pipe Joints", icon="SNAP_PEEL_OBJECT") - layout.menu("INFO_MT_mesh_gears_add", + layout.menu("VIEW3D_MT_mesh_gears_add", text="Gears", icon="SCRIPTWIN") -class INFO_MT_mesh_extras_add(Menu): +class VIEW3D_MT_mesh_extras_add(Menu): # Define the "Extra Objects" menu - bl_idname = "INFO_MT_mesh_extras_add" + bl_idname = "VIEW3D_MT_mesh_extras_add" bl_label = "Extras" def draw(self, context): layout = self.layout layout.operator_context = 'INVOKE_REGION_WIN' - layout.menu("INFO_MT_mesh_diamonds_add", text="Diamonds", + layout.menu("VIEW3D_MT_mesh_diamonds_add", text="Diamonds", icon="PMARKER_SEL") layout.separator() layout.operator("mesh.add_beam", @@ -214,9 +214,9 @@ class INFO_MT_mesh_extras_add(Menu): text="Menger Sponge") -class INFO_MT_mesh_torus_add(Menu): +class VIEW3D_MT_mesh_torus_add(Menu): # Define the "Torus Objects" menu - bl_idname = "INFO_MT_mesh_torus_add" + bl_idname = "VIEW3D_MT_mesh_torus_add" bl_label = "Torus Objects" def draw(self, context): @@ -230,9 +230,9 @@ class INFO_MT_mesh_torus_add(Menu): text="Torus Knot") -class INFO_MT_mesh_pipe_joints_add(Menu): +class VIEW3D_MT_mesh_pipe_joints_add(Menu): # Define the "Pipe Joints" menu - bl_idname = "INFO_MT_mesh_pipe_joints_add" + bl_idname = "VIEW3D_MT_mesh_pipe_joints_add" bl_label = "Pipe Joints" def draw(self, context): @@ -355,15 +355,15 @@ def menu_func(self, context): lay_out.operator_context = 'INVOKE_REGION_WIN' lay_out.separator() - lay_out.menu("INFO_MT_mesh_vert_add", + lay_out.menu("VIEW3D_MT_mesh_vert_add", text="Single Vert", icon="LAYER_ACTIVE") lay_out.operator("mesh.primitive_round_cube_add", text="Round Cube", icon="MOD_SUBSURF") - lay_out.menu("INFO_MT_mesh_math_add", + lay_out.menu("VIEW3D_MT_mesh_math_add", text="Math Function", icon="PACKAGE") - lay_out.menu("INFO_MT_mesh_mech_add", + lay_out.menu("VIEW3D_MT_mesh_mech_add", text="Mechanical", icon="SCRIPTWIN") - lay_out.menu("INFO_MT_mesh_torus_add", + lay_out.menu("VIEW3D_MT_mesh_torus_add", text="Torus Objects", icon="MESH_TORUS") lay_out.separator() lay_out.operator("mesh.generate_geodesic_dome", @@ -371,7 +371,7 @@ def menu_func(self, context): lay_out.operator("discombobulate.ops", text="Discombobulator", icon="RETOPO") lay_out.separator() - lay_out.menu("INFO_MT_mesh_extras_add", + lay_out.menu("VIEW3D_MT_mesh_extras_add", text="Extras", icon="MESH_DATA") lay_out.separator() lay_out.operator("object.parent_to_empty", @@ -402,12 +402,12 @@ def register(): ) # Add "Extras" menu to the "Add Mesh" menu - bpy.types.INFO_MT_mesh_add.append(menu_func) + bpy.types.VIEW3D_MT_mesh_add.append(menu_func) def unregister(): # Remove "Extras" menu from the "Add Mesh" menu. - bpy.types.INFO_MT_mesh_add.remove(menu_func) + bpy.types.VIEW3D_MT_mesh_add.remove(menu_func) del bpy.types.Scene.discomb del bpy.types.Scene.error_message diff --git a/add_mesh_extra_objects/add_empty_as_parent.py b/add_mesh_extra_objects/add_empty_as_parent.py index bcaecf64..32d0d167 100644 --- a/add_mesh_extra_objects/add_empty_as_parent.py +++ b/add_mesh_extra_objects/add_empty_as_parent.py @@ -78,7 +78,7 @@ class P2E(Operator): bpy.ops.object.add(type='EMPTY', location=loc) context.object.name = self.nombre context.object.show_name = True - context.object.show_x_ray = True + context.object.show_in_front = True if self.grupo: bpy.ops.group.create(name=self.nombre) diff --git a/ant_landscape/__init__.py b/ant_landscape/__init__.py index ba6e8b6f..448993d0 100644 --- a/ant_landscape/__init__.py +++ b/ant_landscape/__init__.py @@ -938,14 +938,14 @@ class AntLandscapePropertiesGroup(bpy.types.PropertyGroup): def register(): bpy.utils.register_module(__name__) - bpy.types.INFO_MT_mesh_add.append(menu_func_landscape) + bpy.types.VIEW3D_MT_mesh_add.append(menu_func_landscape) bpy.types.Object.ant_landscape = PointerProperty(type=AntLandscapePropertiesGroup, name="ANT_Landscape", description="Landscape properties") bpy.types.VIEW3D_MT_paint_weight.append(menu_func_eroder) def unregister(): bpy.utils.unregister_module(__name__) - bpy.types.INFO_MT_mesh_add.remove(menu_func_landscape) + bpy.types.VIEW3D_MT_mesh_add.remove(menu_func_landscape) bpy.types.VIEW3D_MT_paint_weight.remove(menu_func_eroder) diff --git a/archimesh/__init__.py b/archimesh/__init__.py index cb22e157..07049ff2 100644 --- a/archimesh/__init__.py +++ b/archimesh/__init__.py @@ -53,7 +53,7 @@ if "bpy" in locals(): importlib.reload(achm_kitchen_maker) importlib.reload(achm_shelves_maker) importlib.reload(achm_books_maker) - importlib.reload(achm_lamp_maker) + importlib.reload(achm_light_maker) importlib.reload(achm_curtain_maker) importlib.reload(achm_venetian_maker) importlib.reload(achm_main_panel) @@ -66,7 +66,7 @@ else: from . import achm_venetian_maker from . import achm_door_maker from . import achm_kitchen_maker - from . import achm_lamp_maker + from . import achm_light_maker from . import achm_main_panel from . import achm_roof_maker from . import achm_room_maker @@ -92,7 +92,7 @@ from bpy.types import ( AddonPreferences, Menu, Scene, - INFO_MT_mesh_add, + VIEW3D_MT_mesh_add, WindowManager, ) @@ -102,13 +102,13 @@ from bpy.types import ( class AchmInfoMtMeshDecorationAdd(Menu): - bl_idname = "INFO_MT_mesh_decoration_add" + bl_idname = "VIEW3D_MT_mesh_decoration_add" bl_label = "Decoration assets" # noinspection PyUnusedLocal def draw(self, context): self.layout.operator("mesh.archimesh_books", text="Add Books") - self.layout.operator("mesh.archimesh_lamp", text="Add Lamp") + self.layout.operator("mesh.archimesh_light", text="Add Lamp") self.layout.operator("mesh.archimesh_roller", text="Add Roller curtains") self.layout.operator("mesh.archimesh_venetian", text="Add Venetian blind") self.layout.operator("mesh.archimesh_japan", text="Add Japanese curtains") @@ -119,7 +119,7 @@ class AchmInfoMtMeshDecorationAdd(Menu): class AchmInfoMtMeshCustomMenuAdd(Menu): - bl_idname = "INFO_MT_mesh_custom_menu_add" + bl_idname = "VIEW3D_MT_mesh_custom_menu_add" bl_label = "Archimesh" # noinspection PyUnusedLocal @@ -134,7 +134,7 @@ class AchmInfoMtMeshCustomMenuAdd(Menu): self.layout.operator("mesh.archimesh_column", text="Add Column") self.layout.operator("mesh.archimesh_stairs", text="Add Stairs") self.layout.operator("mesh.archimesh_roof", text="Add Roof") - self.layout.menu("INFO_MT_mesh_decoration_add", text="Decoration props", icon="GROUP") + self.layout.menu("VIEW3D_MT_mesh_decoration_add", text="Decoration props", icon="GROUP") # -------------------------------------------------------------- # Register all operators and panels @@ -189,7 +189,7 @@ class Archi_Pref(AddonPreferences): # Define menu # noinspection PyUnusedLocal def AchmMenu_func(self, context): - self.layout.menu("INFO_MT_mesh_custom_menu_add", icon="GROUP") + self.layout.menu("VIEW3D_MT_mesh_custom_menu_add", icon="GROUP") def register(): @@ -210,7 +210,7 @@ def register(): bpy.utils.register_class(achm_kitchen_maker.AchmExportInventory) bpy.utils.register_class(achm_shelves_maker.AchmShelves) bpy.utils.register_class(achm_books_maker.AchmBooks) - bpy.utils.register_class(achm_lamp_maker.AchmLamp) + bpy.utils.register_class(achm_light_maker.AchmLamp) bpy.utils.register_class(achm_curtain_maker.AchmRoller) bpy.utils.register_class(achm_curtain_maker.AchmJapan) bpy.utils.register_class(achm_venetian_maker.AchmVenetian) @@ -222,7 +222,7 @@ def register(): bpy.utils.register_class(achm_window_panel.AchmWinPanel) bpy.utils.register_class(achm_window_panel.AchmWindowEditPanel) bpy.utils.register_class(Archi_Pref) - INFO_MT_mesh_add.append(AchmMenu_func) + VIEW3D_MT_mesh_add.append(AchmMenu_func) update_panel(None, bpy.context) # Define properties Scene.archimesh_select_only = BoolProperty( @@ -321,7 +321,7 @@ def unregister(): bpy.utils.unregister_class(achm_kitchen_maker.AchmExportInventory) bpy.utils.unregister_class(achm_shelves_maker.AchmShelves) bpy.utils.unregister_class(achm_books_maker.AchmBooks) - bpy.utils.unregister_class(achm_lamp_maker.AchmLamp) + bpy.utils.unregister_class(achm_light_maker.AchmLamp) bpy.utils.unregister_class(achm_curtain_maker.AchmRoller) bpy.utils.unregister_class(achm_curtain_maker.AchmJapan) bpy.utils.unregister_class(achm_venetian_maker.AchmVenetian) @@ -333,7 +333,7 @@ def unregister(): bpy.utils.unregister_class(achm_window_panel.AchmWinPanel) bpy.utils.unregister_class(achm_window_panel.AchmWindowEditPanel) bpy.utils.unregister_class(Archi_Pref) - INFO_MT_mesh_add.remove(AchmMenu_func) + VIEW3D_MT_mesh_add.remove(AchmMenu_func) # Remove properties del Scene.archimesh_select_only diff --git a/archimesh/achm_door_maker.py b/archimesh/achm_door_maker.py index 6d048bfd..4ef99373 100644 --- a/archimesh/achm_door_maker.py +++ b/archimesh/achm_door_maker.py @@ -233,7 +233,7 @@ def shape_children(mainobject, update=False): myctrl.location.x = 0 myctrl.location.y = -((mp.frame_thick * 3) / 2) myctrl.location.z = -gap - myctrl.draw_type = 'BOUNDS' + myctrl.display_type = 'BOUNDS' myctrl.hide = False myctrl.hide_render = True if bpy.context.scene.render.engine == 'CYCLES': @@ -256,7 +256,7 @@ def shape_children(mainobject, update=False): myctrlbase.location.x = 0 myctrlbase.location.y = -0.15 - (mp.frame_thick / 3) myctrlbase.location.z = -0.10 - myctrlbase.draw_type = 'BOUNDS' + myctrlbase.display_type = 'BOUNDS' myctrlbase.hide = False myctrlbase.hide_render = True if bpy.context.scene.render.engine == 'CYCLES': diff --git a/archimesh/achm_lamp_maker.py b/archimesh/achm_lamp_maker.py index a6b15435..67fbfc1e 100644 --- a/archimesh/achm_lamp_maker.py +++ b/archimesh/achm_lamp_maker.py @@ -130,7 +130,7 @@ def set_preset(self): # Lamps # ------------------------------------------------------------------ class AchmLamp(Operator): - bl_idname = "mesh.archimesh_lamp" + bl_idname = "mesh.archimesh_light" bl_label = "Lamp" bl_description = "Lamp Generator" bl_category = 'Archimesh' @@ -375,7 +375,7 @@ class AchmLamp(Operator): self.oldpreset = self.preset # Create lamp - create_lamp_mesh(self) + create_light_mesh(self) return {'FINISHED'} else: self.report({'WARNING'}, "Archimesh: Option only valid in Object mode") @@ -386,13 +386,13 @@ class AchmLamp(Operator): # Generate mesh data # All custom values are passed using self container (self.myvariable) # ------------------------------------------------------------------------------ -def create_lamp_mesh(self): +def create_light_mesh(self): # deactivate others for o in bpy.data.objects: if o.select is True: o.select = False bpy.ops.object.select_all(False) - generate_lamp(self) + generate_light(self) return @@ -401,13 +401,13 @@ def create_lamp_mesh(self): # Generate lamps # All custom values are passed using self container (self.myvariable) # ------------------------------------------------------------------------------ -def generate_lamp(self): +def generate_light(self): location = bpy.context.scene.cursor_location myloc = copy(location) # copy location to keep 3D cursor position # --------------------- # Lamp base # --------------------- - mydata = create_lamp_base("Lamp_base", self.base_height, + mydata = create_light_base("Lamp_base", self.base_height, myloc.x, myloc.y, myloc.z, self.base_segments, self.base_rings, [self.br01, self.br02, self.br03, self.br04, self.br05, self.br06, @@ -429,7 +429,7 @@ def generate_lamp(self): # --------------------- # Lampholder # --------------------- - myholder = create_lampholder("Lampholder", self.holder, + myholder = create_lightholder("Lampholder", self.holder, myloc.x, myloc.y, myloc.z, self.crt_mat) # refine @@ -444,7 +444,7 @@ def generate_lamp(self): # --------------------- # Lamp strings # --------------------- - mystrings = create_lampholder_strings("Lampstrings", self.holder, + mystrings = create_lightholder_strings("Lampstrings", self.holder, myloc.x, myloc.y, myloc.z, self.tr02, self.top_height, @@ -460,7 +460,7 @@ def generate_lamp(self): # --------------------- # Lampshade # --------------------- - mytop = create_lampshade("Lampshade", self.top_height, + mytop = create_lightshade("Lampshade", self.top_height, myloc.x, myloc.y, myloc.z, self.top_segments, self.tr01, self.tr02, @@ -517,7 +517,7 @@ def generate_lamp(self): # mat: Flag for creating materials # objcol: Color # ------------------------------------------------------------------------------ -def create_lamp_base(objname, height, px, py, pz, segments, rings, radios, ratios, subdivide, mat, objcol): +def create_light_base(objname, height, px, py, pz, segments, rings, radios, ratios, subdivide, mat, objcol): # Calculate heights h = height / (rings - 1) listheight = [] @@ -562,7 +562,7 @@ def create_lamp_base(objname, height, px, py, pz, segments, rings, radios, ratio # pZ: position Z axis # mat: Flag for creating materials # ------------------------------------------------------------------------------ -def create_lampholder(objname, height, px, py, pz, mat): +def create_lightholder(objname, height, px, py, pz, mat): mydata = create_cylinder_data(16, [0, height, height + 0.005, height + 0.008, height + 0.05], [0.005, 0.005, 0.010, 0.018, 0.018], False, False, False, 0, False) @@ -600,7 +600,7 @@ def create_lampholder(objname, height, px, py, pz, mat): # shadeh: height of lampshader # mat: Flag for creating materials # ------------------------------------------------------------------------------ -def create_lampholder_strings(objname, height, px, py, pz, radio, shadeh, mat): +def create_lightholder_strings(objname, height, px, py, pz, radio, shadeh, mat): mydata = create_cylinder_data(32, [height + 0.005, height + 0.005, height + 0.006, height + 0.006], [0.018, 0.025, 0.025, 0.018], False, False, False, 0, False) @@ -652,7 +652,7 @@ def create_lampholder_strings(objname, height, px, py, pz, radio, shadeh, mat): # opacity: opacity factor # mat: Flag for creating materials # ------------------------------------------------------------------------------ -def create_lampshade(objname, height, px, py, pz, segments, radio1, radio2, pleats, pleatsize, opacity, mat): +def create_lightshade(objname, height, px, py, pz, segments, radio1, radio2, pleats, pleatsize, opacity, mat): gap = 0.002 radios = [radio1 - gap, radio1 - gap, radio1, radio2, radio2 - gap, radio2 - gap] heights = [gap * 2, 0, 0, height, height, height - (gap * 2)] diff --git a/archimesh/achm_main_panel.py b/archimesh/achm_main_panel.py index d12c2a6b..e69a048f 100644 --- a/archimesh/achm_main_panel.py +++ b/archimesh/achm_main_panel.py @@ -462,10 +462,10 @@ class ArchimeshMainPanel(Panel): # Prop Buttons # ------------------------------ box = layout.box() - box.label("Props", icon='LAMP_DATA') + box.label("Props", icon='LIGHT_DATA') row = box.row() row.operator("mesh.archimesh_books") - row.operator("mesh.archimesh_lamp") + row.operator("mesh.archimesh_light") row = box.row() row.operator("mesh.archimesh_venetian") row.operator("mesh.archimesh_roller") diff --git a/archimesh/achm_window_maker.py b/archimesh/achm_window_maker.py index 5095f47e..dd12b4b4 100644 --- a/archimesh/achm_window_maker.py +++ b/archimesh/achm_window_maker.py @@ -216,7 +216,7 @@ def shape_mesh_and_create_children(mainobject, tmp_mesh, update=False): myctrl.location.x = 0 myctrl.location.y = -mp.depth * 3 / 2 myctrl.location.z = 0 - myctrl.draw_type = 'BOUNDS' + myctrl.display_type = 'BOUNDS' myctrl.hide = False myctrl.hide_render = True if bpy.context.scene.render.engine == 'CYCLES': diff --git a/archimesh/achm_window_panel.py b/archimesh/achm_window_panel.py index 592e13a6..859f8f9a 100644 --- a/archimesh/achm_window_panel.py +++ b/archimesh/achm_window_panel.py @@ -394,7 +394,7 @@ def do_ctrl_box(myobject): myctrl.location.x = 0 myctrl.location.y = 0 myctrl.location.z = 0 - myctrl.draw_type = 'WIRE' + myctrl.display_type = 'WIRE' myctrl.hide = False myctrl.hide_render = True if bpy.context.scene.render.engine == 'CYCLES': diff --git a/archipack/__init__.py b/archipack/__init__.py index 0f5d3a86..8b87585b 100644 --- a/archipack/__init__.py +++ b/archipack/__init__.py @@ -504,12 +504,12 @@ def register(): bpy.utils.register_class(Archipack_Pref) update_panel(None, bpy.context) bpy.utils.register_class(ARCHIPACK_MT_create) - bpy.types.INFO_MT_mesh_add.append(menu_func) + bpy.types.VIEW3D_MT_mesh_add.append(menu_func) def unregister(): global icons_collection - bpy.types.INFO_MT_mesh_add.remove(menu_func) + bpy.types.VIEW3D_MT_mesh_add.remove(menu_func) bpy.utils.unregister_class(ARCHIPACK_MT_create) bpy.utils.unregister_class(TOOLS_PT_Archipack_Tools) diff --git a/archipack/archipack_autoboolean.py b/archipack/archipack_autoboolean.py index 93e9bc98..43a677b4 100644 --- a/archipack/archipack_autoboolean.py +++ b/archipack/archipack_autoboolean.py @@ -105,7 +105,7 @@ class ArchipackBoolManager(): hole.lock_location = (True, True, True) hole.lock_rotation = (True, True, True) hole.lock_scale = (True, True, True) - hole.draw_type = 'WIRE' + hole.display_type = 'WIRE' hole.hide_render = True hole.hide_select = True hole.select = True diff --git a/archipack/archipack_floor.py b/archipack/archipack_floor.py index 8664b637..a367470e 100644 --- a/archipack/archipack_floor.py +++ b/archipack/archipack_floor.py @@ -337,7 +337,7 @@ class FloorGenerator(CutAblePolygon, CutAbleGenerator): segments=1, # d.bevel_res profile=0.5, vertex_only=False, - clamp_overlap=False, + clight_overlap=False, material=-1) bm.to_mesh(o.data) diff --git a/archipack/archipack_gl.py b/archipack/archipack_gl.py index c50c61a2..e8182fed 100644 --- a/archipack/archipack_gl.py +++ b/archipack/archipack_gl.py @@ -849,8 +849,7 @@ class Screen(): y_max = h - self.margin x_min = self.margin x_max = w - self.margin - if (system.use_region_overlap and - system.window_draw_method in {'TRIPLE_BUFFER', 'AUTOMATIC'}): + if system.use_region_overlap: area = context.area for r in area.regions: diff --git a/archipack/archipack_roof.py b/archipack/archipack_roof.py index aba6f12e..d848d170 100644 --- a/archipack/archipack_roof.py +++ b/archipack/archipack_roof.py @@ -1868,7 +1868,7 @@ class RoofGenerator(CutAbleGenerator): segments=d.tile_bevel_segs, profile=0.5, vertex_only=False, - clamp_overlap=True, + clight_overlap=True, material=-1) if d.tile_solidify: diff --git a/archipack/archipack_thumbs.py b/archipack/archipack_thumbs.py index 8f652ab2..bfc9d55e 100644 --- a/archipack/archipack_thumbs.py +++ b/archipack/archipack_thumbs.py @@ -111,7 +111,7 @@ def generateThumb(context, cls, preset): p.data.materials.append(m) # add 3 lights - bpy.ops.object.lamp_add( + bpy.ops.object.light_add( type='POINT', radius=1, view_align=False, @@ -123,7 +123,7 @@ def generateThumb(context, cls, preset): emit = nodes["Emission"] emit.inputs[1].default_value = 2000.0 - bpy.ops.object.lamp_add( + bpy.ops.object.light_add( type='POINT', radius=1, view_align=False, @@ -137,7 +137,7 @@ def generateThumb(context, cls, preset): falloff.inputs[0].default_value = 5 tree.links.new(falloff.outputs[2], emit.inputs[1]) - bpy.ops.object.lamp_add( + bpy.ops.object.light_add( type='POINT', radius=1, view_align=False, diff --git a/archipack/archipack_wall2.py b/archipack/archipack_wall2.py index 92172eb1..551e87f6 100644 --- a/archipack/archipack_wall2.py +++ b/archipack/archipack_wall2.py @@ -1672,7 +1672,7 @@ class ARCHIPACK_OT_wall2_throttle_update(Operator): m = o.modifiers.get("AutoBoolean") if m is not None: o.hide = False - # o.draw_type = 'TEXTURED' + # o.display_type = 'TEXTURED' # m.show_viewport = True return self.cancel(context) diff --git a/archipack/archipack_window.py b/archipack/archipack_window.py index 3524fbbf..167a27fc 100644 --- a/archipack/archipack_window.py +++ b/archipack/archipack_window.py @@ -993,7 +993,7 @@ class archipack_window(ArchipackObject, Manipulable, PropertyGroup): def find_portal(self, o): for child in o.children: - if child.type == 'LAMP': + if child.type == 'LIGHT': return child return None @@ -1002,7 +1002,7 @@ class archipack_window(ArchipackObject, Manipulable, PropertyGroup): lamp = self.find_portal(o) if self.portal: if lamp is None: - bpy.ops.object.lamp_add(type='AREA') + bpy.ops.object.light_add(type='AREA') lamp = context.active_object lamp.name = "Portal" lamp.parent = o @@ -1025,7 +1025,7 @@ class archipack_window(ArchipackObject, Manipulable, PropertyGroup): d = lamp.data context.scene.objects.unlink(lamp) bpy.data.objects.remove(lamp) - bpy.data.lamps.remove(d) + bpy.data.lights.remove(d) context.scene.objects.active = o @@ -1658,7 +1658,7 @@ class ARCHIPACK_PT_window(Panel): box.prop(prop, 'hole_inside_mat') box.prop(prop, 'hole_outside_mat') - layout.prop(prop, 'portal', icon="LAMP_AREA") + layout.prop(prop, 'portal', icon="LIGHT_AREA") class ARCHIPACK_PT_window_panel(Panel): @@ -1751,11 +1751,11 @@ class ARCHIPACK_OT_window(ArchipackCreateTool, Operator): if archipack_window.filter(o): bpy.ops.archipack.disable_manipulate() for child in o.children: - if child.type == 'LAMP': + if child.type == 'LIGHT': d = child.data context.scene.objects.unlink(child) bpy.data.objects.remove(child) - bpy.data.lamps.remove(d) + bpy.data.lights.remove(d) elif 'archipack_hole' in child: context.scene.objects.unlink(child) bpy.data.objects.remove(child, do_unlink=True) diff --git a/archipack/bmesh_utils.py b/archipack/bmesh_utils.py index 3f402d1d..1157d9a3 100644 --- a/archipack/bmesh_utils.py +++ b/archipack/bmesh_utils.py @@ -216,7 +216,7 @@ class BmeshEdit(): segments=1, profile=0.5, vertex_only=False, - clamp_overlap=True, + clight_overlap=True, material=-1, use_selection=True): """ @@ -245,7 +245,7 @@ class BmeshEdit(): segments=segments, profile=profile, vertex_only=vertex_only, - clamp_overlap=clamp_overlap, + clight_overlap=clight_overlap, material=material) bm.to_mesh(o.data) diff --git a/blender_id/CHANGELOG.md b/blender_id/CHANGELOG.md index cf62a6e1..94b21376 100644 --- a/blender_id/CHANGELOG.md +++ b/blender_id/CHANGELOG.md @@ -1,5 +1,17 @@ # Blender ID Add-on Changelog +# Version 2.0 (in development) + +- Require Blender 2.80+. +- API change: `blender_id.get_subclient_user_id()` now returns `''` instead of `None` when the user + is not logged in. + + +# Version 1.5 (released 2018-07-03) + +- Support Blender 2.80. + + ## Version 1.4.1 (released 2017-12-15) - Improved error reporting when validating a token fails due to diff --git a/blender_id/README.md b/blender_id/README.md index 936e6e3e..8f73fbc7 100644 --- a/blender_id/README.md +++ b/blender_id/README.md @@ -13,6 +13,9 @@ Blender ID add-on version 1.2.0 removed some workarounds necessary for Blender 2.77a. As such, versions 1.1.x are the last versions compatible with Blender 2.77a, and 1.2.0 and newer require at least Blender 2.78. +Blender ID add-on version 2.0 is the first to support and require Blender 2.80+. + + Building & Bundling ------------------- diff --git a/blender_id/__init__.py b/blender_id/__init__.py index 73371945..e5d94715 100644 --- a/blender_id/__init__.py +++ b/blender_id/__init__.py @@ -14,15 +14,17 @@ # along with this program; if not, write to the Free Software Foundation, # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # +# Copyright (C) 2014-2018 Blender Foundation +# # ##### END GPL LICENSE BLOCK ##### # <pep8 compliant> bl_info = { 'name': 'Blender ID authentication', - 'author': 'Francesco Siddi, Inês Almeida and Sybren A. Stüvel', - 'version': (1, 4, 1), - 'blender': (2, 77, 0), + 'author': 'Sybren A. Stüvel, Francesco Siddi, and Inês Almeida', + 'version': (1, 9, 9), + 'blender': (2, 80, 0), 'location': 'Add-on preferences', 'description': 'Stores your Blender ID credentials for usage with other add-ons', @@ -117,11 +119,11 @@ def get_subclient_user_id(subclient_id: str) -> str: Requires that the user has been authenticated at the subclient using a call to create_subclient_token(...) - :returns: the subclient-local user ID, or None if not logged in. + :returns: the subclient-local user ID, or the empty string if not logged in. """ if not BlenderIdProfile.user_id: - return None + return '' return BlenderIdProfile.subclients[subclient_id]['subclient_user_id'] @@ -159,9 +161,9 @@ def token_expires() -> typing.Optional[datetime.datetime]: # Try parsing as different formats. A new Blender ID is coming, # which may change the format in which timestamps are sent. formats = [ - '%Y-%m-%dT%H:%M:%SZ', # ISO 8601 with Z-suffix - '%Y-%m-%dT%H:%M:%S.%fZ', # ISO 8601 with fractional seconds and Z-suffix - '%a, %d %b %Y %H:%M:%S GMT', # RFC 1123, used by old Blender ID + '%Y-%m-%dT%H:%M:%SZ', # ISO 8601 with Z-suffix + '%Y-%m-%dT%H:%M:%S.%fZ', # ISO 8601 with fractional seconds and Z-suffix + '%a, %d %b %Y %H:%M:%S GMT', # RFC 1123, used by old Blender ID ] for fmt in formats: try: @@ -177,22 +179,22 @@ def token_expires() -> typing.Optional[datetime.datetime]: class BlenderIdPreferences(AddonPreferences): bl_idname = __name__ - error_message = StringProperty( + error_message: StringProperty( name='Error Message', default='', options={'HIDDEN', 'SKIP_SAVE'} ) - ok_message = StringProperty( + ok_message: StringProperty( name='Message', default='', options={'HIDDEN', 'SKIP_SAVE'} ) - blender_id_username = StringProperty( + blender_id_username: StringProperty( name='E-mail address', default='', options={'HIDDEN', 'SKIP_SAVE'} ) - blender_id_password = StringProperty( + blender_id_password: StringProperty( name='Password', default='', options={'HIDDEN', 'SKIP_SAVE'}, @@ -209,10 +211,10 @@ class BlenderIdPreferences(AddonPreferences): if self.error_message: sub = layout.row() sub.alert = True # labels don't display in red :( - sub.label(self.error_message, icon='ERROR') + sub.label(text=self.error_message, icon='ERROR') if self.ok_message: sub = layout.row() - sub.label(self.ok_message, icon='FILE_TICK') + sub.label(text=self.ok_message, icon='FILE_TICK') active_profile = get_active_profile() if active_profile: @@ -238,15 +240,17 @@ class BlenderIdPreferences(AddonPreferences): exp_str = 'within seconds' if time_left.days < 14: - layout.label('You are logged in as %s.' % active_profile.username, + layout.label(text='You are logged in as %s.' % active_profile.username, icon='WORLD_DATA') layout.label(text='Your token will expire %s. Please log out and log in again ' - 'to refresh it.' % exp_str, icon='PREVIEW_RANGE') + 'to refresh it.' % exp_str, icon='PREVIEW_RANGE') else: - layout.label('You are logged in as %s. Your authentication token expires %s.' - % (active_profile.username, exp_str), icon='WORLD_DATA') + layout.label( + text='You are logged in as %s. Your authentication token expires %s.' + % (active_profile.username, exp_str), + icon='WORLD_DATA') - row = layout.row().split(0.8) + row = layout.row().split(factor=0.8) row.operator('blender_id.logout') row.operator('blender_id.validate') else: @@ -343,14 +347,20 @@ def register(): profiles.register() BlenderIdProfile.read_json() - bpy.utils.register_module(__name__) + bpy.utils.register_class(BlenderIdLogin) + bpy.utils.register_class(BlenderIdLogout) + bpy.utils.register_class(BlenderIdPreferences) + bpy.utils.register_class(BlenderIdValidate) preferences = bpy.context.user_preferences.addons[__name__].preferences preferences.reset_messages() def unregister(): - bpy.utils.unregister_module(__name__) + bpy.utils.unregister_class(BlenderIdLogin) + bpy.utils.unregister_class(BlenderIdLogout) + bpy.utils.unregister_class(BlenderIdPreferences) + bpy.utils.unregister_class(BlenderIdValidate) if __name__ == '__main__': diff --git a/bone_selection_sets.py b/bone_selection_sets.py index 686eb808..fcc4b70c 100644 --- a/bone_selection_sets.py +++ b/bone_selection_sets.py @@ -20,7 +20,7 @@ bl_info = { "name": "Bone Selection Sets", "author": "Inês Almeida, Sybren A. Stüvel, Antony Riakiotakis, Dan Eicher", "version": (2, 1, 1), - "blender": (2, 75, 0), + "blender": (2, 80, 0), "location": "Properties > Object Data (Armature) > Selection Sets", "description": "List of Bone sets for easy selection while animating", "warning": "", @@ -50,12 +50,12 @@ from bpy.props import ( # Note: bones are stored by name, this means that if the bone is renamed, # there can be problems. However, bone renaming is unlikely during animation class SelectionEntry(PropertyGroup): - name = StringProperty(name="Bone Name") + name: StringProperty(name="Bone Name") class SelectionSet(PropertyGroup): - name = StringProperty(name="Set Name") - bone_ids = CollectionProperty(type=SelectionEntry) + name: StringProperty(name="Set Name") + bone_ids: CollectionProperty(type=SelectionEntry) # UI Panel w/ UIList ########################################################## @@ -210,7 +210,7 @@ class POSE_OT_selection_set_move(NeedSelSetPluginOperator): bl_description = "Move the active Selection Set up/down the list of sets" bl_options = {'UNDO', 'REGISTER'} - direction = EnumProperty( + direction: EnumProperty( name="Move Direction", description="Direction to move the active Selection Set: UP (default) or DOWN", items=[ @@ -334,10 +334,11 @@ class POSE_OT_selection_set_select(NeedSelSetPluginOperator): bl_description = "Add Selection Set bones to current selection" bl_options = {'UNDO', 'REGISTER'} - selection_set_index = IntProperty( + selection_set_index: IntProperty( name='Selection Set Index', default=-1, - description='Which Selection Set to select; -1 uses the active Selection Set') + description='Which Selection Set to select; -1 uses the active Selection Set', + ) def execute(self, context): arm = context.object diff --git a/camera_dolly_crane_rigs.py b/camera_dolly_crane_rigs.py index 16443675..0eceebf3 100644 --- a/camera_dolly_crane_rigs.py +++ b/camera_dolly_crane_rigs.py @@ -533,7 +533,7 @@ def build_dolly_rig(context): cam.data.name = "Dolly_Camera.000" cam_data_name = bpy.context.object.data.name - bpy.data.cameras[cam_data_name].draw_size = 1.0 + bpy.data.cameras[cam_data_name].display_size = 1.0 cam.rotation_euler[0] = 1.5708 # rotate the camera 90 degrees in x cam.location = (0.0, -2.0, 0.0) # move the camera to the correct postion cam.parent = rig @@ -631,9 +631,9 @@ def build_crane_rig(context): ctrlAimChild.parent = ctrlAim # change display to BBone: it just looks nicer - bpy.context.object.data.draw_type = 'BBONE' + bpy.context.object.data.display_type = 'BBONE' # change display to wire for object - bpy.context.object.draw_type = 'WIRE' + bpy.context.object.display_type = 'WIRE' # jump into pose mode and change bones to euler bpy.ops.object.mode_set(mode='POSE') @@ -718,7 +718,7 @@ def build_crane_rig(context): cam.data.name = "Crane_Camera.000" cam_data_name = bpy.context.object.data.name - bpy.data.cameras[cam_data_name].draw_size = 1.0 + bpy.data.cameras[cam_data_name].display_size = 1.0 cam.rotation_euler[0] = 1.5708 # rotate the camera 90 degrees in x cam.location = (0.0, -2.0, 0.0) # move the camera to the correct postion cam.parent = rig @@ -801,7 +801,7 @@ class DollyCameraUI(Panel): text="Make Active Camera", icon='CAMERA_DATA') col.prop(context.active_object, - 'show_x_ray', toggle=False, text='X Ray') + 'show_in_front', toggle=False, text='X Ray') col.prop(cam, "show_limits") col.prop(cam, "show_safe_areas") col.prop(cam, "show_passepartout") @@ -865,7 +865,7 @@ class CraneCameraUI(Panel): col.operator( "scene.make_camera_active", text="Make Active Camera", icon='CAMERA_DATA') col.prop( - context.active_object, 'show_x_ray', toggle=False, text='X Ray') + context.active_object, 'show_in_front', toggle=False, text='X Ray') col.prop(cam, "show_limits") col.prop(cam, "show_safe_areas") col.prop(cam, "show_passepartout") @@ -966,7 +966,7 @@ def register(): bpy.utils.register_class(MakeCameraActive) bpy.utils.register_class(AddMarkerBind) bpy.utils.register_class(AddDofEmpty) - bpy.types.INFO_MT_camera_add.append(add_dolly_crane_buttons) + bpy.types.VIEW3D_MT_camera_add.append(add_dolly_crane_buttons) def unregister(): @@ -977,7 +977,7 @@ def unregister(): bpy.utils.unregister_class(MakeCameraActive) bpy.utils.unregister_class(AddMarkerBind) bpy.utils.unregister_class(AddDofEmpty) - bpy.types.INFO_MT_camera_add.remove(add_dolly_crane_buttons) + bpy.types.VIEW3D_MT_camera_add.remove(add_dolly_crane_buttons) if __name__ == "__main__": diff --git a/camera_turnaround.py b/camera_turnaround.py index 6a6e710f..547c2834 100644 --- a/camera_turnaround.py +++ b/camera_turnaround.py @@ -96,7 +96,7 @@ class RunAction(Operator): context.user_preferences.edit.keyframe_new_interpolation_type = 'LINEAR' # create first frame myempty.rotation_euler = (0, 0, 0) - myempty.empty_draw_size = 0.1 + myempty.empty_display_size = 0.1 context.scene.frame_set(scene.frame_start) myempty.keyframe_insert(data_path='rotation_euler', frame=scene.frame_start) diff --git a/curve_simplify.py b/curve_simplify.py index b053a4b9..e84cdc6e 100644 --- a/curve_simplify.py +++ b/curve_simplify.py @@ -597,13 +597,13 @@ def register(): bpy.types.GRAPH_MT_channel.append(menu_func) bpy.types.DOPESHEET_MT_channel.append(menu_func) - bpy.types.INFO_MT_curve_add.append(menu) + bpy.types.VIEW3D_MT_curve_add.append(menu) def unregister(): bpy.types.GRAPH_MT_channel.remove(menu_func) bpy.types.DOPESHEET_MT_channel.remove(menu_func) - bpy.types.INFO_MT_curve_add.remove(menu) + bpy.types.VIEW3D_MT_curve_add.remove(menu) bpy.utils.unregister_module(__name__) diff --git a/depsgraph_debug.py b/depsgraph_debug.py index 438d4885..76f25290 100644 --- a/depsgraph_debug.py +++ b/depsgraph_debug.py @@ -27,7 +27,7 @@ bl_info = { "name": "Dependency Graph Debug", "author": "Sergey Sharybin", "version": (0, 1), - "blender": (2, 79, 0), + "blender": (2, 80, 0), "description": "Various dependency graph debugging tools", "warning": "", "wiki_url": "", @@ -48,12 +48,12 @@ def _get_depsgraph(context): # Save data from depsgraph to a specified file. class SCENE_OT_depsgraph_save_common: - filepath = StringProperty( - name="File Path", - description="Filepath used for saving the file", - maxlen=1024, - subtype='FILE_PATH', - ) + filepath: StringProperty( + name="File Path", + description="Filepath used for saving the file", + maxlen=1024, + subtype='FILE_PATH', + ) def _getExtension(self, context): return "" @@ -86,8 +86,10 @@ class SCENE_OT_depsgraph_save_common: pass -class SCENE_OT_depsgraph_relations_graphviz(Operator, - SCENE_OT_depsgraph_save_common): +class SCENE_OT_depsgraph_relations_graphviz( + Operator, + SCENE_OT_depsgraph_save_common, +): bl_idname = "scene.depsgraph_relations_graphviz" bl_label = "Save Depsgraph" bl_description = "Save current scene's dependency graph to a graphviz file" @@ -96,13 +98,16 @@ class SCENE_OT_depsgraph_relations_graphviz(Operator, return ".dot" def performSave(self, context, depsgraph): + import os basename, extension = os.path.splitext(self.filepath) - depsgraph.debug_relations_graphviz(self.filepath, absename + ".png") + depsgraph.debug_relations_graphviz(os.path.join(self.filepath, basename + ".dot")) return True -class SCENE_OT_depsgraph_stats_gnuplot(Operator, - SCENE_OT_depsgraph_save_common): +class SCENE_OT_depsgraph_stats_gnuplot( + Operator, + SCENE_OT_depsgraph_save_common, +): bl_idname = "scene.depsgraph_stats_gnuplot" bl_label = "Save Depsgraph Stats" bl_description = "Save current scene's evaluaiton stats to gnuplot file" diff --git a/development_icon_get.py b/development_icon_get.py index a7740c31..cbeeea9a 100644 --- a/development_icon_get.py +++ b/development_icon_get.py @@ -23,9 +23,9 @@ bl_info = { "name": "Icon Viewer", "description": "Click an icon to copy its name to the clipboard", "author": "roaoao", - "version": (1, 3, 2), - "blender": (2, 75, 0), - "location": "Spacebar > Icon Viewer, Text Editor > Properties", + "version": (1, 4, 0), + "blender": (2, 80, 0), + "location": "Search Menu > Icon Viewer, Text Editor > Properties", "wiki_url": "https://wiki.blender.org/index.php/Extensions:2.6" "/Py/Scripts/Development/Display_All_Icons", "category": "Development" @@ -33,6 +33,10 @@ bl_info = { import bpy import math +from bpy.props import ( + BoolProperty, + StringProperty, +) DPI = 72 POPUP_PADDING = 10 @@ -88,6 +92,9 @@ class Icons: not pr.show_brush_icons and "BRUSH_" in icon and \ icon != 'BRUSH_DATA' or \ not pr.show_matcap_icons and "MATCAP_" in icon or \ + not pr.show_event_icons and ( + "EVENT_" in icon or "MOUSE_" in icon + ) or \ not pr.show_colorset_icons and "COLORSET_" in icon: continue self._filtered_icons.append(icon) @@ -109,8 +116,8 @@ class Icons: else: filtered_icons = self.filtered_icons - column = layout.column(True) - row = column.row(True) + column = layout.column(align=True) + row = column.row(align=True) row.alignment = 'CENTER' selected_icon = self.selected_icon if self.is_popup else \ @@ -118,7 +125,7 @@ class Icons: col_idx = 0 for i, icon in enumerate(filtered_icons): p = row.operator( - IV_OT_icon_select.bl_idname, "", + IV_OT_icon_select.bl_idname, text="", icon=icon, emboss=icon == selected_icon) p.icon = icon p.force_copy_on_select = not self.is_popup @@ -129,16 +136,15 @@ class Icons: break col_idx = 0 if i < len(filtered_icons) - 1: - row = column.row(True) + row = column.row(align=True) row.alignment = 'CENTER' if col_idx != 0 and not icons and i >= num_cols: - sub = row.row(True) - sub.scale_x = num_cols - col_idx - sub.label("", icon='BLANK1') + for _ in range(num_cols - col_idx): + row.label(text="", icon='BLANK1') if not filtered_icons: - row.label("No icons were found") + row.label(text="No icons were found") class IV_Preferences(bpy.types.AddonPreferences): @@ -154,47 +160,51 @@ class IV_Preferences(bpy.types.AddonPreferences): def set_panel_filter(self, value): self.panel_icons.filter = value - panel_filter = bpy.props.StringProperty( + panel_filter: StringProperty( description="Filter", default="", get=lambda s: s.panel_icons.filter, set=set_panel_filter, options={'TEXTEDIT_UPDATE'}) - show_panel_icons = bpy.props.BoolProperty( + show_panel_icons: BoolProperty( name="Show Icons", description="Show icons", default=True) - show_history = bpy.props.BoolProperty( + show_history: BoolProperty( name="Show History", description="Show history", default=True) - show_brush_icons = bpy.props.BoolProperty( + show_brush_icons: BoolProperty( name="Show Brush Icons", description="Show brush icons", default=True, update=update_icons) - show_matcap_icons = bpy.props.BoolProperty( + show_matcap_icons: BoolProperty( name="Show Matcap Icons", description="Show matcap icons", default=True, update=update_icons) - show_colorset_icons = bpy.props.BoolProperty( + show_event_icons: BoolProperty( + name="Show Event Icons", + description="Show event icons", default=True, + update=update_icons) + show_colorset_icons: BoolProperty( name="Show Colorset Icons", description="Show colorset icons", default=True, update=update_icons) - copy_on_select = bpy.props.BoolProperty( + copy_on_select: BoolProperty( name="Copy Icon On Click", description="Copy icon on click", default=True) - close_on_select = bpy.props.BoolProperty( + close_on_select: BoolProperty( name="Close Popup On Click", description=( "Close the popup on click.\n" "Not supported by some windows (User Preferences, Render)" - ), + ), default=False) - auto_focus_filter = bpy.props.BoolProperty( + auto_focus_filter: BoolProperty( name="Auto Focus Input Field", description="Auto focus input field", default=True) - show_panel = bpy.props.BoolProperty( + show_panel: BoolProperty( name="Show Panel", description="Show the panel in the Text Editor", default=True) - show_header = bpy.props.BoolProperty( + show_header: BoolProperty( name="Show Header", description="Show the header in the Python Console", default=True) @@ -207,29 +217,30 @@ class IV_Preferences(bpy.types.AddonPreferences): row = layout.row() - col = row.column(True) - col.label("Icons:") + col = row.column(align=True) + col.label(text="Icons:") col.prop(self, "show_matcap_icons") col.prop(self, "show_brush_icons") col.prop(self, "show_colorset_icons") + col.prop(self, "show_event_icons") col.separator() col.prop(self, "show_history") - col = row.column(True) - col.label("Popup:") + col = row.column(align=True) + col.label(text="Popup:") col.prop(self, "auto_focus_filter") col.prop(self, "copy_on_select") if self.copy_on_select: col.prop(self, "close_on_select") - col = row.column(True) - col.label("Panel:") + col = row.column(align=True) + col.label(text="Panel:") col.prop(self, "show_panel") if self.show_panel: col.prop(self, "show_panel_icons") col.separator() - col.label("Header:") + col.label(text="Header:") col.prop(self, "show_header") @@ -253,12 +264,13 @@ class IV_PT_icons(bpy.types.Panel): def draw(self, context): pr = prefs() - row = self.layout.row(True) + row = self.layout.row(align=True) if pr.show_panel_icons: - row.prop(pr, "panel_filter", "", icon='VIEWZOOM') + row.prop(pr, "panel_filter", text="", icon='VIEWZOOM') else: row.operator(IV_OT_icons_show.bl_idname) - row.operator(IV_OT_panel_menu_call.bl_idname, "", icon='COLLAPSEMENU') + row.operator( + IV_OT_panel_menu_call.bl_idname, text="", icon='COLLAPSEMENU') _, y0 = context.region.view2d.region_to_view(0, 0) _, y1 = context.region.view2d.region_to_view(0, 10) @@ -271,11 +283,11 @@ class IV_PT_icons(bpy.types.Panel): col = None if HISTORY and pr.show_history: - col = self.layout.column(True) + col = self.layout.column(align=True) pr.panel_icons.draw(col.box(), num_cols, HISTORY) if pr.show_panel_icons: - col = col or self.layout.column(True) + col = col or self.layout.column(align=True) pr.panel_icons.draw(col.box(), num_cols) @classmethod @@ -313,9 +325,10 @@ class IV_OT_panel_menu_call(bpy.types.Operator): layout.prop(pr, "show_matcap_icons") layout.prop(pr, "show_brush_icons") layout.prop(pr, "show_colorset_icons") + layout.prop(pr, "show_event_icons") def execute(self, context): - context.window_manager.popup_menu(self.menu, "Icon Viewer") + context.window_manager.popup_menu(self.menu, title="Icon Viewer") return {'FINISHED'} @@ -325,8 +338,8 @@ class IV_OT_icon_select(bpy.types.Operator): bl_description = "Select the icon" bl_options = {'INTERNAL'} - icon = bpy.props.StringProperty() - force_copy_on_select = bpy.props.BoolProperty() + icon: StringProperty() + force_copy_on_select: BoolProperty() def execute(self, context): pr = prefs() @@ -362,17 +375,17 @@ class IV_OT_icons_show(bpy.types.Operator): if IV_OT_icons_show.instance: IV_OT_icons_show.instance.auto_focusable = False - filter_auto_focus = bpy.props.StringProperty( + filter_auto_focus: StringProperty( description="Filter", get=lambda s: prefs().popup_icons.filter, set=set_filter, options={'TEXTEDIT_UPDATE', 'SKIP_SAVE'}) - filter = bpy.props.StringProperty( + filter: StringProperty( description="Filter", get=lambda s: prefs().popup_icons.filter, set=set_filter, options={'TEXTEDIT_UPDATE'}) - selected_icon = bpy.props.StringProperty( + selected_icon: StringProperty( description="Selected Icon", get=lambda s: prefs().popup_icons.selected_icon, set=set_selected_icon) @@ -383,36 +396,38 @@ class IV_OT_icons_show(bpy.types.Operator): def draw_header(self, layout): pr = prefs() header = layout.box() - header = header.split(0.75) if self.selected_icon else header.row() - row = header.row(True) - row.prop(pr, "show_matcap_icons", "", icon='SMOOTH') - row.prop(pr, "show_brush_icons", "", icon='BRUSH_DATA') - row.prop(pr, "show_colorset_icons", "", icon='COLOR') + header = header.split(factor=0.75) if self.selected_icon else \ + header.row() + row = header.row(align=True) + row.prop(pr, "show_matcap_icons", text="", icon='SMOOTH') + row.prop(pr, "show_brush_icons", text="", icon='BRUSH_DATA') + row.prop(pr, "show_colorset_icons", text="", icon='COLOR') + row.prop(pr, "show_event_icons", text="", icon='HAND') row.separator() row.prop( - pr, "copy_on_select", "", + pr, "copy_on_select", text="", icon='BORDER_RECT', toggle=True) if pr.copy_on_select: - sub = row.row(True) + sub = row.row(align=True) if bpy.context.window.screen.name == "temp": sub.alert = True sub.prop( - pr, "close_on_select", "", + pr, "close_on_select", text="", icon='RESTRICT_SELECT_OFF', toggle=True) row.prop( - pr, "auto_focus_filter", "", + pr, "auto_focus_filter", text="", icon='OUTLINER_DATA_FONT', toggle=True) row.separator() if self.auto_focusable and pr.auto_focus_filter: - row.prop(self, "filter_auto_focus", "", icon='VIEWZOOM') + row.prop(self, "filter_auto_focus", text="", icon='VIEWZOOM') else: - row.prop(self, "filter", "", icon='VIEWZOOM') + row.prop(self, "filter", text="", icon='VIEWZOOM') if self.selected_icon: row = header.row() - row.prop(self, "selected_icon", "", icon=self.selected_icon) + row.prop(self, "selected_icon", text="", icon=self.selected_icon) def draw(self, context): pr = prefs() @@ -425,7 +440,7 @@ class IV_OT_icons_show(bpy.types.Operator): self.get_num_cols(len(pr.popup_icons.filtered_icons)), history_num_cols) - subcol = col.column(True) + subcol = col.column(align=True) if HISTORY and pr.show_history: pr.popup_icons.draw(subcol.box(), history_num_cols, HISTORY) @@ -468,18 +483,31 @@ class IV_OT_icons_show(bpy.types.Operator): ui_scale() * (num_cols * ICON_SIZE + POPUP_PADDING), context.window.width - WIN_PADDING) - return context.window_manager.invoke_props_dialog(self, self.width) + return context.window_manager.invoke_props_dialog( + self, width=self.width) + + +classes = [ + IV_PT_icons, + IV_HT_icons, + IV_OT_panel_menu_call, + IV_OT_icon_select, + IV_OT_icons_show, + IV_Preferences, +] def register(): if bpy.app.background: return - bpy.utils.register_module(__name__) + for cls in classes: + bpy.utils.register_class(cls) def unregister(): if bpy.app.background: return - bpy.utils.unregister_module(__name__) + for cls in classes: + bpy.utils.unregister_class(cls) diff --git a/game_engine_publishing.py b/game_engine_publishing.py deleted file mode 100644 index 495b0123..00000000 --- a/game_engine_publishing.py +++ /dev/null @@ -1,576 +0,0 @@ -# ##### 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 ##### - -import bpy -import os -import tempfile -import shutil -import tarfile -import time -import stat - - -bl_info = { - "name": "Game Engine Publishing", - "author": "Mitchell Stokes (Moguri), Oren Titane (Genome36)", - "version": (0, 1, 0), - "blender": (2, 75, 0), - "location": "Render Properties > Publishing Info", - "description": "Publish .blend file as game engine runtime, manage versions and platforms", - "warning": "", - "wiki_url": "http://wiki.blender.org/index.php/Extensions:2.6/Py/Scripts/Game_Engine/Publishing", - "category": "Game Engine", -} - - -def WriteRuntime(player_path, output_path, asset_paths, copy_python, overwrite_lib, copy_dlls, make_archive, report=print): - import struct - - player_path = bpy.path.abspath(player_path) - ext = os.path.splitext(player_path)[-1].lower() - output_path = bpy.path.abspath(output_path) - output_dir = os.path.dirname(output_path) - if not os.path.exists(output_dir): - os.makedirs(output_dir) - - python_dir = os.path.join(os.path.dirname(player_path), - bpy.app.version_string.split()[0], - "python", - "lib") - - # Check the paths - if not os.path.isfile(player_path) and not(os.path.exists(player_path) and player_path.endswith('.app')): - report({'ERROR'}, "The player could not be found! Runtime not saved") - return - - # Check if we're bundling a .app - if player_path.lower().endswith('.app'): - # Python doesn't need to be copied for OS X since it's already inside blenderplayer.app - copy_python = False - - output_path = bpy.path.ensure_ext(output_path, '.app') - - if os.path.exists(output_path): - shutil.rmtree(output_path) - - shutil.copytree(player_path, output_path) - bpy.ops.wm.save_as_mainfile(filepath=os.path.join(output_path, 'Contents', 'Resources', 'game.blend'), - relative_remap=False, - compress=False, - copy=True, - ) - else: - # Enforce "exe" extension on Windows - if player_path.lower().endswith('.exe'): - output_path = bpy.path.ensure_ext(output_path, '.exe') - - # Get the player's binary and the offset for the blend - with open(player_path, "rb") as file: - player_d = file.read() - offset = file.tell() - - # Create a tmp blend file (Blenderplayer doesn't like compressed blends) - tempdir = tempfile.mkdtemp() - blend_path = os.path.join(tempdir, bpy.path.clean_name(output_path)) - bpy.ops.wm.save_as_mainfile(filepath=blend_path, - relative_remap=False, - compress=False, - copy=True, - ) - - # Get the blend data - with open(blend_path, "rb") as blend_file: - blend_d = blend_file.read() - - # Get rid of the tmp blend, we're done with it - os.remove(blend_path) - os.rmdir(tempdir) - - # Create a new file for the bundled runtime - with open(output_path, "wb") as output: - # Write the player and blend data to the new runtime - print("Writing runtime...", end=" ", flush=True) - output.write(player_d) - output.write(blend_d) - - # Store the offset (an int is 4 bytes, so we split it up into 4 bytes and save it) - output.write(struct.pack('BBBB', (offset >> 24) & 0xFF, - (offset >> 16) & 0xFF, - (offset >> 8) & 0xFF, - (offset >> 0) & 0xFF)) - - # Stuff for the runtime - output.write(b'BRUNTIME') - - print("done", flush=True) - - # Make sure the runtime is executable - os.chmod(output_path, 0o755) - - # Copy bundled Python - blender_dir = os.path.dirname(player_path) - - if copy_python: - print("Copying Python files...", end=" ", flush=True) - py_folder = os.path.join(bpy.app.version_string.split()[0], "python", "lib") - dst = os.path.join(output_dir, py_folder) - src = python_dir - - if os.path.exists(dst) and overwrite_lib: - shutil.rmtree(dst) - - if not os.path.exists(dst): - shutil.copytree(src, dst, ignore=lambda dir, contents: [i for i in contents if i == '__pycache__']) - print("done", flush=True) - else: - print("used existing Python folder", flush=True) - - # And DLLs if we're doing a Windows runtime) - if copy_dlls and ext == ".exe": - print("Copying DLLs...", end=" ", flush=True) - for file in [i for i in os.listdir(blender_dir) if i.lower().endswith('.dll')]: - src = os.path.join(blender_dir, file) - dst = os.path.join(output_dir, file) - shutil.copy2(src, dst) - - print("done", flush=True) - - # Copy assets - for ap in asset_paths: - src = bpy.path.abspath(ap.name) - dst = os.path.join(output_dir, ap.name[2:] if ap.name.startswith('//') else ap.name) - - if os.path.exists(src): - if os.path.isdir(src): - if ap.overwrite and os.path.exists(dst): - shutil.rmtree(dst) - elif not os.path.exists(dst): - shutil.copytree(src, dst) - else: - if ap.overwrite or not os.path.exists(dst): - shutil.copy2(src, dst) - else: - report({'ERROR'}, "Could not find asset path: '%s'" % src) - - # Make archive - if make_archive: - print("Making archive...", end=" ", flush=True) - - arctype = '' - if player_path.lower().endswith('.exe'): - arctype = 'zip' - elif player_path.lower().endswith('.app'): - arctype = 'zip' - else: # Linux - arctype = 'gztar' - - basedir = os.path.normpath(os.path.join(os.path.dirname(output_path), '..')) - afilename = os.path.join(basedir, os.path.basename(output_dir)) - - if arctype == 'gztar': - # Create the tarball ourselves instead of using shutil.make_archive - # so we can handle permission bits. - - # The runtimename needs to use forward slashes as a path separator - # since this is what tarinfo.name is using. - runtimename = os.path.relpath(output_path, basedir).replace('\\', '/') - - def _set_ex_perm(tarinfo): - if tarinfo.name == runtimename: - tarinfo.mode = 0o755 - return tarinfo - - with tarfile.open(afilename + '.tar.gz', 'w:gz') as tf: - tf.add(output_dir, os.path.relpath(output_dir, basedir), filter=_set_ex_perm) - elif arctype == 'zip': - shutil.make_archive(afilename, 'zip', output_dir) - else: - report({'ERROR'}, "Unknown archive type %s for runtime %s\n" % (arctype, player_path)) - - print("done", flush=True) - - -class PublishAllPlatforms(bpy.types.Operator): - bl_idname = "wm.publish_platforms" - bl_label = "Exports a runtime for each listed platform" - - def execute(self, context): - ps = context.scene.ge_publish_settings - - if ps.publish_default_platform: - print("Publishing default platform") - blender_bin_path = bpy.app.binary_path - blender_bin_dir = os.path.dirname(blender_bin_path) - ext = os.path.splitext(blender_bin_path)[-1].lower() - WriteRuntime(os.path.join(blender_bin_dir, 'blenderplayer' + ext), - os.path.join(ps.output_path, 'default', ps.runtime_name), - ps.asset_paths, - True, - True, - True, - ps.make_archive, - self.report - ) - else: - print("Skipping default platform") - - for platform in ps.platforms: - if platform.publish: - print("Publishing", platform.name) - WriteRuntime(platform.player_path, - os.path.join(ps.output_path, platform.name, ps.runtime_name), - ps.asset_paths, - True, - True, - True, - ps.make_archive, - self.report - ) - else: - print("Skipping", platform.name) - - return {'FINISHED'} - - -class RENDER_UL_assets(bpy.types.UIList): - bl_label = "Asset Paths Listing" - - def draw_item(self, context, layout, data, item, icon, active_data, active_propname): - layout.prop(item, "name", text="", emboss=False) - - -class RENDER_UL_platforms(bpy.types.UIList): - bl_label = "Platforms Listing" - - def draw_item(self, context, layout, data, item, icon, active_data, active_propname): - row = layout.row() - row.label(item.name) - row.prop(item, "publish", text="") - - -class RENDER_PT_publish(bpy.types.Panel): - bl_label = "Publishing Info" - bl_space_type = "PROPERTIES" - bl_region_type = "WINDOW" - bl_context = "render" - - @classmethod - def poll(cls, context): - scene = context.scene - return scene and (scene.render.engine == "BLENDER_GAME") - - def draw(self, context): - ps = context.scene.ge_publish_settings - layout = self.layout - - # config - layout.prop(ps, 'output_path') - layout.prop(ps, 'runtime_name') - layout.prop(ps, 'lib_path') - layout.prop(ps, 'make_archive') - - layout.separator() - - # assets list - layout.label("Asset Paths") - - # UI_UL_list - row = layout.row() - row.template_list("RENDER_UL_assets", "assets_list", ps, 'asset_paths', ps, 'asset_paths_active') - - # operators - col = row.column(align=True) - col.operator(PublishAddAssetPath.bl_idname, icon='ZOOMIN', text="") - col.operator(PublishRemoveAssetPath.bl_idname, icon='ZOOMOUT', text="") - - # indexing - if len(ps.asset_paths) > ps.asset_paths_active >= 0: - ap = ps.asset_paths[ps.asset_paths_active] - row = layout.row() - row.prop(ap, 'overwrite') - - layout.separator() - - # publishing list - row = layout.row(align=True) - row.label("Platforms") - row.prop(ps, 'publish_default_platform') - - # UI_UL_list - row = layout.row() - row.template_list("RENDER_UL_platforms", "platforms_list", ps, 'platforms', ps, 'platforms_active') - - # operators - col = row.column(align=True) - col.operator(PublishAddPlatform.bl_idname, icon='ZOOMIN', text="") - col.operator(PublishRemovePlatform.bl_idname, icon='ZOOMOUT', text="") - col.menu("PUBLISH_MT_platform_specials", icon='DOWNARROW_HLT', text="") - - # indexing - if len(ps.platforms) > ps.platforms_active >= 0: - platform = ps.platforms[ps.platforms_active] - layout.prop(platform, 'name') - layout.prop(platform, 'player_path') - - layout.operator(PublishAllPlatforms.bl_idname, 'Publish Platforms') - - -class PublishAutoPlatforms(bpy.types.Operator): - bl_idname = "scene.publish_auto_platforms" - bl_label = "Auto Add Platforms" - - def execute(self, context): - ps = context.scene.ge_publish_settings - - # verify lib folder - lib_path = bpy.path.abspath(ps.lib_path) - if not os.path.exists(lib_path): - self.report({'ERROR'}, "Could not add platforms, lib folder (%s) does not exist" % lib_path) - return {'CANCELLED'} - - for lib in [i for i in os.listdir(lib_path) if os.path.isdir(os.path.join(lib_path, i))]: - print("Found folder:", lib) - player_found = False - for root, dirs, files in os.walk(os.path.join(lib_path, lib)): - if "__MACOSX" in root: - continue - - for f in dirs + files: - if f.startswith("blenderplayer.app") or f.startswith("blenderplayer"): - a = ps.platforms.add() - if lib.startswith('blender-'): - # Clean up names for packages from blender.org - # example: blender-2.71-RC2-OSX_10.6-x86_64.zip => OSX_10.6-x86_64.zip - # We're pretty consistent on naming, so this should hold up. - a.name = '-'.join(lib.split('-')[3 if 'rc' in lib.lower() else 2:]) - else: - a.name = lib - a.player_path = bpy.path.relpath(os.path.join(root, f)) - player_found = True - break - - if player_found: - break - - return {'FINISHED'} - -# TODO This operator takes a long time to run, which is bad for UX. Could this instead be done as some sort of -# modal dialog? This could also allow users to select which platforms to download and give a better progress -# indicator. -class PublishDownloadPlatforms(bpy.types.Operator): - bl_idname = "scene.publish_download_platforms" - bl_label = "Download Platforms" - - def execute(self, context): - import html.parser - import urllib.request - - remote_platforms = [] - - ps = context.scene.ge_publish_settings - - # create lib folder if not already available - lib_path = bpy.path.abspath(ps.lib_path) - if not os.path.exists(lib_path): - os.makedirs(lib_path) - - print("Retrieving list of platforms from blender.org...", end=" ", flush=True) - - class AnchorParser(html.parser.HTMLParser): - def handle_starttag(self, tag, attrs): - if tag == 'a': - for key, value in attrs: - if key == 'href' and value.startswith('blender'): - remote_platforms.append(value) - - url = 'http://download.blender.org/release/Blender' + bpy.app.version_string.split()[0] - parser = AnchorParser() - data = urllib.request.urlopen(url).read() - parser.feed(str(data)) - - print("done", flush=True) - - print("Downloading files (this will take a while depending on your internet connection speed).", flush=True) - for i in remote_platforms: - src = '/'.join((url, i)) - dst = os.path.join(lib_path, i) - - dst_dir = '.'.join([i for i in dst.split('.') if i not in {'zip', 'tar', 'bz2'}]) - if not os.path.exists(dst) and not os.path.exists(dst.split('.')[0]): - print("Downloading " + src + "...", end=" ", flush=True) - urllib.request.urlretrieve(src, dst) - print("done", flush=True) - else: - print("Reusing existing file: " + dst, flush=True) - - print("Unpacking " + dst + "...", end=" ", flush=True) - if os.path.exists(dst_dir): - shutil.rmtree(dst_dir) - shutil.unpack_archive(dst, dst_dir) - print("done", flush=True) - - print("Creating platform from libs...", flush=True) - bpy.ops.scene.publish_auto_platforms() - return {'FINISHED'} - - -class PublishAddPlatform(bpy.types.Operator): - bl_idname = "scene.publish_add_platform" - bl_label = "Add Publish Platform" - - def execute(self, context): - a = context.scene.ge_publish_settings.platforms.add() - a.name = a.name - return {'FINISHED'} - - -class PublishRemovePlatform(bpy.types.Operator): - bl_idname = "scene.publish_remove_platform" - bl_label = "Remove Publish Platform" - - def execute(self, context): - ps = context.scene.ge_publish_settings - if ps.platforms_active < len(ps.platforms): - ps.platforms.remove(ps.platforms_active) - return {'FINISHED'} - return {'CANCELLED'} - - -# TODO maybe this should display a file browser? -class PublishAddAssetPath(bpy.types.Operator): - bl_idname = "scene.publish_add_assetpath" - bl_label = "Add Asset Path" - - def execute(self, context): - a = context.scene.ge_publish_settings.asset_paths.add() - a.name = a.name - return {'FINISHED'} - - -class PublishRemoveAssetPath(bpy.types.Operator): - bl_idname = "scene.publish_remove_assetpath" - bl_label = "Remove Asset Path" - - def execute(self, context): - ps = context.scene.ge_publish_settings - if ps.asset_paths_active < len(ps.asset_paths): - ps.asset_paths.remove(ps.asset_paths_active) - return {'FINISHED'} - return {'CANCELLED'} - - -class PUBLISH_MT_platform_specials(bpy.types.Menu): - bl_label = "Platform Specials" - - def draw(self, context): - layout = self.layout - layout.operator(PublishAutoPlatforms.bl_idname) - layout.operator(PublishDownloadPlatforms.bl_idname) - - -class PlatformSettings(bpy.types.PropertyGroup): - name = bpy.props.StringProperty( - name = "Platform Name", - description = "The name of the platform", - default = "Platform", - ) - - player_path = bpy.props.StringProperty( - name = "Player Path", - description = "The path to the Blenderplayer to use for this platform", - default = "//lib/platform/blenderplayer", - subtype = 'FILE_PATH', - ) - - publish = bpy.props.BoolProperty( - name = "Publish", - description = "Whether or not to publish to this platform", - default = True, - ) - - -class AssetPath(bpy.types.PropertyGroup): - # TODO This needs a way to be a FILE_PATH or a DIR_PATH - name = bpy.props.StringProperty( - name = "Asset Path", - description = "Path to the asset to be copied", - default = "//src", - subtype = 'FILE_PATH', - ) - - overwrite = bpy.props.BoolProperty( - name = "Overwrite Asset", - description = "Overwrite the asset if it already exists in the destination folder", - default = True, - ) - - -class PublishSettings(bpy.types.PropertyGroup): - output_path = bpy.props.StringProperty( - name = "Publish Output", - description = "Where to publish the game", - default = "//bin/", - subtype = 'DIR_PATH', - ) - - runtime_name = bpy.props.StringProperty( - name = "Runtime name", - description = "The filename for the created runtime", - default = "game", - ) - - lib_path = bpy.props.StringProperty( - name = "Library Path", - description = "Directory to search for platforms", - default = "//lib/", - subtype = 'DIR_PATH', - ) - - publish_default_platform = bpy.props.BoolProperty( - name = "Publish Default Platform", - description = "Whether or not to publish the default platform (the Blender install running this addon) when publishing platforms", - default = True, - ) - - - platforms = bpy.props.CollectionProperty(type=PlatformSettings, name="Platforms") - platforms_active = bpy.props.IntProperty() - - asset_paths = bpy.props.CollectionProperty(type=AssetPath, name="Asset Paths") - asset_paths_active = bpy.props.IntProperty() - - make_archive = bpy.props.BoolProperty( - name = "Make Archive", - description = "Create a zip archive of the published game", - default = True, - ) - - -def register(): - bpy.utils.register_module(__name__) - - bpy.types.Scene.ge_publish_settings = bpy.props.PointerProperty(type=PublishSettings) - - -def unregister(): - bpy.utils.unregister_module(__name__) - del bpy.types.Scene.ge_publish_settings - - -if __name__ == "__main__": - register() diff --git a/game_engine_save_as_runtime.py b/game_engine_save_as_runtime.py deleted file mode 100644 index 25e47d94..00000000 --- a/game_engine_save_as_runtime.py +++ /dev/null @@ -1,258 +0,0 @@ -# ##### 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 ##### - -bl_info = { - "name": "Save As Game Engine Runtime", - "author": "Mitchell Stokes (Moguri)", - "version": (0, 3, 1), - "blender": (2, 61, 0), - "location": "File > Export", - "description": "Bundle a .blend file with the Blenderplayer", - "warning": "", - "wiki_url": "http://wiki.blender.org/index.php/Extensions:2.6/Py/" - "Scripts/Game_Engine/Save_As_Runtime", - "category": "Game Engine", -} - -import bpy -import os -import sys -import shutil -import tempfile - - -def CopyPythonLibs(dst, overwrite_lib, report=print): - import platform - - # use python module to find pytohn's libpath - src = os.path.dirname(platform.__file__) - - # dst points to lib/, but src points to current python's library path, eg: - # '/usr/lib/python3.2' vs '/usr/lib' - # append python's library dir name to destination, so only python's - # libraries would be copied - if os.name == 'posix': - dst = os.path.join(dst, os.path.basename(src)) - - if os.path.exists(src): - write = False - if os.path.exists(dst): - if overwrite_lib: - shutil.rmtree(dst) - write = True - else: - write = True - if write: - shutil.copytree(src, dst, ignore=lambda dir, contents: [i for i in contents if i == '__pycache__']) - else: - report({'WARNING'}, "Python not found in %r, skipping pythn copy" % src) - - -def WriteAppleRuntime(player_path, output_path, copy_python, overwrite_lib): - # Enforce the extension - if not output_path.endswith('.app'): - output_path += '.app' - - # Use the system's cp command to preserve some meta-data - os.system('cp -R "%s" "%s"' % (player_path, output_path)) - - bpy.ops.wm.save_as_mainfile(filepath=os.path.join(output_path, "Contents/Resources/game.blend"), - relative_remap=False, - compress=False, - copy=True, - ) - - # Python doesn't need to be copied for OS X since it's already inside blenderplayer.app - - -def WriteRuntime(player_path, output_path, copy_python, overwrite_lib, copy_dlls, report=print): - import struct - - # Check the paths - if not os.path.isfile(player_path) and not(os.path.exists(player_path) and player_path.endswith('.app')): - report({'ERROR'}, "The player could not be found! Runtime not saved") - return - - # Check if we're bundling a .app - if player_path.endswith('.app'): - WriteAppleRuntime(player_path, output_path, copy_python, overwrite_lib) - return - - # Enforce "exe" extension on Windows - if player_path.endswith('.exe') and not output_path.endswith('.exe'): - output_path += '.exe' - - # Get the player's binary and the offset for the blend - file = open(player_path, 'rb') - player_d = file.read() - offset = file.tell() - file.close() - - # Create a tmp blend file (Blenderplayer doesn't like compressed blends) - tempdir = tempfile.mkdtemp() - blend_path = os.path.join(tempdir, bpy.path.clean_name(output_path)) - bpy.ops.wm.save_as_mainfile(filepath=blend_path, - relative_remap=False, - compress=False, - copy=True, - ) - - # Get the blend data - blend_file = open(blend_path, 'rb') - blend_d = blend_file.read() - blend_file.close() - - # Get rid of the tmp blend, we're done with it - os.remove(blend_path) - os.rmdir(tempdir) - - # Create a new file for the bundled runtime - output = open(output_path, 'wb') - - # Write the player and blend data to the new runtime - print("Writing runtime...", end=" ") - output.write(player_d) - output.write(blend_d) - - # Store the offset (an int is 4 bytes, so we split it up into 4 bytes and save it) - output.write(struct.pack('B', (offset>>24)&0xFF)) - output.write(struct.pack('B', (offset>>16)&0xFF)) - output.write(struct.pack('B', (offset>>8)&0xFF)) - output.write(struct.pack('B', (offset>>0)&0xFF)) - - # Stuff for the runtime - output.write(b'BRUNTIME') - output.close() - - print("done") - - # Make the runtime executable on Linux - if os.name == 'posix': - os.chmod(output_path, 0o755) - - # Copy bundled Python - blender_dir = os.path.dirname(bpy.app.binary_path) - runtime_dir = os.path.dirname(output_path) - - if copy_python: - print("Copying Python files...", end=" ") - py_folder = os.path.join(bpy.app.version_string.split()[0], "python", "lib") - dst = os.path.join(runtime_dir, py_folder) - CopyPythonLibs(dst, overwrite_lib, report) - print("done") - - # And DLLs - if copy_dlls: - print("Copying DLLs...", end=" ") - for file in [i for i in os.listdir(blender_dir) if i.lower().endswith('.dll')]: - src = os.path.join(blender_dir, file) - dst = os.path.join(runtime_dir, file) - shutil.copy2(src, dst) - - print("done") - -from bpy.props import * - - -class SaveAsRuntime(bpy.types.Operator): - bl_idname = "wm.save_as_runtime" - bl_label = "Save As Game Engine Runtime" - bl_options = {'REGISTER'} - - if sys.platform == 'darwin': - # XXX, this line looks suspicious, could be done better? - blender_bin_dir = '/' + os.path.join(*bpy.app.binary_path.split('/')[0:-4]) - ext = '.app' - else: - blender_bin_path = bpy.app.binary_path - blender_bin_dir = os.path.dirname(blender_bin_path) - ext = os.path.splitext(blender_bin_path)[-1].lower() - - default_player_path = os.path.join(blender_bin_dir, 'blenderplayer' + ext) - player_path = StringProperty( - name="Player Path", - description="The path to the player to use", - default=default_player_path, - subtype='FILE_PATH', - ) - filepath = StringProperty( - subtype='FILE_PATH', - ) - copy_python = BoolProperty( - name="Copy Python", - description="Copy bundle Python with the runtime", - default=True, - ) - overwrite_lib = BoolProperty( - name="Overwrite 'lib' folder", - description="Overwrites the lib folder (if one exists) with the bundled Python lib folder", - default=False, - ) - - # Only Windows has dlls to copy - if ext == '.exe': - copy_dlls = BoolProperty( - name="Copy DLLs", - description="Copy all needed DLLs with the runtime", - default=True, - ) - else: - copy_dlls = False - - def execute(self, context): - import time - start_time = time.clock() - print("Saving runtime to %r" % self.filepath) - WriteRuntime(self.player_path, - self.filepath, - self.copy_python, - self.overwrite_lib, - self.copy_dlls, - self.report, - ) - print("Finished in %.4fs" % (time.clock()-start_time)) - return {'FINISHED'} - - def invoke(self, context, event): - if not self.filepath: - ext = '.app' if sys.platform == 'darwin' else os.path.splitext(bpy.app.binary_path)[-1] - self.filepath = bpy.path.ensure_ext(bpy.data.filepath, ext) - - wm = context.window_manager - wm.fileselect_add(self) - return {'RUNNING_MODAL'} - - -def menu_func(self, context): - self.layout.operator(SaveAsRuntime.bl_idname) - - -def register(): - bpy.utils.register_module(__name__) - - bpy.types.INFO_MT_file_export.append(menu_func) - - -def unregister(): - bpy.utils.unregister_module(__name__) - - bpy.types.INFO_MT_file_export.remove(menu_func) - - -if __name__ == "__main__": - register() diff --git a/io_anim_acclaim/__init__.py b/io_anim_acclaim/__init__.py index 620c1fc4..7cada817 100644 --- a/io_anim_acclaim/__init__.py +++ b/io_anim_acclaim/__init__.py @@ -189,7 +189,7 @@ class StructureBuilder(DataStructure): self.armature = self.object.data self.object.name = self.name self.armature.name = self.name - self.armature.draw_type = 'STICK' + self.armature.display_type = 'STICK' self.object['source_file_path'] = self.file_path self.object['source_scale'] = self.user_def_scale self.object['MhxArmature'] = 'Daz' @@ -530,16 +530,16 @@ def menu_func_me(self, context): def register(): bpy.utils.register_module(__name__) - bpy.types.INFO_MT_file_import.append(menu_func_s) - bpy.types.INFO_MT_file_import.append(menu_func_mi) - bpy.types.INFO_MT_file_export.append(menu_func_me) + bpy.types.TOPBAR_MT_file_import.append(menu_func_s) + bpy.types.TOPBAR_MT_file_import.append(menu_func_mi) + bpy.types.TOPBAR_MT_file_export.append(menu_func_me) def unregister(): bpy.utils.unregister_module(__name__) - bpy.types.INFO_MT_file_import.remove(menu_func_s) - bpy.types.INFO_MT_file_import.remove(menu_func_mi) - bpy.types.INFO_MT_file_export.remove(menu_func_me) + bpy.types.TOPBAR_MT_file_import.remove(menu_func_s) + bpy.types.TOPBAR_MT_file_import.remove(menu_func_mi) + bpy.types.TOPBAR_MT_file_export.remove(menu_func_me) if __name__ == "__main__": diff --git a/io_anim_bvh/__init__.py b/io_anim_bvh/__init__.py index 8a63fbbc..1655a783 100644 --- a/io_anim_bvh/__init__.py +++ b/io_anim_bvh/__init__.py @@ -222,15 +222,15 @@ def menu_func_export(self, context): def register(): bpy.utils.register_module(__name__) - bpy.types.INFO_MT_file_import.append(menu_func_import) - bpy.types.INFO_MT_file_export.append(menu_func_export) + bpy.types.TOPBAR_MT_file_import.append(menu_func_import) + bpy.types.TOPBAR_MT_file_export.append(menu_func_export) def unregister(): bpy.utils.unregister_module(__name__) - bpy.types.INFO_MT_file_import.remove(menu_func_import) - bpy.types.INFO_MT_file_export.remove(menu_func_export) + bpy.types.TOPBAR_MT_file_import.remove(menu_func_import) + bpy.types.TOPBAR_MT_file_export.remove(menu_func_export) if __name__ == "__main__": register() diff --git a/io_anim_bvh/import_bvh.py b/io_anim_bvh/import_bvh.py index df733a73..e7cbd779 100644 --- a/io_anim_bvh/import_bvh.py +++ b/io_anim_bvh/import_bvh.py @@ -319,8 +319,8 @@ def bvh_node_dict2objects(context, bvh_name, bvh_nodes, rotate_mode='NATIVE', fr obj.select = True # nicer drawing. - obj.empty_draw_type = 'CUBE' - obj.empty_draw_size = 0.1 + obj.empty_display_type = 'CUBE' + obj.empty_display_size = 0.1 return obj diff --git a/io_anim_c3d/__init__.py b/io_anim_c3d/__init__.py index 2c9cd0d6..e14fcaec 100644 --- a/io_anim_c3d/__init__.py +++ b/io_anim_c3d/__init__.py @@ -272,7 +272,7 @@ class C3DImporter(bpy.types.Operator): unames[name] = o.name bpy.ops.transform.resize(value=empty_size) o.show_name = self.properties.show_names - o.show_x_ray = self.properties.x_ray + o.show_in_front = self.properties.x_ray for name in unames.values(): bpy.context.scene.objects[name].select = True return unames @@ -291,7 +291,7 @@ class C3DImporter(bpy.types.Operator): arm = bpy.context.active_object arm.name = os.path.basename(self.properties.filepath) arm.data.show_names = self.properties.show_names - arm.show_x_ray = self.properties.x_ray + arm.show_in_front = self.properties.x_ray for idx, ml in enumerate(ms.markerLabels): name = self.properties.prefix + ml bpy.ops.armature.select_all(action='DESELECT') @@ -354,12 +354,12 @@ def menu_func(self, context): def register(): bpy.utils.register_module(__name__) - bpy.types.INFO_MT_file_import.append(menu_func) + bpy.types.TOPBAR_MT_file_import.append(menu_func) def unregister(): bpy.utils.unregister_module(__name__) - bpy.types.INFO_MT_file_import.remove(menu_func) + bpy.types.TOPBAR_MT_file_import.remove(menu_func) if __name__ == "__main__": diff --git a/io_anim_camera.py b/io_anim_camera.py index 20cb5395..dff68096 100644 --- a/io_anim_camera.py +++ b/io_anim_camera.py @@ -45,7 +45,7 @@ def write_cameras(context, filepath, frame_start, frame_end, only_selected=False 'dof_distance', 'clip_start', 'clip_end', - 'draw_size', + 'display_size', ) obj_attrs = ( @@ -167,13 +167,13 @@ def menu_export(self, context): def register(): bpy.utils.register_module(__name__) - bpy.types.INFO_MT_file_export.append(menu_export) + bpy.types.TOPBAR_MT_file_export.append(menu_export) def unregister(): bpy.utils.unregister_module(__name__) - bpy.types.INFO_MT_file_export.remove(menu_export) + bpy.types.TOPBAR_MT_file_export.remove(menu_export) if __name__ == "__main__": diff --git a/io_anim_nuke_chan/__init__.py b/io_anim_nuke_chan/__init__.py index b3102329..9266c439 100644 --- a/io_anim_nuke_chan/__init__.py +++ b/io_anim_nuke_chan/__init__.py @@ -143,15 +143,15 @@ def menu_func_export(self, context): def register(): bpy.utils.register_class(ImportChan) bpy.utils.register_class(ExportChan) - bpy.types.INFO_MT_file_import.append(menu_func_import) - bpy.types.INFO_MT_file_export.append(menu_func_export) + bpy.types.TOPBAR_MT_file_import.append(menu_func_import) + bpy.types.TOPBAR_MT_file_export.append(menu_func_export) def unregister(): bpy.utils.unregister_class(ImportChan) bpy.utils.unregister_class(ExportChan) - bpy.types.INFO_MT_file_import.remove(menu_func_import) - bpy.types.INFO_MT_file_export.remove(menu_func_export) + bpy.types.TOPBAR_MT_file_import.remove(menu_func_import) + bpy.types.TOPBAR_MT_file_export.remove(menu_func_export) if __name__ == "__main__": diff --git a/io_blend_utils/__init__.py b/io_blend_utils/__init__.py index d44d4754..9d102102 100644 --- a/io_blend_utils/__init__.py +++ b/io_blend_utils/__init__.py @@ -135,14 +135,14 @@ def register(): for cls in classes: bpy.utils.register_class(cls) - bpy.types.INFO_MT_file_external_data.append(menu_func) + bpy.types.TOPBAR_MT_file_external_data.append(menu_func) def unregister(): for cls in classes: bpy.utils.unregister_class(cls) - bpy.types.INFO_MT_file_external_data.remove(menu_func) + bpy.types.TOPBAR_MT_file_external_data.remove(menu_func) if __name__ == "__main__": diff --git a/io_coat3D/__init__.py b/io_coat3D/__init__.py index b5539ede..ba56d653 100644 --- a/io_coat3D/__init__.py +++ b/io_coat3D/__init__.py @@ -19,8 +19,8 @@ bl_info = { "name": "3D-Coat Applink", "author": "Kalle-Samuli Riihikoski (haikalle)", - "version": (3, 5, 22), - "blender": (2, 59, 0), + "version": (5, 0, 00), + "blender": (2, 80, 0), "location": "Scene > 3D-Coat Applink", "description": "Transfer data between 3D-Coat/Blender", "warning": "", @@ -35,10 +35,16 @@ if "bpy" in locals(): importlib.reload(coat) importlib.reload(tex) else: - from . import coat from . import tex +from io_coat3D import tex +import os +import ntpath +import re + +import time import bpy +import subprocess from bpy.types import PropertyGroup from bpy.props import ( BoolProperty, @@ -49,244 +55,1100 @@ from bpy.props import ( ) +bpy.coat3D = dict() +bpy.coat3D['active_coat'] = '' +bpy.coat3D['status'] = 0 + +def folder_size(path): + + tosi = True + while tosi: + list_of_files = [] + for file in os.listdir(path): + list_of_files.append(path + os.sep + file) + + if len(list_of_files) >= 400: + oldest_file = min(list_of_files, key=os.path.getctime) + os.remove(os.path.abspath(oldest_file)) + else: + tosi = False + +def set_exchange_folder(): + platform = os.sys.platform + coat3D = bpy.context.scene.coat3D + Blender_export = "" + + if(platform == 'win32'): + exchange = os.path.expanduser("~") + os.sep + 'Documents' + os.sep + '3D-CoatV4' + os.sep +'Exchange' + if not(os.path.isdir(exchange)): + exchange = os.path.expanduser("~") + os.sep + 'Documents' + os.sep + '3D-CoatV3' + os.sep +'Exchange' + else: + exchange = os.path.expanduser("~") + os.sep + '3D-CoatV4' + os.sep + 'Exchange' + if not(os.path.isdir(exchange)): + exchange = os.path.expanduser("~") + os.sep + '3D-CoatV3' + os.sep + 'Exchange' + if(not(os.path.isdir(exchange))): + exchange = coat3D.exchangedir + + if(os.path.isdir(exchange)): + bpy.coat3D['status'] = 1 + if(platform == 'win32'): + exchange_path = os.path.expanduser("~") + os.sep + 'Documents' + os.sep + '3DC2Blender' + os.sep + 'Exchange_folder.txt' + applink_folder = os.path.expanduser("~") + os.sep + 'Documents' + os.sep + '3DC2Blender' + if(not(os.path.isdir(applink_folder))): + os.makedirs(applink_folder) + else: + exchange_path = os.path.expanduser("~") + os.sep + 'Documents' + os.sep + '3DC2Blender' + os.sep + 'Exchange_folder.txt' + applink_folder = os.path.expanduser("~") + os.sep + 'Documents' + os.sep + '3DC2Blender' + if(not(os.path.isdir(applink_folder))): + os.makedirs(applink_folder) + file = open(exchange_path, "w") + file.write("%s"%(coat3D.exchangedir)) + file.close() + + else: + if(platform == 'win32'): + exchange_path = os.path.expanduser("~") + os.sep + 'Documents' + os.sep + '3DC2Blender' + os.sep + 'Exchange_folder.txt' + else: + exchange_path = os.path.expanduser("~") + os.sep + '3DC2Blender' + os.sep + 'Exchange_folder.txt' + if(os.path.isfile(exchange_path)): + ex_path ='' + + ex_pathh = open(exchange_path) + for line in ex_pathh: + ex_path = line + break + ex_pathh.close() + + if(os.path.isdir(ex_path) and ex_path.rfind('Exchange') >= 0): + exchange = ex_path + bpy.coat3D['status'] = 1 + else: + bpy.coat3D['status'] = 0 + else: + bpy.coat3D['status'] = 0 + if(bpy.coat3D['status'] == 1): + Blender_folder = ("%s%sBlender"%(exchange,os.sep)) + Blender_export = Blender_folder + path3b_now = exchange + path3b_now += ('last_saved_3b_file.txt') + Blender_export += ('%sexport.txt'%(os.sep)) + + if(not(os.path.isdir(Blender_folder))): + os.makedirs(Blender_folder) + Blender_folder = os.path.join(Blender_folder,"run.txt") + file = open(Blender_folder, "w") + file.close() + return exchange + +def set_working_folders(): + platform = os.sys.platform + coat3D = bpy.context.scene.coat3D + if(platform == 'win32'): + folder_objects = os.path.expanduser("~") + os.sep + 'Documents' + os.sep + '3DC2Blender' + os.sep + 'ApplinkObjects' + if(not(os.path.isdir(folder_objects))): + os.makedirs(folder_objects) + else: + folder_objects = os.path.expanduser("~") + os.sep + '3DC2Blender' + os.sep + 'ApplinkObjects' + if(not(os.path.isdir(folder_objects))): + os.makedirs(folder_objects) + + return folder_objects + +def make_texture_list(texturefolder): + texturefolder += ('%stextures.txt'%(os.sep)) + texturelist = [] + + if (os.path.isfile(texturefolder)): + texturefile = open(texturefolder) + index = 0 + for line in texturefile: + if line != '' and index == 0: + objekti = line + index += 1 + elif index == 1: + material = line + index += 1 + elif index == 2: + type = line + index += 1 + elif index == 3: + address = line + texturelist.append([objekti,material,type,address]) + index = 0 + texturefile.close() + return texturelist + + +''' +#Updating objects MESH part ( Mesh, Vertex Groups, Vertex Colors ) +''' + +def updatemesh(objekti, proxy): + + + #TO DO VERTEX GROUPS, gives an error with this code. + + if(objekti.vertex_groups.keys() != []): + bpy.ops.object.select_all(action='DESELECT') + proxy.select_set('SELECT') + objekti.select_set('SELECT') + bpy.ops.object.vertex_group_copy_to_selected() + bpy.ops.object.select_all(action='DESELECT') + + + + + # UV Set Copy + + proxy.select_set('SELECT') + objekti.select_set('SELECT') + + if len(objekti.data.uv_layers) > 1: + obj_uv_index = objekti.data.uv_layers.active_index + index = 0 + for uv_layer in objekti.data.uv_layers: + if (uv_layer != objekti.data.uv_layers[0]): + proxy.data.uv_layers.new(uv_layer.name) + proxy.data.uv_layers.active_index = index + objekti.data.uv_layers.active_index = index + bpy.ops.object.join_uvs() + index += 1 + proxy.data.uv_layers.active_index = obj_uv_index + + bpy.ops.object.select_all(action='DESELECT') + + #Mesh Copy + + proxy.select_set('SELECT') + obj_data = objekti.data.id_data + objekti.data = proxy.data.id_data + objekti.data.id_data.name = obj_data.name + if (bpy.data.meshes[obj_data.name].users == 0): + bpy.data.meshes.remove(obj_data) + + + +class SCENE_PT_Main(bpy.types.Panel): + bl_label = "3D-Coat Applink" + bl_space_type = "VIEW_3D" + bl_region_type = "TOOLS" + bl_context = "objectmode" + bl_category = '3D-Coat' + bl_options = {'DEFAULT_CLOSED'} + + def draw(self, context): + layout = self.layout + coat3D = bpy.context.scene.coat3D + if(bpy.context.active_object): + coa = bpy.context.active_object.coat3D + + if(coat3D.exchange_found == False): + bpy.coat3D['active_coat'] = set_exchange_folder() + row = layout.row() + row.label(text="Applink didn't find your 3d-Coat/Excahnge folder.") + row = layout.row() + row.label("Please select it before using Applink.") + row = layout.row() + row.prop(coat3D,"exchangedir",text="") + row = layout.row() + row.operator("update_exchange_folder.pilgway_3d_coat", text="Apply folder") + + else: + #Here you add your GUI + row = layout.row() + row.prop(coat3D,"type",text = "") + row = layout.row() + colL = row.column() + colR = row.column() + + colR.operator("export_applink.pilgway_3d_coat", text="Transfer") + colL.operator("import_applink.pilgway_3d_coat", text="Update") + + +def running(): + n=0# number of instances of the program running + prog=[line.split() for line in subprocess.check_output("tasklist").splitlines()] + [prog.pop(e) for e in [0,1,2]] #useless + for task in prog: + if str(task[0]) == "b'3D-CoatDX64C.exe'" or str(task[0]) == "b'3D-CoatGL64C.exe'": + n+=1 + break + if n>0: + return True + else: + return False + +class SCENE_OT_folder(bpy.types.Operator): + bl_idname = "update_exchange_folder.pilgway_3d_coat" + bl_label = "Export your custom property" + bl_description = "Export your custom property" + bl_options = {'UNDO'} + + def invoke(self, context, event): + coat3D = bpy.context.scene.coat3D + print(coat3D.exchangedir) + print(os.path.isdir(coat3D.exchangedir)) + if(os.path.isdir(coat3D.exchangedir)): + coat3D.exchange_found = True + else: + coat3D.exchange_found = False + + return {'FINISHED'} + +class SCENE_OT_opencoat(bpy.types.Operator): + bl_idname = "open_3dcoat.pilgway_3d_coat" + bl_label = "Export your custom property" + bl_description = "Export your custom property" + bl_options = {'UNDO'} + + def invoke(self, context, event): + coat3D = bpy.context.selected_objects[0].coat3D.applink_3b_path + print('3b osoite on:',coat3D) + platform = os.sys.platform + prog_path = os.environ['PROGRAMFILES'] + if (platform == 'win32'): + index = 0 + for file in os.listdir(prog_path): + if index == 0: + if file.startswith('3D-Coat-V4'): + modi = os.path.getmtime(prog_path + os.sep + file) + active_3dcoat = prog_path + os.sep + file + index += 1 + else: + if file.startswith('3D-Coat-V4'): + if(os.path.getmtime(prog_path + os.sep + file) > modi): + modi = os.path.getmtime(prog_path + os.sep + file) + active_3dcoat = prog_path + os.sep + file + + print('haippaa',active_3dcoat) + if running() == False: + os.popen('"' + active_3dcoat + os.sep + '3D-CoatDX64C.exe' '" ' + coat3D) + print('C:\\Program Files\\3D-Coat-V4.8.21\\3D-CoatDX64C.exe ' + coat3D) + else: + importfile = bpy.context.scene.coat3D.exchangedir + importfile += ('%simport.txt' % (os.sep)) + file = open(importfile, "w") + file.write("%s" % (coat3D)) + file.write("\n%s" % (coat3D)) + file.write("\n[3B]") + file.close() + + ''' + If not Windows Os it will only write import.txt. Auto run 3d-coat.exe is disabled. + ''' + + else: + importfile = bpy.context.scene.coat3D.exchangedir + importfile += ('%simport.txt' % (os.sep)) + file = open(importfile, "w") + file.write("%s" % (coat3D)) + file.write("\n%s" % (coat3D)) + file.write("\n[3B]") + file.close() + + + + return {'FINISHED'} + +class SCENE_OT_export(bpy.types.Operator): + bl_idname = "export_applink.pilgway_3d_coat" + bl_label = "Export your custom property" + bl_description = "Export your custom property" + bl_options = {'UNDO'} + + def invoke(self, context, event): + + for mesh in bpy.data.meshes: + if (mesh.users == 0 and mesh.coat3D.name == '3DC'): + bpy.data.meshes.remove(mesh) + + for material in bpy.data.materials: + if (material.users == 1 and material.coat3D.name == '3DC'): + bpy.data.materials.remove(material) + + export_ok = False + coat3D = bpy.context.scene.coat3D + + if (bpy.context.selected_objects == []): + return {'FINISHED'} + else: + for objec in bpy.context.selected_objects: + if objec.type == 'MESH': + export_ok = True + if (export_ok == False): + return {'FINISHED'} + + activeobj = bpy.context.active_object.name + checkname = '' + coa = bpy.context.active_object.coat3D + coat3D.exchangedir = set_exchange_folder() + + if (not os.path.isdir(coat3D.exchangedir)): + coat3D.exchange_found = False + return {'FINISHED'} + + folder_objects = set_working_folders() + folder_size(folder_objects) + + importfile = coat3D.exchangedir + texturefile = coat3D.exchangedir + importfile += ('%simport.txt'%(os.sep)) + texturefile += ('%stextures.txt'%(os.sep)) + + looking = True + object_index = 0 + + while(looking == True): + checkname = folder_objects + os.sep + activeobj + checkname = ("%s%.2d.dae"%(checkname,object_index)) + if(os.path.isfile(checkname)): + object_index += 1 + else: + looking = False + coa.applink_name = ("%s%.2d"%(activeobj,object_index)) + coa.applink_address = checkname + + matindex = 0 + for objekti in bpy.context.selected_objects: + if(objekti.material_slots.keys() == []): + newmat = bpy.data.materials.new('Material') + objekti.data.materials.append(newmat) + matindex += 1 + + for objekti in bpy.context.selected_objects: + objekti.coat3D.applink_scale = objekti.scale + + bpy.ops.object.origin_set(type='ORIGIN_GEOMETRY') + #bpy.ops.object.transforms_to_deltas(mode='SCALE') + + + bpy.ops.wm.collada_export(filepath=coa.applink_address, selected=True, + apply_modifiers=False, sort_by_name=True, use_blender_profile=False, triangulate=False) + + file = open(importfile, "w") + file.write("%s"%(checkname)) + file.write("\n%s"%(checkname)) + file.write("\n[%s]"%(coat3D.type)) + file.close() + group_index = -1.0 + + for objekti in bpy.context.selected_objects: + nimi = '' + for koko in bpy.context.selected_objects: + nimi += koko.data.name + ':::' + objekti.coat3D.applink_group = nimi + objekti.coat3D.applink_address = coa.applink_address + objekti.coat3D.applink_name = coa.applink_name + objekti.coat3D.applink_firsttime = True + objekti.coat3D.objecttime = str(os.path.getmtime(objekti.coat3D.applink_address)) + objekti.data.coat3D.name = '3DC' + + if(objekti.material_slots.keys() != []): + for material in objekti.material_slots: + if material.material.use_nodes == True: + for node in material.material.node_tree.nodes: + if(node.name.startswith('3DC_') == True): + material.material.node_tree.nodes.remove(node) + + return {'FINISHED'} + +class SCENE_OT_import(bpy.types.Operator): + bl_idname = "import_applink.pilgway_3d_coat" + bl_label = "import your custom property" + bl_description = "import your custom property" + bl_options = {'UNDO'} + + def invoke(self, context, event): + + for mesh in bpy.data.meshes: + if(mesh.users == 0 and mesh.coat3D.name == '3DC'): + bpy.data.meshes.remove(mesh) + + for material in bpy.data.materials: + img_list = [] + if (material.users == 1 and material.coat3D.name == '3DC'): + if material.use_nodes == True: + for node in material.node_tree.nodes: + if node.type == 'TEX_IMAGE' and node.name.startswith('3DC'): + img_list.append(node.image) + if img_list != []: + for del_img in img_list: + bpy.data.images.remove(del_img) + + bpy.data.materials.remove(material) + + coat3D = bpy.context.scene.coat3D + coat = bpy.coat3D + coat3D.exchangedir = set_exchange_folder() + + texturelist = make_texture_list(coat3D.exchangedir) + for texturepath in texturelist: + for image in bpy.data.images: + if(image.filepath == texturepath[3]): + bpy.data.images.remove(image) + + Blender_folder = ("%s%sBlender"%(coat3D.exchangedir,os.sep)) + Blender_export = Blender_folder + path3b_now = coat3D.exchangedir + path3b_now += ('last_saved_3b_file.txt') + Blender_export += ('%sexport.txt'%(os.sep)) + new_applink_address = 'False' + new_object = False + if(os.path.isfile(Blender_export)): + obj_pathh = open(Blender_export) + new_object = True + for line in obj_pathh: + new_applink_address = line + break + obj_pathh.close() + + for scene_objects in bpy.context.collection.objects: + if(scene_objects.type == 'MESH'): + if(scene_objects.coat3D.applink_address == new_applink_address): + new_object = False + + exportfile = coat3D.exchangedir + exportfile += ('%sBlender' % (os.sep)) + exportfile += ('%sexport.txt' % (os.sep)) + if (os.path.isfile(exportfile)): + os.remove(exportfile) + + if(new_object == False): + + ''' + #Blender -> 3DC -> Blender workflow + #First check if objects needs to be imported, if imported it will then delete extra mat and objs. + ''' + + old_materials = bpy.data.materials.keys() + old_objects = bpy.data.objects.keys() + old_images = bpy.data.images.keys() + image_list = [] + object_list = [] + import_list = [] + mesh_del_list = [] + for objekti in bpy.context.scene.collection.all_objects: + if (objekti.type == 'MESH'): + object_list.append(objekti.name) + obj_coat = objekti.coat3D + if(obj_coat.applink_address != ''): + if (obj_coat.objecttime != str(os.path.getmtime(obj_coat.applink_address))): + obj_coat.dime = objekti.dimensions + obj_coat.import_mesh = True + obj_coat.objecttime = str(os.path.getmtime(obj_coat.applink_address)) + if(obj_coat.applink_address not in import_list): + import_list.append(obj_coat.applink_address) + if(import_list): + for list in import_list: + bpy.ops.wm.collada_import(filepath=list) + bpy.ops.object.select_all(action='DESELECT') + + new_materials = bpy.data.materials.keys() + new_objects = bpy.data.objects.keys() + new_images = bpy.data.images.keys() + + diff_mat = [i for i in new_materials if i not in old_materials] + diff_objects = [i for i in new_objects if i not in old_objects] + diff_images = [i for i in new_images if i not in old_images] + + for mark_mesh in diff_objects: + bpy.data.objects[mark_mesh].data.coat3D.name = '3DC' + for c_index in diff_mat: + bpy.data.materials.remove(bpy.data.materials[c_index]) + for i in diff_images: + bpy.data.images.remove(bpy.data.images[i]) + + '''The main Applink Object Loop''' + + for oname in object_list: + objekti = bpy.data.objects[oname] + if(objekti.coat3D.import_mesh): + objekti.coat3D.import_mesh = False + objekti.select_set('SELECT') + + if (objekti.coat3D.applink_export == False): + find_name = objekti.data.name + '-mesh' + find_name = find_name.replace('.', '_') + else: + + + new_name = objekti.data.name + name_boxs = new_name.split('.') + if len(name_boxs) > 1: + if len(name_boxs[-1]) == 3: + luku = int(name_boxs[-1]) + luku +=1 + uusi_nimi = ("%s.%.3d" % (new_name[:-4], luku)) + find_name = uusi_nimi + else: + find_name = objekti.data.name + tosi = True + luku = 1 + find_name = ("%s.%.3d" % (objekti.data.name, luku)) + loyty = False + while tosi: + for obj in bpy.data.meshes: + if (obj.name == find_name): + loyty = True + break + if(loyty == True): + luku += 1 + find_name = ("%s.%.3d" % (objekti.data.name, luku)) + loyty = False + else: + find_name = ("%s.%.3d" % (objekti.data.name, luku-1)) + tosi = False + + for proxy_objects in diff_objects: + if (bpy.data.objects[proxy_objects].data.name == find_name): + obj_proxy = bpy.data.objects[proxy_objects] + break + + exportfile = coat3D.exchangedir + path3b_n = coat3D.exchangedir + path3b_n += ('last_saved_3b_file.txt') + exportfile += ('%sBlender' % (os.sep)) + exportfile += ('%sexport.txt'%(os.sep)) + if(os.path.isfile(exportfile)): + export_file = open(exportfile) + for line in export_file: + if line.rfind('.3b'): + coat['active_coat'] = line + export_file.close() + os.remove(exportfile) + + obj_names = objekti.coat3D.applink_group + obj_list = obj_names.split(':::') + applinks = [] + mat_list = [] + obj_list.pop() + + use_smooth = objekti.data.polygons[0].use_smooth + + if(objekti.material_slots): + act_mat = objekti.active_material + for obj_mat in objekti.material_slots: + mat_list.append(obj_mat.material) + + bpy.ops.object.select_all(action='DESELECT') + obj_proxy.select_set('SELECT') + + bpy.ops.object.select_all(action='TOGGLE') + + if objekti.coat3D.applink_firsttime == True: + objekti.scale = (objekti.scale[0]/objekti.coat3D.applink_scale[0],objekti.scale[1]/objekti.coat3D.applink_scale[1],objekti.scale[2]/objekti.coat3D.applink_scale[2]) + bpy.ops.object.transforms_to_deltas(mode='SCALE') + objekti.rotation_euler = (0,0,0) + #objekti.scale = (1,1,1) + objekti.coat3D.applink_firsttime = False + + if(coat3D.importlevel): + obj_proxy.select = True + obj_proxy.modifiers.new(name='temp',type='MULTIRES') + objekti.select = True + bpy.ops.object.multires_reshape(modifier=multires_name) + bpy.ops.object.select_all(action='TOGGLE') + multires_on = False + else: + updatemesh(objekti,obj_proxy) + + #tärkee että saadaan oikein käännettyä objekt + + objekti.select_set('SELECT') + bpy.ops.object.origin_set(type='GEOMETRY_ORIGIN') + + objekti.data.materials.pop() + for mat in mat_list: + objekti.data.materials.append(mat) + + if (use_smooth): + for data_mesh in objekti.data.polygons: + data_mesh.use_smooth = True + + bpy.ops.object.select_all(action='DESELECT') + + if(os.path.isfile(path3b_n)): + path3b_fil = open(path3b_n) + for lin in path3b_fil: + objekti.coat3D.applink_3b_path = lin + head, tail = os.path.split(objekti.coat3D.applink_3b_path) + objekti.coat3D.applink_3b_just_name = tail + path3b_fil.close() + os.remove(path3b_n) + + if(coat3D.importmesh and not(os.path.isfile(objekti.coat3D.applink_address))): + coat3D.importmesh = False + + objekti.select_set('SELECT') + if(coat3D.importtextures): + is_new = False + tex.matlab(mat_list,objekti,bpy.context.scene,is_new) + objekti.select_set('DESELECT') + else: + mat_list = [] + + if (objekti.material_slots): + for obj_mat in objekti.material_slots: + mat_list.append(obj_mat.material) + + if (coat3D.importtextures): + is_new = False + tex.matlab(mat_list, objekti, bpy.context.scene, is_new) + objekti.select_set('DESELECT') + + + bpy.ops.object.select_all(action='DESELECT') + if(import_list): + for del_obj in diff_objects: + bpy.context.collection.all_objects[del_obj].select_set('SELECT') + bpy.ops.object.delete() + + #This is a hack to make textures to update propery + + for material in bpy.data.materials: + if material.use_nodes == True: + for node in material.node_tree.nodes: + if (node.name).startswith('3DC'): + node.location = node.location + else: + + ''' + 3DC -> Blender workflow + ''' + + for old_obj in bpy.context.collection.objects: + old_obj.coat3D.applink_old = True + + coat3D = bpy.context.scene.coat3D + scene = context.scene + Blender_folder = ("%s%sBlender"%(coat3D.exchangedir,os.sep)) + Blender_export = Blender_folder + path3b_now = coat3D.exchangedir + os.sep + path3b_now += ('last_saved_3b_file.txt') + Blender_export += ('%sexport.txt'%(os.sep)) + mat_list = [] + nimi = '' + osoite_3b = '' + if (os.path.isfile(path3b_now)): + path3b_fil = open(path3b_now) + for lin in path3b_fil: + osoite_3b = lin + path3b_fil.close() + head, tail = os.path.split(osoite_3b) + just_3b_name = tail + os.remove(path3b_now) + + old_materials = bpy.data.materials.keys() + old_objects = bpy.data.objects.keys() + + bpy.ops.wm.collada_import(filepath=new_applink_address) + + new_materials = bpy.data.materials.keys() + new_objects = bpy.data.objects.keys() + + diff_mat = [i for i in new_materials if i not in old_materials] + diff_objects = [i for i in new_objects if i not in old_objects] + + print('uudet materiaalit', diff_mat) + + for mark_mesh in diff_mat: + bpy.data.materials[mark_mesh].coat3D.name = '3DC' + bpy.data.materials[mark_mesh].use_fake_user = True + laskuri = 0 + for c_index in diff_objects: + bpy.data.objects[c_index].data.coat3D.name = '3DC' + bpy.data.objects[c_index].material_slots[0].material = bpy.data.materials[diff_mat[laskuri]] + print(bpy.data.materials[diff_mat[laskuri]]) + laskuri += 1 + + bpy.ops.object.select_all(action='DESELECT') + for new_obj in bpy.context.collection.objects: + + if(new_obj.coat3D.applink_old == False): + nimi += new_obj.data.name + ':::' + new_obj.select_set('SELECT') + #bpy.ops.object.origin_set(type='GEOMETRY_ORIGIN') + new_obj.rotation_euler = (0, 0, 0) + new_obj.scale = (1, 1, 1) + new_obj.coat3D.applink_firsttime = False + new_obj.select_set('DESELECT') + new_obj.coat3D.applink_address = new_applink_address + new_obj.coat3D.objecttime = str(os.path.getmtime(new_obj.coat3D.applink_address)) + splittext = ntpath.basename(new_applink_address) + new_obj.coat3D.applink_name = splittext.split('.')[0] + new_obj.coat3D.applink_export = True + print('lokaisson: ', path3b_now) + if(osoite_3b != ''): + new_obj.coat3D.applink_3b_path = osoite_3b + new_obj.coat3D.applink_3b_just_name = just_3b_name + + mat_list.append(new_obj.material_slots[0].material) + is_new = True + tex.matlab(mat_list, new_obj, bpy.context.scene, is_new) + + for new_obj in bpy.context.collection.objects: + if(new_obj.coat3D.applink_old == False): + new_obj.coat3D.applink_group = nimi + new_obj.coat3D.applink_old = True + + bpy.ops.object.select_all(action='SELECT') + bpy.ops.object.origin_set(type='ORIGIN_GEOMETRY') + bpy.ops.object.select_all(action='DESELECT') + if (os.path.isfile(Blender_export)): + os.remove(Blender_export) + for material in bpy.data.materials: + if material.use_nodes == True: + for node in material.node_tree.nodes: + if (node.name).startswith('3DC'): + node.location = node.location + + return {'FINISHED'} + +from bpy import * +from mathutils import Vector, Matrix + +# 3D-Coat Dynamic Menu +class VIEW3D_MT_Coat_Dynamic_Menu(bpy.types.Menu): + bl_label = "3D-Coat Applink Menu" + + def draw(self, context): + layout = self.layout + + layout.operator_context = 'INVOKE_REGION_WIN' + + ob = context + if ob.mode == 'OBJECT': + if(len(context.selected_objects) > 0): + layout.operator("import_applink.pilgway_3d_coat", text="Update Scene") + layout.separator() + + layout.operator("export_applink.pilgway_3d_coat", text="Transfer selected object(s) into 3D-Coat") + layout.separator() + if(context.selected_objects[0].coat3D.applink_3b_path != ''): + layout.operator("open_3dcoat.pilgway_3d_coat", text="Open " +context.selected_objects[0].coat3D.applink_3b_just_name) + layout.separator() + + else: + layout.operator("import_applink.pilgway_3d_coat", text="Update Scene") + layout.separator() + +class VIEW3D_MT_ImportMenu(bpy.types.Menu): + bl_label = "Import Settings" + + def draw(self, context): + layout = self.layout + coat3D = bpy.context.scene.coat3D + settings = context.tool_settings + layout.operator_context = 'INVOKE_REGION_WIN' + layout.prop(coat3D,"importmesh") + layout.prop(coat3D,"importmod") + layout.prop(coat3D,"smooth_on") + layout.prop(coat3D,"importtextures") + +class VIEW3D_MT_ExportMenu(bpy.types.Menu): + bl_label = "Export Settings" + + def draw(self, context): + layout = self.layout + coat3D = bpy.context.scene.coat3D + settings = context.tool_settings + + layout.operator_context = 'INVOKE_REGION_WIN' + layout.operator("view3d.copybuffer", icon="COPY_ID") + + layout.prop(coat3D,"exportover") + if(coat3D.exportover): + layout.prop(coat3D,"exportmod") + +class VIEW3D_MT_ExtraMenu(bpy.types.Menu): + bl_label = "Extra" + + def draw(self, context): + layout = self.layout + coat3D = bpy.context.scene.coat3D + settings = context.tool_settings + layout.operator_context = 'INVOKE_REGION_WIN' + + layout.operator("import_applink.pilgway_3d_deltex",text="Delete all Textures") + layout.separator() + +class ObjectCoat3D(PropertyGroup): + objpath: StringProperty( + name="Object_Path" + ) + applink_address: StringProperty( + name="Object_Applink_address" + ) + applink_3b_path: StringProperty( + name="Object_3B_Path" + ) + applink_name: StringProperty( + name="Applink object name" + ) + applink_3b_just_name: StringProperty( + name="Applink object name" + ) + applink_group: StringProperty( + name="Applink group" + ) + applink_firsttime: BoolProperty( + name="FirstTime", + description="FirstTime", + default=True + ) + import_mesh: BoolProperty( + name="ImportMesh", + description="ImportMesh", + default=False + ) + applink_old: BoolProperty( + name="OldObject", + description="Old Object", + default=False + ) + applink_export: BoolProperty( + name="FirstTime", + description="Object is from 3d-ocat", + default=False + ) + objecttime: StringProperty( + name="ObjectTime", + subtype="FILE_PATH" + ) + path3b: StringProperty( + name="3B Path", + subtype="FILE_PATH" + ) + dime: FloatVectorProperty( + name="dime", + description="Dimension" + ) + applink_scale: FloatVectorProperty( + name="Scale", + description="Scale" + ) + +class SceneCoat3D(PropertyGroup): + defaultfolder: StringProperty( + name="FilePath", + subtype="DIR_PATH", + ) + cursor_loc: FloatVectorProperty( + name="Cursor_loc", + description="location" + ) + exchangedir: StringProperty( + name="FilePath", + subtype="DIR_PATH" + ) + exchangefolder: StringProperty( + name="FilePath", + subtype="DIR_PATH" + ) + wasactive: StringProperty( + name="Pass active object", + ) + import_box: BoolProperty( + name="Import window", + description="Allows to skip import dialog", + default=True + ) + exchange_found: BoolProperty( + name="Exchange Found", + description="Alert if Exchange folder is not found", + default=True + ) + export_box: BoolProperty( + name="Export window", + description="Allows to skip export dialog", + default=True + ) + export_color: BoolProperty( + name="Export color", + description="Export color texture", + default=True + ) + export_spec: BoolProperty( + name="Export specular", + description="Export specular texture", + default=True + ) + export_normal: BoolProperty( + name="Export Normal", + description="Export normal texture", + default=True + ) + export_disp: BoolProperty( + name="Export Displacement", + description="Export displacement texture", + default=True + ) + export_position: BoolProperty( + name="Export Source Position", + description="Export source position", + default=True + ) + export_zero_layer: BoolProperty( + name="Export from Layer 0", + description="Export mesh from Layer 0", + default=True + ) + export_coarse: BoolProperty( + name="Export Coarse", + description="Export Coarse", + default=True + ) + exportfile: BoolProperty( + name="No Import File", + description="Add Modifiers and export", + default=False + ) + importmod: BoolProperty( + name="Remove Modifiers", + description="Import and add modifiers", + default=False + ) + exportmod: BoolProperty( + name="Modifiers", + description="Export modifiers", + default=False + ) + export_pos: BoolProperty( + name="Remember Position", + description="Remember position", + default=True + ) + importtextures: BoolProperty( + name="Bring Textures", + description="Import Textures", + default=True + ) + importlevel: BoolProperty( + name="Multires. Level", + description="Bring Specific Multires Level", + default=False + ) + exportover: BoolProperty( + name="Export Obj", + description="Import Textures", + default=False + ) + importmesh: BoolProperty( + name="Mesh", + description="Import Mesh", + default=True + ) + + # copy location + + loca: FloatVectorProperty( + name="location", + description="Location", + subtype="XYZ", + default=(0.0, 0.0, 0.0) + ) + rota: FloatVectorProperty( + name="location", + description="Location", + subtype="EULER", + default=(0.0, 0.0, 0.0) + ) + scal: FloatVectorProperty( + name="location", + description="Location", + subtype="XYZ", + default=(0.0, 0.0, 0.0) + ) + dime: FloatVectorProperty( + name="dimension", + description="Dimension", + subtype="XYZ", + default=(0.0, 0.0, 0.0) + ) + type: EnumProperty( + name="Export Type", + description="Different Export Types", + items=(("ppp", "Per-Pixel Painting", ""), + ("mv", "Microvertex Painting", ""), + ("ptex", "Ptex Painting", ""), + ("uv", "UV-Mapping", ""), + ("ref", "Reference Mesh", ""), + ("retopo", "Retopo mesh as new layer", ""), + ("vox", "Mesh As Voxel Object", ""), + ("alpha", "Mesh As New Pen Alpha", ""), + ("prim", "Mesh As Voxel Primitive", ""), + ("curv", "Mesh As a Curve Profile", ""), + ("autopo", "Mesh For Auto-retopology", ""), + ), + default="ppp" + ) +class MeshCoat3D(PropertyGroup): + applink_address: StringProperty( + name="ApplinkAddress", + subtype="APPLINK_ADDRESS", + ) +class MaterialCoat3D(PropertyGroup): + name: StringProperty( + name="ApplinkAddress", + subtype="APPLINK_ADDRESS", + ) + +classes = ( + #ObjectButtonsPanel, + SCENE_PT_Main, + SCENE_OT_folder, + SCENE_OT_opencoat, + SCENE_OT_export, + SCENE_OT_import, + VIEW3D_MT_Coat_Dynamic_Menu, + #VIEW3D_MT_ImportMenu, + #VIEW3D_MT_ExportMenu, + #VIEW3D_MT_ExtraMenu, + ObjectCoat3D, + SceneCoat3D, + MeshCoat3D, + MaterialCoat3D, + ) + def register(): bpy.coat3D = dict() bpy.coat3D['active_coat'] = '' bpy.coat3D['status'] = 0 bpy.coat3D['kuva'] = 1 - class ObjectCoat3D(PropertyGroup): - objpath = StringProperty( - name="Object_Path" - ) - applink_name = StringProperty( - name="Object_Applink_name" - ) - coatpath = StringProperty( - name="Coat_Path" - ) - objectdir = StringProperty( - name="ObjectPath", - subtype="FILE_PATH" - ) - objecttime = StringProperty( - name="ObjectTime", - subtype="FILE_PATH" - ) - texturefolder = StringProperty( - name="Texture folder:", - subtype="DIR_PATH" - ) - path3b = StringProperty( - name="3B Path", - subtype="FILE_PATH" - ) - export_on = BoolProperty( - name="Export_On", - description="Add Modifiers and export", - default=False - ) - dime = FloatVectorProperty( - name="dime", - description="Dimension" - ) - loc = FloatVectorProperty( - name="Location", - description="Location" - ) - rot = FloatVectorProperty( - name="Rotation", - description="Rotation", - subtype='EULER' - ) - sca = FloatVectorProperty( - name="Scale", - description="Scale" - ) - - class SceneCoat3D(PropertyGroup): - defaultfolder = StringProperty( - name="FilePath", - subtype="DIR_PATH", - ) - cursor_loc = FloatVectorProperty( - name="Cursor_loc", - description="location" - ) - exchangedir = StringProperty( - name="FilePath", - subtype="DIR_PATH" - ) - exchangefolder = StringProperty( - name="FilePath", - subtype="DIR_PATH" - ) - wasactive = StringProperty( - name="Pass active object", - ) - import_box = BoolProperty( - name="Import window", - description="Allows to skip import dialog", - default=True - ) - exchange_found = BoolProperty( - name="Exchange Found", - description="Alert if Exchange folder is not found", - default=True - ) - export_box = BoolProperty( - name="Export window", - description="Allows to skip export dialog", - default=True - ) - export_color = BoolProperty( - name="Export color", - description="Export color texture", - default=True - ) - export_spec = BoolProperty( - name="Export specular", - description="Export specular texture", - default=True - ) - export_normal = BoolProperty( - name="Export Normal", - description="Export normal texture", - default=True - ) - export_disp = BoolProperty( - name="Export Displacement", - description="Export displacement texture", - default=True - ) - export_position = BoolProperty( - name="Export Source Position", - description="Export source position", - default=True - ) - export_zero_layer = BoolProperty( - name="Export from Layer 0", - description="Export mesh from Layer 0", - default=True - ) - export_coarse = BoolProperty( - name="Export Coarse", - description="Export Coarse", - default=True - ) - exportfile = BoolProperty( - name="No Import File", - description="Add Modifiers and export", - default=False - ) - importmod = BoolProperty( - name="Remove Modifiers", - description="Import and add modifiers", - default=False - ) - exportmod = BoolProperty( - name="Modifiers", - description="Export modifiers", - default=False - ) - export_pos = BoolProperty( - name="Remember Position", - description="Remember position", - default=True - ) - importtextures = BoolProperty( - name="Bring Textures", - description="Import Textures", - default=True - ) - importlevel = BoolProperty( - name="Multires. Level", - description="Bring Specific Multires Level", - default=False - ) - exportover = BoolProperty( - name="Export Obj", - description="Import Textures", - default=False - ) - importmesh = BoolProperty( - name="Mesh", - description="Import Mesh", - default=True - ) - - # copy location - cursor = FloatVectorProperty( - name="Cursor", - description="Location", - subtype="XYZ", - default=(0.0, 0.0, 0.0) - ) - loca = FloatVectorProperty( - name="location", - description="Location", - subtype="XYZ", - default=(0.0, 0.0, 0.0) - ) - rota = FloatVectorProperty( - name="location", - description="Location", - subtype="EULER", - default=(0.0, 0.0, 0.0) - ) - scal = FloatVectorProperty( - name="location", - description="Location", - subtype="XYZ", - default=(0.0, 0.0, 0.0) - ) - dime = FloatVectorProperty( - name="dimension", - description="Dimension", - subtype="XYZ", - default=(0.0, 0.0, 0.0) - ) - type = EnumProperty( - name="Export Type", - description="Different Export Types", - items=(("ppp", "Per-Pixel Painting", ""), - ("mv", "Microvertex Painting", ""), - ("ptex", "Ptex Painting", ""), - ("uv", "UV-Mapping", ""), - ("ref", "Reference Mesh", ""), - ("retopo", "Retopo mesh as new layer", ""), - ("vox", "Mesh As Voxel Object", ""), - ("alpha", "Mesh As New Pen Alpha", ""), - ("prim", "Mesh As Voxel Primitive", ""), - ("curv", "Mesh As a Curve Profile", ""), - ("autopo", "Mesh For Auto-retopology", ""), - ), - default="ppp" - ) - - bpy.utils.register_module(__name__) - - bpy.types.Object.coat3D = PointerProperty( - name="Applink Variables", - type=ObjectCoat3D, - description="Applink variables" - ) - bpy.types.Scene.coat3D = PointerProperty( - name="Applink Variables", - type=SceneCoat3D, - description="Applink variables" - ) + from bpy.utils import register_class + for cls in classes: + register_class(cls) + bpy.types.Object.coat3D = PointerProperty(type=ObjectCoat3D) + bpy.types.Scene.coat3D = PointerProperty(type=SceneCoat3D) + bpy.types.Mesh.coat3D = PointerProperty(type=MeshCoat3D) + bpy.types.Material.coat3D = PointerProperty(type=MaterialCoat3D) + + kc = bpy.context.window_manager.keyconfigs.addon + + if kc: + km = kc.keymaps.new(name="Object Mode") + kmi = km.keymap_items.new('wm.call_menu', 'Q', 'PRESS') + kmi.properties.name = "VIEW3D_MT_Coat_Dynamic_Menu" def unregister(): + import bpy + from bpy.utils import unregister_class del bpy.types.Object.coat3D del bpy.types.Scene.coat3D + del bpy.types.Mesh.coat3D del bpy.coat3D - bpy.utils.unregister_module(__name__) - + kc = bpy.context.window_manager.keyconfigs.addon + if kc: + km = kc.keymaps.get('Object Mode') + for kmi in km.keymap_items: + if kmi.idname == 'wm.call_menu': + if kmi.properties.name == "VIEW3D_MT_Coat_Dynamic_Menu": + km.keymap_items.remove(kmi) -if __name__ == "__main__": - register() + for cls in reversed(classes): + unregister_class(cls) diff --git a/io_coat3D/coat.py b/io_coat3D/coat.py deleted file mode 100644 index fc3cb747..00000000 --- a/io_coat3D/coat.py +++ /dev/null @@ -1,626 +0,0 @@ -# ***** 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 LICENCE BLOCK ***** - -import bpy -from bpy.props import * -from io_coat3D import tex -import os - - -bpy.coat3D = dict() -bpy.coat3D['active_coat'] = '' -bpy.coat3D['status'] = 0 -def set_exchange_folder(): - platform = os.sys.platform - coat3D = bpy.context.scene.coat3D - Blender_export = "" - - if(platform == 'win32'): - exchange = os.path.expanduser("~") + os.sep + 'Documents' + os.sep + '3D-CoatV4' + os.sep +'Exchange' - if not(os.path.isdir(exchange)): - exchange = os.path.expanduser("~") + os.sep + 'Documents' + os.sep + '3D-CoatV3' + os.sep +'Exchange' - else: - exchange = os.path.expanduser("~") + os.sep + '3D-CoatV4' + os.sep + 'Exchange' - if not(os.path.isdir(exchange)): - exchange = os.path.expanduser("~") + os.sep + '3D-CoatV3' + os.sep + 'Exchange' - if(not(os.path.isdir(exchange))): - exchange = coat3D.exchangedir - - if(os.path.isdir(exchange)): - bpy.coat3D['status'] = 1 - if(platform == 'win32'): - exchange_path = os.path.expanduser("~") + os.sep + 'Documents' + os.sep + '3DC2Blender' + os.sep + 'Exchange_folder.txt' - applink_folder = os.path.expanduser("~") + os.sep + 'Documents' + os.sep + '3DC2Blender' - if(not(os.path.isdir(applink_folder))): - os.makedirs(applink_folder) - else: - exchange_path = os.path.expanduser("~") + os.sep + 'Documents' + os.sep + '3DC2Blender' + os.sep + 'Exchange_folder.txt' - applink_folder = os.path.expanduser("~") + os.sep + 'Documents' + os.sep + '3DC2Blender' - if(not(os.path.isdir(applink_folder))): - os.makedirs(applink_folder) - file = open(exchange_path, "w") - file.write("%s"%(coat3D.exchangedir)) - file.close() - - else: - if(platform == 'win32'): - exchange_path = os.path.expanduser("~") + os.sep + 'Documents' + os.sep + '3DC2Blender' + os.sep + 'Exchange_folder.txt' - else: - exchange_path = os.path.expanduser("~") + os.sep + '3DC2Blender' + os.sep + 'Exchange_folder.txt' - if(os.path.isfile(exchange_path)): - ex_path ='' - - ex_pathh = open(exchange_path) - for line in ex_pathh: - ex_path = line - break - ex_pathh.close() - - if(os.path.isdir(ex_path) and ex_path.rfind('Exchange') >= 0): - exchange = ex_path - bpy.coat3D['status'] = 1 - else: - bpy.coat3D['status'] = 0 - else: - bpy.coat3D['status'] = 0 - if(bpy.coat3D['status'] == 1): - Blender_folder = ("%s%sBlender"%(exchange,os.sep)) - Blender_export = Blender_folder - path3b_now = exchange - path3b_now += ('last_saved_3b_file.txt') - Blender_export += ('%sexport.txt'%(os.sep)) - - if(not(os.path.isdir(Blender_folder))): - os.makedirs(Blender_folder) - Blender_folder = os.path.join(Blender_folder,"run.txt") - file = open(Blender_folder, "w") - file.close() - return exchange - -def set_working_folders(): - platform = os.sys.platform - coat3D = bpy.context.scene.coat3D - if(platform == 'win32'): - folder_objects = os.path.expanduser("~") + os.sep + 'Documents' + os.sep + '3DC2Blender' + os.sep + 'Objects' - folder_textures = os.path.expanduser("~") + os.sep + 'Documents' + os.sep + '3DC2Blender' + os.sep + 'Textures' + os.sep - if(not(os.path.isdir(folder_objects))): - os.makedirs(folder_objects) - if(not(os.path.isdir(folder_textures))): - os.makedirs(folder_textures) - else: - folder_objects = os.path.expanduser("~") + os.sep + '3DC2Blender' + os.sep + 'Objects' - folder_textures = os.path.expanduser("~") + os.sep + '3DC2Blender' + os.sep + 'Textures' + os.sep - if(not(os.path.isdir(folder_objects))): - os.makedirs(folder_objects) - if(not(os.path.isdir(folder_textures))): - os.makedirs(folder_textures) - - - return folder_objects,folder_textures - -class ObjectButtonsPanel(): - bl_space_type = 'PROPERTIES' - bl_region_type = 'WINDOW' - bl_context = "object" - -class SCENE_PT_Main(ObjectButtonsPanel,bpy.types.Panel): - bl_label = "3D-Coat Applink" - bl_space_type = "PROPERTIES" - bl_region_type = "WINDOW" - bl_context = "scene" - - def draw(self, context): - layout = self.layout - scene = context.scene - me = context.scene.objects - mat_list = [] - import_no = 0 - coat = bpy.coat3D - coat3D = bpy.context.scene.coat3D - if(bpy.context.scene.objects.active): - coa = bpy.context.scene.objects.active.coat3D - - - if(bpy.coat3D['status'] == 0 and not(os.path.isdir(coat3D.exchangedir))): - bpy.coat3D['active_coat'] = set_exchange_folder() - row = layout.row() - row.label(text="Applink didn't find your 3d-Coat/Excahnge folder.") - row = layout.row() - row.label("Please select it before using Applink.") - row = layout.row() - row.prop(coat3D,"exchangedir",text="") - - else: - - - #Here you add your GUI - row = layout.row() - row.prop(coat3D,"type",text = "") - row = layout.row() - colL = row.column() - colR = row.column() - - colR.operator("export_applink.pilgway_3d_coat", text="Transfer") - - colL.operator("import_applink.pilgway_3d_coat", text="Update") - - - - - - - - - - -class SCENE_OT_export(bpy.types.Operator): - bl_idname = "export_applink.pilgway_3d_coat" - bl_label = "Export your custom property" - bl_description = "Export your custom property" - bl_options = {'UNDO'} - - def invoke(self, context, event): - checkname = '' - coat3D = bpy.context.scene.coat3D - scene = context.scene - activeobj = bpy.context.active_object.name - obj = scene.objects[activeobj] - coa = bpy.context.scene.objects.active.coat3D - coat3D.exchangedir = set_exchange_folder() - export_ok = False - - folder_objects,folder_textures = set_working_folders() - - if(coat3D.exchange_found == False): - return {'FINISHED'} - - if(bpy.context.selected_objects == []): - return {'FINISHED'} - else: - for objec in bpy.context.selected_objects: - if objec.type == 'MESH': - export_ok = True - if(export_ok == False): - return {'FINISHED'} - - importfile = coat3D.exchangedir - texturefile = coat3D.exchangedir - importfile += ('%simport.txt'%(os.sep)) - texturefile += ('%stextures.txt'%(os.sep)) - - looking = True - object_index = 0 - if(coa.applink_name and os.path.isfile(coa.applink_name)): - checkname = coa.applink_name - - else: - while(looking == True): - checkname = folder_objects + os.sep + activeobj - checkname = ("%s%.2d.obj"%(checkname,object_index)) - if(os.path.isfile(checkname)): - object_index += 1 - else: - looking = False - coa.applink_name = checkname - - - coat3D.cursor_loc = obj.location - coat3D.cursor_orginal = bpy.context.scene.cursor_location - - - - coa.loc = obj.location - coa.rot = obj.rotation_euler - coa.sca = obj.scale - coa.dime = obj.dimensions - - obj.location = (0,0,0) - obj.rotation_euler = (0,0,0) - bpy.ops.object.transform_apply(scale=True) - - bpy.ops.export_scene.obj(filepath=coa.applink_name,use_selection=True, - use_mesh_modifiers=False,use_blen_objects=True, use_materials = True, - keep_vertex_order = True,axis_forward='-Z',axis_up='Y') - - obj.location = coa.loc - obj.rotation_euler = coa.rot - - - bpy.context.scene.cursor_location = coat3D.cursor_loc - bpy.context.scene.cursor_location = coat3D.cursor_orginal - - file = open(importfile, "w") - file.write("%s"%(checkname)) - file.write("\n%s"%(checkname)) - file.write("\n[%s]"%(coat3D.type)) - file.write("\n[TexOutput:%s]"%(folder_textures)) - file.close() - - coa.objecttime = str(os.path.getmtime(coa.applink_name)) - - - - return {'FINISHED'} - -class SCENE_OT_import(bpy.types.Operator): - bl_idname = "import_applink.pilgway_3d_coat" - bl_label = "import your custom property" - bl_description = "import your custom property" - bl_options = {'UNDO'} - - def invoke(self, context, event): - scene = context.scene - coat3D = bpy.context.scene.coat3D - coat = bpy.coat3D - test = bpy.context.selected_objects - act_first = bpy.context.scene.objects.active - bpy.context.scene.game_settings.material_mode = 'GLSL' - coat3D.exchangedir = set_exchange_folder() - - folder_objects,folder_textures = set_working_folders() - - Blender_folder = ("%s%sBlender"%(coat3D.exchangedir,os.sep)) - Blender_export = Blender_folder - path3b_now = coat3D.exchangedir - path3b_now += ('last_saved_3b_file.txt') - Blender_export += ('%sexport.txt'%(os.sep)) - new_applink_name = 'False' - new_object = False - if(os.path.isfile(Blender_export)): - obj_pathh = open(Blender_export) - new_object = True - for line in obj_pathh: - new_applink_name = line - break - obj_pathh.close() - - for scene_objects in bpy.context.scene.objects: - if(scene_objects.type == 'MESH'): - if(scene_objects.coat3D.applink_name == new_applink_name): - new_object = False - - for act_name in test: - coa = act_name.coat3D - path_object = coa.applink_name - if act_name.type == 'MESH' and os.path.isfile(path_object): - multires_on = False - activeobj = act_name.name - mat_list = [] - scene.objects[activeobj].select = True - objekti = scene.objects[activeobj] - coat3D.loca = objekti.location - coat3D.rota = objekti.rotation_euler - coat3D.dime = objekti.scale - - - - #See if there is multres modifier. - for modifiers in objekti.modifiers: - if modifiers.type == 'MULTIRES' and (modifiers.total_levels > 0): - if(not(coat3D.importlevel)): - bpy.ops.object.multires_external_pack() - multires = coat3D.exchangedir - multires += ('%stemp.btx'%(os.sep)) - bpy.ops.object.multires_external_save(filepath=multires) - #bpy.ops.object.multires_external_pack() - multires_on = True - multires_name = modifiers.name - break - - exportfile = coat3D.exchangedir - path3b_n = coat3D.exchangedir - path3b_n += ('last_saved_3b_file.txt') - exportfile += ('%sexport.txt'%(os.sep)) - if(os.path.isfile(exportfile)): - export_file = open(exportfile) - for line in export_file: - if line.rfind('.3b'): - objekti.coat3D.coatpath = line - coat['active_coat'] = line - export_file.close() - os.remove(exportfile) - - if(len(objekti.material_slots) == 0): - delete_material = False - else: - delete_material = True - - - if(not(objekti.active_material) and objekti.material_slots): - act_mat_index = objekti.active_material_index - materials_old = bpy.data.materials.keys() - bpy.ops.material.new() - materials_new = bpy.data.materials.keys() - new_ma = list(set(materials_new).difference(set(materials_old))) - new_mat = new_ma[0] - ki = bpy.data.materials[new_mat] - objekti.material_slots[act_mat_index].material = ki - - - - if(os.path.isfile(path_object) and (coa.objecttime != str(os.path.getmtime(path_object)))): - - if(objekti.material_slots): - act_mat_index = objekti.active_material_index - for obj_mat in objekti.material_slots: - mat_list.append(obj_mat.material) - - coa.dime = objekti.dimensions - coa.objecttime = str(os.path.getmtime(path_object)) - mtl = coa.applink_name - mtl = mtl.replace('.obj','.mtl') - if(os.path.isfile(mtl)): - os.remove(mtl) - - bpy.ops.import_scene.obj(filepath=path_object,axis_forward='-Z',axis_up='Y',use_image_search=False) - obj_proxy = scene.objects[0] - bpy.ops.object.select_all(action='TOGGLE') - obj_proxy.select = True - - - bpy.ops.object.transform_apply(rotation=True) - proxy_mat = obj_proxy.material_slots[0].material - if(delete_material): - while(list(obj_proxy.data.materials) != []): - proxy_mat = obj_proxy.material_slots[0].material - obj_proxy.data.materials.pop(0,1) - proxy_mat.user_clear() - bpy.data.materials.remove(proxy_mat) - bpy.ops.object.select_all(action='TOGGLE') - - if(coat3D.importlevel): - obj_proxy.select = True - obj_proxy.modifiers.new(name='temp',type='MULTIRES') - objekti.select = True - bpy.ops.object.multires_reshape(modifier=multires_name) - bpy.ops.object.select_all(action='TOGGLE') - multires_on = False - else: - - scene.objects.active = obj_proxy - - obj_data = objekti.data.id_data - objekti.data = obj_proxy.data.id_data - if(bpy.data.meshes[obj_data.name].users == 0): - objekti.data.id_data.name = obj_data.name - bpy.data.meshes.remove(obj_data) - - - obj_proxy.select = True - bpy.ops.object.delete() - objekti.select = True - objekti.scale = coat3D.dime - - bpy.context.scene.objects.active = objekti - - if(os.path.isfile(path3b_n)): - path3b_fil = open(path3b_n) - for lin in path3b_fil: - objekti.coat3D.path3b = lin - path3b_fil.close() - os.remove(path3b_n) - - if(coat3D.importmesh and not(os.path.isfile(path_object))): - coat3D.importmesh = False - - if(mat_list and coat3D.importmesh): - for mat_one in mat_list: - objekti.data.materials.append(mat_one) - objekti.active_material_index = act_mat_index - - if(mat_list): - for obj_mate in objekti.material_slots: - if(hasattr(obj_mate.material,'texture_slots')): - for tex_slot in obj_mate.material.texture_slots: - if(hasattr(tex_slot,'texture')): - if(tex_slot.texture.type == 'IMAGE'): - if tex_slot.texture.image is not None: - tex_slot.texture.image.reload() - - - if(coat3D.importtextures): - export = '' - tex.gettex(mat_list,objekti,scene,export) - - if(multires_on): - temp_file = coat3D.exchangedir - temp_file += ('%stemp2.btx'%(os.sep)) - if(objekti.modifiers[multires_name].levels == 0): - objekti.modifiers[multires_name].levels = 1 - bpy.ops.object.multires_external_save(filepath=temp_file) - objekti.modifiers[multires_name].filepath = multires - objekti.modifiers[multires_name].levels = 0 - - else: - bpy.ops.object.multires_external_save(filepath=temp_file) - objekti.modifiers[multires_name].filepath = multires - #bpy.ops.object.multires_external_pack() - bpy.ops.object.shade_smooth() - - - for act_name in test: - act_name.select = True - bpy.context.scene.objects.active = act_first - - if(new_object == True): - coat3D = bpy.context.scene.coat3D - scene = context.scene - - Blender_folder = ("%s%sBlender"%(coat3D.exchangedir,os.sep)) - Blender_export = Blender_folder - path3b_now = coat3D.exchangedir - path3b_now += ('last_saved_3b_file.txt') - Blender_export += ('%sexport.txt'%(os.sep)) - - - mat_list = [] - obj_path ='' - - - export = new_applink_name - mod_time = os.path.getmtime(new_applink_name) - mtl_list = new_applink_name.replace('.obj','.mtl') - if(os.path.isfile(mtl_list)): - os.remove(mtl_list) - - bpy.ops.import_scene.obj(filepath=new_applink_name,axis_forward='-Z',axis_up='Y') - bpy.ops.object.transform_apply(rotation=True) - new_obj = scene.objects[0] - new_obj.coat3D.applink_name = obj_path - scene.objects[0].coat3D.applink_name = export #objectdir muutettava - - os.remove(Blender_export) - - bpy.context.scene.objects.active = new_obj - - bpy.ops.object.shade_smooth() - - Blender_tex = ("%s%stextures.txt"%(coat3D.exchangedir,os.sep)) - mat_list.append(new_obj.material_slots[0].material) - tex.gettex(mat_list, new_obj, scene,export) - - return {'FINISHED'} - - - -from bpy import * -from mathutils import Vector, Matrix - -# 3D-Coat Dynamic Menu -class VIEW3D_MT_Coat_Dynamic_Menu(bpy.types.Menu): - bl_label = "3D-Coat Applink Menu" - - def draw(self, context): - layout = self.layout - settings = context.tool_settings - layout.operator_context = 'INVOKE_REGION_WIN' - coat3D = bpy.context.scene.coat3D - Blender_folder = ("%s%sBlender"%(coat3D.exchangedir,os.sep)) - Blender_export = Blender_folder - Blender_export += ('%sexport.txt'%(os.sep)) - - ob = context - if ob.mode == 'OBJECT': - if(bpy.context.selected_objects): - for ind_obj in bpy.context.selected_objects: - if(ind_obj.type == 'MESH'): - layout.active = True - break - layout.active = False - - if(layout.active == True): - - layout.operator("import_applink.pilgway_3d_coat", text="Import") - layout.separator() - - layout.operator("export_applink.pilgway_3d_coat", text="Export") - layout.separator() - - layout.menu("VIEW3D_MT_ImportMenu") - layout.separator() - - layout.menu("VIEW3D_MT_ExportMenu") - layout.separator() - - layout.menu("VIEW3D_MT_ExtraMenu") - layout.separator() - - if(len(bpy.context.selected_objects) == 1): - if(os.path.isfile(bpy.context.selected_objects[0].coat3D.path3b)): - layout.operator("import_applink.pilgway_3d_coat_3b", text="Load 3b") - layout.separator() - - if(os.path.isfile(Blender_export)): - - layout.operator("import3b_applink.pilgway_3d_coat", text="Bring from 3D-Coat") - layout.separator() - else: - if(os.path.isfile(Blender_export)): - layout.active = True - - layout.operator("import3b_applink.pilgway_3d_coat", text="Bring from 3D-Coat") - layout.separator() - else: - if(os.path.isfile(Blender_export)): - - - layout.operator("import3b_applink.pilgway_3d_coat", text="Bring from 3D-Coat") - layout.separator() - -class VIEW3D_MT_ImportMenu(bpy.types.Menu): - bl_label = "Import Settings" - - def draw(self, context): - layout = self.layout - coat3D = bpy.context.scene.coat3D - settings = context.tool_settings - layout.operator_context = 'INVOKE_REGION_WIN' - layout.prop(coat3D,"importmesh") - layout.prop(coat3D,"importmod") - layout.prop(coat3D,"smooth_on") - layout.prop(coat3D,"importtextures") - -class VIEW3D_MT_ExportMenu(bpy.types.Menu): - bl_label = "Export Settings" - - def draw(self, context): - layout = self.layout - coat3D = bpy.context.scene.coat3D - settings = context.tool_settings - layout.operator_context = 'INVOKE_REGION_WIN' - layout.prop(coat3D,"exportover") - if(coat3D.exportover): - layout.prop(coat3D,"exportmod") - -class VIEW3D_MT_ExtraMenu(bpy.types.Menu): - bl_label = "Extra" - - def draw(self, context): - layout = self.layout - coat3D = bpy.context.scene.coat3D - settings = context.tool_settings - layout.operator_context = 'INVOKE_REGION_WIN' - - layout.operator("import_applink.pilgway_3d_deltex",text="Delete all Textures") - layout.separator() - -def register(): - bpy.utils.register_module(__name__) - - kc = bpy.context.window_manager.keyconfigs.addon - if kc: - km = kc.keymaps.new(name='3D View', space_type='VIEW_3D') - kmi = km.keymap_items.new('wm.call_menu2', 'Q', 'PRESS') - kmi.properties.name = "VIEW3D_MT_Coat_Dynamic_Menu" - -def unregister(): - bpy.utils.unregister_module(__name__) - - kc = bpy.context.window_manager.keyconfigs.addon - if kc: - km = kc.keymapskeymaps['3D View'] - for kmi in km.keymap_items: - if kmi.idname == '': - if kmi.properties.name == "VIEW3D_MT_Coat_Dynamic_Menu": - km.keymap_items.remove(kmi) - break - - -if __name__ == "__main__": - register() diff --git a/io_coat3D/tex.py b/io_coat3D/tex.py index f532177c..733d8471 100644 --- a/io_coat3D/tex.py +++ b/io_coat3D/tex.py @@ -19,8 +19,9 @@ import bpy import os - +import re def find_index(objekti): + luku = 0 for tex in objekti.active_material.texture_slots: if(not(hasattr(tex,'texture'))): @@ -28,308 +29,131 @@ def find_index(objekti): luku = luku +1 return luku -def gettex(mat_list, objekti, scene,export): +def readtexturefolder(objekti,is_new): #read textures from texture file coat3D = bpy.context.scene.coat3D - coa = objekti.coat3D - - if(bpy.context.scene.render.engine == 'VRAY_RENDER' or bpy.context.scene.render.engine == 'VRAY_RENDER_PREVIEW'): - vray = True - else: - vray = False - - take_color = 0 - take_spec = 0 - take_normal = 0 - take_disp = 0 - - bring_color = 1 - bring_spec = 1 - bring_normal = 1 - bring_disp = 1 + obj_coat = objekti.coat3D texcoat = {} texcoat['color'] = [] - texcoat['specular'] = [] + texcoat['metalness'] = [] + texcoat['rough'] = [] texcoat['nmap'] = [] texcoat['disp'] = [] - texu = [] - if(export): - objekti.coat3D.objpath = export - nimi = os.path.split(export)[1] - osoite = os.path.dirname(export) + os.sep #pitaa ehka muuttaa - for mate in objekti.material_slots: - for tex_slot in mate.material.texture_slots: - if(hasattr(tex_slot,'texture')): - if(tex_slot.texture.type == 'IMAGE'): - if tex_slot.texture.image is not None: - tex_slot.texture.image.reload() - else: - if(os.sys.platform == 'win32'): - osoite = os.path.expanduser("~") + os.sep + 'Documents' + os.sep + '3DC2Blender' + os.sep + 'Textures' + os.sep - else: - osoite = os.path.expanduser("~") + os.sep + '3DC2Blender' + os.sep + 'Textures' + os.sep - ki = os.path.split(coa.applink_name)[1] - ko = os.path.splitext(ki)[0] - just_nimi = ko + '_' - just_nimi_len = len(just_nimi) - print('terve:' + coa.applink_name) - if(len(objekti.material_slots) != 0): - for obj_tex in objekti.active_material.texture_slots: - if(hasattr(obj_tex,'texture')): - if(obj_tex.texture.type == 'IMAGE'): - if(obj_tex.use_map_color_diffuse): - bring_color = 0; - if(obj_tex.use_map_specular): - bring_spec = 0; - if(obj_tex.use_map_normal): - bring_normal = 0; - if(obj_tex.use_map_displacement): - bring_disp = 0; - - files = os.listdir(osoite) + files_dir = os.path.dirname(os.path.abspath(objekti.coat3D.applink_address)) + files = os.listdir(files_dir) + materiaali_muutos = objekti.active_material.name + uusin_mat = materiaali_muutos.replace('Material.','Material_') + new_name = (obj_coat.applink_name + '_' + uusin_mat) + name_boxs = new_name.split('.') + if len(name_boxs) > 1: + if len(name_boxs[-1]) == 3: + new_name = new_name[:-4] for i in files: - tui = i[:just_nimi_len] - if(tui == just_nimi): - texu.append(i) - - for yy in texu: - minimi = (yy.rfind('_'))+1 - maksimi = (yy.rfind('.')) - tex_name = yy[minimi:maksimi] - koko = '' - koko += osoite - koko += yy - texcoat[tex_name].append(koko) - - if((texcoat['color'] or texcoat['nmap'] or texcoat['disp'] or texcoat['specular']) and (len(objekti.material_slots)) == 0): - materials_old = bpy.data.materials.keys() - bpy.ops.material.new() - materials_new = bpy.data.materials.keys() - new_ma = list(set(materials_new).difference(set(materials_old))) - new_mat = new_ma[0] - ki = bpy.data.materials[new_mat] - objekti.data.materials.append(ki) - - if(bring_color == 1 and texcoat['color']): - index = find_index(objekti) - tex = bpy.ops.Texture - objekti.active_material.texture_slots.create(index) - total_mat = len(objekti.active_material.texture_slots.items()) - useold = '' - - for seekco in bpy.data.textures: - if((seekco.name[:5] == 'Color') and (seekco.users_material == ())): - useold = seekco - - - if(useold == ''): - - textures_old = bpy.data.textures.keys() - bpy.data.textures.new('Color',type='IMAGE') - textures_new = bpy.data.textures.keys() - name_te = list(set(textures_new).difference(set(textures_old))) - name_tex = name_te[0] - - bpy.ops.image.new(name=name_tex) - bpy.data.images[name_tex].filepath = texcoat['color'][0] - bpy.data.images[name_tex].source = 'FILE' - - objekti.active_material.texture_slots[index].texture = bpy.data.textures[name_tex] - objekti.active_material.texture_slots[index].texture.image = bpy.data.images[name_tex] - - if(objekti.data.uv_textures.active): - objekti.active_material.texture_slots[index].texture_coords = 'UV' - objekti.active_material.texture_slots[index].uv_layer = objekti.data.uv_textures.active.name - - objekti.active_material.texture_slots[index].texture.image.reload() - - - elif(useold != ''): - - objekti.active_material.texture_slots[index].texture = useold - objekti.active_material.texture_slots[index].texture.image = bpy.data.images[useold.name] - objekti.active_material.texture_slots[index].texture.image.filepath = texcoat['color'][0] - if(objekti.data.uv_textures.active): - objekti.active_material.texture_slots[index].texture_coords = 'UV' - objekti.active_material.texture_slots[index].uv_layer = objekti.data.uv_textures.active.name - - - if(bring_normal == 1 and texcoat['nmap']): - index = find_index(objekti) - tex = bpy.ops.Texture - objekti.active_material.texture_slots.create(index) - total_mat = len(objekti.active_material.texture_slots.items()) - useold = '' - - for seekco in bpy.data.textures: - if((seekco.name[:6] == 'Normal') and (seekco.users_material == ())): - useold = seekco - - if(useold == ''): - - textures_old = bpy.data.textures.keys() - bpy.data.textures.new('Normal',type='IMAGE') - textures_new = bpy.data.textures.keys() - name_te = list(set(textures_new).difference(set(textures_old))) - name_tex = name_te[0] - - bpy.ops.image.new(name=name_tex) - bpy.data.images[name_tex].filepath = texcoat['nmap'][0] - bpy.data.images[name_tex].source = 'FILE' - - objekti.active_material.texture_slots[index].texture = bpy.data.textures[name_tex] - objekti.active_material.texture_slots[index].texture.image = bpy.data.images[name_tex] - - if(objekti.data.uv_textures.active): - objekti.active_material.texture_slots[index].texture_coords = 'UV' - objekti.active_material.texture_slots[index].uv_layer = objekti.data.uv_textures.active.name - - objekti.active_material.texture_slots[index].use_map_color_diffuse = False - objekti.active_material.texture_slots[index].use_map_normal = True - - objekti.active_material.texture_slots[index].texture.image.reload() - if(vray): - bpy.data.textures[name_tex].vray_slot.BRDFBump.map_type = 'TANGENT' - - else: - bpy.data.textures[name_tex].use_normal_map = True - objekti.active_material.texture_slots[index].normal_map_space = 'TANGENT' - objekti.active_material.texture_slots[index].normal_factor = 1 - - - - elif(useold != ''): - - objekti.active_material.texture_slots[index].texture = useold - objekti.active_material.texture_slots[index].texture.image = bpy.data.images[useold.name] - objekti.active_material.texture_slots[index].texture.image.filepath = texcoat['nmap'][0] - if(objekti.data.uv_textures.active): - objekti.active_material.texture_slots[index].texture_coords = 'UV' - objekti.active_material.texture_slots[index].uv_layer = objekti.data.uv_textures.active.name - objekti.active_material.texture_slots[index].use_map_color_diffuse = False - objekti.active_material.texture_slots[index].use_map_normal = True - objekti.active_material.texture_slots[index].normal_factor = 1 - - - if(bring_spec == 1 and texcoat['specular']): - - index = find_index(objekti) - - objekti.active_material.texture_slots.create(index) - useold = '' - - for seekco in bpy.data.textures: - if((seekco.name[:8] == 'Specular') and (seekco.users_material == ())): - useold = seekco - - if(useold == ''): - - textures_old = bpy.data.textures.keys() - bpy.data.textures.new('Specular',type='IMAGE') - textures_new = bpy.data.textures.keys() - name_te = list(set(textures_new).difference(set(textures_old))) - name_tex = name_te[0] - - bpy.ops.image.new(name=name_tex) - bpy.data.images[name_tex].filepath = texcoat['specular'][0] - bpy.data.images[name_tex].source = 'FILE' - - objekti.active_material.texture_slots[index].texture = bpy.data.textures[name_tex] - objekti.active_material.texture_slots[index].texture.image = bpy.data.images[name_tex] - - if(objekti.data.uv_textures.active): - objekti.active_material.texture_slots[index].texture_coords = 'UV' - objekti.active_material.texture_slots[index].uv_layer = objekti.data.uv_textures.active.name - - objekti.active_material.texture_slots[index].use_map_color_diffuse = False - objekti.active_material.texture_slots[index].use_map_specular = True - - objekti.active_material.texture_slots[index].texture.image.reload() - - - elif(useold != ''): - - objekti.active_material.texture_slots[index].texture = useold - objekti.active_material.texture_slots[index].texture.image = bpy.data.images[useold.name] - objekti.active_material.texture_slots[index].texture.image.filepath = texcoat['specular'][0] - if(objekti.data.uv_textures.active): - objekti.active_material.texture_slots[index].texture_coords = 'UV' - objekti.active_material.texture_slots[index].uv_layer = objekti.data.uv_textures.active.name - objekti.active_material.texture_slots[index].use_map_color_diffuse = False - objekti.active_material.texture_slots[index].use_map_specular = True - - if(bring_disp == 1 and texcoat['disp']): - - index = find_index(objekti) - - - objekti.active_material.texture_slots.create(index) - useold = '' - - for seekco in bpy.data.textures: - if((seekco.name[:12] == 'Displacement') and (seekco.users_material == ())): - useold = seekco - - if useold == "": - - textures_old = bpy.data.textures.keys() - bpy.data.textures.new('Displacement',type='IMAGE') - textures_new = bpy.data.textures.keys() - name_te = list(set(textures_new).difference(set(textures_old))) - name_tex = name_te[0] - - bpy.ops.image.new(name=name_tex) - bpy.data.images[name_tex].filepath = texcoat['disp'][0] - bpy.data.images[name_tex].source = 'FILE' - - objekti.active_material.texture_slots[index].texture = bpy.data.textures[name_tex] - objekti.active_material.texture_slots[index].texture.image = bpy.data.images[name_tex] - - if(objekti.data.uv_textures.active): - objekti.active_material.texture_slots[index].texture_coords = 'UV' - objekti.active_material.texture_slots[index].uv_layer = objekti.data.uv_textures.active.name - - objekti.active_material.texture_slots[index].use_map_color_diffuse = False - objekti.active_material.texture_slots[index].use_map_displacement = True - - objekti.active_material.texture_slots[index].texture.image.reload() - - - elif(useold != ''): - - objekti.active_material.texture_slots[index].texture = useold - objekti.active_material.texture_slots[index].texture.image = bpy.data.images[useold.name] - objekti.active_material.texture_slots[index].texture.image.filepath = texcoat['disp'][0] - if(objekti.data.uv_textures.active): - objekti.active_material.texture_slots[index].texture_coords = 'UV' - objekti.active_material.texture_slots[index].uv_layer = objekti.data.uv_textures.active.name - objekti.active_material.texture_slots[index].use_map_color_diffuse = False - objekti.active_material.texture_slots[index].use_map_displacement = True - - if(vray): - objekti.active_material.texture_slots[index].texture.use_interpolation = False - objekti.active_material.texture_slots[index].displacement_factor = 0.05 - - - else: - disp_modi = '' - for seek_modi in objekti.modifiers: - if(seek_modi.type == 'DISPLACE'): - disp_modi = seek_modi - break - if(disp_modi): - disp_modi.texture = objekti.active_material.texture_slots[index].texture - if(objekti.data.uv_textures.active): - disp_modi.texture_coords = 'UV' - disp_modi.uv_layer = objekti.data.uv_textures.active.name - else: - objekti.modifiers.new('Displace',type='DISPLACE') - objekti.modifiers['Displace'].texture = objekti.active_material.texture_slots[index].texture - if(objekti.data.uv_textures.active): - objekti.modifiers['Displace'].texture_coords = 'UV' - objekti.modifiers['Displace'].uv_layer = objekti.data.uv_textures.active.name - + if(i.startswith(new_name)): + koko_osoite = files_dir + os.sep + i + listed = re.split(r'[_.]', i) + tex_name = listed[-2] + texcoat[tex_name].append(koko_osoite) + + createnodes(objekti, texcoat) + +def checkmaterial(mat_list, objekti): #check how many materials object has + mat_list = [] + + for obj_mate in objekti.material_slots: + if(obj_mate.material.use_nodes == False): + obj_mate.material.use_nodes = True + +def createnodes(objekti,texcoat): #luo nodes palikat ja linkittaa tekstuurit niihin + bring_color = True #naiden tarkoitus on tsekata onko tarvetta luoda uusi node vai riittaako paivitys + bring_metalness = True + bring_roughness = True + bring_normal = True + bring_disp = True + + act_material = objekti.active_material + if(objekti.active_material.use_nodes == False): + objekti.active_material.use_nodes = True + + #ensimmaiseksi kaydaan kaikki image nodet lapi ja tarkistetaan onko nimi 3DC alkunen jos on niin reload + + for node in act_material.node_tree.nodes: + if(node.type == 'TEX_IMAGE'): + if(node.name == '3DC_color'): + bring_color = False + node.image.reload() + elif(node.name == '3DC_metalness'): + bring_metalness = False + node.image.reload() + elif(node.name == '3DC_roughness'): + bring_roughness = False + node.image.reload() + elif(node.name == '3DC_normal'): + bring_normal = False + node.image.reload() + + #seuraavaksi lahdemme rakentamaan node tree. Lahdetaan Material Outputista rakentaa + + main_mat = act_material.node_tree.nodes['Material Output'] + if(main_mat.inputs['Surface'].is_linked == True): + glue_mat = main_mat.inputs['Surface'].links[0].from_node + + #Color + if(bring_color == True and glue_mat.inputs.find('Base Color') != -1 and texcoat['color'] != []): + node = act_material.node_tree.nodes.new('ShaderNodeTexImage') + node.location = -400,400 + node.name='3DC_color' + if(texcoat['color']): + node.image = bpy.data.images.load(texcoat['color'][0]) + input_color = glue_mat.inputs.find('Base Color') + act_material.node_tree.links.new(node.outputs[0], glue_mat.inputs[input_color]) + + #Metalness + if(bring_metalness == True and glue_mat.inputs.find('Metallic') != -1 and texcoat['metalness'] != []): + node = act_material.node_tree.nodes.new('ShaderNodeTexImage') + node.location = -830,160 + node.name='3DC_metalness' + if(texcoat['metalness']): + node.image = bpy.data.images.load(texcoat['metalness'][0]) + node.color_space = 'NONE' + input_color = glue_mat.inputs.find('Metallic') + act_material.node_tree.links.new(node.outputs[0], glue_mat.inputs[input_color]) + + #Roughness + if(bring_roughness == True and glue_mat.inputs.find('Roughness') != -1 and texcoat['rough'] != []): + node = act_material.node_tree.nodes.new('ShaderNodeTexImage') + node.location = -550,0 + node.name='3DC_roughness' + if(texcoat['rough']): + node.image = bpy.data.images.load(texcoat['rough'][0]) + node.color_space = 'NONE' + input_color = glue_mat.inputs.find('Roughness') + act_material.node_tree.links.new(node.outputs[0], glue_mat.inputs[input_color]) + + #Normal map + if(bring_normal == True and glue_mat.inputs.find('Normal') != -1 and texcoat['nmap'] != []): + node = act_material.node_tree.nodes.new('ShaderNodeTexImage') + normal_node = act_material.node_tree.nodes.new('ShaderNodeNormalMap') + node.location = -600,-370 + normal_node.location = -300,-270 + node.name='3DC_normal' + if(texcoat['nmap']): + node.image = bpy.data.images.load(texcoat['nmap'][0]) + node.color_space = 'NONE' + input_color = glue_mat.inputs.find('Normal') + act_material.node_tree.links.new(node.outputs[0], normal_node.inputs[1]) + act_material.node_tree.links.new(normal_node.outputs[0], glue_mat.inputs[input_color]) + + bpy.ops.object.editmode_toggle() #HACKKI joka saa tekstuurit nakymaan heti + bpy.ops.object.editmode_toggle() + + + +def matlab(mat_list, objekti, scene,is_new): + #checkmaterial(mat_list, objekti) + readtexturefolder(objekti,is_new) + return('FINISHED') diff --git a/io_convert_image_to_mesh_img/__init__.py b/io_convert_image_to_mesh_img/__init__.py index 1e5bdddf..a884fb90 100644 --- a/io_convert_image_to_mesh_img/__init__.py +++ b/io_convert_image_to_mesh_img/__init__.py @@ -51,12 +51,12 @@ def menu_import(self, context): def register(): bpy.utils.register_module(__name__) - bpy.types.INFO_MT_file_import.append(menu_import) + bpy.types.TOPBAR_MT_file_import.append(menu_import) def unregister(): bpy.utils.unregister_module(__name__) - bpy.types.INFO_MT_file_import.remove(menu_import) + bpy.types.TOPBAR_MT_file_import.remove(menu_import) if __name__ == '__main__': diff --git a/io_curve_svg/__init__.py b/io_curve_svg/__init__.py index 188e9189..bab43e51 100644 --- a/io_curve_svg/__init__.py +++ b/io_curve_svg/__init__.py @@ -21,8 +21,7 @@ bl_info = { "name": "Scalable Vector Graphics (SVG) 1.1 format", "author": "JM Soler, Sergey Sharybin", - "version": (1, 0, 0), - "blender": (2, 57, 0), + "blender": (2, 80, 0), "location": "File > Import > Scalable Vector Graphics (.svg)", "description": "Import SVG as curves", "warning": "", @@ -53,7 +52,7 @@ class ImportSVG(bpy.types.Operator, ImportHelper): bl_options = {'UNDO'} filename_ext = ".svg" - filter_glob = StringProperty(default="*.svg", options={'HIDDEN'}) + filter_glob: StringProperty(default="*.svg", options={'HIDDEN'}) def execute(self, context): from . import import_svg @@ -68,15 +67,15 @@ def menu_func_import(self, context): def register(): - bpy.utils.register_module(__name__) + bpy.utils.register_class(ImportSVG) - bpy.types.INFO_MT_file_import.append(menu_func_import) + bpy.types.TOPBAR_MT_file_import.append(menu_func_import) def unregister(): - bpy.utils.unregister_module(__name__) + bpy.utils.unregister_class(ImportSVG) - bpy.types.INFO_MT_file_import.remove(menu_func_import) + bpy.types.TOPBAR_MT_file_import.remove(menu_func_import) # NOTES # - blender version is hardcoded diff --git a/io_curve_svg/import_svg.py b/io_curve_svg/import_svg.py index 0dfc70a4..ff16958b 100644 --- a/io_curve_svg/import_svg.py +++ b/io_curve_svg/import_svg.py @@ -118,14 +118,15 @@ def SVGParseFloat(s, i=0): return token, i -def SVGCreateCurve(): +def SVGCreateCurve(context): """ Create new curve object to hold splines in """ cu = bpy.data.curves.new("Curve", 'CURVE') obj = bpy.data.objects.new("Curve", cu) - bpy.context.scene.objects.link(obj) + + context['collection'].objects.link(obj) return obj @@ -213,8 +214,8 @@ def SVGMatrixFromNode(node, context): m = Matrix.Translation(Vector((x, y, 0.0))) if has_user_coordinate: if rect[0] != 0 and rect[1] != 0: - m = m * Matrix.Scale(w / rect[0], 4, Vector((1.0, 0.0, 0.0))) - m = m * Matrix.Scale(h / rect[1], 4, Vector((0.0, 1.0, 0.0))) + m = m @ Matrix.Scale(w / rect[0], 4, Vector((1.0, 0.0, 0.0))) + m = m @ Matrix.Scale(h / rect[1], 4, Vector((0.0, 1.0, 0.0))) if node.getAttribute('viewBox'): viewBox = node.getAttribute('viewBox').replace(',', ' ').split() @@ -237,11 +238,11 @@ def SVGMatrixFromNode(node, context): tx = (w - vw * scale) / 2 ty = (h - vh * scale) / 2 - m = m * Matrix.Translation(Vector((tx, ty, 0.0))) + m = m @ Matrix.Translation(Vector((tx, ty, 0.0))) - m = m * Matrix.Translation(Vector((-vx, -vy, 0.0))) - m = m * Matrix.Scale(scale, 4, Vector((1.0, 0.0, 0.0))) - m = m * Matrix.Scale(scale, 4, Vector((0.0, 1.0, 0.0))) + m = m @ Matrix.Translation(Vector((-vx, -vy, 0.0))) + m = m @ Matrix.Scale(scale, 4, Vector((1.0, 0.0, 0.0))) + m = m @ Matrix.Scale(scale, 4, Vector((0.0, 1.0, 0.0))) return m @@ -263,7 +264,7 @@ def SVGParseTransform(transform): if proc is None: raise Exception('Unknown trasnform function: ' + func) - m = m * proc(params) + m = m @ proc(params) return m @@ -304,7 +305,6 @@ def SVGGetMaterial(color, context): mat = bpy.data.materials.new(name='SVGMat') mat.diffuse_color = diffuse_color - mat.diffuse_intensity = 1.0 materials[color] = mat @@ -350,8 +350,8 @@ def SVGTransformScale(params): m = Matrix() - m = m * Matrix.Scale(sx, 4, Vector((1.0, 0.0, 0.0))) - m = m * Matrix.Scale(sy, 4, Vector((0.0, 1.0, 0.0))) + m = m @ Matrix.Scale(sx, 4, Vector((1.0, 0.0, 0.0))) + m = m @ Matrix.Scale(sy, 4, Vector((0.0, 1.0, 0.0))) return m @@ -395,7 +395,7 @@ def SVGTransformRotate(params): tm = Matrix.Translation(Vector((cx, cy, 0.0))) rm = Matrix.Rotation(ang, 4, Vector((0.0, 0.0, 1.0))) - return tm * rm * tm.inverted() + return tm @ rm @ tm.inverted() SVGTransforms = {'translate': SVGTransformTranslate, 'scale': SVGTransformScale, @@ -1030,7 +1030,7 @@ class SVGGeometry: """ self._context['transform'].append(matrix) - self._context['matrix'] = self._context['matrix'] * matrix + self._context['matrix'] = self._context['matrix'] @ matrix def _popMatrix(self): """ @@ -1038,7 +1038,7 @@ class SVGGeometry: """ matrix = self._context['transform'].pop() - self._context['matrix'] = self._context['matrix'] * matrix.inverted() + self._context['matrix'] = self._context['matrix'] @ matrix.inverted() def _pushStyle(self, style): """ @@ -1063,7 +1063,7 @@ class SVGGeometry: v = Vector((point[0], point[1], 0.0)) - return self._context['matrix'] * v + return self._context['matrix'] @ v def getNodeMatrix(self): """ @@ -1211,7 +1211,7 @@ class SVGGeometryPATH(SVGGeometry): Create real geometries """ - ob = SVGCreateCurve() + ob = SVGCreateCurve(self._context) cu = ob.data if self._node.getAttribute('id'): @@ -1429,7 +1429,7 @@ class SVGGeometryRECT(SVGGeometry): radius = (rx, ry) # Geometry creation - ob = SVGCreateCurve() + ob = SVGCreateCurve(self._context) cu = ob.data if self._styles['useFill']: @@ -1539,7 +1539,7 @@ class SVGGeometryELLIPSE(SVGGeometry): return # Create circle - ob = SVGCreateCurve() + ob = SVGCreateCurve(self._context) cu = ob.data if self._node.getAttribute('id'): @@ -1656,7 +1656,7 @@ class SVGGeometryLINE(SVGGeometry): y2 = SVGParseCoord(self._y2, crect[1]) # Create cline - ob = SVGCreateCurve() + ob = SVGCreateCurve(self._context) cu = ob.data coords = [(x1, y1), (x2, y2)] @@ -1727,7 +1727,7 @@ class SVGGeometryPOLY(SVGGeometry): Create real geometries """ - ob = SVGCreateCurve() + ob = SVGCreateCurve(self._context) cu = ob.data if self._closed and self._styles['useFill']: @@ -1798,7 +1798,7 @@ class SVGGeometrySVG(SVGGeometryContainer): if self._node.getAttribute('inkscape:version'): raw_height = self._node.getAttribute('height') document_height = SVGParseCoord(raw_height, 1.0) - matrix = matrix * Matrix.Translation([0.0, -document_height , 0.0]) + matrix = matrix @ matrix.Translation([0.0, -document_height , 0.0]) self._pushMatrix(matrix) self._pushRect(rect) @@ -1824,16 +1824,22 @@ class SVGLoader(SVGGeometryContainer): return None - def __init__(self, filepath, do_colormanage): + def __init__(self, context, filepath, do_colormanage): """ Initialize SVG loader """ + import os + + svg_name = os.path.basename(filepath) + scene = context.scene + collection = bpy.data.collections.new(name=svg_name) + scene.collection.children.link(collection) node = xml.dom.minidom.parse(filepath) m = Matrix() - m = m * Matrix.Scale(1.0 / 90.0 * 0.3048 / 12.0, 4, Vector((1.0, 0.0, 0.0))) - m = m * Matrix.Scale(-1.0 / 90.0 * 0.3048 / 12.0, 4, Vector((0.0, 1.0, 0.0))) + m = m @ Matrix.Scale(1.0 / 90.0 * 0.3048 / 12.0, 4, Vector((1.0, 0.0, 0.0))) + m = m @ Matrix.Scale(-1.0 / 90.0 * 0.3048 / 12.0, 4, Vector((0.0, 1.0, 0.0))) rect = (0, 0) @@ -1845,7 +1851,8 @@ class SVGLoader(SVGGeometryContainer): 'materials': {}, 'styles': [None], 'style': None, - 'do_colormanage': do_colormanage} + 'do_colormanage': do_colormanage, + 'collection': collection} super().__init__(node, self._context) @@ -1882,7 +1889,7 @@ def parseAbstractNode(node, context): return None -def load_svg(filepath, do_colormanage): +def load_svg(context, filepath, do_colormanage): """ Load specified SVG file """ @@ -1890,7 +1897,7 @@ def load_svg(filepath, do_colormanage): if bpy.ops.object.mode_set.poll(): bpy.ops.object.mode_set(mode='OBJECT') - loader = SVGLoader(filepath, do_colormanage) + loader = SVGLoader(context, filepath, do_colormanage) loader.parse() loader.createGeom(False) @@ -1901,7 +1908,7 @@ def load(operator, context, filepath=""): # non SVG files can give useful messages. do_colormanage = context.scene.display_settings.display_device != 'NONE' try: - load_svg(filepath, do_colormanage) + load_svg(context, filepath, do_colormanage) except (xml.parsers.expat.ExpatError, UnicodeEncodeError) as e: import traceback traceback.print_exc() diff --git a/io_export_after_effects.py b/io_export_after_effects.py index 4a5c6b92..b483ae15 100644 --- a/io_export_after_effects.py +++ b/io_export_after_effects.py @@ -110,7 +110,7 @@ def get_selected(context): # not ready yet. is_plane(object) returns False in all cases. This is temporary solids.append([ob, convert_name(ob.name)]) - elif ob.type == 'LAMP': + elif ob.type == 'LIGHT': lights.append([ob, ob.data.type + convert_name(ob.name)]) # Type of lamp added to name else: @@ -768,12 +768,12 @@ def menu_func(self, context): def register(): bpy.utils.register_class(ExportJsx) - bpy.types.INFO_MT_file_export.append(menu_func) + bpy.types.TOPBAR_MT_file_export.append(menu_func) def unregister(): bpy.utils.unregister_class(ExportJsx) - bpy.types.INFO_MT_file_export.remove(menu_func) + bpy.types.TOPBAR_MT_file_export.remove(menu_func) if __name__ == "__main__": register() diff --git a/io_export_dxf/__init__.py b/io_export_dxf/__init__.py index 254ffdae..41fd79e6 100644 --- a/io_export_dxf/__init__.py +++ b/io_export_dxf/__init__.py @@ -45,7 +45,7 @@ classes = ( ) def register(): - bpy.types.INFO_MT_file_export.append(menu_func) + bpy.types.TOPBAR_MT_file_export.append(menu_func) from bpy.utils import register_class for cls in classes: @@ -53,7 +53,7 @@ def register(): def unregister(): - bpy.types.INFO_MT_file_export.remove(menu_func) + bpy.types.TOPBAR_MT_file_export.remove(menu_func) from bpy.utils import unregister_class for cls in reversed(classes): diff --git a/io_export_dxf/export_dxf.py b/io_export_dxf/export_dxf.py index b6e51531..edaeff4a 100644 --- a/io_export_dxf/export_dxf.py +++ b/io_export_dxf/export_dxf.py @@ -27,7 +27,7 @@ if DEBUG: from .model.migiusModel import MigiusDXFLibDrawing -SUPPORTED_TYPES = ('MESH')#,'CURVE','EMPTY','TEXT','CAMERA','LAMP') +SUPPORTED_TYPES = ('MESH')#,'CURVE','EMPTY','TEXT','CAMERA','LIGHT') def exportDXF(context, filePath, settings): """ @@ -277,8 +277,8 @@ def _exportItem(ctx, o, mw, drawing, settings): elif (o.type == 'CAMERA') and settings['camera_as']: from .primitive_exporters.camera_exporter import CameraDXFExporter e = CameraDXFExporter(settings) - elif (o.type == 'LAMP') and settings['lamp_as']: - from .primitive_exporters.lamp_exporter import LampDXFExporter + elif (o.type == 'LIGHT') and settings['light_as']: + from .primitive_exporters.light_exporter import LampDXFExporter e = LampDXFExporter(settings) return e.export(ctx, drawing, o, mx, mx_n, color=ecolor, layer=elayer, lineType=eltype) diff --git a/io_export_dxf/operator.py b/io_export_dxf/operator.py index a2d9dcf7..39848b1d 100644 --- a/io_export_dxf/operator.py +++ b/io_export_dxf/operator.py @@ -160,10 +160,10 @@ class DXFExporter(bpy.types.Operator): # ('VIEW', 'VIEW', ''), # ('POINT', 'POINT', '') # ) -# lamp_asItems = ( +# light_asItems = ( # ('NO', 'Do not export', ''), # ('..BLOCK', '..BLOCK', ''), -# ('..A_LAMP', '..A_LAMP', ''), +# ('..A_LIGHT', '..A_LIGHT', ''), # ('POINT', 'POINT', '') # ) # --------- CONTROL PROPERTIES -------------------------------------------- @@ -207,9 +207,9 @@ class DXFExporter(bpy.types.Operator): # camera_as = EnumProperty( name="Export camera As:", default='NO', # description="Select representation of a camera", # items=camera_asItems) -# lamp_as = EnumProperty( name="Export lamp As:", default='NO', +# light_as = EnumProperty( name="Export lamp As:", default='NO', # description="Select representation of a lamp", -# items=lamp_asItems) +# items=light_asItems) # ---------------------------------------------------------- entitylayer_from = EnumProperty(name="Entity Layer", default="obj.data.name", description="Entity LAYER assigned to?", @@ -265,7 +265,7 @@ class DXFExporter(bpy.types.Operator): # 'group_as' : self._checkNO(self.group_as), # 'proxy_as' : self._checkNO(self.proxy_as), # 'camera_as' : self._checkNO(self.camera_as), -# 'lamp_as' : self._checkNO(self.lamp_as), +# 'light_as' : self._checkNO(self.light_as), 'entitylayer_from' : self.entitylayer_from, 'entitycolor_from' : self.entitycolor_from, diff --git a/io_export_dxf/primitive_exporters/lamp_exporter.py b/io_export_dxf/primitive_exporters/lamp_exporter.py index 01a65abd..2265d6ad 100644 --- a/io_export_dxf/primitive_exporters/lamp_exporter.py +++ b/io_export_dxf/primitive_exporters/lamp_exporter.py @@ -13,7 +13,7 @@ def exportLamp(ob, mx, mw, **common): [p] = toGlobalOrigin([p]) entities = [] - c = lamp_as_list[GUI_A['lamp_as'].val] + c = light_as_list[GUI_A['light_as'].val] if c=="POINT": # export as POINT dxfPOINT = DXF.Point(points=[p],**common) entities.append(dxfPOINT) diff --git a/io_export_paper_model.py b/io_export_paper_model.py index 5ddcc11c..624dbde2 100644 --- a/io_export_paper_model.py +++ b/io_export_paper_model.py @@ -2582,12 +2582,12 @@ def register(): bpy.types.Mesh.paper_island_index = bpy.props.IntProperty( name="Island List Index", default=-1, min=-1, max=100, options={'SKIP_SAVE'}) - bpy.types.INFO_MT_file_export.append(menu_func) + bpy.types.TOPBAR_MT_file_export.append(menu_func) def unregister(): bpy.utils.unregister_module(__name__) - bpy.types.INFO_MT_file_export.remove(menu_func) + bpy.types.TOPBAR_MT_file_export.remove(menu_func) if display_islands.handle: bpy.types.SpaceView3D.draw_handler_remove(display_islands.handle, 'WINDOW') display_islands.handle = None diff --git a/io_export_pc2.py b/io_export_pc2.py index 752df5c4..86a1b3c1 100644 --- a/io_export_pc2.py +++ b/io_export_pc2.py @@ -205,13 +205,13 @@ def menu_func(self, context): def register(): bpy.utils.register_module(__name__) - bpy.types.INFO_MT_file_export.append(menu_func) + bpy.types.TOPBAR_MT_file_export.append(menu_func) #bpy.types.VIEW3D_PT_tools_objectmode.prepend(menu_func) def unregister(): bpy.utils.unregister_module(__name__) - bpy.types.INFO_MT_file_export.remove(menu_func) + bpy.types.TOPBAR_MT_file_export.remove(menu_func) #bpy.types.VIEW3D_PT_tools_objectmode.remove(menu_func) if __name__ == "__main__": diff --git a/io_export_unreal_psk_psa.py b/io_export_unreal_psk_psa.py index ca22ca46..cc4d068c 100644 --- a/io_export_unreal_psk_psa.py +++ b/io_export_unreal_psk_psa.py @@ -1201,8 +1201,8 @@ def parse_mesh(mesh, psk): # does with the mesh Y coordinates. this is otherwise known as MAGIC-2 uv[1] = 1.0 - uv[1] - # clamp UV coords if udk_option_clamp_uv is True - if bpy.context.scene.udk_option_clamp_uv: + # clamp UV coords if udk_option_clight_uv is True + if bpy.context.scene.udk_option_clight_uv: if (uv[0] > 1): uv[0] = 1 if (uv[0] < 0): @@ -2422,7 +2422,7 @@ class Panel_UDKExport(Panel): object_name = context.active_object.name row10 = layout.row() row10.prop(context.scene, "udk_option_smoothing_groups") - row10.prop(context.scene, "udk_option_clamp_uv") + row10.prop(context.scene, "udk_option_clight_uv") row10.prop(context.scene, "udk_option_verbose") row = layout.row() @@ -2792,7 +2792,7 @@ class ExportUDKAnimData(Operator): scene = context.scene layout.prop(scene, "udk_option_smoothing_groups") - layout.prop(scene, "udk_option_clamp_uv") + layout.prop(scene, "udk_option_clight_uv") layout.prop(scene, "udk_option_verbose") layout.prop(scene, "udk_option_filename_src") layout.prop(scene, "udk_option_export") @@ -2865,7 +2865,7 @@ class PskAddonPreferences(AddonPreferences): def register(): bpy.utils.register_module(__name__) - bpy.types.INFO_MT_file_export.append(menu_func) + bpy.types.TOPBAR_MT_file_export.append(menu_func) update_panel(None, bpy.context) # Added by [MGVS] @@ -2888,7 +2888,7 @@ def register(): description="Boolean for exporting psa format (Animation Data)", default=True ) - bpy.types.Scene.udk_option_clamp_uv = BoolProperty( + bpy.types.Scene.udk_option_clight_uv = BoolProperty( name="Clamp UV", description="True is to limit Clamp UV co-ordinates to [0-1]. False is unrestricted (x,y)", default=False @@ -2972,12 +2972,12 @@ def register(): def unregister(): bpy.utils.unregister_module(__name__) - bpy.types.INFO_MT_file_export.remove(menu_func) + bpy.types.TOPBAR_MT_file_export.remove(menu_func) del bpy.types.Scene.udk_option_filename_src del bpy.types.Scene.udk_option_export_psk del bpy.types.Scene.udk_option_export_psa - del bpy.types.Scene.udk_option_clamp_uv + del bpy.types.Scene.udk_option_clight_uv del bpy.types.Scene.udk_copy_merge del bpy.types.Scene.udk_option_export del bpy.types.Scene.udk_option_verbose diff --git a/io_import_dxf/__init__.py b/io_import_dxf/__init__.py index d768d624..46e84fd5 100644 --- a/io_import_dxf/__init__.py +++ b/io_import_dxf/__init__.py @@ -559,12 +559,12 @@ def menu_func(self, context): def register(): bpy.utils.register_module(__name__) - bpy.types.INFO_MT_file_import.append(menu_func) + bpy.types.TOPBAR_MT_file_import.append(menu_func) def unregister(): bpy.utils.unregister_module(__name__) - bpy.types.INFO_MT_file_import.remove(menu_func) + bpy.types.TOPBAR_MT_file_import.remove(menu_func) if __name__ == "__main__": diff --git a/io_import_dxf/dxfimport/do.py b/io_import_dxf/dxfimport/do.py index e570f9d7..0bc8667b 100644 --- a/io_import_dxf/dxfimport/do.py +++ b/io_import_dxf/dxfimport/do.py @@ -738,7 +738,7 @@ class Do: if self.import_light: type_map = ["NONE", "SUN", "POINT", "SPOT"] layer = self.dwg.layers[en.layer] - lamp = bpy.data.lamps.new(en.name, type_map[en.light_type]) + lamp = bpy.data.lights.new(en.name, type_map[en.light_type]) if en.color != 256: aci = en.color else: @@ -1005,7 +1005,7 @@ class Do: bpy.context.screen.scene = scene o = bbox.copy() - # o.empty_draw_size = 0.3 + # o.empty_display_size = 0.3 o.dupli_type = "GROUP" o.dupli_group = block_group group.objects.link(o) diff --git a/io_import_gimp_image_to_scene.py b/io_import_gimp_image_to_scene.py index c554e518..7db9ef71 100644 --- a/io_import_gimp_image_to_scene.py +++ b/io_import_gimp_image_to_scene.py @@ -680,13 +680,13 @@ def menu_func(self, context): def register(): bpy.utils.register_module(__name__) - bpy.types.INFO_MT_file_import.append(menu_func) + bpy.types.TOPBAR_MT_file_import.append(menu_func) def unregister(): bpy.utils.unregister_module(__name__) - bpy.types.INFO_MT_file_import.remove(menu_func) + bpy.types.TOPBAR_MT_file_import.remove(menu_func) if __name__ == "__main__": diff --git a/io_import_images_as_planes.py b/io_import_images_as_planes.py index b5099da0..3e8b816a 100644 --- a/io_import_images_as_planes.py +++ b/io_import_images_as_planes.py @@ -929,10 +929,6 @@ class IMPORT_IMAGE_OT_to_plane(Operator, AddObjectHelper): tex = self.create_image_textures(context, img_spec) material = self.create_material_for_texture(tex) - # Game Engine Material Settings - material.game_settings.use_backface_culling = False - material.game_settings.alpha_blend = 'ALPHA' - # Create and position plane object plane = self.create_image_plane(context, material.name, img_spec) @@ -1213,16 +1209,16 @@ def register(): for cls in classes: bpy.utils.register_class(cls) - bpy.types.INFO_MT_file_import.append(import_images_button) - bpy.types.INFO_MT_mesh_add.append(import_images_button) + bpy.types.TOPBAR_MT_file_import.append(import_images_button) + bpy.types.VIEW3D_MT_mesh_add.append(import_images_button) bpy.app.handlers.load_post.append(register_driver) register_driver() def unregister(): - bpy.types.INFO_MT_file_import.remove(import_images_button) - bpy.types.INFO_MT_mesh_add.remove(import_images_button) + bpy.types.TOPBAR_MT_file_import.remove(import_images_button) + bpy.types.VIEW3D_MT_mesh_add.remove(import_images_button) # This will only exist if drivers are active if check_drivers in bpy.app.handlers.scene_update_post: diff --git a/io_import_scene_lwo.py b/io_import_scene_lwo.py index 8f1bbbac..5bd24bd9 100644 --- a/io_import_scene_lwo.py +++ b/io_import_scene_lwo.py @@ -1251,13 +1251,13 @@ def menu_func(self, context): def register(): bpy.utils.register_module(__name__) - bpy.types.INFO_MT_file_import.append(menu_func) + bpy.types.TOPBAR_MT_file_import.append(menu_func) def unregister(): bpy.utils.unregister_module(__name__) - bpy.types.INFO_MT_file_import.remove(menu_func) + bpy.types.TOPBAR_MT_file_import.remove(menu_func) if __name__ == "__main__": register() diff --git a/io_import_scene_unreal_psa_psk.py b/io_import_scene_unreal_psa_psk.py index c210b771..2d2ab604 100644 --- a/io_import_scene_unreal_psa_psk.py +++ b/io_import_scene_unreal_psa_psk.py @@ -1275,11 +1275,11 @@ def menu_func(self, context): def register(): bpy.utils.register_module(__name__) - bpy.types.INFO_MT_file_import.append(menu_func) + bpy.types.TOPBAR_MT_file_import.append(menu_func) def unregister(): bpy.utils.unregister_module(__name__) - bpy.types.INFO_MT_file_import.remove(menu_func) + bpy.types.TOPBAR_MT_file_import.remove(menu_func) if __name__ == "__main__": register() diff --git a/io_mesh_pdb/__init__.py b/io_mesh_pdb/__init__.py index dcf9ec4a..ebe620a2 100644 --- a/io_mesh_pdb/__init__.py +++ b/io_mesh_pdb/__init__.py @@ -82,7 +82,7 @@ class ImportPDB(Operator, ImportHelper): use_camera = BoolProperty( name="Camera", default=False, description="Do you need a camera?") - use_lamp = BoolProperty( + use_light = BoolProperty( name="Lamp", default=False, description = "Do you need a lamp?") ball = EnumProperty( @@ -162,7 +162,7 @@ class ImportPDB(Operator, ImportHelper): layout = self.layout row = layout.row() row.prop(self, "use_camera") - row.prop(self, "use_lamp") + row.prop(self, "use_light") row = layout.row() row.prop(self, "use_center") # Balls @@ -256,7 +256,7 @@ class ImportPDB(Operator, ImportHelper): self.sticks_radius, self.use_center, self.use_camera, - self.use_lamp, + self.use_light, filepath_pdb) return {'FINISHED'} @@ -301,13 +301,13 @@ def menu_func_export(self, context): def register(): bpy.utils.register_module(__name__) - bpy.types.INFO_MT_file_import.append(menu_func_import) - bpy.types.INFO_MT_file_export.append(menu_func_export) + bpy.types.TOPBAR_MT_file_import.append(menu_func_import) + bpy.types.TOPBAR_MT_file_export.append(menu_func_export) def unregister(): bpy.utils.unregister_module(__name__) - bpy.types.INFO_MT_file_import.remove(menu_func_import) - bpy.types.INFO_MT_file_export.remove(menu_func_export) + bpy.types.TOPBAR_MT_file_import.remove(menu_func_import) + bpy.types.TOPBAR_MT_file_export.remove(menu_func_export) if __name__ == "__main__": diff --git a/io_mesh_pdb/import_pdb.py b/io_mesh_pdb/import_pdb.py index a7a0be7d..564d26a1 100644 --- a/io_mesh_pdb/import_pdb.py +++ b/io_mesh_pdb/import_pdb.py @@ -536,7 +536,7 @@ def build_stick(radius, length, sectors): # Function, which puts a camera and light source into the 3D scene def camera_light_source(use_camera, - use_lamp, + use_light, object_center_vec, object_size): @@ -592,27 +592,27 @@ def camera_light_source(use_camera, release_confirm=False) # Here a lamp is put into the scene, if chosen. - if use_lamp == True: + if use_light == True: # This is the distance from the object measured in terms of % # of the camera distance. It is set onto 50% (1/2) distance. - lamp_dl = sqrt(object_size) * 15 * 0.5 + light_dl = sqrt(object_size) * 15 * 0.5 # This is a factor to which extend the lamp shall go to the right # (from the camera point of view). - lamp_dy_right = lamp_dl * (3.0/4.0) + light_dy_right = light_dl * (3.0/4.0) # Create x, y and z for the lamp. - object_lamp_vec = Vector((lamp_dl,lamp_dy_right,lamp_dl)) - lamp_xyz_vec = object_center_vec + object_lamp_vec + object_light_vec = Vector((light_dl,light_dy_right,light_dl)) + light_xyz_vec = object_center_vec + object_light_vec # Create the lamp current_layers=bpy.context.scene.layers - lamp_data = bpy.data.lamps.new(name="A_lamp", type="POINT") - lamp_data.distance = 500.0 - lamp_data.energy = 3.0 - lamp_data.shadow_method = 'RAY_SHADOW' - lamp = bpy.data.objects.new("A_lamp", lamp_data) - lamp.location = lamp_xyz_vec + light_data = bpy.data.lights.new(name="A_light", type="POINT") + light_data.distance = 500.0 + light_data.energy = 3.0 + light_data.shadow_method = 'RAY_SHADOW' + lamp = bpy.data.objects.new("A_light", light_data) + lamp.location = light_xyz_vec lamp.layers = current_layers bpy.context.scene.objects.link(lamp) @@ -1145,7 +1145,7 @@ def import_pdb(Ball_type, Stick_diameter, put_to_center, use_camera, - use_lamp, + use_light, filepath_pdb): @@ -1376,7 +1376,7 @@ def import_pdb(Ball_type, # CAMERA and LIGHT SOURCES camera_light_source(use_camera, - use_lamp, + use_light, object_center_vec, object_size) diff --git a/io_mesh_ply/__init__.py b/io_mesh_ply/__init__.py index 77259690..c0fcc8dc 100644 --- a/io_mesh_ply/__init__.py +++ b/io_mesh_ply/__init__.py @@ -191,16 +191,16 @@ def register(): for cls in classes: bpy.utils.register_class(cls) - bpy.types.INFO_MT_file_import.append(menu_func_import) - bpy.types.INFO_MT_file_export.append(menu_func_export) + bpy.types.TOPBAR_MT_file_import.append(menu_func_import) + bpy.types.TOPBAR_MT_file_export.append(menu_func_export) def unregister(): for cls in classes: bpy.utils.unregister_class(cls) - bpy.types.INFO_MT_file_import.remove(menu_func_import) - bpy.types.INFO_MT_file_export.remove(menu_func_export) + bpy.types.TOPBAR_MT_file_import.remove(menu_func_import) + bpy.types.TOPBAR_MT_file_export.remove(menu_func_export) if __name__ == "__main__": register() diff --git a/io_mesh_raw/__init__.py b/io_mesh_raw/__init__.py index 69640932..5ad4c6f5 100644 --- a/io_mesh_raw/__init__.py +++ b/io_mesh_raw/__init__.py @@ -107,15 +107,15 @@ def menu_export(self, context): def register(): bpy.utils.register_module(__name__) - bpy.types.INFO_MT_file_import.append(menu_import) - bpy.types.INFO_MT_file_export.append(menu_export) + bpy.types.TOPBAR_MT_file_import.append(menu_import) + bpy.types.TOPBAR_MT_file_export.append(menu_export) def unregister(): bpy.utils.unregister_module(__name__) - bpy.types.INFO_MT_file_import.remove(menu_import) - bpy.types.INFO_MT_file_export.remove(menu_export) + bpy.types.TOPBAR_MT_file_import.remove(menu_import) + bpy.types.TOPBAR_MT_file_export.remove(menu_export) if __name__ == "__main__": register() diff --git a/io_mesh_stl/__init__.py b/io_mesh_stl/__init__.py index fc8bced2..0f3de86e 100644 --- a/io_mesh_stl/__init__.py +++ b/io_mesh_stl/__init__.py @@ -259,15 +259,15 @@ def menu_export(self, context): def register(): bpy.utils.register_module(__name__) - bpy.types.INFO_MT_file_import.append(menu_import) - bpy.types.INFO_MT_file_export.append(menu_export) + bpy.types.TOPBAR_MT_file_import.append(menu_import) + bpy.types.TOPBAR_MT_file_export.append(menu_export) def unregister(): bpy.utils.unregister_module(__name__) - bpy.types.INFO_MT_file_import.remove(menu_import) - bpy.types.INFO_MT_file_export.remove(menu_export) + bpy.types.TOPBAR_MT_file_import.remove(menu_import) + bpy.types.TOPBAR_MT_file_export.remove(menu_export) if __name__ == "__main__": diff --git a/io_mesh_stl/blender_utils.py b/io_mesh_stl/blender_utils.py index 864335ab..d6ee400c 100644 --- a/io_mesh_stl/blender_utils.py +++ b/io_mesh_stl/blender_utils.py @@ -84,7 +84,7 @@ def faces_from_mesh(ob, global_matrix, use_mesh_modifiers=False, triangulate=Tru # get the modifiers try: - mesh = ob.to_mesh(bpy.context.scene, use_mesh_modifiers, "PREVIEW") + mesh = ob.to_mesh(bpy.context.depsgraph, use_mesh_modifiers) except RuntimeError: raise StopIteration diff --git a/io_mesh_uv_layout/__init__.py b/io_mesh_uv_layout/__init__.py index 30dff949..7256bbef 100644 --- a/io_mesh_uv_layout/__init__.py +++ b/io_mesh_uv_layout/__init__.py @@ -22,7 +22,7 @@ bl_info = { "name": "UV Layout", "author": "Campbell Barton, Matt Ebb", "version": (1, 1, 1), - "blender": (2, 75, 0), + "blender": (2, 80, 0), "location": "Image-Window > UVs > Export UV Layout", "description": "Export the UV layout as a 2D graphic", "warning": "", @@ -61,26 +61,26 @@ class ExportUVLayout(bpy.types.Operator): bl_label = "Export UV Layout" bl_options = {'REGISTER', 'UNDO'} - filepath = StringProperty( + filepath: StringProperty( subtype='FILE_PATH', ) - check_existing = BoolProperty( + check_existing: BoolProperty( name="Check Existing", description="Check and warn on overwriting existing files", default=True, options={'HIDDEN'}, ) - export_all = BoolProperty( + export_all: BoolProperty( name="All UVs", description="Export all UVs in this mesh (not just visible ones)", default=False, ) - modified = BoolProperty( + modified: BoolProperty( name="Modified", description="Exports UVs from the modified mesh", default=False, ) - mode = EnumProperty( + mode: EnumProperty( items=(('SVG', "Scalable Vector Graphic (.svg)", "Export the UV layout to a vector SVG file"), ('EPS', "Encapsulate PostScript (.eps)", @@ -92,19 +92,20 @@ class ExportUVLayout(bpy.types.Operator): description="File format to export the UV layout to", default='PNG', ) - size = IntVectorProperty( + size: IntVectorProperty( + name="Size", size=2, default=(1024, 1024), min=8, max=32768, description="Dimensions of the exported file", ) - opacity = FloatProperty( + opacity: FloatProperty( name="Fill Opacity", min=0.0, max=1.0, default=0.25, description="Set amount of opacity for exported UV layout" ) - tessellated = BoolProperty( + tessellated: BoolProperty( name="Tessellated UVs", description="Export tessellated UVs instead of polygons ones", default=False, @@ -114,7 +115,7 @@ class ExportUVLayout(bpy.types.Operator): @classmethod def poll(cls, context): obj = context.active_object - return (obj and obj.type == 'MESH' and obj.data.uv_textures) + return (obj and obj.type == 'MESH' and obj.data.uv_layers) def _space_image(self, context): space_data = context.space_data @@ -138,27 +139,82 @@ class ExportUVLayout(bpy.types.Operator): return image_width, image_height - def _face_uv_iter(self, context, mesh, tessellated): + # Trying to be consistent with ED_object_get_active_image + # from uvedit_ops.c so that what is exported are the uvs + # that are seen in the UV Editor + # + # returns Image or None + def _get_active_texture(self, mat): + if mat is None or not mat.use_nodes: + return None + + node = self._get_active_texture_nodetree(mat.node_tree) + + if node is not None and node.bl_rna.identifier in {'ShaderNodeTexImage', 'ShaderNodeTexEnvironment'}: + return node.image + + return None + + # returns image node or None + def _get_active_texture_nodetree(self, node_tree): + active_tex_node = None + active_group = None + has_group = False + inactive_node = None + + for node in node_tree.nodes: + if node.show_texture: + active_tex_node = node + if node.select: + return node + elif inactive_node is None and node.bl_rna.identifier in {'ShaderNodeTexImage', 'ShaderNodeTexEnvironment'}: + inactive_node = node + elif node.bl_rna.identifier == 'ShaderNodeGroup': + if node.select: + active_group = node + else: + has_group = True + + # Not found a selected show_texture node + # Try to find a selected show_texture node in the selected group + if active_group is not None: + node = self._get_active_texture_nodetree(active_group.node_tree) + if node is not None: + return node + + if active_tex_node is not None: + return active_tex_node + + if has_group: + for node in node_tree.nodes: + if node.bl_rna.identifier == 'ShaderNodeGroup': + n = self._get_active_texture_nodetree(node.node_tree) + if n is not None and (n.show_texture or inactive_node is None): + return n + + return None + + def _face_uv_iter(self, context, material_slots, mesh): uv_layer = mesh.uv_layers.active.data polys = mesh.polygons if not self.export_all: - uv_tex = mesh.uv_textures.active.data - local_image = Ellipsis + local_image = None if context.tool_settings.show_uv_local_view: space_data = self._space_image(context) if space_data: local_image = space_data.image + has_active_texture = [ + self._get_active_texture(slot.material) + is local_image for slot in material_slots] for i, p in enumerate(polys): # context checks - if polys[i].select and local_image in {Ellipsis, - uv_tex[i].image}: + if (polys[i].select and (local_image is None or has_active_texture[polys[i].material_index])): start = p.loop_start end = start + p.loop_total - uvs = tuple((uv.uv[0], uv.uv[1]) - for uv in uv_layer[start:end]) + uvs = tuple((uv.uv[0], uv.uv[1]) for uv in uv_layer[start:end]) # just write what we see. yield (i, uvs) @@ -171,7 +227,6 @@ class ExportUVLayout(bpy.types.Operator): yield (i, uvs) def execute(self, context): - obj = context.active_object is_editmode = (obj.mode == 'EDIT') if is_editmode: @@ -186,24 +241,36 @@ class ExportUVLayout(bpy.types.Operator): if mode == 'EPS': from . import export_uv_eps - func = export_uv_eps.write + exportUV = export_uv_eps.Export_UV_EPS() elif mode == 'PNG': from . import export_uv_png - func = export_uv_png.write + exportUV = export_uv_png.Export_UV_PNG() elif mode == 'SVG': from . import export_uv_svg - func = export_uv_svg.write + exportUV = export_uv_svg.Export_UV_SVG() - if self.modified: - mesh = obj.to_mesh(context.scene, True, 'PREVIEW') - else: - mesh = obj.data + obList = [ob for ob in context.selected_objects if ob.type == 'MESH'] + + for obj in obList: + obj.data.tag = False - func(fw, mesh, self.size[0], self.size[1], self.opacity, - lambda: self._face_uv_iter(context, mesh, self.tessellated)) + exportUV.begin(fw, self.size, self.opacity) - if self.modified: - bpy.data.meshes.remove(mesh) + for obj in obList: + if (obj.data.tag): + continue + + obj.data.tag = True + + if self.modified: + mesh = obj.to_mesh(context.depsgraph, True) + else: + mesh = obj.data + + exportUV.build(mesh, lambda: self._face_uv_iter( + context, obj.material_slots, mesh)) + + exportUV.end() if is_editmode: bpy.ops.object.mode_set(mode='EDIT', toggle=False) @@ -234,13 +301,14 @@ def menu_func(self, context): def register(): - bpy.utils.register_module(__name__) + bpy.utils.register_class(ExportUVLayout) bpy.types.IMAGE_MT_uvs.append(menu_func) def unregister(): - bpy.utils.unregister_module(__name__) + bpy.utils.unregister_class(ExportUVLayout) bpy.types.IMAGE_MT_uvs.remove(menu_func) -if __name__ == "__main__": + +if __name__ == 'io_mesh_uv_layout': register() diff --git a/io_mesh_uv_layout/export_uv_eps.py b/io_mesh_uv_layout/export_uv_eps.py index a15dc266..d00e998a 100644 --- a/io_mesh_uv_layout/export_uv_eps.py +++ b/io_mesh_uv_layout/export_uv_eps.py @@ -21,66 +21,75 @@ import bpy -def write(fw, mesh, image_width, image_height, opacity, face_iter_func): - fw("%!PS-Adobe-3.0 EPSF-3.0\n") - fw("%%%%Creator: Blender %s\n" % bpy.app.version_string) - fw("%%Pages: 1\n") - fw("%%Orientation: Portrait\n") - fw("%%%%BoundingBox: 0 0 %d %d\n" % (image_width, image_height)) - fw("%%%%HiResBoundingBox: 0.0 0.0 %.4f %.4f\n" % - (image_width, image_height)) - fw("%%EndComments\n") - fw("%%Page: 1 1\n") - fw("0 0 translate\n") - fw("1.0 1.0 scale\n") - fw("0 0 0 setrgbcolor\n") - fw("[] 0 setdash\n") - fw("1 setlinewidth\n") - fw("1 setlinejoin\n") - fw("1 setlinecap\n") +class Export_UV_EPS: + def begin(self, fw, image_size, opacity): - polys = mesh.polygons + self.fw = fw + self.image_width = image_size[0] + self.image_height = image_size[1] + self.opacity = opacity - if opacity > 0.0: - for i, mat in enumerate(mesh.materials if mesh.materials else [None]): - fw("/DRAW_%d {" % i) - fw("gsave\n") - if mat: - color = tuple((1.0 - ((1.0 - c) * opacity)) - for c in mat.diffuse_color) - else: - color = 1.0, 1.0, 1.0 - fw("%.3g %.3g %.3g setrgbcolor\n" % color) - fw("fill\n") - fw("grestore\n") - fw("0 setgray\n") - fw("} def\n") + fw("%!PS-Adobe-3.0 EPSF-3.0\n") + fw("%%%%Creator: Blender %s\n" % bpy.app.version_string) + fw("%%Pages: 1\n") + fw("%%Orientation: Portrait\n") + fw("%%%%BoundingBox: 0 0 %d %d\n" % (self.image_width, self.image_height)) + fw("%%%%HiResBoundingBox: 0.0 0.0 %.4f %.4f\n" % + (self.image_width, self.image_height)) + fw("%%EndComments\n") + fw("%%Page: 1 1\n") + fw("0 0 translate\n") + fw("1.0 1.0 scale\n") + fw("0 0 0 setrgbcolor\n") + fw("[] 0 setdash\n") + fw("1 setlinewidth\n") + fw("1 setlinejoin\n") + fw("1 setlinecap\n") - # fill + def build(self, mesh, face_iter_func): + polys = mesh.polygons + + if self.opacity > 0.0: + for i, mat in enumerate(mesh.materials if mesh.materials else [None]): + self.fw("/DRAW_%d {" % i) + self.fw("gsave\n") + if mat: + color = tuple((1.0 - ((1.0 - c) * self.opacity)) + for c in mat.diffuse_color) + else: + color = 1.0, 1.0, 1.0 + self.fw("%.3g %.3g %.3g setrgbcolor\n" % color) + self.fw("fill\n") + self.fw("grestore\n") + self.fw("0 setgray\n") + self.fw("} def\n") + + # fill + for i, uvs in face_iter_func(): + self.fw("newpath\n") + for j, uv in enumerate(uvs): + uv_scale = (uv[0] * self.image_width, uv[1] * self.image_height) + if j == 0: + self.fw("%.5f %.5f moveto\n" % uv_scale) + else: + self.fw("%.5f %.5f lineto\n" % uv_scale) + + self.fw("closepath\n") + self.fw("DRAW_%d\n" % polys[i].material_index) + + # stroke only for i, uvs in face_iter_func(): - fw("newpath\n") + self.fw("newpath\n") for j, uv in enumerate(uvs): - uv_scale = (uv[0] * image_width, uv[1] * image_height) + uv_scale = (uv[0] * self.image_width, uv[1] * self.image_height) if j == 0: - fw("%.5f %.5f moveto\n" % uv_scale) + self.fw("%.5f %.5f moveto\n" % uv_scale) else: - fw("%.5f %.5f lineto\n" % uv_scale) - - fw("closepath\n") - fw("DRAW_%d\n" % polys[i].material_index) - - # stroke only - for i, uvs in face_iter_func(): - fw("newpath\n") - for j, uv in enumerate(uvs): - uv_scale = (uv[0] * image_width, uv[1] * image_height) - if j == 0: - fw("%.5f %.5f moveto\n" % uv_scale) - else: - fw("%.5f %.5f lineto\n" % uv_scale) + self.fw("%.5f %.5f lineto\n" % uv_scale) - fw("closepath\n") - fw("stroke\n") + self.fw("closepath\n") + self.fw("stroke\n") - fw("showpage\n") - fw("%%EOF\n") + def end(self): + self.fw("showpage\n") + self.fw("%%EOF\n") diff --git a/io_mesh_uv_layout/export_uv_png.py b/io_mesh_uv_layout/export_uv_png.py index b556c982..be03ed0b 100644 --- a/io_mesh_uv_layout/export_uv_png.py +++ b/io_mesh_uv_layout/export_uv_png.py @@ -21,131 +21,162 @@ import bpy -def write(fw, mesh_source, image_width, image_height, opacity, face_iter_func): - filepath = fw.__self__.name - fw.__self__.close() - - material_solids = [bpy.data.materials.new("uv_temp_solid") - for i in range(max(1, len(mesh_source.materials)))] - - material_wire = bpy.data.materials.new("uv_temp_wire") - - scene = bpy.data.scenes.new("uv_temp") - mesh = bpy.data.meshes.new("uv_temp") - for mat_solid in material_solids: - mesh.materials.append(mat_solid) - - polys_source = mesh_source.polygons - - # get unique UV's in case there are many overlapping - # which slow down filling. - face_hash = {(uvs, polys_source[i].material_index) - for i, uvs in face_iter_func()} - - # now set the faces coords and locations - # build mesh data - mesh_new_vertices = [] - mesh_new_materials = [] - mesh_new_polys_startloop = [] - mesh_new_polys_totloop = [] - mesh_new_loops_vertices = [] - - current_vert = 0 - - for uvs, mat_idx in face_hash: - num_verts = len(uvs) - dummy = (0.0,) * num_verts - for uv in uvs: - mesh_new_vertices += (uv[0], uv[1], 0.0) - mesh_new_polys_startloop.append(current_vert) - mesh_new_polys_totloop.append(num_verts) - mesh_new_loops_vertices += range(current_vert, - current_vert + num_verts) - mesh_new_materials.append(mat_idx) - current_vert += num_verts - - mesh.vertices.add(current_vert) - mesh.loops.add(current_vert) - mesh.polygons.add(len(mesh_new_polys_startloop)) - - mesh.vertices.foreach_set("co", mesh_new_vertices) - mesh.loops.foreach_set("vertex_index", mesh_new_loops_vertices) - mesh.polygons.foreach_set("loop_start", mesh_new_polys_startloop) - mesh.polygons.foreach_set("loop_total", mesh_new_polys_totloop) - mesh.polygons.foreach_set("material_index", mesh_new_materials) - - mesh.update(calc_edges=True) - - obj_solid = bpy.data.objects.new("uv_temp_solid", mesh) - obj_wire = bpy.data.objects.new("uv_temp_wire", mesh) - base_solid = scene.objects.link(obj_solid) - base_wire = scene.objects.link(obj_wire) - base_solid.layers[0] = True - base_wire.layers[0] = True - - # place behind the wire - obj_solid.location = 0, 0, -1 - - obj_wire.material_slots[0].link = 'OBJECT' - obj_wire.material_slots[0].material = material_wire - - # setup the camera - cam = bpy.data.cameras.new("uv_temp") - cam.type = 'ORTHO' - cam.ortho_scale = 1.0 - obj_cam = bpy.data.objects.new("uv_temp_cam", cam) - obj_cam.location = 0.5, 0.5, 1.0 - scene.objects.link(obj_cam) - scene.camera = obj_cam - - # setup materials - for i, mat_solid in enumerate(material_solids): - if mesh_source.materials and mesh_source.materials[i]: - mat_solid.diffuse_color = mesh_source.materials[i].diffuse_color - - mat_solid.use_shadeless = True - mat_solid.use_transparency = True - mat_solid.alpha = opacity - - material_wire.type = 'WIRE' - material_wire.use_shadeless = True - material_wire.diffuse_color = 0, 0, 0 - material_wire.use_transparency = True - - # scene render settings - scene.render.use_raytrace = False - scene.render.alpha_mode = 'TRANSPARENT' - scene.render.image_settings.color_mode = 'RGBA' - - scene.render.resolution_x = image_width - scene.render.resolution_y = image_height - scene.render.resolution_percentage = 100 - - if image_width > image_height: - scene.render.pixel_aspect_y = image_width / image_height - elif image_width < image_height: - scene.render.pixel_aspect_x = image_height / image_width - - scene.frame_start = 1 - scene.frame_end = 1 - - scene.render.image_settings.file_format = 'PNG' - scene.render.filepath = filepath - - scene.update() - - data_context = {"blend_data": bpy.context.blend_data, "scene": scene} - bpy.ops.render.render(data_context, write_still=True) - - # cleanup - bpy.data.scenes.remove(scene, do_unlink=True) - bpy.data.objects.remove(obj_cam, do_unlink=True) - bpy.data.objects.remove(obj_solid, do_unlink=True) - bpy.data.objects.remove(obj_wire, do_unlink=True) - - bpy.data.cameras.remove(cam, do_unlink=True) - bpy.data.meshes.remove(mesh, do_unlink=True) - - bpy.data.materials.remove(material_wire, do_unlink=True) - for mat_solid in material_solids: - bpy.data.materials.remove(mat_solid, do_unlink=True) +class Export_UV_PNG: + def begin(self, fw, image_size, opacity): + self.filepath = fw.__self__.name + fw.__self__.close() + + self.scene = bpy.data.scenes.new("uv_temp") + + image_width = image_size[0] + image_height = image_size[1] + + self.scene.render.resolution_x = image_width + self.scene.render.resolution_y = image_height + self.scene.render.resolution_percentage = 100 + + self.scene.render.alpha_mode = 'TRANSPARENT' + + if image_width > image_height: + self.scene.render.pixel_aspect_y = image_width / image_height + elif image_width < image_height: + self.scene.render.pixel_aspect_x = image_height / image_width + + self.base_material = bpy.data.materials.new("uv_temp_base") + self.base_material.use_nodes = True + self.base_material.node_tree.nodes.clear() + output_node = self.base_material.node_tree.nodes.new(type="ShaderNodeOutputMaterial") + emission_node = self.base_material.node_tree.nodes.new(type="ShaderNodeEmission") + emission_node.inputs["Color"].default_value = (1.0, 1.0, 1.0, opacity) + self.base_material.node_tree.links.new( + output_node.inputs["Surface"], + emission_node.outputs["Emission"]) + + self.material_wire = self.base_material.copy() + self.material_wire.name = "Wire" + self.material_wire.node_tree.nodes['Emission'].inputs["Color"].default_value = (0.0, 0.0, 0.0, 1.0) + + self.base_material.blend_method = "BLEND" + + self.material_solids_list = [] # list of lists + self.material_solids_list.append([self.base_material, + self.material_wire]) + + self.mesh_list = [] + self.obj_list = [] + + def build(self, mesh_source, face_iter_func): + material_solids = [self.base_material.copy() for i in range(max(1, len(mesh_source.materials)))] + + self.material_solids_list.append(material_solids) + + mesh = bpy.data.meshes.new("uv_temp") + self.mesh_list.append(mesh) + + for mat_solid in material_solids: + mesh.materials.append(mat_solid) + + # setup materials + for i, mat_solid in enumerate(material_solids): + if mesh_source.materials and mesh_source.materials[i]: + mat_solid.node_tree.nodes['Emission'].\ + inputs["Color"].default_value[0:3]\ + = mesh_source.materials[i].diffuse_color + + # Add materials for wireframe modifier. + for mat_solid in material_solids: + mesh.materials.append(self.material_wire) + + polys_source = mesh_source.polygons + + # get unique UV's in case there are many overlapping + # which slow down filling. + face_hash = {(uvs, polys_source[i].material_index) + for i, uvs in face_iter_func()} + + # now set the faces coords and locations + # build mesh data + mesh_new_vertices = [] + mesh_new_materials = [] + mesh_new_polys_startloop = [] + mesh_new_polys_totloop = [] + mesh_new_loops_vertices = [] + + current_vert = 0 + + for uvs, mat_idx in face_hash: + num_verts = len(uvs) + # dummy = (0.0,) * num_verts + for uv in uvs: + mesh_new_vertices += (uv[0], uv[1], 0.0) + mesh_new_polys_startloop.append(current_vert) + mesh_new_polys_totloop.append(num_verts) + mesh_new_loops_vertices += range(current_vert, + current_vert + num_verts) + mesh_new_materials.append(mat_idx) + current_vert += num_verts + + mesh.vertices.add(current_vert) + mesh.loops.add(current_vert) + mesh.polygons.add(len(mesh_new_polys_startloop)) + + mesh.vertices.foreach_set("co", mesh_new_vertices) + mesh.loops.foreach_set("vertex_index", mesh_new_loops_vertices) + mesh.polygons.foreach_set("loop_start", mesh_new_polys_startloop) + mesh.polygons.foreach_set("loop_total", mesh_new_polys_totloop) + mesh.polygons.foreach_set("material_index", mesh_new_materials) + + mesh.update(calc_edges=True) + + obj_solid = bpy.data.objects.new("uv_temp_solid", mesh) + + wire_mod = obj_solid.modifiers.new("wire_mod", 'WIREFRAME') + wire_mod.use_replace = False + wire_mod.use_relative_offset = True + + wire_mod.material_offset = len(material_solids) + + self.obj_list.append(obj_solid) + self.scene.collection.objects.link(obj_solid) + + def end(self): + # setup the camera + cam = bpy.data.cameras.new("uv_temp") + cam.type = 'ORTHO' + cam.ortho_scale = 1.0 + obj_cam = bpy.data.objects.new("uv_temp_cam", cam) + obj_cam.location = 0.5, 0.5, 1.0 + self.scene.collection.objects.link(obj_cam) + self.obj_list.append(obj_cam) + self.scene.camera = obj_cam + + # scene render settings + self.scene.render.alpha_mode = 'TRANSPARENT' + self.scene.render.image_settings.color_mode = 'RGBA' + + self.scene.frame_start = 1 + self.scene.frame_end = 1 + + self.scene.render.image_settings.file_format = 'PNG' + self.scene.render.filepath = self.filepath + + self.scene.update() + + data_context = {"blend_data": bpy.context.blend_data, + "scene": self.scene} + bpy.ops.render.render(data_context, write_still=True) + + # cleanup + bpy.data.scenes.remove(self.scene, do_unlink=True) + + for obj in self.obj_list: + bpy.data.objects.remove(obj, do_unlink=True) + + bpy.data.cameras.remove(cam, do_unlink=True) + + for mesh in self.mesh_list: + bpy.data.meshes.remove(mesh, do_unlink=True) + + for material_solids in self.material_solids_list: + for mat_solid in material_solids: + bpy.data.materials.remove(mat_solid, do_unlink=True) diff --git a/io_mesh_uv_layout/export_uv_svg.py b/io_mesh_uv_layout/export_uv_svg.py index 764f0d34..fe727d09 100644 --- a/io_mesh_uv_layout/export_uv_svg.py +++ b/io_mesh_uv_layout/export_uv_svg.py @@ -21,48 +21,63 @@ import bpy -def write(fw, mesh, image_width, image_height, opacity, face_iter_func): - # for making an XML compatible string - from xml.sax.saxutils import escape - from os.path import basename - - fw('<?xml version="1.0" standalone="no"?>\n') - fw('<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" \n') - fw(' "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">\n') - fw('<svg width="%d" height="%d" viewBox="0 0 %d %d"\n' % - (image_width, image_height, image_width, image_height)) - fw(' xmlns="http://www.w3.org/2000/svg" version="1.1">\n') - desc = ("%r, %s, (Blender %s)" % - (basename(bpy.data.filepath), mesh.name, bpy.app.version_string)) - fw('<desc>%s</desc>\n' % escape(desc)) - - # svg colors - fill_settings = [] - fill_default = 'fill="grey"' - for mat in mesh.materials if mesh.materials else [None]: - if mat: - fill_settings.append('fill="rgb(%d, %d, %d)"' % - tuple(int(c * 255) - for c in mat.diffuse_color)) - else: - fill_settings.append(fill_default) - - polys = mesh.polygons - for i, uvs in face_iter_func(): - try: # rare cases material index is invalid. - fill = fill_settings[polys[i].material_index] - except IndexError: - fill = fill_default - - fw('<polygon stroke="black" stroke-width="1"') - if opacity > 0.0: - fw(' %s fill-opacity="%.2g"' % (fill, opacity)) - - fw(' points="') - - for j, uv in enumerate(uvs): - x, y = uv[0], 1.0 - uv[1] - fw('%.3f,%.3f ' % (x * image_width, y * image_height)) - fw('" />\n') - fw('\n') - fw('</svg>\n') +from xml.sax.saxutils import escape +from os.path import basename + + +class Export_UV_SVG: + def begin(self, fw, image_size, opacity): + + self.fw = fw + self.image_width = image_size[0] + self.image_height = image_size[1] + self.opacity = opacity + + fw('<?xml version="1.0" standalone="no"?>\n') + fw('<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" \n') + fw(' "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">\n') + fw('<svg width="%d" height="%d" viewBox="0 0 %d %d"\n' % + (self.image_width, self.image_height, self.image_width, self.image_height)) + fw(' xmlns="http://www.w3.org/2000/svg" version="1.1">\n') + desc = ("%r, (Blender %s)" % + (basename(bpy.data.filepath), bpy.app.version_string)) + fw('<desc>%s</desc>\n' % escape(desc)) + + def build(self, mesh, face_iter_func): + self.fw('<g>\n') + desc = ("Mesh: %s" % (mesh.name)) + self.fw('<desc>%s</desc>\n' % escape(desc)) + + # svg colors + fill_settings = [] + fill_default = 'fill="grey"' + for mat in mesh.materials if mesh.materials else [None]: + if mat: + fill_settings.append('fill="rgb(%d, %d, %d)"' % + tuple(int(c * 255) for c in mat.diffuse_color)) + else: + fill_settings.append(fill_default) + + polys = mesh.polygons + for i, uvs in face_iter_func(): + try: # rare cases material index is invalid. + fill = fill_settings[polys[i].material_index] + except IndexError: + fill = fill_default + + self.fw('<polygon stroke="black" stroke-width="1"') + if self.opacity > 0.0: + self.fw(' %s fill-opacity="%.2g"' % (fill, self.opacity)) + + self.fw(' points="') + + for j, uv in enumerate(uvs): + x, y = uv[0], 1.0 - uv[1] + self.fw('%.3f,%.3f ' % (x * self.image_width, y * self.image_height)) + self.fw('" />\n') + + self.fw('</g>\n') + + def end(self): + self.fw('\n') + self.fw('</svg>\n') diff --git a/io_online_sketchfab/__init__.py b/io_online_sketchfab/__init__.py index bad00e82..e483d17a 100644 --- a/io_online_sketchfab/__init__.py +++ b/io_online_sketchfab/__init__.py @@ -247,7 +247,7 @@ class ExportSketchfab(Operator): with open(SKETCHFAB_EXPORT_DATA_FILE, 'w') as s: json.dump({ "models": props.models, - "lamps": props.lamps, + "lights": props.lights, }, s) subprocess.check_call([ @@ -311,7 +311,7 @@ class VIEW3D_PT_sketchfab(Panel): layout.label("Export:") col = layout.box().column(align=True) col.prop(props, "models") - col.prop(props, "lamps") + col.prop(props, "lights") layout.label("Model info:") col = layout.box().column(align=True) diff --git a/io_online_sketchfab/pack_for_export.py b/io_online_sketchfab/pack_for_export.py index e9fbde72..9177b44e 100644 --- a/io_online_sketchfab/pack_for_export.py +++ b/io_online_sketchfab/pack_for_export.py @@ -87,12 +87,12 @@ def prepare_assets(export_settings): images.add(image) if ((export_settings['models'] == 'SELECTION' and ob.type == 'MESH') or - (export_settings['lamps'] == 'SELECTION' and ob.type == 'LAMP')): + (export_settings['lamps'] == 'SELECTION' and ob.type == 'LIGHT')): if not ob.select and not ob.hide: ob.hide = True hidden.add(ob) - elif export_settings['lamps'] == 'NONE' and ob.type == 'LAMP': + elif export_settings['lamps'] == 'NONE' and ob.type == 'LIGHT': if not ob.hide: ob.hide = True hidden.add(ob) diff --git a/io_scene_3ds/__init__.py b/io_scene_3ds/__init__.py index 9236c07e..4377674d 100644 --- a/io_scene_3ds/__init__.py +++ b/io_scene_3ds/__init__.py @@ -149,15 +149,15 @@ def menu_func_import(self, context): def register(): bpy.utils.register_module(__name__) - bpy.types.INFO_MT_file_import.append(menu_func_import) - bpy.types.INFO_MT_file_export.append(menu_func_export) + bpy.types.TOPBAR_MT_file_import.append(menu_func_import) + bpy.types.TOPBAR_MT_file_export.append(menu_func_export) def unregister(): bpy.utils.unregister_module(__name__) - bpy.types.INFO_MT_file_import.remove(menu_func_import) - bpy.types.INFO_MT_file_export.remove(menu_func_export) + bpy.types.TOPBAR_MT_file_import.remove(menu_func_import) + bpy.types.TOPBAR_MT_file_export.remove(menu_func_export) # NOTES: # why add 1 extra vertex? and remove it when done? - diff --git a/io_scene_3ds/import_3ds.py b/io_scene_3ds/import_3ds.py index 862fe2a7..cf17edcd 100644 --- a/io_scene_3ds/import_3ds.py +++ b/io_scene_3ds/import_3ds.py @@ -83,27 +83,27 @@ MAT_24BIT_COLOR = 0x0011 # color defined as 3 bytes #>------ sub defines of OBJECT OBJECT_MESH = 0x4100 # This lets us know that we are reading a new object -OBJECT_LAMP = 0x4600 # This lets un know we are reading a light object -OBJECT_LAMP_SPOT = 0x4610 # The light is a spotloght. -OBJECT_LAMP_OFF = 0x4620 # The light off. -OBJECT_LAMP_ATTENUATE = 0x4625 -OBJECT_LAMP_RAYSHADE = 0x4627 -OBJECT_LAMP_SHADOWED = 0x4630 -OBJECT_LAMP_LOCAL_SHADOW = 0x4640 -OBJECT_LAMP_LOCAL_SHADOW2 = 0x4641 -OBJECT_LAMP_SEE_CONE = 0x4650 -OBJECT_LAMP_SPOT_RECTANGULAR = 0x4651 -OBJECT_LAMP_SPOT_OVERSHOOT = 0x4652 -OBJECT_LAMP_SPOT_PROJECTOR = 0x4653 -OBJECT_LAMP_EXCLUDE = 0x4654 -OBJECT_LAMP_RANGE = 0x4655 -OBJECT_LAMP_ROLL = 0x4656 -OBJECT_LAMP_SPOT_ASPECT = 0x4657 -OBJECT_LAMP_RAY_BIAS = 0x4658 -OBJECT_LAMP_INNER_RANGE = 0x4659 -OBJECT_LAMP_OUTER_RANGE = 0x465A -OBJECT_LAMP_MULTIPLIER = 0x465B -OBJECT_LAMP_AMBIENT_LIGHT = 0x4680 +OBJECT_LIGHT = 0x4600 # This lets un know we are reading a light object +OBJECT_LIGHT_SPOT = 0x4610 # The light is a spotloght. +OBJECT_LIGHT_OFF = 0x4620 # The light off. +OBJECT_LIGHT_ATTENUATE = 0x4625 +OBJECT_LIGHT_RAYSHADE = 0x4627 +OBJECT_LIGHT_SHADOWED = 0x4630 +OBJECT_LIGHT_LOCAL_SHADOW = 0x4640 +OBJECT_LIGHT_LOCAL_SHADOW2 = 0x4641 +OBJECT_LIGHT_SEE_CONE = 0x4650 +OBJECT_LIGHT_SPOT_RECTANGULAR = 0x4651 +OBJECT_LIGHT_SPOT_OVERSHOOT = 0x4652 +OBJECT_LIGHT_SPOT_PROJECTOR = 0x4653 +OBJECT_LIGHT_EXCLUDE = 0x4654 +OBJECT_LIGHT_RANGE = 0x4655 +OBJECT_LIGHT_ROLL = 0x4656 +OBJECT_LIGHT_SPOT_ASPECT = 0x4657 +OBJECT_LIGHT_RAY_BIAS = 0x4658 +OBJECT_LIGHT_INNER_RANGE = 0x4659 +OBJECT_LIGHT_OUTER_RANGE = 0x465A +OBJECT_LIGHT_MULTIPLIER = 0x465B +OBJECT_LIGHT_AMBIENT_LIGHT = 0x4680 OBJECT_CAMERA = 0x4700 # This lets un know we are reading a camera object @@ -596,7 +596,7 @@ def process_next_chunk(file, previous_chunk, importedObjects, IMAGE_SEARCH): new_chunk.bytes_read += temp_chunk.bytes_read - elif new_chunk.ID == OBJECT_LAMP: # Basic lamp support. + elif new_chunk.ID == OBJECT_LIGHT: # Basic lamp support. temp_data = file.read(STRUCT_SIZE_3FLOAT) @@ -604,7 +604,7 @@ def process_next_chunk(file, previous_chunk, importedObjects, IMAGE_SEARCH): new_chunk.bytes_read += STRUCT_SIZE_3FLOAT # no lamp in dict that would be confusing - contextLamp[1] = bpy.data.lamps.new("Lamp", 'POINT') + contextLamp[1] = bpy.data.lights.new("Lamp", 'POINT') contextLamp[0] = ob = bpy.data.objects.new("Lamp", contextLamp[1]) SCN.objects.link(ob) @@ -946,8 +946,8 @@ def load_3ds(filepath, axis_min = [1000000000] * 3 axis_max = [-1000000000] * 3 - global_clamp_size = IMPORT_CONSTRAIN_BOUNDS - if global_clamp_size != 0.0: + global_clight_size = IMPORT_CONSTRAIN_BOUNDS + if global_clight_size != 0.0: # Get all object bounds for ob in importedObjects: for v in ob.bound_box: @@ -963,7 +963,7 @@ def load_3ds(filepath, axis_max[2] - axis_min[2]) scale = 1.0 - while global_clamp_size < max_axis * scale: + while global_clight_size < max_axis * scale: scale = scale / 10.0 scale_mat = mathutils.Matrix.Scale(scale, 4) diff --git a/io_scene_fbx/__init__.py b/io_scene_fbx/__init__.py index 920ddc4c..523d3a29 100644 --- a/io_scene_fbx/__init__.py +++ b/io_scene_fbx/__init__.py @@ -314,13 +314,13 @@ class ExportFBX(bpy.types.Operator, ExportHelper, IOFBXOrientationHelper): options={'ENUM_FLAG'}, items=(('EMPTY', "Empty", ""), ('CAMERA', "Camera", ""), - ('LAMP', "Lamp", ""), + ('LIGHT', "Lamp", ""), ('ARMATURE', "Armature", "WARNING: not supported in dupli/group instances"), ('MESH', "Mesh", ""), ('OTHER', "Other", "Other geometry types, like curve, metaball, etc. (converted to meshes)"), ), description="Which kind of object to export", - default={'EMPTY', 'CAMERA', 'LAMP', 'ARMATURE', 'MESH', 'OTHER'}, + default={'EMPTY', 'CAMERA', 'LIGHT', 'ARMATURE', 'MESH', 'OTHER'}, ) use_mesh_modifiers = BoolProperty( @@ -641,13 +641,13 @@ def register(): for cls in classes: bpy.utils.register_class(cls) - bpy.types.INFO_MT_file_import.append(menu_func_import) - bpy.types.INFO_MT_file_export.append(menu_func_export) + bpy.types.TOPBAR_MT_file_import.append(menu_func_import) + bpy.types.TOPBAR_MT_file_export.append(menu_func_export) def unregister(): - bpy.types.INFO_MT_file_import.remove(menu_func_import) - bpy.types.INFO_MT_file_export.remove(menu_func_export) + bpy.types.TOPBAR_MT_file_import.remove(menu_func_import) + bpy.types.TOPBAR_MT_file_export.remove(menu_func_export) for cls in classes: bpy.utils.unregister_class(cls) diff --git a/io_scene_fbx/export_fbx.py b/io_scene_fbx/export_fbx.py index e62d512d..704614ef 100644 --- a/io_scene_fbx/export_fbx.py +++ b/io_scene_fbx/export_fbx.py @@ -236,7 +236,7 @@ header_comment = \ def save_single(operator, scene, filepath="", global_matrix=None, context_objects=None, - object_types={'EMPTY', 'CAMERA', 'LAMP', 'ARMATURE', 'MESH'}, + object_types={'EMPTY', 'CAMERA', 'LIGHT', 'ARMATURE', 'MESH'}, use_mesh_modifiers=True, mesh_smooth_type='FACE', use_armature_deform_only=False, @@ -423,7 +423,7 @@ def save_single(operator, scene, filepath="", matrix_rot = (global_matrix * self.__anim_poselist[frame]).to_3x3() # Lamps need to be rotated - if obj_type == 'LAMP': + if obj_type == 'LIGHT': matrix_rot = matrix_rot * mtx_x90 elif obj_type == 'CAMERA': y = matrix_rot * Vector((0.0, 1.0, 0.0)) @@ -520,7 +520,7 @@ def save_single(operator, scene, filepath="", matrix_rot = rot.to_matrix() # Lamps need to be rotated - if ob and ob.type == 'LAMP': + if ob and ob.type == 'LIGHT': matrix_rot = matrix_rot * mtx_x90 elif ob and ob.type == 'CAMERA': y = matrix_rot * Vector((0.0, 1.0, 0.0)) @@ -1243,8 +1243,8 @@ def save_single(operator, scene, filepath="", Property: "CurrentMappingType", "enum", "",0 Property: "UVSwap", "bool", "",0''') - fw('\n\t\t\tProperty: "WrapModeU", "enum", "",%i' % tex.use_clamp_x) - fw('\n\t\t\tProperty: "WrapModeV", "enum", "",%i' % tex.use_clamp_y) + fw('\n\t\t\tProperty: "WrapModeU", "enum", "",%i' % tex.use_clight_x) + fw('\n\t\t\tProperty: "WrapModeV", "enum", "",%i' % tex.use_clight_y) fw(''' Property: "TextureRotationPivot", "Vector3D", "",0,0,0 @@ -1809,8 +1809,8 @@ def save_single(operator, scene, filepath="", if tmp_ob_type == 'CAMERA': if 'CAMERA' in object_types: ob_cameras.append(my_object_generic(ob, mtx)) - elif tmp_ob_type == 'LAMP': - if 'LAMP' in object_types: + elif tmp_ob_type == 'LIGHT': + if 'LIGHT' in object_types: ob_lights.append(my_object_generic(ob, mtx)) elif tmp_ob_type == 'ARMATURE': if 'ARMATURE' in object_types: @@ -2086,7 +2086,7 @@ def save_single(operator, scene, filepath="", assert(not (materials and ('MESH' not in object_types))) assert(not (textures and ('MESH' not in object_types))) - assert(not (ob_lights and ('LAMP' not in object_types))) + assert(not (ob_lights and ('LIGHT' not in object_types))) assert(not (ob_cameras and ('CAMERA' not in object_types))) except AssertionError: diff --git a/io_scene_fbx/export_fbx_bin.py b/io_scene_fbx/export_fbx_bin.py index 2df62e3f..09638c5d 100644 --- a/io_scene_fbx/export_fbx_bin.py +++ b/io_scene_fbx/export_fbx_bin.py @@ -571,13 +571,13 @@ def fbx_data_empty_elements(root, empty, scene_data): # No custom properties, already saved with object (Model). -def fbx_data_lamp_elements(root, lamp, scene_data): +def fbx_data_light_elements(root, lamp, scene_data): """ Write the Lamp data block. """ gscale = scene_data.settings.global_scale - lamp_key = scene_data.data_lamps[lamp] + light_key = scene_data.data_lights[lamp] do_light = True decay_type = FBX_LIGHT_DECAY_TYPES['CONSTANT'] do_shadow = False @@ -589,7 +589,7 @@ def fbx_data_lamp_elements(root, lamp, scene_data): do_shadow = lamp.shadow_method not in {'NOSHADOW'} shadow_color = lamp.shadow_color - light = elem_data_single_int64(root, b"NodeAttribute", get_fbx_uuid_from_key(lamp_key)) + light = elem_data_single_int64(root, b"NodeAttribute", get_fbx_uuid_from_key(light_key)) light.add_string(fbx_name_class(lamp.name.encode(), b"NodeAttribute")) light.add_string(b"Light") @@ -1570,7 +1570,7 @@ def fbx_data_object_elements(root, ob_obj, scene_data): obj_type = b"Null" elif (ob_obj.type in BLENDER_OBJECT_TYPES_MESHLIKE): obj_type = b"Mesh" - elif (ob_obj.type == 'LAMP'): + elif (ob_obj.type == 'LIGHT'): obj_type = b"Light" elif (ob_obj.type == 'CAMERA'): obj_type = b"Camera" @@ -2073,13 +2073,13 @@ def fbx_animations(scene_data): 'delta_location', 'delta_rotation_euler', 'delta_rotation_quaternion', 'delta_scale', 'lock_location', 'lock_rotation', 'lock_rotation_w', 'lock_rotations_4d', 'lock_scale', 'tag', 'layers', 'select', 'track_axis', 'up_axis', 'active_material', 'active_material_index', - 'matrix_parent_inverse', 'empty_draw_type', 'empty_draw_size', 'empty_image_offset', 'pass_index', + 'matrix_parent_inverse', 'empty_display_type', 'empty_display_size', 'empty_image_offset', 'pass_index', 'color', 'hide', 'hide_select', 'hide_render', 'use_slow_parent', 'slow_parent_offset', 'use_extra_recalc_object', 'use_extra_recalc_data', 'dupli_type', 'use_dupli_frames_speed', 'use_dupli_vertices_rotation', 'use_dupli_faces_scale', 'dupli_faces_scale', 'dupli_group', 'dupli_frames_start', 'dupli_frames_end', 'dupli_frames_on', 'dupli_frames_off', - 'draw_type', 'show_bounds', 'draw_bounds_type', 'show_name', 'show_axis', 'show_texture_space', - 'show_wire', 'show_all_edges', 'show_transparent', 'show_x_ray', + 'display_type', 'show_bounds', 'display_bounds_type', 'show_name', 'show_axis', 'show_texture_space', + 'show_wire', 'show_all_edges', 'show_transparent', 'show_in_front', 'show_only_shape_key', 'use_shape_key_edit_mode', 'active_shape_key_index', ) for p in props: @@ -2175,8 +2175,8 @@ def fbx_data_from_scene(scene, settings): perfmon.step("FBX export prepare: Wrapping Data (lamps, cameras, empties)...") - data_lamps = OrderedDict((ob_obj.bdata.data, get_blenderID_key(ob_obj.bdata.data)) - for ob_obj in objects if ob_obj.type == 'LAMP') + data_lights = OrderedDict((ob_obj.bdata.data, get_blenderID_key(ob_obj.bdata.data)) + for ob_obj in objects if ob_obj.type == 'LIGHT') # Unfortunately, FBX camera data contains object-level data (like position, orientation, etc.)... data_cameras = OrderedDict((ob_obj, get_blenderID_key(ob_obj.bdata.data)) for ob_obj in objects if ob_obj.type == 'CAMERA') @@ -2376,7 +2376,7 @@ def fbx_data_from_scene(scene, settings): tmp_scdata = FBXExportData( None, None, None, settings, scene, objects, None, None, 0.0, 0.0, - data_empties, data_lamps, data_cameras, data_meshes, None, + data_empties, data_lights, data_cameras, data_meshes, None, data_bones, data_leaf_bones, data_deformers_skin, data_deformers_shape, data_world, data_materials, data_textures, data_videos, ) @@ -2392,8 +2392,8 @@ def fbx_data_from_scene(scene, settings): if data_empties: templates[b"Null"] = fbx_template_def_null(scene, settings, nbr_users=len(data_empties)) - if data_lamps: - templates[b"Light"] = fbx_template_def_light(scene, settings, nbr_users=len(data_lamps)) + if data_lights: + templates[b"Light"] = fbx_template_def_light(scene, settings, nbr_users=len(data_lights)) if data_cameras: templates[b"Camera"] = fbx_template_def_camera(scene, settings, nbr_users=len(data_cameras)) @@ -2491,9 +2491,9 @@ def fbx_data_from_scene(scene, settings): bo_data_key = data_bones[ob_obj] connections.append((b"OO", get_fbx_uuid_from_key(bo_data_key), ob_obj.fbx_uuid, None)) else: - if ob_obj.type == 'LAMP': - lamp_key = data_lamps[ob_obj.bdata.data] - connections.append((b"OO", get_fbx_uuid_from_key(lamp_key), ob_obj.fbx_uuid, None)) + if ob_obj.type == 'LIGHT': + light_key = data_lights[ob_obj.bdata.data] + connections.append((b"OO", get_fbx_uuid_from_key(light_key), ob_obj.fbx_uuid, None)) elif ob_obj.type == 'CAMERA': cam_key = data_cameras[ob_obj] connections.append((b"OO", get_fbx_uuid_from_key(cam_key), ob_obj.fbx_uuid, None)) @@ -2594,7 +2594,7 @@ def fbx_data_from_scene(scene, settings): return FBXExportData( templates, templates_users, connections, settings, scene, objects, animations, animated, frame_start, frame_end, - data_empties, data_lamps, data_cameras, data_meshes, mesh_mat_indices, + data_empties, data_lights, data_cameras, data_meshes, mesh_mat_indices, data_bones, data_leaf_bones, data_deformers_skin, data_deformers_shape, data_world, data_materials, data_textures, data_videos, ) @@ -2803,10 +2803,10 @@ def fbx_objects_elements(root, scene_data): for empty in scene_data.data_empties: fbx_data_empty_elements(objects, empty, scene_data) - perfmon.step("FBX export fetch lamps (%d)..." % len(scene_data.data_lamps)) + perfmon.step("FBX export fetch lamps (%d)..." % len(scene_data.data_lights)) - for lamp in scene_data.data_lamps: - fbx_data_lamp_elements(objects, lamp, scene_data) + for lamp in scene_data.data_lights: + fbx_data_light_elements(objects, lamp, scene_data) perfmon.step("FBX export fetch cameras (%d)..." % len(scene_data.data_cameras)) @@ -2935,7 +2935,7 @@ def save_single(operator, scene, filepath="", ObjectWrapper.cache_clear() if object_types is None: - object_types = {'EMPTY', 'CAMERA', 'LAMP', 'ARMATURE', 'MESH', 'OTHER'} + object_types = {'EMPTY', 'CAMERA', 'LIGHT', 'ARMATURE', 'MESH', 'OTHER'} if 'OTHER' in object_types: object_types |= BLENDER_OTHER_OBJECT_TYPES diff --git a/io_scene_fbx/fbx_utils.py b/io_scene_fbx/fbx_utils.py index 82e17fe2..25f5759b 100644 --- a/io_scene_fbx/fbx_utils.py +++ b/io_scene_fbx/fbx_utils.py @@ -71,7 +71,7 @@ FBX_ANIM_PROPSGROUP_NAME = "d" FBX_KTIME = 46186158000 # This is the number of "ktimes" in one second (yep, precision over the nanosecond...) -MAT_CONVERT_LAMP = Matrix.Rotation(math.pi / 2.0, 4, 'X') # Blender is -Z, FBX is -Y. +MAT_CONVERT_LIGHT = Matrix.Rotation(math.pi / 2.0, 4, 'X') # Blender is -Z, FBX is -Y. MAT_CONVERT_CAMERA = Matrix.Rotation(math.pi / 2.0, 4, 'Y') # Blender is -Z, FBX is +X. # XXX I can't get this working :( # MAT_CONVERT_BONE = Matrix.Rotation(math.pi / 2.0, 4, 'Z') # Blender is +Y, FBX is -X. @@ -1069,8 +1069,8 @@ class ObjectWrapper(metaclass=MetaObjectWrapper): # Apply the bone correction. if scene_data.settings.bone_correction_matrix: matrix = matrix * scene_data.settings.bone_correction_matrix - elif self.bdata.type == 'LAMP': - matrix = matrix * MAT_CONVERT_LAMP + elif self.bdata.type == 'LIGHT': + matrix = matrix * MAT_CONVERT_LIGHT elif self.bdata.type == 'CAMERA': matrix = matrix * MAT_CONVERT_CAMERA @@ -1214,7 +1214,7 @@ FBXExportSettings = namedtuple("FBXExportSettings", ( FBXExportData = namedtuple("FBXExportData", ( "templates", "templates_users", "connections", "settings", "scene", "objects", "animations", "animated", "frame_start", "frame_end", - "data_empties", "data_lamps", "data_cameras", "data_meshes", "mesh_mat_indices", + "data_empties", "data_lights", "data_cameras", "data_meshes", "mesh_mat_indices", "data_bones", "data_leaf_bones", "data_deformers_skin", "data_deformers_shape", "data_world", "data_materials", "data_textures", "data_videos", )) diff --git a/io_scene_fbx/import_fbx.py b/io_scene_fbx/import_fbx.py index 446be0ff..e9582278 100644 --- a/io_scene_fbx/import_fbx.py +++ b/io_scene_fbx/import_fbx.py @@ -60,7 +60,7 @@ fbx_elem_nil = None convert_deg_to_rad_iter = units_convertor_iter("degree", "radian") MAT_CONVERT_BONE = fbx_utils.MAT_CONVERT_BONE.inverted() -MAT_CONVERT_LAMP = fbx_utils.MAT_CONVERT_LAMP.inverted() +MAT_CONVERT_LIGHT = fbx_utils.MAT_CONVERT_LIGHT.inverted() MAT_CONVERT_CAMERA = fbx_utils.MAT_CONVERT_CAMERA.inverted() @@ -1477,7 +1477,7 @@ def blen_read_light(fbx_tmpl, fbx_obj, global_scale): elem_find_first(fbx_tmpl, b'Properties70', fbx_elem_nil)) # rare if fbx_props[0] is None: - lamp = bpy.data.lamps.new(name=elem_name_utf8, type='POINT') + lamp = bpy.data.lights.new(name=elem_name_utf8, type='POINT') return lamp light_type = { @@ -1485,7 +1485,7 @@ def blen_read_light(fbx_tmpl, fbx_obj, global_scale): 1: 'SUN', 2: 'SPOT'}.get(elem_props_get_enum(fbx_props, b'LightType', 0), 'POINT') - lamp = bpy.data.lamps.new(name=elem_name_utf8, type=light_type) + lamp = bpy.data.lights.new(name=elem_name_utf8, type=light_type) if light_type == 'SPOT': spot_size = elem_props_get_number(fbx_props, b'OuterAngle', None) @@ -1706,7 +1706,7 @@ class FbxImportHelperNode: if self.fbx_type == b'Camera': correction_matrix = MAT_CONVERT_CAMERA elif self.fbx_type == b'Light': - correction_matrix = MAT_CONVERT_LAMP + correction_matrix = MAT_CONVERT_LIGHT self.post_matrix = correction_matrix diff --git a/io_scene_ms3d/__init__.py b/io_scene_ms3d/__init__.py index 794aae6b..805b1d83 100644 --- a/io_scene_ms3d/__init__.py +++ b/io_scene_ms3d/__init__.py @@ -64,8 +64,8 @@ from bpy.utils import ( unregister_module, ) from bpy.types import ( - INFO_MT_file_export, - INFO_MT_file_import, + TOPBAR_MT_file_export, + TOPBAR_MT_file_import, ) @@ -82,16 +82,16 @@ def register(): ms3d_ui.register() register_module(__name__) - INFO_MT_file_export.append(Ms3dExportOperator.menu_func) - INFO_MT_file_import.append(Ms3dImportOperator.menu_func) + TOPBAR_MT_file_export.append(Ms3dExportOperator.menu_func) + TOPBAR_MT_file_import.append(Ms3dImportOperator.menu_func) def unregister(): ms3d_ui.unregister() unregister_module(__name__) - INFO_MT_file_export.remove(Ms3dExportOperator.menu_func) - INFO_MT_file_import.remove(Ms3dImportOperator.menu_func) + TOPBAR_MT_file_export.remove(Ms3dExportOperator.menu_func) + TOPBAR_MT_file_import.remove(Ms3dImportOperator.menu_func) ############################################################################### diff --git a/io_scene_ms3d/ms3d_import.py b/io_scene_ms3d/ms3d_import.py index a2205556..9a6fb42f 100644 --- a/io_scene_ms3d/ms3d_import.py +++ b/io_scene_ms3d/ms3d_import.py @@ -690,14 +690,14 @@ class Ms3dImporter(): blender_armature = blender_context.blend_data.armatures.new( ms3d_armature_name) blender_armature.ms3d.name = ms3d_model.name - blender_armature.draw_type = 'STICK' + blender_armature.display_type = 'STICK' blender_armature.show_axes = True blender_armature.use_auto_ik = True blender_armature_object = blender_context.blend_data.objects.new( ms3d_armature_object_name, blender_armature) blender_scene.objects.link(blender_armature_object) #blender_armature_object.location = blender_scene.cursor_location - blender_armature_object.show_x_ray = True + blender_armature_object.show_in_front = True ########################## # create new modifier diff --git a/io_scene_ms3d/ms3d_ui.py b/io_scene_ms3d/ms3d_ui.py index 134447d1..b8753f5b 100644 --- a/io_scene_ms3d/ms3d_ui.py +++ b/io_scene_ms3d/ms3d_ui.py @@ -210,7 +210,7 @@ class Ms3dUi: return ms3d_value ########################################################################### - ICON_OPTIONS = 'LAMP' + ICON_OPTIONS = 'LIGHT' ICON_OBJECT = 'WORLD' ICON_PROCESSING = 'OBJECT_DATAMODE' ICON_MODIFIER = 'MODIFIER' diff --git a/io_scene_obj/__init__.py b/io_scene_obj/__init__.py index d15a6cc7..66329447 100644 --- a/io_scene_obj/__init__.py +++ b/io_scene_obj/__init__.py @@ -111,7 +111,7 @@ class ImportOBJ(bpy.types.Operator, ImportHelper, IOOBJOrientationHelper): ), ) - global_clamp_size = FloatProperty( + global_clight_size = FloatProperty( name="Clamp Size", description="Clamp bounds under this value (zero to disable)", min=0.0, max=1000.0, @@ -139,7 +139,7 @@ class ImportOBJ(bpy.types.Operator, ImportHelper, IOOBJOrientationHelper): from_up=self.axis_up, ).to_4x4() keywords["global_matrix"] = global_matrix - keywords["use_cycles"] = (context.scene.render.engine == 'CYCLES') + keywords["use_cycles"] = (context.scene.view_render.engine == 'CYCLES') if bpy.data.is_saved and context.user_preferences.filepaths.use_relative_paths: import os @@ -167,7 +167,7 @@ class ImportOBJ(bpy.types.Operator, ImportHelper, IOOBJOrientationHelper): row.prop(self, "use_groups_as_vgroups") row = layout.split(percentage=0.67) - row.prop(self, "global_clamp_size") + row.prop(self, "global_clight_size") layout.prop(self, "axis_forward") layout.prop(self, "axis_up") @@ -330,13 +330,13 @@ def register(): for cls in classes: bpy.utils.register_class(cls) - bpy.types.INFO_MT_file_import.append(menu_func_import) - bpy.types.INFO_MT_file_export.append(menu_func_export) + bpy.types.TOPBAR_MT_file_import.append(menu_func_import) + bpy.types.TOPBAR_MT_file_export.append(menu_func_export) def unregister(): - bpy.types.INFO_MT_file_import.remove(menu_func_import) - bpy.types.INFO_MT_file_export.remove(menu_func_export) + bpy.types.TOPBAR_MT_file_import.remove(menu_func_import) + bpy.types.TOPBAR_MT_file_export.remove(menu_func_export) for cls in classes: bpy.utils.unregister_class(cls) diff --git a/io_scene_obj/export_obj.py b/io_scene_obj/export_obj.py index 15b80ab3..22d688da 100644 --- a/io_scene_obj/export_obj.py +++ b/io_scene_obj/export_obj.py @@ -47,10 +47,7 @@ def write_mtl(scene, filepath, path_mode, copy_set, mtl_dict): from mathutils import Color, Vector world = scene.world - if world: - world_amb = world.ambient_color - else: - world_amb = Color((0.0, 0.0, 0.0)) + world_amb = Color((0.0, 0.0, 0.0)) source_dir = os.path.dirname(bpy.data.filepath) dest_dir = os.path.dirname(filepath) @@ -271,7 +268,7 @@ def write_nurb(fw, ob, ob_mat): return tot_verts -def write_file(filepath, objects, scene, +def write_file(filepath, objects, depsgraph, scene, EXPORT_TRI=False, EXPORT_EDGES=False, EXPORT_SMOOTH_GROUPS=False, @@ -388,8 +385,7 @@ def write_file(filepath, objects, scene, # END NURBS try: - me = ob.to_mesh(scene, EXPORT_APPLY_MODIFIERS, calc_tessface=False, - settings='RENDER' if EXPORT_APPLY_MODIFIERS_RENDER else 'PREVIEW') + me = ob.to_mesh(depsgraph, EXPORT_APPLY_MODIFIERS, calc_tessface=False) except RuntimeError: me = None @@ -407,9 +403,8 @@ def write_file(filepath, objects, scene, me.flip_normals() if EXPORT_UV: - faceuv = len(me.uv_textures) > 0 + faceuv = len(me.uv_layers) > 0 if faceuv: - uv_texture = me.uv_textures.active.data[:] uv_layer = me.uv_layers.active.data[:] else: faceuv = False @@ -456,16 +451,7 @@ def write_file(filepath, objects, scene, if EXPORT_KEEP_VERT_ORDER: pass else: - if faceuv: - if smooth_groups: - sort_func = lambda a: (a[0].material_index, - hash(uv_texture[a[1]].image), - smooth_groups[a[1]] if a[0].use_smooth else False) - else: - sort_func = lambda a: (a[0].material_index, - hash(uv_texture[a[1]].image), - a[0].use_smooth) - elif len(materials) > 1: + if len(materials) > 1: if smooth_groups: sort_func = lambda a: (a[0].material_index, smooth_groups[a[1]] if a[0].use_smooth else False) @@ -559,9 +545,6 @@ def write_file(filepath, objects, scene, else: loops_to_normals = [] - if not faceuv: - f_image = None - subprogress2.step() # XXX @@ -581,15 +564,8 @@ def write_file(filepath, objects, scene, f_smooth = smooth_groups[f_index] f_mat = min(f.material_index, len(materials) - 1) - if faceuv: - tface = uv_texture[f_index] - f_image = tface.image - # MAKE KEY - if faceuv and f_image: # Object is always true. - key = material_names[f_mat], f_image.name - else: - key = material_names[f_mat], None # No image, use None instead. + key = material_names[f_mat], None # No image, use None instead. # Write the vertex group if EXPORT_POLYGROUPS: @@ -635,7 +611,7 @@ def write_file(filepath, objects, scene, i += 1 tmp_ext = "_%3d" % i mtl_name += tmp_ext - mat_data = mtl_dict[key] = mtl_name, materials[f_mat], f_image + mat_data = mtl_dict[key] = mtl_name, materials[f_mat], False mtl_rev_dict[mtl_name] = key if EXPORT_GROUP_BY_MAT: @@ -743,6 +719,7 @@ def _write(context, filepath, base_name, ext = os.path.splitext(filepath) context_name = [base_name, '', '', ext] # Base name, scene name, frame number, extension + depsgraph = context.depsgraph scene = context.scene # Exit edit mode before exporting, so current object states are exported properly. @@ -774,7 +751,7 @@ def _write(context, filepath, # erm... bit of a problem here, this can overwrite files when exporting frames. not too bad. # EXPORT THE FILE. progress.enter_substeps(1) - write_file(full_path, objects, scene, + write_file(full_path, objects, depsgraph, scene, EXPORT_TRI, EXPORT_EDGES, EXPORT_SMOOTH_GROUPS, diff --git a/io_scene_obj/import_obj.py b/io_scene_obj/import_obj.py index c4275606..fb273133 100644 --- a/io_scene_obj/import_obj.py +++ b/io_scene_obj/import_obj.py @@ -960,7 +960,7 @@ def get_float_func(filepath): def load(context, filepath, *, - global_clamp_size=0.0, + global_clight_size=0.0, use_smooth_groups=True, use_edges=True, use_split_objects=True, @@ -1294,10 +1294,17 @@ def load(context, for context_nurbs in nurbs: create_nurbs(context_nurbs, verts_loc, new_objects) + view_layer = context.view_layer + if view_layer.collections.active: + collection = view_layer.collections.active.collection + else: + collection = scene.master_collection.new() + view_layer.collections.link(collection) + # Create new obj for obj in new_objects: - base = scene.objects.link(obj) - base.select = True + collection.objects.link(obj) + obj.select_set('SELECT') # we could apply this anywhere before scaling. obj.matrix_world = global_matrix @@ -1307,7 +1314,7 @@ def load(context, axis_min = [1000000000] * 3 axis_max = [-1000000000] * 3 - if global_clamp_size: + if global_clight_size: # Get all object bounds for ob in new_objects: for v in ob.bound_box: @@ -1321,7 +1328,7 @@ def load(context, max_axis = max(axis_max[0] - axis_min[0], axis_max[1] - axis_min[1], axis_max[2] - axis_min[2]) scale = 1.0 - while global_clamp_size < max_axis * scale: + while global_clight_size < max_axis * scale: scale = scale / 10.0 for obj in new_objects: diff --git a/io_scene_vrml2/__init__.py b/io_scene_vrml2/__init__.py index d6c0da2f..18821623 100644 --- a/io_scene_vrml2/__init__.py +++ b/io_scene_vrml2/__init__.py @@ -151,13 +151,13 @@ def menu_func_export(self, context): def register(): bpy.utils.register_module(__name__) - bpy.types.INFO_MT_file_export.append(menu_func_export) + bpy.types.TOPBAR_MT_file_export.append(menu_func_export) def unregister(): bpy.utils.unregister_module(__name__) - bpy.types.INFO_MT_file_export.remove(menu_func_export) + bpy.types.TOPBAR_MT_file_export.remove(menu_func_export) if __name__ == "__main__": register() diff --git a/io_scene_x/__init__.py b/io_scene_x/__init__.py index 001dca61..404d9dc2 100644 --- a/io_scene_x/__init__.py +++ b/io_scene_x/__init__.py @@ -176,13 +176,13 @@ def menu_func(self, context): def register(): bpy.utils.register_module(__name__) - bpy.types.INFO_MT_file_export.append(menu_func) + bpy.types.TOPBAR_MT_file_export.append(menu_func) def unregister(): bpy.utils.unregister_module(__name__) - bpy.types.INFO_MT_file_export.remove(menu_func) + bpy.types.TOPBAR_MT_file_export.remove(menu_func) if __name__ == "__main__": diff --git a/io_scene_x3d/__init__.py b/io_scene_x3d/__init__.py index d5c555a1..f3db0e15 100644 --- a/io_scene_x3d/__init__.py +++ b/io_scene_x3d/__init__.py @@ -172,15 +172,15 @@ def menu_func_export(self, context): def register(): bpy.utils.register_module(__name__) - bpy.types.INFO_MT_file_import.append(menu_func_import) - bpy.types.INFO_MT_file_export.append(menu_func_export) + bpy.types.TOPBAR_MT_file_import.append(menu_func_import) + bpy.types.TOPBAR_MT_file_export.append(menu_func_export) def unregister(): bpy.utils.unregister_module(__name__) - bpy.types.INFO_MT_file_import.remove(menu_func_import) - bpy.types.INFO_MT_file_export.remove(menu_func_export) + bpy.types.TOPBAR_MT_file_import.remove(menu_func_import) + bpy.types.TOPBAR_MT_file_export.remove(menu_func_export) # NOTES # - blender version is hardcoded diff --git a/io_scene_x3d/export_x3d.py b/io_scene_x3d/export_x3d.py index c2ebfca7..d6c4a293 100644 --- a/io_scene_x3d/export_x3d.py +++ b/io_scene_x3d/export_x3d.py @@ -48,7 +48,7 @@ H3D_CAMERA_FOLLOW = 'CAMERA_FOLLOW_TRANSFORM' H3D_VIEW_MATRIX = 'view_matrix' -def clamp_color(col): +def clight_color(col): return tuple([max(min(c, 1.0), 0.0) for c in col]) @@ -164,14 +164,14 @@ def h3d_shader_glsl_frag_patch(filepath, scene, global_vars, frag_uniform_var_ma lines.append("%s\n" % v) lines.append("// h3d custom vars end\n") lines.append("\n") - elif l.lstrip().startswith("lamp_visibility_other("): + elif l.lstrip().startswith("light_visibility_other("): w = l.split(', ') last_transform = w[1] + "_transform" # XXX - HACK!!! w[1] = '(view_matrix * %s_transform * vec4(%s.x, %s.y, %s.z, 1.0)).xyz' % (w[1], w[1], w[1], w[1]) l = ", ".join(w) - elif l.lstrip().startswith("lamp_visibility_sun_hemi("): + elif l.lstrip().startswith("light_visibility_sun_hemi("): w = l.split(', ') - w[0] = w[0][len("lamp_visibility_sun_hemi(") + 1:] + w[0] = w[0][len("light_visibility_sun_hemi(") + 1:] if not h3d_is_object_view(scene, frag_uniform_var_map[w[0]]): w[0] = '(mat3(normalize(view_matrix[0].xyz), normalize(view_matrix[1].xyz), normalize(view_matrix[2].xyz)) * -%s)' % w[0] @@ -179,10 +179,10 @@ def h3d_shader_glsl_frag_patch(filepath, scene, global_vars, frag_uniform_var_ma w[0] = ('(mat3(normalize((view_matrix*%s)[0].xyz), normalize((view_matrix*%s)[1].xyz), normalize((view_matrix*%s)[2].xyz)) * -%s)' % (last_transform, last_transform, last_transform, w[0])) - l = "\tlamp_visibility_sun_hemi(" + ", ".join(w) - elif l.lstrip().startswith("lamp_visibility_spot_circle("): + l = "\tlight_visibility_sun_hemi(" + ", ".join(w) + elif l.lstrip().startswith("light_visibility_spot_circle("): w = l.split(', ') - w[0] = w[0][len("lamp_visibility_spot_circle(") + 1:] + w[0] = w[0][len("light_visibility_spot_circle(") + 1:] if not h3d_is_object_view(scene, frag_uniform_var_map[w[0]]): w[0] = '(mat3(normalize(view_matrix[0].xyz), normalize(view_matrix[1].xyz), normalize(view_matrix[2].xyz)) * -%s)' % w[0] @@ -190,7 +190,7 @@ def h3d_shader_glsl_frag_patch(filepath, scene, global_vars, frag_uniform_var_ma w[0] = ('(mat3(normalize((view_matrix*%s)[0].xyz), normalize((view_matrix*%s)[1].xyz), normalize((view_matrix*%s)[2].xyz)) * %s)' % (last_transform, last_transform, last_transform, w[0])) - l = "\tlamp_visibility_spot_circle(" + ", ".join(w) + l = "\tlight_visibility_spot_circle(" + ", ".join(w) lines.append(l) @@ -241,7 +241,7 @@ def export(file, # since objects of different types will always have # different decorated names. uuid_cache_object = {} # object - uuid_cache_lamp = {} # 'LA_' + object.name + uuid_cache_light = {} # 'LA_' + object.name uuid_cache_view = {} # object, different namespace uuid_cache_mesh = {} # mesh uuid_cache_material = {} # material @@ -261,7 +261,7 @@ def export(file, # prevent uuid collisions. uuid_cache = {} uuid_cache_object = uuid_cache # object - uuid_cache_lamp = uuid_cache # 'LA_' + object.name + uuid_cache_light = uuid_cache # 'LA_' + object.name uuid_cache_view = uuid_cache # object, different namespace uuid_cache_mesh = uuid_cache # mesh uuid_cache_material = uuid_cache # material @@ -370,16 +370,16 @@ def export(file, ident_step = ident + (' ' * (-len(ident) + \ fw('%s<Fog ' % ident))) fw('fogType="%s"\n' % ('LINEAR' if (mtype == 'LINEAR') else 'EXPONENTIAL')) - fw(ident_step + 'color="%.3f %.3f %.3f"\n' % clamp_color(world.horizon_color)) + fw(ident_step + 'color="%.3f %.3f %.3f"\n' % clight_color(world.horizon_color)) fw(ident_step + 'visibilityRange="%.3f"\n' % mparam.depth) fw(ident_step + '/>\n') else: return - def writeNavigationInfo(ident, scene, has_lamp): + def writeNavigationInfo(ident, scene, has_light): ident_step = ident + (' ' * (-len(ident) + \ fw('%s<NavigationInfo ' % ident))) - fw('headlight="%s"\n' % bool_as_str(not has_lamp)) + fw('headlight="%s"\n' % bool_as_str(not has_light)) fw(ident_step + 'visibilityLimit="0.0"\n') fw(ident_step + 'type=\'"EXAMINE", "ANY"\'\n') fw(ident_step + 'avatarSize="0.25, 1.75, 0.75"\n') @@ -411,8 +411,8 @@ def export(file, return ident def writeSpotLight(ident, obj, matrix, lamp, world): - # note, lamp_id is not re-used - lamp_id = quoteattr(unique_name(obj, LA_ + obj.name, uuid_cache_lamp, clean_func=clean_def, sep="_")) + # note, light_id is not re-used + light_id = quoteattr(unique_name(obj, LA_ + obj.name, uuid_cache_light, clean_func=clean_def, sep="_")) if world: ambi = world.ambient_color @@ -435,11 +435,11 @@ def export(file, # radius = lamp.dist*math.cos(beamWidth) ident_step = ident + (' ' * (-len(ident) + \ fw('%s<SpotLight ' % ident))) - fw('DEF=%s\n' % lamp_id) + fw('DEF=%s\n' % light_id) fw(ident_step + 'radius="%.4f"\n' % radius) fw(ident_step + 'ambientIntensity="%.4f"\n' % amb_intensity) fw(ident_step + 'intensity="%.4f"\n' % intensity) - fw(ident_step + 'color="%.4f %.4f %.4f"\n' % clamp_color(lamp.color)) + fw(ident_step + 'color="%.4f %.4f %.4f"\n' % clight_color(lamp.color)) fw(ident_step + 'beamWidth="%.4f"\n' % beamWidth) fw(ident_step + 'cutOffAngle="%.4f"\n' % cutOffAngle) fw(ident_step + 'direction="%.4f %.4f %.4f"\n' % orientation) @@ -447,8 +447,8 @@ def export(file, fw(ident_step + '/>\n') def writeDirectionalLight(ident, obj, matrix, lamp, world): - # note, lamp_id is not re-used - lamp_id = quoteattr(unique_name(obj, LA_ + obj.name, uuid_cache_lamp, clean_func=clean_def, sep="_")) + # note, light_id is not re-used + light_id = quoteattr(unique_name(obj, LA_ + obj.name, uuid_cache_light, clean_func=clean_def, sep="_")) if world: ambi = world.ambient_color @@ -464,16 +464,16 @@ def export(file, ident_step = ident + (' ' * (-len(ident) + \ fw('%s<DirectionalLight ' % ident))) - fw('DEF=%s\n' % lamp_id) + fw('DEF=%s\n' % light_id) fw(ident_step + 'ambientIntensity="%.4f"\n' % amb_intensity) - fw(ident_step + 'color="%.4f %.4f %.4f"\n' % clamp_color(lamp.color)) + fw(ident_step + 'color="%.4f %.4f %.4f"\n' % clight_color(lamp.color)) fw(ident_step + 'intensity="%.4f"\n' % intensity) fw(ident_step + 'direction="%.4f %.4f %.4f"\n' % orientation) fw(ident_step + '/>\n') def writePointLight(ident, obj, matrix, lamp, world): - # note, lamp_id is not re-used - lamp_id = quoteattr(unique_name(obj, LA_ + obj.name, uuid_cache_lamp, clean_func=clean_def, sep="_")) + # note, light_id is not re-used + light_id = quoteattr(unique_name(obj, LA_ + obj.name, uuid_cache_light, clean_func=clean_def, sep="_")) if world: ambi = world.ambient_color @@ -488,9 +488,9 @@ def export(file, ident_step = ident + (' ' * (-len(ident) + \ fw('%s<PointLight ' % ident))) - fw('DEF=%s\n' % lamp_id) + fw('DEF=%s\n' % light_id) fw(ident_step + 'ambientIntensity="%.4f"\n' % amb_intensity) - fw(ident_step + 'color="%.4f %.4f %.4f"\n' % clamp_color(lamp.color)) + fw(ident_step + 'color="%.4f %.4f %.4f"\n' % clight_color(lamp.color)) fw(ident_step + 'intensity="%.4f"\n' % intensity) fw(ident_step + 'radius="%.4f" \n' % lamp.distance) @@ -1002,9 +1002,9 @@ def export(file, ident_step = ident + (' ' * (-len(ident) + \ fw('%s<Material ' % ident))) fw('DEF=%s\n' % material_id) - fw(ident_step + 'diffuseColor="%.3f %.3f %.3f"\n' % clamp_color(diffuseColor)) - fw(ident_step + 'specularColor="%.3f %.3f %.3f"\n' % clamp_color(specColor)) - fw(ident_step + 'emissiveColor="%.3f %.3f %.3f"\n' % clamp_color(emitColor)) + fw(ident_step + 'diffuseColor="%.3f %.3f %.3f"\n' % clight_color(diffuseColor)) + fw(ident_step + 'specularColor="%.3f %.3f %.3f"\n' % clight_color(specColor)) + fw(ident_step + 'emissiveColor="%.3f %.3f %.3f"\n' % clight_color(emitColor)) fw(ident_step + 'ambientIntensity="%.3f"\n' % ambient) fw(ident_step + 'shininess="%.3f"\n' % shininess) fw(ident_step + 'transparency="%s"\n' % transp) @@ -1035,12 +1035,12 @@ def export(file, #~ GPU_DATA_4F 5 #~ GPU_DATA_4UB 8 #~ GPU_DATA_9F 6 - #~ GPU_DYNAMIC_LAMP_DYNCO 7 - #~ GPU_DYNAMIC_LAMP_DYNCOL 11 - #~ GPU_DYNAMIC_LAMP_DYNENERGY 10 - #~ GPU_DYNAMIC_LAMP_DYNIMAT 8 - #~ GPU_DYNAMIC_LAMP_DYNPERSMAT 9 - #~ GPU_DYNAMIC_LAMP_DYNVEC 6 + #~ GPU_DYNAMIC_LIGHT_DYNCO 7 + #~ GPU_DYNAMIC_LIGHT_DYNCOL 11 + #~ GPU_DYNAMIC_LIGHT_DYNENERGY 10 + #~ GPU_DYNAMIC_LIGHT_DYNIMAT 8 + #~ GPU_DYNAMIC_LIGHT_DYNPERSMAT 9 + #~ GPU_DYNAMIC_LIGHT_DYNVEC 6 #~ GPU_DYNAMIC_OBJECT_COLOR 5 #~ GPU_DYNAMIC_OBJECT_IMAT 4 #~ GPU_DYNAMIC_OBJECT_MAT 2 @@ -1134,45 +1134,45 @@ def export(file, writeImageTexture(ident + '\t', uniform['image']) fw('%s</field>\n' % ident) - elif uniform['type'] == gpu.GPU_DYNAMIC_LAMP_DYNCO: - lamp_obj = uniform['lamp'] - frag_uniform_var_map[uniform['varname']] = lamp_obj + elif uniform['type'] == gpu.GPU_DYNAMIC_LIGHT_DYNCO: + light_obj = uniform['lamp'] + frag_uniform_var_map[uniform['varname']] = light_obj if uniform['datatype'] == gpu.GPU_DATA_3F: # should always be true! - lamp_obj_id = quoteattr(unique_name(lamp_obj, LA_ + lamp_obj.name, uuid_cache_lamp, clean_func=clean_def, sep="_")) - lamp_obj_transform_id = quoteattr(unique_name(lamp_obj, lamp_obj.name, uuid_cache_object, clean_func=clean_def, sep="_")) + light_obj_id = quoteattr(unique_name(light_obj, LA_ + light_obj.name, uuid_cache_light, clean_func=clean_def, sep="_")) + light_obj_transform_id = quoteattr(unique_name(light_obj, light_obj.name, uuid_cache_object, clean_func=clean_def, sep="_")) - value = '%.6f %.6f %.6f' % (global_matrix * lamp_obj.matrix_world).to_translation()[:] - field_descr = " <!--- Lamp DynCo '%s' -->" % lamp_obj.name + value = '%.6f %.6f %.6f' % (global_matrix * light_obj.matrix_world).to_translation()[:] + field_descr = " <!--- Lamp DynCo '%s' -->" % light_obj.name fw('%s<field name="%s" type="SFVec3f" accessType="inputOutput" value="%s" />%s\n' % (ident, uniform['varname'], value, field_descr)) # ------------------------------------------------------ # shader-patch - field_descr = " <!--- Lamp DynCo '%s' (shader patch) -->" % lamp_obj.name + field_descr = " <!--- Lamp DynCo '%s' (shader patch) -->" % light_obj.name fw('%s<field name="%s_transform" type="SFMatrix4f" accessType="inputOutput" />%s\n' % (ident, uniform['varname'], field_descr)) # transform frag_vars.append("uniform mat4 %s_transform;" % uniform['varname']) h3d_material_route.append( '<ROUTE fromNode=%s fromField="accumulatedForward" toNode=%s toField="%s_transform" />%s' % - (suffix_quoted_str(lamp_obj_transform_id, _TRANSFORM), material_id, uniform['varname'], field_descr)) + (suffix_quoted_str(light_obj_transform_id, _TRANSFORM), material_id, uniform['varname'], field_descr)) h3d_material_route.append( '<ROUTE fromNode=%s fromField="location" toNode=%s toField="%s" /> %s' % - (lamp_obj_id, material_id, uniform['varname'], field_descr)) + (light_obj_id, material_id, uniform['varname'], field_descr)) # ------------------------------------------------------ else: assert(0) - elif uniform['type'] == gpu.GPU_DYNAMIC_LAMP_DYNCOL: + elif uniform['type'] == gpu.GPU_DYNAMIC_LIGHT_DYNCOL: # odd we have both 3, 4 types. - lamp_obj = uniform['lamp'] - frag_uniform_var_map[uniform['varname']] = lamp_obj + light_obj = uniform['lamp'] + frag_uniform_var_map[uniform['varname']] = light_obj - lamp = lamp_obj.data + lamp = light_obj.data value = '%.6f %.6f %.6f' % (lamp.color * lamp.energy)[:] - field_descr = " <!--- Lamp DynColor '%s' -->" % lamp_obj.name + field_descr = " <!--- Lamp DynColor '%s' -->" % light_obj.name if uniform['datatype'] == gpu.GPU_DATA_3F: fw('%s<field name="%s" type="SFVec3f" accessType="inputOutput" value="%s" />%s\n' % (ident, uniform['varname'], value, field_descr)) elif uniform['datatype'] == gpu.GPU_DATA_4F: @@ -1180,26 +1180,26 @@ def export(file, else: assert(0) - elif uniform['type'] == gpu.GPU_DYNAMIC_LAMP_DYNENERGY: + elif uniform['type'] == gpu.GPU_DYNAMIC_LIGHT_DYNENERGY: # not used ? assert(0) - elif uniform['type'] == gpu.GPU_DYNAMIC_LAMP_DYNVEC: - lamp_obj = uniform['lamp'] - frag_uniform_var_map[uniform['varname']] = lamp_obj + elif uniform['type'] == gpu.GPU_DYNAMIC_LIGHT_DYNVEC: + light_obj = uniform['lamp'] + frag_uniform_var_map[uniform['varname']] = light_obj if uniform['datatype'] == gpu.GPU_DATA_3F: - lamp_obj = uniform['lamp'] - value = '%.6f %.6f %.6f' % ((global_matrix * lamp_obj.matrix_world).to_quaternion() * mathutils.Vector((0.0, 0.0, 1.0))).normalized()[:] - field_descr = " <!--- Lamp DynDirection '%s' -->" % lamp_obj.name + light_obj = uniform['lamp'] + value = '%.6f %.6f %.6f' % ((global_matrix * light_obj.matrix_world).to_quaternion() * mathutils.Vector((0.0, 0.0, 1.0))).normalized()[:] + field_descr = " <!--- Lamp DynDirection '%s' -->" % light_obj.name fw('%s<field name="%s" type="SFVec3f" accessType="inputOutput" value="%s" />%s\n' % (ident, uniform['varname'], value, field_descr)) # route so we can have the lamp update the view - if h3d_is_object_view(scene, lamp_obj): - lamp_id = quoteattr(unique_name(lamp_obj, LA_ + lamp_obj.name, uuid_cache_lamp, clean_func=clean_def, sep="_")) + if h3d_is_object_view(scene, light_obj): + light_id = quoteattr(unique_name(light_obj, LA_ + light_obj.name, uuid_cache_light, clean_func=clean_def, sep="_")) h3d_material_route.append( '<ROUTE fromNode=%s fromField="direction" toNode=%s toField="%s" />%s' % - (lamp_id, material_id, uniform['varname'], field_descr)) + (light_id, material_id, uniform['varname'], field_descr)) else: assert(0) @@ -1330,9 +1330,9 @@ def export(file, blending = world.use_sky_blend, world.use_sky_paper, world.use_sky_real - grd_triple = clamp_color(world.horizon_color) - sky_triple = clamp_color(world.zenith_color) - mix_triple = clamp_color((grd_triple[i] + sky_triple[i]) / 2.0 for i in range(3)) + grd_triple = clight_color(world.horizon_color) + sky_triple = clight_color(world.zenith_color) + mix_triple = clight_color((grd_triple[i] + sky_triple[i]) / 2.0 for i in range(3)) ident_step = ident + (' ' * (-len(ident) + \ fw('%s<Background ' % ident))) @@ -1469,7 +1469,7 @@ def export(file, if do_remove: bpy.data.meshes.remove(me) - elif obj_type == 'LAMP': + elif obj_type == 'LIGHT': data = obj.data datatype = data.type if datatype == 'POINT': @@ -1521,7 +1521,7 @@ def export(file, ident = '' ident = writeHeader(ident) - writeNavigationInfo(ident, scene, any(obj.type == 'LAMP' for obj in objects)) + writeNavigationInfo(ident, scene, any(obj.type == 'LIGHT' for obj in objects)) writeBackground(ident, world) writeFog(ident, world) diff --git a/io_scene_x3d/import_x3d.py b/io_scene_x3d/import_x3d.py index 3416bf22..1929d344 100644 --- a/io_scene_x3d/import_x3d.py +++ b/io_scene_x3d/import_x3d.py @@ -2790,9 +2790,9 @@ def appearance_LoadTexture(tex_node, ancestry, node): if bpyima: # Loading can still fail repeat_s = tex_node.getFieldAsBool('repeatS', True, ancestry) - bpyima.use_clamp_x = not repeat_s + bpyima.use_clight_x = not repeat_s repeat_t = tex_node.getFieldAsBool('repeatT', True, ancestry) - bpyima.use_clamp_y = not repeat_t + bpyima.use_clight_y = not repeat_t # Update the desc-based cache if desc: @@ -3148,7 +3148,7 @@ def importLamp_PointLight(node, ancestry): # is_on = node.getFieldAsBool('on', True, ancestry) # TODO radius = node.getFieldAsFloat('radius', 100.0, ancestry) - bpylamp = bpy.data.lamps.new(vrmlname, 'POINT') + bpylamp = bpy.data.lights.new(vrmlname, 'POINT') bpylamp.energy = intensity bpylamp.distance = radius bpylamp.color = color @@ -3169,7 +3169,7 @@ def importLamp_DirectionalLight(node, ancestry): intensity = node.getFieldAsFloat('intensity', 1.0, ancestry) # max is documented to be 1.0 but some files have higher. # is_on = node.getFieldAsBool('on', True, ancestry) # TODO - bpylamp = bpy.data.lamps.new(vrmlname, 'SUN') + bpylamp = bpy.data.lights.new(vrmlname, 'SUN') bpylamp.energy = intensity bpylamp.color = color @@ -3197,7 +3197,7 @@ def importLamp_SpotLight(node, ancestry): # is_on = node.getFieldAsBool('on', True, ancestry) # TODO radius = node.getFieldAsFloat('radius', 100.0, ancestry) - bpylamp = bpy.data.lamps.new(vrmlname, 'SPOT') + bpylamp = bpy.data.lights.new(vrmlname, 'SPOT') bpylamp.energy = intensity bpylamp.distance = radius bpylamp.color = color @@ -3271,8 +3271,8 @@ def importTransform(bpyscene, node, ancestry, global_matrix): bpyob.matrix_world = getFinalMatrix(node, None, ancestry, global_matrix) # so they are not too annoying - bpyob.empty_draw_type = 'PLAIN_AXES' - bpyob.empty_draw_size = 0.2 + bpyob.empty_display_type = 'PLAIN_AXES' + bpyob.empty_display_size = 0.2 #def importTimeSensor(node): diff --git a/io_shape_mdd/__init__.py b/io_shape_mdd/__init__.py index 99623241..786df7fd 100644 --- a/io_shape_mdd/__init__.py +++ b/io_shape_mdd/__init__.py @@ -167,15 +167,15 @@ def menu_func_export(self, context): def register(): bpy.utils.register_module(__name__) - bpy.types.INFO_MT_file_import.append(menu_func_import) - bpy.types.INFO_MT_file_export.append(menu_func_export) + bpy.types.TOPBAR_MT_file_import.append(menu_func_import) + bpy.types.TOPBAR_MT_file_export.append(menu_func_export) def unregister(): bpy.utils.unregister_module(__name__) - bpy.types.INFO_MT_file_import.remove(menu_func_import) - bpy.types.INFO_MT_file_export.remove(menu_func_export) + bpy.types.TOPBAR_MT_file_import.remove(menu_func_import) + bpy.types.TOPBAR_MT_file_export.remove(menu_func_export) if __name__ == "__main__": register() diff --git a/light_field_tools/light_field_tools.py b/light_field_tools/light_field_tools.py index b4693d52..c2ce7a88 100644 --- a/light_field_tools/light_field_tools.py +++ b/light_field_tools/light_field_tools.py @@ -189,7 +189,7 @@ class OBJECT_OT_create_lightfield_rig(Operator): cam.data.angle = scene.lightfield.angle # display options of the camera - cam.data.draw_size = 0.15 + cam.data.display_size = 0.15 cam.data.lens_unit = 'FOV' # handler parent @@ -228,7 +228,7 @@ class OBJECT_OT_create_lightfield_rig(Operator): def createSpot(self, index, textured=False): scene = bpy.context.scene - bpy.ops.object.lamp_add( + bpy.ops.object.light_add( type='SPOT') spot = bpy.context.active_object diff --git a/measureit/measureit_main.py b/measureit/measureit_main.py index c85de95d..4b40ac60 100644 --- a/measureit/measureit_main.py +++ b/measureit/measureit_main.py @@ -1344,7 +1344,7 @@ class AddLinkButton(Operator): if o is None: return False else: - if o.type == "MESH" or o.type == "EMPTY" or o.type == "CAMERA" or o.type == "LAMP": + if o.type == "MESH" or o.type == "EMPTY" or o.type == "CAMERA" or o.type == "LIGHT": if bpy.context.mode == 'OBJECT': return True else: @@ -1490,7 +1490,7 @@ class AddOriginButton(Operator): if o is None: return False else: - if o.type == "MESH" or o.type == "EMPTY" or o.type == "CAMERA" or o.type == "LAMP": + if o.type == "MESH" or o.type == "EMPTY" or o.type == "CAMERA" or o.type == "LIGHT": if bpy.context.mode == 'OBJECT': return True else: @@ -1892,7 +1892,7 @@ class AddNoteButton(Operator): bpy.ops.object.empty_add(type='PLAIN_AXES') myempty = bpy.data.objects[bpy.context.active_object.name] myempty.location = bpy.context.scene.cursor_location - myempty.empty_draw_size = 0.01 + myempty.empty_display_size = 0.01 myempty.name = "Annotation" # Add properties scene = context.scene diff --git a/mesh_carver.py b/mesh_carver.py index 16308aa4..32e6f74c 100644 --- a/mesh_carver.py +++ b/mesh_carver.py @@ -1618,7 +1618,7 @@ def update_bevel(context): mod.limit_method = 'WEIGHT' mod.width = 0.01 mod.profile = 0.699099 - mod.use_clamp_overlap = False + mod.use_clight_overlap = False mod.segments = 3 mod.loop_slide = False @@ -1676,7 +1676,7 @@ def CreateBevel(context, CurrentObject): mod.limit_method = 'WEIGHT' mod.width = 0.01 mod.profile = 0.699099 - mod.use_clamp_overlap = False + mod.use_clight_overlap = False mod.segments = 3 mod.loop_slide = False @@ -1964,12 +1964,12 @@ def duplicateObject(self): ob_new.rotation_quaternion = qRot ob_new.rotation_mode = 'XYZ' - if (ob_new.draw_type == "WIRE") and (self.BrushSolidify is False): + if (ob_new.display_type == "WIRE") and (self.BrushSolidify is False): ob_new.hide = True if self.BrushSolidify: - ob_new.draw_type = "SOLID" - ob_new.show_x_ray = False + ob_new.display_type = "SOLID" + ob_new.show_in_front = False for o in bpy.context.selected_objects: UndoAdd(self, "DUPLICATE", o) @@ -2070,20 +2070,20 @@ def boolean_operation(bool_type="DIFFERENCE"): ) BoolMod.object = bpy.context.selected_objects[sel_index] BoolMod.operation = bool_type - bpy.context.selected_objects[sel_index].draw_type = 'WIRE' + bpy.context.selected_objects[sel_index].display_type = 'WIRE' def Rebool(context, self): LastObj = context.active_object Brush = context.selected_objects[0] - Brush.draw_type = "WIRE" + Brush.display_type = "WIRE" obj = context.selected_objects[1] bpy.ops.object.select_all(action='TOGGLE') context.scene.objects.active = obj - obj.draw_type = "SOLID" + obj.display_type = "SOLID" obj.select = True bpy.ops.object.duplicate_move( OBJECT_OT_duplicate={ @@ -2124,7 +2124,7 @@ def Rebool(context, self): mb.show_viewport = False if self.ObjectBrush or self.ProfileBrush: - LastObjectCreated.show_x_ray = False + LastObjectCreated.show_in_front = False try: bpy.ops.object.modifier_apply(apply_as='DATA', modifier="CT_SOLIDIFY") except: @@ -2177,7 +2177,7 @@ def createMeshFromData(self): scn.objects.active = ob ob.select = True ob.location = Vector((10000.0, 0.0, 0.0)) - ob.draw_type = "WIRE" + ob.display_type = "WIRE" self.SolidifyPossible = True else: @@ -2390,7 +2390,7 @@ class Carver(bpy.types.Operator): self.ProfileBrush.select = True context.scene.objects.active = self.ProfileBrush # Set xRay - self.ProfileBrush.show_x_ray = True + self.ProfileBrush.show_in_front = True bpy.ops.object.modifier_add(type='SOLIDIFY') context.object.modifiers["Solidify"].name = "CT_SOLIDIFY" @@ -2407,8 +2407,8 @@ class Carver(bpy.types.Operator): self.ObjectBrush.scale = self.InitBrushScale self.ObjectBrush.rotation_quaternion = self.InitBrushQRotation self.ObjectBrush.rotation_euler = self.InitBrushERotation - self.ObjectBrush.draw_type = self.ObjectBrush_DT - self.ObjectBrush.show_x_ray = self.XRay + self.ObjectBrush.display_type = self.ObjectBrush_DT + self.ObjectBrush.show_in_front = self.XRay # Remove solidify modifier Selection_Save(self) @@ -2430,7 +2430,7 @@ class Carver(bpy.types.Operator): self.ObjectBrush.select = True context.scene.objects.active = self.ObjectBrush # Set xRay - self.ObjectBrush.show_x_ray = True + self.ObjectBrush.show_in_front = True bpy.ops.object.modifier_add(type='SOLIDIFY') context.object.modifiers["Solidify"].name = "CT_SOLIDIFY" context.object.modifiers["CT_SOLIDIFY"].thickness = 0.1 @@ -2529,12 +2529,12 @@ class Carver(bpy.types.Operator): self.ObjectBrush.select = True context.scene.objects.active = self.ObjectBrush # Active le xray - self.ObjectBrush.show_x_ray = True + self.ObjectBrush.show_in_front = True else: self.ProfileBrush.select = True context.scene.objects.active = self.ProfileBrush # Active le xray - self.ProfileBrush.show_x_ray = True + self.ProfileBrush.show_in_front = True bpy.ops.object.modifier_add(type='SOLIDIFY') context.object.modifiers["Solidify"].name = "CT_SOLIDIFY" @@ -2773,8 +2773,8 @@ class Carver(bpy.types.Operator): self.ObjectBrush.scale = self.InitBrushScale self.ObjectBrush.rotation_quaternion = self.InitBrushQRotation self.ObjectBrush.rotation_euler = self.InitBrushERotation - self.ObjectBrush.draw_type = self.ObjectBrush_DT - self.ObjectBrush.show_x_ray = self.XRay + self.ObjectBrush.display_type = self.ObjectBrush_DT + self.ObjectBrush.show_in_front = self.XRay # remove solidify Selection_Save(self) @@ -2844,8 +2844,8 @@ class Carver(bpy.types.Operator): self.ObjectBrush.scale = self.InitBrushScale self.ObjectBrush.rotation_quaternion = self.InitBrushQRotation self.ObjectBrush.rotation_euler = self.InitBrushERotation - self.ObjectBrush.draw_type = self.ObjectBrush_DT - self.ObjectBrush.show_x_ray = self.XRay + self.ObjectBrush.display_type = self.ObjectBrush_DT + self.ObjectBrush.show_in_front = self.XRay # Remove solidify modifier Selection_Save(self) @@ -3089,8 +3089,8 @@ class Carver(bpy.types.Operator): self.InitBrushScale = self.ObjectBrush.scale.copy() self.InitBrushQRotation = self.ObjectBrush.rotation_quaternion.copy() self.InitBrushERotation = self.ObjectBrush.rotation_euler.copy() - self.ObjectBrush_DT = self.ObjectBrush.draw_type - self.XRay = self.ObjectBrush.show_x_ray + self.ObjectBrush_DT = self.ObjectBrush.display_type + self.XRay = self.ObjectBrush.show_in_front # Test if flat object z = self.ObjectBrush.data.vertices[0].co.z ErrorMarge = 0.01 @@ -3363,7 +3363,7 @@ class Carver(bpy.types.Operator): bpy.ops.object.delete(use_global=False) else: if self.ObjectMode: - self.ObjectBrush.draw_type = self.ObjectBrush_DT + self.ObjectBrush.display_type = self.ObjectBrush_DT if len(context.selected_objects) > 0: bpy.ops.object.select_all(action='TOGGLE') @@ -3392,9 +3392,9 @@ class Carver(bpy.types.Operator): # If object has children, set "Wire" draw type if self.ObjectBrush is not None: if len(self.ObjectBrush.children) > 0: - self.ObjectBrush.draw_type = "WIRE" + self.ObjectBrush.display_type = "WIRE" if self.ProfileMode: - self.ProfileBrush.draw_type = "WIRE" + self.ProfileBrush.display_type = "WIRE" if bLocalView: bpy.ops.view3d.localview() diff --git a/modules/rna_manual_reference.py b/modules/rna_manual_reference.py index 08f097a7..5f837c8b 100644 --- a/modules/rna_manual_reference.py +++ b/modules/rna_manual_reference.py @@ -253,7 +253,6 @@ url_manual_mapping = ( ("bpy.types.cyclesrendersettings*", "render/cycles/settings/index.html#bpy-types-cyclesrendersettings"), ("bpy.types.datatransfermodifier*", "modeling/modifiers/modify/data_transfer.html#bpy-types-datatransfermodifier"), ("bpy.types.dynamicpaintmodifier*", "physics/dynamic_paint/index.html#bpy-types-dynamicpaintmodifier"), - ("bpy.types.expressioncontroller*", "game_engine/logic/controllers/types/expression.html#bpy-types-expressioncontroller"), ("bpy.types.ffmpegsettings.audio*", "render/output/video.html#bpy-types-ffmpegsettings-audio"), ("bpy.types.followpathconstraint*", "rigging/constraints/relationship/follow_path.html#bpy-types-followpathconstraint"), ("bpy.types.gaussianblursequence*", "editors/vse/sequencer/strips/effects/blur.html#bpy-types-gaussianblursequence"), @@ -344,8 +343,6 @@ url_manual_mapping = ( ("bpy.types.compositornodemask*", "compositing/types/input/mask.html#bpy-types-compositornodemask"), ("bpy.types.compositornodemath*", "compositing/types/converter/math.html#bpy-types-compositornodemath"), ("bpy.types.compositornodetime*", "compositing/types/input/time.html#bpy-types-compositornodetime"), - ("bpy.types.constraintactuator*", "game_engine/logic/actuators/types/constraint.html#bpy-types-constraintactuator"), - ("bpy.types.editobjectactuator*", "game_engine/logic/actuators/types/edit_object.html#bpy-types-editobjectactuator"), ("bpy.types.fluidfluidsettings*", "physics/fluid/types/fluid_object.html#bpy-types-fluidfluidsettings"), ("bpy.types.fmodifiergenerator*", "editors/graph_editor/fcurves/modifiers.html#bpy-types-fmodifiergenerator"), ("bpy.types.freestylelinestyle*", "render/freestyle/parameter_editor/line_style/index.html#bpy-types-freestylelinestyle"), @@ -372,7 +369,6 @@ url_manual_mapping = ( ("bpy.types.shrinkwrapmodifier*", "modeling/modifiers/deform/shrinkwrap.html#bpy-types-shrinkwrapmodifier"), ("bpy.types.splineikconstraint*", "rigging/constraints/tracking/spline_ik.html#bpy-types-splineikconstraint"), ("bpy.types.texturenodetexture*", "render/blender_render/textures/nodes/types/input/texture.html#bpy-types-texturenodetexture"), - ("bpy.types.visibilityactuator*", "game_engine/logic/actuators/types/visibility.html#bpy-types-visibilityactuator"), ("bpy.ops.anim.keyframe_clear*", "animation/keyframes/editing.html#bpy-ops-anim-keyframe-clear"), ("bpy.ops.curve.primitive*add*", "modeling/curves/primitives.html#bpy-ops-curve-primitive-add"), ("bpy.ops.mesh.duplicate_move*", "modeling/meshes/editing/duplicating/duplicate.html#bpy-ops-mesh-duplicate-move"), @@ -386,7 +382,7 @@ url_manual_mapping = ( ("bpy.types.alphaoversequence*", "editors/vse/sequencer/strips/effects/alpha_over_under_overdrop.html#bpy-types-alphaoversequence"), ("bpy.types.armatureeditbones*", "rigging/armatures/bones/editing/index.html#bpy-types-armatureeditbones"), ("bpy.types.childofconstraint*", "rigging/constraints/relationship/child_of.html#bpy-types-childofconstraint"), - ("bpy.types.clamptoconstraint*", "rigging/constraints/tracking/clamp_to.html#bpy-types-clamptoconstraint"), + ("bpy.types.clamptoconstraint*", "rigging/constraints/tracking/clight_to.html#bpy-types-clamptoconstraint"), ("bpy.types.collisionmodifier*", "physics/collision.html#bpy-types-collisionmodifier"), ("bpy.types.collisionsettings*", "physics/collision.html#bpy-types-collisionsettings"), ("bpy.types.compositornodergb*", "compositing/types/input/rgb.html#bpy-types-compositornodergb"), @@ -428,12 +424,10 @@ url_manual_mapping = ( ("bpy.ops.transform.tosphere*", "modeling/meshes/editing/transform/to_sphere.html#bpy-ops-transform-tosphere"), ("bpy.types.actionconstraint*", "rigging/constraints/relationship/action.html#bpy-types-actionconstraint"), ("bpy.types.addonpreferences*", "preferences/addons.html#bpy-types-addonpreferences"), - ("bpy.types.armatureactuator*", "game_engine/logic/actuators/types/armature.html#bpy-types-armatureactuator"), ("bpy.types.armaturemodifier*", "modeling/modifiers/deform/armature.html#bpy-types-armaturemodifier"), ("bpy.types.decimatemodifier*", "modeling/modifiers/generate/decimate.html#bpy-types-decimatemodifier"), ("bpy.types.displacemodifier*", "modeling/modifiers/deform/displace.html#bpy-types-displacemodifier"), ("bpy.types.displaysafeareas*", "render/blender_render/camera/object_data.html#bpy-types-displaysafeareas"), - ("bpy.types.filter2dactuator*", "game_engine/logic/actuators/types/filter_2d.html#bpy-types-filter2dactuator"), ("bpy.types.fmodifierstepped*", "editors/graph_editor/fcurves/modifiers.html#bpy-types-fmodifierstepped"), ("bpy.types.freestylelineset*", "render/freestyle/parameter_editor/line_set.html#bpy-types-freestylelineset"), ("bpy.types.material.ambient*", "render/blender_render/materials/properties/shading.html#bpy-types-material-ambient"), @@ -441,12 +435,10 @@ url_manual_mapping = ( ("bpy.types.multicamsequence*", "editors/vse/sequencer/strips/effects/multicam.html#bpy-types-multicamsequence"), ("bpy.types.multiplysequence*", "editors/vse/sequencer/strips/effects/multiply.html#bpy-types-multiplysequence"), ("bpy.types.multiresmodifier*", "modeling/modifiers/generate/multiresolution.html#bpy-types-multiresmodifier"), - ("bpy.types.object.draw_type*", "editors/3dview/object/properties/display.html#bpy-types-object-draw-type"), + ("bpy.types.object.display_type*", "editors/3dview/object/properties/display.html#bpy-types-object-draw-type"), ("bpy.types.object.use_extra*", "editors/3dview/object/properties/relations/extras.html#bpy-types-object-use-extra"), ("bpy.types.overdropsequence*", "editors/vse/sequencer/strips/effects/alpha_over_under_overdrop.html#bpy-types-overdropsequence"), ("bpy.types.particlesettings*", "physics/particles/index.html#bpy-types-particlesettings"), - ("bpy.types.propertyactuator*", "game_engine/logic/actuators/types/property.html#bpy-types-propertyactuator"), - ("bpy.types.pythoncontroller*", "game_engine/logic/controllers/types/python.html#bpy-types-pythoncontroller"), ("bpy.types.scenerenderlayer*", "render/cycles/settings/scene/render_layers/layers.html#bpy-types-scenerenderlayer"), ("bpy.types.sequencemodifier*", "editors/vse/sequencer/properties/modifiers.html#bpy-types-sequencemodifier"), ("bpy.types.shadernodeinvert*", "render/cycles/nodes/types/color/invert.html#bpy-types-shadernodeinvert"), @@ -462,7 +454,6 @@ url_manual_mapping = ( ("bpy.types.spaceimageeditor*", "editors/uv_image/image/index.html#bpy-types-spaceimageeditor"), ("bpy.types.spacelogiceditor*", "editors/logic_editor.html#bpy-types-spacelogiceditor"), ("bpy.types.sphfluidsettings*", "physics/fluid/index.html#bpy-types-sphfluidsettings"), - ("bpy.types.steeringactuator*", "game_engine/logic/actuators/types/steering.html#bpy-types-steeringactuator"), ("bpy.types.subtractsequence*", "editors/vse/sequencer/strips/effects/subtract.html#bpy-types-subtractsequence"), ("bpy.types.texturenodegroup*", "render/blender_render/textures/nodes/types/groups.html#bpy-types-texturenodegroup"), ("bpy.types.texturenodeimage*", "render/blender_render/textures/nodes/types/input/image.html#bpy-types-texturenodeimage"), @@ -481,7 +472,6 @@ url_manual_mapping = ( ("bpy.ops.uv.remove_doubles*", "editors/uv_image/uv/editing/layout.html#bpy-ops-uv-remove-doubles"), ("bpy.types.backgroundimage*", "editors/3dview/properties/background_images.html#bpy-types-backgroundimage"), ("bpy.types.booleanmodifier*", "modeling/modifiers/generate/booleans.html#bpy-types-booleanmodifier"), - ("bpy.types.collisionsensor*", "game_engine/logic/sensors/types/collision.html#bpy-types-collisionsensor"), ("bpy.types.constraint.mute*", "rigging/constraints/interface/header.html#bpy-types-constraint-mute"), ("bpy.types.explodemodifier*", "modeling/modifiers/simulate/explode.html#bpy-types-explodemodifier"), ("bpy.types.fcurvemodifiers*", "editors/graph_editor/fcurves/modifiers.html#bpy-types-fcurvemodifiers"), @@ -491,7 +481,6 @@ url_manual_mapping = ( ("bpy.types.fmodifierlimits*", "editors/graph_editor/fcurves/modifiers.html#bpy-types-fmodifierlimits"), ("bpy.types.gpussaosettings*", "editors/3dview/properties/shading.html#bpy-types-gpussaosettings"), ("bpy.types.latticemodifier*", "modeling/modifiers/deform/lattice.html#bpy-types-latticemodifier"), - ("bpy.types.messageactuator*", "game_engine/logic/actuators/types/message.html#bpy-types-messageactuator"), ("bpy.types.musgravetexture*", "render/blender_render/textures/types/procedural/musgrave.html#bpy-types-musgravetexture"), ("bpy.types.object.location*", "editors/3dview/object/properties/transforms.html#bpy-types-object-location"), ("bpy.types.object.rotation*", "editors/3dview/object/properties/transforms.html#bpy-types-object-rotation"), @@ -516,28 +505,18 @@ url_manual_mapping = ( ("bpy.ops.transform.resize*", "editors/3dview/object/editing/transform/basics.html#bpy-ops-transform-resize"), ("bpy.ops.transform.rotate*", "editors/3dview/object/editing/transform/basics.html#bpy-ops-transform-rotate"), ("bpy.ops.view3d.localview*", "editors/3dview/navigate/views.html#bpy-ops-view3d-localview"), - ("bpy.types.actionactuator*", "game_engine/logic/actuators/types/action.html#bpy-types-actionactuator"), - ("bpy.types.actuatorsensor*", "game_engine/logic/sensors/types/actuator.html#bpy-types-actuatorsensor"), - ("bpy.types.armaturesensor*", "game_engine/logic/sensors/types/armature.html#bpy-types-armaturesensor"), - ("bpy.types.cameraactuator*", "game_engine/logic/actuators/types/camera.html#bpy-types-cameraactuator"), ("bpy.types.curvesmodifier*", "editors/vse/sequencer/properties/modifiers.html#bpy-types-curvesmodifier"), ("bpy.types.effectsequence*", "editors/vse/sequencer/properties/filter.html#bpy-types-effectsequence"), ("bpy.types.ffmpegsettings*", "render/output/video.html#bpy-types-ffmpegsettings"), ("bpy.types.fmodifiernoise*", "editors/graph_editor/fcurves/modifiers.html#bpy-types-fmodifiernoise"), ("bpy.types.gpudofsettings*", "editors/3dview/properties/shading.html#bpy-types-gpudofsettings"), - ("bpy.types.joysticksensor*", "game_engine/logic/sensors/types/joystick.html#bpy-types-joysticksensor"), - ("bpy.types.keyboardsensor*", "game_engine/logic/sensors/types/keyboard.html#bpy-types-keyboardsensor"), ("bpy.types.materialstrand*", "render/blender_render/materials/properties/strands.html#bpy-types-materialstrand"), ("bpy.types.materialvolume*", "render/blender_render/materials/special_effects/volume.html#bpy-types-materialvolume"), ("bpy.types.mirrormodifier*", "modeling/modifiers/generate/mirror.html#bpy-types-mirrormodifier"), ("bpy.types.movieclipproxy*", "editors/movie_clip_editor/properties/proxy.html#bpy-types-movieclipproxy"), ("bpy.types.object.up_axis*", "editors/3dview/object/properties/relations/extras.html#bpy-types-object-up-axis"), - ("bpy.types.objectactuator*", "game_engine/logic/actuators/types/motion.html#bpy-types-objectactuator"), - ("bpy.types.parentactuator*", "game_engine/logic/actuators/types/parent.html#bpy-types-parentactuator"), ("bpy.types.particlesystem*", "physics/particles/index.html#bpy-types-particlesystem"), ("bpy.types.particletarget*", "physics/particles/emitter/physics/keyed.html#bpy-types-particletarget"), - ("bpy.types.propertysensor*", "game_engine/logic/sensors/types/property.html#bpy-types-propertysensor"), - ("bpy.types.randomactuator*", "game_engine/logic/actuators/types/random.html#bpy-types-randomactuator"), ("bpy.types.remeshmodifier*", "modeling/modifiers/generate/remesh.html#bpy-types-remeshmodifier"), ("bpy.types.rendersettings*", "render/index.html#bpy-types-rendersettings"), ("bpy.types.rigidbodyworld*", "physics/rigid_body/world.html#bpy-types-rigidbodyworld"), @@ -571,9 +550,7 @@ url_manual_mapping = ( ("bpy.types.gpufxsettings*", "editors/3dview/properties/shading.html#bpy-types-gpufxsettings"), ("bpy.types.imagesequence*", "editors/vse/sequencer/strips/movie_image.html#bpy-types-imagesequence"), ("bpy.types.marbletexture*", "render/blender_render/textures/types/procedural/marble.html#bpy-types-marbletexture"), - ("bpy.types.messagesensor*", "game_engine/logic/sensors/types/message.html#bpy-types-messagesensor"), ("bpy.types.modifier.show*", "modeling/modifiers/introduction.html#bpy-types-modifier-show"), - ("bpy.types.mouseactuator*", "game_engine/logic/actuators/types/mouse.html#bpy-types-mouseactuator"), ("bpy.types.moviesequence*", "editors/vse/sequencer/strips/movie_image.html#bpy-types-moviesequence"), ("bpy.types.movietracking*", "editors/movie_clip_editor/tracking/index.html#bpy-types-movietracking"), ("bpy.types.object.layers*", "editors/3dview/object/properties/relations/layers.html#bpy-types-object-layers"), @@ -581,18 +558,15 @@ url_manual_mapping = ( ("bpy.types.oceanmodifier*", "modeling/modifiers/simulate/ocean.html#bpy-types-oceanmodifier"), ("bpy.types.particlebrush*", "physics/particles/mode.html#bpy-types-particlebrush"), ("bpy.types.scene.gravity*", "physics/gravity.html#bpy-types-scene-gravity"), - ("bpy.types.sceneactuator*", "game_engine/logic/actuators/types/scene.html#bpy-types-sceneactuator"), ("bpy.types.scenesequence*", "editors/vse/sequencer/strips/scene.html#bpy-types-scenesequence"), ("bpy.types.screwmodifier*", "modeling/modifiers/generate/screw.html#bpy-types-screwmodifier"), ("bpy.types.sequenceproxy*", "editors/vse/sequencer/properties/proxy_timecode.html#bpy-types-sequenceproxy"), ("bpy.types.shadernodergb*", "render/cycles/nodes/types/input/rgb.html#bpy-types-shadernodergb"), ("bpy.types.smokemodifier*", "physics/smoke/index.html#bpy-types-smokemodifier"), - ("bpy.types.soundactuator*", "game_engine/logic/actuators/types/sound.html#bpy-types-soundactuator"), ("bpy.types.soundsequence*", "editors/vse/sequencer/strips/sound.html#bpy-types-soundsequence"), ("bpy.types.spaceoutliner*", "editors/outliner.html#bpy-types-spaceoutliner"), ("bpy.types.spacetimeline*", "editors/timeline.html#bpy-types-spacetimeline"), ("bpy.types.spaceuveditor*", "editors/uv_image/uv/index.html#bpy-types-spaceuveditor"), - ("bpy.types.stateactuator*", "game_engine/logic/actuators/types/state.html#bpy-types-stateactuator"), ("bpy.types.stuccitexture*", "render/blender_render/textures/types/procedural/stucci.html#bpy-types-stuccitexture"), ("bpy.types.windowmanager*", "interface/index.html#bpy-types-windowmanager"), ("bpy.types.worldlighting*", "render/blender_render/world/ambient_occlusion.html#bpy-types-worldlighting"), @@ -600,12 +574,10 @@ url_manual_mapping = ( ("bpy.ops.object.convert*", "editors/3dview/object/editing/introduction.html#bpy-ops-object-convert"), ("bpy.ops.object.speaker*", "render/audio/speaker.html#bpy-ops-object-speaker"), ("bpy.ops.transform.bend*", "modeling/meshes/editing/transform/bend.html#bpy-ops-transform-bend"), - ("bpy.types.alwayssensor*", "game_engine/logic/sensors/types/always.html#bpy-types-alwayssensor"), ("bpy.types.bakesettings*", "render/cycles/baking.html#bpy-types-bakesettings"), ("bpy.types.blendtexture*", "render/blender_render/textures/types/procedural/blend.html#bpy-types-blendtexture"), ("bpy.types.castmodifier*", "modeling/modifiers/deform/cast.html#bpy-types-castmodifier"), ("bpy.types.colormanaged*", "render/post_process/color_management.html#bpy-types-colormanaged"), - ("bpy.types.gameactuator*", "game_engine/logic/actuators/types/game.html#bpy-types-gameactuator"), ("bpy.types.glowsequence*", "editors/vse/sequencer/strips/effects/glow.html#bpy-types-glowsequence"), ("bpy.types.gpencilbrush*", "interface/grease_pencil/drawing/brushes.html#bpy-types-gpencilbrush"), ("bpy.types.greasepencil*", "interface/grease_pencil/index.html#bpy-types-greasepencil"), @@ -623,7 +595,6 @@ url_manual_mapping = ( ("bpy.types.object.scale*", "editors/3dview/object/properties/transforms.html#bpy-types-object-scale"), ("bpy.types.oceantexture*", "render/blender_render/textures/types/procedural/ocean.html#bpy-types-oceantexture"), ("bpy.types.particleedit*", "physics/particles/mode.html#bpy-types-particleedit"), - ("bpy.types.randomsensor*", "game_engine/logic/sensors/types/random.html#bpy-types-randomsensor"), ("bpy.types.scene.camera*", "data_system/scenes/properties.html#bpy-types-scene-camera"), ("bpy.types.sequencecrop*", "editors/vse/sequencer/properties/input.html#bpy-types-sequencecrop"), ("bpy.types.skinmodifier*", "modeling/modifiers/generate/skin.html#bpy-types-skinmodifier"), @@ -641,14 +612,11 @@ url_manual_mapping = ( ("bpy.ops.wm.properties*", "data_system/custom_properties.html#bpy-ops-wm-properties"), ("bpy.types.addsequence*", "editors/vse/sequencer/strips/effects/add.html#bpy-types-addsequence"), ("bpy.types.consoleline*", "editors/python_console.html#bpy-types-consoleline"), - ("bpy.types.delaysensor*", "game_engine/logic/sensors/types/delay.html#bpy-types-delaysensor"), ("bpy.types.meshstatvis*", "modeling/meshes/mesh_analysis.html#bpy-types-meshstatvis"), - ("bpy.types.mousesensor*", "game_engine/logic/sensors/types/mouse.html#bpy-types-mousesensor"), ("bpy.types.nodesetting*", "editors/node_editor/nodes/parts.html#bpy-types-nodesetting"), ("bpy.types.object.lock*", "editors/3dview/object/properties/transforms.html#bpy-types-object-lock"), ("bpy.types.object.show*", "editors/3dview/object/properties/display.html#bpy-types-object-show"), ("bpy.types.particlekey*", "physics/particles/emitter/physics/keyed.html#bpy-types-particlekey"), - ("bpy.types.radarsensor*", "game_engine/logic/sensors/types/radar.html#bpy-types-radarsensor"), ("bpy.types.renderlayer*", "render/post_process/layers.html#bpy-types-renderlayer"), ("bpy.types.spaceview3d*", "editors/3dview/index.html#bpy-types-spaceview3d"), ("bpy.types.uipopupmenu*", "interface/controls/buttons/menus.html#bpy-types-uipopupmenu"), @@ -665,8 +633,6 @@ url_manual_mapping = ( ("bpy.types.bpy_struct*", "data_system/custom_properties.html#bpy-types-bpy-struct"), ("bpy.types.compositor*", "compositing/index.html#bpy-types-compositor"), ("bpy.types.constraint*", "rigging/constraints/index.html#bpy-types-constraint"), - ("bpy.types.controller*", "game_engine/logic/controllers/index.html#bpy-types-controller"), - ("bpy.types.nearsensor*", "game_engine/logic/sensors/types/near.html#bpy-types-nearsensor"), ("bpy.types.nodesocket*", "editors/node_editor/nodes/parts.html#bpy-types-nodesocket"), ("bpy.types.pointcache*", "physics/baking.html#bpy-types-pointcache"), ("bpy.types.renderpass*", "render/blender_render/settings/passes.html#bpy-types-renderpass"), @@ -687,7 +653,6 @@ url_manual_mapping = ( ("bpy.types.nodeframe*", "editors/node_editor/nodes/frame.html#bpy-types-nodeframe"), ("bpy.types.nodegroup*", "editors/node_editor/nodes/groups.html#bpy-types-nodegroup"), ("bpy.types.pointlamp*", "render/blender_render/lighting/lamps/point.html#bpy-types-pointlamp"), - ("bpy.types.raysensor*", "game_engine/logic/sensors/types/ray.html#bpy-types-raysensor"), ("bpy.types.spaceinfo*", "editors/info/index.html#bpy-types-spaceinfo"), ("bpy.types.textcurve*", "modeling/texts/index.html#bpy-types-textcurve"), ("bpy.types.uipiemenu*", "interface/controls/buttons/menus.html#bpy-types-uipiemenu"), @@ -697,14 +662,12 @@ url_manual_mapping = ( ("bpy.ops.mesh.noise*", "modeling/meshes/editing/transform/noise.html#bpy-ops-mesh-noise"), ("bpy.ops.mesh.screw*", "modeling/meshes/editing/duplicating/screw.html#bpy-ops-mesh-screw"), ("bpy.ops.safe_areas*", "render/blender_render/camera/object_data.html#bpy-ops-safe-areas"), - ("bpy.types.actuator*", "game_engine/logic/actuators/index.html#bpy-types-actuator"), ("bpy.types.arealamp*", "render/blender_render/lighting/lamps/area/index.html#bpy-types-arealamp"), ("bpy.types.armature*", "rigging/armatures/index.html#bpy-types-armature"), ("bpy.types.editbone*", "rigging/armatures/bones/editing/index.html#bpy-types-editbone"), ("bpy.types.hemilamp*", "render/blender_render/lighting/lamps/hemi.html#bpy-types-hemilamp"), ("bpy.types.keyframe*", "animation/keyframes/index.html#bpy-types-keyframe"), ("bpy.types.linesets*", "render/freestyle/parameter_editor/line_set.html#bpy-types-linesets"), - ("bpy.types.lodlevel*", "game_engine/settings/object.html#bpy-types-lodlevel"), ("bpy.types.material*", "render/blender_render/materials/index.html#bpy-types-material"), ("bpy.types.metaball*", "modeling/metas/index.html#bpy-types-metaball"), ("bpy.types.modifier*", "modeling/modifiers/index.html#bpy-types-modifier"), @@ -748,7 +711,6 @@ url_manual_mapping = ( ("bpy.types.render*", "render/index.html#bpy-types-render"), ("bpy.types.screen*", "interface/window_system/screens.html#bpy-types-screen"), ("bpy.types.sculpt*", "sculpt_paint/sculpting/index.html#bpy-types-sculpt"), - ("bpy.types.sensor*", "game_engine/logic/sensors/index.html#bpy-types-sensor"), ("bpy.types.shader*", "render/cycles/nodes/types/shaders/index.html#bpy-types-shader"), ("bpy.types.window*", "interface/index.html#bpy-types-window"), ("bpy.ops.buttons*", "interface/index.html#bpy-ops-buttons"), @@ -792,7 +754,7 @@ url_manual_mapping = ( ("bpy.types.area*", "interface/window_system/areas.html#bpy-types-area"), ("bpy.types.boid*", "physics/particles/emitter/physics/boids.html#bpy-types-boid"), ("bpy.types.bone*", "rigging/armatures/bones/index.html#bpy-types-bone"), - ("bpy.types.lamp*", "render/blender_render/lighting/index.html#bpy-types-lamp"), + ("bpy.types.light*", "render/blender_render/lighting/index.html#bpy-types-lamp"), ("bpy.types.mask*", "editors/movie_clip_editor/masking/index.html#bpy-types-mask"), ("bpy.types.menu*", "interface/controls/buttons/menus.html#bpy-types-menu"), ("bpy.types.mesh*", "modeling/meshes/index.html#bpy-types-mesh"), @@ -805,7 +767,6 @@ url_manual_mapping = ( ("bpy.ops.graph*", "editors/graph_editor/index.html#bpy-ops-graph"), ("bpy.ops.group*", "editors/3dview/object/properties/relations/groups.html#bpy-ops-group"), ("bpy.ops.image*", "data_system/files/media/image_formats.html#bpy-ops-image"), - ("bpy.ops.logic*", "game_engine/logic/index.html#bpy-ops-logic"), ("bpy.ops.mball*", "modeling/metas/index.html#bpy-ops-mball"), ("bpy.ops.paint*", "sculpt_paint/index.html#bpy-ops-paint"), ("bpy.ops.scene*", "data_system/scenes/index.html#bpy-ops-scene"), @@ -818,7 +779,7 @@ url_manual_mapping = ( ("bpy.ops.file*", "editors/file_browser/index.html#bpy-ops-file"), ("bpy.ops.font*", "modeling/texts/index.html#bpy-ops-font"), ("bpy.ops.info*", "editors/info/index.html#bpy-ops-info"), - ("bpy.ops.lamp*", "render/blender_render/lighting/index.html#bpy-ops-lamp"), + ("bpy.ops.light*", "render/blender_render/lighting/index.html#bpy-ops-lamp"), ("bpy.ops.mask*", "editors/movie_clip_editor/masking/index.html#bpy-ops-mask"), ("bpy.ops.mesh*", "modeling/meshes/index.html#bpy-ops-mesh"), ("bpy.ops.node*", "editors/node_editor/nodes/index.html#bpy-ops-node"), diff --git a/netrender/ui.py b/netrender/ui.py index 7f65163f..63553e29 100644 --- a/netrender/ui.py +++ b/netrender/ui.py @@ -35,7 +35,7 @@ ADDRESS_TEST_TIMEOUT = 30 def base_poll(cls, context): rd = context.scene.render - return (rd.use_game_engine==False) and (rd.engine in cls.COMPAT_ENGINES) + return (rd.engine in cls.COMPAT_ENGINES) def init_file(): @@ -96,7 +96,7 @@ class NetRenderButtonsPanel(): @classmethod def poll(cls, context): rd = context.scene.render - return rd.engine == 'NET_RENDER' and rd.use_game_engine == False + return rd.engine == 'NET_RENDER' # Setting panel, use in the scene for now. class RENDER_PT_network_settings(NetRenderButtonsPanel, bpy.types.Panel): diff --git a/node_wrangler.py b/node_wrangler.py index a8cd6646..8b34e13d 100644 --- a/node_wrangler.py +++ b/node_wrangler.py @@ -20,7 +20,7 @@ bl_info = { "name": "Node Wrangler", "author": "Bartek Skorupa, Greg Zaal, Sebastian Koenig, Christian Brinkmann, Florian Meyer", "version": (3, 35), - "blender": (2, 78, 0), + "blender": (2, 80, 0), "location": "Node Editor Toolbar or Ctrl-Space", "description": "Various tools to enhance and speed up node-based workflow", "warning": "", @@ -115,7 +115,7 @@ shaders_input_nodes_props = ( # Keeping mixed case to avoid having to translate entries when adding new nodes in operators. shaders_output_nodes_props = ( ('ShaderNodeOutputMaterial', 'OUTPUT_MATERIAL', 'Material Output'), - ('ShaderNodeOutputLamp', 'OUTPUT_LAMP', 'Lamp Output'), + ('ShaderNodeOutputLight', 'OUTPUT_LIGHT', 'Light Output'), ('ShaderNodeOutputWorld', 'OUTPUT_WORLD', 'World Output'), ) # (rna_type.identifier, type, rna_type.name) @@ -332,7 +332,7 @@ compo_layout_nodes_props = ( blender_mat_input_nodes_props = ( ('ShaderNodeMaterial', 'MATERIAL', 'Material'), ('ShaderNodeCameraData', 'CAMERA', 'Camera Data'), - ('ShaderNodeLampData', 'LAMP', 'Lamp Data'), + ('ShaderNodeLightData', 'LIGHT', 'Light Data'), ('ShaderNodeValue', 'VALUE', 'Value'), ('ShaderNodeRGB', 'RGB', 'RGB'), ('ShaderNodeTexture', 'TEXTURE', 'Texture'), @@ -547,6 +547,10 @@ draw_color_sets = { } +def is_cycles_or_eevee(context): + return context.scene.render.engine in {'CYCLES', 'BLENDER_EEVEE'} + + def nice_hotkey_name(punc): # convert the ugly string name into the actual character pairs = ( @@ -1000,39 +1004,39 @@ def get_nodes_links(context): # Principled prefs class NWPrincipledPreferences(bpy.types.PropertyGroup): - base_color = StringProperty( + base_color: StringProperty( name='Base Color', default='diffuse diff albedo base col color', description='Naming Components for Base Color maps') - sss_color = StringProperty( + sss_color: StringProperty( name='Subsurface Color', default='sss subsurface', description='Naming Components for Subsurface Color maps') - metallic = StringProperty( + metallic: StringProperty( name='Metallic', default='metallic metalness metal mtl', description='Naming Components for metallness maps') - specular = StringProperty( + specular: StringProperty( name='Specular', default='specularity specular spec spc', description='Naming Components for Specular maps') - normal = StringProperty( + normal: StringProperty( name='Normal', default='normal nor nrm nrml norm', description='Naming Components for Normal maps') - bump = StringProperty( + bump: StringProperty( name='Bump', default='bump bmp', description='Naming Components for bump maps') - rough = StringProperty( + rough: StringProperty( name='Roughness', default='roughness rough rgh', description='Naming Components for roughness maps') - gloss = StringProperty( + gloss: StringProperty( name='Gloss', default='gloss glossy glossyness', description='Naming Components for glossy maps') - displacement = StringProperty( + displacement: StringProperty( name='Displacement', default='displacement displace disp dsp height heightmap', description='Naming Components for displacement maps') @@ -1041,7 +1045,7 @@ class NWPrincipledPreferences(bpy.types.PropertyGroup): class NWNodeWrangler(bpy.types.AddonPreferences): bl_idname = __name__ - merge_hide = EnumProperty( + merge_hide: EnumProperty( name="Hide Mix nodes", items=( ("ALWAYS", "Always", "Always collapse the new merge nodes"), @@ -1050,7 +1054,7 @@ class NWNodeWrangler(bpy.types.AddonPreferences): ), default='NON_SHADER', description="When merging nodes with the Ctrl+Numpad0 hotkey (and similar) specifiy whether to collapse them or show the full node with options expanded") - merge_position = EnumProperty( + merge_position: EnumProperty( name="Mix Node Position", items=( ("CENTER", "Center", "Place the Mix node between the two nodes"), @@ -1059,22 +1063,22 @@ class NWNodeWrangler(bpy.types.AddonPreferences): default='CENTER', description="When merging nodes with the Ctrl+Numpad0 hotkey (and similar) specifiy the position of the new nodes") - show_hotkey_list = BoolProperty( + show_hotkey_list: BoolProperty( name="Show Hotkey List", default=False, description="Expand this box into a list of all the hotkeys for functions in this addon" ) - hotkey_list_filter = StringProperty( + hotkey_list_filter: StringProperty( name=" Filter by Name", default="", description="Show only hotkeys that have this text in their name" ) - show_principled_lists = BoolProperty( + show_principled_lists: BoolProperty( name="Show Principled naming tags", default=False, description="Expand this box into a list of all naming tags for principled texture setup" ) - principled_tags = bpy.props.PointerProperty(type=NWPrincipledPreferences) + principled_tags: bpy.props.PointerProperty(type=NWPrincipledPreferences) def draw(self, context): layout = self.layout @@ -1223,7 +1227,7 @@ class NWLazyConnect(Operator, NWBase): bl_idname = "node.nw_lazy_connect" bl_label = "Lazy Connect" bl_options = {'REGISTER', 'UNDO'} - with_menu = BoolProperty() + with_menu: BoolProperty() def modal(self, context, event): context.area.tag_redraw() @@ -1329,12 +1333,12 @@ class NWDeleteUnused(Operator, NWBase): bl_label = 'Delete Unused Nodes' bl_options = {'REGISTER', 'UNDO'} - delete_muted = BoolProperty(name="Delete Muted", description="Delete (but reconnect, like Ctrl-X) all muted nodes", default=True) - delete_frames = BoolProperty(name="Delete Empty Frames", description="Delete all frames that have no nodes inside them", default=True) + delete_muted: BoolProperty(name="Delete Muted", description="Delete (but reconnect, like Ctrl-X) all muted nodes", default=True) + delete_frames: BoolProperty(name="Delete Empty Frames", description="Delete all frames that have no nodes inside them", default=True) def is_unused_node(self, node): end_types = ['OUTPUT_MATERIAL', 'OUTPUT', 'VIEWER', 'COMPOSITE', \ - 'SPLITVIEWER', 'OUTPUT_FILE', 'LEVELS', 'OUTPUT_LAMP', \ + 'SPLITVIEWER', 'OUTPUT_FILE', 'LEVELS', 'OUTPUT_LIGHT', \ 'OUTPUT_WORLD', 'GROUP_INPUT', 'GROUP_OUTPUT', 'FRAME'] if node.type in end_types: return False @@ -1567,9 +1571,10 @@ class NWAddAttrNode(Operator, NWBase): """Add an Attribute node with this name""" bl_idname = 'node.nw_add_attr_node' bl_label = 'Add UV map' - attr_name = StringProperty() bl_options = {'REGISTER', 'UNDO'} + attr_name: StringProperty() + def execute(self, context): bpy.ops.node.add_node('INVOKE_DEFAULT', use_transform=True, type="ShaderNodeAttribute") nodes, links = get_nodes_links(context) @@ -1585,7 +1590,7 @@ class NWEmissionViewer(Operator, NWBase): @classmethod def poll(cls, context): - is_cycles = context.scene.render.engine == 'CYCLES' + is_cycles = is_cycles_or_eevee(context) if nw_check(context): space = context.space_data if space.tree_type == 'ShaderNodeTree' and is_cycles: @@ -1600,13 +1605,13 @@ class NWEmissionViewer(Operator, NWBase): space = context.space_data shader_type = space.shader_type if shader_type == 'OBJECT': - if space.id not in [lamp for lamp in bpy.data.lamps]: # cannot use bpy.data.lamps directly as iterable + if space.id not in [light for light in bpy.data.lights]: # cannot use bpy.data.lights directly as iterable shader_output_type = "OUTPUT_MATERIAL" shader_output_ident = "ShaderNodeOutputMaterial" shader_viewer_ident = "ShaderNodeEmission" else: - shader_output_type = "OUTPUT_LAMP" - shader_output_ident = "ShaderNodeOutputLamp" + shader_output_type = "OUTPUT_LIGHT" + shader_output_ident = "ShaderNodeOutputLight" shader_viewer_ident = "ShaderNodeEmission" elif shader_type == 'WORLD': @@ -1734,9 +1739,19 @@ class NWFrameSelected(Operator, NWBase): bl_label = "Frame Selected" bl_description = "Add a frame node and parent the selected nodes to it" bl_options = {'REGISTER', 'UNDO'} - label_prop = StringProperty(name='Label', default=' ', description='The visual name of the frame node') - color_prop = FloatVectorProperty(name="Color", description="The color of the frame node", default=(0.6, 0.6, 0.6), - min=0, max=1, step=1, precision=3, subtype='COLOR_GAMMA', size=3) + + label_prop: StringProperty( + name='Label', + description='The visual name of the frame node', + default=' ' + ) + color_prop: FloatVectorProperty( + name="Color", + description="The color of the frame node", + default=(0.6, 0.6, 0.6), + min=0, max=1, step=1, precision=3, + subtype='COLOR_GAMMA', size=3 + ) def execute(self, context): nodes, links = get_nodes_links(context) @@ -1795,7 +1810,7 @@ class NWSwitchNodeType(Operator, NWBase): bl_label = "Switch Node Type" bl_options = {'REGISTER', 'UNDO'} - to_type = EnumProperty( + to_type: EnumProperty( name="Switch to type", items=list(shaders_input_nodes_props) + list(shaders_output_nodes_props) + @@ -2009,12 +2024,12 @@ class NWMergeNodes(Operator, NWBase): bl_description = "Merge Selected Nodes" bl_options = {'REGISTER', 'UNDO'} - mode = EnumProperty( + mode: EnumProperty( name="mode", description="All possible blend types and math operations", items=blend_types + [op for op in operations if op not in blend_types], ) - merge_type = EnumProperty( + merge_type: EnumProperty( name="merge type", description="Type of Merge to be used", items=( @@ -2260,11 +2275,11 @@ class NWBatchChangeNodes(Operator, NWBase): bl_description = "Batch Change Blend Type and Math Operation" bl_options = {'REGISTER', 'UNDO'} - blend_type = EnumProperty( + blend_type: EnumProperty( name="Blend Type", items=blend_types + navs, ) - operation = EnumProperty( + operation: EnumProperty( name="Operation", items=operations + navs, ) @@ -2326,7 +2341,7 @@ class NWChangeMixFactor(Operator, NWBase): # option: Change factor. # If option is 1.0 or 0.0 - set to 1.0 or 0.0 # Else - change factor by option value. - option = FloatProperty() + option: FloatProperty() def execute(self, context): nodes, links = get_nodes_links(context) @@ -2462,7 +2477,7 @@ class NWCopyLabel(Operator, NWBase): bl_label = "Copy Label" bl_options = {'REGISTER', 'UNDO'} - option = EnumProperty( + option: EnumProperty( name="option", description="Source of name of label", items=( @@ -2506,7 +2521,7 @@ class NWClearLabel(Operator, NWBase): bl_label = "Clear Label" bl_options = {'REGISTER', 'UNDO'} - option = BoolProperty() + option: BoolProperty() def execute(self, context): nodes, links = get_nodes_links(context) @@ -2528,16 +2543,16 @@ class NWModifyLabels(Operator, NWBase): bl_label = "Modify Labels" bl_options = {'REGISTER', 'UNDO'} - prepend = StringProperty( + prepend: StringProperty( name="Add to Beginning" ) - append = StringProperty( + append: StringProperty( name="Add to End" ) - replace_from = StringProperty( + replace_from: StringProperty( name="Text to Replace" ) - replace_to = StringProperty( + replace_to: StringProperty( name="Replace with" ) @@ -2561,14 +2576,14 @@ class NWAddTextureSetup(Operator, NWBase): bl_description = "Add Texture Node Setup to Selected Shaders" bl_options = {'REGISTER', 'UNDO'} - add_mapping = BoolProperty(name="Add Mapping Nodes", description="Create coordinate and mapping nodes for the texture (ignored for selected texture nodes)", default=True) + add_mapping: BoolProperty(name="Add Mapping Nodes", description="Create coordinate and mapping nodes for the texture (ignored for selected texture nodes)", default=True) @classmethod def poll(cls, context): valid = False if nw_check(context): space = context.space_data - if space.tree_type == 'ShaderNodeTree' and context.scene.render.engine == 'CYCLES': + if space.tree_type == 'ShaderNodeTree' and is_cycles_or_eevee(context): valid = True return valid @@ -2639,26 +2654,28 @@ class NWAddPrincipledSetup(Operator, NWBase, ImportHelper): bl_description = "Add Texture Node Setup for Principled BSDF" bl_options = {'REGISTER', 'UNDO'} - directory = StringProperty( - name='Directory', - subtype='DIR_PATH', - default='', - description='Folder to search in for image files') - files = CollectionProperty( - type=bpy.types.OperatorFileListElement, - options={'HIDDEN', 'SKIP_SAVE'}) + directory: StringProperty( + name='Directory', + subtype='DIR_PATH', + default='', + description='Folder to search in for image files' + ) + files: CollectionProperty( + type=bpy.types.OperatorFileListElement, + options={'HIDDEN', 'SKIP_SAVE'} + ) order = [ "filepath", "files", - ] + ] @classmethod def poll(cls, context): valid = False if nw_check(context): space = context.space_data - if space.tree_type == 'ShaderNodeTree' and context.scene.render.engine == 'CYCLES': + if space.tree_type == 'ShaderNodeTree' and is_cycles_or_eevee(context): valid = True return valid @@ -2892,7 +2909,7 @@ class NWAddReroutes(Operator, NWBase): bl_description = "Add Reroutes to Outputs" bl_options = {'REGISTER', 'UNDO'} - option = EnumProperty( + option: EnumProperty( name="option", items=[ ('ALL', 'to all', 'Add to all outputs'), @@ -2992,9 +3009,9 @@ class NWLinkActiveToSelected(Operator, NWBase): bl_label = "Link Active Node to Selected" bl_options = {'REGISTER', 'UNDO'} - replace = BoolProperty() - use_node_name = BoolProperty() - use_outputs_names = BoolProperty() + replace: BoolProperty() + use_node_name: BoolProperty() + use_outputs_names: BoolProperty() @classmethod def poll(cls, context): @@ -3072,7 +3089,7 @@ class NWAlignNodes(Operator, NWBase): bl_idname = "node.nw_align_nodes" bl_label = "Align Nodes" bl_options = {'REGISTER', 'UNDO'} - margin = IntProperty(name='Margin', default=50, description='The amount of space between nodes') + margin: IntProperty(name='Margin', default=50, description='The amount of space between nodes') def execute(self, context): nodes, links = get_nodes_links(context) @@ -3142,7 +3159,7 @@ class NWSelectParentChildren(Operator, NWBase): bl_label = "Select Parent or Children" bl_options = {'REGISTER', 'UNDO'} - option = EnumProperty( + option: EnumProperty( name="option", items=( ('PARENT', 'Select Parent', 'Select Parent Frame'), @@ -3225,7 +3242,7 @@ class NWLinkToOutputNode(Operator, NWBase): if not output_node: bpy.ops.node.select_all(action="DESELECT") if tree_type == 'ShaderNodeTree': - if context.scene.render.engine == 'CYCLES': + if is_cycles_or_eevee(context): output_node = nodes.new('ShaderNodeOutputMaterial') else: output_node = nodes.new('ShaderNodeOutput') @@ -3246,7 +3263,7 @@ class NWLinkToOutputNode(Operator, NWBase): break out_input_index = 0 - if tree_type == 'ShaderNodeTree' and context.scene.render.engine == 'CYCLES': + if tree_type == 'ShaderNodeTree' and is_cycles_or_eevee(context): if active.outputs[output_index].name == 'Volume': out_input_index = 1 elif active.outputs[output_index].type != 'SHADER': # connect to displacement if not a shader @@ -3263,8 +3280,8 @@ class NWMakeLink(Operator, NWBase): bl_idname = 'node.nw_make_link' bl_label = 'Make Link' bl_options = {'REGISTER', 'UNDO'} - from_socket = IntProperty() - to_socket = IntProperty() + from_socket: IntProperty() + to_socket: IntProperty() def execute(self, context): nodes, links = get_nodes_links(context) @@ -3284,7 +3301,7 @@ class NWCallInputsMenu(Operator, NWBase): bl_idname = 'node.nw_call_inputs_menu' bl_label = 'Make Link' bl_options = {'REGISTER', 'UNDO'} - from_socket = IntProperty() + from_socket: IntProperty() def execute(self, context): nodes, links = get_nodes_links(context) @@ -3305,9 +3322,17 @@ class NWAddSequence(Operator, ImportHelper): bl_idname = 'node.nw_add_sequence' bl_label = 'Import Image Sequence' bl_options = {'REGISTER', 'UNDO'} - directory = StringProperty(subtype="DIR_PATH") - filename = StringProperty(subtype="FILE_NAME") - files = CollectionProperty(type=bpy.types.OperatorFileListElement, options={'HIDDEN', 'SKIP_SAVE'}) + + directory: StringProperty( + subtype="DIR_PATH" + ) + filename: StringProperty( + subtype="FILE_NAME" + ) + files: CollectionProperty( + type=bpy.types.OperatorFileListElement, + options={'HIDDEN', 'SKIP_SAVE'} + ) def execute(self, context): nodes, links = get_nodes_links(context) @@ -3399,8 +3424,13 @@ class NWAddMultipleImages(Operator, ImportHelper): bl_idname = 'node.nw_add_multiple_images' bl_label = 'Open Selected Images' bl_options = {'REGISTER', 'UNDO'} - directory = StringProperty(subtype="DIR_PATH") - files = CollectionProperty(type=bpy.types.OperatorFileListElement, options={'HIDDEN', 'SKIP_SAVE'}) + directory: StringProperty( + subtype="DIR_PATH" + ) + files: CollectionProperty( + type=bpy.types.OperatorFileListElement, + options={'HIDDEN', 'SKIP_SAVE'} + ) def execute(self, context): nodes, links = get_nodes_links(context) @@ -3447,8 +3477,8 @@ class NWViewerFocus(bpy.types.Operator): bl_idname = "node.nw_viewer_focus" bl_label = "Viewer Focus" - x = bpy.props.IntProperty() - y = bpy.props.IntProperty() + x: bpy.props.IntProperty() + y: bpy.props.IntProperty() @classmethod def poll(cls, context): @@ -3502,8 +3532,8 @@ class NWSaveViewer(bpy.types.Operator, ExportHelper): """Save the current viewer node to an image file""" bl_idname = "node.nw_save_viewer" bl_label = "Save This Image" - filepath = StringProperty(subtype="FILE_PATH") - filename_ext = EnumProperty( + filepath: StringProperty(subtype="FILE_PATH") + filename_ext: EnumProperty( name="Format", description="Choose the file format to save to", items=(('.bmp', "PNG", ""), @@ -3681,7 +3711,7 @@ def drawlayout(context, layout, mode='non-panel'): col.menu(NWSwitchNodeTypeMenu.bl_idname, text="Switch Node Type") col.separator() - if tree_type == 'ShaderNodeTree' and context.scene.render.engine == 'CYCLES': + if tree_type == 'ShaderNodeTree' and is_cycles_or_eevee(context): col = layout.column(align=True) col.operator(NWAddTextureSetup.bl_idname, text="Add Texture Setup", icon='NODE_SEL') col.operator(NWAddPrincipledSetup.bl_idname, text="Add Principled Setup", icon='NODE_SEL') @@ -3737,11 +3767,11 @@ class NodeWranglerPanel(Panel, NWBase): bl_region_type = "TOOLS" bl_category = "Node Wrangler" - prepend = StringProperty( + prepend: StringProperty( name='prepend', ) - append = StringProperty() - remove = StringProperty() + append: StringProperty() + remove: StringProperty() def draw(self, context): self.layout.label(text="(Quick access: Ctrl+Space)") @@ -3766,7 +3796,7 @@ class NWMergeNodesMenu(Menu, NWBase): def draw(self, context): type = context.space_data.tree_type layout = self.layout - if type == 'ShaderNodeTree' and context.scene.render.engine == 'CYCLES': + if type == 'ShaderNodeTree' and is_cycles_or_eevee(context): layout.menu(NWMergeShadersMenu.bl_idname, text="Use Shaders") layout.menu(NWMergeMixMenu.bl_idname, text="Use Mix Nodes") layout.menu(NWMergeMathMenu.bl_idname, text="Use Math Nodes") @@ -3990,7 +4020,7 @@ class NWVertColMenu(bpy.types.Menu): valid = False if nw_check(context): snode = context.space_data - valid = snode.tree_type == 'ShaderNodeTree' and context.scene.render.engine == 'CYCLES' + valid = snode.tree_type == 'ShaderNodeTree' and is_cycles_or_eevee(context) return valid def draw(self, context): @@ -4025,7 +4055,7 @@ class NWSwitchNodeTypeMenu(Menu, NWBase): layout = self.layout tree = context.space_data.node_tree if tree.type == 'SHADER': - if context.scene.render.engine == 'CYCLES': + if is_cycles_or_eevee(context): layout.menu(NWSwitchShadersInputSubmenu.bl_idname) layout.menu(NWSwitchShadersOutputSubmenu.bl_idname) layout.menu(NWSwitchShadersShaderSubmenu.bl_idname) @@ -4034,7 +4064,7 @@ class NWSwitchNodeTypeMenu(Menu, NWBase): layout.menu(NWSwitchShadersVectorSubmenu.bl_idname) layout.menu(NWSwitchShadersConverterSubmenu.bl_idname) layout.menu(NWSwitchShadersLayoutSubmenu.bl_idname) - if context.scene.render.engine != 'CYCLES': + else: layout.menu(NWSwitchMatInputSubmenu.bl_idname) layout.menu(NWSwitchMatOutputSubmenu.bl_idname) layout.menu(NWSwitchMatColorSubmenu.bl_idname) diff --git a/object_boolean_tools.py b/object_boolean_tools.py index df082abc..9829640d 100644 --- a/object_boolean_tools.py +++ b/object_boolean_tools.py @@ -159,9 +159,9 @@ def Operation(context, _operation): obj.modifiers.remove(mod) """ if useWire: - selObj.draw_type = "WIRE" + selObj.display_type = "WIRE" else: - selObj.draw_type = "BOUNDS" + selObj.display_type = "BOUNDS" cyclesVis.camera = False cyclesVis.diffuse = False @@ -200,7 +200,7 @@ def Remove(context, thisObj_name, Prop): # if it's the brush object if obj.name == _thisObj_name: cyclesVis = obj.cycles_visibility - obj.draw_type = "TEXTURED" + obj.display_type = "TEXTURED" del obj["BoolToolBrush"] del obj["BoolTool_FTransform"] cyclesVis.camera = True @@ -229,7 +229,7 @@ def Remove(context, thisObj_name, Prop): if (actObj.name in mod.name): Canvas.modifiers.remove(mod) cyclesVis = actObj.cycles_visibility - actObj.draw_type = "TEXTURED" + actObj.display_type = "TEXTURED" del actObj["BoolToolBrush"] del actObj["BoolTool_FTransform"] cyclesVis.camera = True @@ -509,9 +509,9 @@ class BTool_FastTransform(Operator): if isBrush(actObj) and actObj["BoolTool_FTransform"] == "True": EnableThisBrush(bpy.context, "False") if useWire: - actObj.draw_type = "WIRE" + actObj.display_type = "WIRE" else: - actObj.draw_type = "BOUNDS" + actObj.display_type = "BOUNDS" if self.operator == "Translate": bpy.ops.transform.translate('INVOKE_DEFAULT') @@ -523,13 +523,13 @@ class BTool_FastTransform(Operator): if event.type == 'LEFTMOUSE': if isBrush(actObj): EnableThisBrush(bpy.context, "True") - actObj.draw_type = "WIRE" + actObj.display_type = "WIRE" return {'FINISHED'} if event.type in {'RIGHTMOUSE', 'ESC'}: if isBrush(actObj): EnableThisBrush(bpy.context, "True") - actObj.draw_type = "WIRE" + actObj.display_type = "WIRE" return {'CANCELLED'} return {'RUNNING_MODAL'} diff --git a/object_cloud_gen.py b/object_cloud_gen.py index 008763fc..6601b8f1 100644 --- a/object_cloud_gen.py +++ b/object_cloud_gen.py @@ -563,7 +563,7 @@ class GenerateCloud(Operator): # Select all of the left over boxes so people can immediately # press generate again if they want for eachMember in definitionObjects: - eachMember.draw_type = 'SOLID' + eachMember.display_type = 'SOLID' eachMember.select = True eachMember.hide_render = False @@ -576,7 +576,7 @@ class GenerateCloud(Operator): # Create a new object cloudPnts cloudPnts = addNewObject(scene, "CloudPoints", bounds) cloudPnts["CloudMember"] = "CreatedObj" - cloudPnts.draw_type = 'WIRE' + cloudPnts.display_type = 'WIRE' cloudPnts.hide_render = True makeParent(bounds, cloudPnts, scene) @@ -606,7 +606,7 @@ class GenerateCloud(Operator): selectedObjects[0] ) - bounds.draw_type = 'BOUNDS' + bounds.display_type = 'BOUNDS' bounds.hide_render = False # Just add a Definition Property designating this @@ -630,7 +630,7 @@ class GenerateCloud(Operator): for selObj in selectedObjects: selObj["CloudMember"] = "DefinitionObj" selObj.name = "DefinitionObj" - selObj.draw_type = 'WIRE' + selObj.display_type = 'WIRE' selObj.hide_render = True selObj.hide = True makeParent(bounds, selObj, scene) @@ -638,7 +638,7 @@ class GenerateCloud(Operator): # Do the same to the 1. object since it is no longer in list. firstObject["CloudMember"] = "DefinitionObj" firstObject.name = "DefinitionObj" - firstObject.draw_type = 'WIRE' + firstObject.display_type = 'WIRE' firstObject.hide_render = True makeParent(bounds, firstObject, scene) @@ -646,7 +646,7 @@ class GenerateCloud(Operator): # Create a new object cloud. cloud = addNewObject(scene, "CloudMesh", bounds) cloud["CloudMember"] = "CreatedObj" - cloud.draw_type = 'WIRE' + cloud.display_type = 'WIRE' cloud.hide_render = True makeParent(bounds, cloud, scene) @@ -677,7 +677,7 @@ class GenerateCloud(Operator): cloudParticles.settings.frame_end = 0 cloudParticles.settings.emit_from = 'VOLUME' cloudParticles.settings.lifetime = scene.frame_end - cloudParticles.settings.draw_method = 'DOT' + cloudParticles.settings.display_method = 'DOT' cloudParticles.settings.render_type = 'NONE' cloudParticles.settings.distribution = 'RAND' cloudParticles.settings.physics_type = 'NEWTON' @@ -836,7 +836,7 @@ class GenerateCloud(Operator): # Create a new object cloudPnts cloudPnts = addNewObject(scene, "CloudPoints", bounds) cloudPnts["CloudMember"] = "CreatedObj" - cloudPnts.draw_type = 'WIRE' + cloudPnts.display_type = 'WIRE' cloudPnts.hide_render = True makeParent(bounds, cloudPnts, scene) diff --git a/object_collections.py b/object_collections.py new file mode 100644 index 00000000..0c9d58b9 --- /dev/null +++ b/object_collections.py @@ -0,0 +1,309 @@ +# ##### 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 ##### + +import bpy +from bpy.types import ( + Operator, + Panel, + Menu, + ) + + +from bpy.props import ( + EnumProperty, + IntProperty, + ) + + +bl_info = { + "name": "Collections", + "author": "Dalai Felinto", + "version": (1, 0), + "blender": (2, 80, 0), + "description": "Panel to set/unset object collections", + "warning": "", + "wiki_url": "", + "tracker_url": "", + "category": "Object"} + + +# ##################################################################################### +# Operators +# ##################################################################################### + +class OBJECT_OT_collection_add(Operator): + """Add an object to a new collection""" + bl_idname = "object.collection_add" + bl_label = "Add to New Collection" + + def execute(self, context): + scene = context.scene + collection = scene.master_collection.collections.new() + collection.objects.link(context.object) + return {'FINISHED'} + + +class OBJECT_OT_collection_remove(Operator): + """Remove the active object from this collection""" + bl_idname = "object.collection_remove" + bl_label = "Remove from Collection" + + def execute(self, context): + collection = context.scene_collection + collection.objects.unlink(context.object) + return {'FINISHED'} + + +def get_collection_from_id_recursive(collection, collection_id, current_id): + """Return len of collection and the collection if it was a match""" + if collection_id == current_id: + return collection, 0 + + current_id += 1 + + for collection_nested in collection.collections: + matched_collection, current_id = get_collection_from_id_recursive( + collection_nested, + collection_id, + current_id) + if matched_collection is not None: + return matched_collection, 0 + + return None, current_id + + +def get_collection_from_id(scene, collection_id): + master_collection = scene.master_collection + return get_collection_from_id_recursive(master_collection, collection_id, 0)[0] + + +def collection_items_recursive(path, collection, items, current_id, object_name): + name = collection.name + current_id += 1 + + if object_name not in collection.objects: + items.append((str(current_id), path + name, "")) + path += name + " / " + + for collection_nested in collection.collections: + current_id = collection_items_recursive(path, collection_nested, items, current_id, object_name) + return current_id + + +def collection_items(self, context): + items = [] + + master_collection = context.scene.master_collection + object_name = context.object.name + + if object_name not in master_collection.objects: + items.append(('0', "Master Collection", "", 'COLLAPSEMENU', 0)) + + current_id = 0 + for collection in master_collection.collections: + current_id = collection_items_recursive("", collection, items, current_id, object_name) + + return items + + +class OBJECT_OT_collection_link(Operator): + """Add an object to an existing collection""" + bl_idname = "object.collection_link" + bl_label = "Link to Collection" + + collection_index = IntProperty( + name = "Collection Index", + default = -1, + options = {'SKIP_SAVE'}, + ) + + type = EnumProperty( + name = "", + description = "Dynamic enum for collections", + items=collection_items, + ) + + def execute(self, context): + if self.collection_index == -1: + self.collection_index = int(self.type) + + collection = get_collection_from_id(context.scene, self.collection_index) + + if collection is None: + # It should never ever happen! + self.report({'ERROR'}, "Unexpected error: collection {0} is invalid".format( + self.collection_index)) + return {'CANCELLED'} + + collection.objects.link(context.object) + return {'FINISHED'} + + def invoke(self, context, events): + if self.collection_index != -1: + return self.execute(context) + + wm = context.window_manager + wm.invoke_search_popup(self) + return {'FINISHED'} + + +def find_collection_parent(collection, collection_parent): + for collection_nested in collection_parent.collections: + if collection_nested == collection: + return collection_parent + + found_collection = find_collection_parent(collection, collection_nested) + if found_collection: + return found_collection + return None + + +class OBJECT_OT_collection_unlink(Operator): + """Unlink the collection from all objects""" + bl_idname = "object.collection_unlink" + bl_label = "Unlink Collection" + + def execute(self, context): + collection = context.scene_collection + master_collection = context.scene.master_collection + + collection_parent = find_collection_parent(collection, master_collection) + if collection_parent is None: + self.report({'ERROR'}, "Cannot find {0}'s parent".format(collection.name)) + return {'CANCELLED'} + + collection_parent.collections.remove(collection) + return {'CANCELLED'} + + +def select_collection_objects(collection): + for ob in collection.objects: + ob.select_set('SELECT') + + for collection_nested in collection.collections: + select_collection_objects(collection_nested) + + +class OBJECT_OT_collection_select(Operator): + """Select all objects in collection""" + bl_idname = "object.collection_select" + bl_label = "Select Collection" + + def execute(self, context): + collection = context.scene_collection + select_collection_objects(collection) + return {'FINISHED'} + + +# ##################################################################################### +# Interface +# ##################################################################################### + +class COLLECTION_MT_specials(Menu): + bl_label = "Collection Specials" + + def draw(self, context): + layout = self.layout + + col = layout.column() + col.active = context.scene_collection != context.scene.master_collection + col.operator("object.collection_unlink", icon='X', text="Unlink Collection") + + layout.operator("object.collection_select", text="Select Collection") + + +def all_collections_get(context): + """Iterator over all scene collections + """ + def all_collections_recursive_get(collection_parent, collections): + collections.append(collection_parent) + for collection_nested in collection_parent.collections: + all_collections_recursive_get(collection_nested, collections) + + scene = context.scene + master_collection = scene.master_collection + + collections = [] + + all_collections_recursive_get(master_collection, collections) + + return collections + + +class OBJECT_PT_collections(Panel): + bl_space_type = 'PROPERTIES' + bl_region_type = 'WINDOW' + bl_context = "object" + bl_label = "Collections" + + def draw(self, context): + layout = self.layout + row = layout.row(align=True) + + obj = context.object + master_collection = bpy.context.scene.master_collection + + if master_collection.collections: + row.operator("object.collection_link", text="Add to Collection") + else: + row.operator("object.collection_link", text="Add to Collection").collection_index = 0 + row.operator("object.collection_add", text="", icon='ZOOMIN') + + obj_name = obj.name + for collection in all_collections_get(context): + collection_objects = collection.objects + if obj_name in collection.objects: + col = layout.column(align=True) + col.context_pointer_set("scene_collection", collection) + + row = col.box().row() + if collection == master_collection: + row.label(text=collection.name) + else: + row.prop(collection, "name", text="") + row.operator("object.collection_remove", text="", icon='X', emboss=False) + row.menu("COLLECTION_MT_specials", icon='DOWNARROW_HLT', text="") + + +# ##################################################################################### +# Register/Unregister +# ##################################################################################### + +classes = ( + COLLECTION_MT_specials, + OBJECT_PT_collections, + OBJECT_OT_collection_add, + OBJECT_OT_collection_remove, + OBJECT_OT_collection_link, + OBJECT_OT_collection_unlink, + OBJECT_OT_collection_select, +) + + +def register(): + for cls in classes: + bpy.utils.register_class(cls) + + +def unregister(): + for cls in classes: + bpy.utils.unregister_class(cls) + + +if __name__ == "__main__": + register() diff --git a/object_fracture/__init__.py b/object_fracture/__init__.py index 0ac9f403..5dad8801 100644 --- a/object_fracture/__init__.py +++ b/object_fracture/__init__.py @@ -40,8 +40,8 @@ else: import bpy -class INFO_MT_add_fracture_objects(bpy.types.Menu): - bl_idname = "INFO_MT_add_fracture_objects" +class VIEW3D_MT_add_fracture_objects(bpy.types.Menu): + bl_idname = "VIEW3D_MT_add_fracture_objects" bl_label = "Fracture Helper Objects" def draw(self, context): @@ -57,21 +57,21 @@ class INFO_MT_add_fracture_objects(bpy.types.Menu): def menu_func(self, context): - self.layout.menu("INFO_MT_add_fracture_objects") + self.layout.menu("VIEW3D_MT_add_fracture_objects") def register(): bpy.utils.register_module(__name__) # Add the "add fracture objects" menu to the "Add" menu - bpy.types.INFO_MT_add.append(menu_func) + bpy.types.VIEW3D_MT_add.append(menu_func) def unregister(): bpy.utils.unregister_module(__name__) # Remove "add fracture objects" menu from the "Add" menu. - bpy.types.INFO_MT_add.remove(menu_func) + bpy.types.VIEW3D_MT_add.remove(menu_func) if __name__ == "__main__": diff --git a/object_fracture_cell/__init__.py b/object_fracture_cell/__init__.py index ad4cdf39..891027f2 100644 --- a/object_fracture_cell/__init__.py +++ b/object_fracture_cell/__init__.py @@ -75,8 +75,8 @@ def main_object(scene, obj, level, **kw): obj.select = False if kw_copy["use_debug_redraw"]: - obj_draw_type_prev = obj.draw_type - obj.draw_type = 'WIRE' + obj_display_type_prev = obj.display_type + obj.display_type = 'WIRE' objects = fracture_cell_setup.cell_fracture_objects(scene, obj, **kw_copy) objects = fracture_cell_setup.cell_fracture_boolean(scene, obj, objects, @@ -172,7 +172,7 @@ def main_object(scene, obj, level, **kw): group.objects.link(obj_cell) if kw_copy["use_debug_redraw"]: - obj.draw_type = obj_draw_type_prev + obj.display_type = obj_display_type_prev # testing only! # obj.hide = True diff --git a/object_grease_scatter.py b/object_grease_scatter.py index 105b40ea..df1c7cce 100644 --- a/object_grease_scatter.py +++ b/object_grease_scatter.py @@ -390,12 +390,12 @@ def menu_func(self, context): def register(): bpy.utils.register_class(Scatter) - bpy.types.INFO_MT_mesh_add.append(menu_func) + bpy.types.VIEW3D_MT_mesh_add.append(menu_func) def unregister(): bpy.utils.unregister_class(Scatter) - bpy.types.INFO_MT_mesh_add.remove(menu_func) + bpy.types.VIEW3D_MT_mesh_add.remove(menu_func) #if __name__ == "__main__": # _main() diff --git a/pie_menus_official/__init__.py b/pie_menus_official/__init__.py index 513ae2b3..52c8d346 100644 --- a/pie_menus_official/__init__.py +++ b/pie_menus_official/__init__.py @@ -31,7 +31,7 @@ bl_info = { "name": "UI Pie Menu Official", "author": "Antony Riakiotakis, Sebastian Koenig", "version": (1, 1, 5), - "blender": (2, 7, 7), + "blender": (2, 80, 0), "description": "Individual Pie Menu Activation List", "location": "Addons Preferences", "warning": "", @@ -129,42 +129,42 @@ class UIToolsPreferences(AddonPreferences): op = sub.operator('wm.context_toggle', text='', icon=icon, emboss=False) op.data_path = 'addon_prefs.show_expanded_' + mod_name - sub.label('{}: {}'.format(info['category'], info['name'])) + sub.label(text='{}: {}'.format(info['category'], info['name'])) sub = row.row() sub.alignment = 'RIGHT' if info.get('warning'): - sub.label('', icon='ERROR') + sub.label(text='', icon='ERROR') sub.prop(self, 'use_' + mod_name, text='') # The second stage if expand: if info.get('description'): - split = col.row().split(percentage=0.15) - split.label('Description:') - split.label(info['description']) + split = col.row().split(factor=0.15) + split.label(text='Description:') + split.label(text=info['description']) if info.get('location'): - split = col.row().split(percentage=0.15) - split.label('Location:') - split.label(info['location']) + split = col.row().split(factor=0.15) + split.label(text='Location:') + split.label(text=info['location']) """ if info.get('author'): - split = col.row().split(percentage=0.15) - split.label('Author:') - split.label(info['author']) + split = col.row().split(factor=0.15) + split.label(text='Author:') + split.label(text=info['author']) """ if info.get('version'): - split = col.row().split(percentage=0.15) - split.label('Version:') - split.label('.'.join(str(x) for x in info['version']), + split = col.row().split(factor=0.15) + split.label(text='Version:') + split.label(text='.'.join(str(x) for x in info['version']), translate=False) if info.get('warning'): - split = col.row().split(percentage=0.15) - split.label('Warning:') - split.label(' ' + info['warning'], icon='ERROR') + split = col.row().split(factor=0.15) + split.label(text='Warning:') + split.label(text=' ' + info['warning'], icon='ERROR') tot_row = int(bool(info.get('wiki_url'))) if tot_row: - split = col.row().split(percentage=0.15) + split = col.row().split(factor=0.15) split.label(text='Internet:') if info.get('wiki_url'): op = split.operator('wm.url_open', diff --git a/pie_menus_official/pie_manipulator_of.py b/pie_menus_official/pie_manipulator_of.py index 04ced83a..eb475cf7 100644 --- a/pie_menus_official/pie_manipulator_of.py +++ b/pie_menus_official/pie_manipulator_of.py @@ -26,7 +26,7 @@ class VIEW3D_manipulator_set_of(Operator): bl_label = "Set Manipulator" bl_idname = "view3d.manipulator_set" - type = EnumProperty( + type: EnumProperty( name="Type", items=(('TRANSLATE', "Translate", "Use the manipulator for movement transformations"), ('ROTATE', "Rotate", "Use the manipulator for rotation transformations"), @@ -36,7 +36,7 @@ class VIEW3D_manipulator_set_of(Operator): def execute(self, context): # show manipulator if user selects an option - context.space_data.show_manipulator = True + context.space_data.show_gizmo = True context.space_data.transform_manipulators = {self.type} return {'FINISHED'} @@ -50,10 +50,10 @@ class VIEW3D_PIE_manipulator_of(Menu): layout = self.layout pie = layout.menu_pie() - pie.operator("view3d.manipulator_set", icon='MAN_TRANS', text="Translate").type = 'TRANSLATE' - pie.operator("view3d.manipulator_set", icon='MAN_ROT', text="Rotate").type = 'ROTATE' - pie.operator("view3d.manipulator_set", icon='MAN_SCALE', text="Scale").type = 'SCALE' - pie.prop(context.space_data, "show_manipulator") + pie.operator("wm.tool_set_by_name", icon='MAN_TRANS', text="Translate").name = "Move" + pie.operator("wm.tool_set_by_name", icon='MAN_ROT', text="Rotate").name = "Rotate" + pie.operator("wm.tool_set_by_name", icon='MAN_SCALE', text="Scale").name = "Scale" + pie.prop(context.space_data, "show_gizmo") classes = ( diff --git a/pie_menus_official/pie_view_of.py b/pie_menus_official/pie_view_of.py index 65a2e262..30b85d8d 100644 --- a/pie_menus_official/pie_view_of.py +++ b/pie_menus_official/pie_view_of.py @@ -38,7 +38,7 @@ class VIEW3D_PIE_view_of(Menu): layout = self.layout pie = layout.menu_pie() - pie.operator_enum("VIEW3D_OT_viewnumpad", "type") + pie.operator_enum("VIEW3D_OT_view_axis", "type") pie.operator("wm.call_menu_pie", text="More", icon='PLUS').name = "VIEW3D_PIE_view_more_of" diff --git a/render_povray/__init__.py b/render_povray/__init__.py index 90d80f13..d55512cb 100644 --- a/render_povray/__init__.py +++ b/render_povray/__init__.py @@ -2274,11 +2274,11 @@ class PovrayPreferences(AddonPreferences): def register(): bpy.utils.register_module(__name__) - bpy.types.INFO_MT_add.prepend(ui.menu_func_add) - bpy.types.INFO_MT_file_import.append(ui.menu_func_import) + bpy.types.VIEW3D_MT_add.prepend(ui.menu_func_add) + bpy.types.TOPBAR_MT_file_import.append(ui.menu_func_import) bpy.types.TEXT_MT_templates.append(ui.menu_func_templates) bpy.types.RENDER_PT_povray_radiosity.prepend(ui.rad_panel_func) - bpy.types.LAMP_PT_POV_lamp.prepend(ui.lamp_panel_func) + bpy.types.LIGHT_PT_POV_light.prepend(ui.light_panel_func) bpy.types.WORLD_PT_world.prepend(ui.world_panel_func) # was used for parametric objects but made the other addon unreachable on # unregister for other tools to use created a user action call instead @@ -2312,11 +2312,11 @@ def unregister(): #bpy.types.TEXTURE_PT_context_texture.remove(TEXTURE_PT_povray_type) #addon_utils.disable("add_mesh_extra_objects", default_set=False) bpy.types.WORLD_PT_world.remove(ui.world_panel_func) - bpy.types.LAMP_PT_POV_lamp.remove(ui.lamp_panel_func) + bpy.types.LIGHT_PT_POV_light.remove(ui.light_panel_func) bpy.types.RENDER_PT_povray_radiosity.remove(ui.rad_panel_func) bpy.types.TEXT_MT_templates.remove(ui.menu_func_templates) - bpy.types.INFO_MT_file_import.remove(ui.menu_func_import) - bpy.types.INFO_MT_add.remove(ui.menu_func_add) + bpy.types.TOPBAR_MT_file_import.remove(ui.menu_func_import) + bpy.types.VIEW3D_MT_add.remove(ui.menu_func_add) bpy.utils.unregister_module(__name__) diff --git a/render_povray/nodes.py b/render_povray/nodes.py index ef185473..769961b6 100644 --- a/render_povray/nodes.py +++ b/render_povray/nodes.py @@ -52,7 +52,7 @@ class ObjectNodeTree(bpy.types.NodeTree): @classmethod def get_from_context(cls, context): ob = context.active_object - if ob and ob.type not in {'LAMP'}: + if ob and ob.type not in {'LIGHT'}: ma = ob.active_material if ma is not None: nt_name = ma.node_tree diff --git a/render_povray/primitives.py b/render_povray/primitives.py index 29734ae7..6059ccb1 100644 --- a/render_povray/primitives.py +++ b/render_povray/primitives.py @@ -1052,7 +1052,7 @@ class POVRAY_OT_rainbow_add(bpy.types.Operator): def execute(self,context): cam = context.scene.camera - bpy.ops.object.lamp_add(type='SPOT', radius=1) + bpy.ops.object.light_add(type='SPOT', radius=1) ob = context.object ob.data.show_cone = False ob.data.spot_blend = 0.5 diff --git a/render_povray/render.py b/render_povray/render.py index 9838f25d..8494bfd5 100644 --- a/render_povray/render.py +++ b/render_povray/render.py @@ -2067,7 +2067,7 @@ def write_pov(filename, scene=None, info_callback=None): # XXX I moved all those checks here, as there is no need to compute names # for object we won't export here! - if (ob.type in {'LAMP', 'CAMERA', #'EMPTY', #empties can bear dupligroups + if (ob.type in {'LIGHT', 'CAMERA', #'EMPTY', #empties can bear dupligroups 'META', 'ARMATURE', 'LATTICE'}): continue smokeFlag=False @@ -2111,7 +2111,7 @@ def write_pov(filename, scene=None, info_callback=None): strandShape = 0.0 # Set the number of particles to render count rather than 3d view display pSys.set_resolution(scene, ob, 'RENDER') - steps = pSys.settings.draw_step + steps = pSys.settings.display_step steps = 3 ** steps # or (power of 2 rather than 3) + 1 # Formerly : len(particle.hair_keys) totalNumberOfHairs = ( len(pSys.particles) + len(pSys.child_particles) ) @@ -2163,7 +2163,7 @@ def write_pov(filename, scene=None, info_callback=None): elif step == 0: hDiameter = strandStart else: - hDiameter += (strandEnd-strandStart)/(pSys.settings.draw_step+1) #XXX +1 or not? + hDiameter += (strandEnd-strandStart)/(pSys.settings.display_step+1) #XXX +1 or not? if step == 0 and pSys.settings.use_hair_bspline: # Write three times the first point to compensate pov Bezier handling file.write('<%.6g,%.6g,%.6g>,%.7g,\n' % (co[0], co[1], co[2], abs(hDiameter))) @@ -3666,11 +3666,11 @@ def write_pov(filename, scene=None, info_callback=None): csg = True sel = renderable_objects(scene) - exportLamps([L for L in sel if (L.type == 'LAMP' and L.pov.object_as != 'RAINBOW')]) + exportLamps([L for L in sel if (L.type == 'LIGHT' and L.pov.object_as != 'RAINBOW')]) if comments: file.write("\n//--Rainbows--\n\n") - exportRainbows([L for L in sel if (L.type == 'LAMP' and L.pov.object_as == 'RAINBOW')]) + exportRainbows([L for L in sel if (L.type == 'LIGHT' and L.pov.object_as == 'RAINBOW')]) if comments: @@ -4468,4 +4468,4 @@ class RunPovTextRender(Operator): #empty text name property engain scene.pov.text_block = "" - return {'FINISHED'}
\ No newline at end of file + return {'FINISHED'} diff --git a/render_povray/ui.py b/render_povray/ui.py index 58c69398..750dcf1a 100644 --- a/render_povray/ui.py +++ b/render_povray/ui.py @@ -214,15 +214,12 @@ del properties_data_modifier from bl_ui import properties_material for member in dir(properties_material): subclass = getattr(properties_material, member) - if subclass not in (properties_material.MATERIAL_PT_transp_game, - properties_material.MATERIAL_PT_game_settings, - properties_material.MATERIAL_PT_physics): - try: - #mat=context.material - #if mat and mat.type == "SURFACE" and (engine in cls.COMPAT_ENGINES) and not (mat.pov.material_use_nodes or mat.use_nodes): - subclass.COMPAT_ENGINES.add('POVRAY_RENDER') - except: - pass + try: + #mat=context.material + #if mat and mat.type == "SURFACE" and (engine in cls.COMPAT_ENGINES) and not (mat.pov.material_use_nodes or mat.use_nodes): + subclass.COMPAT_ENGINES.add('POVRAY_RENDER') + except: + pass del properties_material @@ -294,7 +291,7 @@ class RenderButtonsPanel(): @classmethod def poll(cls, context): rd = context.scene.render - return (rd.use_game_engine is False) and (rd.engine in cls.COMPAT_ENGINES) + return (rd.engine in cls.COMPAT_ENGINES) class ModifierButtonsPanel(): bl_space_type = 'PROPERTIES' @@ -306,7 +303,7 @@ class ModifierButtonsPanel(): def poll(cls, context): mods = context.object.modifiers rd = context.scene.render - return mods and (rd.use_game_engine is False) and (rd.engine in cls.COMPAT_ENGINES) + return mods and (rd.engine in cls.COMPAT_ENGINES) class MaterialButtonsPanel(): bl_space_type = 'PROPERTIES' @@ -318,7 +315,7 @@ class MaterialButtonsPanel(): def poll(cls, context): mat = context.material rd = context.scene.render - return mat and (rd.use_game_engine is False) and (rd.engine in cls.COMPAT_ENGINES) + return mat (rd.engine in cls.COMPAT_ENGINES) class TextureButtonsPanel(): @@ -331,7 +328,7 @@ class TextureButtonsPanel(): def poll(cls, context): tex = context.texture rd = context.scene.render - return tex and (rd.use_game_engine is False) and (rd.engine in cls.COMPAT_ENGINES) + return tex and (rd.engine in cls.COMPAT_ENGINES) # class TextureTypePanel(TextureButtonsPanel): @@ -352,7 +349,7 @@ class ObjectButtonsPanel(): def poll(cls, context): obj = context.object rd = context.scene.render - return obj and (rd.use_game_engine is False) and (rd.engine in cls.COMPAT_ENGINES) + return obj and (rd.engine in cls.COMPAT_ENGINES) class CameraDataButtonsPanel(): bl_space_type = 'PROPERTIES' @@ -364,7 +361,7 @@ class CameraDataButtonsPanel(): def poll(cls, context): cam = context.camera rd = context.scene.render - return cam and (rd.use_game_engine is False) and (rd.engine in cls.COMPAT_ENGINES) + return cam and (rd.engine in cls.COMPAT_ENGINES) class WorldButtonsPanel(): bl_space_type = 'PROPERTIES' @@ -376,7 +373,7 @@ class WorldButtonsPanel(): def poll(cls, context): wld = context.world rd = context.scene.render - return wld and (rd.use_game_engine is False) and (rd.engine in cls.COMPAT_ENGINES) + return wld and (rd.engine in cls.COMPAT_ENGINES) class TextButtonsPanel(): bl_space_type = 'TEXT_EDITOR' @@ -388,7 +385,7 @@ class TextButtonsPanel(): def poll(cls, context): text = context.space_data rd = context.scene.render - return text and (rd.use_game_engine is False) and (rd.engine in cls.COMPAT_ENGINES) + return text and (rd.engine in cls.COMPAT_ENGINES) from bl_ui import properties_data_mesh # These panels are kept @@ -464,25 +461,25 @@ del properties_data_mesh ################################################################################ -# from bl_ui import properties_data_lamp -# for member in dir(properties_data_lamp): - # subclass = getattr(properties_data_lamp, member) +# from bl_ui import properties_data_light +# for member in dir(properties_data_light): + # subclass = getattr(properties_data_light, member) # try: # subclass.COMPAT_ENGINES.add('POVRAY_RENDER') # except: # pass -# del properties_data_lamp -#########################LAMPS################################ +# del properties_data_light +#########################LIGHTS################################ -from bl_ui import properties_data_lamp +from bl_ui import properties_data_light # These panels are kept -properties_data_lamp.DATA_PT_custom_props_lamp.COMPAT_ENGINES.add('POVRAY_RENDER') -properties_data_lamp.DATA_PT_context_lamp.COMPAT_ENGINES.add('POVRAY_RENDER') +properties_data_light.DATA_PT_custom_props_light.COMPAT_ENGINES.add('POVRAY_RENDER') +properties_data_light.DATA_PT_context_light.COMPAT_ENGINES.add('POVRAY_RENDER') ## make some native panels contextual to some object variable ## by recreating custom panels inheriting their properties -class PovLampButtonsPanel(properties_data_lamp.DataButtonsPanel): +class PovLampButtonsPanel(properties_data_light.DataButtonsPanel): COMPAT_ENGINES = {'POVRAY_RENDER'} POV_OBJECT_TYPES = {'RAINBOW'} @@ -499,17 +496,17 @@ class PovLampButtonsPanel(properties_data_lamp.DataButtonsPanel): # Complex py/bpy/rna interactions (with metaclass and all) simply do not allow it to work. # So we simply have to explicitly copy here the interesting bits. ;) -class LAMP_PT_POV_preview(PovLampButtonsPanel, bpy.types.Panel): - bl_label = properties_data_lamp.DATA_PT_preview.bl_label +class LIGHT_PT_POV_preview(PovLampButtonsPanel, bpy.types.Panel): + bl_label = properties_data_light.DATA_PT_preview.bl_label - draw = properties_data_lamp.DATA_PT_preview.draw + draw = properties_data_light.DATA_PT_preview.draw -class LAMP_PT_POV_lamp(PovLampButtonsPanel, bpy.types.Panel): - bl_label = properties_data_lamp.DATA_PT_lamp.bl_label +class LIGHT_PT_POV_light(PovLampButtonsPanel, bpy.types.Panel): + bl_label = properties_data_light.DATA_PT_light.bl_label - draw = properties_data_lamp.DATA_PT_lamp.draw + draw = properties_data_light.DATA_PT_light.draw -class POV_LAMP_MT_presets(bpy.types.Menu): +class POV_LIGHT_MT_presets(bpy.types.Menu): bl_label = "Lamp Presets" preset_subdir = "pov/lamp" preset_operator = "script.execute_preset" @@ -518,19 +515,19 @@ class POV_LAMP_MT_presets(bpy.types.Menu): class AddPresetLamp(AddPresetBase, bpy.types.Operator): '''Add a Lamp Preset''' - bl_idname = "object.lamp_preset_add" + bl_idname = "object.light_preset_add" bl_label = "Add Lamp Preset" - preset_menu = "POV_LAMP_MT_presets" + preset_menu = "POV_LIGHT_MT_presets" # variable used for all preset values preset_defines = [ - "lampdata = bpy.context.object.data" + "lightdata = bpy.context.object.data" ] # properties to store in the preset preset_values = [ - "lampdata.type", - "lampdata.color", + "lightdata.type", + "lightdata.color", ] # where to store the preset @@ -541,68 +538,68 @@ class AddPresetLamp(AddPresetBase, bpy.types.Operator): # Draw into an existing panel -def lamp_panel_func(self, context): +def light_panel_func(self, context): layout = self.layout row = layout.row(align=True) - row.menu(POV_LAMP_MT_presets.__name__, text=POV_LAMP_MT_presets.bl_label) + row.menu(POV_LIGHT_MT_presets.__name__, text=POV_LIGHT_MT_presets.bl_label) row.operator(AddPresetLamp.bl_idname, text="", icon='ZOOMIN') row.operator(AddPresetLamp.bl_idname, text="", icon='ZOOMOUT').remove_active = True classes = ( - POV_LAMP_MT_presets, + POV_LIGHT_MT_presets, AddPresetLamp, ) -class LAMP_PT_POV_sunsky(PovLampButtonsPanel, bpy.types.Panel): - bl_label = properties_data_lamp.DATA_PT_sunsky.bl_label +class LIGHT_PT_POV_sunsky(PovLampButtonsPanel, bpy.types.Panel): + bl_label = properties_data_light.DATA_PT_sunsky.bl_label @classmethod def poll(cls, context): - lamp = context.lamp + lamp = context.light engine = context.scene.render.engine return (lamp and lamp.type == 'SUN') and (engine in cls.COMPAT_ENGINES) - draw = properties_data_lamp.DATA_PT_sunsky.draw + draw = properties_data_light.DATA_PT_sunsky.draw -class LAMP_PT_POV_shadow(PovLampButtonsPanel, bpy.types.Panel): - bl_label = properties_data_lamp.DATA_PT_shadow.bl_label +class LIGHT_PT_POV_shadow(PovLampButtonsPanel, bpy.types.Panel): + bl_label = properties_data_light.DATA_PT_shadow.bl_label - draw = properties_data_lamp.DATA_PT_shadow.draw + draw = properties_data_light.DATA_PT_shadow.draw -class LAMP_PT_POV_area(PovLampButtonsPanel, bpy.types.Panel): - bl_label = properties_data_lamp.DATA_PT_area.bl_label +class LIGHT_PT_POV_area(PovLampButtonsPanel, bpy.types.Panel): + bl_label = properties_data_light.DATA_PT_area.bl_label @classmethod def poll(cls, context): - lamp = context.lamp + lamp = context.light engine = context.scene.render.engine return (lamp and lamp.type == 'AREA') and (engine in cls.COMPAT_ENGINES) - draw = properties_data_lamp.DATA_PT_area.draw + draw = properties_data_light.DATA_PT_area.draw -class LAMP_PT_POV_spot(PovLampButtonsPanel, bpy.types.Panel): - bl_label = properties_data_lamp.DATA_PT_spot.bl_label +class LIGHT_PT_POV_spot(PovLampButtonsPanel, bpy.types.Panel): + bl_label = properties_data_light.DATA_PT_spot.bl_label @classmethod def poll(cls, context): - lamp = context.lamp + lamp = context.light engine = context.scene.render.engine return (lamp and lamp.type == 'SPOT') and (engine in cls.COMPAT_ENGINES) - draw = properties_data_lamp.DATA_PT_spot.draw + draw = properties_data_light.DATA_PT_spot.draw -class LAMP_PT_POV_falloff_curve(PovLampButtonsPanel, bpy.types.Panel): - bl_label = properties_data_lamp.DATA_PT_falloff_curve.bl_label - bl_options = properties_data_lamp.DATA_PT_falloff_curve.bl_options +class LIGHT_PT_POV_falloff_curve(PovLampButtonsPanel, bpy.types.Panel): + bl_label = properties_data_light.DATA_PT_falloff_curve.bl_label + bl_options = properties_data_light.DATA_PT_falloff_curve.bl_options @classmethod def poll(cls, context): - lamp = context.lamp + lamp = context.light engine = context.scene.render.engine return (lamp and lamp.type in {'POINT', 'SPOT'} and lamp.falloff_type == 'CUSTOM_CURVE') and (engine in cls.COMPAT_ENGINES) - draw = properties_data_lamp.DATA_PT_falloff_curve.draw + draw = properties_data_light.DATA_PT_falloff_curve.draw class OBJECT_PT_povray_obj_rainbow(PovLampButtonsPanel, bpy.types.Panel): bl_label = "POV-Ray Rainbow" @@ -644,7 +641,7 @@ class OBJECT_PT_povray_obj_rainbow(PovLampButtonsPanel, bpy.types.Panel): col.prop(obj.pov, "arc_angle") col.prop(obj.pov, "falloff_angle") -del properties_data_lamp +del properties_data_light ############################################################################### class RENDER_PT_povray_export_settings(RenderButtonsPanel, bpy.types.Panel): diff --git a/rigify/__init__.py b/rigify/__init__.py index fa93533b..f0a332f8 100644 --- a/rigify/__init__.py +++ b/rigify/__init__.py @@ -22,7 +22,7 @@ bl_info = { "name": "Rigify", "version": (0, 5), "author": "Nathan Vegdahl, Lucio Rossi, Ivan Cappiello", - "blender": (2, 78, 0), + "blender": (2, 79, 0), "description": "Automatic rigging from building-block components", "location": "Armature properties, Bone properties, View3d tools panel, Armature Add menu", "wiki_url": "http://wiki.blender.org/index.php/Extensions:2.5/Py/" @@ -44,7 +44,15 @@ import bpy import sys import os from bpy.types import AddonPreferences -from bpy.props import BoolProperty +from bpy.props import ( + BoolProperty, + IntProperty, + EnumProperty, + StringProperty, + FloatVectorProperty, + PointerProperty, + CollectionProperty, +) class RigifyPreferences(AddonPreferences): @@ -118,14 +126,13 @@ class RigifyPreferences(AddonPreferences): register() - legacy_mode = BoolProperty( + legacy_mode: BoolProperty( name='Rigify Legacy Mode', description='Select if you want to use Rigify in legacy mode', default=False, update=update_legacy ) - - show_expanded = BoolProperty() + show_expanded: BoolProperty() def draw(self, context): layout = self.layout @@ -158,56 +165,56 @@ class RigifyPreferences(AddonPreferences): class RigifyName(bpy.types.PropertyGroup): - name = bpy.props.StringProperty() + name: StringProperty() class RigifyColorSet(bpy.types.PropertyGroup): - name = bpy.props.StringProperty(name="Color Set", default=" ") - active = bpy.props.FloatVectorProperty( - name="object_color", - subtype='COLOR', - default=(1.0, 1.0, 1.0), - min=0.0, max=1.0, - description="color picker" - ) - normal = bpy.props.FloatVectorProperty( - name="object_color", - subtype='COLOR', - default=(1.0, 1.0, 1.0), - min=0.0, max=1.0, - description="color picker" - ) - select = bpy.props.FloatVectorProperty( - name="object_color", - subtype='COLOR', - default=(1.0, 1.0, 1.0), - min=0.0, max=1.0, - description="color picker" - ) - standard_colors_lock = bpy.props.BoolProperty(default=True) + name: StringProperty(name="Color Set", default=" ") + active: FloatVectorProperty( + name="object_color", + subtype='COLOR', + default=(1.0, 1.0, 1.0), + min=0.0, max=1.0, + description="color picker" + ) + normal: FloatVectorProperty( + name="object_color", + subtype='COLOR', + default=(1.0, 1.0, 1.0), + min=0.0, max=1.0, + description="color picker" + ) + select: FloatVectorProperty( + name="object_color", + subtype='COLOR', + default=(1.0, 1.0, 1.0), + min=0.0, max=1.0, + description="color picker" + ) + standard_colors_lock: BoolProperty(default=True) class RigifySelectionColors(bpy.types.PropertyGroup): - select = bpy.props.FloatVectorProperty( - name="object_color", - subtype='COLOR', - default=(0.314, 0.784, 1.0), - min=0.0, max=1.0, - description="color picker" - ) + select: FloatVectorProperty( + name="object_color", + subtype='COLOR', + default=(0.314, 0.784, 1.0), + min=0.0, max=1.0, + description="color picker" + ) - active = bpy.props.FloatVectorProperty( - name="object_color", - subtype='COLOR', - default=(0.549, 1.0, 1.0), - min=0.0, max=1.0, - description="color picker" - ) + active: FloatVectorProperty( + name="object_color", + subtype='COLOR', + default=(0.549, 1.0, 1.0), + min=0.0, max=1.0, + description="color picker" + ) class RigifyParameters(bpy.types.PropertyGroup): - name = bpy.props.StringProperty() + name: StringProperty() class RigifyArmatureLayer(bpy.types.PropertyGroup): @@ -225,104 +232,123 @@ class RigifyArmatureLayer(bpy.types.PropertyGroup): else: self['group_prop'] = value - name = bpy.props.StringProperty(name="Layer Name", default=" ") - row = bpy.props.IntProperty(name="Layer Row", default=1, min=1, max=32, description='UI row for this layer') - set = bpy.props.BoolProperty(name="Selection Set", default=False, description='Add Selection Set for this layer') - group = bpy.props.IntProperty(name="Bone Group", default=0, min=0, max=32, - get=get_group, set=set_group, description='Assign Bone Group to this layer') + name: StringProperty(name="Layer Name", default=" ") + row: IntProperty(name="Layer Row", default=1, min=1, max=32, description='UI row for this layer') + selset: BoolProperty(name="Selection Set", default=False, description='Add Selection Set for this layer') + group: IntProperty(name="Bone Group", default=0, min=0, max=32, + get=get_group, set=set_group, description='Assign Bone Group to this layer') + ##### REGISTER ##### +classes = ( + RigifyName, + RigifyParameters, + RigifyColorSet, + RigifySelectionColors, + RigifyArmatureLayer, + RigifyPreferences, +) + + def register(): + from bpy.utils import register_class + + # Sub-modules. ui.register() metarig_menu.register() - bpy.utils.register_class(RigifyName) - bpy.utils.register_class(RigifyParameters) - - bpy.utils.register_class(RigifyColorSet) - bpy.utils.register_class(RigifySelectionColors) - bpy.utils.register_class(RigifyArmatureLayer) - bpy.utils.register_class(RigifyPreferences) - bpy.types.Armature.rigify_layers = bpy.props.CollectionProperty(type=RigifyArmatureLayer) - - bpy.types.PoseBone.rigify_type = bpy.props.StringProperty(name="Rigify Type", description="Rig type for this bone") - bpy.types.PoseBone.rigify_parameters = bpy.props.PointerProperty(type=RigifyParameters) - - bpy.types.Armature.rigify_colors = bpy.props.CollectionProperty(type=RigifyColorSet) - - bpy.types.Armature.rigify_selection_colors = bpy.props.PointerProperty(type=RigifySelectionColors) - - bpy.types.Armature.rigify_colors_index = bpy.props.IntProperty(default=-1) - bpy.types.Armature.rigify_colors_lock = bpy.props.BoolProperty(default=True) - bpy.types.Armature.rigify_theme_to_add = bpy.props.EnumProperty(items=(('THEME01', 'THEME01', ''), - ('THEME02', 'THEME02', ''), - ('THEME03', 'THEME03', ''), - ('THEME04', 'THEME04', ''), - ('THEME05', 'THEME05', ''), - ('THEME06', 'THEME06', ''), - ('THEME07', 'THEME07', ''), - ('THEME08', 'THEME08', ''), - ('THEME09', 'THEME09', ''), - ('THEME10', 'THEME10', ''), - ('THEME11', 'THEME11', ''), - ('THEME12', 'THEME12', ''), - ('THEME13', 'THEME13', ''), - ('THEME14', 'THEME14', ''), - ('THEME15', 'THEME15', ''), - ('THEME16', 'THEME16', ''), - ('THEME17', 'THEME17', ''), - ('THEME18', 'THEME18', ''), - ('THEME19', 'THEME19', ''), - ('THEME20', 'THEME20', '') - ), name='Theme') + # Classes. + for cls in classes: + register_class(cls) + + # Properties. + bpy.types.Armature.rigify_layers = CollectionProperty(type=RigifyArmatureLayer) + + bpy.types.PoseBone.rigify_type = StringProperty(name="Rigify Type", description="Rig type for this bone") + bpy.types.PoseBone.rigify_parameters = PointerProperty(type=RigifyParameters) + + bpy.types.Armature.rigify_colors = CollectionProperty(type=RigifyColorSet) + + bpy.types.Armature.rigify_selection_colors = PointerProperty(type=RigifySelectionColors) + + bpy.types.Armature.rigify_colors_index = IntProperty(default=-1) + bpy.types.Armature.rigify_colors_lock = BoolProperty(default=True) + bpy.types.Armature.rigify_theme_to_add = EnumProperty(items=( + ('THEME01', 'THEME01', ''), + ('THEME02', 'THEME02', ''), + ('THEME03', 'THEME03', ''), + ('THEME04', 'THEME04', ''), + ('THEME05', 'THEME05', ''), + ('THEME06', 'THEME06', ''), + ('THEME07', 'THEME07', ''), + ('THEME08', 'THEME08', ''), + ('THEME09', 'THEME09', ''), + ('THEME10', 'THEME10', ''), + ('THEME11', 'THEME11', ''), + ('THEME12', 'THEME12', ''), + ('THEME13', 'THEME13', ''), + ('THEME14', 'THEME14', ''), + ('THEME15', 'THEME15', ''), + ('THEME16', 'THEME16', ''), + ('THEME17', 'THEME17', ''), + ('THEME18', 'THEME18', ''), + ('THEME19', 'THEME19', ''), + ('THEME20', 'THEME20', '') + ), name='Theme') IDStore = bpy.types.WindowManager - IDStore.rigify_collection = bpy.props.EnumProperty(items=rig_lists.col_enum_list, default="All", - name="Rigify Active Collection", - description="The selected rig collection") + IDStore.rigify_collection = EnumProperty(items=rig_lists.col_enum_list, default="All", + name="Rigify Active Collection", + description="The selected rig collection") - IDStore.rigify_types = bpy.props.CollectionProperty(type=RigifyName) - IDStore.rigify_active_type = bpy.props.IntProperty(name="Rigify Active Type", description="The selected rig type") + IDStore.rigify_types = CollectionProperty(type=RigifyName) + IDStore.rigify_active_type = IntProperty(name="Rigify Active Type", description="The selected rig type") - IDStore.rigify_advanced_generation = bpy.props.BoolProperty(name="Advanced Options", - description="Enables/disables advanced options for Rigify rig generation", - default=False) + IDStore.rigify_advanced_generation = BoolProperty(name="Advanced Options", + description="Enables/disables advanced options for Rigify rig generation", + default=False) def update_mode(self, context): if self.rigify_generate_mode == 'new': self.rigify_force_widget_update = False - IDStore.rigify_generate_mode = bpy.props.EnumProperty(name="Rigify Generate Rig Mode", - description="'Generate Rig' mode. In 'overwrite' mode the features of the target rig will be updated as defined by the metarig. In 'new' mode a new rig will be created as defined by the metarig. Current mode", - update=update_mode, - items=(('overwrite', 'overwrite', ''), - ('new', 'new', ''))) - - IDStore.rigify_force_widget_update = bpy.props.BoolProperty(name="Force Widget Update", - description="Forces Rigify to delete and rebuild all the rig widgets. if unset, only missing widgets will be created", - default=False) - - IDStore.rigify_target_rigs = bpy.props.CollectionProperty(type=RigifyName) - IDStore.rigify_target_rig = bpy.props.StringProperty(name="Rigify Target Rig", - description="Defines which rig to overwrite. If unset, a new one called 'rig' will be created", - default="") - - IDStore.rigify_rig_uis = bpy.props.CollectionProperty(type=RigifyName) - IDStore.rigify_rig_ui = bpy.props.StringProperty(name="Rigify Target Rig UI", - description="Defines the UI to overwrite. It should always be the same as the target rig. If unset, 'rig_ui.py' will be used", - default="") - - IDStore.rigify_rig_basename = bpy.props.StringProperty(name="Rigify Rig Name", - description="Defines the name of the Rig. If unset, in 'new' mode 'rig' will be used, in 'overwrite' mode the target rig name will be used", - default="") - - IDStore.rigify_transfer_only_selected = bpy.props.BoolProperty(name="Transfer Only Selected", description="Transfer selected bones only", default=True) - IDStore.rigify_transfer_start_frame = bpy.props.IntProperty(name="Start Frame", description="First Frame to Transfer", default=0, min= 0) - IDStore.rigify_transfer_end_frame = bpy.props.IntProperty(name="End Frame", description="Last Frame to Transfer", default=0, min= 0) - + IDStore.rigify_generate_mode = EnumProperty(name="Rigify Generate Rig Mode", + description="'Generate Rig' mode. In 'overwrite' mode the features of the target rig will be updated as defined by the metarig. In 'new' mode a new rig will be created as defined by the metarig. Current mode", + update=update_mode, + items=( ('overwrite', 'overwrite', ''), + ('new', 'new', ''))) + + IDStore.rigify_force_widget_update = BoolProperty(name="Force Widget Update", + description="Forces Rigify to delete and rebuild all the rig widgets. if unset, only missing widgets will be created", + default=False) + + IDStore.rigify_target_rigs = CollectionProperty(type=RigifyName) + IDStore.rigify_target_rig = StringProperty(name="Rigify Target Rig", + description="Defines which rig to overwrite. If unset, a new one called 'rig' will be created", + default="") + + IDStore.rigify_rig_uis = CollectionProperty(type=RigifyName) + IDStore.rigify_rig_ui = StringProperty(name="Rigify Target Rig UI", + description="Defines the UI to overwrite. It should always be the same as the target rig. If unset, 'rig_ui.py' will be used", + default="") + + IDStore.rigify_rig_basename = StringProperty(name="Rigify Rig Name", + description="Defines the name of the Rig. If unset, in 'new' mode 'rig' will be used, in 'overwrite' mode the target rig name will be used", + default="") + + IDStore.rigify_transfer_only_selected = BoolProperty( + name="Transfer Only Selected", + description="Transfer selected bones only", default=True) + IDStore.rigify_transfer_start_frame = IntProperty( + name="Start Frame", + description="First Frame to Transfer", default=0, min= 0) + IDStore.rigify_transfer_end_frame = IntProperty( + name="End Frame", + description="Last Frame to Transfer", default=0, min= 0) + + # Update legacy on restart or reload. if (ui and 'legacy' in str(ui)) or bpy.context.user_preferences.addons['rigify'].preferences.legacy_mode: - # update legacy on restart or reload bpy.context.user_preferences.addons['rigify'].preferences.legacy_mode = True # Add rig parameters @@ -335,6 +361,9 @@ def register(): def unregister(): + from bpy.utils import unregister_class + + # Properties. del bpy.types.PoseBone.rigify_type del bpy.types.PoseBone.rigify_parameters @@ -354,14 +383,10 @@ def unregister(): del IDStore.rigify_transfer_start_frame del IDStore.rigify_transfer_end_frame - bpy.utils.unregister_class(RigifyName) - bpy.utils.unregister_class(RigifyParameters) - - bpy.utils.unregister_class(RigifyColorSet) - bpy.utils.unregister_class(RigifySelectionColors) - - bpy.utils.unregister_class(RigifyArmatureLayer) - bpy.utils.unregister_class(RigifyPreferences) + # Classes. + for cls in classes: + unregister_class(cls) + # Sub-modules. metarig_menu.unregister() ui.unregister() diff --git a/rigify/generate.py b/rigify/generate.py index e2492708..0631cce3 100644 --- a/rigify/generate.py +++ b/rigify/generate.py @@ -96,12 +96,12 @@ def generate_rig(context, metarig): rig_old_name = name name = rig_new_name or name obj = bpy.data.objects.new(name, bpy.data.armatures.new(name)) - obj.draw_type = 'WIRE' + obj.display_type = 'WIRE' scene.objects.link(obj) else: name = rig_new_name or "rig" obj = bpy.data.objects.new(name, bpy.data.armatures.new(name)) # in case name 'rig' exists it will be rig.001 - obj.draw_type = 'WIRE' + obj.display_type = 'WIRE' scene.objects.link(obj) id_store.rigify_target_rig = obj.name @@ -553,7 +553,7 @@ def create_selection_sets(obj, metarig): pbones = obj.pose.bones for i, name in enumerate(metarig.data.rigify_layers.keys()): - if name == '' or not metarig.data.rigify_layers[i].set: + if name == '' or not metarig.data.rigify_layers[i].selset: continue bpy.ops.pose.select_all(action='DESELECT') diff --git a/rigify/legacy/__init__.py b/rigify/legacy/__init__.py index 6e6f751c..029d877e 100644 --- a/rigify/legacy/__init__.py +++ b/rigify/legacy/__init__.py @@ -45,16 +45,16 @@ import bpy class RigifyName(bpy.types.PropertyGroup): - name = bpy.props.StringProperty() + name: bpy.props.StringProperty() class RigifyParameters(bpy.types.PropertyGroup): - name = bpy.props.StringProperty() + name: bpy.props.StringProperty() class RigifyArmatureLayer(bpy.types.PropertyGroup): - name = bpy.props.StringProperty(name="Layer Name", default=" ") - row = bpy.props.IntProperty(name="Layer Row", default=1, min=1, max=32) + name: bpy.props.StringProperty(name="Layer Name", default=" ") + row: bpy.props.IntProperty(name="Layer Row", default=1, min=1, max=32) ##### REGISTER ##### diff --git a/rigify/legacy/generate.py b/rigify/legacy/generate.py index 3bc9823b..f1d9c8b0 100644 --- a/rigify/legacy/generate.py +++ b/rigify/legacy/generate.py @@ -88,7 +88,7 @@ def generate_rig(context, metarig): obj = scene.objects[name] except KeyError: obj = bpy.data.objects.new(name, bpy.data.armatures.new(name)) - obj.draw_type = 'WIRE' + obj.display_type = 'WIRE' scene.objects.link(obj) obj.data.pose_position = 'POSE' diff --git a/rigify/legacy/metarig_menu.py b/rigify/legacy/metarig_menu.py index 4bdf2701..c0c20955 100644 --- a/rigify/legacy/metarig_menu.py +++ b/rigify/legacy/metarig_menu.py @@ -114,7 +114,7 @@ def register(): bpy.utils.register_class(mop) for mf in menu_funcs: - bpy.types.INFO_MT_armature_add.append(mf) + bpy.types.VIEW3D_MT_armature_add.append(mf) def unregister(): @@ -122,4 +122,4 @@ def unregister(): bpy.utils.unregister_class(mop) for mf in menu_funcs: - bpy.types.INFO_MT_armature_add.remove(mf) + bpy.types.VIEW3D_MT_armature_add.remove(mf) diff --git a/rigify/legacy/rigs/basic/copy.py b/rigify/legacy/rigs/basic/copy.py index 50a25767..65c5ff31 100644 --- a/rigify/legacy/rigs/basic/copy.py +++ b/rigify/legacy/rigs/basic/copy.py @@ -88,8 +88,8 @@ def add_parameters(params): """ Add the parameters of this rig type to the RigifyParameters PropertyGroup """ - params.make_control = bpy.props.BoolProperty(name="Control", default=True, description="Create a control bone for the copy") - params.make_deform = bpy.props.BoolProperty(name="Deform", default=True, description="Create a deform bone for the copy") + params.make_control: bpy.props.BoolProperty(name="Control", default=True, description="Create a control bone for the copy") + params.make_deform: bpy.props.BoolProperty(name="Deform", default=True, description="Create a deform bone for the copy") def parameters_ui(layout, params): diff --git a/rigify/legacy/rigs/basic/copy_chain.py b/rigify/legacy/rigs/basic/copy_chain.py index 4e426284..25013c0e 100644 --- a/rigify/legacy/rigs/basic/copy_chain.py +++ b/rigify/legacy/rigs/basic/copy_chain.py @@ -127,8 +127,8 @@ def add_parameters(params): """ Add the parameters of this rig type to the RigifyParameters PropertyGroup """ - params.make_controls = bpy.props.BoolProperty(name="Controls", default=True, description="Create control bones for the copy") - params.make_deforms = bpy.props.BoolProperty(name="Deform", default=True, description="Create deform bones for the copy") + params.make_controls: bpy.props.BoolProperty(name="Controls", default=True, description="Create control bones for the copy") + params.make_deforms: bpy.props.BoolProperty(name="Deform", default=True, description="Create deform bones for the copy") def parameters_ui(layout, params): diff --git a/rigify/legacy/rigs/pitchipoy/super_copy.py b/rigify/legacy/rigs/pitchipoy/super_copy.py index 27e88775..5a60ed04 100644 --- a/rigify/legacy/rigs/pitchipoy/super_copy.py +++ b/rigify/legacy/rigs/pitchipoy/super_copy.py @@ -91,7 +91,7 @@ def add_parameters(params): """ Add the parameters of this rig type to the RigifyParameters PropertyGroup """ - params.make_control = bpy.props.BoolProperty( + params.make_control: bpy.props.BoolProperty( name = "Control", default = True, description = "Create a control bone for the copy" diff --git a/rigify/legacy/rigs/pitchipoy/super_face.py b/rigify/legacy/rigs/pitchipoy/super_face.py index 341596a1..79aa5e02 100644 --- a/rigify/legacy/rigs/pitchipoy/super_face.py +++ b/rigify/legacy/rigs/pitchipoy/super_face.py @@ -1016,26 +1016,26 @@ def add_parameters(params): """ #Setting up extra layers for the tweak bones - params.primary_layers_extra = bpy.props.BoolProperty( + params.primary_layers_extra: bpy.props.BoolProperty( name = "primary_layers_extra", default = True, description = "" - ) - params.primary_layers = bpy.props.BoolVectorProperty( + ) + params.primary_layers: bpy.props.BoolVectorProperty( size = 32, description = "Layers for the 1st tweak controls to be on", default = tuple( [ i == 1 for i in range(0, 32) ] ) - ) - params.secondary_layers_extra = bpy.props.BoolProperty( + ) + params.secondary_layers_extra: bpy.props.BoolProperty( name = "secondary_layers_extra", default = True, description = "" - ) - params.secondary_layers = bpy.props.BoolVectorProperty( + ) + params.secondary_layers: bpy.props.BoolVectorProperty( size = 32, description = "Layers for the 2nd tweak controls to be on", default = tuple( [ i == 1 for i in range(0, 32) ] ) - ) + ) def parameters_ui(layout, params): diff --git a/rigify/legacy/ui.py b/rigify/legacy/ui.py index dec5b73c..30018d85 100644 --- a/rigify/legacy/ui.py +++ b/rigify/legacy/ui.py @@ -221,8 +221,8 @@ class VIEW3D_PT_tools_rigify_dev(bpy.types.Panel): r = self.layout.row() r.operator("mesh.rigify_encode_mesh_widget", text="Encode Mesh Widget to Python") -#~ class INFO_MT_armature_metarig_add(bpy.types.Menu): - #~ bl_idname = "INFO_MT_armature_metarig_add" +#~ class VIEW3D_MT_armature_metarig_add(bpy.types.Menu): + #~ bl_idname = "VIEW3D_MT_armature_metarig_add" #~ bl_label = "Meta-Rig" #~ def draw(self, context): @@ -304,11 +304,11 @@ class Sample(bpy.types.Operator): bl_label = "Add a sample metarig for a rig type" bl_options = {'UNDO'} - metarig_type = StringProperty( - name="Type", - description="Name of the rig type to generate a sample of", - maxlen=128, - ) + metarig_type: StringProperty( + name="Type", + description="Name of the rig type to generate a sample of", + maxlen=128, + ) def execute(self, context): if context.mode == 'EDIT_ARMATURE' and self.metarig_type != "": @@ -410,7 +410,7 @@ class EncodeWidget(bpy.types.Operator): return {'FINISHED'} -#menu_func = (lambda self, context: self.layout.menu("INFO_MT_armature_metarig_add", icon='OUTLINER_OB_ARMATURE')) +#menu_func = (lambda self, context: self.layout.menu("VIEW3D_MT_armature_metarig_add", icon='OUTLINER_OB_ARMATURE')) #from bl_ui import space_info # ensure the menu is loaded first @@ -425,7 +425,7 @@ def register(): bpy.utils.register_class(EncodeMetarig) bpy.utils.register_class(EncodeMetarigSample) bpy.utils.register_class(EncodeWidget) - #space_info.INFO_MT_armature_add.append(ui.menu_func) + #space_info.VIEW3D_MT_armature_add.append(ui.menu_func) def unregister(): diff --git a/rigify/metarig_menu.py b/rigify/metarig_menu.py index 6b12abad..c1610553 100644 --- a/rigify/metarig_menu.py +++ b/rigify/metarig_menu.py @@ -159,25 +159,33 @@ for metarig_class in metarig_classes: arm_sub = next((e for e in armature_submenus if e.bl_label == metarig_class + ' (submenu)'), '') arm_sub.operators.append((mop.bl_idname, name,)) + +### Registering ### + + def register(): + from bpy.utils import register_class + for cl in metarig_ops: for mop, name in metarig_ops[cl]: - bpy.utils.register_class(mop) + register_class(mop) for arm_sub in armature_submenus: - bpy.utils.register_class(arm_sub) + register_class(arm_sub) for mf in menu_funcs: - bpy.types.INFO_MT_armature_add.append(mf) + bpy.types.VIEW3D_MT_armature_add.append(mf) def unregister(): + from bpy.utils import unregister_class + for cl in metarig_ops: for mop, name in metarig_ops[cl]: - bpy.utils.unregister_class(mop) + unregister_class(mop) for arm_sub in armature_submenus: - bpy.utils.unregister_class(arm_sub) + unregister_class(arm_sub) for mf in menu_funcs: - bpy.types.INFO_MT_armature_add.remove(mf) + bpy.types.VIEW3D_MT_armature_add.remove(mf) diff --git a/rigify/metarigs/Animals/bird.py b/rigify/metarigs/Animals/bird.py index 15b75a11..f8ecd47d 100644 --- a/rigify/metarigs/Animals/bird.py +++ b/rigify/metarigs/Animals/bird.py @@ -48,119 +48,119 @@ def create(obj): arm.rigify_layers[0].name = "Face" arm.rigify_layers[0].row = 1 - arm.rigify_layers[0].set = False + arm.rigify_layers[0].selset = False arm.rigify_layers[0].group = 6 arm.rigify_layers[1].name = "Face (Tweak)" arm.rigify_layers[1].row = 2 - arm.rigify_layers[1].set = False + arm.rigify_layers[1].selset = False arm.rigify_layers[1].group = 4 arm.rigify_layers[2].name = " " arm.rigify_layers[2].row = 1 - arm.rigify_layers[2].set = False + arm.rigify_layers[2].selset = False arm.rigify_layers[2].group = 0 arm.rigify_layers[3].name = "Spine" arm.rigify_layers[3].row = 3 - arm.rigify_layers[3].set = False + arm.rigify_layers[3].selset = False arm.rigify_layers[3].group = 3 arm.rigify_layers[4].name = "Spine (Tweak)" arm.rigify_layers[4].row = 4 - arm.rigify_layers[4].set = False + arm.rigify_layers[4].selset = False arm.rigify_layers[4].group = 4 arm.rigify_layers[5].name = " " arm.rigify_layers[5].row = 1 - arm.rigify_layers[5].set = False + arm.rigify_layers[5].selset = False arm.rigify_layers[5].group = 0 arm.rigify_layers[6].name = " " arm.rigify_layers[6].row = 1 - arm.rigify_layers[6].set = False + arm.rigify_layers[6].selset = False arm.rigify_layers[6].group = 0 arm.rigify_layers[7].name = "Wing.L" arm.rigify_layers[7].row = 6 - arm.rigify_layers[7].set = False + arm.rigify_layers[7].selset = False arm.rigify_layers[7].group = 5 arm.rigify_layers[8].name = "" arm.rigify_layers[8].row = 8 - arm.rigify_layers[8].set = False + arm.rigify_layers[8].selset = False arm.rigify_layers[8].group = 0 arm.rigify_layers[9].name = "Wing.L (Tweak)" arm.rigify_layers[9].row = 7 - arm.rigify_layers[9].set = False + arm.rigify_layers[9].selset = False arm.rigify_layers[9].group = 4 arm.rigify_layers[10].name = "Wing.R" arm.rigify_layers[10].row = 6 - arm.rigify_layers[10].set = False + arm.rigify_layers[10].selset = False arm.rigify_layers[10].group = 5 arm.rigify_layers[11].name = "" arm.rigify_layers[11].row = 8 - arm.rigify_layers[11].set = False + arm.rigify_layers[11].selset = False arm.rigify_layers[11].group = 0 arm.rigify_layers[12].name = "Wing.R (Tweak)" arm.rigify_layers[12].row = 7 - arm.rigify_layers[12].set = False + arm.rigify_layers[12].selset = False arm.rigify_layers[12].group = 4 arm.rigify_layers[13].name = "Leg.L (IK)" arm.rigify_layers[13].row = 10 - arm.rigify_layers[13].set = False + arm.rigify_layers[13].selset = False arm.rigify_layers[13].group = 2 arm.rigify_layers[14].name = "Leg.L (FK)" arm.rigify_layers[14].row = 11 - arm.rigify_layers[14].set = False + arm.rigify_layers[14].selset = False arm.rigify_layers[14].group = 5 arm.rigify_layers[15].name = "Leg.L (Tweak)" arm.rigify_layers[15].row = 12 - arm.rigify_layers[15].set = False + arm.rigify_layers[15].selset = False arm.rigify_layers[15].group = 4 arm.rigify_layers[16].name = " Leg.R (IK)" arm.rigify_layers[16].row = 10 - arm.rigify_layers[16].set = False + arm.rigify_layers[16].selset = False arm.rigify_layers[16].group = 2 arm.rigify_layers[17].name = " Leg.R (FK)" arm.rigify_layers[17].row = 11 - arm.rigify_layers[17].set = False + arm.rigify_layers[17].selset = False arm.rigify_layers[17].group = 5 arm.rigify_layers[18].name = " Leg.R (Tweak)" arm.rigify_layers[18].row = 12 - arm.rigify_layers[18].set = False + arm.rigify_layers[18].selset = False arm.rigify_layers[18].group = 4 arm.rigify_layers[19].name = " " arm.rigify_layers[19].row = 1 - arm.rigify_layers[19].set = False + arm.rigify_layers[19].selset = False arm.rigify_layers[19].group = 0 arm.rigify_layers[20].name = " " arm.rigify_layers[20].row = 1 - arm.rigify_layers[20].set = False + arm.rigify_layers[20].selset = False arm.rigify_layers[20].group = 0 arm.rigify_layers[21].name = "Claws" arm.rigify_layers[21].row = 13 - arm.rigify_layers[21].set = False + arm.rigify_layers[21].selset = False arm.rigify_layers[21].group = 6 arm.rigify_layers[22].name = "Claws (Tweak)" arm.rigify_layers[22].row = 14 - arm.rigify_layers[22].set = False + arm.rigify_layers[22].selset = False arm.rigify_layers[22].group = 4 arm.rigify_layers[23].name = " " arm.rigify_layers[23].row = 1 - arm.rigify_layers[23].set = False + arm.rigify_layers[23].selset = False arm.rigify_layers[23].group = 0 arm.rigify_layers[24].name = "Feathers" arm.rigify_layers[24].row = 8 - arm.rigify_layers[24].set = False + arm.rigify_layers[24].selset = False arm.rigify_layers[24].group = 6 arm.rigify_layers[25].name = " " arm.rigify_layers[25].row = 1 - arm.rigify_layers[25].set = False + arm.rigify_layers[25].selset = False arm.rigify_layers[25].group = 0 arm.rigify_layers[26].name = " " arm.rigify_layers[26].row = 1 - arm.rigify_layers[26].set = False + arm.rigify_layers[26].selset = False arm.rigify_layers[26].group = 0 arm.rigify_layers[27].name = " " arm.rigify_layers[27].row = 1 - arm.rigify_layers[27].set = False + arm.rigify_layers[27].selset = False arm.rigify_layers[27].group = 0 arm.rigify_layers[28].name = "Root" arm.rigify_layers[28].row = 14 - arm.rigify_layers[28].set = False + arm.rigify_layers[28].selset = False arm.rigify_layers[28].group = 1 bones = {} diff --git a/rigify/metarigs/Animals/cat.py b/rigify/metarigs/Animals/cat.py index 2f9de8c8..206b6f64 100644 --- a/rigify/metarigs/Animals/cat.py +++ b/rigify/metarigs/Animals/cat.py @@ -48,119 +48,119 @@ def create(obj): arm.rigify_layers[0].name = "Face" arm.rigify_layers[0].row = 1 - arm.rigify_layers[0].set = False + arm.rigify_layers[0].selset = False arm.rigify_layers[0].group = 5 arm.rigify_layers[1].name = "Face (Primary)" arm.rigify_layers[1].row = 2 - arm.rigify_layers[1].set = False + arm.rigify_layers[1].selset = False arm.rigify_layers[1].group = 2 arm.rigify_layers[2].name = "Face (Secondary)" arm.rigify_layers[2].row = 2 - arm.rigify_layers[2].set = False + arm.rigify_layers[2].selset = False arm.rigify_layers[2].group = 3 arm.rigify_layers[3].name = "Spine" arm.rigify_layers[3].row = 3 - arm.rigify_layers[3].set = False + arm.rigify_layers[3].selset = False arm.rigify_layers[3].group = 3 arm.rigify_layers[4].name = "Spine (Tweak)" arm.rigify_layers[4].row = 4 - arm.rigify_layers[4].set = False + arm.rigify_layers[4].selset = False arm.rigify_layers[4].group = 4 arm.rigify_layers[5].name = "Paws" arm.rigify_layers[5].row = 5 - arm.rigify_layers[5].set = False + arm.rigify_layers[5].selset = False arm.rigify_layers[5].group = 6 arm.rigify_layers[6].name = "Paws (Tweak)" arm.rigify_layers[6].row = 6 - arm.rigify_layers[6].set = False + arm.rigify_layers[6].selset = False arm.rigify_layers[6].group = 4 arm.rigify_layers[7].name = "Arm.L (IK)" arm.rigify_layers[7].row = 7 - arm.rigify_layers[7].set = False + arm.rigify_layers[7].selset = False arm.rigify_layers[7].group = 2 arm.rigify_layers[8].name = "Arm.L (FK)" arm.rigify_layers[8].row = 8 - arm.rigify_layers[8].set = False + arm.rigify_layers[8].selset = False arm.rigify_layers[8].group = 5 arm.rigify_layers[9].name = "Arm,L (Tweak)" arm.rigify_layers[9].row = 9 - arm.rigify_layers[9].set = False + arm.rigify_layers[9].selset = False arm.rigify_layers[9].group = 4 arm.rigify_layers[10].name = "Arm.R (IK)" arm.rigify_layers[10].row = 7 - arm.rigify_layers[10].set = False + arm.rigify_layers[10].selset = False arm.rigify_layers[10].group = 2 arm.rigify_layers[11].name = "Arm.R (FK)" arm.rigify_layers[11].row = 8 - arm.rigify_layers[11].set = False + arm.rigify_layers[11].selset = False arm.rigify_layers[11].group = 5 arm.rigify_layers[12].name = "Arm.R (Tweak)" arm.rigify_layers[12].row = 9 - arm.rigify_layers[12].set = False + arm.rigify_layers[12].selset = False arm.rigify_layers[12].group = 4 arm.rigify_layers[13].name = "Leg.L (IK)" arm.rigify_layers[13].row = 10 - arm.rigify_layers[13].set = False + arm.rigify_layers[13].selset = False arm.rigify_layers[13].group = 2 arm.rigify_layers[14].name = "Leg.L (FK)" arm.rigify_layers[14].row = 11 - arm.rigify_layers[14].set = False + arm.rigify_layers[14].selset = False arm.rigify_layers[14].group = 5 arm.rigify_layers[15].name = "Leg.L (Tweak)" arm.rigify_layers[15].row = 12 - arm.rigify_layers[15].set = False + arm.rigify_layers[15].selset = False arm.rigify_layers[15].group = 4 arm.rigify_layers[16].name = "Leg.R (IK)" arm.rigify_layers[16].row = 10 - arm.rigify_layers[16].set = False + arm.rigify_layers[16].selset = False arm.rigify_layers[16].group = 2 arm.rigify_layers[17].name = "Leg.R (FK)" arm.rigify_layers[17].row = 11 - arm.rigify_layers[17].set = False + arm.rigify_layers[17].selset = False arm.rigify_layers[17].group = 5 arm.rigify_layers[18].name = "Leg.R (Tweak)" arm.rigify_layers[18].row = 12 - arm.rigify_layers[18].set = False + arm.rigify_layers[18].selset = False arm.rigify_layers[18].group = 4 arm.rigify_layers[19].name = "Tail" arm.rigify_layers[19].row = 13 - arm.rigify_layers[19].set = False + arm.rigify_layers[19].selset = False arm.rigify_layers[19].group = 3 arm.rigify_layers[20].name = "Tail (Tweaks)" arm.rigify_layers[20].row = 14 - arm.rigify_layers[20].set = False + arm.rigify_layers[20].selset = False arm.rigify_layers[20].group = 4 arm.rigify_layers[21].name = " " arm.rigify_layers[21].row = 1 - arm.rigify_layers[21].set = False + arm.rigify_layers[21].selset = False arm.rigify_layers[21].group = 0 arm.rigify_layers[22].name = " " arm.rigify_layers[22].row = 1 - arm.rigify_layers[22].set = False + arm.rigify_layers[22].selset = False arm.rigify_layers[22].group = 0 arm.rigify_layers[23].name = " " arm.rigify_layers[23].row = 1 - arm.rigify_layers[23].set = False + arm.rigify_layers[23].selset = False arm.rigify_layers[23].group = 0 arm.rigify_layers[24].name = " " arm.rigify_layers[24].row = 1 - arm.rigify_layers[24].set = False + arm.rigify_layers[24].selset = False arm.rigify_layers[24].group = 0 arm.rigify_layers[25].name = " " arm.rigify_layers[25].row = 1 - arm.rigify_layers[25].set = False + arm.rigify_layers[25].selset = False arm.rigify_layers[25].group = 0 arm.rigify_layers[26].name = " " arm.rigify_layers[26].row = 1 - arm.rigify_layers[26].set = False + arm.rigify_layers[26].selset = False arm.rigify_layers[26].group = 0 arm.rigify_layers[27].name = " " arm.rigify_layers[27].row = 1 - arm.rigify_layers[27].set = False + arm.rigify_layers[27].selset = False arm.rigify_layers[27].group = 0 arm.rigify_layers[28].name = "Root" arm.rigify_layers[28].row = 16 - arm.rigify_layers[28].set = False + arm.rigify_layers[28].selset = False arm.rigify_layers[28].group = 1 bones = {} diff --git a/rigify/metarigs/Animals/horse.py b/rigify/metarigs/Animals/horse.py index e85be5fd..f7ebc68f 100644 --- a/rigify/metarigs/Animals/horse.py +++ b/rigify/metarigs/Animals/horse.py @@ -48,119 +48,119 @@ def create(obj): arm.rigify_layers[0].name = "Face" arm.rigify_layers[0].row = 1 - arm.rigify_layers[0].set = False + arm.rigify_layers[0].selset = False arm.rigify_layers[0].group = 5 arm.rigify_layers[1].name = "Face (Primary)" arm.rigify_layers[1].row = 2 - arm.rigify_layers[1].set = False + arm.rigify_layers[1].selset = False arm.rigify_layers[1].group = 4 arm.rigify_layers[2].name = " " arm.rigify_layers[2].row = 3 - arm.rigify_layers[2].set = False + arm.rigify_layers[2].selset = False arm.rigify_layers[2].group = 0 arm.rigify_layers[3].name = "Spine" arm.rigify_layers[3].row = 4 - arm.rigify_layers[3].set = False + arm.rigify_layers[3].selset = False arm.rigify_layers[3].group = 3 arm.rigify_layers[4].name = "Spine (Tweak)" arm.rigify_layers[4].row = 5 - arm.rigify_layers[4].set = False + arm.rigify_layers[4].selset = False arm.rigify_layers[4].group = 4 arm.rigify_layers[5].name = " " arm.rigify_layers[5].row = 1 - arm.rigify_layers[5].set = False + arm.rigify_layers[5].selset = False arm.rigify_layers[5].group = 0 arm.rigify_layers[6].name = " " arm.rigify_layers[6].row = 1 - arm.rigify_layers[6].set = False + arm.rigify_layers[6].selset = False arm.rigify_layers[6].group = 0 arm.rigify_layers[7].name = "Arm.L (IK)" arm.rigify_layers[7].row = 7 - arm.rigify_layers[7].set = False + arm.rigify_layers[7].selset = False arm.rigify_layers[7].group = 2 arm.rigify_layers[8].name = "Arm.L (FK)" arm.rigify_layers[8].row = 8 - arm.rigify_layers[8].set = False + arm.rigify_layers[8].selset = False arm.rigify_layers[8].group = 5 arm.rigify_layers[9].name = "Arm.L (Tweak)" arm.rigify_layers[9].row = 9 - arm.rigify_layers[9].set = False + arm.rigify_layers[9].selset = False arm.rigify_layers[9].group = 4 arm.rigify_layers[10].name = "Arm.R (IK)" arm.rigify_layers[10].row = 7 - arm.rigify_layers[10].set = False + arm.rigify_layers[10].selset = False arm.rigify_layers[10].group = 2 arm.rigify_layers[11].name = "Arm.R (FK)" arm.rigify_layers[11].row = 8 - arm.rigify_layers[11].set = False + arm.rigify_layers[11].selset = False arm.rigify_layers[11].group = 5 arm.rigify_layers[12].name = "Arm.R (Tweak)" arm.rigify_layers[12].row = 9 - arm.rigify_layers[12].set = False + arm.rigify_layers[12].selset = False arm.rigify_layers[12].group = 4 arm.rigify_layers[13].name = "Leg.L (IK)" arm.rigify_layers[13].row = 10 - arm.rigify_layers[13].set = False + arm.rigify_layers[13].selset = False arm.rigify_layers[13].group = 2 arm.rigify_layers[14].name = "Leg.L (FK)" arm.rigify_layers[14].row = 11 - arm.rigify_layers[14].set = False + arm.rigify_layers[14].selset = False arm.rigify_layers[14].group = 5 arm.rigify_layers[15].name = "Leg.L (Tweak)" arm.rigify_layers[15].row = 12 - arm.rigify_layers[15].set = False + arm.rigify_layers[15].selset = False arm.rigify_layers[15].group = 4 arm.rigify_layers[16].name = "Leg.R (IK)" arm.rigify_layers[16].row = 10 - arm.rigify_layers[16].set = False + arm.rigify_layers[16].selset = False arm.rigify_layers[16].group = 2 arm.rigify_layers[17].name = "Leg.R (FK)" arm.rigify_layers[17].row = 11 - arm.rigify_layers[17].set = False + arm.rigify_layers[17].selset = False arm.rigify_layers[17].group = 5 arm.rigify_layers[18].name = "Leg.R (Tweak)" arm.rigify_layers[18].row = 12 - arm.rigify_layers[18].set = False + arm.rigify_layers[18].selset = False arm.rigify_layers[18].group = 4 arm.rigify_layers[19].name = "Tail" arm.rigify_layers[19].row = 13 - arm.rigify_layers[19].set = False + arm.rigify_layers[19].selset = False arm.rigify_layers[19].group = 6 arm.rigify_layers[20].name = " " arm.rigify_layers[20].row = 1 - arm.rigify_layers[20].set = False + arm.rigify_layers[20].selset = False arm.rigify_layers[20].group = 4 arm.rigify_layers[21].name = "Hair" arm.rigify_layers[21].row = 14 - arm.rigify_layers[21].set = False + arm.rigify_layers[21].selset = False arm.rigify_layers[21].group = 6 arm.rigify_layers[22].name = " " arm.rigify_layers[22].row = 1 - arm.rigify_layers[22].set = False + arm.rigify_layers[22].selset = False arm.rigify_layers[22].group = 0 arm.rigify_layers[23].name = " " arm.rigify_layers[23].row = 1 - arm.rigify_layers[23].set = False + arm.rigify_layers[23].selset = False arm.rigify_layers[23].group = 0 arm.rigify_layers[24].name = " " arm.rigify_layers[24].row = 1 - arm.rigify_layers[24].set = False + arm.rigify_layers[24].selset = False arm.rigify_layers[24].group = 0 arm.rigify_layers[25].name = " " arm.rigify_layers[25].row = 1 - arm.rigify_layers[25].set = False + arm.rigify_layers[25].selset = False arm.rigify_layers[25].group = 0 arm.rigify_layers[26].name = " " arm.rigify_layers[26].row = 1 - arm.rigify_layers[26].set = False + arm.rigify_layers[26].selset = False arm.rigify_layers[26].group = 0 arm.rigify_layers[27].name = " " arm.rigify_layers[27].row = 1 - arm.rigify_layers[27].set = False + arm.rigify_layers[27].selset = False arm.rigify_layers[27].group = 0 arm.rigify_layers[28].name = "Root" arm.rigify_layers[28].row = 14 - arm.rigify_layers[28].set = False + arm.rigify_layers[28].selset = False arm.rigify_layers[28].group = 1 diff --git a/rigify/metarigs/Animals/shark.py b/rigify/metarigs/Animals/shark.py index dc3fb8bf..355e8197 100644 --- a/rigify/metarigs/Animals/shark.py +++ b/rigify/metarigs/Animals/shark.py @@ -48,119 +48,119 @@ def create(obj): arm.rigify_layers[0].name = "Face" arm.rigify_layers[0].row = 1 - arm.rigify_layers[0].set = False + arm.rigify_layers[0].selset = False arm.rigify_layers[0].group = 5 arm.rigify_layers[1].name = "Face (Tweak)" arm.rigify_layers[1].row = 2 - arm.rigify_layers[1].set = False + arm.rigify_layers[1].selset = False arm.rigify_layers[1].group = 4 arm.rigify_layers[2].name = " " arm.rigify_layers[2].row = 1 - arm.rigify_layers[2].set = False + arm.rigify_layers[2].selset = False arm.rigify_layers[2].group = 0 arm.rigify_layers[3].name = "Spine" arm.rigify_layers[3].row = 3 - arm.rigify_layers[3].set = False + arm.rigify_layers[3].selset = False arm.rigify_layers[3].group = 3 arm.rigify_layers[4].name = "Spine (Tweak)" arm.rigify_layers[4].row = 4 - arm.rigify_layers[4].set = False + arm.rigify_layers[4].selset = False arm.rigify_layers[4].group = 4 arm.rigify_layers[5].name = "Tail" arm.rigify_layers[5].row = 5 - arm.rigify_layers[5].set = False + arm.rigify_layers[5].selset = False arm.rigify_layers[5].group = 6 arm.rigify_layers[6].name = "Fins.L" arm.rigify_layers[6].row = 6 - arm.rigify_layers[6].set = False + arm.rigify_layers[6].selset = False arm.rigify_layers[6].group = 5 arm.rigify_layers[7].name = "Fins.L (Tweak)" arm.rigify_layers[7].row = 7 - arm.rigify_layers[7].set = False + arm.rigify_layers[7].selset = False arm.rigify_layers[7].group = 4 arm.rigify_layers[8].name = "Fins.R" arm.rigify_layers[8].row = 6 - arm.rigify_layers[8].set = False + arm.rigify_layers[8].selset = False arm.rigify_layers[8].group = 5 arm.rigify_layers[9].name = "Fins.R (Tweak)" arm.rigify_layers[9].row = 7 - arm.rigify_layers[9].set = False + arm.rigify_layers[9].selset = False arm.rigify_layers[9].group = 4 arm.rigify_layers[10].name = "Fins" arm.rigify_layers[10].row = 8 - arm.rigify_layers[10].set = False + arm.rigify_layers[10].selset = False arm.rigify_layers[10].group = 3 arm.rigify_layers[11].name = "Fins (Tweak)" arm.rigify_layers[11].row = 9 - arm.rigify_layers[11].set = False + arm.rigify_layers[11].selset = False arm.rigify_layers[11].group = 4 arm.rigify_layers[12].name = " " arm.rigify_layers[12].row = 1 - arm.rigify_layers[12].set = False + arm.rigify_layers[12].selset = False arm.rigify_layers[12].group = 0 arm.rigify_layers[13].name = " " arm.rigify_layers[13].row = 1 - arm.rigify_layers[13].set = False + arm.rigify_layers[13].selset = False arm.rigify_layers[13].group = 6 arm.rigify_layers[14].name = " " arm.rigify_layers[14].row = 1 - arm.rigify_layers[14].set = False + arm.rigify_layers[14].selset = False arm.rigify_layers[14].group = 0 arm.rigify_layers[15].name = " " arm.rigify_layers[15].row = 1 - arm.rigify_layers[15].set = False + arm.rigify_layers[15].selset = False arm.rigify_layers[15].group = 0 arm.rigify_layers[16].name = " " arm.rigify_layers[16].row = 1 - arm.rigify_layers[16].set = False + arm.rigify_layers[16].selset = False arm.rigify_layers[16].group = 0 arm.rigify_layers[17].name = " " arm.rigify_layers[17].row = 1 - arm.rigify_layers[17].set = False + arm.rigify_layers[17].selset = False arm.rigify_layers[17].group = 0 arm.rigify_layers[18].name = " " arm.rigify_layers[18].row = 1 - arm.rigify_layers[18].set = False + arm.rigify_layers[18].selset = False arm.rigify_layers[18].group = 0 arm.rigify_layers[19].name = " " arm.rigify_layers[19].row = 1 - arm.rigify_layers[19].set = False + arm.rigify_layers[19].selset = False arm.rigify_layers[19].group = 0 arm.rigify_layers[20].name = " " arm.rigify_layers[20].row = 1 - arm.rigify_layers[20].set = False + arm.rigify_layers[20].selset = False arm.rigify_layers[20].group = 0 arm.rigify_layers[21].name = " " arm.rigify_layers[21].row = 1 - arm.rigify_layers[21].set = False + arm.rigify_layers[21].selset = False arm.rigify_layers[21].group = 0 arm.rigify_layers[22].name = " " arm.rigify_layers[22].row = 1 - arm.rigify_layers[22].set = False + arm.rigify_layers[22].selset = False arm.rigify_layers[22].group = 0 arm.rigify_layers[23].name = " " arm.rigify_layers[23].row = 1 - arm.rigify_layers[23].set = False + arm.rigify_layers[23].selset = False arm.rigify_layers[23].group = 0 arm.rigify_layers[24].name = " " arm.rigify_layers[24].row = 1 - arm.rigify_layers[24].set = False + arm.rigify_layers[24].selset = False arm.rigify_layers[24].group = 0 arm.rigify_layers[25].name = " " arm.rigify_layers[25].row = 1 - arm.rigify_layers[25].set = False + arm.rigify_layers[25].selset = False arm.rigify_layers[25].group = 0 arm.rigify_layers[26].name = " " arm.rigify_layers[26].row = 1 - arm.rigify_layers[26].set = False + arm.rigify_layers[26].selset = False arm.rigify_layers[26].group = 0 arm.rigify_layers[27].name = " " arm.rigify_layers[27].row = 1 - arm.rigify_layers[27].set = False + arm.rigify_layers[27].selset = False arm.rigify_layers[27].group = 0 arm.rigify_layers[28].name = "Root" arm.rigify_layers[28].row = 14 - arm.rigify_layers[28].set = False + arm.rigify_layers[28].selset = False arm.rigify_layers[28].group = 1 bones = {} diff --git a/rigify/metarigs/Animals/wolf.py b/rigify/metarigs/Animals/wolf.py index e1a8ea54..e156421b 100644 --- a/rigify/metarigs/Animals/wolf.py +++ b/rigify/metarigs/Animals/wolf.py @@ -48,119 +48,119 @@ def create(obj): arm.rigify_layers[0].name = "Face" arm.rigify_layers[0].row = 1 - arm.rigify_layers[0].set = False + arm.rigify_layers[0].selset = False arm.rigify_layers[0].group = 5 arm.rigify_layers[1].name = "Face (Primary)" arm.rigify_layers[1].row = 2 - arm.rigify_layers[1].set = False + arm.rigify_layers[1].selset = False arm.rigify_layers[1].group = 2 arm.rigify_layers[2].name = "Face (Secondary)" arm.rigify_layers[2].row = 2 - arm.rigify_layers[2].set = False + arm.rigify_layers[2].selset = False arm.rigify_layers[2].group = 3 arm.rigify_layers[3].name = "Spine" arm.rigify_layers[3].row = 3 - arm.rigify_layers[3].set = False + arm.rigify_layers[3].selset = False arm.rigify_layers[3].group = 3 arm.rigify_layers[4].name = "Spine (Tweak)" arm.rigify_layers[4].row = 4 - arm.rigify_layers[4].set = False + arm.rigify_layers[4].selset = False arm.rigify_layers[4].group = 4 arm.rigify_layers[5].name = "Paws" arm.rigify_layers[5].row = 5 - arm.rigify_layers[5].set = False + arm.rigify_layers[5].selset = False arm.rigify_layers[5].group = 6 arm.rigify_layers[6].name = "Paws (Tweak)" arm.rigify_layers[6].row = 6 - arm.rigify_layers[6].set = False + arm.rigify_layers[6].selset = False arm.rigify_layers[6].group = 4 arm.rigify_layers[7].name = "Arm.L (IK)" arm.rigify_layers[7].row = 7 - arm.rigify_layers[7].set = False + arm.rigify_layers[7].selset = False arm.rigify_layers[7].group = 2 arm.rigify_layers[8].name = "Arm.L (FK)" arm.rigify_layers[8].row = 8 - arm.rigify_layers[8].set = False + arm.rigify_layers[8].selset = False arm.rigify_layers[8].group = 5 arm.rigify_layers[9].name = "Arm.L (Tweak)" arm.rigify_layers[9].row = 9 - arm.rigify_layers[9].set = False + arm.rigify_layers[9].selset = False arm.rigify_layers[9].group = 4 arm.rigify_layers[10].name = "Arm.R (IK)" arm.rigify_layers[10].row = 7 - arm.rigify_layers[10].set = False + arm.rigify_layers[10].selset = False arm.rigify_layers[10].group = 2 arm.rigify_layers[11].name = "Arm.R (FK)" arm.rigify_layers[11].row = 8 - arm.rigify_layers[11].set = False + arm.rigify_layers[11].selset = False arm.rigify_layers[11].group = 5 arm.rigify_layers[12].name = "Arm.R (Tweak)" arm.rigify_layers[12].row = 9 - arm.rigify_layers[12].set = False + arm.rigify_layers[12].selset = False arm.rigify_layers[12].group = 4 arm.rigify_layers[13].name = "Leg.L (IK)" arm.rigify_layers[13].row = 10 - arm.rigify_layers[13].set = False + arm.rigify_layers[13].selset = False arm.rigify_layers[13].group = 2 arm.rigify_layers[14].name = "Leg.L (FK)" arm.rigify_layers[14].row = 11 - arm.rigify_layers[14].set = False + arm.rigify_layers[14].selset = False arm.rigify_layers[14].group = 5 arm.rigify_layers[15].name = "Leg.L (Tweak)" arm.rigify_layers[15].row = 12 - arm.rigify_layers[15].set = False + arm.rigify_layers[15].selset = False arm.rigify_layers[15].group = 4 arm.rigify_layers[16].name = "Leg.R (IK)" arm.rigify_layers[16].row = 10 - arm.rigify_layers[16].set = False + arm.rigify_layers[16].selset = False arm.rigify_layers[16].group = 2 arm.rigify_layers[17].name = "Leg.R (FK)" arm.rigify_layers[17].row = 11 - arm.rigify_layers[17].set = False + arm.rigify_layers[17].selset = False arm.rigify_layers[17].group = 5 arm.rigify_layers[18].name = "Leg.R (Tweak)" arm.rigify_layers[18].row = 12 - arm.rigify_layers[18].set = False + arm.rigify_layers[18].selset = False arm.rigify_layers[18].group = 4 arm.rigify_layers[19].name = "Tail" arm.rigify_layers[19].row = 13 - arm.rigify_layers[19].set = False + arm.rigify_layers[19].selset = False arm.rigify_layers[19].group = 6 arm.rigify_layers[20].name = "" arm.rigify_layers[20].row = 1 - arm.rigify_layers[20].set = False + arm.rigify_layers[20].selset = False arm.rigify_layers[20].group = 0 arm.rigify_layers[21].name = "" arm.rigify_layers[21].row = 13 - arm.rigify_layers[21].set = False + arm.rigify_layers[21].selset = False arm.rigify_layers[21].group = 0 arm.rigify_layers[22].name = "" arm.rigify_layers[22].row = 13 - arm.rigify_layers[22].set = False + arm.rigify_layers[22].selset = False arm.rigify_layers[22].group = 0 arm.rigify_layers[23].name = "" arm.rigify_layers[23].row = 1 - arm.rigify_layers[23].set = False + arm.rigify_layers[23].selset = False arm.rigify_layers[23].group = 0 arm.rigify_layers[24].name = "" arm.rigify_layers[24].row = 1 - arm.rigify_layers[24].set = False + arm.rigify_layers[24].selset = False arm.rigify_layers[24].group = 0 arm.rigify_layers[25].name = "" arm.rigify_layers[25].row = 1 - arm.rigify_layers[25].set = False + arm.rigify_layers[25].selset = False arm.rigify_layers[25].group = 0 arm.rigify_layers[26].name = "" arm.rigify_layers[26].row = 1 - arm.rigify_layers[26].set = False + arm.rigify_layers[26].selset = False arm.rigify_layers[26].group = 0 arm.rigify_layers[27].name = "" arm.rigify_layers[27].row = 1 - arm.rigify_layers[27].set = False + arm.rigify_layers[27].selset = False arm.rigify_layers[27].group = 0 arm.rigify_layers[28].name = "Root" arm.rigify_layers[28].row = 14 - arm.rigify_layers[28].set = False + arm.rigify_layers[28].selset = False arm.rigify_layers[28].group = 1 bones = {} diff --git a/rigify/metarigs/Basic/basic_human.py b/rigify/metarigs/Basic/basic_human.py index 221809e7..6492509b 100644 --- a/rigify/metarigs/Basic/basic_human.py +++ b/rigify/metarigs/Basic/basic_human.py @@ -48,119 +48,119 @@ def create(obj): arm.rigify_layers[0].name = " " arm.rigify_layers[0].row = 1 - arm.rigify_layers[0].set = False + arm.rigify_layers[0].selset = False arm.rigify_layers[0].group = 0 arm.rigify_layers[1].name = " " arm.rigify_layers[1].row = 1 - arm.rigify_layers[1].set = False + arm.rigify_layers[1].selset = False arm.rigify_layers[1].group = 0 arm.rigify_layers[2].name = " " arm.rigify_layers[2].row = 1 - arm.rigify_layers[2].set = False + arm.rigify_layers[2].selset = False arm.rigify_layers[2].group = 0 arm.rigify_layers[3].name = "Torso" arm.rigify_layers[3].row = 3 - arm.rigify_layers[3].set = False + arm.rigify_layers[3].selset = False arm.rigify_layers[3].group = 3 arm.rigify_layers[4].name = "Torso (Tweak)" arm.rigify_layers[4].row = 4 - arm.rigify_layers[4].set = False + arm.rigify_layers[4].selset = False arm.rigify_layers[4].group = 4 arm.rigify_layers[5].name = " " arm.rigify_layers[5].row = 1 - arm.rigify_layers[5].set = False + arm.rigify_layers[5].selset = False arm.rigify_layers[5].group = 0 arm.rigify_layers[6].name = " " arm.rigify_layers[6].row = 1 - arm.rigify_layers[6].set = False + arm.rigify_layers[6].selset = False arm.rigify_layers[6].group = 0 arm.rigify_layers[7].name = "Arm.L (IK)" arm.rigify_layers[7].row = 7 - arm.rigify_layers[7].set = False + arm.rigify_layers[7].selset = False arm.rigify_layers[7].group = 2 arm.rigify_layers[8].name = "Arm.L (FK)" arm.rigify_layers[8].row = 8 - arm.rigify_layers[8].set = False + arm.rigify_layers[8].selset = False arm.rigify_layers[8].group = 5 arm.rigify_layers[9].name = "Arm.L (Tweak)" arm.rigify_layers[9].row = 9 - arm.rigify_layers[9].set = False + arm.rigify_layers[9].selset = False arm.rigify_layers[9].group = 4 arm.rigify_layers[10].name = "Arm.R (IK)" arm.rigify_layers[10].row = 7 - arm.rigify_layers[10].set = False + arm.rigify_layers[10].selset = False arm.rigify_layers[10].group = 2 arm.rigify_layers[11].name = "Arm.R (FK)" arm.rigify_layers[11].row = 8 - arm.rigify_layers[11].set = False + arm.rigify_layers[11].selset = False arm.rigify_layers[11].group = 5 arm.rigify_layers[12].name = "Arm.R (Tweak)" arm.rigify_layers[12].row = 9 - arm.rigify_layers[12].set = False + arm.rigify_layers[12].selset = False arm.rigify_layers[12].group = 4 arm.rigify_layers[13].name = "Leg.L (IK)" arm.rigify_layers[13].row = 10 - arm.rigify_layers[13].set = False + arm.rigify_layers[13].selset = False arm.rigify_layers[13].group = 2 arm.rigify_layers[14].name = "Leg.L (FK)" arm.rigify_layers[14].row = 11 - arm.rigify_layers[14].set = False + arm.rigify_layers[14].selset = False arm.rigify_layers[14].group = 5 arm.rigify_layers[15].name = "Leg.L (Tweak)" arm.rigify_layers[15].row = 12 - arm.rigify_layers[15].set = False + arm.rigify_layers[15].selset = False arm.rigify_layers[15].group = 4 arm.rigify_layers[16].name = "Leg.R (IK)" arm.rigify_layers[16].row = 10 - arm.rigify_layers[16].set = False + arm.rigify_layers[16].selset = False arm.rigify_layers[16].group = 2 arm.rigify_layers[17].name = "Leg.R (FK)" arm.rigify_layers[17].row = 11 - arm.rigify_layers[17].set = False + arm.rigify_layers[17].selset = False arm.rigify_layers[17].group = 5 arm.rigify_layers[18].name = "Leg.R (Tweak)" arm.rigify_layers[18].row = 12 - arm.rigify_layers[18].set = False + arm.rigify_layers[18].selset = False arm.rigify_layers[18].group = 4 arm.rigify_layers[19].name = "" arm.rigify_layers[19].row = 1 - arm.rigify_layers[19].set = False + arm.rigify_layers[19].selset = False arm.rigify_layers[19].group = 0 arm.rigify_layers[20].name = "" arm.rigify_layers[20].row = 1 - arm.rigify_layers[20].set = False + arm.rigify_layers[20].selset = False arm.rigify_layers[20].group = 0 arm.rigify_layers[21].name = "" arm.rigify_layers[21].row = 1 - arm.rigify_layers[21].set = False + arm.rigify_layers[21].selset = False arm.rigify_layers[21].group = 0 arm.rigify_layers[22].name = "" arm.rigify_layers[22].row = 1 - arm.rigify_layers[22].set = False + arm.rigify_layers[22].selset = False arm.rigify_layers[22].group = 0 arm.rigify_layers[23].name = "" arm.rigify_layers[23].row = 1 - arm.rigify_layers[23].set = False + arm.rigify_layers[23].selset = False arm.rigify_layers[23].group = 0 arm.rigify_layers[24].name = "" arm.rigify_layers[24].row = 1 - arm.rigify_layers[24].set = False + arm.rigify_layers[24].selset = False arm.rigify_layers[24].group = 0 arm.rigify_layers[25].name = "" arm.rigify_layers[25].row = 1 - arm.rigify_layers[25].set = False + arm.rigify_layers[25].selset = False arm.rigify_layers[25].group = 0 arm.rigify_layers[26].name = "" arm.rigify_layers[26].row = 1 - arm.rigify_layers[26].set = False + arm.rigify_layers[26].selset = False arm.rigify_layers[26].group = 0 arm.rigify_layers[27].name = "" arm.rigify_layers[27].row = 1 - arm.rigify_layers[27].set = False + arm.rigify_layers[27].selset = False arm.rigify_layers[27].group = 0 arm.rigify_layers[28].name = "Root" arm.rigify_layers[28].row = 14 - arm.rigify_layers[28].set = False + arm.rigify_layers[28].selset = False arm.rigify_layers[28].group = 1 bones = {} diff --git a/rigify/metarigs/Basic/basic_quadruped.py b/rigify/metarigs/Basic/basic_quadruped.py index fe3449e1..46143b36 100644 --- a/rigify/metarigs/Basic/basic_quadruped.py +++ b/rigify/metarigs/Basic/basic_quadruped.py @@ -48,119 +48,119 @@ def create(obj): arm.rigify_layers[0].name = " " arm.rigify_layers[0].row = 1 - arm.rigify_layers[0].set = False + arm.rigify_layers[0].selset = False arm.rigify_layers[0].group = 0 arm.rigify_layers[1].name = " " arm.rigify_layers[1].row = 2 - arm.rigify_layers[1].set = False + arm.rigify_layers[1].selset = False arm.rigify_layers[1].group = 0 arm.rigify_layers[2].name = " " arm.rigify_layers[2].row = 2 - arm.rigify_layers[2].set = False + arm.rigify_layers[2].selset = False arm.rigify_layers[2].group = 0 arm.rigify_layers[3].name = "Spine" arm.rigify_layers[3].row = 3 - arm.rigify_layers[3].set = False + arm.rigify_layers[3].selset = False arm.rigify_layers[3].group = 3 arm.rigify_layers[4].name = "Spine (Tweak)" arm.rigify_layers[4].row = 4 - arm.rigify_layers[4].set = False + arm.rigify_layers[4].selset = False arm.rigify_layers[4].group = 4 arm.rigify_layers[5].name = " " arm.rigify_layers[5].row = 5 - arm.rigify_layers[5].set = False + arm.rigify_layers[5].selset = False arm.rigify_layers[5].group = 0 arm.rigify_layers[6].name = " " arm.rigify_layers[6].row = 6 - arm.rigify_layers[6].set = False + arm.rigify_layers[6].selset = False arm.rigify_layers[6].group = 0 arm.rigify_layers[7].name = "Arm.L (IK)" arm.rigify_layers[7].row = 7 - arm.rigify_layers[7].set = False + arm.rigify_layers[7].selset = False arm.rigify_layers[7].group = 2 arm.rigify_layers[8].name = "Arm.L (FK)" arm.rigify_layers[8].row = 8 - arm.rigify_layers[8].set = False + arm.rigify_layers[8].selset = False arm.rigify_layers[8].group = 5 arm.rigify_layers[9].name = "Arm.L (Tweak)" arm.rigify_layers[9].row = 9 - arm.rigify_layers[9].set = False + arm.rigify_layers[9].selset = False arm.rigify_layers[9].group = 4 arm.rigify_layers[10].name = "Arm.R (IK)" arm.rigify_layers[10].row = 7 - arm.rigify_layers[10].set = False + arm.rigify_layers[10].selset = False arm.rigify_layers[10].group = 2 arm.rigify_layers[11].name = "Arm.R (FK)" arm.rigify_layers[11].row = 8 - arm.rigify_layers[11].set = False + arm.rigify_layers[11].selset = False arm.rigify_layers[11].group = 5 arm.rigify_layers[12].name = "Arm.R (Tweak)" arm.rigify_layers[12].row = 9 - arm.rigify_layers[12].set = False + arm.rigify_layers[12].selset = False arm.rigify_layers[12].group = 4 arm.rigify_layers[13].name = "Leg.L (IK)" arm.rigify_layers[13].row = 10 - arm.rigify_layers[13].set = False + arm.rigify_layers[13].selset = False arm.rigify_layers[13].group = 2 arm.rigify_layers[14].name = "Leg.L (FK)" arm.rigify_layers[14].row = 11 - arm.rigify_layers[14].set = False + arm.rigify_layers[14].selset = False arm.rigify_layers[14].group = 5 arm.rigify_layers[15].name = "Leg.L (Tweak)" arm.rigify_layers[15].row = 12 - arm.rigify_layers[15].set = False + arm.rigify_layers[15].selset = False arm.rigify_layers[15].group = 4 arm.rigify_layers[16].name = "Leg.R (IK)" arm.rigify_layers[16].row = 10 - arm.rigify_layers[16].set = False + arm.rigify_layers[16].selset = False arm.rigify_layers[16].group = 2 arm.rigify_layers[17].name = "Leg.R (FK)" arm.rigify_layers[17].row = 11 - arm.rigify_layers[17].set = False + arm.rigify_layers[17].selset = False arm.rigify_layers[17].group = 5 arm.rigify_layers[18].name = "Leg.R (Tweak)" arm.rigify_layers[18].row = 12 - arm.rigify_layers[18].set = False + arm.rigify_layers[18].selset = False arm.rigify_layers[18].group = 4 arm.rigify_layers[19].name = "Tail" arm.rigify_layers[19].row = 13 - arm.rigify_layers[19].set = False + arm.rigify_layers[19].selset = False arm.rigify_layers[19].group = 6 arm.rigify_layers[20].name = "" arm.rigify_layers[20].row = 1 - arm.rigify_layers[20].set = False + arm.rigify_layers[20].selset = False arm.rigify_layers[20].group = 0 arm.rigify_layers[21].name = "" arm.rigify_layers[21].row = 13 - arm.rigify_layers[21].set = False + arm.rigify_layers[21].selset = False arm.rigify_layers[21].group = 0 arm.rigify_layers[22].name = "" arm.rigify_layers[22].row = 13 - arm.rigify_layers[22].set = False + arm.rigify_layers[22].selset = False arm.rigify_layers[22].group = 0 arm.rigify_layers[23].name = "" arm.rigify_layers[23].row = 1 - arm.rigify_layers[23].set = False + arm.rigify_layers[23].selset = False arm.rigify_layers[23].group = 0 arm.rigify_layers[24].name = "" arm.rigify_layers[24].row = 1 - arm.rigify_layers[24].set = False + arm.rigify_layers[24].selset = False arm.rigify_layers[24].group = 0 arm.rigify_layers[25].name = "" arm.rigify_layers[25].row = 1 - arm.rigify_layers[25].set = False + arm.rigify_layers[25].selset = False arm.rigify_layers[25].group = 0 arm.rigify_layers[26].name = "" arm.rigify_layers[26].row = 1 - arm.rigify_layers[26].set = False + arm.rigify_layers[26].selset = False arm.rigify_layers[26].group = 0 arm.rigify_layers[27].name = "" arm.rigify_layers[27].row = 1 - arm.rigify_layers[27].set = False + arm.rigify_layers[27].selset = False arm.rigify_layers[27].group = 0 arm.rigify_layers[28].name = "Root" arm.rigify_layers[28].row = 14 - arm.rigify_layers[28].set = False + arm.rigify_layers[28].selset = False arm.rigify_layers[28].group = 1 bones = {} diff --git a/rigify/metarigs/human.py b/rigify/metarigs/human.py index cf301cd2..337180a5 100644 --- a/rigify/metarigs/human.py +++ b/rigify/metarigs/human.py @@ -48,119 +48,119 @@ def create(obj): arm.rigify_layers[0].name = "Face" arm.rigify_layers[0].row = 1 - arm.rigify_layers[0].set = False + arm.rigify_layers[0].selset = False arm.rigify_layers[0].group = 5 arm.rigify_layers[1].name = "Face (Primary)" arm.rigify_layers[1].row = 2 - arm.rigify_layers[1].set = False + arm.rigify_layers[1].selset = False arm.rigify_layers[1].group = 2 arm.rigify_layers[2].name = "Face (Secondary)" arm.rigify_layers[2].row = 2 - arm.rigify_layers[2].set = False + arm.rigify_layers[2].selset = False arm.rigify_layers[2].group = 3 arm.rigify_layers[3].name = "Torso" arm.rigify_layers[3].row = 3 - arm.rigify_layers[3].set = False + arm.rigify_layers[3].selset = False arm.rigify_layers[3].group = 3 arm.rigify_layers[4].name = "Torso (Tweak)" arm.rigify_layers[4].row = 4 - arm.rigify_layers[4].set = False + arm.rigify_layers[4].selset = False arm.rigify_layers[4].group = 4 arm.rigify_layers[5].name = "Fingers" arm.rigify_layers[5].row = 5 - arm.rigify_layers[5].set = False + arm.rigify_layers[5].selset = False arm.rigify_layers[5].group = 6 arm.rigify_layers[6].name = "Fingers (Tweak)" arm.rigify_layers[6].row = 6 - arm.rigify_layers[6].set = False + arm.rigify_layers[6].selset = False arm.rigify_layers[6].group = 4 arm.rigify_layers[7].name = "Arm.L (IK)" arm.rigify_layers[7].row = 7 - arm.rigify_layers[7].set = False + arm.rigify_layers[7].selset = False arm.rigify_layers[7].group = 2 arm.rigify_layers[8].name = "Arm.L (FK)" arm.rigify_layers[8].row = 8 - arm.rigify_layers[8].set = False + arm.rigify_layers[8].selset = False arm.rigify_layers[8].group = 5 arm.rigify_layers[9].name = "Arm.L (Tweak)" arm.rigify_layers[9].row = 9 - arm.rigify_layers[9].set = False + arm.rigify_layers[9].selset = False arm.rigify_layers[9].group = 4 arm.rigify_layers[10].name = "Arm.R (IK)" arm.rigify_layers[10].row = 7 - arm.rigify_layers[10].set = False + arm.rigify_layers[10].selset = False arm.rigify_layers[10].group = 2 arm.rigify_layers[11].name = "Arm.R (FK)" arm.rigify_layers[11].row = 8 - arm.rigify_layers[11].set = False + arm.rigify_layers[11].selset = False arm.rigify_layers[11].group = 5 arm.rigify_layers[12].name = "Arm.R (Tweak)" arm.rigify_layers[12].row = 9 - arm.rigify_layers[12].set = False + arm.rigify_layers[12].selset = False arm.rigify_layers[12].group = 4 arm.rigify_layers[13].name = "Leg.L (IK)" arm.rigify_layers[13].row = 10 - arm.rigify_layers[13].set = False + arm.rigify_layers[13].selset = False arm.rigify_layers[13].group = 2 arm.rigify_layers[14].name = "Leg.L (FK)" arm.rigify_layers[14].row = 11 - arm.rigify_layers[14].set = False + arm.rigify_layers[14].selset = False arm.rigify_layers[14].group = 5 arm.rigify_layers[15].name = "Leg.L (Tweak)" arm.rigify_layers[15].row = 12 - arm.rigify_layers[15].set = False + arm.rigify_layers[15].selset = False arm.rigify_layers[15].group = 4 arm.rigify_layers[16].name = "Leg.R (IK)" arm.rigify_layers[16].row = 10 - arm.rigify_layers[16].set = False + arm.rigify_layers[16].selset = False arm.rigify_layers[16].group = 2 arm.rigify_layers[17].name = "Leg.R (FK)" arm.rigify_layers[17].row = 11 - arm.rigify_layers[17].set = False + arm.rigify_layers[17].selset = False arm.rigify_layers[17].group = 5 arm.rigify_layers[18].name = "Leg.R (Tweak)" arm.rigify_layers[18].row = 12 - arm.rigify_layers[18].set = False + arm.rigify_layers[18].selset = False arm.rigify_layers[18].group = 4 arm.rigify_layers[19].name = "" arm.rigify_layers[19].row = 1 - arm.rigify_layers[19].set = False + arm.rigify_layers[19].selset = False arm.rigify_layers[19].group = 0 arm.rigify_layers[20].name = "" arm.rigify_layers[20].row = 1 - arm.rigify_layers[20].set = False + arm.rigify_layers[20].selset = False arm.rigify_layers[20].group = 0 arm.rigify_layers[21].name = "" arm.rigify_layers[21].row = 1 - arm.rigify_layers[21].set = False + arm.rigify_layers[21].selset = False arm.rigify_layers[21].group = 0 arm.rigify_layers[22].name = "" arm.rigify_layers[22].row = 1 - arm.rigify_layers[22].set = False + arm.rigify_layers[22].selset = False arm.rigify_layers[22].group = 0 arm.rigify_layers[23].name = "" arm.rigify_layers[23].row = 1 - arm.rigify_layers[23].set = False + arm.rigify_layers[23].selset = False arm.rigify_layers[23].group = 0 arm.rigify_layers[24].name = "" arm.rigify_layers[24].row = 1 - arm.rigify_layers[24].set = False + arm.rigify_layers[24].selset = False arm.rigify_layers[24].group = 0 arm.rigify_layers[25].name = "" arm.rigify_layers[25].row = 1 - arm.rigify_layers[25].set = False + arm.rigify_layers[25].selset = False arm.rigify_layers[25].group = 0 arm.rigify_layers[26].name = "" arm.rigify_layers[26].row = 1 - arm.rigify_layers[26].set = False + arm.rigify_layers[26].selset = False arm.rigify_layers[26].group = 0 arm.rigify_layers[27].name = "" arm.rigify_layers[27].row = 1 - arm.rigify_layers[27].set = False + arm.rigify_layers[27].selset = False arm.rigify_layers[27].group = 0 arm.rigify_layers[28].name = "Root" arm.rigify_layers[28].row = 14 - arm.rigify_layers[28].set = False + arm.rigify_layers[28].selset = False arm.rigify_layers[28].group = 1 bones = {} diff --git a/rigify/rig_ui_template.py b/rigify/rig_ui_template.py index 3cdda311..bbbc06dc 100644 --- a/rigify/rig_ui_template.py +++ b/rigify/rig_ui_template.py @@ -20,6 +20,7 @@ UI_SLIDERS = ''' import bpy +from bpy.props import StringProperty from mathutils import Matrix, Vector from math import acos, pi, radians @@ -600,13 +601,13 @@ class Rigify_Arm_FK2IK(bpy.types.Operator): bl_label = "Rigify Snap FK arm to IK" bl_options = {'UNDO'} - uarm_fk = bpy.props.StringProperty(name="Upper Arm FK Name") - farm_fk = bpy.props.StringProperty(name="Forerm FK Name") - hand_fk = bpy.props.StringProperty(name="Hand FK Name") + uarm_fk: StringProperty(name="Upper Arm FK Name") + farm_fk: StringProperty(name="Forerm FK Name") + hand_fk: StringProperty(name="Hand FK Name") - uarm_ik = bpy.props.StringProperty(name="Upper Arm IK Name") - farm_ik = bpy.props.StringProperty(name="Forearm IK Name") - hand_ik = bpy.props.StringProperty(name="Hand IK Name") + uarm_ik: StringProperty(name="Upper Arm IK Name") + farm_ik: StringProperty(name="Forearm IK Name") + hand_ik: StringProperty(name="Hand IK Name") @classmethod def poll(cls, context): @@ -629,16 +630,16 @@ class Rigify_Arm_IK2FK(bpy.types.Operator): bl_label = "Rigify Snap IK arm to FK" bl_options = {'UNDO'} - uarm_fk = bpy.props.StringProperty(name="Upper Arm FK Name") - farm_fk = bpy.props.StringProperty(name="Forerm FK Name") - hand_fk = bpy.props.StringProperty(name="Hand FK Name") + uarm_fk: StringProperty(name="Upper Arm FK Name") + farm_fk: StringProperty(name="Forerm FK Name") + hand_fk: StringProperty(name="Hand FK Name") - uarm_ik = bpy.props.StringProperty(name="Upper Arm IK Name") - farm_ik = bpy.props.StringProperty(name="Forearm IK Name") - hand_ik = bpy.props.StringProperty(name="Hand IK Name") - pole = bpy.props.StringProperty(name="Pole IK Name") + uarm_ik: StringProperty(name="Upper Arm IK Name") + farm_ik: StringProperty(name="Forearm IK Name") + hand_ik: StringProperty(name="Hand IK Name") + pole : StringProperty(name="Pole IK Name") - main_parent = bpy.props.StringProperty(name="Main Parent", default="") + main_parent: StringProperty(name="Main Parent", default="") @classmethod def poll(cls, context): @@ -661,15 +662,15 @@ class Rigify_Leg_FK2IK(bpy.types.Operator): bl_label = "Rigify Snap FK leg to IK" bl_options = {'UNDO'} - thigh_fk = bpy.props.StringProperty(name="Thigh FK Name") - shin_fk = bpy.props.StringProperty(name="Shin FK Name") - foot_fk = bpy.props.StringProperty(name="Foot FK Name") - mfoot_fk = bpy.props.StringProperty(name="MFoot FK Name") + thigh_fk: StringProperty(name="Thigh FK Name") + shin_fk: StringProperty(name="Shin FK Name") + foot_fk: StringProperty(name="Foot FK Name") + mfoot_fk: StringProperty(name="MFoot FK Name") - thigh_ik = bpy.props.StringProperty(name="Thigh IK Name") - shin_ik = bpy.props.StringProperty(name="Shin IK Name") - foot_ik = bpy.props.StringProperty(name="Foot IK Name") - mfoot_ik = bpy.props.StringProperty(name="MFoot IK Name") + thigh_ik: StringProperty(name="Thigh IK Name") + shin_ik: StringProperty(name="Shin IK Name") + foot_ik: StringProperty(name="Foot IK Name") + mfoot_ik: StringProperty(name="MFoot IK Name") @classmethod def poll(cls, context): @@ -692,18 +693,18 @@ class Rigify_Leg_IK2FK(bpy.types.Operator): bl_label = "Rigify Snap IK leg to FK" bl_options = {'UNDO'} - thigh_fk = bpy.props.StringProperty(name="Thigh FK Name") - shin_fk = bpy.props.StringProperty(name="Shin FK Name") - mfoot_fk = bpy.props.StringProperty(name="MFoot FK Name") - foot_fk = bpy.props.StringProperty(name="Foot FK Name", default="") - thigh_ik = bpy.props.StringProperty(name="Thigh IK Name") - shin_ik = bpy.props.StringProperty(name="Shin IK Name") - foot_ik = bpy.props.StringProperty(name="Foot IK Name") - footroll = bpy.props.StringProperty(name="Foot Roll Name") - pole = bpy.props.StringProperty(name="Pole IK Name") - mfoot_ik = bpy.props.StringProperty(name="MFoot IK Name") + thigh_fk: StringProperty(name="Thigh FK Name") + shin_fk: StringProperty(name="Shin FK Name") + mfoot_fk: StringProperty(name="MFoot FK Name") + foot_fk: StringProperty(name="Foot FK Name", default="") + thigh_ik: StringProperty(name="Thigh IK Name") + shin_ik: StringProperty(name="Shin IK Name") + foot_ik: StringProperty(name="Foot IK Name") + footroll: StringProperty(name="Foot Roll Name") + pole: StringProperty(name="Pole IK Name") + mfoot_ik: StringProperty(name="MFoot IK Name") - main_parent = bpy.props.StringProperty(name="Main Parent", default="") + main_parent: StringProperty(name="Main Parent", default="") @classmethod def poll(cls, context): @@ -726,13 +727,14 @@ class Rigify_Rot2PoleSwitch(bpy.types.Operator): bl_idname = "pose.rigify_rot2pole_" + rig_id bl_label = "Rotation - Pole toggle" bl_description = "Toggles IK chain between rotation and pole target" - bone_name = bpy.props.StringProperty(default='') - limb_type = bpy.props.StringProperty(name="Limb Type") - controls = bpy.props.StringProperty(name="Controls string") - ik_ctrl = bpy.props.StringProperty(name="IK Controls string") - fk_ctrl = bpy.props.StringProperty(name="FK Controls string") - parent = bpy.props.StringProperty(name="Parent name") - pole = bpy.props.StringProperty(name="Pole name") + + bone_name: StringProperty(default='') + limb_type: StringProperty(name="Limb Type") + controls: StringProperty(name="Controls string") + ik_ctrl: StringProperty(name="IK Controls string") + fk_ctrl: StringProperty(name="FK Controls string") + parent: StringProperty(name="Parent name") + pole: StringProperty(name="Pole name") def execute(self, context): rig = context.object @@ -841,23 +843,26 @@ class RigLayers(bpy.types.Panel): UI_REGISTER = ''' +classes = ( + Rigify_Arm_FK2IK, + Rigify_Arm_IK2FK, + Rigify_Leg_FK2IK, + Rigify_Leg_IK2FK, + Rigify_Rot2PoleSwitch, + RigUI, + RigLayers, +) + def register(): - bpy.utils.register_class(Rigify_Arm_FK2IK) - bpy.utils.register_class(Rigify_Arm_IK2FK) - bpy.utils.register_class(Rigify_Leg_FK2IK) - bpy.utils.register_class(Rigify_Leg_IK2FK) - bpy.utils.register_class(Rigify_Rot2PoleSwitch) - bpy.utils.register_class(RigUI) - bpy.utils.register_class(RigLayers) + from bpy.utils import register_class + for cls in classes: + register_class(cls) + def unregister(): - bpy.utils.unregister_class(Rigify_Arm_FK2IK) - bpy.utils.unregister_class(Rigify_Arm_IK2FK) - bpy.utils.unregister_class(Rigify_Leg_FK2IK) - bpy.utils.unregister_class(Rigify_Leg_IK2FK) - bpy.utils.register_class(Rigify_Rot2PoleSwitch) - bpy.utils.unregister_class(RigUI) - bpy.utils.unregister_class(RigLayers) + from bpy.utils import unregister_class + for cls in classes: + unregister_class(cls) register() ''' diff --git a/rigify/rigs/basic/super_copy.py b/rigify/rigs/basic/super_copy.py index b2045346..20a70bc6 100644 --- a/rigify/rigs/basic/super_copy.py +++ b/rigify/rigs/basic/super_copy.py @@ -92,7 +92,7 @@ def add_parameters(params): """ Add the parameters of this rig type to the RigifyParameters PropertyGroup """ - params.make_control = bpy.props.BoolProperty( + params.make_control: bpy.props.BoolProperty( name = "Control", default = True, description = "Create a control bone for the copy" diff --git a/rigify/rot_mode.py b/rigify/rot_mode.py index 22def224..d5e5a71e 100644 --- a/rigify/rot_mode.py +++ b/rigify/rot_mode.py @@ -38,6 +38,10 @@ blender.stackexchange.com/questions/40711/how-to-convert-quaternions-keyframes-t # "category": "Animation"} import bpy +from bpy.props import ( + BoolProperty, + EnumProperty, +) order_list = ['QUATERNION', 'XYZ', 'XZY', 'YXZ', 'YZX', 'ZXY', 'ZYX'] @@ -326,9 +330,19 @@ class CONVERT_OT_quat2eu_all_actions(bpy.types.Operator): return {'FINISHED'} +### Registering ### + +classes = ( + ToolsPanel, + CONVERT_OT_quat2eu_current_action, + CONVERT_OT_quat2eu_all_actions, +) + + def register(): - IDStore = bpy.types.WindowManager + from bpy.utils import register_class + # Properties. items = [('QUATERNION', 'QUATERNION', 'QUATERNION'), ('XYZ', 'XYZ', 'XYZ'), ('XZY', 'XZY', 'XZY'), @@ -336,24 +350,27 @@ def register(): ('YZX', 'YZX', 'YZX'), ('ZXY', 'ZXY', 'ZXY'), ('ZYX', 'ZYX', 'ZYX')] + bpy.types.Scene.order_list = EnumProperty( + items=items, name='Convert to', + description="The target rotation mode", default='QUATERNION') - bpy.types.Scene.order_list = bpy.props.EnumProperty(items=items, name='Convert to', - description="The target rotation mode", default='QUATERNION') + IDStore = bpy.types.WindowManager + IDStore.rigify_convert_only_selected = BoolProperty( + name="Convert Only Selected", + description="Convert selected bones only", default=True) - IDStore.rigify_convert_only_selected = bpy.props.BoolProperty( - name="Convert Only Selected", description="Convert selected bones only", default=True) + # Classes. + for cls in classes: + register_class(cls) - bpy.utils.register_class(ToolsPanel) - bpy.utils.register_class(CONVERT_OT_quat2eu_current_action) - bpy.utils.register_class(CONVERT_OT_quat2eu_all_actions) def unregister(): - IDStore = bpy.types.WindowManager + from bpy.utils import unregister_class - bpy.utils.unregister_class(ToolsPanel) - bpy.utils.unregister_class(CONVERT_OT_quat2eu_current_action) - bpy.utils.unregister_class(CONVERT_OT_quat2eu_all_actions) + # Classes. + for cls in classes: + unregister_class(cls) + # Properties. + IDStore = bpy.types.WindowManager del IDStore.rigify_convert_only_selected - -# bpy.utils.register_module(__name__) diff --git a/rigify/ui.py b/rigify/ui.py index ce66da96..c8a7e98a 100644 --- a/rigify/ui.py +++ b/rigify/ui.py @@ -19,7 +19,13 @@ # <pep8 compliant> import bpy -from bpy.props import StringProperty +from bpy.props import ( + BoolProperty, + IntProperty, + EnumProperty, + StringProperty +) + from mathutils import Color from .utils import get_rig_type, MetarigError @@ -234,8 +240,8 @@ class DATA_PT_rigify_layer_names(bpy.types.Panel): #row.prop(arm, "layers", index=i, text="Layer %d" % (i + 1), toggle=True, icon=icon) row.prop(rigify_layer, "name", text="") row.prop(rigify_layer, "row", text="UI Row") - icon = 'RADIOBUT_ON' if rigify_layer.set else 'RADIOBUT_OFF' - row.prop(rigify_layer, "set", text="", toggle=True, icon=icon) + icon = 'RADIOBUT_ON' if rigify_layer.selset else 'RADIOBUT_OFF' + row.prop(rigify_layer, "selset", text="", toggle=True, icon=icon) row.prop(rigify_layer, "group", text="Bone Group") else: row = col.row(align=True) @@ -247,8 +253,8 @@ class DATA_PT_rigify_layer_names(bpy.types.Panel): row1.prop(rigify_layer, "name", text="") row1.prop(rigify_layer, "row", text="UI Row") row1.enabled = False - icon = 'RADIOBUT_ON' if rigify_layer.set else 'RADIOBUT_OFF' - row.prop(rigify_layer, "set", text="", toggle=True, icon=icon) + icon = 'RADIOBUT_ON' if rigify_layer.selset else 'RADIOBUT_OFF' + row.prop(rigify_layer, "selset", text="", toggle=True, icon=icon) row.prop(rigify_layer, "group", text="Bone Group") if rigify_layer.group == 0: row.label(text='None') @@ -395,28 +401,29 @@ class DATA_OT_rigify_bone_group_add_theme(bpy.types.Operator): bl_label = "Rigify Add Bone Group color set from Theme" bl_options = {"REGISTER", "UNDO"} - theme = bpy.props.EnumProperty(items=(('THEME01', 'THEME01', ''), - ('THEME02', 'THEME02', ''), - ('THEME03', 'THEME03', ''), - ('THEME04', 'THEME04', ''), - ('THEME05', 'THEME05', ''), - ('THEME06', 'THEME06', ''), - ('THEME07', 'THEME07', ''), - ('THEME08', 'THEME08', ''), - ('THEME09', 'THEME09', ''), - ('THEME10', 'THEME10', ''), - ('THEME11', 'THEME11', ''), - ('THEME12', 'THEME12', ''), - ('THEME13', 'THEME13', ''), - ('THEME14', 'THEME14', ''), - ('THEME15', 'THEME15', ''), - ('THEME16', 'THEME16', ''), - ('THEME17', 'THEME17', ''), - ('THEME18', 'THEME18', ''), - ('THEME19', 'THEME19', ''), - ('THEME20', 'THEME20', '') - ), - name='Theme') + theme: EnumProperty(items=( + ('THEME01', 'THEME01', ''), + ('THEME02', 'THEME02', ''), + ('THEME03', 'THEME03', ''), + ('THEME04', 'THEME04', ''), + ('THEME05', 'THEME05', ''), + ('THEME06', 'THEME06', ''), + ('THEME07', 'THEME07', ''), + ('THEME08', 'THEME08', ''), + ('THEME09', 'THEME09', ''), + ('THEME10', 'THEME10', ''), + ('THEME11', 'THEME11', ''), + ('THEME12', 'THEME12', ''), + ('THEME13', 'THEME13', ''), + ('THEME14', 'THEME14', ''), + ('THEME15', 'THEME15', ''), + ('THEME16', 'THEME16', ''), + ('THEME17', 'THEME17', ''), + ('THEME18', 'THEME18', ''), + ('THEME19', 'THEME19', ''), + ('THEME20', 'THEME20', '') + ), + name='Theme') @classmethod def poll(cls, context): @@ -448,7 +455,7 @@ class DATA_OT_rigify_bone_group_remove(bpy.types.Operator): bl_idname = "armature.rigify_bone_group_remove" bl_label = "Rigify Remove Bone Group color set" - idx = bpy.props.IntProperty() + idx: IntProperty() @classmethod def poll(cls, context): @@ -794,18 +801,17 @@ class SwitchToLegacy(bpy.types.Operator): class Sample(bpy.types.Operator): - """Create a sample metarig to be modified before generating """ \ - """the final rig""" + """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'} - metarig_type = StringProperty( - name="Type", - description="Name of the rig type to generate a sample of", - maxlen=128, - ) + metarig_type: StringProperty( + name="Type", + description="Name of the rig type to generate a sample of", + maxlen=128, + ) def execute(self, context): if context.mode == 'EDIT_ARMATURE' and self.metarig_type != "": @@ -1074,20 +1080,20 @@ def IktoFk(rig, window='ALL'): break -def clearAnimation(act, type, names): +def clearAnimation(act, anim_type, names): bones = [] for group in names: if names[group]['limb_type'] == 'arm': - if type == 'IK': + if anim_type == 'IK': bones.extend([names[group]['controls'][0], names[group]['controls'][4]]) - elif type == 'FK': + elif anim_type == 'FK': bones.extend([names[group]['controls'][1], names[group]['controls'][2], names[group]['controls'][3]]) else: - if type == 'IK': + if anim_type == 'IK': bones.extend([names[group]['controls'][0], names[group]['controls'][6], names[group]['controls'][5], names[group]['controls'][4]]) - elif type == 'FK': + elif anim_type == 'FK': bones.extend([names[group]['controls'][1], names[group]['controls'][2], names[group]['controls'][3], names[group]['controls'][4]]) FCurves = [] @@ -1271,7 +1277,8 @@ class OBJECT_OT_ClearAnimation(bpy.types.Operator): bl_idname = "rigify.clear_animation" bl_label = "Clear Animation" bl_description = "Clear Animation For FK or IK Bones" - type = StringProperty() + + anim_type: StringProperty() def execute(self, context): @@ -1286,7 +1293,7 @@ class OBJECT_OT_ClearAnimation(bpy.types.Operator): if not act: return {'FINISHED'} - clearAnimation(act, self.type, names=get_limb_generated_names(rig)) + clearAnimation(act, self.anim_type, names=get_limb_generated_names(rig)) finally: context.user_preferences.edit.use_global_undo = use_global_undo return {'FINISHED'} @@ -1296,11 +1303,12 @@ class OBJECT_OT_Rot2Pole(bpy.types.Operator): bl_idname = "rigify.rotation_pole" bl_label = "Rotation - Pole toggle" bl_description = "Toggles IK chain between rotation and pole target" - bone_name = bpy.props.StringProperty(default='') - window = bpy.props.StringProperty(default='ALL') - toggle = bpy.props.BoolProperty(default=True) - value = bpy.props.BoolProperty(default=True) - bake = bpy.props.BoolProperty(default=True) + + bone_name: StringProperty(default='') + window: StringProperty(default='ALL') + toggle: BoolProperty(default=True) + value: BoolProperty(default=True) + bake: BoolProperty(default=True) def execute(self, context): rig = context.object @@ -1313,74 +1321,60 @@ class OBJECT_OT_Rot2Pole(bpy.types.Operator): return {'FINISHED'} +### Registering ### + + +classes = ( + DATA_OT_rigify_add_bone_groups, + DATA_OT_rigify_use_standard_colors, + DATA_OT_rigify_apply_selection_colors, + DATA_OT_rigify_bone_group_add, + DATA_OT_rigify_bone_group_add_theme, + DATA_OT_rigify_bone_group_remove, + DATA_OT_rigify_bone_group_remove_all, + DATA_UL_rigify_bone_groups, + DATA_MT_rigify_bone_groups_specials, + DATA_PT_rigify_bone_groups, + DATA_PT_rigify_layer_names, + DATA_PT_rigify_buttons, + BONE_PT_rigify_buttons, + VIEW3D_PT_rigify_animation_tools, + VIEW3D_PT_tools_rigify_dev, + LayerInit, + Generate, + UpgradeMetarigTypes, + SwitchToLegacy, + Sample, + EncodeMetarig, + EncodeMetarigSample, + EncodeWidget, + OBJECT_OT_GetFrameRange, + OBJECT_OT_FK2IK, + OBJECT_OT_IK2FK, + OBJECT_OT_TransferFKtoIK, + OBJECT_OT_TransferIKtoFK, + OBJECT_OT_ClearAnimation, + OBJECT_OT_Rot2Pole, +) + + def register(): + from bpy.utils import register_class - bpy.utils.register_class(DATA_OT_rigify_add_bone_groups) - bpy.utils.register_class(DATA_OT_rigify_use_standard_colors) - bpy.utils.register_class(DATA_OT_rigify_apply_selection_colors) - bpy.utils.register_class(DATA_OT_rigify_bone_group_add) - bpy.utils.register_class(DATA_OT_rigify_bone_group_add_theme) - bpy.utils.register_class(DATA_OT_rigify_bone_group_remove) - bpy.utils.register_class(DATA_OT_rigify_bone_group_remove_all) - bpy.utils.register_class(DATA_UL_rigify_bone_groups) - bpy.utils.register_class(DATA_MT_rigify_bone_groups_specials) - bpy.utils.register_class(DATA_PT_rigify_bone_groups) - bpy.utils.register_class(DATA_PT_rigify_layer_names) - bpy.utils.register_class(DATA_PT_rigify_buttons) - bpy.utils.register_class(BONE_PT_rigify_buttons) - bpy.utils.register_class(VIEW3D_PT_rigify_animation_tools) - bpy.utils.register_class(VIEW3D_PT_tools_rigify_dev) - bpy.utils.register_class(LayerInit) - bpy.utils.register_class(Generate) - bpy.utils.register_class(UpgradeMetarigTypes) - bpy.utils.register_class(SwitchToLegacy) - bpy.utils.register_class(Sample) - bpy.utils.register_class(EncodeMetarig) - bpy.utils.register_class(EncodeMetarigSample) - bpy.utils.register_class(EncodeWidget) - bpy.utils.register_class(OBJECT_OT_GetFrameRange) - bpy.utils.register_class(OBJECT_OT_FK2IK) - bpy.utils.register_class(OBJECT_OT_IK2FK) - bpy.utils.register_class(OBJECT_OT_TransferFKtoIK) - bpy.utils.register_class(OBJECT_OT_TransferIKtoFK) - bpy.utils.register_class(OBJECT_OT_ClearAnimation) - bpy.utils.register_class(OBJECT_OT_Rot2Pole) + # Classes. + for cls in classes: + register_class(cls) + # Sub-modules. rot_mode.register() def unregister(): + from bpy.utils import unregister_class - bpy.utils.unregister_class(DATA_OT_rigify_add_bone_groups) - bpy.utils.unregister_class(DATA_OT_rigify_use_standard_colors) - bpy.utils.unregister_class(DATA_OT_rigify_apply_selection_colors) - bpy.utils.unregister_class(DATA_OT_rigify_bone_group_add) - bpy.utils.unregister_class(DATA_OT_rigify_bone_group_add_theme) - bpy.utils.unregister_class(DATA_OT_rigify_bone_group_remove) - bpy.utils.unregister_class(DATA_OT_rigify_bone_group_remove_all) - bpy.utils.unregister_class(DATA_UL_rigify_bone_groups) - bpy.utils.unregister_class(DATA_MT_rigify_bone_groups_specials) - bpy.utils.unregister_class(DATA_PT_rigify_bone_groups) - bpy.utils.unregister_class(DATA_PT_rigify_layer_names) - bpy.utils.unregister_class(DATA_PT_rigify_buttons) - bpy.utils.unregister_class(BONE_PT_rigify_buttons) - bpy.utils.unregister_class(VIEW3D_PT_rigify_animation_tools) - bpy.utils.unregister_class(VIEW3D_PT_tools_rigify_dev) - bpy.utils.unregister_class(LayerInit) - bpy.utils.unregister_class(Generate) - bpy.utils.unregister_class(UpgradeMetarigTypes) - bpy.utils.unregister_class(SwitchToLegacy) - bpy.utils.unregister_class(Sample) - bpy.utils.unregister_class(EncodeMetarig) - bpy.utils.unregister_class(EncodeMetarigSample) - bpy.utils.unregister_class(EncodeWidget) - bpy.utils.unregister_class(OBJECT_OT_GetFrameRange) - bpy.utils.unregister_class(OBJECT_OT_FK2IK) - bpy.utils.unregister_class(OBJECT_OT_IK2FK) - bpy.utils.unregister_class(OBJECT_OT_TransferFKtoIK) - bpy.utils.unregister_class(OBJECT_OT_TransferIKtoFK) - bpy.utils.unregister_class(OBJECT_OT_ClearAnimation) - bpy.utils.unregister_class(OBJECT_OT_Rot2Pole) - + # Sub-modules. rot_mode.unregister() + # Classes. + for cls in classes: + unregister_class(cls) diff --git a/rigify/utils.py b/rigify/utils.py index 876ee0d3..51b432b9 100644 --- a/rigify/utils.py +++ b/rigify/utils.py @@ -1026,11 +1026,11 @@ def write_metarig(obj, layers=False, func_name="create", groups=False): for i in range(len(arm.rigify_layers)): name = arm.rigify_layers[i].name row = arm.rigify_layers[i].row - set = arm.rigify_layers[i].set + selset = arm.rigify_layers[i].selset group = arm.rigify_layers[i].group code.append(' arm.rigify_layers[' + str(i) + '].name = "' + name + '"') code.append(' arm.rigify_layers[' + str(i) + '].row = ' + str(row)) - code.append(' arm.rigify_layers[' + str(i) + '].set = ' + str(set)) + code.append(' arm.rigify_layers[' + str(i) + '].selset = ' + str(selset)) code.append(' arm.rigify_layers[' + str(i) + '].group = ' + str(group)) # write parents first diff --git a/space_view3d_copy_attributes.py b/space_view3d_copy_attributes.py index 7e810da1..4e2bbb03 100644 --- a/space_view3d_copy_attributes.py +++ b/space_view3d_copy_attributes.py @@ -22,7 +22,7 @@ bl_info = { "name": "Copy Attributes Menu", "author": "Bassam Kurdali, Fabian Fricke, Adam Wiseman", "version": (0, 4, 8), - "blender": (2, 63, 0), + "blender": (2, 80, 0), "location": "View3D > Ctrl-C", "description": "Copy Attributes Menu from Blender 2.4", "wiki_url": "https://wiki.blender.org/index.php/Extensions:2.6/Py/" @@ -33,13 +33,13 @@ bl_info = { import bpy from mathutils import Matrix from bpy.types import ( - Operator, - Menu, - ) + Operator, + Menu, +) from bpy.props import ( - BoolVectorProperty, - StringProperty, - ) + BoolVectorProperty, + StringProperty, +) # First part of the operator Info message INFO_MESSAGE = "Copy Attributes: " @@ -82,7 +82,7 @@ def genops(copylist, oplist, prefix, poll_func, loopfunc): exec_func = build_exec(loopfunc, op[3]) invoke_func = build_invoke(loopfunc, op[3]) opclass = build_op(prefix + op[0], "Copy " + op[1], op[2], - poll_func, exec_func, invoke_func) + poll_func, exec_func, invoke_func) oplist.append(opclass) @@ -112,11 +112,11 @@ def getmat(bone, active, context, ignoreparent): else: parentposemat = parentbonemat = Matrix() if parentbonemat == parentposemat or ignoreparent: - newmat = bonemat_local.inverted() * otherloc + newmat = bonemat_local.inverted() @ otherloc else: - bonemat = parentbonemat.inverted() * bonemat_local + bonemat = parentbonemat.inverted() @ bonemat_local - newmat = bonemat.inverted() * parentposemat.inverted() * otherloc + newmat = bonemat.inverted() @ parentposemat.inverted() @ otherloc return newmat @@ -161,13 +161,13 @@ def pVisLocExec(bone, active, context): def pVisRotExec(bone, active, context): rotcopy(bone, getmat(bone, active, - context, not context.active_object.data.bones[bone.name].use_inherit_rotation)) + context, not context.active_object.data.bones[bone.name].use_inherit_rotation)) def pVisScaExec(bone, active, context): bone.scale = getmat(bone, active, context, - not context.active_object.data.bones[bone.name].use_inherit_scale)\ - .to_scale() + not context.active_object.data.bones[bone.name].use_inherit_scale)\ + .to_scale() def pDrwExec(bone, active, context): @@ -207,29 +207,29 @@ def pBBonesExec(bone, active, context): pose_copies = ( - ('pose_loc_loc', "Local Location", - "Copy Location from Active to Selected", pLocLocExec), - ('pose_loc_rot', "Local Rotation", - "Copy Rotation from Active to Selected", pLocRotExec), - ('pose_loc_sca', "Local Scale", - "Copy Scale from Active to Selected", pLocScaExec), - ('pose_vis_loc', "Visual Location", - "Copy Location from Active to Selected", pVisLocExec), - ('pose_vis_rot', "Visual Rotation", - "Copy Rotation from Active to Selected", pVisRotExec), - ('pose_vis_sca', "Visual Scale", - "Copy Scale from Active to Selected", pVisScaExec), - ('pose_drw', "Bone Shape", - "Copy Bone Shape from Active to Selected", pDrwExec), - ('pose_lok', "Protected Transform", - "Copy Protected Tranforms from Active to Selected", pLokExec), - ('pose_con', "Bone Constraints", - "Copy Object Constraints from Active to Selected", pConExec), - ('pose_iks', "IK Limits", - "Copy IK Limits from Active to Selected", pIKsExec), - ('bbone_settings', "BBone Settings", - "Copy BBone Settings from Active to Selected", pBBonesExec), - ) + ('pose_loc_loc', "Local Location", + "Copy Location from Active to Selected", pLocLocExec), + ('pose_loc_rot', "Local Rotation", + "Copy Rotation from Active to Selected", pLocRotExec), + ('pose_loc_sca', "Local Scale", + "Copy Scale from Active to Selected", pLocScaExec), + ('pose_vis_loc', "Visual Location", + "Copy Location from Active to Selected", pVisLocExec), + ('pose_vis_rot', "Visual Rotation", + "Copy Rotation from Active to Selected", pVisRotExec), + ('pose_vis_sca', "Visual Scale", + "Copy Scale from Active to Selected", pVisScaExec), + ('pose_drw', "Bone Shape", + "Copy Bone Shape from Active to Selected", pDrwExec), + ('pose_lok', "Protected Transform", + "Copy Protected Tranforms from Active to Selected", pLokExec), + ('pose_con', "Bone Constraints", + "Copy Object Constraints from Active to Selected", pConExec), + ('pose_iks', "IK Limits", + "Copy IK Limits from Active to Selected", pIKsExec), + ('bbone_settings', "BBone Settings", + "Copy BBone Settings from Active to Selected", pBBonesExec), +) @classmethod @@ -248,10 +248,10 @@ class CopySelectedPoseConstraints(Operator): bl_idname = "pose.copy_selected_constraints" bl_label = "Copy Selected Constraints" - selection = BoolVectorProperty( - size=32, - options={'SKIP_SAVE'} - ) + selection: BoolVectorProperty( + size=32, + options={'SKIP_SAVE'} + ) poll = pose_poll_func invoke = pose_invoke_func @@ -260,7 +260,7 @@ class CopySelectedPoseConstraints(Operator): layout = self.layout for idx, const in enumerate(context.active_pose_bone.constraints): layout.prop(self, "selection", index=idx, text=const.name, - toggle=True) + toggle=True) def execute(self, context): active = context.active_pose_bone @@ -271,8 +271,8 @@ class CopySelectedPoseConstraints(Operator): if flag: old_constraint = active.constraints[index] new_constraint = bone.constraints.new( - active.constraints[index].type - ) + active.constraints[index].type + ) generic_copy(old_constraint, new_constraint) return {'FINISHED'} @@ -307,9 +307,9 @@ def obLoopExec(self, context, funk): def world_to_basis(active, ob, context): """put world coords of active as basis coords of ob""" - local = ob.parent.matrix_world.inverted() * active.matrix_world - P = ob.matrix_basis * ob.matrix_local.inverted() - mat = P * local + local = ob.parent.matrix_world.inverted() @ active.matrix_world + P = ob.matrix_basis @ ob.matrix_local.inverted() + mat = P @ local return(mat) @@ -356,17 +356,17 @@ def obVisSca(ob, active, context): def obDrw(ob, active, context): - ob.draw_type = active.draw_type + ob.display_type = active.display_type ob.show_axis = active.show_axis ob.show_bounds = active.show_bounds - ob.draw_bounds_type = active.draw_bounds_type + ob.display_bounds_type = active.display_bounds_type ob.show_name = active.show_name ob.show_texture_space = active.show_texture_space ob.show_transparent = active.show_transparent ob.show_wire = active.show_wire - ob.show_x_ray = active.show_x_ray - ob.empty_draw_type = active.empty_draw_type - ob.empty_draw_size = active.empty_draw_size + ob.show_in_front = active.show_in_front + ob.empty_display_type = active.empty_display_type + ob.empty_display_size = active.empty_display_size def obOfs(ob, active, context): @@ -383,11 +383,6 @@ def obCol(ob, active, context): ob.color = active.color -def obMas(ob, active, context): - ob.game.mass = active.game.mass - return('INFO', "Mass copied") - - def obLok(ob, active, context): for index, state in enumerate(active.lock_location): ob.lock_location[index] = state @@ -430,7 +425,7 @@ def obMod(ob, active, context): ob.modifiers.remove(modifier) for old_modifier in active.modifiers.values(): new_modifier = ob.modifiers.new(name=old_modifier.name, - type=old_modifier.type) + type=old_modifier.type) generic_copy(old_modifier, new_modifier) return('INFO', "Modifiers copied") @@ -484,62 +479,60 @@ def obWei(ob, active, context): for vgs in range(0, len(groups)): if groups[vgs].name == groupName: groups[vgs].add((v.index,), - vgroupIndex_weight[i][1], "REPLACE") + vgroupIndex_weight[i][1], "REPLACE") return('INFO', "Weights copied") object_copies = ( - # ('obj_loc', "Location", - # "Copy Location from Active to Selected", obLoc), - # ('obj_rot', "Rotation", - # "Copy Rotation from Active to Selected", obRot), - # ('obj_sca', "Scale", - # "Copy Scale from Active to Selected", obSca), - ('obj_vis_loc', "Location", - "Copy Location from Active to Selected", obVisLoc), - ('obj_vis_rot', "Rotation", - "Copy Rotation from Active to Selected", obVisRot), - ('obj_vis_sca', "Scale", - "Copy Scale from Active to Selected", obVisSca), - ('obj_drw', "Draw Options", - "Copy Draw Options from Active to Selected", obDrw), - ('obj_ofs', "Time Offset", - "Copy Time Offset from Active to Selected", obOfs), - ('obj_dup', "Dupli", - "Copy Dupli from Active to Selected", obDup), - ('obj_col', "Object Color", - "Copy Object Color from Active to Selected", obCol), - ('obj_mas', "Mass", - "Copy Mass from Active to Selected", obMas), - # ('obj_dmp', "Damping", - # "Copy Damping from Active to Selected"), - # ('obj_all', "All Physical Attributes", - # "Copy Physical Attributes from Active to Selected"), - # ('obj_prp', "Properties", - # "Copy Properties from Active to Selected"), - # ('obj_log', "Logic Bricks", - # "Copy Logic Bricks from Active to Selected"), - ('obj_lok', "Protected Transform", - "Copy Protected Tranforms from Active to Selected", obLok), - ('obj_con', "Object Constraints", - "Copy Object Constraints from Active to Selected", obCon), - # ('obj_nla', "NLA Strips", - # "Copy NLA Strips from Active to Selected"), - # ('obj_tex', "Texture Space", - # "Copy Texture Space from Active to Selected", obTex), - # ('obj_sub', "Subsurf Settings", - # "Copy Subsurf Setings from Active to Selected"), - # ('obj_smo', "AutoSmooth", - # "Copy AutoSmooth from Active to Selected"), - ('obj_idx', "Pass Index", - "Copy Pass Index from Active to Selected", obIdx), - ('obj_mod', "Modifiers", - "Copy Modifiers from Active to Selected", obMod), - ('obj_wei', "Vertex Weights", - "Copy vertex weights based on indices", obWei), - ('obj_grp', "Group Links", - "Copy selected into active object's groups", obGrp) - ) + # ('obj_loc', "Location", + # "Copy Location from Active to Selected", obLoc), + # ('obj_rot', "Rotation", + # "Copy Rotation from Active to Selected", obRot), + # ('obj_sca', "Scale", + # "Copy Scale from Active to Selected", obSca), + ('obj_vis_loc', "Location", + "Copy Location from Active to Selected", obVisLoc), + ('obj_vis_rot', "Rotation", + "Copy Rotation from Active to Selected", obVisRot), + ('obj_vis_sca', "Scale", + "Copy Scale from Active to Selected", obVisSca), + ('obj_drw', "Draw Options", + "Copy Draw Options from Active to Selected", obDrw), + ('obj_ofs', "Time Offset", + "Copy Time Offset from Active to Selected", obOfs), + ('obj_dup', "Dupli", + "Copy Dupli from Active to Selected", obDup), + ('obj_col', "Object Color", + "Copy Object Color from Active to Selected", obCol), + # ('obj_dmp', "Damping", + # "Copy Damping from Active to Selected"), + # ('obj_all', "All Physical Attributes", + # "Copy Physical Attributes from Active to Selected"), + # ('obj_prp', "Properties", + # "Copy Properties from Active to Selected"), + # ('obj_log', "Logic Bricks", + # "Copy Logic Bricks from Active to Selected"), + ('obj_lok', "Protected Transform", + "Copy Protected Tranforms from Active to Selected", obLok), + ('obj_con', "Object Constraints", + "Copy Object Constraints from Active to Selected", obCon), + # ('obj_nla', "NLA Strips", + # "Copy NLA Strips from Active to Selected"), + # ('obj_tex', "Texture Space", + # "Copy Texture Space from Active to Selected", obTex), + # ('obj_sub', "Subsurf Settings", + # "Copy Subsurf Setings from Active to Selected"), + # ('obj_smo', "AutoSmooth", + # "Copy AutoSmooth from Active to Selected"), + ('obj_idx', "Pass Index", + "Copy Pass Index from Active to Selected", obIdx), + ('obj_mod', "Modifiers", + "Copy Modifiers from Active to Selected", obMod), + ('obj_wei', "Vertex Weights", + "Copy vertex weights based on indices", obWei), + ('obj_grp', "Group Links", + "Copy selected into active object's groups", obGrp) +) @classmethod @@ -558,10 +551,10 @@ class CopySelectedObjectConstraints(Operator): bl_idname = "object.copy_selected_constraints" bl_label = "Copy Selected Constraints" - selection = BoolVectorProperty( - size=32, - options={'SKIP_SAVE'} - ) + selection: BoolVectorProperty( + size=32, + options={'SKIP_SAVE'} + ) poll = object_poll_func invoke = object_invoke_func @@ -570,7 +563,7 @@ class CopySelectedObjectConstraints(Operator): layout = self.layout for idx, const in enumerate(context.active_object.constraints): layout.prop(self, "selection", index=idx, text=const.name, - toggle=True) + toggle=True) def execute(self, context): active = context.active_object @@ -581,8 +574,8 @@ class CopySelectedObjectConstraints(Operator): if flag: old_constraint = active.constraints[index] new_constraint = obj.constraints.new( - active.constraints[index].type - ) + active.constraints[index].type + ) generic_copy(old_constraint, new_constraint) return{'FINISHED'} @@ -592,10 +585,10 @@ class CopySelectedObjectModifiers(Operator): bl_idname = "object.copy_selected_modifiers" bl_label = "Copy Selected Modifiers" - selection = BoolVectorProperty( - size=32, - options={'SKIP_SAVE'} - ) + selection: BoolVectorProperty( + size=32, + options={'SKIP_SAVE'} + ) poll = object_poll_func invoke = object_invoke_func @@ -604,7 +597,7 @@ class CopySelectedObjectModifiers(Operator): layout = self.layout for idx, const in enumerate(context.active_object.modifiers): layout.prop(self, 'selection', index=idx, text=const.name, - toggle=True) + toggle=True) def execute(self, context): active = context.active_object @@ -615,9 +608,9 @@ class CopySelectedObjectModifiers(Operator): if flag: old_modifier = active.modifiers[index] new_modifier = obj.modifiers.new( - type=active.modifiers[index].type, - name=active.modifiers[index].name - ) + type=active.modifiers[index].type, + name=active.modifiers[index].name + ) generic_copy(old_modifier, new_modifier) return{'FINISHED'} @@ -669,23 +662,23 @@ class MESH_MT_CopyFaceSettings(Menu): layout.separator() op = layout.operator(MESH_OT_CopyFaceSettings.bl_idname, - text="Copy Material") + text="Copy Material") op['layer'] = '' op['mode'] = 'MAT' if mesh.uv_textures.active: op = layout.operator(MESH_OT_CopyFaceSettings.bl_idname, - text="Copy Active UV Image") + text="Copy Active UV Image") op['layer'] = '' op['mode'] = 'IMAGE' op = layout.operator(MESH_OT_CopyFaceSettings.bl_idname, - text="Copy Active UV Coords") + text="Copy Active UV Coords") op['layer'] = '' op['mode'] = 'UV' if mesh.vertex_colors.active: op = layout.operator(MESH_OT_CopyFaceSettings.bl_idname, - text="Copy Active Vertex Colors") + text="Copy Active Vertex Colors") op['layer'] = '' op['mode'] = 'VCOL' @@ -709,7 +702,7 @@ class MESH_MT_CopyImagesFromLayer(Menu): def poll(cls, context): obj = context.active_object return obj and obj.mode == "EDIT_MESH" and len( - obj.data.uv_layers) > 1 + obj.data.uv_layers) > 1 def draw(self, context): mesh = context.active_object.data @@ -723,7 +716,7 @@ class MESH_MT_CopyUVCoordsFromLayer(Menu): def poll(cls, context): obj = context.active_object return obj and obj.mode == "EDIT_MESH" and len( - obj.data.uv_layers) > 1 + obj.data.uv_layers) > 1 def draw(self, context): mesh = context.active_object.data @@ -737,7 +730,7 @@ class MESH_MT_CopyVertexColorsFromLayer(Menu): def poll(cls, context): obj = context.active_object return obj and obj.mode == "EDIT_MESH" and len( - obj.data.vertex_colors) > 1 + obj.data.vertex_colors) > 1 def draw(self, context): mesh = context.active_object.data @@ -764,14 +757,14 @@ class MESH_OT_CopyFaceSettings(Operator): bl_label = "Copy Face Settings" bl_options = {'REGISTER', 'UNDO'} - mode = StringProperty( - name="Mode", - options={"HIDDEN"}, - ) - layer = StringProperty( - name="Layer", - options={"HIDDEN"}, - ) + mode: StringProperty( + name="Mode", + options={"HIDDEN"}, + ) + layer: StringProperty( + name="Layer", + options={"HIDDEN"}, + ) @classmethod def poll(cls, context): @@ -843,8 +836,25 @@ class MESH_OT_CopyFaceSettings(Operator): return(retval) +classes = ( + CopySelectedPoseConstraints, + VIEW3D_MT_posecopypopup, + CopySelectedObjectConstraints, + CopySelectedObjectModifiers, + VIEW3D_MT_copypopup, + MESH_MT_CopyFaceSettings, + MESH_MT_CopyImagesFromLayer, + MESH_MT_CopyUVCoordsFromLayer, + MESH_MT_CopyVertexColorsFromLayer, + MESH_OT_CopyFaceSettings, + *pose_ops, + *object_ops, +) + def register(): - bpy.utils.register_module(__name__) + from bpy.utils import register_class + for cls in classes: + register_class(cls) # mostly to get the keymap working kc = bpy.context.window_manager.keyconfigs.addon @@ -893,7 +903,9 @@ def unregister(): if kmi.properties.name == 'VIEW3D_MT_copypopup': km.keymap_items.remove(kmi) - bpy.utils.unregister_module(__name__) + from bpy.utils import unregister_class + for cls in classes: + unregister_class(cls) if __name__ == "__main__": diff --git a/space_view3d_display_tools/__init__.py b/space_view3d_display_tools/__init__.py index 58699f98..9aa53a31 100644 --- a/space_view3d_display_tools/__init__.py +++ b/space_view3d_display_tools/__init__.py @@ -80,7 +80,7 @@ class DisplayToolsPanel(Panel): bl_category = "Display" bl_options = {'DEFAULT_CLOSED'} - draw_type_icons = { + display_type_icons = { 'BOUNDS': 'BBOX', 'WIRE': 'WIRE', 'SOLID': 'SOLID', @@ -142,7 +142,7 @@ class DisplayToolsPanel(Panel): col.prop(view, "show_all_objects_origin", toggle=True) col.prop(view, "show_backface_culling", toggle=True) if obj: - col.prop(obj, "show_x_ray", text="X-Ray", toggle=True) + col.prop(obj, "show_in_front", text="X-Ray", toggle=True) if obj and obj_type == 'MESH': col.prop(obj, "show_transparent", text="Transparency", toggle=True) @@ -176,8 +176,8 @@ class DisplayToolsPanel(Panel): if obj: col = layout.column(align=True) col.alignment = 'EXPAND' - col.label(text="Maximum:") - col.prop(obj, "draw_type", text="", icon=self.draw_type_icons[obj.draw_type]) + col.label(text="Display As:") + col.prop(obj, "display_type", text="", icon=self.display_type_icons[obj.display_type]) col = layout.column(align=True) col.alignment = 'CENTER' diff --git a/space_view3d_display_tools/display.py b/space_view3d_display_tools/display.py index d0310ee8..6c1c6796 100644 --- a/space_view3d_display_tools/display.py +++ b/space_view3d_display_tools/display.py @@ -82,10 +82,10 @@ class DisplayDrawChange(Operator, BasePollCheck): if not selection: for obj in bpy.data.objects: - obj.draw_type = self.drawing + obj.display_type = self.drawing else: for obj in selection: - obj.draw_type = self.drawing + obj.display_type = self.drawing except: self.report({'ERROR'}, "Setting Draw Type could not be applied") return {'CANCELLED'} @@ -110,12 +110,12 @@ class DisplayBoundsSwitch(Operator, BasePollCheck): for obj in bpy.data.objects: obj.show_bounds = self.bounds if self.bounds: - obj.draw_bounds_type = scene.BoundingMode + obj.display_bounds_type = scene.BoundingMode else: for obj in selection: obj.show_bounds = self.bounds if self.bounds: - obj.draw_bounds_type = scene.BoundingMode + obj.display_bounds_type = scene.BoundingMode except: self.report({'ERROR'}, "Display/Hide Bounding box overlay failed") return {'CANCELLED'} @@ -164,10 +164,10 @@ class DisplayXRayOn(Operator, BasePollCheck): if not selection: for obj in bpy.data.objects: - obj.show_x_ray = self.xrays + obj.show_in_front = self.xrays else: for obj in selection: - obj.show_x_ray = self.xrays + obj.show_in_front = self.xrays except: self.report({'ERROR'}, "Turn on/off X-ray mode failed") return {'CANCELLED'} diff --git a/space_view3d_display_tools/fast_navigate.py b/space_view3d_display_tools/fast_navigate.py index 269aec2c..5d61138a 100644 --- a/space_view3d_display_tools/fast_navigate.py +++ b/space_view3d_display_tools/fast_navigate.py @@ -43,14 +43,14 @@ def display_particles(mode, dis_particles): for particles in bpy.data.particles: if scene.ShowParticles is False: - particles.draw_method = 'NONE' + particles.display_method = 'NONE' else: if particles.type == 'EMITTER': - particles.draw_method = 'DOT' - particles.draw_percentage = 100 + particles.display_method = 'DOT' + particles.display_percentage = 100 else: - particles.draw_method = 'RENDER' - particles.draw_percentage = dis_particles + particles.display_method = 'RENDER' + particles.display_percentage = dis_particles return dis_particles @@ -149,15 +149,15 @@ class FastNavigate(Operator): self.store_viewport_shade = shade for particle in bpy.data.particles: self.store_init_particles[particle.name] = \ - [particle.draw_method, particle.draw_percentage] + [particle.display_method, particle.display_percentage] else: if not shade: self.store_fail = True else: shade = self.store_viewport_shade or 'SOLID' for particle in bpy.data.particles: - particle.draw_method = self.store_init_particles[particle.name][0] - particle.draw_percentage = self.store_init_particles[particle.name][1] + particle.display_method = self.store_init_particles[particle.name][0] + particle.display_percentage = self.store_init_particles[particle.name][1] except: self.store_fail = True diff --git a/space_view3d_display_tools/select_tools.py b/space_view3d_display_tools/select_tools.py index eb5c0aaa..b53c6da2 100644 --- a/space_view3d_display_tools/select_tools.py +++ b/space_view3d_display_tools/select_tools.py @@ -65,7 +65,7 @@ class ShowHideObject(Operator): i.hide = True i.select = False - if i.type not in ['CAMERA', 'LAMP']: + if i.type not in ['CAMERA', 'LIGHT']: i.hide_render = True except: continue @@ -103,7 +103,7 @@ class HideAllObjects(Operator): i.hide = True i.select = False - if i.type not in ['CAMERA', 'LAMP']: + if i.type not in ['CAMERA', 'LIGHT']: i.hide_render = True else: obj_name = context.object.name @@ -113,7 +113,7 @@ class HideAllObjects(Operator): i.hide = True i.select = False - if i.type not in ['CAMERA', 'LAMP']: + if i.type not in ['CAMERA', 'LIGHT']: i.hide_render = True return {'FINISHED'} @@ -232,11 +232,11 @@ class OBJECT_OT_HideShowByTypeTemplate(): ('LATTICE', 'Lattice', ''), ('EMPTY', 'Empty', ''), ('CAMERA', 'Camera', ''), - ('LAMP', 'Lamp', ''), + ('LIGHT', 'Lamp', ''), ('ALL', 'All', '')), name="Type", description="Type", - default='LAMP', + default='LIGHT', options={'ANIMATABLE'} ) diff --git a/space_view3d_display_tools/selection_restrictor.py b/space_view3d_display_tools/selection_restrictor.py index feb3b8b8..71561bfe 100644 --- a/space_view3d_display_tools/selection_restrictor.py +++ b/space_view3d_display_tools/selection_restrictor.py @@ -45,7 +45,7 @@ curve = 'OUTLINER_OB_CURVE' arm = 'OUTLINER_OB_ARMATURE' empty = 'OUTLINER_OB_EMPTY' cam = 'OUTLINER_OB_CAMERA' -lamp = 'OUTLINER_OB_LAMP' +lamp = 'OUTLINER_OB_LIGHT' lat = 'OUTLINER_OB_LATTICE' font = 'OUTLINER_OB_FONT' meta = 'OUTLINER_OB_META' @@ -135,10 +135,10 @@ def check_restrictors(dummy): # lamp if bpy.context.scene.get('lamprestrictor') is None: lamprestrictorenabled = True - lamp = 'OUTLINER_OB_LAMP' + lamp = 'OUTLINER_OB_LIGHT' else: lamprestrictorenabled = False - lamp = 'LAMP_DATA' + lamp = 'LIGHT_DATA' # lattice if bpy.context.scene.get('latrestrictor') is None: @@ -408,7 +408,7 @@ class RestrictorCam(Operator): # Restrictor for Lamps class RestrictorLamp(Operator): - bl_idname = "restrictor.lamp" + bl_idname = "restrictor.light" bl_label = "Restrictor Lamps" bl_option = {'REGISTER', 'UNDO'} bl_description = "Lamps selection restrictor" @@ -421,18 +421,18 @@ class RestrictorLamp(Operator): lamprestrictorenabled = True if bpy.context.scene.get('lamprestrictor') is not None: del bpy.context.scene['lamprestrictor'] - lamp = 'OUTLINER_OB_LAMP' + lamp = 'OUTLINER_OB_LIGHT' for ob in bpy.context.scene.objects: - if ob.type == 'LAMP': + if ob.type == 'LIGHT': if ob.get('ignore_restrictors') is None: ob.hide_select = False else: lamprestrictorenabled = False bpy.context.scene['lamprestrictor'] = 1 - lamp = 'LAMP_DATA' + lamp = 'LIGHT_DATA' for ob in bpy.context.scene.objects: - if ob.type == 'LAMP': + if ob.type == 'LIGHT': if ob.get('ignore_restrictors') is None: ob.hide_select = True ob.select = False @@ -638,7 +638,7 @@ class RefreshRestrictors(Operator): 'armrestrictor': ("OUTLINER_OB_ARMATURE", "ARMATURE_DATA", "ARMATURE"), 'emptyrestrictor': ("OUTLINER_OB_EMPTY", "EMPTY_DATA", "EMPTY"), 'camrestrictor': ("OUTLINER_OB_CAMERA", "CAMERA_DATA", "CAMERA"), - 'lamprestrictor': ("OUTLINER_OB_LAMP", "LAMP_DATA", "LAMP"), + 'lamprestrictor': ("OUTLINER_OB_LIGHT", "LIGHT_DATA", "LIGHT"), 'latrestrictor': ("OUTLINER_OB_LATTICE", "LATTICE", "LATTICE"), 'fontrestrictor': ("OUTLINER_OB_FONT", "FONT", "FONT"), 'metarestrictor': ("OUTLINER_OB_META", "META_DATA", "META"), @@ -664,7 +664,7 @@ class RefreshRestrictors(Operator): arm = gl_icon if types == "ARMATURE" else arm empty = gl_icon if types == "EMPTY" else empty cam = gl_icon if types == "CAMERA" else cam - lamp = gl_icon if types == "LAMP" else lamp + lamp = gl_icon if types == "LIGHT" else lamp lat = gl_icon if types == "LATTICE" else lat font = gl_icon if types == "FONT" else font meta = gl_icon if types == "META" else meta @@ -701,7 +701,7 @@ class RestrictorSelection(Menu): layout.operator("restrictor.arm", icon=arm, text="Armature") layout.operator("restrictor.empty", icon=empty, text="Empty") layout.operator("restrictor.cam", icon=cam, text="Camera") - layout.operator("restrictor.lamp", icon=lamp, text="Lamp") + layout.operator("restrictor.light", icon=lamp, text="Lamp") layout.operator("restrictor.lat", icon=lat, text="Lattice") layout.operator("restrictor.font", icon=font, text="Font") layout.operator("restrictor.meta", icon=meta, text="MetaBall") diff --git a/space_view3d_display_tools/useless_tools.py b/space_view3d_display_tools/useless_tools.py index 512fcf2d..22931423 100644 --- a/space_view3d_display_tools/useless_tools.py +++ b/space_view3d_display_tools/useless_tools.py @@ -204,7 +204,7 @@ class UTSubsurfHideSelAll(Operator): objects = bpy.context.selected_objects if self.selected else bpy.data.objects for e in objects: try: - if e.type not in {"LAMP", "CAMERA", "EMPTY"}: + if e.type not in {"LIGHT", "CAMERA", "EMPTY"}: e.modifiers['Subsurf'].show_viewport = self.show except Exception as k: name = getattr(e, "name", "Nameless") @@ -233,7 +233,7 @@ class UTOptimalDisplaySelAll(Operator): objects = bpy.context.selected_objects if self.selected else bpy.data.objects for e in objects: try: - if e.type not in {"LAMP", "CAMERA", "EMPTY"}: + if e.type not in {"LIGHT", "CAMERA", "EMPTY"}: e.modifiers['Subsurf'].show_only_control_edges = self.on except Exception as k: name = getattr(e, "name", "Nameless") diff --git a/space_view3d_pie_menus/__init__.py b/space_view3d_pie_menus/__init__.py index 486d538f..e725995f 100644 --- a/space_view3d_pie_menus/__init__.py +++ b/space_view3d_pie_menus/__init__.py @@ -21,20 +21,20 @@ import bpy from bpy.props import ( - BoolProperty, - PointerProperty, - ) + BoolProperty, + PointerProperty, +) from bpy.types import ( - PropertyGroup, - AddonPreferences, - ) + PropertyGroup, + AddonPreferences, +) bl_info = { "name": "3D Viewport Pie Menus", "author": "meta-androcto, pitiwazou, chromoly, italic", "version": (1, 1, 8), - "blender": (2, 7, 7), + "blender": (2, 80, 0), "description": "Individual Pie Menu Activation List", "location": "Addons Preferences", "warning": "", @@ -149,32 +149,32 @@ def disable_all_modules(self, context): class PieToolsPreferences(AddonPreferences): bl_idname = __name__ - enable_all = BoolProperty( - name="Enable all", - description="Enable all Pie Modules", - default=False, - update=enable_all_modules - ) - disable_all = BoolProperty( - name="Disable all", - description="Disable all Pie Modules", - default=False, - update=disable_all_modules - ) + enable_all: BoolProperty( + name="Enable all", + description="Enable all Pie Modules", + default=False, + update=enable_all_modules + ) + disable_all: BoolProperty( + name="Disable all", + description="Disable all Pie Modules", + default=False, + update=disable_all_modules + ) def draw(self, context): layout = self.layout - split = layout.split(percentage=0.5, align=True) + split = layout.split(factor=0.5, align=True) row = split.row() row.alignment = "LEFT" sub_box = row.box() sub_box.prop(self, "enable_all", emboss=False, icon="VISIBLE_IPO_ON", icon_only=True) - row.label("Enable All") + row.label(text="Enable All") row = split.row() row.alignment = "RIGHT" - row.label("Disable All") + row.label(text="Disable All") sub_box = row.box() sub_box.prop(self, "disable_all", emboss=False, icon="VISIBLE_IPO_OFF", icon_only=True) @@ -195,42 +195,42 @@ class PieToolsPreferences(AddonPreferences): op = sub.operator('wm.context_toggle', text='', icon=icon, emboss=False) op.data_path = 'addon_prefs.show_expanded_' + mod_name - sub.label('{}: {}'.format(info['category'], info['name'])) + sub.label(text='{}: {}'.format(info['category'], info['name'])) sub = row.row() sub.alignment = 'RIGHT' if info.get('warning'): - sub.label('', icon='ERROR') + sub.label(text='', icon='ERROR') sub.prop(self, 'use_' + mod_name, text='') # The second stage if expand: if info.get('description'): - split = col.row().split(percentage=0.15) - split.label('Description:') - split.label(info['description']) + split = col.row().split(factor=0.15) + split.label(text='Description:') + split.label(text=info['description']) if info.get('location'): - split = col.row().split(percentage=0.15) - split.label('Location:') - split.label(info['location']) + split = col.row().split(factor=0.15) + split.label(text='Location:') + split.label(text=info['location']) """ if info.get('author'): - split = col.row().split(percentage=0.15) - split.label('Author:') + split = col.row().split(factor=0.15) + split.label(text='Author:') split.label(info['author']) """ if info.get('version'): - split = col.row().split(percentage=0.15) - split.label('Version:') - split.label('.'.join(str(x) for x in info['version']), + split = col.row().split(factor=0.15) + split.label(text='Version:') + split.label(text='.'.join(str(x) for x in info['version']), translate=False) if info.get('warning'): - split = col.row().split(percentage=0.15) - split.label('Warning:') - split.label(' ' + info['warning'], icon='ERROR') + split = col.row().split(factor=0.15) + split.label(text='Warning:') + split.label(text=' ' + info['warning'], icon='ERROR') tot_row = int(bool(info.get('wiki_url'))) if tot_row: - split = col.row().split(percentage=0.15) + split = col.row().split(factor=0.15) split.label(text='Internet:') if info.get('wiki_url'): op = split.operator('wm.url_open', @@ -274,17 +274,17 @@ for mod in sub_modules: return update prop = BoolProperty( - name=info['name'], - description=info.get('description', ''), - update=gen_update(mod), - ) + name=info['name'], + description=info.get('description', ''), + update=gen_update(mod), + ) setattr(PieToolsPreferences, 'use_' + mod_name, prop) prop = BoolProperty() setattr(PieToolsPreferences, 'show_expanded_' + mod_name, prop) classes = ( PieToolsPreferences, - ) +) def register(): diff --git a/space_view3d_pie_menus/pie_align_menu.py b/space_view3d_pie_menus/pie_align_menu.py index c8ce2e15..39315137 100644 --- a/space_view3d_pie_menus/pie_align_menu.py +++ b/space_view3d_pie_menus/pie_align_menu.py @@ -102,7 +102,7 @@ class AlignSelectedXYZ(Operator): bl_description = "Align Selected Along the chosen axis" bl_options = {'REGISTER', 'UNDO'} - axis = EnumProperty( + axis: EnumProperty( name="Axis", items=[ ('X', "X", "X Axis"), @@ -147,7 +147,7 @@ class AlignToXYZ0(Operator): bl_description = "Align Active Object To a chosen X, Y or Z equals 0 Location" bl_options = {'REGISTER', 'UNDO'} - axis = EnumProperty( + axis: EnumProperty( name="Axis", items=[ ('0', "X", "X Axis"), @@ -181,7 +181,7 @@ class AlignXYZAll(Operator): bl_description = "Align to a Front or Back along the chosen Axis" bl_options = {'REGISTER', 'UNDO'} - axis = EnumProperty( + axis: EnumProperty( name="Axis", items=[ ('0', "X", "X Axis"), @@ -191,7 +191,7 @@ class AlignXYZAll(Operator): description="Choose an axis for alignment", default='0' ) - side = EnumProperty( + side: EnumProperty( name="Side", items=[ ('POSITIVE', "Front", "Align on the positive chosen axis"), diff --git a/space_view3d_pie_menus/pie_apply_transform_menu.py b/space_view3d_pie_menus/pie_apply_transform_menu.py index 7eb0a3a9..362d9b1a 100644 --- a/space_view3d_pie_menus/pie_apply_transform_menu.py +++ b/space_view3d_pie_menus/pie_apply_transform_menu.py @@ -71,7 +71,7 @@ class ApplyTransLocRotPie(Operator): bl_description = "Apply Transform: Location, Rotation or Scale" bl_options = {'REGISTER', 'UNDO'} - option = EnumProperty( + option: EnumProperty( name="Type", items=[ ("LOC", "Location", "Apply Location"), diff --git a/space_view3d_pie_menus/pie_cursor.py b/space_view3d_pie_menus/pie_cursor.py index 568cdd6d..e598943f 100644 --- a/space_view3d_pie_menus/pie_cursor.py +++ b/space_view3d_pie_menus/pie_cursor.py @@ -69,7 +69,7 @@ class Snap_CursorMenu(Menu): icon='CLIPUV_HLT').use_offset = False # 6 - RIGHT pie.operator("view3d.snap_selected_to_cursor", - text="Selection to Cursor (Offset)", icon='CURSOR').use_offset = True + text="Selection to Cursor (Keep Offset)", icon='CURSOR').use_offset = True # 2 - BOTTOM pie.operator("view3d.snap_cursor_selected_to_center1", text="Selected & Cursor to Center", icon='ALIGN') diff --git a/space_view3d_pie_menus/pie_editor_switch_menu.py b/space_view3d_pie_menus/pie_editor_switch_menu.py index 67f40ff8..1e23bd49 100644 --- a/space_view3d_pie_menus/pie_editor_switch_menu.py +++ b/space_view3d_pie_menus/pie_editor_switch_menu.py @@ -41,7 +41,7 @@ from bpy.props import ( class AreaPieMenu(Menu): - bl_idname = "INFO_MT_window_pie" + bl_idname = "TOPBAR_MT_window_pie" bl_label = "Pie Menu" bl_description = "Window Pie Menus" @@ -87,7 +87,7 @@ class AreaPieEditor(Menu): class AreaTypePieOther(Menu): - bl_idname = "INFO_MT_window_pie_area_type_other" + bl_idname = "TOPBAR_MT_window_pie_area_type_other" bl_label = "Editor Type (other)" bl_description = "Is pie menu change editor type (other)" @@ -114,7 +114,7 @@ class SetAreaType(Operator): bl_description = "Change Editor Type" bl_options = {'REGISTER'} - types = StringProperty(name="Area Type") + types: StringProperty(name="Area Type") def execute(self, context): context.area.type = self.types @@ -122,7 +122,7 @@ class SetAreaType(Operator): class AreaTypePieAnim(Menu): - bl_idname = "INFO_MT_window_pie_area_type_anim" + bl_idname = "TOPBAR_MT_window_pie_area_type_anim" bl_label = "Editor Type (Animation)" bl_description = "Menu for changing editor type (animation related)" diff --git a/space_view3d_pie_menus/pie_manipulator_menu.py b/space_view3d_pie_menus/pie_manipulator_menu.py index 2690c094..3a599483 100644 --- a/space_view3d_pie_menus/pie_manipulator_menu.py +++ b/space_view3d_pie_menus/pie_manipulator_menu.py @@ -37,111 +37,6 @@ from bpy.types import ( ) -class ManipTranslate(Operator): - bl_idname = "manip.translate" - bl_label = "Manip Translate" - bl_options = {'REGISTER', 'UNDO'} - bl_description = " Show Translate" - - def execute(self, context): - if context.space_data.show_manipulator is False: - context.space_data.show_manipulator = True - context.space_data.transform_manipulators = {'TRANSLATE'} - if context.space_data.transform_manipulators != {'TRANSLATE'}: - context.space_data.transform_manipulators = {'TRANSLATE'} - return {'FINISHED'} - - -class ManipRotate(Operator): - bl_idname = "manip.rotate" - bl_label = "Manip Rotate" - bl_options = {'REGISTER', 'UNDO'} - bl_description = " Show Rotate" - - def execute(self, context): - if context.space_data.show_manipulator is False: - context.space_data.show_manipulator = True - context.space_data.transform_manipulators = {'ROTATE'} - if context.space_data.transform_manipulators != {'ROTATE'}: - context.space_data.transform_manipulators = {'ROTATE'} - return {'FINISHED'} - - -class ManipScale(Operator): - bl_idname = "manip.scale" - bl_label = "Manip Scale" - bl_options = {'REGISTER', 'UNDO'} - bl_description = " Show Scale" - - def execute(self, context): - if context.space_data.show_manipulator is False: - context.space_data.show_manipulator = True - context.space_data.transform_manipulators = {'SCALE'} - if context.space_data.transform_manipulators != {'SCALE'}: - context.space_data.transform_manipulators = {'SCALE'} - return {'FINISHED'} - - -class TranslateRotate(Operator): - bl_idname = "translate.rotate" - bl_label = "Translate Rotate" - bl_options = {'REGISTER', 'UNDO'} - bl_description = " Show Translate/Rotate" - - def execute(self, context): - if context.space_data.show_manipulator is False: - context.space_data.show_manipulator = True - context.space_data.transform_manipulators = {'TRANSLATE', 'ROTATE'} - if context.space_data.transform_manipulators != {'TRANSLATE', 'ROTATE'}: - context.space_data.transform_manipulators = {'TRANSLATE', 'ROTATE'} - return {'FINISHED'} - - -class TranslateScale(Operator): - bl_idname = "translate.scale" - bl_label = "Translate Scale" - bl_options = {'REGISTER', 'UNDO'} - bl_description = " Show Translate/Scale" - - def execute(self, context): - if context.space_data.show_manipulator is False: - context.space_data.show_manipulator = True - context.space_data.transform_manipulators = {'TRANSLATE', 'SCALE'} - if context.space_data.transform_manipulators != {'TRANSLATE', 'SCALE'}: - context.space_data.transform_manipulators = {'TRANSLATE', 'SCALE'} - return {'FINISHED'} - - -class RotateScale(Operator): - bl_idname = "rotate.scale" - bl_label = "Rotate Scale" - bl_options = {'REGISTER', 'UNDO'} - bl_description = " Show Rotate/Scale" - - def execute(self, context): - if context.space_data.show_manipulator is False: - context.space_data.show_manipulator = True - context.space_data.transform_manipulators = {'ROTATE', 'SCALE'} - if context.space_data.transform_manipulators != {'ROTATE', 'SCALE'}: - context.space_data.transform_manipulators = {'ROTATE', 'SCALE'} - return {'FINISHED'} - - -class TranslateRotateScale(Operator): - bl_idname = "translate.rotatescale" - bl_label = "Translate Rotate Scale" - bl_options = {'REGISTER', 'UNDO'} - bl_description = "Show All" - - def execute(self, context): - if context.space_data.show_manipulator is False: - context.space_data.show_manipulator = True - context.space_data.transform_manipulators = {'TRANSLATE', 'ROTATE', 'SCALE'} - if context.space_data.transform_manipulators != {'TRANSLATE', 'ROTATE', 'SCALE'}: - context.space_data.transform_manipulators = {'TRANSLATE', 'ROTATE', 'SCALE'} - return {'FINISHED'} - - class WManupulators(Operator): bl_idname = "w.manupulators" bl_label = "W Manupulators" @@ -168,32 +63,17 @@ class PieManipulator(Menu): layout = self.layout pie = layout.menu_pie() # 4 - LEFT - pie.operator("rotate.scale", text="Rotate/Scale") + pie.operator("wm.tool_set_by_name", text="Translate", icon='MAN_TRANS').name = "Move" # 6 - RIGHT - pie.operator("manip.rotate", text="Rotate", icon='MAN_ROT') + pie.operator("wm.tool_set_by_name", text="Scale", icon='MAN_SCALE').name = "Scale" # 2 - BOTTOM - pie.operator("translate.rotatescale", text="Translate/Rotate/Scale") + pie.operator("wm.tool_set_by_name", text="Rotate", icon='MAN_ROT').name = "Rotate" # 8 - TOP pie.operator("w.manupulators", text="Show/Hide Toggle", icon='MANIPUL') - # 7 - TOP - LEFT - pie.operator("translate.rotate", text="Translate/Rotate") - # 9 - TOP - RIGHT - pie.operator("manip.translate", text="Translate", icon='MAN_TRANS') - # 1 - BOTTOM - LEFT - pie.operator("translate.scale", text="Translate/Scale") - # 3 - BOTTOM - RIGHT - pie.operator("manip.scale", text="Scale", icon='MAN_SCALE') classes = ( PieManipulator, - ManipTranslate, - ManipRotate, - ManipScale, - TranslateRotate, - TranslateScale, - RotateScale, - TranslateRotateScale, WManupulators, ) diff --git a/space_view3d_pie_menus/pie_modes_menu.py b/space_view3d_pie_menus/pie_modes_menu.py index 40f6ba4a..74c0b79d 100644 --- a/space_view3d_pie_menus/pie_modes_menu.py +++ b/space_view3d_pie_menus/pie_modes_menu.py @@ -163,7 +163,7 @@ class SetObjectModePie(Operator): bl_description = "I set the interactive mode of object" bl_options = {'REGISTER'} - mode = bpy.props.StringProperty(name="Interactive mode", default="OBJECT") + mode: bpy.props.StringProperty(name="Interactive mode", default="OBJECT") def execute(self, context): if (context.active_object): @@ -429,7 +429,7 @@ class PieObjectEditMode(Menu): pie.operator("view3d.pie_interactive_mode_grease_pencil", icon="GREASEPENCIL") else: message = "Active Object has only Object Mode available" if ob \ - and ob.type in {"LAMP", "CAMERA", "EMPTY", "SPEAKER"} else \ + and ob.type in {"LIGHT", "CAMERA", "EMPTY", "SPEAKER"} else \ "No active object found. Please select one first" pie = layout.menu_pie() pie.separator() diff --git a/space_view3d_pie_menus/pie_orientation_menu.py b/space_view3d_pie_menus/pie_orientation_menu.py index a9de9fa6..ea90862a 100644 --- a/space_view3d_pie_menus/pie_orientation_menu.py +++ b/space_view3d_pie_menus/pie_orientation_menu.py @@ -44,7 +44,7 @@ class OrientPoll(Operator): bl_label = "Orientation Poll" bl_options = {'INTERNAL'} - space = StringProperty() + space: StringProperty() @classmethod def poll(cls, context): diff --git a/space_view3d_pie_menus/pie_save_open_menu.py b/space_view3d_pie_menus/pie_save_open_menu.py index bdd9b63c..8b7e56e0 100644 --- a/space_view3d_pie_menus/pie_save_open_menu.py +++ b/space_view3d_pie_menus/pie_save_open_menu.py @@ -97,9 +97,9 @@ class pie_fileio(Menu): layout = self.layout pie = layout.menu_pie() box = pie.split().column() - box.menu("INFO_MT_file_import", icon='IMPORT') + box.menu("TOPBAR_MT_file_import", icon='IMPORT') box.separator() - box.menu("INFO_MT_file_export", icon='EXPORT') + box.menu("TOPBAR_MT_file_export", icon='EXPORT') class ExternalData(Menu): diff --git a/space_view3d_pie_menus/pie_snap_menu.py b/space_view3d_pie_menus/pie_snap_menu.py index b5ca502c..19b4464f 100644 --- a/space_view3d_pie_menus/pie_snap_menu.py +++ b/space_view3d_pie_menus/pie_snap_menu.py @@ -185,7 +185,8 @@ class SnapTargetVariable(Operator): bl_idname = "object.snaptargetvariable" bl_label = "Snap Target Variable" bl_options = {'REGISTER', 'UNDO'} - variable = bpy.props.StringProperty() + + variable: bpy.props.StringProperty() @classmethod def poll(cls, context): diff --git a/space_view3d_spacebar_menu.py b/space_view3d_spacebar_menu.py index e183e075..a470571e 100644 --- a/space_view3d_spacebar_menu.py +++ b/space_view3d_spacebar_menu.py @@ -121,7 +121,7 @@ class VIEW3D_MT_Space_Dynamic_Menu(Menu): layout.menu("VIEW3D_MT_Select_Edit_Mesh", icon='RESTRICT_SELECT_OFF') layout.menu("VIEW3D_MT_Edit_Multi", icon='VERTEXSEL') UseSeparator(self, context) - layout.menu("INFO_MT_mesh_add", text="Add Mesh", icon='OUTLINER_OB_MESH') + layout.menu("VIEW3D_MT_mesh_add", text="Add Mesh", icon='OUTLINER_OB_MESH') layout.menu("VIEW3D_MT_Edit_Mesh", text="Mesh", icon='MESH_DATA') UseSeparator(self, context) layout.menu("VIEW3D_MT_TransformMenuEdit", icon='MANIPUL') @@ -259,7 +259,7 @@ class VIEW3D_MT_Space_Dynamic_Menu(Menu): layout.menu("VIEW3D_MT_Select_Edit_Curve", icon='RESTRICT_SELECT_OFF') UseSeparator(self, context) - layout.menu("INFO_MT_curve_add", text="Add Curve", + layout.menu("VIEW3D_MT_curve_add", text="Add Curve", icon='OUTLINER_OB_CURVE') layout.menu("VIEW3D_MT_Edit_Curve", icon='CURVE_DATA') UseSeparator(self, context) @@ -321,7 +321,7 @@ class VIEW3D_MT_Space_Dynamic_Menu(Menu): layout.menu("VIEW3D_MT_View_Menu", icon='ZOOM_ALL') layout.menu("VIEW3D_MT_Select_Edit_Surface", icon='RESTRICT_SELECT_OFF') UseSeparator(self, context) - layout.menu("INFO_MT_surface_add", text="Add Surface", + layout.menu("VIEW3D_MT_surface_add", text="Add Surface", icon='OUTLINER_OB_SURFACE') layout.menu("VIEW3D_MT_TransformMenu", icon='MANIPUL') layout.menu("VIEW3D_MT_MirrorMenu", icon='MOD_MIRROR') @@ -489,7 +489,7 @@ class VIEW3D_MT_Space_Dynamic_Menu(Menu): layout.operator("view3d.properties", icon='MENU_PANEL') # Lamp Object Mode # - if obj and obj.type == 'LAMP' and obj.mode in {'OBJECT'}: + if obj and obj.type == 'LIGHT' and obj.mode in {'OBJECT'}: layout.operator_context = 'INVOKE_REGION_WIN' layout.operator("wm.search_menu", text="Search", icon='VIEWZOOM') @@ -561,7 +561,7 @@ class VIEW3D_MT_Space_Dynamic_Menu(Menu): layout.menu("VIEW3D_MT_Select_Edit_Armature", icon='RESTRICT_SELECT_OFF') UseSeparator(self, context) - layout.menu("INFO_MT_armature_add", text="Add Armature", + layout.menu("VIEW3D_MT_armature_add", text="Add Armature", icon='OUTLINER_OB_ARMATURE') layout.menu("VIEW3D_MT_Edit_Armature", text="Armature", icon='OUTLINER_DATA_ARMATURE') @@ -602,7 +602,7 @@ class VIEW3D_MT_Space_Dynamic_Menu(Menu): layout.menu("VIEW3D_MT_CursorMenuLite", icon='CURSOR') layout.menu("VIEW3D_MT_PoseCopy", icon='FILE') - if arm.draw_type in {'BBONE', 'ENVELOPE'}: + if arm.display_type in {'BBONE', 'ENVELOPE'}: layout.operator("transform.transform", text="Scale Envelope Distance").mode = 'BONE_SIZE' @@ -807,7 +807,6 @@ class VIEW3D_MT_Object(Menu): layout.menu("VIEW3D_MT_object_track") layout.menu("VIEW3D_MT_object_animation") UseSeparator(self, context) - layout.menu("VIEW3D_MT_object_game") layout.menu("VIEW3D_MT_object_showhide") UseSeparator(self, context) layout.operator_menu_enum("object.convert", "target") @@ -821,18 +820,18 @@ class VIEW3D_MT_AddMenu(Menu): layout = self.layout layout.operator_context = 'INVOKE_REGION_WIN' - layout.menu("INFO_MT_mesh_add", text="Add Mesh", + layout.menu("VIEW3D_MT_mesh_add", text="Add Mesh", icon='OUTLINER_OB_MESH') - layout.menu("INFO_MT_curve_add", text="Add Curve", + layout.menu("VIEW3D_MT_curve_add", text="Add Curve", icon='OUTLINER_OB_CURVE') - layout.menu("INFO_MT_surface_add", text="Add Surface", + layout.menu("VIEW3D_MT_surface_add", text="Add Surface", icon='OUTLINER_OB_SURFACE') layout.operator_menu_enum("object.metaball_add", "type", icon='OUTLINER_OB_META') layout.operator("object.text_add", text="Add Text", icon='OUTLINER_OB_FONT') UseSeparator(self, context) - layout.menu("INFO_MT_armature_add", text="Add Armature", + layout.menu("VIEW3D_MT_armature_add", text="Add Armature", icon='OUTLINER_OB_ARMATURE') layout.operator("object.add", text="Lattice", icon='OUTLINER_OB_LATTICE').type = 'LATTICE' @@ -842,8 +841,8 @@ class VIEW3D_MT_AddMenu(Menu): UseSeparator(self, context) layout.operator("object.camera_add", text="Camera", icon='OUTLINER_OB_CAMERA') - layout.operator_menu_enum("object.lamp_add", "type", - icon="OUTLINER_OB_LAMP") + layout.operator_menu_enum("object.light_add", "type", + icon="OUTLINER_OB_LIGHT") UseSeparator(self, context) layout.operator_menu_enum("object.effector_add", "type", text="Force Field", @@ -981,8 +980,10 @@ class VIEW3D_MT_CursorMenu(Menu): layout.operator("view3d.snap_cursor_to_active", text="Cursor to Active") UseSeparator(self, context) - layout.operator("view3d.snap_selected_to_cursor", text="Selection to Cursor").use_offset = False - layout.operator("view3d.snap_selected_to_cursor", text="Selection to Cursor (Offset)").use_offset = True + layout.operator("view3d.snap_selected_to_cursor", + text="Selection to Cursor").use_offset = False + layout.operator("view3d.snap_selected_to_cursor", + text="Selection to Cursor (Keep Offset)").use_offset = True layout.operator("view3d.snap_selected_to_grid", text="Selection to Grid") layout.operator("view3d.snap_cursor_selected_to_center", @@ -1012,8 +1013,10 @@ class VIEW3D_MT_CursorMenuLite(Menu): layout.operator("view3d.snap_cursor_to_active", text="Cursor to Active") UseSeparator(self, context) - layout.operator("view3d.snap_selected_to_cursor", text="Selection to Cursor").use_offset = False - layout.operator("view3d.snap_selected_to_cursor", text="Selection to Cursor (Offset)").use_offset = True + layout.operator("view3d.snap_selected_to_cursor", + text="Selection to Cursor").use_offset = False + layout.operator("view3d.snap_selected_to_cursor", + text="Selection to Cursor (Keep Offset)").use_offset = True layout.operator("view3d.snap_selected_to_grid", text="Selection to Grid") layout.operator("view3d.snap_cursor_selected_to_center", @@ -1420,8 +1423,10 @@ class VIEW3D_MT_EditCursorMenu(Menu): layout.operator("view3d.snap_cursor_to_edge_intersection", text="Cursor to Edge Intersection") UseSeparator(self, context) - layout.operator("view3d.snap_selected_to_cursor", text="Selection to Cursor").use_offset = False - layout.operator("view3d.snap_selected_to_cursor", text="Selection to Cursor (Offset)").use_offset = True + layout.operator("view3d.snap_selected_to_cursor", + text="Selection to Cursor").use_offset = False + layout.operator("view3d.snap_selected_to_cursor", + text="Selection to Cursor (Keep Offset)").use_offset = True layout.operator("view3d.snap_selected_to_grid", text="Selection to Grid") UseSeparator(self, context) @@ -1890,7 +1895,7 @@ class VIEW3D_MT_TransformMenu(Menu): layout = self.layout layout.menu("VIEW3D_MT_ManipulatorMenu1") UseSeparator(self, context) - layout.operator("transform.translate", text="Grab/Move") + layout.operator("transform.translate", text="Move") layout.operator("transform.rotate", text="Rotate") layout.operator("transform.resize", text="Scale") UseSeparator(self, context) @@ -1920,7 +1925,7 @@ class VIEW3D_MT_TransformMenuEdit(Menu): layout = self.layout layout.menu("VIEW3D_MT_ManipulatorMenu1") UseSeparator(self, context) - layout.operator("transform.translate", text="Grab/Move") + layout.operator("transform.translate", text="Move") layout.operator("transform.rotate", text="Rotate") layout.operator("transform.resize", text="Scale") UseSeparator(self, context) @@ -1950,7 +1955,7 @@ class VIEW3D_MT_TransformMenuLite(Menu): layout = self.layout layout.menu("VIEW3D_MT_ManipulatorMenu1") UseSeparator(self, context) - layout.operator("transform.translate", text="Grab/Move") + layout.operator("transform.translate", text="Move") layout.operator("transform.rotate", text="Rotate") layout.operator("transform.resize", text="Scale") UseSeparator(self, context) @@ -1971,7 +1976,7 @@ class VIEW3D_MT_TransformMenuCamera(Menu): layout.menu("VIEW3D_MT_ManipulatorMenu1") layout.menu("VIEW3D_MT_object_clear") layout.menu("VIEW3D_MT_object_apply") - layout.operator("transform.translate", text="Grab/Move") + layout.operator("transform.translate", text="Move") layout.operator("transform.rotate", text="Rotate") layout.operator("transform.resize", text="Scale") layout.operator("object.align") @@ -1990,7 +1995,7 @@ class VIEW3D_MT_TransformMenuArmature(Menu): layout.menu("VIEW3D_MT_ManipulatorMenu1") UseSeparator(self, context) - layout.operator("transform.translate", text="Grab/Move") + layout.operator("transform.translate", text="Move") layout.operator("transform.rotate", text="Rotate") layout.operator("transform.resize", text="Scale") UseSeparator(self, context) @@ -2016,7 +2021,7 @@ class VIEW3D_MT_TransformMenuArmatureEdit(Menu): layout = self.layout layout.menu("VIEW3D_MT_ManipulatorMenu1") UseSeparator(self, context) - layout.operator("transform.translate", text="Grab/Move") + layout.operator("transform.translate", text="Move") layout.operator("transform.rotate", text="Rotate") layout.operator("transform.resize", text="Scale") UseSeparator(self, context) @@ -2038,7 +2043,7 @@ class VIEW3D_MT_TransformMenuArmaturePose(Menu): def draw(self, context): layout = self.layout layout.menu("VIEW3D_MT_ManipulatorMenu1") - layout.operator("transform.translate", text="Grab/Move") + layout.operator("transform.translate", text="Move") layout.operator("transform.rotate", text="Rotate") layout.operator("transform.resize", text="Scale") UseSeparator(self, context) @@ -2052,9 +2057,9 @@ class VIEW3D_MT_TransformMenuArmaturePose(Menu): layout.operator("pose.user_transforms_clear", text="Reset unkeyed") obj = context.object if obj.type == 'ARMATURE' and obj.mode in {'EDIT', 'POSE'}: - if obj.data.draw_type == 'BBONE': + if obj.data.display_type == 'BBONE': layout.operator("transform.transform", text="Scale BBone").mode = 'BONE_SIZE' - elif obj.data.draw_type == 'ENVELOPE': + elif obj.data.display_type == 'ENVELOPE': layout.operator("transform.transform", text="Scale Envelope Distance").mode = 'BONE_SIZE' layout.operator("transform.transform", text="Scale Radius").mode = 'BONE_ENVELOPE' @@ -2086,7 +2091,7 @@ class VIEW3D_MT_View_Border(Menu): layout.operator_context = 'INVOKE_REGION_WIN' layout.operator("view3d.clip_border", text="Clipping Border...") layout.operator("view3d.zoom_border", text="Zoom Border...") - layout.operator("view3d.render_border", text="Render Border...").camera_only = False + layout.operator("view3d.render_border", text="Render Border...") class VIEW3D_MT_View_Toggle(Menu): @@ -2224,7 +2229,7 @@ class VIEW3D_MT_Shade(Menu): UseSeparator(self, context) layout.operator("view3d.display_wire_all", text="Wire all", icon='WIRE') - layout.prop(context.object, "show_x_ray", text="X-Ray", icon="META_CUBE") + layout.prop(context.object, "show_in_front", text="X-Ray", icon="META_CUBE") UseSeparator(self, context) layout.prop(context.space_data.fx_settings, "use_ssao", diff --git a/system_blend_info.py b/system_blend_info.py index 8b2a0939..65b1d9f9 100644 --- a/system_blend_info.py +++ b/system_blend_info.py @@ -102,10 +102,10 @@ class OBJECT_PT_blendinfo(bpy.types.Panel): icon='CAMERA_DATA') row = ob_cols[1].row() - lamps = [o for o in objects.values() if o.type == 'LAMP'] + lamps = [o for o in objects.values() if o.type == 'LIGHT'] num = len(lamps) row.label(text=quantity_string(num, "Lamp", "Lamps"), - icon='LAMP_DATA') + icon='LIGHT_DATA') row = ob_cols[0].row() armatures = [o for o in objects.values() if o.type == 'ARMATURE'] @@ -159,9 +159,9 @@ class OBJECT_PT_blendinfo(bpy.types.Panel): icon='CAMERA_DATA') row = db_cols[1].row() - num = len(bpy.data.lamps) + num = len(bpy.data.lights) row.label(text=quantity_string(num, "Lamp", "Lamps"), - icon='LAMP_DATA') + icon='LIGHT_DATA') row = db_cols[0].row() num = len(bpy.data.armatures) diff --git a/system_demo_mode/__init__.py b/system_demo_mode/__init__.py index 55557134..178fd0e2 100644 --- a/system_demo_mode/__init__.py +++ b/system_demo_mode/__init__.py @@ -248,7 +248,7 @@ def register(): bpy.utils.register_class(DemoModeSetup) bpy.utils.register_class(DemoModeRun) - bpy.types.INFO_MT_file.prepend(menu_func) + bpy.types.TOPBAR_MT_file.prepend(menu_func) extern_demo_mode_register() @@ -257,7 +257,7 @@ def unregister(): bpy.utils.unregister_class(DemoModeSetup) bpy.utils.unregister_class(DemoModeRun) - bpy.types.INFO_MT_file.remove(menu_func) + bpy.types.TOPBAR_MT_file.remove(menu_func) extern_demo_mode_unregister() diff --git a/ui_layer_manager.py b/ui_layer_manager.py index 018aad26..662dd3e5 100644 --- a/ui_layer_manager.py +++ b/ui_layer_manager.py @@ -277,11 +277,11 @@ class SCENE_OT_namedlayer_toggle_wire(Operator): group_layers = scene.layergroups[group_idx].layers layers = obj.layers if True in {layer and group_layer for layer, group_layer in zip(layers, group_layers)}: - obj.draw_type = display + obj.display_type = display scene.layergroups[group_idx].use_wire = use_wire else: if obj.layers[layer_idx]: - obj.draw_type = display + obj.display_type = display scene.namedlayers.layers[layer_idx].use_wire = use_wire return {'FINISHED'} diff --git a/uv_texture_atlas.py b/uv_texture_atlas.py index 974d998c..b0936a8a 100644 --- a/uv_texture_atlas.py +++ b/uv_texture_atlas.py @@ -127,15 +127,15 @@ class TexAtl_Main(Panel): self.layout.prop(group, 'unwrap_type', text='Lightmap', expand=True) row = self.layout.row() row.operator( - "object.ms_auto", text="Auto Unwrap", icon="LAMP_SPOT") + "object.ms_auto", text="Auto Unwrap", icon="LIGHT_SPOT") row.prop(group, 'autoUnwrapPrecision', text='') self.layout.label(text="Manual Unwrap:") row = self.layout.row() row.operator( - "object.ms_run", text="StartManualUnwrap", icon="LAMP_SPOT") + "object.ms_run", text="StartManualUnwrap", icon="LIGHT_SPOT") row.operator( - "object.ms_run_remove", text="FinishManualUnwrap", icon="LAMP_SPOT") + "object.ms_run_remove", text="FinishManualUnwrap", icon="LIGHT_SPOT") class TexAtl_RunAuto(Operator): |