Skip to content

Commit

Permalink
Merge branch 'master' into writeSTL
Browse files Browse the repository at this point in the history
  • Loading branch information
dmurdoch authored Sep 28, 2024
2 parents 338d234 + fbedc32 commit 752e825
Show file tree
Hide file tree
Showing 13 changed files with 46 additions and 25 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Package: rgl
Version: 1.3.9
Version: 1.3.11
Title: 3D Visualization Using OpenGL
Authors@R: c(person("Duncan", "Murdoch", role = c("aut", "cre"),
email = "murdoch.duncan@gmail.com"),
Expand Down
2 changes: 1 addition & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# rgl 1.3.9
# rgl 1.3.11

## Minor changes

Expand Down
6 changes: 5 additions & 1 deletion R/knitr.R
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,11 @@ fns <- local({
left = "margin-left:0;margin-right:auto;",
right = "margin-left:auto;margin-right:0;",
""))))
result <- do.call("knit_print", c(list(content, options), x$args))
# Not sure why this wasn't there for our vignettes...
if (!("screenshot.force" %in% names(options)))
options$screenshot.force <- FALSE

result <- do.call("knit_print", c(list(x = content, options = options), x$args))
if (!latex)
class(result) <- c(class(result), "knit_asis_htmlwidget")

Expand Down
13 changes: 13 additions & 0 deletions R/rglwidget.R
Original file line number Diff line number Diff line change
Expand Up @@ -241,12 +241,25 @@ asRow <- function(..., last = NA, height = NULL, colsize = 1) {
newElementId <- function(prefix)
paste0(prefix, p_sample(100000, 1))

isMarkdownHTMLformat <- function() {
output <- rmarkdown::metadata$output

if (is.list(output))
output <- names(output)

is.character(output) &&
length(output) >= 1 &&
output[1] == "markdown::html_format"
}

knitrNeedsSnapshot <- function(options = knitr::opts_current$get()) {
if (!is.null(options$snapshot))
return(options$snapshot)
if (isFALSE(options$screenshot.force))
return(FALSE)
force <- isTRUE(options$screenshot.force)
if (isMarkdownHTMLformat())
return(FALSE)
fmt <- pandoc_to()
if (!length(fmt) || force)
return(TRUE)
Expand Down
21 changes: 10 additions & 11 deletions cran-comments.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
# 1.3.1
# 1.3.10

This adds a workaround to a bug in the interaction of the
`markdown` and `knitr` packages that caused the vignettes
to attempt to produce snapshots if Pandoc was not available,
even though Pandoc is not needed.
Responded to the issues raised on the first submission.

# 1.3.0
# 1.3.9

This small release is at the request of Tomas to adapt to
upcoming changes in Rtools on Windows. It also contains
a number of other changes (mostly bug fixes and minor
improvements, described in the NEWS.md file). I ran revdep
checks and didn't see any problems.
This is a minor release, containing several bug fixes and minor
updates.

The CRAN checks identify a non-API reference to R_InputHandlers. I haven't done
anything about this yet; it isn't mentioned in the "Moving into C API
compliance" section of WRE. It's needed for the X11 display, and I
don't know an alternative.
2 changes: 1 addition & 1 deletion man/playwidget.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ be shown on the \code{"Play"} button while playing.
The height of the widget in pixels. In a pipe, this is a relative height.
}
\item{...}{Additional arguments to pass to
to \code{htmlwidgets::\link{createWidget}}.}
to \code{htmlwidgets::\link[htmlwidgets]{createWidget}}.}
}
\details{
The \code{components} are buttons to control the animation,
Expand Down
2 changes: 1 addition & 1 deletion man/plot3d.lm.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ Three plots are possible, depending on the value(s) in \code{which}:
If \code{clip_to_density} is positive, then the
surface, plane or grid will be clipped to
the region where a non-parametric density estimate
(using \code{MASS::\link{kde2d}}), normalized to have a
(using \code{MASS::\link[MASS]{kde2d}}), normalized to have a
maximum value of 1, is greater than the given value.
This will suppress parts of the plot that aren't
supported by the observed data.
Expand Down
6 changes: 3 additions & 3 deletions man/rglwidget.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ component that will hold the scene.
that don't handle WebGL. See Details below.}
\item{oldConvertBBox, fastTransparency}{See Details below.}
\item{...}{Additional arguments
to pass to \code{htmlwidgets::\link{createWidget}}.}
to pass to \code{htmlwidgets::\link[htmlwidgets]{createWidget}}.}
}
\details{
This produces a WebGL version of an RGL scene using the \pkg{htmlwidgets}
Expand All @@ -77,14 +77,14 @@ If \code{elementId} is \code{NULL} and we are not in a Shiny app,
\code{elementId} is set to a random value to facilitate re-use
of information.
To save the display to a file, use \code{htmlwidgets::\link{saveWidget}}.
To save the display to a file, use \code{htmlwidgets::\link[htmlwidgets]{saveWidget}}.
This requires \command{pandoc} to be installed.
For a snapshot, you can use
\code{htmltools::save_html(img(src=rglwidget(snapshot=TRUE)), file = ...)}.
The \code{webGLoptions} argument is a list which will
be passed when the WebGL context is created. See
the WebGL 1.0 specification on \url{https://registry.khronos.org/webgl} for possible
the WebGL 1.0 specification on \url{https://registry.khronos.org/webgl/} for possible
settings. The default in \code{rglwidget} differs
from the WebGL default by setting \code{preserveDrawingBuffer = TRUE} in order to allow other tools to read
the image, but please note that some implementations
Expand Down
7 changes: 5 additions & 2 deletions man/snapshot.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,13 @@ Ignored if \code{webshot = TRUE}.}
\details{
\code{rgl.snapshot()} is a low-level function
that copies the current RGL window from the screen. Users
should use \code{snapshot3d()} instead; it is more flexible,
should usually use \code{snapshot3d()} instead; it is more flexible,
and (if \pkg{webshot2} is installed) can take images even if
no window is showing, and they can be larger than the physical
screen.
screen. On some systems \pkg{webshot2} doesn't work reliably; if
you find \code{snapshot3d()} failing or taking a very long time
I'd recommend using \code{snapshot3d(..., webshot = FALSE)}. See
the note below about \code{RGL_USE_WEBSHOT} to make this the default.

Animations can be created in a loop modifying the scene and saving
each screenshot to a file. Various graphics programs (e.g. ImageMagick)
Expand Down
4 changes: 3 additions & 1 deletion vignettes/demos.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ vignette: >
```{r setup, include = FALSE}
knitr::opts_chunk$set(
collapse = FALSE, # Bug in knitr 1.42 requires FALSE here
comment = "#>")
comment = "#>",
snapshot = FALSE,
screenshot.force = FALSE)
library(rgl)
setupKnitr(autoprint = TRUE)
```
Expand Down
2 changes: 1 addition & 1 deletion vignettes/pkgdown.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ if (!requireNamespace("rmarkdown", quietly = TRUE)) {
warning(call. = FALSE, "These vignettes assume rmarkdown. This was not found.")
knitr::knit_exit()
}
knitr::opts_chunk$set(echo = TRUE)
knitr::opts_chunk$set(echo = TRUE, snapshot = FALSE, screenshot.force = FALSE)
library(rgl)
options(rgl.useNULL = TRUE)
setupKnitr(autoprint = TRUE)
Expand Down
2 changes: 1 addition & 1 deletion vignettes/setup.R
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ if (!requireNamespace("rmarkdown", quietly = TRUE)) {
# knitr uses it to determine whether to do
# screenshots; we don't want those. see https://github.com/rstudio/markdown/issues/115

knitr::opts_knit$set(screenshot.force = FALSE)
knitr::opts_chunk$set(screenshot.force = FALSE, snapshot = FALSE)

# knitr::opts_chunk$set(snapshot = TRUE) # for snapshots instead of dynamic

Expand Down
2 changes: 1 addition & 1 deletion vignettes/transparency.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ if (!requireNamespace("rmarkdown", quietly = TRUE)) {
warning(call. = FALSE, "These vignettes assume rmarkdown is installed. This was not found.")
knitr::knit_exit()
}
knitr::opts_chunk$set(echo = TRUE)
knitr::opts_chunk$set(echo = TRUE, snapshot = FALSE, screenshot.force = FALSE)
library(rgl)
options(rgl.useNULL = TRUE)
setupKnitr(autoprint = TRUE)
Expand Down

0 comments on commit 752e825

Please sign in to comment.