<commit_before>using System;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Runtime.CompilerServices;
using System.Reflection;
using UnityEngine;
#if UNITY_EDITOR
using UnityEditor;
#endif

[ExecuteInEditMode]
public class AlembicCamera : AlembicElement
{
    public AbcAPI.aiAspectRatioModeOverride m_aspectRatioMode = AbcAPI.aiAspectRatioModeOverride.InheritStreamSetting;

    Camera m_camera;
    AbcAPI.aiCameraData m_abcData;

    public override void AbcSetup(AlembicStream abcStream,
                                  AbcAPI.aiObject abcObj,
                                  AbcAPI.aiSchema abcSchema)
    {
        base.AbcSetup(abcStream, abcObj, abcSchema);

        m_camera = GetOrAddComponent<Camera>();
    }

    public override void AbcGetConfig(ref AbcAPI.aiConfig config)
    {
        if (m_aspectRatioMode != AbcAPI.aiAspectRatioModeOverride.InheritStreamSetting)
        {
            config.aspectRatio = AbcAPI.GetAspectRatio((AbcAPI.aiAspectRatioMode) m_aspectRatioMode);
        }
    }

    public override void AbcSampleUpdated(AbcAPI.aiSample sample, bool topologyChanged)
    {
        AbcAPI.aiCameraGetData(sample, ref m_abcData);

        AbcDirty();
    }

    public override void AbcUpdate()
    {
        if (AbcIsDirty())
        {
            m_trans.forward = -m_trans.parent.forward;
            m_camera.fieldOfView = m_abcData.fieldOfView;
            m_camera.nearClipPlane = m_abcData.nearClippingPlane;
            m_camera.farClipPlane = m_abcData.farClippingPlane;
            
            // no use for focusDistance and focalLength yet (could be usefull for DoF component)
            
            AbcClean();
        }
    }
}<commit_msg>add new 'Ignore Clipping Planes' option to alembic camera component<commit_after>using System;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Runtime.CompilerServices;
using System.Reflection;
using UnityEngine;
#if UNITY_EDITOR
using UnityEditor;
#endif

[ExecuteInEditMode]
public class AlembicCamera : AlembicElement
{
    public AbcAPI.aiAspectRatioModeOverride m_aspectRatioMode = AbcAPI.aiAspectRatioModeOverride.InheritStreamSetting;
    public bool m_ignoreClippingPlanes = false;

    Camera m_camera;
    AbcAPI.aiCameraData m_abcData;
    bool m_lastIgnoreClippingPlanes = false;

    public override void AbcSetup(AlembicStream abcStream,
                                  AbcAPI.aiObject abcObj,
                                  AbcAPI.aiSchema abcSchema)
    {
        base.AbcSetup(abcStream, abcObj, abcSchema);

        m_camera = GetOrAddComponent<Camera>();
    }

    public override void AbcGetConfig(ref AbcAPI.aiConfig config)
    {
        if (m_aspectRatioMode != AbcAPI.aiAspectRatioModeOverride.InheritStreamSetting)
        {
            config.aspectRatio = AbcAPI.GetAspectRatio((AbcAPI.aiAspectRatioMode) m_aspectRatioMode);
        }
    }

    public override void AbcSampleUpdated(AbcAPI.aiSample sample, bool topologyChanged)
    {
        AbcAPI.aiCameraGetData(sample, ref m_abcData);

        AbcDirty();
    }

    public override void AbcUpdate()
    {
        if (AbcIsDirty() || m_lastIgnoreClippingPlanes != m_ignoreClippingPlanes)
        {
            m_trans.forward = -m_trans.parent.forward;
            m_camera.fieldOfView = m_abcData.fieldOfView;

            if (!m_ignoreClippingPlanes)
            {
                m_camera.nearClipPlane = m_abcData.nearClippingPlane;
                m_camera.farClipPlane = m_abcData.farClippingPlane;
            }
            
            // no use for focusDistance and focalLength yet (could be usefull for DoF component)
            
            AbcClean();

            m_lastIgnoreClippingPlanes = m_ignoreClippingPlanes;
        }
    }
}
{'fraction_non_alphanumeric': 0.06926070038910506, 'fraction_numerical': 0.0, 'mean_word_length': 2.6446124763705106, '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': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '137236', 'n_tokens_mistral': 1169, 'n_tokens_neox': 1147, 'n_words': 216}