<commit_before># -*- coding: utf-8 -*-
#
# Installation:
# Add this file to your script path.
# Mac
# /Users/Shared/Autodesk/Maya
# Windows
# <user directory>/My Documents/Maya/scripts
# Linux
# /usr/autodesk/userconfig/Maya/scripts
#
#
# Usage:
# Select the target, and execute the following python command:
#
# import fitViewToObject
# fitViewToObject.fitView()
#

import math
import sys
from maya import OpenMaya, OpenMayaUI, cmds

sys.dont_write_bytecode = True


def getActiveView():
    view = OpenMayaUI.M3dView.active3dView()
    return view


def getDagPath(name=''):
    sl = OpenMaya.MSelectionList()
    dagPath = OpenMaya.MDagPath()
    sl.add(name)
    sl.getDagPath(0, dagPath)
    return dagPath


def fitView():
    objects = cmds.ls(sl=True)
    if not objects:
        return

    # View
    view = getActiveView()

    # Camera.
    cam = OpenMaya.MDagPath()
    view.getCamera(cam)
    camPath = cam.fullPathName()
    camDag = getDagPath(name=camPath)
    camFn = OpenMaya.MFnCamera(camDag)
    camTransform = cmds.listRelatives(camPath, p=True, typ='transform')[0]
    hFov = camFn.horizontalFieldOfView()<commit_msg>Update fitViewToObject.py<commit_after># -*- coding: utf-8 -*-
#
# Installation:
# Add this file to your script path.
# Mac
# /Users/Shared/Autodesk/Maya
# Windows
# <user directory>/My Documents/Maya/scripts
# Linux
# /usr/autodesk/userconfig/Maya/scripts
#
#
# Usage:
# Select the target, and execute the following python command:
#
# import fitViewToObject
# fitViewToObject.fitView()
#

import math
import sys
from maya import OpenMaya
from maya import OpenMayaUI
from maya import cmds
from maya import mel

sys.dont_write_bytecode = True


def getActiveView():
    view = OpenMayaUI.M3dView.active3dView()
    return view


def getDagPath(name=''):
    sl = OpenMaya.MSelectionList()
    dagPath = OpenMaya.MDagPath()
    sl.add(name)
    sl.getDagPath(0, dagPath)
    return dagPath


def fitView():
    objects = cmds.ls(sl=True)
    if not objects:
        return

    panel = cmds.getPanel(wf=True)
    modelPanels = cmds.getPanel(typ='modelPanel')
    if not panel in modelPanels:
        mel.eval('FrameSelected;')
        return

    # View
    view = getActiveView()
    if not view:
        return

    # Camera.
    cam = OpenMaya.MDagPath()
    view.getCamera(cam)
    camPath = cam.fullPathName()
    camDag = getDagPath(name=camPath)
    camFn = OpenMaya.MFnCamera(camDag)
    camTransform = cmds.listRelatives(camPath, p=True, typ='transform')[0]
    hFov = camFn.horizontalFieldOfView()
{'fraction_non_alphanumeric': 0.11272584446190102, 'fraction_numerical': 0.003927729772191673, 'mean_word_length': 3.468421052631579, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4729939', 'n_tokens_mistral': 910, 'n_tokens_neox': 893, 'n_words': 201}