Skip to content

small issue within dent on python #30

Description

@blender-tv-studio

this python code isn't pasting right all the way just a very top line of the if statement is indented I have to put my mouse cursor next to the I and if and press shifting tab to indent it after pasting otherwise it works perfectly just an idea you know if you're not going to do it I'll do it later or something but I was thinking you could put it in GPT 4 and have it help you design this better for Python it shouldn't take that long if you're a really good programmer but GPT 4 because you have a easier time


if event.type == 'MOUSEMOVE':
    print("Mouse movement detected")
    v = self.manager.transform_nudge_prop

    if event.shift:
        print("Shift key pressed with mouse movement")
        v *= 0.005

    self.mouse_dx = self.mouse_dx - event.mouse_x
    offset = self.mouse_dx * v * 0.05  # Adjust the 0.05 factor for smoother scaling

    if hasattr(bpy.context.scene, "transform_local_prop") and bpy.context.scene.transform_local_prop:
        print("Transforming in local X-axis")
        for ob in context.selected_objects:
            ob.scale.x -= offset * ob.matrix_world.to_3x3().normalized()[0][0]
            print(f"{ob.name} Scale (Local X): X={ob.scale.x:.2f}, Y={ob.scale.y:.2f}, Z={ob.scale.z:.2f}")

    else:
        print("Transforming in global X-axis")
        for ob in context.selected_objects:
            mat = ob.matrix_world.to_3x3().normalized()
            ob.scale.x -= offset * mat[0][0]
            ob.scale.y -= offset * mat[1][0]
            ob.scale.z -= offset * mat[2][0]
            print(f"{ob.name} Scale (Global X): X={ob.scale.x:.2f}, Y={ob.scale.y:.2f}, Z={ob.scale.z:.2f}")

    self.mouse_dx = event.mouse_x

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions