@m_adam OK this is really weird. I tried this over and over yesterday for several hours. this morning it is working fine! It must have been a case of restarting my machine or something. All set on my end! Thanks for testing either way, much appreciated!
Best posts made by reubenlara
Latest posts made by reubenlara
As you can see from the attached image, R25 won't highlight the following parameter:
[c4d.ID_BASEOBJECT_COLOR]
I'm using this to programmatically change the Display Color of a null, but it doesn't highlight in orange in either the Script Editor (when I type it) or the Script Log (when I manually change the color to trace a call), and since it doesn't recognize it, it throws an error. The same script highlights orange and runs fine in R23. Unless I'm missing something, I believe this is a bug?
@m_magalhaes ah ok thanks for the clarification. So, at this point, you can confirm that this is a bug and not a mistake in implementation on my part?
@m_magalhaes Excellent thank you! Will you post the results here? Or is there a another link I should follow?
Hello! My script relies on selection order and works fine. however, when I undo and run the script again immediately, the selection order is changed (somewhat reversed), and it toggles the reversal consistently. Why is it doing this? And is there a way to make sure the selection order stays constant when re-invoking the script?
You can see a clearer explanation of my problem:
in this brief screen recording
import c4d
from c4d import gui
def main():
doc.StartUndo()
selected = doc.GetActiveObjects(c4d.GETACTIVEOBJECTFLAGS_SELECTIONORDER)
#print order of object names to console
print ("start:")
names = []
for obj in selected:
names.append(obj.GetName())
print (names)
#distribute objects
for idx, ob in enumerate(selected):
doc.AddUndo(c4d.UNDOTYPE_CHANGE, ob)
print (ob.GetName())
ob[c4d.ID_BASEOBJECT_GLOBAL_POSITION,c4d.VECTOR_X] = 0
ob[c4d.ID_BASEOBJECT_GLOBAL_POSITION,c4d.VECTOR_Y] = 0
ob[c4d.ID_BASEOBJECT_GLOBAL_POSITION,c4d.VECTOR_Z] = 0 + (idx * 1000)
c4d.EventAdd()
doc.EndUndo()
if __name__=='__main__':
main()
c4d.EventAdd()
Ah yes thank you so much!
@m_magalhaes Thank you! In your example of "Check for specific key pressed", instead of "c4d.KEY_F10", how can I can I check for a character key? I'd like to use GetInputState vs. GetInputEvent for my specific script.
@reubenlara For that matter, maybe I'm going about it the wrong way with "BFM_INPUT_ASC"? How would I detect normal letters? Thank you!
Hello! I've successfully been able to detect modifier keys for my Phyton script, but can't figure out how to use "BFM_INPUT_ASC" to detect the letters "x", "y", and "z" (or any other character, for that matter). Where can i query this within the code below? Thank you!
pressedKey = 'none'
bc = c4d.BaseContainer()
if c4d.gui.GetInputState(c4d.BFM_INPUT_KEYBOARD,c4d.BFM_INPUT_CHANNEL,bc):
if bc[c4d.BFM_INPUT_QUALIFIER] & c4d.QSHIFT:
print("SHIFT PRESSED")
pressedKey = "shift"
if bc[c4d.BFM_INPUT_QUALIFIER] & c4d.QCTRL:
print("CONTROL PRESSED")
pressedKey = "control"
if bc[c4d.BFM_INPUT_QUALIFIER] & c4d.QALT:
print("ALT PRESSED")
pressedKey = "alt"