Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,21 @@ repos:
- id: cmake-format

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.13.2
rev: v0.17.0
hooks:
- id: ruff-check
args: [ --fix ]
- id: ruff-format

- repo: https://github.com/pre-commit/mirrors-clang-format
rev: 'v19.1.4'
rev: 'v23.1.3'
hooks:
- id: clang-format
types_or: [c++, c]
exclude: '\.(m|mm)$'

- repo: https://github.com/igorshubovych/markdownlint-cli
rev: v0.47.0
rev: v0.49.1
hooks:
- id: markdownlint
args: [--fix]
Expand Down
1 change: 0 additions & 1 deletion conan/scripts/export_recipes.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
from pathlib import Path

import yaml

from _common import CONAN_USER, conan_exec, load_packages


Expand Down
1 change: 0 additions & 1 deletion conan/scripts/validate_packages_yml.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import sys

import yaml

from _common import PACKAGES_YML

REQUIRED = {"name": str, "version": str, "channel": str, "cci_folder": str}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,38 +15,39 @@ _Note: there are some slight differences that need to be noted when translating
to make the commands visible in the current namespace. In Python you need to include the package name:

```python
from rv.commands import *
from rv.commands import *
```

or

```python
import rv.commands
import rv.commands
```

### Open RV Python quickstart

In order to extend RV using Python you will be making a "mode" as part of an rvpkg package—this is identical to the way it’s done in Mu and this is the method that we use internally to add new functions to RV's interface. Creation of a modes and packages is documented later in this chapter. Here is a very simple mode written in Python which is part of the RV packages as `pyhello-1.1.rvpkg`.

```python
import rv.rvtypes
import rv.rvtypes
import rv.commands

class PyHello(rv.rvtypes.MinorMode):

class PyHello(rv.rvtypes.MinorMode):
"A simple example that shows how to make shift-Z start/stop playback"

def togglePlayback(self, event):
if rv.commands.isPlaying():
rv.commands.stop()
else:
def togglePlayback(self, event):
if rv.commands.isPlaying():
rv.commands.stop()
else:
rv.commands.play()

def __init__(self):
rv.rvtypes.MinorMode.__init__(self)
self.init("pyhello", [("key-down--Z", self.togglePlayback, "Z key")], None)
def __init__(self):
rv.rvtypes.MinorMode.__init__(self)
self.init("pyhello", [("key-down--Z", self.togglePlayback, "Z key")], None)

def createMode():
"Required to initialize the module. RV will call this function to create your mode."
def createMode():
"Required to initialize the module. RV will call this function to create your mode."
return PyHello()
```

Expand All @@ -62,18 +63,20 @@ It's possible to call Mu code from Python, but in practice you will probably not

```python
from pymu import MuSymbol

F = MuSymbol("commands.play")
F()
F()
```

If the Mu function has arguments you supply them when calling. Return values are automatically converted between languages. The conversions are indicated in Figure [4.3](#43-python-mu-type-conversions).

```python
from pymu import MuSymbol

F = MuSymbol("commands.isPlaying")
G = MuSymbol("commands.setWindowTitle")
if F() == True:
G("PLAYING")
G("PLAYING")
```

Once a MuSymbol object has been created, the overhead to call it is minimal. All of the Mu commands module is imported on start up or reimplemented as native CPython in the Python rv.commands module so you will not need to create MuSymbol objects yourself; just import rv.commands and use the pre-existing ones.
Expand Down Expand Up @@ -225,7 +228,7 @@ label.show()
# Enter Qt application main loop.
app.exec_()

sys.exit()
sys.exit()
```

To access RV's essential session window Qt QWidgets, i.e. the main window, the GL view, top tool bar and bottom tool bar, import the Python module 'rv.qtutils'.
Expand All @@ -245,7 +248,7 @@ rvSessionGLView = rv.qtutils.sessionGLView()
rvSessionTopToolBar = rv.qtutils.sessionTopToolBar()

# Gets the current RV session bottom tool bar as a PySide QToolBar.
rvSessionBottomToolBar = rv.qtutils.sessionBottomToolBar()
rvSessionBottomToolBar = rv.qtutils.sessionBottomToolBar()
```

### 4.5 Open RV Python Implementation FAQ
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ If you need to, RV can load sources asynchronously, also known as progressive so

```python
from rv import commands as rvc

rvc.setProgressiveSourceLoading(True)
```

Expand Down Expand Up @@ -120,7 +121,7 @@ You can expect this sequence of events:
Enabling progressive source loading significantly increases the complexity of scripting. Consider the following example:

```python
rv.commands.addSource('/my/clip/1')
rv.commands.addSource("/my/clip/1")
rv.commands.setFPS(60.00)
```

Expand Down Expand Up @@ -201,7 +202,7 @@ A full property name has three parts: the node name, the component name, and the
or in Python:

```py
setFloatProperty("display.color.gamma", [2.2, 2.2, 2.2], True)
setFloatProperty("display.color.gamma", [2.2, 2.2, 2.2], True)
```

In this case the value is being set to 2.2.
Expand Down Expand Up @@ -231,7 +232,7 @@ setFloatProperty("#RVColor.color.exposure", float[] {2.0, 2.0, 2.0}, true)
or in Python:

```py
setFloatProperty("#RVColor.color.exposure", [2.0, 2.0, 2.0], True)
setFloatProperty("#RVColor.color.exposure", [2.0, 2.0, 2.0], True)
```

In sequence mode (i.e. the default case), only one RVColor node is usually active at a time (the one belonging to the source being viewed at the current frame). In stack mode, the RVColor nodes for all of the sources could be active. In that case, they will all have their exposure set. In the UI, properties are almost exclusively addressed in this manner so that making changes affects the currently visible sources only. See figure [2.9](#active-nodes-in-the-image-processing-graph) for a diagrammatic explanation.
Expand Down
10 changes: 6 additions & 4 deletions openrvcore-conanfile.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import os
import sys
from conan import ConanFile
from conan.tools.cmake import CMake, CMakeDeps, cmake_layout, CMakeToolchain

from conan.errors import ConanException
from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout
from conan.tools.env import VirtualBuildEnv
from conan.tools.gnu import PkgConfigDeps
from conan.tools.microsoft import VCVars
from conan.tools.env import VirtualBuildEnv
from conan.errors import ConanException

from conan import ConanFile

# The comment below is relevant for WINDOWS only because of the usage of MSYS2.

Expand Down
2 changes: 1 addition & 1 deletion src/bin/apps/rv/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ extern void rvThirdPartyCustomization(TwkApp::Bundle& bundle, char* licarg);
// #error ********* NO VERSION INFORMATION ***********
#else
#ifndef _MSC_VER
#warning********* NO VERSION INFORMATION ***********
#warning ********* NO VERSION INFORMATION ***********
#endif
#endif
#endif
Expand Down
2 changes: 1 addition & 1 deletion src/bin/apps/rvpkg/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
// #error ********* NO VERSION INFORMATION ***********
#else
#ifndef _MSC_VER
#warning********* NO VERSION INFORMATION ***********
#warning ********* NO VERSION INFORMATION ***********
#endif
#endif
#endif
Expand Down
3 changes: 1 addition & 2 deletions src/bin/mu/mu-interp/test/rng.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ def gen_random(max):


def main(N):
if N < 1:
N = 1
N = max(N, 1)
gr = gen_random
for i in range(1, N):
gr(100.0)
Expand Down
2 changes: 1 addition & 1 deletion src/bin/nsapps/RV/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ extern void rvThirdPartyCustomization(TwkApp::Bundle& bundle, char* licarg);
#if NDEBUG
// #error ********* NO VERSION INFORMATION ***********
#else
#warning********* NO VERSION INFORMATION ***********
#warning ********* NO VERSION INFORMATION ***********
#endif
#endif

Expand Down
15 changes: 7 additions & 8 deletions src/bin/python/py-interp/tests/test_SSL.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ def _fetch(name, func, url):

def fetch_httplib(url):
def impl(url):
from six.moves import http_client
from six.moves import urllib_parse
from six.moves import http_client, urllib_parse

u = urllib_parse.urlparse(url)
http_client.HTTPSConnection(u.netloc).request("GET", u.path)
Expand Down Expand Up @@ -57,19 +56,19 @@ def impl(url):
def fetch_pyside(url):
def impl(url):
try:
from PySide2.QtCore import QEventLoop, QUrl, QCoreApplication
from PySide2.QtCore import QCoreApplication, QEventLoop, QUrl
from PySide2.QtNetwork import (
QNetworkRequest,
QNetworkReply,
QNetworkAccessManager,
QNetworkReply,
QNetworkRequest,
)
except ImportError:
try:
from PySide6.QtCore import QEventLoop, QUrl, QCoreApplication
from PySide6.QtCore import QCoreApplication, QEventLoop, QUrl
from PySide6.QtNetwork import (
QNetworkRequest,
QNetworkReply,
QNetworkAccessManager,
QNetworkReply,
QNetworkRequest,
)
except ImportError:
pass
Expand Down
1 change: 0 additions & 1 deletion src/build/install_all_rvpkg.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import argparse
import pathlib
import subprocess
Expand Down
6 changes: 2 additions & 4 deletions src/build/make_openssl.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

# *****************************************************************************
# Copyright 2020 Autodesk, Inc. All rights reserved.
Expand All @@ -12,12 +11,11 @@
import glob
import os
import pathlib
import platform
import shutil
import subprocess
import platform
import tempfile
import uuid
from typing import List

SOURCE_DIR = ""
OUTPUT_DIR = ""
Expand All @@ -26,7 +24,7 @@
LIB_DIR = ""


def get_openssl_args(root) -> List[str]:
def get_openssl_args(root) -> list[str]:
"""
Return the path to the openssl binary given a package root.

Expand Down
26 changes: 12 additions & 14 deletions src/build/make_pyside.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

# *****************************************************************************
# Copyright 2020 Autodesk, Inc. All rights reserved.
Expand All @@ -11,21 +10,21 @@
import argparse
import glob
import os
import re
import pathlib
import platform
import re
import shutil
import subprocess
import platform
import tempfile
import uuid

from make_python import get_python_interpreter_args
from utils import (
download_file,
extract_7z_archive,
verify_7z_archive,
update_env_path,
verify_7z_archive,
)
from make_python import get_python_interpreter_args

SOURCE_DIR = ""
OUTPUT_DIR = ""
Expand Down Expand Up @@ -147,15 +146,14 @@ def prepare() -> None:
os.remove(old_cmakelist_path)

os.rename(cmakelist_path, old_cmakelist_path)
with open(old_cmakelist_path) as old_cmakelist:
with open(cmakelist_path, "w") as cmakelist:
for line in old_cmakelist:
new_line = line.replace(
" set(HAS_LIBXSLT 1)",
" #set(HAS_LIBXSLT 1)",
)

cmakelist.write(new_line)
with open(old_cmakelist_path) as old_cmakelist, open(cmakelist_path, "w") as cmakelist:
for line in old_cmakelist:
new_line = line.replace(
" set(HAS_LIBXSLT 1)",
" #set(HAS_LIBXSLT 1)",
)

cmakelist.write(new_line)


def remove_broken_shortcuts(python_home: str) -> None:
Expand Down
Loading
Loading