|
1 | 1 | # ##### BEGIN GPL LICENSE BLOCK ##### |
2 | 2 | # |
3 | 3 | # Stop motion OBJ: A Mesh sequence importer for Blender |
4 | | -# Copyright (C) 2016-2021 Justin Jensen |
| 4 | +# Copyright (C) 2016-2022 Justin Jensen |
5 | 5 | # |
6 | 6 | # This program is free software: you can redistribute it and/or modify |
7 | 7 | # it under the terms of the GNU General Public License as published by |
@@ -36,10 +36,13 @@ class SMO_PT_MeshSequencePanel(bpy.types.Panel): |
36 | 36 |
|
37 | 37 | @classmethod |
38 | 38 | def poll(cls, context): |
39 | | - return context.object.mesh_sequence_settings.initialized == True |
| 39 | + return context.object.type == 'MESH' |
40 | 40 |
|
41 | 41 | def draw(self, context): |
42 | | - pass |
| 42 | + if context.object.type == 'MESH' and context.object.mesh_sequence_settings.initialized == False: |
| 43 | + # show button to convert the object into a mesh sequence |
| 44 | + self.layout.operator(ConvertToMeshSequence.bl_idname, icon="ONIONSKIN_ON") |
| 45 | + |
43 | 46 |
|
44 | 47 |
|
45 | 48 | class SMO_PT_MeshSequencePlaybackPanel(bpy.types.Panel): |
@@ -237,7 +240,7 @@ def execute(self, context): |
237 | 240 | if self.sequenceSettings.showAsSingleMesh: |
238 | 241 | seqObj = newMeshSequence('SingleMesh') |
239 | 242 | else: |
240 | | - seqObj = newMeshSequence('EmptyMesh') |
| 243 | + seqObj = newMeshSequence('emptyMesh') |
241 | 244 |
|
242 | 245 | global_matrix = axis_conversion(from_forward=b_axis_forward,from_up=b_axis_up).to_4x4() |
243 | 246 | seqObj.matrix_world = global_matrix |
@@ -432,10 +435,16 @@ def execute(self, context): |
432 | 435 | return {'CANCELLED'} |
433 | 436 |
|
434 | 437 | # hijack the mesh from the selected object and add it to a new mesh sequence |
435 | | - msObj = newMeshSequence() |
| 438 | + msObj = newMeshSequence('emptyMesh') |
436 | 439 | msObj.mesh_sequence_settings.isImported = False |
437 | 440 | addMeshToSequence(msObj, obj.data) |
438 | 441 |
|
| 442 | + # make sure the new mesh sequence has the same transform (especially the location) as context.object |
| 443 | + msObj.location = obj.location |
| 444 | + msObj.scale = obj.scale |
| 445 | + msObj.rotation_euler = obj.rotation_euler |
| 446 | + msObj.rotation_quaternion = obj.rotation_quaternion |
| 447 | + |
439 | 448 | objName = obj.name |
440 | 449 | msObj.name = objName + '_sequence' |
441 | 450 |
|
|
0 commit comments