Maxscript renders saving blank/empty file - render

I am having trouble saving renders to an output file (using Maxscript). I use the following code in my script:
`render camera:$VRayCam002 frame:1 outputfile:"testscript.tif"`
When I run the code, I can see the scene render in the frame buffer, but the saved file, 'testscript.tif' is blank, i.e. the image is all black.
Any ideas what I may be doing wrong?
Thanks,

Figured out the problem. Apparently, while doing things pertaining to the render scene dialog settings in MAXScript, the actual dialog should be closed. See here from MAXScript help documentation.
With the dialog closed, the image saves properly
Also be sure to set
rendSaveFile =true and rendOutputFilename = "whatevername"

Related

Gimp Script-Fu: Delete a selection

I'm trying to write a script for Gimp that will crop an image, make a circular selection of what's left, invert the selection, and then delete the selection. I have the cropping, selection, and inversion part done, but the deleting is what's getting me.
(removed old code, see update)
That's the code I have. What's confusing me about the gimp-item-delete code is the item. I understand that I need to define my current selection as the item, but I'm not sure how to do this. If someone could explain how to do this, I would greatly appreciate it! Alternatively, if there's an easier way to do what I'm trying to do (but preferably still in a script), please let me know what you think. My knowledge of this coding is pretty limited, so simple explanations are appreciated.
UPDATE/EDIT:
Here's the (full) updated code:
; XML2 Conversation Portrait Preview Crop
(define (script-fu-xml2-convo-preview image layer)
(gimp-image-undo-group-start image)
(gimp-selection-none image)
(gimp-image-resize image 152 152 -280 -496)
(gimp-layer-resize-to-image-size layer)
(gimp-image-select-ellipse image 0 0 0 152 152)
(gimp-selection-invert image)
(gimp-displays-flush)
(gimp-drawable-edit-clear layer)
(gimp-selection-none image)
(gimp-image-undo-group-end image)
)
; populate script registration information
(script-fu-register
"script-fu-xml2-convo-preview"
"XML2 Conversation Portrait Preview Crop"
"Crops the preview window for XML2 conversation portraits."
"BaconWizard17"
"BaconWizard17"
"September 2021"
"*"
SF-IMAGE "Image" 0
SF-DRAWABLE "Layer" 0
)
; register the script within gimp menu
(script-fu-menu-register "script-fu-xml2-convo-preview" "<Image>/Marvel Mods/Skin Previews/XML2 PC")
So when I'm running this script, it appears to just crop it and doesn't delete the inverted circular selection. However, if I interact with the image in any way (click on it, duplicated it, copy/paste it, undo/redo), it will correct itself and show the properly cropped image with the deleted circular corners. When I first run the script, it also shows the incorrect image up at the top where you can pick which image you're working on, but after interacting with the image it will show the correct image. Here's an example:
The starting image that I create from the clipboard with Ctrl+Shift+V (after screenshotting it from the game using PrtScr):
Then, I run the script, which results in this:
At the top of the screen, the image shows up like this (which is the top left 152x152 pixels of the starting image:
How the image looks once I interact with it in any way (clicking on it, copy/pasting it, duplicating it, undoing/redoing the operation):
The thumbnail at the top of the screen after I interact with the image:
Maybe it's getting hung up on something during the operation? I'm not sure. I understand if this issue is unavoidable, but I would prefer to be able to just run the script and move on rather than having to interact with the image to get it to show up correctly. The image does have an alpha layer when it's pasted in.
gimp-item-delete is a memory/object management thing and is rarely used. What you are looking for is gimp-drawable-edit-clear.
Note that it should be done (together with your final gimp-selection-none) before gimp-image-undo-group-end if you want your whole script to be undone by a single Ctrl-Z.
Edit: It appears that your code works, it's just that the display isn't updated to show the result, which is exactly what gimp-display-flush is meant to do, so why is your code calling it before gimp-drawable-edit-clear? gimp-display-flush ought to be about the last thing done by your script.

P3D sketch not working in Python mode of Processing

I was translating a Java sketch to a Python sketch in Processing. It is using the P3D engine and it is not showing anything in the window while it is showing what I want in Java mode. When I run it just shows a blank black window instead of a grid. I can change its background color but I can not draw in the shapes or something window. Please help me! And I can not share its code as it is not an open source project.
It was my fault. It was a mistake in the code. I was making the grid using for loop and the variables that were needed for for loop were not defined properly it was not giving an error because the value of variables was 0. Sorry for wasting your time. Enjoy!

replace image using gtk.image.set_from_file

I'm trying to add and if needed by user, change the image from a widget in python.
I'm using Glade with gtk2+, python 2.7.3, and these is what I'm doing
image = gtk.Image()
image.set_from_file("MyImagePath.png")
image.show()
button = App.get_object('buttonExample')
button.add(image)
and this is what I get when try to change the image
GtkWarning: Attempting to add a widget with type GtkImage to a
GtkAspectFrame, but as a GtkBin subclass a GtkAspectFrame can only
contain one widget at a time; it already contains a widget of type
GtkImage
The image is loaded correctly as expected, but if I change the input path for image, I wish I could change the button image, but this is not what I'm getting.
I tried to use gtk.Image.clear(), but it says I cannot use it on a button (maybe im just messing things around)
Is there a good way to load and reload images to a button?
Thx
You either have to remove the old image from the button before adding a new one (the error message is pretty straightforward about this), or you could try changing the current image:
button.get_child().set_from_file("MyImagePath.png")
This was exactly what I needed. I used the clear in the image as you said and also cleaned the button image, as follows:
App.get_object('buttonExample').remove(image)
image.clear()
Thank you very much for you help!

image() modifies actual image content in MATLAB

I am displaying an image in figure window in MATLAB using following code.
im = imread('Image02.tif');
processAndDisplayImage(im);
hImage = image(im);
set(hImage,'ButtonDownFcn',#clickInImage);
But problem is that the third line above makes the image changed for some reason I don't know. Is there any way to get image handle without the modification?
UPDATE: Resolved the problem. Please refer to my answer below.
The image graphical command cannot change the image. I can only guess that it shows the image in a way you don't want it. Inspect the range of the image -
max(im(:));
and also the type:
class(im);
and try to figure out what is wrong
Perhaps you could modify processAndDisplayImage so that it returns a handle to the displayed image as an output variable?
Instead of
hImage = image(im);
I used following to solve my problem.
[hImage hfig ha] = imhandles(gcf);
But I still don't understand image command does to the actual image displayed on figure.

Axapta: How to load an image from a file on disk into a grid with a Window Control

I have been trying:
to load an image into a window control with a datamethod that loads the file into a bitmap, returning a bitmap. This makes Axapta Crash.
When doing the same but returning an image does not do anything.
using the "active" method on the data source has some success if I set the "imagename" to the filename and the autodecalaration property to "true" on the window component. The Grid does not refresh properly and the pictures dissappear and reappear (while you change rows) for a while until it seems satisfied and then it stays on the screen.
Any help with this will be greatly appreciated.
I found the answer - it would help if the documentation was better.
On the WindowControl: Simply link the datasource to the table containing the field with the string(text) of the full path and filename; and link the datafield to that field. Hey - it works like a charm. I have been trying to return images and bitmaps all the time from a datamethod.

Resources