AFCStudio / BCRYExporter

BCry Asset Exporter from Blender to CryEngine
45 stars 12 forks source link

Feature: Feet On Floor #143

Closed dwhite5914 closed 7 years ago

dwhite5914 commented 7 years ago

Convenience tool for quickly placing the origin at the base of an object (mesh, armature, or empty) and positioning the base of the object on top of the grid plane.

image

image

image

feedbackex commented 7 years ago

Thank you for this feature @dwhite5914, it looks so good. I will check it as soon.

feedbackex commented 7 years ago

It's working perfectly, @dwhite5914 .

I think, in some cases, to dig object a bit might be handy. Just could you add a __z_offset__ property for tool shelf panel? Like this;

Property

    bl_options = {'REGISTER', 'UNDO'}

    z_offset = FloatProperty(name="Z Offset",
                        default=0.0, step=0.1, precision=3,
                        description="Z offset for center of object.")

    def execute(self, context):

Adding

            x, y, z = bpy.context.scene.cursor_location
            z = obj.location.z - obj.dimensions.z / 2 + self.z_offset
            bpy.context.scene.cursor_location = Vector((x, y, z))
dwhite5914 commented 7 years ago

@feedbackex Good thinking, I added the offset option. The only thing I changed was: z = obj.location.z - obj.dimensions.z / 2 + self.z_offset to z = obj.location.z - obj.dimensions.z / 2 - self.z_offset so that the z-offset aligns with the axis properly. Let me know if you have any other recommendations and I'll add them.

feedbackex commented 7 years ago

That's fine @dwhite5914. As last thing, could you squash them into one commit before the merge?

dwhite5914 commented 7 years ago

@feedbackex All set, squashed into one commit and merged.