Attaching image to camera calibrator adds offset to camera
-
Hi all,
I'm having a strange bug with the camera calibrator that hopefully you may be aware of.
I create the camera, the camera calibrator tag and add an image. The Offset Y of the changes to a value, even though the Camera calibrator Image Offset Y is at 0%.
Once I manually force update the Image Offset Y to 0% it reverts the camera Offset Y.Thank you in advance!
Andre
P.S. Apologies for the big gif... Still working it out!
-
Hi @AndreAnjos I don't see any SDK related question here but more a general issue with Cinema 4D. I personally think this is due to your Take but in any case please contact the Cinema 4D support https://support.maxon.net/index.php?lang=en_US
Cheers,
Maxime. -
Hi Maxime,
Thank you for your help!
@m_adam said in Attaching image to camera calibrator adds offset to camera:
Hi @AndreAnjos I don't see any SDK related question here but more a general issue with Cinema 4D.
Mostly because the camera and take creation are all done with python, thought it could be a SDK issue.
@m_adam said in Attaching image to camera calibrator adds offset to camera:
I personally think this is due to your Take...
That's a good guess with the takes, but it does it with the Main Take active. Would you know how could it influence my main take?
@m_adam said in Attaching image to camera calibrator adds offset to camera:
...but in any case please contact the Cinema 4D support https://support.maxon.net/index.php?lang=en_US
Will do that!
Cheers,
Andre
-
@m_adam said in Attaching image to camera calibrator adds offset to camera:
but in any case please contact the Cinema 4D support https://support.maxon.net/index.php?lang=en_US
Hi Maxime,
After opening a ticket, support sent me here instead.
Perhaps this is an issue with my code...Here's a snippet to see if this replicates to you:
import c4d def create_camera(i, cam_name, lst): """ Creates a camera with the correct name, variables and user data set. """ cam = c4d.CameraObject() cam[c4d.ID_BASELIST_NAME] = '{:02d}_{}'.format(i, cam_name.capitalize()) cam[c4d.CAMERAOBJECT_TARGETDISTANCE] = 1 lst.append(cam) return lst def main(): cam_names = ['intro_1', 'stats_1', 'feature_1', 'feature_2', 'feature_3', 'feature_4', 'feature_5', 'feature_6', 'feature_7', 'feature_8', 'outro_1'] global CAMS_LST CAMS_LST = [] # Create and setup Cameras for i, cam in enumerate(cam_names, start=1): CAMS_LST = create_camera(i, cam, CAMS_LST) for cam in CAMS_LST[::-1]: doc.InsertObject(cam) outro_cal_tag = CAMS_LST[-1].MakeTag(1026818) # Camera calibrator tag outro_cal_tag[c4d.CM_IMAGE_FILENAME] = "" # <-------- Add any image path. outro_cal_tag[c4d.CM_LOUPE_SIZE_PIX] = 8 outro_cal_tag[c4d.CM_LOUPE_MAGNIFICATION] = 1 c4d.EventAdd() if __name__=='__main__': main()
Cheers!
Andre
-
hello,
we though it was not code related sorry.
Regarding your problem, it seems that with this tag there are some actions that are trigger only when you select the tag (this is done with a SceneHook)
so the most direct way i found to trigger this is to simply select the tag with.
doc.SetActiveTag(outro_cal_tag)
This trigger everything the tag need to update the camera parameters and so on. (and draw the image on the view)
If you add the tag with the UI it will be selected and kick in. So this is a "normal" behavior (strange but normal)
Cheers
Manuel -
@m_magalhaes said in Attaching image to camera calibrator adds offset to camera:
hello,
we though it was not code related sorry.
Regarding your problem, it seems that with this tag there are some actions that are trigger only when you select the tag (this is done with a SceneHook)
so the most direct way i found to trigger this is to simply select the tag with.
doc.SetActiveTag(outro_cal_tag)
This trigger everything the tag need to update the camera parameters and so on. (and draw the image on the view)
If you add the tag with the UI it will be selected and kick in. So this is a "normal" behavior (strange but normal)
Cheers
ManuelHi Manuel,
That makes sense! I couldn't understand how it was triggering in order to refresh the values, as usually the c4d.EventAdd() function does the trick.
Did it work for you then? As I've tried the code above and still no luck. I'm adding your line after the value changes.Obrigado Manuel!
Andre
-
this code doesn't work with you ?
What version of Cinema 4D are you working with ? (I'm using 20.059)
outro_cal_tag = CAMS_LST[-1].MakeTag(1026818) # Camera calibrator tag outro_cal_tag[c4d.CM_IMAGE_FILENAME] = 'what ever file' # <-------- Add any image path. outro_cal_tag[c4d.CM_LOUPE_SIZE_PIX] = 8 outro_cal_tag[c4d.CM_LOUPE_MAGNIFICATION] = 1 doc.SetActiveTag(outro_cal_tag) c4d.EventAdd()
Cheers
Manuel -
@m_magalhaes said in Attaching image to camera calibrator adds offset to camera:
this code doesn't work with you ?
What version of Cinema 4D are you working with ? (I'm using 20.059)
outro_cal_tag = CAMS_LST[-1].MakeTag(1026818) # Camera calibrator tag outro_cal_tag[c4d.CM_IMAGE_FILENAME] = 'what ever file' # <-------- Add any image path. outro_cal_tag[c4d.CM_LOUPE_SIZE_PIX] = 8 outro_cal_tag[c4d.CM_LOUPE_MAGNIFICATION] = 1 doc.SetActiveTag(outro_cal_tag) c4d.EventAdd()
Cheers
ManuelHi Manuel,
Thanks for coming back to me!
We have a copy of R20.059 and it definitely worked.
Our team currently works on R19.053 and I've tried again this morning and no luck. So not sure what's going on with it...Thank you in advance!
Andre
-
hi,
I've tried with the R19.053 and once I select the camera, the offsetY is already set to 0% (as it should)
to be sure with the code :
import c4d def create_camera(i, cam_name, lst): """ Creates a camera with the correct name, variables and user data set. """ cam = c4d.CameraObject() cam[c4d.ID_BASELIST_NAME] = '{:02d}_{}'.format(i, cam_name.capitalize()) cam[c4d.CAMERAOBJECT_TARGETDISTANCE] = 1 lst.append(cam) return lst def main(): cam_names = ['intro_1', 'stats_1', 'feature_1', 'feature_2', 'feature_3', 'feature_4', 'feature_5', 'feature_6', 'feature_7', 'feature_8', 'outro_1'] global CAMS_LST CAMS_LST = [] # Create and setup Cameras for i, cam in enumerate(cam_names, start=1): CAMS_LST = create_camera(i, cam, CAMS_LST) for cam in CAMS_LST[::-1]: doc.InsertObject(cam) outro_cal_tag = CAMS_LST[-1].MakeTag(1026818) # Camera calibrator tag outro_cal_tag[c4d.CM_IMAGE_FILENAME] = "C:\\Users\\Manuel Magalhaes\\Desktop\\texture\\CommonLizard.jpg" # <-------- Add any image path. outro_cal_tag[c4d.CM_LOUPE_SIZE_PIX] = 8 outro_cal_tag[c4d.CM_LOUPE_MAGNIFICATION] = 1 doc.SetActiveTag(outro_cal_tag) c4d.EventAdd() if __name__=='__main__': main()
-
Hi Manuel,
Right! Found the culprit... symbolcache file...
Couldn't understand how it was working for you and not for me.
After deleting symbolcache worked straight away and it seems that also works without havingdoc.SetActiveTag(outro_cal_tag)
Thank you very much for your awesome help with this!
Andre